Skip to content

Commit 5477811

Browse files
committedMar 28, 2012
Change PlaneGeometry from XY to XZ as it's more intuitive.
Fixed all the examples that used PlaneGeometry except webgl_terrain_dynamic.html (not sure what's going on :S).
1 parent 19f0b1f commit 5477811

39 files changed

+79
-113
lines changed
 

‎examples/canvas_geometry_cube.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
// Plane
7777

7878
plane = new THREE.Mesh( new THREE.PlaneGeometry( 200, 200 ), new THREE.MeshBasicMaterial( { color: 0xe0e0e0 } ) );
79-
plane.rotation.x = - 90 * ( Math.PI / 180 );
8079
scene.add( plane );
8180

8281
renderer = new THREE.CanvasRenderer();
@@ -166,7 +165,7 @@
166165

167166
function render() {
168167

169-
plane.rotation.z = cube.rotation.y += ( targetRotation - cube.rotation.y ) * 0.05;
168+
plane.rotation.y = cube.rotation.y += ( targetRotation - cube.rotation.y ) * 0.05;
170169
renderer.render( scene, camera );
171170

172171
}

‎examples/canvas_geometry_earth.html

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262

6363
mesh = new THREE.Mesh( new THREE.PlaneGeometry( 300, 300, 3, 3 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/shadow.png' ), overdraw: true } ) );
6464
mesh.position.y = - 250;
65-
mesh.rotation.x = - 90 * Math.PI / 180;
6665
scene.add( mesh );
6766

6867
mesh = new THREE.Mesh( new THREE.SphereGeometry( 200, 20, 20 ), new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( 'textures/land_ocean_ice_cloud_2048.jpg' ), overdraw: true } ) );

‎examples/canvas_geometry_terrain.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@
7575
for ( var i = 0, l = plane.vertices.length; i < l; i ++ ) {
7676

7777
var x = i % quality, y = ~~ ( i / quality );
78-
plane.vertices[ i ].position.z = data[ ( x * step ) + ( y * step ) * 1024 ] * 2 - 128;
78+
plane.vertices[ i ].position.y = data[ ( x * step ) + ( y * step ) * 1024 ] * 2 - 128;
7979

8080
}
8181

8282
plane.computeCentroids();
8383

8484
mesh = new THREE.Mesh( plane, material );
85-
mesh.rotation.x = -90 * Math.PI / 180;
8685
scene.add( mesh );
8786

8887
renderer = new THREE.CanvasRenderer();

‎examples/canvas_interactive_voxelpainter.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@
7575

7676
projector = new THREE.Projector();
7777

78-
plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 20, 20 ), new THREE.MeshFaceMaterial() );
79-
plane.rotation.x = - 90 * Math.PI / 180;
78+
plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000 ), new THREE.MeshFaceMaterial() );
8079
scene.add( plane );
8180

8281
mouse2D = new THREE.Vector3( 0, 10000, 0.5 );

‎examples/canvas_materials_depth.html

-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@
7070

7171
plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 10, 10 ), material );
7272
plane.doubleSided = true;
73-
74-
plane.rotation.x = - 90 * ( Math.PI / 180 );
7573
plane.position.y = - 100;
7674

7775
scene.add( plane );

‎examples/canvas_materials_video.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,14 @@
108108
var plane = new THREE.PlaneGeometry( 480, 204, 4, 4 );
109109

110110
mesh = new THREE.Mesh( plane, material );
111+
mesh.rotation.x = Math.PI / 2;
111112
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.5;
112113
scene.add(mesh);
113114

114115
mesh = new THREE.Mesh( plane, materialReflection );
115116
mesh.position.y = -306;
117+
mesh.rotation.x = - Math.PI / 2;
116118
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1.5;
117-
mesh.rotation.x = 180 * Math.PI / 180;
118119
mesh.doubleSided = true;
119120
scene.add( mesh );
120121

‎examples/js/postprocessing/EffectComposer.js

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ THREE.EffectComposer.camera = new THREE.OrthographicCamera( window.innerWidth /
126126
// shared fullscreen quad scene
127127

128128
THREE.EffectComposer.geometry = new THREE.PlaneGeometry( 1, 1 );
129+
THREE.EffectComposer.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
129130

130131
THREE.EffectComposer.quad = new THREE.Mesh( THREE.EffectComposer.geometry, null );
131132
THREE.EffectComposer.quad.position.z = -100;

‎examples/misc_materials_multimaterials.html

+2
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ <h1>Multi-materials test</h1>
244244
mesh.position.x = i * ( size + 5 ) - ( ( materials.length - 1 ) * ( size + 5 ) / 2 );
245245
mesh.position.y = FLOOR + size / 2 + bottom;
246246
mesh.position.z = -100;
247+
mesh.rotation.x = Math.PI / 2;
247248
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
248249
mesh.doubleSided = true;
249250
scene.add( mesh );
@@ -265,6 +266,7 @@ <h1>Multi-materials test</h1>
265266
mesh.position.x = i * ( size + 5 ) - ( ( materials.length - 1 ) * ( size + 5 ) / 2 );
266267
mesh.position.y = FLOOR + size / 2 + bottom;
267268
mesh.position.z = - 99;
269+
mesh.rotation.x = Math.PI / 2;
268270
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
269271
mesh.doubleSided = true;
270272
scene.add( mesh );

‎examples/misc_sound.html

-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@
169169
var plane = new THREE.PlaneGeometry( 1000, 1000, 100, 100 );
170170
mesh = new THREE.Mesh( plane, material_wireframe );
171171
mesh.position.y = 0.1;
172-
mesh.rotation.x = -Math.PI/2;
173172
scene.add( mesh );
174173

175174

‎examples/misc_ubiquity_test.html

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282

8383
mesh = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
8484
mesh.position.y = -500;
85+
mesh.rotation.x = Math.PI / 2;
8586
mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
8687
mesh.doubleSided = true;
8788
scene.add( mesh );

‎examples/webgl_animation_skinning.html

-2
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,10 @@
9696

9797
floor = new THREE.Mesh( planeSimple, matSolid );
9898
floor.position.y = -10;
99-
floor.rotation.x = -Math.PI/2;
10099
floor.scale.set( 25, 25, 25 );
101100
scene.add( floor );
102101

103102
floor = new THREE.Mesh( planeTesselated, matWire );
104-
floor.rotation.x = -Math.PI/2;
105103
floor.scale.set( 25, 25, 25 );
106104
scene.add( floor );
107105

‎examples/webgl_geometry_colors.html

-3
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,16 @@
7676

7777
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
7878
mesh.position.y = - 250;
79-
mesh.rotation.x = - 90 * Math.PI / 180;
8079
scene.add( mesh );
8180

8281
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
8382
mesh.position.y = - 250;
8483
mesh.position.x = - 400;
85-
mesh.rotation.x = - 90 * Math.PI / 180;
8684
scene.add( mesh );
8785

8886
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
8987
mesh.position.y = - 250;
9088
mesh.position.x = 400;
91-
mesh.rotation.x = - 90 * Math.PI / 180;
9289
scene.add( mesh );
9390

9491
var faceIndices = [ 'a', 'b', 'c', 'd' ];

‎examples/webgl_geometry_dynamic.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
for ( i = 0, il = geometry.vertices.length; i < il; i ++ ) {
9393

94-
geometry.vertices[ i ].position.z = 35 * Math.sin( i/2 );
94+
geometry.vertices[ i ].position.y = 35 * Math.sin( i/2 );
9595

9696
}
9797

@@ -108,7 +108,6 @@
108108
material = new THREE.MeshBasicMaterial( { color: 0x0044ff, map: texture } );
109109

110110
mesh = new THREE.Mesh( geometry, material );
111-
mesh.rotation.x = - 90 * Math.PI / 180;
112111
scene.add( mesh );
113112

114113
renderer = new THREE.WebGLRenderer( { clearColor: 0xaaccff, clearAlpha: 1 } );
@@ -144,7 +143,7 @@
144143

145144
for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
146145

147-
geometry.vertices[ i ].position.z = 35 * Math.sin( i / 5 + ( time + i ) / 7 );
146+
geometry.vertices[ i ].position.y = 35 * Math.sin( i / 5 + ( time + i ) / 7 );
148147

149148
}
150149

‎examples/webgl_geometry_terrain.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,14 @@
8484

8585
for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
8686

87-
geometry.vertices[ i ].position.z = data[ i ] * 10;
87+
geometry.vertices[ i ].position.y = data[ i ] * 10;
8888

8989
}
9090

9191
texture = new THREE.Texture( generateTexture( data, worldWidth, worldDepth ), new THREE.UVMapping(), THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping );
9292
texture.needsUpdate = true;
9393

9494
mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: texture } ) );
95-
mesh.rotation.x = - 90 * Math.PI / 180;
9695
scene.add( mesh );
9796

9897
renderer = new THREE.WebGLRenderer();

‎examples/webgl_geometry_terrain_fog.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,14 @@
8787

8888
for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
8989

90-
geometry.vertices[ i ].position.z = data[ i ] * 10;
90+
geometry.vertices[ i ].position.y = data[ i ] * 10;
9191

9292
}
9393

9494
texture = new THREE.Texture( generateTexture( data, worldWidth, worldDepth ), new THREE.UVMapping(), THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping );
9595
texture.needsUpdate = true;
9696

9797
mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: texture } ) );
98-
mesh.rotation.x = - 90 * Math.PI / 180;
9998
scene.add( mesh );
10099

101100
renderer = new THREE.WebGLRenderer( { clearColor: 0xefd1b5, clearAlpha: 1 } );

‎examples/webgl_geometry_text.html

-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@
233233
createText();
234234

235235
var plane = new THREE.Mesh( new THREE.PlaneGeometry( 10000, 10000 ), new THREE.MeshBasicMaterial( { color: 0xffffff, opacity: 0.5, transparent: true } ) );
236-
plane.rotation.x = -Math.PI/2;
237236
plane.position.y = 100;
238237
scene.add( plane );
239238

‎examples/webgl_hdr.html

+2-9
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,7 @@
107107

108108
var container, stats;
109109

110-
var camera, scene, renderer, mesh, directionalLight;
111-
112-
var windowHalfX = window.innerWidth / 2;
113-
var windowHalfY = window.innerHeight / 2;
114-
110+
var camera, scene, renderer;
115111
var materialHDR, quad;
116112

117113
var sign = 1, rate = 1;
@@ -132,10 +128,6 @@
132128
scene.add( camera );
133129

134130

135-
directionalLight = new THREE.DirectionalLight( 0xffffff );
136-
directionalLight.position.set( 0, 0, 1 ).normalize();
137-
scene.add( directionalLight );
138-
139131
var texture = THREE.ImageUtils.loadTexture( "textures/memorial.png" );
140132
texture.minFilter = THREE.LinearFilter;
141133
texture.magFilter = THREE.NearestFilter;
@@ -156,6 +148,7 @@
156148

157149
quad = new THREE.Mesh( plane, materialHDR );
158150
quad.position.z = -100;
151+
quad.rotation.x = Math.PI / 2;
159152
scene.add( quad );
160153

161154
renderer = new THREE.WebGLRenderer();

‎examples/webgl_interactive_draggablecubes.html

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
}
9292

9393
plane = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.25, transparent: true, wireframe: true } ) );
94+
plane.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
9495
plane.lookAt( camera.position );
9596
plane.visible = false;
9697
scene.add( plane );

‎examples/webgl_interactive_voxelpainter.html

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
// grid
9090

9191
plane = new THREE.Mesh( new THREE.PlaneGeometry( 1000, 1000, 20, 20 ), new THREE.MeshBasicMaterial( { color: 0x555555, wireframe: true } ) );
92-
plane.rotation.x = - 90 * Math.PI / 180;
9392
scene.add( plane );
9493

9594
mouse2D = new THREE.Vector3( 0, 10000, 0.5 );

‎examples/webgl_lights_pointlights2.html

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
// GROUND
132132

133133
var mesh = new THREE.Mesh( new THREE.PlaneGeometry( 800, 400, 2, 2 ), groundMaterial );
134-
mesh.rotation.x = -1.57;
135134
mesh.position.y = -5;
136135
scene.add( mesh );
137136

‎examples/webgl_loader_json_objconverter.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ <h1>OBJ to Three.js converter test</h1>
107107

108108
mesh = new THREE.Mesh( geometry, xm );
109109
mesh.position.set( 0, FLOOR, 0 );
110-
mesh.rotation.x = Math.PI/2;
111110
mesh.scale.set( 10, 10, 10 );
112-
mesh.doubleSided = true;
113111
scene.add( mesh );
114112

115113
// SPHERES
@@ -216,6 +214,7 @@ <h1>OBJ to Three.js converter test</h1>
216214
mesh.position.x = i * (size + 5) - ( ( materials.length - 1 )* ( size + 5 )/2);
217215
mesh.position.y = FLOOR + size/2 + bottom;
218216
mesh.position.z = -100;
217+
mesh.rotation.x = Math.PI / 2;
219218
mesh.doubleSided = true;
220219
scene.add( mesh );
221220

@@ -237,6 +236,7 @@ <h1>OBJ to Three.js converter test</h1>
237236
mesh.position.x = i * ( size + 5 ) - ( ( materials.length - 1 )* ( size + 5 )/2);
238237
mesh.position.y = FLOOR + size/2 + bottom;
239238
mesh.position.z = -99;
239+
mesh.rotation.x = Math.PI / 2;
240240
mesh.doubleSided = true;
241241
scene.add( mesh );
242242

‎examples/webgl_materials_cubemap_dynamic.html

+10-12
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@
522522
groundBasic.color.setHSV( 0.1, 0.45, 0.995 );
523523

524524
ground = new THREE.Mesh( new THREE.PlaneGeometry( 50000, 50000 ), groundBasic );
525-
ground.rotation.x = - Math.PI / 2;
526525
ground.position.y = - 215;
527526
scene.add( ground );
528527

@@ -563,15 +562,14 @@
563562
var shadowTexture = THREE.ImageUtils.loadTexture( "textures/shadowAlpha.png" );
564563

565564
var shadowPlane = new THREE.PlaneGeometry( 400, 400 );
566-
var shadowMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.35, transparent: true,
567-
map: shadowTexture,
568-
polygonOffset: false, polygonOffsetFactor: -0.5, polygonOffsetUnits: 1 } );
565+
var shadowMaterial = new THREE.MeshBasicMaterial( {
566+
color: 0xff0000, opacity: 0.35, transparent: true, map: shadowTexture,
567+
polygonOffset: false, polygonOffsetFactor: -0.5, polygonOffsetUnits: 1
568+
} );
569569

570570
var shadow = new THREE.Mesh( shadowPlane, shadowMaterial );
571-
shadow.rotation.x = -Math.PI/2;
572-
shadow.rotation.z = Math.PI/2;
573-
574571
shadow.position.y = sy;
572+
shadow.rotation.y = Math.PI / 2;
575573

576574
object.add( shadow );
577575

@@ -682,13 +680,13 @@
682680
var shadowHeight = 1.25 * ss * ( bb.max.x - bb.min.x );
683681

684682
var shadowPlane = new THREE.PlaneGeometry( shadowWidth, shadowHeight );
685-
var shadowMaterial = new THREE.MeshBasicMaterial( { color: 0xffffff, opacity: 0.5, transparent: true,
686-
map: shadowTexture,
687-
polygonOffset: false, polygonOffsetFactor: -0.5, polygonOffsetUnits: 1 } );
683+
var shadowMaterial = new THREE.MeshBasicMaterial( {
684+
color: 0xffffff, opacity: 0.5, transparent: true, map: shadowTexture,
685+
polygonOffset: false, polygonOffsetFactor: -0.5, polygonOffsetUnits: 1
686+
} );
688687

689688
var shadow = new THREE.Mesh( shadowPlane, shadowMaterial );
690-
shadow.rotation.x = -Math.PI/2;
691-
shadow.rotation.z = Math.PI/2;
689+
shadow.rotation.y = Math.PI / 2;
692690
shadow.position.y = s + 10;
693691

694692
object.root.add( shadow );

‎examples/webgl_materials_grass.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@
4646

4747
for ( var i = 0; i < 15; i ++ ) {
4848

49-
mesh = levels[ i ] = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: new THREE.Texture( generateTextureLevel( bitmap ) ), transparent: true, depthTest: false } ) );
49+
mesh = levels[ i ] = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map: new THREE.Texture( generateTextureLevel( bitmap ) ), transparent: true, depthWrite: false, depthTest: false } ) );
5050
mesh.material.map.needsUpdate = true;
5151

52-
mesh.rotation.x = - 90 * ( Math.PI / 180 );
5352
mesh.position.y = i * 0.25;
5453

5554
scene.add( mesh );

‎examples/webgl_materials_texture_filters.html

+11-13
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,10 @@
132132

133133

134134
var meshCanvas = new THREE.Mesh( geometry, materialCanvas );
135-
meshCanvas.rotation.x = Math.PI / 2;
136135
meshCanvas.scale.set( 1000, 1000, 1000 );
137-
meshCanvas.doubleSided = true;
138136

139137
var meshCanvas2 = new THREE.Mesh( geometry, materialCanvas2 );
140-
meshCanvas2.rotation.x = Math.PI / 2;
141138
meshCanvas2.scale.set( 1000, 1000, 1000 );
142-
meshCanvas2.doubleSided = true;
143139

144140

145141
// PAINTING
@@ -152,33 +148,35 @@
152148
scene.add( meshCanvas );
153149
scene2.add( meshCanvas2 );
154150

155-
var geometry = new THREE.PlaneGeometry( 100, 100 ),
156-
mesh = new THREE.Mesh( geometry, materialPainting ),
157-
mesh2 = new THREE.Mesh( geometry, materialPainting2 );
151+
var geometry = new THREE.PlaneGeometry( 100, 100 );
152+
var mesh = new THREE.Mesh( geometry, materialPainting );
153+
var mesh2 = new THREE.Mesh( geometry, materialPainting2 );
154+
155+
mesh.rotation.x = Math.PI / 2;
156+
mesh2.rotation.x = Math.PI / 2;
158157

159158
addPainting( scene, mesh );
160159
addPainting( scene2, mesh2 );
161160

162161
function addPainting( zscene, zmesh ) {
163162

164163
zmesh.scale.x = image.width / 100;
165-
zmesh.scale.y = image.height / 100;
164+
zmesh.scale.z = image.height / 100;
166165

167166
zscene.add( zmesh );
168167

169168
var meshFrame = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, polygonOffset: true, polygonOffsetFactor: 1, polygonOffsetUnits: 5 } ) );
170-
169+
meshFrame.rotation.x = Math.PI / 2;
171170
meshFrame.scale.x = 1.1 * image.width / 100;
172-
meshFrame.scale.y = 1.1 * image.height / 100;
171+
meshFrame.scale.z = 1.1 * image.height / 100;
173172

174173
zscene.add( meshFrame );
175174

176-
var meshShadow = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.9, transparent: true } ) );
175+
var meshShadow = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.75, transparent: true } ) );
177176

178177
meshShadow.position.z = - 1.1 * image.height/2;
179178
meshShadow.scale.x = 1.1 * image.width / 100;
180-
meshShadow.scale.y = 1.1 * image.height / 100;
181-
meshShadow.rotation.x = -Math.PI / 2;
179+
meshShadow.scale.z = 1.1 * image.height / 100;
182180
zscene.add( meshShadow );
183181

184182
meshShadow.position.y = - 1.1 * image.height/2;

‎examples/webgl_morphtargets_md2.html

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
var ground = new THREE.Mesh( gg, gm );
122122
ground.material.map.repeat.set( 8, 8 );
123123
ground.material.map.wrapS = ground.material.map.wrapT = THREE.RepeatWrapping;
124-
ground.rotation.x = - Math.PI/2;
125124
ground.receiveShadow = true;
126125

127126
scene.add( ground );

‎examples/webgl_morphtargets_md2_control.html

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@
122122
var ground = new THREE.Mesh( gg, gm );
123123
ground.material.map.repeat.set( 64, 64 );
124124
ground.material.map.wrapS = ground.material.map.wrapT = THREE.RepeatWrapping;
125-
ground.rotation.x = - Math.PI/2;
126125
ground.receiveShadow = true;
127126

128127
scene.add( ground );

‎examples/webgl_multiple_canvases_circle.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@
230230
var mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
231231
mesh.position.y = - 250;
232232
mesh.position.x = - ( noof_balls - 1 ) / 2 *400 + i * 400;
233-
mesh.rotation.x = - 90 * Math.PI / 180;
234233
scene.add( mesh );
235234

236235
}
@@ -284,7 +283,7 @@
284283

285284
}
286285

287-
renderer = new THREE.WebGLRenderer( { antialias: true, clearColor: 0xffffff } );
286+
renderer = new THREE.WebGLRenderer( { antialias: true } );
288287
renderer.setSize( container.clientWidth, container.clientHeight );
289288

290289
container.appendChild( renderer.domElement );

‎examples/webgl_multiple_canvases_complex.html

100755100644
+1-4
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,16 @@
136136

137137
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
138138
mesh.position.y = - 250;
139-
mesh.rotation.x = - 90 * Math.PI / 180;
140139
scene.add( mesh );
141140

142141
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
143142
mesh.position.y = - 250;
144143
mesh.position.x = - 400;
145-
mesh.rotation.x = - 90 * Math.PI / 180;
146144
scene.add( mesh );
147145

148146
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
149147
mesh.position.y = - 250;
150148
mesh.position.x = 400;
151-
mesh.rotation.x = - 90 * Math.PI / 180;
152149
scene.add( mesh );
153150

154151
var faceIndices = [ 'a', 'b', 'c', 'd' ];
@@ -217,7 +214,7 @@
217214
group3.rotation.x = 0;
218215
scene.add( group3 );
219216

220-
renderer = new THREE.WebGLRenderer( { antialias: true, clearColor: 0xffffff } );
217+
renderer = new THREE.WebGLRenderer( { antialias: true } );
221218
renderer.setSize( container.clientWidth, container.clientHeight );
222219

223220
container.appendChild( renderer.domElement );

‎examples/webgl_multiple_canvases_grid.html

100755100644
+1-4
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,16 @@
152152

153153
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
154154
mesh.position.y = - 250;
155-
mesh.rotation.x = - 90 * Math.PI / 180;
156155
scene.add( mesh );
157156

158157
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
159158
mesh.position.y = - 250;
160159
mesh.position.x = - 400;
161-
mesh.rotation.x = - 90 * Math.PI / 180;
162160
scene.add( mesh );
163161

164162
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
165163
mesh.position.y = - 250;
166164
mesh.position.x = 400;
167-
mesh.rotation.x = - 90 * Math.PI / 180;
168165
scene.add( mesh );
169166

170167
var faceIndices = [ 'a', 'b', 'c', 'd' ];
@@ -233,7 +230,7 @@
233230
group3.rotation.x = 0;
234231
scene.add( group3 );
235232

236-
renderer = new THREE.WebGLRenderer( { antialias: true, clearColor: 0xffffff } );
233+
renderer = new THREE.WebGLRenderer( { antialias: true } );
237234
renderer.setSize( container.clientWidth, container.clientHeight );
238235

239236
container.appendChild( renderer.domElement );

‎examples/webgl_multiple_views.html

-3
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,16 @@
133133

134134
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
135135
mesh.position.y = - 250;
136-
mesh.rotation.x = - 90 * Math.PI / 180;
137136
scene.add( mesh );
138137

139138
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
140139
mesh.position.y = - 250;
141140
mesh.position.x = - 400;
142-
mesh.rotation.x = - 90 * Math.PI / 180;
143141
scene.add( mesh );
144142

145143
mesh = new THREE.Mesh( shadowGeo, shadowMaterial );
146144
mesh.position.y = - 250;
147145
mesh.position.x = 400;
148-
mesh.rotation.x = - 90 * Math.PI / 180;
149146
scene.add( mesh );
150147

151148
var faceIndices = [ 'a', 'b', 'c', 'd' ];

‎examples/webgl_particles_dynamic.html

-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@
148148
scene.add( parent );
149149

150150
var grid = new THREE.ParticleSystem( new THREE.PlaneGeometry( 15000, 15000, 64, 64 ), new THREE.ParticleBasicMaterial( { color: 0xff0000, size: 10 } ) );
151-
grid.rotation.x = Math.PI/2;
152151
grid.position.y = -400;
153152
parent.add( grid );
154153

‎examples/webgl_postprocessing.html

+6-7
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,21 @@
112112
//
113113

114114
var materialColor = new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture( "textures/cube/SwedishRoyalCastle/pz.jpg" ), depthTest: false } );
115-
var plane = new THREE.PlaneGeometry( 1, 1 );
116115

117-
quadBG = new THREE.Mesh( plane, materialColor );
116+
quadBG = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), materialColor );
118117
quadBG.position.z = -500;
119-
quadBG.scale.set( window.innerWidth, window.innerHeight, 1 );
118+
quadBG.rotation.x = Math.PI / 2;
119+
quadBG.scale.set( window.innerWidth, 1, window.innerHeight );
120120
sceneBG.add( quadBG );
121121

122122
//
123123

124124
var sceneMask = new THREE.Scene();
125125

126-
var plane = new THREE.PlaneGeometry( 1, 1 );
127-
128-
quadMask = new THREE.Mesh( plane, new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
126+
quadMask = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), new THREE.MeshBasicMaterial( { color: 0xffaa00 } ) );
129127
quadMask.position.z = -300;
130-
quadMask.scale.set( window.innerWidth / 2, window.innerHeight/2, 1 );
128+
quadMask.rotation.x = Math.PI / 2;
129+
quadMask.scale.set( window.innerWidth / 2, 1, window.innerHeight / 2 );
131130
sceneMask.add( quadMask );
132131

133132
//

‎examples/webgl_postprocessing_dof.html

+1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@
263263

264264
postprocessing.quad = new THREE.Mesh( new THREE.PlaneGeometry( window.innerWidth, window.innerHeight ), postprocessing.materialBokeh );
265265
postprocessing.quad.position.z = - 500;
266+
postprocessing.quad.rotation.x = Math.PI / 2;
266267
postprocessing.scene.add( postprocessing.quad );
267268

268269
}

‎examples/webgl_rtt.html

+2
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,14 @@
156156

157157
quad = new THREE.Mesh( plane, material );
158158
quad.position.z = -100;
159+
quad.rotation.x = Math.PI / 2;
159160
sceneRTT.add( quad );
160161

161162
createMesh( new THREE.TorusGeometry( 100, 25, 15, 30 ), sceneRTT );
162163

163164
quad = new THREE.Mesh( plane, materialScreen );
164165
quad.position.z = -100;
166+
quad.rotation.x = Math.PI / 2;
165167
sceneScreen.add( quad );
166168

167169
var n = 5,

‎examples/webgl_shader.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!doctype html>
22
<html lang="en">
33
<head>
4-
<title>three.js webgl - materials - shaders [Monjori]</title>
4+
<title>three.js webgl - shader [Monjori]</title>
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
77
<style>
@@ -129,6 +129,7 @@
129129
} );
130130

131131
mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), material );
132+
mesh.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
132133
scene.add( mesh );
133134

134135
renderer = new THREE.WebGLRenderer();

‎examples/webgl_shading_physical.html

-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@
196196

197197
var ground = new THREE.Mesh( planeGeometry, groundMaterial );
198198
ground.position.set( 0, 0, 0 );
199-
ground.rotation.x = -Math.PI/2;
200199
ground.scale.set( 1000, 1000, 1000 );
201200

202201
ground.receiveShadow = true;

‎examples/webgl_shadowmap.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
var hudMesh = new THREE.Mesh( hudGeo, hudMaterial );
167167
hudMesh.position.x = ( SCREEN_WIDTH - SHADOW_MAP_WIDTH / 2 ) * -0.5;
168168
hudMesh.position.y = ( SCREEN_HEIGHT - SHADOW_MAP_HEIGHT / 2 ) * -0.5;
169+
hudMesh.rotation.x = Math.PI / 2;
169170

170171
sceneHUD = new THREE.Scene();
171172
sceneHUD.add( hudMesh );
@@ -186,7 +187,6 @@
186187
var ground = new THREE.Mesh( geometry, planeMaterial );
187188

188189
ground.position.set( 0, FLOOR, 0 );
189-
ground.rotation.x = -Math.PI/2;
190190
ground.scale.set( 100, 100, 100 );
191191

192192
ground.castShadow = false;

‎examples/webgl_terrain_dynamic.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@
419419

420420
quadTarget = new THREE.Mesh( plane, new THREE.MeshBasicMaterial( { color: 0xff0000 } ) );
421421
quadTarget.position.z = -500;
422+
// quadTarget.rotation.x = Math.PI;
422423
sceneRenderTarget.add( quadTarget );
423424

424425
// TERRAIN MESH
@@ -429,7 +430,6 @@
429430
geometryTerrain.computeTangents();
430431

431432
terrain = new THREE.Mesh( geometryTerrain, mlib[ "terrain" ] );
432-
terrain.rotation.set( -Math.PI/2, 0, 0 );
433433
terrain.position.set( 0, -125, 0 );
434434
terrain.visible = false;
435435
scene.add( terrain );
@@ -631,6 +631,7 @@
631631

632632
var meshTmp = new THREE.Mesh( new THREE.PlaneGeometry( SCREEN_WIDTH, SCREEN_HEIGHT ), shaderMaterial );
633633
meshTmp.position.z = -500;
634+
// meshTmp.rotation.x = Math.PI / 2;
634635
sceneTmp.add( meshTmp );
635636

636637
renderer.render( sceneTmp, cameraOrtho, target, true );

‎src/extras/geometries/PlaneGeometry.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,54 @@
33
* based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
44
*/
55

6-
THREE.PlaneGeometry = function ( width, height, segmentsWidth, segmentsHeight ) {
6+
THREE.PlaneGeometry = function ( width, depth, segmentsWidth, segmentsDepth ) {
77

88
THREE.Geometry.call( this );
99

10-
var ix, iy,
10+
var ix, iz,
1111
width_half = width / 2,
12-
height_half = height / 2,
12+
depth_half = depth / 2,
1313
gridX = segmentsWidth || 1,
14-
gridY = segmentsHeight || 1,
14+
gridZ = segmentsDepth || 1,
1515
gridX1 = gridX + 1,
16-
gridY1 = gridY + 1,
16+
gridZ1 = gridZ + 1,
1717
segment_width = width / gridX,
18-
segment_height = height / gridY,
19-
normal = new THREE.Vector3( 0, 0, 1 );
18+
segment_depth = depth / gridZ,
19+
normal = new THREE.Vector3( 0, 1, 0 );
2020

21-
for ( iy = 0; iy < gridY1; iy++ ) {
21+
for ( iz = 0; iz < gridZ1; iz ++ ) {
2222

23-
for ( ix = 0; ix < gridX1; ix++ ) {
23+
for ( ix = 0; ix < gridX1; ix ++ ) {
2424

2525
var x = ix * segment_width - width_half;
26-
var y = iy * segment_height - height_half;
26+
var z = iz * segment_depth - depth_half;
2727

28-
this.vertices.push( new THREE.Vertex( new THREE.Vector3( x, - y, 0 ) ) );
28+
this.vertices.push( new THREE.Vertex( new THREE.Vector3( x, 0, z ) ) );
2929

3030
}
3131

3232
}
3333

34-
for ( iy = 0; iy < gridY; iy++ ) {
34+
for ( iz = 0; iz < gridZ; iz ++ ) {
3535

36-
for ( ix = 0; ix < gridX; ix++ ) {
36+
for ( ix = 0; ix < gridX; ix ++ ) {
3737

38-
var a = ix + gridX1 * iy;
39-
var b = ix + gridX1 * ( iy + 1 );
40-
var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
41-
var d = ( ix + 1 ) + gridX1 * iy;
38+
var a = ix + gridX1 * iz;
39+
var b = ix + gridX1 * ( iz + 1 );
40+
var c = ( ix + 1 ) + gridX1 * ( iz + 1 );
41+
var d = ( ix + 1 ) + gridX1 * iz;
4242

4343
var face = new THREE.Face4( a, b, c, d );
4444
face.normal.copy( normal );
4545
face.vertexNormals.push( normal.clone(), normal.clone(), normal.clone(), normal.clone() );
4646

4747
this.faces.push( face );
4848
this.faceVertexUvs[ 0 ].push( [
49-
new THREE.UV( ix / gridX, iy / gridY ),
50-
new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
51-
new THREE.UV( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ),
52-
new THREE.UV( ( ix + 1 ) / gridX, iy / gridY )
53-
] );
49+
new THREE.UV( ix / gridX, iz / gridZ ),
50+
new THREE.UV( ix / gridX, ( iz + 1 ) / gridZ ),
51+
new THREE.UV( ( ix + 1 ) / gridX, ( iz + 1 ) / gridZ ),
52+
new THREE.UV( ( ix + 1 ) / gridX, iz / gridZ )
53+
] );
5454

5555
}
5656

0 commit comments

Comments
 (0)
Please sign in to comment.