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,7 +1,7 @@
1
- import { createNodeFromType } from '../core/Node.js';
2
- import { nodeObject } from '../shadernode/ShaderNode.js';
1
+ import { createNodeFromType } from '../../nodes/core/Node.js';
2
+ import { nodeObject } from '../../nodes/tsl/TSLBase.js';
3
3
 
4
- import { Loader } from '../../loaders/Loader.js';
4
+ import { Loader } from '../Loader.js';
5
5
  import { FileLoader } from '../../loaders/FileLoader.js';
6
6
 
7
7
  class NodeLoader extends Loader {
@@ -56,7 +56,7 @@ class NodeLoader extends Loader {
56
56
 
57
57
  const { uuid, type } = nodeJSON;
58
58
 
59
- nodes[ uuid ] = nodeObject( createNodeFromType( type ) ); // @TODO: Maybe nodeObjectify the node in createNodeFromType?
59
+ nodes[ uuid ] = nodeObject( createNodeFromType( type ) );
60
60
  nodes[ uuid ].uuid = uuid;
61
61
 
62
62
  }
@@ -1,6 +1,5 @@
1
- import { createNodeMaterialFromType } from '../materials/Materials.js';
2
-
3
1
  import { MaterialLoader } from '../../loaders/MaterialLoader.js';
2
+ import { createNodeMaterialFromType } from '../../materials/nodes/NodeMaterial.js';
4
3
 
5
4
  const superFromTypeFunction = MaterialLoader.createMaterialFromType;
6
5
 
@@ -100,6 +100,10 @@ class Material extends EventDispatcher {
100
100
 
101
101
  }
102
102
 
103
+ // onBeforeRender and onBeforeCompile only supported in WebGLRenderer
104
+
105
+ onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}
106
+
103
107
  onBeforeCompile( /* shaderobject, renderer */ ) {}
104
108
 
105
109
  customProgramCacheKey() {
@@ -522,13 +526,6 @@ class Material extends EventDispatcher {
522
526
 
523
527
  }
524
528
 
525
- onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {
526
-
527
- console.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166
528
-
529
- }
530
-
531
-
532
529
  }
533
530
 
534
531
  export { Material };
@@ -1,17 +1,16 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { varying } from '../core/VaryingNode.js';
3
- import { property } from '../core/PropertyNode.js';
4
- import { attribute } from '../core/AttributeNode.js';
5
- import { cameraProjectionMatrix } from '../accessors/CameraNode.js';
6
- import { materialColor, materialPointWidth } from '../accessors/MaterialNode.js'; // or should this be a property, instead?
7
- import { modelViewMatrix } from '../accessors/ModelNode.js';
8
- import { positionGeometry } from '../accessors/PositionNode.js';
9
- import { smoothstep } from '../math/MathNode.js';
10
- import { tslFn, vec2, vec4 } from '../shadernode/ShaderNode.js';
11
- import { uv } from '../accessors/UVNode.js';
12
- import { viewport } from '../display/ViewportNode.js';
13
-
14
- import { PointsMaterial } from '../../materials/PointsMaterial.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { property } from '../../nodes/core/PropertyNode.js';
3
+ import { attribute } from '../../nodes/core/AttributeNode.js';
4
+ import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
5
+ import { materialColor, materialOpacity, materialPointWidth } from '../../nodes/accessors/MaterialNode.js'; // or should this be a property, instead?
6
+ import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
7
+ import { positionGeometry } from '../../nodes/accessors/Position.js';
8
+ import { smoothstep } from '../../nodes/math/MathNode.js';
9
+ import { Fn, varying, vec2, vec4 } from '../../nodes/tsl/TSLBase.js';
10
+ import { uv } from '../../nodes/accessors/UV.js';
11
+ import { viewport } from '../../nodes/display/ViewportNode.js';
12
+
13
+ import { PointsMaterial } from '../PointsMaterial.js';
15
14
 
16
15
  const _defaultValues = /*@__PURE__*/ new PointsMaterial();
17
16
 
@@ -21,8 +20,6 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
21
20
 
22
21
  super();
23
22
 
24
- this.normals = false;
25
-
26
23
  this.lights = false;
27
24
 
28
25
  this.useAlphaToCoverage = true;
@@ -33,6 +30,8 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
33
30
 
34
31
  this.pointColorNode = null;
35
32
 
33
+ this.pointWidthNode = null;
34
+
36
35
  this.setDefaultValues( _defaultValues );
37
36
 
38
37
  this.setupShaders();
@@ -41,17 +40,25 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
41
40
 
42
41
  }
43
42
 
43
+ setup( builder ) {
44
+
45
+ this.setupShaders();
46
+
47
+ super.setup( builder );
48
+
49
+ }
50
+
44
51
  setupShaders() {
45
52
 
46
53
  const useAlphaToCoverage = this.alphaToCoverage;
47
54
  const useColor = this.useColor;
48
55
 
49
- this.vertexNode = tslFn( () => {
56
+ this.vertexNode = Fn( () => {
50
57
 
51
58
  //vUv = uv;
52
59
  varying( vec2(), 'vUv' ).assign( uv() ); // @TODO: Analyze other way to do this
53
60
 
54
- const instancePosition = attribute( 'instancePosition' );
61
+ const instancePosition = attribute( 'instancePosition' ).xyz;
55
62
 
56
63
  // camera space
57
64
  const mvPos = property( 'vec4', 'mvPos' );
@@ -65,7 +72,9 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
65
72
  // offset in ndc space
66
73
  const offset = property( 'vec2', 'offset' );
67
74
  offset.assign( positionGeometry.xy );
68
- offset.assign( offset.mul( materialPointWidth ) );
75
+
76
+ offset.mulAssign( this.pointWidthNode ? this.pointWidthNode : materialPointWidth );
77
+
69
78
  offset.assign( offset.div( viewport.z ) );
70
79
  offset.y.assign( offset.y.mul( aspect ) );
71
80
 
@@ -81,7 +90,7 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
81
90
 
82
91
  } )();
83
92
 
84
- this.fragmentNode = tslFn( () => {
93
+ this.fragmentNode = Fn( () => {
85
94
 
86
95
  const vUv = varying( vec2(), 'vUv' );
87
96
 
@@ -130,12 +139,12 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
130
139
 
131
140
  }
132
141
 
142
+ alpha.mulAssign( materialOpacity );
143
+
133
144
  return vec4( pointColorNode, alpha );
134
145
 
135
146
  } )();
136
147
 
137
- this.needsUpdate = true;
138
-
139
148
  }
140
149
 
141
150
  get alphaToCoverage() {
@@ -149,7 +158,7 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
149
158
  if ( this.useAlphaToCoverage !== value ) {
150
159
 
151
160
  this.useAlphaToCoverage = value;
152
- this.setupShaders();
161
+ this.needsUpdate = true;
153
162
 
154
163
  }
155
164
 
@@ -159,4 +168,4 @@ class InstancedPointsNodeMaterial extends NodeMaterial {
159
168
 
160
169
  export default InstancedPointsNodeMaterial;
161
170
 
162
- addNodeMaterial( 'InstancedPointsNodeMaterial', InstancedPointsNodeMaterial );
171
+ InstancedPointsNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'InstancedPoints', InstancedPointsNodeMaterial );
@@ -1,19 +1,17 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { temp } from '../core/VarNode.js';
3
- import { varying } from '../core/VaryingNode.js';
4
- import { property, varyingProperty } from '../core/PropertyNode.js';
5
- import { attribute } from '../core/AttributeNode.js';
6
- import { cameraProjectionMatrix } from '../accessors/CameraNode.js';
7
- import { materialColor, materialLineScale, materialLineDashSize, materialLineGapSize, materialLineDashOffset, materialLineWidth } from '../accessors/MaterialNode.js';
8
- import { modelViewMatrix } from '../accessors/ModelNode.js';
9
- import { positionGeometry } from '../accessors/PositionNode.js';
10
- import { mix, smoothstep } from '../math/MathNode.js';
11
- import { tslFn, float, vec2, vec3, vec4, If } from '../shadernode/ShaderNode.js';
12
- import { uv } from '../accessors/UVNode.js';
13
- import { viewport } from '../display/ViewportNode.js';
14
- import { dashSize, gapSize } from '../core/PropertyNode.js';
15
-
16
- import { LineDashedMaterial } from '../../materials/LineDashedMaterial.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { property, varyingProperty } from '../../nodes/core/PropertyNode.js';
3
+ import { attribute } from '../../nodes/core/AttributeNode.js';
4
+ import { cameraProjectionMatrix } from '../../nodes/accessors/Camera.js';
5
+ import { materialColor, materialLineScale, materialLineDashSize, materialLineGapSize, materialLineDashOffset, materialLineWidth } from '../../nodes/accessors/MaterialNode.js';
6
+ import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js';
7
+ import { positionGeometry } from '../../nodes/accessors/Position.js';
8
+ import { mix, smoothstep } from '../../nodes/math/MathNode.js';
9
+ import { Fn, varying, float, vec2, vec3, vec4, If } from '../../nodes/tsl/TSLBase.js';
10
+ import { uv } from '../../nodes/accessors/UV.js';
11
+ import { viewport } from '../../nodes/display/ViewportNode.js';
12
+ import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js';
13
+
14
+ import { LineDashedMaterial } from '../LineDashedMaterial.js';
17
15
 
18
16
  const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();
19
17
 
@@ -23,7 +21,6 @@ class Line2NodeMaterial extends NodeMaterial {
23
21
 
24
22
  super();
25
23
 
26
- this.normals = false;
27
24
  this.lights = false;
28
25
 
29
26
  this.setDefaultValues( _defaultValues );
@@ -62,7 +59,7 @@ class Line2NodeMaterial extends NodeMaterial {
62
59
  const useDash = this.dashed;
63
60
  const useWorldUnits = this.worldUnits;
64
61
 
65
- const trimSegment = tslFn( ( { start, end } ) => {
62
+ const trimSegment = Fn( ( { start, end } ) => {
66
63
 
67
64
  const a = cameraProjectionMatrix.element( 2 ).element( 2 ); // 3nd entry in 3th column
68
65
  const b = cameraProjectionMatrix.element( 3 ).element( 2 ); // 3nd entry in 4th column
@@ -74,7 +71,7 @@ class Line2NodeMaterial extends NodeMaterial {
74
71
 
75
72
  } );
76
73
 
77
- this.vertexNode = tslFn( () => {
74
+ this.vertexNode = Fn( () => {
78
75
 
79
76
  varyingProperty( 'vec2', 'vUv' ).assign( uv() );
80
77
 
@@ -111,7 +108,7 @@ class Line2NodeMaterial extends NodeMaterial {
111
108
 
112
109
  end.assign( trimSegment( { start: start, end: end } ) );
113
110
 
114
- } ).elseif( end.z.lessThan( 0.0 ).and( start.z.greaterThanEqual( 0.0 ) ), () => {
111
+ } ).ElseIf( end.z.lessThan( 0.0 ).and( start.z.greaterThanEqual( 0.0 ) ), () => {
115
112
 
116
113
  start.assign( trimSegment( { start: end, end: start } ) );
117
114
 
@@ -128,13 +125,13 @@ class Line2NodeMaterial extends NodeMaterial {
128
125
  const ndcEnd = clipEnd.xyz.div( clipEnd.w );
129
126
 
130
127
  // direction
131
- const dir = ndcEnd.xy.sub( ndcStart.xy ).temp();
128
+ const dir = ndcEnd.xy.sub( ndcStart.xy ).toVar();
132
129
 
133
130
  // account for clip-space aspect ratio
134
131
  dir.x.assign( dir.x.mul( aspect ) );
135
132
  dir.assign( dir.normalize() );
136
133
 
137
- const clip = temp( vec4() );
134
+ const clip = vec4().toVar();
138
135
 
139
136
  if ( useWorldUnits ) {
140
137
 
@@ -147,18 +144,18 @@ class Line2NodeMaterial extends NodeMaterial {
147
144
 
148
145
  const worldPos = varyingProperty( 'vec4', 'worldPos' );
149
146
 
150
- worldPos.assign( positionGeometry.y.lessThan( 0.5 ).cond( start, end ) );
147
+ worldPos.assign( positionGeometry.y.lessThan( 0.5 ).select( start, end ) );
151
148
 
152
149
  // height offset
153
150
  const hw = materialLineWidth.mul( 0.5 );
154
- worldPos.addAssign( vec4( positionGeometry.x.lessThan( 0.0 ).cond( worldUp.mul( hw ), worldUp.mul( hw ).negate() ), 0 ) );
151
+ worldPos.addAssign( vec4( positionGeometry.x.lessThan( 0.0 ).select( worldUp.mul( hw ), worldUp.mul( hw ).negate() ), 0 ) );
155
152
 
156
153
  // don't extend the line if we're rendering dashes because we
157
154
  // won't be rendering the endcaps
158
155
  if ( ! useDash ) {
159
156
 
160
157
  // cap extension
161
- worldPos.addAssign( vec4( positionGeometry.y.lessThan( 0.5 ).cond( worldDir.mul( hw ).negate(), worldDir.mul( hw ) ), 0 ) );
158
+ worldPos.addAssign( vec4( positionGeometry.y.lessThan( 0.5 ).select( worldDir.mul( hw ).negate(), worldDir.mul( hw ) ), 0 ) );
162
159
 
163
160
  // add width to the box
164
161
  worldPos.addAssign( vec4( worldFwd.mul( hw ), 0 ) );
@@ -177,9 +174,9 @@ class Line2NodeMaterial extends NodeMaterial {
177
174
 
178
175
  // shift the depth of the projected points so the line
179
176
  // segments overlap neatly
180
- const clipPose = temp( vec3() );
177
+ const clipPose = vec3().toVar();
181
178
 
182
- clipPose.assign( positionGeometry.y.lessThan( 0.5 ).cond( ndcStart, ndcEnd ) );
179
+ clipPose.assign( positionGeometry.y.lessThan( 0.5 ).select( ndcStart, ndcEnd ) );
183
180
  clip.z.assign( clipPose.z.mul( clip.w ) );
184
181
 
185
182
  } else {
@@ -193,14 +190,14 @@ class Line2NodeMaterial extends NodeMaterial {
193
190
  offset.x.assign( offset.x.div( aspect ) );
194
191
 
195
192
  // sign flip
196
- offset.assign( positionGeometry.x.lessThan( 0.0 ).cond( offset.negate(), offset ) );
193
+ offset.assign( positionGeometry.x.lessThan( 0.0 ).select( offset.negate(), offset ) );
197
194
 
198
195
  // endcaps
199
196
  If( positionGeometry.y.lessThan( 0.0 ), () => {
200
197
 
201
198
  offset.assign( offset.sub( dir ) );
202
199
 
203
- } ).elseif( positionGeometry.y.greaterThan( 1.0 ), () => {
200
+ } ).ElseIf( positionGeometry.y.greaterThan( 1.0 ), () => {
204
201
 
205
202
  offset.assign( offset.add( dir ) );
206
203
 
@@ -213,7 +210,7 @@ class Line2NodeMaterial extends NodeMaterial {
213
210
  offset.assign( offset.div( viewport.w ) );
214
211
 
215
212
  // select end
216
- clip.assign( positionGeometry.y.lessThan( 0.5 ).cond( clipStart, clipEnd ) );
213
+ clip.assign( positionGeometry.y.lessThan( 0.5 ).select( clipStart, clipEnd ) );
217
214
 
218
215
  // back to clip space
219
216
  offset.assign( offset.mul( clip.w ) );
@@ -226,7 +223,7 @@ class Line2NodeMaterial extends NodeMaterial {
226
223
 
227
224
  } )();
228
225
 
229
- const closestLineToLine = tslFn( ( { p1, p2, p3, p4 } ) => {
226
+ const closestLineToLine = Fn( ( { p1, p2, p3, p4 } ) => {
230
227
 
231
228
  const p13 = p1.sub( p3 );
232
229
  const p43 = p4.sub( p3 );
@@ -249,7 +246,7 @@ class Line2NodeMaterial extends NodeMaterial {
249
246
 
250
247
  } );
251
248
 
252
- this.fragmentNode = tslFn( () => {
249
+ this.fragmentNode = Fn( () => {
253
250
 
254
251
  const vUv = varyingProperty( 'vec2', 'vUv' );
255
252
 
@@ -266,7 +263,7 @@ class Line2NodeMaterial extends NodeMaterial {
266
263
  const instanceDistanceStart = attribute( 'instanceDistanceStart' );
267
264
  const instanceDistanceEnd = attribute( 'instanceDistanceEnd' );
268
265
 
269
- const lineDistance = positionGeometry.y.lessThan( 0.5 ).cond( dashScaleNode.mul( instanceDistanceStart ), materialLineScale.mul( instanceDistanceEnd ) );
266
+ const lineDistance = positionGeometry.y.lessThan( 0.5 ).select( dashScaleNode.mul( instanceDistanceStart ), materialLineScale.mul( instanceDistanceEnd ) );
270
267
 
271
268
  const vLineDistance = varying( lineDistance.add( materialLineDashOffset ) );
272
269
  const vLineDistanceOffset = offsetNode ? vLineDistance.add( offsetNode ) : vLineDistance;
@@ -318,7 +315,7 @@ class Line2NodeMaterial extends NodeMaterial {
318
315
  if ( useAlphaToCoverage ) {
319
316
 
320
317
  const a = vUv.x;
321
- const b = vUv.y.greaterThan( 0.0 ).cond( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
318
+ const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
322
319
 
323
320
  const len2 = a.mul( a ).add( b.mul( b ) );
324
321
 
@@ -337,7 +334,7 @@ class Line2NodeMaterial extends NodeMaterial {
337
334
  If( vUv.y.abs().greaterThan( 1.0 ), () => {
338
335
 
339
336
  const a = vUv.x;
340
- const b = vUv.y.greaterThan( 0.0 ).cond( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
337
+ const b = vUv.y.greaterThan( 0.0 ).select( vUv.y.sub( 1.0 ), vUv.y.add( 1.0 ) );
341
338
  const len2 = a.mul( a ).add( b.mul( b ) );
342
339
 
343
340
  len2.greaterThan( 1.0 ).discard();
@@ -361,7 +358,7 @@ class Line2NodeMaterial extends NodeMaterial {
361
358
  const instanceColorStart = attribute( 'instanceColorStart' );
362
359
  const instanceColorEnd = attribute( 'instanceColorEnd' );
363
360
 
364
- const instanceColor = positionGeometry.y.lessThan( 0.5 ).cond( instanceColorStart, instanceColorEnd );
361
+ const instanceColor = positionGeometry.y.lessThan( 0.5 ).select( instanceColorStart, instanceColorEnd );
365
362
 
366
363
  lineColorNode = instanceColor.mul( materialColor );
367
364
 
@@ -437,4 +434,4 @@ class Line2NodeMaterial extends NodeMaterial {
437
434
 
438
435
  export default Line2NodeMaterial;
439
436
 
440
- addNodeMaterial( 'Line2NodeMaterial', Line2NodeMaterial );
437
+ Line2NodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'Line2', Line2NodeMaterial );
@@ -1,6 +1,6 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
2
 
3
- import { LineBasicMaterial } from '../../materials/LineBasicMaterial.js';
3
+ import { LineBasicMaterial } from '../LineBasicMaterial.js';
4
4
 
5
5
  const _defaultValues = /*@__PURE__*/ new LineBasicMaterial();
6
6
 
@@ -13,7 +13,6 @@ class LineBasicNodeMaterial extends NodeMaterial {
13
13
  this.isLineBasicNodeMaterial = true;
14
14
 
15
15
  this.lights = false;
16
- this.normals = false;
17
16
 
18
17
  this.setDefaultValues( _defaultValues );
19
18
 
@@ -25,4 +24,4 @@ class LineBasicNodeMaterial extends NodeMaterial {
25
24
 
26
25
  export default LineBasicNodeMaterial;
27
26
 
28
- addNodeMaterial( 'LineBasicNodeMaterial', LineBasicNodeMaterial );
27
+ LineBasicNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'LineBasic', LineBasicNodeMaterial );
@@ -1,11 +1,10 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { attribute } from '../core/AttributeNode.js';
3
- import { varying } from '../core/VaryingNode.js';
4
- import { materialLineDashSize, materialLineGapSize, materialLineScale } from '../accessors/MaterialNode.js';
5
- import { dashSize, gapSize } from '../core/PropertyNode.js';
6
- import { float } from '../shadernode/ShaderNode.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { attribute } from '../../nodes/core/AttributeNode.js';
3
+ import { materialLineDashSize, materialLineGapSize, materialLineScale } from '../../nodes/accessors/MaterialNode.js';
4
+ import { dashSize, gapSize } from '../../nodes/core/PropertyNode.js';
5
+ import { varying, float } from '../../nodes/tsl/TSLBase.js';
7
6
 
8
- import { LineDashedMaterial } from '../../materials/LineDashedMaterial.js';
7
+ import { LineDashedMaterial } from '../LineDashedMaterial.js';
9
8
 
10
9
  const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();
11
10
 
@@ -18,7 +17,6 @@ class LineDashedNodeMaterial extends NodeMaterial {
18
17
  this.isLineDashedNodeMaterial = true;
19
18
 
20
19
  this.lights = false;
21
- this.normals = false;
22
20
 
23
21
  this.setDefaultValues( _defaultValues );
24
22
 
@@ -52,4 +50,4 @@ class LineDashedNodeMaterial extends NodeMaterial {
52
50
 
53
51
  export default LineDashedNodeMaterial;
54
52
 
55
- addNodeMaterial( 'LineDashedNodeMaterial', LineDashedNodeMaterial );
53
+ LineDashedNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'LineDashed', LineDashedNodeMaterial );
@@ -1,11 +1,12 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { materialLightMap } from '../accessors/MaterialNode.js';
3
- import { MeshBasicMaterial } from '../../materials/MeshBasicMaterial.js';
4
- import BasicEnvironmentNode from '../lighting/BasicEnvironmentNode.js';
5
- import BasicLightMapNode from '../lighting/BasicLightMapNode.js';
6
- import BasicLightingModel from '../functions/BasicLightingModel.js';
7
- import { transformedNormalView, normalView } from '../accessors/NormalNode.js';
8
- import { diffuseColor } from '../core/PropertyNode.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { materialLightMap } from '../../nodes/accessors/MaterialNode.js';
3
+ import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
4
+ import BasicLightMapNode from '../../nodes/lighting/BasicLightMapNode.js';
5
+ import BasicLightingModel from '../../nodes/functions/BasicLightingModel.js';
6
+ import { normalView } from '../../nodes/accessors/Normal.js';
7
+ import { diffuseColor } from '../../nodes/core/PropertyNode.js';
8
+
9
+ import { MeshBasicMaterial } from '../MeshBasicMaterial.js';
9
10
 
10
11
  const _defaultValues = /*@__PURE__*/ new MeshBasicMaterial();
11
12
 
@@ -18,7 +19,6 @@ class MeshBasicNodeMaterial extends NodeMaterial {
18
19
  this.isMeshBasicNodeMaterial = true;
19
20
 
20
21
  this.lights = true;
21
- //this.normals = false; @TODO: normals usage by context
22
22
 
23
23
  this.setDefaultValues( _defaultValues );
24
24
 
@@ -28,7 +28,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
28
28
 
29
29
  setupNormal() {
30
30
 
31
- transformedNormalView.assign( normalView ); // see #28839
31
+ return normalView; // see #28839
32
32
 
33
33
  }
34
34
 
@@ -70,4 +70,4 @@ class MeshBasicNodeMaterial extends NodeMaterial {
70
70
 
71
71
  export default MeshBasicNodeMaterial;
72
72
 
73
- addNodeMaterial( 'MeshBasicNodeMaterial', MeshBasicNodeMaterial );
73
+ MeshBasicNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshBasic', MeshBasicNodeMaterial );
@@ -1,8 +1,8 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import BasicEnvironmentNode from '../lighting/BasicEnvironmentNode.js';
3
- import PhongLightingModel from '../functions/PhongLightingModel.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
3
+ import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js';
4
4
 
5
- import { MeshLambertMaterial } from '../../materials/MeshLambertMaterial.js';
5
+ import { MeshLambertMaterial } from '../MeshLambertMaterial.js';
6
6
 
7
7
  const _defaultValues = /*@__PURE__*/ new MeshLambertMaterial();
8
8
 
@@ -40,4 +40,4 @@ class MeshLambertNodeMaterial extends NodeMaterial {
40
40
 
41
41
  export default MeshLambertNodeMaterial;
42
42
 
43
- addNodeMaterial( 'MeshLambertNodeMaterial', MeshLambertNodeMaterial );
43
+ MeshLambertNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshLambert', MeshLambertNodeMaterial );
@@ -1,11 +1,11 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { materialReference } from '../accessors/MaterialReferenceNode.js';
3
- import { diffuseColor } from '../core/PropertyNode.js';
4
- import { vec3 } from '../shadernode/ShaderNode.js';
5
- import { mix } from '../math/MathNode.js';
6
- import { matcapUV } from '../utils/MatcapUVNode.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { materialReference } from '../../nodes/accessors/MaterialReferenceNode.js';
3
+ import { diffuseColor } from '../../nodes/core/PropertyNode.js';
4
+ import { vec3 } from '../../nodes/tsl/TSLBase.js';
5
+ import { mix } from '../../nodes/math/MathNode.js';
6
+ import { matcapUV } from '../../nodes/utils/MatcapUVNode.js';
7
7
 
8
- import { MeshMatcapMaterial } from '../../materials/MeshMatcapMaterial.js';
8
+ import { MeshMatcapMaterial } from '../MeshMatcapMaterial.js';
9
9
 
10
10
  const _defaultValues = /*@__PURE__*/ new MeshMatcapMaterial();
11
11
 
@@ -50,4 +50,4 @@ class MeshMatcapNodeMaterial extends NodeMaterial {
50
50
 
51
51
  export default MeshMatcapNodeMaterial;
52
52
 
53
- addNodeMaterial( 'MeshMatcapNodeMaterial', MeshMatcapNodeMaterial );
53
+ MeshMatcapNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshMatcap', MeshMatcapNodeMaterial );
@@ -0,0 +1,40 @@
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { diffuseColor } from '../../nodes/core/PropertyNode.js';
3
+ import { directionToColor } from '../../nodes/utils/Packing.js';
4
+ import { materialOpacity } from '../../nodes/accessors/MaterialNode.js';
5
+ import { transformedNormalView } from '../../nodes/accessors/Normal.js';
6
+ import { float, vec4 } from '../../nodes/tsl/TSLBase.js';
7
+
8
+ import { MeshNormalMaterial } from '../MeshNormalMaterial.js';
9
+
10
+ const _defaultValues = /*@__PURE__*/ new MeshNormalMaterial();
11
+
12
+ class MeshNormalNodeMaterial extends NodeMaterial {
13
+
14
+ constructor( parameters ) {
15
+
16
+ super();
17
+
18
+ this.lights = false;
19
+
20
+ this.isMeshNormalNodeMaterial = true;
21
+
22
+ this.setDefaultValues( _defaultValues );
23
+
24
+ this.setValues( parameters );
25
+
26
+ }
27
+
28
+ setupDiffuseColor() {
29
+
30
+ const opacityNode = this.opacityNode ? float( this.opacityNode ) : materialOpacity;
31
+
32
+ diffuseColor.assign( vec4( directionToColor( transformedNormalView ), opacityNode ) );
33
+
34
+ }
35
+
36
+ }
37
+
38
+ export default MeshNormalNodeMaterial;
39
+
40
+ MeshNormalNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshNormal', MeshNormalNodeMaterial );
@@ -1,11 +1,11 @@
1
- import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';
2
- import { shininess, specularColor } from '../core/PropertyNode.js';
3
- import { materialShininess, materialSpecular } from '../accessors/MaterialNode.js';
4
- import { float } from '../shadernode/ShaderNode.js';
5
- import BasicEnvironmentNode from '../lighting/BasicEnvironmentNode.js';
6
- import PhongLightingModel from '../functions/PhongLightingModel.js';
1
+ import NodeMaterial, { registerNodeMaterial } from './NodeMaterial.js';
2
+ import { shininess, specularColor } from '../../nodes/core/PropertyNode.js';
3
+ import { materialShininess, materialSpecular } from '../../nodes/accessors/MaterialNode.js';
4
+ import { float } from '../../nodes/tsl/TSLBase.js';
5
+ import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js';
6
+ import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js';
7
7
 
8
- import { MeshPhongMaterial } from '../../materials/MeshPhongMaterial.js';
8
+ import { MeshPhongMaterial } from '../MeshPhongMaterial.js';
9
9
 
10
10
  const _defaultValues = /*@__PURE__*/ new MeshPhongMaterial();
11
11
 
@@ -35,6 +35,7 @@ class MeshPhongNodeMaterial extends NodeMaterial {
35
35
  return envNode ? new BasicEnvironmentNode( envNode ) : null;
36
36
 
37
37
  }
38
+
38
39
  setupLightingModel( /*builder*/ ) {
39
40
 
40
41
  return new PhongLightingModel();
@@ -70,4 +71,4 @@ class MeshPhongNodeMaterial extends NodeMaterial {
70
71
 
71
72
  export default MeshPhongNodeMaterial;
72
73
 
73
- addNodeMaterial( 'MeshPhongNodeMaterial', MeshPhongNodeMaterial );
74
+ MeshPhongNodeMaterial.type = /*@__PURE__*/ registerNodeMaterial( 'MeshPhong', MeshPhongNodeMaterial );