Exemple #1
0
        /// <summary>
        /// Parses and loads a line from an OBJ file.
        /// Currently only supports V, VT, F and MTLLIB prefixes
        /// </summary>
        private void processLine(string line)
        {
            string[] parts = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (parts.Length > 0)
            {
                switch (parts[0])
                {
                case "mtllib":
                    Mtl = parts[1];
                    break;

                case "v":
                    Vertex v = new Vertex();
                    v.LoadFromStringArray(parts);
                    VertexList.Add(v);
                    v.Index = VertexList.Count();
                    break;

                case "f":
                    Face f = new Face();
                    f.LoadFromStringArray(parts);
                    FaceList.Add(f);
                    break;

                case "vt":
                    TextureVertex vt = new TextureVertex();
                    vt.LoadFromStringArray(parts);
                    TextureList.Add(vt);
                    vt.Index = TextureList.Count();
                    break;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Parses and loads a line from an OBJ file.
        /// Currently only supports V, VT, F and MTLLIB prefixes
        /// </summary>		
        private void processLine(string line)
        {
            string[] parts = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (parts.Length > 0)
            {
                switch (parts[0])
                {
                    case "mtllib":
                        Mtl = parts[1];
                        break;
                    case "v":
                        Vertex v = new Vertex();
                        v.LoadFromStringArray(parts);
                        VertexList.Add(v);
                        v.Index = VertexList.Count();
                        break;
                    case "f":
                        Face f = new Face();
                        f.LoadFromStringArray(parts);
                        FaceList.Add(f);
                        break;
                    case "vt":
                        TextureVertex vt = new TextureVertex();
                        vt.LoadFromStringArray(parts);
                        TextureList.Add(vt);
                        vt.Index = TextureList.Count();
                        break;

                }
            }
        }