rhodonite 0.25.0 → 0.27.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 (518) hide show
  1. package/README.md +93 -19
  2. package/VERSION-FILE +1 -1
  3. package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.d.ts +54 -0
  4. package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.js +1 -1
  5. package/dist/esm/foundation/components/Camera/CameraComponent.d.ts +34 -0
  6. package/dist/esm/foundation/components/Camera/CameraComponent.js +1 -1
  7. package/dist/esm/foundation/components/Light/LightComponent.d.ts +3 -1
  8. package/dist/esm/foundation/components/Light/LightComponent.js +1 -1
  9. package/dist/esm/foundation/components/Mesh/MeshComponent.js +1 -1
  10. package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.js +1 -1
  11. package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -0
  12. package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.js +1 -1
  13. package/dist/esm/foundation/components/Shape/ShapeComponent.js +1 -1
  14. package/dist/esm/foundation/components/Skeletal/AnimationRetarget/AbsoluteAnimation.js +1 -1
  15. package/dist/esm/foundation/components/Skeletal/AnimationRetarget/GlobalRetarget.js +1 -1
  16. package/dist/esm/foundation/components/Skeletal/AnimationRetarget/GlobalRetargetReverse.js +1 -1
  17. package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +48 -0
  18. package/dist/esm/foundation/components/Skeletal/SkeletalComponent.js +1 -1
  19. package/dist/esm/foundation/components/Transform/TransformComponent.js +1 -1
  20. package/dist/esm/foundation/components/Trigger/TriggerComponent.js +1 -1
  21. package/dist/esm/foundation/components/Vrm/VrmComponent.js +1 -1
  22. package/dist/esm/foundation/constraints/VrmAimConstraint.js +1 -1
  23. package/dist/esm/foundation/constraints/VrmRollConstraint.js +1 -1
  24. package/dist/esm/foundation/constraints/VrmRotationConstraint.js +1 -1
  25. package/dist/esm/foundation/core/Component.js +1 -1
  26. package/dist/esm/foundation/core/ComponentRepository.js +1 -1
  27. package/dist/esm/foundation/core/Entity.js +1 -1
  28. package/dist/esm/foundation/core/EntityRepository.js +1 -1
  29. package/dist/esm/foundation/core/MemoryManager.d.ts +19 -0
  30. package/dist/esm/foundation/core/MemoryManager.js +2 -2
  31. package/dist/esm/foundation/definitions/ShaderSemantics.d.ts +1 -0
  32. package/dist/esm/foundation/definitions/ShaderSemantics.js +2 -2
  33. package/dist/esm/foundation/geometry/ComplexVertexAttribute.js +1 -1
  34. package/dist/esm/foundation/geometry/Mesh.js +1 -1
  35. package/dist/esm/foundation/geometry/Primitive.js +1 -1
  36. package/dist/esm/foundation/gizmos/AABBGizmo.js +1 -1
  37. package/dist/esm/foundation/gizmos/CapsuleColliderGizmo.js +1 -1
  38. package/dist/esm/foundation/gizmos/Gizmo.d.ts +13 -0
  39. package/dist/esm/foundation/gizmos/Gizmo.js +1 -1
  40. package/dist/esm/foundation/gizmos/JointGizmo.js +1 -1
  41. package/dist/esm/foundation/gizmos/LightGizmo.d.ts +0 -1
  42. package/dist/esm/foundation/gizmos/LightGizmo.js +1 -1
  43. package/dist/esm/foundation/gizmos/LocatorGizmo.js +1 -1
  44. package/dist/esm/foundation/gizmos/RotationGizmo.js +1 -1
  45. package/dist/esm/foundation/gizmos/ScaleGizmo.js +1 -1
  46. package/dist/esm/foundation/gizmos/ShapeGizmo.js +1 -1
  47. package/dist/esm/foundation/gizmos/SphereColliderGizmo.js +1 -1
  48. package/dist/esm/foundation/gizmos/TranslationGizmo.js +1 -1
  49. package/dist/esm/foundation/helpers/BloomHelper.js +1 -1
  50. package/dist/esm/foundation/helpers/GaussianBlurHelper.js +1 -1
  51. package/dist/esm/foundation/helpers/Shadow/PointShadowMap.js +1 -1
  52. package/dist/esm/foundation/helpers/Shadow/ShadowMap.js +1 -1
  53. package/dist/esm/foundation/helpers/Shadow/ShadowSystem.js +1 -1
  54. package/dist/esm/foundation/helpers/materials/createMotionVectorMaterial.d.ts +25 -0
  55. package/dist/esm/foundation/helpers/materials/createMotionVectorMaterial.js +1 -0
  56. package/dist/esm/foundation/helpers/materials/createNodeBasedRaymarchingMaterials.js +1 -1
  57. package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.d.ts +33 -0
  58. package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.js +1 -0
  59. package/dist/esm/foundation/helpers/materials/nodeBasedMaterialCommon.js +1 -1
  60. package/dist/esm/foundation/importer/AnimationAssigner.js +1 -1
  61. package/dist/esm/foundation/importer/DrcPointCloudImporter.js +1 -1
  62. package/dist/esm/foundation/importer/Gltf2Importer.d.ts +2 -1
  63. package/dist/esm/foundation/importer/Gltf2Importer.js +1 -1
  64. package/dist/esm/foundation/importer/GltfImporter.js +1 -1
  65. package/dist/esm/foundation/importer/ModelConverter.js +1 -1
  66. package/dist/esm/foundation/importer/RhodoniteImportExtension.js +1 -1
  67. package/dist/esm/foundation/importer/Vrm0xImporter.js +1 -1
  68. package/dist/esm/foundation/importer/VrmImporter.js +1 -1
  69. package/dist/esm/foundation/materials/contents/CustomMaterialContent.js +1 -1
  70. package/dist/esm/foundation/materials/contents/MToon0xMaterialContent.js +18 -18
  71. package/dist/esm/foundation/materials/contents/MToon1MaterialContent.js +6 -6
  72. package/dist/esm/foundation/materials/core/AbstractMaterialContent.d.ts +11 -0
  73. package/dist/esm/foundation/materials/core/AbstractMaterialContent.js +1 -1
  74. package/dist/esm/foundation/materials/core/Material.d.ts +7 -2
  75. package/dist/esm/foundation/materials/core/Material.js +1 -1
  76. package/dist/esm/foundation/materials/core/ShaderityUtilityWebGL.js +2 -2
  77. package/dist/esm/foundation/materials/core/ShaderityUtilityWebGPU.js +2 -2
  78. package/dist/esm/foundation/materials/nodes/CastToFloatShaderNode.js +1 -1
  79. package/dist/esm/foundation/materials/nodes/MergeVectorShaderNode.js +1 -1
  80. package/dist/esm/foundation/materials/nodes/Random_HashPRNGShaderNode.js +1 -1
  81. package/dist/esm/foundation/materials/nodes/Random_SinHashShaderNode.js +1 -1
  82. package/dist/esm/foundation/materials/nodes/SplitVectorShaderNode.js +1 -1
  83. package/dist/esm/foundation/math/MathClassUtil.js +1 -1
  84. package/dist/esm/foundation/math/Quaternion.js +1 -1
  85. package/dist/esm/foundation/math/Transform3D.js +1 -1
  86. package/dist/esm/foundation/math/shapes/MathSphere.js +1 -1
  87. package/dist/esm/foundation/memory/Accessor.js +6 -6
  88. package/dist/esm/foundation/memory/BufferView.js +1 -1
  89. package/dist/esm/foundation/misc/PngDecoder.d.ts +18 -0
  90. package/dist/esm/foundation/misc/PngDecoder.js +1 -0
  91. package/dist/esm/foundation/misc/cache/Cache.js +1 -1
  92. package/dist/esm/foundation/physics/VRMSpring/CapsuleCollider.js +1 -1
  93. package/dist/esm/foundation/physics/VRMSpring/SphereCollider.js +1 -1
  94. package/dist/esm/foundation/physics/VRMSpring/VRMSpringBone.js +1 -1
  95. package/dist/esm/foundation/renderer/Frame.js +1 -1
  96. package/dist/esm/foundation/renderer/RenderPass.d.ts +7 -0
  97. package/dist/esm/foundation/renderer/RenderPass.js +1 -1
  98. package/dist/esm/foundation/renderer/TemporalAA/PreviousFrameDataTracker.d.ts +33 -0
  99. package/dist/esm/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +1 -0
  100. package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +135 -0
  101. package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.js +1 -0
  102. package/dist/esm/foundation/renderer/pipelines/DeferredRenderPipeline.js +1 -1
  103. package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +64 -17
  104. package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.js +1 -1
  105. package/dist/esm/foundation/system/Engine.d.ts +37 -3
  106. package/dist/esm/foundation/system/Engine.js +1 -1
  107. package/dist/esm/foundation/textures/AbstractTexture.js +1 -1
  108. package/dist/esm/foundation/textures/CubeTexture.d.ts +11 -2
  109. package/dist/esm/foundation/textures/CubeTexture.js +1 -1
  110. package/dist/esm/foundation/textures/RenderTargetTexture.js +1 -1
  111. package/dist/esm/foundation/textures/RenderTargetTexture2DArray.js +1 -1
  112. package/dist/esm/foundation/textures/RenderTargetTextureCube.d.ts +6 -0
  113. package/dist/esm/foundation/textures/RenderTargetTextureCube.js +1 -1
  114. package/dist/esm/foundation/textures/Texture.js +1 -1
  115. package/dist/esm/foundation/textures/TextureDataFloat.js +1 -1
  116. package/dist/esm/foundation/textures/VideoTexture.js +1 -1
  117. package/dist/esm/version.js +1 -1
  118. package/dist/esm/webgl/MultiDrawRepository.js +1 -1
  119. package/dist/esm/webgl/WebGLResourceRepository.d.ts +5 -0
  120. package/dist/esm/webgl/WebGLResourceRepository.js +3 -3
  121. package/dist/esm/webgl/WebGLStereoUtil.js +1 -1
  122. package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +27 -14
  123. package/dist/esm/webgl/WebGLStrategyWebGL2.js +74 -55
  124. package/dist/esm/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +0 -3
  125. package/dist/esm/webgl/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.glsl.js +2 -1
  126. package/dist/esm/webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.glsl.js +1 -0
  127. package/dist/esm/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.js +35 -0
  128. package/dist/esm/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +140 -0
  129. package/dist/esm/webgl/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -0
  130. package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +175 -0
  131. package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +18 -0
  132. package/dist/esm/webgl/shaderity_shaders/common/iblDefinition.glsl.js +11 -5
  133. package/dist/esm/webgl/shaders/StandardShaderPart.js +3 -3
  134. package/dist/esm/webgl/shaders/nodes/BlockBeginShader.js +1 -1
  135. package/dist/esm/webgl/shaders/nodes/BlockEndShader.js +1 -1
  136. package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.js +9 -9
  137. package/dist/esm/webgl/shaders/nodes/RaymarchObjectIdUniform.js +3 -3
  138. package/dist/esm/webgl/shaders/nodes/SdApplyWorldMatrix.js +3 -3
  139. package/dist/esm/webgl/shaders/nodes/Texture2DShader.js +14 -14
  140. package/dist/esm/webgl/shaders/nodes/UniformDataShader.js +13 -13
  141. package/dist/esm/webgpu/GpuCullingRegistry.js +1 -1
  142. package/dist/esm/webgpu/GpuDeformRegistry.js +1 -1
  143. package/dist/esm/webgpu/WebGpuGpuCulling.js +1 -1
  144. package/dist/esm/webgpu/WebGpuLightClusterBuilder.js +1 -1
  145. package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +6 -0
  146. package/dist/esm/webgpu/WebGpuResourceRepository.js +5 -5
  147. package/dist/esm/webgpu/WebGpuStrategyBasic.d.ts +8 -0
  148. package/dist/esm/webgpu/WebGpuStrategyBasic.js +78 -59
  149. package/dist/esm/webgpu/WebGpuVertexDeformer.js +1 -1
  150. package/dist/esm/webgpu/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.wgsl.js +1 -0
  151. package/dist/esm/webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.wgsl.js +1 -0
  152. package/dist/esm/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.wgsl.js +30 -0
  153. package/dist/esm/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.wgsl.js +133 -0
  154. package/dist/esm/webgpu/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +1 -0
  155. package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +169 -0
  156. package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +19 -0
  157. package/dist/esm/webgpu/shaderity_shaders/common/iblDefinition.wgsl.js +10 -4
  158. package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.d.ts +54 -0
  159. package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.js +107 -1
  160. package/dist/esmdev/foundation/components/Camera/CameraComponent.d.ts +34 -0
  161. package/dist/esmdev/foundation/components/Camera/CameraComponent.js +118 -46
  162. package/dist/esmdev/foundation/components/CameraController/CameraControllerComponent.js +8 -8
  163. package/dist/esmdev/foundation/components/CharacterController/CharacterAnimationController.js +74 -74
  164. package/dist/esmdev/foundation/components/CharacterController/CharacterControllerComponent.js +39 -39
  165. package/dist/esmdev/foundation/components/Constraint/ConstraintComponent.js +4 -4
  166. package/dist/esmdev/foundation/components/Light/LightComponent.d.ts +3 -1
  167. package/dist/esmdev/foundation/components/Light/LightComponent.js +126 -121
  168. package/dist/esmdev/foundation/components/Mesh/MeshComponent.js +50 -50
  169. package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.js +96 -92
  170. package/dist/esmdev/foundation/components/Physics/PhysicsComponent.js +73 -73
  171. package/dist/esmdev/foundation/components/Raymarching/RaymarchingComponent.js +54 -54
  172. package/dist/esmdev/foundation/components/Raymarching/RaymarchingSdfEvaluator.js +251 -251
  173. package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -0
  174. package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.js +375 -343
  175. package/dist/esmdev/foundation/components/Shape/ShapeComponent.js +31 -31
  176. package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/AbsoluteAnimation.js +5 -5
  177. package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/GlobalRetarget.js +5 -5
  178. package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/GlobalRetargetReverse.js +9 -9
  179. package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +48 -0
  180. package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.js +337 -205
  181. package/dist/esmdev/foundation/components/Transform/TransformComponent.js +93 -93
  182. package/dist/esmdev/foundation/components/Trigger/TriggerComponent.js +61 -61
  183. package/dist/esmdev/foundation/components/Vrm/VrmComponent.js +44 -44
  184. package/dist/esmdev/foundation/constraints/VrmAimConstraint.js +11 -11
  185. package/dist/esmdev/foundation/constraints/VrmRollConstraint.js +16 -16
  186. package/dist/esmdev/foundation/constraints/VrmRotationConstraint.js +10 -10
  187. package/dist/esmdev/foundation/core/Component.js +32 -32
  188. package/dist/esmdev/foundation/core/ComponentMemoryRegistry.js +42 -42
  189. package/dist/esmdev/foundation/core/ComponentRepository.js +37 -37
  190. package/dist/esmdev/foundation/core/Config.js +9 -9
  191. package/dist/esmdev/foundation/core/Entity.js +9 -9
  192. package/dist/esmdev/foundation/core/EntityRepository.js +19 -19
  193. package/dist/esmdev/foundation/core/GlobalDataRepository.js +17 -17
  194. package/dist/esmdev/foundation/core/MemoryManager.d.ts +19 -0
  195. package/dist/esmdev/foundation/core/MemoryManager.js +52 -27
  196. package/dist/esmdev/foundation/core/RnObject.js +37 -37
  197. package/dist/esmdev/foundation/definitions/Blend.js +3 -3
  198. package/dist/esmdev/foundation/definitions/ComponentType.js +7 -7
  199. package/dist/esmdev/foundation/definitions/CompositionType.js +50 -50
  200. package/dist/esmdev/foundation/definitions/CompressionTextureType.js +6 -6
  201. package/dist/esmdev/foundation/definitions/ShaderSemantics.d.ts +1 -0
  202. package/dist/esmdev/foundation/definitions/ShaderSemantics.js +12 -7
  203. package/dist/esmdev/foundation/definitions/TextureFormat.js +3 -3
  204. package/dist/esmdev/foundation/definitions/TextureParameter.js +3 -3
  205. package/dist/esmdev/foundation/definitions/VertexAttribute.js +30 -30
  206. package/dist/esmdev/foundation/enhanced_js_objects/Array.js +2 -2
  207. package/dist/esmdev/foundation/exporter/Gltf2Exporter.js +112 -112
  208. package/dist/esmdev/foundation/geometry/ComplexVertexAttribute.js +24 -24
  209. package/dist/esmdev/foundation/geometry/Frustum.js +41 -41
  210. package/dist/esmdev/foundation/geometry/Mesh.js +219 -219
  211. package/dist/esmdev/foundation/geometry/Primitive.js +134 -134
  212. package/dist/esmdev/foundation/geometry/SimpleVertexAttribute.js +7 -7
  213. package/dist/esmdev/foundation/geometry/shapes/Cylinder.js +3 -3
  214. package/dist/esmdev/foundation/geometry/shapes/Joint.js +33 -33
  215. package/dist/esmdev/foundation/gizmos/AABBGizmo.js +17 -20
  216. package/dist/esmdev/foundation/gizmos/CapsuleColliderGizmo.js +24 -26
  217. package/dist/esmdev/foundation/gizmos/Gizmo.d.ts +13 -0
  218. package/dist/esmdev/foundation/gizmos/Gizmo.js +43 -21
  219. package/dist/esmdev/foundation/gizmos/JointGizmo.js +38 -40
  220. package/dist/esmdev/foundation/gizmos/LightGizmo.d.ts +0 -1
  221. package/dist/esmdev/foundation/gizmos/LightGizmo.js +26 -30
  222. package/dist/esmdev/foundation/gizmos/LocatorGizmo.js +26 -29
  223. package/dist/esmdev/foundation/gizmos/RotationGizmo.js +217 -219
  224. package/dist/esmdev/foundation/gizmos/ScaleGizmo.js +135 -137
  225. package/dist/esmdev/foundation/gizmos/ShapeGizmo.js +44 -47
  226. package/dist/esmdev/foundation/gizmos/SphereColliderGizmo.js +25 -27
  227. package/dist/esmdev/foundation/gizmos/TranslationGizmo.js +133 -135
  228. package/dist/esmdev/foundation/helpers/BloomHelper.js +34 -34
  229. package/dist/esmdev/foundation/helpers/GaussianBlurHelper.js +18 -18
  230. package/dist/esmdev/foundation/helpers/Shadow/PointShadowMap.js +12 -12
  231. package/dist/esmdev/foundation/helpers/Shadow/ShadowMap.js +5 -5
  232. package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.js +119 -119
  233. package/dist/esmdev/foundation/helpers/materials/createMotionVectorMaterial.d.ts +25 -0
  234. package/dist/esmdev/foundation/helpers/materials/createMotionVectorMaterial.js +61 -0
  235. package/dist/esmdev/foundation/helpers/materials/createNodeBasedRaymarchingMaterials.js +10 -1
  236. package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.d.ts +33 -0
  237. package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.js +127 -0
  238. package/dist/esmdev/foundation/helpers/materials/nodeBasedMaterialCommon.js +11 -1
  239. package/dist/esmdev/foundation/importer/AnimationAssigner.js +44 -44
  240. package/dist/esmdev/foundation/importer/DrcPointCloudImporter.js +33 -33
  241. package/dist/esmdev/foundation/importer/Gltf2Importer.d.ts +2 -1
  242. package/dist/esmdev/foundation/importer/Gltf2Importer.js +21 -17
  243. package/dist/esmdev/foundation/importer/GltfImporter.js +22 -22
  244. package/dist/esmdev/foundation/importer/ModelConverter.js +131 -131
  245. package/dist/esmdev/foundation/importer/RhodoniteImportExtension.js +6 -6
  246. package/dist/esmdev/foundation/importer/Vrm0xImporter.js +48 -48
  247. package/dist/esmdev/foundation/importer/VrmImporter.js +10 -10
  248. package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.js +37 -28
  249. package/dist/esmdev/foundation/materials/contents/DepthEncodeMaterialContent.js +2 -2
  250. package/dist/esmdev/foundation/materials/contents/MToon0xMaterialContent.js +147 -139
  251. package/dist/esmdev/foundation/materials/contents/MToon1MaterialContent.js +28 -20
  252. package/dist/esmdev/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +5 -5
  253. package/dist/esmdev/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +5 -5
  254. package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.d.ts +11 -0
  255. package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.js +68 -53
  256. package/dist/esmdev/foundation/materials/core/AbstractShaderNode.js +26 -26
  257. package/dist/esmdev/foundation/materials/core/DummyTextures.js +3 -3
  258. package/dist/esmdev/foundation/materials/core/Material.d.ts +7 -2
  259. package/dist/esmdev/foundation/materials/core/Material.js +132 -118
  260. package/dist/esmdev/foundation/materials/core/MaterialRepository.js +65 -65
  261. package/dist/esmdev/foundation/materials/core/ShaderGraphResolver.js +38 -38
  262. package/dist/esmdev/foundation/materials/core/ShaderHandler.js +4 -4
  263. package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGL.js +16 -17
  264. package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGPU.js +17 -18
  265. package/dist/esmdev/foundation/materials/nodes/AbsShaderNode.js +13 -13
  266. package/dist/esmdev/foundation/materials/nodes/AcosShaderNode.js +13 -13
  267. package/dist/esmdev/foundation/materials/nodes/AddShaderNode.js +18 -18
  268. package/dist/esmdev/foundation/materials/nodes/AlphaTestShaderNode.js +5 -5
  269. package/dist/esmdev/foundation/materials/nodes/AndShaderNode.js +6 -6
  270. package/dist/esmdev/foundation/materials/nodes/Atan2ShaderNode.js +15 -15
  271. package/dist/esmdev/foundation/materials/nodes/AttributeColorShaderNode.js +1 -1
  272. package/dist/esmdev/foundation/materials/nodes/AttributeInstanceIdsShaderNode.js +1 -1
  273. package/dist/esmdev/foundation/materials/nodes/AttributeJointShaderNode.js +1 -1
  274. package/dist/esmdev/foundation/materials/nodes/AttributeNormalShaderNode.js +1 -1
  275. package/dist/esmdev/foundation/materials/nodes/AttributePositionShaderNode.js +2 -2
  276. package/dist/esmdev/foundation/materials/nodes/AttributeTangentShaderNode.js +1 -1
  277. package/dist/esmdev/foundation/materials/nodes/AttributeTexcoordShaderNode.js +2 -2
  278. package/dist/esmdev/foundation/materials/nodes/AttributeWeightShaderNode.js +1 -1
  279. package/dist/esmdev/foundation/materials/nodes/BlockBeginShaderNode.js +11 -11
  280. package/dist/esmdev/foundation/materials/nodes/BlockEndShaderNode.js +6 -6
  281. package/dist/esmdev/foundation/materials/nodes/BranchShaderNode.js +15 -15
  282. package/dist/esmdev/foundation/materials/nodes/CalcBitangentShaderNode.js +7 -7
  283. package/dist/esmdev/foundation/materials/nodes/CastToFloatShaderNode.js +13 -13
  284. package/dist/esmdev/foundation/materials/nodes/ClampShaderNode.js +15 -15
  285. package/dist/esmdev/foundation/materials/nodes/ClassicShaderNode.js +11 -11
  286. package/dist/esmdev/foundation/materials/nodes/ConstantScalarVariableShaderNode.js +1 -1
  287. package/dist/esmdev/foundation/materials/nodes/ConstantVariableShaderNode.js +5 -5
  288. package/dist/esmdev/foundation/materials/nodes/ConstantVector2VariableShaderNode.js +1 -1
  289. package/dist/esmdev/foundation/materials/nodes/ConstantVector3VariableShaderNode.js +1 -1
  290. package/dist/esmdev/foundation/materials/nodes/ConstantVector4VariableShaderNode.js +1 -1
  291. package/dist/esmdev/foundation/materials/nodes/CosShaderNode.js +13 -13
  292. package/dist/esmdev/foundation/materials/nodes/DiscardShaderNode.js +2 -2
  293. package/dist/esmdev/foundation/materials/nodes/DotProductShaderNode.js +10 -10
  294. package/dist/esmdev/foundation/materials/nodes/EqualShaderNode.js +10 -10
  295. package/dist/esmdev/foundation/materials/nodes/FlatShaderNode.js +5 -5
  296. package/dist/esmdev/foundation/materials/nodes/GreaterOrEqualShaderNode.js +10 -10
  297. package/dist/esmdev/foundation/materials/nodes/GreaterShaderNode.js +3 -3
  298. package/dist/esmdev/foundation/materials/nodes/GreaterThanShaderNode.js +10 -10
  299. package/dist/esmdev/foundation/materials/nodes/LengthShaderNode.js +13 -13
  300. package/dist/esmdev/foundation/materials/nodes/LessOrEqualShaderNode.js +10 -10
  301. package/dist/esmdev/foundation/materials/nodes/LessThanShaderNode.js +10 -10
  302. package/dist/esmdev/foundation/materials/nodes/MergeVectorShaderNode.js +19 -19
  303. package/dist/esmdev/foundation/materials/nodes/MinShaderNode.js +18 -18
  304. package/dist/esmdev/foundation/materials/nodes/MultiplyShaderNode.js +21 -21
  305. package/dist/esmdev/foundation/materials/nodes/NormalMatrixShaderNode.js +1 -1
  306. package/dist/esmdev/foundation/materials/nodes/NormalizeShaderNode.js +9 -9
  307. package/dist/esmdev/foundation/materials/nodes/NotEqualShaderNode.js +10 -10
  308. package/dist/esmdev/foundation/materials/nodes/OrShaderNode.js +6 -6
  309. package/dist/esmdev/foundation/materials/nodes/OutColorShaderNode.js +2 -2
  310. package/dist/esmdev/foundation/materials/nodes/OutPositionShaderNode.js +2 -2
  311. package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyPropsShaderNode.js +5 -5
  312. package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyRotationShaderNode.js +3 -3
  313. package/dist/esmdev/foundation/materials/nodes/PbrBaseColorPropsShaderNode.js +5 -5
  314. package/dist/esmdev/foundation/materials/nodes/PbrClearcoatPropsShaderNode.js +7 -7
  315. package/dist/esmdev/foundation/materials/nodes/PbrDiffuseTransmissionPropsShaderNode.js +6 -6
  316. package/dist/esmdev/foundation/materials/nodes/PbrEmissivePropsShaderNode.js +5 -5
  317. package/dist/esmdev/foundation/materials/nodes/PbrIridescencePropsShaderNode.js +8 -8
  318. package/dist/esmdev/foundation/materials/nodes/PbrMetallicRoughnessPropsShaderNode.js +6 -6
  319. package/dist/esmdev/foundation/materials/nodes/PbrNormalPropsShaderNode.js +11 -11
  320. package/dist/esmdev/foundation/materials/nodes/PbrOcclusionPropsShaderNode.js +4 -4
  321. package/dist/esmdev/foundation/materials/nodes/PbrShaderShaderNode.js +21 -21
  322. package/dist/esmdev/foundation/materials/nodes/PbrSheenPropsShaderNode.js +6 -6
  323. package/dist/esmdev/foundation/materials/nodes/PbrSpecularPropsShaderNode.js +6 -6
  324. package/dist/esmdev/foundation/materials/nodes/PbrTransmissionPropsShaderNode.js +4 -4
  325. package/dist/esmdev/foundation/materials/nodes/PbrVolumePropsShaderNode.js +6 -6
  326. package/dist/esmdev/foundation/materials/nodes/PremultipliedAlphaShaderNode.js +4 -4
  327. package/dist/esmdev/foundation/materials/nodes/ProcessGeometryShaderNode.js +22 -22
  328. package/dist/esmdev/foundation/materials/nodes/ProjectionMatrixShaderNode.js +1 -1
  329. package/dist/esmdev/foundation/materials/nodes/Random_HashPRNGShaderNode.js +12 -12
  330. package/dist/esmdev/foundation/materials/nodes/Random_SinHashShaderNode.js +12 -12
  331. package/dist/esmdev/foundation/materials/nodes/RemapShaderNode.js +17 -17
  332. package/dist/esmdev/foundation/materials/nodes/SinShaderNode.js +13 -13
  333. package/dist/esmdev/foundation/materials/nodes/SmoothStepShaderNode.js +15 -15
  334. package/dist/esmdev/foundation/materials/nodes/SplitVectorShaderNode.js +17 -17
  335. package/dist/esmdev/foundation/materials/nodes/StepShaderNode.js +14 -14
  336. package/dist/esmdev/foundation/materials/nodes/TanShaderNode.js +13 -13
  337. package/dist/esmdev/foundation/materials/nodes/Texture2DShaderNode.js +16 -16
  338. package/dist/esmdev/foundation/materials/nodes/TimeShaderNode.js +1 -1
  339. package/dist/esmdev/foundation/materials/nodes/TransformShaderNode.js +10 -10
  340. package/dist/esmdev/foundation/materials/nodes/UniformDataShaderNode.js +5 -5
  341. package/dist/esmdev/foundation/materials/nodes/ViewMatrixShaderNode.js +1 -1
  342. package/dist/esmdev/foundation/materials/nodes/WireframeMaterialNode.js +3 -3
  343. package/dist/esmdev/foundation/materials/nodes/WorldMatrixShaderNode.js +1 -1
  344. package/dist/esmdev/foundation/materials/nodes/raymarching/BendXYShaderNode.js +4 -4
  345. package/dist/esmdev/foundation/materials/nodes/raymarching/BendXZShaderNode.js +4 -4
  346. package/dist/esmdev/foundation/materials/nodes/raymarching/BendYXShaderNode.js +4 -4
  347. package/dist/esmdev/foundation/materials/nodes/raymarching/BendYZShaderNode.js +4 -4
  348. package/dist/esmdev/foundation/materials/nodes/raymarching/BendZXShaderNode.js +4 -4
  349. package/dist/esmdev/foundation/materials/nodes/raymarching/BendZYShaderNode.js +4 -4
  350. package/dist/esmdev/foundation/materials/nodes/raymarching/InitialPositionShaderNode.js +1 -1
  351. package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothIntersectionShaderNode.js +5 -5
  352. package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothSubtractionShaderNode.js +5 -5
  353. package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothUnionShaderNode.js +5 -5
  354. package/dist/esmdev/foundation/materials/nodes/raymarching/OpSubtractionShaderNode.js +6 -6
  355. package/dist/esmdev/foundation/materials/nodes/raymarching/OpUnionShaderNode.js +6 -6
  356. package/dist/esmdev/foundation/materials/nodes/raymarching/OutDistanceShaderNode.js +16 -16
  357. package/dist/esmdev/foundation/materials/nodes/raymarching/OutShadingColorShaderNode.js +2 -2
  358. package/dist/esmdev/foundation/materials/nodes/raymarching/OutUnionShaderNode.js +16 -16
  359. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchCameraPositionShaderNode.js +2 -2
  360. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitDistanceShaderNode.js +2 -2
  361. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitNormalShaderNode.js +2 -2
  362. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitPositionShaderNode.js +2 -2
  363. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdShaderNode.js +2 -2
  364. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdUniformShaderNode.js +4 -4
  365. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchRayDirectionShaderNode.js +2 -2
  366. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchTBNShaderNode.js +2 -2
  367. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchViewDirectionShaderNode.js +2 -2
  368. package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyTransformShaderNode.js +9 -9
  369. package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyWorldMatrixShaderNode.js +5 -5
  370. package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarXShaderNode.js +3 -3
  371. package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarYShaderNode.js +3 -3
  372. package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarZShaderNode.js +3 -3
  373. package/dist/esmdev/foundation/materials/nodes/raymarching/SdBoxShaderNode.js +3 -3
  374. package/dist/esmdev/foundation/materials/nodes/raymarching/SdCapsuleShaderNode.js +5 -5
  375. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatShaderNode.js +4 -4
  376. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXShaderNode.js +4 -4
  377. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXYShaderNode.js +4 -4
  378. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYShaderNode.js +4 -4
  379. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYZShaderNode.js +4 -4
  380. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZShaderNode.js +4 -4
  381. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZXShaderNode.js +4 -4
  382. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRoundBoxShaderNode.js +4 -4
  383. package/dist/esmdev/foundation/materials/nodes/raymarching/SdSphereShaderNode.js +3 -3
  384. package/dist/esmdev/foundation/materials/nodes/raymarching/SdTorusShaderNode.js +4 -4
  385. package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeXShaderNode.js +3 -3
  386. package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeYShaderNode.js +3 -3
  387. package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeZShaderNode.js +3 -3
  388. package/dist/esmdev/foundation/materials/nodes/raymarching/TwistXShaderNode.js +4 -4
  389. package/dist/esmdev/foundation/materials/nodes/raymarching/TwistYShaderNode.js +4 -4
  390. package/dist/esmdev/foundation/materials/nodes/raymarching/TwistZShaderNode.js +4 -4
  391. package/dist/esmdev/foundation/math/AABB.js +132 -132
  392. package/dist/esmdev/foundation/math/AnimatedQuaternion.js +54 -54
  393. package/dist/esmdev/foundation/math/AnimatedScalar.js +55 -55
  394. package/dist/esmdev/foundation/math/AnimatedValueEvaluationState.js +20 -20
  395. package/dist/esmdev/foundation/math/AnimatedVector2.js +55 -55
  396. package/dist/esmdev/foundation/math/AnimatedVector3.js +55 -55
  397. package/dist/esmdev/foundation/math/AnimatedVector4.js +55 -55
  398. package/dist/esmdev/foundation/math/AnimatedVectorN.js +55 -55
  399. package/dist/esmdev/foundation/math/IdentityMatrix33.js +2 -2
  400. package/dist/esmdev/foundation/math/IdentityMatrix44.js +2 -2
  401. package/dist/esmdev/foundation/math/MathClassUtil.js +4 -4
  402. package/dist/esmdev/foundation/math/Quaternion.js +20 -20
  403. package/dist/esmdev/foundation/math/Transform3D.js +83 -83
  404. package/dist/esmdev/foundation/math/shapes/MathSphere.js +9 -9
  405. package/dist/esmdev/foundation/memory/Accessor.js +371 -371
  406. package/dist/esmdev/foundation/memory/Buffer.js +40 -40
  407. package/dist/esmdev/foundation/memory/BufferView.js +33 -33
  408. package/dist/esmdev/foundation/misc/DataUtil.js +2 -2
  409. package/dist/esmdev/foundation/misc/EnumIO.js +10 -10
  410. package/dist/esmdev/foundation/misc/Logger.js +14 -14
  411. package/dist/esmdev/foundation/misc/PngDecoder.d.ts +18 -0
  412. package/dist/esmdev/foundation/misc/PngDecoder.js +113 -0
  413. package/dist/esmdev/foundation/misc/RnPromise.js +14 -14
  414. package/dist/esmdev/foundation/misc/Time.js +27 -27
  415. package/dist/esmdev/foundation/misc/WeakOption.js +14 -14
  416. package/dist/esmdev/foundation/misc/cache/Cache.js +2 -2
  417. package/dist/esmdev/foundation/misc/cache/SymbolWeakMap.js +8 -8
  418. package/dist/esmdev/foundation/physics/PhysicsWorldQuery.js +13 -13
  419. package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.js +202 -202
  420. package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.js +241 -241
  421. package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.js +3 -3
  422. package/dist/esmdev/foundation/physics/VRMSpring/CapsuleCollider.js +42 -42
  423. package/dist/esmdev/foundation/physics/VRMSpring/SphereCollider.js +27 -27
  424. package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBone.js +10 -10
  425. package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBonePhysicsStrategy.js +50 -50
  426. package/dist/esmdev/foundation/renderer/Expression.js +6 -6
  427. package/dist/esmdev/foundation/renderer/Frame.js +12 -12
  428. package/dist/esmdev/foundation/renderer/FrameBuffer.js +25 -25
  429. package/dist/esmdev/foundation/renderer/RenderPass.d.ts +7 -0
  430. package/dist/esmdev/foundation/renderer/RenderPass.js +110 -99
  431. package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.d.ts +33 -0
  432. package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +66 -0
  433. package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +135 -0
  434. package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.js +275 -0
  435. package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystem.js +153 -153
  436. package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystemStub.js +3 -3
  437. package/dist/esmdev/foundation/renderer/pipelines/DeferredRenderPipeline.js +6 -6
  438. package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +64 -17
  439. package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.js +537 -430
  440. package/dist/esmdev/foundation/system/Engine.d.ts +37 -3
  441. package/dist/esmdev/foundation/system/Engine.js +266 -224
  442. package/dist/esmdev/foundation/system/EventPubSub.js +8 -8
  443. package/dist/esmdev/foundation/system/InputManager.js +56 -56
  444. package/dist/esmdev/foundation/system/ModuleManager.js +6 -6
  445. package/dist/esmdev/foundation/textures/AbstractTexture.js +50 -50
  446. package/dist/esmdev/foundation/textures/CubeTexture.d.ts +11 -2
  447. package/dist/esmdev/foundation/textures/CubeTexture.js +47 -36
  448. package/dist/esmdev/foundation/textures/RenderBuffer.js +11 -11
  449. package/dist/esmdev/foundation/textures/RenderTargetTexture.js +25 -25
  450. package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.js +37 -37
  451. package/dist/esmdev/foundation/textures/RenderTargetTextureCube.d.ts +6 -0
  452. package/dist/esmdev/foundation/textures/RenderTargetTextureCube.js +26 -20
  453. package/dist/esmdev/foundation/textures/Sampler.js +24 -24
  454. package/dist/esmdev/foundation/textures/Texture.js +83 -83
  455. package/dist/esmdev/foundation/textures/TextureArray.js +8 -8
  456. package/dist/esmdev/foundation/textures/TextureDataFloat.js +26 -26
  457. package/dist/esmdev/foundation/textures/VideoTexture.js +24 -24
  458. package/dist/esmdev/version.js +2 -2
  459. package/dist/esmdev/webgl/InstanceSidTable.js +62 -62
  460. package/dist/esmdev/webgl/MultiDraw.js +2 -2
  461. package/dist/esmdev/webgl/MultiDrawRepository.js +30 -30
  462. package/dist/esmdev/webgl/WebGLContextWrapper.js +164 -164
  463. package/dist/esmdev/webgl/WebGLGpuTimer.js +32 -32
  464. package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +5 -0
  465. package/dist/esmdev/webgl/WebGLResourceRepository.js +375 -314
  466. package/dist/esmdev/webgl/WebGLStereoUtil.js +42 -42
  467. package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +27 -14
  468. package/dist/esmdev/webgl/WebGLStrategyWebGL2.js +350 -301
  469. package/dist/esmdev/webgl/debug/ShaderParameterDebugger.js +4 -4
  470. package/dist/esmdev/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +2 -2
  471. package/dist/esmdev/webgl/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.glsl.js +2 -2
  472. package/dist/esmdev/webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.glsl.js +2 -2
  473. package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.js +12 -0
  474. package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +12 -0
  475. package/dist/esmdev/webgl/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -2
  476. package/dist/esmdev/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +12 -0
  477. package/dist/esmdev/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +12 -0
  478. package/dist/esmdev/webgl/shaderity_shaders/common/iblDefinition.glsl.js +2 -2
  479. package/dist/esmdev/webgl/shaders/RaymarchingShaderPart.js +4 -4
  480. package/dist/esmdev/webgl/shaders/RaymarchingShadowShaderPart.js +14 -14
  481. package/dist/esmdev/webgl/shaders/StandardShaderPart.js +3 -3
  482. package/dist/esmdev/webgl/shaders/nodes/BlockBeginShader.js +10 -10
  483. package/dist/esmdev/webgl/shaders/nodes/BlockEndShader.js +10 -10
  484. package/dist/esmdev/webgl/shaders/nodes/ConstantVariableShader.js +21 -21
  485. package/dist/esmdev/webgl/shaders/nodes/DiscardShader.js +3 -3
  486. package/dist/esmdev/webgl/shaders/nodes/EndShader.js +3 -3
  487. package/dist/esmdev/webgl/shaders/nodes/OutDistance.js +12 -12
  488. package/dist/esmdev/webgl/shaders/nodes/OutUnion.js +9 -9
  489. package/dist/esmdev/webgl/shaders/nodes/RaymarchObjectIdUniform.js +8 -8
  490. package/dist/esmdev/webgl/shaders/nodes/SdApplyTransform.js +9 -9
  491. package/dist/esmdev/webgl/shaders/nodes/SdApplyWorldMatrix.js +8 -8
  492. package/dist/esmdev/webgl/shaders/nodes/Texture2DShader.js +23 -23
  493. package/dist/esmdev/webgl/shaders/nodes/UniformDataShader.js +23 -23
  494. package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.js +27 -27
  495. package/dist/esmdev/webgpu/GpuCullingRegistry.js +94 -94
  496. package/dist/esmdev/webgpu/GpuDeformRegistry.js +53 -53
  497. package/dist/esmdev/webgpu/RangeAllocator.js +16 -16
  498. package/dist/esmdev/webgpu/WebGpuBufferArena.js +21 -21
  499. package/dist/esmdev/webgpu/WebGpuDeviceWrapper.js +7 -7
  500. package/dist/esmdev/webgpu/WebGpuGpuCulling.js +198 -198
  501. package/dist/esmdev/webgpu/WebGpuGpuTimer.js +52 -52
  502. package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.js +37 -37
  503. package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +6 -0
  504. package/dist/esmdev/webgpu/WebGpuResourceRepository.js +660 -598
  505. package/dist/esmdev/webgpu/WebGpuStrategyBasic.d.ts +8 -0
  506. package/dist/esmdev/webgpu/WebGpuStrategyBasic.js +169 -132
  507. package/dist/esmdev/webgpu/WebGpuVertexDeformer.js +128 -128
  508. package/dist/esmdev/webgpu/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.wgsl.js +2 -2
  509. package/dist/esmdev/webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.wgsl.js +2 -2
  510. package/dist/esmdev/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.wgsl.js +12 -0
  511. package/dist/esmdev/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.wgsl.js +12 -0
  512. package/dist/esmdev/webgpu/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -2
  513. package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +12 -0
  514. package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +12 -0
  515. package/dist/esmdev/webgpu/shaderity_shaders/common/iblDefinition.wgsl.js +2 -2
  516. package/dist/esmdev/xr/WebARSystem.js +69 -69
  517. package/dist/esmdev/xr/WebXRSystem.js +153 -153
  518. package/package.json +2 -1
@@ -1,6 +1,6 @@
1
- import T from"../../../webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.glsl.js";import R from"../../../webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.vert.glsl.js";import M from"../../../webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.wgsl.js";import y from"../../../webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.vert.wgsl.js";import{HdriFormat as h}from"../../definitions/HdriFormat.js";import{ShaderSemantics as b}from"../../definitions/ShaderSemantics.js";import{TextureParameter as p}from"../../definitions/TextureParameter.js";import{MutableVector2 as G}from"../../math/MutableVector2.js";import{MutableVector4 as x}from"../../math/MutableVector4.js";import{Sampler as g}from"../../textures/Sampler.js";import{AbstractMaterialContent as c}from"../core/AbstractMaterialContent.js";var P=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?T:void 0,L=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?R:void 0,E=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?M:void 0,N=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?y:void 0,S=class _ extends c{constructor(e,i,r,n,t,s,m){super(i,{isMorphing:r,isSkinning:n,isLighting:t});let u=this.doShaderReflection(e,L,P,N,E,m);this.Ud=new g(e,{minFilter:p.Linear,magFilter:p.Linear,wrapS:p.ClampToEdge,wrapT:p.ClampToEdge,wrapR:p.ClampToEdge}),this.Wd=new g(e,{minFilter:p.LinearMipmapLinear,magFilter:p.Linear,wrapS:p.ClampToEdge,wrapT:p.ClampToEdge,wrapR:p.ClampToEdge}),this.Ud.created||this.Ud.create(),this.Wd.created||this.Wd.create(),t&&(this.$d+=`#define RN_IS_LIGHTING
2
- `),n&&(this.$d+=`#define RN_IS_SKINNING
3
- `),r&&(this.$d+=`#define RN_IS_MORPHING
4
- `),s&&(this.$d+=`#define RN_MTOON_IS_OUTLINE
5
- `),this.setShaderSemanticsInfoArray(u)}setMaterialParameters(e,i,r){i?(e.cullFace=!0,e.cullFaceBack=!1):r.doubleSided?e.cullFace=!1:(e.cullFace=!0,e.cullFaceBack=!0),r.alphaMode==="MASK"&&(this.$d+=`#define RN_ALPHATEST_ON
6
- `)}_setInternalSettingParametersToGpuWebGpu({material:e,args:i}){let{mipmapLevelNumber:r,meshRenderComponent:n,diffuseHdriType:t,specularHdriType:s,diffuseContribution:m,specularContribution:u}=_.Jd(i),d=c.Qd;d.x=r,d.y=m,d.z=u,d.w=n.rotationOfCubeMap,e.setParameter("iblParameter",d);let l=c.Xd;l.x=t,l.y=s,e.setParameter("hdriFormat",l);let a=i.entity.tryToGetMeshRenderer();if(a!=null&&a.diffuseCubeMap!=null&&a.specularCubeMap!=null){let o=x.zero(),f=G.zero();o.x=a.specularCubeMap.mipmapLevelNumber,o.y=a.diffuseCubeMapContribution,o.z=a.specularCubeMapContribution,o.w=a.rotationOfCubeMap,e.setParameter("iblParameter",o),f.x=a.diffuseCubeMap.hdriFormat.index,f.y=a.specularCubeMap.hdriFormat.index,e.setParameter("hdriFormat",f)}}_setInternalSettingParametersToGpuWebGLPerShaderProgram({engine:e,material:i,shaderProgram:r,args:n}){var m;let t=e.webglResourceRepository,s=i.getTextureParameter(b.DiffuseEnvTexture.str);if(s!=null){let u=s[0];(m=n.diffuseCube)!=null&&m.isTextureReady?t.setUniform1iForTexture(r,b.DiffuseEnvTexture.str,[u,n.diffuseCube,this.Ud]):t.setUniform1iForTexture(r,b.DiffuseEnvTexture.str,[u,e.dummyTextures.dummyBlackCubeTexture])}}_setInternalSettingParametersToGpuWebGLPerMaterial({engine:e,material:i,shaderProgram:r,firstTime:n,args:t}){let{mipmapLevelNumber:s,meshRenderComponent:m,diffuseHdriType:u,specularHdriType:d,diffuseContribution:l,specularContribution:a}=_.Jd(t),o=c.Qd;o.x=s,o.y=l,o.z=a,o.w=m.rotationOfCubeMap,i.setParameter("iblParameter",o);let f=c.Xd;f.x=u,f.y=d,i.setParameter("hdriFormat",f);let C=t.entity.tryToGetBlendShape();this.setMorphInfo(r,t.entity.getMesh(),t.primitive,C)}static Jd(e){let i=1;e.specularCube&&(i=e.specularCube.mipmapLevelNumber);let r=e.entity.getMeshRenderer(),n=h.LDR_SRGB.index,t=h.LDR_SRGB.index;r.diffuseCubeMap&&(n=r.diffuseCubeMap.hdriFormat.index),r.specularCubeMap&&(t=r.specularCubeMap.hdriFormat.index);let s=r.diffuseCubeMap!=null?r.diffuseCubeMapContribution:0,m=r.specularCubeMap!=null?r.specularCubeMapContribution:0;return{mipmapLevelNumber:i,meshRenderComponent:r,diffuseHdriType:n,specularHdriType:t,diffuseContribution:s,specularContribution:m}}};export{S as MToon1MaterialContent};
1
+ import T from"../../../webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.glsl.js";import R from"../../../webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.vert.glsl.js";import y from"../../../webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.wgsl.js";import G from"../../../webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.vert.wgsl.js";import{HdriFormat as h}from"../../definitions/HdriFormat.js";import{ShaderSemantics as _}from"../../definitions/ShaderSemantics.js";import{TextureParameter as u}from"../../definitions/TextureParameter.js";import{MutableVector2 as L}from"../../math/MutableVector2.js";import{MutableVector4 as P}from"../../math/MutableVector4.js";import{Sampler as g}from"../../textures/Sampler.js";import{AbstractMaterialContent as b}from"../core/AbstractMaterialContent.js";var x=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?T:void 0,v=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?R:void 0,E=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?y:void 0,N=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?G:void 0,C=class S extends b{constructor(e,t,i,r,n,o,s){super(t,{isMorphing:i,isSkinning:r,isLighting:n});let m=this.doShaderReflection(e,v,x,N,E,s);this.Yd=new g(e,{minFilter:u.Linear,magFilter:u.Linear,wrapS:u.ClampToEdge,wrapT:u.ClampToEdge,wrapR:u.ClampToEdge}),this.Qd=new g(e,{minFilter:u.LinearMipmapLinear,magFilter:u.Linear,wrapS:u.ClampToEdge,wrapT:u.ClampToEdge,wrapR:u.ClampToEdge}),this.Yd.created||this.Yd.create(),this.Qd.created||this.Qd.create(),n&&(this.r_+=`#define RN_IS_LIGHTING
2
+ `),r&&(this.r_+=`#define RN_IS_SKINNING
3
+ `),i&&(this.r_+=`#define RN_IS_MORPHING
4
+ `),o&&(this.r_+=`#define RN_MTOON_IS_OUTLINE
5
+ `),this.setShaderSemanticsInfoArray(m)}setMaterialParameters(e,t,i){t?(e.cullFace=!0,e.cullFaceBack=!1):i.doubleSided?e.cullFace=!1:(e.cullFace=!0,e.cullFaceBack=!0),i.alphaMode==="MASK"&&(this.r_+=`#define RN_ALPHATEST_ON
6
+ `)}_setInternalSettingParametersToGpuWebGpu({material:e,args:t}){let{mipmapLevelNumber:i,iblMipLevelSkip:r,meshRenderComponent:n,diffuseHdriType:o,specularHdriType:s,diffuseContribution:m,specularContribution:c}=S.rb(t),l=b.nb;l.x=i,l.y=m,l.z=c,l.w=n.rotationOfCubeMap,e.setParameter("iblParameter",l),e.setParameter("iblMipLevelSkip",r);let f=b.sb;f.x=o,f.y=s,e.setParameter("hdriFormat",f);let a=t.entity.tryToGetMeshRenderer();if(a!=null&&a.diffuseCubeMap!=null&&a.specularCubeMap!=null){let p=P.zero(),d=L.zero();p.x=a.specularCubeMap.mipmapLevelNumber,p.y=a.diffuseCubeMapContribution,p.z=a.specularCubeMapContribution,p.w=a.rotationOfCubeMap,e.setParameter("iblParameter",p),e.setParameter("iblMipLevelSkip",a.specularCubeMap.iblMipLevelSkip),d.x=a.diffuseCubeMap.hdriFormat.index,d.y=a.specularCubeMap.hdriFormat.index,e.setParameter("hdriFormat",d)}}_setInternalSettingParametersToGpuWebGLPerShaderProgram({engine:e,material:t,shaderProgram:i,args:r}){var s;let n=e.webglResourceRepository,o=t.getTextureParameter(_.DiffuseEnvTexture.str);if(o!=null){let m=o[0];(s=r.diffuseCube)!=null&&s.isTextureReady?n.setUniform1iForTexture(i,_.DiffuseEnvTexture.str,[m,r.diffuseCube,this.Yd]):n.setUniform1iForTexture(i,_.DiffuseEnvTexture.str,[m,e.dummyTextures.dummyBlackCubeTexture])}}_setInternalSettingParametersToGpuWebGLPerMaterial({engine:e,material:t,shaderProgram:i,firstTime:r,args:n}){let{mipmapLevelNumber:o,iblMipLevelSkip:s,meshRenderComponent:m,diffuseHdriType:c,specularHdriType:l,diffuseContribution:f,specularContribution:a}=S.rb(n),p=b.nb;p.x=o,p.y=f,p.z=a,p.w=m.rotationOfCubeMap,t.setParameter("iblParameter",p),t.setParameter("iblMipLevelSkip",s);let d=b.sb;d.x=c,d.y=l,t.setParameter("hdriFormat",d);let M=n.entity.tryToGetBlendShape();this.setMorphInfo(i,n.entity.getMesh(),n.primitive,M)}static rb(e){let t=1,i=0;e.specularCube&&(t=e.specularCube.mipmapLevelNumber,i=e.specularCube.iblMipLevelSkip);let r=e.entity.getMeshRenderer(),n=h.LDR_SRGB.index,o=h.LDR_SRGB.index;r.diffuseCubeMap&&(n=r.diffuseCubeMap.hdriFormat.index),r.specularCubeMap&&(o=r.specularCubeMap.hdriFormat.index);let s=r.diffuseCubeMap!=null?r.diffuseCubeMapContribution:0,m=r.specularCubeMap!=null?r.specularCubeMapContribution:0;return{mipmapLevelNumber:t,iblMipLevelSkip:i,meshRenderComponent:r,diffuseHdriType:n,specularHdriType:o,diffuseContribution:s,specularContribution:m}}};export{C as MToon1MaterialContent};
@@ -154,6 +154,17 @@ export declare abstract class AbstractMaterialContent extends RnObject {
154
154
  get isLighting(): boolean;
155
155
  /**
156
156
  * Sets the shader semantics information array for this material.
157
+ *
158
+ * A semantic name may arrive more than once: a custom shader can reflect a
159
+ * parameter from its own `// #param` declaration while the material factory
160
+ * declares the same parameter explicitly (for example, the raymarching
161
+ * Uniform nodes). The material's field maps and the buffer view accessors are
162
+ * keyed by the semantic name, so a duplicate leaves a JS-side field pointing
163
+ * at another parameter's memory while the shader reads the first entry's
164
+ * slot, and `setParameter` then updates a value no shader reads. Keep a single
165
+ * definition per semantic: the later definition wins (the explicit factory
166
+ * one over the reflected one) at the position of its first appearance.
167
+ *
157
168
  * @param shaderSemanticsInfoArray - Array of shader semantics information to set
158
169
  */
159
170
  setShaderSemanticsInfoArray(shaderSemanticsInfoArray: ShaderSemanticsInfo[]): void;
@@ -1 +1 @@
1
- import M from"../../../_deps/shaderity.js";import{RnObject as P}from"../../core/RnObject.js";import{CompositionType as I}from"../../definitions/CompositionType.js";import{ProcessApproach as v}from"../../definitions/ProcessApproach.js";import{ShaderType as h}from"../../definitions/ShaderType.js";import{MutableMatrix44 as _}from"../../math/MutableMatrix44.js";import{MutableVector2 as O}from"../../math/MutableVector2.js";import{MutableVector4 as G}from"../../math/MutableVector4.js";import{Vector3 as W}from"../../math/Vector3.js";import{Logger as V}from"../../misc/Logger.js";import{ShaderityUtilityWebGL as D}from"./ShaderityUtilityWebGL.js";import{ShaderityUtilityWebGPU as U}from"./ShaderityUtilityWebGPU.js";var f=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?D:void 0,l=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?U:void 0,S=M.default||M,a=class a extends P{constructor(e,{isMorphing:t=!1,isSkinning:r=!1,isLighting:i=!1}={},s,o,n){super();this.aS=[];this.$d="";this.shaderType=h.VertexAndPixelShader;this.pS="";this.nS="";this.tS=e,n&&(this._engine=n),this.kx=t,this.cS=r,this.ix=i,this.fS=a.hS++,this.setVertexShaderityObject(s,n),this.setPixelShaderityObject(o,n)}get isMultiDrawCompatible(){return!0}static mS(e){let t=a.iS.get(e);return t||(t=new Map,a.iS.set(e,t)),t}static dS(e){let t=a.oS.get(e);return t||(t=new Map,a.oS.set(e,t)),t}static lS(e){let t=a.sS.get(e);return t||(t=new Map,a.sS.set(e,t)),t}setVertexShaderityObject(e,t){if(e){let r=t!=null?t:this._engine;r&&a.mS(r.objectUID).set(this.tS,e)}}setPixelShaderityObject(e,t){if(e){let r=t!=null?t:this._engine;r&&a.dS(r.objectUID).set(this.tS,e)}}makeMaterialSemanticsVariantName(){let e="";for(let t of this.aS)e+=`${t.semantic}_`;this.nS=`semanticsVariation_${e}`,this.pS=`${this.tS}_${this.nS}`}getMaterialSemanticsVariantName(){return this.pS}getMaterialVariationIdentifier(){return this.nS}getBaseMaterialName(){return this.tS.replace(/__$/,"")}get vertexShaderityObject(){if(this._engine)return a.mS(this._engine.objectUID).get(this.tS)}get pixelShaderityObject(){if(this._engine)return a.dS(this._engine.objectUID).get(this.tS)}getDefinitions(){return this.$d}static getMaterialNode(e){return a.materialNodes[e]}get _semanticsInfoArray(){return this.aS}get isSkinning(){return this.cS}get isMorphing(){return this.kx}get isLighting(){return this.ix}setShaderSemanticsInfoArray(e){let t=[];for(let i of e)t.push(i);let r=new Set;r.add(0),t.forEach(i=>{if(I.isTexture(i.compositionType)){let s=i.initialValue[0];s>0&&r.add(s)}}),t.forEach(i=>{if(I.isTexture(i.compositionType)&&i.initialValue[0]<0){let o=-1;for(let n=1;n<32;n++)if(!r.has(n)){o=n;break}o===-1&&V.default.warn(`All texture slots (1-31) are occupied. Cannot assign a valid slot for semantic "${i.semantic}". This may cause rendering issues.`),i.initialValue[0]=o,r.add(o)}}),this.aS=t,this.makeMaterialSemanticsVariantName()}setupBasicInfo(e,t,r,i,s,o){let n=t.entity.tryToGetBlendShape();this.setMorphInfo(r,t.entity.getMesh(),t.primitive,n)}setWorldMatrix(e,t){e._gl.uniformMatrix4fv(e.worldMatrix,!1,t._v)}setNormalMatrix(e,t){e._gl.uniformMatrix3fv(e.normalMatrix,!1,t._v)}setIsBillboard(e,t){e._gl.uniform1i(e.isBillboard,t?1:0)}setIsVisible(e,t){e._gl.uniform1i(e.isVisible,t?1:0)}setViewInfo(e,t,r,i){let s,o;if(r){let n=t.entity.engine._webXRSystemIfEnabled;n!=null&&n.isWebXRMode&&(s=n._getViewMatrixAt(i),o=n._getCameraWorldPositionAt(i))}else t?(o=t.worldPosition,s=t.viewMatrix):(s=_.identity(),o=W.fromCopyArray([0,0,10]));e._gl.uniformMatrix4fv(e.viewMatrix,!1,s._v),e._gl.uniform3fv(e.viewPosition,o._v)}setProjection(e,t,r,i){let s;if(r){let o=t.entity.engine._webXRSystemIfEnabled;o!=null&&o.isWebXRMode&&(s=o._getProjectMatrixAt(i))}else t?s=t.projectionMatrix:s=_.identity();e._gl.uniformMatrix4fv(e.projectionMatrix,!1,s._v)}setMorphInfo(e,t,r,i){if(!this.kx||r.targets.length===0)return;let s=r.constructor.getPrimitiveIdxHasMorph(r.primitiveUid);e._gl.uniform1i(e.currentPrimitiveIdx,s)}_setInternalSettingParametersToGpuWebGLPerShaderProgram(e){}_setInternalSettingParametersToGpuWebGLPerMaterial(e){}_setInternalSettingParametersToGpuWebGLPerPrimitive(e){}_setInternalSettingParametersToGpuWebGpu(e){}getDefinition(){return""}doShaderReflection(e,t,r,i,s,o){this._engine=e;let n=o.join(""),g=a.lS(e.objectUID),x=g.get(this.tS+n);if(x!=null)return x.concat();let y,u;if(e.processApproach===v.WebGPU){let c=S.processPragma(i,!1,o),p=S.processPragma(s,!1,o);y=l.getShaderDataReflection(e,c),u=l.getShaderDataReflection(e,p);let d=l.getShaderDataReflection(e,i),b=l.getShaderDataReflection(e,s);this.setVertexShaderityObject(d.shaderityObject,e),this.setPixelShaderityObject(b.shaderityObject,e)}else{let c=S.processPragma(t,!0,o),p=S.processPragma(r,!0,o);y=f.getShaderDataReflection(e,c),u=f.getShaderDataReflection(e,p);let d=f.getShaderDataReflection(e,t),b=f.getShaderDataReflection(e,r);this.setVertexShaderityObject(d.shaderityObject,e),this.setPixelShaderityObject(b.shaderityObject,e)}let m=[];for(let c of y.shaderSemanticsInfoArray)c.stage=h.VertexShader,m.push(c);for(let c of u.shaderSemanticsInfoArray){let p=m.find(d=>d.semantic===c.semantic);p?p.stage=h.VertexAndPixelShader:(c.stage=h.PixelShader,m.push(c))}return g.set(this.tS+n,m),m.concat()}static _cleanupForEngine(e){a.iS.delete(e.objectUID),a.oS.delete(e.objectUID),a.sS.delete(e.objectUID)}};a.materialNodes=[],a.Qd=G.zero(),a.Xd=O.zero(),a.hS=0,a.iS=new Map,a.oS=new Map,a.sS=new Map;var j=a;export{j as AbstractMaterialContent};
1
+ import x from"../../../_deps/shaderity.js";import{RnObject as P}from"../../core/RnObject.js";import{CompositionType as I}from"../../definitions/CompositionType.js";import{ProcessApproach as v}from"../../definitions/ProcessApproach.js";import{ShaderType as f}from"../../definitions/ShaderType.js";import{MutableMatrix44 as _}from"../../math/MutableMatrix44.js";import{MutableVector2 as O}from"../../math/MutableVector2.js";import{MutableVector4 as G}from"../../math/MutableVector4.js";import{Vector3 as W}from"../../math/Vector3.js";import{Logger as V}from"../../misc/Logger.js";import{ShaderityUtilityWebGL as D}from"./ShaderityUtilityWebGL.js";import{ShaderityUtilityWebGPU as U}from"./ShaderityUtilityWebGPU.js";var l=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?D:void 0,S=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?U:void 0,y=x.default||x,i=class i extends P{constructor(e,{isMorphing:t=!1,isSkinning:a=!1,isLighting:n=!1}={},r,o,s){super();this.aS=[];this.r_="";this.shaderType=f.VertexAndPixelShader;this.pS="";this.nS="";this.tS=e,s&&(this._engine=s),this.kx=t,this.cS=a,this.ix=n,this.fS=i.hS++,this.setVertexShaderityObject(r,s),this.setPixelShaderityObject(o,s)}get isMultiDrawCompatible(){return!0}static mS(e){let t=i.iS.get(e);return t||(t=new Map,i.iS.set(e,t)),t}static dS(e){let t=i.oS.get(e);return t||(t=new Map,i.oS.set(e,t)),t}static lS(e){let t=i.sS.get(e);return t||(t=new Map,i.sS.set(e,t)),t}setVertexShaderityObject(e,t){if(e){let a=t!=null?t:this._engine;a&&i.mS(a.objectUID).set(this.tS,e)}}setPixelShaderityObject(e,t){if(e){let a=t!=null?t:this._engine;a&&i.dS(a.objectUID).set(this.tS,e)}}makeMaterialSemanticsVariantName(){let e="";for(let t of this.aS)e+=`${t.semantic}_`;this.nS=`semanticsVariation_${e}`,this.pS=`${this.tS}_${this.nS}`}getMaterialSemanticsVariantName(){return this.pS}getMaterialVariationIdentifier(){return this.nS}getBaseMaterialName(){return this.tS.replace(/__$/,"")}get vertexShaderityObject(){if(this._engine)return i.mS(this._engine.objectUID).get(this.tS)}get pixelShaderityObject(){if(this._engine)return i.dS(this._engine.objectUID).get(this.tS)}getDefinitions(){return this.r_}static getMaterialNode(e){return i.materialNodes[e]}get _semanticsInfoArray(){return this.aS}get isSkinning(){return this.cS}get isMorphing(){return this.kx}get isLighting(){return this.ix}setShaderSemanticsInfoArray(e){let t=new Map;for(let r of e)t.set(r.semantic,r);let a=[];for(let r of t.values())a.push(r);let n=new Set;n.add(0),a.forEach(r=>{if(I.isTexture(r.compositionType)){let o=r.initialValue[0];o>0&&n.add(o)}}),a.forEach(r=>{if(I.isTexture(r.compositionType)&&r.initialValue[0]<0){let s=-1;for(let p=1;p<32;p++)if(!n.has(p)){s=p;break}s===-1&&V.default.warn(`All texture slots (1-31) are occupied. Cannot assign a valid slot for semantic "${r.semantic}". This may cause rendering issues.`),r.initialValue[0]=s,n.add(s)}}),this.aS=a,this.makeMaterialSemanticsVariantName()}setupBasicInfo(e,t,a,n,r,o){let s=t.entity.tryToGetBlendShape();this.setMorphInfo(a,t.entity.getMesh(),t.primitive,s)}setWorldMatrix(e,t){e._gl.uniformMatrix4fv(e.worldMatrix,!1,t._v)}setNormalMatrix(e,t){e._gl.uniformMatrix3fv(e.normalMatrix,!1,t._v)}setIsBillboard(e,t){e._gl.uniform1i(e.isBillboard,t?1:0)}setIsVisible(e,t){e._gl.uniform1i(e.isVisible,t?1:0)}setViewInfo(e,t,a,n){let r,o;if(a){let s=t.entity.engine._webXRSystemIfEnabled;s!=null&&s.isWebXRMode&&(r=s._getViewMatrixAt(n),o=s._getCameraWorldPositionAt(n))}else t?(o=t.worldPosition,r=t.viewMatrix):(r=_.identity(),o=W.fromCopyArray([0,0,10]));e._gl.uniformMatrix4fv(e.viewMatrix,!1,r._v),e._gl.uniform3fv(e.viewPosition,o._v)}setProjection(e,t,a,n){let r;if(a){let o=t.entity.engine._webXRSystemIfEnabled;o!=null&&o.isWebXRMode&&(r=o._getProjectMatrixAt(n))}else t?r=t.projectionMatrix:r=_.identity();e._gl.uniformMatrix4fv(e.projectionMatrix,!1,r._v)}setMorphInfo(e,t,a,n){if(!this.kx||a.targets.length===0)return;let r=a.constructor.getPrimitiveIdxHasMorph(a.primitiveUid);e._gl.uniform1i(e.currentPrimitiveIdx,r)}_setInternalSettingParametersToGpuWebGLPerShaderProgram(e){}_setInternalSettingParametersToGpuWebGLPerMaterial(e){}_setInternalSettingParametersToGpuWebGLPerPrimitive(e){}_setInternalSettingParametersToGpuWebGpu(e){}getDefinition(){return""}doShaderReflection(e,t,a,n,r,o){this._engine=e;let s=o.join(""),p=i.lS(e.objectUID),M=p.get(this.tS+s);if(M!=null)return M.concat();let u,b;if(e.processApproach===v.WebGPU){let c=y.processPragma(n,!1,o),m=y.processPragma(r,!1,o);u=S.getShaderDataReflection(e,c),b=S.getShaderDataReflection(e,m);let h=S.getShaderDataReflection(e,n),g=S.getShaderDataReflection(e,r);this.setVertexShaderityObject(h.shaderityObject,e),this.setPixelShaderityObject(g.shaderityObject,e)}else{let c=y.processPragma(t,!0,o),m=y.processPragma(a,!0,o);u=l.getShaderDataReflection(e,c),b=l.getShaderDataReflection(e,m);let h=l.getShaderDataReflection(e,t),g=l.getShaderDataReflection(e,a);this.setVertexShaderityObject(h.shaderityObject,e),this.setPixelShaderityObject(g.shaderityObject,e)}let d=[];for(let c of u.shaderSemanticsInfoArray)c.stage=f.VertexShader,d.push(c);for(let c of b.shaderSemanticsInfoArray){let m=d.find(h=>h.semantic===c.semantic);m?m.stage=f.VertexAndPixelShader:(c.stage=f.PixelShader,d.push(c))}return p.set(this.tS+s,d),d.concat()}static _cleanupForEngine(e){i.iS.delete(e.objectUID),i.oS.delete(e.objectUID),i.sS.delete(e.objectUID)}};i.materialNodes=[],i.nb=G.zero(),i.sb=O.zero(),i.hS=0,i.iS=new Map,i.oS=new Map,i.sS=new Map;var j=i;export{j as AbstractMaterialContent};
@@ -218,13 +218,18 @@ export declare class Material extends RnObject {
218
218
  getShaderProgramUid(primitive: Primitive): CGAPIResourceHandle;
219
219
  /**
220
220
  * Adds a primitive to the list of primitives that belong to this material.
221
+ *
222
+ * The primitive is held weakly: a material that stays reachable (for example a shared material) must not
223
+ * keep the primitives assigned to it, and with them their CPU vertex data, alive after they are destroyed.
221
224
  * @internal Called from Primitive class only
222
225
  * @param primitive - The primitive to add
223
226
  */
224
227
  _addBelongPrimitive(primitive: Primitive): void;
225
228
  /**
226
- * Gets all primitives that belong to this material.
227
- * @returns A Map of primitive UIDs to Primitive objects
229
+ * Gets all primitives that belong to this material and are still alive.
230
+ *
231
+ * Entries whose primitive has been collected are pruned while resolving the map.
232
+ * @returns A Map of primitive UIDs to the live Primitive objects
228
233
  */
229
234
  getBelongPrimitives(): Map<number, Primitive>;
230
235
  /**
@@ -1 +1 @@
1
- import{Component as p}from"../../core/Component.js";import{RnObject as b}from"../../core/RnObject.js";import{TextureParameter as d}from"../../definitions/index.js";import{AlphaMode as m}from"../../definitions/AlphaMode.js";import{Blend as o}from"../../definitions/Blend.js";import{CompositionType as c}from"../../definitions/CompositionType.js";import{ShaderType as g}from"../../definitions/ShaderType.js";import{AnimatedQuaternion as P}from"../../math/AnimatedQuaternion.js";import{AnimatedScalar as S}from"../../math/AnimatedScalar.js";import{AnimatedVector2 as _}from"../../math/AnimatedVector2.js";import{AnimatedVector3 as y}from"../../math/AnimatedVector3.js";import{AnimatedVector4 as F}from"../../math/AnimatedVector4.js";import{AnimatedVectorN as M}from"../../math/AnimatedVectorN.js";import{MathClassUtil as v}from"../../math/MathClassUtil.js";import{Is as V}from"../../misc/Is.js";import{Logger as R}from"../../misc/Logger.js";import{Sampler as T}from"../../textures/Sampler.js";import{_createProgramAsSingleOperationByUpdatedSources as I,_createProgramAsSingleOperationWebGL as A,_createProgramAsSingleOperationWebGpu as C}from"./ShaderHandler.js";var f=class extends b{constructor(e,t,r,i,a,s){super();this._allFieldVariables=new Map;this._autoFieldVariablesOnly=new Map;this._autoTextureFieldVariablesOnly=new Map;this._autoUniformFieldVariablesOnly=new Map;this._allFieldsInfo=new Map;this._g=new Map;this._shaderProgramUidMap=new Map;this._shaderProgramComponentStateVersionMap=new Map;this.yg=-1;this.Mg=-1;this.vg=m.Opaque;this.zWriteWhenBlend=!1;this.colorWriteMask=[!0,!0,!0,!0];this.isTranslucent=!1;this.cullFace=!0;this.cullFrontFaceCCW=!0;this.cullFaceBack=!0;this.Vg=!1;this.hg=o.EquationFuncAdd;this.mg=o.EquationFuncAdd;this.ug=o.One;this.pg=o.OneMinusSrcAlpha;this.dg=o.One;this.gg=o.OneMinusSrcAlpha;this.yf=0;this.Rg=0;this.cg=0;this.Nn="";this.lg=new Set;this.Ag="";this.Cg=-1;this.Pg="";this.Ug=-1;this.i=e,this._materialContent=s,this.Fg=t,this.yg=r,this.Mg=i,this.og=a}addShaderDefine(e){this.lg.add(e),this.makeShadersInvalidate()}removeShaderDefine(e){this.lg.delete(e),this.makeShadersInvalidate()}getShaderDefines(){return this.lg}isShaderDefine(e){return this.lg.has(e)}calcFingerPrint(){let e="";e+=this.alphaMode.index,e+=this.blendFuncSrcFactor.webgpu,e+=this.blendFuncDstFactor.webgpu,e+=this.blendFuncAlphaSrcFactor.webgpu,e+=this.blendFuncAlphaDstFactor.webgpu,e+=this.blendEquationMode.webgpu,e+=this.blendEquationModeAlpha.webgpu,e+=this.cullFace?"1":"0",e+=this.cullFrontFaceCCW?"1":"0",e+=this.cullFaceBack?"1":"0",e!==this.Nn&&(this.Nn=e,this.bg())}bg(){this.Rg++,this.i.materialRepository._incrementBindingStateVersion()}_getFingerPrint(){return this.Nn}_getTextureBindingSignature(){var t,r,i,a,s;if(this.Cg===this.yf)return this.Ag;let e="";for(let[n,l]of this._autoTextureFieldVariablesOnly){let h=l.value;e+=`${n}:${h[0]}:${(r=(t=h[1])==null?void 0:t._textureResourceUid)!=null?r:-1}:${(a=(i=h[2])==null?void 0:i._samplerResourceUid)!=null?a:-1};`}for(let[n,l]of this._autoUniformFieldVariablesOnly){let h=l.value,u=(s=h==null?void 0:h._v)!=null?s:h;e+=`${n}:${Array.isArray(u)||ArrayBuffer.isView(u)?Array.from(u).join(","):String(u)};`}return this.Ag=e,this.Cg=this.yf,e}_getMultiDrawStateKey(){return this.Ug===this.yf?this.Pg:(this.Pg=`${this.og}|${this._materialContent.getMaterialSemanticsVariantName()}|${[...this.lg].sort().join(",")}|${this.Nn}|${this._getTextureBindingSignature()}`,this.Ug=this.yf,this.Pg)}_isAnimatedValue(e){return e instanceof S||e instanceof _||e instanceof y||e instanceof F||e instanceof P||e instanceof M}setParameter(e,t){let r=this._allFieldsInfo.get(e);if(r!=null){let i;r.soloDatum?i=this.i.materialRepository._soloDatumFields.get(this.og).get(e):i=this._allFieldVariables.get(e),this._isAnimatedValue(t)?(t.setFloat32Array(i.value._v),i.value=t,this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint()):v._setForce(i.value,t)&&(this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint())}}setTextureParameter(e,t,r){if(V.not.exist(r)&&(r=new T(this.i,{magFilter:d.Linear,minFilter:d.Linear,wrapS:d.Repeat,wrapT:d.Repeat})),r.created||r.create(),this._allFieldsInfo.has(e)){let i=this._allFieldVariables.get(e);if(i.value[1]===t&&i.value[2]===r)return;let a={value:[i.value[0],t,r],info:i.info};this._allFieldVariables.set(e,a),i.info.isInternalSetting||(this._autoFieldVariablesOnly.set(e,a),c.isTexture(i.info.compositionType)&&this._autoTextureFieldVariablesOnly.set(e,a)),(e==="diffuseColorTexture"||e==="baseColorTexture")&&t.isTransparent&&(this.alphaMode=m.Blend),this.yf++,this.cg++,this.i.materialRepository._incrementStateVersion(),this.i.materialRepository._incrementBindingStateVersion(),this.calcFingerPrint()}}getTextureParameter(e){if(this._allFieldsInfo.has(e))return this._allFieldVariables.get(e).value}setTextureParameterAsPromise(e,t){t.then(r=>{if(this._allFieldsInfo.has(e)){let i=this._allFieldVariables.get(e);if(i.value[1]===r)return;let a={value:[i.value[0],r],info:i.info};this._allFieldVariables.set(e,a),i.info.isInternalSetting||(this._autoFieldVariablesOnly.set(e,a),c.isTexture(i.info.compositionType)&&this._autoTextureFieldVariablesOnly.set(e,a)),(e==="diffuseColorTexture"||e==="baseColorTexture")&&r.isTransparent&&(this.alphaMode=m.Blend)}this.yf++,this.cg++,this.i.materialRepository._incrementStateVersion(),this.i.materialRepository._incrementBindingStateVersion(),this.calcFingerPrint()})}getParameter(e){var r,i;let t=this._allFieldsInfo.get(e);if(t!=null)return t.soloDatum?(r=this.i.materialRepository._soloDatumFields.get(this.og).get(e))==null?void 0:r.value:(i=this._allFieldVariables.get(e))==null?void 0:i.value}isShaderProgramReady(e){let t=e._getFingerPrint();return this._shaderProgramComponentStateVersionMap.get(t)!==p.getStateVersion(this.i)?(this._shaderProgramUidMap.delete(t),this._shaderProgramComponentStateVersionMap.delete(t),!1):this._shaderProgramUidMap.has(t)}_setUniformLocationsOfMaterialNodes(e){let t=this.i.webglResourceRepository,r=[];if(this._materialContent!=null){let a=this._materialContent._semanticsInfoArray;r=r.concat(a)}let i=this._shaderProgramUidMap.get(e._getFingerPrint());t.setupUniformLocations(this.i.config,i,r)}getShaderProgramUid(e){var r;let t=e._getFingerPrint();return(r=this._shaderProgramUidMap.get(t))!=null?r:-1}_addBelongPrimitive(e){this._g.set(e.primitiveUid,e)}getBelongPrimitives(){return this._g}_createProgramWebGL(e,t,r,i,a,s,n){let[l,h]=A(e,this,t,r,i,a,s,n),u=n._getFingerPrint();return this._shaderProgramUidMap.set(u,l),this._shaderProgramComponentStateVersionMap.set(u,p.getStateVersion(e)),this.i.materialRepository._incrementStateVersion(),[l,h]}_createProgramWebGpu(e,t,r,i,a,s,n){let l=C(e,this,t,r,i,a,s,n),h=t._getFingerPrint();this._shaderProgramUidMap.set(h,l),this._shaderProgramComponentStateVersionMap.set(h,p.getStateVersion(e)),this.i.materialRepository._incrementStateVersion()}_createProgramByUpdatedSources(e,t,r){let[i,a]=I(this.i,this,t,this._materialContent,e,r),s=t._getFingerPrint();return this._shaderProgramUidMap.set(s,i),this._shaderProgramComponentStateVersionMap.set(s,p.getStateVersion(this.i)),i>0,this.i.materialRepository._incrementStateVersion(),[i,a]}_setupBasicUniformsLocations(e){let t=this.i.webglResourceRepository,r=e._getFingerPrint(),i=this._shaderProgramUidMap.get(r);t.setupBasicUniformLocations(i)}_setupAdditionalUniformLocations(e,t){let r=this.i.webglResourceRepository,i=t._getFingerPrint(),a=this._shaderProgramUidMap.get(i);r.setupUniformLocations(this.i.config,a,e)}_setInternalSettingParametersToGpuWebGpu({engine:e,material:t,args:r}){this._materialContent._setInternalSettingParametersToGpuWebGpu({engine:e,material:t,args:r})}_setParametersToGpuWebGL({engine:e,material:t,shaderProgram:r,firstTime:i,args:a}){this.Gg(i,r),this._materialContent._setInternalSettingParametersToGpuWebGLPerMaterial({engine:e,material:t,shaderProgram:r,firstTime:i,args:a}),this.wg({shaderProgram:r,firstTime:i})}_setParametersToGpuWebGLPerShaderProgram({engine:e,material:t,shaderProgram:r,firstTime:i,args:a}){this._materialContent._setInternalSettingParametersToGpuWebGLPerShaderProgram({engine:e,material:t,shaderProgram:r,firstTime:i,args:a})}_setParametersToGpuWebGLPerPrimitive({material:e,shaderProgram:t,firstTime:r,args:i}){this._materialContent._setInternalSettingParametersToGpuWebGLPerPrimitive({material:e,shaderProgram:t,firstTime:r,args:i})}_setParametersToGpuWebGLWithOutInternalSetting({shaderProgram:e,firstTime:t}){this.Gg(t,e),this.wg({shaderProgram:e,firstTime:t})}_getProperties(e,t,r){let i="",a="";return this._allFieldsInfo.forEach(n=>{(n.stage===g.VertexShader||n.stage===g.VertexAndPixelShader)&&(i+=r(e,this.og,n)),(n.stage===g.PixelShader||n.stage===g.VertexAndPixelShader)&&(a+=r(e,this.og,n))}),[i,a]=e.globalDataRepository._addPropertiesStr(i,a,t),{vertexPropertiesStr:i,pixelPropertiesStr:a}}Gg(e,t){let r=this.i.webglResourceRepository;for(let[,i]of this._autoTextureFieldVariablesOnly){let a=i.info;e?r.setUniform1iForTexture(t,a.semantic,i.value):r.bindTexture(a,i.value)}for(let[,i]of this._autoUniformFieldVariablesOnly){let a=i.info;a.needUniformInDataTextureMode&&r.setUniformValue(t,a.semantic,e,i.value)}}wg({shaderProgram:e,firstTime:t}){let r=this.i.webglResourceRepository,i=this.og,a=this.i.materialRepository._soloDatumFields.get(i);if(a==null)return;let s=a.values();for(let n of s){let l=n.info;c.isTexture(l.compositionType)&&(l.isInternalSetting||(t?r.setUniformValue(e,l.semantic,t,n.value):r.bindTexture(l,n.value)))}}setBlendEquationMode(e,t){this.hg=e,this.mg=t!=null?t:e,this.Sg(),this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint()}Sg(){(this.hg===o.Min||this.hg===o.Max)&&(this.pg=o.One,this.ug=o.One),(this.mg===o.Min||this.mg===o.Max)&&(this.gg=o.One,this.dg=o.One)}setBlendFuncSeparateFactor(e,t,r,i){this.ug=e,this.pg=t,this.dg=r,this.gg=i,this.Sg(),this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint()}setBlendFuncFactor(e,t){this.ug=e,this.pg=t,this.dg=e,this.gg=t,this.Sg(),this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint()}isBlend(){return this.alphaMode===m.Blend}isTranslucentOpaque(){return!!(this.alphaMode!==m.Blend&&this.isTranslucent)}isBlendOrTranslucent(){return!!(this.alphaMode===m.Blend||this.isTranslucent)}isOpaque(){return this.alphaMode===m.Opaque}isMask(){return this.alphaMode===m.Mask}set alphaToCoverage(e){e&&this.alphaMode===m.Blend&&R.default.warn("If you set alphaToCoverage = true on a material whose AlphaMode is Translucent, you may get drawing problems."),this.Vg=e,this.makeShadersInvalidate(),this.calcFingerPrint()}get alphaToCoverage(){return this.Vg}get materialTID(){return this.Fg}get fieldsInfoArray(){return Array.from(this._allFieldsInfo.values())}get blendEquationMode(){return this.hg}get blendEquationModeAlpha(){return this.mg}get blendFuncSrcFactor(){return this.ug}get blendFuncDstFactor(){return this.pg}get blendFuncAlphaSrcFactor(){return this.dg}get blendFuncAlphaDstFactor(){return this.gg}get alphaMode(){return this.vg}set alphaMode(e){this.vg=e,this.calcFingerPrint(),this.makeShadersInvalidate()}get materialUID(){return this.yg}get materialSID(){return this.Mg}get isSkinning(){return this._materialContent.isSkinning}get isMorphing(){return this._materialContent.isMorphing}get isLighting(){return this._materialContent.isLighting}get materialTypeName(){return this.og}get baseMaterialName(){return this._materialContent.getBaseMaterialName()}get materialVariationIdentifier(){return this._materialContent.getMaterialVariationIdentifier()}get stateVersion(){return this.yf}makeShadersInvalidate(){this._shaderProgramUidMap.clear(),this._shaderProgramComponentStateVersionMap.clear(),this.yf++,this.bg(),this.i.materialRepository._incrementStateVersion()}updateStateVersion(){this.yf++,this.bg(),this.i.materialRepository._incrementStateVersion()}get pipelineStateVersion(){return this.Rg}get textureStateVersion(){return this.cg}get shaderNodeJson(){return this.fg}set shaderNodeJson(e){this.fg=e}get shaderNodeUniforms(){return this.Tg}set shaderNodeUniforms(e){this.Tg=e}get isNodeBasedMaterial(){return this.fg!=null}get shaderNodeFileName(){return this.Ig}set shaderNodeFileName(e){this.Ig=e}};export{f as Material};
1
+ import{Component as p}from"../../core/Component.js";import{RnObject as b}from"../../core/RnObject.js";import{TextureParameter as d}from"../../definitions/index.js";import{AlphaMode as m}from"../../definitions/AlphaMode.js";import{Blend as o}from"../../definitions/Blend.js";import{CompositionType as c}from"../../definitions/CompositionType.js";import{ShaderType as g}from"../../definitions/ShaderType.js";import{AnimatedQuaternion as P}from"../../math/AnimatedQuaternion.js";import{AnimatedScalar as S}from"../../math/AnimatedScalar.js";import{AnimatedVector2 as _}from"../../math/AnimatedVector2.js";import{AnimatedVector3 as y}from"../../math/AnimatedVector3.js";import{AnimatedVector4 as F}from"../../math/AnimatedVector4.js";import{AnimatedVectorN as M}from"../../math/AnimatedVectorN.js";import{MathClassUtil as v}from"../../math/MathClassUtil.js";import{Is as V}from"../../misc/Is.js";import{Logger as R}from"../../misc/Logger.js";import{Sampler as T}from"../../textures/Sampler.js";import{_createProgramAsSingleOperationByUpdatedSources as I,_createProgramAsSingleOperationWebGL as A,_createProgramAsSingleOperationWebGpu as U}from"./ShaderHandler.js";var f=class extends b{constructor(e,t,r,i,a,s){super();this._allFieldVariables=new Map;this._autoFieldVariablesOnly=new Map;this._autoTextureFieldVariablesOnly=new Map;this._autoUniformFieldVariablesOnly=new Map;this._allFieldsInfo=new Map;this.cg=new Map;this._shaderProgramUidMap=new Map;this._shaderProgramComponentStateVersionMap=new Map;this.yg=-1;this.Mg=-1;this.vg=m.Opaque;this.zWriteWhenBlend=!1;this.colorWriteMask=[!0,!0,!0,!0];this.isTranslucent=!1;this.cullFace=!0;this.cullFrontFaceCCW=!0;this.cullFaceBack=!0;this.Vg=!1;this.hg=o.EquationFuncAdd;this.mg=o.EquationFuncAdd;this.ug=o.One;this.pg=o.OneMinusSrcAlpha;this.dg=o.One;this.gg=o.OneMinusSrcAlpha;this.yf=0;this.Rg=0;this.fg=0;this.Nn="";this.lg=new Set;this.Ag="";this.Ug=-1;this.Sg="";this.Cg=-1;this.i=e,this._materialContent=s,this.Fg=t,this.yg=r,this.Mg=i,this.og=a}addShaderDefine(e){this.lg.add(e),this.makeShadersInvalidate()}removeShaderDefine(e){this.lg.delete(e),this.makeShadersInvalidate()}getShaderDefines(){return this.lg}isShaderDefine(e){return this.lg.has(e)}calcFingerPrint(){let e="";e+=this.alphaMode.index,e+=this.blendFuncSrcFactor.webgpu,e+=this.blendFuncDstFactor.webgpu,e+=this.blendFuncAlphaSrcFactor.webgpu,e+=this.blendFuncAlphaDstFactor.webgpu,e+=this.blendEquationMode.webgpu,e+=this.blendEquationModeAlpha.webgpu,e+=this.cullFace?"1":"0",e+=this.cullFrontFaceCCW?"1":"0",e+=this.cullFaceBack?"1":"0",e!==this.Nn&&(this.Nn=e,this.Pg())}Pg(){this.Rg++,this.i.materialRepository._incrementBindingStateVersion()}_getFingerPrint(){return this.Nn}_getTextureBindingSignature(){var t,r,i,a,s;if(this.Ug===this.yf)return this.Ag;let e="";for(let[n,l]of this._autoTextureFieldVariablesOnly){let h=l.value;e+=`${n}:${h[0]}:${(r=(t=h[1])==null?void 0:t._textureResourceUid)!=null?r:-1}:${(a=(i=h[2])==null?void 0:i._samplerResourceUid)!=null?a:-1};`}for(let[n,l]of this._autoUniformFieldVariablesOnly){let h=l.value,u=(s=h==null?void 0:h._v)!=null?s:h;e+=`${n}:${Array.isArray(u)||ArrayBuffer.isView(u)?Array.from(u).join(","):String(u)};`}return this.Ag=e,this.Ug=this.yf,e}_getMultiDrawStateKey(){return this.Cg===this.yf?this.Sg:(this.Sg=`${this.og}|${this._materialContent.getMaterialSemanticsVariantName()}|${[...this.lg].sort().join(",")}|${this.Nn}|${this._getTextureBindingSignature()}`,this.Cg=this.yf,this.Sg)}_isAnimatedValue(e){return e instanceof S||e instanceof _||e instanceof y||e instanceof F||e instanceof P||e instanceof M}setParameter(e,t){let r=this._allFieldsInfo.get(e);if(r!=null){let i;r.soloDatum?i=this.i.materialRepository._soloDatumFields.get(this.og).get(e):i=this._allFieldVariables.get(e),this._isAnimatedValue(t)?(t.setFloat32Array(i.value._v),i.value=t,this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint()):v._setForce(i.value,t)&&(this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint())}}setTextureParameter(e,t,r){if(V.not.exist(r)&&(r=new T(this.i,{magFilter:d.Linear,minFilter:d.Linear,wrapS:d.Repeat,wrapT:d.Repeat})),r.created||r.create(),this._allFieldsInfo.has(e)){let i=this._allFieldVariables.get(e);if(i.value[1]===t&&i.value[2]===r)return;let a={value:[i.value[0],t,r],info:i.info};this._allFieldVariables.set(e,a),i.info.isInternalSetting||(this._autoFieldVariablesOnly.set(e,a),c.isTexture(i.info.compositionType)&&this._autoTextureFieldVariablesOnly.set(e,a)),(e==="diffuseColorTexture"||e==="baseColorTexture")&&t.isTransparent&&(this.alphaMode=m.Blend),this.yf++,this.fg++,this.i.materialRepository._incrementStateVersion(),this.i.materialRepository._incrementBindingStateVersion(),this.calcFingerPrint()}}getTextureParameter(e){if(this._allFieldsInfo.has(e))return this._allFieldVariables.get(e).value}setTextureParameterAsPromise(e,t){t.then(r=>{if(this._allFieldsInfo.has(e)){let i=this._allFieldVariables.get(e);if(i.value[1]===r)return;let a={value:[i.value[0],r],info:i.info};this._allFieldVariables.set(e,a),i.info.isInternalSetting||(this._autoFieldVariablesOnly.set(e,a),c.isTexture(i.info.compositionType)&&this._autoTextureFieldVariablesOnly.set(e,a)),(e==="diffuseColorTexture"||e==="baseColorTexture")&&r.isTransparent&&(this.alphaMode=m.Blend)}this.yf++,this.fg++,this.i.materialRepository._incrementStateVersion(),this.i.materialRepository._incrementBindingStateVersion(),this.calcFingerPrint()})}getParameter(e){var r,i;let t=this._allFieldsInfo.get(e);if(t!=null)return t.soloDatum?(r=this.i.materialRepository._soloDatumFields.get(this.og).get(e))==null?void 0:r.value:(i=this._allFieldVariables.get(e))==null?void 0:i.value}isShaderProgramReady(e){let t=e._getFingerPrint();return this._shaderProgramComponentStateVersionMap.get(t)!==p.getStateVersion(this.i)?(this._shaderProgramUidMap.delete(t),this._shaderProgramComponentStateVersionMap.delete(t),!1):this._shaderProgramUidMap.has(t)}_setUniformLocationsOfMaterialNodes(e){let t=this.i.webglResourceRepository,r=[];if(this._materialContent!=null){let a=this._materialContent._semanticsInfoArray;r=r.concat(a)}let i=this._shaderProgramUidMap.get(e._getFingerPrint());t.setupUniformLocations(this.i.config,i,r)}getShaderProgramUid(e){var r;let t=e._getFingerPrint();return(r=this._shaderProgramUidMap.get(t))!=null?r:-1}_addBelongPrimitive(e){this.cg.set(e.primitiveUid,new WeakRef(e))}getBelongPrimitives(){let e=new Map;for(let[t,r]of this.cg){let i=r.deref();i!=null?e.set(t,i):this.cg.delete(t)}return e}_createProgramWebGL(e,t,r,i,a,s,n){let[l,h]=A(e,this,t,r,i,a,s,n),u=n._getFingerPrint();return this._shaderProgramUidMap.set(u,l),this._shaderProgramComponentStateVersionMap.set(u,p.getStateVersion(e)),this.i.materialRepository._incrementStateVersion(),[l,h]}_createProgramWebGpu(e,t,r,i,a,s,n){let l=U(e,this,t,r,i,a,s,n),h=t._getFingerPrint();this._shaderProgramUidMap.set(h,l),this._shaderProgramComponentStateVersionMap.set(h,p.getStateVersion(e)),this.i.materialRepository._incrementStateVersion()}_createProgramByUpdatedSources(e,t,r){let[i,a]=I(this.i,this,t,this._materialContent,e,r),s=t._getFingerPrint();return this._shaderProgramUidMap.set(s,i),this._shaderProgramComponentStateVersionMap.set(s,p.getStateVersion(this.i)),i>0,this.i.materialRepository._incrementStateVersion(),[i,a]}_setupBasicUniformsLocations(e){let t=this.i.webglResourceRepository,r=e._getFingerPrint(),i=this._shaderProgramUidMap.get(r);t.setupBasicUniformLocations(i)}_setupAdditionalUniformLocations(e,t){let r=this.i.webglResourceRepository,i=t._getFingerPrint(),a=this._shaderProgramUidMap.get(i);r.setupUniformLocations(this.i.config,a,e)}_setInternalSettingParametersToGpuWebGpu({engine:e,material:t,args:r}){this._materialContent._setInternalSettingParametersToGpuWebGpu({engine:e,material:t,args:r})}_setParametersToGpuWebGL({engine:e,material:t,shaderProgram:r,firstTime:i,args:a}){this.Gg(i,r),this._materialContent._setInternalSettingParametersToGpuWebGLPerMaterial({engine:e,material:t,shaderProgram:r,firstTime:i,args:a}),this.wg({shaderProgram:r,firstTime:i})}_setParametersToGpuWebGLPerShaderProgram({engine:e,material:t,shaderProgram:r,firstTime:i,args:a}){this._materialContent._setInternalSettingParametersToGpuWebGLPerShaderProgram({engine:e,material:t,shaderProgram:r,firstTime:i,args:a})}_setParametersToGpuWebGLPerPrimitive({material:e,shaderProgram:t,firstTime:r,args:i}){this._materialContent._setInternalSettingParametersToGpuWebGLPerPrimitive({material:e,shaderProgram:t,firstTime:r,args:i})}_setParametersToGpuWebGLWithOutInternalSetting({shaderProgram:e,firstTime:t}){this.Gg(t,e),this.wg({shaderProgram:e,firstTime:t})}_getProperties(e,t,r){let i="",a="";return this._allFieldsInfo.forEach(n=>{(n.stage===g.VertexShader||n.stage===g.VertexAndPixelShader)&&(i+=r(e,this.og,n)),(n.stage===g.PixelShader||n.stage===g.VertexAndPixelShader)&&(a+=r(e,this.og,n))}),[i,a]=e.globalDataRepository._addPropertiesStr(i,a,t),{vertexPropertiesStr:i,pixelPropertiesStr:a}}Gg(e,t){let r=this.i.webglResourceRepository;for(let[,i]of this._autoTextureFieldVariablesOnly){let a=i.info;e?r.setUniform1iForTexture(t,a.semantic,i.value):r.bindTexture(a,i.value)}for(let[,i]of this._autoUniformFieldVariablesOnly){let a=i.info;a.needUniformInDataTextureMode&&r.setUniformValue(t,a.semantic,e,i.value)}}wg({shaderProgram:e,firstTime:t}){let r=this.i.webglResourceRepository,i=this.og,a=this.i.materialRepository._soloDatumFields.get(i);if(a==null)return;let s=a.values();for(let n of s){let l=n.info;c.isTexture(l.compositionType)&&(l.isInternalSetting||(t?r.setUniformValue(e,l.semantic,t,n.value):r.bindTexture(l,n.value)))}}setBlendEquationMode(e,t){this.hg=e,this.mg=t!=null?t:e,this._g(),this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint()}_g(){(this.hg===o.Min||this.hg===o.Max)&&(this.pg=o.One,this.ug=o.One),(this.mg===o.Min||this.mg===o.Max)&&(this.gg=o.One,this.dg=o.One)}setBlendFuncSeparateFactor(e,t,r,i){this.ug=e,this.pg=t,this.dg=r,this.gg=i,this._g(),this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint()}setBlendFuncFactor(e,t){this.ug=e,this.pg=t,this.dg=e,this.gg=t,this._g(),this.yf++,this.i.materialRepository._incrementStateVersion(),this.calcFingerPrint()}isBlend(){return this.alphaMode===m.Blend}isTranslucentOpaque(){return!!(this.alphaMode!==m.Blend&&this.isTranslucent)}isBlendOrTranslucent(){return!!(this.alphaMode===m.Blend||this.isTranslucent)}isOpaque(){return this.alphaMode===m.Opaque}isMask(){return this.alphaMode===m.Mask}set alphaToCoverage(e){e&&this.alphaMode===m.Blend&&R.default.warn("If you set alphaToCoverage = true on a material whose AlphaMode is Translucent, you may get drawing problems."),this.Vg=e,this.makeShadersInvalidate(),this.calcFingerPrint()}get alphaToCoverage(){return this.Vg}get materialTID(){return this.Fg}get fieldsInfoArray(){return Array.from(this._allFieldsInfo.values())}get blendEquationMode(){return this.hg}get blendEquationModeAlpha(){return this.mg}get blendFuncSrcFactor(){return this.ug}get blendFuncDstFactor(){return this.pg}get blendFuncAlphaSrcFactor(){return this.dg}get blendFuncAlphaDstFactor(){return this.gg}get alphaMode(){return this.vg}set alphaMode(e){this.vg=e,this.calcFingerPrint(),this.makeShadersInvalidate()}get materialUID(){return this.yg}get materialSID(){return this.Mg}get isSkinning(){return this._materialContent.isSkinning}get isMorphing(){return this._materialContent.isMorphing}get isLighting(){return this._materialContent.isLighting}get materialTypeName(){return this.og}get baseMaterialName(){return this._materialContent.getBaseMaterialName()}get materialVariationIdentifier(){return this._materialContent.getMaterialVariationIdentifier()}get stateVersion(){return this.yf}makeShadersInvalidate(){this._shaderProgramUidMap.clear(),this._shaderProgramComponentStateVersionMap.clear(),this.yf++,this.Pg(),this.i.materialRepository._incrementStateVersion()}updateStateVersion(){this.yf++,this.Pg(),this.i.materialRepository._incrementStateVersion()}get pipelineStateVersion(){return this.Rg}get textureStateVersion(){return this.fg}get shaderNodeJson(){return this.bg}set shaderNodeJson(e){this.bg=e}get shaderNodeUniforms(){return this.Tg}set shaderNodeUniforms(e){this.Tg=e}get isNodeBasedMaterial(){return this.bg!=null}get shaderNodeFileName(){return this.Ig}set shaderNodeFileName(e){this.Ig=e}};export{f as Material};
@@ -1,2 +1,2 @@
1
- import d from"../../../_deps/shaderity.js";import{BlendShapeComponent as O}from"../../components/BlendShape/BlendShapeComponent.js";import{WellKnownComponentTIDs as A}from"../../components/WellKnownComponentTIDs.js";import{ComponentType as h}from"../../definitions/ComponentType.js";import{CompositionType as i}from"../../definitions/CompositionType.js";import{ShaderType as T}from"../../definitions/ShaderType.js";import{VertexAttribute as V}from"../../definitions/VertexAttribute.js";import{MutableMatrix22 as C}from"../../math/MutableMatrix22.js";import{MutableMatrix33 as g}from"../../math/MutableMatrix33.js";import{MutableMatrix44 as S}from"../../math/MutableMatrix44.js";import{MutableScalar as l}from"../../math/MutableScalar.js";import{MutableVector2 as F}from"../../math/MutableVector2.js";import{MutableVector3 as x}from"../../math/MutableVector3.js";import{MutableVector4 as N}from"../../math/MutableVector4.js";import{Logger as y}from"../../misc/Logger.js";var f=d.default||d,M=class{static fillTemplate(r,e,o,u){let n=f.fillTemplate(e,u),a=r.webglResourceRepository,s=a.currentWebGLContextWrapper;if(s==null)return n;let t=s.getMaxTextureSize(),m=o.constructor.getMorphUniformDataOffsets(),p=O.getOffsetsInUniform(r),b={WellKnownComponentTIDs:A,widthOfDataTexture:`const int widthOfDataTexture = ${t};`,dataUBODefinition:a.getGlslDataUBODefinitionString(),dataUBOVec4Size:a.getGlslDataUBOVec4SizeString(),maxMorphOffsetsDataNumber:`${Math.max(Math.ceil(m[m.length-1]/4),1)}`,maxMorphWeightsDataNumber:`${Math.max(Math.ceil(p[p.length-1]/4),1)}`};return f.fillTemplate(n,b)}static transformWebGLVersion(r,e){return e?f.transformToGLSLES3(r):f.transformToGLSLES1(r,!0)}static getAttributeReflection(r){let e=f.createReflectionObject(r);this.tb(e),e.reflect();let o=e.attributesNames,u=e.attributesSemantics.map((s,t)=>{let m=V.fromString(s);return m===void 0&&y.default.error(`Unknown vertex attribute semantic: name=${o[t]}, semantic=${s}`),m}),n=e.attributesTypes.map(s=>i.fromGlslString(s)),a=e.attributesTypes.map(s=>h.fromGlslString(s));return{names:o,semantics:u,compositions:n,components:a}}static tb(r){let e=new Map;e.set("instanceids","INSTANCE"),e.set("barycentriccoord","BARY_CENTRIC_COORD"),r.addAttributeSemanticsMap(e)}static getShaderDataReflection(r,e){let o=this.eb(e),u=e.code.split(/\r\n|\n/),n=[],a=[];for(let s of u){let t=/^(?![/])[\t ]*uniform[\t ]+(\w+)[\t ]+(\w+);[\t ]*(\/\/)*[\t ]*(.*)/,m=s.match(t);if(m){let p=m[1],b=m[2],c=m[4];if(this.rb(c)){n.push(s);continue}let w=this.ab(r,p,b,c,e.isFragmentShader);a.push(w)}else n.push(s)}return o.code=n.join(`
2
- `),{shaderSemanticsInfoArray:a,shaderityObject:o}}static eb(r){return{code:r.code,shaderStage:r.shaderStage,isFragmentShader:r.shaderStage==="fragment"}}static rb(r){let e=r.match(/skipProcess[\t ]*=[\t ]*(\w+)[,\t ]*/);return(e==null?void 0:e[1])==="true"}static ab(r,e,o,u,n){let a=h.fromGlslString(e),s=i.fromGlslString(e),t=n?T.PixelShader:T.VertexShader;o=o.match(/u_(\w+)/)[1];let p={semantic:o,compositionType:s,componentType:a,min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInternalSetting:!1,stage:t};return this.ob(r,p,u),p}static ob(r,e,o){let u=o.match(/soloDatum[\t ]*=[\t ]*(\w+)[,\t ]*/),n=!1;(u==null?void 0:u[1])==="true"&&(n=!0),e.soloDatum=n;let a=o.match(/isInternalSetting[\t ]*=[\t ]*(\w+)[,\t ]*/),s=!1;(a==null?void 0:a[1])==="true"&&(s=!0),e.isInternalSetting=s;let t=o.match(/initialValue[\t ]*=[\t ]*(.+)[,\t ]*/);if(t){let c=t[1];e.initialValue=this.ib(r,e,c)}else e.initialValue=this.nb(r,e);let m=o.match(/needUniformInDataTextureMode[\t ]*=[\t ]*(.+)[,\t ]*/);if(m){let c=!1;(m==null?void 0:m[1])==="true"&&(c=!0),e.needUniformInDataTextureMode=c}let p=o.match(/max[\t ]*=[\t ]*(.+)[,\t ]*/);p&&(e.max=Number.parseFloat(p[1]));let b=o.match(/min[\t ]*=[\t ]*(.+)[,\t ]*/);b&&(e.min=Number.parseFloat(b[1]))}static ib(r,e,o){let u=o.match(/\(([\d\w., ]+)\)/),n=s=>{e.compositionType!==s&&y.default.error(`component number of initialValue is invalid:${e.semantic}`)},a;if(u){let t=u[1].split(",");switch(t.length){case 1:n(i.Scalar),t[0]==="true"?a=new l(new Float32Array([1])):t[0]==="false"?a=new l(new Float32Array([0])):a=new l(new Float32Array([Number.parseFloat(t[0])]));break;case 2:if(e.compositionType===i.Texture2D||e.compositionType===i.Texture2DShadow){let m=t[1].charAt(0).toUpperCase()+t[1].slice(1);a=[Number.parseInt(t[0],10),r.dummyTextures[`dummy${m}Texture`]]}else if(e.compositionType===i.TextureCube){let m=t[1].charAt(0).toUpperCase()+t[1].slice(1);a=[Number.parseInt(t[0],10),r.dummyTextures[`dummy${m}CubeTexture`]]}else n(i.Vec2),a=F.fromCopyArray([Number.parseFloat(t[0]),Number.parseFloat(t[1])]);break;case 3:n(i.Vec3),a=x.fromCopyArray([Number.parseFloat(t[0]),Number.parseFloat(t[1]),Number.parseFloat(t[2])]);break;case 4:n(i.Vec4),a=N.fromCopyArray([Number.parseFloat(t[0]),Number.parseFloat(t[1]),Number.parseFloat(t[2]),Number.parseFloat(t[3])]);break;case 9:n(i.Mat3),a=g.fromCopy9RowMajor(Number.parseFloat(t[0]),Number.parseFloat(t[1]),Number.parseFloat(t[2]),Number.parseFloat(t[3]),Number.parseFloat(t[4]),Number.parseFloat(t[5]),Number.parseFloat(t[6]),Number.parseFloat(t[7]),Number.parseFloat(t[8]));break;case 16:n(i.Mat4),a=S.fromCopy16RowMajor(Number.parseFloat(t[0]),Number.parseFloat(t[1]),Number.parseFloat(t[2]),Number.parseFloat(t[3]),Number.parseFloat(t[4]),Number.parseFloat(t[5]),Number.parseFloat(t[6]),Number.parseFloat(t[7]),Number.parseFloat(t[8]),Number.parseFloat(t[9]),Number.parseFloat(t[10]),Number.parseFloat(t[11]),Number.parseFloat(t[12]),Number.parseFloat(t[13]),Number.parseFloat(t[14]),Number.parseFloat(t[15]));break;default:y.default.error("Invalid format")}}else n(i.Scalar),o==="true"?a=new l(new Float32Array([1])):o==="false"?a=new l(new Float32Array([0])):a=new l(new Float32Array([Number.parseFloat(o)]));return a}static nb(r,e){if(e.compositionType===i.Scalar)return new l(new Float32Array([0]));if(e.compositionType===i.Vec2)return F.zero();if(e.compositionType===i.Vec3)return x.zero();if(e.compositionType===i.Vec4)return N.zero();if(e.compositionType===i.Mat2)return C.identity();if(e.compositionType===i.Mat3)return g.identity();if(e.compositionType===i.Mat4)return S.identity();if(e.compositionType===i.Texture2D)return[0,r.dummyTextures.dummyWhiteTexture];if(e.compositionType===i.Texture2DShadow)return[0,r.dummyTextures.dummyWhiteTexture];if(e.compositionType===i.TextureCube)return[0,r.dummyTextures.dummyBlackTexture];y.default.warn("initial value is not found")}};export{M as ShaderityUtilityWebGL};
1
+ import d from"../../../_deps/shaderity.js";import{BlendShapeComponent as A}from"../../components/BlendShape/BlendShapeComponent.js";import{WellKnownComponentTIDs as O}from"../../components/WellKnownComponentTIDs.js";import{ComponentType as h}from"../../definitions/ComponentType.js";import{CompositionType as i}from"../../definitions/CompositionType.js";import{ShaderType as T}from"../../definitions/ShaderType.js";import{VertexAttribute as V}from"../../definitions/VertexAttribute.js";import{MutableMatrix22 as C}from"../../math/MutableMatrix22.js";import{MutableMatrix33 as g}from"../../math/MutableMatrix33.js";import{MutableMatrix44 as F}from"../../math/MutableMatrix44.js";import{MutableScalar as l}from"../../math/MutableScalar.js";import{MutableVector2 as S}from"../../math/MutableVector2.js";import{MutableVector3 as N}from"../../math/MutableVector3.js";import{MutableVector4 as x}from"../../math/MutableVector4.js";import{Logger as y}from"../../misc/Logger.js";var b=d.default||d,M=class{static fillTemplate(r,e,o,u){let n=b.fillTemplate(e,u),a=r.webglResourceRepository,s=a.currentWebGLContextWrapper;if(s==null)return n;let t=s.getMaxTextureSize(),m=o.constructor.getMorphUniformDataOffsets(),p={WellKnownComponentTIDs:O,widthOfDataTexture:`const int widthOfDataTexture = ${t};`,dataUBODefinition:a.getGlslDataUBODefinitionString(),dataUBOVec4Size:a.getGlslDataUBOVec4SizeString(),maxMorphOffsetsDataNumber:`${Math.max(Math.ceil(m[m.length-1]/4),1)}`,maxMorphWeightsDataNumber:`${A._getMorphWeightsVec4Count(r)}`};return b.fillTemplate(n,p)}static transformWebGLVersion(r,e){return e?b.transformToGLSLES3(r):b.transformToGLSLES1(r,!0)}static getAttributeReflection(r){let e=b.createReflectionObject(r);this.ab(e),e.reflect();let o=e.attributesNames,u=e.attributesSemantics.map((s,t)=>{let m=V.fromString(s);return m===void 0&&y.default.error(`Unknown vertex attribute semantic: name=${o[t]}, semantic=${s}`),m}),n=e.attributesTypes.map(s=>i.fromGlslString(s)),a=e.attributesTypes.map(s=>h.fromGlslString(s));return{names:o,semantics:u,compositions:n,components:a}}static ab(r){let e=new Map;e.set("instanceids","INSTANCE"),e.set("barycentriccoord","BARY_CENTRIC_COORD"),r.addAttributeSemanticsMap(e)}static getShaderDataReflection(r,e){let o=this.ob(e),u=e.code.split(/\r\n|\n/),n=[],a=[];for(let s of u){let t=/^(?![/])[\t ]*uniform[\t ]+(\w+)[\t ]+(\w+);[\t ]*(\/\/)*[\t ]*(.*)/,m=s.match(t);if(m){let p=m[1],f=m[2],c=m[4];if(this.mb(c)){n.push(s);continue}let w=this.ub(r,p,f,c,e.isFragmentShader);a.push(w)}else n.push(s)}return o.code=n.join(`
2
+ `),{shaderSemanticsInfoArray:a,shaderityObject:o}}static ob(r){return{code:r.code,shaderStage:r.shaderStage,isFragmentShader:r.shaderStage==="fragment"}}static mb(r){let e=r.match(/skipProcess[\t ]*=[\t ]*(\w+)[,\t ]*/);return(e==null?void 0:e[1])==="true"}static ub(r,e,o,u,n){let a=h.fromGlslString(e),s=i.fromGlslString(e),t=n?T.PixelShader:T.VertexShader;o=o.match(/u_(\w+)/)[1];let p={semantic:o,compositionType:s,componentType:a,min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInternalSetting:!1,stage:t};return this.pb(r,p,u),p}static pb(r,e,o){let u=o.match(/soloDatum[\t ]*=[\t ]*(\w+)[,\t ]*/),n=!1;(u==null?void 0:u[1])==="true"&&(n=!0),e.soloDatum=n;let a=o.match(/isInternalSetting[\t ]*=[\t ]*(\w+)[,\t ]*/),s=!1;(a==null?void 0:a[1])==="true"&&(s=!0),e.isInternalSetting=s;let t=o.match(/initialValue[\t ]*=[\t ]*(.+)[,\t ]*/);if(t){let c=t[1];e.initialValue=this.cb(r,e,c)}else e.initialValue=this.lb(r,e);let m=o.match(/needUniformInDataTextureMode[\t ]*=[\t ]*(.+)[,\t ]*/);if(m){let c=!1;(m==null?void 0:m[1])==="true"&&(c=!0),e.needUniformInDataTextureMode=c}let p=o.match(/max[\t ]*=[\t ]*(.+)[,\t ]*/);p&&(e.max=Number.parseFloat(p[1]));let f=o.match(/min[\t ]*=[\t ]*(.+)[,\t ]*/);f&&(e.min=Number.parseFloat(f[1]))}static cb(r,e,o){let u=o.match(/\(([\d\w., ]+)\)/),n=s=>{e.compositionType!==s&&y.default.error(`component number of initialValue is invalid:${e.semantic}`)},a;if(u){let t=u[1].split(",");switch(t.length){case 1:n(i.Scalar),t[0]==="true"?a=new l(new Float32Array([1])):t[0]==="false"?a=new l(new Float32Array([0])):a=new l(new Float32Array([Number.parseFloat(t[0])]));break;case 2:if(e.compositionType===i.Texture2D||e.compositionType===i.Texture2DShadow){let m=t[1].charAt(0).toUpperCase()+t[1].slice(1);a=[Number.parseInt(t[0],10),r.dummyTextures[`dummy${m}Texture`]]}else if(e.compositionType===i.TextureCube){let m=t[1].charAt(0).toUpperCase()+t[1].slice(1);a=[Number.parseInt(t[0],10),r.dummyTextures[`dummy${m}CubeTexture`]]}else n(i.Vec2),a=S.fromCopyArray([Number.parseFloat(t[0]),Number.parseFloat(t[1])]);break;case 3:n(i.Vec3),a=N.fromCopyArray([Number.parseFloat(t[0]),Number.parseFloat(t[1]),Number.parseFloat(t[2])]);break;case 4:n(i.Vec4),a=x.fromCopyArray([Number.parseFloat(t[0]),Number.parseFloat(t[1]),Number.parseFloat(t[2]),Number.parseFloat(t[3])]);break;case 9:n(i.Mat3),a=g.fromCopy9RowMajor(Number.parseFloat(t[0]),Number.parseFloat(t[1]),Number.parseFloat(t[2]),Number.parseFloat(t[3]),Number.parseFloat(t[4]),Number.parseFloat(t[5]),Number.parseFloat(t[6]),Number.parseFloat(t[7]),Number.parseFloat(t[8]));break;case 16:n(i.Mat4),a=F.fromCopy16RowMajor(Number.parseFloat(t[0]),Number.parseFloat(t[1]),Number.parseFloat(t[2]),Number.parseFloat(t[3]),Number.parseFloat(t[4]),Number.parseFloat(t[5]),Number.parseFloat(t[6]),Number.parseFloat(t[7]),Number.parseFloat(t[8]),Number.parseFloat(t[9]),Number.parseFloat(t[10]),Number.parseFloat(t[11]),Number.parseFloat(t[12]),Number.parseFloat(t[13]),Number.parseFloat(t[14]),Number.parseFloat(t[15]));break;default:y.default.error("Invalid format")}}else n(i.Scalar),o==="true"?a=new l(new Float32Array([1])):o==="false"?a=new l(new Float32Array([0])):a=new l(new Float32Array([Number.parseFloat(o)]));return a}static lb(r,e){if(e.compositionType===i.Scalar)return new l(new Float32Array([0]));if(e.compositionType===i.Vec2)return S.zero();if(e.compositionType===i.Vec3)return N.zero();if(e.compositionType===i.Vec4)return x.zero();if(e.compositionType===i.Mat2)return C.identity();if(e.compositionType===i.Mat3)return g.identity();if(e.compositionType===i.Mat4)return F.identity();if(e.compositionType===i.Texture2D)return[0,r.dummyTextures.dummyWhiteTexture];if(e.compositionType===i.Texture2DShadow)return[0,r.dummyTextures.dummyWhiteTexture];if(e.compositionType===i.TextureCube)return[0,r.dummyTextures.dummyBlackTexture];y.default.warn("initial value is not found")}};export{M as ShaderityUtilityWebGL};
@@ -1,2 +1,2 @@
1
- import N from"../../../_deps/shaderity.js";import{BlendShapeComponent as I}from"../../components/BlendShape/BlendShapeComponent.js";import{TextureParameter as c}from"../../definitions/index.js";import{ComponentType as w}from"../../definitions/ComponentType.js";import{CompositionType as i}from"../../definitions/CompositionType.js";import{ShaderType as g}from"../../definitions/ShaderType.js";import{MutableMatrix22 as U}from"../../math/MutableMatrix22.js";import{MutableMatrix33 as M}from"../../math/MutableMatrix33.js";import{MutableMatrix44 as A}from"../../math/MutableMatrix44.js";import{MutableScalar as y}from"../../math/MutableScalar.js";import{MutableVector2 as V}from"../../math/MutableVector2.js";import{MutableVector3 as C}from"../../math/MutableVector3.js";import{MutableVector4 as E}from"../../math/MutableVector4.js";import{Logger as T}from"../../misc/Logger.js";import{Sampler as O}from"../../textures/Sampler.js";var D=N.default||N,v=class{static fillTemplate(r,t,n,o){let a=D.fillTemplate(t,o),s=n.constructor.getMorphUniformDataOffsets(),e=I.getOffsetsInUniform(r),m={maxMorphOffsetsDataNumber:`${Math.max(Math.ceil(s[s.length-1]/4),1)}`,maxMorphWeightsDataNumber:`${Math.max(Math.ceil(e[e.length-1]/4),1)}`};return D.fillTemplate(a,m)}static getShaderDataReflection(r,t){let n=this.eb(t),o=new Map,a=t.code.split(/\r\n|\n/),s=[],e=[];for(let m of a){let u=/^[\t ]*\/\/[\t ]*#param[\t ]+(\w+)[ \t]*:[\t ]*([\w><]+);[\t ]*(\/\/)*[\t ]*(.*)/,p=m.match(u),f=/^[\t ]*@group\(1\) @binding\((\d+)\)[ \t]*var[ \t]*(\w+)[ \t]*:[ \t]*([\w><]+);[\t ]*\/\/*[\t ]*(.*)/,l=m.match(f),j=/^[\t ]*@group\(2\) @binding\((\d+)\)[ \t]*var[ \t]*(\w+)[ \t]*:[ \t]*sampler;/,S=m.match(j);if(p){let b=p[2],d=p[1],h=p[4],F=this.ab(r,b,d,h,t.isFragmentShader);e.push(F)}else if(l){let b=Number.parseInt(l[1],10),d=l[2],h=l[3],F=l[4],x=this.sb(r,h,d,b,F,t.isFragmentShader);o.set(b,x),e.push(x)}else if(S){let b=Number.parseInt(S[1],10);if(o.has(b)){let d=o.get(b);if(d){let h=new O(r,{magFilter:c.Linear,minFilter:c.Linear,wrapS:c.Repeat,wrapT:c.Repeat,wrapR:c.Repeat,anisotropy:!1});d.initialValue[2]=h}}}else s.push(m)}return n.code=s.join(`
2
- `),{shaderSemanticsInfoArray:e,shaderityObject:n}}static sb(r,t,n,o,a,s){let e=w.Int,m=i.Texture2D;t.indexOf("texture_2d")!==-1?m=i.Texture2D:t.indexOf("texture_cube")!==-1&&(m=i.TextureCube);let u=s?g.PixelShader:g.VertexShader,p={semantic:n,compositionType:m,componentType:e,min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInternalSetting:!1,stage:u},f=a.match(/initialValue[\t ]*=[\t ]*(.+)[,\t ]*/);if(f){let l=f[1];p.initialValue=this.mb(r,p,o,l)}else p.initialValue=this.nb(r,p);return p}static ab(r,t,n,o,a){let s=w.fromWgslString(t),e=i.fromWgslString(t),m=a?g.PixelShader:g.VertexShader,u={semantic:n,compositionType:e,componentType:s,min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInternalSetting:!1,stage:m};return this.ob(r,u,o),u}static ob(r,t,n){let o=n.match(/soloDatum[\t ]*=[\t ]*(\w+)[,\t ]*/),a=!1;(o==null?void 0:o[1])==="true"&&(a=!0),t.soloDatum=a;let s=n.match(/isInternalSetting[\t ]*=[\t ]*(\w+)[,\t ]*/),e=!1;(s==null?void 0:s[1])==="true"&&(e=!0),t.isInternalSetting=e;let m=n.match(/initialValue[\t ]*=[\t ]*(.+)[,\t ]*/);if(m){let l=m[1];t.initialValue=this.ib(t,l)}else t.initialValue=this.nb(r,t);let u=n.match(/needUniformInDataTextureMode[\t ]*=[\t ]*(.+)[,\t ]*/);if(u){let l=!1;(u==null?void 0:u[1])==="true"&&(l=!0),t.needUniformInDataTextureMode=l}let p=n.match(/max[\t ]*=[\t ]*(.+)[,\t ]*/);p&&(t.max=Number.parseFloat(p[1]));let f=n.match(/min[\t ]*=[\t ]*(.+)[,\t ]*/);f&&(t.min=Number.parseFloat(f[1]))}static mb(r,t,n,o){let a,s=new O(r,{magFilter:c.Linear,minFilter:c.Linear,wrapS:c.ClampToEdge,wrapT:c.ClampToEdge,wrapR:c.ClampToEdge,anisotropy:!1});if(t.compositionType===i.Texture2D||t.compositionType===i.Texture2DShadow){let e=o.charAt(0).toUpperCase()+o.slice(1);a=[n,r.dummyTextures[`dummy${e}Texture`],s]}else if(t.compositionType===i.TextureCube){let e=o.charAt(0).toUpperCase()+o.slice(1);a=[n,r.dummyTextures[`dummy${e}CubeTexture`],s]}return a}static ib(r,t){let n=t.match(/\(([\d\w., ]+)\)/),o=s=>{r.compositionType!==s&&T.default.error(`component number of initialValue is invalid:${r.semantic}`)},a;if(n){let e=n[1].split(",");switch(e.length){case 1:o(i.Scalar),e[0]==="true"?a=new y(new Float32Array([1])):e[0]==="false"?a=new y(new Float32Array([0])):a=new y(new Float32Array([Number.parseFloat(e[0])]));break;case 2:o(i.Vec2),a=V.fromCopyArray([Number.parseFloat(e[0]),Number.parseFloat(e[1])]);break;case 3:o(i.Vec3),a=C.fromCopyArray([Number.parseFloat(e[0]),Number.parseFloat(e[1]),Number.parseFloat(e[2])]);break;case 4:o(i.Vec4),a=E.fromCopyArray([Number.parseFloat(e[0]),Number.parseFloat(e[1]),Number.parseFloat(e[2]),Number.parseFloat(e[3])]);break;case 9:o(i.Mat3),a=M.fromCopy9RowMajor(Number.parseFloat(e[0]),Number.parseFloat(e[1]),Number.parseFloat(e[2]),Number.parseFloat(e[3]),Number.parseFloat(e[4]),Number.parseFloat(e[5]),Number.parseFloat(e[6]),Number.parseFloat(e[7]),Number.parseFloat(e[8]));break;case 16:o(i.Mat4),a=A.fromCopy16RowMajor(Number.parseFloat(e[0]),Number.parseFloat(e[1]),Number.parseFloat(e[2]),Number.parseFloat(e[3]),Number.parseFloat(e[4]),Number.parseFloat(e[5]),Number.parseFloat(e[6]),Number.parseFloat(e[7]),Number.parseFloat(e[8]),Number.parseFloat(e[9]),Number.parseFloat(e[10]),Number.parseFloat(e[11]),Number.parseFloat(e[12]),Number.parseFloat(e[13]),Number.parseFloat(e[14]),Number.parseFloat(e[15]));break;default:T.default.error("Invalid format")}}else o(i.Scalar),t==="true"?a=new y(new Float32Array([1])):t==="false"?a=new y(new Float32Array([0])):a=new y(new Float32Array([Number.parseFloat(t)]));return a}static nb(r,t){if(t.compositionType===i.Scalar)return new y(new Float32Array([0]));if(t.compositionType===i.Vec2)return V.zero();if(t.compositionType===i.Vec3)return C.zero();if(t.compositionType===i.Vec4)return E.zero();if(t.compositionType===i.Mat2)return U.identity();if(t.compositionType===i.Mat3)return M.identity();if(t.compositionType===i.Mat4)return A.identity();if(t.compositionType===i.Texture2D)return[0,r.dummyTextures.dummyWhiteTexture];if(t.compositionType===i.Texture2DShadow)return[0,r.dummyTextures.dummyWhiteTexture];if(t.compositionType===i.TextureCube)return[0,r.dummyTextures.dummyBlackTexture];T.default.warn("initial value is not found")}static eb(r){return{code:r.code,shaderStage:r.shaderStage,isFragmentShader:r.shaderStage==="fragment"}}};export{v as ShaderityUtilityWebGPU};
1
+ import N from"../../../_deps/shaderity.js";import{BlendShapeComponent as k}from"../../components/BlendShape/BlendShapeComponent.js";import{TextureParameter as c}from"../../definitions/index.js";import{ComponentType as w}from"../../definitions/ComponentType.js";import{CompositionType as i}from"../../definitions/CompositionType.js";import{ShaderType as g}from"../../definitions/ShaderType.js";import{MutableMatrix22 as I}from"../../math/MutableMatrix22.js";import{MutableMatrix33 as M}from"../../math/MutableMatrix33.js";import{MutableMatrix44 as A}from"../../math/MutableMatrix44.js";import{MutableScalar as y}from"../../math/MutableScalar.js";import{MutableVector2 as V}from"../../math/MutableVector2.js";import{MutableVector3 as C}from"../../math/MutableVector3.js";import{MutableVector4 as E}from"../../math/MutableVector4.js";import{Logger as T}from"../../misc/Logger.js";import{Sampler as O}from"../../textures/Sampler.js";var v=N.default||N,D=class{static fillTemplate(r,t,n,o){let a=v.fillTemplate(t,o),s=n.constructor.getMorphUniformDataOffsets(),e={maxMorphOffsetsDataNumber:`${Math.max(Math.ceil(s[s.length-1]/4),1)}`,maxMorphWeightsDataNumber:`${k._getMorphWeightsVec4Count(r)}`};return v.fillTemplate(a,e)}static getShaderDataReflection(r,t){let n=this.ob(t),o=new Map,a=t.code.split(/\r\n|\n/),s=[],e=[];for(let m of a){let u=/^[\t ]*\/\/[\t ]*#param[\t ]+(\w+)[ \t]*:[\t ]*([\w><]+);[\t ]*(\/\/)*[\t ]*(.*)/,p=m.match(u),f=/^[\t ]*@group\(1\) @binding\((\d+)\)[ \t]*var[ \t]*(\w+)[ \t]*:[ \t]*([\w><]+);[\t ]*\/\/*[\t ]*(.*)/,l=m.match(f),j=/^[\t ]*@group\(2\) @binding\((\d+)\)[ \t]*var[ \t]*(\w+)[ \t]*:[ \t]*sampler;/,S=m.match(j);if(p){let b=p[2],d=p[1],h=p[4],F=this.ub(r,b,d,h,t.isFragmentShader);e.push(F)}else if(l){let b=Number.parseInt(l[1],10),d=l[2],h=l[3],F=l[4],x=this.fb(r,h,d,b,F,t.isFragmentShader);o.set(b,x),e.push(x)}else if(S){let b=Number.parseInt(S[1],10);if(o.has(b)){let d=o.get(b);if(d){let h=new O(r,{magFilter:c.Linear,minFilter:c.Linear,wrapS:c.Repeat,wrapT:c.Repeat,wrapR:c.Repeat,anisotropy:!1});d.initialValue[2]=h}}}else s.push(m)}return n.code=s.join(`
2
+ `),{shaderSemanticsInfoArray:e,shaderityObject:n}}static fb(r,t,n,o,a,s){let e=w.Int,m=i.Texture2D;t.indexOf("texture_2d")!==-1?m=i.Texture2D:t.indexOf("texture_cube")!==-1&&(m=i.TextureCube);let u=s?g.PixelShader:g.VertexShader,p={semantic:n,compositionType:m,componentType:e,min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInternalSetting:!1,stage:u},f=a.match(/initialValue[\t ]*=[\t ]*(.+)[,\t ]*/);if(f){let l=f[1];p.initialValue=this.bb(r,p,o,l)}else p.initialValue=this.lb(r,p);return p}static ub(r,t,n,o,a){let s=w.fromWgslString(t),e=i.fromWgslString(t),m=a?g.PixelShader:g.VertexShader,u={semantic:n,compositionType:e,componentType:s,min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInternalSetting:!1,stage:m};return this.pb(r,u,o),u}static pb(r,t,n){let o=n.match(/soloDatum[\t ]*=[\t ]*(\w+)[,\t ]*/),a=!1;(o==null?void 0:o[1])==="true"&&(a=!0),t.soloDatum=a;let s=n.match(/isInternalSetting[\t ]*=[\t ]*(\w+)[,\t ]*/),e=!1;(s==null?void 0:s[1])==="true"&&(e=!0),t.isInternalSetting=e;let m=n.match(/initialValue[\t ]*=[\t ]*(.+)[,\t ]*/);if(m){let l=m[1];t.initialValue=this.cb(t,l)}else t.initialValue=this.lb(r,t);let u=n.match(/needUniformInDataTextureMode[\t ]*=[\t ]*(.+)[,\t ]*/);if(u){let l=!1;(u==null?void 0:u[1])==="true"&&(l=!0),t.needUniformInDataTextureMode=l}let p=n.match(/max[\t ]*=[\t ]*(.+)[,\t ]*/);p&&(t.max=Number.parseFloat(p[1]));let f=n.match(/min[\t ]*=[\t ]*(.+)[,\t ]*/);f&&(t.min=Number.parseFloat(f[1]))}static bb(r,t,n,o){let a,s=new O(r,{magFilter:c.Linear,minFilter:c.Linear,wrapS:c.ClampToEdge,wrapT:c.ClampToEdge,wrapR:c.ClampToEdge,anisotropy:!1});if(t.compositionType===i.Texture2D||t.compositionType===i.Texture2DShadow){let e=o.charAt(0).toUpperCase()+o.slice(1);a=[n,r.dummyTextures[`dummy${e}Texture`],s]}else if(t.compositionType===i.TextureCube){let e=o.charAt(0).toUpperCase()+o.slice(1);a=[n,r.dummyTextures[`dummy${e}CubeTexture`],s]}return a}static cb(r,t){let n=t.match(/\(([\d\w., ]+)\)/),o=s=>{r.compositionType!==s&&T.default.error(`component number of initialValue is invalid:${r.semantic}`)},a;if(n){let e=n[1].split(",");switch(e.length){case 1:o(i.Scalar),e[0]==="true"?a=new y(new Float32Array([1])):e[0]==="false"?a=new y(new Float32Array([0])):a=new y(new Float32Array([Number.parseFloat(e[0])]));break;case 2:o(i.Vec2),a=V.fromCopyArray([Number.parseFloat(e[0]),Number.parseFloat(e[1])]);break;case 3:o(i.Vec3),a=C.fromCopyArray([Number.parseFloat(e[0]),Number.parseFloat(e[1]),Number.parseFloat(e[2])]);break;case 4:o(i.Vec4),a=E.fromCopyArray([Number.parseFloat(e[0]),Number.parseFloat(e[1]),Number.parseFloat(e[2]),Number.parseFloat(e[3])]);break;case 9:o(i.Mat3),a=M.fromCopy9RowMajor(Number.parseFloat(e[0]),Number.parseFloat(e[1]),Number.parseFloat(e[2]),Number.parseFloat(e[3]),Number.parseFloat(e[4]),Number.parseFloat(e[5]),Number.parseFloat(e[6]),Number.parseFloat(e[7]),Number.parseFloat(e[8]));break;case 16:o(i.Mat4),a=A.fromCopy16RowMajor(Number.parseFloat(e[0]),Number.parseFloat(e[1]),Number.parseFloat(e[2]),Number.parseFloat(e[3]),Number.parseFloat(e[4]),Number.parseFloat(e[5]),Number.parseFloat(e[6]),Number.parseFloat(e[7]),Number.parseFloat(e[8]),Number.parseFloat(e[9]),Number.parseFloat(e[10]),Number.parseFloat(e[11]),Number.parseFloat(e[12]),Number.parseFloat(e[13]),Number.parseFloat(e[14]),Number.parseFloat(e[15]));break;default:T.default.error("Invalid format")}}else o(i.Scalar),t==="true"?a=new y(new Float32Array([1])):t==="false"?a=new y(new Float32Array([0])):a=new y(new Float32Array([Number.parseFloat(t)]));return a}static lb(r,t){if(t.compositionType===i.Scalar)return new y(new Float32Array([0]));if(t.compositionType===i.Vec2)return V.zero();if(t.compositionType===i.Vec3)return C.zero();if(t.compositionType===i.Vec4)return E.zero();if(t.compositionType===i.Mat2)return I.identity();if(t.compositionType===i.Mat3)return M.identity();if(t.compositionType===i.Mat4)return A.identity();if(t.compositionType===i.Texture2D)return[0,r.dummyTextures.dummyWhiteTexture];if(t.compositionType===i.Texture2DShadow)return[0,r.dummyTextures.dummyWhiteTexture];if(t.compositionType===i.TextureCube)return[0,r.dummyTextures.dummyBlackTexture];T.default.warn("initial value is not found")}static ob(r){return{code:r.code,shaderStage:r.shaderStage,isFragmentShader:r.shaderStage==="fragment"}}};export{D as ShaderityUtilityWebGPU};
@@ -1 +1 @@
1
- import p from"../../../webgl/shaderity_shaders/nodes/CastToFloat.glsl.js";import r from"../../../webgpu/shaderity_shaders/nodes/CastToFloat.wgsl.js";import{ComponentType as i}from"../../definitions/ComponentType.js";import{CompositionType as n}from"../../definitions/CompositionType.js";import{ProcessApproach as m}from"../../definitions/ProcessApproach.js";import{AbstractShaderNode as c}from"../core/AbstractShaderNode.js";var a=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?p:void 0,f=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?r:void 0,s=class extends c{constructor(t,e){super("castToFloat",{codeGLSL:a.code,codeWGSL:f.code}),this.n_=e,this.o_=t,this.uS.push({compositionType:t,componentType:e,name:"value"}),this.yS.push({compositionType:t,componentType:i.Float,name:"outValue"})}getShaderFunctionNameDerivative(t){if(t.engineState.currentProcessApproach===m.WebGPU){let e="";this.n_===i.Bool?e="Bool":this.n_===i.Int?e="Int":this.n_===i.UnsignedInt&&(e="Uint");let o="";return this.o_===n.Scalar?o="Scalar":this.o_===n.Vec2?o="Vec2":this.o_===n.Vec3?o="Vec3":this.o_===n.Vec4&&(o="Vec4"),`${this.gS}${e}${o}`}return this.gS}};export{s as CastToFloatShaderNode};
1
+ import p from"../../../webgl/shaderity_shaders/nodes/CastToFloat.glsl.js";import r from"../../../webgpu/shaderity_shaders/nodes/CastToFloat.wgsl.js";import{ComponentType as i}from"../../definitions/ComponentType.js";import{CompositionType as n}from"../../definitions/CompositionType.js";import{ProcessApproach as m}from"../../definitions/ProcessApproach.js";import{AbstractShaderNode as c}from"../core/AbstractShaderNode.js";var a=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?p:void 0,f=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?r:void 0,s=class extends c{constructor(t,e){super("castToFloat",{codeGLSL:a.code,codeWGSL:f.code}),this.m_=e,this.p_=t,this.uS.push({compositionType:t,componentType:e,name:"value"}),this.yS.push({compositionType:t,componentType:i.Float,name:"outValue"})}getShaderFunctionNameDerivative(t){if(t.engineState.currentProcessApproach===m.WebGPU){let e="";this.m_===i.Bool?e="Bool":this.m_===i.Int?e="Int":this.m_===i.UnsignedInt&&(e="Uint");let o="";return this.p_===n.Scalar?o="Scalar":this.p_===n.Vec2?o="Vec2":this.p_===n.Vec3?o="Vec3":this.p_===n.Vec4&&(o="Vec4"),`${this.gS}${e}${o}`}return this.gS}};export{s as CastToFloatShaderNode};
@@ -1,2 +1,2 @@
1
- import a from"../../../webgl/shaderity_shaders/nodes/MergeVector.glsl.js";import y from"../../../webgpu/shaderity_shaders/nodes/MergeVector.wgsl.js";import{ComponentType as c}from"../../definitions/ComponentType.js";import{CompositionType as t}from"../../definitions/CompositionType.js";import{ProcessApproach as l}from"../../definitions/ProcessApproach.js";import{AbstractShaderNode as d}from"../core/AbstractShaderNode.js";var f=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?a:void 0,g=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?y:void 0,m=class extends d{constructor(e=c.Float){super("mergeVector",{codeGLSL:f.code,codeWGSL:g.code}),this.s_=e,this.uS.push({compositionType:t.Vec3,componentType:e,name:"xyz"}),this.uS.push({compositionType:t.Vec2,componentType:e,name:"xy"}),this.uS.push({compositionType:t.Vec2,componentType:e,name:"zw"}),this.uS.push({compositionType:t.Scalar,componentType:e,name:"x"}),this.uS.push({compositionType:t.Scalar,componentType:e,name:"y"}),this.uS.push({compositionType:t.Scalar,componentType:e,name:"z"}),this.uS.push({compositionType:t.Scalar,componentType:e,name:"w"}),this.yS.push({compositionType:t.Vec4,componentType:e,name:"xyzw"}),this.yS.push({compositionType:t.Vec3,componentType:e,name:"xyz"}),this.yS.push({compositionType:t.Vec2,componentType:e,name:"xy"}),this.yS.push({compositionType:t.Vec2,componentType:e,name:"zw"})}getShaderFunctionNameDerivative(e){let n="";if(e.engineState.currentProcessApproach===l.WebGPU&&(this.s_===c.Int?n="I32":this.s_===c.UnsignedInt&&(n="U32")),this.inputConnections[0]!=null&&this.inputConnections[6]!=null)return`${this.gS}XYZ_W${n}`;if(this.inputConnections[1]!=null&&this.inputConnections[2]!=null)return`${this.gS}XY_ZW${n}`;if(this.inputConnections[1]!=null&&this.inputConnections[5]!=null&&this.inputConnections[6]!=null)return`${this.gS}XY_Z_W${n}`;if(this.inputConnections[2]!=null&&this.inputConnections[3]!=null&&this.inputConnections[4]!=null)return`${this.gS}ZW_X_Y${n}`;if(this.inputConnections[3]!=null&&this.inputConnections[4]!=null&&this.inputConnections[5]!=null&&this.inputConnections[6]!=null)return`${this.gS}X_Y_Z_W${n}`;throw new Error("Not implemented")}makeCallStatement(e,n,S,s,u,h){let p="";if(u[n].length>0&&h[n].length>0){let o;s.includes("XYZ_W")?o=[0,6]:s.includes("XY_ZW")?o=[1,2]:s.includes("XY_Z_W")?o=[1,5,6]:s.includes("ZW_X_Y")?o=[2,3,4]:s.includes("X_Y_Z_W")?o=[3,4,5,6]:o=[];let r=[...h[n]];if(e.engineState.currentProcessApproach===l.WebGPU)for(let i=0;i<r.length;i++)r[i]=`&${r[i]}`;p+=`${s}(`;for(let i=0;i<o.length;i++){i!==0&&(p+=", ");let _=u[n][o[i]];p+=_}p+=`, ${r.join(", ")}`,p+=`);
1
+ import a from"../../../webgl/shaderity_shaders/nodes/MergeVector.glsl.js";import y from"../../../webgpu/shaderity_shaders/nodes/MergeVector.wgsl.js";import{ComponentType as c}from"../../definitions/ComponentType.js";import{CompositionType as t}from"../../definitions/CompositionType.js";import{ProcessApproach as l}from"../../definitions/ProcessApproach.js";import{AbstractShaderNode as d}from"../core/AbstractShaderNode.js";var f=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?a:void 0,g=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?y:void 0,m=class extends d{constructor(e=c.Float){super("mergeVector",{codeGLSL:f.code,codeWGSL:g.code}),this.c_=e,this.uS.push({compositionType:t.Vec3,componentType:e,name:"xyz"}),this.uS.push({compositionType:t.Vec2,componentType:e,name:"xy"}),this.uS.push({compositionType:t.Vec2,componentType:e,name:"zw"}),this.uS.push({compositionType:t.Scalar,componentType:e,name:"x"}),this.uS.push({compositionType:t.Scalar,componentType:e,name:"y"}),this.uS.push({compositionType:t.Scalar,componentType:e,name:"z"}),this.uS.push({compositionType:t.Scalar,componentType:e,name:"w"}),this.yS.push({compositionType:t.Vec4,componentType:e,name:"xyzw"}),this.yS.push({compositionType:t.Vec3,componentType:e,name:"xyz"}),this.yS.push({compositionType:t.Vec2,componentType:e,name:"xy"}),this.yS.push({compositionType:t.Vec2,componentType:e,name:"zw"})}getShaderFunctionNameDerivative(e){let n="";if(e.engineState.currentProcessApproach===l.WebGPU&&(this.c_===c.Int?n="I32":this.c_===c.UnsignedInt&&(n="U32")),this.inputConnections[0]!=null&&this.inputConnections[6]!=null)return`${this.gS}XYZ_W${n}`;if(this.inputConnections[1]!=null&&this.inputConnections[2]!=null)return`${this.gS}XY_ZW${n}`;if(this.inputConnections[1]!=null&&this.inputConnections[5]!=null&&this.inputConnections[6]!=null)return`${this.gS}XY_Z_W${n}`;if(this.inputConnections[2]!=null&&this.inputConnections[3]!=null&&this.inputConnections[4]!=null)return`${this.gS}ZW_X_Y${n}`;if(this.inputConnections[3]!=null&&this.inputConnections[4]!=null&&this.inputConnections[5]!=null&&this.inputConnections[6]!=null)return`${this.gS}X_Y_Z_W${n}`;throw new Error("Not implemented")}makeCallStatement(e,n,S,s,u,h){let p="";if(u[n].length>0&&h[n].length>0){let o;s.includes("XYZ_W")?o=[0,6]:s.includes("XY_ZW")?o=[1,2]:s.includes("XY_Z_W")?o=[1,5,6]:s.includes("ZW_X_Y")?o=[2,3,4]:s.includes("X_Y_Z_W")?o=[3,4,5,6]:o=[];let r=[...h[n]];if(e.engineState.currentProcessApproach===l.WebGPU)for(let i=0;i<r.length;i++)r[i]=`&${r[i]}`;p+=`${s}(`;for(let i=0;i<o.length;i++){i!==0&&(p+=", ");let _=u[n][o[i]];p+=_}p+=`, ${r.join(", ")}`,p+=`);
2
2
  `}return p}};export{m as MergeVectorShaderNode};
@@ -1,2 +1,2 @@
1
- import p from"../../../webgl/shaderity_shaders/nodes/Random_HashPRNG.glsl.js";import _ from"../../../webgpu/shaderity_shaders/nodes/Random_HashPRNG.wgsl.js";import{ComponentType as t}from"../../definitions/ComponentType.js";import{CompositionType as e}from"../../definitions/CompositionType.js";import{ProcessApproach as f}from"../../definitions/ProcessApproach.js";import{Vector3 as S}from"../../math/Vector3.js";import{AbstractShaderNode as G}from"../core/AbstractShaderNode.js";import{Socket as o}from"../core/Socket.js";var g=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?p:void 0,y=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?_:void 0,u=class extends G{constructor(){super("random_HashPRNG",{codeGLSL:g.code,codeWGSL:y.code}),this.uS.push(new o("seed",e.Vec3,t.Float,S.fromCopy3(0,0,0))),this.yS.push(new o("outXYZW",e.Vec4,t.Float)),this.yS.push(new o("outXYZ1",e.Vec4,t.Float)),this.yS.push(new o("outXYZ",e.Vec3,t.Float)),this.yS.push(new o("outXY",e.Vec2,t.Float)),this.yS.push(new o("outZW",e.Vec2,t.Float)),this.yS.push(new o("outX",e.Scalar,t.Float)),this.yS.push(new o("outY",e.Scalar,t.Float)),this.yS.push(new o("outZ",e.Scalar,t.Float)),this.yS.push(new o("outW",e.Scalar,t.Float))}c_(i){let r=[4,3,3,2,4,1,2,3,4],c=1;for(let n=0;n<i.length;n++)if(!i[n].startsWith("dummy")){let s=r[n]||4;c=Math.max(c,s)}return c}makeCallStatement(i,r,c,n,l,s){let a="";if(l[r].length>0&&s[r].length>0){let d=`random_HashPRNG${this.c_(s[r])}`,h=[...s[r]];if(i.engineState.currentProcessApproach===f.WebGPU)for(let m=0;m<h.length;m++)h[m]=`&${h[m]}`;a+=`${d}(`,a+=l[r][0],a+=`, ${h.join(", ")}`,a+=`);
1
+ import p from"../../../webgl/shaderity_shaders/nodes/Random_HashPRNG.glsl.js";import _ from"../../../webgpu/shaderity_shaders/nodes/Random_HashPRNG.wgsl.js";import{ComponentType as t}from"../../definitions/ComponentType.js";import{CompositionType as e}from"../../definitions/CompositionType.js";import{ProcessApproach as f}from"../../definitions/ProcessApproach.js";import{Vector3 as S}from"../../math/Vector3.js";import{AbstractShaderNode as G}from"../core/AbstractShaderNode.js";import{Socket as o}from"../core/Socket.js";var g=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?p:void 0,y=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?_:void 0,u=class extends G{constructor(){super("random_HashPRNG",{codeGLSL:g.code,codeWGSL:y.code}),this.uS.push(new o("seed",e.Vec3,t.Float,S.fromCopy3(0,0,0))),this.yS.push(new o("outXYZW",e.Vec4,t.Float)),this.yS.push(new o("outXYZ1",e.Vec4,t.Float)),this.yS.push(new o("outXYZ",e.Vec3,t.Float)),this.yS.push(new o("outXY",e.Vec2,t.Float)),this.yS.push(new o("outZW",e.Vec2,t.Float)),this.yS.push(new o("outX",e.Scalar,t.Float)),this.yS.push(new o("outY",e.Scalar,t.Float)),this.yS.push(new o("outZ",e.Scalar,t.Float)),this.yS.push(new o("outW",e.Scalar,t.Float))}h_(i){let r=[4,3,3,2,4,1,2,3,4],c=1;for(let n=0;n<i.length;n++)if(!i[n].startsWith("dummy")){let s=r[n]||4;c=Math.max(c,s)}return c}makeCallStatement(i,r,c,n,l,s){let a="";if(l[r].length>0&&s[r].length>0){let d=`random_HashPRNG${this.h_(s[r])}`,h=[...s[r]];if(i.engineState.currentProcessApproach===f.WebGPU)for(let m=0;m<h.length;m++)h[m]=`&${h[m]}`;a+=`${d}(`,a+=l[r][0],a+=`, ${h.join(", ")}`,a+=`);
2
2
  `}return a}};export{u as Random_HashPRNGShaderNode};
@@ -1,2 +1,2 @@
1
- import p from"../../../webgl/shaderity_shaders/nodes/Random_SinHash.glsl.js";import _ from"../../../webgpu/shaderity_shaders/nodes/Random_SinHash.wgsl.js";import{ComponentType as t}from"../../definitions/ComponentType.js";import{CompositionType as e}from"../../definitions/CompositionType.js";import{ProcessApproach as S}from"../../definitions/ProcessApproach.js";import{Vector2 as f}from"../../math/Vector2.js";import{AbstractShaderNode as g}from"../core/AbstractShaderNode.js";import{Socket as o}from"../core/Socket.js";var y=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?p:void 0,W=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?_:void 0,u=class extends g{constructor(){super("random_SinHash",{codeGLSL:y.code,codeWGSL:W.code}),this.uS.push(new o("seed",e.Vec2,t.Float,f.fromCopy2(0,0))),this.yS.push(new o("outXYZW",e.Vec4,t.Float)),this.yS.push(new o("outXYZ1",e.Vec4,t.Float)),this.yS.push(new o("outXYZ",e.Vec3,t.Float)),this.yS.push(new o("outXY",e.Vec2,t.Float)),this.yS.push(new o("outZW",e.Vec2,t.Float)),this.yS.push(new o("outX",e.Scalar,t.Float)),this.yS.push(new o("outY",e.Scalar,t.Float)),this.yS.push(new o("outZ",e.Scalar,t.Float)),this.yS.push(new o("outW",e.Scalar,t.Float))}c_(a){let n=[4,3,3,2,4,1,2,3,4],c=1;for(let r=0;r<a.length;r++)if(!a[r].startsWith("dummy")){let s=n[r]||4;c=Math.max(c,s)}return c}makeCallStatement(a,n,c,r,l,s){let i="";if(l[n].length>0&&s[n].length>0){let d=`random_SinHash${this.c_(s[n])}`,h=[...s[n]];if(a.engineState.currentProcessApproach===S.WebGPU)for(let m=0;m<h.length;m++)h[m]=`&${h[m]}`;i+=`${d}(`,i+=l[n][0],i+=`, ${h.join(", ")}`,i+=`);
1
+ import p from"../../../webgl/shaderity_shaders/nodes/Random_SinHash.glsl.js";import _ from"../../../webgpu/shaderity_shaders/nodes/Random_SinHash.wgsl.js";import{ComponentType as t}from"../../definitions/ComponentType.js";import{CompositionType as e}from"../../definitions/CompositionType.js";import{ProcessApproach as S}from"../../definitions/ProcessApproach.js";import{Vector2 as f}from"../../math/Vector2.js";import{AbstractShaderNode as g}from"../core/AbstractShaderNode.js";import{Socket as o}from"../core/Socket.js";var y=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?p:void 0,W=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?_:void 0,u=class extends g{constructor(){super("random_SinHash",{codeGLSL:y.code,codeWGSL:W.code}),this.uS.push(new o("seed",e.Vec2,t.Float,f.fromCopy2(0,0))),this.yS.push(new o("outXYZW",e.Vec4,t.Float)),this.yS.push(new o("outXYZ1",e.Vec4,t.Float)),this.yS.push(new o("outXYZ",e.Vec3,t.Float)),this.yS.push(new o("outXY",e.Vec2,t.Float)),this.yS.push(new o("outZW",e.Vec2,t.Float)),this.yS.push(new o("outX",e.Scalar,t.Float)),this.yS.push(new o("outY",e.Scalar,t.Float)),this.yS.push(new o("outZ",e.Scalar,t.Float)),this.yS.push(new o("outW",e.Scalar,t.Float))}h_(a){let n=[4,3,3,2,4,1,2,3,4],c=1;for(let r=0;r<a.length;r++)if(!a[r].startsWith("dummy")){let s=n[r]||4;c=Math.max(c,s)}return c}makeCallStatement(a,n,c,r,l,s){let i="";if(l[n].length>0&&s[n].length>0){let d=`random_SinHash${this.h_(s[n])}`,h=[...s[n]];if(a.engineState.currentProcessApproach===S.WebGPU)for(let m=0;m<h.length;m++)h[m]=`&${h[m]}`;i+=`${d}(`,i+=l[n][0],i+=`, ${h.join(", ")}`,i+=`);
2
2
  `}return i}};export{u as Random_SinHashShaderNode};
@@ -1,2 +1,2 @@
1
- import l from"../../../webgl/shaderity_shaders/nodes/SplitVector.glsl.js";import d from"../../../webgpu/shaderity_shaders/nodes/SplitVector.wgsl.js";import{ComponentType as r}from"../../definitions/ComponentType.js";import{CompositionType as n}from"../../definitions/CompositionType.js";import{ProcessApproach as a}from"../../definitions/ProcessApproach.js";import{AbstractShaderNode as S}from"../core/AbstractShaderNode.js";var _=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?l:void 0,T=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?d:void 0,u=class extends S{constructor(e=r.Float){super("splitVector",{codeGLSL:_.code,codeWGSL:T.code}),this.s_=e,this.uS.push({compositionType:n.Vec4,componentType:e,name:"xyzw"}),this.uS.push({compositionType:n.Vec3,componentType:e,name:"xyz"}),this.uS.push({compositionType:n.Vec2,componentType:e,name:"xy"}),this.yS.push({compositionType:n.Vec3,componentType:e,name:"xyz"}),this.yS.push({compositionType:n.Vec2,componentType:e,name:"xy"}),this.yS.push({compositionType:n.Vec2,componentType:e,name:"zw"}),this.yS.push({compositionType:n.Scalar,componentType:e,name:"x"}),this.yS.push({compositionType:n.Scalar,componentType:e,name:"y"}),this.yS.push({compositionType:n.Scalar,componentType:e,name:"z"}),this.yS.push({compositionType:n.Scalar,componentType:e,name:"w"})}getShaderFunctionNameDerivative(e){if(e.engineState.currentProcessApproach===a.WebGPU){let t="";this.s_===r.Int?t="I32":this.s_===r.UnsignedInt&&(t="U32");for(let o of this.inputConnections)if(o!=null){if(o.inputNameOfThis==="xyzw")return`${this.gS}XYZW${t}`;if(o.inputNameOfThis==="xyz")return`${this.gS}XYZ${t}`;if(o.inputNameOfThis==="xy")return`${this.gS}XY${t}`}throw new Error("Not implemented")}return this.gS}makeCallStatement(e,t,o,y,c,m){let s="";if(c[t].length>0&&m[t].length>0){let h=0;for(let i=0;i<this.inputConnections.length;i++)if(this.inputConnections[i]!=null){h=i;break}let p=[...m[t]];if(e.engineState.currentProcessApproach===a.WebGPU)for(let i=0;i<p.length;i++)p[i]=`&${p[i]}`;s+=`${y}(`;let f=c[t][h];s+=f,s+=`, ${p.join(", ")}`,s+=`);
1
+ import l from"../../../webgl/shaderity_shaders/nodes/SplitVector.glsl.js";import d from"../../../webgpu/shaderity_shaders/nodes/SplitVector.wgsl.js";import{ComponentType as r}from"../../definitions/ComponentType.js";import{CompositionType as n}from"../../definitions/CompositionType.js";import{ProcessApproach as a}from"../../definitions/ProcessApproach.js";import{AbstractShaderNode as S}from"../core/AbstractShaderNode.js";var _=typeof __RN_WEBGL__=="undefined"||__RN_WEBGL__?l:void 0,T=typeof __RN_WEBGPU__=="undefined"||__RN_WEBGPU__?d:void 0,u=class extends S{constructor(e=r.Float){super("splitVector",{codeGLSL:_.code,codeWGSL:T.code}),this.c_=e,this.uS.push({compositionType:n.Vec4,componentType:e,name:"xyzw"}),this.uS.push({compositionType:n.Vec3,componentType:e,name:"xyz"}),this.uS.push({compositionType:n.Vec2,componentType:e,name:"xy"}),this.yS.push({compositionType:n.Vec3,componentType:e,name:"xyz"}),this.yS.push({compositionType:n.Vec2,componentType:e,name:"xy"}),this.yS.push({compositionType:n.Vec2,componentType:e,name:"zw"}),this.yS.push({compositionType:n.Scalar,componentType:e,name:"x"}),this.yS.push({compositionType:n.Scalar,componentType:e,name:"y"}),this.yS.push({compositionType:n.Scalar,componentType:e,name:"z"}),this.yS.push({compositionType:n.Scalar,componentType:e,name:"w"})}getShaderFunctionNameDerivative(e){if(e.engineState.currentProcessApproach===a.WebGPU){let t="";this.c_===r.Int?t="I32":this.c_===r.UnsignedInt&&(t="U32");for(let o of this.inputConnections)if(o!=null){if(o.inputNameOfThis==="xyzw")return`${this.gS}XYZW${t}`;if(o.inputNameOfThis==="xyz")return`${this.gS}XYZ${t}`;if(o.inputNameOfThis==="xy")return`${this.gS}XY${t}`}throw new Error("Not implemented")}return this.gS}makeCallStatement(e,t,o,y,c,m){let s="";if(c[t].length>0&&m[t].length>0){let h=0;for(let i=0;i<this.inputConnections.length;i++)if(this.inputConnections[i]!=null){h=i;break}let p=[...m[t]];if(e.engineState.currentProcessApproach===a.WebGPU)for(let i=0;i<p.length;i++)p[i]=`&${p[i]}`;s+=`${y}(`;let f=c[t][h];s+=f,s+=`, ${p.join(", ")}`,s+=`);
2
2
  `}return s}};export{u as SplitVectorShaderNode};
@@ -1 +1 @@
1
- import{CompositionType as a}from"../definitions/CompositionType.js";import{Logger as o}from"../misc/Logger.js";import{Matrix33 as V}from"./Matrix33.js";import{Matrix44 as A}from"./Matrix44.js";import{MutableMatrix33 as N}from"./MutableMatrix33.js";import{MutableMatrix44 as C}from"./MutableMatrix44.js";import{MutableQuaternion as z}from"./MutableQuaternion.js";import{MutableScalar as S}from"./MutableScalar.js";import{MutableVector2 as w}from"./MutableVector2.js";import{MutableVector3 as M}from"./MutableVector3.js";import{MutableVector4 as d}from"./MutableVector4.js";import{Quaternion as m}from"./Quaternion.js";import{Scalar as x}from"./Scalar.js";import{Vector2 as t}from"./Vector2.js";import{Vector3 as s}from"./Vector3.js";import{Vector4 as _}from"./Vector4.js";import{VectorN as k}from"./VectorN.js";var E=class{static arrayToVector(r){return Array.isArray(r)?typeof r[3]!="undefined"?_.fromCopyArray([r[0],r[1],r[2],r[3]]):typeof r[2]!="undefined"?s.fromCopyArray([r[0],r[1],r[2]]):t.fromCopyArray2([r[0],r[1]]):r}static arrayToVectorOrMatrix(r){return Array.isArray(r)?typeof r[15]!="undefined"?A.fromCopyArrayRowMajor(r):typeof r[8]!="undefined"?V.fromCopyArrayRowMajor(r):typeof r[3]!="undefined"?_.fromCopyArray([r[0],r[1],r[2],r[3]]):typeof r[2]!="undefined"?s.fromCopyArray([r[0],r[1],r[2]]):t.fromCopyArray2([r[0],r[1]]):r}static getImmutableValueClass(r){if(r===a.Vec2)return t;if(r===a.Vec3)return s;if(r===a.Vec4)return _;if(r===a.Mat3)return V;if(r===a.Mat4)return A}static getMutableValueClass(r){if(r===a.Vec2)return w;if(r===a.Vec3)return M;if(r===a.Vec4)return d;if(r===a.Mat3)return N;if(r===a.Mat4)return C}static cloneOfMathObjects(r){return r instanceof A||r instanceof V||r instanceof _||r instanceof s||r instanceof t?r.clone():r}static isAcceptableArrayForQuaternion(r){return!!(Array.isArray(r)&&typeof r[3]!="undefined")}static arrayToQuaternion(r){return m.fromCopy4(r[0],r[1],r[2],r[3])}static makeSubArray(r,n){return n===4?[r[0],r[1],r[2],r[3]]:n===3?[r[0],r[1],r[2]]:n===2?[r[0],r[1]]:r[0]}static vectorToArray(r){return r instanceof t?[r.x,r.y]:r instanceof s?[r.x,r.y,r.z]:r instanceof _||r instanceof m?[r.x,r.y,r.z,r.w]:r}static componentNumberOfVector(r){return r instanceof t?2:r instanceof s?3:r instanceof _||r instanceof m?4:Array.isArray(r)?r.length:0}static packNormalizedVec4ToVec2(r,n,f,i,u){let c=0,g=0;r=(r+1)/2,n=(n+1)/2,f=(f+1)/2,i=(i+1)/2;let e=Math.floor(r*(u-1)),q=Math.floor(n*(u-1));c=(e*u+q)/u;let Q=Math.floor(f*(u-1)),y=Math.floor(i*(u-1));return g=(Q*u+y)/u,[c,g]}static unProjectTo(r,n,f,i,u,c){let g=this.Ol.setComponents((r-u.x)/u.z*2-1,(n-u.y)/u.w*2-1,2*f-1,1),e=i.multiplyVectorTo(g,this.Ul);return e.w===0?(o.default.error("0 division occurred! The result is left unchanged."),c):M.multiplyTo(e,1/e.w,c)}static add(r,n){if(Number.isFinite(r))return r+n;if(r instanceof t)return t.add(r,n);if(r instanceof s)return s.add(r,n);if(r instanceof _)return _.add(r,n);if(r instanceof m)return m.add(r,n);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=r[i]+n[i];return f}o.default.error("Non supported type!")}static subtract(r,n){if(Number.isFinite(r))return r-n;if(r instanceof t)return t.subtract(r,n);if(r instanceof s)return s.subtract(r,n);if(r instanceof _)return _.subtract(r,n);if(r instanceof m)return m.subtract(r,n);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=r[i]-n[i];return f}o.default.error("Non supported type!")}static multiplyNumber(r,n){if(Number.isFinite(r))return r*n;if(r instanceof t)return t.multiply(r,n);if(r instanceof s)return s.multiply(r,n);if(r instanceof _)return _.multiply(r,n);if(r instanceof m)return m.multiplyNumber(r,n);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=r[i]*n;return f}o.default.error("Non supported type!")}static divideNumber(r,n){if(Number.isFinite(r))return r/n;if(r instanceof t)return t.multiply(r,1/n);if(r instanceof s)return s.multiply(r,1/n);if(r instanceof _)return _.multiply(r,1/n);if(r instanceof m)return m.multiplyNumber(r,1/n);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=r[i]/n;return f}o.default.error("Non supported type!")}static initWithScalar(r,n){if(Number.isFinite(r))return n;if(r instanceof t)return t.fromCopyArray2([n,n]);if(r instanceof s)return s.fromCopyArray([n,n,n]);if(r instanceof _)return _.fromCopyArray([n,n,n,n]);if(r instanceof m)return m.fromCopy4(0,0,0,1);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=n;return f}o.default.error("Non supported type!")}static initWithFloat32Array(r,n){let f;if(Number.isFinite(r)){let i=new Float32Array(n);return n._v=void 0,i[0]=r,new x(i)}if(r instanceof x||r instanceof S)n[0]=r.x,f=new S(n);else if(r instanceof t||r instanceof w)n[0]=r.x,n[1]=r.y,f=new w(n);else if(r instanceof s||r instanceof M)n[0]=r.x,n[1]=r.y,n[2]=r.z,f=M.fromFloat32Array(n);else if(r instanceof _||r instanceof d)n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=r.w,f=new d(n);else if(r instanceof m||r instanceof z)n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=r.w,f=new z(n);else if(r instanceof V||r instanceof N)f=f==null?new N(n):f,f.m00=r.m00,f.m01=r.m01,f.m02=r.m02,f.m10=r.m10,f.m11=r.m11,f.m12=r.m12,f.m20=r.m20,f.m21=r.m21,f.m22=r.m22;else if(r instanceof A||r instanceof C)f=new C(n),f.m00=r.m00,f.m01=r.m01,f.m02=r.m02,f.m03=r.m03,f.m10=r.m10,f.m11=r.m11,f.m12=r.m12,f.m13=r.m13,f.m20=r.m20,f.m21=r.m21,f.m22=r.m22,f.m23=r.m23,f.m30=r.m30,f.m31=r.m31,f.m32=r.m32,f.m33=r.m33;else if(r instanceof k){for(let i=0;i<r._v.length;i++)n[i]=r._v[i];f=new k(n)}else if(r==null){let i;switch(n.length){case 4:i=_.fromCopyFloat32Array(n);break;case 3:i=s.fromCopyFloat32Array(n);break;case 2:i=new t(n);break;case 1:i=new x(n);break}return n._v=void 0,i}else{if(Array.isArray(r)||ArrayBuffer.isView(r)||ArrayBuffer.isView(r._v))return r;o.default.error("Non supported type!");return}return n._v=void 0,f}static _setForce(r,n){if(r instanceof d||r instanceof _){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2],r._v[3]=n._v[3]}else if(r instanceof w||r instanceof t){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1]}else if(r instanceof M||r instanceof s){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2]}else if(r instanceof S||r instanceof x)if(typeof n._v=="undefined"){if(r._v[0]===n)return!1;r._v[0]=n}else{if(r._v[0]===n._v[0])return!1;r._v[0]=n._v[0]}else if(r instanceof N||r instanceof V){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2],r._v[3]=n._v[3],r._v[4]=n._v[4],r._v[5]=n._v[5],r._v[6]=n._v[6],r._v[7]=n._v[7],r._v[8]=n._v[8]}else if(r instanceof C||r instanceof A){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2],r._v[3]=n._v[3],r._v[4]=n._v[4],r._v[5]=n._v[5],r._v[6]=n._v[6],r._v[7]=n._v[7],r._v[8]=n._v[8],r._v[9]=n._v[9],r._v[10]=n._v[10],r._v[11]=n._v[11],r._v[12]=n._v[12],r._v[13]=n._v[13],r._v[14]=n._v[14],r._v[15]=n._v[15]}else if(r instanceof z||r instanceof m){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2],r._v[3]=n._v[3]}else if(r instanceof k){let f;n instanceof k?f=n._v:f=n;let i=!0;for(let u=0;u<r._v.length;u++)if(r._v[u]!==f[u]){i=!1;break}if(i)return!1;for(let u=0;u<r._v.length;u++)r._v[u]=f[u]}else if(Array.isArray(r)){let f=!0;for(let i=0;i<r.length;i++)if(r[i]!==n._v[i]){f=!1;break}if(f)return!1;for(let i=0;i<r.length;i++)r[i]=n._v[i]}else if(Number.isNaN(r._v.length))o.default.warn("Unknown type _setForce");else{let f=!0;for(let i=0;i<r._v.length;i++)if(Array.isArray(n)){if(r._v[i]!==n[i]){f=!1;break}}else if(r._v[i]!==n._v[i]){f=!1;break}if(f)return!1;for(let i=0;i<r._v.length;i++)Array.isArray(n)?r._v[i]=n[i]:r._v[i]=n._v[i]}return!0}};E.Ol=d.zero(),E.Ul=d.zero();export{E as MathClassUtil};
1
+ import{CompositionType as a}from"../definitions/CompositionType.js";import{Logger as o}from"../misc/Logger.js";import{Matrix33 as V}from"./Matrix33.js";import{Matrix44 as A}from"./Matrix44.js";import{MutableMatrix33 as N}from"./MutableMatrix33.js";import{MutableMatrix44 as C}from"./MutableMatrix44.js";import{MutableQuaternion as z}from"./MutableQuaternion.js";import{MutableScalar as S}from"./MutableScalar.js";import{MutableVector2 as w}from"./MutableVector2.js";import{MutableVector3 as M}from"./MutableVector3.js";import{MutableVector4 as d}from"./MutableVector4.js";import{Quaternion as m}from"./Quaternion.js";import{Scalar as x}from"./Scalar.js";import{Vector2 as t}from"./Vector2.js";import{Vector3 as s}from"./Vector3.js";import{Vector4 as _}from"./Vector4.js";import{VectorN as k}from"./VectorN.js";var E=class{static arrayToVector(r){return Array.isArray(r)?typeof r[3]!="undefined"?_.fromCopyArray([r[0],r[1],r[2],r[3]]):typeof r[2]!="undefined"?s.fromCopyArray([r[0],r[1],r[2]]):t.fromCopyArray2([r[0],r[1]]):r}static arrayToVectorOrMatrix(r){return Array.isArray(r)?typeof r[15]!="undefined"?A.fromCopyArrayRowMajor(r):typeof r[8]!="undefined"?V.fromCopyArrayRowMajor(r):typeof r[3]!="undefined"?_.fromCopyArray([r[0],r[1],r[2],r[3]]):typeof r[2]!="undefined"?s.fromCopyArray([r[0],r[1],r[2]]):t.fromCopyArray2([r[0],r[1]]):r}static getImmutableValueClass(r){if(r===a.Vec2)return t;if(r===a.Vec3)return s;if(r===a.Vec4)return _;if(r===a.Mat3)return V;if(r===a.Mat4)return A}static getMutableValueClass(r){if(r===a.Vec2)return w;if(r===a.Vec3)return M;if(r===a.Vec4)return d;if(r===a.Mat3)return N;if(r===a.Mat4)return C}static cloneOfMathObjects(r){return r instanceof A||r instanceof V||r instanceof _||r instanceof s||r instanceof t?r.clone():r}static isAcceptableArrayForQuaternion(r){return!!(Array.isArray(r)&&typeof r[3]!="undefined")}static arrayToQuaternion(r){return m.fromCopy4(r[0],r[1],r[2],r[3])}static makeSubArray(r,n){return n===4?[r[0],r[1],r[2],r[3]]:n===3?[r[0],r[1],r[2]]:n===2?[r[0],r[1]]:r[0]}static vectorToArray(r){return r instanceof t?[r.x,r.y]:r instanceof s?[r.x,r.y,r.z]:r instanceof _||r instanceof m?[r.x,r.y,r.z,r.w]:r}static componentNumberOfVector(r){return r instanceof t?2:r instanceof s?3:r instanceof _||r instanceof m?4:Array.isArray(r)?r.length:0}static packNormalizedVec4ToVec2(r,n,f,i,u){let c=0,g=0;r=(r+1)/2,n=(n+1)/2,f=(f+1)/2,i=(i+1)/2;let e=Math.floor(r*(u-1)),q=Math.floor(n*(u-1));c=(e*u+q)/u;let Q=Math.floor(f*(u-1)),y=Math.floor(i*(u-1));return g=(Q*u+y)/u,[c,g]}static unProjectTo(r,n,f,i,u,c){let g=this.Zl.setComponents((r-u.x)/u.z*2-1,(n-u.y)/u.w*2-1,2*f-1,1),e=i.multiplyVectorTo(g,this.$l);return e.w===0?(o.default.error("0 division occurred! The result is left unchanged."),c):M.multiplyTo(e,1/e.w,c)}static add(r,n){if(Number.isFinite(r))return r+n;if(r instanceof t)return t.add(r,n);if(r instanceof s)return s.add(r,n);if(r instanceof _)return _.add(r,n);if(r instanceof m)return m.add(r,n);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=r[i]+n[i];return f}o.default.error("Non supported type!")}static subtract(r,n){if(Number.isFinite(r))return r-n;if(r instanceof t)return t.subtract(r,n);if(r instanceof s)return s.subtract(r,n);if(r instanceof _)return _.subtract(r,n);if(r instanceof m)return m.subtract(r,n);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=r[i]-n[i];return f}o.default.error("Non supported type!")}static multiplyNumber(r,n){if(Number.isFinite(r))return r*n;if(r instanceof t)return t.multiply(r,n);if(r instanceof s)return s.multiply(r,n);if(r instanceof _)return _.multiply(r,n);if(r instanceof m)return m.multiplyNumber(r,n);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=r[i]*n;return f}o.default.error("Non supported type!")}static divideNumber(r,n){if(Number.isFinite(r))return r/n;if(r instanceof t)return t.multiply(r,1/n);if(r instanceof s)return s.multiply(r,1/n);if(r instanceof _)return _.multiply(r,1/n);if(r instanceof m)return m.multiplyNumber(r,1/n);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=r[i]/n;return f}o.default.error("Non supported type!")}static initWithScalar(r,n){if(Number.isFinite(r))return n;if(r instanceof t)return t.fromCopyArray2([n,n]);if(r instanceof s)return s.fromCopyArray([n,n,n]);if(r instanceof _)return _.fromCopyArray([n,n,n,n]);if(r instanceof m)return m.fromCopy4(0,0,0,1);if(Array.isArray(r)){let f=[];for(let i=0;i<r.length;i++)f[i]=n;return f}o.default.error("Non supported type!")}static initWithFloat32Array(r,n){let f;if(Number.isFinite(r)){let i=new Float32Array(n);return n._v=void 0,i[0]=r,new x(i)}if(r instanceof x||r instanceof S)n[0]=r.x,f=new S(n);else if(r instanceof t||r instanceof w)n[0]=r.x,n[1]=r.y,f=new w(n);else if(r instanceof s||r instanceof M)n[0]=r.x,n[1]=r.y,n[2]=r.z,f=M.fromFloat32Array(n);else if(r instanceof _||r instanceof d)n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=r.w,f=new d(n);else if(r instanceof m||r instanceof z)n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=r.w,f=new z(n);else if(r instanceof V||r instanceof N)f=f==null?new N(n):f,f.m00=r.m00,f.m01=r.m01,f.m02=r.m02,f.m10=r.m10,f.m11=r.m11,f.m12=r.m12,f.m20=r.m20,f.m21=r.m21,f.m22=r.m22;else if(r instanceof A||r instanceof C)f=new C(n),f.m00=r.m00,f.m01=r.m01,f.m02=r.m02,f.m03=r.m03,f.m10=r.m10,f.m11=r.m11,f.m12=r.m12,f.m13=r.m13,f.m20=r.m20,f.m21=r.m21,f.m22=r.m22,f.m23=r.m23,f.m30=r.m30,f.m31=r.m31,f.m32=r.m32,f.m33=r.m33;else if(r instanceof k){for(let i=0;i<r._v.length;i++)n[i]=r._v[i];f=new k(n)}else if(r==null){let i;switch(n.length){case 4:i=_.fromCopyFloat32Array(n);break;case 3:i=s.fromCopyFloat32Array(n);break;case 2:i=new t(n);break;case 1:i=new x(n);break}return n._v=void 0,i}else{if(Array.isArray(r)||ArrayBuffer.isView(r)||ArrayBuffer.isView(r._v))return r;o.default.error("Non supported type!");return}return n._v=void 0,f}static _setForce(r,n){if(r instanceof d||r instanceof _){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2],r._v[3]=n._v[3]}else if(r instanceof w||r instanceof t){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1]}else if(r instanceof M||r instanceof s){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2]}else if(r instanceof S||r instanceof x)if(typeof n._v=="undefined"){if(r._v[0]===n)return!1;r._v[0]=n}else{if(r._v[0]===n._v[0])return!1;r._v[0]=n._v[0]}else if(r instanceof N||r instanceof V){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2],r._v[3]=n._v[3],r._v[4]=n._v[4],r._v[5]=n._v[5],r._v[6]=n._v[6],r._v[7]=n._v[7],r._v[8]=n._v[8]}else if(r instanceof C||r instanceof A){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2],r._v[3]=n._v[3],r._v[4]=n._v[4],r._v[5]=n._v[5],r._v[6]=n._v[6],r._v[7]=n._v[7],r._v[8]=n._v[8],r._v[9]=n._v[9],r._v[10]=n._v[10],r._v[11]=n._v[11],r._v[12]=n._v[12],r._v[13]=n._v[13],r._v[14]=n._v[14],r._v[15]=n._v[15]}else if(r instanceof z||r instanceof m){if(r.isEqual(n))return!1;r._v[0]=n._v[0],r._v[1]=n._v[1],r._v[2]=n._v[2],r._v[3]=n._v[3]}else if(r instanceof k){let f;n instanceof k?f=n._v:f=n;let i=!0;for(let u=0;u<r._v.length;u++)if(r._v[u]!==f[u]){i=!1;break}if(i)return!1;for(let u=0;u<r._v.length;u++)r._v[u]=f[u]}else if(Array.isArray(r)){let f=!0;for(let i=0;i<r.length;i++)if(r[i]!==n._v[i]){f=!1;break}if(f)return!1;for(let i=0;i<r.length;i++)r[i]=n._v[i]}else if(Number.isNaN(r._v.length))o.default.warn("Unknown type _setForce");else{let f=!0;for(let i=0;i<r._v.length;i++)if(Array.isArray(n)){if(r._v[i]!==n[i]){f=!1;break}}else if(r._v[i]!==n._v[i]){f=!1;break}if(f)return!1;for(let i=0;i<r._v.length;i++)Array.isArray(n)?r._v[i]=n[i]:r._v[i]=n._v[i]}return!0}};E.Zl=d.zero(),E.$l=d.zero();export{E as MathClassUtil};
@@ -1,2 +1,2 @@
1
1
  import{CompositionType as R}from"../definitions/CompositionType.js";import{Logger as h}from"../misc/Logger.js";import{AbstractQuaternion as S}from"./AbstractQuaternion.js";import{MathUtil as A}from"./MathUtil.js";import{MutableMatrix44 as E}from"./MutableMatrix44.js";import{MutableVector3 as M}from"./MutableVector3.js";import{Vector3 as m}from"./Vector3.js";var Q=class extends S{constructor(t,r){super(),this._v=t}get className(){return"Quaternion"}static get compositionType(){return R.Vec4}static identity(){return this.fromCopy4(0,0,0,1)}static dummy(){return new this(new this._type(0))}static invert(t){let r=t.length();if(r===0)return this.fromCopy4(0,0,0,0);let n=-t._v[0]/r,e=-t._v[1]/r,i=-t._v[2]/r,a=t._v[3]/r;return this.fromCopy4(n,e,i,a)}static invertTo(t,r){let n=t.length();return n===0?r.setComponents(0,0,0,0):(r._v[0]=-t._v[0]/n,r._v[1]=-t._v[1]/n,r._v[2]=-t._v[2]/n,r._v[3]=t._v[3]/n,r)}static qlerp(t,r,n){let e=t._v[0]*r._v[0]+t._v[1]*r._v[1]+t._v[2]*r._v[2]+t._v[3]*r._v[3];if(1-e*e===0)return t.clone();e>1?e=.999:e<-1&&(e=-.999);let a=Math.acos(e),s=Math.sin(a),o;e<0?(e*=-1,a=Math.acos(e),o=-1*Math.sin(a*n)/s):o=Math.sin(a*n)/s;let c=Math.sin(a*(1-n))/s,v=t._v[0]*c+r._v[0]*o,l=t._v[1]*c+r._v[1]*o,p=t._v[2]*c+r._v[2]*o,u=t._v[3]*c+r._v[3]*o,y=Math.hypot(v,l,p,u);return v=v/y,l=l/y,p=p/y,u=u/y,this.fromCopy4(v,l,p,u)}static qlerpTo(t,r,n,e){let i=t._v[0]*r._v[0]+t._v[1]*r._v[1]+t._v[2]*r._v[2]+t._v[3]*r._v[3];if(1-i*i===0)return e.copyComponents(t);i>1?i=.999:i<-1&&(i=-.999);let s=Math.acos(i),o=Math.sin(s),c;i<0?(i*=-1,s=Math.acos(i),c=-1*Math.sin(s*n)/o):c=Math.sin(s*n)/o;let v=Math.sin(s*(1-n))/o;return e._v[0]=t._v[0]*v+r._v[0]*c,e._v[1]=t._v[1]*v+r._v[1]*c,e._v[2]=t._v[2]*v+r._v[2]*c,e._v[3]=t._v[3]*v+r._v[3]*c,e.normalize()}static lerp(t,r,n){let e=t._v[0]*(1-n)+r._v[0]*n,i=t._v[1]*(1-n)+r._v[1]*n,a=t._v[2]*(1-n)+r._v[2]*n,s=t._v[3]*(1-n)+r._v[3]*n;return this.fromCopy4(e,i,a,s)}static lerpTo(t,r,n,e){return e._v[0]=t._v[0]*(1-n)+r._v[0]*n,e._v[1]=t._v[1]*(1-n)+r._v[1]*n,e._v[2]=t._v[2]*(1-n)+r._v[2]*n,e._v[3]=t._v[3]*(1-n)+r._v[3]*n,e}static tryAxisAngle(t,r){let n=t.length();if(!Number.isFinite(n)||n===0)return null;let e=.5*r,i=Math.sin(e);return this.fromCopy4(i*t._v[0]/n,i*t._v[1]/n,i*t._v[2]/n,Math.cos(e))}static axisAngle(t,r){let n=this.tryAxisAngle(t,r);return n!==null?n:(h.default.error("the rotation axis has zero length. Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1))}static nv(t,r){let n=Math.hypot(t.m00,t.m10,t.m20),e=Math.hypot(t.m01,t.m11,t.m21),i=Math.hypot(t.m02,t.m12,t.m22),a=t.determinant();if(A.isSingularDet(a,n*e*i,A.getSingularEpsilon(this._type.BYTES_PER_ELEMENT)))return!1;let s=a<0?-n:n,o=E.fromCopyMatrix44(t),c=1/s,v=1/e,l=1/i;o.m00*=c,o.m10*=c,o.m20*=c,o.m01*=v,o.m11*=v,o.m21*=v,o.m02*=l,o.m12*=l,o.m22*=l;let p=o.m00+o.m11+o.m22;if(p>0){let u=.5/Math.sqrt(p+1);r[0]=(o.m21-o.m12)*u,r[1]=(o.m02-o.m20)*u,r[2]=(o.m10-o.m01)*u,r[3]=.25/u}else if(o.m00>o.m11&&o.m00>o.m22){let u=Math.sqrt(1+o.m00-o.m11-o.m22)*2;r[0]=.25*u,r[1]=(o.m01+o.m10)/u,r[2]=(o.m02+o.m20)/u,r[3]=(o.m21-o.m12)/u}else if(o.m11>o.m22){let u=Math.sqrt(1+o.m11-o.m00-o.m22)*2;r[0]=(o.m01+o.m10)/u,r[1]=.25*u,r[2]=(o.m12+o.m21)/u,r[3]=(o.m02-o.m20)/u}else{let u=Math.sqrt(1+o.m22-o.m00-o.m11)*2;r[0]=(o.m02+o.m20)/u,r[1]=(o.m12+o.m21)/u,r[2]=.25*u,r[3]=(o.m10-o.m01)/u}return!0}static tryFromMatrix(t){let r=new this._type(4);return this.nv(t,r)?this.fromCopy4(r[0],r[1],r[2],r[3]):null}static fromMatrix(t){let r=this.tryFromMatrix(t);return r!==null?r:(h.default.error("the rotation cannot be extracted from the matrix (it is singular or contains non-finite values). Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1))}static tryFromMatrixTo(t,r){return this.nv(t,r._v)}static fromMatrixTo(t,r){return this.tryFromMatrixTo(t,r)||(h.default.error("the rotation cannot be extracted from the matrix (it is singular or contains non-finite values). Returning an identity quaternion instead."),r._v[0]=0,r._v[1]=0,r._v[2]=0,r._v[3]=1),r}static lookFromTo(t,r){return t.isEqual(r)?this.fromCopy4(0,0,0,1):this.qlerp(this.lookForward(t),this.lookForward(r),1)}static tryLookForward(t){return this.tv==null&&(this.tv=new t.constructor(0,1,0)),this.tryLookForwardAccordingToThisUp(t,this.tv)}static lookForward(t){let r=this.tryLookForward(t);return r!==null?r:(h.default.error("the forward direction has zero length. Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1))}static tryLookForwardAccordingToThisUp(t,r){let n=t.length(),e=r.length();if(!Number.isFinite(n)||!Number.isFinite(e)||n===0||e===0)return null;let i=t._v[0]/n,a=t._v[1]/n,s=t._v[2]/n,o=r._v[0]/e,c=r._v[1]/e,v=r._v[2]/e,l=r._v[1]*t._v[2]-r._v[2]*t._v[1],p=r._v[2]*t._v[0]-r._v[0]*t._v[2],u=r._v[0]*t._v[1]-r._v[1]*t._v[0],y=Math.hypot(l,p,u);if(!Number.isFinite(y)||y===0)return null;l/=y,p/=y,u/=y;let f=l,g=p,x=u,C=o,d=c,z=v,V=i,F=a,T=s,L=f+d+T;if(L>0){let b=Math.sqrt(L+1),I=.5/b;return this.fromCopy4((z-F)*I,(V-x)*I,(g-C)*I,b*.5)}if(f>=d&&f>=T){let b=Math.sqrt(1+f-d-T),I=.5/b;return this.fromCopy4(.5*b,(g+C)*I,(x+V)*I,(z-F)*I)}if(d>T){let b=Math.sqrt(1+d-f-T),I=.5/b;return this.fromCopy4((C+g)*I,.5*b,(F+z)*I,(V-x)*I)}let k=Math.sqrt(1+T-f-d),w=.5/k;return this.fromCopy4((V+x)*w,(F+z)*w,.5*k,(g-C)*w)}static lookForwardAccordingToThisUp(t,r){let n=this.tryLookForwardAccordingToThisUp(t,r);return n!==null?n:(h.default.error("the forward/up directions are degenerate (zero length or parallel). Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1))}static fromPosition(t){return this.fromCopy4(t._v[0],t._v[1],t._v[2],0)}static add(t,r){let n=t._v[0]+r._v[0],e=t._v[1]+r._v[1],i=t._v[2]+r._v[2],a=t._v[3]+r._v[3];return this.fromCopy4(n,e,i,a)}static addTo(t,r,n){return n._v[0]=t._v[0]+r._v[0],n._v[1]=t._v[1]+r._v[1],n._v[2]=t._v[2]+r._v[2],n._v[3]=t._v[3]+r._v[3],n}static subtract(t,r){let n=t._v[0]-r._v[0],e=t._v[1]-r._v[1],i=t._v[2]-r._v[2],a=t._v[3]-r._v[3];return this.fromCopy4(n,e,i,a)}static subtractTo(t,r,n){return n._v[0]=t._v[0]-r._v[0],n._v[1]=t._v[1]-r._v[1],n._v[2]=t._v[2]-r._v[2],n._v[3]=t._v[3]-r._v[3],n}static multiply(t,r){let n=r._v[3]*t._v[0]+r._v[2]*t._v[1]-r._v[1]*t._v[2]+r._v[0]*t._v[3],e=-r._v[2]*t._v[0]+r._v[3]*t._v[1]+r._v[0]*t._v[2]+r._v[1]*t._v[3],i=r._v[1]*t._v[0]-r._v[0]*t._v[1]+r._v[3]*t._v[2]+r._v[2]*t._v[3],a=-r._v[0]*t._v[0]-r._v[1]*t._v[1]-r._v[2]*t._v[2]+r._v[3]*t._v[3];return this.fromCopy4(n,e,i,a)}static multiplyTo(t,r,n){let e=r._v[3]*t._v[0]+r._v[2]*t._v[1]-r._v[1]*t._v[2]+r._v[0]*t._v[3],i=-r._v[2]*t._v[0]+r._v[3]*t._v[1]+r._v[0]*t._v[2]+r._v[1]*t._v[3],a=r._v[1]*t._v[0]-r._v[0]*t._v[1]+r._v[3]*t._v[2]+r._v[2]*t._v[3],s=-r._v[0]*t._v[0]-r._v[1]*t._v[1]-r._v[2]*t._v[2]+r._v[3]*t._v[3];return n.setComponents(e,i,a,s)}static multiplyNumber(t,r){let n=t._v[0]*r,e=t._v[1]*r,i=t._v[2]*r,a=t._v[3]*r;return this.fromCopy4(n,e,i,a)}static multiplyNumberTo(t,r,n){return n._v[0]=t._v[0]*r,n._v[1]=t._v[1]*r,n._v[2]=t._v[2]*r,n._v[3]=t._v[3]*r,n}static divideNumber(t,r){return r===0?(h.default.error("0 division occurred! The result is set to zero."),this.fromCopy4(0,0,0,0)):this.fromCopy4(t._v[0]/r,t._v[1]/r,t._v[2]/r,t._v[3]/r)}static divideNumberTo(t,r,n){return r===0?(h.default.error("0 division occurred! The result is set to zero."),n._v[0]=0,n._v[1]=0,n._v[2]=0,n._v[3]=0,n):(n._v[0]=t._v[0]/r,n._v[1]=t._v[1]/r,n._v[2]=t._v[2]/r,n._v[3]=t._v[3]/r,n)}toString(){return`(${this._v[0]}, ${this._v[1]}, ${this._v[2]}, ${this._v[3]})`}toStringApproximately(){return`${A.financial(this._v[0])} ${A.financial(this._v[1])} ${A.financial(this._v[2])} ${A.financial(this._v[3])}
2
- `}flattenAsArray(){return[this._v[0],this._v[1],this._v[2],this._v[3]]}isDummy(){return this._v.length===0}isEqual(t,r=Number.EPSILON){return Math.abs(t._v[0]-this._v[0])<r&&Math.abs(t._v[1]-this._v[1])<r&&Math.abs(t._v[2]-this._v[2])<r&&Math.abs(t._v[3]-this._v[3])<r}isStrictEqual(t){return this._v[0]===t._v[0]&&this._v[1]===t._v[1]&&this._v[2]===t._v[2]&&this._v[3]===t._v[3]}toEulerAnglesTo(t){let r=2*(this._v[3]*this._v[0]+this._v[1]*this._v[2]),n=1-2*(this._v[0]*this._v[0]+this._v[1]*this._v[1]);t._v[0]=Math.atan2(r,n);let e=2*(this._v[3]*this._v[1]-this._v[2]*this._v[0]);e=Math.min(e,1),e=Math.max(e,-1),t._v[1]=Math.asin(e);let i=2*(this._v[3]*this._v[2]+this._v[0]*this._v[1]),a=1-2*(this._v[1]*this._v[1]+this._v[2]*this._v[2]);return t._v[2]=Math.atan2(i,a),t}toEulerAngles(){let t=new m(new Float32Array(3)),r=2*(this._v[3]*this._v[0]+this._v[1]*this._v[2]),n=1-2*(this._v[0]*this._v[0]+this._v[1]*this._v[1]);t._v[0]=Math.atan2(r,n);let e=2*(this._v[3]*this._v[1]-this._v[2]*this._v[0]);e=Math.min(e,1),e=Math.max(e,-1),t._v[1]=Math.asin(e);let i=2*(this._v[3]*this._v[2]+this._v[0]*this._v[1]),a=1-2*(this._v[1]*this._v[1]+this._v[2]*this._v[2]);return t._v[2]=Math.atan2(i,a),t}static _divide(t,r){let n,e,i,a;return r!==0?(n=t._v[0]/r,e=t._v[1]/r,i=t._v[2]/r,a=t._v[3]/r):(h.default.error("0 division occurred! The result is set to zero."),n=0,e=0,i=0,a=0),this.fromCopy4(n,e,i,a)}static _divideTo(t,r,n){let e,i,a,s;return r!==0?(e=t._v[0]/r,i=t._v[1]/r,a=t._v[2]/r,s=t._v[3]/r):(h.default.error("0 division occurred! The result is set to zero."),e=0,i=0,a=0,s=0),n._v[0]=e,n._v[1]=i,n._v[2]=a,n._v[3]=s,n}static normalize(t){let r=t.length();return r===0?(h.default.error("cannot normalize a zero-length quaternion. Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1)):this._divide(t,r)}static normalizeTo(t,r){let n=t.length();return n===0?(h.default.error("cannot normalize a zero-length quaternion. The output is set to the identity quaternion."),r._v[0]=0,r._v[1]=0,r._v[2]=0,r._v[3]=1,r):this._divideTo(t,n,r)}fromToRotation(t,r){let n=M.fromCopyVector3(t),e=M.fromCopyVector3(r);n.normalize(),e.normalize();let i=n.dot(e);if(i>-1+Number.EPSILON){let o=Math.sqrt((1+i)*2),c=1/o,v=m.multiply(n.cross(e),c);return this._v[0]=v.x,this._v[1]=v.y,this._v[2]=v.z,this._v[3]=o*.5,this.constructor.normalize(this)}let a=m.fromCopy3(0,1,0),s=n.cross(a);return s.length()<Number.EPSILON&&(a=m.fromCopy3(1,0,0),s=n.cross(a)),s.normalize(),this.constructor.fromAxisAngle(s,Math.PI)}static fromToRotation(t,r){let n=m.dot(t,r)+1;if(n<Number.EPSILON){if(n=0,Math.abs(t.x)>Math.abs(t.z)){let a=this.fromCopy4(-t.y,t.x,0,n);return this.normalize(a)}let i=this.fromCopy4(0,-t.z,t.y,n);return this.normalize(i)}let e=this.fromCopy4(t.y*r.z-t.z*r.y,t.z*r.x-t.x*r.z,t.x*r.y-t.y*r.x,n);return this.normalize(e)}static fromToRotationTo(t,r,n){let e=m.dot(t,r)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(n._v[0]=-t.y,n._v[1]=t.x,n._v[2]=0,n._v[3]=e,n.normalize(),n):(n._v[0]=0,n._v[1]=-t.z,n._v[2]=t.y,n._v[3]=e,n.normalize(),n)):(n._v[0]=t.y*r.z-t.z*r.y,n._v[1]=t.z*r.x-t.x*r.z,n._v[2]=t.x*r.y-t.y*r.x,n._v[3]=e,n.normalize(),n)}transformVector3(t){let r=_.rv;r.setComponents(this._v[0],this._v[1],this._v[2]);let n=m.cross(r,t),e=m.cross(r,n),i=m.multiply(n,this._v[3]),a=m.add(e,i),s=m.multiply(a,2);return m.add(t,s)}transformVector3To(t,r){let n=_.rv;n.setComponents(this._v[0],this._v[1],this._v[2]);let e=m.crossTo(n,t,_.Or),i=m.crossTo(n,e,_.Nr),a=m.multiplyTo(e,this._v[3],_.Xr),s=m.addTo(i,a,_.ev),o=m.multiplyTo(s,2,_.ov);return m.addTo(t,o,r)}transformVector3Inverse(t){return this.constructor.invert(this).transformVector3(t)}clone(){return this.constructor.fromCopy4(this._v[0],this._v[1],this._v[2],this._v[3])}static fromTypedArray(t){return new this(t)}static fromCopyArray4(t){return new this(new this._type(t))}static fromCopyArray(t){return new this(new this._type(t.slice(0,4)))}static fromCopy4(t,r,n,e){return new this(new this._type([t,r,n,e]))}static fromCopyQuaternion(t){let r=new this._type(4);return r[0]=t._v[0],r[1]=t._v[1],r[2]=t._v[2],r[3]=t._v[3],new this(r)}static fromCopyVector4(t){let r=new this._type(4);return r[0]=t._v[0],r[1]=t._v[1],r[2]=t._v[2],r[3]=t._v[3],new this(r)}static fromCopyLogQuaternion(t){let r=Math.hypot(t._v[0],t._v[1],t._v[2]),n=new this._type(4);if(r===0)return n[0]=0,n[1]=0,n[2]=0,n[3]=1,new this(n);let e=Math.sin(r);return n[0]=t._v[0]*(e/r),n[1]=t._v[1]*(e/r),n[2]=t._v[2]*(e/r),n[3]=Math.cos(r),new this(n)}static fromAxisAngle(t,r){r=r*.5;let n=Math.sin(r);return this.fromCopy4(n*t.x,n*t.y,n*t.z,Math.cos(r))}static fromAxisAngleTo(t,r,n){r=r*.5;let e=Math.sin(r);return n._v[0]=e*t.x,n._v[1]=e*t.y,n._v[2]=e*t.z,n._v[3]=Math.cos(r),n}static getQuaternionAngle(t){let r=Math.max(-1,Math.min(1,t.w));return 2*Math.acos(r)}static clampRotation(t,r){let n=this.getQuaternionAngle(t);if(n<=r)return t;let e=r/n,i=this.fromCopy4(0,0,0,1);return this.qlerp(i,t,e)}};Q._type=Float32Array,Q.tv=void 0,Q.Or=M.zero(),Q.Nr=M.zero(),Q.Xr=M.zero(),Q.ev=M.zero(),Q.ov=M.zero(),Q.rv=M.zero();var _=class extends Q{constructor(t){super(t,{type:Float32Array})}static identity(){return super.identity()}static dummy(){return super.dummy()}static invert(t){return super.invert(t)}static invertTo(t,r){return super.invertTo(t,r)}static qlerp(t,r,n){return super.qlerp(t,r,n)}static qlerpTo(t,r,n,e){return super.qlerpTo(t,r,n,e)}static lerp(t,r,n){return super.lerp(t,r,n)}static lerpTo(t,r,n,e){return super.lerpTo(t,r,n,e)}static tryAxisAngle(t,r){return super.tryAxisAngle(t,r)}static axisAngle(t,r){return super.axisAngle(t,r)}static tryFromMatrix(t){return super.tryFromMatrix(t)}static fromMatrix(t){return super.fromMatrix(t)}static tryFromMatrixTo(t,r){return super.tryFromMatrixTo(t,r)}static fromMatrixTo(t,r){return super.fromMatrixTo(t,r)}static lookFromTo(t,r){return super.lookFromTo(t,r)}static tryLookForward(t){return super.tryLookForward(t)}static lookForward(t){return super.lookForward(t)}static tryLookForwardAccordingToThisUp(t,r){return super.tryLookForwardAccordingToThisUp(t,r)}static lookForwardAccordingToThisUp(t,r){return super.lookForwardAccordingToThisUp(t,r)}static fromPosition(t){return super.fromPosition(t)}static add(t,r){return super.add(t,r)}static addTo(t,r,n){return super.addTo(t,r,n)}static subtract(t,r){return super.subtract(t,r)}static subtractTo(t,r,n){return super.subtractTo(t,r,n)}static multiply(t,r){return super.multiply(t,r)}static multiplyTo(t,r,n){return super.multiplyTo(t,r,n)}static multiplyNumber(t,r){return super.multiplyNumber(t,r)}static multiplyNumberTo(t,r,n){return super.multiplyNumberTo(t,r,n)}static divideNumber(t,r){return super.divideNumber(t,r)}static divideNumberTo(t,r,n){return super.divideNumberTo(t,r,n)}static normalize(t){return super.normalize(t)}static normalizeTo(t,r){return super.normalizeTo(t,r)}static fromToRotation(t,r){return super.fromToRotation(t,r)}static fromToRotationTo(t,r,n){return super.fromToRotationTo(t,r,n)}static fromFloat32Array(t){return super.fromTypedArray(t)}static fromCopyArray4(t){return super.fromCopyArray4(t)}static fromCopyArray(t){return super.fromCopyArray(t)}static fromCopy4(t,r,n,e){return super.fromCopy4(t,r,n,e)}static fromCopyQuaternion(t){return super.fromCopyQuaternion(t)}static fromCopyVector4(t){return super.fromCopyVector4(t)}static fromCopyLogQuaternion(t){return super.fromCopyLogQuaternion(t)}static fromAxisAngle(t,r){return super.fromAxisAngle(t,r)}static fromAxisAngleTo(t,r,n){return super.fromAxisAngleTo(t,r,n)}static getQuaternionAngle(t){return super.getQuaternionAngle(t)}static clampRotation(t,r){return super.clampRotation(t,r)}},D=class extends Q{constructor(t){super(t,{type:Float64Array})}static identity(){return super.identity()}static dummy(){return super.dummy()}static invert(t){return super.invert(t)}static invertTo(t,r){return super.invertTo(t,r)}static qlerp(t,r,n){return super.qlerp(t,r,n)}static qlerpTo(t,r,n,e){return super.qlerpTo(t,r,n,e)}static lerp(t,r,n){return super.lerp(t,r,n)}static lerpTo(t,r,n,e){return super.lerpTo(t,r,n,e)}static tryAxisAngle(t,r){return super.tryAxisAngle(t,r)}static axisAngle(t,r){return super.axisAngle(t,r)}static tryFromMatrix(t){return super.tryFromMatrix(t)}static fromMatrix(t){return super.fromMatrix(t)}static tryFromMatrixTo(t,r){return super.tryFromMatrixTo(t,r)}static fromMatrixTo(t,r){return super.fromMatrixTo(t,r)}static lookFromTo(t,r){return super.lookFromTo(t,r)}static tryLookForward(t){return super.tryLookForward(t)}static lookForward(t){return super.lookForward(t)}static tryLookForwardAccordingToThisUp(t,r){return super.tryLookForwardAccordingToThisUp(t,r)}static lookForwardAccordingToThisUp(t,r){return super.lookForwardAccordingToThisUp(t,r)}static fromPosition(t){return super.fromPosition(t)}static add(t,r){return super.add(t,r)}static addTo(t,r,n){return super.addTo(t,r,n)}static subtract(t,r){return super.subtract(t,r)}static subtractTo(t,r,n){return super.subtractTo(t,r,n)}static multiply(t,r){return super.multiply(t,r)}static multiplyTo(t,r,n){return super.multiplyTo(t,r,n)}static multiplyNumber(t,r){return super.multiplyNumber(t,r)}static multiplyNumberTo(t,r,n){return super.multiplyNumberTo(t,r,n)}static divideNumber(t,r){return super.divideNumber(t,r)}static divideNumberTo(t,r,n){return super.divideNumberTo(t,r,n)}static normalize(t){return super.normalize(t)}static normalizeTo(t,r){return super.normalizeTo(t,r)}static fromToRotation(t,r){return super.fromToRotation(t,r)}static fromToRotationTo(t,r,n){return super.fromToRotationTo(t,r,n)}static fromFloat64Array(t){return super.fromTypedArray(t)}static fromCopyArray4(t){return super.fromCopyArray4(t)}static fromCopyArray(t){return super.fromCopyArray(t)}static fromCopy4(t,r,n,e){return super.fromCopy4(t,r,n,e)}static fromCopyQuaternion(t){return super.fromCopyQuaternion(t)}static fromCopyVector4(t){return super.fromCopyVector4(t)}static fromCopyLogQuaternion(t){return super.fromCopyLogQuaternion(t)}static fromAxisAngle(t,r){return super.fromAxisAngle(t,r)}static fromAxisAngleTo(t,r,n){return super.fromAxisAngleTo(t,r,n)}static getQuaternionAngle(t){return super.getQuaternionAngle(t)}static clampRotation(t,r){return super.clampRotation(t,r)}};D._type=Float64Array;export{_ as Quaternion,D as QuaternionD,_ as QuaternionF,Q as Quaternion_};
2
+ `}flattenAsArray(){return[this._v[0],this._v[1],this._v[2],this._v[3]]}isDummy(){return this._v.length===0}isEqual(t,r=Number.EPSILON){return Math.abs(t._v[0]-this._v[0])<r&&Math.abs(t._v[1]-this._v[1])<r&&Math.abs(t._v[2]-this._v[2])<r&&Math.abs(t._v[3]-this._v[3])<r}isStrictEqual(t){return this._v[0]===t._v[0]&&this._v[1]===t._v[1]&&this._v[2]===t._v[2]&&this._v[3]===t._v[3]}toEulerAnglesTo(t){let r=2*(this._v[3]*this._v[0]+this._v[1]*this._v[2]),n=1-2*(this._v[0]*this._v[0]+this._v[1]*this._v[1]);t._v[0]=Math.atan2(r,n);let e=2*(this._v[3]*this._v[1]-this._v[2]*this._v[0]);e=Math.min(e,1),e=Math.max(e,-1),t._v[1]=Math.asin(e);let i=2*(this._v[3]*this._v[2]+this._v[0]*this._v[1]),a=1-2*(this._v[1]*this._v[1]+this._v[2]*this._v[2]);return t._v[2]=Math.atan2(i,a),t}toEulerAngles(){let t=new m(new Float32Array(3)),r=2*(this._v[3]*this._v[0]+this._v[1]*this._v[2]),n=1-2*(this._v[0]*this._v[0]+this._v[1]*this._v[1]);t._v[0]=Math.atan2(r,n);let e=2*(this._v[3]*this._v[1]-this._v[2]*this._v[0]);e=Math.min(e,1),e=Math.max(e,-1),t._v[1]=Math.asin(e);let i=2*(this._v[3]*this._v[2]+this._v[0]*this._v[1]),a=1-2*(this._v[1]*this._v[1]+this._v[2]*this._v[2]);return t._v[2]=Math.atan2(i,a),t}static _divide(t,r){let n,e,i,a;return r!==0?(n=t._v[0]/r,e=t._v[1]/r,i=t._v[2]/r,a=t._v[3]/r):(h.default.error("0 division occurred! The result is set to zero."),n=0,e=0,i=0,a=0),this.fromCopy4(n,e,i,a)}static _divideTo(t,r,n){let e,i,a,s;return r!==0?(e=t._v[0]/r,i=t._v[1]/r,a=t._v[2]/r,s=t._v[3]/r):(h.default.error("0 division occurred! The result is set to zero."),e=0,i=0,a=0,s=0),n._v[0]=e,n._v[1]=i,n._v[2]=a,n._v[3]=s,n}static normalize(t){let r=t.length();return r===0?(h.default.error("cannot normalize a zero-length quaternion. Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1)):this._divide(t,r)}static normalizeTo(t,r){let n=t.length();return n===0?(h.default.error("cannot normalize a zero-length quaternion. The output is set to the identity quaternion."),r._v[0]=0,r._v[1]=0,r._v[2]=0,r._v[3]=1,r):this._divideTo(t,n,r)}fromToRotation(t,r){let n=M.fromCopyVector3(t),e=M.fromCopyVector3(r);n.normalize(),e.normalize();let i=n.dot(e);if(i>-1+Number.EPSILON){let o=Math.sqrt((1+i)*2),c=1/o,v=m.multiply(n.cross(e),c);return this._v[0]=v.x,this._v[1]=v.y,this._v[2]=v.z,this._v[3]=o*.5,this.constructor.normalize(this)}let a=m.fromCopy3(0,1,0),s=n.cross(a);return s.length()<Number.EPSILON&&(a=m.fromCopy3(1,0,0),s=n.cross(a)),s.normalize(),this.constructor.fromAxisAngle(s,Math.PI)}static fromToRotation(t,r){let n=m.dot(t,r)+1;if(n<Number.EPSILON){if(n=0,Math.abs(t.x)>Math.abs(t.z)){let a=this.fromCopy4(-t.y,t.x,0,n);return this.normalize(a)}let i=this.fromCopy4(0,-t.z,t.y,n);return this.normalize(i)}let e=this.fromCopy4(t.y*r.z-t.z*r.y,t.z*r.x-t.x*r.z,t.x*r.y-t.y*r.x,n);return this.normalize(e)}static fromToRotationTo(t,r,n){let e=m.dot(t,r)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(n._v[0]=-t.y,n._v[1]=t.x,n._v[2]=0,n._v[3]=e,n.normalize(),n):(n._v[0]=0,n._v[1]=-t.z,n._v[2]=t.y,n._v[3]=e,n.normalize(),n)):(n._v[0]=t.y*r.z-t.z*r.y,n._v[1]=t.z*r.x-t.x*r.z,n._v[2]=t.x*r.y-t.y*r.x,n._v[3]=e,n.normalize(),n)}transformVector3(t){let r=_.rv;r.setComponents(this._v[0],this._v[1],this._v[2]);let n=m.cross(r,t),e=m.cross(r,n),i=m.multiply(n,this._v[3]),a=m.add(e,i),s=m.multiply(a,2);return m.add(t,s)}transformVector3To(t,r){let n=_.rv;n.setComponents(this._v[0],this._v[1],this._v[2]);let e=m.crossTo(n,t,_.Yr),i=m.crossTo(n,e,_.Zr),a=m.multiplyTo(e,this._v[3],_._r),s=m.addTo(i,a,_.ev),o=m.multiplyTo(s,2,_.ov);return m.addTo(t,o,r)}transformVector3Inverse(t){return this.constructor.invert(this).transformVector3(t)}clone(){return this.constructor.fromCopy4(this._v[0],this._v[1],this._v[2],this._v[3])}static fromTypedArray(t){return new this(t)}static fromCopyArray4(t){return new this(new this._type(t))}static fromCopyArray(t){return new this(new this._type(t.slice(0,4)))}static fromCopy4(t,r,n,e){return new this(new this._type([t,r,n,e]))}static fromCopyQuaternion(t){let r=new this._type(4);return r[0]=t._v[0],r[1]=t._v[1],r[2]=t._v[2],r[3]=t._v[3],new this(r)}static fromCopyVector4(t){let r=new this._type(4);return r[0]=t._v[0],r[1]=t._v[1],r[2]=t._v[2],r[3]=t._v[3],new this(r)}static fromCopyLogQuaternion(t){let r=Math.hypot(t._v[0],t._v[1],t._v[2]),n=new this._type(4);if(r===0)return n[0]=0,n[1]=0,n[2]=0,n[3]=1,new this(n);let e=Math.sin(r);return n[0]=t._v[0]*(e/r),n[1]=t._v[1]*(e/r),n[2]=t._v[2]*(e/r),n[3]=Math.cos(r),new this(n)}static fromAxisAngle(t,r){r=r*.5;let n=Math.sin(r);return this.fromCopy4(n*t.x,n*t.y,n*t.z,Math.cos(r))}static fromAxisAngleTo(t,r,n){r=r*.5;let e=Math.sin(r);return n._v[0]=e*t.x,n._v[1]=e*t.y,n._v[2]=e*t.z,n._v[3]=Math.cos(r),n}static getQuaternionAngle(t){let r=Math.max(-1,Math.min(1,t.w));return 2*Math.acos(r)}static clampRotation(t,r){let n=this.getQuaternionAngle(t);if(n<=r)return t;let e=r/n,i=this.fromCopy4(0,0,0,1);return this.qlerp(i,t,e)}};Q._type=Float32Array,Q.tv=void 0,Q.Yr=M.zero(),Q.Zr=M.zero(),Q._r=M.zero(),Q.ev=M.zero(),Q.ov=M.zero(),Q.rv=M.zero();var _=class extends Q{constructor(t){super(t,{type:Float32Array})}static identity(){return super.identity()}static dummy(){return super.dummy()}static invert(t){return super.invert(t)}static invertTo(t,r){return super.invertTo(t,r)}static qlerp(t,r,n){return super.qlerp(t,r,n)}static qlerpTo(t,r,n,e){return super.qlerpTo(t,r,n,e)}static lerp(t,r,n){return super.lerp(t,r,n)}static lerpTo(t,r,n,e){return super.lerpTo(t,r,n,e)}static tryAxisAngle(t,r){return super.tryAxisAngle(t,r)}static axisAngle(t,r){return super.axisAngle(t,r)}static tryFromMatrix(t){return super.tryFromMatrix(t)}static fromMatrix(t){return super.fromMatrix(t)}static tryFromMatrixTo(t,r){return super.tryFromMatrixTo(t,r)}static fromMatrixTo(t,r){return super.fromMatrixTo(t,r)}static lookFromTo(t,r){return super.lookFromTo(t,r)}static tryLookForward(t){return super.tryLookForward(t)}static lookForward(t){return super.lookForward(t)}static tryLookForwardAccordingToThisUp(t,r){return super.tryLookForwardAccordingToThisUp(t,r)}static lookForwardAccordingToThisUp(t,r){return super.lookForwardAccordingToThisUp(t,r)}static fromPosition(t){return super.fromPosition(t)}static add(t,r){return super.add(t,r)}static addTo(t,r,n){return super.addTo(t,r,n)}static subtract(t,r){return super.subtract(t,r)}static subtractTo(t,r,n){return super.subtractTo(t,r,n)}static multiply(t,r){return super.multiply(t,r)}static multiplyTo(t,r,n){return super.multiplyTo(t,r,n)}static multiplyNumber(t,r){return super.multiplyNumber(t,r)}static multiplyNumberTo(t,r,n){return super.multiplyNumberTo(t,r,n)}static divideNumber(t,r){return super.divideNumber(t,r)}static divideNumberTo(t,r,n){return super.divideNumberTo(t,r,n)}static normalize(t){return super.normalize(t)}static normalizeTo(t,r){return super.normalizeTo(t,r)}static fromToRotation(t,r){return super.fromToRotation(t,r)}static fromToRotationTo(t,r,n){return super.fromToRotationTo(t,r,n)}static fromFloat32Array(t){return super.fromTypedArray(t)}static fromCopyArray4(t){return super.fromCopyArray4(t)}static fromCopyArray(t){return super.fromCopyArray(t)}static fromCopy4(t,r,n,e){return super.fromCopy4(t,r,n,e)}static fromCopyQuaternion(t){return super.fromCopyQuaternion(t)}static fromCopyVector4(t){return super.fromCopyVector4(t)}static fromCopyLogQuaternion(t){return super.fromCopyLogQuaternion(t)}static fromAxisAngle(t,r){return super.fromAxisAngle(t,r)}static fromAxisAngleTo(t,r,n){return super.fromAxisAngleTo(t,r,n)}static getQuaternionAngle(t){return super.getQuaternionAngle(t)}static clampRotation(t,r){return super.clampRotation(t,r)}},D=class extends Q{constructor(t){super(t,{type:Float64Array})}static identity(){return super.identity()}static dummy(){return super.dummy()}static invert(t){return super.invert(t)}static invertTo(t,r){return super.invertTo(t,r)}static qlerp(t,r,n){return super.qlerp(t,r,n)}static qlerpTo(t,r,n,e){return super.qlerpTo(t,r,n,e)}static lerp(t,r,n){return super.lerp(t,r,n)}static lerpTo(t,r,n,e){return super.lerpTo(t,r,n,e)}static tryAxisAngle(t,r){return super.tryAxisAngle(t,r)}static axisAngle(t,r){return super.axisAngle(t,r)}static tryFromMatrix(t){return super.tryFromMatrix(t)}static fromMatrix(t){return super.fromMatrix(t)}static tryFromMatrixTo(t,r){return super.tryFromMatrixTo(t,r)}static fromMatrixTo(t,r){return super.fromMatrixTo(t,r)}static lookFromTo(t,r){return super.lookFromTo(t,r)}static tryLookForward(t){return super.tryLookForward(t)}static lookForward(t){return super.lookForward(t)}static tryLookForwardAccordingToThisUp(t,r){return super.tryLookForwardAccordingToThisUp(t,r)}static lookForwardAccordingToThisUp(t,r){return super.lookForwardAccordingToThisUp(t,r)}static fromPosition(t){return super.fromPosition(t)}static add(t,r){return super.add(t,r)}static addTo(t,r,n){return super.addTo(t,r,n)}static subtract(t,r){return super.subtract(t,r)}static subtractTo(t,r,n){return super.subtractTo(t,r,n)}static multiply(t,r){return super.multiply(t,r)}static multiplyTo(t,r,n){return super.multiplyTo(t,r,n)}static multiplyNumber(t,r){return super.multiplyNumber(t,r)}static multiplyNumberTo(t,r,n){return super.multiplyNumberTo(t,r,n)}static divideNumber(t,r){return super.divideNumber(t,r)}static divideNumberTo(t,r,n){return super.divideNumberTo(t,r,n)}static normalize(t){return super.normalize(t)}static normalizeTo(t,r){return super.normalizeTo(t,r)}static fromToRotation(t,r){return super.fromToRotation(t,r)}static fromToRotationTo(t,r,n){return super.fromToRotationTo(t,r,n)}static fromFloat64Array(t){return super.fromTypedArray(t)}static fromCopyArray4(t){return super.fromCopyArray4(t)}static fromCopyArray(t){return super.fromCopyArray(t)}static fromCopy4(t,r,n,e){return super.fromCopy4(t,r,n,e)}static fromCopyQuaternion(t){return super.fromCopyQuaternion(t)}static fromCopyVector4(t){return super.fromCopyVector4(t)}static fromCopyLogQuaternion(t){return super.fromCopyLogQuaternion(t)}static fromAxisAngle(t,r){return super.fromAxisAngle(t,r)}static fromAxisAngleTo(t,r,n){return super.fromAxisAngleTo(t,r,n)}static getQuaternionAngle(t){return super.getQuaternionAngle(t)}static clampRotation(t,r){return super.clampRotation(t,r)}};D._type=Float64Array;export{_ as Quaternion,D as QuaternionD,_ as QuaternionF,Q as Quaternion_};
@@ -1 +1 @@
1
- import{Matrix44 as I}from"./Matrix44.js";import{MutableMatrix44 as _}from"./MutableMatrix44.js";import{MutableQuaternion as l}from"./MutableQuaternion.js";import{MutableVector3 as h}from"./MutableVector3.js";import{Quaternion as q}from"./Quaternion.js";import{Vector3 as x}from"./Vector3.js";var i=class i{constructor(t){this.rt=0;this.hv=_.identity();this.lv=!1;this.uv=new Float64Array(3);this.pv=new Float64Array(4);this.mv=new Float64Array(3);this.sv=h.dummy(),this.av=h.dummy(),this.iv=l.dummy(),t!==void 0?this.setTransform(t.positionInner,t.scaleInner,l.fromCopyQuaternion(t.rotationInner)):(this.sv=h.zero(),this.av=h.one(),this.iv=l.identity())}isEqual(t,o=Number.EPSILON){return this.positionInner.isEqual(t.positionInner,o)&&this.rotationInner.isEqual(t.rotationInner,o)&&this.scaleInner.isEqual(t.scaleInner,o)}clone(){return new i(this)}set position(t){this.sv.copyComponents(t),this.cv("position")}setPositionAsArray3(t){this.sv._v[0]=t[0],this.sv._v[1]=t[1],this.sv._v[2]=t[2],this.cv("position")}get position(){return this.positionInner.clone()}get positionInner(){return this.sv}set eulerAngles(t){let o=Math.sin(t._v[0]*.5),s=Math.cos(t._v[0]*.5),r=Math.sin(t._v[1]*.5),e=Math.cos(t._v[1]*.5),c=Math.sin(t._v[2]*.5),a=Math.cos(t._v[2]*.5);this.rotation=l.fromCopy4(o*e*a-s*r*c,s*r*a+o*e*c,s*e*c-o*r*a,s*e*a+o*r*c)}get eulerAngles(){return this.eulerAnglesInner.clone()}get eulerAnglesInner(){return this.iv.toEulerAngles()}set scale(t){this.av.copyComponents(t),this.cv()}setScaleAsArray3(t){this.av._v[0]=t[0],this.av._v[1]=t[1],this.av._v[2]=t[2],this.cv()}get scale(){return this.scaleInner.clone()}get scaleInner(){return this.av}set rotation(t){this.iv.copyComponents(t),this.cv()}setRotationAsArray4(t){this.iv._v[0]=t[0],this.iv._v[1]=t[1],this.iv._v[2]=t[2],this.iv._v[3]=t[3],this.cv()}get rotation(){return this.rotationInner.clone()}get rotationInner(){return this.iv}cv(t="all"){if(this.rt++,t==="position"&&this.lv){let o=this.hv._v;o[12]=this.sv._v[0],o[13]=this.sv._v[1],o[14]=this.sv._v[2],this.uv.set(this.sv._v)}else this.lv=!1}set matrix(t){this.iv.fromMatrix(t),t.getTranslateTo(this.sv),t.getScaleTo(this.av),this.cv()}get matrix(){return this.matrixInner}get matrixInner(){return this.vv(),this.hv.clone()}yv(){let t=this.scaleInner,o=t._v[0],s=t._v[1],r=t._v[2],e=this.rotationInner,c=e._v[0]*e._v[0],a=e._v[1]*e._v[1],n=e._v[2]*e._v[2],p=e._v[1]*e._v[2],m=e._v[0]*e._v[2],v=e._v[0]*e._v[1],y=e._v[3]*e._v[0],M=e._v[3]*e._v[1],f=e._v[3]*e._v[2],A=1-2*(a+n),g=2*(v-f),V=2*(m+M),z=2*(v+f),C=1-2*(c+n),Q=2*(p-y),d=2*(m-M),w=2*(p+y),T=1-2*(c+a),u=this.positionInner;this.hv.setComponents(A*o,g*s,V*r,u.x,z*o,C*s,Q*r,u.y,d*o,w*s,T*r,u.z,0,0,0,1),this.uv.set(this.sv._v),this.pv.set(this.iv._v),this.mv.set(this.av._v)}vv(){if(!this.lv){this.yv(),this.lv=!0;return}let t=this.sv._v,o=this.iv._v,s=this.av._v,r=this.uv,e=this.pv,c=this.mv,a=!1;for(let n=0;n<4;n++)if(o[n]!==e[n]){a=!0;break}if(!a){for(let n=0;n<3;n++)if(s[n]!==c[n]){a=!0;break}}if(a){this.yv();return}if(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]){let n=this.hv._v;n[12]=t[0],n[13]=t[1],n[14]=t[2],r[0]=t[0],r[1]=t[1],r[2]=t[2]}}getMatrixInnerTo(t){this.vv(),t.copyComponents(this.hv)}get updateCount(){return this.rt}set rotateMatrix44(t){this.rotation=i.Dl.fromMatrix(t)}get rotateMatrix44(){return I.fromCopyQuaternion(this.rotation)}setPropertiesFromJson(t){let o=t;typeof t=="string"&&(o=JSON.parse(t));for(let s in o)Object.hasOwn(o,s)&&s in this&&(s==="quaternion"?this.rotation=q.fromCopyArray4(o[s]):s==="matrix"?this[s]=I.fromCopyArray16RowMajor(o[s]):this[s]=x.fromCopyArray(o[s]))}setRotationFromNewUpAndFront(t,o){let s=t,r=h.crossTo(s,o,i.Ze),e=h.crossTo(r,s,i.He),c=i.je.setComponents(r.x,s.x,e.x,0,r.y,s.y,e.y,0,r.z,s.z,e.z,0,0,0,0,1);this.rotateMatrix44=c}headToDirection(t,o){let s=i.Ze.copyComponents(t).normalize(),r=i.He.copyComponents(o).normalize(),e=h.crossTo(s,r,i.Xe),c=x.dot(s,r),a=Math.acos(c);this.rotation=i.Dl.axisAngle(e,a)}setTransform(t,o,s){this.sv=t.clone(),this.iv=s.clone(),this.av=o.clone(),this.cv()}};i.je=_.zero(),i.Ze=h.zero(),i.He=h.zero(),i.Xe=h.zero(),i.Dl=l.identity();var b=i;export{b as Transform3D};
1
+ import{Matrix44 as I}from"./Matrix44.js";import{MutableMatrix44 as _}from"./MutableMatrix44.js";import{MutableQuaternion as l}from"./MutableQuaternion.js";import{MutableVector3 as h}from"./MutableVector3.js";import{Quaternion as q}from"./Quaternion.js";import{Vector3 as x}from"./Vector3.js";var i=class i{constructor(t){this.rt=0;this.hv=_.identity();this.lv=!1;this.uv=new Float64Array(3);this.pv=new Float64Array(4);this.mv=new Float64Array(3);this.sv=h.dummy(),this.av=h.dummy(),this.iv=l.dummy(),t!==void 0?this.setTransform(t.positionInner,t.scaleInner,l.fromCopyQuaternion(t.rotationInner)):(this.sv=h.zero(),this.av=h.one(),this.iv=l.identity())}isEqual(t,o=Number.EPSILON){return this.positionInner.isEqual(t.positionInner,o)&&this.rotationInner.isEqual(t.rotationInner,o)&&this.scaleInner.isEqual(t.scaleInner,o)}clone(){return new i(this)}set position(t){this.sv.copyComponents(t),this.cv("position")}setPositionAsArray3(t){this.sv._v[0]=t[0],this.sv._v[1]=t[1],this.sv._v[2]=t[2],this.cv("position")}get position(){return this.positionInner.clone()}get positionInner(){return this.sv}set eulerAngles(t){let o=Math.sin(t._v[0]*.5),s=Math.cos(t._v[0]*.5),r=Math.sin(t._v[1]*.5),e=Math.cos(t._v[1]*.5),c=Math.sin(t._v[2]*.5),a=Math.cos(t._v[2]*.5);this.rotation=l.fromCopy4(o*e*a-s*r*c,s*r*a+o*e*c,s*e*c-o*r*a,s*e*a+o*r*c)}get eulerAngles(){return this.eulerAnglesInner.clone()}get eulerAnglesInner(){return this.iv.toEulerAngles()}set scale(t){this.av.copyComponents(t),this.cv()}setScaleAsArray3(t){this.av._v[0]=t[0],this.av._v[1]=t[1],this.av._v[2]=t[2],this.cv()}get scale(){return this.scaleInner.clone()}get scaleInner(){return this.av}set rotation(t){this.iv.copyComponents(t),this.cv()}setRotationAsArray4(t){this.iv._v[0]=t[0],this.iv._v[1]=t[1],this.iv._v[2]=t[2],this.iv._v[3]=t[3],this.cv()}get rotation(){return this.rotationInner.clone()}get rotationInner(){return this.iv}cv(t="all"){if(this.rt++,t==="position"&&this.lv){let o=this.hv._v;o[12]=this.sv._v[0],o[13]=this.sv._v[1],o[14]=this.sv._v[2],this.uv.set(this.sv._v)}else this.lv=!1}set matrix(t){this.iv.fromMatrix(t),t.getTranslateTo(this.sv),t.getScaleTo(this.av),this.cv()}get matrix(){return this.matrixInner}get matrixInner(){return this.vv(),this.hv.clone()}yv(){let t=this.scaleInner,o=t._v[0],s=t._v[1],r=t._v[2],e=this.rotationInner,c=e._v[0]*e._v[0],a=e._v[1]*e._v[1],n=e._v[2]*e._v[2],p=e._v[1]*e._v[2],m=e._v[0]*e._v[2],v=e._v[0]*e._v[1],y=e._v[3]*e._v[0],M=e._v[3]*e._v[1],f=e._v[3]*e._v[2],A=1-2*(a+n),g=2*(v-f),V=2*(m+M),z=2*(v+f),C=1-2*(c+n),Q=2*(p-y),d=2*(m-M),w=2*(p+y),T=1-2*(c+a),u=this.positionInner;this.hv.setComponents(A*o,g*s,V*r,u.x,z*o,C*s,Q*r,u.y,d*o,w*s,T*r,u.z,0,0,0,1),this.uv.set(this.sv._v),this.pv.set(this.iv._v),this.mv.set(this.av._v)}vv(){if(!this.lv){this.yv(),this.lv=!0;return}let t=this.sv._v,o=this.iv._v,s=this.av._v,r=this.uv,e=this.pv,c=this.mv,a=!1;for(let n=0;n<4;n++)if(o[n]!==e[n]){a=!0;break}if(!a){for(let n=0;n<3;n++)if(s[n]!==c[n]){a=!0;break}}if(a){this.yv();return}if(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]){let n=this.hv._v;n[12]=t[0],n[13]=t[1],n[14]=t[2],r[0]=t[0],r[1]=t[1],r[2]=t[2]}}getMatrixInnerTo(t){this.vv(),t.copyComponents(this.hv)}get updateCount(){return this.rt}set rotateMatrix44(t){this.rotation=i.Ql.fromMatrix(t)}get rotateMatrix44(){return I.fromCopyQuaternion(this.rotation)}setPropertiesFromJson(t){let o=t;typeof t=="string"&&(o=JSON.parse(t));for(let s in o)Object.hasOwn(o,s)&&s in this&&(s==="quaternion"?this.rotation=q.fromCopyArray4(o[s]):s==="matrix"?this[s]=I.fromCopyArray16RowMajor(o[s]):this[s]=x.fromCopyArray(o[s]))}setRotationFromNewUpAndFront(t,o){let s=t,r=h.crossTo(s,o,i.tr),e=h.crossTo(r,s,i.Ze),c=i.Ge.setComponents(r.x,s.x,e.x,0,r.y,s.y,e.y,0,r.z,s.z,e.z,0,0,0,0,1);this.rotateMatrix44=c}headToDirection(t,o){let s=i.tr.copyComponents(t).normalize(),r=i.Ze.copyComponents(o).normalize(),e=h.crossTo(s,r,i.$e),c=x.dot(s,r),a=Math.acos(c);this.rotation=i.Ql.axisAngle(e,a)}setTransform(t,o,s){this.sv=t.clone(),this.iv=s.clone(),this.av=o.clone(),this.cv()}};i.Ge=_.zero(),i.tr=h.zero(),i.Ze=h.zero(),i.$e=h.zero(),i.Ql=l.identity();var b=i;export{b as Transform3D};
@@ -1 +1 @@
1
- import{Vector3_ as a}from"../Vector3.js";var t=class{constructor(r,o){this.sv=r,this.by=o,this.sv.bytesPerComponent===4?this.Ye=Float32Array:this.Ye=Float64Array}get position(){return this.sv}get radius(){return this.by}calcCollision(r,o){let e=a._subtract(r,this.sv,this.Ye),s=a.dot(e,o),i=a.dot(e,e)-this.by*this.by;return!(i>0&&s>0||s*s-i<0)}},n=class extends t{},l=class extends t{};export{n as MathSphere,l as MathSphereD,t as MathSphere_};
1
+ import{Vector3_ as a}from"../Vector3.js";var t=class{constructor(r,o){this.sv=r,this.by=o,this.sv.bytesPerComponent===4?this.Qe=Float32Array:this.Qe=Float64Array}get position(){return this.sv}get radius(){return this.by}calcCollision(r,o){let e=a._subtract(r,this.sv,this.Qe),s=a.dot(e,o),i=a.dot(e,e)-this.by*this.by;return!(i>0&&s>0||s*s-i<0)}},n=class extends t{},l=class extends t{};export{n as MathSphere,l as MathSphereD,t as MathSphere_};