|
@@ -20049,25 +20049,8 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
//
|
|
//
|
|
|
|
|
|
- var backgroundCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
|
|
|
|
- var backgroundCamera2 = new PerspectiveCamera();
|
|
|
|
- var backgroundPlaneMesh = new Mesh(
|
|
|
|
- new PlaneBufferGeometry( 2, 2 ),
|
|
|
|
- new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } )
|
|
|
|
- );
|
|
|
|
- var backgroundBoxShader = ShaderLib[ 'cube' ];
|
|
|
|
- var backgroundBoxMesh = new Mesh(
|
|
|
|
- new BoxBufferGeometry( 5, 5, 5 ),
|
|
|
|
- new ShaderMaterial( {
|
|
|
|
- uniforms: backgroundBoxShader.uniforms,
|
|
|
|
- vertexShader: backgroundBoxShader.vertexShader,
|
|
|
|
- fragmentShader: backgroundBoxShader.fragmentShader,
|
|
|
|
- side: BackSide,
|
|
|
|
- depthTest: false,
|
|
|
|
- depthWrite: false,
|
|
|
|
- fog: false
|
|
|
|
- } )
|
|
|
|
- );
|
|
|
|
|
|
+ var backgroundPlaneCamera, backgroundPlaneMesh;
|
|
|
|
+ var backgroundBoxCamera, backgroundBoxMesh;
|
|
|
|
|
|
//
|
|
//
|
|
|
|
|
|
@@ -20938,25 +20921,56 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
if ( background && background.isCubeTexture ) {
|
|
if ( background && background.isCubeTexture ) {
|
|
|
|
|
|
- backgroundCamera2.projectionMatrix.copy( camera.projectionMatrix );
|
|
|
|
|
|
+ if ( backgroundBoxCamera === undefined ) {
|
|
|
|
+
|
|
|
|
+ backgroundBoxCamera = new PerspectiveCamera();
|
|
|
|
+
|
|
|
|
+ backgroundBoxMesh = new Mesh(
|
|
|
|
+ new BoxBufferGeometry( 5, 5, 5 ),
|
|
|
|
+ new ShaderMaterial( {
|
|
|
|
+ uniforms: ShaderLib.cube.uniforms,
|
|
|
|
+ vertexShader: ShaderLib.cube.vertexShader,
|
|
|
|
+ fragmentShader: ShaderLib.cube.fragmentShader,
|
|
|
|
+ side: BackSide,
|
|
|
|
+ depthTest: false,
|
|
|
|
+ depthWrite: false,
|
|
|
|
+ fog: false
|
|
|
|
+ } )
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ backgroundBoxCamera.projectionMatrix.copy( camera.projectionMatrix );
|
|
|
|
+
|
|
|
|
+ backgroundBoxCamera.matrixWorld.extractRotation( camera.matrixWorld );
|
|
|
|
+ backgroundBoxCamera.matrixWorldInverse.getInverse( backgroundBoxCamera.matrixWorld );
|
|
|
|
|
|
- backgroundCamera2.matrixWorld.extractRotation( camera.matrixWorld );
|
|
|
|
- backgroundCamera2.matrixWorldInverse.getInverse( backgroundCamera2.matrixWorld );
|
|
|
|
|
|
|
|
backgroundBoxMesh.material.uniforms[ "tCube" ].value = background;
|
|
backgroundBoxMesh.material.uniforms[ "tCube" ].value = background;
|
|
- backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundCamera2.matrixWorldInverse, backgroundBoxMesh.matrixWorld );
|
|
|
|
|
|
+ backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundBoxCamera.matrixWorldInverse, backgroundBoxMesh.matrixWorld );
|
|
|
|
|
|
objects.update( backgroundBoxMesh );
|
|
objects.update( backgroundBoxMesh );
|
|
|
|
|
|
- _this.renderBufferDirect( backgroundCamera2, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null );
|
|
|
|
|
|
+ _this.renderBufferDirect( backgroundBoxCamera, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null );
|
|
|
|
|
|
} else if ( background && background.isTexture ) {
|
|
} else if ( background && background.isTexture ) {
|
|
|
|
|
|
|
|
+ if ( backgroundPlaneCamera === undefined ) {
|
|
|
|
+
|
|
|
|
+ backgroundPlaneCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
|
|
|
|
+
|
|
|
|
+ backgroundPlaneMesh = new Mesh(
|
|
|
|
+ new PlaneBufferGeometry( 2, 2 ),
|
|
|
|
+ new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } )
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
backgroundPlaneMesh.material.map = background;
|
|
backgroundPlaneMesh.material.map = background;
|
|
|
|
|
|
objects.update( backgroundPlaneMesh );
|
|
objects.update( backgroundPlaneMesh );
|
|
|
|
|
|
- _this.renderBufferDirect( backgroundCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null );
|
|
|
|
|
|
+ _this.renderBufferDirect( backgroundPlaneCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -41082,11 +41096,8 @@ BoxHelper.prototype.update = ( function () {
|
|
* headWidth - Number
|
|
* headWidth - Number
|
|
*/
|
|
*/
|
|
|
|
|
|
-var lineGeometry = new BufferGeometry();
|
|
|
|
-lineGeometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
|
|
|
|
-
|
|
|
|
-var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
|
|
|
|
-coneGeometry.translate( 0, - 0.5, 0 );
|
|
|
|
|
|
+var lineGeometry;
|
|
|
|
+var coneGeometry;
|
|
|
|
|
|
function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
|
|
function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
|
|
|
|
|
|
@@ -41099,6 +41110,16 @@ function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
|
|
if ( headLength === undefined ) headLength = 0.2 * length;
|
|
if ( headLength === undefined ) headLength = 0.2 * length;
|
|
if ( headWidth === undefined ) headWidth = 0.2 * headLength;
|
|
if ( headWidth === undefined ) headWidth = 0.2 * headLength;
|
|
|
|
|
|
|
|
+ if ( lineGeometry === undefined ) {
|
|
|
|
+
|
|
|
|
+ lineGeometry = new BufferGeometry();
|
|
|
|
+ lineGeometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
|
|
|
|
+
|
|
|
|
+ coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
|
|
|
|
+ coneGeometry.translate( 0, - 0.5, 0 );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
this.position.copy( origin );
|
|
this.position.copy( origin );
|
|
|
|
|
|
this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) );
|
|
this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) );
|