@@ -2501,23 +2501,13 @@ THREE.Vector3.prototype = {
2501
2501
2502
2502
},
2503
2503
2504
- projectOnVector: function () {
2504
+ projectOnVector: function ( vector ) {
2505
2505
2506
- var v1, dot;
2507
-
2508
- return function projectOnVector( vector ) {
2509
-
2510
- if ( v1 === undefined ) v1 = new THREE.Vector3();
2511
-
2512
- v1.copy( vector ).normalize();
2513
-
2514
- dot = this.dot( v1 );
2515
-
2516
- return this.copy( v1 ).multiplyScalar( dot );
2517
-
2518
- };
2519
-
2520
- }(),
2506
+ var scalar = vector.dot( this ) / vector.lengthSq();
2507
+
2508
+ return this.copy( vector ).multiplyScalar( scalar );
2509
+
2510
+ },
2521
2511
2522
2512
projectOnPlane: function () {
2523
2513
@@ -8410,7 +8400,7 @@ THREE.Layers.prototype = {
8410
8400
8411
8401
} else if ( camera instanceof THREE.OrthographicCamera ) {
8412
8402
8413
- this.ray.origin.set( coords.x, coords.y, - 1 ) .unproject( camera );
8403
+ this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ) .unproject( camera ); // set origin in plane of camera
8414
8404
this.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );
8415
8405
8416
8406
} else {
@@ -29980,7 +29970,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
29980
29970
29981
29971
function createTexture( type, target, count ) {
29982
29972
29983
- var data = new Uint8Array( 3 );
29973
+ var data = new Uint8Array( 4 ); // 4 is required to match default unpack alignment of 4.
29984
29974
var texture = gl.createTexture();
29985
29975
29986
29976
gl.bindTexture( type, texture );
@@ -29989,7 +29979,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
29989
29979
29990
29980
for ( var i = 0; i < count; i ++ ) {
29991
29981
29992
- gl.texImage2D( target + i, 0, gl.RGB , 1, 1, 0, gl.RGB , gl.UNSIGNED_BYTE, data );
29982
+ gl.texImage2D( target + i, 0, gl.RGBA , 1, 1, 0, gl.RGBA , gl.UNSIGNED_BYTE, data );
29993
29983
29994
29984
}
29995
29985
@@ -39620,7 +39610,7 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
39620
39610
var v2 = p[ indices[ i + 1 ] ];
39621
39611
var v3 = p[ indices[ i + 2 ] ];
39622
39612
39623
- faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ], undefined, j );
39613
+ faces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
39624
39614
39625
39615
}
39626
39616
@@ -39697,9 +39687,9 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
39697
39687
39698
39688
// Approximate a curved face with recursively sub-divided triangles.
39699
39689
39700
- function make( v1, v2, v3, materialIndex ) {
39690
+ function make( v1, v2, v3 ) {
39701
39691
39702
- var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ], undefined, materialIndex );
39692
+ var face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );
39703
39693
that.faces.push( face );
39704
39694
39705
39695
centroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );
@@ -39725,8 +39715,6 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
39725
39715
var c = prepare( that.vertices[ face.c ] );
39726
39716
var v = [];
39727
39717
39728
- var materialIndex = face.materialIndex;
39729
-
39730
39718
// Construct all of the vertices for this subdivision.
39731
39719
39732
39720
for ( var i = 0 ; i <= cols; i ++ ) {
@@ -39766,17 +39754,15 @@ THREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {
39766
39754
make(
39767
39755
v[ i ][ k + 1 ],
39768
39756
v[ i + 1 ][ k ],
39769
- v[ i ][ k ],
39770
- materialIndex
39757
+ v[ i ][ k ]
39771
39758
);
39772
39759
39773
39760
} else {
39774
39761
39775
39762
make(
39776
39763
v[ i ][ k + 1 ],
39777
39764
v[ i + 1 ][ k + 1 ],
39778
- v[ i + 1 ][ k ],
39779
- materialIndex
39765
+ v[ i + 1 ][ k ]
39780
39766
);
39781
39767
39782
39768
}
0 commit comments