|
@@ -25924,7 +25924,6 @@ class BatchedMesh extends Mesh {
|
|
|
this._multiDrawCounts = new Int32Array( maxInstanceCount );
|
|
this._multiDrawCounts = new Int32Array( maxInstanceCount );
|
|
|
this._multiDrawStarts = new Int32Array( maxInstanceCount );
|
|
this._multiDrawStarts = new Int32Array( maxInstanceCount );
|
|
|
this._multiDrawCount = 0;
|
|
this._multiDrawCount = 0;
|
|
|
- this._multiDrawInstances = null;
|
|
|
|
|
|
|
|
|
|
// Local matrix per geometry by using data texture
|
|
// Local matrix per geometry by using data texture
|
|
|
this._matricesTexture = null;
|
|
this._matricesTexture = null;
|
|
@@ -61847,44 +61846,12 @@ function WebGLBufferRenderer( gl, extensions, info ) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
|
|
|
-
|
|
|
|
|
- if ( drawCount === 0 ) return;
|
|
|
|
|
-
|
|
|
|
|
- const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
|
|
|
-
|
|
|
|
|
- if ( extension === null ) {
|
|
|
|
|
-
|
|
|
|
|
- for ( let i = 0; i < starts.length; i ++ ) {
|
|
|
|
|
-
|
|
|
|
|
- renderInstances( starts[ i ], counts[ i ], primcount[ i ] );
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
-
|
|
|
|
|
- extension.multiDrawArraysInstancedWEBGL( mode, starts, 0, counts, 0, primcount, 0, drawCount );
|
|
|
|
|
-
|
|
|
|
|
- let elementCount = 0;
|
|
|
|
|
- for ( let i = 0; i < drawCount; i ++ ) {
|
|
|
|
|
-
|
|
|
|
|
- elementCount += counts[ i ] * primcount[ i ];
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- info.update( elementCount, mode, 1 );
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
//
|
|
//
|
|
|
|
|
|
|
|
this.setMode = setMode;
|
|
this.setMode = setMode;
|
|
|
this.render = render;
|
|
this.render = render;
|
|
|
this.renderInstances = renderInstances;
|
|
this.renderInstances = renderInstances;
|
|
|
this.renderMultiDraw = renderMultiDraw;
|
|
this.renderMultiDraw = renderMultiDraw;
|
|
|
- this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -64029,37 +63996,6 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- function renderMultiDrawInstances( starts, counts, drawCount, primcount ) {
|
|
|
|
|
-
|
|
|
|
|
- if ( drawCount === 0 ) return;
|
|
|
|
|
-
|
|
|
|
|
- const extension = extensions.get( 'WEBGL_multi_draw' );
|
|
|
|
|
-
|
|
|
|
|
- if ( extension === null ) {
|
|
|
|
|
-
|
|
|
|
|
- for ( let i = 0; i < starts.length; i ++ ) {
|
|
|
|
|
-
|
|
|
|
|
- renderInstances( starts[ i ] / bytesPerElement, counts[ i ], primcount[ i ] );
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
-
|
|
|
|
|
- extension.multiDrawElementsInstancedWEBGL( mode, counts, 0, type, starts, 0, primcount, 0, drawCount );
|
|
|
|
|
-
|
|
|
|
|
- let elementCount = 0;
|
|
|
|
|
- for ( let i = 0; i < drawCount; i ++ ) {
|
|
|
|
|
-
|
|
|
|
|
- elementCount += counts[ i ] * primcount[ i ];
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- info.update( elementCount, mode, 1 );
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
//
|
|
//
|
|
|
|
|
|
|
|
this.setMode = setMode;
|
|
this.setMode = setMode;
|
|
@@ -64067,7 +64003,6 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
|
|
|
this.render = render;
|
|
this.render = render;
|
|
|
this.renderInstances = renderInstances;
|
|
this.renderInstances = renderInstances;
|
|
|
this.renderMultiDraw = renderMultiDraw;
|
|
this.renderMultiDraw = renderMultiDraw;
|
|
|
- this.renderMultiDrawInstances = renderMultiDrawInstances;
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -68576,7 +68511,8 @@ function WebGLRenderState( extensions ) {
|
|
|
|
|
|
|
|
lights: lights,
|
|
lights: lights,
|
|
|
|
|
|
|
|
- transmissionRenderTarget: {}
|
|
|
|
|
|
|
+ transmissionRenderTarget: {},
|
|
|
|
|
+ textureUnits: 0
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
@@ -69569,6 +69505,7 @@ function WebGLState( gl, extensions ) {
|
|
|
const uboProgramMap = new WeakMap();
|
|
const uboProgramMap = new WeakMap();
|
|
|
|
|
|
|
|
let enabledCapabilities = {};
|
|
let enabledCapabilities = {};
|
|
|
|
|
+ let parameters = {};
|
|
|
|
|
|
|
|
let currentBoundFramebuffers = {};
|
|
let currentBoundFramebuffers = {};
|
|
|
let currentDrawbuffers = new WeakMap();
|
|
let currentDrawbuffers = new WeakMap();
|
|
@@ -70328,6 +70265,31 @@ function WebGLState( gl, extensions ) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function getParameter( name ) {
|
|
|
|
|
+
|
|
|
|
|
+ if ( parameters[ name ] !== undefined ) {
|
|
|
|
|
+
|
|
|
|
|
+ return parameters[ name ];
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ return gl.getParameter( name );
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function pixelStorei( name, value ) {
|
|
|
|
|
+
|
|
|
|
|
+ if ( parameters[ name ] !== value ) {
|
|
|
|
|
+
|
|
|
|
|
+ gl.pixelStorei( name, value );
|
|
|
|
|
+ parameters[ name ] = value;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//
|
|
//
|
|
|
|
|
|
|
|
function scissor( scissor ) {
|
|
function scissor( scissor ) {
|
|
@@ -70444,9 +70406,24 @@ function WebGLState( gl, extensions ) {
|
|
|
gl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );
|
|
gl.scissor( 0, 0, gl.canvas.width, gl.canvas.height );
|
|
|
gl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );
|
|
gl.viewport( 0, 0, gl.canvas.width, gl.canvas.height );
|
|
|
|
|
|
|
|
|
|
+ gl.pixelStorei( gl.PACK_ALIGNMENT, 4 );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_ALIGNMENT, 4 );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_FLIP_Y_WEBGL, false );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.BROWSER_DEFAULT_WEBGL );
|
|
|
|
|
+ gl.pixelStorei( gl.PACK_ROW_LENGTH, 0 );
|
|
|
|
|
+ gl.pixelStorei( gl.PACK_SKIP_PIXELS, 0 );
|
|
|
|
|
+ gl.pixelStorei( gl.PACK_SKIP_ROWS, 0 );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_ROW_LENGTH, 0 );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_IMAGE_HEIGHT, 0 );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_SKIP_PIXELS, 0 );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_SKIP_ROWS, 0 );
|
|
|
|
|
+ gl.pixelStorei( gl.UNPACK_SKIP_IMAGES, 0 );
|
|
|
|
|
+
|
|
|
// reset internals
|
|
// reset internals
|
|
|
|
|
|
|
|
enabledCapabilities = {};
|
|
enabledCapabilities = {};
|
|
|
|
|
+ parameters = {};
|
|
|
|
|
|
|
|
currentTextureSlot = null;
|
|
currentTextureSlot = null;
|
|
|
currentBoundTextures = {};
|
|
currentBoundTextures = {};
|
|
@@ -70520,6 +70497,8 @@ function WebGLState( gl, extensions ) {
|
|
|
compressedTexImage3D: compressedTexImage3D,
|
|
compressedTexImage3D: compressedTexImage3D,
|
|
|
texImage2D: texImage2D,
|
|
texImage2D: texImage2D,
|
|
|
texImage3D: texImage3D,
|
|
texImage3D: texImage3D,
|
|
|
|
|
+ pixelStorei: pixelStorei,
|
|
|
|
|
+ getParameter: getParameter,
|
|
|
|
|
|
|
|
updateUBOMapping: updateUBOMapping,
|
|
updateUBOMapping: updateUBOMapping,
|
|
|
uniformBlockBinding: uniformBlockBinding,
|
|
uniformBlockBinding: uniformBlockBinding,
|
|
@@ -71004,6 +70983,18 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function getTextureUnits() {
|
|
|
|
|
+
|
|
|
|
|
+ return textureUnits;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function setTextureUnits( value ) {
|
|
|
|
|
+
|
|
|
|
|
+ textureUnits = value;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function allocateTextureUnit() {
|
|
function allocateTextureUnit() {
|
|
|
|
|
|
|
|
const textureUnit = textureUnits;
|
|
const textureUnit = textureUnits;
|
|
@@ -71355,11 +71346,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
// Trim the array to only contain the merged ranges.
|
|
// Trim the array to only contain the merged ranges.
|
|
|
updateRanges.length = mergeIndex + 1;
|
|
updateRanges.length = mergeIndex + 1;
|
|
|
|
|
|
|
|
- const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
|
|
|
- const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
|
|
|
- const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
|
|
|
|
|
+ const currentUnpackRowLen = state.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
|
|
|
+ const currentUnpackSkipPixels = state.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
|
|
|
+ const currentUnpackSkipRows = state.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
|
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
|
|
|
|
|
|
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
|
|
|
|
|
@@ -71375,8 +71366,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
const width = pixelCount;
|
|
const width = pixelCount;
|
|
|
const height = 1;
|
|
const height = 1;
|
|
|
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, x );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, y );
|
|
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_PIXELS, x );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_ROWS, y );
|
|
|
|
|
|
|
|
state.texSubImage2D( _gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data );
|
|
state.texSubImage2D( _gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data );
|
|
|
|
|
|
|
@@ -71384,9 +71375,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
|
|
texture.clearUpdateRanges();
|
|
texture.clearUpdateRanges();
|
|
|
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -71418,13 +71409,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
|
|
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
|
|
|
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
|
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
|
|
|
|
|
|
let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
|
|
let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
|
|
|
image = verifyColorSpace( texture, image );
|
|
image = verifyColorSpace( texture, image );
|
|
@@ -71852,10 +71843,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
|
|
const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
|
|
|
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
|
|
|
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
|
|
|
|
|
|
|
|
const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
|
|
const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
|
|
|
const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
|
|
const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
|
|
@@ -72922,6 +72913,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
|
|
this.allocateTextureUnit = allocateTextureUnit;
|
|
this.allocateTextureUnit = allocateTextureUnit;
|
|
|
this.resetTextureUnits = resetTextureUnits;
|
|
this.resetTextureUnits = resetTextureUnits;
|
|
|
|
|
+ this.getTextureUnits = getTextureUnits;
|
|
|
|
|
+ this.setTextureUnits = setTextureUnits;
|
|
|
|
|
|
|
|
this.setTexture2D = setTexture2D;
|
|
this.setTexture2D = setTexture2D;
|
|
|
this.setTexture2DArray = setTexture2DArray;
|
|
this.setTexture2DArray = setTexture2DArray;
|
|
@@ -76680,33 +76673,23 @@ class WebGLRenderer {
|
|
|
|
|
|
|
|
if ( object.isBatchedMesh ) {
|
|
if ( object.isBatchedMesh ) {
|
|
|
|
|
|
|
|
- if ( object._multiDrawInstances !== null ) {
|
|
|
|
|
-
|
|
|
|
|
- // @deprecated, r174
|
|
|
|
|
- warnOnce( 'WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.' );
|
|
|
|
|
- renderer.renderMultiDrawInstances( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount, object._multiDrawInstances );
|
|
|
|
|
|
|
+ if ( ! extensions.get( 'WEBGL_multi_draw' ) ) {
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
-
|
|
|
|
|
- if ( ! extensions.get( 'WEBGL_multi_draw' ) ) {
|
|
|
|
|
-
|
|
|
|
|
- const starts = object._multiDrawStarts;
|
|
|
|
|
- const counts = object._multiDrawCounts;
|
|
|
|
|
- const drawCount = object._multiDrawCount;
|
|
|
|
|
- const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
|
|
|
|
|
- const uniforms = properties.get( material ).currentProgram.getUniforms();
|
|
|
|
|
- for ( let i = 0; i < drawCount; i ++ ) {
|
|
|
|
|
|
|
+ const starts = object._multiDrawStarts;
|
|
|
|
|
+ const counts = object._multiDrawCounts;
|
|
|
|
|
+ const drawCount = object._multiDrawCount;
|
|
|
|
|
+ const bytesPerElement = index ? attributes.get( index ).bytesPerElement : 1;
|
|
|
|
|
+ const uniforms = properties.get( material ).currentProgram.getUniforms();
|
|
|
|
|
+ for ( let i = 0; i < drawCount; i ++ ) {
|
|
|
|
|
|
|
|
- uniforms.setValue( _gl, '_gl_DrawID', i );
|
|
|
|
|
- renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ uniforms.setValue( _gl, '_gl_DrawID', i );
|
|
|
|
|
+ renderer.render( starts[ i ] / bytesPerElement, counts[ i ] );
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -77040,6 +77023,7 @@ class WebGLRenderer {
|
|
|
currentRenderState = renderStates.get( scene, renderStateStack.length );
|
|
currentRenderState = renderStates.get( scene, renderStateStack.length );
|
|
|
currentRenderState.init( camera );
|
|
currentRenderState.init( camera );
|
|
|
|
|
|
|
|
|
|
+ currentRenderState.state.textureUnits = textures.getTextureUnits();
|
|
|
renderStateStack.push( currentRenderState );
|
|
renderStateStack.push( currentRenderState );
|
|
|
|
|
|
|
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
@@ -77185,6 +77169,8 @@ class WebGLRenderer {
|
|
|
|
|
|
|
|
currentRenderState = renderStateStack[ renderStateStack.length - 1 ];
|
|
currentRenderState = renderStateStack[ renderStateStack.length - 1 ];
|
|
|
|
|
|
|
|
|
|
+ textures.setTextureUnits( currentRenderState.state.textureUnits );
|
|
|
|
|
+
|
|
|
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );
|
|
if ( _clippingEnabled === true ) clipping.setGlobalState( _this.clippingPlanes, currentRenderState.state.camera );
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -78674,22 +78660,22 @@ class WebGLRenderer {
|
|
|
|
|
|
|
|
state.activeTexture( _gl.TEXTURE0 ); // see #33153
|
|
state.activeTexture( _gl.TEXTURE0 ); // see #33153
|
|
|
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment );
|
|
|
|
|
|
|
|
// used for copying data from cpu
|
|
// used for copying data from cpu
|
|
|
- const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
|
|
|
- const currentUnpackImageHeight = _gl.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
|
|
|
- const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
|
|
|
- const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
|
|
|
- const currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
|
|
|
-
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );
|
|
|
|
|
|
|
+ const currentUnpackRowLen = state.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
|
|
|
+ const currentUnpackImageHeight = state.getParameter( _gl.UNPACK_IMAGE_HEIGHT );
|
|
|
|
|
+ const currentUnpackSkipPixels = state.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
|
|
|
+ const currentUnpackSkipRows = state.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
|
|
|
+ const currentUnpackSkipImages = state.getParameter( _gl.UNPACK_SKIP_IMAGES );
|
|
|
|
|
+
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_ROWS, minY );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_IMAGES, minZ );
|
|
|
|
|
|
|
|
// set up the src texture
|
|
// set up the src texture
|
|
|
const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
|
|
const isSrc3D = srcTexture.isDataArrayTexture || srcTexture.isData3DTexture;
|
|
@@ -78815,11 +78801,11 @@ class WebGLRenderer {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// reset values
|
|
// reset values
|
|
|
- _gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
|
|
|
- _gl.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, currentUnpackImageHeight );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
|
|
|
+ state.pixelStorei( _gl.UNPACK_SKIP_IMAGES, currentUnpackSkipImages );
|
|
|
|
|
|
|
|
// Generate mipmaps only when copying level 0
|
|
// Generate mipmaps only when copying level 0
|
|
|
if ( dstLevel === 0 && dstTexture.generateMipmaps ) {
|
|
if ( dstLevel === 0 && dstTexture.generateMipmaps ) {
|