@@ -31,8 +31,7 @@ import { WebGLBindingStates } from './webgl/WebGLBindingStates.js';
3131import { WebGLBufferRenderer } from './webgl/WebGLBufferRenderer.js' ;
3232import { WebGLCapabilities } from './webgl/WebGLCapabilities.js' ;
3333import { WebGLClipping } from './webgl/WebGLClipping.js' ;
34- import { WebGLCubeMaps } from './webgl/WebGLCubeMaps.js' ;
35- import { WebGLCubeUVMaps } from './webgl/WebGLCubeUVMaps.js' ;
34+ import { WebGLEnvironments } from './webgl/WebGLEnvironments.js' ;
3635import { WebGLExtensions } from './webgl/WebGLExtensions.js' ;
3736import { WebGLGeometries } from './webgl/WebGLGeometries.js' ;
3837import { WebGLIndexedBufferRenderer } from './webgl/WebGLIndexedBufferRenderer.js' ;
@@ -414,7 +413,7 @@ class WebGLRenderer {
414413 }
415414
416415 let extensions , capabilities , state , info ;
417- let properties , textures , cubemaps , cubeuvmaps , attributes , geometries , objects ;
416+ let properties , textures , environments , attributes , geometries , objects ;
418417 let programCache , materials , renderLists , renderStates , clipping , shadowMap ;
419418
420419 let background , morphtargets , bufferRenderer , indexedBufferRenderer ;
@@ -441,19 +440,18 @@ class WebGLRenderer {
441440 info = new WebGLInfo ( _gl ) ;
442441 properties = new WebGLProperties ( ) ;
443442 textures = new WebGLTextures ( _gl , extensions , state , properties , capabilities , utils , info ) ;
444- cubemaps = new WebGLCubeMaps ( _this ) ;
445- cubeuvmaps = new WebGLCubeUVMaps ( _this ) ;
443+ environments = new WebGLEnvironments ( _this ) ;
446444 attributes = new WebGLAttributes ( _gl ) ;
447445 bindingStates = new WebGLBindingStates ( _gl , attributes ) ;
448446 geometries = new WebGLGeometries ( _gl , attributes , info , bindingStates ) ;
449447 objects = new WebGLObjects ( _gl , geometries , attributes , bindingStates , info ) ;
450448 morphtargets = new WebGLMorphtargets ( _gl , capabilities , textures ) ;
451449 clipping = new WebGLClipping ( properties ) ;
452- programCache = new WebGLPrograms ( _this , cubemaps , cubeuvmaps , extensions , capabilities , bindingStates , clipping ) ;
450+ programCache = new WebGLPrograms ( _this , environments , extensions , capabilities , bindingStates , clipping ) ;
453451 materials = new WebGLMaterials ( _this , properties ) ;
454452 renderLists = new WebGLRenderLists ( ) ;
455453 renderStates = new WebGLRenderStates ( extensions ) ;
456- background = new WebGLBackground ( _this , cubemaps , cubeuvmaps , state , objects , _alpha , premultipliedAlpha ) ;
454+ background = new WebGLBackground ( _this , environments , state , objects , _alpha , premultipliedAlpha ) ;
457455 shadowMap = new WebGLShadowMap ( _this , objects , capabilities ) ;
458456 uniformsGroups = new WebGLUniformsGroups ( _gl , info , capabilities , state ) ;
459457
@@ -1055,8 +1053,7 @@ class WebGLRenderer {
10551053 renderLists . dispose ( ) ;
10561054 renderStates . dispose ( ) ;
10571055 properties . dispose ( ) ;
1058- cubemaps . dispose ( ) ;
1059- cubeuvmaps . dispose ( ) ;
1056+ environments . dispose ( ) ;
10601057 objects . dispose ( ) ;
10611058 bindingStates . dispose ( ) ;
10621059 uniformsGroups . dispose ( ) ;
@@ -2137,7 +2134,7 @@ class WebGLRenderer {
21372134
21382135 materialProperties . environment = material . isMeshStandardMaterial ? scene . environment : null ;
21392136 materialProperties . fog = scene . fog ;
2140- materialProperties . envMap = ( material . isMeshStandardMaterial ? cubeuvmaps : cubemaps ) . get ( material . envMap || materialProperties . environment ) ;
2137+ materialProperties . envMap = environments . get ( material . envMap || materialProperties . environment , material . isMeshStandardMaterial ) ;
21412138 materialProperties . envMapRotation = ( materialProperties . environment !== null && material . envMap === null ) ? scene . environmentRotation : material . envMapRotation ;
21422139
21432140 if ( programs === undefined ) {
@@ -2270,7 +2267,7 @@ class WebGLRenderer {
22702267 const fog = scene . fog ;
22712268 const environment = material . isMeshStandardMaterial ? scene . environment : null ;
22722269 const colorSpace = ( _currentRenderTarget === null ) ? _this . outputColorSpace : ( _currentRenderTarget . isXRRenderTarget === true ? _currentRenderTarget . texture . colorSpace : LinearSRGBColorSpace ) ;
2273- const envMap = ( material . isMeshStandardMaterial ? cubeuvmaps : cubemaps ) . get ( material . envMap || environment ) ;
2270+ const envMap = environments . get ( material . envMap || environment , material . isMeshStandardMaterial ) ;
22742271 const vertexAlphas = material . vertexColors === true && ! ! geometry . attributes . color && geometry . attributes . color . itemSize === 4 ;
22752272 const vertexTangents = ! ! geometry . attributes . tangent && ( ! ! material . normalMap || material . anisotropy > 0 ) ;
22762273 const morphTargets = ! ! geometry . morphAttributes . position ;
0 commit comments