|
2849 | 2849 |
|
2850 | 2850 | }, |
2851 | 2851 |
|
2852 | | - project: function () { |
| 2852 | + project: function ( camera ) { |
2853 | 2853 |
|
2854 | | - var matrix = new Matrix4(); |
2855 | | - |
2856 | | - return function project( camera ) { |
2857 | | - |
2858 | | - matrix.multiplyMatrices( camera.projectionMatrix, matrix.getInverse( camera.matrixWorld ) ); |
2859 | | - return this.applyMatrix4( matrix ); |
2860 | | - |
2861 | | - }; |
| 2854 | + return this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix ); |
2862 | 2855 |
|
2863 | | - }(), |
| 2856 | + }, |
2864 | 2857 |
|
2865 | 2858 | unproject: function () { |
2866 | 2859 |
|
2867 | 2860 | var matrix = new Matrix4(); |
2868 | 2861 |
|
2869 | 2862 | return function unproject( camera ) { |
2870 | 2863 |
|
2871 | | - matrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) ); |
2872 | | - return this.applyMatrix4( matrix ); |
| 2864 | + return this.applyMatrix4( matrix.getInverse( camera.projectionMatrix ) ).applyMatrix4( camera.matrixWorld ); |
2873 | 2865 |
|
2874 | 2866 | }; |
2875 | 2867 |
|
|
6936 | 6928 |
|
6937 | 6929 | }, |
6938 | 6930 |
|
| 6931 | + lerpHSL: function () { |
| 6932 | + |
| 6933 | + var hslA = { h: 0, s: 0, l: 0 }; |
| 6934 | + var hslB = { h: 0, s: 0, l: 0 }; |
| 6935 | + |
| 6936 | + return function lerpHSL( color, alpha ) { |
| 6937 | + |
| 6938 | + this.getHSL( hslA ); |
| 6939 | + color.getHSL( hslB ); |
| 6940 | + |
| 6941 | + var h = _Math.lerp( hslA.h, hslB.h, alpha ); |
| 6942 | + var s = _Math.lerp( hslA.s, hslB.s, alpha ); |
| 6943 | + var l = _Math.lerp( hslA.l, hslB.l, alpha ); |
| 6944 | + |
| 6945 | + this.setHSL( h, s, l ); |
| 6946 | + |
| 6947 | + return this; |
| 6948 | + |
| 6949 | + }; |
| 6950 | + |
| 6951 | + }(), |
| 6952 | + |
6939 | 6953 | equals: function ( c ) { |
6940 | 6954 |
|
6941 | 6955 | return ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b ); |
|
8514 | 8528 |
|
8515 | 8529 | }(), |
8516 | 8530 |
|
8517 | | - getWorldDirection: function () { |
8518 | | - |
8519 | | - var quaternion = new Quaternion(); |
8520 | | - |
8521 | | - return function getWorldDirection( target ) { |
| 8531 | + getWorldDirection: function ( target ) { |
8522 | 8532 |
|
8523 | | - if ( target === undefined ) { |
| 8533 | + if ( target === undefined ) { |
8524 | 8534 |
|
8525 | | - console.warn( 'THREE.Object3D: .getWorldDirection() target is now required' ); |
8526 | | - target = new Vector3(); |
| 8535 | + console.warn( 'THREE.Object3D: .getWorldDirection() target is now required' ); |
| 8536 | + target = new Vector3(); |
8527 | 8537 |
|
8528 | | - } |
| 8538 | + } |
8529 | 8539 |
|
8530 | | - this.getWorldQuaternion( quaternion ); |
| 8540 | + this.updateMatrixWorld( true ); |
8531 | 8541 |
|
8532 | | - return target.set( 0, 0, 1 ).applyQuaternion( quaternion ); |
| 8542 | + var e = this.matrixWorld.elements; |
8533 | 8543 |
|
8534 | | - }; |
| 8544 | + return target.set( e[ 8 ], e[ 9 ], e[ 10 ] ).normalize(); |
8535 | 8545 |
|
8536 | | - }(), |
| 8546 | + }, |
8537 | 8547 |
|
8538 | 8548 | raycast: function () {}, |
8539 | 8549 |
|
|
8877 | 8887 |
|
8878 | 8888 | }, |
8879 | 8889 |
|
8880 | | - getWorldDirection: function () { |
8881 | | - |
8882 | | - var quaternion = new Quaternion(); |
8883 | | - |
8884 | | - return function getWorldDirection( target ) { |
| 8890 | + getWorldDirection: function ( target ) { |
8885 | 8891 |
|
8886 | | - if ( target === undefined ) { |
| 8892 | + if ( target === undefined ) { |
8887 | 8893 |
|
8888 | | - console.warn( 'THREE.Camera: .getWorldDirection() target is now required' ); |
8889 | | - target = new Vector3(); |
| 8894 | + console.warn( 'THREE.Camera: .getWorldDirection() target is now required' ); |
| 8895 | + target = new Vector3(); |
8890 | 8896 |
|
8891 | | - } |
| 8897 | + } |
8892 | 8898 |
|
8893 | | - this.getWorldQuaternion( quaternion ); |
| 8899 | + this.updateMatrixWorld( true ); |
8894 | 8900 |
|
8895 | | - return target.set( 0, 0, - 1 ).applyQuaternion( quaternion ); |
| 8901 | + var e = this.matrixWorld.elements; |
8896 | 8902 |
|
8897 | | - }; |
| 8903 | + return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize(); |
8898 | 8904 |
|
8899 | | - }(), |
| 8905 | + }, |
8900 | 8906 |
|
8901 | 8907 | updateMatrixWorld: function ( force ) { |
8902 | 8908 |
|
|
31873 | 31879 |
|
31874 | 31880 | }, false ); |
31875 | 31881 |
|
| 31882 | + request.addEventListener( 'abort', function ( event ) { |
| 31883 | + |
| 31884 | + var callbacks = loading[ url ]; |
| 31885 | + |
| 31886 | + delete loading[ url ]; |
| 31887 | + |
| 31888 | + for ( var i = 0, il = callbacks.length; i < il; i ++ ) { |
| 31889 | + |
| 31890 | + var callback = callbacks[ i ]; |
| 31891 | + if ( callback.onError ) callback.onError( event ); |
| 31892 | + |
| 31893 | + } |
| 31894 | + |
| 31895 | + scope.manager.itemEnd( url ); |
| 31896 | + scope.manager.itemError( url ); |
| 31897 | + |
| 31898 | + }, false ); |
| 31899 | + |
31876 | 31900 | if ( this.responseType !== undefined ) request.responseType = this.responseType; |
31877 | 31901 | if ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials; |
31878 | 31902 |
|
|
32355 | 32379 | texture.image = image; |
32356 | 32380 |
|
32357 | 32381 | // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB. |
32358 | | - var isJPEG = url.search( /\.(jpg|jpeg)$/ ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; |
| 32382 | + var isJPEG = url.search( /\.jpe?g$/i ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; |
32359 | 32383 |
|
32360 | 32384 | texture.format = isJPEG ? RGBFormat : RGBAFormat; |
32361 | 32385 | texture.needsUpdate = true; |
|
0 commit comments