|
@@ -18636,7 +18636,7 @@ var vsm_frag = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nunifor
|
|
|
|
|
|
var vsm_vert = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
|
|
|
|
|
|
-function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
|
|
|
+function WebGLShadowMap( _renderer, _objects, _capabilities ) {
|
|
|
|
|
|
let _frustum = new Frustum();
|
|
|
|
|
@@ -18648,7 +18648,9 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
|
|
|
_depthMaterials = [],
|
|
|
_distanceMaterials = [],
|
|
|
|
|
|
- _materialCache = {};
|
|
|
+ _materialCache = {},
|
|
|
+
|
|
|
+ _maxTextureSize = _capabilities.maxTextureSize;
|
|
|
|
|
|
const shadowSide = { 0: BackSide, 1: FrontSide, 2: DoubleSide };
|
|
|
|
|
@@ -18737,19 +18739,19 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
|
|
|
|
|
|
_viewportSize.copy( shadow.mapSize );
|
|
|
|
|
|
- if ( _shadowMapSize.x > maxTextureSize || _shadowMapSize.y > maxTextureSize ) {
|
|
|
+ if ( _shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize ) {
|
|
|
|
|
|
- if ( _shadowMapSize.x > maxTextureSize ) {
|
|
|
+ if ( _shadowMapSize.x > _maxTextureSize ) {
|
|
|
|
|
|
- _viewportSize.x = Math.floor( maxTextureSize / shadowFrameExtents.x );
|
|
|
+ _viewportSize.x = Math.floor( _maxTextureSize / shadowFrameExtents.x );
|
|
|
_shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;
|
|
|
shadow.mapSize.x = _viewportSize.x;
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( _shadowMapSize.y > maxTextureSize ) {
|
|
|
+ if ( _shadowMapSize.y > _maxTextureSize ) {
|
|
|
|
|
|
- _viewportSize.y = Math.floor( maxTextureSize / shadowFrameExtents.y );
|
|
|
+ _viewportSize.y = Math.floor( _maxTextureSize / shadowFrameExtents.y );
|
|
|
_shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;
|
|
|
shadow.mapSize.y = _viewportSize.y;
|
|
|
|
|
@@ -21147,6 +21149,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
renderTarget.addEventListener( 'dispose', onRenderTargetDispose );
|
|
|
|
|
|
textureProperties.__webglTexture = _gl.createTexture();
|
|
|
+ textureProperties.__version = texture.version;
|
|
|
|
|
|
info.memory.textures ++;
|
|
|
|
|
@@ -23280,7 +23283,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
let extensions, capabilities, state, info;
|
|
|
let properties, textures, cubemaps, attributes, geometries, objects;
|
|
|
- let programCache, materials, renderLists, renderStates, clipping;
|
|
|
+ let programCache, materials, renderLists, renderStates, clipping, shadowMap;
|
|
|
|
|
|
let background, morphtargets, bufferRenderer, indexedBufferRenderer;
|
|
|
|
|
@@ -23313,6 +23316,7 @@ function WebGLRenderer( parameters ) {
|
|
|
renderLists = new WebGLRenderLists( properties );
|
|
|
renderStates = new WebGLRenderStates( extensions, capabilities );
|
|
|
background = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha );
|
|
|
+ shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
|
|
|
|
bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
|
|
|
indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );
|
|
@@ -23323,6 +23327,7 @@ function WebGLRenderer( parameters ) {
|
|
|
_this.extensions = extensions;
|
|
|
_this.properties = properties;
|
|
|
_this.renderLists = renderLists;
|
|
|
+ _this.shadowMap = shadowMap;
|
|
|
_this.state = state;
|
|
|
_this.info = info;
|
|
|
|
|
@@ -23336,12 +23341,6 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
this.xr = xr;
|
|
|
|
|
|
- // shadow map
|
|
|
-
|
|
|
- const shadowMap = new WebGLShadowMap( _this, objects, capabilities.maxTextureSize );
|
|
|
-
|
|
|
- this.shadowMap = shadowMap;
|
|
|
-
|
|
|
// API
|
|
|
|
|
|
this.getContext = function () {
|
|
@@ -23638,8 +23637,20 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
_isContextLost = false;
|
|
|
|
|
|
+ const infoAutoReset = info.autoReset;
|
|
|
+ const shadowMapEnabled = shadowMap.enabled;
|
|
|
+ const shadowMapAutoUpdate = shadowMap.autoUpdate;
|
|
|
+ const shadowMapNeedsUpdate = shadowMap.needsUpdate;
|
|
|
+ const shadowMapType = shadowMap.type;
|
|
|
+
|
|
|
initGLContext();
|
|
|
|
|
|
+ info.autoReset = infoAutoReset;
|
|
|
+ shadowMap.enabled = shadowMapEnabled;
|
|
|
+ shadowMap.autoUpdate = shadowMapAutoUpdate;
|
|
|
+ shadowMap.needsUpdate = shadowMapNeedsUpdate;
|
|
|
+ shadowMap.type = shadowMapType;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function onMaterialDispose( event ) {
|