implement crosshair

This commit is contained in:
LabyStudio
2022-02-03 13:06:04 +01:00
parent 88db6b5e80
commit 356eab2b0c
5 changed files with 35 additions and 2 deletions
@@ -70,6 +70,7 @@ window.WorldRenderer = class {
// Get context stack of 2d canvas
this.stack2d = this.canvas2d.getContext('2d');
this.stack2d.imageSmoothingEnabled = false;
// Create texture from rendered graphics.
this.frameBuffer = new THREE.Texture(this.canvas2d)
@@ -110,6 +111,10 @@ window.WorldRenderer = class {
let cameraChunkZ = Math.floor(player.z >> 4);
this.renderChunks(cameraChunkX, cameraChunkZ);
// Clear frame buffer for 2d screen
this.stack2d.clearRect(0, 0, this.window.width, this.window.height);
this.frameBuffer.needsUpdate = true;
// Render in-game overlay
let mouseX = this.minecraft.window.mouseX;
let mouseY = this.minecraft.window.mouseY;