@plastic-software/three 0.178.0 → 0.179.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.
Files changed (141) hide show
  1. package/README.md +1 -1
  2. package/build/three.cjs +856 -196
  3. package/build/three.core.js +647 -123
  4. package/build/three.core.min.js +1 -1
  5. package/build/three.module.js +211 -76
  6. package/build/three.module.min.js +1 -1
  7. package/build/three.tsl.js +70 -21
  8. package/build/three.tsl.min.js +1 -1
  9. package/build/three.webgpu.js +1796 -557
  10. package/build/three.webgpu.min.js +1 -1
  11. package/build/three.webgpu.nodes.js +1754 -557
  12. package/build/three.webgpu.nodes.min.js +1 -1
  13. package/examples/jsm/Addons.js +1 -2
  14. package/examples/jsm/capabilities/WebGPU.js +1 -1
  15. package/examples/jsm/csm/CSMShadowNode.js +4 -4
  16. package/examples/jsm/environments/RoomEnvironment.js +8 -3
  17. package/examples/jsm/exporters/USDZExporter.js +676 -299
  18. package/examples/jsm/geometries/RoundedBoxGeometry.js +47 -8
  19. package/examples/jsm/interactive/HTMLMesh.js +5 -3
  20. package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
  21. package/examples/jsm/lights/LightProbeGenerator.js +14 -3
  22. package/examples/jsm/loaders/EXRLoader.js +210 -22
  23. package/examples/jsm/loaders/FBXLoader.js +1 -1
  24. package/examples/jsm/loaders/MaterialXLoader.js +212 -30
  25. package/examples/jsm/loaders/TTFLoader.js +13 -1
  26. package/examples/jsm/loaders/USDLoader.js +219 -0
  27. package/examples/jsm/loaders/USDZLoader.js +4 -892
  28. package/examples/jsm/loaders/usd/USDAParser.js +741 -0
  29. package/examples/jsm/loaders/usd/USDCParser.js +17 -0
  30. package/examples/jsm/objects/LensflareMesh.js +3 -3
  31. package/examples/jsm/objects/SkyMesh.js +2 -2
  32. package/examples/jsm/physics/RapierPhysics.js +14 -5
  33. package/examples/jsm/postprocessing/GTAOPass.js +10 -9
  34. package/examples/jsm/postprocessing/OutlinePass.js +17 -17
  35. package/examples/jsm/postprocessing/SSAOPass.js +10 -9
  36. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +11 -2
  37. package/examples/jsm/transpiler/GLSLDecoder.js +2 -2
  38. package/examples/jsm/tsl/display/BloomNode.js +8 -7
  39. package/examples/jsm/tsl/display/GaussianBlurNode.js +6 -8
  40. package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +181 -172
  41. package/examples/jsm/tsl/lighting/TiledLightsNode.js +1 -1
  42. package/package.json +1 -1
  43. package/src/Three.Core.js +1 -0
  44. package/src/Three.TSL.js +69 -20
  45. package/src/animation/KeyframeTrack.js +1 -1
  46. package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
  47. package/src/animation/tracks/StringKeyframeTrack.js +1 -1
  48. package/src/cameras/Camera.js +14 -0
  49. package/src/cameras/OrthographicCamera.js +1 -1
  50. package/src/cameras/PerspectiveCamera.js +1 -1
  51. package/src/constants.js +1 -1
  52. package/{examples/jsm/misc → src/core}/Timer.js +4 -42
  53. package/src/extras/PMREMGenerator.js +11 -0
  54. package/src/helpers/CameraHelper.js +41 -11
  55. package/src/helpers/SkeletonHelper.js +35 -6
  56. package/src/lights/LightShadow.js +21 -8
  57. package/src/lights/PointLightShadow.js +1 -1
  58. package/src/loaders/FileLoader.js +25 -2
  59. package/src/loaders/ImageBitmapLoader.js +23 -0
  60. package/src/loaders/Loader.js +14 -0
  61. package/src/loaders/LoadingManager.js +23 -0
  62. package/src/materials/MeshBasicMaterial.js +1 -1
  63. package/src/materials/nodes/Line2NodeMaterial.js +0 -8
  64. package/src/materials/nodes/NodeMaterial.js +1 -1
  65. package/src/materials/nodes/PointsNodeMaterial.js +5 -0
  66. package/src/materials/nodes/manager/NodeMaterialObserver.js +87 -2
  67. package/src/math/Frustum.js +19 -8
  68. package/src/math/FrustumArray.js +10 -5
  69. package/src/math/Line3.js +129 -2
  70. package/src/math/Matrix4.js +48 -27
  71. package/src/math/Spherical.js +2 -2
  72. package/src/nodes/Nodes.js +1 -0
  73. package/src/nodes/TSL.js +1 -0
  74. package/src/nodes/accessors/Camera.js +12 -12
  75. package/src/nodes/accessors/Normal.js +11 -11
  76. package/src/nodes/accessors/ReferenceNode.js +18 -3
  77. package/src/nodes/accessors/SceneNode.js +1 -1
  78. package/src/nodes/accessors/StorageTextureNode.js +1 -1
  79. package/src/nodes/accessors/TextureNode.js +12 -0
  80. package/src/nodes/core/ArrayNode.js +12 -0
  81. package/src/nodes/core/AssignNode.js +3 -0
  82. package/src/nodes/core/ContextNode.js +20 -1
  83. package/src/nodes/core/Node.js +14 -2
  84. package/src/nodes/core/NodeBuilder.js +25 -20
  85. package/src/nodes/core/NodeUtils.js +4 -1
  86. package/src/nodes/core/StackNode.js +42 -0
  87. package/src/nodes/core/UniformNode.js +63 -5
  88. package/src/nodes/core/VarNode.js +91 -2
  89. package/src/nodes/display/PassNode.js +148 -2
  90. package/src/nodes/display/ViewportTextureNode.js +67 -7
  91. package/src/nodes/functions/PhysicalLightingModel.js +2 -2
  92. package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
  93. package/src/nodes/gpgpu/ComputeNode.js +67 -23
  94. package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
  95. package/src/nodes/lighting/ProjectorLightNode.js +19 -6
  96. package/src/nodes/lighting/ShadowFilterNode.js +1 -1
  97. package/src/nodes/materialx/MaterialXNodes.js +131 -2
  98. package/src/nodes/materialx/lib/mx_noise.js +165 -1
  99. package/src/nodes/math/ConditionalNode.js +1 -1
  100. package/src/nodes/math/MathNode.js +78 -54
  101. package/src/nodes/math/OperatorNode.js +22 -22
  102. package/src/nodes/tsl/TSLCore.js +64 -9
  103. package/src/nodes/utils/DebugNode.js +1 -1
  104. package/src/nodes/utils/EventNode.js +83 -0
  105. package/src/nodes/utils/RTTNode.js +9 -0
  106. package/src/objects/BatchedMesh.js +4 -2
  107. package/src/renderers/WebGLRenderer.js +21 -22
  108. package/src/renderers/common/Bindings.js +19 -18
  109. package/src/renderers/common/Color4.js +2 -2
  110. package/src/renderers/common/PostProcessing.js +60 -5
  111. package/src/renderers/common/Renderer.js +18 -15
  112. package/src/renderers/common/SampledTexture.js +3 -71
  113. package/src/renderers/common/Sampler.js +79 -0
  114. package/src/renderers/common/Storage3DTexture.js +21 -0
  115. package/src/renderers/common/StorageArrayTexture.js +21 -0
  116. package/src/renderers/common/StorageTexture.js +19 -0
  117. package/src/renderers/common/Textures.js +19 -3
  118. package/src/renderers/common/XRManager.js +26 -8
  119. package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
  120. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +20 -2
  121. package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
  122. package/src/renderers/webgl/WebGLCapabilities.js +2 -2
  123. package/src/renderers/webgl/WebGLMaterials.js +6 -6
  124. package/src/renderers/webgl/WebGLProgram.js +22 -16
  125. package/src/renderers/webgl/WebGLPrograms.js +4 -4
  126. package/src/renderers/webgl/WebGLShadowMap.js +11 -1
  127. package/src/renderers/webgl/WebGLTextures.js +19 -7
  128. package/src/renderers/webgl-fallback/WebGLBackend.js +22 -12
  129. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +2 -2
  130. package/src/renderers/webgpu/WebGPUBackend.js +54 -15
  131. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +53 -73
  132. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +35 -31
  133. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1 -1
  134. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +11 -64
  135. package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
  136. package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
  137. package/src/renderers/webxr/WebXRManager.js +68 -8
  138. package/src/textures/ExternalTexture.js +45 -0
  139. package/src/textures/FramebufferTexture.js +2 -2
  140. package/src/textures/Source.js +11 -1
  141. package/src/textures/VideoTexture.js +30 -2
package/src/Three.TSL.js CHANGED
@@ -2,8 +2,10 @@ import { TSL } from 'three/webgpu';
2
2
 
3
3
  export const BRDF_GGX = TSL.BRDF_GGX;
4
4
  export const BRDF_Lambert = TSL.BRDF_Lambert;
5
+ export const BasicPointShadowFilter = TSL.BasicPointShadowFilter;
5
6
  export const BasicShadowFilter = TSL.BasicShadowFilter;
6
7
  export const Break = TSL.Break;
8
+ export const Const = TSL.Const;
7
9
  export const Continue = TSL.Continue;
8
10
  export const DFGApprox = TSL.DFGApprox;
9
11
  export const D_GGX = TSL.D_GGX;
@@ -13,27 +15,32 @@ export const F_Schlick = TSL.F_Schlick;
13
15
  export const Fn = TSL.Fn;
14
16
  export const INFINITY = TSL.INFINITY;
15
17
  export const If = TSL.If;
16
- export const Switch = TSL.Switch;
17
18
  export const Loop = TSL.Loop;
19
+ export const NodeAccess = TSL.NodeAccess;
18
20
  export const NodeShaderStage = TSL.NodeShaderStage;
19
21
  export const NodeType = TSL.NodeType;
20
22
  export const NodeUpdateType = TSL.NodeUpdateType;
21
- export const NodeAccess = TSL.NodeAccess;
22
23
  export const PCFShadowFilter = TSL.PCFShadowFilter;
23
24
  export const PCFSoftShadowFilter = TSL.PCFSoftShadowFilter;
24
25
  export const PI = TSL.PI;
25
26
  export const PI2 = TSL.PI2;
27
+ export const PointShadowFilter = TSL.PointShadowFilter;
26
28
  export const Return = TSL.Return;
27
29
  export const Schlick_to_F0 = TSL.Schlick_to_F0;
28
30
  export const ScriptableNodeResources = TSL.ScriptableNodeResources;
29
31
  export const ShaderNode = TSL.ShaderNode;
32
+ export const Stack = TSL.Stack;
33
+ export const Switch = TSL.Switch;
30
34
  export const TBNViewMatrix = TSL.TBNViewMatrix;
31
35
  export const VSMShadowFilter = TSL.VSMShadowFilter;
32
36
  export const V_GGX_SmithCorrelated = TSL.V_GGX_SmithCorrelated;
37
+ export const Var = TSL.Var;
38
+ export const VarIntent = TSL.VarIntent;
33
39
  export const abs = TSL.abs;
34
40
  export const acesFilmicToneMapping = TSL.acesFilmicToneMapping;
35
41
  export const acos = TSL.acos;
36
42
  export const add = TSL.add;
43
+ export const addMethodChaining = TSL.addMethodChaining;
37
44
  export const addNodeElement = TSL.addNodeElement;
38
45
  export const agxToneMapping = TSL.agxToneMapping;
39
46
  export const all = TSL.all;
@@ -53,13 +60,13 @@ export const atan2 = TSL.atan2;
53
60
  export const atomicAdd = TSL.atomicAdd;
54
61
  export const atomicAnd = TSL.atomicAnd;
55
62
  export const atomicFunc = TSL.atomicFunc;
63
+ export const atomicLoad = TSL.atomicLoad;
56
64
  export const atomicMax = TSL.atomicMax;
57
65
  export const atomicMin = TSL.atomicMin;
58
66
  export const atomicOr = TSL.atomicOr;
59
67
  export const atomicStore = TSL.atomicStore;
60
68
  export const atomicSub = TSL.atomicSub;
61
69
  export const atomicXor = TSL.atomicXor;
62
- export const atomicLoad = TSL.atomicLoad;
63
70
  export const attenuationColor = TSL.attenuationColor;
64
71
  export const attenuationDistance = TSL.attenuationDistance;
65
72
  export const attribute = TSL.attribute;
@@ -112,15 +119,15 @@ export const checker = TSL.checker;
112
119
  export const cineonToneMapping = TSL.cineonToneMapping;
113
120
  export const clamp = TSL.clamp;
114
121
  export const clearcoat = TSL.clearcoat;
122
+ export const clearcoatNormalView = TSL.clearcoatNormalView;
115
123
  export const clearcoatRoughness = TSL.clearcoatRoughness;
116
124
  export const code = TSL.code;
117
125
  export const color = TSL.color;
118
126
  export const colorSpaceToWorking = TSL.colorSpaceToWorking;
119
127
  export const colorToDirection = TSL.colorToDirection;
120
128
  export const compute = TSL.compute;
129
+ export const computeKernel = TSL.computeKernel;
121
130
  export const computeSkinning = TSL.computeSkinning;
122
- export const cond = TSL.cond;
123
- export const Const = TSL.Const;
124
131
  export const context = TSL.context;
125
132
  export const convert = TSL.convert;
126
133
  export const convertColorSpace = TSL.convertColorSpace;
@@ -128,6 +135,8 @@ export const convertToTexture = TSL.convertToTexture;
128
135
  export const cos = TSL.cos;
129
136
  export const cross = TSL.cross;
130
137
  export const cubeTexture = TSL.cubeTexture;
138
+ export const cubeTextureBase = TSL.cubeTextureBase;
139
+ export const cubeToUV = TSL.cubeToUV;
131
140
  export const dFdx = TSL.dFdx;
132
141
  export const dFdy = TSL.dFdy;
133
142
  export const dashSize = TSL.dashSize;
@@ -143,10 +152,12 @@ export const densityFog = TSL.densityFog;
143
152
  export const densityFogFactor = TSL.densityFogFactor;
144
153
  export const depth = TSL.depth;
145
154
  export const depthPass = TSL.depthPass;
155
+ export const determinant = TSL.determinant;
146
156
  export const difference = TSL.difference;
147
157
  export const diffuseColor = TSL.diffuseColor;
148
158
  export const directPointLight = TSL.directPointLight;
149
159
  export const directionToColor = TSL.directionToColor;
160
+ export const directionToFaceDirection = TSL.directionToFaceDirection;
150
161
  export const dispersion = TSL.dispersion;
151
162
  export const distance = TSL.distance;
152
163
  export const div = TSL.div;
@@ -185,10 +196,11 @@ export const getParallaxCorrectNormal = TSL.getParallaxCorrectNormal;
185
196
  export const getRoughness = TSL.getRoughness;
186
197
  export const getScreenPosition = TSL.getScreenPosition;
187
198
  export const getShIrradianceAt = TSL.getShIrradianceAt;
188
- export const getTextureIndex = TSL.getTextureIndex;
189
- export const getViewPosition = TSL.getViewPosition;
190
199
  export const getShadowMaterial = TSL.getShadowMaterial;
191
200
  export const getShadowRenderObjectFunction = TSL.getShadowRenderObjectFunction;
201
+ export const getTextureIndex = TSL.getTextureIndex;
202
+ export const getViewPosition = TSL.getViewPosition;
203
+ export const globalId = TSL.globalId;
192
204
  export const glsl = TSL.glsl;
193
205
  export const glslFn = TSL.glslFn;
194
206
  export const grayscale = TSL.grayscale;
@@ -207,6 +219,7 @@ export const instancedBufferAttribute = TSL.instancedBufferAttribute;
207
219
  export const instancedDynamicBufferAttribute = TSL.instancedDynamicBufferAttribute;
208
220
  export const instancedMesh = TSL.instancedMesh;
209
221
  export const int = TSL.int;
222
+ export const inverse = TSL.inverse;
210
223
  export const inverseSqrt = TSL.inverseSqrt;
211
224
  export const inversesqrt = TSL.inversesqrt;
212
225
  export const invocationLocalIndex = TSL.invocationLocalIndex;
@@ -225,6 +238,7 @@ export const lengthSq = TSL.lengthSq;
225
238
  export const lessThan = TSL.lessThan;
226
239
  export const lessThanEqual = TSL.lessThanEqual;
227
240
  export const lightPosition = TSL.lightPosition;
241
+ export const lightProjectionUV = TSL.lightProjectionUV;
228
242
  export const lightShadowMatrix = TSL.lightShadowMatrix;
229
243
  export const lightTargetDirection = TSL.lightTargetDirection;
230
244
  export const lightTargetPosition = TSL.lightTargetPosition;
@@ -234,13 +248,10 @@ export const lights = TSL.lights;
234
248
  export const linearDepth = TSL.linearDepth;
235
249
  export const linearToneMapping = TSL.linearToneMapping;
236
250
  export const localId = TSL.localId;
237
- export const globalId = TSL.globalId;
238
251
  export const log = TSL.log;
239
252
  export const log2 = TSL.log2;
240
253
  export const logarithmicDepthToViewZ = TSL.logarithmicDepthToViewZ;
241
- export const loop = TSL.loop;
242
254
  export const luminance = TSL.luminance;
243
- export const mediumpModelViewMatrix = TSL.mediumpModelViewMatrix;
244
255
  export const mat2 = TSL.mat2;
245
256
  export const mat3 = TSL.mat3;
246
257
  export const mat4 = TSL.mat4;
@@ -257,6 +268,8 @@ export const materialClearcoatRoughness = TSL.materialClearcoatRoughness;
257
268
  export const materialColor = TSL.materialColor;
258
269
  export const materialDispersion = TSL.materialDispersion;
259
270
  export const materialEmissive = TSL.materialEmissive;
271
+ export const materialEnvIntensity = TSL.materialEnvIntensity;
272
+ export const materialEnvRotation = TSL.materialEnvRotation;
260
273
  export const materialIOR = TSL.materialIOR;
261
274
  export const materialIridescence = TSL.materialIridescence;
262
275
  export const materialIridescenceIOR = TSL.materialIridescenceIOR;
@@ -287,6 +300,7 @@ export const materialThickness = TSL.materialThickness;
287
300
  export const materialTransmission = TSL.materialTransmission;
288
301
  export const max = TSL.max;
289
302
  export const maxMipLevel = TSL.maxMipLevel;
303
+ export const mediumpModelViewMatrix = TSL.mediumpModelViewMatrix;
290
304
  export const metalness = TSL.metalness;
291
305
  export const min = TSL.min;
292
306
  export const mix = TSL.mix;
@@ -307,24 +321,45 @@ export const morphReference = TSL.morphReference;
307
321
  export const mrt = TSL.mrt;
308
322
  export const mul = TSL.mul;
309
323
  export const mx_aastep = TSL.mx_aastep;
324
+ export const mx_add = TSL.mx_add;
325
+ export const mx_atan2 = TSL.mx_atan2;
310
326
  export const mx_cell_noise_float = TSL.mx_cell_noise_float;
311
327
  export const mx_contrast = TSL.mx_contrast;
328
+ export const mx_divide = TSL.mx_divide;
312
329
  export const mx_fractal_noise_float = TSL.mx_fractal_noise_float;
313
330
  export const mx_fractal_noise_vec2 = TSL.mx_fractal_noise_vec2;
314
331
  export const mx_fractal_noise_vec3 = TSL.mx_fractal_noise_vec3;
315
332
  export const mx_fractal_noise_vec4 = TSL.mx_fractal_noise_vec4;
333
+ export const mx_frame = TSL.mx_frame;
334
+ export const mx_heighttonormal = TSL.mx_heighttonormal;
316
335
  export const mx_hsvtorgb = TSL.mx_hsvtorgb;
336
+ export const mx_ifequal = TSL.mx_ifequal;
337
+ export const mx_ifgreater = TSL.mx_ifgreater;
338
+ export const mx_ifgreatereq = TSL.mx_ifgreatereq;
339
+ export const mx_invert = TSL.mx_invert;
340
+ export const mx_modulo = TSL.mx_modulo;
341
+ export const mx_multiply = TSL.mx_multiply;
317
342
  export const mx_noise_float = TSL.mx_noise_float;
318
343
  export const mx_noise_vec3 = TSL.mx_noise_vec3;
319
344
  export const mx_noise_vec4 = TSL.mx_noise_vec4;
345
+ export const mx_place2d = TSL.mx_place2d;
346
+ export const mx_power = TSL.mx_power;
347
+ export const mx_ramp4 = TSL.mx_ramp4;
320
348
  export const mx_ramplr = TSL.mx_ramplr;
321
349
  export const mx_ramptb = TSL.mx_ramptb;
322
350
  export const mx_rgbtohsv = TSL.mx_rgbtohsv;
351
+ export const mx_rotate2d = TSL.mx_rotate2d;
352
+ export const mx_rotate3d = TSL.mx_rotate3d;
323
353
  export const mx_safepower = TSL.mx_safepower;
354
+ export const mx_separate = TSL.mx_separate;
324
355
  export const mx_splitlr = TSL.mx_splitlr;
325
356
  export const mx_splittb = TSL.mx_splittb;
326
357
  export const mx_srgb_texture_to_lin_rec709 = TSL.mx_srgb_texture_to_lin_rec709;
358
+ export const mx_subtract = TSL.mx_subtract;
359
+ export const mx_timer = TSL.mx_timer;
327
360
  export const mx_transform_uv = TSL.mx_transform_uv;
361
+ export const mx_unifiednoise2d = TSL.mx_unifiednoise2d;
362
+ export const mx_unifiednoise3d = TSL.mx_unifiednoise3d;
328
363
  export const mx_worley_noise_float = TSL.mx_worley_noise_float;
329
364
  export const mx_worley_noise_vec2 = TSL.mx_worley_noise_vec2;
330
365
  export const mx_worley_noise_vec3 = TSL.mx_worley_noise_vec3;
@@ -333,8 +368,10 @@ export const neutralToneMapping = TSL.neutralToneMapping;
333
368
  export const nodeArray = TSL.nodeArray;
334
369
  export const nodeImmutable = TSL.nodeImmutable;
335
370
  export const nodeObject = TSL.nodeObject;
371
+ export const nodeObjectIntent = TSL.nodeObjectIntent;
336
372
  export const nodeObjects = TSL.nodeObjects;
337
373
  export const nodeProxy = TSL.nodeProxy;
374
+ export const nodeProxyIntent = TSL.nodeProxyIntent;
338
375
  export const normalFlat = TSL.normalFlat;
339
376
  export const normalGeometry = TSL.normalGeometry;
340
377
  export const normalLocal = TSL.normalLocal;
@@ -354,6 +391,8 @@ export const objectRadius = TSL.objectRadius;
354
391
  export const objectScale = TSL.objectScale;
355
392
  export const objectViewPosition = TSL.objectViewPosition;
356
393
  export const objectWorldMatrix = TSL.objectWorldMatrix;
394
+ export const OnObjectUpdate = TSL.OnObjectUpdate;
395
+ export const OnMaterialUpdate = TSL.OnMaterialUpdate;
357
396
  export const oneMinus = TSL.oneMinus;
358
397
  export const or = TSL.or;
359
398
  export const orthographicDepthToViewZ = TSL.orthographicDepthToViewZ;
@@ -374,6 +413,7 @@ export const passTexture = TSL.passTexture;
374
413
  export const pcurve = TSL.pcurve;
375
414
  export const perspectiveDepthToViewZ = TSL.perspectiveDepthToViewZ;
376
415
  export const pmremTexture = TSL.pmremTexture;
416
+ export const pointShadow = TSL.pointShadow;
377
417
  export const pointUV = TSL.pointUV;
378
418
  export const pointWidth = TSL.pointWidth;
379
419
  export const positionGeometry = TSL.positionGeometry;
@@ -396,7 +436,6 @@ export const range = TSL.range;
396
436
  export const rangeFog = TSL.rangeFog;
397
437
  export const rangeFogFactor = TSL.rangeFogFactor;
398
438
  export const reciprocal = TSL.reciprocal;
399
- export const lightProjectionUV = TSL.lightProjectionUV;
400
439
  export const reference = TSL.reference;
401
440
  export const referenceBuffer = TSL.referenceBuffer;
402
441
  export const reflect = TSL.reflect;
@@ -407,7 +446,6 @@ export const refract = TSL.refract;
407
446
  export const refractVector = TSL.refractVector;
408
447
  export const refractView = TSL.refractView;
409
448
  export const reinhardToneMapping = TSL.reinhardToneMapping;
410
- export const remainder = TSL.remainder;
411
449
  export const remap = TSL.remap;
412
450
  export const remapClamp = TSL.remapClamp;
413
451
  export const renderGroup = TSL.renderGroup;
@@ -433,12 +471,12 @@ export const scriptable = TSL.scriptable;
433
471
  export const scriptableValue = TSL.scriptableValue;
434
472
  export const select = TSL.select;
435
473
  export const setCurrentStack = TSL.setCurrentStack;
474
+ export const setName = TSL.setName;
436
475
  export const shaderStages = TSL.shaderStages;
437
476
  export const shadow = TSL.shadow;
438
- export const pointShadow = TSL.pointShadow;
439
477
  export const shadowPositionWorld = TSL.shadowPositionWorld;
440
- export const sharedUniformGroup = TSL.sharedUniformGroup;
441
478
  export const shapeCircle = TSL.shapeCircle;
479
+ export const sharedUniformGroup = TSL.sharedUniformGroup;
442
480
  export const sheen = TSL.sheen;
443
481
  export const sheenRoughness = TSL.sheenRoughness;
444
482
  export const shiftLeft = TSL.shiftLeft;
@@ -458,6 +496,7 @@ export const spritesheetUV = TSL.spritesheetUV;
458
496
  export const sqrt = TSL.sqrt;
459
497
  export const stack = TSL.stack;
460
498
  export const step = TSL.step;
499
+ export const stepElement = TSL.stepElement;
461
500
  export const storage = TSL.storage;
462
501
  export const storageBarrier = TSL.storageBarrier;
463
502
  export const storageObject = TSL.storageObject;
@@ -503,21 +542,18 @@ export const triNoise3D = TSL.triNoise3D;
503
542
  export const triplanarTexture = TSL.triplanarTexture;
504
543
  export const triplanarTextures = TSL.triplanarTextures;
505
544
  export const trunc = TSL.trunc;
506
- export const tslFn = TSL.tslFn;
507
545
  export const uint = TSL.uint;
508
546
  export const uniform = TSL.uniform;
509
- export const uniformCubeTexture = TSL.uniformCubeTexture;
510
547
  export const uniformArray = TSL.uniformArray;
548
+ export const uniformCubeTexture = TSL.uniformCubeTexture;
511
549
  export const uniformGroup = TSL.uniformGroup;
512
550
  export const uniformTexture = TSL.uniformTexture;
513
- export const uniforms = TSL.uniforms;
514
551
  export const unpremultiplyAlpha = TSL.unpremultiplyAlpha;
515
552
  export const userData = TSL.userData;
516
553
  export const uv = TSL.uv;
517
554
  export const uvec2 = TSL.uvec2;
518
555
  export const uvec3 = TSL.uvec3;
519
556
  export const uvec4 = TSL.uvec4;
520
- export const Var = TSL.Var;
521
557
  export const varying = TSL.varying;
522
558
  export const varyingProperty = TSL.varyingProperty;
523
559
  export const vec2 = TSL.vec2;
@@ -527,12 +563,12 @@ export const vectorComponents = TSL.vectorComponents;
527
563
  export const velocity = TSL.velocity;
528
564
  export const vertexColor = TSL.vertexColor;
529
565
  export const vertexIndex = TSL.vertexIndex;
566
+ export const vertexStage = TSL.vertexStage;
530
567
  export const vibrance = TSL.vibrance;
531
568
  export const viewZToLogarithmicDepth = TSL.viewZToLogarithmicDepth;
532
569
  export const viewZToOrthographicDepth = TSL.viewZToOrthographicDepth;
533
570
  export const viewZToPerspectiveDepth = TSL.viewZToPerspectiveDepth;
534
571
  export const viewport = TSL.viewport;
535
- export const viewportBottomLeft = TSL.viewportBottomLeft;
536
572
  export const viewportCoordinate = TSL.viewportCoordinate;
537
573
  export const viewportDepthTexture = TSL.viewportDepthTexture;
538
574
  export const viewportLinearDepth = TSL.viewportLinearDepth;
@@ -542,7 +578,6 @@ export const viewportSafeUV = TSL.viewportSafeUV;
542
578
  export const viewportSharedTexture = TSL.viewportSharedTexture;
543
579
  export const viewportSize = TSL.viewportSize;
544
580
  export const viewportTexture = TSL.viewportTexture;
545
- export const viewportTopLeft = TSL.viewportTopLeft;
546
581
  export const viewportUV = TSL.viewportUV;
547
582
  export const wgsl = TSL.wgsl;
548
583
  export const wgslFn = TSL.wgslFn;
@@ -551,3 +586,17 @@ export const workgroupBarrier = TSL.workgroupBarrier;
551
586
  export const workgroupId = TSL.workgroupId;
552
587
  export const workingToColorSpace = TSL.workingToColorSpace;
553
588
  export const xor = TSL.xor;
589
+
590
+ /*
591
+ // Use this code to generate the export statements dynamically
592
+
593
+ let code = '';
594
+
595
+ for ( const key of Object.keys( THREE.TSL ) ) {
596
+
597
+ code += `export const ${ key } = TSL.${ key };\n`;
598
+
599
+ }
600
+
601
+ console.log( code );
602
+ //*/
@@ -20,7 +20,7 @@ class KeyframeTrack {
20
20
  *
21
21
  * @param {string} name - The keyframe track's name.
22
22
  * @param {Array<number>} times - A list of keyframe times.
23
- * @param {Array<number>} values - A list of keyframe values.
23
+ * @param {Array<number|string|boolean>} values - A list of keyframe values.
24
24
  * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type.
25
25
  */
26
26
  constructor( name, times, values, interpolation ) {
@@ -16,7 +16,7 @@ class BooleanKeyframeTrack extends KeyframeTrack {
16
16
  *
17
17
  * @param {string} name - The keyframe track's name.
18
18
  * @param {Array<number>} times - A list of keyframe times.
19
- * @param {Array<number>} values - A list of keyframe values.
19
+ * @param {Array<boolean>} values - A list of keyframe values.
20
20
  */
21
21
  constructor( name, times, values ) {
22
22
 
@@ -16,7 +16,7 @@ class StringKeyframeTrack extends KeyframeTrack {
16
16
  *
17
17
  * @param {string} name - The keyframe track's name.
18
18
  * @param {Array<number>} times - A list of keyframe times.
19
- * @param {Array<number>} values - A list of keyframe values.
19
+ * @param {Array<string>} values - A list of keyframe values.
20
20
  */
21
21
  constructor( name, times, values ) {
22
22
 
@@ -57,6 +57,20 @@ class Camera extends Object3D {
57
57
  */
58
58
  this.coordinateSystem = WebGLCoordinateSystem;
59
59
 
60
+ this._reversedDepth = false;
61
+
62
+ }
63
+
64
+ /**
65
+ * The flag that indicates whether the camera uses a reversed depth buffer.
66
+ *
67
+ * @type {boolean}
68
+ * @default false
69
+ */
70
+ get reversedDepth() {
71
+
72
+ return this._reversedDepth;
73
+
60
74
  }
61
75
 
62
76
  copy( source, recursive ) {
@@ -216,7 +216,7 @@ class OrthographicCamera extends Camera {
216
216
 
217
217
  }
218
218
 
219
- this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem );
219
+ this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far, this.coordinateSystem, this.reversedDepth );
220
220
 
221
221
  this.projectionMatrixInverse.copy( this.projectionMatrix ).invert();
222
222
 
@@ -374,7 +374,7 @@ class PerspectiveCamera extends Camera {
374
374
  const skew = this.filmOffset;
375
375
  if ( skew !== 0 ) left += near * skew / this.getFilmWidth();
376
376
 
377
- this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem );
377
+ this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far, this.coordinateSystem, this.reversedDepth );
378
378
 
379
379
  this.projectionMatrixInverse.copy( this.projectionMatrix ).invert();
380
380
 
package/src/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const REVISION = '178';
1
+ export const REVISION = '179';
2
2
 
3
3
  /**
4
4
  * Represents mouse buttons and interaction types in context of controls.
@@ -11,8 +11,6 @@
11
11
  * const timer = new Timer();
12
12
  * timer.connect( document ); // use Page Visibility API
13
13
  * ```
14
- *
15
- * @three_import import { Timer } from 'three/addons/misc/Timer.js';
16
14
  */
17
15
  class Timer {
18
16
 
@@ -23,7 +21,7 @@ class Timer {
23
21
 
24
22
  this._previousTime = 0;
25
23
  this._currentTime = 0;
26
- this._startTime = now();
24
+ this._startTime = performance.now();
27
25
 
28
26
  this._delta = 0;
29
27
  this._elapsed = 0;
@@ -129,7 +127,7 @@ class Timer {
129
127
  */
130
128
  reset() {
131
129
 
132
- this._currentTime = now() - this._startTime;
130
+ this._currentTime = performance.now() - this._startTime;
133
131
 
134
132
  return this;
135
133
 
@@ -164,7 +162,7 @@ class Timer {
164
162
  } else {
165
163
 
166
164
  this._previousTime = this._currentTime;
167
- this._currentTime = ( timestamp !== undefined ? timestamp : now() ) - this._startTime;
165
+ this._currentTime = ( timestamp !== undefined ? timestamp : performance.now() ) - this._startTime;
168
166
 
169
167
  this._delta = ( this._currentTime - this._previousTime ) * this._timescale;
170
168
  this._elapsed += this._delta; // _elapsed is the accumulation of all previous deltas
@@ -177,46 +175,10 @@ class Timer {
177
175
 
178
176
  }
179
177
 
180
- /**
181
- * A special version of a timer with a fixed time delta value.
182
- * Can be useful for testing and debugging purposes.
183
- *
184
- * @augments Timer
185
- */
186
- class FixedTimer extends Timer {
187
-
188
- /**
189
- * Constructs a new timer.
190
- *
191
- * @param {number} [fps=60] - The fixed FPS of this timer.
192
- */
193
- constructor( fps = 60 ) {
194
-
195
- super();
196
- this._delta = ( 1 / fps ) * 1000;
197
-
198
- }
199
-
200
- update() {
201
-
202
- this._elapsed += ( this._delta * this._timescale ); // _elapsed is the accumulation of all previous deltas
203
-
204
- return this;
205
-
206
- }
207
-
208
- }
209
-
210
- function now() {
211
-
212
- return performance.now();
213
-
214
- }
215
-
216
178
  function handleVisibilityChange() {
217
179
 
218
180
  if ( this._document.hidden === false ) this.reset();
219
181
 
220
182
  }
221
183
 
222
- export { Timer, FixedTimer };
184
+ export { Timer };
@@ -347,6 +347,17 @@ class PMREMGenerator {
347
347
  renderer.toneMapping = NoToneMapping;
348
348
  renderer.autoClear = false;
349
349
 
350
+ // https://github.com/mrdoob/three.js/issues/31413#issuecomment-3095966812
351
+ const reversedDepthBuffer = renderer.state.buffers.depth.getReversed();
352
+
353
+ if ( reversedDepthBuffer ) {
354
+
355
+ renderer.setRenderTarget( cubeUVRenderTarget );
356
+ renderer.clearDepth();
357
+ renderer.setRenderTarget( null );
358
+
359
+ }
360
+
350
361
  const backgroundMaterial = new MeshBasicMaterial( {
351
362
  name: 'PMREM.Background',
352
363
  side: BackSide,
@@ -5,7 +5,7 @@ import { Color } from '../math/Color.js';
5
5
  import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
6
6
  import { BufferGeometry } from '../core/BufferGeometry.js';
7
7
  import { Float32BufferAttribute } from '../core/BufferAttribute.js';
8
- import { WebGLCoordinateSystem } from '../constants.js';
8
+ import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from '../constants.js';
9
9
 
10
10
  const _vector = /*@__PURE__*/ new Vector3();
11
11
  const _camera = /*@__PURE__*/ new Camera();
@@ -159,6 +159,7 @@ class CameraHelper extends LineSegments {
159
159
  * @param {Color} up - The up line color.
160
160
  * @param {Color} target - The target line color.
161
161
  * @param {Color} cross - The cross line color.
162
+ * @return {CameraHelper} A reference to this helper.
162
163
  */
163
164
  setColors( frustum, cone, up, target, cross ) {
164
165
 
@@ -215,6 +216,8 @@ class CameraHelper extends LineSegments {
215
216
 
216
217
  colorAttribute.needsUpdate = true;
217
218
 
219
+ return this;
220
+
218
221
  }
219
222
 
220
223
  /**
@@ -227,17 +230,44 @@ class CameraHelper extends LineSegments {
227
230
 
228
231
  const w = 1, h = 1;
229
232
 
233
+ let nearZ, farZ;
234
+
230
235
  // we need just camera projection matrix inverse
231
236
  // world matrix must be identity
232
237
 
233
238
  _camera.projectionMatrixInverse.copy( this.camera.projectionMatrixInverse );
234
239
 
235
240
  // Adjust z values based on coordinate system
236
- const nearZ = this.camera.coordinateSystem === WebGLCoordinateSystem ? - 1 : 0;
241
+
242
+ if ( this.camera.reversedDepth === true ) {
243
+
244
+ nearZ = 1;
245
+ farZ = 0;
246
+
247
+ } else {
248
+
249
+ if ( this.camera.coordinateSystem === WebGLCoordinateSystem ) {
250
+
251
+ nearZ = - 1;
252
+ farZ = 1;
253
+
254
+ } else if ( this.camera.coordinateSystem === WebGPUCoordinateSystem ) {
255
+
256
+ nearZ = 0;
257
+ farZ = 1;
258
+
259
+ } else {
260
+
261
+ throw new Error( 'THREE.CameraHelper.update(): Invalid coordinate system: ' + this.camera.coordinateSystem );
262
+
263
+ }
264
+
265
+ }
266
+
237
267
 
238
268
  // center / target
239
269
  setPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );
240
- setPoint( 't', pointMap, geometry, _camera, 0, 0, 1 );
270
+ setPoint( 't', pointMap, geometry, _camera, 0, 0, farZ );
241
271
 
242
272
  // near
243
273
 
@@ -248,10 +278,10 @@ class CameraHelper extends LineSegments {
248
278
 
249
279
  // far
250
280
 
251
- setPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 );
252
- setPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 );
253
- setPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 );
254
- setPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );
281
+ setPoint( 'f1', pointMap, geometry, _camera, - w, - h, farZ );
282
+ setPoint( 'f2', pointMap, geometry, _camera, w, - h, farZ );
283
+ setPoint( 'f3', pointMap, geometry, _camera, - w, h, farZ );
284
+ setPoint( 'f4', pointMap, geometry, _camera, w, h, farZ );
255
285
 
256
286
  // up
257
287
 
@@ -261,10 +291,10 @@ class CameraHelper extends LineSegments {
261
291
 
262
292
  // cross
263
293
 
264
- setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 );
265
- setPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );
266
- setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 );
267
- setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );
294
+ setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, farZ );
295
+ setPoint( 'cf2', pointMap, geometry, _camera, w, 0, farZ );
296
+ setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, farZ );
297
+ setPoint( 'cf4', pointMap, geometry, _camera, 0, h, farZ );
268
298
 
269
299
  setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, nearZ );
270
300
  setPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );
@@ -23,7 +23,7 @@ const _matrixWorldInv = /*@__PURE__*/ new Matrix4();
23
23
  class SkeletonHelper extends LineSegments {
24
24
 
25
25
  /**
26
- * Constructs a new hemisphere light helper.
26
+ * Constructs a new skeleton helper.
27
27
  *
28
28
  * @param {Object3D} object - Usually an instance of {@link SkinnedMesh}. However, any 3D object
29
29
  * can be used if it represents a hierarchy of bones (see {@link Bone}).
@@ -37,9 +37,6 @@ class SkeletonHelper extends LineSegments {
37
37
  const vertices = [];
38
38
  const colors = [];
39
39
 
40
- const color1 = new Color( 0, 0, 1 );
41
- const color2 = new Color( 0, 1, 0 );
42
-
43
40
  for ( let i = 0; i < bones.length; i ++ ) {
44
41
 
45
42
  const bone = bones[ i ];
@@ -48,8 +45,8 @@ class SkeletonHelper extends LineSegments {
48
45
 
49
46
  vertices.push( 0, 0, 0 );
50
47
  vertices.push( 0, 0, 0 );
51
- colors.push( color1.r, color1.g, color1.b );
52
- colors.push( color2.r, color2.g, color2.b );
48
+ colors.push( 0, 0, 0 );
49
+ colors.push( 0, 0, 0 );
53
50
 
54
51
  }
55
52
 
@@ -90,6 +87,13 @@ class SkeletonHelper extends LineSegments {
90
87
  this.matrix = object.matrixWorld;
91
88
  this.matrixAutoUpdate = false;
92
89
 
90
+ // colors
91
+
92
+ const color1 = new Color( 0x0000ff );
93
+ const color2 = new Color( 0x00ff00 );
94
+
95
+ this.setColors( color1, color2 );
96
+
93
97
  }
94
98
 
95
99
  updateMatrixWorld( force ) {
@@ -127,6 +131,31 @@ class SkeletonHelper extends LineSegments {
127
131
 
128
132
  }
129
133
 
134
+ /**
135
+ * Defines the colors of the helper.
136
+ *
137
+ * @param {Color} color1 - The first line color for each bone.
138
+ * @param {Color} color2 - The second line color for each bone.
139
+ * @return {SkeletonHelper} A reference to this helper.
140
+ */
141
+ setColors( color1, color2 ) {
142
+
143
+ const geometry = this.geometry;
144
+ const colorAttribute = geometry.getAttribute( 'color' );
145
+
146
+ for ( let i = 0; i < colorAttribute.count; i += 2 ) {
147
+
148
+ colorAttribute.setXYZ( i, color1.r, color1.g, color1.b );
149
+ colorAttribute.setXYZ( i + 1, color2.r, color2.g, color2.b );
150
+
151
+ }
152
+
153
+ colorAttribute.needsUpdate = true;
154
+
155
+ return this;
156
+
157
+ }
158
+
130
159
  /**
131
160
  * Frees the GPU-related resources allocated by this instance. Call this
132
161
  * method whenever this instance is no longer used in your app.