예제 #1
0
        private FaceVertex ParseFaceVertex(string vertexString)
        {
            var fields = vertexString.Split(new[]{'/'}, StringSplitOptions.None);

            var vertexIndex = fields[0].ParseInvariantInt();
            var faceVertex = new FaceVertex(vertexIndex, 0, 0);

            if(fields.Length > 1)
            {
                var textureIndex = fields[1].Length == 0 ? 0 : fields[1].ParseInvariantInt();
                faceVertex.TextureIndex = textureIndex;
            }

            if(fields.Length > 2)
            {
                var normalIndex = fields.Length > 2 && fields[2].Length == 0 ? 0 : fields[2].ParseInvariantInt();
                faceVertex.NormalIndex = normalIndex;
            }

            return faceVertex;
        }
예제 #2
0
파일: Face.cs 프로젝트: rikkit/ObjLoader
 public void AddVertex(FaceVertex vertex)
 {
     _vertices.Add(vertex);
 }