Browse Source

make camera optional

Gregg Tavares 7 years ago
parent
commit
fbf6a820de
1 changed files with 5 additions and 1 deletions
  1. 5 1
      threejs/lessons/resources/threejs-lesson-utils.js

+ 5 - 1
threejs/lessons/resources/threejs-lesson-utils.js

@@ -82,7 +82,7 @@ window.threejsLessonUtils = {
     const aspect = 1;
     const zNear = 0.1;
     const zFar = 50;
-    const camera = new THREE.PerspectiveCamera(targetFOVDeg, aspect, zNear, zFar);
+    let camera = new THREE.PerspectiveCamera(targetFOVDeg, aspect, zNear, zFar);
     camera.position.z = 15;
     scene.add(camera);
 
@@ -129,6 +129,10 @@ window.threejsLessonUtils = {
       if (info.resize) {
         resizeFunctions.push(info.resize);
       }
+      if (info.camera) {
+        camera = info.camera;
+        renderInfo.camera = camera;
+      }
 
       Object.assign(settings, info);
       targetFOVDeg = camera.fov;