@plastic-software/three 0.183.3 → 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 +783 -290
- package/build/three.core.js +372 -110
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +436 -184
- 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/PMREMGenerator.js +1 -1
- 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 +148 -49
- 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/batching_pars_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -1
- 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 +5 -0
- package/src/renderers/webgl/WebGLPrograms.js +24 -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
|
@@ -65,6 +65,22 @@ const refreshUniforms = [
|
|
|
65
65
|
*/
|
|
66
66
|
const _lightsCache = new WeakMap();
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Holds the material data for comparison.
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
* @type {WeakMap<Material,Object>}
|
|
73
|
+
*/
|
|
74
|
+
const _materialCache = new WeakMap();
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Holds the geometry data for comparison.
|
|
78
|
+
*
|
|
79
|
+
* @private
|
|
80
|
+
* @type {WeakMap<BufferGeometry,Object>}
|
|
81
|
+
*/
|
|
82
|
+
const _geometryCache = new WeakMap();
|
|
83
|
+
|
|
68
84
|
/**
|
|
69
85
|
* This class is used by {@link WebGPURenderer} as management component.
|
|
70
86
|
* It's primary purpose is to determine whether render objects require a
|
|
@@ -166,17 +182,10 @@ class NodeMaterialObserver {
|
|
|
166
182
|
|
|
167
183
|
if ( data === undefined ) {
|
|
168
184
|
|
|
169
|
-
const { geometry,
|
|
185
|
+
const { geometry, object } = renderObject;
|
|
170
186
|
|
|
171
187
|
data = {
|
|
172
|
-
|
|
173
|
-
geometry: {
|
|
174
|
-
id: geometry.id,
|
|
175
|
-
attributes: this.getAttributesData( geometry.attributes ),
|
|
176
|
-
indexId: geometry.index ? geometry.index.id : null,
|
|
177
|
-
indexVersion: geometry.index ? geometry.index.version : null,
|
|
178
|
-
drawRange: { start: geometry.drawRange.start, count: geometry.drawRange.count }
|
|
179
|
-
},
|
|
188
|
+
geometryId: geometry.id,
|
|
180
189
|
worldMatrix: object.matrixWorld.clone()
|
|
181
190
|
};
|
|
182
191
|
|
|
@@ -198,7 +207,7 @@ class NodeMaterialObserver {
|
|
|
198
207
|
|
|
199
208
|
}
|
|
200
209
|
|
|
201
|
-
if (
|
|
210
|
+
if ( renderObject.material.transmission > 0 ) {
|
|
202
211
|
|
|
203
212
|
const { width, height } = renderObject.context;
|
|
204
213
|
|
|
@@ -268,6 +277,37 @@ class NodeMaterialObserver {
|
|
|
268
277
|
|
|
269
278
|
}
|
|
270
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Returns a geometry data structure holding the geometry property values for
|
|
282
|
+
* monitoring.
|
|
283
|
+
*
|
|
284
|
+
* @param {BufferGeometry} geometry - The geometry.
|
|
285
|
+
* @return {Object} An object for monitoring geometry properties.
|
|
286
|
+
*/
|
|
287
|
+
getGeometryData( geometry ) {
|
|
288
|
+
|
|
289
|
+
let data = _geometryCache.get( geometry );
|
|
290
|
+
|
|
291
|
+
if ( data === undefined ) {
|
|
292
|
+
|
|
293
|
+
data = {
|
|
294
|
+
_renderId: - 1,
|
|
295
|
+
_equal: false,
|
|
296
|
+
|
|
297
|
+
attributes: this.getAttributesData( geometry.attributes ),
|
|
298
|
+
indexId: geometry.index ? geometry.index.id : null,
|
|
299
|
+
indexVersion: geometry.index ? geometry.index.version : null,
|
|
300
|
+
drawRange: { start: geometry.drawRange.start, count: geometry.drawRange.count }
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
_geometryCache.set( geometry, data );
|
|
304
|
+
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return data;
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
|
|
271
311
|
/**
|
|
272
312
|
* Returns a material data structure holding the material property values for
|
|
273
313
|
* monitoring.
|
|
@@ -277,32 +317,40 @@ class NodeMaterialObserver {
|
|
|
277
317
|
*/
|
|
278
318
|
getMaterialData( material ) {
|
|
279
319
|
|
|
280
|
-
|
|
320
|
+
let data = _materialCache.get( material );
|
|
281
321
|
|
|
282
|
-
|
|
322
|
+
if ( data === undefined ) {
|
|
283
323
|
|
|
284
|
-
|
|
324
|
+
data = { _renderId: - 1, _equal: false };
|
|
285
325
|
|
|
286
|
-
|
|
326
|
+
for ( const property of this.refreshUniforms ) {
|
|
287
327
|
|
|
288
|
-
|
|
328
|
+
const value = material[ property ];
|
|
289
329
|
|
|
290
|
-
if ( value
|
|
330
|
+
if ( value === null || value === undefined ) continue;
|
|
291
331
|
|
|
292
|
-
|
|
332
|
+
if ( typeof value === 'object' && value.clone !== undefined ) {
|
|
293
333
|
|
|
294
|
-
|
|
334
|
+
if ( value.isTexture === true ) {
|
|
295
335
|
|
|
296
|
-
|
|
336
|
+
data[ property ] = { id: value.id, version: value.version };
|
|
297
337
|
|
|
298
|
-
|
|
338
|
+
} else {
|
|
299
339
|
|
|
300
|
-
|
|
340
|
+
data[ property ] = value.clone();
|
|
341
|
+
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
} else {
|
|
301
345
|
|
|
302
|
-
|
|
346
|
+
data[ property ] = value;
|
|
347
|
+
|
|
348
|
+
}
|
|
303
349
|
|
|
304
350
|
}
|
|
305
351
|
|
|
352
|
+
_materialCache.set( material, data );
|
|
353
|
+
|
|
306
354
|
}
|
|
307
355
|
|
|
308
356
|
return data;
|
|
@@ -314,9 +362,10 @@ class NodeMaterialObserver {
|
|
|
314
362
|
*
|
|
315
363
|
* @param {RenderObject} renderObject - The render object.
|
|
316
364
|
* @param {Array<Light>} lightsData - The current material lights.
|
|
365
|
+
* @param {number} renderId - The current render ID.
|
|
317
366
|
* @return {boolean} Whether the given render object has changed its state or not.
|
|
318
367
|
*/
|
|
319
|
-
equals( renderObject, lightsData ) {
|
|
368
|
+
equals( renderObject, lightsData, renderId ) {
|
|
320
369
|
|
|
321
370
|
const { object, material, geometry } = renderObject;
|
|
322
371
|
|
|
@@ -334,130 +383,180 @@ class NodeMaterialObserver {
|
|
|
334
383
|
|
|
335
384
|
// material
|
|
336
385
|
|
|
337
|
-
const materialData =
|
|
386
|
+
const materialData = this.getMaterialData( renderObject.material );
|
|
387
|
+
|
|
388
|
+
// check the material for the "equal" state just once per render for all render objects
|
|
389
|
+
|
|
390
|
+
if ( materialData._renderId !== renderId ) {
|
|
391
|
+
|
|
392
|
+
materialData._renderId = renderId;
|
|
393
|
+
|
|
394
|
+
for ( const property in materialData ) {
|
|
395
|
+
|
|
396
|
+
const value = materialData[ property ];
|
|
397
|
+
const mtlValue = material[ property ];
|
|
398
|
+
|
|
399
|
+
if ( property === '_renderId' ) continue;
|
|
400
|
+
if ( property === '_equal' ) continue;
|
|
401
|
+
|
|
402
|
+
if ( value.equals !== undefined ) {
|
|
403
|
+
|
|
404
|
+
if ( value.equals( mtlValue ) === false ) {
|
|
338
405
|
|
|
339
|
-
|
|
406
|
+
value.copy( mtlValue );
|
|
340
407
|
|
|
341
|
-
|
|
342
|
-
|
|
408
|
+
materialData._equal = false;
|
|
409
|
+
return false;
|
|
343
410
|
|
|
344
|
-
|
|
411
|
+
}
|
|
345
412
|
|
|
346
|
-
if (
|
|
413
|
+
} else if ( mtlValue.isTexture === true ) {
|
|
347
414
|
|
|
348
|
-
value.
|
|
415
|
+
if ( value.id !== mtlValue.id || value.version !== mtlValue.version ) {
|
|
349
416
|
|
|
417
|
+
value.id = mtlValue.id;
|
|
418
|
+
value.version = mtlValue.version;
|
|
419
|
+
|
|
420
|
+
materialData._equal = false;
|
|
421
|
+
return false;
|
|
422
|
+
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
} else if ( value !== mtlValue ) {
|
|
426
|
+
|
|
427
|
+
materialData[ property ] = mtlValue;
|
|
428
|
+
|
|
429
|
+
materialData._equal = false;
|
|
350
430
|
return false;
|
|
351
431
|
|
|
352
432
|
}
|
|
353
433
|
|
|
354
|
-
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if ( materialData.transmission > 0 ) {
|
|
437
|
+
|
|
438
|
+
const { width, height } = renderObject.context;
|
|
355
439
|
|
|
356
|
-
if (
|
|
440
|
+
if ( renderObjectData.bufferWidth !== width || renderObjectData.bufferHeight !== height ) {
|
|
357
441
|
|
|
358
|
-
|
|
359
|
-
|
|
442
|
+
renderObjectData.bufferWidth = width;
|
|
443
|
+
renderObjectData.bufferHeight = height;
|
|
360
444
|
|
|
445
|
+
materialData._equal = false;
|
|
361
446
|
return false;
|
|
362
447
|
|
|
363
448
|
}
|
|
364
449
|
|
|
365
|
-
}
|
|
450
|
+
}
|
|
366
451
|
|
|
367
|
-
|
|
452
|
+
materialData._equal = true;
|
|
368
453
|
|
|
369
|
-
|
|
454
|
+
} else {
|
|
370
455
|
|
|
371
|
-
|
|
456
|
+
if ( materialData._equal === false ) return false;
|
|
372
457
|
|
|
373
458
|
}
|
|
374
459
|
|
|
375
|
-
|
|
460
|
+
// geometry
|
|
376
461
|
|
|
377
|
-
|
|
462
|
+
if ( renderObjectData.geometryId !== geometry.id ) {
|
|
378
463
|
|
|
379
|
-
|
|
464
|
+
renderObjectData.geometryId = geometry.id;
|
|
465
|
+
return false;
|
|
380
466
|
|
|
381
|
-
|
|
382
|
-
renderObjectData.bufferHeight = height;
|
|
467
|
+
}
|
|
383
468
|
|
|
384
|
-
|
|
469
|
+
const geometryData = this.getGeometryData( renderObject.geometry );
|
|
385
470
|
|
|
386
|
-
|
|
471
|
+
// check the geoemtry for the "equal" state just once per render for all render objects
|
|
387
472
|
|
|
388
|
-
|
|
473
|
+
if ( geometryData._renderId !== renderId ) {
|
|
389
474
|
|
|
390
|
-
|
|
475
|
+
geometryData._renderId = renderId;
|
|
391
476
|
|
|
392
|
-
|
|
393
|
-
const attributes = geometry.attributes;
|
|
394
|
-
const storedAttributes = storedGeometryData.attributes;
|
|
477
|
+
// attributes
|
|
395
478
|
|
|
396
|
-
|
|
397
|
-
|
|
479
|
+
const attributes = geometry.attributes;
|
|
480
|
+
const storedAttributes = geometryData.attributes;
|
|
398
481
|
|
|
399
|
-
|
|
482
|
+
let currentAttributeCount = 0;
|
|
483
|
+
let storedAttributeCount = 0;
|
|
400
484
|
|
|
401
|
-
|
|
402
|
-
return false;
|
|
485
|
+
for ( const _ in attributes ) currentAttributeCount ++; // eslint-disable-line no-unused-vars
|
|
403
486
|
|
|
404
|
-
|
|
487
|
+
for ( const name in storedAttributes ) {
|
|
405
488
|
|
|
406
|
-
|
|
489
|
+
storedAttributeCount ++;
|
|
407
490
|
|
|
408
|
-
|
|
409
|
-
|
|
491
|
+
const storedAttributeData = storedAttributes[ name ];
|
|
492
|
+
const attribute = attributes[ name ];
|
|
410
493
|
|
|
411
|
-
|
|
494
|
+
if ( attribute === undefined ) {
|
|
412
495
|
|
|
413
|
-
|
|
496
|
+
// attribute was removed
|
|
497
|
+
delete storedAttributes[ name ];
|
|
414
498
|
|
|
415
|
-
|
|
499
|
+
geometryData._equal = false;
|
|
500
|
+
return false;
|
|
416
501
|
|
|
417
|
-
|
|
418
|
-
const attribute = attributes[ name ];
|
|
502
|
+
}
|
|
419
503
|
|
|
420
|
-
|
|
504
|
+
if ( storedAttributeData.id !== attribute.id || storedAttributeData.version !== attribute.version ) {
|
|
421
505
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
506
|
+
storedAttributeData.id = attribute.id;
|
|
507
|
+
storedAttributeData.version = attribute.version;
|
|
508
|
+
|
|
509
|
+
geometryData._equal = false;
|
|
510
|
+
return false;
|
|
511
|
+
|
|
512
|
+
}
|
|
425
513
|
|
|
426
514
|
}
|
|
427
515
|
|
|
428
|
-
if (
|
|
516
|
+
if ( storedAttributeCount !== currentAttributeCount ) {
|
|
517
|
+
|
|
518
|
+
geometryData.attributes = this.getAttributesData( attributes );
|
|
429
519
|
|
|
430
|
-
|
|
431
|
-
storedAttributeData.version = attribute.version;
|
|
520
|
+
geometryData._equal = false;
|
|
432
521
|
return false;
|
|
433
522
|
|
|
434
523
|
}
|
|
435
524
|
|
|
436
|
-
|
|
525
|
+
// check index
|
|
437
526
|
|
|
438
|
-
|
|
527
|
+
const index = geometry.index;
|
|
528
|
+
const storedIndexId = geometryData.indexId;
|
|
529
|
+
const storedIndexVersion = geometryData.indexVersion;
|
|
530
|
+
const currentIndexId = index ? index.id : null;
|
|
531
|
+
const currentIndexVersion = index ? index.version : null;
|
|
439
532
|
|
|
440
|
-
|
|
441
|
-
const storedIndexId = storedGeometryData.indexId;
|
|
442
|
-
const storedIndexVersion = storedGeometryData.indexVersion;
|
|
443
|
-
const currentIndexId = index ? index.id : null;
|
|
444
|
-
const currentIndexVersion = index ? index.version : null;
|
|
533
|
+
if ( storedIndexId !== currentIndexId || storedIndexVersion !== currentIndexVersion ) {
|
|
445
534
|
|
|
446
|
-
|
|
535
|
+
geometryData.indexId = currentIndexId;
|
|
536
|
+
geometryData.indexVersion = currentIndexVersion;
|
|
447
537
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
return false;
|
|
538
|
+
geometryData._equal = false;
|
|
539
|
+
return false;
|
|
451
540
|
|
|
452
|
-
|
|
541
|
+
}
|
|
453
542
|
|
|
454
|
-
|
|
543
|
+
// check drawRange
|
|
455
544
|
|
|
456
|
-
|
|
545
|
+
if ( geometryData.drawRange.start !== geometry.drawRange.start || geometryData.drawRange.count !== geometry.drawRange.count ) {
|
|
457
546
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
547
|
+
geometryData.drawRange.start = geometry.drawRange.start;
|
|
548
|
+
geometryData.drawRange.count = geometry.drawRange.count;
|
|
549
|
+
|
|
550
|
+
geometryData._equal = false;
|
|
551
|
+
return false;
|
|
552
|
+
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
geometryData._equal = true;
|
|
556
|
+
|
|
557
|
+
} else {
|
|
558
|
+
|
|
559
|
+
if ( geometryData._equal === false ) return false;
|
|
461
560
|
|
|
462
561
|
}
|
|
463
562
|
|
|
@@ -608,7 +707,7 @@ class NodeMaterialObserver {
|
|
|
608
707
|
return false;
|
|
609
708
|
|
|
610
709
|
const lightsData = this.getLights( renderObject.lightsNode, renderId );
|
|
611
|
-
const notEqual = this.equals( renderObject, lightsData ) !== true;
|
|
710
|
+
const notEqual = this.equals( renderObject, lightsData, renderId ) !== true;
|
|
612
711
|
|
|
613
712
|
return notEqual;
|
|
614
713
|
|
package/src/math/Line3.js
CHANGED
|
@@ -142,6 +142,9 @@ class Line3 {
|
|
|
142
142
|
_startEnd.subVectors( this.end, this.start );
|
|
143
143
|
|
|
144
144
|
const startEnd2 = _startEnd.dot( _startEnd );
|
|
145
|
+
|
|
146
|
+
if ( startEnd2 === 0 ) return 0;
|
|
147
|
+
|
|
145
148
|
const startEnd_startP = _startEnd.dot( _startP );
|
|
146
149
|
|
|
147
150
|
let t = startEnd_startP / startEnd2;
|
package/src/math/Matrix2.js
CHANGED
|
@@ -26,6 +26,19 @@
|
|
|
26
26
|
*/
|
|
27
27
|
export class Matrix2 {
|
|
28
28
|
|
|
29
|
+
static {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* This flag can be used for type testing.
|
|
33
|
+
*
|
|
34
|
+
* @type {boolean}
|
|
35
|
+
* @readonly
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
Matrix2.prototype.isMatrix2 = true;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
/**
|
|
30
43
|
* Constructs a new 2x2 matrix. The arguments are supposed to be
|
|
31
44
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -38,15 +51,6 @@ export class Matrix2 {
|
|
|
38
51
|
*/
|
|
39
52
|
constructor( n11, n12, n21, n22 ) {
|
|
40
53
|
|
|
41
|
-
/**
|
|
42
|
-
* This flag can be used for type testing.
|
|
43
|
-
*
|
|
44
|
-
* @type {boolean}
|
|
45
|
-
* @readonly
|
|
46
|
-
* @default true
|
|
47
|
-
*/
|
|
48
|
-
Matrix2.prototype.isMatrix2 = true;
|
|
49
|
-
|
|
50
54
|
/**
|
|
51
55
|
* A column-major list of matrix values.
|
|
52
56
|
*
|
package/src/math/Matrix3.js
CHANGED
|
@@ -28,6 +28,19 @@
|
|
|
28
28
|
*/
|
|
29
29
|
class Matrix3 {
|
|
30
30
|
|
|
31
|
+
static {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* This flag can be used for type testing.
|
|
35
|
+
*
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
* @readonly
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
Matrix3.prototype.isMatrix3 = true;
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
31
44
|
/**
|
|
32
45
|
* Constructs a new 3x3 matrix. The arguments are supposed to be
|
|
33
46
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -45,15 +58,6 @@ class Matrix3 {
|
|
|
45
58
|
*/
|
|
46
59
|
constructor( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {
|
|
47
60
|
|
|
48
|
-
/**
|
|
49
|
-
* This flag can be used for type testing.
|
|
50
|
-
*
|
|
51
|
-
* @type {boolean}
|
|
52
|
-
* @readonly
|
|
53
|
-
* @default true
|
|
54
|
-
*/
|
|
55
|
-
Matrix3.prototype.isMatrix3 = true;
|
|
56
|
-
|
|
57
61
|
/**
|
|
58
62
|
* A column-major list of matrix values.
|
|
59
63
|
*
|
package/src/math/Matrix4.js
CHANGED
|
@@ -41,6 +41,19 @@ import { Vector3 } from './Vector3.js';
|
|
|
41
41
|
*/
|
|
42
42
|
class Matrix4 {
|
|
43
43
|
|
|
44
|
+
static {
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* This flag can be used for type testing.
|
|
48
|
+
*
|
|
49
|
+
* @type {boolean}
|
|
50
|
+
* @readonly
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
Matrix4.prototype.isMatrix4 = true;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
44
57
|
/**
|
|
45
58
|
* Constructs a new 4x4 matrix. The arguments are supposed to be
|
|
46
59
|
* in row-major order. If no arguments are provided, the constructor
|
|
@@ -65,15 +78,6 @@ class Matrix4 {
|
|
|
65
78
|
*/
|
|
66
79
|
constructor( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {
|
|
67
80
|
|
|
68
|
-
/**
|
|
69
|
-
* This flag can be used for type testing.
|
|
70
|
-
*
|
|
71
|
-
* @type {boolean}
|
|
72
|
-
* @readonly
|
|
73
|
-
* @default true
|
|
74
|
-
*/
|
|
75
|
-
Matrix4.prototype.isMatrix4 = true;
|
|
76
|
-
|
|
77
81
|
/**
|
|
78
82
|
* A column-major list of matrix values.
|
|
79
83
|
*
|
package/src/math/Plane.js
CHANGED
|
@@ -210,9 +210,10 @@ class Plane {
|
|
|
210
210
|
*
|
|
211
211
|
* @param {Line3} line - The line to compute the intersection for.
|
|
212
212
|
* @param {Vector3} target - The target vector that is used to store the method's result.
|
|
213
|
-
* @
|
|
213
|
+
* @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
|
|
214
|
+
* @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
|
|
214
215
|
*/
|
|
215
|
-
intersectLine( line, target ) {
|
|
216
|
+
intersectLine( line, target, clampToLine = true ) {
|
|
216
217
|
|
|
217
218
|
const direction = line.delta( _vector1 );
|
|
218
219
|
|
|
@@ -234,7 +235,7 @@ class Plane {
|
|
|
234
235
|
|
|
235
236
|
const t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;
|
|
236
237
|
|
|
237
|
-
if ( t < 0 || t > 1 ) {
|
|
238
|
+
if ( ( clampToLine === true ) && ( t < 0 || t > 1 ) ) {
|
|
238
239
|
|
|
239
240
|
return null;
|
|
240
241
|
|
package/src/math/Triangle.js
CHANGED
package/src/math/Vector2.js
CHANGED
|
@@ -27,13 +27,7 @@ import { clamp } from './MathUtils.js';
|
|
|
27
27
|
*/
|
|
28
28
|
class Vector2 {
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
* Constructs a new 2D vector.
|
|
32
|
-
*
|
|
33
|
-
* @param {number} [x=0] - The x value of this vector.
|
|
34
|
-
* @param {number} [y=0] - The y value of this vector.
|
|
35
|
-
*/
|
|
36
|
-
constructor( x = 0, y = 0 ) {
|
|
30
|
+
static {
|
|
37
31
|
|
|
38
32
|
/**
|
|
39
33
|
* This flag can be used for type testing.
|
|
@@ -44,6 +38,16 @@ class Vector2 {
|
|
|
44
38
|
*/
|
|
45
39
|
Vector2.prototype.isVector2 = true;
|
|
46
40
|
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Constructs a new 2D vector.
|
|
45
|
+
*
|
|
46
|
+
* @param {number} [x=0] - The x value of this vector.
|
|
47
|
+
* @param {number} [y=0] - The y value of this vector.
|
|
48
|
+
*/
|
|
49
|
+
constructor( x = 0, y = 0 ) {
|
|
50
|
+
|
|
47
51
|
/**
|
|
48
52
|
* The x value of this vector.
|
|
49
53
|
*
|
package/src/math/Vector3.js
CHANGED
|
@@ -28,14 +28,7 @@ import { Quaternion } from './Quaternion.js';
|
|
|
28
28
|
*/
|
|
29
29
|
class Vector3 {
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
* Constructs a new 3D vector.
|
|
33
|
-
*
|
|
34
|
-
* @param {number} [x=0] - The x value of this vector.
|
|
35
|
-
* @param {number} [y=0] - The y value of this vector.
|
|
36
|
-
* @param {number} [z=0] - The z value of this vector.
|
|
37
|
-
*/
|
|
38
|
-
constructor( x = 0, y = 0, z = 0 ) {
|
|
31
|
+
static {
|
|
39
32
|
|
|
40
33
|
/**
|
|
41
34
|
* This flag can be used for type testing.
|
|
@@ -46,6 +39,17 @@ class Vector3 {
|
|
|
46
39
|
*/
|
|
47
40
|
Vector3.prototype.isVector3 = true;
|
|
48
41
|
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Constructs a new 3D vector.
|
|
46
|
+
*
|
|
47
|
+
* @param {number} [x=0] - The x value of this vector.
|
|
48
|
+
* @param {number} [y=0] - The y value of this vector.
|
|
49
|
+
* @param {number} [z=0] - The z value of this vector.
|
|
50
|
+
*/
|
|
51
|
+
constructor( x = 0, y = 0, z = 0 ) {
|
|
52
|
+
|
|
49
53
|
/**
|
|
50
54
|
* The x value of this vector.
|
|
51
55
|
*
|
package/src/math/Vector4.js
CHANGED
|
@@ -26,15 +26,7 @@ import { clamp } from './MathUtils.js';
|
|
|
26
26
|
*/
|
|
27
27
|
class Vector4 {
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
* Constructs a new 4D vector.
|
|
31
|
-
*
|
|
32
|
-
* @param {number} [x=0] - The x value of this vector.
|
|
33
|
-
* @param {number} [y=0] - The y value of this vector.
|
|
34
|
-
* @param {number} [z=0] - The z value of this vector.
|
|
35
|
-
* @param {number} [w=1] - The w value of this vector.
|
|
36
|
-
*/
|
|
37
|
-
constructor( x = 0, y = 0, z = 0, w = 1 ) {
|
|
29
|
+
static {
|
|
38
30
|
|
|
39
31
|
/**
|
|
40
32
|
* This flag can be used for type testing.
|
|
@@ -45,6 +37,18 @@ class Vector4 {
|
|
|
45
37
|
*/
|
|
46
38
|
Vector4.prototype.isVector4 = true;
|
|
47
39
|
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Constructs a new 4D vector.
|
|
44
|
+
*
|
|
45
|
+
* @param {number} [x=0] - The x value of this vector.
|
|
46
|
+
* @param {number} [y=0] - The y value of this vector.
|
|
47
|
+
* @param {number} [z=0] - The z value of this vector.
|
|
48
|
+
* @param {number} [w=1] - The w value of this vector.
|
|
49
|
+
*/
|
|
50
|
+
constructor( x = 0, y = 0, z = 0, w = 1 ) {
|
|
51
|
+
|
|
48
52
|
/**
|
|
49
53
|
* The x value of this vector.
|
|
50
54
|
*
|
package/src/nodes/Nodes.js
CHANGED
|
@@ -154,7 +154,6 @@ export { default as LoopNode } from './utils/LoopNode.js';
|
|
|
154
154
|
export { default as MaxMipLevelNode } from './utils/MaxMipLevelNode.js';
|
|
155
155
|
export { default as MemberNode } from './utils/MemberNode.js';
|
|
156
156
|
export { default as ReflectorNode } from './utils/ReflectorNode.js';
|
|
157
|
-
export { default as RemapNode } from './utils/RemapNode.js';
|
|
158
157
|
export { default as RotateNode } from './utils/RotateNode.js';
|
|
159
158
|
export { default as RTTNode } from './utils/RTTNode.js';
|
|
160
159
|
export { default as SampleNode } from './utils/SampleNode.js';
|
package/src/nodes/TSL.js
CHANGED
|
@@ -35,7 +35,7 @@ export * from './utils/MatcapUV.js';
|
|
|
35
35
|
export * from './utils/MaxMipLevelNode.js';
|
|
36
36
|
export * from './utils/Oscillators.js';
|
|
37
37
|
export * from './utils/Packing.js';
|
|
38
|
-
export * from './utils/
|
|
38
|
+
export * from './utils/Remap.js';
|
|
39
39
|
export * from './utils/UVUtils.js';
|
|
40
40
|
export * from './utils/SpriteUtils.js';
|
|
41
41
|
export * from './utils/ViewportUtils.js';
|