Skip to content

Commit 481af0d

Browse files
committed
Merge branch 'dev' of https://github.com/mrdoob/three.js into dev
2 parents c7f9708 + f68b64d commit 481af0d

File tree

5 files changed

+15
-29
lines changed

5 files changed

+15
-29
lines changed

docs/api/cameras/PerspectiveCamera.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h1>[name]</h1>
1717

1818
<h2>Example</h2>
1919

20-
<div>[example:canvas_effects_stereo effects / stereo ]</div>
20+
<div>[example:webgl_effects_stereo effects / stereo ]</div>
2121
<div>[example:canvas_geometry_birds geometry / birds ]</div>
2222
<div>[example:canvas_geometry_cube geometry / cube ]</div>
2323
<div>[example:webgl_animation_skinning_blending animation / skinning / blending ]</div>

src/core/Raycaster.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484

8585
} else if ( camera instanceof THREE.OrthographicCamera ) {
8686

87-
this.ray.origin.set( coords.x, coords.y, - 1 ).unproject( camera );
87+
this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera
8888
this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );
8989

9090
} else {

src/extras/geometries/PolyhedronGeometry.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
3838
var v2 = p[ indices[ i + 1 ] ];
3939
var v3 = p[ indices[ i + 2 ] ];
4040

41-
faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ], undefined, j );
41+
faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
4242

4343
}
4444

@@ -115,9 +115,9 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
115115

116116
// Approximate a curved face with recursively sub-divided triangles.
117117

118-
function make( v1, v2, v3, materialIndex ) {
118+
function make( v1, v2, v3 ) {
119119

120-
var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ], undefined, materialIndex );
120+
var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
121121
that.faces.push( face );
122122

123123
centroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );
@@ -143,8 +143,6 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
143143
var c = prepare( that.vertices[ face.c ] );
144144
var v = [];
145145

146-
var materialIndex = face.materialIndex;
147-
148146
// Construct all of the vertices for this subdivision.
149147

150148
for ( var i = 0 ; i <= cols; i ++ ) {
@@ -184,17 +182,15 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
184182
make(
185183
v[ i ][ k + 1 ],
186184
v[ i + 1 ][ k ],
187-
v[ i ][ k ],
188-
materialIndex
185+
v[ i ][ k ]
189186
);
190187

191188
} else {
192189

193190
make(
194191
v[ i ][ k + 1 ],
195192
v[ i + 1 ][ k + 1 ],
196-
v[ i + 1 ][ k ],
197-
materialIndex
193+
v[ i + 1 ][ k ]
198194
);
199195

200196
}

src/math/Vector3.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -594,23 +594,13 @@ THREE.Vector3.prototype = {
594594

595595
},
596596

597-
projectOnVector: function () {
597+
projectOnVector: function ( vector ) {
598598

599-
var v1, dot;
600-
601-
return function projectOnVector( vector ) {
602-
603-
if ( v1 === undefined ) v1 = new THREE.Vector3();
604-
605-
v1.copy( vector ).normalize();
606-
607-
dot = this.dot( v1 );
608-
609-
return this.copy( v1 ).multiplyScalar( dot );
610-
611-
};
612-
613-
}(),
599+
var scalar = vector.dot( this ) / vector.lengthSq();
600+
601+
return this.copy( vector ).multiplyScalar( scalar );
602+
603+
},
614604

615605
projectOnPlane: function () {
616606

src/renderers/webgl/WebGLState.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
5050

5151
function createTexture( type, target, count ) {
5252

53-
var data = new Uint8Array( 3 );
53+
var data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.
5454
var texture = gl.createTexture();
5555

5656
gl.bindTexture( type, texture );
@@ -59,7 +59,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
5959

6060
for ( var i = 0; i < count; i ++ ) {
6161

62-
gl.texImage2D( target + i, 0, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, data );
62+
gl.texImage2D( target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
6363

6464
}
6565

0 commit comments

Comments
 (0)