Browse Source

don't use setClearColor except where appropriate

Gregg Tavares 6 years ago
parent
commit
2f5d90716e

+ 0 - 2
threejs/background.html

@@ -40,7 +40,6 @@ function main() {
   const canvas = document.querySelector('#c');
   const renderer = new THREE.WebGLRenderer({canvas: canvas});
   const scene = new THREE.Scene();
-  scene.background = new THREE.Color().setHSL(0.6, 0, 1);
 
   const aspect = 2;  // the canvas default
   const fov = 35;
@@ -62,7 +61,6 @@ function main() {
     controls.update();
   }
 
-  renderer.setClearColor(0xAACCFF);
   renderer.gammaInput = true;
   renderer.gammaOutput = true;
   renderer.shadowMap.enabled = true;

+ 2 - 3
threejs/lessons/threejs-primitives.md

@@ -81,9 +81,8 @@ with the [examples from the previous article](threejs-responsive.html).
 Near the top let's set a background color
 
 ```
-const canvas = document.querySelector('#c');
-const renderer = new THREE.WebGLRenderer({canvas: canvas});
-+renderer.setClearColor(0xAAAAAA);
+const scene = new THREE.Scene();
++scene.background = new THREE.Color(0xAAAAAA);
 ```
 
 This tells three.js to clear to lightish gray.

+ 1 - 1
threejs/threejs-primitives-text.html

@@ -28,7 +28,6 @@
 function main() {
   const canvas = document.querySelector('#c');
   const renderer = new THREE.WebGLRenderer({canvas: canvas});
-  renderer.setClearColor(0xAAAAAA);
 
   const fov = 40;
   const aspect = 2;  // the canvas default
@@ -38,6 +37,7 @@ function main() {
   camera.position.z = 40;
 
   const scene = new THREE.Scene();
+  scene.background = new THREE.Color(0xAAAAAA);
 
   {
     const color = 0xFFFFFF;

+ 1 - 1
threejs/threejs-primitives.html

@@ -28,7 +28,6 @@
 function main() {
   const canvas = document.querySelector('#c');
   const renderer = new THREE.WebGLRenderer({canvas: canvas});
-  renderer.setClearColor(0xAAAAAA);
 
   const fov = 40;
   const aspect = 2;  // the canvas default
@@ -38,6 +37,7 @@ function main() {
   camera.position.z = 120;
 
   const scene = new THREE.Scene();
+  scene.background = new THREE.Color(0xAAAAAA);
 
   {
     const color = 0xFFFFFF;