Browse Source

switch to phong material

Gregg Tavares 7 years ago
parent
commit
d546089788
1 changed files with 5 additions and 1 deletions
  1. 5 1
      threejs/threejs-fundamentals-3-cubes.html

+ 5 - 1
threejs/threejs-fundamentals-3-cubes.html

@@ -27,13 +27,17 @@ function main() {
 
 
   const scene = new THREE.Scene();
   const scene = new THREE.Scene();
 
 
+  const light = new THREE.DirectionalLight(0xffffff, 1);
+  light.position.set(-1, 2, 4);
+  scene.add(light);
+
   const boxWidth = 1;
   const boxWidth = 1;
   const boxHeight = 1;
   const boxHeight = 1;
   const boxDepth = 1;
   const boxDepth = 1;
   const geometry = new THREE.BoxGeometry(boxWidth, boxHeight, boxDepth);
   const geometry = new THREE.BoxGeometry(boxWidth, boxHeight, boxDepth);
 
 
   function makeInstance(geometry, color, x) {
   function makeInstance(geometry, color, x) {
-    const material = new THREE.MeshBasicMaterial({color});
+    const material = new THREE.MeshPhongMaterial({color});
 
 
     const cube = new THREE.Mesh(geometry, material);
     const cube = new THREE.Mesh(geometry, material);
     scene.add(cube);
     scene.add(cube);