@plastic-software/three 0.181.2 → 0.182.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 (253) hide show
  1. package/README.md +3 -4
  2. package/build/three.cjs +1192 -522
  3. package/build/three.core.js +345 -219
  4. package/build/three.core.min.js +1 -1
  5. package/build/three.module.js +864 -328
  6. package/build/three.module.min.js +1 -1
  7. package/build/three.tsl.js +15 -3
  8. package/build/three.tsl.min.js +1 -1
  9. package/build/three.webgpu.js +3660 -1545
  10. package/build/three.webgpu.min.js +1 -1
  11. package/build/three.webgpu.nodes.js +3659 -1544
  12. package/build/three.webgpu.nodes.min.js +1 -1
  13. package/examples/jsm/controls/MapControls.js +55 -1
  14. package/examples/jsm/controls/OrbitControls.js +6 -6
  15. package/examples/jsm/controls/TrackballControls.js +6 -6
  16. package/examples/jsm/csm/CSM.js +2 -1
  17. package/examples/jsm/environments/RoomEnvironment.js +2 -0
  18. package/examples/jsm/geometries/DecalGeometry.js +1 -1
  19. package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -1
  20. package/examples/jsm/helpers/TextureHelperGPU.js +1 -1
  21. package/examples/jsm/inspector/Inspector.js +53 -9
  22. package/examples/jsm/inspector/RendererInspector.js +12 -2
  23. package/examples/jsm/inspector/tabs/Console.js +2 -2
  24. package/examples/jsm/inspector/tabs/Parameters.js +2 -2
  25. package/examples/jsm/inspector/tabs/Performance.js +2 -2
  26. package/examples/jsm/inspector/tabs/Viewer.js +4 -4
  27. package/examples/jsm/inspector/ui/Profiler.js +1836 -31
  28. package/examples/jsm/inspector/ui/Style.js +948 -13
  29. package/examples/jsm/inspector/ui/Tab.js +188 -1
  30. package/examples/jsm/inspector/ui/Values.js +17 -1
  31. package/examples/jsm/loaders/3DMLoader.js +5 -4
  32. package/examples/jsm/loaders/DRACOLoader.js +5 -5
  33. package/examples/jsm/loaders/FBXLoader.js +0 -2
  34. package/examples/jsm/loaders/HDRLoader.js +0 -1
  35. package/examples/jsm/loaders/KTX2Loader.js +16 -0
  36. package/examples/jsm/loaders/LDrawLoader.js +2 -3
  37. package/examples/jsm/loaders/PCDLoader.js +1 -0
  38. package/examples/jsm/loaders/SVGLoader.js +1 -1
  39. package/examples/jsm/loaders/TDSLoader.js +0 -2
  40. package/examples/jsm/loaders/TGALoader.js +0 -2
  41. package/examples/jsm/loaders/UltraHDRLoader.js +110 -137
  42. package/examples/jsm/loaders/VOXLoader.js +660 -117
  43. package/examples/jsm/loaders/VRMLLoader.js +2 -2
  44. package/examples/jsm/loaders/usd/USDCParser.js +1 -1
  45. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -1
  46. package/examples/jsm/materials/MeshGouraudMaterial.js +0 -1
  47. package/examples/jsm/materials/WoodNodeMaterial.js +11 -11
  48. package/examples/jsm/math/Octree.js +131 -1
  49. package/examples/jsm/misc/Volume.js +0 -1
  50. package/examples/jsm/misc/VolumeSlice.js +0 -1
  51. package/examples/jsm/objects/SkyMesh.js +13 -3
  52. package/examples/jsm/physics/AmmoPhysics.js +12 -7
  53. package/examples/jsm/physics/JoltPhysics.js +3 -1
  54. package/examples/jsm/physics/RapierPhysics.js +3 -1
  55. package/examples/jsm/postprocessing/OutputPass.js +9 -0
  56. package/examples/jsm/postprocessing/RenderPass.js +10 -0
  57. package/examples/jsm/postprocessing/UnrealBloomPass.js +48 -18
  58. package/examples/jsm/renderers/Projector.js +268 -30
  59. package/examples/jsm/renderers/SVGRenderer.js +191 -58
  60. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -4
  61. package/examples/jsm/transpiler/AST.js +44 -0
  62. package/examples/jsm/transpiler/GLSLDecoder.js +61 -4
  63. package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -0
  64. package/examples/jsm/transpiler/TSLEncoder.js +46 -3
  65. package/examples/jsm/transpiler/TranspilerUtils.js +3 -3
  66. package/examples/jsm/transpiler/WGSLEncoder.js +27 -0
  67. package/examples/jsm/tsl/display/AnaglyphPassNode.js +2 -0
  68. package/examples/jsm/tsl/display/BloomNode.js +11 -1
  69. package/examples/jsm/tsl/display/GTAONode.js +3 -2
  70. package/examples/jsm/tsl/display/PixelationPassNode.js +2 -1
  71. package/examples/jsm/tsl/display/SSGINode.js +7 -19
  72. package/examples/jsm/tsl/display/SSRNode.js +1 -1
  73. package/examples/jsm/tsl/display/SSSNode.js +4 -2
  74. package/examples/jsm/tsl/display/StereoCompositePassNode.js +8 -1
  75. package/examples/jsm/tsl/display/TRAANode.js +265 -114
  76. package/examples/jsm/tsl/display/radialBlur.js +68 -0
  77. package/examples/jsm/utils/ShadowMapViewer.js +24 -10
  78. package/examples/jsm/utils/ShadowMapViewerGPU.js +1 -1
  79. package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
  80. package/package.json +14 -12
  81. package/src/Three.Core.js +1 -0
  82. package/src/Three.TSL.js +14 -2
  83. package/src/animation/AnimationUtils.js +1 -12
  84. package/src/animation/KeyframeTrack.js +1 -1
  85. package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
  86. package/src/animation/tracks/ColorKeyframeTrack.js +1 -1
  87. package/src/animation/tracks/NumberKeyframeTrack.js +1 -1
  88. package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -1
  89. package/src/animation/tracks/StringKeyframeTrack.js +1 -1
  90. package/src/animation/tracks/VectorKeyframeTrack.js +1 -1
  91. package/src/constants.js +61 -5
  92. package/src/core/BufferGeometry.js +14 -2
  93. package/src/core/Raycaster.js +2 -2
  94. package/src/extras/PMREMGenerator.js +3 -10
  95. package/src/extras/TextureUtils.js +5 -1
  96. package/src/geometries/ExtrudeGeometry.js +2 -2
  97. package/src/geometries/PolyhedronGeometry.js +1 -1
  98. package/src/helpers/PointLightHelper.js +1 -1
  99. package/src/lights/DirectionalLight.js +13 -0
  100. package/src/lights/HemisphereLight.js +10 -0
  101. package/src/lights/Light.js +1 -11
  102. package/src/lights/LightProbe.js +0 -15
  103. package/src/lights/LightShadow.js +0 -3
  104. package/src/lights/PointLight.js +15 -0
  105. package/src/lights/PointLightShadow.js +0 -86
  106. package/src/lights/SpotLight.js +22 -1
  107. package/src/loaders/MaterialLoader.js +2 -1
  108. package/src/loaders/ObjectLoader.js +3 -1
  109. package/src/loaders/nodes/NodeLoader.js +2 -2
  110. package/src/materials/Material.js +2 -0
  111. package/src/materials/ShaderMaterial.js +20 -1
  112. package/src/materials/nodes/Line2NodeMaterial.js +2 -2
  113. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +3 -2
  114. package/src/materials/nodes/MeshStandardNodeMaterial.js +5 -4
  115. package/src/materials/nodes/NodeMaterial.js +59 -3
  116. package/src/materials/nodes/manager/NodeMaterialObserver.js +1 -1
  117. package/src/math/Matrix4.js +40 -40
  118. package/src/math/Sphere.js +1 -1
  119. package/src/math/Vector3.js +0 -2
  120. package/src/nodes/TSL.js +4 -1
  121. package/src/nodes/accessors/BatchNode.js +10 -10
  122. package/src/nodes/accessors/BufferAttributeNode.js +98 -12
  123. package/src/nodes/accessors/BufferNode.js +29 -2
  124. package/src/nodes/accessors/ClippingNode.js +4 -4
  125. package/src/nodes/accessors/CubeTextureNode.js +20 -1
  126. package/src/nodes/accessors/InstanceNode.js +69 -29
  127. package/src/nodes/accessors/MaterialNode.js +9 -1
  128. package/src/nodes/accessors/MaterialReferenceNode.js +1 -2
  129. package/src/nodes/accessors/ModelNode.js +1 -1
  130. package/src/nodes/accessors/Normal.js +2 -2
  131. package/src/nodes/accessors/ReferenceBaseNode.js +4 -4
  132. package/src/nodes/accessors/ReferenceNode.js +4 -4
  133. package/src/nodes/accessors/RendererReferenceNode.js +1 -2
  134. package/src/nodes/accessors/SkinningNode.js +15 -2
  135. package/src/nodes/accessors/StorageBufferNode.js +4 -2
  136. package/src/nodes/accessors/Tangent.js +1 -11
  137. package/src/nodes/accessors/Texture3DNode.js +26 -1
  138. package/src/nodes/accessors/UniformArrayNode.js +2 -2
  139. package/src/nodes/accessors/UserDataNode.js +1 -2
  140. package/src/nodes/accessors/VertexColorNode.js +1 -2
  141. package/src/nodes/code/FunctionNode.js +1 -2
  142. package/src/nodes/core/ArrayNode.js +20 -1
  143. package/src/nodes/core/AssignNode.js +2 -2
  144. package/src/nodes/core/AttributeNode.js +2 -2
  145. package/src/nodes/core/ContextNode.js +103 -4
  146. package/src/nodes/core/NodeBuilder.js +56 -14
  147. package/src/nodes/core/NodeFrame.js +12 -4
  148. package/src/nodes/core/NodeUtils.js +5 -5
  149. package/src/nodes/core/ParameterNode.js +1 -2
  150. package/src/nodes/core/PropertyNode.js +19 -3
  151. package/src/nodes/core/StackNode.js +56 -8
  152. package/src/nodes/core/StructNode.js +1 -2
  153. package/src/nodes/core/StructTypeNode.js +11 -17
  154. package/src/nodes/core/UniformNode.js +19 -4
  155. package/src/nodes/core/VarNode.js +46 -21
  156. package/src/nodes/display/NormalMapNode.js +37 -2
  157. package/src/nodes/display/PassNode.js +77 -7
  158. package/src/nodes/display/ScreenNode.js +1 -0
  159. package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +3 -3
  160. package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
  161. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  162. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +1 -1
  163. package/src/nodes/functions/PhysicalLightingModel.js +102 -43
  164. package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -2
  165. package/src/nodes/gpgpu/SubgroupFunctionNode.js +1 -1
  166. package/src/nodes/gpgpu/WorkgroupInfoNode.js +2 -3
  167. package/src/nodes/lighting/AnalyticLightNode.js +53 -0
  168. package/src/nodes/lighting/LightsNode.js +2 -2
  169. package/src/nodes/lighting/PointShadowNode.js +141 -140
  170. package/src/nodes/lighting/ShadowFilterNode.js +53 -37
  171. package/src/nodes/lighting/ShadowNode.js +53 -19
  172. package/src/nodes/math/BitcountNode.js +433 -0
  173. package/src/nodes/math/PackFloatNode.js +98 -0
  174. package/src/nodes/math/UnpackFloatNode.js +96 -0
  175. package/src/nodes/pmrem/PMREMNode.js +1 -1
  176. package/src/nodes/tsl/TSLCore.js +4 -4
  177. package/src/nodes/utils/ArrayElementNode.js +13 -0
  178. package/src/nodes/utils/EventNode.js +1 -2
  179. package/src/nodes/utils/Packing.js +13 -1
  180. package/src/nodes/utils/PostProcessingUtils.js +33 -1
  181. package/src/nodes/utils/ReflectorNode.js +1 -1
  182. package/src/nodes/utils/SampleNode.js +1 -1
  183. package/src/nodes/utils/UVUtils.js +26 -0
  184. package/src/objects/BatchedMesh.js +5 -2
  185. package/src/objects/Line.js +1 -1
  186. package/src/objects/Mesh.js +1 -1
  187. package/src/objects/Points.js +1 -1
  188. package/src/objects/Skeleton.js +9 -0
  189. package/src/renderers/WebGLRenderer.js +145 -33
  190. package/src/renderers/common/Backend.js +8 -0
  191. package/src/renderers/common/Background.js +19 -9
  192. package/src/renderers/common/Binding.js +11 -0
  193. package/src/renderers/common/Bindings.js +7 -7
  194. package/src/renderers/common/Buffer.js +40 -0
  195. package/src/renderers/common/ChainMap.js +30 -6
  196. package/src/renderers/common/Geometries.js +12 -0
  197. package/src/renderers/common/RenderContexts.js +8 -1
  198. package/src/renderers/common/RenderObject.js +14 -1
  199. package/src/renderers/common/Renderer.js +53 -35
  200. package/src/renderers/common/Textures.js +1 -1
  201. package/src/renderers/common/UniformsGroup.js +1 -0
  202. package/src/renderers/common/XRManager.js +1 -0
  203. package/src/renderers/common/extras/PMREMGenerator.js +2 -8
  204. package/src/renderers/common/nodes/NodeUniformBuffer.js +52 -0
  205. package/src/renderers/shaders/DFGLUTData.js +19 -34
  206. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +5 -2
  207. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
  208. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +90 -51
  209. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +194 -186
  210. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
  211. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  212. package/src/renderers/shaders/ShaderChunk.js +3 -3
  213. package/src/renderers/shaders/ShaderLib/depth.glsl.js +3 -0
  214. package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
  215. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +0 -1
  216. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
  217. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -1
  218. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
  219. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
  220. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +0 -1
  221. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
  222. package/src/renderers/shaders/ShaderLib.js +3 -3
  223. package/src/renderers/webgl/WebGLCapabilities.js +3 -4
  224. package/src/renderers/webgl/WebGLLights.js +18 -1
  225. package/src/renderers/webgl/WebGLOutput.js +267 -0
  226. package/src/renderers/webgl/WebGLProgram.js +43 -107
  227. package/src/renderers/webgl/WebGLPrograms.js +35 -45
  228. package/src/renderers/webgl/WebGLShadowMap.js +188 -25
  229. package/src/renderers/webgl/WebGLState.js +20 -20
  230. package/src/renderers/webgl/WebGLTextures.js +89 -28
  231. package/src/renderers/webgl/WebGLUniforms.js +40 -3
  232. package/src/renderers/webgl/WebGLUtils.js +6 -2
  233. package/src/renderers/webgl-fallback/WebGLBackend.js +79 -13
  234. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +59 -7
  235. package/src/renderers/webgl-fallback/utils/WebGLState.js +18 -3
  236. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +5 -3
  237. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +9 -9
  238. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +6 -2
  239. package/src/renderers/webgpu/WebGPUBackend.js +61 -4
  240. package/src/renderers/webgpu/WebGPURenderer.js +1 -1
  241. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +65 -23
  242. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +4 -17
  243. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +354 -186
  244. package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -0
  245. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +20 -7
  246. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +40 -17
  247. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +7 -7
  248. package/src/renderers/webgpu/utils/WebGPUUtils.js +7 -5
  249. package/src/textures/CubeDepthTexture.js +76 -0
  250. package/src/textures/Source.js +1 -1
  251. package/src/textures/Texture.js +1 -1
  252. package/src/utils.js +13 -1
  253. package/src/nodes/functions/BSDF/DFGApprox.js +0 -71
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plastic-software/three",
3
- "version": "0.181.2",
3
+ "version": "0.182.0",
4
4
  "description": "JavaScript 3D library",
5
5
  "type": "module",
6
6
  "main": "./build/three.cjs",
@@ -53,14 +53,13 @@
53
53
  "preview": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8080\"",
54
54
  "preview-ssl": "concurrently --names \"ROLLUP,HTTPS\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"servez -p 8080 --ssl\"",
55
55
  "lint-core": "eslint src",
56
- "lint-addons": "eslint examples/jsm --ext .js --ignore-pattern libs --ignore-pattern ifc",
57
- "lint-examples": "eslint examples --ext .html",
58
- "lint-docs": "eslint docs --ignore-pattern prettify.js",
59
- "lint-editor": "eslint editor --ignore-pattern libs",
60
- "lint-playground": "eslint playground --ignore-pattern libs",
61
- "lint-manual": "eslint manual --ignore-pattern 3rdparty --ignore-pattern prettify.js --ignore-pattern shapefile.js",
62
- "lint-test": "eslint test --ignore-pattern vendor",
63
- "lint-utils": "eslint utils --ignore-pattern prettify --ignore-pattern fuse",
56
+ "lint-addons": "eslint examples/jsm",
57
+ "lint-examples": "eslint examples",
58
+ "lint-editor": "eslint editor",
59
+ "lint-playground": "eslint playground",
60
+ "lint-manual": "eslint manual",
61
+ "lint-test": "eslint test",
62
+ "lint-utils": "eslint utils",
64
63
  "lint": "npm run lint-core",
65
64
  "lint-fix": "npm run lint-core -- --fix && npm run lint-addons -- --fix && npm run lint-examples -- --fix && npm run lint-docs -- --fix && npm run lint-editor -- --fix && npm run lint-playground -- --fix && npm run lint-manual -- --fix && npm run lint-test -- --fix && npm run lint-utils -- --fix",
66
65
  "test-unit": "qunit test/unit/three.source.unit.js",
@@ -94,14 +93,17 @@
94
93
  },
95
94
  "homepage": "https://threejs.org/",
96
95
  "devDependencies": {
96
+ "@eslint/js": "^9.0.0",
97
97
  "@rollup/plugin-node-resolve": "^16.0.0",
98
98
  "@rollup/plugin-terser": "^0.4.0",
99
99
  "concurrently": "^9.0.0",
100
- "eslint": "^8.37.0",
100
+ "eslint": "^9.0.0",
101
101
  "eslint-config-mdcs": "^5.0.0",
102
102
  "eslint-plugin-compat": "^6.0.0",
103
- "eslint-plugin-html": "^8.0.0",
104
- "eslint-plugin-import": "^2.27.5",
103
+ "eslint-plugin-html": "^8.1.3",
104
+ "eslint-plugin-import": "^2.32.0",
105
+ "eslint-plugin-jsdoc": "^61.4.1",
106
+ "globals": "^16.5.0",
105
107
  "jimp": "^1.6.0",
106
108
  "jsdoc": "^4.0.5",
107
109
  "magic-string": "^0.30.0",
package/src/Three.Core.js CHANGED
@@ -35,6 +35,7 @@ export { CompressedCubeTexture } from './textures/CompressedCubeTexture.js';
35
35
  export { CubeTexture } from './textures/CubeTexture.js';
36
36
  export { CanvasTexture } from './textures/CanvasTexture.js';
37
37
  export { DepthTexture } from './textures/DepthTexture.js';
38
+ export { CubeDepthTexture } from './textures/CubeDepthTexture.js';
38
39
  export { ExternalTexture } from './textures/ExternalTexture.js';
39
40
  export { Texture } from './textures/Texture.js';
40
41
  export * from './geometries/Geometries.js';
package/src/Three.TSL.js CHANGED
@@ -7,7 +7,7 @@ export const BasicShadowFilter = TSL.BasicShadowFilter;
7
7
  export const Break = TSL.Break;
8
8
  export const Const = TSL.Const;
9
9
  export const Continue = TSL.Continue;
10
- export const DFGApprox = TSL.DFGApprox;
10
+ export const DFGLUT = TSL.DFGLUT;
11
11
  export const D_GGX = TSL.D_GGX;
12
12
  export const Discard = TSL.Discard;
13
13
  export const EPSILON = TSL.EPSILON;
@@ -100,6 +100,8 @@ export const bufferAttribute = TSL.bufferAttribute;
100
100
  export const bumpMap = TSL.bumpMap;
101
101
  export const burn = TSL.burn;
102
102
  export const builtin = TSL.builtin;
103
+ export const builtinAOContext = TSL.builtinAOContext;
104
+ export const builtinShadowContext = TSL.builtinShadowContext;
103
105
  export const bvec2 = TSL.bvec2;
104
106
  export const bvec3 = TSL.bvec3;
105
107
  export const bvec4 = TSL.bvec4;
@@ -136,11 +138,13 @@ export const context = TSL.context;
136
138
  export const convert = TSL.convert;
137
139
  export const convertColorSpace = TSL.convertColorSpace;
138
140
  export const convertToTexture = TSL.convertToTexture;
141
+ export const countLeadingZeros = TSL.countLeadingZeros;
142
+ export const countOneBits = TSL.countOneBits;
143
+ export const countTrailingZeros = TSL.countTrailingZeros;
139
144
  export const cos = TSL.cos;
140
145
  export const cross = TSL.cross;
141
146
  export const cubeTexture = TSL.cubeTexture;
142
147
  export const cubeTextureBase = TSL.cubeTextureBase;
143
- export const cubeToUV = TSL.cubeToUV;
144
148
  export const dFdx = TSL.dFdx;
145
149
  export const dFdy = TSL.dFdy;
146
150
  export const dashSize = TSL.dashSize;
@@ -199,6 +203,7 @@ export const getDistanceAttenuation = TSL.getDistanceAttenuation;
199
203
  export const getGeometryRoughness = TSL.getGeometryRoughness;
200
204
  export const getNormalFromDepth = TSL.getNormalFromDepth;
201
205
  export const interleavedGradientNoise = TSL.interleavedGradientNoise;
206
+ export const vogelDiskSample = TSL.vogelDiskSample;
202
207
  export const getParallaxCorrectNormal = TSL.getParallaxCorrectNormal;
203
208
  export const getRoughness = TSL.getRoughness;
204
209
  export const getScreenPosition = TSL.getScreenPosition;
@@ -414,6 +419,9 @@ export const output = TSL.output;
414
419
  export const outputStruct = TSL.outputStruct;
415
420
  export const overlay = TSL.overlay;
416
421
  export const overloadingFn = TSL.overloadingFn;
422
+ export const packHalf2x16 = TSL.packHalf2x16;
423
+ export const packSnorm2x16 = TSL.packSnorm2x16;
424
+ export const packUnorm2x16 = TSL.packUnorm2x16;
417
425
  export const parabola = TSL.parabola;
418
426
  export const parallaxDirection = TSL.parallaxDirection;
419
427
  export const parallaxUV = TSL.parallaxUV;
@@ -461,6 +469,7 @@ export const remapClamp = TSL.remapClamp;
461
469
  export const renderGroup = TSL.renderGroup;
462
470
  export const renderOutput = TSL.renderOutput;
463
471
  export const rendererReference = TSL.rendererReference;
472
+ export const replaceDefaultUV = TSL.replaceDefaultUV;
464
473
  export const rotate = TSL.rotate;
465
474
  export const rotateUV = TSL.rotateUV;
466
475
  export const roughness = TSL.roughness;
@@ -579,6 +588,9 @@ export const uniformCubeTexture = TSL.uniformCubeTexture;
579
588
  export const uniformGroup = TSL.uniformGroup;
580
589
  export const uniformFlow = TSL.uniformFlow;
581
590
  export const uniformTexture = TSL.uniformTexture;
591
+ export const unpackHalf2x16 = TSL.unpackHalf2x16;
592
+ export const unpackSnorm2x16 = TSL.unpackSnorm2x16;
593
+ export const unpackUnorm2x16 = TSL.unpackUnorm2x16;
582
594
  export const unpremultiplyAlpha = TSL.unpremultiplyAlpha;
583
595
  export const userData = TSL.userData;
584
596
  export const uv = TSL.uv;
@@ -1,5 +1,6 @@
1
1
  import { Quaternion } from '../math/Quaternion.js';
2
2
  import { AdditiveAnimationBlendMode } from '../constants.js';
3
+ import { isTypedArray } from '../utils.js';
3
4
 
4
5
  /**
5
6
  * Converts an array to a specific type.
@@ -22,18 +23,6 @@ function convertArray( array, type ) {
22
23
 
23
24
  }
24
25
 
25
- /**
26
- * Returns `true` if the given object is a typed array.
27
- *
28
- * @param {any} object - The object to check.
29
- * @return {boolean} Whether the given object is a typed array.
30
- */
31
- function isTypedArray( object ) {
32
-
33
- return ArrayBuffer.isView( object ) && ! ( object instanceof DataView );
34
-
35
- }
36
-
37
26
  /**
38
27
  * Returns an array by which times and values can be sorted.
39
28
  *
@@ -565,7 +565,7 @@ class KeyframeTrack {
565
565
  /**
566
566
  * The value type name.
567
567
  *
568
- * @type {String}
568
+ * @type {string}
569
569
  * @default ''
570
570
  */
571
571
  KeyframeTrack.prototype.ValueTypeName = '';
@@ -29,7 +29,7 @@ class BooleanKeyframeTrack extends KeyframeTrack {
29
29
  /**
30
30
  * The value type name.
31
31
  *
32
- * @type {String}
32
+ * @type {string}
33
33
  * @default 'bool'
34
34
  */
35
35
  BooleanKeyframeTrack.prototype.ValueTypeName = 'bool';
@@ -26,7 +26,7 @@ class ColorKeyframeTrack extends KeyframeTrack {
26
26
  /**
27
27
  * The value type name.
28
28
  *
29
- * @type {String}
29
+ * @type {string}
30
30
  * @default 'color'
31
31
  */
32
32
  ColorKeyframeTrack.prototype.ValueTypeName = 'color';
@@ -26,7 +26,7 @@ class NumberKeyframeTrack extends KeyframeTrack {
26
26
  /**
27
27
  * The value type name.
28
28
  *
29
- * @type {String}
29
+ * @type {string}
30
30
  * @default 'number'
31
31
  */
32
32
  NumberKeyframeTrack.prototype.ValueTypeName = 'number';
@@ -40,7 +40,7 @@ class QuaternionKeyframeTrack extends KeyframeTrack {
40
40
  /**
41
41
  * The value type name.
42
42
  *
43
- * @type {String}
43
+ * @type {string}
44
44
  * @default 'quaternion'
45
45
  */
46
46
  QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';
@@ -29,7 +29,7 @@ class StringKeyframeTrack extends KeyframeTrack {
29
29
  /**
30
30
  * The value type name.
31
31
  *
32
- * @type {String}
32
+ * @type {string}
33
33
  * @default 'string'
34
34
  */
35
35
  StringKeyframeTrack.prototype.ValueTypeName = 'string';
@@ -26,7 +26,7 @@ class VectorKeyframeTrack extends KeyframeTrack {
26
26
  /**
27
27
  * The value type name.
28
28
  *
29
- * @type {String}
29
+ * @type {string}
30
30
  * @default 'vector'
31
31
  */
32
32
  VectorKeyframeTrack.prototype.ValueTypeName = 'vector';
package/src/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- export const REVISION = '181';
1
+ export const REVISION = '182';
2
2
 
3
3
  /**
4
4
  * Represents mouse buttons and interaction types in context of controls.
@@ -910,6 +910,38 @@ export const RGB_ETC2_Format = 37492;
910
910
  */
911
911
  export const RGBA_ETC2_EAC_Format = 37496;
912
912
 
913
+ /**
914
+ * EAC R11 UNORM format.
915
+ *
916
+ * @type {number}
917
+ * @constant
918
+ */
919
+ export const R11_EAC_Format = 37488; // 0x9270
920
+
921
+ /**
922
+ * EAC R11 SNORM format.
923
+ *
924
+ * @type {number}
925
+ * @constant
926
+ */
927
+ export const SIGNED_R11_EAC_Format = 37489; // 0x9271
928
+
929
+ /**
930
+ * EAC RG11 UNORM format.
931
+ *
932
+ * @type {number}
933
+ * @constant
934
+ */
935
+ export const RG11_EAC_Format = 37490; // 0x9272
936
+
937
+ /**
938
+ * EAC RG11 SNORM format.
939
+ *
940
+ * @type {number}
941
+ * @constant
942
+ */
943
+ export const SIGNED_RG11_EAC_Format = 37491; // 0x9273
944
+
913
945
  /**
914
946
  * ASTC RGBA 4x4 format.
915
947
  *
@@ -1194,7 +1226,7 @@ export const TriangleStripDrawMode = 1;
1194
1226
  export const TriangleFanDrawMode = 2;
1195
1227
 
1196
1228
  /**
1197
- * Basic depth packing.
1229
+ * The depth value is inverted (1.0 - z) for visualization purposes.
1198
1230
  *
1199
1231
  * @type {number}
1200
1232
  * @constant
@@ -1202,7 +1234,7 @@ export const TriangleFanDrawMode = 2;
1202
1234
  export const BasicDepthPacking = 3200;
1203
1235
 
1204
1236
  /**
1205
- * A depth value is packed into 32 bit RGBA.
1237
+ * The depth value is packed into 32 bit RGBA.
1206
1238
  *
1207
1239
  * @type {number}
1208
1240
  * @constant
@@ -1210,7 +1242,7 @@ export const BasicDepthPacking = 3200;
1210
1242
  export const RGBADepthPacking = 3201;
1211
1243
 
1212
1244
  /**
1213
- * A depth value is packed into 24 bit RGB.
1245
+ * The depth value is packed into 24 bit RGB.
1214
1246
  *
1215
1247
  * @type {number}
1216
1248
  * @constant
@@ -1218,7 +1250,7 @@ export const RGBADepthPacking = 3201;
1218
1250
  export const RGBDepthPacking = 3202;
1219
1251
 
1220
1252
  /**
1221
- * A depth value is packed into 16 bit RG.
1253
+ * The depth value is packed into 16 bit RG.
1222
1254
  *
1223
1255
  * @type {number}
1224
1256
  * @constant
@@ -1283,6 +1315,30 @@ export const LinearTransfer = 'linear';
1283
1315
  */
1284
1316
  export const SRGBTransfer = 'srgb';
1285
1317
 
1318
+ /**
1319
+ * No normal map packing.
1320
+ *
1321
+ * @type {string}
1322
+ * @constant
1323
+ */
1324
+ export const NoNormalPacking = '';
1325
+
1326
+ /**
1327
+ * Normal RG packing.
1328
+ *
1329
+ * @type {string}
1330
+ * @constant
1331
+ */
1332
+ export const NormalRGPacking = 'rg';
1333
+
1334
+ /**
1335
+ * Normal GA packing.
1336
+ *
1337
+ * @type {string}
1338
+ * @constant
1339
+ */
1340
+ export const NormalGAPacking = 'ga';
1341
+
1286
1342
  /**
1287
1343
  * Sets the stencil buffer value to `0`.
1288
1344
  *
@@ -111,6 +111,16 @@ class BufferGeometry extends EventDispatcher {
111
111
  */
112
112
  this.indirect = null;
113
113
 
114
+ /**
115
+ * The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset.
116
+ *
117
+ * Can only be used with {@link WebGPURenderer} and a WebGPU backend.
118
+ *
119
+ * @type {number|Array<number>}
120
+ * @default 0
121
+ */
122
+ this.indirectOffset = 0;
123
+
114
124
  /**
115
125
  * This dictionary has as id the name of the attribute to be set and as value
116
126
  * the buffer attribute to set it to. Rather than accessing this property directly,
@@ -124,7 +134,7 @@ class BufferGeometry extends EventDispatcher {
124
134
  * This dictionary holds the morph targets of the geometry.
125
135
  *
126
136
  * Note: Once the geometry has been rendered, the morph attribute data cannot
127
- * be changed. You will have to call `dispose()?, and create a new geometry instance.
137
+ * be changed. You will have to call `dispose()`, and create a new geometry instance.
128
138
  *
129
139
  * @type {Object}
130
140
  */
@@ -224,11 +234,13 @@ class BufferGeometry extends EventDispatcher {
224
234
  * Sets the given indirect attribute to this geometry.
225
235
  *
226
236
  * @param {BufferAttribute} indirect - The attribute holding indirect draw calls.
237
+ * @param {number|Array<number>} [indirectOffset=0] - The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset.
227
238
  * @return {BufferGeometry} A reference to this instance.
228
239
  */
229
- setIndirect( indirect ) {
240
+ setIndirect( indirect, indirectOffset = 0 ) {
230
241
 
231
242
  this.indirect = indirect;
243
+ this.indirectOffset = indirectOffset;
232
244
 
233
245
  return this;
234
246
 
@@ -38,7 +38,7 @@ class Raycaster {
38
38
  this.near = near;
39
39
 
40
40
  /**
41
- * All results returned are further away than near. Near can't be negative.
41
+ * All results returned are closer than far. Far can't be lower than near.
42
42
  *
43
43
  * @type {number}
44
44
  * @default Infinity
@@ -167,7 +167,7 @@ class Raycaster {
167
167
  * @property {Object3D} object - The 3D object that has been intersected.
168
168
  * @property {Vector2} uv - U,V coordinates at point of intersection.
169
169
  * @property {Vector2} uv1 - Second set of U,V coordinates at point of intersection.
170
- * @property {Vector3} uv1 - Interpolated normal vector at point of intersection.
170
+ * @property {Vector3} normal - Interpolated normal vector at point of intersection.
171
171
  * @property {number} instanceId - The index number of the instance where the ray
172
172
  * intersects the {@link InstancedMesh}.
173
173
  */
@@ -103,7 +103,7 @@ class PMREMGenerator {
103
103
  * @param {number} [far=100] - The far plane distance.
104
104
  * @param {Object} [options={}] - The configuration options.
105
105
  * @param {number} [options.size=256] - The texture size of the PMREM.
106
- * @param {Vector3} [options.renderTarget=origin] - The position of the internal cube camera that renders the scene.
106
+ * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene.
107
107
  * @return {WebGLRenderTarget} The resulting PMREM.
108
108
  */
109
109
  fromScene( scene, sigma = 0, near = 0.1, far = 100, options = {} ) {
@@ -314,6 +314,7 @@ class PMREMGenerator {
314
314
  ( { lodMeshes: this._lodMeshes, sizeLods: this._sizeLods, sigmas: this._sigmas } = _createPlanes( _lodMax ) );
315
315
 
316
316
  this._blurMaterial = _getBlurShader( _lodMax, width, height );
317
+ this._ggxMaterial = _getGGXShader( _lodMax, width, height );
317
318
 
318
319
  }
319
320
 
@@ -519,14 +520,6 @@ class PMREMGenerator {
519
520
  const renderer = this._renderer;
520
521
  const pingPongRenderTarget = this._pingPongRenderTarget;
521
522
 
522
- if ( this._ggxMaterial === null ) {
523
-
524
- const width = 3 * Math.max( this._cubeSize, 16 );
525
- const height = 4 * this._cubeSize;
526
- this._ggxMaterial = _getGGXShader( this._lodMax, width, height );
527
-
528
- }
529
-
530
523
  const ggxMaterial = this._ggxMaterial;
531
524
  const ggxMesh = this._lodMeshes[ lodOut ];
532
525
  ggxMesh.material = ggxMaterial;
@@ -539,7 +532,7 @@ class PMREMGenerator {
539
532
  const incrementalRoughness = Math.sqrt( targetRoughness * targetRoughness - sourceRoughness * sourceRoughness );
540
533
 
541
534
  // Apply blur strength mapping for better quality across the roughness range
542
- const blurStrength = 0.05 + targetRoughness * 0.95;
535
+ const blurStrength = 0.0 + targetRoughness * 1.25;
543
536
  const adjustedRoughness = incrementalRoughness * blurStrength;
544
537
 
545
538
  // Calculate viewport position based on output LOD level
@@ -1,4 +1,4 @@
1
- import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js';
1
+ import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js';
2
2
 
3
3
  /**
4
4
  * Scales the texture as large as possible within its surface without cropping
@@ -140,8 +140,12 @@ function getByteLength( width, height, format, type ) {
140
140
  // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/
141
141
  case RGB_ETC1_Format:
142
142
  case RGB_ETC2_Format:
143
+ case R11_EAC_Format:
144
+ case SIGNED_R11_EAC_Format:
143
145
  return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8;
144
146
  case RGBA_ETC2_EAC_Format:
147
+ case RG11_EAC_Format:
148
+ case SIGNED_RG11_EAC_Format:
145
149
  return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16;
146
150
 
147
151
  // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/
@@ -112,9 +112,9 @@ class ExtrudeGeometry extends BufferGeometry {
112
112
 
113
113
  // SETUP TNB variables
114
114
 
115
- // TODO1 - have a .isClosed in spline?
115
+ const isClosed = extrudePath.isCatmullRomCurve3 ? extrudePath.closed : false;
116
116
 
117
- splineTube = extrudePath.computeFrenetFrames( steps, false );
117
+ splineTube = extrudePath.computeFrenetFrames( steps, isClosed );
118
118
 
119
119
  // log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
120
120
 
@@ -339,7 +339,7 @@ class PolyhedronGeometry extends BufferGeometry {
339
339
  */
340
340
  static fromJSON( data ) {
341
341
 
342
- return new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.details );
342
+ return new PolyhedronGeometry( data.vertices, data.indices, data.radius, data.detail );
343
343
 
344
344
  }
345
345
 
@@ -38,7 +38,7 @@ class PointLightHelper extends Mesh {
38
38
  /**
39
39
  * The light being visualized.
40
40
  *
41
- * @type {HemisphereLight}
41
+ * @type {PointLight}
42
42
  */
43
43
  this.light = light;
44
44
 
@@ -80,6 +80,8 @@ class DirectionalLight extends Light {
80
80
 
81
81
  dispose() {
82
82
 
83
+ super.dispose();
84
+
83
85
  this.shadow.dispose();
84
86
 
85
87
  }
@@ -95,6 +97,17 @@ class DirectionalLight extends Light {
95
97
 
96
98
  }
97
99
 
100
+ toJSON( meta ) {
101
+
102
+ const data = super.toJSON( meta );
103
+
104
+ data.object.shadow = this.shadow.toJSON();
105
+ data.object.target = this.target.uuid;
106
+
107
+ return data;
108
+
109
+ }
110
+
98
111
  }
99
112
 
100
113
  export { DirectionalLight };
@@ -61,6 +61,16 @@ class HemisphereLight extends Light {
61
61
 
62
62
  }
63
63
 
64
+ toJSON( meta ) {
65
+
66
+ const data = super.toJSON( meta );
67
+
68
+ data.object.groundColor = this.groundColor.getHex();
69
+
70
+ return data;
71
+
72
+ }
73
+
64
74
  }
65
75
 
66
76
  export { HemisphereLight };
@@ -54,7 +54,7 @@ class Light extends Object3D {
54
54
  */
55
55
  dispose() {
56
56
 
57
- // Empty here in base class; some subclasses override.
57
+ this.dispatchEvent( { type: 'dispose' } );
58
58
 
59
59
  }
60
60
 
@@ -76,16 +76,6 @@ class Light extends Object3D {
76
76
  data.object.color = this.color.getHex();
77
77
  data.object.intensity = this.intensity;
78
78
 
79
- if ( this.groundColor !== undefined ) data.object.groundColor = this.groundColor.getHex();
80
-
81
- if ( this.distance !== undefined ) data.object.distance = this.distance;
82
- if ( this.angle !== undefined ) data.object.angle = this.angle;
83
- if ( this.decay !== undefined ) data.object.decay = this.decay;
84
- if ( this.penumbra !== undefined ) data.object.penumbra = this.penumbra;
85
-
86
- if ( this.shadow !== undefined ) data.object.shadow = this.shadow.toJSON();
87
- if ( this.target !== undefined ) data.object.target = this.target.uuid;
88
-
89
79
  return data;
90
80
 
91
81
  }
@@ -60,21 +60,6 @@ class LightProbe extends Light {
60
60
 
61
61
  }
62
62
 
63
- /**
64
- * Deserializes the light prove from the given JSON.
65
- *
66
- * @param {Object} json - The JSON holding the serialized light probe.
67
- * @return {LightProbe} A reference to this light probe.
68
- */
69
- fromJSON( json ) {
70
-
71
- this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();
72
- this.sh.fromArray( json.sh );
73
-
74
- return this;
75
-
76
- }
77
-
78
63
  toJSON( meta ) {
79
64
 
80
65
  const data = super.toJSON( meta );
@@ -69,9 +69,6 @@ class LightShadow {
69
69
  * map size will allow for a higher value to be used here before these effects
70
70
  * become visible.
71
71
  *
72
- * The property has no effect when the shadow map type is `PCFSoftShadowMap` and
73
- * and it is recommended to increase softness by decreasing the shadow map size instead.
74
- *
75
72
  * The property has no effect when the shadow map type is `BasicShadowMap`.
76
73
  *
77
74
  * @type {number}
@@ -94,6 +94,8 @@ class PointLight extends Light {
94
94
 
95
95
  dispose() {
96
96
 
97
+ super.dispose();
98
+
97
99
  this.shadow.dispose();
98
100
 
99
101
  }
@@ -111,6 +113,19 @@ class PointLight extends Light {
111
113
 
112
114
  }
113
115
 
116
+ toJSON( meta ) {
117
+
118
+ const data = super.toJSON( meta );
119
+
120
+ data.object.distance = this.distance;
121
+ data.object.decay = this.decay;
122
+
123
+ data.object.shadow = this.shadow.toJSON();
124
+
125
+ return data;
126
+
127
+ }
128
+
114
129
  }
115
130
 
116
131
  export { PointLight };