Skip to content

Commit

Permalink
Merge pull request #4 from WebXR-iOS/main
Browse files Browse the repository at this point in the history
update things
  • Loading branch information
CrazyH2 authored Mar 21, 2024
2 parents 5e8ecdb + 9871fb4 commit f5378e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/world/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class Render {
constructor(top) {
this.top = top;

this.scene = new THREE.Scene();

this.ScreenManager = new ScreenManager(this);

this.render();
Expand Down
11 changes: 6 additions & 5 deletions src/world/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { ActionsInfoScreen } from "../screens/start/actionsInfo.js";
class Scene {
constructor(top) {
this.top = top;

this.scene = this.top.scene;

this.main();
};

main() {
var vrDisplay = this.top.vrDisplay;

// Create a three.js scene.
this.scene = new THREE.Scene();

// Create a three.js camera.
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 10000);

Expand All @@ -40,6 +40,7 @@ class Scene {
this.scene.add( light );

// Kick off the render loop.
const scope = this;
vrDisplay.requestAnimationFrame(animate);

// Create 3D objects.
Expand All @@ -54,7 +55,7 @@ class Scene {
scene.add(cube);*/

// Load Default Screen
this.top.ScreenManager.renderScreen(ActionsInfoScreen);
this.top.ScreenManager.renderScreen(new ActionsInfoScreen(this.top));

// Request animation frame loop function
var lastRender = 0;
Expand All @@ -69,7 +70,7 @@ class Scene {
controls.update();

// Render the scene.
effect.render(this.scene, camera);
effect.render(scope.scene, camera);

// Keep looping.
vrDisplay.requestAnimationFrame(animate);
Expand Down

0 comments on commit f5378e1

Please sign in to comment.