Browse Source

Because CanvasRenderer now checks if `map.loaded == true` (following WebGLRenderer behaviour) some examples got broken.

Mr.doob 14 years ago
parent
commit
93c9bb3486

+ 4 - 3
examples/geometry_panorama.html

@@ -100,16 +100,17 @@
 
 				var material = new THREE.MeshBasicMaterial( { map: new THREE.Texture( texture_placeholder, THREE.UVMapping ) } );
 
-				var texture = new Image();
+				var image = new Image();
 
-				texture.onload = function () {
+				image.onload = function () {
 
 					material.map.image = this;
+					material.map.loaded = true;
 					render();
 
 				};
 
-				texture.src = path;
+				image.src = path;
 
 				return material;
 			}

+ 17 - 16
examples/geometry_panorama_fisheye.html

@@ -28,7 +28,7 @@
 	</head>
 	<body>
 
-		<div id="container"></div> 
+		<div id="container"></div>
 		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - panorama fisheye demo. cubemap by <a href="http://www.zfight.com/" target="_blank">Jochum Skoglund</a>. (mousewheel: change fov)</div>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
@@ -99,7 +99,7 @@
 				document.addEventListener( 'mouseup', onDocumentMouseUp, false );
 				document.addEventListener( 'mousewheel', onDocumentMouseWheel, false );
 				document.addEventListener( 'DOMMouseScroll', onDocumentMouseWheel, false);
-				
+
 				document.addEventListener( 'touchstart', onDocumentTouchStart, false );
 				document.addEventListener( 'touchmove', onDocumentTouchMove, false );
 
@@ -109,16 +109,17 @@
 
 				var material = new THREE.MeshBasicMaterial( { map: new THREE.Texture( texture_placeholder, THREE.UVMapping ) } );
 
-				var texture = new Image();
+				var image = new Image();
 
-				texture.onload = function () {
+				image.onload = function () {
 
 					material.map.image = this;
+					material.map.loaded = true;
 					render();
 
 				};
 
-				texture.src = path;
+				image.src = path;
 
 				return material;
 			}
@@ -159,27 +160,27 @@
 			}
 
 			function onDocumentMouseWheel( event ) {
-				
+
 				// WebKit
-				
+
 				if ( event.wheelDeltaY ) {
-					
+
 					fov -= event.wheelDeltaY * 0.05;
-					
+
 				// Opera / Explorer 9
-				
+
 				} else if ( event.wheelDelta ) {
-					
+
 					fov -= event.wheelDelta * 0.05;
-					
+
 				// Firefox
-				
+
 				} else if ( event.detail ) {
-				
+
 					fov += event.detail * 1.0;
-				
+
 				}
-				
+
 				camera.projectionMatrix = THREE.Matrix4.makePerspective( fov, window.innerWidth / window.innerHeight, 1, 1100 );
 				render();
 

+ 5 - 2
examples/geometry_terrain.html

@@ -68,8 +68,11 @@
 				scene = new THREE.Scene();
 
 				var heightMap = height( 1024, 1024 );
-				var textureMap = shadow( heightMap );
-				var material = new THREE.MeshBasicMaterial( { map: new THREE.Texture( textureMap, THREE.UVMapping ) } );
+
+				var texture = new THREE.Texture( shadow( heightMap ), THREE.UVMapping );
+				texture.loaded = true;
+
+				var material = new THREE.MeshBasicMaterial( { map: texture } );
 
 				var quality = 20;
 				var quality1 = quality + 1;

+ 4 - 1
examples/materials_video.html

@@ -81,7 +81,10 @@
 				textureContext.fillStyle = '#000000';
 				textureContext.fillRect( 0, 0, 480, 204 );
 
-				var material = new THREE.MeshBasicMaterial( { map: new THREE.Texture( texture, THREE.UVMapping ) } );
+				var map = new THREE.Texture( texture, THREE.UVMapping );
+				map.loaded = true;
+
+				var material = new THREE.MeshBasicMaterial( { map: map } );
 
 				textureReflection = document.createElement( 'canvas' );
 				textureReflection.width = 480;