Made entire pipeline class based.

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

View File

@ -1,35 +1,35 @@
import { Camera } from "./display/Camera";
import { Quad } from "./display/Quad";
import { Shader } from "./display/Shader";
import { Game, gameSetMain } from "./game/Game";
import { Scene } from "./scene/Scene";
class TestScene extends Scene {
private quad:Primitive;
private quad:Quad;
private camera:Camera;
private shader:Shader;
private texture:Texture;
private texture:CTexture;
init() {
this.quad = primitiveCreate();
quadInit(this.quad, 0,
-1, -1, 0, 0,
1, 1, 1, 1
);
this.quad = new Quad();
this.shader = this.game.assets.shaderLoad(
"shaders/textured.vert", "shaders/textured.frag", this
);
this.texture = this.game.assets.textureLoad("test_texture.png", this);
this.camera = cameraCreate();
cameraLookAt(this.camera, 3,3,3, 0,0,0);
cameraPerspective(this.camera, 45, 16/9, 0.01, 1000);
this.camera = new Camera();
}
update() {
shaderUse(this.shader);
shaderUseCamera(this.shader, this.camera);
shaderUsePosition(this.shader, 0,0,0, 0,this.game.time.current,0);
shaderUseTexture(this.shader, this.texture);
primitiveDraw(this.quad, 0, -1);
this.camera.perspective(45, 16/9, 0.01, 100);
this.camera.lookAt(3,3,3, 0,0,0);
this.shader.use();
this.shader.setCamera(this.camera);
this.shader.setPosition(0,0,0, 0,this.game.time.current,0);
this.shader.setTexture(this.texture);
this.quad.draw();
}
dispose() {