Made entire pipeline class based.
This commit is contained in:
30
ts/main.ts
30
ts/main.ts
@ -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() {
|
||||
|
Reference in New Issue
Block a user