From a940f0542772457da57abfb8fb4009161d8a4cd5 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Mon, 5 Sep 2011 23:16:56 +0200 Subject: [PATCH] Updated examples with the new `.add`/`.remove` methods. --- examples/canvas_camera_orthographic.html | 12 ++++----- examples/canvas_geometry_birds.html | 2 +- examples/canvas_geometry_cube.html | 4 +-- examples/canvas_geometry_earth.html | 4 +-- examples/canvas_geometry_hierarchy.html | 4 +-- examples/canvas_geometry_panorama.html | 2 +- .../canvas_geometry_panorama_fisheye.html | 2 +- examples/canvas_geometry_terrain.html | 2 +- examples/canvas_geometry_text.html | 4 +-- examples/canvas_interactive_cubes.html | 4 +-- examples/canvas_interactive_cubes_tween.html | 2 +- examples/canvas_interactive_particles.html | 2 +- examples/canvas_interactive_voxelpainter.html | 16 ++++++------ examples/canvas_lights_pointlights.html | 16 ++++++------ .../canvas_lights_pointlights_smooth.html | 16 ++++++------ examples/canvas_lines.html | 4 +-- examples/canvas_lines_sphere.html | 4 +-- examples/canvas_materials.html | 14 +++++----- examples/canvas_materials_depth.html | 10 +++---- examples/canvas_materials_normal.html | 2 +- examples/canvas_materials_reflection.html | 2 +- examples/canvas_materials_video.html | 6 ++--- examples/canvas_particles_floor.html | 2 +- examples/canvas_particles_random.html | 4 +-- examples/canvas_particles_shapes.html | 10 +++---- examples/canvas_particles_sprites.html | 2 +- examples/canvas_particles_waves.html | 2 +- examples/canvas_performance.html | 12 ++++----- examples/canvas_sandbox.html | 12 ++++----- examples/misc_camera_path.html | 10 +++---- examples/misc_camera_roll.html | 18 ++++++------- examples/misc_camera_trackball.html | 16 ++++++------ examples/misc_lights_test.html | 14 +++++----- examples/misc_lookat.html | 4 +-- examples/misc_materials_multimaterials.html | 24 +++++++---------- examples/misc_sound.html | 8 +++--- examples/misc_ubiquity_test.html | 16 ++++++------ examples/webgl_animation_skinning.html | 8 +++--- examples/webgl_collada.html | 12 ++++----- examples/webgl_collisions_box.html | 6 ++--- examples/webgl_collisions_mesh.html | 6 ++--- examples/webgl_collisions_normal.html | 8 +++--- examples/webgl_collisions_primitives.html | 10 +++---- examples/webgl_collisions_reaction.html | 10 +++---- examples/webgl_collisions_terrain.html | 8 +++--- examples/webgl_collisions_trigger.html | 8 +++--- examples/webgl_custom_attributes.html | 2 +- .../webgl_custom_attributes_particles.html | 4 +-- .../webgl_custom_attributes_particles2.html | 4 +-- .../webgl_custom_attributes_particles3.html | 4 +-- examples/webgl_flycamera_earth.html | 12 ++++----- .../webgl_geometry_blenderexport_colors.html | 8 +++--- examples/webgl_geometry_colors.html | 14 +++++----- examples/webgl_geometry_dynamic.html | 6 +---- examples/webgl_geometry_hierarchy.html | 4 +-- examples/webgl_geometry_hierarchy2.html | 14 +++++----- examples/webgl_geometry_large_mesh.html | 10 +++---- examples/webgl_geometry_minecraft.html | 6 ++--- examples/webgl_geometry_minecraft_ao.html | 6 ++--- examples/webgl_geometry_shapes.html | 16 ++++++------ examples/webgl_geometry_terrain.html | 2 +- examples/webgl_geometry_terrain_fog.html | 2 +- examples/webgl_geometry_text.html | 16 ++++++------ examples/webgl_hdr.html | 4 +-- examples/webgl_interactive_cubes.html | 6 ++--- examples/webgl_interactive_voxelpainter.html | 14 +++++----- examples/webgl_lights_pointlights.html | 26 ++++++------------- examples/webgl_lines_colors.html | 2 +- examples/webgl_lines_cubes.html | 2 +- examples/webgl_lines_sphere.html | 2 +- examples/webgl_lines_splines.html | 2 +- examples/webgl_lod.html | 6 ++--- examples/webgl_lod_text.html | 6 ++--- examples/webgl_materials.html | 12 ++++----- examples/webgl_materials_cars.html | 12 ++++----- examples/webgl_materials_cars_anaglyph.html | 12 ++++----- examples/webgl_materials_cars_camaro.html | 10 +++---- ...webgl_materials_cars_camaro_crosseyed.html | 10 +++---- examples/webgl_materials_cubemap.html | 14 +++++----- ...gl_materials_cubemap_balls_reflection.html | 4 +-- ...als_cubemap_balls_reflection_anaglyph.html | 4 +-- ...gl_materials_cubemap_balls_refraction.html | 4 +-- ...ls_cubemap_balls_refraction_crosseyed.html | 4 +-- examples/webgl_materials_cubemap_escher.html | 4 +-- .../webgl_materials_cubemap_refraction.html | 14 +++++----- examples/webgl_materials_grass.html | 2 +- examples/webgl_materials_normalmap.html | 12 ++++----- examples/webgl_materials_normalmap2.html | 8 +++--- examples/webgl_materials_shaders.html | 10 +++---- examples/webgl_materials_shaders_fresnel.html | 4 +-- examples/webgl_materials_texture_filters.html | 10 +++---- examples/webgl_materials_video.html | 4 +-- examples/webgl_morphtargets.html | 6 ++--- examples/webgl_morphtargets_horse.html | 6 ++--- examples/webgl_multiple_canvases_complex.html | 14 +++++----- examples/webgl_multiple_canvases_grid.html | 14 +++++----- examples/webgl_objconvert_test.html | 17 +++++------- examples/webgl_panorama_equirectangular.html | 2 +- examples/webgl_particles_billboards.html | 4 +-- .../webgl_particles_billboards_colors.html | 4 +-- examples/webgl_particles_dynamic.html | 10 +++---- examples/webgl_particles_random.html | 2 +- examples/webgl_particles_sprites.html | 2 +- examples/webgl_performance.html | 2 +- examples/webgl_postprocessing.html | 8 +++--- examples/webgl_postprocessing_dof.html | 4 +-- examples/webgl_ribbons.html | 2 +- examples/webgl_rtt.html | 14 +++++----- examples/webgl_sandbox.html | 2 +- examples/webgl_scene_test.html | 6 ++--- examples/webgl_scene_test_blender.html | 6 ++--- examples/webgl_shader.html | 2 +- examples/webgl_shader2.html | 2 +- examples/webgl_shader_lava.html | 2 +- examples/webgl_shadowmap.html | 16 ++++++------ examples/webgl_sprites.html | 10 +++---- examples/webgl_test_memory.html | 4 +-- examples/webgl_trackballcamera_earth.html | 13 ++++------ examples/webgl_utf8loader.html | 6 ++--- 119 files changed, 435 insertions(+), 463 deletions(-) diff --git a/examples/canvas_camera_orthographic.html b/examples/canvas_camera_orthographic.html index 2317b0e0..c3b7a911 100644 --- a/examples/canvas_camera_orthographic.html +++ b/examples/canvas_camera_orthographic.html @@ -59,12 +59,12 @@ var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.2 } ) ); line.position.z = ( i * 50 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0x000000, opacity: 0.2 } ) ); line.position.x = ( i * 50 ) - 500; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -84,28 +84,28 @@ cube.position.y = ( cube.scale.y * 50 ) / 2; cube.position.z = Math.floor( ( Math.random() * 1000 - 500 ) / 50 ) * 50 + 25; - scene.addObject(cube); + scene.add(cube); } // Lights var ambientLight = new THREE.AmbientLight( Math.random() * 0x10 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_birds.html b/examples/canvas_geometry_birds.html index 9c45b580..db3f7b69 100644 --- a/examples/canvas_geometry_birds.html +++ b/examples/canvas_geometry_birds.html @@ -361,7 +361,7 @@ bird.position = boids[ i ].position; bird.doubleSided = true; // bird.scale.x = bird.scale.y = bird.scale.z = 10; - scene.addObject( bird ); + scene.add( bird ); } diff --git a/examples/canvas_geometry_cube.html b/examples/canvas_geometry_cube.html index e5976d7a..849fa809 100644 --- a/examples/canvas_geometry_cube.html +++ b/examples/canvas_geometry_cube.html @@ -73,14 +73,14 @@ cube = new THREE.Mesh( new THREE.CubeGeometry( 200, 200, 200, 1, 1, 1, materials ), new THREE.MeshFaceMaterial() ); cube.position.y = 150; cube.overdraw = true; - scene.addObject( cube ); + scene.add( cube ); // Plane plane = new THREE.Mesh( new THREE.PlaneGeometry( 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0 } ) ); plane.rotation.x = - 90 * ( Math.PI / 180 ); plane.overdraw = true; - scene.addObject( plane ); + scene.add( plane ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_earth.html b/examples/canvas_geometry_earth.html index cedb970e..654e05e2 100644 --- a/examples/canvas_geometry_earth.html +++ b/examples/canvas_geometry_earth.html @@ -67,11 +67,11 @@ mesh.overdraw = true; mesh.position.y = - 250; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject(mesh); + scene.add(mesh); mesh = new THREE.Mesh( new THREE.SphereGeometry( 200, 20, 20 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ) } ) ); mesh.overdraw = true; - scene.addObject(mesh); + scene.add(mesh); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_hierarchy.html b/examples/canvas_geometry_hierarchy.html index 5e7aeda2..bda95e7e 100644 --- a/examples/canvas_geometry_hierarchy.html +++ b/examples/canvas_geometry_hierarchy.html @@ -65,11 +65,11 @@ mesh.matrixAutoUpdate = false; mesh.updateMatrix(); - group.addChild( mesh ); + group.add( mesh ); } - scene.addObject( group ); + scene.add( group ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_panorama.html b/examples/canvas_geometry_panorama.html index 01f7b27b..0e92bdf1 100644 --- a/examples/canvas_geometry_panorama.html +++ b/examples/canvas_geometry_panorama.html @@ -78,7 +78,7 @@ mesh = new THREE.Mesh( new THREE.CubeGeometry( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_panorama_fisheye.html b/examples/canvas_geometry_panorama_fisheye.html index 3e67d2c5..dedf89f2 100644 --- a/examples/canvas_geometry_panorama_fisheye.html +++ b/examples/canvas_geometry_panorama_fisheye.html @@ -78,7 +78,7 @@ mesh = new THREE.Mesh( new THREE.CubeGeometry( 300, 300, 300, 7, 7, 7, materials, true ), new THREE.MeshFaceMaterial() ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); for ( var i = 0, l = mesh.geometry.vertices.length; i < l; i ++ ) { diff --git a/examples/canvas_geometry_terrain.html b/examples/canvas_geometry_terrain.html index fbf7a0da..8c6333db 100644 --- a/examples/canvas_geometry_terrain.html +++ b/examples/canvas_geometry_terrain.html @@ -84,7 +84,7 @@ mesh = new THREE.Mesh( plane, material ); mesh.rotation.x = -90 * Math.PI / 180; mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_geometry_text.html b/examples/canvas_geometry_text.html index 3d828197..18eb3f8d 100644 --- a/examples/canvas_geometry_text.html +++ b/examples/canvas_geometry_text.html @@ -104,9 +104,9 @@ text.overdraw = true; parent = new THREE.Object3D(); - parent.addChild( text ); + parent.add( text ); - scene.addObject( parent ); + scene.add( parent ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_interactive_cubes.html b/examples/canvas_interactive_cubes.html index 8eef9ccc..805e056c 100644 --- a/examples/canvas_interactive_cubes.html +++ b/examples/canvas_interactive_cubes.html @@ -63,7 +63,7 @@ object.rotation.x = ( Math.random() * 360 ) * Math.PI / 180; object.rotation.y = ( Math.random() * 360 ) * Math.PI / 180; object.rotation.z = ( Math.random() * 360 ) * Math.PI / 180; - scene.addObject( object ); + scene.add( object ); objects.push( object ); @@ -118,7 +118,7 @@ var particle = new THREE.Particle( particleMaterial ); particle.position = intersects[ 0 ].point; particle.scale.x = particle.scale.y = 8; - scene.addObject( particle ); + scene.add( particle ); } diff --git a/examples/canvas_interactive_cubes_tween.html b/examples/canvas_interactive_cubes_tween.html index ba62bd1e..640fba7b 100644 --- a/examples/canvas_interactive_cubes_tween.html +++ b/examples/canvas_interactive_cubes_tween.html @@ -61,7 +61,7 @@ object.rotation.x = ( Math.random() * 360 ) * Math.PI / 180; object.rotation.y = ( Math.random() * 360 ) * Math.PI / 180; object.rotation.z = ( Math.random() * 360 ) * Math.PI / 180; - scene.addObject( object ); + scene.add( object ); } diff --git a/examples/canvas_interactive_particles.html b/examples/canvas_interactive_particles.html index 23bee24c..ca13a5a6 100644 --- a/examples/canvas_interactive_particles.html +++ b/examples/canvas_interactive_particles.html @@ -76,7 +76,7 @@ particle.position.y = Math.random() * 800 - 400; particle.position.z = Math.random() * 800 - 400; particle.scale.x = particle.scale.y = Math.random() * 10 + 10; - scene.addObject( particle ); + scene.add( particle ); } diff --git a/examples/canvas_interactive_voxelpainter.html b/examples/canvas_interactive_voxelpainter.html index 02bd7bc3..8b6c677b 100644 --- a/examples/canvas_interactive_voxelpainter.html +++ b/examples/canvas_interactive_voxelpainter.html @@ -62,12 +62,12 @@ var line = new THREE.Line( geometry, material ); line.position.z = ( i * 50 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, material ); line.position.x = ( i * 50 ) - 500; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -75,7 +75,7 @@ plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 20, 20 ), new THREE.MeshFaceMaterial() ); plane.rotation.x = - 90 * Math.PI / 180; - scene.addObject( plane ); + scene.add( plane ); mouse2D = new THREE.Vector3( 0, 10000, 0.5 ); ray = new THREE.Ray( camera.position, null ); @@ -83,21 +83,21 @@ // Lights var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var directionalLight = new THREE.DirectionalLight( 0x808080 ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); @@ -137,7 +137,7 @@ if ( intersects[ 0 ].object != plane ) { - scene.removeObject( intersects[ 0 ].object ); + scene.remove( intersects[ 0 ].object ); } @@ -152,7 +152,7 @@ voxel.matrixAutoUpdate = false; voxel.updateMatrix(); voxel.overdraw = true; - scene.addObject( voxel ); + scene.add( voxel ); } diff --git a/examples/canvas_lights_pointlights.html b/examples/canvas_lights_pointlights.html index bf89005f..64c9e856 100644 --- a/examples/canvas_lights_pointlights.html +++ b/examples/canvas_lights_pointlights.html @@ -62,16 +62,16 @@ scene = new THREE.Scene(); - scene.addLight( new THREE.AmbientLight( 0x00020 ) ); + scene.add( new THREE.AmbientLight( 0x00020 ) ); light1 = new THREE.PointLight( 0xff0040, 1, 50 ); - scene.addLight( light1 ); + scene.add( light1 ); light2 = new THREE.PointLight( 0x0040ff, 1, 50 ); - scene.addLight( light2 ); + scene.add( light2 ); light3 = new THREE.PointLight( 0x80ff80, 1, 50 ); - scene.addLight( light3 ); + scene.add( light3 ); var PI2 = Math.PI * 2; var program = function ( context ) { @@ -85,19 +85,19 @@ particle1 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0xff0040, program: program } ) ); particle1.scale.x = particle1.scale.y = particle1.scale.z = 0.5; - scene.addObject( particle1 ); + scene.add( particle1 ); particle2 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0x0040ff, program: program } ) ); particle2.scale.x = particle2.scale.y = particle2.scale.z = 0.5; - scene.addObject( particle2 ); + scene.add( particle2 ); particle3 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0x80ff80, program: program } ) ); particle3.scale.x = particle3.scale.y = particle3.scale.z = 0.5; - scene.addObject( particle3 ); + scene.add( particle3 ); mesh = new THREE.Mesh( new WaltHead(), new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.FlatShading } ) ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_lights_pointlights_smooth.html b/examples/canvas_lights_pointlights_smooth.html index f22f4093..cb59acd9 100644 --- a/examples/canvas_lights_pointlights_smooth.html +++ b/examples/canvas_lights_pointlights_smooth.html @@ -62,16 +62,16 @@ scene = new THREE.Scene(); - scene.addLight( new THREE.AmbientLight( 0x00020 ) ); + scene.add( new THREE.AmbientLight( 0x00020 ) ); light1 = new THREE.PointLight( 0xff0040, 1, 50 ); - scene.addLight( light1 ); + scene.add( light1 ); light2 = new THREE.PointLight( 0x0040ff, 1, 50 ); - scene.addLight( light2 ); + scene.add( light2 ); light3 = new THREE.PointLight( 0x80ff80, 1, 50 ); - scene.addLight( light3 ); + scene.add( light3 ); var PI2 = Math.PI * 2; var program = function ( context ) { @@ -85,22 +85,22 @@ particle1 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0xff0040, program: program } ) ); particle1.scale.x = particle1.scale.y = particle1.scale.z = 0.5; - scene.addObject( particle1 ); + scene.add( particle1 ); particle2 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0x0040ff, program: program } ) ); particle2.scale.x = particle2.scale.y = particle2.scale.z = 0.5; - scene.addObject( particle2 ); + scene.add( particle2 ); particle3 = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0x80ff80, program: program } ) ); particle3.scale.x = particle3.scale.y = particle3.scale.z = 0.5; - scene.addObject( particle3 ); + scene.add( particle3 ); geometry = new WaltHead(); geometry.computeVertexNormals(); mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xffffff, shading: THREE.SmoothShading } ) ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_lines.html b/examples/canvas_lines.html index b9a8c1e5..bc1adb8b 100644 --- a/examples/canvas_lines.html +++ b/examples/canvas_lines.html @@ -83,7 +83,7 @@ particle.position.normalize(); particle.position.multiplyScalar( Math.random() * 10 + 450 ); particle.scale.x = particle.scale.y = 5; - scene.addObject( particle ); + scene.add( particle ); geometry.vertices.push( new THREE.Vertex( particle.position ) ); @@ -92,7 +92,7 @@ // lines var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xffffff, opacity: 0.5 } ) ); - scene.addObject( line ); + scene.add( line ); document.addEventListener( 'mousemove', onDocumentMouseMove, false ); document.addEventListener( 'touchstart', onDocumentTouchStart, false ); diff --git a/examples/canvas_lines_sphere.html b/examples/canvas_lines_sphere.html index 579c54d5..5af4270f 100644 --- a/examples/canvas_lines_sphere.html +++ b/examples/canvas_lines_sphere.html @@ -83,7 +83,7 @@ particle.position.z = Math.random() * 2 - 1; particle.position.normalize(); particle.position.multiplyScalar( Math.random() * 10 + 450 ); - scene.addObject( particle ); + scene.add( particle ); } @@ -105,7 +105,7 @@ geometry.vertices.push( new THREE.Vertex( vector2 ) ); var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xffffff, opacity: Math.random() } ) ); - scene.addObject( line ); + scene.add( line ); } document.addEventListener( 'mousemove', onDocumentMouseMove, false ); diff --git a/examples/canvas_materials.html b/examples/canvas_materials.html index 9194c04e..995d159d 100644 --- a/examples/canvas_materials.html +++ b/examples/canvas_materials.html @@ -53,13 +53,13 @@ var line = new THREE.Line( geometry, material ); line.position.y = - 120; line.position.z = ( i * 100 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, material ); line.position.x = ( i * 100 ) - 500; line.position.y = - 120; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -107,7 +107,7 @@ objects.push( sphere ); - scene.addObject( sphere ); + scene.add( sphere ); } @@ -123,21 +123,21 @@ particleLight = new THREE.Particle( new THREE.ParticleCanvasMaterial( { color: 0xffffff, program: program } ) ); particleLight.scale.x = particleLight.scale.y = particleLight.scale.z = 4; - scene.addObject( particleLight ); + scene.add( particleLight ); // Lights - scene.addLight( new THREE.AmbientLight( Math.random() * 0x202020 ) ); + scene.add( new THREE.AmbientLight( Math.random() * 0x202020 ) ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffffff, 1 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.CanvasRenderer(); // renderer = new THREE.WebGLRenderer(); diff --git a/examples/canvas_materials_depth.html b/examples/canvas_materials_depth.html index 13e45514..692886ed 100644 --- a/examples/canvas_materials_depth.html +++ b/examples/canvas_materials_depth.html @@ -79,7 +79,7 @@ plane.rotation.x = - 90 * ( Math.PI / 180 ); plane.position.y = - 100; - scene.addObject( plane ); + scene.add( plane ); // Spheres @@ -108,24 +108,24 @@ cube.scale.x = cube.scale.y = cube.scale.z = Math.random() + 0.5; */ - scene.addObject(cube); + scene.add(cube); } // Lights var ambientLight = new THREE.AmbientLight( Math.random() * 0x202020 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var pointLight = new THREE.PointLight( 0xff0000, 1 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_materials_normal.html b/examples/canvas_materials_normal.html index c4c469eb..cb47d4c0 100644 --- a/examples/canvas_materials_normal.html +++ b/examples/canvas_materials_normal.html @@ -63,7 +63,7 @@ object = new THREE.Mesh( new WaltHead(), new THREE.MeshNormalMaterial() ); object.overdraw = true; object.scale.x = object.scale.y = object.scale.z = 10; - scene.addObject( object ); + scene.add( object ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_materials_reflection.html b/examples/canvas_materials_reflection.html index 92864055..b89d399e 100644 --- a/examples/canvas_materials_reflection.html +++ b/examples/canvas_materials_reflection.html @@ -68,7 +68,7 @@ mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { envMap: THREE.ImageUtils.loadTexture( 'textures/metal.jpg', new THREE.SphericalReflectionMapping() ) } ) ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_materials_video.html b/examples/canvas_materials_video.html index 63e1e77b..831f33ef 100644 --- a/examples/canvas_materials_video.html +++ b/examples/canvas_materials_video.html @@ -109,7 +109,7 @@ mesh = new THREE.Mesh( plane, material ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.5; mesh.overdraw = true; - scene.addObject(mesh); + scene.add(mesh); mesh = new THREE.Mesh( plane, materialReflection ); mesh.position.y = -306; @@ -117,7 +117,7 @@ mesh.rotation.x = 180 * Math.PI / 180; mesh.doubleSided = true; mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); // @@ -148,7 +148,7 @@ particle.position.x = ix * separation - ( ( amountx * separation ) / 2 ); particle.position.y = -153 particle.position.z = iy * separation - ( ( amounty * separation ) / 2 ); - scene.addObject( particle ); + scene.add( particle ); } } diff --git a/examples/canvas_particles_floor.html b/examples/canvas_particles_floor.html index e4bfee2a..745443a3 100644 --- a/examples/canvas_particles_floor.html +++ b/examples/canvas_particles_floor.html @@ -71,7 +71,7 @@ particle = new THREE.Particle( material ); particle.position.x = ix * SEPARATION - ( ( AMOUNTX * SEPARATION ) / 2 ); particle.position.z = iy * SEPARATION - ( ( AMOUNTY * SEPARATION ) / 2 ); - scene.addObject( particle ); + scene.add( particle ); } } diff --git a/examples/canvas_particles_random.html b/examples/canvas_particles_random.html index 7698aa9a..12d839b8 100644 --- a/examples/canvas_particles_random.html +++ b/examples/canvas_particles_random.html @@ -56,7 +56,7 @@ } group = new THREE.Object3D(); - scene.addObject( group ); + scene.add( group ); for ( var i = 0; i < 1000; i++ ) { @@ -65,7 +65,7 @@ particle.position.y = Math.random() * 2000 - 1000; particle.position.z = Math.random() * 2000 - 1000; particle.scale.x = particle.scale.y = Math.random() * 10 + 5; - group.addChild( particle ); + group.add( particle ); } renderer = new THREE.CanvasRenderer(); diff --git a/examples/canvas_particles_shapes.html b/examples/canvas_particles_shapes.html index b352c074..db94c8ad 100644 --- a/examples/canvas_particles_shapes.html +++ b/examples/canvas_particles_shapes.html @@ -115,14 +115,14 @@ text.overdraw = true; parent = new THREE.Object3D(); - parent.addChild( text ); + parent.add( text ); particleCloud = new THREE.Object3D(); // Just a group particleCloud.y = 800; - parent.addChild( particleCloud ); + parent.add( particleCloud ); - scene.addObject( parent ); + scene.add( parent ); // Create Particle Systems @@ -184,7 +184,7 @@ particle = new THREE.Particle( material ); particle.scale.x = particle.scale.y = Math.random() * 20 +20; - particleCloud.addChild( particle ); + particleCloud.add( particle ); return particle; }; @@ -196,7 +196,7 @@ var onParticleDead = function(particle) { particle.target.visible = false; - particleCloud.removeChild(particle.target); + particleCloud.remove(particle.target); }; diff --git a/examples/canvas_particles_sprites.html b/examples/canvas_particles_sprites.html index 2f7f9338..bab5a3ef 100644 --- a/examples/canvas_particles_sprites.html +++ b/examples/canvas_particles_sprites.html @@ -54,7 +54,7 @@ initParticle( particle, i * 10 ); - scene.addObject( particle ); + scene.add( particle ); } renderer = new THREE.CanvasRenderer(); diff --git a/examples/canvas_particles_waves.html b/examples/canvas_particles_waves.html index 0d0ceb6a..d612617c 100644 --- a/examples/canvas_particles_waves.html +++ b/examples/canvas_particles_waves.html @@ -75,7 +75,7 @@ particle = particles[ i ++ ] = new THREE.Particle( material ); particle.position.x = ix * SEPARATION - ( ( AMOUNTX * SEPARATION ) / 2 ); particle.position.z = iy * SEPARATION - ( ( AMOUNTY * SEPARATION ) / 2 ); - scene.addObject( particle ); + scene.add( particle ); } diff --git a/examples/canvas_performance.html b/examples/canvas_performance.html index d84b02e6..dd775161 100644 --- a/examples/canvas_performance.html +++ b/examples/canvas_performance.html @@ -63,12 +63,12 @@ var line = new THREE.Line( geometry, material ); line.position.z = ( i * 100 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, material ); line.position.x = ( i * 100 ) - 500; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -85,23 +85,23 @@ sphere.position.x = ( i % 5 ) * 200 - 400; sphere.position.z = Math.floor( i / 5 ) * 200 - 400; - scene.addObject( sphere ); + scene.add( sphere ); } // Lights var ambientLight = new THREE.AmbientLight( Math.random() * 0x202020 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = 0; directionalLight.position.y = 1; directionalLight.position.z = 0; - scene.addLight( directionalLight ); + scene.add( directionalLight ); var pointLight = new THREE.PointLight( 0xff0000, 1, 500 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/canvas_sandbox.html b/examples/canvas_sandbox.html index 038e9e0a..e23ae6c4 100644 --- a/examples/canvas_sandbox.html +++ b/examples/canvas_sandbox.html @@ -178,12 +178,12 @@ var line = new THREE.Line( geometry, material ); line.position.z = ( i * 100 ) - 500; - scene.addObject( line ); + scene.add( line ); var line = new THREE.Line( geometry, material ); line.position.x = ( i * 100 ) - 500; line.rotation.y = 90 * Math.PI / 180; - scene.addObject( line ); + scene.add( line ); } @@ -211,24 +211,24 @@ objects.push( sphere ); - scene.addObject( sphere ); + scene.add( sphere ); } // Lights var ambientLight = new THREE.AmbientLight( Math.random() * 0x202020 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xff0000, 1 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.CanvasRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/misc_camera_path.html b/examples/misc_camera_path.html index d9eef97f..4fb46d15 100644 --- a/examples/misc_camera_path.html +++ b/examples/misc_camera_path.html @@ -102,24 +102,24 @@ mesh.updateMatrix(); mesh.matrixAutoUpdate = false; - scene.addChild( mesh ); + scene.add( mesh ); } - scene.addObject( camera.animationParent ); + scene.add( camera.animationParent ); // lights light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 1, 1, 1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.DirectionalLight( 0x002288 ); light.position.set( -1, -1, -1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.AmbientLight( 0x222222 ); - scene.addChild( light ); + scene.add( light ); // renderer diff --git a/examples/misc_camera_roll.html b/examples/misc_camera_roll.html index 1fb05577..b145bc8a 100644 --- a/examples/misc_camera_roll.html +++ b/examples/misc_camera_roll.html @@ -85,7 +85,7 @@ mesh.updateMatrix(); mesh.matrixAutoUpdate = false; - scene.addChild( mesh ); + scene.add( mesh ); } @@ -100,37 +100,37 @@ var material = new THREE.MeshPhongMaterial( { color:0xff0000 } ); var mesh = new THREE.Mesh( new THREE.Cube( 40, 5, 5 ), material ); mesh.position.x = 20; - cross.addChild( mesh ); + cross.add( mesh ); var material = new THREE.MeshPhongMaterial( { color:0x00ff00 } ); var mesh = new THREE.Mesh( new THREE.Cube( 5, 40, 5 ), material ); mesh.position.y = 20; - cross.addChild( mesh ); + cross.add( mesh ); var material = new THREE.MeshPhongMaterial( { color:0x0000ff } ); var mesh = new THREE.Mesh( new THREE.Cube( 5, 5, 40 ), material ); mesh.position.z = 20; - cross.addChild( mesh ); - camera.addChild( cross ); + cross.add( mesh ); + camera.add( cross ); */ - scene.addChild( camera ); + scene.add( camera ); // lights light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 1, 1, 1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.DirectionalLight( 0x002288 ); light.position.set( -1, -1, -1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.AmbientLight( 0x222222 ); - scene.addChild( light ); + scene.add( light ); // renderer diff --git a/examples/misc_camera_trackball.html b/examples/misc_camera_trackball.html index 3eb58fa5..e38e46ce 100644 --- a/examples/misc_camera_trackball.html +++ b/examples/misc_camera_trackball.html @@ -102,7 +102,7 @@ mesh.updateMatrix(); mesh.matrixAutoUpdate = false; - scene.addChild( mesh ); + scene.add( mesh ); } @@ -117,19 +117,19 @@ var material = new THREE.MeshPhongMaterial( { color:0xff0000 } ); var mesh = new THREE.Mesh( new THREE.Cube( 40, 5, 5 ), material ); mesh.position.x = 20; - cross.addChild( mesh ); + cross.add( mesh ); var material = new THREE.MeshPhongMaterial( { color:0x00ff00 } ); var mesh = new THREE.Mesh( new THREE.Cube( 5, 40, 5 ), material ); mesh.position.y = 20; - cross.addChild( mesh ); + cross.add( mesh ); var material = new THREE.MeshPhongMaterial( { color:0x0000ff } ); var mesh = new THREE.Mesh( new THREE.Cube( 5, 5, 40 ), material ); mesh.position.z = 20; - cross.addChild( mesh ); - camera.addChild( cross ); + cross.add( mesh ); + camera.add( cross ); */ @@ -137,14 +137,14 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 1, 1, 1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.DirectionalLight( 0x002288 ); light.position.set( -1, -1, -1 ); - scene.addChild( light ); + scene.add( light ); light = new THREE.AmbientLight( 0x222222 ); - scene.addChild( light ); + scene.add( light ); // renderer diff --git a/examples/misc_lights_test.html b/examples/misc_lights_test.html index 6f3afbb4..39e85ba7 100644 --- a/examples/misc_lights_test.html +++ b/examples/misc_lights_test.html @@ -101,7 +101,7 @@ mesh.position.z = 500 * ( Math.random() - 0.5 ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * ( Math.random() + 0.5 ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); } @@ -109,30 +109,30 @@ mesh = new THREE.Mesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), new THREE.MeshLambertMaterial( { color: 0xffffff } ) ); mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); // Lights var ambient = new THREE.AmbientLight( 0x101010 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.y = -70; directionalLight.position.z = 100; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00 ); pointLight.position.x = 0; pointLight.position.y = 0; pointLight.position.z = 0; - scene.addLight( pointLight ); + scene.add( pointLight ); lightMesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) ); lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05; lightMesh.position = pointLight.position; lightMesh.overdraw = true; - scene.addObject(lightMesh); + scene.add(lightMesh); if ( render_canvas ) { @@ -193,7 +193,7 @@ function render() { - counter == 30 ? scene.removeLight( directionalLight ) : counter ++; + counter == 30 ? scene.remove( directionalLight ) : counter ++; camera.position.x += ( mouseX - camera.position.x ) * .05; camera.position.y += ( - mouseY - camera.position.y ) * .05; diff --git a/examples/misc_lookat.html b/examples/misc_lookat.html index b1686498..42b2a7bf 100644 --- a/examples/misc_lookat.html +++ b/examples/misc_lookat.html @@ -68,7 +68,7 @@ var material = new THREE.MeshNormalMaterial( { shading: THREE.SmoothShading } ); target = new THREE.Mesh( new THREE.SphereGeometry( 100, 20, 20 ), material ); - scene.addObject( target ); + scene.add( target ); for ( var i = 0; i < 1000; i ++ ) { @@ -77,7 +77,7 @@ mesh.position.y = Math.random() * 4000 - 2000; mesh.position.z = Math.random() * 4000 - 2000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 4 + 2; - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/examples/misc_materials_multimaterials.html b/examples/misc_materials_multimaterials.html index 6fc3ef43..fcd48ed2 100644 --- a/examples/misc_materials_multimaterials.html +++ b/examples/misc_materials_multimaterials.html @@ -60,7 +60,7 @@ var mesh, zmesh, geometry; - var directionalLight, pointLight; + var directionalLight; var mouseX = 0; var mouseY = 0; @@ -108,7 +108,7 @@ mesh.position.y = 500 * ( Math.random() - 0.5 ); mesh.position.z = 500 * ( Math.random() - 0.5 ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * (Math.random() + 0.5); - scene.addObject(mesh); + scene.add(mesh); } @@ -116,24 +116,18 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x101010 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.y = -70; directionalLight.position.z = 100; directionalLight.position.normalize(); - scene.addLight( directionalLight ); - - pointLight = new THREE.PointLight( 0xffaa00 ); - pointLight.position.x = 0; - pointLight.position.y = 0; - pointLight.position.z = 120; - //scene.addLight( pointLight ); + scene.add( directionalLight ); mesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xff0000 } ) ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.1; - mesh.position = pointLight.position; - scene.addObject(mesh); + mesh.position.set( 0, 0, 120 ); + scene.add(mesh); if ( render_gl ) { try { @@ -230,7 +224,7 @@ zmesh.scale.x = zmesh.scale.y = zmesh.scale.z = 3; zmesh.overdraw = true; zmesh.updateMatrix(); - scene.addObject(zmesh); + scene.add(zmesh); // PLANES with all materials from the model @@ -250,7 +244,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); // number var x = document.createElement( "canvas" ); @@ -272,7 +266,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); } } diff --git a/examples/misc_sound.html b/examples/misc_sound.html index 2e7a12fa..90145eb2 100644 --- a/examples/misc_sound.html +++ b/examples/misc_sound.html @@ -118,7 +118,7 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0.5, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var sphere = new THREE.SphereGeometry( 20, 32, 16 ); @@ -136,7 +136,7 @@ var mesh1 = new THREE.Mesh( sphere, material_sphere1 ); mesh1.position.set( -250, 30, 0 ); mesh1.scale.set( s, s, s ); - scene.addObject( mesh1 ); + scene.add( mesh1 ); sound1 = new Sound( [ 'sounds/358232_j_s_song.mp3', 'sounds/358232_j_s_song.ogg' ], 275, 1 ); sound1.position.copy( mesh1.position ); @@ -147,7 +147,7 @@ var mesh2 = new THREE.Mesh( sphere, material_sphere2 ); mesh2.position.set( 250, 30, 0 ); mesh2.scale.set( s, s, s ); - scene.addObject( mesh2 ); + scene.add( mesh2 ); sound2 = new Sound( [ 'sounds/376737_Skullbeatz___Bad_Cat_Maste.mp3', 'sounds/376737_Skullbeatz___Bad_Cat_Maste.ogg' ], 275, 1 ); sound2.position.copy( mesh2.position ); @@ -164,7 +164,7 @@ mesh = new THREE.Mesh( plane, material_wireframe ); mesh.position.y = 0.1; mesh.rotation.x = -1.57; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1, antialias: false } ); diff --git a/examples/misc_ubiquity_test.html b/examples/misc_ubiquity_test.html index 0b489123..d94b9eea 100644 --- a/examples/misc_ubiquity_test.html +++ b/examples/misc_ubiquity_test.html @@ -163,7 +163,7 @@ qrcode = mesh = new THREE.Mesh( new Qrcode(), new THREE.MeshFaceMaterial() ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); // CUBES @@ -174,7 +174,7 @@ mesh.rotation.x = Math.random(); mesh.rotation.y = Math.random(); mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( cube, new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) ); mesh.position.x = 500; @@ -182,7 +182,7 @@ mesh.rotation.x = Math.random(); mesh.rotation.y = Math.random(); mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); // PLANE @@ -190,14 +190,14 @@ mesh.position.y = -500; mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; mesh.doubleSided = true; - scene.addObject( mesh ); + scene.add( mesh ); // CYLINDER mesh = new THREE.Mesh( new THREE.CylinderGeometry( 10, 20, 100, 200, - 50, - 20 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) ); mesh.position.x = -500; mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); // POLYFIELD @@ -226,16 +226,16 @@ mesh = new THREE.Mesh( geometry, [ new THREE.MeshFaceMaterial(), new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true, wireframe: true, wireframeLinewidth: 10 } ) ] ); mesh.doubleSided = true; mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.addObject( mesh ); + scene.add( mesh ); // LIGHTS var ambient = new THREE.AmbientLight( 0x80ffff ); - scene.addLight( ambient ); + scene.add( ambient ); var directional = new THREE.DirectionalLight( 0xffff00 ); - scene.addLight( directional ); + scene.add( directional ); canvasRenderer = new THREE.CanvasRenderer(); canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT ); diff --git a/examples/webgl_animation_skinning.html b/examples/webgl_animation_skinning.html index e9932da1..a2ce4b02 100644 --- a/examples/webgl_animation_skinning.html +++ b/examples/webgl_animation_skinning.html @@ -86,7 +86,7 @@ light = new THREE.DirectionalLight( 0xffffff, 1.5 ); light.position.set( 0, 1, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var planeSimple = new THREE.PlaneGeometry( 200, 300 ); var planeTesselated = new THREE.PlaneGeometry( 100, 300, 25, 40 ); @@ -98,12 +98,12 @@ floor.position.y = -10; floor.rotation.x = -1.57; floor.scale.set( 25, 25, 25 ); - scene.addObject( floor ); + scene.add( floor ); floor = new THREE.Mesh( planeTesselated, matWire ); floor.rotation.x = -1.57; floor.scale.set( 25, 25, 25 ); - scene.addObject( floor ); + scene.add( floor ); renderer = new THREE.WebGLRenderer( { clearColor: 0xffffff, clearAlpha: 1 } ); renderer.setSize( window.innerWidth, height ); @@ -161,7 +161,7 @@ buffalo.position.y = buffalo.boundRadius * 0.5; buffalo.rotation.y = 0.2 - Math.random() * 0.4; - scene.addObject( buffalo ); + scene.add( buffalo ); buffalos.push( buffalo ); diff --git a/examples/webgl_collada.html b/examples/webgl_collada.html index 5977feeb..103d65cd 100644 --- a/examples/webgl_collada.html +++ b/examples/webgl_collada.html @@ -76,29 +76,29 @@ } var line = new THREE.Line( geometry, line_material, THREE.LinePieces ); - scene.addObject( line ); + scene.add( line ); // Add the COLLADA - scene.addObject( dae ); + scene.add( dae ); particleLight = new THREE.Mesh( new THREE.SphereGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) ); - scene.addObject( particleLight ); + scene.add( particleLight ); // Lights - scene.addLight( new THREE.AmbientLight( 0xcccccc ) ); + scene.add( new THREE.AmbientLight( 0xcccccc ) ); var directionalLight = new THREE.DirectionalLight(/*Math.random() * 0xffffff*/0xeeeeee ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffffff, 4 ); pointLight.position.x = 10000; - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_collisions_box.html b/examples/webgl_collisions_box.html index cddd0b43..b433b6b5 100644 --- a/examples/webgl_collisions_box.html +++ b/examples/webgl_collisions_box.html @@ -68,11 +68,11 @@ function init() { container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); sun = new THREE.DirectionalLight( 0xffffff ); sun.position = camera.position.clone(); - scene.addLight( sun ); + scene.add( sun ); createCube( 200, new THREE.Vector3( 0,0,0 ) ); @@ -94,7 +94,7 @@ function createCube( s, p ) { ); cube.position = p; - scene.addObject( cube ); + scene.add( cube ); THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB( cube ) ); diff --git a/examples/webgl_collisions_mesh.html b/examples/webgl_collisions_mesh.html index 2f3c3e24..628db1b2 100644 --- a/examples/webgl_collisions_mesh.html +++ b/examples/webgl_collisions_mesh.html @@ -76,11 +76,11 @@ function init() { container.appendChild( renderer.domElement ); var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); sun = new THREE.DirectionalLight( 0xffffff ); sun.position = camera.position.clone(); - scene.addLight( sun ); + scene.add( sun ); loadCube(); @@ -174,7 +174,7 @@ function addCube( p, g) { //mesh.scale.y = Math.random() + 0.5; //mesh.scale.z = Math.random() + 0.5; - scene.addObject( mesh ); + scene.add( mesh ); var mc = THREE.CollisionUtils.MeshColliderWBox(mesh); THREE.Collisions.colliders.push( mc ); meshes.push( mesh ); diff --git a/examples/webgl_collisions_normal.html b/examples/webgl_collisions_normal.html index a6ea935d..4ab6bf34 100644 --- a/examples/webgl_collisions_normal.html +++ b/examples/webgl_collisions_normal.html @@ -76,11 +76,11 @@ function init() { container.appendChild( renderer.domElement ); var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); sun = new THREE.DirectionalLight( 0xffffff ); sun.position = camera.position.clone(); - scene.addLight( sun ); + scene.add( sun ); loadCube(); @@ -91,7 +91,7 @@ function init() { geom.vertices.push( new THREE.Vertex( new THREE.Vector3( 100, 0, 0) ) ); line = new THREE.Line(geom, lineMat); - scene.addObject( line ); + scene.add( line ); stats = new Stats(); stats.domElement.style.position = 'absolute'; @@ -127,7 +127,7 @@ function addCube( p, g) { var mesh = new THREE.Mesh( g, new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); mesh.position = p; - scene.addObject( mesh ); + scene.add( mesh ); var mc = THREE.CollisionUtils.MeshColliderWBox(mesh); THREE.Collisions.colliders.push( mc ); meshes.push( mesh ); diff --git a/examples/webgl_collisions_primitives.html b/examples/webgl_collisions_primitives.html index def66f3d..3d43bd79 100644 --- a/examples/webgl_collisions_primitives.html +++ b/examples/webgl_collisions_primitives.html @@ -73,10 +73,10 @@ container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight(0x606060); - scene.addLight(ambientLight); + scene.add(ambientLight); sun = new THREE.DirectionalLight(0xffffff); - scene.addLight(sun); + scene.add(sun); //makeWall(480); //makeWall(360); @@ -91,7 +91,7 @@ plane = new THREE.Mesh( new THREE.PlaneGeometry( 30000, 30000, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); plane.position.y = - 480; plane.rotation.x = Math.PI / - 2; - scene.addObject( plane ); + scene.add( plane ); geoms.push( plane ); var cplane = new THREE.PlaneCollider( plane.position, new THREE.Vector3( 0, 1, 0 ) ); @@ -123,7 +123,7 @@ function createCube(s, p){ var cube = new THREE.Mesh(new THREE.CubeGeometry( s, s, s ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); cube.position = p; - scene.addObject(cube); + scene.add(cube); geoms.push(cube); THREE.Collisions.colliders.push(THREE.CollisionUtils.MeshAABB(cube, p)); } @@ -131,7 +131,7 @@ function createSphere(rad, p){ var sphere = new THREE.Mesh( new THREE.SphereGeometry( rad, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); sphere.position = p; - scene.addObject(sphere); + scene.add(sphere); geoms.push(sphere); var sc = new THREE.SphereCollider(p, rad); diff --git a/examples/webgl_collisions_reaction.html b/examples/webgl_collisions_reaction.html index 319b91bd..c1a6316a 100644 --- a/examples/webgl_collisions_reaction.html +++ b/examples/webgl_collisions_reaction.html @@ -74,18 +74,18 @@ scene = new THREE.Scene(); sphere = new THREE.Mesh( new THREE.SphereGeometry( sphereSize, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0xff0000 } ) ); - scene.addObject( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight(0xdddddd); - scene.addLight(ambientLight); + scene.add(ambientLight); sun = new THREE.DirectionalLight(0xffffff); sun.position = new THREE.Vector3(1, -1, 1).normalize(); - scene.addLight(sun); + scene.add(sun); createObstacles(); @@ -93,7 +93,7 @@ geometry.vertices.push( new THREE.Vertex( new THREE.Vector3(0, 0, 0) ) ); geometry.vertices.push( new THREE.Vertex( new THREE.Vector3(10, 0, 0) ) ); debugNormal = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xff0000 } ) ); - scene.addObject( debugNormal ); + scene.add( debugNormal ); container.onmousemove = onDocumentMouseMove; animate(); @@ -110,7 +110,7 @@ var cube = new THREE.Mesh( new THREE.CubeGeometry( sx, sy, sz ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); cube.position = p; cube.rotation.y = ry; - scene.addObject(cube); + scene.add(cube); THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) ); cubes.push(cube); return cube; diff --git a/examples/webgl_collisions_terrain.html b/examples/webgl_collisions_terrain.html index bee6c3b0..3931896b 100644 --- a/examples/webgl_collisions_terrain.html +++ b/examples/webgl_collisions_terrain.html @@ -69,18 +69,18 @@ function init() { ray.direction = new THREE.Vector3(0, -1, 0); sphere = new THREE.Mesh( new THREE.SphereGeometry( sphereSize, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0xff0000 } ) ); - scene.addObject(sphere); + scene.add(sphere); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight( 0x444444 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); sun = new THREE.DirectionalLight( 0xaaaaaa ); sun.position = new THREE.Vector3(-1,1, -1).normalize(); - scene.addLight( sun ); + scene.add( sun ); loadCube(); @@ -93,7 +93,7 @@ function init() { function loadCube(p) { var onGeometry = function( geometry ) { var mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0xf3e4b8 } ) ); - scene.addObject( mesh ); + scene.add( mesh ); THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshColliderWBox(mesh) ); }; diff --git a/examples/webgl_collisions_trigger.html b/examples/webgl_collisions_trigger.html index c69dbb5f..bedf619a 100644 --- a/examples/webgl_collisions_trigger.html +++ b/examples/webgl_collisions_trigger.html @@ -74,18 +74,18 @@ scene = new THREE.Scene(); sphere = new THREE.Mesh( new THREE.SphereGeometry( sphereSize, 10, 10 ), new THREE.MeshLambertMaterial( { color: 0xff0000 } ) ); - scene.addObject( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); container.appendChild(renderer.domElement); var ambientLight = new THREE.AmbientLight(0xdddddd); - scene.addLight(ambientLight); + scene.add(ambientLight); sun = new THREE.DirectionalLight(0xffffff); sun.position = new THREE.Vector3(1, -1, 1).normalize(); - scene.addLight(sun); + scene.add(sun); createObstacles(); @@ -102,7 +102,7 @@ function createCube(sx, sy, sz, p){ var cube = new THREE.Mesh(new THREE.CubeGeometry( sx, sy, sz ), new THREE.MeshLambertMaterial( { color: 0x003300 } ) ); cube.position = p; - scene.addObject(cube); + scene.add(cube); THREE.Collisions.colliders.push( THREE.CollisionUtils.MeshOBB(cube) ); cubes.push(cube); return cube; diff --git a/examples/webgl_custom_attributes.html b/examples/webgl_custom_attributes.html index 927dbd3c..e825a6dc 100644 --- a/examples/webgl_custom_attributes.html +++ b/examples/webgl_custom_attributes.html @@ -149,7 +149,7 @@ } - scene.addChild( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer( { clearColor: 0x050505, clearAlpha: 1 } ); renderer.setSize( WIDTH, HEIGHT ); diff --git a/examples/webgl_custom_attributes_particles.html b/examples/webgl_custom_attributes_particles.html index d9ad8b3e..7e3f8997 100644 --- a/examples/webgl_custom_attributes_particles.html +++ b/examples/webgl_custom_attributes_particles.html @@ -165,7 +165,7 @@ } - scene.addChild( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } ); renderer.setSize( WIDTH, HEIGHT ); @@ -221,4 +221,4 @@ - \ No newline at end of file + diff --git a/examples/webgl_custom_attributes_particles2.html b/examples/webgl_custom_attributes_particles2.html index 7f54f913..788a17c8 100644 --- a/examples/webgl_custom_attributes_particles2.html +++ b/examples/webgl_custom_attributes_particles2.html @@ -162,7 +162,7 @@ } - scene.addChild( sphere ); + scene.add( sphere ); renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } ); renderer.setSize( WIDTH, HEIGHT ); @@ -220,4 +220,4 @@ - \ No newline at end of file + diff --git a/examples/webgl_custom_attributes_particles3.html b/examples/webgl_custom_attributes_particles3.html index f33b62f9..3abd76b0 100644 --- a/examples/webgl_custom_attributes_particles3.html +++ b/examples/webgl_custom_attributes_particles3.html @@ -221,7 +221,7 @@ console.log( vertices.length ); - scene.addObject( object ); + scene.add( object ); renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } ); renderer.setSize( WIDTH, HEIGHT ); @@ -279,4 +279,4 @@ - \ No newline at end of file + diff --git a/examples/webgl_flycamera_earth.html b/examples/webgl_flycamera_earth.html index 043dff05..bed568ed 100644 --- a/examples/webgl_flycamera_earth.html +++ b/examples/webgl_flycamera_earth.html @@ -106,10 +106,10 @@ dirLight = new THREE.DirectionalLight( 0xffffff ); dirLight.position.set( -1, 0, 1 ); dirLight.position.normalize(); - scene.addLight( dirLight ); + scene.add( dirLight ); ambientLight = new THREE.AmbientLight( 0x000000 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var planetTexture = THREE.ImageUtils.loadTexture( "textures/planets/earth_atmos_2048.jpg" ); var cloudsTexture = THREE.ImageUtils.loadTexture( "textures/planets/earth_clouds_1024.png" ); @@ -148,7 +148,7 @@ meshPlanet = new THREE.Mesh( geometry, materialNormalMap ); meshPlanet.rotation.y = 1.3; meshPlanet.rotation.z = tilt; - scene.addObject( meshPlanet ); + scene.add( meshPlanet ); // clouds @@ -157,7 +157,7 @@ meshClouds = new THREE.Mesh( geometry, materialClouds ); meshClouds.scale.set( cloudsScale, cloudsScale, cloudsScale ); meshClouds.rotation.z = tilt; - scene.addObject( meshClouds ); + scene.add( meshClouds ); // moon @@ -166,7 +166,7 @@ meshMoon = new THREE.Mesh( geometry, materialMoon ); meshMoon.position.set( radius * 5, 0, 0 ); meshMoon.scale.set( moonScale, moonScale, moonScale ); - scene.addObject( meshMoon ); + scene.add( meshMoon ); // stars @@ -214,7 +214,7 @@ stars.matrixAutoUpdate = false; stars.updateMatrix(); - scene.addObject( stars ); + scene.add( stars ); } diff --git a/examples/webgl_geometry_blenderexport_colors.html b/examples/webgl_geometry_blenderexport_colors.html index f115edfc..1c0a00ce 100644 --- a/examples/webgl_geometry_blenderexport_colors.html +++ b/examples/webgl_geometry_blenderexport_colors.html @@ -66,12 +66,10 @@ scene = new THREE.Scene(); - //scene.addLight( new THREE.AmbientLight( 0x333333 ) ); - light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var loader = new THREE.JSONLoader(); loader.load( { model: "obj/cubecolors/cubecolors.js", callback: createScene1 } ); @@ -100,7 +98,7 @@ mesh = new THREE.Mesh( geometry, material ); mesh.position.x = 400; mesh.scale.x = mesh.scale.y = mesh.scale.z = 250; - scene.addObject( mesh ); + scene.add( mesh ); } @@ -113,7 +111,7 @@ mesh2 = new THREE.Mesh( geometry, material ); mesh2.position.x = - 400; mesh2.scale.x = mesh2.scale.y = mesh2.scale.z = 250; - scene.addObject( mesh2 ); + scene.add( mesh2 ); } diff --git a/examples/webgl_geometry_colors.html b/examples/webgl_geometry_colors.html index d64be5a6..5da550ab 100644 --- a/examples/webgl_geometry_colors.html +++ b/examples/webgl_geometry_colors.html @@ -69,7 +69,7 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } ); var shadowGeo = new THREE.PlaneGeometry( 300, 300, 1, 1 ); @@ -77,19 +77,19 @@ mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = - 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); var faceIndices = [ 'a', 'b', 'c', 'd' ]; @@ -144,19 +144,19 @@ mesh.position.x = -400; mesh.scale.x = mesh.scale.y = mesh.scale.z = 200; mesh.rotation.x = -1.87; - scene.addObject( mesh ); + scene.add( mesh ); mesh2 = new THREE.Mesh( geometry2, materials ); mesh2.position.x = 400; mesh2.rotation.x = 0; mesh2.scale = mesh.scale; - scene.addObject( mesh2 ); + scene.add( mesh2 ); mesh3 = new THREE.Mesh( geometry3, materials ); mesh3.position.x = 0; mesh3.rotation.x = 0; mesh3.scale = mesh.scale; - scene.addObject( mesh3 ); + scene.add( mesh3 ); renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_dynamic.html b/examples/webgl_geometry_dynamic.html index 377f8893..92feb639 100644 --- a/examples/webgl_geometry_dynamic.html +++ b/examples/webgl_geometry_dynamic.html @@ -82,10 +82,6 @@ scene = new THREE.Scene(); scene.fog = new THREE.FogExp2( 0xaaccff, 0.0007 ); - //var light = new THREE.PointLight( 0xffffff, 2 ); - //light.position.y = 500; - //scene.addLight( light ); - camera.position.y = 200; camera.target.position.y = camera.position.y; @@ -113,7 +109,7 @@ mesh = new THREE.Mesh( geometry, material ); mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer( { clearColor:0xaaccff, clearAlpha: 1 } ); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_hierarchy.html b/examples/webgl_geometry_hierarchy.html index da7d1548..83373d42 100644 --- a/examples/webgl_geometry_hierarchy.html +++ b/examples/webgl_geometry_hierarchy.html @@ -65,11 +65,11 @@ mesh.matrixAutoUpdate = false; mesh.updateMatrix(); - group.addChild( mesh ); + group.add( mesh ); } - scene.addObject( group ); + scene.add( group ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_hierarchy2.html b/examples/webgl_geometry_hierarchy2.html index 37d53986..059bf902 100644 --- a/examples/webgl_geometry_hierarchy2.html +++ b/examples/webgl_geometry_hierarchy2.html @@ -66,7 +66,7 @@ child = new THREE.Mesh( geometry, material ); child.position.x = 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -80,7 +80,7 @@ child = new THREE.Mesh( geometry, material ); child.position.x = - 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -94,7 +94,7 @@ child = new THREE.Mesh( geometry, material ); child.position.y = - 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -108,7 +108,7 @@ child = new THREE.Mesh( geometry, material ); child.position.y = 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -122,7 +122,7 @@ child = new THREE.Mesh( geometry, material ); child.position.z = - 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); @@ -136,14 +136,14 @@ child = new THREE.Mesh( geometry, material ); child.position.z = 100; - object.addChild( child ); + object.add( child ); object = child; objects.push( child ); } - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_large_mesh.html b/examples/webgl_geometry_large_mesh.html index 6d396be3..99a760af 100644 --- a/examples/webgl_geometry_large_mesh.html +++ b/examples/webgl_geometry_large_mesh.html @@ -97,7 +97,7 @@ mesh.rotation.z = rz; mesh.overdraw = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); } @@ -115,20 +115,20 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x101010 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 2; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00 ); pointLight.position.x = 0; pointLight.position.y = 0; pointLight.position.z = 0; - scene.addLight( pointLight ); + scene.add( pointLight ); // light representation sphere = new THREE.SphereGeometry( 100, 16, 8, 1 ); @@ -137,7 +137,7 @@ lightMesh.position = pointLight.position; lightMesh.overdraw = true; lightMesh.updateMatrix(); - scene.addObject( lightMesh ); + scene.add( lightMesh ); if ( render_gl ) { diff --git a/examples/webgl_geometry_minecraft.html b/examples/webgl_geometry_minecraft.html index c06be920..f08d4779 100644 --- a/examples/webgl_geometry_minecraft.html +++ b/examples/webgl_geometry_minecraft.html @@ -151,17 +151,17 @@ } mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() ); - scene.addObject( mesh ); + scene.add( mesh ); var ambientLight = new THREE.AmbientLight( 0xcccccc ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( 0xffffff, 1.5 ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_minecraft_ao.html b/examples/webgl_geometry_minecraft_ao.html index 19c6f3f6..55a1a55b 100644 --- a/examples/webgl_geometry_minecraft_ao.html +++ b/examples/webgl_geometry_minecraft_ao.html @@ -438,17 +438,17 @@ } mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() ); - scene.addObject( mesh ); + scene.add( mesh ); var ambientLight = new THREE.AmbientLight( 0xcccccc ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( 0xffffff, 1.5 ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_shapes.html b/examples/webgl_geometry_shapes.html index c29317c2..f69ef700 100644 --- a/examples/webgl_geometry_shapes.html +++ b/examples/webgl_geometry_shapes.html @@ -65,11 +65,11 @@ var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); parent = new THREE.Object3D(); parent.position.y = 50; - scene.addChild( parent ); + scene.add( parent ); function addGeometry( geometry, points, spacedPoints, color, x, y, z, rx, ry, rz, s ) { @@ -79,7 +79,7 @@ mesh.position.set( x, y, z - 75 ); mesh.rotation.set( rx, ry, rz ); mesh.scale.set( s, s, s ); - parent.addChild( mesh ); + parent.add( mesh ); // solid line @@ -87,7 +87,7 @@ line.position.set( x, y, z + 25 ); line.rotation.set( rx, ry, rz ); line.scale.set( s, s, s ); - parent.addChild( line ); + parent.add( line ); // transparent line from real points @@ -95,7 +95,7 @@ line.position.set( x, y, z + 75 ); line.rotation.set( rx, ry, rz ); line.scale.set( s, s, s ); - parent.addChild( line ); + parent.add( line ); // vertices from real points @@ -104,7 +104,7 @@ particles.position.set( x, y, z + 75 ); particles.rotation.set( rx, ry, rz ); particles.scale.set( s, s, s ); - parent.addChild( particles ); + parent.add( particles ); // transparent line from equidistance sampled points @@ -112,7 +112,7 @@ line.position.set( x, y, z + 100 ); line.rotation.set( rx, ry, rz ); line.scale.set( s, s, s ); - parent.addChild( line ); + parent.add( line ); // equidistance sampled points @@ -121,7 +121,7 @@ particles2.position.set( x, y, z + 100 ); particles2.rotation.set( rx, ry, rz ); particles2.scale.set( s, s, s ); - parent.addChild( particles2 ); + parent.add( particles2 ); } diff --git a/examples/webgl_geometry_terrain.html b/examples/webgl_geometry_terrain.html index 3c335837..8f568cbf 100644 --- a/examples/webgl_geometry_terrain.html +++ b/examples/webgl_geometry_terrain.html @@ -96,7 +96,7 @@ mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: texture } ) ); mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_terrain_fog.html b/examples/webgl_geometry_terrain_fog.html index 3f0b5e64..5ade2246 100644 --- a/examples/webgl_geometry_terrain_fog.html +++ b/examples/webgl_geometry_terrain_fog.html @@ -96,7 +96,7 @@ mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: texture } ) ); mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer( { clearColor: 0xefd1b5, clearAlpha: 1 } ); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_geometry_text.html b/examples/webgl_geometry_text.html index fd56dc67..2a335951 100644 --- a/examples/webgl_geometry_text.html +++ b/examples/webgl_geometry_text.html @@ -175,11 +175,11 @@ var dirLight = new THREE.DirectionalLight( 0xffffff, 0.125 ); dirLight.position.set( 0, 0, 1 ); dirLight.position.normalize(); - scene.addLight( dirLight ); + scene.add( dirLight ); var pointLight = new THREE.PointLight( 0xffffff, 1.5 ); pointLight.position.set( 0, 100, 90 ); - scene.addLight( pointLight ); + scene.add( pointLight ); //text = capitalize( font ) + " " + capitalize( weight ); //text = "abcdefghijklmnopqrstuvwxyz0123456789"; @@ -228,14 +228,14 @@ parent = new THREE.Object3D(); parent.position.y = 100; - scene.addChild( parent ); + scene.add( parent ); createText(); var plane = new THREE.Mesh( new THREE.PlaneGeometry( 10000, 10000 ), new THREE.MeshBasicMaterial( { color: 0xffffff, opacity: 0.5, transparent: true } ) ); plane.rotation.x = -1.57; plane.position.y = 100; - scene.addChild( plane ); + scene.add( plane ); // RENDERER @@ -499,7 +499,7 @@ textMesh1.rotation.x = 0; textMesh1.rotation.y = Math.PI * 2; - parent.addChild( textMesh1 ); + parent.add( textMesh1 ); if ( mirror ) { @@ -512,7 +512,7 @@ textMesh2.rotation.x = Math.PI; textMesh2.rotation.y = Math.PI * 2; - parent.addChild( textMesh2 ); + parent.add( textMesh2 ); } @@ -522,8 +522,8 @@ updatePermalink(); - scene.removeChild( textMesh1 ); - if ( mirror ) scene.removeChild( textMesh2 ); + scene.remove( textMesh1 ); + if ( mirror ) scene.remove( textMesh2 ); if ( !text ) return; diff --git a/examples/webgl_hdr.html b/examples/webgl_hdr.html index 2c657add..57a3763f 100644 --- a/examples/webgl_hdr.html +++ b/examples/webgl_hdr.html @@ -125,7 +125,7 @@ directionalLight.position.y = 0; directionalLight.position.z = 1; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var texture = THREE.ImageUtils.loadTexture( "textures/memorial.png" ); texture.minFilter = THREE.LinearFilter; @@ -147,7 +147,7 @@ quad = new THREE.Mesh( plane, materialHDR ); quad.position.z = -100; - scene.addObject( quad ); + scene.add( quad ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_interactive_cubes.html b/examples/webgl_interactive_cubes.html index 3ede8438..8c618de4 100644 --- a/examples/webgl_interactive_cubes.html +++ b/examples/webgl_interactive_cubes.html @@ -53,14 +53,14 @@ light.position.y = 1; light.position.z = 1; light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.x = - 1; light.position.y = - 1; light.position.z = - 1; light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var geometry = new THREE.CubeGeometry( 20, 20, 20 ); @@ -76,7 +76,7 @@ object.scale.x = Math.random() * 2 + 1; object.scale.y = Math.random() * 2 + 1; object.scale.z = Math.random() * 2 + 1; - scene.addObject( object ); + scene.add( object ); } diff --git a/examples/webgl_interactive_voxelpainter.html b/examples/webgl_interactive_voxelpainter.html index 557d1854..f456e4c4 100644 --- a/examples/webgl_interactive_voxelpainter.html +++ b/examples/webgl_interactive_voxelpainter.html @@ -64,7 +64,7 @@ rollOverGeo = new THREE.CubeGeometry( 50, 50, 50 ); rollOverMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } ); rollOverMesh = new THREE.Mesh( rollOverGeo, rollOverMaterial ); - scene.addObject( rollOverMesh ); + scene.add( rollOverMesh ); // cubes @@ -80,7 +80,7 @@ plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 20, 20 ), new THREE.MeshBasicMaterial( { color: 0x555555, wireframe: true } ) ); plane.rotation.x = - 90 * Math.PI / 180; - scene.addObject( plane ); + scene.add( plane ); mouse2D = new THREE.Vector3( 0, 10000, 0.5 ); ray = new THREE.Ray( camera.position, null ); @@ -88,21 +88,21 @@ // Lights var ambientLight = new THREE.AmbientLight( 0x606060 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); var directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); var directionalLight = new THREE.DirectionalLight( 0x808080 ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( window.innerWidth, window.innerHeight ); @@ -176,7 +176,7 @@ if ( intersector.object != plane ) { - scene.removeObject( intersector.object ); + scene.remove( intersector.object ); } @@ -191,7 +191,7 @@ voxel.position.copy( voxelPosition ); voxel.matrixAutoUpdate = false; voxel.updateMatrix(); - scene.addObject( voxel ); + scene.add( voxel ); } diff --git a/examples/webgl_lights_pointlights.html b/examples/webgl_lights_pointlights.html index 096b345d..8da860e5 100644 --- a/examples/webgl_lights_pointlights.html +++ b/examples/webgl_lights_pointlights.html @@ -77,48 +77,38 @@ object = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial( { ambient: 0x555555, color: 0x555555, specular: 0xffffff, shininess: 50, shading: THREE.SmoothShading } ) ); object.scale.x = object.scale.y = object.scale.z = 0.80; - scene.addObject( object ); + scene.add( object ); loader.statusDomElement.style.display = "none"; }; - //loader.load( { model: "obj/walt/WaltHead_slim.js", callback: callback } ); loader.load( { model: "obj/walt/WaltHead_bin.js", callback: callback } ); - /* - var directionalLight = new THREE.DirectionalLight( 0x111111, 0.9 ); - directionalLight.position.x = 1; - directionalLight.position.y = 1; - directionalLight.position.z = 2; - directionalLight.position.normalize(); - scene.addLight( directionalLight ); - */ - - scene.addLight( new THREE.AmbientLight( 0x00000 ) ); + scene.add( new THREE.AmbientLight( 0x00000 ) ); light1 = new THREE.PointLight( 0xff0040, 2, 50 ); - scene.addLight( light1 ); + scene.add( light1 ); light2 = new THREE.PointLight( 0x0040ff, 2, 50 ); - scene.addLight( light2 ); + scene.add( light2 ); light3 = new THREE.PointLight( 0x80ff80, 2, 50 ); - scene.addLight( light3 ); + scene.add( light3 ); var sphere = new THREE.SphereGeometry( 0.5, 16, 8 ); var l1 = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xff0040 } ) ); l1.position = light1.position; - scene.addObject( l1 ); + scene.add( l1 ); var l2 = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0x0040ff } ) ); l2.position = light2.position; - scene.addObject( l2 ); + scene.add( l2 ); var l3 = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0x80ff80 } ) ); l3.position = light3.position; - scene.addObject( l3 ); + scene.add( l3 ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_lines_colors.html b/examples/webgl_lines_colors.html index 5854470d..4ba0b0ed 100644 --- a/examples/webgl_lines_colors.html +++ b/examples/webgl_lines_colors.html @@ -135,7 +135,7 @@ line.position.x = p[ 2 ][ 0 ]; line.position.y = p[ 2 ][ 1 ]; line.position.z = p[ 2 ][ 2 ]; - scene.addObject( line ); + scene.add( line ); } diff --git a/examples/webgl_lines_cubes.html b/examples/webgl_lines_cubes.html index e765f1b4..d7439bf4 100644 --- a/examples/webgl_lines_cubes.html +++ b/examples/webgl_lines_cubes.html @@ -112,7 +112,7 @@ line.position.x = p[ 2 ][ 0 ]; line.position.y = p[ 2 ][ 1 ]; line.position.z = p[ 2 ][ 2 ]; - scene.addObject( line ); + scene.add( line ); } diff --git a/examples/webgl_lines_sphere.html b/examples/webgl_lines_sphere.html index 7ba84b3a..b024ea0d 100644 --- a/examples/webgl_lines_sphere.html +++ b/examples/webgl_lines_sphere.html @@ -111,7 +111,7 @@ line.originalScale = p[ 0 ]; line.rotation.y = Math.random() * Math.PI; line.updateMatrix(); - scene.addObject( line ); + scene.add( line ); } diff --git a/examples/webgl_lines_splines.html b/examples/webgl_lines_splines.html index ab01e570..eaa9d906 100644 --- a/examples/webgl_lines_splines.html +++ b/examples/webgl_lines_splines.html @@ -137,7 +137,7 @@ line.position.x = p[ 2 ][ 0 ]; line.position.y = p[ 2 ][ 1 ]; line.position.z = p[ 2 ][ 2 ]; - scene.addObject( line ); + scene.add( line ); } diff --git a/examples/webgl_lod.html b/examples/webgl_lod.html index 8492b87f..170642fa 100644 --- a/examples/webgl_lod.html +++ b/examples/webgl_lod.html @@ -74,12 +74,12 @@ var light = new THREE.PointLight( 0xff2200 ); light.position.set( 0, 0, 0 ); - scene.addLight( light ); + scene.add( light ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var material = new THREE.MeshLambertMaterial( { color: 0xffffff, wireframe: true } ); @@ -113,7 +113,7 @@ lod.position.z = 10000 * ( 0.5 - Math.random() ); lod.updateMatrix(); lod.matrixAutoUpdate = false; - scene.addObject( lod ); + scene.add( lod ); } diff --git a/examples/webgl_lod_text.html b/examples/webgl_lod_text.html index 05a6ba15..e00d9386 100644 --- a/examples/webgl_lod_text.html +++ b/examples/webgl_lod_text.html @@ -89,12 +89,12 @@ var light = new THREE.PointLight( 0xff2200 ); light.position.set( 0, 0, 0 ); - scene.addLight( light ); + scene.add( light ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var wireMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, opacity: 0.5, wireframe: true } ); @@ -154,7 +154,7 @@ lod.position.z = 10000 * ( 0.5 - Math.random() ); lod.updateMatrix(); lod.matrixAutoUpdate = false; - scene.addObject( lod ); + scene.add( lod ); } diff --git a/examples/webgl_materials.html b/examples/webgl_materials.html index 20e8a79d..43194ebf 100644 --- a/examples/webgl_materials.html +++ b/examples/webgl_materials.html @@ -63,7 +63,7 @@ } var line = new THREE.Line( geometry, line_material, THREE.LinePieces ); - scene.addObject( line ); + scene.add( line ); // Materials @@ -123,26 +123,26 @@ objects.push( sphere ); - scene.addObject( sphere ); + scene.add( sphere ); } particleLight = new THREE.Mesh( new THREE.SphereGeometry( 4, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) ); - scene.addObject( particleLight ); + scene.add( particleLight ); // Lights - scene.addLight( new THREE.AmbientLight( 0x202020 ) ); + scene.add( new THREE.AmbientLight( 0x202020 ) ); var directionalLight = new THREE.DirectionalLight( Math.random() * 0xffffff ); directionalLight.position.x = Math.random() - 0.5; directionalLight.position.y = Math.random() - 0.5; directionalLight.position.z = Math.random() - 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffffff, 1 ); - scene.addLight( pointLight ); + scene.add( pointLight ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_materials_cars.html b/examples/webgl_materials_cars.html index c6528efb..664c42df 100644 --- a/examples/webgl_materials_cars.html +++ b/examples/webgl_materials_cars.html @@ -174,27 +174,27 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x555555 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff, 2 ); directionalLight.position.x = 2; directionalLight.position.y = 1.2; directionalLight.position.z = 10; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); directionalLight = new THREE.DirectionalLight( 0xffffff, 1 ); directionalLight.position.x = - 2; directionalLight.position.y = 1.2; directionalLight.position.z = - 10; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00, 2 ); pointLight.position.x = 2000; pointLight.position.y = 1200; pointLight.position.z = 10000; - scene.addLight( pointLight ); + scene.add( pointLight ); // Skybox @@ -210,7 +210,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // @@ -573,7 +573,7 @@ mesh.rotation.y = r[ 1 ]; mesh.rotation.z = r[ 2 ]; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); CARS[ car ].object = mesh; diff --git a/examples/webgl_materials_cars_anaglyph.html b/examples/webgl_materials_cars_anaglyph.html index 66aa7d03..aee0a944 100644 --- a/examples/webgl_materials_cars_anaglyph.html +++ b/examples/webgl_materials_cars_anaglyph.html @@ -170,27 +170,27 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x555555 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff, 2 ); directionalLight.position.x = 2; directionalLight.position.y = 1.2; directionalLight.position.z = 10; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); directionalLight = new THREE.DirectionalLight( 0xffffff, 1 ); directionalLight.position.x = - 2; directionalLight.position.y = 1.2; directionalLight.position.z = - 10; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00, 2 ); pointLight.position.x = 2000; pointLight.position.y = 1200; pointLight.position.z = 10000; - scene.addLight( pointLight ); + scene.add( pointLight ); // Skybox @@ -206,7 +206,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - scene.addObject( mesh ); + scene.add( mesh ); // @@ -568,7 +568,7 @@ mesh.rotation.y = r[ 1 ]; mesh.rotation.z = r[ 2 ]; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); CARS[ car ].object = mesh; diff --git a/examples/webgl_materials_cars_camaro.html b/examples/webgl_materials_cars_camaro.html index fe2baa55..6d67c506 100644 --- a/examples/webgl_materials_cars_camaro.html +++ b/examples/webgl_materials_cars_camaro.html @@ -76,20 +76,20 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x555555 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00 ); pointLight.position.x = 0; pointLight.position.y = 0; pointLight.position.z = 0; - scene.addLight( pointLight ); + scene.add( pointLight ); sphere = new THREE.SphereGeometry( 100, 16, 8, 1 ); @@ -98,7 +98,7 @@ lightMesh.position = pointLight.position; lightMesh.overdraw = true; lightMesh.updateMatrix(); - scene.addObject(lightMesh); + scene.add(lightMesh); webglRenderer = new THREE.WebGLRenderer(); @@ -190,7 +190,7 @@ var mesh = new THREE.Mesh( geometry, m ); mesh.rotation.y = 1; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); createButtons( materials.body, geometry ); diff --git a/examples/webgl_materials_cars_camaro_crosseyed.html b/examples/webgl_materials_cars_camaro_crosseyed.html index 0b1ed1d1..d4cc2f19 100644 --- a/examples/webgl_materials_cars_camaro_crosseyed.html +++ b/examples/webgl_materials_cars_camaro_crosseyed.html @@ -79,20 +79,20 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x555555 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffaa00 ); pointLight.position.x = 0; pointLight.position.y = 0; pointLight.position.z = 0; - scene.addLight( pointLight ); + scene.add( pointLight ); sphere = new THREE.SphereGeometry( 100, 16, 8, 1 ); @@ -101,7 +101,7 @@ lightMesh.position = pointLight.position; lightMesh.overdraw = true; lightMesh.updateMatrix(); - scene.addObject(lightMesh); + scene.add(lightMesh); webglRenderer = new THREE.CrosseyedWebGLRenderer( { separation: 20, antialias: true } ); @@ -195,7 +195,7 @@ var mesh = new THREE.Mesh( geometry, m ); mesh.rotation.y = 1; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); createButtons( materials.body, geometry ); diff --git a/examples/webgl_materials_cubemap.html b/examples/webgl_materials_cubemap.html index 5ec82254..d6b0dc7b 100644 --- a/examples/webgl_materials_cubemap.html +++ b/examples/webgl_materials_cubemap.html @@ -84,17 +84,17 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0xffffff ); - scene.addLight( ambient ); + scene.add( ambient ); pointLight = new THREE.PointLight( 0xffffff, 2 ); - scene.addLight( pointLight ); + scene.add( pointLight ); // light representation sphere = new THREE.SphereGeometry( 100, 16, 8 ); lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color:0xffaa00 } ) ); lightMesh.position = pointLight.position; lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05; - scene.addObject(lightMesh); + scene.add(lightMesh); var path = "textures/cube/SwedishRoyalCastle/"; var format = '.jpg'; @@ -126,7 +126,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 10, 10, 10, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // @@ -155,19 +155,19 @@ var mesh = new THREE.Mesh( geometry, m1 ); mesh.position.z = - 100; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( geometry, m2 ); mesh.position.x = - 900; mesh.position.z = - 100; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( geometry, m3 ); mesh.position.x = 900; mesh.position.z = - 100; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_materials_cubemap_balls_reflection.html b/examples/webgl_materials_cubemap_balls_reflection.html index 593ee4fc..ea744d27 100644 --- a/examples/webgl_materials_cubemap_balls_reflection.html +++ b/examples/webgl_materials_cubemap_balls_reflection.html @@ -97,7 +97,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -117,7 +117,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_balls_reflection_anaglyph.html b/examples/webgl_materials_cubemap_balls_reflection_anaglyph.html index 70654537..b8736c75 100644 --- a/examples/webgl_materials_cubemap_balls_reflection_anaglyph.html +++ b/examples/webgl_materials_cubemap_balls_reflection_anaglyph.html @@ -93,7 +93,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -113,7 +113,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - scene.addObject( mesh ); + scene.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_balls_refraction.html b/examples/webgl_materials_cubemap_balls_refraction.html index 21da2bbc..b806b3a7 100644 --- a/examples/webgl_materials_cubemap_balls_refraction.html +++ b/examples/webgl_materials_cubemap_balls_refraction.html @@ -96,7 +96,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -116,7 +116,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_balls_refraction_crosseyed.html b/examples/webgl_materials_cubemap_balls_refraction_crosseyed.html index b462212c..ff98ef68 100644 --- a/examples/webgl_materials_cubemap_balls_refraction_crosseyed.html +++ b/examples/webgl_materials_cubemap_balls_refraction_crosseyed.html @@ -95,7 +95,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -115,7 +115,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - scene.addObject( mesh ); + scene.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_escher.html b/examples/webgl_materials_cubemap_escher.html index 49d57561..4410d283 100644 --- a/examples/webgl_materials_cubemap_escher.html +++ b/examples/webgl_materials_cubemap_escher.html @@ -85,7 +85,7 @@ var mesh = new THREE.Mesh( geometry, material ); mesh.scale.x = mesh.scale.y = mesh.scale.z = 16; - scene.addObject( mesh ); + scene.add( mesh ); // Skybox @@ -101,7 +101,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 6000, 6000, 6000, 1, 1, 1, null, true ), material ); - scene.addObject( mesh ); + scene.add( mesh ); // diff --git a/examples/webgl_materials_cubemap_refraction.html b/examples/webgl_materials_cubemap_refraction.html index 1401454b..40fb599e 100644 --- a/examples/webgl_materials_cubemap_refraction.html +++ b/examples/webgl_materials_cubemap_refraction.html @@ -82,10 +82,10 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0xffffff ); - scene.addLight( ambient ); + scene.add( ambient ); pointLight = new THREE.PointLight( 0xffffff, 2 ); - scene.addLight( pointLight ); + scene.add( pointLight ); // light representation @@ -93,7 +93,7 @@ lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color:0xffaa00 } ) ); lightMesh.position = pointLight.position; lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05; - scene.addObject(lightMesh); + scene.add(lightMesh); // material samples @@ -123,7 +123,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // @@ -154,19 +154,19 @@ var mesh = new THREE.Mesh( geometry, m1 ); mesh.position.z = z; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( geometry, m2 ); mesh.position.x = - 900; mesh.position.z = z; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( geometry, m3 ); mesh.position.x = 900; mesh.position.z = z; mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.addObject( mesh ); + scene.add( mesh ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_materials_grass.html b/examples/webgl_materials_grass.html index ba37262c..165dfe7a 100644 --- a/examples/webgl_materials_grass.html +++ b/examples/webgl_materials_grass.html @@ -50,7 +50,7 @@ mesh.materials[0].map.needsUpdate = true; mesh.rotation.x = - 90 * ( Math.PI / 180 ); mesh.position.y = i * 0.25; - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/examples/webgl_materials_normalmap.html b/examples/webgl_materials_normalmap.html index fc932ed9..67b4014a 100644 --- a/examples/webgl_materials_normalmap.html +++ b/examples/webgl_materials_normalmap.html @@ -92,18 +92,18 @@ // LIGHTS ambientLight = new THREE.AmbientLight( 0x111111 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); pointLight = new THREE.PointLight( 0xffff55 ); pointLight.position.z = 10000; - scene.addLight( pointLight ); + scene.add( pointLight ); directionalLight = new THREE.DirectionalLight( 0xaaaa88 ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = 0.5; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); // light representation @@ -111,7 +111,7 @@ lightMesh = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) ); lightMesh.position = pointLight.position; lightMesh.scale.x = lightMesh.scale.y = lightMesh.scale.z = 0.05; - scene.addObject(lightMesh); + scene.add(lightMesh); // common material parameters @@ -176,12 +176,12 @@ mesh1 = new THREE.Mesh( geometry, material1 ); mesh1.position.x = - scale * 12; mesh1.scale.set( scale, scale, scale ); - scene.addObject( mesh1 ); + scene.add( mesh1 ); mesh2 = new THREE.Mesh( geometry, material2 ); mesh2.position.x = scale * 12; mesh2.scale.set( scale, scale, scale ); - scene.addObject( mesh2 ); + scene.add( mesh2 ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_materials_normalmap2.html b/examples/webgl_materials_normalmap2.html index 67f54f6d..104bca69 100644 --- a/examples/webgl_materials_normalmap2.html +++ b/examples/webgl_materials_normalmap2.html @@ -95,19 +95,19 @@ // LIGHTS ambientLight = new THREE.AmbientLight( 0x444444 ); - scene.addLight( ambientLight ); + scene.add( ambientLight ); pointLight = new THREE.PointLight( 0xffffff ); pointLight.position.z = 600; - scene.addLight( pointLight ); + scene.add( pointLight ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.x = 1; directionalLight.position.y = 1; directionalLight.position.z = - 1; directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); // material parameters @@ -164,7 +164,7 @@ mesh1 = new THREE.Mesh( geometry, material ); mesh1.position.y = - 50; mesh1.scale.x = mesh1.scale.y = mesh1.scale.z = scale; - scene.addObject( mesh1 ); + scene.add( mesh1 ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_materials_shaders.html b/examples/webgl_materials_shaders.html index 034d7259..046312b9 100644 --- a/examples/webgl_materials_shaders.html +++ b/examples/webgl_materials_shaders.html @@ -86,7 +86,7 @@ mesh.overdraw = true; - scene.addObject( mesh ); + scene.add( mesh ); } @@ -104,15 +104,15 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x101010 ); - scene.addLight( ambient ); + scene.add( ambient ); directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.set( 1, 1, 2 ); directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); pointLight = new THREE.PointLight( 0xffffff ); - scene.addLight( pointLight ); + scene.add( pointLight ); // light representation @@ -121,7 +121,7 @@ lightMesh.scale.set( 0.05, 0.05, 0.05 ); lightMesh.position = pointLight.position; lightMesh.overdraw = true; - scene.addObject( lightMesh ); + scene.add( lightMesh ); // material samples diff --git a/examples/webgl_materials_shaders_fresnel.html b/examples/webgl_materials_shaders_fresnel.html index d02ecd3d..9c6ac114 100644 --- a/examples/webgl_materials_shaders_fresnel.html +++ b/examples/webgl_materials_shaders_fresnel.html @@ -107,7 +107,7 @@ mesh.position.y = Math.random() * 10000 - 5000; mesh.position.z = Math.random() * 10000 - 5000; mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.addObject( mesh ); + scene.add( mesh ); spheres.push( mesh ); @@ -129,7 +129,7 @@ } ), mesh = new THREE.Mesh( new THREE.CubeGeometry( 100000, 100000, 100000, 1, 1, 1, null, true ), material ); - sceneCube.addObject( mesh ); + sceneCube.add( mesh ); // diff --git a/examples/webgl_materials_texture_filters.html b/examples/webgl_materials_texture_filters.html index 372d2bdd..79e059f2 100644 --- a/examples/webgl_materials_texture_filters.html +++ b/examples/webgl_materials_texture_filters.html @@ -147,8 +147,8 @@ texturePainting2.image = image; texturePainting2.needsUpdate = true; - scene.addObject( meshCanvas ); - scene2.addObject( meshCanvas2 ); + scene.add( meshCanvas ); + scene2.add( meshCanvas2 ); var geometry = new THREE.PlaneGeometry( 100, 100 ), mesh = new THREE.Mesh( geometry, materialPainting ), @@ -162,14 +162,14 @@ zmesh.scale.x = image.width / 100; zmesh.scale.y = image.height / 100; - zscene.addObject( zmesh ); + zscene.add( zmesh ); var meshFrame = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 5 } ) ); meshFrame.scale.x = 1.1 * image.width / 100; meshFrame.scale.y = 1.1 * image.height / 100; - zscene.addObject( meshFrame ); + zscene.add( meshFrame ); var meshShadow = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.9, transparent: true } ) ); @@ -177,7 +177,7 @@ meshShadow.scale.x = 1.1 * image.width / 100; meshShadow.scale.y = 1.1 * image.height / 100; meshShadow.rotation.x = -Math.PI / 2; - zscene.addObject( meshShadow ); + zscene.add( meshShadow ); meshShadow.position.y = - 1.1 * image.height/2; diff --git a/examples/webgl_materials_video.html b/examples/webgl_materials_video.html index 7306cc2e..a6637270 100644 --- a/examples/webgl_materials_video.html +++ b/examples/webgl_materials_video.html @@ -97,7 +97,7 @@ var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0.5, 1, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); renderer = new THREE.WebGLRenderer( { antialias: false } ); renderer.setSize( window.innerWidth, window.innerHeight ); @@ -160,7 +160,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; - scene.addObject(mesh); + scene.add(mesh); mesh.dx = 0.001 * ( 0.5 - Math.random() ); mesh.dy = 0.001 * ( 0.5 - Math.random() ); diff --git a/examples/webgl_morphtargets.html b/examples/webgl_morphtargets.html index 0a48affb..6b395610 100644 --- a/examples/webgl_morphtargets.html +++ b/examples/webgl_morphtargets.html @@ -103,10 +103,10 @@ var light = new THREE.PointLight( 0xff2200 ); light.position.set( 100, 100, 100 ); - scene.addLight( light ); + scene.add( light ); var light = new THREE.AmbientLight( 0x333333 ); - scene.addLight( light ); + scene.add( light ); var geometry = new THREE.CubeGeometry( 100, 100, 100 ); @@ -138,7 +138,7 @@ mesh = new THREE.Mesh( geometry, material ); - scene.addChild( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer( { clearColor:0x222222, clearAlpha: 1 } ); diff --git a/examples/webgl_morphtargets_horse.html b/examples/webgl_morphtargets_horse.html index e6488821..f4fa049a 100644 --- a/examples/webgl_morphtargets_horse.html +++ b/examples/webgl_morphtargets_horse.html @@ -52,21 +52,21 @@ light.position.y = 1; light.position.z = 1; light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var light = new THREE.DirectionalLight( 0xffefef, 2 ); light.position.x = - 1; light.position.y = - 1; light.position.z = - 1; light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var loader = new THREE.JSONLoader( true ); loader.load( { model: "models/animated/horse.js", callback: function( geometry ) { mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: 0x606060, morphTargets: true } ) ); mesh.scale.set( 1.5, 1.5, 1.5 ); - scene.addObject( mesh ); + scene.add( mesh ); } } ); diff --git a/examples/webgl_multiple_canvases_complex.html b/examples/webgl_multiple_canvases_complex.html index a2f03934..c4c2366c 100755 --- a/examples/webgl_multiple_canvases_complex.html +++ b/examples/webgl_multiple_canvases_complex.html @@ -129,7 +129,7 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } ); var shadowGeo = new THREE.PlaneGeometry( 300, 300, 1, 1 ); @@ -137,19 +137,19 @@ mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = - 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); var faceIndices = [ 'a', 'b', 'c', 'd' ]; @@ -204,19 +204,19 @@ mesh.position.x = -400; mesh.scale.x = mesh.scale.y = mesh.scale.z = 200; mesh.rotation.x = -1.87; - scene.addObject( mesh ); + scene.add( mesh ); mesh2 = new THREE.Mesh( geometry2, materials ); mesh2.position.x = 400; mesh2.rotation.x = 0; mesh2.scale = mesh.scale; - scene.addObject( mesh2 ); + scene.add( mesh2 ); mesh3 = new THREE.Mesh( geometry3, materials ); mesh3.position.x = 0; mesh3.rotation.x = 0; mesh3.scale = mesh.scale; - scene.addObject( mesh3 ); + scene.add( mesh3 ); renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( container.clientWidth, container.clientHeight ); diff --git a/examples/webgl_multiple_canvases_grid.html b/examples/webgl_multiple_canvases_grid.html index 32d7bb96..e56ca605 100755 --- a/examples/webgl_multiple_canvases_grid.html +++ b/examples/webgl_multiple_canvases_grid.html @@ -145,7 +145,7 @@ light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - scene.addLight( light ); + scene.add( light ); var shadowMaterial = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ) } ); var shadowGeo = new THREE.PlaneGeometry( 300, 300, 1, 1 ); @@ -153,19 +153,19 @@ mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = - 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); mesh = new THREE.Mesh( shadowGeo, shadowMaterial ); mesh.position.y = - 250; mesh.position.x = 400; mesh.rotation.x = - 90 * Math.PI / 180; - scene.addObject( mesh ); + scene.add( mesh ); var faceIndices = [ 'a', 'b', 'c', 'd' ]; @@ -220,19 +220,19 @@ mesh.position.x = -400; mesh.scale.x = mesh.scale.y = mesh.scale.z = 200; mesh.rotation.x = -1.87; - scene.addObject( mesh ); + scene.add( mesh ); mesh2 = new THREE.Mesh( geometry2, materials ); mesh2.position.x = 400; mesh2.rotation.x = 0; mesh2.scale = mesh.scale; - scene.addObject( mesh2 ); + scene.add( mesh2 ); mesh3 = new THREE.Mesh( geometry3, materials ); mesh3.position.x = 0; mesh3.rotation.x = 0; mesh3.scale = mesh.scale; - scene.addObject( mesh3 ); + scene.add( mesh3 ); renderer = new THREE.WebGLRenderer( { antialias: true } ); renderer.setSize( container.clientWidth, container.clientHeight ); diff --git a/examples/webgl_objconvert_test.html b/examples/webgl_objconvert_test.html index 5e3508e7..ed8efece 100644 --- a/examples/webgl_objconvert_test.html +++ b/examples/webgl_objconvert_test.html @@ -116,7 +116,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 10; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); // SPHERES @@ -132,7 +132,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 0.25 * (Math.random() + 0.5); mesh.overdraw = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); } @@ -140,16 +140,13 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x221100 ); - scene.addLight( ambient ); + scene.add( ambient ); var directionalLight = new THREE.DirectionalLight( 0xffeedd ); directionalLight.position.y = -70; directionalLight.position.z = 100; directionalLight.position.normalize(); - scene.addLight( directionalLight ); - - var pointLight = new THREE.PointLight( 0xff0000, 1 ); - //scene.addLight( pointLight ); + scene.add( directionalLight ); if ( render_gl ) { @@ -201,7 +198,7 @@ zmesh.scale.x = zmesh.scale.y = zmesh.scale.z = 3; zmesh.overdraw = true; zmesh.updateMatrix(); - scene.addObject(zmesh); + scene.add(zmesh); createMaterialsPalette( geometry.materials, 100, b ); @@ -220,7 +217,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); // number @@ -243,7 +240,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; mesh.doubleSided = true; mesh.updateMatrix(); - scene.addObject(mesh); + scene.add(mesh); } diff --git a/examples/webgl_panorama_equirectangular.html b/examples/webgl_panorama_equirectangular.html index 6b8e7e2f..f2cb686c 100644 --- a/examples/webgl_panorama_equirectangular.html +++ b/examples/webgl_panorama_equirectangular.html @@ -61,7 +61,7 @@ mesh = new THREE.Mesh( new THREE.SphereGeometry( 500, 60, 40 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/2294472375_24a3b8ef46_o.jpg' ) } ) ); mesh.scale.x = -1; - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_particles_billboards.html b/examples/webgl_particles_billboards.html index 2c43f6e2..f898bba1 100644 --- a/examples/webgl_particles_billboards.html +++ b/examples/webgl_particles_billboards.html @@ -87,13 +87,13 @@ particles = new THREE.ParticleSystem( geometry, material ); particles.sortParticles = true; particles.updateMatrix(); - scene.addObject( particles ); + scene.add( particles ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.x = 0; light.position.y = 0; light.position.z = 1; - scene.addLight( light ); + scene.add( light ); renderer = new THREE.WebGLRenderer( { clearAlpha: 1 }); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_particles_billboards_colors.html b/examples/webgl_particles_billboards_colors.html index 646e882b..6bb37e54 100644 --- a/examples/webgl_particles_billboards_colors.html +++ b/examples/webgl_particles_billboards_colors.html @@ -91,13 +91,13 @@ particles = new THREE.ParticleSystem( geometry, material ); particles.sortParticles = true; particles.updateMatrix(); - scene.addObject( particles ); + scene.add( particles ); var light = new THREE.DirectionalLight( 0xffffff ); light.position.x = 0; light.position.y = 0; light.position.z = 1; - scene.addLight( light ); + scene.add( light ); renderer = new THREE.WebGLRenderer( { clearAlpha: 1 } ); renderer.setSize( window.innerWidth, window.innerHeight ); diff --git a/examples/webgl_particles_dynamic.html b/examples/webgl_particles_dynamic.html index 28412c67..ac4979fc 100644 --- a/examples/webgl_particles_dynamic.html +++ b/examples/webgl_particles_dynamic.html @@ -94,7 +94,7 @@ directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.set( 0, 0, 1 ); directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); aloader = new THREE.JSONLoader( ); bloader = new THREE.BinaryLoader( true ); @@ -155,12 +155,12 @@ // parent = new THREE.Object3D(); - scene.addObject( parent ); + scene.add( parent ); var grid = new THREE.ParticleSystem( new THREE.PlaneGeometry( 15000, 15000, 64, 64 ), new THREE.ParticleBasicMaterial( { color: 0xff0000, size: 10 } ) ); grid.rotation.x = 1.57; grid.position.y = -400; - parent.addChild( grid ); + parent.add( grid ); totaln += 1; total += grid.geometry.vertices.length; @@ -254,7 +254,7 @@ mesh.position.y = y + clones[ i ][ 1 ]; mesh.position.z = z + clones[ i ][ 2 ]; - parent.addChild( mesh ); + parent.add( mesh ); clonemeshes.push( { mesh: mesh, speed: 0.5 + Math.random() } ); @@ -272,7 +272,7 @@ mesh.position.y = y; mesh.position.z = z; - parent.addChild( mesh ); + parent.add( mesh ); totaln += 1; total += vl; diff --git a/examples/webgl_particles_random.html b/examples/webgl_particles_random.html index 9c729c00..b47fad74 100644 --- a/examples/webgl_particles_random.html +++ b/examples/webgl_particles_random.html @@ -93,7 +93,7 @@ particles.rotation.x = Math.random() * 6; particles.rotation.y = Math.random() * 6; particles.rotation.z = Math.random() * 6; - scene.addObject( particles ); + scene.add( particles ); } diff --git a/examples/webgl_particles_sprites.html b/examples/webgl_particles_sprites.html index 981605a1..48527e97 100644 --- a/examples/webgl_particles_sprites.html +++ b/examples/webgl_particles_sprites.html @@ -98,7 +98,7 @@ particles.rotation.x = Math.random() * 6; particles.rotation.y = Math.random() * 6; particles.rotation.z = Math.random() * 6; - scene.addObject( particles ); + scene.add( particles ); } diff --git a/examples/webgl_performance.html b/examples/webgl_performance.html index 18864c18..3e5cd9c8 100644 --- a/examples/webgl_performance.html +++ b/examples/webgl_performance.html @@ -72,7 +72,7 @@ //mesh.frustumCulled = false; - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/examples/webgl_postprocessing.html b/examples/webgl_postprocessing.html index cce2d076..b82b2e03 100644 --- a/examples/webgl_postprocessing.html +++ b/examples/webgl_postprocessing.html @@ -129,7 +129,7 @@ directionalLight = new THREE.DirectionalLight( 0xffffff ); directionalLight.position.set( 0, 0, 1 ); directionalLight.position.normalize(); - sceneModel.addLight( directionalLight ); + sceneModel.add( directionalLight ); loader = new THREE.JSONLoader( true ); document.body.appendChild( loader.statusDomElement ); @@ -153,7 +153,7 @@ quadBG = new THREE.Mesh( plane, materialColor ); quadBG.position.z = -500; quadBG.scale.set( window.innerWidth, window.innerHeight, 1 ); - sceneBG.addObject( quadBG ); + sceneBG.add( quadBG ); // @@ -164,7 +164,7 @@ quadMask = new THREE.Mesh( plane, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) ); quadMask.position.z = -300; quadMask.scale.set( window.innerWidth / 2, window.innerHeight/2, 1 ); - sceneMask.addObject( quadMask ); + sceneMask.add( quadMask ); // @@ -360,7 +360,7 @@ mesh.position.set( 0, -50, 0 ); mesh.scale.set( scale, scale, scale ); - scene.addObject( mesh ); + scene.add( mesh ); loader.statusDomElement.style.display = "none"; diff --git a/examples/webgl_postprocessing_dof.html b/examples/webgl_postprocessing_dof.html index abd51301..ad1bf71d 100644 --- a/examples/webgl_postprocessing_dof.html +++ b/examples/webgl_postprocessing_dof.html @@ -147,7 +147,7 @@ mesh.matrixAutoUpdate = false; mesh.updateMatrix(); - scene.addObject( mesh ); + scene.add( mesh ); objects.push( mesh ); c++; @@ -260,7 +260,7 @@ postprocessing.quad = new THREE.Mesh( new THREE.PlaneGeometry( window.innerWidth, window.innerHeight ), postprocessing.materialBokeh ); postprocessing.quad.position.z = - 500; - postprocessing.scene.addObject( postprocessing.quad ); + postprocessing.scene.add( postprocessing.quad ); } diff --git a/examples/webgl_ribbons.html b/examples/webgl_ribbons.html index 1ddf4505..f23d605f 100644 --- a/examples/webgl_ribbons.html +++ b/examples/webgl_ribbons.html @@ -167,7 +167,7 @@ ribbon.boundRadiusScale = Math.max( ribbon.scale.x, Math.max( ribbon.scale.y, ribbon.scale.z ) ); ribbons.push( ribbon ); - scene.addObject( ribbon ); + scene.add( ribbon ); c ++; diff --git a/examples/webgl_rtt.html b/examples/webgl_rtt.html index 92eec882..e70ac749 100644 --- a/examples/webgl_rtt.html +++ b/examples/webgl_rtt.html @@ -121,12 +121,12 @@ var light = new THREE.DirectionalLight( 0xffffff ); light.position.set( 0, 0, 1 ); light.position.normalize(); - sceneRTT.addLight( light ); + sceneRTT.add( light ); light = new THREE.DirectionalLight( 0xffaaaa, 1.5 ); light.position.set( 0, 0, -1 ); light.position.normalize(); - sceneRTT.addLight( light ); + sceneRTT.add( light ); rtTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBFormat } ); @@ -150,13 +150,13 @@ quad = new THREE.Mesh( plane, material ); quad.position.z = -100; - sceneRTT.addObject( quad ); + sceneRTT.add( quad ); createMesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), sceneRTT ); quad = new THREE.Mesh( plane, materialScreen ); quad.position.z = -100; - sceneScreen.addObject( quad ); + sceneScreen.add( quad ); var n = 5, geometry = new THREE.SphereGeometry( 10, 64, 32 ), @@ -174,7 +174,7 @@ mesh.rotation.y = 1.57; - scene.addObject( mesh ); + scene.add( mesh ); } } @@ -202,12 +202,12 @@ zmesh1 = new THREE.Mesh( geometry, mat1 ); zmesh1.position.set( 0, 0, 100 ); zmesh1.scale.set( 1.5, 1.5, 1.5 ); - xscene.addObject( zmesh1 ); + xscene.add( zmesh1 ); zmesh2 = new THREE.Mesh( geometry, mat2 ); zmesh2.position.set( 0, 150, 100 ); zmesh2.scale.set( 0.75, 0.75, 0.75 ); - xscene.addObject( zmesh2 ); + xscene.add( zmesh2 ); } diff --git a/examples/webgl_sandbox.html b/examples/webgl_sandbox.html index 4430b3c0..fdd7f93d 100644 --- a/examples/webgl_sandbox.html +++ b/examples/webgl_sandbox.html @@ -230,7 +230,7 @@ mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 4 + 1; mesh.matrixAutoUpdate = false; mesh.updateMatrix(); - scene.addObject( mesh ); + scene.add( mesh ); } diff --git a/examples/webgl_scene_test.html b/examples/webgl_scene_test.html index 12ed7e8a..209ffcc5 100644 --- a/examples/webgl_scene_test.html +++ b/examples/webgl_scene_test.html @@ -372,18 +372,18 @@ object.rotation.z = Math.random() * 6; object.matrixAutoUpdate = false; object.updateMatrix(); - result.scene.addObject( object ); + result.scene.add( object ); } result.scene.matrixAutoUpdate = false; light = new THREE.PointLight( 0xffffff ); - result.scene.addLight( light ); + result.scene.add( light ); light = new THREE.DirectionalLight( 0x111111 ); light.position.x = 1; - result.scene.addLight( light ); + result.scene.add( light ); return result; diff --git a/examples/webgl_scene_test_blender.html b/examples/webgl_scene_test_blender.html index b0614148..fdcb97db 100644 --- a/examples/webgl_scene_test_blender.html +++ b/examples/webgl_scene_test_blender.html @@ -337,18 +337,18 @@ object.rotation.z = Math.random() * 6; object.matrixAutoUpdate = false; object.updateMatrix(); - result.scene.addObject( object ); + result.scene.add( object ); } result.scene.matrixAutoUpdate = false; light = new THREE.PointLight( 0xffffff ); - result.scene.addLight( light ); + result.scene.add( light ); light = new THREE.DirectionalLight( 0x111111 ); light.position.x = 1; - result.scene.addLight( light ); + result.scene.add( light ); return result; diff --git a/examples/webgl_shader.html b/examples/webgl_shader.html index 434bb11c..8235c91a 100644 --- a/examples/webgl_shader.html +++ b/examples/webgl_shader.html @@ -126,7 +126,7 @@ } ); mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), material ); - scene.addObject( mesh ); + scene.add( mesh ); renderer = new THREE.WebGLRenderer(); container.appendChild( renderer.domElement ); diff --git a/examples/webgl_shader2.html b/examples/webgl_shader2.html index ed0f5e75..fdc3b3f0 100644 --- a/examples/webgl_shader2.html +++ b/examples/webgl_shader2.html @@ -231,7 +231,7 @@ mesh = new THREE.Mesh( new THREE.CubeGeometry( size, size, size, 1, 1, 1, [ mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ], mlib[ i ] ], false ), new THREE.MeshFaceMaterial() ); mesh.position.x = i - ( params.length - 1 ) / 2; mesh.position.y = i % 2 - 0.5; - scene.addObject( mesh ); + scene.add( mesh ); meshes[ i ] = mesh; diff --git a/examples/webgl_shader_lava.html b/examples/webgl_shader_lava.html index 1c2b22ae..879e6496 100644 --- a/examples/webgl_shader_lava.html +++ b/examples/webgl_shader_lava.html @@ -175,7 +175,7 @@ mesh.position.x = 0; mesh.position.y = 0; mesh.rotation.x = 0.3; - scene.addObject( mesh ); + scene.add( mesh ); // diff --git a/examples/webgl_shadowmap.html b/examples/webgl_shadowmap.html index c6049fe1..9fdad2c6 100644 --- a/examples/webgl_shadowmap.html +++ b/examples/webgl_shadowmap.html @@ -91,13 +91,13 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x444444 ); - scene.addLight( ambient ); + scene.add( ambient ); light = new THREE.SpotLight( 0xffffff ); light.position.set( 0, 1500, 1000 ); light.target.position.set( 0, 0, 0 ); light.castShadow = true; - scene.addLight( light ); + scene.add( light ); createHUD(); createScene(); @@ -151,7 +151,7 @@ hudMesh.position.y = ( SCREEN_HEIGHT - SHADOW_MAP_HEIGHT / 2 ) * -0.5; sceneHUD = new THREE.Scene(); - sceneHUD.addObject( hudMesh ); + sceneHUD.add( hudMesh ); } @@ -172,7 +172,7 @@ ground.castShadow = false; ground.receiveShadow = true; - scene.addObject( ground ); + scene.add( ground ); // TEXT @@ -204,7 +204,7 @@ mesh.castShadow = true; mesh.receiveShadow = true; - scene.addObject( mesh ); + scene.add( mesh ); // CUBES @@ -216,7 +216,7 @@ mesh.castShadow = true; mesh.receiveShadow = true; - scene.addObject( mesh ); + scene.add( mesh ); var mesh = new THREE.Mesh( new THREE.CubeGeometry( 1600, 170, 250 ), planeMaterial ); @@ -226,7 +226,7 @@ mesh.castShadow = true; mesh.receiveShadow = true; - scene.addObject( mesh ); + scene.add( mesh ); // MORPHS @@ -244,7 +244,7 @@ meshAnim.castShadow = true; meshAnim.receiveShadow = false; - scene.addObject( meshAnim ); + scene.add( meshAnim ); morphs.push( { mesh: meshAnim, lastKeyframe: 0, currentKeyframe: 0, offset: Math.random() * 6, speed: speed, duration: duration, diff --git a/examples/webgl_sprites.html b/examples/webgl_sprites.html index 9e08903f..660860a2 100644 --- a/examples/webgl_sprites.html +++ b/examples/webgl_sprites.html @@ -71,27 +71,27 @@ sprite.position.normalize(); sprite.position.multiplyScalar( radius ); - group.addChild( sprite ); + group.add( sprite ); } - scene.addChild( group ); + scene.add( group ); // add 2d-sprites sprite = new THREE.Sprite( { map: mapA, alignment:THREE.SpriteAlignment.topLeft } ); sprite.position.set( 100, 100, 0 ); sprite.opacity = 0.25; - scene.addChild( sprite ); + scene.add( sprite ); sprite = new THREE.Sprite( { map: mapA, alignment:THREE.SpriteAlignment.topLeft } ); sprite.position.set( 150, 150, 2 ); sprite.opacity = 0.5; - scene.addChild( sprite ); + scene.add( sprite ); sprite = new THREE.Sprite( { map: mapA, alignment:THREE.SpriteAlignment.topLeft } ); sprite.position.set( 200, 200, 3 ); sprite.opacity = 1; - scene.addChild( sprite ); + scene.add( sprite ); // renderer diff --git a/examples/webgl_test_memory.html b/examples/webgl_test_memory.html index c5beee56..0dd2e3d8 100644 --- a/examples/webgl_test_memory.html +++ b/examples/webgl_test_memory.html @@ -78,11 +78,11 @@ var mesh = new THREE.Mesh( geometry, material ); - scene.addObject( mesh ); + scene.add( mesh ); renderer.render( scene, camera ); - scene.removeObject( mesh ); + scene.remove( mesh ); renderer.deallocateObject( mesh ); renderer.deallocateTexture( texture ); diff --git a/examples/webgl_trackballcamera_earth.html b/examples/webgl_trackballcamera_earth.html index d0f5718c..4005d6af 100644 --- a/examples/webgl_trackballcamera_earth.html +++ b/examples/webgl_trackballcamera_earth.html @@ -126,10 +126,7 @@ dirLight = new THREE.DirectionalLight( 0xFFFFFF ); dirLight.position.set( -1, 0, 1 ); dirLight.position.normalize(); - scene.addLight( dirLight ); - - ambientLight = new THREE.AmbientLight( 0xFFFFFF ); - //scene.addLight( ambientLight ); + scene.add( dirLight ); var planetTexture = THREE.ImageUtils.loadTexture( "textures/planets/earth_atmos_2048.jpg" ), cloudsTexture = THREE.ImageUtils.loadTexture( "textures/planets/earth_clouds_1024.png" ), @@ -172,7 +169,7 @@ meshPlanet = new THREE.Mesh( geometry, materialNormalMap ); meshPlanet.rotation.y = 1.3; meshPlanet.rotation.z = tilt; - scene.addObject( meshPlanet ); + scene.add( meshPlanet ); // clouds @@ -182,7 +179,7 @@ meshClouds = new THREE.Mesh( geometry, materialClouds ); meshClouds.scale.set( cloudsScale, cloudsScale, cloudsScale ); meshClouds.rotation.z = tilt; - scene.addObject( meshClouds ); + scene.add( meshClouds ); // moon @@ -192,7 +189,7 @@ meshMoon = new THREE.Mesh( geometry, materialMoon ); meshMoon.position.set( radius * 5, 0, 0 ); meshMoon.scale.set( moonScale, moonScale, moonScale ); - scene.addObject( meshMoon ); + scene.add( meshMoon ); // stars @@ -234,7 +231,7 @@ stars.matrixAutoUpdate = false; stars.updateMatrix(); - scene.addObject( stars ); + scene.add( stars ); } diff --git a/examples/webgl_utf8loader.html b/examples/webgl_utf8loader.html index dd8b5562..12860e8d 100644 --- a/examples/webgl_utf8loader.html +++ b/examples/webgl_utf8loader.html @@ -90,12 +90,12 @@ // LIGHTS var ambient = new THREE.AmbientLight( 0x221100 ); - scene.addLight( ambient ); + scene.add( ambient ); var directionalLight = new THREE.DirectionalLight( 0xffeedd ); directionalLight.position.set( 0, 0, 1 ); directionalLight.position.normalize(); - scene.addLight( directionalLight ); + scene.add( directionalLight ); // RENDERER @@ -137,7 +137,7 @@ mesh.position.set( x, y, z ); mesh.scale.set( s, s, s ); - scene.addObject( mesh ); + scene.add( mesh ); }