Esempio n. 1
0
		private void ParseTris(TextParser parser, ModelBlockPrimBase submesh)
		{
			var tmp = new ComplexIndex[3];
			for (;;)
			{
				var attribute = parser.Lexem;
				if (attribute == "}")
				{
					parser.Consume();
					break;
				}
				if (attribute == "numTris")
				{
					parser.Consume();
					submesh.Indices.Capacity = submesh.Indices.Count + parser.ConsumeInt();
					continue;
				}
				if (attribute == "t")
				{
					parser.Consume();
					ParseTriangle(parser, tmp);
					submesh.Indices.Add(tmp[0]);
					submesh.Indices.Add(tmp[2]);
					submesh.Indices.Add(tmp[1]);
					continue;
				}
				parser.UnknownLexemError();
			}
		}
Esempio n. 2
0
		private void ParseQuads(TextParser parser, ModelBlockPrimBase submesh)
		{
			var tmp = new ComplexIndex[4];
			int startIndex = submesh.Indices.Count;
			for (;;)
			{
				var attribute = parser.Lexem;
				if (attribute == "}")
				{
					parser.Consume();
					break;
				}
				if (attribute == "numQuads")
				{
					parser.Consume();
					submesh.Indices.Capacity = startIndex + parser.ConsumeInt() * 2;
					continue;
				}
				if (attribute == "q")
				{
					parser.Consume();
					ParseQuad(parser, tmp);
					submesh.Indices.Add(tmp[0]);
					submesh.Indices.Add(tmp[2]);
					submesh.Indices.Add(tmp[1]);
					submesh.Indices.Add(tmp[0]);
					submesh.Indices.Add(tmp[3]);
					submesh.Indices.Add(tmp[2]);
					continue;
				}
				parser.UnknownLexemError();
			}
		}