Made entire pipeline class based.

This commit is contained in:
2021-09-26 01:45:07 -07:00
parent 00ea49ed74
commit ef021aa200
8 changed files with 145 additions and 46 deletions

View File

@ -1,10 +1,12 @@
import { Shader } from "../display/Shader";
export interface IAssetOwner {
}
export class AssetManager {
private owners:{ [key:string]:IAssetOwner[] };
private textures:{ [key:string]:Texture };
private textures:{ [key:string]:CTexture };
private shaders:{ [key:string]:Shader };
constructor() {
@ -18,7 +20,7 @@ export class AssetManager {
this.owners[name].push(owner);
}
public textureLoad(name:string, owner:IAssetOwner):Texture {
public textureLoad(name:string, owner:IAssetOwner):CTexture {
this.addOwner(name, owner);
if(this.textures[name]) return this.textures[name];
this.textures[name] = textureCreate();
@ -29,8 +31,8 @@ export class AssetManager {
public shaderLoad(vert:string, frag:string, owner:IAssetOwner):Shader {
this.addOwner(vert, owner);
if(this.shaders[vert]) return this.shaders[vert];
this.shaders[vert] = shaderCreate();
assetShaderLoad(this.shaders[vert], vert, frag);
this.shaders[vert] = new Shader();
assetShaderLoad(this.shaders[vert]._shader, vert, frag);
return this.shaders[vert];
}