super-three 0.169.0 → 0.170.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +989 -1131
- package/build/three.module.js +990 -1128
- package/build/three.module.min.js +1 -1
- package/build/three.webgpu.js +8398 -9842
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +8398 -9842
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +3 -3
- package/examples/jsm/animation/MMDAnimationHelper.js +2 -0
- package/examples/jsm/animation/MMDPhysics.js +2 -0
- package/examples/jsm/controls/TransformControls.js +22 -6
- package/examples/jsm/csm/CSM.js +2 -2
- package/examples/jsm/csm/CSMFrustum.js +7 -4
- package/examples/jsm/csm/CSMHelper.js +2 -0
- package/examples/jsm/csm/CSMShadowNode.js +435 -0
- package/examples/jsm/curves/NURBSCurve.js +34 -3
- package/examples/jsm/exporters/GLTFExporter.js +138 -71
- package/examples/jsm/exporters/KTX2Exporter.js +35 -12
- package/examples/jsm/exporters/MMDExporter.js +6 -0
- package/examples/jsm/exporters/USDZExporter.js +21 -3
- package/examples/jsm/geometries/DecalGeometry.js +65 -20
- package/examples/jsm/geometries/InstancedPointsGeometry.js +2 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +175 -0
- package/examples/jsm/interactive/HTMLMesh.js +1 -0
- package/examples/jsm/lighting/TiledLighting.js +18 -0
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
- package/examples/jsm/lines/LineMaterial.js +7 -2
- package/examples/jsm/lines/LineSegmentsGeometry.js +2 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +0 -15
- package/examples/jsm/lines/webgpu/Wireframe.js +56 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -0
- package/examples/jsm/loaders/3MFLoader.js +91 -0
- package/examples/jsm/loaders/FBXLoader.js +12 -2
- package/examples/jsm/loaders/GLTFLoader.js +2 -0
- package/examples/jsm/loaders/KTX2Loader.js +140 -49
- package/examples/jsm/loaders/LDrawLoader.js +22 -136
- package/examples/jsm/loaders/LottieLoader.js +1 -0
- package/examples/jsm/loaders/MMDLoader.js +9 -2
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +143 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +114 -0
- package/examples/jsm/materials/MeshGouraudMaterial.js +6 -2
- package/examples/jsm/math/ColorSpaces.js +76 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +52 -40
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +293 -0
- package/examples/jsm/misc/VolumeSlice.js +1 -0
- package/examples/jsm/objects/WaterMesh.js +8 -8
- package/examples/jsm/postprocessing/AfterimagePass.js +14 -3
- package/examples/jsm/postprocessing/SSRPass.js +6 -0
- package/examples/jsm/renderers/CSS2DRenderer.js +6 -3
- package/examples/jsm/renderers/CSS3DRenderer.js +7 -4
- package/examples/jsm/shaders/FXAAShader.js +225 -224
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.js +17 -20
- package/{src/nodes → examples/jsm/tsl}/display/AnaglyphPassNode.js +2 -6
- package/{src/nodes → examples/jsm/tsl}/display/AnamorphicNode.js +12 -18
- package/{src/nodes → examples/jsm/tsl}/display/BleachBypass.js +1 -3
- package/{src/nodes → examples/jsm/tsl}/display/BloomNode.js +11 -40
- package/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.js +18 -41
- package/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.js +2 -8
- package/{src/nodes → examples/jsm/tsl}/display/DotScreenNode.js +2 -9
- package/examples/jsm/tsl/display/FXAANode.js +316 -0
- package/{src/nodes → examples/jsm/tsl}/display/FilmNode.js +2 -6
- package/{src/nodes → examples/jsm/tsl}/display/GTAONode.js +30 -70
- package/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.js +74 -36
- package/examples/jsm/tsl/display/LensflareNode.js +161 -0
- package/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.js +1 -4
- package/{src/nodes → examples/jsm/tsl}/display/MotionBlur.js +2 -3
- package/examples/jsm/tsl/display/OutlineNode.js +434 -0
- package/{src/nodes → examples/jsm/tsl}/display/ParallaxBarrierPassNode.js +1 -5
- package/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.js +3 -15
- package/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.js +1 -6
- package/examples/jsm/tsl/display/SMAANode.js +620 -0
- package/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.js +10 -25
- package/examples/jsm/tsl/display/SSRNode.js +343 -0
- package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +1 -2
- package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +3 -11
- package/{src/nodes → examples/jsm/tsl}/display/StereoCompositePassNode.js +9 -11
- package/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.js +10 -11
- package/examples/jsm/tsl/display/TRAAPassNode.js +355 -0
- package/{src/nodes → examples/jsm/tsl}/display/TransitionNode.js +1 -6
- package/examples/jsm/tsl/display/hashBlur.js +24 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +392 -0
- package/examples/jsm/utils/{TextureUtilsGPU.js → WebGPUTextureUtils.js} +2 -1
- package/examples/jsm/webxr/OculusHandPointerModel.js +21 -21
- package/examples/jsm/webxr/Text2D.js +6 -6
- package/package.json +2 -2
- package/src/Three.WebGPU.Nodes.js +4 -0
- package/src/Three.WebGPU.js +4 -0
- package/src/constants.js +1 -6
- package/src/core/BufferGeometry.js +44 -6
- package/src/geometries/CylinderGeometry.js +2 -2
- package/src/materials/LineBasicMaterial.js +6 -2
- package/src/materials/LineDashedMaterial.js +6 -2
- package/src/materials/Material.js +14 -1
- package/src/materials/MeshBasicMaterial.js +6 -2
- package/src/materials/MeshDepthMaterial.js +6 -2
- package/src/materials/MeshDistanceMaterial.js +6 -2
- package/src/materials/MeshLambertMaterial.js +6 -2
- package/src/materials/MeshMatcapMaterial.js +6 -2
- package/src/materials/MeshNormalMaterial.js +6 -2
- package/src/materials/MeshPhongMaterial.js +6 -2
- package/src/materials/MeshPhysicalMaterial.js +6 -2
- package/src/materials/MeshStandardMaterial.js +6 -2
- package/src/materials/MeshToonMaterial.js +6 -2
- package/src/materials/PointsMaterial.js +6 -2
- package/src/materials/RawShaderMaterial.js +6 -2
- package/src/materials/ShaderMaterial.js +6 -2
- package/src/materials/ShadowMaterial.js +6 -2
- package/src/materials/SpriteMaterial.js +6 -2
- package/src/materials/nodes/NodeMaterial.js +31 -9
- package/src/materials/nodes/SpriteNodeMaterial.js +11 -2
- package/src/materials/nodes/manager/NodeMaterialObserver.js +111 -2
- package/src/math/ColorManagement.js +118 -85
- package/src/math/Vector4.js +11 -0
- package/src/nodes/Nodes.js +1 -21
- package/src/nodes/TSL.js +6 -24
- package/src/nodes/accessors/Camera.js +0 -1
- package/src/nodes/accessors/SceneNode.js +35 -1
- package/src/nodes/accessors/StorageBufferNode.js +32 -10
- package/src/nodes/accessors/VelocityNode.js +13 -3
- package/src/nodes/code/FunctionCallNode.js +16 -5
- package/src/nodes/code/ScriptableNode.js +4 -4
- package/src/nodes/core/Node.js +1 -0
- package/src/nodes/core/NodeBuilder.js +29 -5
- package/src/nodes/core/VarNode.js +15 -3
- package/src/nodes/display/ColorAdjustment.js +53 -4
- package/src/nodes/display/ColorSpaceFunctions.js +5 -5
- package/src/nodes/display/ColorSpaceNode.js +27 -39
- package/src/nodes/display/PassNode.js +6 -4
- package/src/nodes/display/ToneMappingNode.js +1 -1
- package/src/nodes/display/ViewportDepthNode.js +33 -1
- package/src/nodes/functions/PhysicalLightingModel.js +21 -15
- package/src/nodes/functions/material/getAlphaHashThreshold.js +64 -0
- package/src/nodes/functions/material/getGeometryRoughness.js +8 -2
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +22 -0
- package/src/nodes/gpgpu/ComputeNode.js +9 -1
- package/src/nodes/lighting/AnalyticLightNode.js +12 -416
- package/src/nodes/lighting/LightsNode.js +24 -12
- package/src/nodes/lighting/PointLightNode.js +36 -26
- package/src/nodes/lighting/RectAreaLightNode.js +3 -0
- package/src/nodes/lighting/ShadowNode.js +484 -0
- package/src/nodes/utils/LoopNode.js +2 -2
- package/src/nodes/utils/Oscillators.js +6 -0
- package/src/nodes/utils/PostProcessingUtils.js +89 -0
- package/src/nodes/utils/ReflectorNode.js +101 -15
- package/src/nodes/utils/Timer.js +29 -0
- package/src/objects/BatchedMesh.js +458 -241
- package/src/renderers/WebGLRenderer.js +121 -126
- package/src/renderers/common/Attributes.js +4 -0
- package/src/renderers/common/Backend.js +2 -0
- package/src/renderers/common/Background.js +14 -4
- package/src/renderers/common/Bindings.js +3 -2
- package/src/renderers/common/Constants.js +2 -1
- package/src/renderers/common/Geometries.js +20 -0
- package/src/renderers/common/IndirectStorageBufferAttribute.js +15 -0
- package/src/renderers/common/Lighting.js +45 -0
- package/src/renderers/common/PostProcessingUtils.js +86 -0
- package/src/renderers/common/RenderList.js +39 -11
- package/src/renderers/common/RenderLists.js +4 -2
- package/src/renderers/common/RenderObject.js +18 -1
- package/src/renderers/common/Renderer.js +165 -26
- package/src/renderers/common/Textures.js +30 -14
- package/src/renderers/common/nodes/NodeLibrary.js +1 -14
- package/src/renderers/common/nodes/Nodes.js +2 -2
- package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +4 -24
- package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -2
- package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLCapabilities.js +0 -7
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLProgram.js +24 -28
- package/src/renderers/webgl/WebGLPrograms.js +5 -2
- package/src/renderers/webgl/WebGLState.js +37 -1
- package/src/renderers/webgl/WebGLTextures.js +29 -12
- package/src/renderers/webgl-fallback/WebGLBackend.js +98 -31
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +2 -7
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +33 -8
- package/src/renderers/webgpu/WebGPUBackend.js +105 -25
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -1
- package/src/renderers/webgpu/WebGPURenderer.js +1 -1
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +0 -8
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -8
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +10 -20
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +12 -4
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +29 -9
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +24 -6
- package/src/renderers/webgpu/utils/WebGPUUtils.js +0 -1
- package/src/renderers/webxr/WebXRManager.js +4 -4
- package/examples/jsm/cameras/CinematicCamera.js +0 -208
- package/src/nodes/display/FXAANode.js +0 -332
- package/src/nodes/utils/OscNode.js +0 -85
- package/src/nodes/utils/TimerNode.js +0 -97
- package/src/renderers/webvr/WebVRManager.js +0 -495
- package/src/renderers/webvr/WebVRUtils.js +0 -66
- /package/examples/jsm/utils/{TextureUtils.js → WebGLTextureUtils.js} +0 -0
|
@@ -2,7 +2,7 @@ import DataMap from './DataMap.js';
|
|
|
2
2
|
|
|
3
3
|
import { Vector3 } from '../../math/Vector3.js';
|
|
4
4
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
5
|
-
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type,
|
|
5
|
+
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, EquirectangularReflectionMapping, EquirectangularRefractionMapping, CubeReflectionMapping, CubeRefractionMapping, UnsignedByteType } from '../../constants.js';
|
|
6
6
|
|
|
7
7
|
const _size = /*@__PURE__*/ new Vector3();
|
|
8
8
|
|
|
@@ -33,9 +33,11 @@ class Textures extends DataMap {
|
|
|
33
33
|
const mipHeight = size.height >> activeMipmapLevel;
|
|
34
34
|
|
|
35
35
|
let depthTexture = renderTarget.depthTexture || depthTextureMips[ activeMipmapLevel ];
|
|
36
|
+
const useDepthTexture = renderTarget.depthBuffer === true || renderTarget.stencilBuffer === true;
|
|
37
|
+
|
|
36
38
|
let textureNeedsUpdate = false;
|
|
37
39
|
|
|
38
|
-
if ( depthTexture === undefined ) {
|
|
40
|
+
if ( depthTexture === undefined && useDepthTexture ) {
|
|
39
41
|
|
|
40
42
|
depthTexture = new DepthTexture();
|
|
41
43
|
depthTexture.format = renderTarget.stencilBuffer ? DepthStencilFormat : DepthFormat;
|
|
@@ -50,17 +52,21 @@ class Textures extends DataMap {
|
|
|
50
52
|
if ( renderTargetData.width !== size.width || size.height !== renderTargetData.height ) {
|
|
51
53
|
|
|
52
54
|
textureNeedsUpdate = true;
|
|
53
|
-
depthTexture.needsUpdate = true;
|
|
54
55
|
|
|
55
|
-
depthTexture
|
|
56
|
-
|
|
56
|
+
if ( depthTexture ) {
|
|
57
|
+
|
|
58
|
+
depthTexture.needsUpdate = true;
|
|
59
|
+
depthTexture.image.width = mipWidth;
|
|
60
|
+
depthTexture.image.height = mipHeight;
|
|
61
|
+
|
|
62
|
+
}
|
|
57
63
|
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
renderTargetData.width = size.width;
|
|
61
67
|
renderTargetData.height = size.height;
|
|
62
68
|
renderTargetData.textures = textures;
|
|
63
|
-
renderTargetData.depthTexture = depthTexture;
|
|
69
|
+
renderTargetData.depthTexture = depthTexture || null;
|
|
64
70
|
renderTargetData.depth = renderTarget.depthBuffer;
|
|
65
71
|
renderTargetData.stencil = renderTarget.stencilBuffer;
|
|
66
72
|
renderTargetData.renderTarget = renderTarget;
|
|
@@ -68,7 +74,12 @@ class Textures extends DataMap {
|
|
|
68
74
|
if ( renderTargetData.sampleCount !== sampleCount ) {
|
|
69
75
|
|
|
70
76
|
textureNeedsUpdate = true;
|
|
71
|
-
|
|
77
|
+
|
|
78
|
+
if ( depthTexture ) {
|
|
79
|
+
|
|
80
|
+
depthTexture.needsUpdate = true;
|
|
81
|
+
|
|
82
|
+
}
|
|
72
83
|
|
|
73
84
|
renderTargetData.sampleCount = sampleCount;
|
|
74
85
|
|
|
@@ -88,7 +99,11 @@ class Textures extends DataMap {
|
|
|
88
99
|
|
|
89
100
|
}
|
|
90
101
|
|
|
91
|
-
|
|
102
|
+
if ( depthTexture ) {
|
|
103
|
+
|
|
104
|
+
this.updateTexture( depthTexture, options );
|
|
105
|
+
|
|
106
|
+
}
|
|
92
107
|
|
|
93
108
|
// dispose handler
|
|
94
109
|
|
|
@@ -108,7 +123,11 @@ class Textures extends DataMap {
|
|
|
108
123
|
|
|
109
124
|
}
|
|
110
125
|
|
|
111
|
-
|
|
126
|
+
if ( depthTexture ) {
|
|
127
|
+
|
|
128
|
+
this._destroyTexture( depthTexture );
|
|
129
|
+
|
|
130
|
+
}
|
|
112
131
|
|
|
113
132
|
this.delete( renderTarget );
|
|
114
133
|
|
|
@@ -141,8 +160,7 @@ class Textures extends DataMap {
|
|
|
141
160
|
|
|
142
161
|
if ( texture.isFramebufferTexture ) {
|
|
143
162
|
|
|
144
|
-
const
|
|
145
|
-
const renderTarget = renderer.getRenderTarget();
|
|
163
|
+
const renderTarget = this.renderer.getRenderTarget();
|
|
146
164
|
|
|
147
165
|
if ( renderTarget ) {
|
|
148
166
|
|
|
@@ -316,9 +334,7 @@ class Textures extends DataMap {
|
|
|
316
334
|
|
|
317
335
|
needsMipmaps( texture ) {
|
|
318
336
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
return ( texture.isCompressedTexture === true ) || ( ( texture.minFilter !== NearestFilter ) && ( texture.minFilter !== LinearFilter ) );
|
|
337
|
+
return this.isEnvironmentTexture( texture ) || texture.isCompressedTexture === true || texture.generateMipmaps;
|
|
322
338
|
|
|
323
339
|
}
|
|
324
340
|
|
|
@@ -5,7 +5,6 @@ class NodeLibrary {
|
|
|
5
5
|
this.lightNodes = new WeakMap();
|
|
6
6
|
this.materialNodes = new Map();
|
|
7
7
|
this.toneMappingNodes = new Map();
|
|
8
|
-
this.colorSpaceNodes = new Map();
|
|
9
8
|
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -33,18 +32,6 @@ class NodeLibrary {
|
|
|
33
32
|
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
addColorSpace( colorSpaceNode, colorSpace ) {
|
|
37
|
-
|
|
38
|
-
this.addType( colorSpaceNode, colorSpace, this.colorSpaceNodes );
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
getColorSpaceFunction( colorSpace ) {
|
|
43
|
-
|
|
44
|
-
return this.colorSpaceNodes.get( colorSpace ) || null;
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
35
|
addToneMapping( toneMappingNode, toneMapping ) {
|
|
49
36
|
|
|
50
37
|
this.addType( toneMappingNode, toneMapping, this.toneMappingNodes );
|
|
@@ -65,7 +52,7 @@ class NodeLibrary {
|
|
|
65
52
|
|
|
66
53
|
addMaterial( materialNodeClass, materialClass ) {
|
|
67
54
|
|
|
68
|
-
this.addType( materialNodeClass, materialClass.
|
|
55
|
+
this.addType( materialNodeClass, materialClass.type, this.materialNodes );
|
|
69
56
|
|
|
70
57
|
}
|
|
71
58
|
|
|
@@ -3,7 +3,7 @@ import ChainMap from '../ChainMap.js';
|
|
|
3
3
|
import NodeBuilderState from './NodeBuilderState.js';
|
|
4
4
|
import { cubeMapNode } from '../../../nodes/utils/CubeMapNode.js';
|
|
5
5
|
import { NodeFrame } from '../../../nodes/Nodes.js';
|
|
6
|
-
import { objectGroup, renderGroup, frameGroup, cubeTexture, texture, rangeFog, densityFog, reference,
|
|
6
|
+
import { objectGroup, renderGroup, frameGroup, cubeTexture, texture, rangeFog, densityFog, reference, pmremTexture, screenUV } from '../../../nodes/TSL.js';
|
|
7
7
|
|
|
8
8
|
import { CubeUVReflectionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping } from '../../../constants.js';
|
|
9
9
|
import { hashArray } from '../../../nodes/core/NodeUtils.js';
|
|
@@ -279,7 +279,7 @@ class Nodes extends DataMap {
|
|
|
279
279
|
|
|
280
280
|
if ( scene.backgroundBlurriness > 0 || background.mapping === CubeUVReflectionMapping ) {
|
|
281
281
|
|
|
282
|
-
backgroundNode = pmremTexture( background
|
|
282
|
+
backgroundNode = pmremTexture( background );
|
|
283
283
|
|
|
284
284
|
} else {
|
|
285
285
|
|
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
export default /* glsl */`
|
|
2
2
|
|
|
3
|
-
// http://www.russellcottrell.com/photo/matrixCalculator.htm
|
|
4
|
-
|
|
5
|
-
// Linear sRGB => XYZ => Linear Display P3
|
|
6
|
-
const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
|
|
7
|
-
vec3( 0.8224621, 0.177538, 0.0 ),
|
|
8
|
-
vec3( 0.0331941, 0.9668058, 0.0 ),
|
|
9
|
-
vec3( 0.0170827, 0.0723974, 0.9105199 )
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
// Linear Display P3 => XYZ => Linear sRGB
|
|
13
|
-
const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
|
|
14
|
-
vec3( 1.2249401, - 0.2249404, 0.0 ),
|
|
15
|
-
vec3( - 0.0420569, 1.0420571, 0.0 ),
|
|
16
|
-
vec3( - 0.0196376, - 0.0786361, 1.0982735 )
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
|
|
20
|
-
return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
|
|
24
|
-
return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
|
|
25
|
-
}
|
|
26
|
-
|
|
27
3
|
vec4 LinearTransferOETF( in vec4 value ) {
|
|
28
4
|
return value;
|
|
29
5
|
}
|
|
30
6
|
|
|
7
|
+
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
8
|
+
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
|
|
9
|
+
}
|
|
10
|
+
|
|
31
11
|
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
32
12
|
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|
33
13
|
}
|
|
@@ -3,6 +3,14 @@ export default /* glsl */`
|
|
|
3
3
|
|
|
4
4
|
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
5
5
|
|
|
6
|
+
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
7
|
+
|
|
8
|
+
// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)
|
|
9
|
+
|
|
10
|
+
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
11
|
+
|
|
12
|
+
#endif
|
|
13
|
+
|
|
6
14
|
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
7
15
|
|
|
8
16
|
#endif
|
|
@@ -7,8 +7,8 @@ export default /* glsl */`
|
|
|
7
7
|
|
|
8
8
|
// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)
|
|
9
9
|
|
|
10
|
-
sampledDiffuseColor =
|
|
11
|
-
|
|
10
|
+
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
11
|
+
|
|
12
12
|
#endif
|
|
13
13
|
|
|
14
14
|
diffuseColor *= sampledDiffuseColor;
|
|
@@ -65,15 +65,11 @@ function WebGLBufferRenderer( gl, extensions, info ) {
|
|
|
65
65
|
let elementCount = 0;
|
|
66
66
|
for ( let i = 0; i < drawCount; i ++ ) {
|
|
67
67
|
|
|
68
|
-
elementCount += counts[ i ];
|
|
68
|
+
elementCount += counts[ i ] * primcount[ i ];
|
|
69
69
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
info.update( elementCount, mode, primcount[ i ] );
|
|
75
|
-
|
|
76
|
-
}
|
|
72
|
+
info.update( elementCount, mode, 1 );
|
|
77
73
|
|
|
78
74
|
}
|
|
79
75
|
|
|
@@ -94,13 +94,6 @@ function WebGLCapabilities( gl, extensions, parameters, utils ) {
|
|
|
94
94
|
const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
|
|
95
95
|
const reverseDepthBuffer = parameters.reverseDepthBuffer === true && extensions.has( 'EXT_clip_control' );
|
|
96
96
|
|
|
97
|
-
if ( reverseDepthBuffer === true ) {
|
|
98
|
-
|
|
99
|
-
const ext = extensions.get( 'EXT_clip_control' );
|
|
100
|
-
ext.clipControlEXT( ext.LOWER_LEFT_EXT, ext.ZERO_TO_ONE_EXT );
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
97
|
const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
|
|
105
98
|
const maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );
|
|
106
99
|
const maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );
|
|
@@ -75,15 +75,11 @@ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
|
|
|
75
75
|
let elementCount = 0;
|
|
76
76
|
for ( let i = 0; i < drawCount; i ++ ) {
|
|
77
77
|
|
|
78
|
-
elementCount += counts[ i ];
|
|
78
|
+
elementCount += counts[ i ] * primcount[ i ];
|
|
79
79
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
info.update( elementCount, mode, primcount[ i ] );
|
|
85
|
-
|
|
86
|
-
}
|
|
82
|
+
info.update( elementCount, mode, 1 );
|
|
87
83
|
|
|
88
84
|
}
|
|
89
85
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { WebGLUniforms } from './WebGLUniforms.js';
|
|
2
2
|
import { WebGLShader } from './WebGLShader.js';
|
|
3
3
|
import { ShaderChunk } from '../shaders/ShaderChunk.js';
|
|
4
|
-
import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, AgXToneMapping, ACESFilmicToneMapping, NeutralToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GLSL3,
|
|
4
|
+
import { NoToneMapping, AddOperation, MixOperation, MultiplyOperation, CubeRefractionMapping, CubeUVReflectionMapping, CubeReflectionMapping, PCFSoftShadowMap, PCFShadowMap, VSMShadowMap, AgXToneMapping, ACESFilmicToneMapping, NeutralToneMapping, CineonToneMapping, CustomToneMapping, ReinhardToneMapping, LinearToneMapping, GLSL3, LinearTransfer, SRGBTransfer } from '../../constants.js';
|
|
5
5
|
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
6
6
|
import { Vector3 } from '../../math/Vector3.js';
|
|
7
|
+
import { Matrix3 } from '../../math/Matrix3.js';
|
|
7
8
|
|
|
8
9
|
// From https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/
|
|
9
10
|
const COMPLETION_STATUS_KHR = 0x91B1;
|
|
@@ -29,40 +30,25 @@ function handleSource( string, errorLine ) {
|
|
|
29
30
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
|
|
35
|
-
const encodingPrimaries = ColorManagement.getPrimaries( colorSpace );
|
|
36
|
-
|
|
37
|
-
let gamutMapping;
|
|
38
|
-
|
|
39
|
-
if ( workingPrimaries === encodingPrimaries ) {
|
|
33
|
+
const _m0 = /*@__PURE__*/ new Matrix3();
|
|
40
34
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {
|
|
44
|
-
|
|
45
|
-
gamutMapping = 'LinearDisplayP3ToLinearSRGB';
|
|
46
|
-
|
|
47
|
-
} else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {
|
|
35
|
+
function getEncodingComponents( colorSpace ) {
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
ColorManagement._getMatrix( _m0, ColorManagement.workingColorSpace, colorSpace );
|
|
50
38
|
|
|
51
|
-
}
|
|
39
|
+
const encodingMatrix = `mat3( ${ _m0.elements.map( ( v ) => v.toFixed( 4 ) ) } )`;
|
|
52
40
|
|
|
53
|
-
switch ( colorSpace ) {
|
|
41
|
+
switch ( ColorManagement.getTransfer( colorSpace ) ) {
|
|
54
42
|
|
|
55
|
-
case
|
|
56
|
-
|
|
57
|
-
return [ gamutMapping, 'LinearTransferOETF' ];
|
|
43
|
+
case LinearTransfer:
|
|
44
|
+
return [ encodingMatrix, 'LinearTransferOETF' ];
|
|
58
45
|
|
|
59
|
-
case
|
|
60
|
-
|
|
61
|
-
return [ gamutMapping, 'sRGBTransferOETF' ];
|
|
46
|
+
case SRGBTransfer:
|
|
47
|
+
return [ encodingMatrix, 'sRGBTransferOETF' ];
|
|
62
48
|
|
|
63
49
|
default:
|
|
64
|
-
console.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );
|
|
65
|
-
return [
|
|
50
|
+
console.warn( 'THREE.WebGLProgram: Unsupported color space: ', colorSpace );
|
|
51
|
+
return [ encodingMatrix, 'LinearTransferOETF' ];
|
|
66
52
|
|
|
67
53
|
}
|
|
68
54
|
|
|
@@ -95,7 +81,16 @@ function getShaderErrors( gl, shader, type ) {
|
|
|
95
81
|
function getTexelEncodingFunction( functionName, colorSpace ) {
|
|
96
82
|
|
|
97
83
|
const components = getEncodingComponents( colorSpace );
|
|
98
|
-
|
|
84
|
+
|
|
85
|
+
return [
|
|
86
|
+
|
|
87
|
+
`vec4 ${functionName}( vec4 value ) {`,
|
|
88
|
+
|
|
89
|
+
` return ${components[ 1 ]}( vec4( value.rgb * ${components[ 0 ]}, value.a ) );`,
|
|
90
|
+
|
|
91
|
+
'}',
|
|
92
|
+
|
|
93
|
+
].join( '\n' );
|
|
99
94
|
|
|
100
95
|
}
|
|
101
96
|
|
|
@@ -823,6 +818,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
823
818
|
parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
|
|
824
819
|
|
|
825
820
|
parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
|
|
821
|
+
parameters.decodeVideoTextureEmissive ? '#define DECODE_VIDEO_TEXTURE_EMISSIVE' : '',
|
|
826
822
|
|
|
827
823
|
parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
|
|
828
824
|
parameters.reverseDepthBuffer ? '#define USE_REVERSEDEPTHBUF' : '',
|
|
@@ -14,7 +14,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
14
14
|
const programs = [];
|
|
15
15
|
|
|
16
16
|
const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
|
|
17
|
-
const reverseDepthBuffer = capabilities.reverseDepthBuffer;
|
|
18
17
|
const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
|
|
19
18
|
|
|
20
19
|
let precision = capabilities.precision;
|
|
@@ -109,6 +108,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
111
|
+
const reverseDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
112
112
|
|
|
113
113
|
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
114
114
|
|
|
@@ -344,6 +344,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
344
344
|
toneMapping: toneMapping,
|
|
345
345
|
|
|
346
346
|
decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),
|
|
347
|
+
decodeVideoTextureEmissive: HAS_EMISSIVEMAP && ( material.emissiveMap.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.emissiveMap.colorSpace ) === SRGBTransfer ),
|
|
347
348
|
|
|
348
349
|
premultipliedAlpha: material.premultipliedAlpha,
|
|
349
350
|
|
|
@@ -561,8 +562,10 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
561
562
|
_programLayers.enable( 18 );
|
|
562
563
|
if ( parameters.decodeVideoTexture )
|
|
563
564
|
_programLayers.enable( 19 );
|
|
564
|
-
if ( parameters.
|
|
565
|
+
if ( parameters.decodeVideoTextureEmissive )
|
|
565
566
|
_programLayers.enable( 20 );
|
|
567
|
+
if ( parameters.alphaToCoverage )
|
|
568
|
+
_programLayers.enable( 21 );
|
|
566
569
|
if ( parameters.numMultiviewViews )
|
|
567
570
|
_programLayers.enable( 21 );
|
|
568
571
|
|
|
@@ -14,7 +14,7 @@ const reversedFuncs = {
|
|
|
14
14
|
[ GreaterEqualDepth ]: LessEqualDepth,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
function WebGLState( gl ) {
|
|
17
|
+
function WebGLState( gl, extensions ) {
|
|
18
18
|
|
|
19
19
|
function ColorBuffer() {
|
|
20
20
|
|
|
@@ -88,10 +88,36 @@ function WebGLState( gl ) {
|
|
|
88
88
|
|
|
89
89
|
setReversed: function ( value ) {
|
|
90
90
|
|
|
91
|
+
if ( reversed !== value ) {
|
|
92
|
+
|
|
93
|
+
const ext = extensions.get( 'EXT_clip_control' );
|
|
94
|
+
|
|
95
|
+
if ( reversed ) {
|
|
96
|
+
|
|
97
|
+
ext.clipControlEXT( ext.LOWER_LEFT_EXT, ext.ZERO_TO_ONE_EXT );
|
|
98
|
+
|
|
99
|
+
} else {
|
|
100
|
+
|
|
101
|
+
ext.clipControlEXT( ext.LOWER_LEFT_EXT, ext.NEGATIVE_ONE_TO_ONE_EXT );
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const oldDepth = currentDepthClear;
|
|
106
|
+
currentDepthClear = null;
|
|
107
|
+
this.setClear( oldDepth );
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
91
111
|
reversed = value;
|
|
92
112
|
|
|
93
113
|
},
|
|
94
114
|
|
|
115
|
+
getReversed: function () {
|
|
116
|
+
|
|
117
|
+
return reversed;
|
|
118
|
+
|
|
119
|
+
},
|
|
120
|
+
|
|
95
121
|
setTest: function ( depthTest ) {
|
|
96
122
|
|
|
97
123
|
if ( depthTest ) {
|
|
@@ -187,6 +213,12 @@ function WebGLState( gl ) {
|
|
|
187
213
|
|
|
188
214
|
if ( currentDepthClear !== depth ) {
|
|
189
215
|
|
|
216
|
+
if ( reversed ) {
|
|
217
|
+
|
|
218
|
+
depth = 1 - depth;
|
|
219
|
+
|
|
220
|
+
}
|
|
221
|
+
|
|
190
222
|
gl.clearDepth( depth );
|
|
191
223
|
currentDepthClear = depth;
|
|
192
224
|
|
|
@@ -201,6 +233,7 @@ function WebGLState( gl ) {
|
|
|
201
233
|
currentDepthMask = null;
|
|
202
234
|
currentDepthFunc = null;
|
|
203
235
|
currentDepthClear = null;
|
|
236
|
+
reversed = false;
|
|
204
237
|
|
|
205
238
|
}
|
|
206
239
|
|
|
@@ -1171,6 +1204,9 @@ function WebGLState( gl ) {
|
|
|
1171
1204
|
|
|
1172
1205
|
gl.depthMask( true );
|
|
1173
1206
|
gl.depthFunc( gl.LESS );
|
|
1207
|
+
|
|
1208
|
+
depthBuffer.setReversed( false );
|
|
1209
|
+
|
|
1174
1210
|
gl.clearDepth( 1 );
|
|
1175
1211
|
|
|
1176
1212
|
gl.stencilMask( 0xffffffff );
|
|
@@ -111,7 +111,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
111
111
|
|
|
112
112
|
function textureNeedsGenerateMipmaps( texture ) {
|
|
113
113
|
|
|
114
|
-
return texture.generateMipmaps
|
|
114
|
+
return texture.generateMipmaps;
|
|
115
115
|
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -121,6 +121,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
121
121
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
function getTargetType( texture ) {
|
|
125
|
+
|
|
126
|
+
if ( texture.isWebGLCubeRenderTarget ) return _gl.TEXTURE_CUBE_MAP;
|
|
127
|
+
if ( texture.isWebGL3DRenderTarget ) return _gl.TEXTURE_3D;
|
|
128
|
+
if ( texture.isWebGLArrayRenderTarget || texture.isCompressedArrayTexture ) return _gl.TEXTURE_2D_ARRAY;
|
|
129
|
+
return _gl.TEXTURE_2D;
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
124
133
|
function getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {
|
|
125
134
|
|
|
126
135
|
if ( internalFormatName !== null ) {
|
|
@@ -380,6 +389,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
380
389
|
|
|
381
390
|
renderTarget.depthTexture.dispose();
|
|
382
391
|
|
|
392
|
+
properties.remove( renderTarget.depthTexture );
|
|
393
|
+
|
|
383
394
|
}
|
|
384
395
|
|
|
385
396
|
if ( renderTarget.isWebGLCubeRenderTarget ) {
|
|
@@ -929,7 +940,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
929
940
|
layerIndex * layerByteLength / mipmap.data.BYTES_PER_ELEMENT,
|
|
930
941
|
( layerIndex + 1 ) * layerByteLength / mipmap.data.BYTES_PER_ELEMENT
|
|
931
942
|
);
|
|
932
|
-
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData
|
|
943
|
+
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, layerData );
|
|
933
944
|
|
|
934
945
|
}
|
|
935
946
|
|
|
@@ -937,7 +948,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
937
948
|
|
|
938
949
|
} else {
|
|
939
950
|
|
|
940
|
-
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data
|
|
951
|
+
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data );
|
|
941
952
|
|
|
942
953
|
}
|
|
943
954
|
|
|
@@ -1453,6 +1464,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1453
1464
|
const glType = utils.convert( texture.type );
|
|
1454
1465
|
const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
1455
1466
|
const renderTargetProperties = properties.get( renderTarget );
|
|
1467
|
+
const textureProperties = properties.get( texture );
|
|
1468
|
+
|
|
1469
|
+
textureProperties.__renderTarget = renderTarget;
|
|
1456
1470
|
|
|
1457
1471
|
if ( ! renderTargetProperties.__hasExternalTextures ) {
|
|
1458
1472
|
|
|
@@ -1483,11 +1497,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1483
1497
|
|
|
1484
1498
|
if ( multisampled ) {
|
|
1485
1499
|
|
|
1486
|
-
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0,
|
|
1500
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ), 0, renderTarget.numViews );
|
|
1487
1501
|
|
|
1488
1502
|
} else {
|
|
1489
1503
|
|
|
1490
|
-
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0,
|
|
1504
|
+
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, 0, 0, renderTarget.numViews );
|
|
1491
1505
|
|
|
1492
1506
|
}
|
|
1493
1507
|
|
|
@@ -1495,11 +1509,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1495
1509
|
|
|
1496
1510
|
if ( multisampled ) {
|
|
1497
1511
|
|
|
1498
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget,
|
|
1512
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
1499
1513
|
|
|
1500
1514
|
} else {
|
|
1501
1515
|
|
|
1502
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget,
|
|
1516
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level );
|
|
1503
1517
|
|
|
1504
1518
|
}
|
|
1505
1519
|
|
|
@@ -1642,8 +1656,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1642
1656
|
|
|
1643
1657
|
}
|
|
1644
1658
|
|
|
1659
|
+
const textureProperties = properties.get( renderTarget.depthTexture );
|
|
1660
|
+
textureProperties.__renderTarget = renderTarget;
|
|
1661
|
+
|
|
1645
1662
|
// upload an empty depth texture with framebuffer size
|
|
1646
|
-
if ( !
|
|
1663
|
+
if ( ! textureProperties.__webglTexture ||
|
|
1647
1664
|
renderTarget.depthTexture.image.width !== renderTarget.width ||
|
|
1648
1665
|
renderTarget.depthTexture.image.height !== renderTarget.height ) {
|
|
1649
1666
|
|
|
@@ -1664,7 +1681,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1664
1681
|
|
|
1665
1682
|
}
|
|
1666
1683
|
|
|
1667
|
-
const webglDepthTexture =
|
|
1684
|
+
const webglDepthTexture = textureProperties.__webglTexture;
|
|
1668
1685
|
const samples = getRenderTargetSamples( renderTarget );
|
|
1669
1686
|
|
|
1670
1687
|
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
@@ -2100,11 +2117,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
2100
2117
|
|
|
2101
2118
|
if ( textureNeedsGenerateMipmaps( texture ) ) {
|
|
2102
2119
|
|
|
2103
|
-
const
|
|
2120
|
+
const targetType = getTargetType( renderTarget );
|
|
2104
2121
|
const webglTexture = properties.get( texture ).__webglTexture;
|
|
2105
2122
|
|
|
2106
|
-
state.bindTexture(
|
|
2107
|
-
generateMipmap(
|
|
2123
|
+
state.bindTexture( targetType, webglTexture );
|
|
2124
|
+
generateMipmap( targetType );
|
|
2108
2125
|
state.unbindTexture();
|
|
2109
2126
|
|
|
2110
2127
|
}
|