Esempio n. 1
0
 public void Setup()
 {
     objWorker = new ObjWorker
     {
         IoWorker               = new IoWorker(),
         ObjLoaderFactory       = new ObjLoaderFactory(),
         ModelToObjectConverter = new ModelToMeshConverter()
     };
 }
Esempio n. 2
0
        private Mesh GetMesh(SceneFormat.SceneObject parsedObject)
        {
            switch (parsedObject.MeshCase)
            {
            case SceneFormat.SceneObject.MeshOneofCase.Sphere:
                return(new Sphere((float)parsedObject.Sphere.Radius));

            case SceneFormat.SceneObject.MeshOneofCase.Cube:
                return(new Box(ConvertVector(parsedObject.Cube.Size) * 0.5f));

            case SceneFormat.SceneObject.MeshOneofCase.Plane:
                return(new Plane());

            case SceneFormat.SceneObject.MeshOneofCase.Disk:
                return(new Disk((float)parsedObject.Disk.Radius));

            case SceneFormat.SceneObject.MeshOneofCase.MeshedObject:
                return(ObjWorker.Parse(parsedObject.MeshedObject.Reference));

            default:
                throw new Exception("Unsupported mesh");
            }
        }
Esempio n. 3
0
 public virtual void LoadFromObj(string filename)
 {
     ObjWorker.GetInstance().LoadObj(filename, out Vertices, out UVs, out Normals, out VertexIndices);
 }