From 9765c1a72bd0a0379196459428ba98f67684b7ad Mon Sep 17 00:00:00 2001 From: CrazyH <87752773+CrazyH2@users.noreply.github.com> Date: Thu, 21 Mar 2024 07:49:45 +0000 Subject: [PATCH 1/2] Update render.js --- src/world/render.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/world/render.js b/src/world/render.js index cf263ea..5127ed4 100644 --- a/src/world/render.js +++ b/src/world/render.js @@ -8,9 +8,10 @@ import { ScreenManager } from "./../screens/screenManager.js"; class Render { constructor(top) { this.top = top; - this.render(); this.ScreenManager = new ScreenManager(this); + + this.render(); }; render() { From 37cf893a52cf2593ce91b7c01cf6554ea50c0488 Mon Sep 17 00:00:00 2001 From: CrazyH <87752773+CrazyH2@users.noreply.github.com> Date: Thu, 21 Mar 2024 08:31:25 +0000 Subject: [PATCH 2/2] updarte --- src/screens/screenManager.js | 2 +- src/world/scene.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/screens/screenManager.js b/src/screens/screenManager.js index 5a5a401..9c18dad 100644 --- a/src/screens/screenManager.js +++ b/src/screens/screenManager.js @@ -8,7 +8,7 @@ class ScreenManager { }; renderScreen(screenGroup) { - this.root.scene.scene.background = new THREE.Color(0x000000); + this.root.scene.background = new THREE.Color(0x000000); screenGroup.render(screenGroup.renderGroup); diff --git a/src/world/scene.js b/src/world/scene.js index 87a8858..cf7f080 100644 --- a/src/world/scene.js +++ b/src/world/scene.js @@ -14,7 +14,7 @@ class Scene { var vrDisplay = this.top.vrDisplay; // Create a three.js scene. - var scene = new THREE.Scene(); + this.scene = new THREE.Scene(); // Create a three.js camera. var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 10000); @@ -26,7 +26,7 @@ class Scene { ); reticle.position.z = -0.5; camera.add(reticle); - scene.add(camera); + this.scene.add(camera); // Apply VR headset positional data to camera. var controls = new THREE.DeviceOrientationControls(camera); @@ -37,7 +37,7 @@ class Scene { // Add a light and sky var light = new THREE.DirectionalLight(0xffffff, 0.4); - scene.add( light ); + this.scene.add( light ); // Kick off the render loop. vrDisplay.requestAnimationFrame(animate); @@ -69,7 +69,7 @@ class Scene { controls.update(); // Render the scene. - effect.render(scene, camera); + effect.render(this.scene, camera); // Keep looping. vrDisplay.requestAnimationFrame(animate);