This commit is contained in:
Kbz-8
2024-01-27 13:42:21 +01:00
parent d0b0d83209
commit adf35bd66a
2 changed files with 32 additions and 9 deletions

View File

@ -16,7 +16,6 @@ export default class extends AbstractView
this.gl = null;
this.shader_prog = null;
this.buffers = null;
this.rotation = 0.0;
this.programInfo = null;
}
@ -46,6 +45,9 @@ export default class extends AbstractView
normalMatrix: this.gl.getUniformLocation(this.shader_prog, "uNormalMat"),
},
};
this.gl.enable(this.gl.CULL_FACE);
this.gl.cullFace(this.gl.BACK);
}
async join_game()
@ -77,7 +79,7 @@ export default class extends AbstractView
this.gl.depthFunc(this.gl.LEQUAL);
this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT);
const fieldOfView = (45 * Math.PI) / 180;
const fieldOfView = (90 * Math.PI) / 180;
const aspect = this.gl.canvas.clientWidth / this.gl.canvas.clientHeight;
const zNear = 0.1;
const zFar = 100.0;
@ -96,12 +98,8 @@ export default class extends AbstractView
projectionMatrix
);
this.rotation += 0.025;
this.renderCube(0.0, 0.0, -15.0, this.rotation);
this.renderCube(0.0, 1.0, -15.0, this.rotation + 0.1);
this.renderCube(-2.0, 0.0, -15.0, this.rotation + 4.3);
this.renderCube(2.0, 3.0, -15.0, this.rotation - 12.4, 5);
// rendering player bar
this.renderCube(0.0, -5.0, -8.0, 0.0, 5);
}
renderCube(x, y, z, angle = 0, sx = 1, sy = 1, sz = 1)