super-three 0.165.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 (462) hide show
  1. package/build/three.cjs +854 -410
  2. package/build/three.module.js +849 -411
  3. package/build/three.module.min.js +1 -1
  4. package/build/three.webgpu.js +77755 -0
  5. package/build/three.webgpu.min.js +6 -0
  6. package/examples/jsm/Addons.js +5 -2
  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/csm/CSMShader.js +4 -4
  17. package/examples/jsm/effects/AnaglyphEffect.js +6 -13
  18. package/examples/jsm/effects/ParallaxBarrierEffect.js +17 -11
  19. package/examples/jsm/effects/StereoEffect.js +6 -1
  20. package/examples/jsm/environments/RoomEnvironment.js +1 -1
  21. package/examples/jsm/exporters/GLTFExporter.js +13 -4
  22. package/examples/jsm/exporters/USDZExporter.js +29 -8
  23. package/examples/jsm/geometries/TeapotGeometry.js +1 -1
  24. package/examples/jsm/helpers/LightProbeHelper.js +42 -43
  25. package/examples/jsm/helpers/ViewHelper.js +51 -2
  26. package/examples/jsm/libs/tween.module.js +64 -75
  27. package/examples/jsm/lights/RectAreaLightTexturesLib.js +91 -0
  28. package/examples/jsm/lights/RectAreaLightUniformsLib.js +8 -63
  29. package/examples/jsm/lines/webgpu/Line2.js +20 -0
  30. package/examples/jsm/lines/webgpu/LineSegments2.js +376 -0
  31. package/examples/jsm/loaders/FBXLoader.js +23 -45
  32. package/examples/jsm/loaders/GLTFLoader.js +10 -4
  33. package/examples/jsm/loaders/KTX2Loader.js +19 -7
  34. package/examples/jsm/loaders/MaterialXLoader.js +10 -10
  35. package/examples/jsm/loaders/PCDLoader.js +9 -9
  36. package/examples/jsm/loaders/USDZLoader.js +124 -76
  37. package/examples/jsm/loaders/UltraHDRLoader.js +583 -0
  38. package/examples/jsm/loaders/VTKLoader.js +76 -3
  39. package/examples/jsm/misc/GPUComputationRenderer.js +9 -19
  40. package/examples/jsm/modifiers/SimplifyModifier.js +2 -1
  41. package/examples/jsm/objects/InstancedPoints.js +2 -2
  42. package/examples/jsm/objects/SkyMesh.js +188 -0
  43. package/examples/jsm/objects/Water2Mesh.js +159 -0
  44. package/examples/jsm/objects/WaterMesh.js +102 -0
  45. package/examples/jsm/physics/RapierPhysics.js +20 -0
  46. package/examples/jsm/postprocessing/OutlinePass.js +31 -46
  47. package/examples/jsm/postprocessing/RenderTransitionPass.js +13 -38
  48. package/examples/jsm/postprocessing/SSAARenderPass.js +3 -1
  49. package/examples/jsm/postprocessing/SSAOPass.js +6 -9
  50. package/examples/jsm/postprocessing/UnrealBloomPass.js +4 -4
  51. package/examples/jsm/shaders/BleachBypassShader.js +1 -2
  52. package/examples/jsm/shaders/ColorifyShader.js +1 -2
  53. package/examples/jsm/shaders/FXAAShader.js +0 -2
  54. package/examples/jsm/shaders/GTAOShader.js +1 -1
  55. package/examples/jsm/shaders/LuminosityHighPassShader.js +1 -3
  56. package/examples/jsm/shaders/OutputShader.js +1 -1
  57. package/examples/jsm/transpiler/GLSLDecoder.js +46 -4
  58. package/examples/jsm/transpiler/TSLEncoder.js +24 -22
  59. package/examples/jsm/utils/TextureUtils.js +1 -1
  60. package/package.json +8 -6
  61. package/src/Three.WebGPU.js +200 -0
  62. package/src/Three.js +3 -0
  63. package/src/constants.js +4 -1
  64. package/src/core/Object3D.js +22 -22
  65. package/src/extras/Controls.js +32 -0
  66. package/src/extras/TextureUtils.js +210 -0
  67. package/src/lights/Light.js +1 -0
  68. package/src/lights/LightShadow.js +5 -0
  69. package/{examples/jsm/lights → src/lights/webgpu}/IESSpotLight.js +1 -1
  70. package/src/loaders/ObjectLoader.js +33 -2
  71. package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeLoader.js +6 -4
  72. package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeMaterialLoader.js +2 -2
  73. package/{examples/jsm/nodes/loaders → src/loaders/nodes}/NodeObjectLoader.js +2 -1
  74. package/src/materials/Material.js +7 -1
  75. package/{examples/jsm/nodes/materials → src/materials/nodes}/InstancedPointsNodeMaterial.js +36 -27
  76. package/{examples/jsm/nodes/materials → src/materials/nodes}/Line2NodeMaterial.js +37 -40
  77. package/src/materials/nodes/LineBasicNodeMaterial.js +27 -0
  78. package/{examples/jsm/nodes/materials → src/materials/nodes}/LineDashedNodeMaterial.js +10 -11
  79. package/src/materials/nodes/MeshBasicNodeMaterial.js +73 -0
  80. package/src/materials/nodes/MeshLambertNodeMaterial.js +43 -0
  81. package/src/materials/nodes/MeshMatcapNodeMaterial.js +53 -0
  82. package/src/materials/nodes/MeshNormalNodeMaterial.js +40 -0
  83. package/src/materials/nodes/MeshPhongNodeMaterial.js +74 -0
  84. package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshPhysicalNodeMaterial.js +22 -20
  85. package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshSSSNodeMaterial.js +6 -6
  86. package/{examples/jsm/nodes/materials → src/materials/nodes}/MeshStandardNodeMaterial.js +28 -11
  87. package/src/materials/nodes/MeshToonNodeMaterial.js +34 -0
  88. package/{examples/jsm/nodes/materials → src/materials/nodes}/NodeMaterial.js +142 -96
  89. package/{examples/jsm/nodes/materials/Materials.js → src/materials/nodes/NodeMaterials.js} +1 -1
  90. package/{examples/jsm/nodes/materials → src/materials/nodes}/PointsNodeMaterial.js +5 -6
  91. package/src/materials/nodes/ShadowNodeMaterial.js +34 -0
  92. package/{examples/jsm/nodes/materials → src/materials/nodes}/SpriteNodeMaterial.js +13 -13
  93. package/{examples/jsm/nodes/materials → src/materials/nodes}/VolumeNodeMaterial.js +14 -16
  94. package/src/math/Box2.js +4 -4
  95. package/src/math/Box3.js +6 -6
  96. package/src/math/ColorManagement.js +10 -0
  97. package/src/math/Matrix2.js +54 -0
  98. package/src/math/Vector4.js +13 -0
  99. package/src/nodes/Nodes.js +164 -0
  100. package/src/nodes/TSL.js +176 -0
  101. package/{examples/jsm → src}/nodes/accessors/AccessorsUtils.js +8 -8
  102. package/src/nodes/accessors/BatchNode.js +124 -0
  103. package/{examples/jsm/nodes/accessors/BitangentNode.js → src/nodes/accessors/Bitangent.js} +9 -9
  104. package/{examples/jsm → src}/nodes/accessors/BufferAttributeNode.js +41 -6
  105. package/{examples/jsm → src}/nodes/accessors/BufferNode.js +4 -4
  106. package/src/nodes/accessors/Camera.js +19 -0
  107. package/{examples/jsm → src}/nodes/accessors/ClippingNode.js +16 -14
  108. package/src/nodes/accessors/CubeTextureNode.js +76 -0
  109. package/src/nodes/accessors/InstanceNode.js +144 -0
  110. package/src/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
  111. package/{examples/jsm → src}/nodes/accessors/MaterialNode.js +66 -49
  112. package/src/nodes/accessors/MaterialProperties.js +3 -0
  113. package/{examples/jsm → src}/nodes/accessors/MaterialReferenceNode.js +6 -4
  114. package/src/nodes/accessors/ModelNode.js +37 -0
  115. package/{examples/jsm → src}/nodes/accessors/ModelViewProjectionNode.js +6 -7
  116. package/{examples/jsm → src}/nodes/accessors/MorphNode.js +35 -31
  117. package/src/nodes/accessors/Normal.js +62 -0
  118. package/{examples/jsm → src}/nodes/accessors/Object3DNode.js +11 -11
  119. package/src/nodes/accessors/PointUVNode.js +26 -0
  120. package/src/nodes/accessors/Position.js +10 -0
  121. package/src/nodes/accessors/ReferenceBaseNode.js +143 -0
  122. package/{examples/jsm → src}/nodes/accessors/ReferenceNode.js +14 -8
  123. package/src/nodes/accessors/ReflectVector.js +10 -0
  124. package/{examples/jsm → src}/nodes/accessors/RendererReferenceNode.js +6 -6
  125. package/{examples/jsm → src}/nodes/accessors/SceneNode.js +5 -6
  126. package/src/nodes/accessors/SkinningNode.js +187 -0
  127. package/{examples/jsm → src}/nodes/accessors/StorageBufferNode.js +54 -6
  128. package/{examples/jsm → src}/nodes/accessors/StorageTextureNode.js +16 -7
  129. package/src/nodes/accessors/Tangent.js +22 -0
  130. package/{examples/jsm → src}/nodes/accessors/Texture3DNode.js +11 -11
  131. package/{examples/jsm/nodes/accessors/TextureBicubicNode.js → src/nodes/accessors/TextureBicubic.js} +3 -32
  132. package/{examples/jsm → src}/nodes/accessors/TextureNode.js +69 -37
  133. package/{examples/jsm → src}/nodes/accessors/TextureSizeNode.js +4 -6
  134. package/{examples/jsm/nodes/accessors/UniformsNode.js → src/nodes/accessors/UniformArrayNode.js} +24 -9
  135. package/{examples/jsm → src}/nodes/accessors/UserDataNode.js +4 -4
  136. package/src/nodes/accessors/VelocityNode.js +83 -0
  137. package/{examples/jsm → src}/nodes/accessors/VertexColorNode.js +6 -5
  138. package/{examples/jsm → src}/nodes/code/CodeNode.js +5 -5
  139. package/{examples/jsm → src}/nodes/code/ExpressionNode.js +4 -4
  140. package/{examples/jsm → src}/nodes/code/FunctionCallNode.js +5 -5
  141. package/{examples/jsm → src}/nodes/code/FunctionNode.js +5 -23
  142. package/{examples/jsm → src}/nodes/code/ScriptableNode.js +18 -6
  143. package/{examples/jsm → src}/nodes/code/ScriptableValueNode.js +6 -7
  144. package/{examples/jsm → src}/nodes/core/AssignNode.js +5 -5
  145. package/{examples/jsm → src}/nodes/core/AttributeNode.js +22 -21
  146. package/{examples/jsm → src}/nodes/core/BypassNode.js +5 -5
  147. package/src/nodes/core/CacheNode.js +46 -0
  148. package/{examples/jsm → src}/nodes/core/ConstNode.js +2 -2
  149. package/{examples/jsm → src}/nodes/core/ContextNode.js +17 -11
  150. package/{examples/jsm → src}/nodes/core/IndexNode.js +17 -6
  151. package/{examples/jsm → src}/nodes/core/InputNode.js +2 -2
  152. package/{examples/jsm → src}/nodes/core/LightingModel.js +2 -2
  153. package/src/nodes/core/MRTNode.js +82 -0
  154. package/{examples/jsm → src}/nodes/core/Node.js +57 -31
  155. package/{examples/jsm → src}/nodes/core/NodeBuilder.js +216 -65
  156. package/src/nodes/core/NodeCache.js +36 -0
  157. package/{examples/jsm → src}/nodes/core/NodeFrame.js +42 -0
  158. package/{examples/jsm → src}/nodes/core/NodeFunction.js +2 -2
  159. package/{examples/jsm → src}/nodes/core/NodeUniform.js +1 -2
  160. package/{examples/jsm → src}/nodes/core/NodeUtils.js +7 -1
  161. package/{examples/jsm → src}/nodes/core/OutputStructNode.js +4 -4
  162. package/{examples/jsm → src}/nodes/core/ParameterNode.js +4 -4
  163. package/src/nodes/core/PropertyNode.js +84 -0
  164. package/{examples/jsm → src}/nodes/core/StackNode.js +26 -10
  165. package/{examples/jsm → src}/nodes/core/StructTypeNode.js +2 -2
  166. package/{examples/jsm → src}/nodes/core/TempNode.js +4 -4
  167. package/src/nodes/core/UniformGroupNode.js +55 -0
  168. package/{examples/jsm → src}/nodes/core/UniformNode.js +14 -5
  169. package/{examples/jsm → src}/nodes/core/VarNode.js +8 -12
  170. package/{examples/jsm → src}/nodes/core/VaryingNode.js +13 -5
  171. package/{examples/jsm → src}/nodes/display/AfterImageNode.js +27 -35
  172. package/src/nodes/display/AnaglyphPassNode.js +61 -0
  173. package/{examples/jsm → src}/nodes/display/AnamorphicNode.js +27 -30
  174. package/src/nodes/display/BleachBypass.js +26 -0
  175. package/src/nodes/display/BlendMode.js +54 -0
  176. package/src/nodes/display/BloomNode.js +335 -0
  177. package/{examples/jsm → src}/nodes/display/BumpMapNode.js +7 -12
  178. package/src/nodes/display/ColorAdjustment.js +46 -0
  179. package/src/nodes/display/ColorSpaceFunctions.js +38 -0
  180. package/src/nodes/display/ColorSpaceNode.js +85 -0
  181. package/src/nodes/display/DenoiseNode.js +201 -0
  182. package/src/nodes/display/DepthOfFieldNode.js +121 -0
  183. package/src/nodes/display/DotScreenNode.js +63 -0
  184. package/src/nodes/display/FXAANode.js +329 -0
  185. package/src/nodes/display/FilmNode.js +53 -0
  186. package/src/nodes/display/FrontFacingNode.js +41 -0
  187. package/src/nodes/display/GTAONode.js +328 -0
  188. package/{examples/jsm → src}/nodes/display/GaussianBlurNode.js +44 -24
  189. package/src/nodes/display/Lut3DNode.js +54 -0
  190. package/src/nodes/display/MotionBlur.js +25 -0
  191. package/{examples/jsm → src}/nodes/display/NormalMapNode.js +9 -11
  192. package/src/nodes/display/ParallaxBarrierPassNode.js +55 -0
  193. package/src/nodes/display/PassNode.js +367 -0
  194. package/src/nodes/display/PixelationPassNode.js +206 -0
  195. package/{examples/jsm → src}/nodes/display/PosterizeNode.js +4 -6
  196. package/src/nodes/display/RGBShiftNode.js +50 -0
  197. package/src/nodes/display/RenderOutputNode.js +56 -0
  198. package/src/nodes/display/SSAAPassNode.js +284 -0
  199. package/src/nodes/display/Sepia.js +17 -0
  200. package/src/nodes/display/SobelOperatorNode.js +123 -0
  201. package/src/nodes/display/StereoCompositePassNode.js +107 -0
  202. package/src/nodes/display/StereoPassNode.js +80 -0
  203. package/src/nodes/display/ToneMappingFunctions.js +190 -0
  204. package/src/nodes/display/ToneMappingNode.js +66 -0
  205. package/src/nodes/display/TransitionNode.js +77 -0
  206. package/src/nodes/display/ViewportDepthNode.js +121 -0
  207. package/src/nodes/display/ViewportDepthTextureNode.js +30 -0
  208. package/{examples/jsm → src}/nodes/display/ViewportNode.js +28 -26
  209. package/src/nodes/display/ViewportSharedTextureNode.js +36 -0
  210. package/{examples/jsm → src}/nodes/display/ViewportTextureNode.js +12 -12
  211. package/{examples/jsm → src}/nodes/fog/FogExp2Node.js +4 -6
  212. package/{examples/jsm → src}/nodes/fog/FogNode.js +5 -7
  213. package/{examples/jsm → src}/nodes/fog/FogRangeNode.js +4 -6
  214. package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_GGX.js +4 -4
  215. package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Lambert.js +2 -2
  216. package/{examples/jsm → src}/nodes/functions/BSDF/BRDF_Sheen.js +6 -6
  217. package/{examples/jsm → src}/nodes/functions/BSDF/DFGApprox.js +2 -2
  218. package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX.js +2 -2
  219. package/{examples/jsm → src}/nodes/functions/BSDF/D_GGX_Anisotropic.js +3 -3
  220. package/{examples/jsm → src}/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  221. package/{examples/jsm → src}/nodes/functions/BSDF/F_Schlick.js +2 -2
  222. package/src/nodes/functions/BSDF/LTC.js +131 -0
  223. package/{examples/jsm → src}/nodes/functions/BSDF/Schlick_to_F0.js +2 -2
  224. package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +2 -2
  225. package/{examples/jsm → src}/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
  226. package/src/nodes/functions/BasicLightingModel.js +78 -0
  227. package/{examples/jsm → src}/nodes/functions/PhongLightingModel.js +10 -8
  228. package/{examples/jsm → src}/nodes/functions/PhysicalLightingModel.js +73 -31
  229. package/{examples/jsm → src}/nodes/functions/ShadowMaskModel.js +1 -1
  230. package/{examples/jsm → src}/nodes/functions/ToonLightingModel.js +6 -4
  231. package/src/nodes/functions/material/getGeometryRoughness.js +13 -0
  232. package/{examples/jsm → src}/nodes/functions/material/getRoughness.js +2 -2
  233. package/{examples/jsm → src}/nodes/geometry/RangeNode.js +23 -10
  234. package/{examples/jsm → src}/nodes/gpgpu/ComputeNode.js +5 -5
  235. package/src/nodes/lighting/AONode.js +24 -0
  236. package/{examples/jsm → src}/nodes/lighting/AmbientLightNode.js +2 -7
  237. package/src/nodes/lighting/AnalyticLightNode.js +354 -0
  238. package/src/nodes/lighting/BasicEnvironmentNode.js +27 -0
  239. package/src/nodes/lighting/BasicLightMapNode.js +29 -0
  240. package/{examples/jsm → src}/nodes/lighting/DirectionalLightNode.js +3 -9
  241. package/{examples/jsm → src}/nodes/lighting/EnvironmentNode.js +23 -21
  242. package/{examples/jsm → src}/nodes/lighting/HemisphereLightNode.js +4 -7
  243. package/{examples/jsm → src}/nodes/lighting/IESSpotLightNode.js +3 -8
  244. package/{examples/jsm → src}/nodes/lighting/IrradianceNode.js +2 -2
  245. package/{examples/jsm → src}/nodes/lighting/LightNode.js +5 -5
  246. package/src/nodes/lighting/LightProbeNode.js +76 -0
  247. package/{examples/jsm → src}/nodes/lighting/LightUtils.js +3 -3
  248. package/src/nodes/lighting/LightingContextNode.js +64 -0
  249. package/{examples/jsm → src}/nodes/lighting/LightingNode.js +4 -2
  250. package/src/nodes/lighting/LightsNode.js +231 -0
  251. package/{examples/jsm → src}/nodes/lighting/PointLightNode.js +4 -10
  252. package/src/nodes/lighting/RectAreaLightNode.js +93 -0
  253. package/{examples/jsm → src}/nodes/lighting/SpotLightNode.js +4 -10
  254. package/{examples/jsm → src}/nodes/materialx/MaterialXNodes.js +2 -2
  255. package/{examples/jsm → src}/nodes/materialx/lib/mx_hsv.js +43 -46
  256. package/{examples/jsm → src}/nodes/materialx/lib/mx_noise.js +500 -603
  257. package/{examples/jsm → src}/nodes/materialx/lib/mx_transform_color.js +3 -9
  258. package/{examples/jsm/nodes/math/CondNode.js → src/nodes/math/ConditionalNode.js} +31 -13
  259. package/src/nodes/math/Hash.js +13 -0
  260. package/src/nodes/math/MathNode.js +404 -0
  261. package/{examples/jsm → src}/nodes/math/MathUtils.js +0 -7
  262. package/{examples/jsm → src}/nodes/math/OperatorNode.js +100 -58
  263. package/{examples/jsm → src}/nodes/math/TriNoise3D.js +19 -29
  264. package/{examples/jsm → src}/nodes/parsers/GLSLNodeFunction.js +7 -7
  265. package/{examples/jsm → src}/nodes/pmrem/PMREMNode.js +60 -16
  266. package/{examples/jsm → src}/nodes/pmrem/PMREMUtils.js +46 -46
  267. package/src/nodes/procedural/Checker.js +14 -0
  268. package/src/nodes/tsl/TSLBase.js +30 -0
  269. package/{examples/jsm/nodes/shadernode/ShaderNode.js → src/nodes/tsl/TSLCore.js} +106 -96
  270. package/{examples/jsm → src}/nodes/utils/ArrayElementNode.js +2 -2
  271. package/{examples/jsm → src}/nodes/utils/ConvertNode.js +2 -2
  272. package/src/nodes/utils/CubeMapNode.js +157 -0
  273. package/src/nodes/utils/Discard.js +8 -0
  274. package/{examples/jsm → src}/nodes/utils/EquirectUVNode.js +5 -5
  275. package/src/nodes/utils/FlipNode.js +65 -0
  276. package/{examples/jsm → src}/nodes/utils/FunctionOverloadingNode.js +7 -5
  277. package/{examples/jsm → src}/nodes/utils/JoinNode.js +2 -2
  278. package/{examples/jsm → src}/nodes/utils/LoopNode.js +19 -12
  279. package/{examples/jsm → src}/nodes/utils/MatcapUVNode.js +6 -6
  280. package/{examples/jsm → src}/nodes/utils/MaxMipLevelNode.js +12 -6
  281. package/{examples/jsm → src}/nodes/utils/OscNode.js +7 -7
  282. package/src/nodes/utils/Packing.js +4 -0
  283. package/src/nodes/utils/RTTNode.js +130 -0
  284. package/{examples/jsm → src}/nodes/utils/ReflectorNode.js +17 -4
  285. package/{examples/jsm → src}/nodes/utils/RemapNode.js +7 -7
  286. package/{examples/jsm → src}/nodes/utils/RotateNode.js +4 -12
  287. package/{examples/jsm → src}/nodes/utils/SetNode.js +2 -2
  288. package/{examples/jsm → src}/nodes/utils/SplitNode.js +2 -2
  289. package/{examples/jsm → src}/nodes/utils/SpriteSheetUVNode.js +5 -5
  290. package/src/nodes/utils/SpriteUtils.js +47 -0
  291. package/{examples/jsm → src}/nodes/utils/StorageArrayElementNode.js +4 -6
  292. package/{examples/jsm → src}/nodes/utils/TimerNode.js +5 -5
  293. package/{examples/jsm → src}/nodes/utils/TriplanarTexturesNode.js +7 -9
  294. package/src/nodes/utils/UVUtils.js +19 -0
  295. package/src/nodes/utils/ViewportUtils.js +14 -0
  296. package/src/objects/BatchedMesh.js +169 -190
  297. package/src/objects/InstancedMesh.js +1 -1
  298. package/src/renderers/WebGLRenderer.js +60 -23
  299. package/{examples/jsm → src}/renderers/common/Attributes.js +2 -1
  300. package/{examples/jsm → src}/renderers/common/Backend.js +30 -27
  301. package/{examples/jsm → src}/renderers/common/Background.js +12 -4
  302. package/src/renderers/common/BindGroup.js +18 -0
  303. package/{examples/jsm → src}/renderers/common/Bindings.js +45 -32
  304. package/{examples/jsm → src}/renderers/common/ClippingContext.js +18 -7
  305. package/{examples/jsm → src}/renderers/common/Color4.js +1 -1
  306. package/{examples/jsm → src}/renderers/common/CubeRenderTarget.js +16 -4
  307. package/{examples/jsm → src}/renderers/common/Geometries.js +37 -5
  308. package/{examples/jsm → src}/renderers/common/Info.js +34 -6
  309. package/src/renderers/common/PostProcessing.js +90 -0
  310. package/{examples/jsm/objects → src/renderers/common}/QuadMesh.js +8 -3
  311. package/{examples/jsm → src}/renderers/common/RenderContext.js +25 -1
  312. package/{examples/jsm → src}/renderers/common/RenderContexts.js +1 -1
  313. package/{examples/jsm → src}/renderers/common/RenderList.js +1 -1
  314. package/{examples/jsm → src}/renderers/common/RenderObject.js +45 -12
  315. package/{examples/jsm → src}/renderers/common/Renderer.js +151 -73
  316. package/{examples/jsm → src}/renderers/common/SampledTexture.js +14 -5
  317. package/src/renderers/common/StandardRenderer.js +18 -0
  318. package/{examples/jsm → src}/renderers/common/StorageBufferAttribute.js +1 -1
  319. package/{examples/jsm → src}/renderers/common/StorageInstancedBufferAttribute.js +1 -1
  320. package/{examples/jsm → src}/renderers/common/StorageTexture.js +2 -1
  321. package/{examples/jsm → src}/renderers/common/Textures.js +14 -14
  322. package/{examples/jsm → src}/renderers/common/Uniform.js +9 -4
  323. package/{examples/jsm → src}/renderers/common/UniformsGroup.js +69 -31
  324. package/{examples/jsm → src}/renderers/common/extras/PMREMGenerator.js +25 -25
  325. package/src/renderers/common/nodes/NodeBuilderState.js +58 -0
  326. package/src/renderers/common/nodes/NodeLibrary.js +118 -0
  327. package/{examples/jsm → src}/renderers/common/nodes/NodeSampledTexture.js +8 -7
  328. package/{examples/jsm → src}/renderers/common/nodes/NodeSampler.js +2 -1
  329. package/{examples/jsm → src}/renderers/common/nodes/NodeStorageBuffer.js +5 -1
  330. package/{examples/jsm → src}/renderers/common/nodes/NodeUniform.js +3 -3
  331. package/{examples/jsm → src}/renderers/common/nodes/NodeUniformBuffer.js +2 -1
  332. package/{examples/jsm → src}/renderers/common/nodes/NodeUniformsGroup.js +2 -8
  333. package/{examples/jsm → src}/renderers/common/nodes/Nodes.js +69 -21
  334. package/src/renderers/common/nodes/StandardNodeLibrary.js +105 -0
  335. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +16 -1
  336. package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +1 -1
  337. package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +1 -1
  338. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +0 -9
  339. package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -10
  340. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +3 -3
  341. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +45 -13
  342. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +7 -4
  343. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +3 -0
  344. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +3 -3
  345. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +2 -2
  346. package/src/renderers/shaders/ShaderLib/depth.glsl.js +8 -0
  347. package/src/renderers/shaders/UniformsLib.js +3 -0
  348. package/src/renderers/webgl/WebGLAttributes.js +2 -2
  349. package/src/renderers/webgl/WebGLBufferRenderer.js +6 -19
  350. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +6 -18
  351. package/src/renderers/webgl/WebGLLights.js +6 -0
  352. package/src/renderers/webgl/WebGLProgram.js +27 -1
  353. package/src/renderers/webgl/WebGLPrograms.js +1 -1
  354. package/src/renderers/webgl/WebGLProperties.js +7 -0
  355. package/src/renderers/webgl/WebGLTextures.js +75 -57
  356. package/src/renderers/webgl/WebGLUniforms.js +12 -2
  357. package/src/renderers/webgl/WebGLUniformsGroups.js +7 -7
  358. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBackend.js +242 -120
  359. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/nodes/GLSLNodeBuilder.js +227 -44
  360. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLAttributeUtils.js +2 -2
  361. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLConstants.js +1 -0
  362. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLExtensions.js +2 -0
  363. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLState.js +22 -1
  364. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLTextureUtils.js +62 -23
  365. package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLUtils.js +1 -1
  366. package/{examples/jsm → src}/renderers/webgpu/WebGPUBackend.js +242 -136
  367. package/{examples/jsm → src}/renderers/webgpu/WebGPURenderer.js +9 -9
  368. package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeBuilder.js +281 -107
  369. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +159 -0
  370. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUAttributeUtils.js +2 -1
  371. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUBindingUtils.js +64 -33
  372. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUConstants.js +4 -1
  373. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUPipelineUtils.js +34 -36
  374. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTexturePassUtils.js +62 -5
  375. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUTextureUtils.js +76 -44
  376. package/{examples/jsm → src}/renderers/webgpu/utils/WebGPUUtils.js +42 -4
  377. package/src/renderers/webxr/WebXRDepthSensing.js +6 -0
  378. package/src/renderers/webxr/WebXRManager.js +37 -24
  379. package/src/textures/CompressedArrayTexture.js +1 -1
  380. package/examples/jsm/loaders/LogLuvLoader.js +0 -606
  381. package/examples/jsm/nodes/Nodes.js +0 -202
  382. package/examples/jsm/nodes/accessors/BatchNode.js +0 -78
  383. package/examples/jsm/nodes/accessors/CameraNode.js +0 -12
  384. package/examples/jsm/nodes/accessors/CubeTextureNode.js +0 -61
  385. package/examples/jsm/nodes/accessors/InstanceNode.js +0 -94
  386. package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +0 -21
  387. package/examples/jsm/nodes/accessors/ModelNode.js +0 -36
  388. package/examples/jsm/nodes/accessors/NormalNode.js +0 -14
  389. package/examples/jsm/nodes/accessors/PointUVNode.js +0 -26
  390. package/examples/jsm/nodes/accessors/PositionNode.js +0 -10
  391. package/examples/jsm/nodes/accessors/ReflectVectorNode.js +0 -6
  392. package/examples/jsm/nodes/accessors/SkinningNode.js +0 -124
  393. package/examples/jsm/nodes/accessors/TangentNode.js +0 -23
  394. package/examples/jsm/nodes/core/CacheNode.js +0 -49
  395. package/examples/jsm/nodes/core/NodeCache.js +0 -26
  396. package/examples/jsm/nodes/core/NodeKeywords.js +0 -80
  397. package/examples/jsm/nodes/core/PropertyNode.js +0 -83
  398. package/examples/jsm/nodes/core/UniformGroupNode.js +0 -36
  399. package/examples/jsm/nodes/display/BlendModeNode.js +0 -128
  400. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +0 -99
  401. package/examples/jsm/nodes/display/ColorSpaceNode.js +0 -108
  402. package/examples/jsm/nodes/display/FrontFacingNode.js +0 -40
  403. package/examples/jsm/nodes/display/PassNode.js +0 -201
  404. package/examples/jsm/nodes/display/ToneMappingNode.js +0 -188
  405. package/examples/jsm/nodes/display/ViewportDepthNode.js +0 -97
  406. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +0 -31
  407. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +0 -37
  408. package/examples/jsm/nodes/functions/material/getGeometryRoughness.js +0 -13
  409. package/examples/jsm/nodes/lighting/AONode.js +0 -27
  410. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +0 -256
  411. package/examples/jsm/nodes/lighting/LightingContextNode.js +0 -66
  412. package/examples/jsm/nodes/lighting/LightsNode.js +0 -215
  413. package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +0 -28
  414. package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +0 -28
  415. package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +0 -34
  416. package/examples/jsm/nodes/materials/MeshMatcapNodeMaterial.js +0 -52
  417. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +0 -38
  418. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +0 -65
  419. package/examples/jsm/nodes/materials/MeshToonNodeMaterial.js +0 -34
  420. package/examples/jsm/nodes/materials/ShadowNodeMaterial.js +0 -34
  421. package/examples/jsm/nodes/math/HashNode.js +0 -34
  422. package/examples/jsm/nodes/math/MathNode.js +0 -391
  423. package/examples/jsm/nodes/procedural/CheckerNode.js +0 -42
  424. package/examples/jsm/nodes/utils/DiscardNode.js +0 -27
  425. package/examples/jsm/nodes/utils/PackingNode.js +0 -55
  426. package/examples/jsm/nodes/utils/RotateUVNode.js +0 -35
  427. package/examples/jsm/renderers/common/PostProcessing.js +0 -33
  428. package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +0 -44
  429. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +0 -104
  430. /package/{examples/jsm/nodes/accessors/UVNode.js → src/nodes/accessors/UV.js} +0 -0
  431. /package/{examples/jsm → src}/nodes/core/NodeAttribute.js +0 -0
  432. /package/{examples/jsm → src}/nodes/core/NodeCode.js +0 -0
  433. /package/{examples/jsm → src}/nodes/core/NodeFunctionInput.js +0 -0
  434. /package/{examples/jsm → src}/nodes/core/NodeParser.js +0 -0
  435. /package/{examples/jsm → src}/nodes/core/NodeVar.js +0 -0
  436. /package/{examples/jsm → src}/nodes/core/NodeVarying.js +0 -0
  437. /package/{examples/jsm → src}/nodes/core/UniformGroup.js +0 -0
  438. /package/{examples/jsm → src}/nodes/core/constants.js +0 -0
  439. /package/{examples/jsm → src}/nodes/materialx/DISCLAIMER.md +0 -0
  440. /package/{examples/jsm → src}/nodes/parsers/GLSLNodeParser.js +0 -0
  441. /package/{examples/jsm → src}/renderers/common/Animation.js +0 -0
  442. /package/{examples/jsm → src}/renderers/common/Binding.js +0 -0
  443. /package/{examples/jsm → src}/renderers/common/Buffer.js +0 -0
  444. /package/{examples/jsm → src}/renderers/common/BufferUtils.js +0 -0
  445. /package/{examples/jsm → src}/renderers/common/ChainMap.js +0 -0
  446. /package/{examples/jsm → src}/renderers/common/ComputePipeline.js +0 -0
  447. /package/{examples/jsm → src}/renderers/common/Constants.js +0 -0
  448. /package/{examples/jsm → src}/renderers/common/DataMap.js +0 -0
  449. /package/{examples/jsm → src}/renderers/common/Pipeline.js +0 -0
  450. /package/{examples/jsm → src}/renderers/common/Pipelines.js +0 -0
  451. /package/{examples/jsm → src}/renderers/common/ProgrammableStage.js +0 -0
  452. /package/{examples/jsm → src}/renderers/common/RenderBundle.js +0 -0
  453. /package/{examples/jsm → src}/renderers/common/RenderBundles.js +0 -0
  454. /package/{examples/jsm → src}/renderers/common/RenderLists.js +0 -0
  455. /package/{examples/jsm → src}/renderers/common/RenderObjects.js +0 -0
  456. /package/{examples/jsm → src}/renderers/common/RenderPipeline.js +0 -0
  457. /package/{examples/jsm → src}/renderers/common/Sampler.js +0 -0
  458. /package/{examples/jsm → src}/renderers/common/StorageBuffer.js +0 -0
  459. /package/{examples/jsm → src}/renderers/common/UniformBuffer.js +0 -0
  460. /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/WebGLBufferRenderer.js +0 -0
  461. /package/{examples/jsm/renderers/webgl → src/renderers/webgl-fallback}/utils/WebGLCapabilities.js +0 -0
  462. /package/{examples/jsm → src}/renderers/webgpu/nodes/WGSLNodeParser.js +0 -0
@@ -92,7 +92,7 @@ IncidentLight directLight;
92
92
 
93
93
  #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
94
94
  spotLightShadow = spotLightShadows[ i ];
95
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
95
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
96
96
 
97
97
  #endif
98
98
 
@@ -141,7 +141,7 @@ IncidentLight directLight;
141
141
 
142
142
  vec3 prevColor = directLight.color;
143
143
  directionalLightShadow = directionalLightShadows[ i ];
144
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
144
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
145
145
 
146
146
  bool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter;
147
147
  directLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );
@@ -173,7 +173,7 @@ IncidentLight directLight;
173
173
  #if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
174
174
 
175
175
  directionalLightShadow = directionalLightShadows[ i ];
176
- if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
176
+ if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
177
177
 
178
178
  if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
179
179
 
@@ -225,7 +225,7 @@ IncidentLight directLight;
225
225
 
226
226
  #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
227
227
  directionalLightShadow = directionalLightShadows[ i ];
228
- directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
228
+ directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
229
229
  #endif
230
230
 
231
231
  RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
@@ -1,16 +1,13 @@
1
1
  import {
2
2
  LinearFilter,
3
3
  Matrix3,
4
- Mesh,
5
4
  NearestFilter,
6
- OrthographicCamera,
7
- PlaneGeometry,
8
5
  RGBAFormat,
9
- Scene,
10
6
  ShaderMaterial,
11
7
  StereoCamera,
12
8
  WebGLRenderTarget
13
9
  } from 'three';
10
+ import { FullScreenQuad } from '../postprocessing/Pass.js';
14
11
 
15
12
  class AnaglyphEffect {
16
13
 
@@ -30,10 +27,6 @@ class AnaglyphEffect {
30
27
  - 0.00155529, - 0.0184503, 1.2264
31
28
  ] );
32
29
 
33
- const _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
34
-
35
- const _scene = new Scene();
36
-
37
30
  const _stereo = new StereoCamera();
38
31
 
39
32
  const _params = { minFilter: LinearFilter, magFilter: NearestFilter, format: RGBAFormat };
@@ -99,8 +92,7 @@ class AnaglyphEffect {
99
92
 
100
93
  } );
101
94
 
102
- const _mesh = new Mesh( new PlaneGeometry( 2, 2 ), _material );
103
- _scene.add( _mesh );
95
+ const _quad = new FullScreenQuad( _material );
104
96
 
105
97
  this.setSize = function ( width, height ) {
106
98
 
@@ -132,7 +124,7 @@ class AnaglyphEffect {
132
124
  renderer.render( scene, _stereo.cameraR );
133
125
 
134
126
  renderer.setRenderTarget( null );
135
- renderer.render( _scene, _camera );
127
+ _quad.render( renderer );
136
128
 
137
129
  renderer.setRenderTarget( currentRenderTarget );
138
130
 
@@ -142,8 +134,9 @@ class AnaglyphEffect {
142
134
 
143
135
  _renderTargetL.dispose();
144
136
  _renderTargetR.dispose();
145
- _mesh.geometry.dispose();
146
- _mesh.material.dispose();
137
+
138
+ _material.dispose();
139
+ _quad.dispose();
147
140
 
148
141
  };
149
142
 
@@ -1,24 +1,17 @@
1
1
  import {
2
2
  LinearFilter,
3
- Mesh,
4
3
  NearestFilter,
5
- OrthographicCamera,
6
- PlaneGeometry,
7
4
  RGBAFormat,
8
- Scene,
9
5
  ShaderMaterial,
10
6
  StereoCamera,
11
7
  WebGLRenderTarget
12
8
  } from 'three';
9
+ import { FullScreenQuad } from '../postprocessing/Pass.js';
13
10
 
14
11
  class ParallaxBarrierEffect {
15
12
 
16
13
  constructor( renderer ) {
17
14
 
18
- const _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
19
-
20
- const _scene = new Scene();
21
-
22
15
  const _stereo = new StereoCamera();
23
16
 
24
17
  const _params = { minFilter: LinearFilter, magFilter: NearestFilter, format: RGBAFormat };
@@ -77,8 +70,7 @@ class ParallaxBarrierEffect {
77
70
 
78
71
  } );
79
72
 
80
- const mesh = new Mesh( new PlaneGeometry( 2, 2 ), _material );
81
- _scene.add( mesh );
73
+ const _quad = new FullScreenQuad( _material );
82
74
 
83
75
  this.setSize = function ( width, height ) {
84
76
 
@@ -93,6 +85,8 @@ class ParallaxBarrierEffect {
93
85
 
94
86
  this.render = function ( scene, camera ) {
95
87
 
88
+ const currentRenderTarget = renderer.getRenderTarget();
89
+
96
90
  if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();
97
91
 
98
92
  if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld();
@@ -108,7 +102,19 @@ class ParallaxBarrierEffect {
108
102
  renderer.render( scene, _stereo.cameraR );
109
103
 
110
104
  renderer.setRenderTarget( null );
111
- renderer.render( _scene, _camera );
105
+ _quad.render( renderer );
106
+
107
+ renderer.setRenderTarget( currentRenderTarget );
108
+
109
+ };
110
+
111
+ this.dispose = function () {
112
+
113
+ _renderTargetL.dispose();
114
+ _renderTargetR.dispose();
115
+
116
+ _material.dispose();
117
+ _quad.dispose();
112
118
 
113
119
  };
114
120
 
@@ -31,9 +31,12 @@ class StereoEffect {
31
31
 
32
32
  _stereo.update( camera );
33
33
 
34
+ const currentAutoClear = renderer.autoClear;
34
35
  renderer.getSize( size );
35
36
 
36
- if ( renderer.autoClear ) renderer.clear();
37
+ renderer.autoClear = false;
38
+ renderer.clear();
39
+
37
40
  renderer.setScissorTest( true );
38
41
 
39
42
  renderer.setScissor( 0, 0, size.width / 2, size.height );
@@ -46,6 +49,8 @@ class StereoEffect {
46
49
 
47
50
  renderer.setScissorTest( false );
48
51
 
52
+ renderer.autoClear = currentAutoClear;
53
+
49
54
  };
50
55
 
51
56
  }
@@ -14,7 +14,7 @@ import {
14
14
 
15
15
  class RoomEnvironment extends Scene {
16
16
 
17
- constructor( renderer = null ) {
17
+ constructor() {
18
18
 
19
19
  super();
20
20
 
@@ -871,7 +871,9 @@ class GLTFWriter {
871
871
  canvas.width = width;
872
872
  canvas.height = height;
873
873
 
874
- const context = canvas.getContext( '2d' );
874
+ const context = canvas.getContext( '2d', {
875
+ willReadFrequently: true,
876
+ } );
875
877
  context.fillStyle = '#00ffff';
876
878
  context.fillRect( 0, 0, width, height );
877
879
 
@@ -1273,7 +1275,9 @@ class GLTFWriter {
1273
1275
  canvas.width = Math.min( image.width, options.maxTextureSize );
1274
1276
  canvas.height = Math.min( image.height, options.maxTextureSize );
1275
1277
 
1276
- const ctx = canvas.getContext( '2d' );
1278
+ const ctx = canvas.getContext( '2d', {
1279
+ willReadFrequently: true,
1280
+ } );
1277
1281
 
1278
1282
  if ( flipY === true ) {
1279
1283
 
@@ -2109,7 +2113,7 @@ class GLTFWriter {
2109
2113
  if ( ! trackNode || ! trackProperty ) {
2110
2114
 
2111
2115
  console.warn( 'THREE.GLTFExporter: Could not export animation track "%s".', track.name );
2112
- return null;
2116
+ continue;
2113
2117
 
2114
2118
  }
2115
2119
 
@@ -2833,7 +2837,12 @@ class GLTFMaterialsVolumeExtension {
2833
2837
 
2834
2838
  }
2835
2839
 
2836
- extensionDef.attenuationDistance = material.attenuationDistance;
2840
+ if ( material.attenuationDistance !== Infinity ) {
2841
+
2842
+ extensionDef.attenuationDistance = material.attenuationDistance;
2843
+
2844
+ }
2845
+
2837
2846
  extensionDef.attenuationColor = material.attenuationColor.toArray();
2838
2847
 
2839
2848
  materialDef.extensions = materialDef.extensions || {};
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  NoColorSpace,
3
3
  DoubleSide,
4
+ Color,
4
5
  } from 'three';
5
6
 
6
7
  import {
@@ -584,7 +585,7 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
584
585
 
585
586
  inputs.push( `${ pad }color3f inputs:emissiveColor.connect = </Materials/Material_${ material.id }/Texture_${ material.emissiveMap.id }_emissive.outputs:rgb>` );
586
587
 
587
- samplers.push( buildTexture( material.emissiveMap, 'emissive' ) );
588
+ samplers.push( buildTexture( material.emissiveMap, 'emissive', new Color( material.emissive.r * material.emissiveIntensity, material.emissive.g * material.emissiveIntensity, material.emissive.b * material.emissiveIntensity ) ) );
588
589
 
589
590
  } else if ( material.emissive.getHex() > 0 ) {
590
591
 
@@ -604,15 +605,15 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
604
605
 
605
606
  inputs.push( `${ pad }float inputs:occlusion.connect = </Materials/Material_${ material.id }/Texture_${ material.aoMap.id }_occlusion.outputs:r>` );
606
607
 
607
- samplers.push( buildTexture( material.aoMap, 'occlusion' ) );
608
+ samplers.push( buildTexture( material.aoMap, 'occlusion', new Color( material.aoMapIntensity, material.aoMapIntensity, material.aoMapIntensity ) ) );
608
609
 
609
610
  }
610
611
 
611
- if ( material.roughnessMap !== null && material.roughness === 1 ) {
612
+ if ( material.roughnessMap !== null ) {
612
613
 
613
614
  inputs.push( `${ pad }float inputs:roughness.connect = </Materials/Material_${ material.id }/Texture_${ material.roughnessMap.id }_roughness.outputs:g>` );
614
615
 
615
- samplers.push( buildTexture( material.roughnessMap, 'roughness' ) );
616
+ samplers.push( buildTexture( material.roughnessMap, 'roughness', new Color( material.roughness, material.roughness, material.roughness ) ) );
616
617
 
617
618
  } else {
618
619
 
@@ -620,11 +621,11 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
620
621
 
621
622
  }
622
623
 
623
- if ( material.metalnessMap !== null && material.metalness === 1 ) {
624
+ if ( material.metalnessMap !== null ) {
624
625
 
625
626
  inputs.push( `${ pad }float inputs:metallic.connect = </Materials/Material_${ material.id }/Texture_${ material.metalnessMap.id }_metallic.outputs:b>` );
626
627
 
627
- samplers.push( buildTexture( material.metalnessMap, 'metallic' ) );
628
+ samplers.push( buildTexture( material.metalnessMap, 'metallic', new Color( material.metalness, material.metalness, material.metalness ) ) );
628
629
 
629
630
  } else {
630
631
 
@@ -647,8 +648,28 @@ function buildMaterial( material, textures, quickLookCompatible = false ) {
647
648
 
648
649
  if ( material.isMeshPhysicalMaterial ) {
649
650
 
650
- inputs.push( `${ pad }float inputs:clearcoat = ${ material.clearcoat }` );
651
- inputs.push( `${ pad }float inputs:clearcoatRoughness = ${ material.clearcoatRoughness }` );
651
+ if ( material.clearcoatMap !== null ) {
652
+
653
+ inputs.push( `${pad}float inputs:clearcoat.connect = </Materials/Material_${material.id}/Texture_${material.clearcoatMap.id}_clearcoat.outputs:r>` );
654
+ samplers.push( buildTexture( material.clearcoatMap, 'clearcoat', new Color( material.clearcoat, material.clearcoat, material.clearcoat ) ) );
655
+
656
+ } else {
657
+
658
+ inputs.push( `${pad}float inputs:clearcoat = ${material.clearcoat}` );
659
+
660
+ }
661
+
662
+ if ( material.clearcoatRoughnessMap !== null ) {
663
+
664
+ inputs.push( `${pad}float inputs:clearcoatRoughness.connect = </Materials/Material_${material.id}/Texture_${material.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>` );
665
+ samplers.push( buildTexture( material.clearcoatRoughnessMap, 'clearcoatRoughness', new Color( material.clearcoatRoughness, material.clearcoatRoughness, material.clearcoatRoughness ) ) );
666
+
667
+ } else {
668
+
669
+ inputs.push( `${pad}float inputs:clearcoatRoughness = ${material.clearcoatRoughness}` );
670
+
671
+ }
672
+
652
673
  inputs.push( `${ pad }float inputs:ior = ${ material.ior }` );
653
674
 
654
675
  }
@@ -10,7 +10,7 @@ import {
10
10
  * Tessellates the famous Utah teapot database by Martin Newell into triangles.
11
11
  *
12
12
  * Parameters: size = 50, segments = 10, bottom = true, lid = true, body = true,
13
- * fitLid = false, blinn = true
13
+ * fitLid = true, blinn = true
14
14
  *
15
15
  * size is a relative scale: I've scaled the teapot to fit vertically between -1 and 1.
16
16
  * Think of it as a "radius".
@@ -20,79 +20,78 @@ class LightProbeHelper extends Mesh {
20
20
 
21
21
  },
22
22
 
23
- vertexShader: [
23
+ vertexShader: /* glsl */`
24
24
 
25
- 'varying vec3 vNormal;',
25
+ varying vec3 vNormal;
26
26
 
27
- 'void main() {',
27
+ void main() {
28
28
 
29
- ' vNormal = normalize( normalMatrix * normal );',
29
+ vNormal = normalize( normalMatrix * normal );
30
30
 
31
- ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
31
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
32
32
 
33
- '}',
33
+ }
34
34
 
35
- ].join( '\n' ),
35
+ `,
36
36
 
37
- fragmentShader: [
37
+ fragmentShader: /* glsl */`
38
38
 
39
- '#define RECIPROCAL_PI 0.318309886',
39
+ #define RECIPROCAL_PI 0.318309886
40
40
 
41
- 'vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {',
41
+ vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {
42
42
 
43
- ' // matrix is assumed to be orthogonal',
43
+ // matrix is assumed to be orthogonal
44
44
 
45
- ' return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );',
45
+ return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );
46
46
 
47
- '}',
47
+ }
48
48
 
49
- '// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf',
50
- 'vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {',
49
+ // source: https://graphics.stanford.edu/papers/envmap/envmap.pdf,
50
+ vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
51
51
 
52
- ' // normal is assumed to have unit length',
52
+ // normal is assumed to have unit length,
53
53
 
54
- ' float x = normal.x, y = normal.y, z = normal.z;',
54
+ float x = normal.x, y = normal.y, z = normal.z;
55
55
 
56
- ' // band 0',
57
- ' vec3 result = shCoefficients[ 0 ] * 0.886227;',
56
+ // band 0,
57
+ vec3 result = shCoefficients[ 0 ] * 0.886227;
58
58
 
59
- ' // band 1',
60
- ' result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;',
61
- ' result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;',
62
- ' result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;',
59
+ // band 1,
60
+ result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
61
+ result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
62
+ result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
63
63
 
64
- ' // band 2',
65
- ' result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;',
66
- ' result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;',
67
- ' result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );',
68
- ' result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;',
69
- ' result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );',
64
+ // band 2,
65
+ result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
66
+ result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
67
+ result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
68
+ result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
69
+ result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
70
+ return result;
70
71
 
71
- ' return result;',
72
+ }
72
73
 
73
- '}',
74
+ uniform vec3 sh[ 9 ]; // sh coefficients
74
75
 
75
- 'uniform vec3 sh[ 9 ]; // sh coefficients',
76
+ uniform float intensity; // light probe intensity
76
77
 
77
- 'uniform float intensity; // light probe intensity',
78
+ varying vec3 vNormal;
78
79
 
79
- 'varying vec3 vNormal;',
80
+ void main() {
80
81
 
81
- 'void main() {',
82
+ vec3 normal = normalize( vNormal );
82
83
 
83
- ' vec3 normal = normalize( vNormal );',
84
+ vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
84
85
 
85
- ' vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );',
86
+ vec3 irradiance = shGetIrradianceAt( worldNormal, sh );
86
87
 
87
- ' vec3 irradiance = shGetIrradianceAt( worldNormal, sh );',
88
+ vec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;
88
89
 
89
- ' vec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;',
90
+ gl_FragColor = linearToOutputTexel( vec4( outgoingLight, 1.0 ) );
90
91
 
91
- ' gl_FragColor = linearToOutputTexel( vec4( outgoingLight, 1.0 ) );',
92
+ }
92
93
 
93
- '}'
94
-
95
- ].join( '\n' )
94
+ `,
96
95
 
97
96
  } );
98
97
 
@@ -33,6 +33,8 @@ class ViewHelper extends Object3D {
33
33
  const color3 = new Color( '#4488ff' );
34
34
  const color4 = new Color( '#000000' );
35
35
 
36
+ const options = {};
37
+
36
38
  const interactiveObjects = [];
37
39
  const raycaster = new Raycaster();
38
40
  const mouse = new Vector2();
@@ -166,6 +168,26 @@ class ViewHelper extends Object3D {
166
168
 
167
169
  };
168
170
 
171
+ this.setLabels = function ( labelX, labelY, labelZ ) {
172
+
173
+ options.labelX = labelX;
174
+ options.labelY = labelY;
175
+ options.labelZ = labelZ;
176
+
177
+ updateLabels();
178
+
179
+ };
180
+
181
+ this.setLabelStyle = function ( font, color, radius ) {
182
+
183
+ options.font = font;
184
+ options.color = color;
185
+ options.radius = radius;
186
+
187
+ updateLabels();
188
+
189
+ };
190
+
169
191
  this.update = function ( delta ) {
170
192
 
171
193
  const step = delta * turnRate;
@@ -271,7 +293,9 @@ class ViewHelper extends Object3D {
271
293
 
272
294
  }
273
295
 
274
- function getSpriteMaterial( color ) {
296
+ function getSpriteMaterial( color, text ) {
297
+
298
+ const { font = '24px Arial', color: labelColor = '#000000', radius = 14 } = options;
275
299
 
276
300
  const canvas = document.createElement( 'canvas' );
277
301
  canvas.width = 64;
@@ -279,11 +303,20 @@ class ViewHelper extends Object3D {
279
303
 
280
304
  const context = canvas.getContext( '2d' );
281
305
  context.beginPath();
282
- context.arc( 32, 32, 14, 0, 2 * Math.PI );
306
+ context.arc( 32, 32, radius, 0, 2 * Math.PI );
283
307
  context.closePath();
284
308
  context.fillStyle = color.getStyle();
285
309
  context.fill();
286
310
 
311
+ if ( text ) {
312
+
313
+ context.font = font;
314
+ context.textAlign = 'center';
315
+ context.fillStyle = labelColor;
316
+ context.fillText( text, 32, 41 );
317
+
318
+ }
319
+
287
320
  const texture = new CanvasTexture( canvas );
288
321
  texture.colorSpace = SRGBColorSpace;
289
322
 
@@ -291,6 +324,22 @@ class ViewHelper extends Object3D {
291
324
 
292
325
  }
293
326
 
327
+ function updateLabels() {
328
+
329
+ posXAxisHelper.material.map.dispose();
330
+ posYAxisHelper.material.map.dispose();
331
+ posZAxisHelper.material.map.dispose();
332
+
333
+ posXAxisHelper.material.dispose();
334
+ posYAxisHelper.material.dispose();
335
+ posZAxisHelper.material.dispose();
336
+
337
+ posXAxisHelper.material = getSpriteMaterial( color1, options.labelX );
338
+ posYAxisHelper.material = getSpriteMaterial( color2, options.labelY );
339
+ posZAxisHelper.material = getSpriteMaterial( color3, options.labelZ );
340
+
341
+ }
342
+
294
343
  }
295
344
 
296
345
  }