Explorar o código

Another batch of examples resizing fixes.

This thing is neverending story ...
alteredq %!s(int64=13) %!d(string=hai) anos
pai
achega
d2ea31a0f7
Modificáronse 36 ficheiros con 252 adicións e 54 borrados
  1. 2 2
      examples/canvas_geometry_cube.html
  2. 2 2
      examples/canvas_geometry_earth.html
  3. 2 2
      examples/canvas_geometry_hierarchy.html
  4. 2 2
      examples/canvas_geometry_terrain.html
  5. 2 2
      examples/canvas_geometry_text.html
  6. 2 2
      examples/canvas_lines.html
  7. 2 2
      examples/canvas_lines_sphere.html
  8. 2 2
      examples/canvas_materials_video.html
  9. 2 2
      examples/canvas_particles_floor.html
  10. 2 2
      examples/canvas_particles_random.html
  11. 5 3
      examples/canvas_particles_shapes.html
  12. 2 2
      examples/canvas_particles_sprites.html
  13. 2 2
      examples/canvas_particles_waves.html
  14. 2 2
      examples/canvas_sandbox.html
  15. 2 2
      examples/webgl_lines_colors.html
  16. 2 2
      examples/webgl_loader_obj.html
  17. 2 2
      examples/webgl_loader_scene.html
  18. 2 2
      examples/webgl_loader_scene_blender.html
  19. 2 2
      examples/webgl_loader_utf8.html
  20. 2 2
      examples/webgl_lod.html
  21. 2 2
      examples/webgl_materials_cars.html
  22. 2 2
      examples/webgl_materials_cars_anaglyph.html
  23. 2 2
      examples/webgl_materials_cars_camaro.html
  24. 2 2
      examples/webgl_materials_cars_camaro_crosseyed.html
  25. 2 2
      examples/webgl_materials_cars_parallaxbarrier.html
  26. 19 0
      examples/webgl_materials_cubemap.html
  27. 19 1
      examples/webgl_materials_cubemap_balls_reflection.html
  28. 19 0
      examples/webgl_materials_cubemap_balls_reflection_anaglyph.html
  29. 19 0
      examples/webgl_materials_cubemap_balls_refraction.html
  30. 17 1
      examples/webgl_materials_cubemap_balls_refraction_crosseyed.html
  31. 16 0
      examples/webgl_materials_cubemap_escher.html
  32. 19 0
      examples/webgl_materials_cubemap_refraction.html
  33. 14 0
      examples/webgl_materials_grass.html
  34. 20 0
      examples/webgl_materials_normalmap.html
  35. 17 0
      examples/webgl_materials_shaders.html
  36. 20 1
      examples/webgl_materials_shaders_fresnel.html

+ 2 - 2
examples/canvas_geometry_cube.html

@@ -100,8 +100,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_geometry_earth.html

@@ -124,8 +124,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_geometry_hierarchy.html

@@ -90,8 +90,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_geometry_terrain.html

@@ -106,8 +106,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_geometry_text.html

@@ -128,8 +128,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_lines.html

@@ -106,8 +106,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_lines_sphere.html

@@ -120,8 +120,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_materials_video.html

@@ -174,8 +174,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_particles_floor.html

@@ -97,8 +97,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_particles_random.html

@@ -90,8 +90,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 5 - 3
examples/canvas_particles_shapes.html

@@ -190,9 +190,11 @@
 
 				};
 
-				var onParticleCreated = function(p) {
+				var onParticleCreated = function( p ) {
+
 					var position = p.position;
 					p.target.position = position;
+
 				};
 
 				var onParticleDead = function(particle) {
@@ -246,8 +248,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_particles_sprites.html

@@ -81,8 +81,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_particles_waves.html

@@ -102,8 +102,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/canvas_sandbox.html

@@ -164,8 +164,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_lines_colors.html

@@ -185,8 +185,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_loader_obj.html

@@ -120,8 +120,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_loader_scene.html

@@ -319,8 +319,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_loader_scene_blender.html

@@ -286,8 +286,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_loader_utf8.html

@@ -133,8 +133,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_lod.html

@@ -134,8 +134,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_materials_cars.html

@@ -475,8 +475,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_materials_cars_anaglyph.html

@@ -470,8 +470,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_materials_cars_camaro.html

@@ -148,8 +148,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_materials_cars_camaro_crosseyed.html

@@ -158,8 +158,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 2 - 2
examples/webgl_materials_cars_parallaxbarrier.html

@@ -470,8 +470,8 @@
 
 			function onWindowResize() {
 
-				windowHalfX = window.innerWidth / 2,
-				windowHalfY = window.innerHeight / 2,
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
 
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();

+ 19 - 0
examples/webgl_materials_cubemap.html

@@ -156,6 +156,25 @@
 
 				loader.load( "obj/walt/WaltHead_bin.js", function( geometry ) { createScene( geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3 ) } );
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				cameraCube.aspect = window.innerWidth / window.innerHeight;
+				cameraCube.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function createScene( geometry, m1, m2, m3 ) {

+ 19 - 1
examples/webgl_materials_cubemap_balls_reflection.html

@@ -79,7 +79,6 @@
 				cameraCube = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 100000 );
 				cubeTarget = new THREE.Vector3( 0, 0, 0 );
 
-
 				sceneCube.add( cameraCube );
 
 				var geometry = new THREE.SphereGeometry( 100, 32, 16 );
@@ -136,6 +135,25 @@
 				renderer.autoClear = false;
 				container.appendChild( renderer.domElement );
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2,
+				windowHalfY = window.innerHeight / 2,
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				cameraCube.aspect = window.innerWidth / window.innerHeight;
+				cameraCube.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function onDocumentMouseMove( event ) {

+ 19 - 0
examples/webgl_materials_cubemap_balls_reflection_anaglyph.html

@@ -127,7 +127,26 @@
 				renderer = new THREE.WebGLRenderer();
 				container.appendChild( renderer.domElement );
 
+				var width = window.innerWidth || 2;
+				var height = window.innerHeight || 2;
+
 				effect = new THREE.AnaglyphEffect( renderer );
+				effect.setSize( width, height );
+
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2,
+				windowHalfY = window.innerHeight / 2,
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
 				effect.setSize( window.innerWidth, window.innerHeight );
 
 			}

+ 19 - 0
examples/webgl_materials_cubemap_balls_refraction.html

@@ -132,6 +132,25 @@
 				renderer.autoClear = false;
 				container.appendChild( renderer.domElement );
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2,
+				windowHalfY = window.innerHeight / 2,
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				cameraCube.aspect = window.innerWidth / window.innerHeight;
+				cameraCube.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function onDocumentMouseMove(event) {

+ 17 - 1
examples/webgl_materials_cubemap_balls_refraction_crosseyed.html

@@ -130,9 +130,25 @@
 				effect = new THREE.CrosseyedEffect( renderer );
 				effect.setSize( window.innerWidth, window.innerHeight );
 				effect.separation = 90;
-				
+
 				document.addEventListener( 'keydown', onKeyDown, false );
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2,
+				windowHalfY = window.innerHeight / 2,
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				effect.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function onDocumentMouseMove( event ) {

+ 16 - 0
examples/webgl_materials_cubemap_escher.html

@@ -118,6 +118,22 @@
 
 				}
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function onDocumentMouseMove(event) {

+ 19 - 0
examples/webgl_materials_cubemap_refraction.html

@@ -150,6 +150,25 @@
 
 				document.addEventListener('mousemove', onDocumentMouseMove, false);
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2,
+				windowHalfY = window.innerHeight / 2,
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				cameraCube.aspect = window.innerWidth / window.innerHeight;
+				cameraCube.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function createScene( geometry, m1, m2, m3 ) {

+ 14 - 0
examples/webgl_materials_grass.html

@@ -60,6 +60,19 @@
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				document.body.appendChild( renderer.domElement );
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function generateTextureBase() {
@@ -84,6 +97,7 @@
 				context.globalCompositeOperation = 'lighter';
 
 				return canvas;
+
 			}
 
 			function generateTextureLevel( texture ) {

+ 20 - 0
examples/webgl_materials_normalmap.html

@@ -231,6 +231,26 @@
 
 				}
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
+
+				camera.left = window.innerWidth / - 2;
+				camera.right = window.innerWidth / 2;
+				camera.top = window.innerHeight / 2;
+				camera.bottom = window.innerHeight / - 2;
+
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function createScene( geometry, scale, material1, material2 ) {

+ 17 - 0
examples/webgl_materials_shaders.html

@@ -189,6 +189,23 @@
 
 				document.addEventListener('mousemove', onDocumentMouseMove, false);
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				if ( webglRenderer ) webglRenderer.setSize( window.innerWidth, window.innerHeight );
+				if ( canvasRenderer ) canvasRenderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
 			function addToruses( geometry ) {

+ 20 - 1
examples/webgl_materials_shaders_fresnel.html

@@ -143,9 +143,28 @@
 				renderer.autoClear = false;
 				container.appendChild( renderer.domElement );
 
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				windowHalfX = window.innerWidth / 2;
+				windowHalfY = window.innerHeight / 2;
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				cameraCube.aspect = window.innerWidth / window.innerHeight;
+				cameraCube.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
 			}
 
-			function onDocumentMouseMove(event) {
+			function onDocumentMouseMove( event ) {
 
 				mouseX = ( event.clientX - windowHalfX ) * 10;
 				mouseY = ( event.clientY - windowHalfY ) * 10;