WestLangley 10 ani în urmă
părinte
comite
d14d55862c
2 a modificat fișierele cu 12 adăugiri și 18 ștergeri
  1. 3 6
      examples/obj/lightmap/lightmap.js
  2. 9 12
      examples/webgl_materials_lightmap.html

+ 3 - 6
examples/obj/lightmap/lightmap.js

@@ -21,8 +21,7 @@
 	"DbgIndex" : 0,
 	"DbgName" : "redstone",
 	"blending" : "NormalBlending",
-	"colorAmbient" : [0.8, 0.3736, 0.2799],
-	"colorDiffuse" : [0.8, 0.3736, 0.2799],
+	"colorDiffuse" : [0.64, 0.13957696, 0.078344],
 	"colorSpecular" : [0.067, 0.067, 0.067],
 	"depthTest" : true,
 	"depthWrite" : true,
@@ -49,8 +48,7 @@
 	"DbgIndex" : 1,
 	"DbgName" : "floor",
 	"blending" : "NormalBlending",
-	"colorAmbient" : [0.8, 0.72, 0.6],
-	"colorDiffuse" : [0.8, 0.72, 0.6],
+	"colorDiffuse" : [0.64, 0.5184, 0.36],
 	"colorSpecular" : [0.067, 0.067, 0.067],
 	"depthTest" : true,
 	"depthWrite" : true,
@@ -77,8 +75,7 @@
 	"DbgIndex" : 1,
 	"DbgName" : "stone",
 	"blending" : "NormalBlending",
-	"colorAmbient" : [0.8, 0.5184, 0.36],
-	"colorDiffuse" : [0.8, 0.5184, 0.36],
+	"colorDiffuse" : [0.64, 0.26874, 0.1296],
 	"colorSpecular" : [0.067, 0.067, 0.067],
 	"depthTest" : true,
 	"depthWrite" : true,

+ 9 - 12
examples/webgl_materials_lightmap.html

@@ -69,7 +69,7 @@
 			var SCREEN_WIDTH = window.innerWidth;
 			var SCREEN_HEIGHT = window.innerHeight;
 
-			var container,stats;
+			var container, stats;
 			var camera, scene, renderer;
 
 			var clock = new THREE.Clock();
@@ -85,18 +85,17 @@
 				// CAMERA
 
 				camera = new THREE.PerspectiveCamera( 40, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 10000 );
-				camera.position.x = 700;
-				camera.position.z = -500;
-				camera.position.y = 180;
+				camera.position.set( 700, 200, - 500 );
 
 				// SCENE
 
 				scene = new THREE.Scene();
-				scene.fog = new THREE.Fog( 0xffffff, 1000, 10000 );
 
 				// CONTROLS
 
 				controls = new THREE.OrbitControls( camera );
+				controls.maxPolarAngle = 0.9 * Math.PI / 2;
+				controls.enableZoom = false;
 
 				// LIGHTS
 
@@ -117,8 +116,6 @@
 				};
 				uniforms.topColor.value.copy( hemiLight.color );
 
-				scene.fog.color.copy( uniforms.bottomColor.value );
-
 				var skyGeo = new THREE.SphereGeometry( 4000, 32, 15 );
 				var skyMat = new THREE.ShaderMaterial( {
 					uniforms: uniforms,
@@ -133,10 +130,8 @@
 				// RENDERER
 
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setClearColor( scene.fog.color );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
-				renderer.domElement.style.position = "relative";
 				container.appendChild( renderer.domElement );
 
 				renderer.gammaInput = true;
@@ -152,8 +147,10 @@
 				var loader = new THREE.JSONLoader();
 				loader.load( "obj/lightmap/lightmap.js", function ( geometry, materials ) {
 
-					for( var i = 0; i < materials.length; i ++ ) {
-						materials[i].lightMapIntensity = 0.75;
+					for ( var i = 0; i < materials.length; i ++ ) {
+
+						materials[ i ].lightMapIntensity = 0.75;
+
 					}
 
 					var mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) );
@@ -189,8 +186,8 @@
 
 			}
 
-
 		</script>
 
 	</body>
+
 </html>