Пример #1
0
		void CreatePhong(Fx.ColladaPhong phong, H1.Tags.shader_transparent_chicago_group shader)
		{
			if (shader.Maps.Count > 0 && !shader.Maps[0].Map.Datum.IsNull)
			{
				phong.Diffuse.Color = null;
				phong.Diffuse.Texture = CreateTexture(shader.Maps[0].Map.Datum, 0);
			}
		}
Пример #2
0
		void CreatePhong(Fx.ColladaPhong phong, H1.Tags.shader_model_group shader)
		{
			if (shader.BaseMap.Datum != DatumIndex.Null)
			{
				phong.Diffuse.Color = null;
				phong.Diffuse.Texture = CreateTexture(shader.BaseMap.Datum, 0);
			}

			phong.Specular.Color.SetColor(shader.PerpendicularTintColor, 1);
		}
Пример #3
0
		void CreatePhong(Fx.ColladaPhong phong, H1.Tags.shader_transparent_chicago_extended_group shader)
		{
			DatumIndex bitmap_datum = DatumIndex.Null;
			if (shader._4StageMaps.Count > 0)
				bitmap_datum = shader._4StageMaps[0].Map.Datum;
			else if (shader._2StageMaps.Count > 0)
				bitmap_datum = shader._2StageMaps[0].Map.Datum;

			if (bitmap_datum != DatumIndex.Null)
			{
				phong.Diffuse.Color = null;
				phong.Diffuse.Texture = CreateTexture(bitmap_datum, 0);
			}
		}
Пример #4
0
		///-------------------------------------------------------------------------------------------------
		/// <summary>	Creates a vertex index list from a gbxmodel geometry part. </summary>
		/// <param name="part">		   	The part to create an index list from. </param>
		/// <param name="index_offset">	The amount to offset the indices by. </param>
		/// <returns>	The new indices model. </returns>
		///-------------------------------------------------------------------------------------------------
		private List<int> CreateIndicesModel(H1.Tags.gbxmodel_group.model_geometry_block.model_geometry_part_block part,
			int index_offset)
		{
			// add the strip indices to an easier to handle index list, ignoring invalid indices
			var index_list = new List<int>();
			foreach(var triangle in part.Triangles)
			{
				index_list.Add(triangle.VertexIndex0 + index_offset);
				if(triangle.VertexIndex1 != -1) index_list.Add(triangle.VertexIndex1 + index_offset);
				if(triangle.VertexIndex2 != -1) index_list.Add(triangle.VertexIndex2 + index_offset);
			}

			// return the index list after converting to a triangle list
			return ConvertTriStripToList(index_list, true);
		}
Пример #5
0
		void CreatePhong(Fx.ColladaPhong phong, H1.Tags.shader_environment_group shader)
		{
			if (shader.BaseMap.Datum == DatumIndex.Null)
				phong.Diffuse.Color.SetColor(shader.MaterialColor, 1);
			else
			{
				phong.Diffuse.Color = null;
				phong.Diffuse.Texture = CreateTexture(shader.BaseMap.Datum, 0);
			}

			if (shader.Flags.Test(1) && (shader.BumpMap.Datum != DatumIndex.Null))
			{
				phong.Transparent.Color = null;
				phong.Transparent.Texture = CreateTexture(shader.BumpMap.Datum, 0);
				phong.Transparent.Opaque = Enums.ColladaFXOpaqueEnum.A_ONE;
			}

			phong.Specular.Color.SetColor(shader.PerpendicularColor, 1);
		}
Пример #6
0
		/// <summary>
		/// Creates a vertex index list from a set of bsp surfaces
		/// </summary>
		/// <param name="definition">The bsp tag definition</param>
		/// <param name="surface_offset">The surface index to start collecting indices from</param>
		/// <param name="surface_count">The number of surfaces to collect indices from</param>
		/// <param name="index_offset">The amount to offset the collected indices by</param>
		/// <returns></returns>
		List<int> CreateIndicesBSP(H1.Tags.structure_bsp_group definition, int surface_offset, int surface_count, int index_offset)
		{
			List<int> indices = new List<int>();

			for (int i = 0; i < surface_count; i++)
			{
				indices.Add(definition.Surfaces[surface_offset + i].A3 + index_offset);
				indices.Add(definition.Surfaces[surface_offset + i].A2 + index_offset);
				indices.Add(definition.Surfaces[surface_offset + i].A1 + index_offset);
			}

			return indices;
		}
Пример #7
0
		void CreatePhong(Fx.ColladaPhong phong, H1.Tags.shader_transparent_glass_group shader)
		{
			if (shader.DiffuseMap.Datum != DatumIndex.Null)
			{
				phong.Diffuse.Color = null;
				phong.Diffuse.Texture = CreateTexture(shader.DiffuseMap.Datum, 0);
			}
		}