Пример #1
0
        public static Shader GetShader(Resource resource)
        {
            Shader s;

            if (!allShaders.TryGetValue(resource, out s))
            {
                s = new Shader(resource);
                s.Load(resource);
                allShaders[resource] = s;
                UnloadFactory.Add(s);
            }
            return(s);
        }
Пример #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);
        }