Skip to content

Commit 2c94803

Browse files
committed
Merge remote-tracking branch 'bhouston/dev' into dev
2 parents efc1b6a + 2103070 commit 2c94803

56 files changed

Lines changed: 4718 additions & 356 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/canvas_geometry_hierarchy.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
mesh.position.x = Math.random() * 2000 - 1000;
6060
mesh.position.y = Math.random() * 2000 - 1000;
6161
mesh.position.z = Math.random() * 2000 - 1000;
62-
mesh.rotation.x = Math.random() * 360 * ( Math.PI / 180 );
63-
mesh.rotation.y = Math.random() * 360 * ( Math.PI / 180 );
62+
mesh.rotation.x = Math.random() * 2 * Math.PI;
63+
mesh.rotation.y = Math.random() * 2 * Math.PI;
6464
mesh.matrixAutoUpdate = false;
6565
mesh.updateMatrix();
6666
group.add( mesh );
@@ -122,9 +122,10 @@
122122
camera.position.y += ( - mouseY - camera.position.y ) * .05;
123123
camera.lookAt( scene.position );
124124

125-
group.rotation.x = Math.sin( Date.now() * 0.0007 ) * 0.5;
126-
group.rotation.y = Math.sin( Date.now() * 0.0003 ) * 0.5;
127-
group.rotation.z = Math.sin( Date.now() * 0.0002 ) * 0.5;
125+
var currentSeconds = Date.now();
126+
group.rotation.x = Math.sin( currentSeconds * 0.0007 ) * 0.5;
127+
group.rotation.y = Math.sin( currentSeconds * 0.0003 ) * 0.5;
128+
group.rotation.z = Math.sin( currentSeconds * 0.0002 ) * 0.5;
128129

129130
renderer.render( scene, camera );
130131

examples/canvas_geometry_panorama.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@
208208
function render() {
209209

210210
lat = Math.max( - 85, Math.min( 85, lat ) );
211-
phi = ( 90 - lat ) * Math.PI / 180;
212-
theta = lon * Math.PI / 180;
211+
phi = THREE.Math.degToRad( 90 - lat );
212+
theta = THREE.Math.degToRad( lon );
213213

214214
target.x = 500 * Math.sin( phi ) * Math.cos( theta );
215215
target.y = 500 * Math.cos( phi );

examples/canvas_geometry_panorama_fisheye.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@
236236
function render() {
237237

238238
lat = Math.max( - 85, Math.min( 85, lat ) );
239-
phi = ( 90 - lat ) * Math.PI / 180;
240-
theta = lon * Math.PI / 180;
239+
phi = THREE.Math.degToRad( 90 - lat );
240+
theta = THREE.Math.degToRad( lon );
241241

242242
target.x = 500 * Math.sin( phi ) * Math.cos( theta );
243243
target.y = 500 * Math.cos( phi );

examples/canvas_interactive_cubes.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161
object.scale.y = Math.random() * 2 + 1;
6262
object.scale.z = Math.random() * 2 + 1;
6363

64-
object.rotation.x = ( Math.random() * 360 ) * Math.PI / 180;
65-
object.rotation.y = ( Math.random() * 360 ) * Math.PI / 180;
66-
object.rotation.z = ( Math.random() * 360 ) * Math.PI / 180;
64+
object.rotation.x = Math.random() * 2 * Math.PI;
65+
object.rotation.y = Math.random() * 2 * Math.PI;
66+
object.rotation.z = Math.random() * 2 * Math.PI;
6767

6868
scene.add( object );
6969

@@ -163,11 +163,11 @@
163163

164164
function render() {
165165

166-
theta += 0.2;
166+
theta += 0.1;
167167

168-
camera.position.x = radius * Math.sin( theta * Math.PI / 360 );
169-
camera.position.y = radius * Math.sin( theta * Math.PI / 360 );
170-
camera.position.z = radius * Math.cos( theta * Math.PI / 360 );
168+
camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
169+
camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) );
170+
camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
171171
camera.lookAt( scene.position );
172172

173173
renderer.render( scene, camera );

examples/canvas_interactive_cubes_tween.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
object.scale.x = Math.random() * 2 + 1;
5959
object.scale.y = Math.random() * 2 + 1;
6060
object.scale.z = Math.random() * 2 + 1;
61-
object.rotation.x = ( Math.random() * 360 ) * Math.PI / 180;
62-
object.rotation.y = ( Math.random() * 360 ) * Math.PI / 180;
63-
object.rotation.z = ( Math.random() * 360 ) * Math.PI / 180;
61+
object.rotation.x = Math.random() * 2 * Math.PI;
62+
object.rotation.y = Math.random() * 2 * Math.PI;
63+
object.rotation.z = Math.random() * 2 * Math.PI;
6464
scene.add( object );
6565

6666
}
@@ -114,9 +114,9 @@
114114
.easing( TWEEN.Easing.Elastic.Out).start();
115115

116116
new TWEEN.Tween( intersects[ 0 ].object.rotation ).to( {
117-
x: ( Math.random() * 360 ) * Math.PI / 180,
118-
y: ( Math.random() * 360 ) * Math.PI / 180,
119-
z: ( Math.random() * 360 ) * Math.PI / 180 }, 2000 )
117+
x: Math.random() * 2 * Math.PI,
118+
y: Math.random() * 2 * Math.PI,
119+
z: Math.random() * 2 * Math.PI }, 2000 )
120120
.easing( TWEEN.Easing.Elastic.Out).start();
121121

122122
}
@@ -149,11 +149,11 @@
149149

150150
TWEEN.update();
151151

152-
theta += 0.2;
152+
theta += 0.1;
153153

154-
camera.position.x = radius * Math.sin( theta * Math.PI / 360 );
155-
camera.position.y = radius * Math.sin( theta * Math.PI / 360 );
156-
camera.position.z = radius * Math.cos( theta * Math.PI / 360 );
154+
camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
155+
camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) );
156+
camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
157157
camera.lookAt( scene.position );
158158

159159
renderer.render( scene, camera );

examples/canvas_interactive_particles.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@
135135

136136
// rotate camera
137137

138-
theta += 0.2;
138+
theta += 0.1;
139139

140-
camera.position.x = radius * Math.sin( theta * Math.PI / 360 );
141-
camera.position.y = radius * Math.sin( theta * Math.PI / 360 );
142-
camera.position.z = radius * Math.cos( theta * Math.PI / 360 );
140+
camera.position.x = radius * Math.sin( THREE.Math.degToRad( theta ) );
141+
camera.position.y = radius * Math.sin( THREE.Math.degToRad( theta ) );
142+
camera.position.z = radius * Math.cos( THREE.Math.degToRad( theta ) );
143143
camera.lookAt( scene.position );
144144

145145
// find intersections

examples/css3d_panorama.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@
192192

193193
lon += 0.1;
194194
lat = Math.max( - 85, Math.min( 85, lat ) );
195-
phi = ( 90 - lat ) * Math.PI / 180;
196-
theta = lon * Math.PI / 180;
195+
phi = THREE.Math.degToRad( 90 - lat );
196+
theta = THREE.Math.degToRad( lon );
197197

198198
target.x = Math.sin( phi ) * Math.cos( theta );
199199
target.y = Math.cos( phi );

examples/js/controls/FirstPersonControls.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ THREE.FirstPersonControls = function ( object, domElement ) {
231231
if( this.lookVertical ) this.lat -= this.mouseY * actualLookSpeed; // * this.invertVertical?-1:1;
232232

233233
this.lat = Math.max( - 85, Math.min( 85, this.lat ) );
234-
this.phi = ( 90 - this.lat ) * Math.PI / 180;
235-
this.theta = this.lon * Math.PI / 180;
234+
this.phi = THREE.Math.degToRad( 90 - this.lat );
235+
this.theta = THREE.Math.degToRad( this.lon );
236236

237237
var targetPosition = this.target,
238238
position = this.object.position;
@@ -255,9 +255,9 @@ THREE.FirstPersonControls = function ( object, domElement ) {
255255
if( this.lookVertical ) this.lat -= this.mouseY * actualLookSpeed * verticalLookRatio;
256256

257257
this.lat = Math.max( - 85, Math.min( 85, this.lat ) );
258-
this.phi = ( 90 - this.lat ) * Math.PI / 180;
258+
this.phi = THREE.Math.degToRad( 90 - this.lat );
259259

260-
this.theta = this.lon * Math.PI / 180;
260+
this.theta = THREE.Math.degToRad( this.lon );
261261

262262
if ( this.constrainVertical ) {
263263

examples/js/controls/PathControls.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ THREE.PathControls = function ( object, domElement ) {
4141
this.phi = 0;
4242
this.theta = 0;
4343

44-
var PI2 = Math.PI * 2,
45-
PI180 = Math.PI / 180;
44+
var PI2 = Math.PI * 2;
4645

4746
this.viewHalfX = 0;
4847
this.viewHalfY = 0;
@@ -81,8 +80,8 @@ THREE.PathControls = function ( object, domElement ) {
8180
this.lon = Math.max( 0, Math.min( 360, this.lon ) );
8281
this.lat = Math.max( - 85, Math.min( 85, this.lat ) );
8382

84-
this.phi = ( 90 - this.lat ) * PI180;
85-
this.theta = this.lon * PI180;
83+
this.phi = THREE.Math.degToRad( 90 - this.lat );
84+
this.theta = THREE.Math.degToRad( this.lon );
8685

8786
this.phi = normalize_angle_rad( this.phi );
8887

examples/js/effects/AnaglyphEffect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ THREE.AnaglyphEffect = function ( renderer, width, height ) {
117117
var projectionMatrix = camera.projectionMatrix.clone();
118118
var eyeSep = focalLength / 30 * 0.5;
119119
var eyeSepOnProjection = eyeSep * _near / focalLength;
120-
var ymax = _near * Math.tan( _fov * Math.PI / 360 );
120+
var ymax = _near * Math.tan( THREE.Math.degToRad( _fov * 0.5 ) );
121121
var xmin, xmax;
122122

123123
// translate xOffset

0 commit comments

Comments
 (0)