@plastic-software/three 0.183.4 → 0.184.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 +773 -286
- package/build/three.core.js +372 -110
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +426 -180
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +7 -1
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +2979 -1281
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +2942 -1281
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +11 -0
- package/examples/jsm/animation/CCDIKSolver.js +5 -1
- package/examples/jsm/controls/ArcballControls.js +4 -1
- package/examples/jsm/controls/DragControls.js +2 -2
- package/examples/jsm/controls/FirstPersonControls.js +58 -54
- package/examples/jsm/controls/FlyControls.js +4 -0
- package/examples/jsm/controls/OrbitControls.js +2 -2
- package/examples/jsm/controls/TrackballControls.js +2 -2
- package/examples/jsm/controls/TransformControls.js +34 -2
- package/examples/jsm/csm/CSMShadowNode.js +6 -2
- package/examples/jsm/exporters/GLTFExporter.js +21 -5
- package/examples/jsm/geometries/TextGeometry.js +18 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +169 -114
- package/examples/jsm/inspector/RendererInspector.js +2 -2
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +34 -2
- package/examples/jsm/inspector/tabs/Performance.js +2 -2
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +105 -3
- package/examples/jsm/inspector/ui/Graph.js +2 -2
- package/examples/jsm/inspector/ui/List.js +1 -1
- package/examples/jsm/inspector/ui/Profiler.js +273 -176
- package/examples/jsm/inspector/ui/Style.js +64 -10
- package/examples/jsm/inspector/ui/Tab.js +39 -7
- package/examples/jsm/inspector/ui/Values.js +39 -2
- package/examples/jsm/inspector/ui/utils.js +13 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +8 -8
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lines/LineMaterial.js +1 -1
- package/examples/jsm/loaders/EXRLoader.js +682 -43
- package/examples/jsm/loaders/FBXLoader.js +233 -33
- package/examples/jsm/loaders/GLTFLoader.js +24 -7
- package/examples/jsm/loaders/HDRLoader.js +1 -1
- package/examples/jsm/loaders/KTX2Loader.js +8 -2
- package/examples/jsm/loaders/LDrawLoader.js +39 -47
- package/examples/jsm/loaders/SVGLoader.js +1 -1
- package/examples/jsm/loaders/VTKLoader.js +5 -1
- package/examples/jsm/loaders/collada/ColladaComposer.js +101 -7
- package/examples/jsm/loaders/collada/ColladaParser.js +19 -4
- package/examples/jsm/loaders/usd/USDAParser.js +6 -0
- package/examples/jsm/loaders/usd/USDCParser.js +26 -0
- package/examples/jsm/loaders/usd/USDComposer.js +656 -103
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/RollerCoaster.js +42 -4
- package/examples/jsm/modifiers/TessellateModifier.js +1 -1
- package/examples/jsm/objects/Reflector.js +73 -25
- package/examples/jsm/objects/Sky.js +14 -2
- package/examples/jsm/objects/SkyMesh.js +23 -6
- package/examples/jsm/renderers/Projector.js +18 -38
- package/examples/jsm/renderers/SVGRenderer.js +6 -25
- package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +10 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +11 -0
- package/examples/jsm/tsl/display/BilateralBlurNode.js +10 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +3 -36
- package/examples/jsm/tsl/display/FSR1Node.js +477 -0
- package/examples/jsm/tsl/display/GTAONode.js +2 -1
- package/examples/jsm/tsl/display/GaussianBlurNode.js +10 -0
- package/examples/jsm/tsl/display/GodraysNode.js +2 -11
- package/examples/jsm/tsl/display/OutlineNode.js +66 -16
- package/examples/jsm/tsl/display/SSGINode.js +0 -4
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +48 -7
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +13 -2
- package/examples/jsm/utils/BufferGeometryUtils.js +2 -3
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/SkeletonUtils.js +14 -8
- package/examples/jsm/webxr/XRHandMeshModel.js +36 -10
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -1
- package/package.json +4 -4
- package/src/Three.Core.js +1 -0
- package/src/Three.TSL.js +6 -0
- package/src/Three.WebGPU.Nodes.js +3 -0
- package/src/Three.WebGPU.js +6 -0
- package/src/animation/AnimationAction.js +11 -1
- package/src/audio/AudioContext.js +2 -2
- package/src/constants.js +1 -1
- package/src/core/BufferAttribute.js +13 -1
- package/src/core/Clock.js +1 -1
- package/src/core/Object3D.js +1 -5
- package/src/core/RenderTarget.js +1 -0
- package/src/extras/curves/CatmullRomCurve3.js +3 -2
- package/src/loaders/AudioLoader.js +11 -1
- package/src/loaders/DataTextureLoader.js +6 -4
- package/src/loaders/FileLoader.js +1 -2
- package/src/loaders/ImageBitmapLoader.js +4 -6
- package/src/loaders/MaterialLoader.js +1 -1
- package/src/loaders/ObjectLoader.js +25 -4
- package/src/loaders/nodes/NodeObjectLoader.js +18 -0
- package/src/materials/MeshToonMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +27 -0
- package/src/materials/nodes/NodeMaterial.js +0 -27
- package/src/materials/nodes/manager/NodeMaterialObserver.js +188 -89
- package/src/math/Line3.js +3 -0
- package/src/math/Matrix2.js +13 -9
- package/src/math/Matrix3.js +13 -9
- package/src/math/Matrix4.js +13 -9
- package/src/math/Plane.js +4 -3
- package/src/math/Triangle.js +1 -1
- package/src/math/Vector2.js +11 -7
- package/src/math/Vector3.js +12 -8
- package/src/math/Vector4.js +13 -9
- package/src/nodes/Nodes.js +0 -1
- package/src/nodes/TSL.js +1 -1
- package/src/nodes/accessors/BufferAttributeNode.js +9 -3
- package/src/nodes/accessors/CubeTextureNode.js +7 -1
- package/src/nodes/accessors/MaterialProperties.js +2 -5
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/ReferenceBaseNode.js +2 -2
- package/src/nodes/accessors/ReferenceNode.js +4 -4
- package/src/nodes/accessors/SceneProperties.js +2 -8
- package/src/nodes/accessors/StorageBufferNode.js +10 -4
- package/src/nodes/accessors/StorageTextureNode.js +4 -9
- package/src/nodes/accessors/TextureNode.js +10 -2
- package/src/nodes/accessors/UniformArrayNode.js +2 -2
- package/src/nodes/code/FunctionCallNode.js +1 -1
- package/src/nodes/code/FunctionNode.js +1 -1
- package/src/nodes/core/ArrayNode.js +1 -1
- package/src/nodes/core/AssignNode.js +1 -1
- package/src/nodes/core/AttributeNode.js +1 -1
- package/src/nodes/core/BypassNode.js +1 -1
- package/src/nodes/core/ContextNode.js +1 -1
- package/src/nodes/core/IndexNode.js +2 -1
- package/src/nodes/core/InputNode.js +1 -1
- package/src/nodes/core/InspectorNode.js +1 -1
- package/src/nodes/core/IsolateNode.js +1 -1
- package/src/nodes/core/Node.js +83 -12
- package/src/nodes/core/NodeBuilder.js +117 -16
- package/src/nodes/core/NodeUtils.js +1 -1
- package/src/nodes/core/OutputStructNode.js +1 -1
- package/src/nodes/core/ParameterNode.js +1 -1
- package/src/nodes/core/StackNode.js +1 -1
- package/src/nodes/core/StructNode.js +1 -1
- package/src/nodes/core/StructTypeNode.js +1 -1
- package/src/nodes/core/SubBuildNode.js +1 -1
- package/src/nodes/core/UniformGroupNode.js +36 -6
- package/src/nodes/core/VarNode.js +1 -1
- package/src/nodes/core/VaryingNode.js +1 -1
- package/src/nodes/display/NormalMapNode.js +2 -2
- package/src/nodes/display/PassNode.js +27 -7
- package/src/nodes/display/RenderOutputNode.js +4 -4
- package/src/nodes/display/ScreenNode.js +1 -1
- package/src/nodes/display/ViewportDepthTextureNode.js +11 -15
- package/src/nodes/display/ViewportTextureNode.js +18 -7
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/geometry/RangeNode.js +1 -1
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/BarrierNode.js +9 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +69 -44
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +1 -1
- package/src/nodes/lighting/LightsNode.js +6 -27
- package/src/nodes/lighting/ShadowNode.js +24 -2
- package/src/nodes/math/BitcastNode.js +1 -1
- package/src/nodes/math/ConditionalNode.js +1 -1
- package/src/nodes/math/MathNode.js +73 -1
- package/src/nodes/math/OperatorNode.js +1 -1
- package/src/nodes/math/PackFloatNode.js +1 -1
- package/src/nodes/math/UnpackFloatNode.js +1 -1
- package/src/nodes/tsl/TSLBase.js +1 -1
- package/src/nodes/tsl/TSLCore.js +21 -3
- package/src/nodes/utils/ArrayElementNode.js +1 -1
- package/src/nodes/utils/ConvertNode.js +1 -1
- package/src/nodes/utils/DebugNode.js +1 -1
- package/src/nodes/utils/EventNode.js +30 -0
- package/src/nodes/utils/FlipNode.js +1 -1
- package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
- package/src/nodes/utils/JoinNode.js +1 -1
- package/src/nodes/utils/MemberNode.js +1 -1
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +1 -1
- package/src/nodes/utils/SetNode.js +1 -1
- package/src/nodes/utils/SplitNode.js +1 -1
- package/src/objects/BatchedMesh.js +17 -2
- package/src/objects/InstancedMesh.js +19 -3
- package/src/objects/SkinnedMesh.js +26 -9
- package/src/renderers/WebGLRenderer.js +147 -48
- package/src/renderers/common/Animation.js +3 -3
- package/src/renderers/common/Attributes.js +15 -1
- package/src/renderers/common/Backend.js +0 -8
- package/src/renderers/common/Background.js +2 -2
- package/src/renderers/common/BindGroup.js +1 -8
- package/src/renderers/common/Bindings.js +2 -2
- package/src/renderers/common/ComputePipeline.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/Info.js +333 -4
- package/src/renderers/common/InspectorBase.js +6 -1
- package/src/renderers/common/Pipelines.js +36 -3
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +3 -1
- package/src/renderers/common/RenderBundles.js +5 -2
- package/src/renderers/common/RenderObject.js +2 -2
- package/src/renderers/common/RenderObjects.js +3 -3
- package/src/renderers/common/RenderPipeline.js +35 -6
- package/src/renderers/common/Renderer.js +232 -53
- package/src/renderers/common/Textures.js +72 -3
- package/src/renderers/common/UniformsGroup.js +1 -1
- package/src/renderers/common/XRManager.js +34 -27
- package/src/renderers/common/extras/PMREMGenerator.js +23 -15
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/NodeManager.js +230 -99
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +2 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +1 -3
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +12 -2
- package/src/renderers/shaders/ShaderChunk.js +2 -0
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib.js +0 -1
- package/src/renderers/shaders/UniformsLib.js +7 -2
- package/src/renderers/shaders/UniformsUtils.js +27 -5
- package/src/renderers/webgl/WebGLAnimation.js +2 -1
- package/src/renderers/webgl/WebGLBackground.js +13 -13
- package/src/renderers/webgl/WebGLBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLCapabilities.js +6 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLMaterials.js +12 -13
- package/src/renderers/webgl/WebGLOutput.js +4 -1
- package/src/renderers/webgl/WebGLProgram.js +4 -0
- package/src/renderers/webgl/WebGLPrograms.js +19 -3
- package/src/renderers/webgl/WebGLRenderStates.js +13 -2
- package/src/renderers/webgl/WebGLState.js +43 -0
- package/src/renderers/webgl/WebGLTextures.js +129 -26
- package/src/renderers/webgl/WebGLUniformsGroups.js +19 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +106 -65
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +0 -41
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +29 -51
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +53 -19
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +25 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +42 -1
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +63 -50
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +1 -1
- package/src/renderers/webgpu/WebGPUBackend.js +160 -146
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +55 -33
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +103 -17
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +8 -0
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +91 -17
- package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -2
- package/src/renderers/webxr/WebXRController.js +12 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +1 -1
- package/src/textures/Texture.js +13 -2
- package/src/utils.js +23 -1
- package/src/nodes/utils/RemapNode.js +0 -125
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { error } from '../../utils.js';
|
|
2
|
+
import {
|
|
3
|
+
ByteType, UnsignedByteType, ShortType, UnsignedShortType, HalfFloatType,
|
|
4
|
+
IntType, UnsignedIntType, FloatType,
|
|
5
|
+
AlphaFormat, RedFormat, RedIntegerFormat, DepthFormat, DepthStencilFormat,
|
|
6
|
+
RGFormat, RGIntegerFormat, RGBFormat, RGBIntegerFormat,
|
|
7
|
+
UnsignedShort4444Type, UnsignedShort5551Type,
|
|
8
|
+
UnsignedInt248Type, UnsignedInt5999Type, UnsignedInt101111Type
|
|
9
|
+
} from '../../constants.js';
|
|
2
10
|
|
|
3
11
|
/**
|
|
4
12
|
* This renderer module provides a series of statistical information
|
|
@@ -87,13 +95,51 @@ class Info {
|
|
|
87
95
|
* @type {Object}
|
|
88
96
|
* @readonly
|
|
89
97
|
* @property {number} geometries - The number of active geometries.
|
|
90
|
-
* @property {number}
|
|
98
|
+
* @property {number} textures - The number of active textures.
|
|
99
|
+
* @property {number} attributes - The number of active attributes.
|
|
100
|
+
* @property {number} indexAttributes - The number of active index attributes.
|
|
101
|
+
* @property {number} storageAttributes - The number of active storage attributes.
|
|
102
|
+
* @property {number} indirectStorageAttributes - The number of active indirect storage attributes.
|
|
103
|
+
* @property {number} readbackBuffers - The number of active readback buffers.
|
|
104
|
+
* @property {number} programs - The number of active programs.
|
|
105
|
+
* @property {number} renderTargets - The number of active renderTargets.
|
|
106
|
+
* @property {number} total - The total memory size in bytes.
|
|
107
|
+
* @property {number} texturesSize - The memory size of active textures in bytes.
|
|
108
|
+
* @property {number} attributesSize - The memory size of active attributes in bytes.
|
|
109
|
+
* @property {number} indexAttributesSize - The memory size of active index attributes in bytes.
|
|
110
|
+
* @property {number} storageAttributesSize - The memory size of active storage attributes in bytes.
|
|
111
|
+
* @property {number} indirectStorageAttributesSize - The memory size of active indirect storage attributes in bytes.
|
|
112
|
+
* @property {number} readbackBuffersSize - The memory size of active readback buffers in bytes.
|
|
113
|
+
* @property {number} programsSize - The memory size of active programs in bytes.
|
|
91
114
|
*/
|
|
92
115
|
this.memory = {
|
|
93
116
|
geometries: 0,
|
|
94
|
-
textures: 0
|
|
117
|
+
textures: 0,
|
|
118
|
+
attributes: 0,
|
|
119
|
+
indexAttributes: 0,
|
|
120
|
+
storageAttributes: 0,
|
|
121
|
+
indirectStorageAttributes: 0,
|
|
122
|
+
readbackBuffers: 0,
|
|
123
|
+
programs: 0,
|
|
124
|
+
renderTargets: 0,
|
|
125
|
+
total: 0,
|
|
126
|
+
texturesSize: 0,
|
|
127
|
+
attributesSize: 0,
|
|
128
|
+
indexAttributesSize: 0,
|
|
129
|
+
storageAttributesSize: 0,
|
|
130
|
+
indirectStorageAttributesSize: 0,
|
|
131
|
+
readbackBuffersSize: 0,
|
|
132
|
+
programsSize: 0
|
|
95
133
|
};
|
|
96
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Map for storing calculated byte sizes of tracked objects.
|
|
137
|
+
*
|
|
138
|
+
* @type {Map<Object, number>}
|
|
139
|
+
* @private
|
|
140
|
+
*/
|
|
141
|
+
this.memoryMap = new Map();
|
|
142
|
+
|
|
97
143
|
}
|
|
98
144
|
|
|
99
145
|
/**
|
|
@@ -161,8 +207,291 @@ class Info {
|
|
|
161
207
|
|
|
162
208
|
this.render.timestamp = 0;
|
|
163
209
|
this.compute.timestamp = 0;
|
|
164
|
-
|
|
165
|
-
this.memory
|
|
210
|
+
|
|
211
|
+
for ( const prop in this.memory ) {
|
|
212
|
+
|
|
213
|
+
this.memory[ prop ] = 0;
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
this.memoryMap.clear();
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Tracks texture memory explicitly, updating counts and byte tracking.
|
|
223
|
+
*
|
|
224
|
+
* @param {Texture} texture
|
|
225
|
+
*/
|
|
226
|
+
createTexture( texture ) {
|
|
227
|
+
|
|
228
|
+
const size = this._getTextureMemorySize( texture );
|
|
229
|
+
this.memoryMap.set( texture, size );
|
|
230
|
+
|
|
231
|
+
this.memory.textures ++;
|
|
232
|
+
this.memory.total += size;
|
|
233
|
+
this.memory.texturesSize += size;
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Tracks texture memory explicitly, updating counts and byte tracking.
|
|
239
|
+
*
|
|
240
|
+
* @param {Texture} texture
|
|
241
|
+
*/
|
|
242
|
+
destroyTexture( texture ) {
|
|
243
|
+
|
|
244
|
+
const size = this.memoryMap.get( texture ) || 0;
|
|
245
|
+
this.memoryMap.delete( texture );
|
|
246
|
+
|
|
247
|
+
this.memory.textures --;
|
|
248
|
+
this.memory.total -= size;
|
|
249
|
+
this.memory.texturesSize -= size;
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Tracks attribute memory explicitly, updating counts and byte tracking.
|
|
255
|
+
*
|
|
256
|
+
* @param {BufferAttribute} attribute
|
|
257
|
+
* @param {string} type - type of attribute
|
|
258
|
+
* @private
|
|
259
|
+
*/
|
|
260
|
+
_createAttribute( attribute, type ) {
|
|
261
|
+
|
|
262
|
+
const size = this._getAttributeMemorySize( attribute );
|
|
263
|
+
this.memoryMap.set( attribute, { size, type } );
|
|
264
|
+
|
|
265
|
+
this.memory[ type ] ++;
|
|
266
|
+
this.memory.total += size;
|
|
267
|
+
this.memory[ type + 'Size' ] += size;
|
|
268
|
+
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Tracks a regular attribute memory explicitly.
|
|
273
|
+
*
|
|
274
|
+
* @param {BufferAttribute} attribute - The attribute to track.
|
|
275
|
+
*/
|
|
276
|
+
createAttribute( attribute ) {
|
|
277
|
+
|
|
278
|
+
this._createAttribute( attribute, 'attributes' );
|
|
279
|
+
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Tracks an index attribute memory explicitly.
|
|
284
|
+
*
|
|
285
|
+
* @param {BufferAttribute} attribute - The index attribute to track.
|
|
286
|
+
*/
|
|
287
|
+
createIndexAttribute( attribute ) {
|
|
288
|
+
|
|
289
|
+
this._createAttribute( attribute, 'indexAttributes' );
|
|
290
|
+
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Tracks a storage attribute memory explicitly.
|
|
295
|
+
*
|
|
296
|
+
* @param {BufferAttribute} attribute - The storage attribute to track.
|
|
297
|
+
*/
|
|
298
|
+
createStorageAttribute( attribute ) {
|
|
299
|
+
|
|
300
|
+
this._createAttribute( attribute, 'storageAttributes' );
|
|
301
|
+
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Tracks an indirect storage attribute memory explicitly.
|
|
306
|
+
*
|
|
307
|
+
* @param {BufferAttribute} attribute - The indirect storage attribute to track.
|
|
308
|
+
*/
|
|
309
|
+
createIndirectStorageAttribute( attribute ) {
|
|
310
|
+
|
|
311
|
+
this._createAttribute( attribute, 'indirectStorageAttributes' );
|
|
312
|
+
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Tracks attribute memory explicitly, updating counts and byte tracking.
|
|
317
|
+
*
|
|
318
|
+
* @param {BufferAttribute} attribute
|
|
319
|
+
*/
|
|
320
|
+
destroyAttribute( attribute ) {
|
|
321
|
+
|
|
322
|
+
const data = this.memoryMap.get( attribute );
|
|
323
|
+
|
|
324
|
+
if ( data ) {
|
|
325
|
+
|
|
326
|
+
this.memoryMap.delete( attribute );
|
|
327
|
+
|
|
328
|
+
this.memory[ data.type ] --;
|
|
329
|
+
this.memory.total -= data.size;
|
|
330
|
+
this.memory[ data.type + 'Size' ] -= data.size;
|
|
331
|
+
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Tracks a readback buffer memory explicitly.
|
|
338
|
+
*
|
|
339
|
+
* @param {ReadbackBuffer} readbackBuffer - The readback buffer to track.
|
|
340
|
+
*/
|
|
341
|
+
createReadbackBuffer( readbackBuffer ) {
|
|
342
|
+
|
|
343
|
+
const maxByteLength = readbackBuffer.maxByteLength;
|
|
344
|
+
this.memoryMap.set( readbackBuffer, { size: maxByteLength, type: 'readbackBuffers' } );
|
|
345
|
+
|
|
346
|
+
this.memory.readbackBuffers ++;
|
|
347
|
+
this.memory.total += maxByteLength;
|
|
348
|
+
this.memory.readbackBuffersSize += maxByteLength;
|
|
349
|
+
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Tracks a readback buffer memory explicitly.
|
|
354
|
+
*
|
|
355
|
+
* @param {ReadbackBuffer} readbackBuffer - The readback buffer to track.
|
|
356
|
+
*/
|
|
357
|
+
destroyReadbackBuffer( readbackBuffer ) {
|
|
358
|
+
|
|
359
|
+
const { size } = this.memoryMap.get( readbackBuffer );
|
|
360
|
+
this.memoryMap.delete( readbackBuffer );
|
|
361
|
+
|
|
362
|
+
this.memory.readbackBuffers --;
|
|
363
|
+
this.memory.total -= size;
|
|
364
|
+
this.memory.readbackBuffersSize -= size;
|
|
365
|
+
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Tracks program memory explicitly, updating counts and byte tracking.
|
|
370
|
+
*
|
|
371
|
+
* @param {ProgrammableStage} program - The program to track.
|
|
372
|
+
*/
|
|
373
|
+
createProgram( program ) {
|
|
374
|
+
|
|
375
|
+
const size = program.code.length; // Approx size
|
|
376
|
+
|
|
377
|
+
this.memoryMap.set( program, size );
|
|
378
|
+
|
|
379
|
+
this.memory.programs ++;
|
|
380
|
+
this.memory.total += size;
|
|
381
|
+
this.memory.programsSize += size;
|
|
382
|
+
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Tracks program memory explicitly, updating counts and byte tracking.
|
|
387
|
+
*
|
|
388
|
+
* @param {Object} program - The program to track.
|
|
389
|
+
*/
|
|
390
|
+
destroyProgram( program ) {
|
|
391
|
+
|
|
392
|
+
const size = this.memoryMap.get( program ) || 0;
|
|
393
|
+
this.memoryMap.delete( program );
|
|
394
|
+
|
|
395
|
+
this.memory.programs --;
|
|
396
|
+
this.memory.total -= size;
|
|
397
|
+
this.memory.programsSize -= size;
|
|
398
|
+
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Calculates the memory size of a texture in bytes.
|
|
403
|
+
*
|
|
404
|
+
* @param {Texture} texture - The texture to calculate the size for.
|
|
405
|
+
* @return {number} The calculated size in bytes.
|
|
406
|
+
* @private
|
|
407
|
+
*/
|
|
408
|
+
_getTextureMemorySize( texture ) {
|
|
409
|
+
|
|
410
|
+
if ( texture.isCompressedTexture ) {
|
|
411
|
+
|
|
412
|
+
return 1; // Fallback estimate since exact format decompressed isn't readily available without format maps
|
|
413
|
+
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
let bytesPerChannel = 1;
|
|
417
|
+
|
|
418
|
+
if ( texture.type === ByteType || texture.type === UnsignedByteType ) bytesPerChannel = 1;
|
|
419
|
+
else if ( texture.type === ShortType || texture.type === UnsignedShortType || texture.type === HalfFloatType ) bytesPerChannel = 2;
|
|
420
|
+
else if ( texture.type === IntType || texture.type === UnsignedIntType || texture.type === FloatType ) bytesPerChannel = 4;
|
|
421
|
+
|
|
422
|
+
let channels = 4; // RGBA default
|
|
423
|
+
|
|
424
|
+
if ( texture.format === AlphaFormat || texture.format === RedFormat || texture.format === RedIntegerFormat || texture.format === DepthFormat || texture.format === DepthStencilFormat ) channels = 1;
|
|
425
|
+
else if ( texture.format === RGFormat || texture.format === RGIntegerFormat ) channels = 2;
|
|
426
|
+
else if ( texture.format === RGBFormat || texture.format === RGBIntegerFormat ) channels = 3;
|
|
427
|
+
|
|
428
|
+
let bytesPerPixel = bytesPerChannel * channels;
|
|
429
|
+
|
|
430
|
+
// Packed overrides
|
|
431
|
+
if ( texture.type === UnsignedShort4444Type || texture.type === UnsignedShort5551Type ) bytesPerPixel = 2;
|
|
432
|
+
else if ( texture.type === UnsignedInt248Type || texture.type === UnsignedInt5999Type || texture.type === UnsignedInt101111Type ) bytesPerPixel = 4;
|
|
433
|
+
|
|
434
|
+
const width = texture.width || 1;
|
|
435
|
+
const height = texture.height || 1;
|
|
436
|
+
const depth = texture.isCubeTexture ? 6 : ( texture.depth || 1 );
|
|
437
|
+
|
|
438
|
+
let size = width * height * depth * bytesPerPixel;
|
|
439
|
+
const mipmaps = texture.mipmaps;
|
|
440
|
+
|
|
441
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
442
|
+
|
|
443
|
+
let mipmapSize = 0;
|
|
444
|
+
for ( let i = 0; i < mipmaps.length; i ++ ) {
|
|
445
|
+
|
|
446
|
+
const mipmap = mipmaps[ i ];
|
|
447
|
+
if ( mipmap.data ) {
|
|
448
|
+
|
|
449
|
+
mipmapSize += mipmap.data.byteLength;
|
|
450
|
+
|
|
451
|
+
} else {
|
|
452
|
+
|
|
453
|
+
const mipWidth = mipmap.width || Math.max( 1, width >> i );
|
|
454
|
+
const mipHeight = mipmap.height || Math.max( 1, height >> i );
|
|
455
|
+
mipmapSize += mipWidth * mipHeight * depth * bytesPerPixel;
|
|
456
|
+
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
size += mipmapSize;
|
|
462
|
+
|
|
463
|
+
} else if ( texture.generateMipmaps ) {
|
|
464
|
+
|
|
465
|
+
size = size * 1.333; // MiP chain approximation
|
|
466
|
+
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return Math.round( size );
|
|
470
|
+
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Calculates the memory size of an attribute in bytes.
|
|
475
|
+
*
|
|
476
|
+
* @param {BufferAttribute} attribute - The attribute to calculate the size for.
|
|
477
|
+
* @return {number} The calculated size in bytes.
|
|
478
|
+
* @private
|
|
479
|
+
*/
|
|
480
|
+
_getAttributeMemorySize( attribute ) {
|
|
481
|
+
|
|
482
|
+
if ( attribute.isInterleavedBufferAttribute ) attribute = attribute.data;
|
|
483
|
+
|
|
484
|
+
if ( attribute.array ) {
|
|
485
|
+
|
|
486
|
+
return attribute.array.byteLength;
|
|
487
|
+
|
|
488
|
+
} else if ( attribute.count && attribute.itemSize ) {
|
|
489
|
+
|
|
490
|
+
return attribute.count * attribute.itemSize * 4; // Assume Float32
|
|
491
|
+
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
return 0;
|
|
166
495
|
|
|
167
496
|
}
|
|
168
497
|
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
import { EventDispatcher } from '../../core/EventDispatcher.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* InspectorBase is the base class for all inspectors.
|
|
3
5
|
*
|
|
4
6
|
* @class InspectorBase
|
|
7
|
+
* @augments EventDispatcher
|
|
5
8
|
*/
|
|
6
|
-
class InspectorBase {
|
|
9
|
+
class InspectorBase extends EventDispatcher {
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* Creates a new InspectorBase.
|
|
10
13
|
*/
|
|
11
14
|
constructor() {
|
|
12
15
|
|
|
16
|
+
super();
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* The renderer associated with this inspector.
|
|
15
20
|
*
|
|
@@ -15,9 +15,10 @@ class Pipelines extends DataMap {
|
|
|
15
15
|
* Constructs a new pipeline management component.
|
|
16
16
|
*
|
|
17
17
|
* @param {Backend} backend - The renderer's backend.
|
|
18
|
-
* @param {
|
|
18
|
+
* @param {NodeManager} nodes - Renderer component for managing nodes related logic.
|
|
19
|
+
* @param {Info} info - Renderer component for managing metrics and monitoring data.
|
|
19
20
|
*/
|
|
20
|
-
constructor( backend, nodes ) {
|
|
21
|
+
constructor( backend, nodes, info ) {
|
|
21
22
|
|
|
22
23
|
super();
|
|
23
24
|
|
|
@@ -31,10 +32,17 @@ class Pipelines extends DataMap {
|
|
|
31
32
|
/**
|
|
32
33
|
* Renderer component for managing nodes related logic.
|
|
33
34
|
*
|
|
34
|
-
* @type {
|
|
35
|
+
* @type {NodeManager}
|
|
35
36
|
*/
|
|
36
37
|
this.nodes = nodes;
|
|
37
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Renderer component for managing metrics and monitoring data.
|
|
41
|
+
*
|
|
42
|
+
* @type {Info}
|
|
43
|
+
*/
|
|
44
|
+
this.info = info;
|
|
45
|
+
|
|
38
46
|
/**
|
|
39
47
|
* A references to the bindings management component.
|
|
40
48
|
* This reference will be set inside the `Bindings`
|
|
@@ -108,6 +116,7 @@ class Pipelines extends DataMap {
|
|
|
108
116
|
this.programs.compute.set( nodeBuilderState.computeShader, stageCompute );
|
|
109
117
|
|
|
110
118
|
backend.createProgram( stageCompute );
|
|
119
|
+
this.info.createProgram( stageCompute );
|
|
111
120
|
|
|
112
121
|
}
|
|
113
122
|
|
|
@@ -184,6 +193,7 @@ class Pipelines extends DataMap {
|
|
|
184
193
|
this.programs.vertex.set( nodeBuilderState.vertexShader, stageVertex );
|
|
185
194
|
|
|
186
195
|
backend.createProgram( stageVertex );
|
|
196
|
+
this.info.createProgram( stageVertex );
|
|
187
197
|
|
|
188
198
|
}
|
|
189
199
|
|
|
@@ -197,6 +207,7 @@ class Pipelines extends DataMap {
|
|
|
197
207
|
this.programs.fragment.set( nodeBuilderState.fragmentShader, stageFragment );
|
|
198
208
|
|
|
199
209
|
backend.createProgram( stageFragment );
|
|
210
|
+
this.info.createProgram( stageFragment );
|
|
200
211
|
|
|
201
212
|
}
|
|
202
213
|
|
|
@@ -234,6 +245,26 @@ class Pipelines extends DataMap {
|
|
|
234
245
|
|
|
235
246
|
}
|
|
236
247
|
|
|
248
|
+
/**
|
|
249
|
+
* Checks if the render pipeline for the given render object is ready for drawing.
|
|
250
|
+
* Returns false if the GPU pipeline is still being compiled asynchronously.
|
|
251
|
+
*
|
|
252
|
+
* @param {RenderObject} renderObject - The render object.
|
|
253
|
+
* @return {boolean} True if the pipeline is ready for drawing.
|
|
254
|
+
*/
|
|
255
|
+
isReady( renderObject ) {
|
|
256
|
+
|
|
257
|
+
const data = this.get( renderObject );
|
|
258
|
+
const pipeline = data.pipeline;
|
|
259
|
+
|
|
260
|
+
if ( pipeline === undefined ) return false;
|
|
261
|
+
|
|
262
|
+
const pipelineData = this.backend.get( pipeline );
|
|
263
|
+
|
|
264
|
+
return pipelineData.pipeline !== undefined && pipelineData.pipeline !== null;
|
|
265
|
+
|
|
266
|
+
}
|
|
267
|
+
|
|
237
268
|
/**
|
|
238
269
|
* Deletes the pipeline for the given render object.
|
|
239
270
|
*
|
|
@@ -428,6 +459,8 @@ class Pipelines extends DataMap {
|
|
|
428
459
|
|
|
429
460
|
this.programs[ stage ].delete( code );
|
|
430
461
|
|
|
462
|
+
this.info.destroyProgram( program );
|
|
463
|
+
|
|
431
464
|
}
|
|
432
465
|
|
|
433
466
|
/**
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { EventDispatcher } from '../../core/EventDispatcher.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A readback buffer is used to transfer data from the GPU to the CPU.
|
|
5
|
+
* It is primarily used to read back compute shader results.
|
|
6
|
+
*
|
|
7
|
+
* @augments EventDispatcher
|
|
8
|
+
*/
|
|
9
|
+
class ReadbackBuffer extends EventDispatcher {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new readback buffer.
|
|
13
|
+
*
|
|
14
|
+
* @param {number} maxByteLength - The maximum size of the buffer to be read back.
|
|
15
|
+
*/
|
|
16
|
+
constructor( maxByteLength ) {
|
|
17
|
+
|
|
18
|
+
super();
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Name used for debugging purposes.
|
|
22
|
+
*
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
25
|
+
this.name = '';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The mapped, read back array buffer.
|
|
29
|
+
*
|
|
30
|
+
* @type {ArrayBuffer|null}
|
|
31
|
+
*/
|
|
32
|
+
this.buffer = null;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The maximum size of the buffer to be read back.
|
|
36
|
+
*
|
|
37
|
+
* @type {number}
|
|
38
|
+
*/
|
|
39
|
+
this.maxByteLength = maxByteLength;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* This flag can be used for type testing.
|
|
43
|
+
*
|
|
44
|
+
* @type {boolean}
|
|
45
|
+
* @readonly
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
this.isReadbackBuffer = true;
|
|
49
|
+
|
|
50
|
+
this._mapped = false;
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Releases the mapped buffer data so the GPU buffer can be
|
|
56
|
+
* used by the GPU again.
|
|
57
|
+
*
|
|
58
|
+
* Note: Any `ArrayBuffer` data associated with this readback buffer
|
|
59
|
+
* are removed and no longer accessible after calling this method.
|
|
60
|
+
*/
|
|
61
|
+
release() {
|
|
62
|
+
|
|
63
|
+
this.dispatchEvent( { type: 'release' } );
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Frees internal resources.
|
|
69
|
+
*/
|
|
70
|
+
dispose() {
|
|
71
|
+
|
|
72
|
+
this.dispatchEvent( { type: 'dispose' } );
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default ReadbackBuffer;
|
|
@@ -11,11 +11,13 @@ class RenderBundle {
|
|
|
11
11
|
*
|
|
12
12
|
* @param {BundleGroup} bundleGroup - The bundle group.
|
|
13
13
|
* @param {Camera} camera - The camera the bundle group is rendered with.
|
|
14
|
+
* @param {RenderContext} renderContext - The render context the bundle is rendered with.
|
|
14
15
|
*/
|
|
15
|
-
constructor( bundleGroup, camera ) {
|
|
16
|
+
constructor( bundleGroup, camera, renderContext ) {
|
|
16
17
|
|
|
17
18
|
this.bundleGroup = bundleGroup;
|
|
18
19
|
this.camera = camera;
|
|
20
|
+
this.renderContext = renderContext;
|
|
19
21
|
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -29,26 +29,29 @@ class RenderBundles {
|
|
|
29
29
|
*
|
|
30
30
|
* @param {BundleGroup} bundleGroup - The bundle group.
|
|
31
31
|
* @param {Camera} camera - The camera the bundle group is rendered with.
|
|
32
|
+
* @param {RenderContext} renderContext - The render context the bundle is rendered with.
|
|
32
33
|
* @return {RenderBundle} The render bundle.
|
|
33
34
|
*/
|
|
34
|
-
get( bundleGroup, camera ) {
|
|
35
|
+
get( bundleGroup, camera, renderContext ) {
|
|
35
36
|
|
|
36
37
|
const bundles = this.bundles;
|
|
37
38
|
|
|
38
39
|
_chainKeys[ 0 ] = bundleGroup;
|
|
39
40
|
_chainKeys[ 1 ] = camera;
|
|
41
|
+
_chainKeys[ 2 ] = renderContext;
|
|
40
42
|
|
|
41
43
|
let bundle = bundles.get( _chainKeys );
|
|
42
44
|
|
|
43
45
|
if ( bundle === undefined ) {
|
|
44
46
|
|
|
45
|
-
bundle = new RenderBundle( bundleGroup, camera );
|
|
47
|
+
bundle = new RenderBundle( bundleGroup, camera, renderContext );
|
|
46
48
|
bundles.set( _chainKeys, bundle );
|
|
47
49
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
_chainKeys[ 0 ] = null;
|
|
51
53
|
_chainKeys[ 1 ] = null;
|
|
54
|
+
_chainKeys[ 2 ] = null;
|
|
52
55
|
|
|
53
56
|
return bundle;
|
|
54
57
|
|
|
@@ -59,7 +59,7 @@ class RenderObject {
|
|
|
59
59
|
/**
|
|
60
60
|
* Constructs a new render object.
|
|
61
61
|
*
|
|
62
|
-
* @param {
|
|
62
|
+
* @param {NodeManager} nodes - Renderer component for managing nodes related logic.
|
|
63
63
|
* @param {Geometries} geometries - Renderer component for managing geometries.
|
|
64
64
|
* @param {Renderer} renderer - The renderer.
|
|
65
65
|
* @param {Object3D} object - The 3D object.
|
|
@@ -77,7 +77,7 @@ class RenderObject {
|
|
|
77
77
|
/**
|
|
78
78
|
* Renderer component for managing nodes related logic.
|
|
79
79
|
*
|
|
80
|
-
* @type {
|
|
80
|
+
* @type {NodeManager}
|
|
81
81
|
* @private
|
|
82
82
|
*/
|
|
83
83
|
this._nodes = nodes;
|
|
@@ -14,7 +14,7 @@ class RenderObjects {
|
|
|
14
14
|
* Constructs a new render object management component.
|
|
15
15
|
*
|
|
16
16
|
* @param {Renderer} renderer - The renderer.
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {NodeManager} nodes - Renderer component for managing nodes related logic.
|
|
18
18
|
* @param {Geometries} geometries - Renderer component for managing geometries.
|
|
19
19
|
* @param {Pipelines} pipelines - Renderer component for managing pipelines.
|
|
20
20
|
* @param {Bindings} bindings - Renderer component for managing bindings.
|
|
@@ -32,7 +32,7 @@ class RenderObjects {
|
|
|
32
32
|
/**
|
|
33
33
|
* Renderer component for managing nodes related logic.
|
|
34
34
|
*
|
|
35
|
-
* @type {
|
|
35
|
+
* @type {NodeManager}
|
|
36
36
|
*/
|
|
37
37
|
this.nodes = nodes;
|
|
38
38
|
|
|
@@ -179,7 +179,7 @@ class RenderObjects {
|
|
|
179
179
|
/**
|
|
180
180
|
* Factory method for creating render objects with the given list of parameters.
|
|
181
181
|
*
|
|
182
|
-
* @param {
|
|
182
|
+
* @param {NodeManager} nodes - Renderer component for managing nodes related logic.
|
|
183
183
|
* @param {Geometries} geometries - Renderer component for managing geometries.
|
|
184
184
|
* @param {Renderer} renderer - The renderer.
|
|
185
185
|
* @param {Object3D} object - The 3D object.
|
|
@@ -49,8 +49,8 @@ class RenderPipeline {
|
|
|
49
49
|
* Whether the default output tone mapping and color
|
|
50
50
|
* space transformation should be enabled or not.
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
* effects
|
|
52
|
+
* This is enabled by default but it must be disabled for
|
|
53
|
+
* effects that expect to be executed after tone mapping and color
|
|
54
54
|
* space conversion. A typical example is FXAA which
|
|
55
55
|
* requires sRGB input.
|
|
56
56
|
*
|
|
@@ -94,6 +94,23 @@ class RenderPipeline {
|
|
|
94
94
|
*/
|
|
95
95
|
this._context = null;
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* The current tone mapping.
|
|
99
|
+
*
|
|
100
|
+
* @private
|
|
101
|
+
* @type {ToneMapping}
|
|
102
|
+
*/
|
|
103
|
+
this._toneMapping = renderer.toneMapping;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The current output color space.
|
|
107
|
+
*
|
|
108
|
+
* @private
|
|
109
|
+
* @type {ColorSpace}
|
|
110
|
+
*/
|
|
111
|
+
this._outputColorSpace = renderer.outputColorSpace;
|
|
112
|
+
|
|
113
|
+
|
|
97
114
|
}
|
|
98
115
|
|
|
99
116
|
/**
|
|
@@ -161,12 +178,24 @@ class RenderPipeline {
|
|
|
161
178
|
*/
|
|
162
179
|
_update() {
|
|
163
180
|
|
|
164
|
-
if ( this.
|
|
181
|
+
if ( this._toneMapping !== this.renderer.toneMapping ) {
|
|
182
|
+
|
|
183
|
+
this._toneMapping = this.renderer.toneMapping;
|
|
184
|
+
this.needsUpdate = true;
|
|
185
|
+
|
|
186
|
+
}
|
|
165
187
|
|
|
166
|
-
|
|
188
|
+
if ( this._outputColorSpace !== this.renderer.outputColorSpace ) {
|
|
189
|
+
|
|
190
|
+
this._outputColorSpace = this.renderer.outputColorSpace;
|
|
191
|
+
this.needsUpdate = true;
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if ( this.needsUpdate === true ) {
|
|
167
196
|
|
|
168
|
-
const toneMapping =
|
|
169
|
-
const outputColorSpace =
|
|
197
|
+
const toneMapping = this._toneMapping;
|
|
198
|
+
const outputColorSpace = this._outputColorSpace;
|
|
170
199
|
|
|
171
200
|
const context = {
|
|
172
201
|
renderPipeline: this,
|