Exemplo n.º 1
0
		private void ParseModelExtSelSetVert(BinaryParser parser, Model model, uint name, uint flags)
		{
			throw new NotImplementedException();
		}
Exemplo n.º 2
0
		private void ParseModelBlockVerts2D(
			BinaryParser parser, Model model, uint name, uint size, uint numItems, ushort flags)
		{
			throw new NotImplementedException("Can't read ModelBlockVerts2D");
		}
Exemplo n.º 3
0
		private void ParseModelExtSelSetFace(BinaryParser parser, Model model, uint name, uint flags)
		{
			var m_Flags = parser.ConsumeByte();
			var m_FlagsSW = parser.ConsumeByte();
			var m_FlagsHW = parser.ConsumeByte();
			var m_OTZOfsSW = parser.ConsumeSByte();
			var m_NumFaces = parser.ConsumeUInt32();
			var m_FaceIDs = parser.ConsumeUInt16Array((int)m_NumFaces);
			//bool m_WorldSet;     /** True if this set is a world file only set */
		}
Exemplo n.º 4
0
		private void ParseModelBlockVerts(BinaryParser parser, Model model, uint name, uint size, uint numItems, ushort flags)
		{
			var uniqueValues = parser.ConsumeUInt16();
			var streamMesh = (model.Meshes[0]);
			streamMesh.Vertices.Clear();
			var itemsToRead = (int)uniqueValues;
			streamMesh.Vertices.EnsureAt((int)numItems - 1);
			for (int i = 0; i < itemsToRead; ++i)
			{
				float x = parser.ConsumeFloat();
				parser.Skip(1);
				streamMesh.Vertices[i] = new Vector3(x, 0, 0);
			}
			for (int i = 0; i < itemsToRead; ++i)
			{
				float x = parser.ConsumeFloat();
				parser.Skip(1);
				streamMesh.Vertices[i] = new Vector3(streamMesh.Vertices[i].X, x, 0);
			}
			for (int i = 0; i < itemsToRead; ++i)
			{
				float x = parser.ConsumeFloat();
				parser.Skip(1);
				streamMesh.Vertices[i] = new Vector3(streamMesh.Vertices[i].X, streamMesh.Vertices[i].Y, x);
			}
			while (itemsToRead < numItems)
			{
				streamMesh.Vertices[itemsToRead] = streamMesh.Vertices[parser.ConsumeUInt16()];
				++itemsToRead;
			}

			//var len = this.uniqueValues; // this.numItems; //

			//this.Resize(this.numItems);

			//if (serialise.IsWriting())
			//{
			//    throw new NotImplementedException();
			//}

			//for (int i = 0; i < len; ++i)
			//{
			//    short x = (short)(this.verts[i].X - mediane);
			//    serialise.Int16(ref x);
			//    this.verts[i].X = x + mediane;
			//}

			//for (int i = 0; i < len; ++i)
			//{
			//    short y = (short)(this.verts[i].Y - mediane);
			//    serialise.Int16(ref y);
			//    this.verts[i].Y = y + mediane;
			//}

			//for (int i = 0; i < len; ++i)
			//{
			//    short z = (short)(this.verts[i].Z - mediane);
			//    serialise.Int16(ref z);
			//    this.verts[i].Z = z + mediane;
			//}

			//ushort[] links = new ushort[this.numItems - this.uniqueValues];
			//serialise.Serialise(ref links);
			//for (int i = this.uniqueValues; i < this.numItems; ++i)
			//{
			//    this.verts[i] = this.verts[links[i - this.uniqueValues]];
			//}
		}
Exemplo n.º 5
0
		private void ParseModelBlockTangents(
			BinaryParser parser, Model model, uint name, uint size, uint numItems, ushort flags)
		{
			var streamMesh = (model.Meshes[0]);
			streamMesh.Tangents.Clear();
			int num = (int)numItems;
			streamMesh.Tangents.Capacity = num;
			for (int i = 0; i < num; ++i)
			{
				streamMesh.Tangents.Add(parser.ConsumeVector3());
			}
		}
Exemplo n.º 6
0
		private void ParseModelBlockGLTriList(
			BinaryParser parser, Model model, uint name, uint size, uint numItems, ushort flags)
		{
			var streamMesh = (model.Meshes[0]);
			var streamSubmesh = this.context.Resolve<ModelBlockGLTriList>();
			streamSubmesh.Mesh = streamMesh;
			streamMesh.Surfaces.Add(streamSubmesh);

			streamSubmesh.Material.HashReference = parser.ConsumeUInt32();

			var indices = parser.ConsumeUInt16Array((int)numItems);
			for (int i = 0; i < indices.Length;)
			{
				UInt16 a = indices[i++];
				UInt16 b = indices[i++];
				UInt16 c = indices[i++];
				streamSubmesh.Indices.Add(a);
				streamSubmesh.Indices.Add(b);
				streamSubmesh.Indices.Add(c);
			}
			//if (serialise.IsReading())
			//{
			//    this.m_TupleIDs = new ushort[this.m_NumTupleIDs];
			//    this.prims = new _IwModelPrim[this.numItems];
			//}

			//serialise.Serialise(ref this.m_TupleIDs);

			//for (int i = 0; i < this.numItems; ++i)
			//{
			//    this.prims[i].Serialise(serialise);
			//}
		}
Exemplo n.º 7
0
		private void ParseModelBlockCols(BinaryParser parser, Model model, uint name, uint size, uint numItems, ushort flags)
		{
			var streamMesh = (model.Meshes[0]);
			int num = (int)numItems;
			streamMesh.Colors.Clear();
			streamMesh.Colors.Capacity = num;
			if (parser.ConsumeBool())
			{
				for (int i = 0; i < num; ++i)
				{
					byte b = parser.ConsumeByte();
					streamMesh.Colors.Add(Color.FromArgb(255, b, b, b));
				}
			}
			else
			{
				var c = parser.ConsumeByteArray(num * 4);
				for (int i = 0; i < num; ++i)
				{
					streamMesh.Colors.Add(Color.FromArgb(c[i + num * 3], c[i + num * 0], c[i + num * 1], c[i + num * 2]));
				}
			}
		}
Exemplo n.º 8
0
		public void RenderModel(Model model)
		{
			foreach (var mesh in model.Meshes)
			{
				this.RenderMesh(mesh);
			}
		}