예제 #1
0
 public void ScanInternal(string objMeshPath)
 {
     Mesh x = ObjImporter.ImportFile(objMeshPath);
     if (x == null)
     {
         Debug.LogError("Couldn't read .obj file at '" + objMeshPath + "'");
         return;
     }
     this.sourceMesh = x;
     base.ScanInternal();
 }
예제 #2
0
        /** Scans the graph using the path to an .obj mesh */
        public void ScanInternal(string objMeshPath)
        {
            Mesh mesh = ObjImporter.ImportFile(objMeshPath);

            if (mesh == null)
            {
                Debug.LogError("Couldn't read .obj file at '" + objMeshPath + "'");
                return;
            }

            sourceMesh = mesh;
            ScanInternal();
        }
예제 #3
0
        public void ScanInternal(string objMeshPath)
        {
            Mesh x = ObjImporter.ImportFile(objMeshPath);

            if (x == null)
            {
                Debug.LogError("Couldn't read .obj file at '" + objMeshPath + "'");
                return;
            }
            this.sourceMesh = x;
            IEnumerator <Progress> enumerator = this.ScanInternal().GetEnumerator();

            while (enumerator.MoveNext())
            {
            }
        }
        public void ScanInternal(string objMeshPath)
        {
            Mesh mesh = ObjImporter.ImportFile(objMeshPath);

            if (mesh == null)
            {
                Debug.LogError("Couldn't read .obj file at '" + objMeshPath + "'");
                return;
            }

            sourceMesh = mesh;

            var scan = ScanInternal().GetEnumerator();

            while (scan.MoveNext())
            {
            }
        }
        public static Mesh ImportFile(string filePath)
        {
            if (!File.Exists(filePath))
            {
                Debug.LogError("No file was found at '" + filePath + "'");
                return(null);
            }
            ObjImporter.meshStruct meshStruct = ObjImporter.createMeshStruct(filePath);
            ObjImporter.populateMeshStruct(ref meshStruct);
            Vector3[] array  = new Vector3[meshStruct.faceData.Length];
            Vector2[] array2 = new Vector2[meshStruct.faceData.Length];
            Vector3[] array3 = new Vector3[meshStruct.faceData.Length];
            int       num    = 0;

            Vector3[] faceData = meshStruct.faceData;
            for (int i = 0; i < faceData.Length; i++)
            {
                Vector3 vector = faceData[i];
                array[num] = meshStruct.vertices[(int)vector.x - 1];
                if (vector.y >= 1f)
                {
                    array2[num] = meshStruct.uv[(int)vector.y - 1];
                }
                if (vector.z >= 1f)
                {
                    array3[num] = meshStruct.normals[(int)vector.z - 1];
                }
                num++;
            }
            Mesh mesh = new Mesh();

            mesh.vertices  = array;
            mesh.uv        = array2;
            mesh.normals   = array3;
            mesh.triangles = meshStruct.triangles;
            mesh.RecalculateBounds();
            return(mesh);
        }