super-three 0.169.1 → 0.170.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/build/three.cjs +24628 -24228
  2. package/build/three.core.js +37002 -0
  3. package/build/three.core.min.js +6 -0
  4. package/build/three.module.js +10519 -47108
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +533 -0
  7. package/build/three.tsl.min.js +6 -0
  8. package/build/three.webgpu.js +17071 -53583
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +17134 -53623
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +3 -3
  13. package/examples/jsm/animation/MMDAnimationHelper.js +2 -0
  14. package/examples/jsm/animation/MMDPhysics.js +2 -0
  15. package/examples/jsm/capabilities/WebGPU.js +1 -10
  16. package/examples/jsm/controls/ArcballControls.js +25 -21
  17. package/examples/jsm/controls/OrbitControls.js +41 -9
  18. package/examples/jsm/controls/PointerLockControls.js +2 -5
  19. package/examples/jsm/controls/TransformControls.js +22 -6
  20. package/examples/jsm/csm/CSM.js +2 -2
  21. package/examples/jsm/csm/CSMFrustum.js +7 -4
  22. package/examples/jsm/csm/CSMHelper.js +2 -0
  23. package/examples/jsm/csm/CSMShadowNode.js +437 -0
  24. package/examples/jsm/curves/NURBSCurve.js +34 -3
  25. package/examples/jsm/exporters/GLTFExporter.js +138 -71
  26. package/examples/jsm/exporters/KTX2Exporter.js +35 -12
  27. package/examples/jsm/exporters/MMDExporter.js +6 -0
  28. package/examples/jsm/exporters/USDZExporter.js +21 -3
  29. package/examples/jsm/geometries/DecalGeometry.js +70 -21
  30. package/examples/jsm/geometries/InstancedPointsGeometry.js +2 -0
  31. package/examples/jsm/helpers/TextureHelperGPU.js +175 -0
  32. package/examples/jsm/interactive/HTMLMesh.js +1 -0
  33. package/examples/jsm/lighting/TiledLighting.js +18 -0
  34. package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -1
  35. package/examples/jsm/lines/LineGeometry.js +25 -0
  36. package/examples/jsm/lines/LineMaterial.js +0 -1
  37. package/examples/jsm/lines/LineSegmentsGeometry.js +2 -0
  38. package/examples/jsm/lines/webgpu/Line2.js +2 -1
  39. package/examples/jsm/lines/webgpu/LineSegments2.js +2 -16
  40. package/examples/jsm/lines/webgpu/Wireframe.js +57 -0
  41. package/examples/jsm/loaders/3DMLoader.js +1 -0
  42. package/examples/jsm/loaders/3MFLoader.js +91 -0
  43. package/examples/jsm/loaders/FBXLoader.js +12 -2
  44. package/examples/jsm/loaders/GLTFLoader.js +2 -0
  45. package/examples/jsm/loaders/KTX2Loader.js +143 -49
  46. package/examples/jsm/loaders/LDrawLoader.js +22 -136
  47. package/examples/jsm/loaders/LottieLoader.js +1 -0
  48. package/examples/jsm/loaders/MMDLoader.js +3 -0
  49. package/examples/jsm/loaders/MaterialXLoader.js +2 -2
  50. package/examples/jsm/materials/LDrawConditionalLineMaterial.js +143 -0
  51. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +114 -0
  52. package/examples/jsm/math/ColorSpaces.js +76 -0
  53. package/examples/jsm/misc/ProgressiveLightMap.js +52 -40
  54. package/examples/jsm/misc/ProgressiveLightMapGPU.js +293 -0
  55. package/examples/jsm/misc/VolumeSlice.js +1 -0
  56. package/examples/jsm/objects/InstancedPoints.js +2 -4
  57. package/examples/jsm/objects/LensflareMesh.js +4 -2
  58. package/examples/jsm/objects/SkyMesh.js +5 -3
  59. package/examples/jsm/objects/Water2Mesh.js +7 -3
  60. package/examples/jsm/objects/WaterMesh.js +12 -10
  61. package/examples/jsm/postprocessing/AfterimagePass.js +14 -3
  62. package/examples/jsm/postprocessing/SSRPass.js +6 -0
  63. package/examples/jsm/renderers/CSS2DRenderer.js +6 -3
  64. package/examples/jsm/renderers/CSS3DRenderer.js +7 -4
  65. package/examples/jsm/shaders/FXAAShader.js +225 -224
  66. package/examples/jsm/transpiler/AST.js +2 -2
  67. package/examples/jsm/transpiler/GLSLDecoder.js +57 -25
  68. package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
  69. package/examples/jsm/transpiler/TSLEncoder.js +11 -6
  70. package/{src/nodes → examples/jsm/tsl}/display/AfterImageNode.js +18 -21
  71. package/{src/nodes → examples/jsm/tsl}/display/AnaglyphPassNode.js +2 -6
  72. package/{src/nodes → examples/jsm/tsl}/display/AnamorphicNode.js +12 -18
  73. package/{src/nodes → examples/jsm/tsl}/display/BleachBypass.js +1 -3
  74. package/{src/nodes → examples/jsm/tsl}/display/BloomNode.js +12 -41
  75. package/{src/nodes → examples/jsm/tsl}/display/DenoiseNode.js +60 -47
  76. package/{src/nodes → examples/jsm/tsl}/display/DepthOfFieldNode.js +4 -9
  77. package/{src/nodes → examples/jsm/tsl}/display/DotScreenNode.js +2 -9
  78. package/examples/jsm/tsl/display/FXAANode.js +316 -0
  79. package/{src/nodes → examples/jsm/tsl}/display/FilmNode.js +4 -7
  80. package/{src/nodes → examples/jsm/tsl}/display/GTAONode.js +73 -78
  81. package/{src/nodes → examples/jsm/tsl}/display/GaussianBlurNode.js +78 -42
  82. package/examples/jsm/tsl/display/LensflareNode.js +161 -0
  83. package/{src/nodes → examples/jsm/tsl}/display/Lut3DNode.js +3 -5
  84. package/{src/nodes → examples/jsm/tsl}/display/MotionBlur.js +2 -3
  85. package/examples/jsm/tsl/display/OutlineNode.js +434 -0
  86. package/{src/nodes → examples/jsm/tsl}/display/ParallaxBarrierPassNode.js +2 -5
  87. package/{src/nodes → examples/jsm/tsl}/display/PixelationPassNode.js +5 -17
  88. package/{src/nodes → examples/jsm/tsl}/display/RGBShiftNode.js +2 -6
  89. package/examples/jsm/tsl/display/SMAANode.js +620 -0
  90. package/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.js +10 -25
  91. package/examples/jsm/tsl/display/SSRNode.js +366 -0
  92. package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +1 -2
  93. package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +4 -12
  94. package/{src/nodes → examples/jsm/tsl}/display/StereoCompositePassNode.js +9 -11
  95. package/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.js +10 -11
  96. package/examples/jsm/tsl/display/TRAAPassNode.js +355 -0
  97. package/{src/nodes → examples/jsm/tsl}/display/TransitionNode.js +3 -7
  98. package/examples/jsm/tsl/display/hashBlur.js +24 -0
  99. package/examples/jsm/tsl/lighting/TiledLightsNode.js +389 -0
  100. package/examples/jsm/utils/SceneOptimizer.js +410 -0
  101. package/examples/jsm/utils/UVsDebug.js +1 -1
  102. package/examples/jsm/utils/{TextureUtilsGPU.js → WebGPUTextureUtils.js} +2 -1
  103. package/examples/jsm/webxr/OculusHandPointerModel.js +21 -21
  104. package/examples/jsm/webxr/Text2D.js +6 -6
  105. package/package.json +4 -4
  106. package/src/Three.Core.js +178 -0
  107. package/src/Three.TSL.js +526 -0
  108. package/src/Three.WebGPU.Nodes.js +9 -186
  109. package/src/Three.WebGPU.js +8 -186
  110. package/src/Three.js +1 -177
  111. package/src/animation/AnimationClip.js +2 -2
  112. package/src/animation/AnimationObjectGroup.js +2 -2
  113. package/src/audio/Audio.js +38 -0
  114. package/src/cameras/PerspectiveCamera.js +6 -6
  115. package/src/cameras/StereoCamera.js +2 -2
  116. package/src/constants.js +1 -6
  117. package/src/core/BufferGeometry.js +48 -8
  118. package/src/core/InterleavedBuffer.js +4 -4
  119. package/src/core/Object3D.js +2 -2
  120. package/src/extras/core/Curve.js +3 -3
  121. package/src/extras/core/Shape.js +2 -2
  122. package/src/geometries/CylinderGeometry.js +2 -2
  123. package/src/geometries/EdgesGeometry.js +2 -2
  124. package/src/geometries/LatheGeometry.js +2 -2
  125. package/src/lights/SpotLightShadow.js +2 -2
  126. package/src/materials/LineDashedMaterial.js +0 -1
  127. package/src/materials/Material.js +2 -2
  128. package/src/materials/MeshPhongMaterial.js +1 -1
  129. package/src/materials/MeshPhysicalMaterial.js +2 -2
  130. package/src/materials/MeshStandardMaterial.js +2 -2
  131. package/src/materials/nodes/Line2NodeMaterial.js +32 -13
  132. package/src/materials/nodes/LineDashedNodeMaterial.js +4 -2
  133. package/src/materials/nodes/NodeMaterial.js +93 -23
  134. package/src/materials/nodes/SpriteNodeMaterial.js +11 -2
  135. package/src/materials/nodes/manager/NodeMaterialObserver.js +119 -7
  136. package/src/math/ColorManagement.js +143 -102
  137. package/src/math/Line3.js +2 -2
  138. package/src/math/Quaternion.js +2 -2
  139. package/src/math/Spherical.js +3 -3
  140. package/src/math/Vector2.js +7 -7
  141. package/src/math/Vector3.js +9 -9
  142. package/src/math/Vector4.js +22 -9
  143. package/src/nodes/Nodes.js +2 -21
  144. package/src/nodes/TSL.js +9 -25
  145. package/src/nodes/accessors/Arrays.js +27 -0
  146. package/src/nodes/accessors/BuiltinNode.js +26 -0
  147. package/src/nodes/accessors/Camera.js +0 -1
  148. package/src/nodes/accessors/ClippingNode.js +76 -42
  149. package/src/nodes/accessors/InstanceNode.js +17 -20
  150. package/src/nodes/accessors/InstancedMeshNode.js +26 -0
  151. package/src/nodes/accessors/Lights.js +32 -0
  152. package/src/nodes/accessors/SceneNode.js +35 -1
  153. package/src/nodes/accessors/StorageBufferNode.js +61 -19
  154. package/src/nodes/accessors/StorageTextureNode.js +10 -4
  155. package/src/nodes/accessors/TextureNode.js +1 -1
  156. package/src/nodes/accessors/VelocityNode.js +13 -3
  157. package/src/nodes/code/FunctionCallNode.js +16 -5
  158. package/src/nodes/code/ScriptableNode.js +4 -4
  159. package/src/nodes/core/Node.js +1 -0
  160. package/src/nodes/core/NodeBuilder.js +31 -14
  161. package/src/nodes/core/NodeUtils.js +28 -0
  162. package/src/nodes/core/VarNode.js +15 -3
  163. package/src/nodes/core/constants.js +6 -0
  164. package/src/nodes/display/BlendModes.js +99 -0
  165. package/src/nodes/display/ColorAdjustment.js +53 -4
  166. package/src/nodes/display/ColorSpaceFunctions.js +5 -5
  167. package/src/nodes/display/ColorSpaceNode.js +27 -39
  168. package/src/nodes/display/PassNode.js +6 -4
  169. package/src/nodes/display/ToneMappingNode.js +1 -1
  170. package/src/nodes/display/ToonOutlinePassNode.js +3 -3
  171. package/src/nodes/display/ViewportDepthNode.js +48 -1
  172. package/src/nodes/functions/PhysicalLightingModel.js +21 -15
  173. package/src/nodes/functions/material/getAlphaHashThreshold.js +70 -0
  174. package/src/nodes/functions/material/getGeometryRoughness.js +8 -2
  175. package/src/nodes/functions/material/getParallaxCorrectNormal.js +22 -0
  176. package/src/nodes/gpgpu/ComputeNode.js +9 -1
  177. package/src/nodes/lighting/AnalyticLightNode.js +23 -419
  178. package/src/nodes/lighting/LightsNode.js +24 -12
  179. package/src/nodes/lighting/PointLightNode.js +41 -22
  180. package/src/nodes/lighting/PointShadowNode.js +254 -0
  181. package/src/nodes/lighting/RectAreaLightNode.js +3 -0
  182. package/src/nodes/lighting/ShadowNode.js +593 -0
  183. package/src/nodes/lighting/SpotLightNode.js +14 -2
  184. package/src/nodes/utils/LoopNode.js +2 -2
  185. package/src/nodes/utils/Oscillators.js +6 -0
  186. package/src/nodes/utils/PostProcessingUtils.js +89 -0
  187. package/src/nodes/utils/RTTNode.js +9 -1
  188. package/src/nodes/utils/ReflectorNode.js +101 -15
  189. package/src/nodes/utils/StorageArrayElementNode.js +2 -2
  190. package/src/nodes/utils/Timer.js +29 -0
  191. package/src/objects/BatchedMesh.js +472 -296
  192. package/src/objects/ClippingGroup.js +19 -0
  193. package/src/objects/Skeleton.js +2 -2
  194. package/src/renderers/WebGLRenderer.js +183 -109
  195. package/src/renderers/common/Animation.js +23 -11
  196. package/src/renderers/common/Attributes.js +4 -0
  197. package/src/renderers/common/Backend.js +2 -0
  198. package/src/renderers/common/Background.js +15 -5
  199. package/src/renderers/common/Bindings.js +23 -6
  200. package/src/renderers/common/ClippingContext.js +77 -85
  201. package/src/renderers/common/Constants.js +2 -1
  202. package/src/renderers/common/Geometries.js +20 -0
  203. package/src/renderers/common/IndirectStorageBufferAttribute.js +15 -0
  204. package/src/renderers/common/Lighting.js +45 -0
  205. package/src/renderers/common/PostProcessingUtils.js +86 -0
  206. package/src/renderers/common/RenderList.js +48 -17
  207. package/src/renderers/common/RenderLists.js +4 -2
  208. package/src/renderers/common/RenderObject.js +45 -28
  209. package/src/renderers/common/RenderObjects.js +12 -6
  210. package/src/renderers/common/Renderer.js +222 -77
  211. package/src/renderers/common/Textures.js +41 -17
  212. package/src/renderers/common/UniformsGroup.js +16 -4
  213. package/src/renderers/common/extras/PMREMGenerator.js +89 -13
  214. package/src/renderers/common/nodes/NodeLibrary.js +2 -15
  215. package/src/renderers/common/nodes/NodeStorageBuffer.js +2 -3
  216. package/src/renderers/common/nodes/NodeUniform.js +42 -0
  217. package/src/renderers/common/nodes/Nodes.js +2 -2
  218. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +4 -24
  219. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +8 -0
  220. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -2
  221. package/src/renderers/webgl/WebGLBackground.js +20 -1
  222. package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
  223. package/src/renderers/webgl/WebGLCapabilities.js +0 -7
  224. package/src/renderers/webgl/WebGLGeometries.js +0 -28
  225. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +2 -6
  226. package/src/renderers/webgl/WebGLProgram.js +24 -28
  227. package/src/renderers/webgl/WebGLPrograms.js +5 -2
  228. package/src/renderers/webgl/WebGLState.js +37 -1
  229. package/src/renderers/webgl/WebGLTextures.js +29 -12
  230. package/src/renderers/webgl-fallback/WebGLBackend.js +111 -37
  231. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +2 -7
  232. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +43 -12
  233. package/src/renderers/webgl-fallback/utils/WebGLState.js +26 -1
  234. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +37 -9
  235. package/src/renderers/webgpu/WebGPUBackend.js +152 -56
  236. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -1
  237. package/src/renderers/webgpu/WebGPURenderer.js +1 -1
  238. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +0 -8
  239. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +13 -34
  240. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +192 -92
  241. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +12 -4
  242. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -2
  243. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -7
  244. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +29 -9
  245. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +29 -7
  246. package/src/renderers/webgpu/utils/WebGPUUtils.js +0 -1
  247. package/src/renderers/webxr/WebXRManager.js +4 -4
  248. package/src/textures/Source.js +2 -2
  249. package/src/textures/Texture.js +2 -2
  250. package/examples/jsm/cameras/CinematicCamera.js +0 -208
  251. package/src/nodes/display/BlendMode.js +0 -54
  252. package/src/nodes/display/FXAANode.js +0 -332
  253. package/src/nodes/utils/OscNode.js +0 -85
  254. package/src/nodes/utils/TimerNode.js +0 -97
  255. /package/examples/jsm/utils/{TextureUtils.js → WebGLTextureUtils.js} +0 -0
@@ -1,140 +1,181 @@
1
- import { SRGBColorSpace, LinearSRGBColorSpace, DisplayP3ColorSpace, LinearDisplayP3ColorSpace, Rec709Primaries, P3Primaries, SRGBTransfer, LinearTransfer, NoColorSpace, } from '../constants.js';
1
+ import { SRGBColorSpace, LinearSRGBColorSpace, SRGBTransfer, LinearTransfer, NoColorSpace } from '../constants.js';
2
2
  import { Matrix3 } from './Matrix3.js';
3
3
 
4
- /**
5
- * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
6
- * or clipping. Based on W3C specifications for sRGB and Display P3,
7
- * and ICC specifications for the D50 connection space. Values in/out
8
- * are _linear_ sRGB and _linear_ Display P3.
9
- *
10
- * Note that both sRGB and Display P3 use the sRGB transfer functions.
11
- *
12
- * Reference:
13
- * - http://www.russellcottrell.com/photo/matrixCalculator.htm
14
- */
15
-
16
- const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(
17
- 0.8224621, 0.177538, 0.0,
18
- 0.0331941, 0.9668058, 0.0,
19
- 0.0170827, 0.0723974, 0.9105199,
4
+ const LINEAR_REC709_TO_XYZ = /*@__PURE__*/ new Matrix3().set(
5
+ 0.4123908, 0.3575843, 0.1804808,
6
+ 0.2126390, 0.7151687, 0.0721923,
7
+ 0.0193308, 0.1191948, 0.9505322
20
8
  );
21
9
 
22
- const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(
23
- 1.2249401, - 0.2249404, 0.0,
24
- - 0.0420569, 1.0420571, 0.0,
25
- - 0.0196376, - 0.0786361, 1.0982735
10
+ const XYZ_TO_LINEAR_REC709 = /*@__PURE__*/ new Matrix3().set(
11
+ 3.2409699, - 1.5373832, - 0.4986108,
12
+ - 0.9692436, 1.8759675, 0.0415551,
13
+ 0.0556301, - 0.2039770, 1.0569715
26
14
  );
27
15
 
28
- /**
29
- * Defines supported color spaces by transfer function and primaries,
30
- * and provides conversions to/from the Linear-sRGB reference space.
31
- */
32
- const COLOR_SPACES = {
33
- [ LinearSRGBColorSpace ]: {
34
- transfer: LinearTransfer,
35
- primaries: Rec709Primaries,
36
- luminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],
37
- toReference: ( color ) => color,
38
- fromReference: ( color ) => color,
39
- },
40
- [ SRGBColorSpace ]: {
41
- transfer: SRGBTransfer,
42
- primaries: Rec709Primaries,
43
- luminanceCoefficients: [ 0.2126, 0.7152, 0.0722 ],
44
- toReference: ( color ) => color.convertSRGBToLinear(),
45
- fromReference: ( color ) => color.convertLinearToSRGB(),
46
- },
47
- [ LinearDisplayP3ColorSpace ]: {
48
- transfer: LinearTransfer,
49
- primaries: P3Primaries,
50
- luminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],
51
- toReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
52
- fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),
53
- },
54
- [ DisplayP3ColorSpace ]: {
55
- transfer: SRGBTransfer,
56
- primaries: P3Primaries,
57
- luminanceCoefficients: [ 0.2289, 0.6917, 0.0793 ],
58
- toReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
59
- fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),
60
- },
61
- };
62
-
63
- const SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );
64
-
65
- export const ColorManagement = {
66
-
67
- enabled: true,
68
-
69
- _workingColorSpace: LinearSRGBColorSpace,
70
-
71
- get workingColorSpace() {
72
-
73
- return this._workingColorSpace;
74
-
75
- },
76
-
77
- set workingColorSpace( colorSpace ) {
78
-
79
- if ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {
80
-
81
- throw new Error( `Unsupported working color space, "${ colorSpace }".` );
16
+ function createColorManagement() {
82
17
 
83
- }
18
+ const ColorManagement = {
19
+
20
+ enabled: true,
21
+
22
+ workingColorSpace: LinearSRGBColorSpace,
23
+
24
+ /**
25
+ * Implementations of supported color spaces.
26
+ *
27
+ * Required:
28
+ * - primaries: chromaticity coordinates [ rx ry gx gy bx by ]
29
+ * - whitePoint: reference white [ x y ]
30
+ * - transfer: transfer function (pre-defined)
31
+ * - toXYZ: Matrix3 RGB to XYZ transform
32
+ * - fromXYZ: Matrix3 XYZ to RGB transform
33
+ * - luminanceCoefficients: RGB luminance coefficients
34
+ *
35
+ * Optional:
36
+ * - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace }
37
+ * - workingColorSpaceConfig: { unpackColorSpace: ColorSpace }
38
+ *
39
+ * Reference:
40
+ * - https://www.russellcottrell.com/photo/matrixCalculator.htm
41
+ */
42
+ spaces: {},
43
+
44
+ convert: function ( color, sourceColorSpace, targetColorSpace ) {
45
+
46
+ if ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {
47
+
48
+ return color;
49
+
50
+ }
51
+
52
+ if ( this.spaces[ sourceColorSpace ].transfer === SRGBTransfer ) {
84
53
 
85
- this._workingColorSpace = colorSpace;
54
+ color.r = SRGBToLinear( color.r );
55
+ color.g = SRGBToLinear( color.g );
56
+ color.b = SRGBToLinear( color.b );
86
57
 
87
- },
58
+ }
88
59
 
89
- convert: function ( color, sourceColorSpace, targetColorSpace ) {
60
+ if ( this.spaces[ sourceColorSpace ].primaries !== this.spaces[ targetColorSpace ].primaries ) {
90
61
 
91
- if ( this.enabled === false || sourceColorSpace === targetColorSpace || ! sourceColorSpace || ! targetColorSpace ) {
62
+ color.applyMatrix3( this.spaces[ sourceColorSpace ].toXYZ );
63
+ color.applyMatrix3( this.spaces[ targetColorSpace ].fromXYZ );
64
+
65
+ }
66
+
67
+ if ( this.spaces[ targetColorSpace ].transfer === SRGBTransfer ) {
68
+
69
+ color.r = LinearToSRGB( color.r );
70
+ color.g = LinearToSRGB( color.g );
71
+ color.b = LinearToSRGB( color.b );
72
+
73
+ }
92
74
 
93
75
  return color;
94
76
 
95
- }
77
+ },
78
+
79
+ fromWorkingColorSpace: function ( color, targetColorSpace ) {
80
+
81
+ return this.convert( color, this.workingColorSpace, targetColorSpace );
82
+
83
+ },
96
84
 
97
- const sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;
98
- const targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;
85
+ toWorkingColorSpace: function ( color, sourceColorSpace ) {
99
86
 
100
- return targetFromReference( sourceToReference( color ) );
87
+ return this.convert( color, sourceColorSpace, this.workingColorSpace );
101
88
 
102
- },
89
+ },
103
90
 
104
- fromWorkingColorSpace: function ( color, targetColorSpace ) {
91
+ getPrimaries: function ( colorSpace ) {
105
92
 
106
- return this.convert( color, this._workingColorSpace, targetColorSpace );
93
+ return this.spaces[ colorSpace ].primaries;
107
94
 
108
- },
95
+ },
109
96
 
110
- toWorkingColorSpace: function ( color, sourceColorSpace ) {
97
+ getTransfer: function ( colorSpace ) {
111
98
 
112
- return this.convert( color, sourceColorSpace, this._workingColorSpace );
99
+ if ( colorSpace === NoColorSpace ) return LinearTransfer;
113
100
 
114
- },
101
+ return this.spaces[ colorSpace ].transfer;
115
102
 
116
- getPrimaries: function ( colorSpace ) {
103
+ },
117
104
 
118
- return COLOR_SPACES[ colorSpace ].primaries;
105
+ getLuminanceCoefficients: function ( target, colorSpace = this.workingColorSpace ) {
119
106
 
120
- },
107
+ return target.fromArray( this.spaces[ colorSpace ].luminanceCoefficients );
121
108
 
122
- getTransfer: function ( colorSpace ) {
109
+ },
123
110
 
124
- if ( colorSpace === NoColorSpace ) return LinearTransfer;
111
+ define: function ( colorSpaces ) {
125
112
 
126
- return COLOR_SPACES[ colorSpace ].transfer;
113
+ Object.assign( this.spaces, colorSpaces );
127
114
 
128
- },
115
+ },
129
116
 
130
- getLuminanceCoefficients: function ( target, colorSpace = this._workingColorSpace ) {
117
+ // Internal APIs
131
118
 
132
- return target.fromArray( COLOR_SPACES[ colorSpace ].luminanceCoefficients );
119
+ _getMatrix: function ( targetMatrix, sourceColorSpace, targetColorSpace ) {
133
120
 
134
- },
121
+ return targetMatrix
122
+ .copy( this.spaces[ sourceColorSpace ].toXYZ )
123
+ .multiply( this.spaces[ targetColorSpace ].fromXYZ );
135
124
 
136
- };
125
+ },
126
+
127
+ _getDrawingBufferColorSpace: function ( colorSpace ) {
128
+
129
+ return this.spaces[ colorSpace ].outputColorSpaceConfig.drawingBufferColorSpace;
130
+
131
+ },
132
+
133
+ _getUnpackColorSpace: function ( colorSpace = this.workingColorSpace ) {
134
+
135
+ return this.spaces[ colorSpace ].workingColorSpaceConfig.unpackColorSpace;
136
+
137
+ }
138
+
139
+ };
140
+
141
+ /******************************************************************************
142
+ * sRGB definitions
143
+ */
144
+
145
+ const REC709_PRIMARIES = [ 0.640, 0.330, 0.300, 0.600, 0.150, 0.060 ];
146
+ const REC709_LUMINANCE_COEFFICIENTS = [ 0.2126, 0.7152, 0.0722 ];
147
+ const D65 = [ 0.3127, 0.3290 ];
148
+
149
+ ColorManagement.define( {
150
+
151
+ [ LinearSRGBColorSpace ]: {
152
+ primaries: REC709_PRIMARIES,
153
+ whitePoint: D65,
154
+ transfer: LinearTransfer,
155
+ toXYZ: LINEAR_REC709_TO_XYZ,
156
+ fromXYZ: XYZ_TO_LINEAR_REC709,
157
+ luminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS,
158
+ workingColorSpaceConfig: { unpackColorSpace: SRGBColorSpace },
159
+ outputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace }
160
+ },
161
+
162
+ [ SRGBColorSpace ]: {
163
+ primaries: REC709_PRIMARIES,
164
+ whitePoint: D65,
165
+ transfer: SRGBTransfer,
166
+ toXYZ: LINEAR_REC709_TO_XYZ,
167
+ fromXYZ: XYZ_TO_LINEAR_REC709,
168
+ luminanceCoefficients: REC709_LUMINANCE_COEFFICIENTS,
169
+ outputColorSpaceConfig: { drawingBufferColorSpace: SRGBColorSpace }
170
+ },
171
+
172
+ } );
173
+
174
+ return ColorManagement;
175
+
176
+ }
137
177
 
178
+ export const ColorManagement = /*@__PURE__*/ createColorManagement();
138
179
 
139
180
  export function SRGBToLinear( c ) {
140
181
 
package/src/math/Line3.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Vector3 } from './Vector3.js';
2
- import * as MathUtils from './MathUtils.js';
2
+ import { clamp } from './MathUtils.js';
3
3
 
4
4
  const _startP = /*@__PURE__*/ new Vector3();
5
5
  const _startEnd = /*@__PURE__*/ new Vector3();
@@ -73,7 +73,7 @@ class Line3 {
73
73
 
74
74
  if ( clampToLine ) {
75
75
 
76
- t = MathUtils.clamp( t, 0, 1 );
76
+ t = clamp( t, 0, 1 );
77
77
 
78
78
  }
79
79
 
@@ -1,4 +1,4 @@
1
- import * as MathUtils from './MathUtils.js';
1
+ import { clamp } from './MathUtils.js';
2
2
 
3
3
  class Quaternion {
4
4
 
@@ -394,7 +394,7 @@ class Quaternion {
394
394
 
395
395
  angleTo( q ) {
396
396
 
397
- return 2 * Math.acos( Math.abs( MathUtils.clamp( this.dot( q ), - 1, 1 ) ) );
397
+ return 2 * Math.acos( Math.abs( clamp( this.dot( q ), - 1, 1 ) ) );
398
398
 
399
399
  }
400
400
 
@@ -1,4 +1,4 @@
1
- import * as MathUtils from './MathUtils.js';
1
+ import { clamp } from './MathUtils.js';
2
2
 
3
3
  /**
4
4
  * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
@@ -42,7 +42,7 @@ class Spherical {
42
42
  makeSafe() {
43
43
 
44
44
  const EPS = 0.000001;
45
- this.phi = Math.max( EPS, Math.min( Math.PI - EPS, this.phi ) );
45
+ this.phi = clamp( this.phi, EPS, Math.PI - EPS );
46
46
 
47
47
  return this;
48
48
 
@@ -66,7 +66,7 @@ class Spherical {
66
66
  } else {
67
67
 
68
68
  this.theta = Math.atan2( x, z );
69
- this.phi = Math.acos( MathUtils.clamp( y / this.radius, - 1, 1 ) );
69
+ this.phi = Math.acos( clamp( y / this.radius, - 1, 1 ) );
70
70
 
71
71
  }
72
72
 
@@ -1,4 +1,4 @@
1
- import * as MathUtils from './MathUtils.js';
1
+ import { clamp } from './MathUtils.js';
2
2
 
3
3
  class Vector2 {
4
4
 
@@ -240,8 +240,8 @@ class Vector2 {
240
240
 
241
241
  // assumes min < max, componentwise
242
242
 
243
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
244
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
243
+ this.x = clamp( this.x, min.x, max.x );
244
+ this.y = clamp( this.y, min.y, max.y );
245
245
 
246
246
  return this;
247
247
 
@@ -249,8 +249,8 @@ class Vector2 {
249
249
 
250
250
  clampScalar( minVal, maxVal ) {
251
251
 
252
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
253
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
252
+ this.x = clamp( this.x, minVal, maxVal );
253
+ this.y = clamp( this.y, minVal, maxVal );
254
254
 
255
255
  return this;
256
256
 
@@ -260,7 +260,7 @@ class Vector2 {
260
260
 
261
261
  const length = this.length();
262
262
 
263
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
263
+ return this.divideScalar( length || 1 ).multiplyScalar( clamp( length, min, max ) );
264
264
 
265
265
  }
266
266
 
@@ -365,7 +365,7 @@ class Vector2 {
365
365
 
366
366
  // clamp, to handle numerical problems
367
367
 
368
- return Math.acos( MathUtils.clamp( theta, - 1, 1 ) );
368
+ return Math.acos( clamp( theta, - 1, 1 ) );
369
369
 
370
370
  }
371
371
 
@@ -1,4 +1,4 @@
1
- import * as MathUtils from './MathUtils.js';
1
+ import { clamp } from './MathUtils.js';
2
2
  import { Quaternion } from './Quaternion.js';
3
3
 
4
4
  class Vector3 {
@@ -338,9 +338,9 @@ class Vector3 {
338
338
 
339
339
  // assumes min < max, componentwise
340
340
 
341
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
342
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
343
- this.z = Math.max( min.z, Math.min( max.z, this.z ) );
341
+ this.x = clamp( this.x, min.x, max.x );
342
+ this.y = clamp( this.y, min.y, max.y );
343
+ this.z = clamp( this.z, min.z, max.z );
344
344
 
345
345
  return this;
346
346
 
@@ -348,9 +348,9 @@ class Vector3 {
348
348
 
349
349
  clampScalar( minVal, maxVal ) {
350
350
 
351
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
352
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
353
- this.z = Math.max( minVal, Math.min( maxVal, this.z ) );
351
+ this.x = clamp( this.x, minVal, maxVal );
352
+ this.y = clamp( this.y, minVal, maxVal );
353
+ this.z = clamp( this.z, minVal, maxVal );
354
354
 
355
355
  return this;
356
356
 
@@ -360,7 +360,7 @@ class Vector3 {
360
360
 
361
361
  const length = this.length();
362
362
 
363
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
363
+ return this.divideScalar( length || 1 ).multiplyScalar( clamp( length, min, max ) );
364
364
 
365
365
  }
366
366
 
@@ -530,7 +530,7 @@ class Vector3 {
530
530
 
531
531
  // clamp, to handle numerical problems
532
532
 
533
- return Math.acos( MathUtils.clamp( theta, - 1, 1 ) );
533
+ return Math.acos( clamp( theta, - 1, 1 ) );
534
534
 
535
535
  }
536
536
 
@@ -1,3 +1,5 @@
1
+ import { clamp } from './MathUtils.js';
2
+
1
3
  class Vector4 {
2
4
 
3
5
  constructor( x = 0, y = 0, z = 0, w = 1 ) {
@@ -249,6 +251,17 @@ class Vector4 {
249
251
 
250
252
  }
251
253
 
254
+ divide( v ) {
255
+
256
+ this.x /= v.x;
257
+ this.y /= v.y;
258
+ this.z /= v.z;
259
+ this.w /= v.w;
260
+
261
+ return this;
262
+
263
+ }
264
+
252
265
  divideScalar( scalar ) {
253
266
 
254
267
  return this.multiplyScalar( 1 / scalar );
@@ -452,10 +465,10 @@ class Vector4 {
452
465
 
453
466
  // assumes min < max, componentwise
454
467
 
455
- this.x = Math.max( min.x, Math.min( max.x, this.x ) );
456
- this.y = Math.max( min.y, Math.min( max.y, this.y ) );
457
- this.z = Math.max( min.z, Math.min( max.z, this.z ) );
458
- this.w = Math.max( min.w, Math.min( max.w, this.w ) );
468
+ this.x = clamp( this.x, min.x, max.x );
469
+ this.y = clamp( this.y, min.y, max.y );
470
+ this.z = clamp( this.z, min.z, max.z );
471
+ this.w = clamp( this.w, min.w, max.w );
459
472
 
460
473
  return this;
461
474
 
@@ -463,10 +476,10 @@ class Vector4 {
463
476
 
464
477
  clampScalar( minVal, maxVal ) {
465
478
 
466
- this.x = Math.max( minVal, Math.min( maxVal, this.x ) );
467
- this.y = Math.max( minVal, Math.min( maxVal, this.y ) );
468
- this.z = Math.max( minVal, Math.min( maxVal, this.z ) );
469
- this.w = Math.max( minVal, Math.min( maxVal, this.w ) );
479
+ this.x = clamp( this.x, minVal, maxVal );
480
+ this.y = clamp( this.y, minVal, maxVal );
481
+ this.z = clamp( this.z, minVal, maxVal );
482
+ this.w = clamp( this.w, minVal, maxVal );
470
483
 
471
484
  return this;
472
485
 
@@ -476,7 +489,7 @@ class Vector4 {
476
489
 
477
490
  const length = this.length();
478
491
 
479
- return this.divideScalar( length || 1 ).multiplyScalar( Math.max( min, Math.min( max, length ) ) );
492
+ return this.divideScalar( length || 1 ).multiplyScalar( clamp( length, min, max ) );
480
493
 
481
494
  }
482
495
 
@@ -43,14 +43,12 @@ export { default as JoinNode } from './utils/JoinNode.js';
43
43
  export { default as LoopNode } from './utils/LoopNode.js';
44
44
  export { default as MatcapUVNode } from './utils/MatcapUVNode.js';
45
45
  export { default as MaxMipLevelNode } from './utils/MaxMipLevelNode.js';
46
- export { default as OscNode } from './utils/OscNode.js';
47
46
  export { default as RemapNode } from './utils/RemapNode.js';
48
47
  export { default as RotateNode } from './utils/RotateNode.js';
49
48
  export { default as SetNode } from './utils/SetNode.js';
50
49
  export { default as SplitNode } from './utils/SplitNode.js';
51
50
  export { default as SpriteSheetUVNode } from './utils/SpriteSheetUVNode.js';
52
51
  export { default as StorageArrayElementNode } from './utils/StorageArrayElementNode.js';
53
- export { default as TimerNode } from './utils/TimerNode.js';
54
52
  export { default as TriplanarTexturesNode } from './utils/TriplanarTexturesNode.js';
55
53
  export { default as ReflectorNode } from './utils/ReflectorNode.js';
56
54
  export { default as RTTNode } from './utils/RTTNode.js';
@@ -62,6 +60,7 @@ export { default as BufferNode } from './accessors/BufferNode.js';
62
60
  export { default as VertexColorNode } from './accessors/VertexColorNode.js';
63
61
  export { default as CubeTextureNode } from './accessors/CubeTextureNode.js';
64
62
  export { default as InstanceNode } from './accessors/InstanceNode.js';
63
+ export { default as InstancedMeshNode } from './accessors/InstancedMeshNode.js';
65
64
  export { default as BatchNode } from './accessors/BatchNode.js';
66
65
  export { default as MaterialNode } from './accessors/MaterialNode.js';
67
66
  export { default as MaterialReferenceNode } from './accessors/MaterialReferenceNode.js';
@@ -93,26 +92,7 @@ export { default as ViewportTextureNode } from './display/ViewportTextureNode.js
93
92
  export { default as ViewportSharedTextureNode } from './display/ViewportSharedTextureNode.js';
94
93
  export { default as ViewportDepthTextureNode } from './display/ViewportDepthTextureNode.js';
95
94
  export { default as ViewportDepthNode } from './display/ViewportDepthNode.js';
96
- export { default as GaussianBlurNode } from './display/GaussianBlurNode.js';
97
- export { default as AfterImageNode } from './display/AfterImageNode.js';
98
- export { default as AnamorphicNode } from './display/AnamorphicNode.js';
99
- export { default as SobelOperatorNode } from './display/SobelOperatorNode.js';
100
- export { default as DepthOfFieldNode } from './display/DepthOfFieldNode.js';
101
- export { default as DotScreenNode } from './display/DotScreenNode.js';
102
- export { default as RGBShiftNode } from './display/RGBShiftNode.js';
103
- export { default as FilmNode } from './display/FilmNode.js';
104
- export { default as Lut3DNode } from './display/Lut3DNode.js';
105
- export { default as GTAONode } from './display/GTAONode.js';
106
- export { default as DenoiseNode } from './display/DenoiseNode.js';
107
- export { default as FXAANode } from './display/FXAANode.js';
108
- export { default as BloomNode } from './display/BloomNode.js';
109
- export { default as TransitionNode } from './display/TransitionNode.js';
110
95
  export { default as RenderOutputNode } from './display/RenderOutputNode.js';
111
- export { default as PixelationPassNode } from './display/PixelationPassNode.js';
112
- export { default as SSAAPassNode } from './display/SSAAPassNode.js';
113
- export { default as StereoPassNode } from './display/StereoPassNode.js';
114
- export { default as AnaglyphPassNode } from './display/AnaglyphPassNode.js';
115
- export { default as ParallaxBarrierPassNode } from './display/ParallaxBarrierPassNode.js';
116
96
  export { default as PassNode } from './display/PassNode.js';
117
97
  export { default as ToonOutlinePassNode } from './display/ToonOutlinePassNode.js';
118
98
 
@@ -152,6 +132,7 @@ export { default as BasicEnvironmentNode } from './lighting/BasicEnvironmentNode
152
132
  export { default as IrradianceNode } from './lighting/IrradianceNode.js';
153
133
  export { default as AONode } from './lighting/AONode.js';
154
134
  export { default as AnalyticLightNode } from './lighting/AnalyticLightNode.js';
135
+ export { default as ShadowNode } from './lighting/ShadowNode.js';
155
136
 
156
137
  // pmrem
157
138
  export { default as PMREMNode } from './pmrem/PMREMNode.js';
package/src/nodes/TSL.js CHANGED
@@ -28,7 +28,7 @@ export * from './utils/FunctionOverloadingNode.js';
28
28
  export * from './utils/LoopNode.js';
29
29
  export * from './utils/MatcapUVNode.js';
30
30
  export * from './utils/MaxMipLevelNode.js';
31
- export * from './utils/OscNode.js';
31
+ export * from './utils/Oscillators.js';
32
32
  export * from './utils/Packing.js';
33
33
  export * from './utils/RemapNode.js';
34
34
  export * from './utils/UVUtils.js';
@@ -36,16 +36,18 @@ export * from './utils/SpriteUtils.js';
36
36
  export * from './utils/ViewportUtils.js';
37
37
  export * from './utils/RotateNode.js';
38
38
  export * from './utils/SpriteSheetUVNode.js';
39
- export * from './utils/TimerNode.js';
39
+ export * from './utils/Timer.js';
40
40
  export * from './utils/TriplanarTexturesNode.js';
41
41
  export * from './utils/ReflectorNode.js';
42
42
  export * from './utils/RTTNode.js';
43
+ export * from './utils/PostProcessingUtils.js';
43
44
 
44
45
  // three.js shading language
45
46
  export * from './tsl/TSLBase.js';
46
47
 
47
48
  // accessors
48
49
  export * from './accessors/AccessorsUtils.js';
50
+ export * from './accessors/Arrays.js';
49
51
  export * from './accessors/UniformArrayNode.js';
50
52
  export * from './accessors/Bitangent.js';
51
53
  export * from './accessors/BufferAttributeNode.js';
@@ -54,6 +56,7 @@ export * from './accessors/Camera.js';
54
56
  export * from './accessors/VertexColorNode.js';
55
57
  export * from './accessors/CubeTextureNode.js';
56
58
  export * from './accessors/InstanceNode.js';
59
+ export * from './accessors/InstancedMeshNode.js';
57
60
  export * from './accessors/BatchNode.js';
58
61
  export * from './accessors/MaterialNode.js';
59
62
  export * from './accessors/MaterialProperties.js';
@@ -82,7 +85,7 @@ export * from './accessors/UserDataNode.js';
82
85
  export * from './accessors/VelocityNode.js';
83
86
 
84
87
  // display
85
- export * from './display/BlendMode.js';
88
+ export * from './display/BlendModes.js';
86
89
  export * from './display/BumpMapNode.js';
87
90
  export * from './display/ColorAdjustment.js';
88
91
  export * from './display/ColorSpaceNode.js';
@@ -95,29 +98,7 @@ export * from './display/ViewportTextureNode.js';
95
98
  export * from './display/ViewportSharedTextureNode.js';
96
99
  export * from './display/ViewportDepthTextureNode.js';
97
100
  export * from './display/ViewportDepthNode.js';
98
- export * from './display/GaussianBlurNode.js';
99
- export * from './display/AfterImageNode.js';
100
- export * from './display/AnamorphicNode.js';
101
- export * from './display/SobelOperatorNode.js';
102
- export * from './display/DepthOfFieldNode.js';
103
- export * from './display/DotScreenNode.js';
104
- export * from './display/RGBShiftNode.js';
105
- export * from './display/FilmNode.js';
106
- export * from './display/Lut3DNode.js';
107
- export * from './display/MotionBlur.js';
108
- export * from './display/GTAONode.js';
109
- export * from './display/DenoiseNode.js';
110
- export * from './display/FXAANode.js';
111
- export * from './display/BloomNode.js';
112
- export * from './display/TransitionNode.js';
113
101
  export * from './display/RenderOutputNode.js';
114
- export * from './display/PixelationPassNode.js';
115
- export * from './display/SSAAPassNode.js';
116
- export * from './display/StereoPassNode.js';
117
- export * from './display/AnaglyphPassNode.js';
118
- export * from './display/ParallaxBarrierPassNode.js';
119
- export * from './display/BleachBypass.js';
120
- export * from './display/Sepia.js';
121
102
  export * from './display/ToonOutlinePassNode.js';
122
103
 
123
104
  export * from './display/PassNode.js';
@@ -152,6 +133,8 @@ export * from './gpgpu/AtomicFunctionNode.js';
152
133
  export * from './accessors/Lights.js';
153
134
  export * from './lighting/LightsNode.js';
154
135
  export * from './lighting/LightingContextNode.js';
136
+ export * from './lighting/ShadowNode.js';
137
+ export * from './lighting/PointLightNode.js';
155
138
 
156
139
  // pmrem
157
140
  export * from './pmrem/PMREMNode.js';
@@ -175,5 +158,6 @@ export { default as V_GGX_SmithCorrelated } from './functions/BSDF/V_GGX_SmithCo
175
158
  export * from './lighting/LightUtils.js';
176
159
 
177
160
  export { default as getGeometryRoughness } from './functions/material/getGeometryRoughness.js';
161
+ export { default as getParallaxCorrectNormal } from './functions/material/getParallaxCorrectNormal.js';
178
162
  export { default as getRoughness } from './functions/material/getRoughness.js';
179
163
  export { default as getShIrradianceAt } from './functions/material/getShIrradianceAt.js';
@@ -0,0 +1,27 @@
1
+ import StorageInstancedBufferAttribute from '../../renderers/common/StorageInstancedBufferAttribute.js';
2
+ import StorageBufferAttribute from '../../renderers/common/StorageBufferAttribute.js';
3
+ import { storage } from './StorageBufferNode.js';
4
+ import { getLengthFromType } from '../core/NodeUtils.js';
5
+
6
+ export const attributeArray = ( count, type = 'float' ) => {
7
+
8
+ const itemSize = getLengthFromType( type );
9
+
10
+ const buffer = new StorageBufferAttribute( count, itemSize );
11
+ const node = storage( buffer, type, count );
12
+
13
+ return node;
14
+
15
+ };
16
+
17
+
18
+ export const instancedArray = ( count, type = 'float' ) => {
19
+
20
+ const itemSize = getLengthFromType( type );
21
+
22
+ const buffer = new StorageInstancedBufferAttribute( count, itemSize );
23
+ const node = storage( buffer, type, count );
24
+
25
+ return node;
26
+
27
+ };