Ejemplo n.º 1
0
        public Mesh GetMesh(string file, bool allowDuplicates = false)
        {
            //if (!resource.originalPath.EndsWith(".obj")) throw new System.Exception("Resource path does not end with .obj");

            Mesh s;

            if (allowDuplicates || !allMeshes.TryGetValue(file, out s))
            {
                s = objLoader.Load(this.FileSystem.FindExistingFile(file));
                allMeshes[file] = s;
            }
            return(s);
        }
Ejemplo n.º 2
0
        public static Mesh GetMesh(Resource resource, bool allowDuplicates = false)
        {
            if (!resource.originalPath.EndsWith(".obj"))
            {
                throw new System.Exception("Resource path does not end with .obj");
            }

            Mesh s;

            if (allowDuplicates || !allMeshes.TryGetValue(resource, out s))
            {
                s = ObjLoader.Load(resource);
                allMeshes[resource] = s;
                UnloadFactory.Add(s);
            }
            return(s);
        }
Ejemplo n.º 3
0
        //internal Dictionary<string, Mesh> allMeshes = new Dictionary<string, Mesh>();
        public static void AppendMesh(Resource resource, GameObject appendTo)
        {
            if (!resource.originalPath.EndsWith(".obj"))
            {
                throw new System.Exception("Resource path does not end with .obj");
            }

            ObjLoader.Load(resource, appendTo);

            /*Mesh s;
             * if (!allMeshes.TryGetValue(resource, out s))
             * {
             *  s = ObjLoader.Load(resource, appendTo);
             *  allMeshes[resource] = s;
             *  UnloadFactory.Add(s);
             * }
             * return s;*/
        }