Beispiel #1
0
    public void LoadFile(string filePath)
    {
        ImportObj iobj = new ImportObj();

        Debug.Log(filePath);
        iobj.ImportObjFromFile(filePath);
    }
Beispiel #2
0
        private void Start()
        {
            IntegrationTestManager testManager = new IntegrationTestManager();
            Mesh mesh = testManager.mesh;

            // OBJ with UVs
            mesh.persistence.Load("test_files/vive_teleporter");
            testManager.Assert(mesh.vertices.vertices.Count == 101);
            testManager.Assert(mesh.triangles.triangles.Count == 336);
            testManager.Assert(mesh.materials.MaterialNames().Count == 112);
            testManager.Assert(mesh.materials.GetMaterials().Count == 4);

            mesh.vertices.BuildVertices();
            mesh.triangles.BuildTriangles();

            testManager.Assert(mesh.uMesh.uv.Length == 101);

            testManager.CreateBox();

            testManager.Assert(mesh.vertices.vertices.Count == 109);
            testManager.Assert(mesh.triangles.triangles.Count == 372);
            testManager.Assert(mesh.triangles.triangleInstances.Count == 124);
            testManager.Assert(mesh.materials.GetMaterials().Count == 5);
            testManager.Assert(mesh.materials.GetTriangleIndexMaterialIndex().Count == 124);

            mesh.persistence.Save("Temp/test.obj");

            ImportObj importObj = new ImportObj();

            importObj.Load("Temp/test.obj");
            testManager.Assert(importObj.vertices.Count == 109);
            testManager.Assert(importObj.uvs.Count == 109);
            testManager.Assert(importObj.triangles.Count == 372);
            testManager.Assert(importObj.materialNames.Count == 124);
            testManager.Assert(importObj.materials.Count == 5);

            testManager.Assert(File.Exists("Temp/test.obj"));
            File.Delete("Temp/test.obj");
            testManager.Assert(File.Exists("Temp/test.mtl"));
            File.Delete("Temp/test.mtl");

            IntegrationTest.Pass(gameObject);
        }
        private void Start()
        {
            IntegrationTestManager testManager = new IntegrationTestManager();
            //MeshController meshController = testManager.meshController;

            ImportObj importObj = new ImportObj();

            importObj.Load("test_files/vive_teleporter.obj");
            testManager.Assert(importObj.vertices.Count == 101);
            testManager.Assert(importObj.uvs.Count == 101);
            testManager.Assert(importObj.triangles.Count == 336);
            testManager.Assert(importObj.materialNames.Count == 112);
            testManager.Assert(importObj.materials.Count == 4);

            importObj.Clear();
            importObj.Load("test_files/pikachu.obj");
            testManager.Assert(importObj.vertices.Count == 208);
            testManager.Assert(importObj.uvs.Count == 0);
            testManager.Assert(importObj.triangles.Count == 412 * 3);
            testManager.Assert(importObj.materialNames.Count == 412);
            testManager.Assert(importObj.materials.Count == 2);

            IntegrationTest.Pass(gameObject);
        }
        private void Start()
        {
            IntegrationTestManager testManager = new IntegrationTestManager();
            Mesh mesh = testManager.mesh;

            // ------------------
            // OBJ with UVs
            // ------------------
            mesh.persistence.Load("test_files/vive_teleporter");
            testManager.Assert(mesh.vertices.vertices.Count == 101);
            testManager.Assert(mesh.triangles.triangles.Count == 336);
            testManager.Assert(mesh.materials.MaterialNames().Count == 112);
            testManager.Assert(mesh.materials.GetMaterials().Count == 4);

            mesh.vertices.BuildVertices();
            mesh.triangles.BuildTriangles();

            testManager.Assert(mesh.uMesh.uv.Length == 101);

            mesh.persistence.Save("Temp/test.obj");

            ImportObj importObj = new ImportObj();

            importObj.Load("Temp/test.obj");
            testManager.Assert(importObj.vertices.Count == 101);
            testManager.Assert(importObj.uvs.Count == 101);
            testManager.Assert(importObj.triangles.Count == 336);
            testManager.Assert(importObj.materialNames.Count == 112);
            testManager.Assert(importObj.materials.Count == 4);

            testManager.Assert(File.Exists("Temp/test.obj"));
            File.Delete("Temp/test.obj");
            testManager.Assert(File.Exists("Temp/test.mtl"));
            File.Delete("Temp/test.mtl");

            testManager.Clear();
            importObj.Clear();

            // ------------------
            // OBJ without UVs
            // ------------------
            mesh.persistence.Load("test_files/pikachu");
            testManager.Assert(mesh.vertices.vertices.Count == 208);
            testManager.Assert(mesh.triangles.triangles.Count == 412 * 3);
            testManager.Assert(mesh.materials.MaterialNames().Count == 412);
            testManager.Assert(mesh.materials.GetMaterials().Count == 2);

            mesh.vertices.BuildVertices();
            mesh.triangles.BuildTriangles();

            testManager.Assert(mesh.uMesh.uv.Length == 208);

            mesh.persistence.Save("Temp/test.obj");

            importObj.Load("Temp/test.obj");
            testManager.Assert(importObj.vertices.Count == 208);
            testManager.Assert(importObj.uvs.Count == 208);
            testManager.Assert(importObj.triangles.Count == 412 * 3);
            testManager.Assert(importObj.materialNames.Count == 412);
            testManager.Assert(importObj.materials.Count == 2);

            testManager.Assert(File.Exists("Temp/test.obj"));
            File.Delete("Temp/test.obj");
            testManager.Assert(File.Exists("Temp/test.mtl"));
            File.Delete("Temp/test.mtl");

            IntegrationTest.Pass(gameObject);
        }