Skip to content

Commit f137098

Browse files
committed
Updated builds.
1 parent 2baec79 commit f137098

File tree

2 files changed

+341
-269
lines changed

2 files changed

+341
-269
lines changed

build/three.js

Lines changed: 79 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23777,6 +23777,7 @@ THREE.Scene = function () {
2377723777

2377823778
this.type = 'Scene';
2377923779

23780+
this.background = null;
2378023781
this.fog = null;
2378123782
this.overrideMaterial = null;
2378223783

@@ -23791,6 +23792,7 @@ THREE.Scene.prototype.copy = function ( source, recursive ) {
2379123792

2379223793
THREE.Object3D.prototype.copy.call( this, source, recursive );
2379323794

23795+
if ( source.background !== null ) this.background = source.background.clone();
2379423796
if ( source.fog !== null ) this.fog = source.fog.clone();
2379523797
if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
2379623798

@@ -24999,6 +25001,29 @@ THREE.WebGLRenderer = function ( parameters ) {
2499925001

2500025002
//
2500125003

25004+
var backgroundCamera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
25005+
var backgroundCamera2 = new THREE.PerspectiveCamera();
25006+
var backgroundPlaneMesh = new THREE.Mesh(
25007+
new THREE.PlaneBufferGeometry( 2, 2 ),
25008+
new THREE.MeshBasicMaterial( { depthTest: false, depthWrite: false } )
25009+
);
25010+
var backgroundBoxShader = THREE.ShaderLib[ 'cube' ];
25011+
var backgroundBoxMesh = new THREE.Mesh(
25012+
new THREE.BoxBufferGeometry( 5, 5, 5 ),
25013+
new THREE.ShaderMaterial( {
25014+
uniforms: backgroundBoxShader.uniforms,
25015+
vertexShader: backgroundBoxShader.vertexShader,
25016+
fragmentShader: backgroundBoxShader.fragmentShader,
25017+
depthTest: false,
25018+
depthWrite: false,
25019+
side: THREE.BackSide
25020+
} )
25021+
);
25022+
objects.update( backgroundPlaneMesh );
25023+
objects.update( backgroundBoxMesh );
25024+
25025+
//
25026+
2500225027
function getTargetPixelRatio() {
2500325028

2500425029
return _currentRenderTarget === null ? _pixelRatio : 1;
@@ -25658,6 +25683,12 @@ THREE.WebGLRenderer = function ( parameters ) {
2565825683
var size = geometryAttribute.itemSize;
2565925684
var buffer = objects.getAttributeBuffer( geometryAttribute );
2566025685

25686+
if ( buffer === undefined ) {
25687+
25688+
console.error( objects, geometryAttribute );
25689+
25690+
}
25691+
2566125692
if ( geometryAttribute instanceof THREE.InterleavedBufferAttribute ) {
2566225693

2566325694
var data = geometryAttribute.data;
@@ -25832,12 +25863,10 @@ THREE.WebGLRenderer = function ( parameters ) {
2583225863
lensFlares.length = 0;
2583325864

2583425865
_localClippingEnabled = this.localClippingEnabled;
25835-
_clippingEnabled = _clipping.init(
25836-
this.clippingPlanes, _localClippingEnabled, camera );
25866+
_clippingEnabled = _clipping.init( this.clippingPlanes, _localClippingEnabled, camera );
2583725867

2583825868
projectObject( scene, camera );
2583925869

25840-
2584125870
opaqueObjects.length = opaqueObjectsLastIndex + 1;
2584225871
transparentObjects.length = transparentObjectsLastIndex + 1;
2584325872

@@ -25875,7 +25904,46 @@ THREE.WebGLRenderer = function ( parameters ) {
2587525904

2587625905
this.setRenderTarget( renderTarget );
2587725906

25878-
if ( this.autoClear || forceClear ) {
25907+
//
25908+
25909+
var needsClear = this.autoClear || forceClear;
25910+
var background = scene.background;
25911+
25912+
if ( background === null ) {
25913+
25914+
glClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );
25915+
25916+
} else if ( background instanceof THREE.CubeTexture ) {
25917+
25918+
backgroundCamera2.projectionMatrix = camera.projectionMatrix;
25919+
25920+
backgroundCamera2.matrixWorld.extractRotation( camera.matrixWorld );
25921+
backgroundCamera2.matrixWorldInverse.getInverse( backgroundCamera2.matrixWorld );
25922+
25923+
backgroundBoxMesh.material.uniforms[ "tCube" ].value = background;
25924+
backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundCamera2.matrixWorldInverse, backgroundBoxMesh.matrixWorld );
25925+
25926+
_this.renderBufferDirect( backgroundCamera2, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null );
25927+
25928+
needsClear = false;
25929+
25930+
} else if ( background instanceof THREE.Texture ) {
25931+
25932+
backgroundPlaneMesh.material.map = background;
25933+
25934+
_this.renderBufferDirect( backgroundCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null );
25935+
25936+
needsClear = false;
25937+
25938+
} else if ( background instanceof THREE.Color ) {
25939+
25940+
glClearColor( background.r, background.g, background.b, 1 );
25941+
25942+
needsClear = true;
25943+
25944+
}
25945+
25946+
if ( needsClear ) {
2587925947

2588025948
this.clear( this.autoClearColor, this.autoClearDepth, this.autoClearStencil );
2588125949

@@ -28749,15 +28817,15 @@ THREE.WebGLProgram = ( function () {
2874928817

2875028818
prefixVertex = [
2875128819

28752-
'#define SHADER_NAME ' + material.__webglShader.name,
28820+
'#define SHADER_NAME RawShaderMaterial',
2875328821

2875428822
customDefines
2875528823

2875628824
].filter( filterEmptyLine ).join( '\n' );
2875728825

2875828826
prefixFragment = [
2875928827

28760-
'#define SHADER_NAME ' + material.__webglShader.name,
28828+
'#define SHADER_NAME RawShaderMaterial',
2876128829

2876228830
customDefines
2876328831

@@ -40403,7 +40471,9 @@ THREE.ArrowHelper.prototype.setColor = function ( color ) {
4040340471
* @author mrdoob / http://mrdoob.com/
4040440472
*/
4040540473

40406-
THREE.BoxHelper = function ( object ) {
40474+
THREE.BoxHelper = function ( object, color ) {
40475+
40476+
if ( color === undefined ) color = 0xffff00;
4040740477

4040840478
var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
4040940479
var positions = new Float32Array( 8 * 3 );
@@ -40412,7 +40482,7 @@ THREE.BoxHelper = function ( object ) {
4041240482
geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );
4041340483
geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
4041440484

40415-
THREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ) );
40485+
THREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: color } ) );
4041640486

4041740487
if ( object !== undefined ) {
4041840488

@@ -40613,7 +40683,7 @@ THREE.CameraHelper = function ( camera ) {
4061340683
THREE.LineSegments.call( this, geometry, material );
4061440684

4061540685
this.camera = camera;
40616-
this.camera.updateProjectionMatrix();
40686+
if( this.camera.updateProjectionMatrix ) this.camera.updateProjectionMatrix();
4061740687

4061840688
this.matrix = camera.matrixWorld;
4061940689
this.matrixAutoUpdate = false;

0 commit comments

Comments
 (0)