Ver Código Fonte

support basic (e.g. correct colors) lighting again.

still it's a bit weird as the trixls only seem to get lit from the front
and the back.
Lucas Stadler 12 anos atrás
pai
commit
a1a9e73d15
1 arquivos alterados com 13 adições e 1 exclusões
  1. 13 1
      js/pixl/public/thrixl.html

+ 13 - 1
js/pixl/public/thrixl.html

@ -121,7 +121,10 @@
121 121
				}
122 122
			}
123 123
124
			var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
124
			var material = new THREE.MeshLambertMaterial({
125
				vertexColors: true,
126
				side: THREE.DoubleSide
127
			});
125 128
			return new THREE.Mesh(chunkGeometry, material);
126 129
		}
127 130
@ -147,7 +150,14 @@
147 150
		controls.movementSpeed = 5.0;
148 151
		controls.rollSpeed = 0.75;
149 152
153
		var ambient = new THREE.AmbientLight(0x606060);
154
		scene.add(ambient);
155
156
		var light = new THREE.PointLight(0xffffff, 1, 10000);
157
		scene.add(light);
158
150 159
		var renderer = new THREE.WebGLRenderer();
160
		renderer.physicallyBasedShading = true;
151 161
		renderer.sortObjects = false;
152 162
		renderer.setClearColor(0xffffff);
153 163
		renderer.setSize(window.innerWidth, window.innerHeight);
@ -173,6 +183,8 @@
173 183
			}
174 184
175 185
			controls.update(clock.getDelta());
186
			light.position.copy(camera.position);
187
			light.rotation.copy(camera.rotation);
176 188
			renderer.render(scene, camera);
177 189
		}
178 190