public static Mesh Load(Resource resource, GameObject appendToGameObject = null)
        {
            var mesh = new ObjLoader().Parse(resource, appendToGameObject);

            mesh.resource = resource;
            return(mesh);
        }
Esempio 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);
        }
Esempio 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;*/
        }