super-three 0.167.0 → 0.168.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 (311) hide show
  1. package/build/three.cjs +165 -44
  2. package/build/three.module.js +165 -45
  3. package/build/three.module.min.js +1 -1
  4. package/build/three.webgpu.js +23600 -21931
  5. package/build/three.webgpu.min.js +1 -1
  6. package/examples/jsm/Addons.js +3 -1
  7. package/examples/jsm/animation/AnimationClipCreator.js +1 -1
  8. package/examples/jsm/capabilities/WebGL.js +27 -21
  9. package/examples/jsm/controls/ArcballControls.js +174 -158
  10. package/examples/jsm/controls/DragControls.js +260 -132
  11. package/examples/jsm/controls/FirstPersonControls.js +175 -163
  12. package/examples/jsm/controls/FlyControls.js +194 -188
  13. package/examples/jsm/controls/OrbitControls.js +777 -786
  14. package/examples/jsm/controls/PointerLockControls.js +24 -15
  15. package/examples/jsm/controls/TrackballControls.js +453 -452
  16. package/examples/jsm/effects/AnaglyphEffect.js +6 -13
  17. package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
  18. package/examples/jsm/effects/StereoEffect.js +6 -1
  19. package/examples/jsm/environments/RoomEnvironment.js +1 -1
  20. package/examples/jsm/exporters/GLTFExporter.js +6 -1
  21. package/examples/jsm/exporters/USDZExporter.js +29 -8
  22. package/examples/jsm/helpers/LightProbeHelper.js +42 -43
  23. package/examples/jsm/loaders/KTX2Loader.js +19 -7
  24. package/examples/jsm/loaders/MaterialXLoader.js +11 -4
  25. package/examples/jsm/loaders/PCDLoader.js +9 -9
  26. package/examples/jsm/objects/SkyMesh.js +188 -0
  27. package/examples/jsm/objects/Water2Mesh.js +159 -0
  28. package/examples/jsm/objects/WaterMesh.js +102 -0
  29. package/examples/jsm/physics/RapierPhysics.js +20 -0
  30. package/examples/jsm/postprocessing/OutlinePass.js +31 -46
  31. package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
  32. package/examples/jsm/shaders/BleachBypassShader.js +1 -2
  33. package/examples/jsm/shaders/OutputShader.js +1 -1
  34. package/examples/jsm/transpiler/TSLEncoder.js +8 -8
  35. package/examples/jsm/utils/TextureUtils.js +1 -1
  36. package/package.json +2 -1
  37. package/src/Three.WebGPU.js +6 -0
  38. package/src/Three.js +1 -0
  39. package/src/constants.js +1 -1
  40. package/src/extras/Controls.js +32 -0
  41. package/src/loaders/ObjectLoader.js +3 -3
  42. package/src/{nodes/loaders → loaders/nodes}/NodeLoader.js +4 -4
  43. package/src/{nodes/loaders → loaders/nodes}/NodeMaterialLoader.js +1 -2
  44. package/src/materials/Material.js +4 -7
  45. package/src/{nodes/materials → materials/nodes}/InstancedPointsNodeMaterial.js +33 -24
  46. package/src/{nodes/materials → materials/nodes}/Line2NodeMaterial.js +34 -37
  47. package/src/{nodes/materials → materials/nodes}/LineBasicNodeMaterial.js +3 -4
  48. package/src/{nodes/materials → materials/nodes}/LineDashedNodeMaterial.js +7 -9
  49. package/src/{nodes/materials → materials/nodes}/MeshBasicNodeMaterial.js +11 -11
  50. package/src/{nodes/materials → materials/nodes}/MeshLambertNodeMaterial.js +5 -5
  51. package/src/{nodes/materials → materials/nodes}/MeshMatcapNodeMaterial.js +8 -8
  52. package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
  53. package/src/{nodes/materials → materials/nodes}/MeshPhongNodeMaterial.js +9 -8
  54. package/src/{nodes/materials → materials/nodes}/MeshPhysicalNodeMaterial.js +18 -17
  55. package/src/{nodes/materials → materials/nodes}/MeshSSSNodeMaterial.js +6 -6
  56. package/src/{nodes/materials → materials/nodes}/MeshStandardNodeMaterial.js +17 -11
  57. package/src/{nodes/materials → materials/nodes}/MeshToonNodeMaterial.js +4 -4
  58. package/src/{nodes/materials → materials/nodes}/NodeMaterial.js +67 -86
  59. package/src/{nodes/materials/Materials.js → materials/nodes/NodeMaterials.js} +1 -1
  60. package/src/{nodes/materials → materials/nodes}/PointsNodeMaterial.js +3 -4
  61. package/src/{nodes/materials → materials/nodes}/ShadowNodeMaterial.js +4 -4
  62. package/src/{nodes/materials → materials/nodes}/SpriteNodeMaterial.js +11 -11
  63. package/src/{nodes/materials → materials/nodes}/VolumeNodeMaterial.js +14 -16
  64. package/src/nodes/Nodes.js +103 -159
  65. package/src/nodes/TSL.js +176 -0
  66. package/src/nodes/accessors/AccessorsUtils.js +8 -8
  67. package/src/nodes/accessors/BatchNode.js +48 -20
  68. package/src/nodes/accessors/{BitangentNode.js → Bitangent.js} +9 -9
  69. package/src/nodes/accessors/BufferAttributeNode.js +5 -5
  70. package/src/nodes/accessors/BufferNode.js +4 -4
  71. package/src/nodes/accessors/{CameraNode.js → Camera.js} +10 -10
  72. package/src/nodes/accessors/ClippingNode.js +16 -14
  73. package/src/nodes/accessors/CubeTextureNode.js +5 -7
  74. package/src/nodes/accessors/InstanceNode.js +17 -13
  75. package/src/nodes/accessors/InstancedPointsMaterialNode.js +4 -4
  76. package/src/nodes/accessors/MaterialNode.js +52 -55
  77. package/src/nodes/accessors/MaterialProperties.js +3 -0
  78. package/src/nodes/accessors/MaterialReferenceNode.js +6 -4
  79. package/src/nodes/accessors/ModelNode.js +11 -11
  80. package/src/nodes/accessors/ModelViewProjectionNode.js +6 -7
  81. package/src/nodes/accessors/MorphNode.js +12 -12
  82. package/src/nodes/accessors/Normal.js +62 -0
  83. package/src/nodes/accessors/Object3DNode.js +10 -10
  84. package/src/nodes/accessors/PointUVNode.js +4 -4
  85. package/src/nodes/accessors/Position.js +10 -0
  86. package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
  87. package/src/nodes/accessors/ReferenceNode.js +13 -7
  88. package/src/nodes/accessors/ReflectVector.js +10 -0
  89. package/src/nodes/accessors/RendererReferenceNode.js +6 -6
  90. package/src/nodes/accessors/SceneNode.js +5 -6
  91. package/src/nodes/accessors/SkinningNode.js +84 -21
  92. package/src/nodes/accessors/StorageBufferNode.js +4 -5
  93. package/src/nodes/accessors/StorageTextureNode.js +5 -5
  94. package/src/nodes/accessors/Tangent.js +22 -0
  95. package/src/nodes/accessors/Texture3DNode.js +11 -11
  96. package/src/nodes/accessors/{TextureBicubicNode.js → TextureBicubic.js} +3 -32
  97. package/src/nodes/accessors/TextureNode.js +16 -21
  98. package/src/nodes/accessors/TextureSizeNode.js +4 -6
  99. package/src/nodes/accessors/{UniformsNode.js → UniformArrayNode.js} +17 -8
  100. package/src/nodes/accessors/UserDataNode.js +4 -4
  101. package/src/nodes/accessors/VelocityNode.js +83 -0
  102. package/src/nodes/accessors/VertexColorNode.js +4 -4
  103. package/src/nodes/code/CodeNode.js +5 -5
  104. package/src/nodes/code/ExpressionNode.js +4 -4
  105. package/src/nodes/code/FunctionCallNode.js +5 -5
  106. package/src/nodes/code/FunctionNode.js +5 -23
  107. package/src/nodes/code/ScriptableNode.js +4 -6
  108. package/src/nodes/code/ScriptableValueNode.js +4 -6
  109. package/src/nodes/core/AssignNode.js +5 -5
  110. package/src/nodes/core/AttributeNode.js +7 -20
  111. package/src/nodes/core/BypassNode.js +5 -5
  112. package/src/nodes/core/CacheNode.js +5 -5
  113. package/src/nodes/core/ConstNode.js +2 -2
  114. package/src/nodes/core/ContextNode.js +17 -11
  115. package/src/nodes/core/IndexNode.js +12 -7
  116. package/src/nodes/core/InputNode.js +2 -2
  117. package/src/nodes/core/MRTNode.js +12 -6
  118. package/src/nodes/core/Node.js +39 -19
  119. package/src/nodes/core/NodeBuilder.js +46 -33
  120. package/src/nodes/core/NodeUtils.js +1 -0
  121. package/src/nodes/core/OutputStructNode.js +4 -4
  122. package/src/nodes/core/ParameterNode.js +4 -4
  123. package/src/nodes/core/PropertyNode.js +32 -32
  124. package/src/nodes/core/StackNode.js +26 -10
  125. package/src/nodes/core/StructTypeNode.js +2 -2
  126. package/src/nodes/core/TempNode.js +2 -2
  127. package/src/nodes/core/UniformGroupNode.js +8 -9
  128. package/src/nodes/core/UniformNode.js +4 -4
  129. package/src/nodes/core/VarNode.js +6 -6
  130. package/src/nodes/core/VaryingNode.js +5 -5
  131. package/src/nodes/display/AfterImageNode.js +9 -9
  132. package/src/nodes/display/AnaglyphPassNode.js +61 -0
  133. package/src/nodes/display/AnamorphicNode.js +11 -11
  134. package/src/nodes/display/BleachBypass.js +26 -0
  135. package/src/nodes/display/BlendMode.js +54 -0
  136. package/src/nodes/display/BloomNode.js +21 -19
  137. package/src/nodes/display/BumpMapNode.js +7 -12
  138. package/src/nodes/display/ColorAdjustment.js +46 -0
  139. package/src/nodes/display/ColorSpaceFunctions.js +38 -0
  140. package/src/nodes/display/ColorSpaceNode.js +40 -63
  141. package/src/nodes/display/DenoiseNode.js +20 -17
  142. package/src/nodes/display/DepthOfFieldNode.js +8 -6
  143. package/src/nodes/display/DotScreenNode.js +10 -22
  144. package/src/nodes/display/FXAANode.js +17 -15
  145. package/src/nodes/display/FilmNode.js +7 -6
  146. package/src/nodes/display/FrontFacingNode.js +5 -5
  147. package/src/nodes/display/GTAONode.js +19 -15
  148. package/src/nodes/display/GaussianBlurNode.js +11 -8
  149. package/src/nodes/display/Lut3DNode.js +6 -5
  150. package/src/nodes/display/MotionBlur.js +25 -0
  151. package/src/nodes/display/NormalMapNode.js +8 -10
  152. package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
  153. package/src/nodes/display/PassNode.js +84 -8
  154. package/src/nodes/display/PixelationPassNode.js +12 -7
  155. package/src/nodes/display/PosterizeNode.js +4 -6
  156. package/src/nodes/display/RGBShiftNode.js +8 -7
  157. package/src/nodes/display/RenderOutputNode.js +9 -9
  158. package/src/nodes/display/SSAAPassNode.js +284 -0
  159. package/src/nodes/display/Sepia.js +17 -0
  160. package/src/nodes/display/SobelOperatorNode.js +9 -7
  161. package/src/nodes/display/StereoCompositePassNode.js +107 -0
  162. package/src/nodes/display/StereoPassNode.js +80 -0
  163. package/src/nodes/display/ToneMappingFunctions.js +190 -0
  164. package/src/nodes/display/ToneMappingNode.js +12 -173
  165. package/src/nodes/display/TransitionNode.js +9 -8
  166. package/src/nodes/display/ViewportDepthNode.js +30 -29
  167. package/src/nodes/display/ViewportDepthTextureNode.js +6 -8
  168. package/src/nodes/display/ViewportNode.js +26 -25
  169. package/src/nodes/display/ViewportSharedTextureNode.js +6 -8
  170. package/src/nodes/display/ViewportTextureNode.js +7 -10
  171. package/src/nodes/fog/FogExp2Node.js +4 -6
  172. package/src/nodes/fog/FogNode.js +5 -7
  173. package/src/nodes/fog/FogRangeNode.js +4 -6
  174. package/src/nodes/functions/BSDF/BRDF_GGX.js +4 -4
  175. package/src/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
  176. package/src/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
  177. package/src/nodes/functions/BSDF/DFGApprox.js +2 -2
  178. package/src/nodes/functions/BSDF/D_GGX.js +2 -2
  179. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
  180. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  181. package/src/nodes/functions/BSDF/F_Schlick.js +2 -2
  182. package/src/nodes/functions/BSDF/LTC.js +6 -6
  183. package/src/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
  184. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
  185. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
  186. package/src/nodes/functions/BasicLightingModel.js +1 -1
  187. package/src/nodes/functions/PhongLightingModel.js +5 -5
  188. package/src/nodes/functions/PhysicalLightingModel.js +32 -31
  189. package/src/nodes/functions/ShadowMaskModel.js +1 -1
  190. package/src/nodes/functions/ToonLightingModel.js +3 -3
  191. package/src/nodes/functions/material/getGeometryRoughness.js +4 -4
  192. package/src/nodes/functions/material/getRoughness.js +2 -2
  193. package/src/nodes/geometry/RangeNode.js +4 -4
  194. package/src/nodes/gpgpu/ComputeNode.js +5 -5
  195. package/src/nodes/lighting/AONode.js +2 -2
  196. package/src/nodes/lighting/AmbientLightNode.js +2 -7
  197. package/src/nodes/lighting/AnalyticLightNode.js +34 -13
  198. package/src/nodes/lighting/BasicEnvironmentNode.js +4 -3
  199. package/src/nodes/lighting/BasicLightMapNode.js +3 -3
  200. package/src/nodes/lighting/DirectionalLightNode.js +2 -7
  201. package/src/nodes/lighting/EnvironmentNode.js +20 -19
  202. package/src/nodes/lighting/HemisphereLightNode.js +3 -7
  203. package/src/nodes/lighting/IESSpotLightNode.js +3 -8
  204. package/src/nodes/lighting/IrradianceNode.js +2 -2
  205. package/src/nodes/lighting/LightNode.js +5 -5
  206. package/src/nodes/lighting/LightProbeNode.js +76 -0
  207. package/src/nodes/lighting/LightUtils.js +3 -3
  208. package/src/nodes/lighting/LightingContextNode.js +15 -17
  209. package/src/nodes/lighting/LightingNode.js +2 -2
  210. package/src/nodes/lighting/LightsNode.js +94 -76
  211. package/src/nodes/lighting/PointLightNode.js +3 -8
  212. package/src/nodes/lighting/RectAreaLightNode.js +2 -6
  213. package/src/nodes/lighting/SpotLightNode.js +3 -8
  214. package/src/nodes/materialx/MaterialXNodes.js +2 -2
  215. package/src/nodes/materialx/lib/mx_hsv.js +36 -31
  216. package/src/nodes/materialx/lib/mx_noise.js +96 -96
  217. package/src/nodes/materialx/lib/mx_transform_color.js +2 -2
  218. package/src/nodes/math/{CondNode.js → ConditionalNode.js} +18 -7
  219. package/src/nodes/math/Hash.js +13 -0
  220. package/src/nodes/math/MathNode.js +124 -124
  221. package/src/nodes/math/MathUtils.js +0 -7
  222. package/src/nodes/math/OperatorNode.js +94 -52
  223. package/src/nodes/math/TriNoise3D.js +19 -29
  224. package/src/nodes/pmrem/PMREMNode.js +58 -15
  225. package/src/nodes/pmrem/PMREMUtils.js +46 -46
  226. package/src/nodes/procedural/Checker.js +14 -0
  227. package/src/nodes/tsl/TSLBase.js +30 -0
  228. package/src/nodes/{shadernode/ShaderNode.js → tsl/TSLCore.js} +105 -97
  229. package/src/nodes/utils/ArrayElementNode.js +2 -2
  230. package/src/nodes/utils/ConvertNode.js +2 -2
  231. package/src/nodes/utils/CubeMapNode.js +157 -0
  232. package/src/nodes/utils/Discard.js +8 -0
  233. package/src/nodes/utils/EquirectUVNode.js +5 -5
  234. package/src/nodes/utils/FlipNode.js +65 -0
  235. package/src/nodes/utils/FunctionOverloadingNode.js +5 -5
  236. package/src/nodes/utils/JoinNode.js +2 -2
  237. package/src/nodes/utils/LoopNode.js +12 -6
  238. package/src/nodes/utils/MatcapUVNode.js +6 -6
  239. package/src/nodes/utils/MaxMipLevelNode.js +4 -4
  240. package/src/nodes/utils/OscNode.js +7 -7
  241. package/src/nodes/utils/Packing.js +4 -0
  242. package/src/nodes/utils/RTTNode.js +8 -8
  243. package/src/nodes/utils/ReflectorNode.js +8 -3
  244. package/src/nodes/utils/RemapNode.js +7 -7
  245. package/src/nodes/utils/RotateNode.js +4 -12
  246. package/src/nodes/utils/SetNode.js +2 -2
  247. package/src/nodes/utils/SplitNode.js +2 -2
  248. package/src/nodes/utils/SpriteSheetUVNode.js +5 -5
  249. package/src/nodes/utils/SpriteUtils.js +47 -0
  250. package/src/nodes/utils/StorageArrayElementNode.js +4 -6
  251. package/src/nodes/utils/TimerNode.js +5 -5
  252. package/src/nodes/utils/TriplanarTexturesNode.js +7 -9
  253. package/src/nodes/utils/UVUtils.js +19 -0
  254. package/src/nodes/utils/ViewportUtils.js +14 -0
  255. package/src/objects/BatchedMesh.js +2 -3
  256. package/src/renderers/WebGLRenderer.js +24 -0
  257. package/src/renderers/common/Backend.js +2 -2
  258. package/src/renderers/common/Background.js +3 -1
  259. package/src/renderers/common/BindGroup.js +3 -1
  260. package/src/renderers/common/Bindings.js +13 -15
  261. package/src/renderers/common/ClippingContext.js +14 -5
  262. package/src/renderers/common/CubeRenderTarget.js +9 -3
  263. package/src/renderers/common/PostProcessing.js +4 -1
  264. package/src/renderers/common/QuadMesh.js +2 -0
  265. package/src/renderers/common/RenderContext.js +24 -0
  266. package/src/renderers/common/RenderList.js +1 -1
  267. package/src/renderers/common/RenderObject.js +2 -2
  268. package/src/renderers/common/Renderer.js +75 -49
  269. package/src/renderers/common/SampledTexture.js +12 -3
  270. package/src/renderers/common/StandardRenderer.js +18 -0
  271. package/src/renderers/common/Textures.js +8 -12
  272. package/src/renderers/common/extras/PMREMGenerator.js +12 -13
  273. package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
  274. package/src/renderers/common/nodes/NodeLibrary.js +118 -0
  275. package/src/renderers/common/nodes/NodeSampledTexture.js +2 -2
  276. package/src/renderers/common/nodes/Nodes.js +36 -9
  277. package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
  278. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
  279. package/src/renderers/webgl/WebGLProgram.js +1 -1
  280. package/src/renderers/webgl/WebGLProperties.js +7 -0
  281. package/src/renderers/webgl/WebGLTextures.js +61 -4
  282. package/src/renderers/webgl-fallback/WebGLBackend.js +88 -68
  283. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +57 -9
  284. package/src/renderers/webgl-fallback/utils/WebGLState.js +21 -0
  285. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +28 -21
  286. package/src/renderers/webgpu/WebGPUBackend.js +86 -68
  287. package/src/renderers/webgpu/WebGPURenderer.js +8 -8
  288. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -63
  289. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +45 -21
  290. package/src/renderers/webgpu/utils/WebGPUConstants.js +2 -1
  291. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +6 -15
  292. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
  293. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +36 -21
  294. package/src/renderers/webgpu/utils/WebGPUUtils.js +18 -1
  295. package/src/renderers/webxr/WebXRManager.js +32 -25
  296. package/examples/jsm/loaders/LogLuvLoader.js +0 -606
  297. package/src/nodes/accessors/NormalNode.js +0 -14
  298. package/src/nodes/accessors/PositionNode.js +0 -10
  299. package/src/nodes/accessors/ReflectVectorNode.js +0 -10
  300. package/src/nodes/accessors/TangentNode.js +0 -23
  301. package/src/nodes/core/NodeKeywords.js +0 -80
  302. package/src/nodes/display/BlendModeNode.js +0 -128
  303. package/src/nodes/display/ColorAdjustmentNode.js +0 -104
  304. package/src/nodes/materials/MeshNormalNodeMaterial.js +0 -40
  305. package/src/nodes/math/HashNode.js +0 -34
  306. package/src/nodes/procedural/CheckerNode.js +0 -42
  307. package/src/nodes/utils/DiscardNode.js +0 -28
  308. package/src/nodes/utils/PackingNode.js +0 -55
  309. package/src/nodes/utils/RotateUVNode.js +0 -35
  310. /package/src/{nodes/loaders → loaders/nodes}/NodeObjectLoader.js +0 -0
  311. /package/src/nodes/accessors/{UVNode.js → UV.js} +0 -0
@@ -1,15 +1,14 @@
1
- import { addNodeMaterial } from './NodeMaterial.js';
2
- import { transformedClearcoatNormalView } from '../accessors/NormalNode.js';
3
- import { clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, specularColor, specularF90, diffuseColor, metalness, roughness, anisotropy, alphaT, anisotropyT, anisotropyB, ior, transmission, thickness, attenuationDistance, attenuationColor, dispersion } from '../core/PropertyNode.js';
4
- import { materialClearcoat, materialClearcoatRoughness, materialClearcoatNormal, materialSheen, materialSheenRoughness, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialSpecularIntensity, materialSpecularColor, materialAnisotropy, materialIOR, materialTransmission, materialThickness, materialAttenuationDistance, materialAttenuationColor, materialDispersion } from '../accessors/MaterialNode.js';
5
- import { float, vec2, vec3, If } from '../shadernode/ShaderNode.js';
6
- import getRoughness from '../functions/material/getRoughness.js';
7
- import { TBNViewMatrix } from '../accessors/AccessorsUtils.js';
8
- import PhysicalLightingModel from '../functions/PhysicalLightingModel.js';
1
+ import { clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, specularColor, specularF90, diffuseColor, metalness, roughness, anisotropy, alphaT, anisotropyT, anisotropyB, ior, transmission, thickness, attenuationDistance, attenuationColor, dispersion } from '../../nodes/core/PropertyNode.js';
2
+ import { materialClearcoat, materialClearcoatRoughness, materialClearcoatNormal, materialSheen, materialSheenRoughness, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialSpecularIntensity, materialSpecularColor, materialAnisotropy, materialIOR, materialTransmission, materialThickness, materialAttenuationDistance, materialAttenuationColor, materialDispersion } from '../../nodes/accessors/MaterialNode.js';
3
+ import { float, vec2, vec3, If } from '../../nodes/tsl/TSLBase.js';
4
+ import getRoughness from '../../nodes/functions/material/getRoughness.js';
5
+ import { TBNViewMatrix } from '../../nodes/accessors/AccessorsUtils.js';
6
+ import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js';
9
7
  import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js';
10
- import { mix, pow2, min } from '../math/MathNode.js';
8
+ import { mix, pow2, min } from '../../nodes/math/MathNode.js';
11
9
 
12
- import { MeshPhysicalMaterial } from '../../materials/MeshPhysicalMaterial.js';
10
+ import { MeshPhysicalMaterial } from '../MeshPhysicalMaterial.js';
11
+ import { registerNodeMaterial } from './NodeMaterial.js';
13
12
 
14
13
  const _defaultValues = /*@__PURE__*/ new MeshPhysicalMaterial();
15
14
 
@@ -156,7 +155,7 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
156
155
 
157
156
  anisotropyV.assign( vec2( 1.0, 0.0 ) );
158
157
 
159
- } ).else( () => {
158
+ } ).Else( () => {
160
159
 
161
160
  anisotropyV.divAssign( vec2( anisotropy ) );
162
161
  anisotropy.assign( anisotropy.saturate() );
@@ -197,15 +196,17 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
197
196
 
198
197
  }
199
198
 
200
- setupNormal( builder ) {
199
+ setupClearcoatNormal() {
201
200
 
202
- super.setupNormal( builder );
201
+ return this.clearcoatNormalNode ? vec3( this.clearcoatNormalNode ) : materialClearcoatNormal;
203
202
 
204
- // CLEARCOAT NORMAL
203
+ }
204
+
205
+ setup( builder ) {
205
206
 
206
- const clearcoatNormalNode = this.clearcoatNormalNode ? vec3( this.clearcoatNormalNode ) : materialClearcoatNormal;
207
+ builder.context.setupClearcoatNormal = () => this.setupClearcoatNormal( builder );
207
208
 
208
- transformedClearcoatNormalView.assign( clearcoatNormalNode );
209
+ super.setup( builder );
209
210
 
210
211
  }
211
212
 
@@ -241,4 +242,4 @@ class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial {
241
242
 
242
243
  export default MeshPhysicalNodeMaterial;
243
244
 
244
- addNodeMaterial( 'MeshPhysicalNodeMaterial', MeshPhysicalNodeMaterial );
245
+ MeshPhysicalNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshPhysical', MeshPhysicalNodeMaterial );
@@ -1,9 +1,9 @@
1
- import { addNodeMaterial } from './NodeMaterial.js';
2
- import { transformedNormalView } from '../accessors/NormalNode.js';
3
- import { positionViewDirection } from '../accessors/PositionNode.js';
4
- import PhysicalLightingModel from '../functions/PhysicalLightingModel.js';
5
1
  import MeshPhysicalNodeMaterial from './MeshPhysicalNodeMaterial.js';
6
- import { float, vec3 } from '../shadernode/ShaderNode.js';
2
+ import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js';
3
+ import { transformedNormalView } from '../../nodes/accessors/Normal.js';
4
+ import { positionViewDirection } from '../../nodes/accessors/Position.js';
5
+ import { float, vec3 } from '../../nodes/tsl/TSLBase.js';
6
+ import { registerNodeMaterial } from './NodeMaterial.js';
7
7
 
8
8
  class SSSLightingModel extends PhysicalLightingModel {
9
9
 
@@ -81,4 +81,4 @@ class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial {
81
81
 
82
82
  export default MeshSSSNodeMaterial;
83
83
 
84
- addNodeMaterial( 'MeshSSSNodeMaterial', MeshSSSNodeMaterial );
84
+ MeshSSSNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshSSS', MeshSSSNodeMaterial );
@@ -1,13 +1,13 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { diffuseColor, metalness, roughness, specularColor, specularF90 } from '../core/PropertyNode.js';
3
- import { mix } from '../math/MathNode.js';
4
- import { materialRoughness, materialMetalness } from '../accessors/MaterialNode.js';
5
- import getRoughness from '../functions/material/getRoughness.js';
6
- import PhysicalLightingModel from '../functions/PhysicalLightingModel.js';
7
- import EnvironmentNode from '../lighting/EnvironmentNode.js';
8
- import { float, vec3, vec4 } from '../shadernode/ShaderNode.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { diffuseColor, metalness, roughness, specularColor, specularF90 } from '../../nodes/core/PropertyNode.js';
3
+ import { mix } from '../../nodes/math/MathNode.js';
4
+ import { materialRoughness, materialMetalness } from '../../nodes/accessors/MaterialNode.js';
5
+ import getRoughness from '../../nodes/functions/material/getRoughness.js';
6
+ import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js';
7
+ import EnvironmentNode from '../../nodes/lighting/EnvironmentNode.js';
8
+ import { float, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
9
9
 
10
- import { MeshStandardMaterial } from '../../materials/MeshStandardMaterial.js';
10
+ import { MeshStandardMaterial } from '../MeshStandardMaterial.js';
11
11
 
12
12
  const _defaultValues = /*@__PURE__*/ new MeshStandardMaterial();
13
13
 
@@ -34,7 +34,13 @@ class MeshStandardNodeMaterial extends NodeMaterial {
34
34
 
35
35
  setupEnvironment( builder ) {
36
36
 
37
- const envNode = super.setupEnvironment( builder );
37
+ let envNode = super.setupEnvironment( builder );
38
+
39
+ if ( envNode === null && builder.environmentNode ) {
40
+
41
+ envNode = builder.environmentNode;
42
+
43
+ }
38
44
 
39
45
  return envNode ? new EnvironmentNode( envNode ) : null;
40
46
 
@@ -95,4 +101,4 @@ class MeshStandardNodeMaterial extends NodeMaterial {
95
101
 
96
102
  export default MeshStandardNodeMaterial;
97
103
 
98
- addNodeMaterial( 'MeshStandardNodeMaterial', MeshStandardNodeMaterial );
104
+ MeshStandardNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshStandard', MeshStandardNodeMaterial );
@@ -1,7 +1,7 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import ToonLightingModel from '../functions/ToonLightingModel.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import ToonLightingModel from '../../nodes/functions/ToonLightingModel.js';
3
3
 
4
- import { MeshToonMaterial } from '../../materials/MeshToonMaterial.js';
4
+ import { MeshToonMaterial } from '../MeshToonMaterial.js';
5
5
 
6
6
  const _defaultValues = /*@__PURE__*/ new MeshToonMaterial();
7
7
 
@@ -31,4 +31,4 @@ class MeshToonNodeMaterial extends NodeMaterial {
31
31
 
32
32
  export default MeshToonNodeMaterial;
33
33
 
34
- addNodeMaterial( 'MeshToonNodeMaterial', MeshToonNodeMaterial );
34
+ MeshToonNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshToon', MeshToonNodeMaterial );
@@ -1,30 +1,27 @@
1
- import { Material } from '../../materials/Material.js';
1
+ import { Material } from '../Material.js';
2
2
  import { NormalBlending } from '../../constants.js';
3
3
 
4
- import { getNodeChildren, getCacheKey } from '../core/NodeUtils.js';
5
- import { attribute } from '../core/AttributeNode.js';
6
- import { output, diffuseColor, emissive, varyingProperty } from '../core/PropertyNode.js';
7
- import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAOMap } from '../accessors/MaterialNode.js';
8
- import { modelViewProjection } from '../accessors/ModelViewProjectionNode.js';
9
- import { transformedNormalView, normalLocal } from '../accessors/NormalNode.js';
10
- import { instance } from '../accessors/InstanceNode.js';
11
- import { batch } from '../accessors/BatchNode.js';
12
- import { materialReference } from '../accessors/MaterialReferenceNode.js';
13
- import { positionLocal, positionView } from '../accessors/PositionNode.js';
14
- import { skinningReference } from '../accessors/SkinningNode.js';
15
- import { morphReference } from '../accessors/MorphNode.js';
16
- import { texture } from '../accessors/TextureNode.js';
17
- import { cubeTexture } from '../accessors/CubeTextureNode.js';
18
- import { lightsNode } from '../lighting/LightsNode.js';
19
- import { mix } from '../math/MathNode.js';
20
- import { float, vec3, vec4 } from '../shadernode/ShaderNode.js';
21
- import AONode from '../lighting/AONode.js';
22
- import { lightingContext } from '../lighting/LightingContextNode.js';
23
- import IrradianceNode from '../lighting/IrradianceNode.js';
24
- import { depth } from '../display/ViewportDepthNode.js';
25
- import { cameraLogDepth } from '../accessors/CameraNode.js';
26
- import { clipping, clippingAlpha } from '../accessors/ClippingNode.js';
27
- import { faceDirection } from '../display/FrontFacingNode.js';
4
+ import { getNodeChildren, getCacheKey } from '../../nodes/core/NodeUtils.js';
5
+ import { attribute } from '../../nodes/core/AttributeNode.js';
6
+ import { output, diffuseColor, emissive, varyingProperty } from '../../nodes/core/PropertyNode.js';
7
+ import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAOMap } from '../../nodes/accessors/MaterialNode.js';
8
+ import { modelViewProjection } from '../../nodes/accessors/ModelViewProjectionNode.js';
9
+ import { normalLocal } from '../../nodes/accessors/Normal.js';
10
+ import { instance } from '../../nodes/accessors/InstanceNode.js';
11
+ import { batch } from '../../nodes/accessors/BatchNode.js';
12
+ import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
13
+ import { positionLocal } from '../../nodes/accessors/Position.js';
14
+ import { skinningReference } from '../../nodes/accessors/SkinningNode.js';
15
+ import { morphReference } from '../../nodes/accessors/MorphNode.js';
16
+ import { lights } from '../../nodes/lighting/LightsNode.js';
17
+ import { mix } from '../../nodes/math/MathNode.js';
18
+ import { float, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
19
+ import AONode from '../../nodes/lighting/AONode.js';
20
+ import { lightingContext } from '../../nodes/lighting/LightingContextNode.js';
21
+ import IrradianceNode from '../../nodes/lighting/IrradianceNode.js';
22
+ import { depth } from '../../nodes/display/ViewportDepthNode.js';
23
+ import { cameraLogDepth } from '../../nodes/accessors/Camera.js';
24
+ import { clipping, clippingAlpha } from '../../nodes/accessors/ClippingNode.js';
28
25
 
29
26
  const NodeMaterials = new Map();
30
27
 
@@ -42,7 +39,6 @@ class NodeMaterial extends Material {
42
39
 
43
40
  this.fog = true;
44
41
  this.lights = false;
45
- this.normals = true;
46
42
 
47
43
  this.lightsNode = null;
48
44
  this.envNode = null;
@@ -83,6 +79,8 @@ class NodeMaterial extends Material {
83
79
 
84
80
  setup( builder ) {
85
81
 
82
+ builder.context.setupNormal = () => this.setupNormal( builder );
83
+
86
84
  // < VERTEX STAGE >
87
85
 
88
86
  builder.addStack();
@@ -103,8 +101,6 @@ class NodeMaterial extends Material {
103
101
 
104
102
  if ( this.fragmentNode === null ) {
105
103
 
106
- if ( this.normals === true ) this.setupNormal( builder );
107
-
108
104
  this.setupDiffuseColor( builder );
109
105
  this.setupVariants( builder );
110
106
 
@@ -208,11 +204,21 @@ class NodeMaterial extends Material {
208
204
 
209
205
  let depthNode = this.depthNode;
210
206
 
211
- if ( depthNode === null && renderer.logarithmicDepthBuffer === true ) {
207
+ if ( depthNode === null ) {
208
+
209
+ const mrt = renderer.getMRT();
210
+
211
+ if ( mrt && mrt.has( 'depth' ) ) {
212
+
213
+ depthNode = mrt.get( 'depth' );
214
+
215
+ } else if ( renderer.logarithmicDepthBuffer === true ) {
212
216
 
213
- const fragDepth = modelViewProjection().w.add( 1 );
217
+ const fragDepth = modelViewProjection().w.add( 1 );
214
218
 
215
- depthNode = fragDepth.log2().mul( cameraLogDepth ).mul( 0.5 );
219
+ depthNode = fragDepth.log2().mul( cameraLogDepth ).mul( 0.5 );
220
+
221
+ }
216
222
 
217
223
  }
218
224
 
@@ -304,6 +310,15 @@ class NodeMaterial extends Material {
304
310
 
305
311
  }
306
312
 
313
+ if ( object.isBatchedMesh && object._colorsTexture ) {
314
+
315
+ const batchColor = varyingProperty( 'vec3', 'vBatchColor' );
316
+
317
+ colorNode = batchColor.mul( colorNode );
318
+
319
+ }
320
+
321
+
307
322
  // COLOR
308
323
 
309
324
  diffuseColor.assign( colorNode );
@@ -337,7 +352,6 @@ class NodeMaterial extends Material {
337
352
 
338
353
  }
339
354
 
340
-
341
355
  setupOutgoingLight() {
342
356
 
343
357
  return ( this.lights === true ) ? vec3( 0 ) : diffuseColor.rgb;
@@ -346,25 +360,11 @@ class NodeMaterial extends Material {
346
360
 
347
361
  setupNormal() {
348
362
 
349
- // NORMAL VIEW
350
-
351
- if ( this.flatShading === true ) {
352
-
353
- const normalNode = positionView.dFdx().cross( positionView.dFdy() ).normalize();
354
-
355
- transformedNormalView.assign( normalNode.mul( faceDirection ) );
356
-
357
- } else {
358
-
359
- const normalNode = this.normalNode ? vec3( this.normalNode ) : materialNormal;
360
-
361
- transformedNormalView.assign( normalNode.mul( faceDirection ) );
362
-
363
- }
363
+ return this.normalNode ? vec3( this.normalNode ) : materialNormal;
364
364
 
365
365
  }
366
366
 
367
- setupEnvironment( builder ) {
367
+ setupEnvironment( /*builder*/ ) {
368
368
 
369
369
  let node = null;
370
370
 
@@ -374,11 +374,7 @@ class NodeMaterial extends Material {
374
374
 
375
375
  } else if ( this.envMap ) {
376
376
 
377
- node = this.envMap.isCubeTexture ? cubeTexture( this.envMap ) : texture( this.envMap );
378
-
379
- } else if ( builder.environmentNode ) {
380
-
381
- node = builder.environmentNode;
377
+ node = this.envMap.isCubeTexture ? materialReference( 'envMap', 'cubeTexture' ) : materialReference( 'envMap', 'texture' );
382
378
 
383
379
  }
384
380
 
@@ -434,7 +430,7 @@ class NodeMaterial extends Material {
434
430
 
435
431
  if ( materialLightsNode.length > 0 ) {
436
432
 
437
- lightsN = lightsNode( [ ...lightsN.lightNodes, ...materialLightsNode ] );
433
+ lightsN = lights( [ ...lightsN.getLights(), ...materialLightsNode ] );
438
434
 
439
435
  }
440
436
 
@@ -461,7 +457,7 @@ class NodeMaterial extends Material {
461
457
 
462
458
  let outgoingLightNode = this.setupOutgoingLight( builder );
463
459
 
464
- if ( lightsNode && lightsNode.hasLight !== false ) {
460
+ if ( lightsNode && lightsNode.getScope().getLights().length > 0 ) {
465
461
 
466
462
  const lightingModel = this.setupLightingModel( builder );
467
463
 
@@ -624,50 +620,37 @@ class NodeMaterial extends Material {
624
620
 
625
621
  }
626
622
 
627
- static fromMaterial( material ) {
628
-
629
- if ( material.isNodeMaterial === true ) { // is already a node material
630
-
631
- return material;
632
-
633
- }
634
-
635
- const type = material.type.replace( 'Material', 'NodeMaterial' );
636
-
637
- const nodeMaterial = createNodeMaterialFromType( type );
623
+ }
638
624
 
639
- if ( nodeMaterial === undefined ) {
625
+ export default NodeMaterial;
640
626
 
641
- throw new Error( `NodeMaterial: Material "${ material.type }" is not compatible.` );
627
+ NodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( '', NodeMaterial );
642
628
 
643
- }
629
+ export function registerNodeMaterial( type, nodeMaterialClass ) {
644
630
 
645
- for ( const key in material ) {
631
+ const suffix = 'NodeMaterial';
632
+ const nodeMaterialType = type + suffix;
646
633
 
647
- nodeMaterial[ key ] = material[ key ];
634
+ if ( typeof nodeMaterialClass !== 'function' ) throw new Error( `THREE.Node: NodeMaterial class "${ type }" is not a class.` );
648
635
 
649
- }
636
+ if ( NodeMaterials.has( nodeMaterialType ) ) {
650
637
 
651
- return nodeMaterial;
638
+ console.warn( `THREE.Node: Redefinition of NodeMaterial class "${ nodeMaterialType }".` );
639
+ return;
652
640
 
653
641
  }
654
642
 
655
- }
643
+ if ( type.slice( - suffix.length ) === suffix ) {
656
644
 
657
- export default NodeMaterial;
658
-
659
- export function addNodeMaterial( type, nodeMaterial ) {
660
-
661
- if ( typeof nodeMaterial !== 'function' || ! type ) throw new Error( `Node material ${ type } is not a class` );
662
- if ( NodeMaterials.has( type ) ) {
663
-
664
- console.warn( `Redefinition of node material ${ type }` );
645
+ console.warn( `THREE.NodeMaterial: NodeMaterial class ${ nodeMaterialType } should not have '${ suffix }' suffix.` );
665
646
  return;
666
647
 
667
648
  }
668
649
 
669
- NodeMaterials.set( type, nodeMaterial );
670
- nodeMaterial.type = type;
650
+ NodeMaterials.set( nodeMaterialType, nodeMaterialClass );
651
+ nodeMaterialClass.type = nodeMaterialType;
652
+
653
+ return nodeMaterialType;
671
654
 
672
655
  }
673
656
 
@@ -682,5 +665,3 @@ export function createNodeMaterialFromType( type ) {
682
665
  }
683
666
 
684
667
  }
685
-
686
- addNodeMaterial( 'NodeMaterial', NodeMaterial );
@@ -1,6 +1,6 @@
1
1
  // @TODO: We can simplify "export { default as SomeNode, other, exports } from '...'" to just "export * from '...'" if we will use only named exports
2
2
 
3
- export { default as NodeMaterial, addNodeMaterial, createNodeMaterialFromType } from './NodeMaterial.js';
3
+ export { default as NodeMaterial } from './NodeMaterial.js';
4
4
  export { default as InstancedPointsNodeMaterial } from './InstancedPointsNodeMaterial.js';
5
5
  export { default as LineBasicNodeMaterial } from './LineBasicNodeMaterial.js';
6
6
  export { default as LineDashedNodeMaterial } from './LineDashedNodeMaterial.js';
@@ -1,6 +1,6 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
2
 
3
- import { PointsMaterial } from '../../materials/PointsMaterial.js';
3
+ import { PointsMaterial } from '../PointsMaterial.js';
4
4
 
5
5
  const _defaultValues = /*@__PURE__*/ new PointsMaterial();
6
6
 
@@ -13,7 +13,6 @@ class PointsNodeMaterial extends NodeMaterial {
13
13
  this.isPointsNodeMaterial = true;
14
14
 
15
15
  this.lights = false;
16
- this.normals = false;
17
16
  this.transparent = true;
18
17
 
19
18
  this.sizeNode = null;
@@ -36,4 +35,4 @@ class PointsNodeMaterial extends NodeMaterial {
36
35
 
37
36
  export default PointsNodeMaterial;
38
37
 
39
- addNodeMaterial( 'PointsNodeMaterial', PointsNodeMaterial );
38
+ PointsNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Points', PointsNodeMaterial );
@@ -1,7 +1,7 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import ShadowMaskModel from '../functions/ShadowMaskModel.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import ShadowMaskModel from '../../nodes/functions/ShadowMaskModel.js';
3
3
 
4
- import { ShadowMaterial } from '../../materials/ShadowMaterial.js';
4
+ import { ShadowMaterial } from '../ShadowMaterial.js';
5
5
 
6
6
  const _defaultValues = /*@__PURE__*/ new ShadowMaterial();
7
7
 
@@ -31,4 +31,4 @@ class ShadowNodeMaterial extends NodeMaterial {
31
31
 
32
32
  export default ShadowNodeMaterial;
33
33
 
34
- addNodeMaterial( 'ShadowNodeMaterial', ShadowNodeMaterial );
34
+ ShadowNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Shadow', ShadowNodeMaterial );
@@ -1,12 +1,13 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { uniform } from '../core/UniformNode.js';
3
- import { cameraProjectionMatrix } from '../accessors/CameraNode.js';
4
- import { materialRotation } from '../accessors/MaterialNode.js';
5
- import { modelViewMatrix, modelWorldMatrix } from '../accessors/ModelNode.js';
6
- import { positionLocal } from '../accessors/PositionNode.js';
7
- import { float, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { uniform } from '../../nodes/core/UniformNode.js';
3
+ import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
4
+ import { materialRotation } from '../../nodes/accessors/MaterialNode.js';
5
+ import { modelViewMatrix, modelWorldMatrix } from '../../nodes/accessors/ModelNode.js';
6
+ import { positionLocal } from '../../nodes/accessors/Position.js';
7
+ import { rotate } from '../../nodes/utils/RotateNode.js';
8
+ import { float, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
8
9
 
9
- import { SpriteMaterial } from '../../materials/SpriteMaterial.js';
10
+ import { SpriteMaterial } from '../SpriteMaterial.js';
10
11
 
11
12
  const _defaultValues = /*@__PURE__*/ new SpriteMaterial();
12
13
 
@@ -19,7 +20,6 @@ class SpriteNodeMaterial extends NodeMaterial {
19
20
  this.isSpriteNodeMaterial = true;
20
21
 
21
22
  this.lights = false;
22
- this.normals = false;
23
23
 
24
24
  this.positionNode = null;
25
25
  this.rotationNode = null;
@@ -61,7 +61,7 @@ class SpriteNodeMaterial extends NodeMaterial {
61
61
 
62
62
  const rotation = float( rotationNode || materialRotation );
63
63
 
64
- const rotatedPosition = alignedPosition.rotate( rotation );
64
+ const rotatedPosition = rotate( alignedPosition, rotation );
65
65
 
66
66
  mvPosition = vec4( mvPosition.xy.add( rotatedPosition ), mvPosition.zw );
67
67
 
@@ -87,4 +87,4 @@ class SpriteNodeMaterial extends NodeMaterial {
87
87
 
88
88
  export default SpriteNodeMaterial;
89
89
 
90
- addNodeMaterial( 'SpriteNodeMaterial', SpriteNodeMaterial );
90
+ SpriteNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Sprite', SpriteNodeMaterial );
@@ -1,14 +1,13 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { varying } from '../core/VaryingNode.js';
3
- import { property } from '../core/PropertyNode.js';
4
- import { materialReference } from '../accessors/MaterialReferenceNode.js';
5
- import { modelWorldMatrixInverse } from '../accessors/ModelNode.js';
6
- import { cameraPosition } from '../accessors/CameraNode.js';
7
- import { positionGeometry } from '../accessors/PositionNode.js';
8
- import { tslFn, vec2, vec3, vec4 } from '../shadernode/ShaderNode.js';
9
- import { min, max } from '../math/MathNode.js';
10
- import { loop, Break } from '../utils/LoopNode.js';
11
- import { texture3D } from '../accessors/Texture3DNode.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { property } from '../../nodes/core/PropertyNode.js';
3
+ import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
4
+ import { modelWorldMatrixInverse } from '../../nodes/accessors/ModelNode.js';
5
+ import { cameraPosition } from '../../nodes/accessors/Camera.js';
6
+ import { positionGeometry } from '../../nodes/accessors/Position.js';
7
+ import { Fn, varying, vec2, vec3, vec4 } from '../../nodes/tsl/TSLBase.js';
8
+ import { min, max } from '../../nodes/math/MathNode.js';
9
+ import { Loop, Break } from '../../nodes/utils/LoopNode.js';
10
+ import { texture3D } from '../../nodes/accessors/Texture3DNode.js';
12
11
 
13
12
  class VolumeNodeMaterial extends NodeMaterial {
14
13
 
@@ -16,7 +15,6 @@ class VolumeNodeMaterial extends NodeMaterial {
16
15
 
17
16
  super();
18
17
 
19
- this.normals = false;
20
18
  this.lights = false;
21
19
  this.isVolumeNodeMaterial = true;
22
20
  this.testNode = null;
@@ -29,7 +27,7 @@ class VolumeNodeMaterial extends NodeMaterial {
29
27
 
30
28
  const map = texture3D( this.map, null, 0 );
31
29
 
32
- const hitBox = tslFn( ( { orig, dir } ) => {
30
+ const hitBox = Fn( ( { orig, dir } ) => {
33
31
 
34
32
  const box_min = vec3( - 0.5 );
35
33
  const box_max = vec3( 0.5 );
@@ -49,7 +47,7 @@ class VolumeNodeMaterial extends NodeMaterial {
49
47
 
50
48
  } );
51
49
 
52
- this.fragmentNode = tslFn( () => {
50
+ this.fragmentNode = Fn( () => {
53
51
 
54
52
  const vOrigin = varying( vec3( modelWorldMatrixInverse.mul( vec4( cameraPosition, 1.0 ) ) ) );
55
53
  const vDirection = varying( positionGeometry.sub( vOrigin ) );
@@ -69,7 +67,7 @@ class VolumeNodeMaterial extends NodeMaterial {
69
67
 
70
68
  const ac = property( 'vec4', 'ac' ).assign( vec4( materialReference( 'base', 'color' ), 0.0 ) );
71
69
 
72
- loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
70
+ Loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= delta' }, () => {
73
71
 
74
72
  const d = property( 'float', 'd' ).assign( map.uv( p.add( 0.5 ) ).r );
75
73
 
@@ -103,4 +101,4 @@ class VolumeNodeMaterial extends NodeMaterial {
103
101
 
104
102
  export default VolumeNodeMaterial;
105
103
 
106
- addNodeMaterial( 'VolumeNodeMaterial', VolumeNodeMaterial );
104
+ VolumeNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Volume', VolumeNodeMaterial );