public Face(short v1, short v2, short v3) { MaterialID = 0; GroupID = 0; TexcoordIndices = new short[0]; NormalIndices = new short[0]; VertexIndices = new short[3]; VertexIndices[0] = v1; VertexIndices[1] = v2; VertexIndices[2] = v3; Usage = FaceUsage.Vertex; }
public Face(short v1, short v2, short v3, short vt1, short vt2, short vt3, short vn1, short vn2, short vn3) { MaterialID = 0; GroupID = 0; VertexIndices = new short[3]; TexcoordIndices = new short[3]; NormalIndices = new short[3]; VertexIndices[0] = v1; VertexIndices[1] = v2; VertexIndices[2] = v3; TexcoordIndices[0] = vt1; TexcoordIndices[1] = vt2; TexcoordIndices[2] = vt3; NormalIndices[0] = vn1; NormalIndices[1] = vn2; NormalIndices[2] = vn3; Usage = FaceUsage.All; }
public Face(string[] components) { MaterialID = 0; GroupID = 0; VertexIndices = new short[0]; TexcoordIndices = new short[0]; NormalIndices = new short[0]; Usage = (FaceUsage)0; int Count = (components.Length - 1) / 3; switch (Count) { case 1: VertexIndices = new short[3]; VertexIndices[0] = (short)(short.Parse(components[1]) - 1); VertexIndices[1] = (short)(short.Parse(components[2]) - 1); VertexIndices[2] = (short)(short.Parse(components[3]) - 1); Usage = FaceUsage.Vertex; break; case 2: VertexIndices = new short[3]; TexcoordIndices = new short[3]; VertexIndices[0] = (short)(short.Parse(components[1]) - 1); VertexIndices[1] = (short)(short.Parse(components[3]) - 1); VertexIndices[2] = (short)(short.Parse(components[5]) - 1); TexcoordIndices[0] = (short)(short.Parse(components[2]) - 1); TexcoordIndices[1] = (short)(short.Parse(components[4]) - 1); TexcoordIndices[2] = (short)(short.Parse(components[6]) - 1); Usage = FaceUsage.Vertex | FaceUsage.Texcoord; break; case 3: VertexIndices = new short[3]; TexcoordIndices = new short[3]; NormalIndices = new short[3]; VertexIndices[0] = (short)(short.Parse(components[1]) - 1); VertexIndices[1] = (short)(short.Parse(components[4]) - 1); VertexIndices[2] = (short)(short.Parse(components[7]) - 1); TexcoordIndices[0] = (short)(short.Parse(components[2]) - 1); TexcoordIndices[1] = (short)(short.Parse(components[5]) - 1); TexcoordIndices[2] = (short)(short.Parse(components[8]) - 1); NormalIndices[0] = (short)(short.Parse(components[3]) - 1); NormalIndices[1] = (short)(short.Parse(components[6]) - 1); NormalIndices[2] = (short)(short.Parse(components[9]) - 1); Usage = FaceUsage.All; break; } }