super-three 0.169.1 → 0.170.1
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 +24628 -24228
- package/build/three.core.js +37002 -0
- package/build/three.core.min.js +6 -0
- package/build/three.module.js +10519 -47108
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +533 -0
- package/build/three.tsl.min.js +6 -0
- package/build/three.webgpu.js +17071 -53583
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +17134 -53623
- 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/capabilities/WebGPU.js +1 -10
- package/examples/jsm/controls/ArcballControls.js +25 -21
- package/examples/jsm/controls/OrbitControls.js +41 -9
- package/examples/jsm/controls/PointerLockControls.js +2 -5
- 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 +437 -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 +70 -21
- 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/LineGeometry.js +25 -0
- package/examples/jsm/lines/LineMaterial.js +0 -1
- package/examples/jsm/lines/LineSegmentsGeometry.js +2 -0
- package/examples/jsm/lines/webgpu/Line2.js +2 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +2 -16
- package/examples/jsm/lines/webgpu/Wireframe.js +57 -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 +143 -49
- package/examples/jsm/loaders/LDrawLoader.js +22 -136
- package/examples/jsm/loaders/LottieLoader.js +1 -0
- package/examples/jsm/loaders/MMDLoader.js +3 -0
- package/examples/jsm/loaders/MaterialXLoader.js +2 -2
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +143 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +114 -0
- 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/InstancedPoints.js +2 -4
- package/examples/jsm/objects/LensflareMesh.js +4 -2
- package/examples/jsm/objects/SkyMesh.js +5 -3
- package/examples/jsm/objects/Water2Mesh.js +7 -3
- package/examples/jsm/objects/WaterMesh.js +12 -10
- 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/AST.js +2 -2
- package/examples/jsm/transpiler/GLSLDecoder.js +57 -25
- package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
- package/examples/jsm/transpiler/TSLEncoder.js +11 -6
- package/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.js +18 -21
- 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 +12 -41
- package/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.js +60 -47
- package/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.js +4 -9
- 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 +4 -7
- package/{src/nodes → examples/jsm/tsl}/display/GTAONode.js +73 -78
- package/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.js +78 -42
- package/examples/jsm/tsl/display/LensflareNode.js +161 -0
- package/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.js +3 -5
- 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 +2 -5
- package/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.js +5 -17
- package/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.js +2 -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 +366 -0
- package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +1 -2
- package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +4 -12
- 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 +3 -7
- package/examples/jsm/tsl/display/hashBlur.js +24 -0
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +389 -0
- package/examples/jsm/utils/SceneOptimizer.js +410 -0
- package/examples/jsm/utils/UVsDebug.js +1 -1
- 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 +4 -4
- package/src/Three.Core.js +178 -0
- package/src/Three.TSL.js +526 -0
- package/src/Three.WebGPU.Nodes.js +9 -186
- package/src/Three.WebGPU.js +8 -186
- package/src/Three.js +1 -177
- package/src/animation/AnimationClip.js +2 -2
- package/src/animation/AnimationObjectGroup.js +2 -2
- package/src/audio/Audio.js +38 -0
- package/src/cameras/PerspectiveCamera.js +6 -6
- package/src/cameras/StereoCamera.js +2 -2
- package/src/constants.js +1 -6
- package/src/core/BufferGeometry.js +48 -8
- package/src/core/InterleavedBuffer.js +4 -4
- package/src/core/Object3D.js +2 -2
- package/src/extras/core/Curve.js +3 -3
- package/src/extras/core/Shape.js +2 -2
- package/src/geometries/CylinderGeometry.js +2 -2
- package/src/geometries/EdgesGeometry.js +2 -2
- package/src/geometries/LatheGeometry.js +2 -2
- package/src/lights/SpotLightShadow.js +2 -2
- package/src/materials/LineDashedMaterial.js +0 -1
- package/src/materials/Material.js +2 -2
- package/src/materials/MeshPhongMaterial.js +1 -1
- package/src/materials/MeshPhysicalMaterial.js +2 -2
- package/src/materials/MeshStandardMaterial.js +2 -2
- package/src/materials/nodes/Line2NodeMaterial.js +32 -13
- package/src/materials/nodes/LineDashedNodeMaterial.js +4 -2
- package/src/materials/nodes/NodeMaterial.js +93 -23
- package/src/materials/nodes/SpriteNodeMaterial.js +11 -2
- package/src/materials/nodes/manager/NodeMaterialObserver.js +119 -7
- package/src/math/ColorManagement.js +143 -102
- package/src/math/Line3.js +2 -2
- package/src/math/Quaternion.js +2 -2
- package/src/math/Spherical.js +3 -3
- package/src/math/Vector2.js +7 -7
- package/src/math/Vector3.js +9 -9
- package/src/math/Vector4.js +22 -9
- package/src/nodes/Nodes.js +2 -21
- package/src/nodes/TSL.js +9 -25
- package/src/nodes/accessors/Arrays.js +27 -0
- package/src/nodes/accessors/BuiltinNode.js +26 -0
- package/src/nodes/accessors/Camera.js +0 -1
- package/src/nodes/accessors/ClippingNode.js +76 -42
- package/src/nodes/accessors/InstanceNode.js +17 -20
- package/src/nodes/accessors/InstancedMeshNode.js +26 -0
- package/src/nodes/accessors/Lights.js +32 -0
- package/src/nodes/accessors/SceneNode.js +35 -1
- package/src/nodes/accessors/StorageBufferNode.js +61 -19
- package/src/nodes/accessors/StorageTextureNode.js +10 -4
- package/src/nodes/accessors/TextureNode.js +1 -1
- 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 +31 -14
- package/src/nodes/core/NodeUtils.js +28 -0
- package/src/nodes/core/VarNode.js +15 -3
- package/src/nodes/core/constants.js +6 -0
- package/src/nodes/display/BlendModes.js +99 -0
- 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/ToonOutlinePassNode.js +3 -3
- package/src/nodes/display/ViewportDepthNode.js +48 -1
- package/src/nodes/functions/PhysicalLightingModel.js +21 -15
- package/src/nodes/functions/material/getAlphaHashThreshold.js +70 -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 +23 -419
- package/src/nodes/lighting/LightsNode.js +24 -12
- package/src/nodes/lighting/PointLightNode.js +41 -22
- package/src/nodes/lighting/PointShadowNode.js +254 -0
- package/src/nodes/lighting/RectAreaLightNode.js +3 -0
- package/src/nodes/lighting/ShadowNode.js +593 -0
- package/src/nodes/lighting/SpotLightNode.js +14 -2
- 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/RTTNode.js +9 -1
- package/src/nodes/utils/ReflectorNode.js +101 -15
- package/src/nodes/utils/StorageArrayElementNode.js +2 -2
- package/src/nodes/utils/Timer.js +29 -0
- package/src/objects/BatchedMesh.js +472 -296
- package/src/objects/ClippingGroup.js +19 -0
- package/src/objects/Skeleton.js +2 -2
- package/src/renderers/WebGLRenderer.js +183 -109
- package/src/renderers/common/Animation.js +23 -11
- package/src/renderers/common/Attributes.js +4 -0
- package/src/renderers/common/Backend.js +2 -0
- package/src/renderers/common/Background.js +15 -5
- package/src/renderers/common/Bindings.js +23 -6
- package/src/renderers/common/ClippingContext.js +77 -85
- 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 +48 -17
- package/src/renderers/common/RenderLists.js +4 -2
- package/src/renderers/common/RenderObject.js +45 -28
- package/src/renderers/common/RenderObjects.js +12 -6
- package/src/renderers/common/Renderer.js +222 -77
- package/src/renderers/common/Textures.js +41 -17
- package/src/renderers/common/UniformsGroup.js +16 -4
- package/src/renderers/common/extras/PMREMGenerator.js +89 -13
- package/src/renderers/common/nodes/NodeLibrary.js +2 -15
- package/src/renderers/common/nodes/NodeStorageBuffer.js +2 -3
- package/src/renderers/common/nodes/NodeUniform.js +42 -0
- 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/WebGLBackground.js +20 -1
- package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
- package/src/renderers/webgl/WebGLCapabilities.js +0 -7
- package/src/renderers/webgl/WebGLGeometries.js +0 -28
- 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 +111 -37
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +2 -7
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +43 -12
- package/src/renderers/webgl-fallback/utils/WebGLState.js +26 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +37 -9
- package/src/renderers/webgpu/WebGPUBackend.js +152 -56
- 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 +13 -34
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +192 -92
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +12 -4
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -2
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -7
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +29 -9
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +29 -7
- package/src/renderers/webgpu/utils/WebGPUUtils.js +0 -1
- package/src/renderers/webxr/WebXRManager.js +4 -4
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +2 -2
- package/examples/jsm/cameras/CinematicCamera.js +0 -208
- package/src/nodes/display/BlendMode.js +0 -54
- 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/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
|
|
|
@@ -282,8 +300,8 @@ class Textures extends DataMap {
|
|
|
282
300
|
|
|
283
301
|
if ( image.image !== undefined ) image = image.image;
|
|
284
302
|
|
|
285
|
-
target.width = image.width;
|
|
286
|
-
target.height = image.height;
|
|
303
|
+
target.width = image.width || 1;
|
|
304
|
+
target.height = image.height || 1;
|
|
287
305
|
target.depth = texture.isCubeTexture ? 6 : ( image.depth || 1 );
|
|
288
306
|
|
|
289
307
|
} else {
|
|
@@ -302,7 +320,15 @@ class Textures extends DataMap {
|
|
|
302
320
|
|
|
303
321
|
if ( texture.isCompressedTexture ) {
|
|
304
322
|
|
|
305
|
-
|
|
323
|
+
if ( texture.mipmaps ) {
|
|
324
|
+
|
|
325
|
+
mipLevelCount = texture.mipmaps.length;
|
|
326
|
+
|
|
327
|
+
} else {
|
|
328
|
+
|
|
329
|
+
mipLevelCount = 1;
|
|
330
|
+
|
|
331
|
+
}
|
|
306
332
|
|
|
307
333
|
} else {
|
|
308
334
|
|
|
@@ -316,9 +342,7 @@ class Textures extends DataMap {
|
|
|
316
342
|
|
|
317
343
|
needsMipmaps( texture ) {
|
|
318
344
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
return ( texture.isCompressedTexture === true ) || ( ( texture.minFilter !== NearestFilter ) && ( texture.minFilter !== LinearFilter ) );
|
|
345
|
+
return this.isEnvironmentTexture( texture ) || texture.isCompressedTexture === true || texture.generateMipmaps;
|
|
322
346
|
|
|
323
347
|
}
|
|
324
348
|
|
|
@@ -149,10 +149,11 @@ class UniformsGroup extends UniformBuffer {
|
|
|
149
149
|
const a = this.values;
|
|
150
150
|
const v = uniform.getValue();
|
|
151
151
|
const offset = uniform.offset;
|
|
152
|
+
const type = uniform.getType();
|
|
152
153
|
|
|
153
154
|
if ( a[ offset ] !== v ) {
|
|
154
155
|
|
|
155
|
-
const b = this.
|
|
156
|
+
const b = this._getBufferForType( type );
|
|
156
157
|
|
|
157
158
|
b[ offset ] = a[ offset ] = v;
|
|
158
159
|
updated = true;
|
|
@@ -170,10 +171,11 @@ class UniformsGroup extends UniformBuffer {
|
|
|
170
171
|
const a = this.values;
|
|
171
172
|
const v = uniform.getValue();
|
|
172
173
|
const offset = uniform.offset;
|
|
174
|
+
const type = uniform.getType();
|
|
173
175
|
|
|
174
176
|
if ( a[ offset + 0 ] !== v.x || a[ offset + 1 ] !== v.y ) {
|
|
175
177
|
|
|
176
|
-
const b = this.
|
|
178
|
+
const b = this._getBufferForType( type );
|
|
177
179
|
|
|
178
180
|
b[ offset + 0 ] = a[ offset + 0 ] = v.x;
|
|
179
181
|
b[ offset + 1 ] = a[ offset + 1 ] = v.y;
|
|
@@ -193,10 +195,11 @@ class UniformsGroup extends UniformBuffer {
|
|
|
193
195
|
const a = this.values;
|
|
194
196
|
const v = uniform.getValue();
|
|
195
197
|
const offset = uniform.offset;
|
|
198
|
+
const type = uniform.getType();
|
|
196
199
|
|
|
197
200
|
if ( a[ offset + 0 ] !== v.x || a[ offset + 1 ] !== v.y || a[ offset + 2 ] !== v.z ) {
|
|
198
201
|
|
|
199
|
-
const b = this.
|
|
202
|
+
const b = this._getBufferForType( type );
|
|
200
203
|
|
|
201
204
|
b[ offset + 0 ] = a[ offset + 0 ] = v.x;
|
|
202
205
|
b[ offset + 1 ] = a[ offset + 1 ] = v.y;
|
|
@@ -217,10 +220,11 @@ class UniformsGroup extends UniformBuffer {
|
|
|
217
220
|
const a = this.values;
|
|
218
221
|
const v = uniform.getValue();
|
|
219
222
|
const offset = uniform.offset;
|
|
223
|
+
const type = uniform.getType();
|
|
220
224
|
|
|
221
225
|
if ( a[ offset + 0 ] !== v.x || a[ offset + 1 ] !== v.y || a[ offset + 2 ] !== v.z || a[ offset + 4 ] !== v.w ) {
|
|
222
226
|
|
|
223
|
-
const b = this.
|
|
227
|
+
const b = this._getBufferForType( type );
|
|
224
228
|
|
|
225
229
|
b[ offset + 0 ] = a[ offset + 0 ] = v.x;
|
|
226
230
|
b[ offset + 1 ] = a[ offset + 1 ] = v.y;
|
|
@@ -312,6 +316,14 @@ class UniformsGroup extends UniformBuffer {
|
|
|
312
316
|
|
|
313
317
|
}
|
|
314
318
|
|
|
319
|
+
_getBufferForType( type ) {
|
|
320
|
+
|
|
321
|
+
if ( type === 'int' || type === 'ivec2' || type === 'ivec3' || type === 'ivec4' ) return new Int32Array( this.buffer.buffer );
|
|
322
|
+
if ( type === 'uint' || type === 'uvec2' || type === 'uvec3' || type === 'uvec4' ) return new Uint32Array( this.buffer.buffer );
|
|
323
|
+
return this.buffer;
|
|
324
|
+
|
|
325
|
+
}
|
|
326
|
+
|
|
315
327
|
}
|
|
316
328
|
|
|
317
329
|
function setArray( a, b, offset ) {
|
|
@@ -116,6 +116,12 @@ class PMREMGenerator {
|
|
|
116
116
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
get _hasInitialized() {
|
|
120
|
+
|
|
121
|
+
return this._renderer.hasInitialized();
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
119
125
|
/**
|
|
120
126
|
* Generates a PMREM from a supplied Scene, which can be faster than using an
|
|
121
127
|
* image if networking bandwidth is low. Optional sigma specifies a blur radius
|
|
@@ -123,15 +129,27 @@ class PMREMGenerator {
|
|
|
123
129
|
* and far planes ensure the scene is rendered in its entirety (the cubeCamera
|
|
124
130
|
* is placed at the origin).
|
|
125
131
|
*/
|
|
126
|
-
fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {
|
|
132
|
+
fromScene( scene, sigma = 0, near = 0.1, far = 100, renderTarget = null ) {
|
|
133
|
+
|
|
134
|
+
this._setSize( 256 );
|
|
135
|
+
|
|
136
|
+
if ( this._hasInitialized === false ) {
|
|
137
|
+
|
|
138
|
+
console.warn( 'THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Try using .fromSceneAsync() instead.' );
|
|
139
|
+
|
|
140
|
+
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
141
|
+
|
|
142
|
+
this.fromSceneAsync( scene, sigma, near, far, cubeUVRenderTarget );
|
|
143
|
+
|
|
144
|
+
return cubeUVRenderTarget;
|
|
145
|
+
|
|
146
|
+
}
|
|
127
147
|
|
|
128
148
|
_oldTarget = this._renderer.getRenderTarget();
|
|
129
149
|
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
130
150
|
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
|
|
131
151
|
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
const cubeUVRenderTarget = this._allocateTargets();
|
|
152
|
+
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
135
153
|
cubeUVRenderTarget.depthBuffer = true;
|
|
136
154
|
|
|
137
155
|
this._sceneToCubeUV( scene, near, far, cubeUVRenderTarget );
|
|
@@ -150,6 +168,14 @@ class PMREMGenerator {
|
|
|
150
168
|
|
|
151
169
|
}
|
|
152
170
|
|
|
171
|
+
async fromSceneAsync( scene, sigma = 0, near = 0.1, far = 100, renderTarget = null ) {
|
|
172
|
+
|
|
173
|
+
if ( this._hasInitialized === false ) await this._renderer.init();
|
|
174
|
+
|
|
175
|
+
return this.fromScene( scene, sigma, near, far, renderTarget );
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
|
|
153
179
|
/**
|
|
154
180
|
* Generates a PMREM from an equirectangular texture, which can be either LDR
|
|
155
181
|
* or HDR. The ideal input image size is 1k (1024 x 512),
|
|
@@ -157,6 +183,28 @@ class PMREMGenerator {
|
|
|
157
183
|
*/
|
|
158
184
|
fromEquirectangular( equirectangular, renderTarget = null ) {
|
|
159
185
|
|
|
186
|
+
if ( this._hasInitialized === false ) {
|
|
187
|
+
|
|
188
|
+
console.warn( 'THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using .fromEquirectangularAsync() instead.' );
|
|
189
|
+
|
|
190
|
+
this._setSizeFromTexture( equirectangular );
|
|
191
|
+
|
|
192
|
+
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
193
|
+
|
|
194
|
+
this.fromEquirectangularAsync( equirectangular, cubeUVRenderTarget );
|
|
195
|
+
|
|
196
|
+
return cubeUVRenderTarget;
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return this._fromTexture( equirectangular, renderTarget );
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async fromEquirectangularAsync( equirectangular, renderTarget = null ) {
|
|
205
|
+
|
|
206
|
+
if ( this._hasInitialized === false ) await this._renderer.init();
|
|
207
|
+
|
|
160
208
|
return this._fromTexture( equirectangular, renderTarget );
|
|
161
209
|
|
|
162
210
|
}
|
|
@@ -168,6 +216,28 @@ class PMREMGenerator {
|
|
|
168
216
|
*/
|
|
169
217
|
fromCubemap( cubemap, renderTarget = null ) {
|
|
170
218
|
|
|
219
|
+
if ( this._hasInitialized === false ) {
|
|
220
|
+
|
|
221
|
+
console.warn( 'THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead.' );
|
|
222
|
+
|
|
223
|
+
this._setSizeFromTexture( cubemap );
|
|
224
|
+
|
|
225
|
+
const cubeUVRenderTarget = renderTarget || this._allocateTargets();
|
|
226
|
+
|
|
227
|
+
this.fromCubemapAsync( cubemap, renderTarget );
|
|
228
|
+
|
|
229
|
+
return cubeUVRenderTarget;
|
|
230
|
+
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return this._fromTexture( cubemap, renderTarget );
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async fromCubemapAsync( cubemap, renderTarget = null ) {
|
|
238
|
+
|
|
239
|
+
if ( this._hasInitialized === false ) await this._renderer.init();
|
|
240
|
+
|
|
171
241
|
return this._fromTexture( cubemap, renderTarget );
|
|
172
242
|
|
|
173
243
|
}
|
|
@@ -224,6 +294,20 @@ class PMREMGenerator {
|
|
|
224
294
|
|
|
225
295
|
// private interface
|
|
226
296
|
|
|
297
|
+
_setSizeFromTexture( texture ) {
|
|
298
|
+
|
|
299
|
+
if ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping ) {
|
|
300
|
+
|
|
301
|
+
this._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );
|
|
302
|
+
|
|
303
|
+
} else { // Equirectangular
|
|
304
|
+
|
|
305
|
+
this._setSize( texture.image.width / 4 );
|
|
306
|
+
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
|
|
227
311
|
_setSize( cubeSize ) {
|
|
228
312
|
|
|
229
313
|
this._lodMax = Math.floor( Math.log2( cubeSize ) );
|
|
@@ -255,15 +339,7 @@ class PMREMGenerator {
|
|
|
255
339
|
|
|
256
340
|
_fromTexture( texture, renderTarget ) {
|
|
257
341
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
this._setSize( texture.image.length === 0 ? 16 : ( texture.image[ 0 ].width || texture.image[ 0 ].image.width ) );
|
|
261
|
-
|
|
262
|
-
} else { // Equirectangular
|
|
263
|
-
|
|
264
|
-
this._setSize( texture.image.width / 4 );
|
|
265
|
-
|
|
266
|
-
}
|
|
342
|
+
this._setSizeFromTexture( texture );
|
|
267
343
|
|
|
268
344
|
_oldTarget = this._renderer.getRenderTarget();
|
|
269
345
|
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
|
|
@@ -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 );
|
|
@@ -63,9 +50,9 @@ class NodeLibrary {
|
|
|
63
50
|
|
|
64
51
|
}
|
|
65
52
|
|
|
66
|
-
addMaterial( materialNodeClass,
|
|
53
|
+
addMaterial( materialNodeClass, materialClassType ) {
|
|
67
54
|
|
|
68
|
-
this.addType( materialNodeClass,
|
|
55
|
+
this.addType( materialNodeClass, materialClassType, this.materialNodes );
|
|
69
56
|
|
|
70
57
|
}
|
|
71
58
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import StorageBuffer from '../StorageBuffer.js';
|
|
2
|
-
import {
|
|
2
|
+
import { NodeAccess } from '../../../nodes/core/constants.js';
|
|
3
3
|
|
|
4
4
|
let _id = 0;
|
|
5
5
|
|
|
@@ -10,10 +10,9 @@ class NodeStorageBuffer extends StorageBuffer {
|
|
|
10
10
|
super( 'StorageBuffer_' + _id ++, nodeUniform ? nodeUniform.value : null );
|
|
11
11
|
|
|
12
12
|
this.nodeUniform = nodeUniform;
|
|
13
|
-
this.access = nodeUniform ? nodeUniform.access :
|
|
13
|
+
this.access = nodeUniform ? nodeUniform.access : NodeAccess.READ_WRITE;
|
|
14
14
|
this.groupNode = groupNode;
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
get buffer() {
|
|
@@ -19,6 +19,12 @@ class NumberNodeUniform extends NumberUniform {
|
|
|
19
19
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
getType() {
|
|
23
|
+
|
|
24
|
+
return this.nodeUniform.type;
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
class Vector2NodeUniform extends Vector2Uniform {
|
|
@@ -37,6 +43,12 @@ class Vector2NodeUniform extends Vector2Uniform {
|
|
|
37
43
|
|
|
38
44
|
}
|
|
39
45
|
|
|
46
|
+
getType() {
|
|
47
|
+
|
|
48
|
+
return this.nodeUniform.type;
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
class Vector3NodeUniform extends Vector3Uniform {
|
|
@@ -55,6 +67,12 @@ class Vector3NodeUniform extends Vector3Uniform {
|
|
|
55
67
|
|
|
56
68
|
}
|
|
57
69
|
|
|
70
|
+
getType() {
|
|
71
|
+
|
|
72
|
+
return this.nodeUniform.type;
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
58
76
|
}
|
|
59
77
|
|
|
60
78
|
class Vector4NodeUniform extends Vector4Uniform {
|
|
@@ -73,6 +91,12 @@ class Vector4NodeUniform extends Vector4Uniform {
|
|
|
73
91
|
|
|
74
92
|
}
|
|
75
93
|
|
|
94
|
+
getType() {
|
|
95
|
+
|
|
96
|
+
return this.nodeUniform.type;
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
76
100
|
}
|
|
77
101
|
|
|
78
102
|
class ColorNodeUniform extends ColorUniform {
|
|
@@ -91,6 +115,12 @@ class ColorNodeUniform extends ColorUniform {
|
|
|
91
115
|
|
|
92
116
|
}
|
|
93
117
|
|
|
118
|
+
getType() {
|
|
119
|
+
|
|
120
|
+
return this.nodeUniform.type;
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
|
|
94
124
|
}
|
|
95
125
|
|
|
96
126
|
class Matrix3NodeUniform extends Matrix3Uniform {
|
|
@@ -109,6 +139,12 @@ class Matrix3NodeUniform extends Matrix3Uniform {
|
|
|
109
139
|
|
|
110
140
|
}
|
|
111
141
|
|
|
142
|
+
getType() {
|
|
143
|
+
|
|
144
|
+
return this.nodeUniform.type;
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
|
|
112
148
|
}
|
|
113
149
|
|
|
114
150
|
class Matrix4NodeUniform extends Matrix4Uniform {
|
|
@@ -127,6 +163,12 @@ class Matrix4NodeUniform extends Matrix4Uniform {
|
|
|
127
163
|
|
|
128
164
|
}
|
|
129
165
|
|
|
166
|
+
getType() {
|
|
167
|
+
|
|
168
|
+
return this.nodeUniform.type;
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
130
172
|
}
|
|
131
173
|
|
|
132
174
|
export {
|
|
@@ -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;
|
|
@@ -242,6 +242,24 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
242
242
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
function dispose() {
|
|
246
|
+
|
|
247
|
+
if ( boxMesh !== undefined ) {
|
|
248
|
+
|
|
249
|
+
boxMesh.geometry.dispose();
|
|
250
|
+
boxMesh.material.dispose();
|
|
251
|
+
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if ( planeMesh !== undefined ) {
|
|
255
|
+
|
|
256
|
+
planeMesh.geometry.dispose();
|
|
257
|
+
planeMesh.material.dispose();
|
|
258
|
+
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
}
|
|
262
|
+
|
|
245
263
|
return {
|
|
246
264
|
|
|
247
265
|
getClearColor: function () {
|
|
@@ -268,7 +286,8 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
268
286
|
|
|
269
287
|
},
|
|
270
288
|
render: render,
|
|
271
|
-
addToRenderList: addToRenderList
|
|
289
|
+
addToRenderList: addToRenderList,
|
|
290
|
+
dispose: dispose
|
|
272
291
|
|
|
273
292
|
};
|
|
274
293
|
|
|
@@ -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 );
|
|
@@ -22,18 +22,6 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
|
|
|
22
22
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
for ( const name in geometry.morphAttributes ) {
|
|
26
|
-
|
|
27
|
-
const array = geometry.morphAttributes[ name ];
|
|
28
|
-
|
|
29
|
-
for ( let i = 0, l = array.length; i < l; i ++ ) {
|
|
30
|
-
|
|
31
|
-
attributes.remove( array[ i ] );
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
25
|
geometry.removeEventListener( 'dispose', onGeometryDispose );
|
|
38
26
|
|
|
39
27
|
delete geometries[ geometry.id ];
|
|
@@ -87,22 +75,6 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
|
|
|
87
75
|
|
|
88
76
|
}
|
|
89
77
|
|
|
90
|
-
// morph targets
|
|
91
|
-
|
|
92
|
-
const morphAttributes = geometry.morphAttributes;
|
|
93
|
-
|
|
94
|
-
for ( const name in morphAttributes ) {
|
|
95
|
-
|
|
96
|
-
const array = morphAttributes[ name ];
|
|
97
|
-
|
|
98
|
-
for ( let i = 0, l = array.length; i < l; i ++ ) {
|
|
99
|
-
|
|
100
|
-
attributes.update( array[ i ], gl.ARRAY_BUFFER );
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
78
|
}
|
|
107
79
|
|
|
108
80
|
function updateWireframeAttribute( geometry ) {
|