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,12 +1,12 @@
1
- import{ComponentType as o}from"../definitions/ComponentType.js";import{CompositionType as g}from"../definitions/CompositionType.js";import{Matrix33 as z}from"../math/Matrix33.js";import{MutableMatrix44 as w}from"../math/MutableMatrix44.js";import{MutableVector2 as L}from"../math/MutableVector2.js";import{MutableVector3 as X}from"../math/MutableVector3.js";import{MutableVector4 as O}from"../math/MutableVector4.js";import{Vector2 as M}from"../math/Vector2.js";import{Vector3 as N}from"../math/Vector3.js";import{Vector4 as T}from"../math/Vector4.js";import{Is as C}from"../misc/Is.js";import{Logger as V}from"../misc/Logger.js";var a=class a{constructor({bufferView:s,byteOffsetInBufferView:e,compositionType:h,componentType:t,byteStride:i,count:r,raw:c,max:u,min:y,arrayLength:_,normalized:A}){this.o_=g.Unknown;this.s_=o.Unknown;this.pb=0;this._b=new Float32Array;this.gb=0;this.hb=0;this.ny=O.fromCopyArray([-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]);this.sy=O.fromCopyArray([Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE]);this.Vb=1;this.Ib=!1;this.cb=!0;this.vb=0;var I,B,S,f,n,m,x,E;this.Ab=s,this.bb=s.byteOffsetInRawArrayBufferOfBuffer+e,this.o_=h,this.s_=t,this.pb=r,this.Vb=_,C.exist(u)&&this.ny.setComponents((I=u[0])!=null?I:-Number.MAX_VALUE,(B=u[1])!=null?B:-Number.MAX_VALUE,(S=u[2])!=null?S:-Number.MAX_VALUE,(f=u[3])!=null?f:-Number.MAX_VALUE),C.exist(y)&&this.sy.setComponents((n=y[0])!=null?n:Number.MAX_VALUE,(m=y[1])!=null?m:Number.MAX_VALUE,(x=y[2])!=null?x:Number.MAX_VALUE,(E=y[3])!=null?E:Number.MAX_VALUE),C.exist(u)&&C.exist(y)&&(this.cb=!1),this.Fp=c,this.Ib=A,this.hb=i,this.hb===0&&(this.hb=this.o_.getNumberOfComponents()*this.s_.getSizeInBytes()*this.Vb);let p=this.getTypedArrayClass(this.s_);this.Sb=p;let b=this.hb-this.o_.getNumberOfComponents()*this.s_.getSizeInBytes(),l=this.Fp.byteLength-this.bb,v=this.byteStride*this.pb-b;l<v&&V.default.error(`Requesting a data size that exceeds the remaining capacity of the buffer: ${this.bufferView.buffer.name}.
1
+ import{ComponentType as o}from"../definitions/ComponentType.js";import{CompositionType as g}from"../definitions/CompositionType.js";import{Matrix33 as z}from"../math/Matrix33.js";import{MutableMatrix44 as w}from"../math/MutableMatrix44.js";import{MutableVector2 as L}from"../math/MutableVector2.js";import{MutableVector3 as X}from"../math/MutableVector3.js";import{MutableVector4 as O}from"../math/MutableVector4.js";import{Vector2 as M}from"../math/Vector2.js";import{Vector3 as N}from"../math/Vector3.js";import{Vector4 as T}from"../math/Vector4.js";import{Is as C}from"../misc/Is.js";import{Logger as V}from"../misc/Logger.js";var a=class a{constructor({bufferView:s,byteOffsetInBufferView:e,compositionType:h,componentType:t,byteStride:i,count:r,raw:c,max:u,min:y,arrayLength:_,normalized:A}){this.p_=g.Unknown;this.c_=o.Unknown;this.Ab=0;this.Ob=new Float32Array;this.Ib=0;this.hb=0;this.ny=O.fromCopyArray([-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]);this.sy=O.fromCopyArray([Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE]);this.Bb=1;this.Tb=!1;this.Vb=!0;this.Nb=0;var I,B,S,f,n,m,x,E;this.Cb=s,this._b=s.byteOffsetInRawArrayBufferOfBuffer+e,this.p_=h,this.c_=t,this.Ab=r,this.Bb=_,C.exist(u)&&this.ny.setComponents((I=u[0])!=null?I:-Number.MAX_VALUE,(B=u[1])!=null?B:-Number.MAX_VALUE,(S=u[2])!=null?S:-Number.MAX_VALUE,(f=u[3])!=null?f:-Number.MAX_VALUE),C.exist(y)&&this.sy.setComponents((n=y[0])!=null?n:Number.MAX_VALUE,(m=y[1])!=null?m:Number.MAX_VALUE,(x=y[2])!=null?x:Number.MAX_VALUE,(E=y[3])!=null?E:Number.MAX_VALUE),C.exist(u)&&C.exist(y)&&(this.Vb=!1),this.Fp=c,this.Tb=A,this.hb=i,this.hb===0&&(this.hb=this.p_.getNumberOfComponents()*this.c_.getSizeInBytes()*this.Bb);let p=this.getTypedArrayClass(this.c_);this.Mb=p;let b=this.hb-this.p_.getNumberOfComponents()*this.c_.getSizeInBytes(),l=this.Fp.byteLength-this._b,v=this.byteStride*this.Ab-b;l<v&&V.default.error(`Requesting a data size that exceeds the remaining capacity of the buffer: ${this.bufferView.buffer.name}.
2
2
  Exceeded Size: ${v-l}
3
3
  this.__raw.byteLength: ${this.Fp.byteLength}
4
4
  this.__byteOffsetInRawArrayBufferOfBuffer: ${this.byteOffsetInRawArrayBufferOfBuffer}
5
5
  this.byteStride: ${this.byteStride}
6
- this.__count: ${this.pb}
7
- this.__raw.byteLength - this.__byteOffsetInRawArrayBufferOfBuffer: ${this.Fp.byteLength-this.bb}
8
- this.byteStride * this.__count: ${this.byteStride*this.pb}
6
+ this.__count: ${this.Ab}
7
+ this.__raw.byteLength - this.__byteOffsetInRawArrayBufferOfBuffer: ${this.Fp.byteLength-this._b}
8
+ this.byteStride * this.__count: ${this.byteStride*this.Ab}
9
9
  maxExceededSizeOnAoS: ${b}
10
- `),this.lb=new DataView(this.Fp,this.bb,Math.min(this.hb*this.pb,this.Fp.byteLength-this.bb)),this.bb%p.BYTES_PER_ELEMENT===0?this._b=new p(this.Fp,this.bb,this.o_.getNumberOfComponents()*this.pb):(V.default.warn(`This Accessor's byteOffsetInRawArrayBufferOfBuffer is not aligned with the typedArrayClass's BYTES_PER_ELEMENT. So we need to copy the buffer.
10
+ `),this.vb=new DataView(this.Fp,this._b,Math.min(this.hb*this.Ab,this.Fp.byteLength-this._b)),this._b%p.BYTES_PER_ELEMENT===0?this.Ob=new p(this.Fp,this._b,this.p_.getNumberOfComponents()*this.Ab):(V.default.warn(`This Accessor's byteOffsetInRawArrayBufferOfBuffer is not aligned with the typedArrayClass's BYTES_PER_ELEMENT. So we need to copy the buffer.
11
11
  So the typedArray data got by getTypedArray() is copied data, not reference to the original buffer.
12
- `),this.Bb()),this.ub=this.lb[this.getDataViewGetter(this.s_)].bind(this.lb),this.fb=this.lb[this.getDataViewSetter(this.s_)].bind(this.lb)}Bb(){let s=this.getTypedArrayClass(this.s_),e=this.Fp.slice(this.bb,this.bb+this.o_.getNumberOfComponents()*this.pb*s.BYTES_PER_ELEMENT);this._b=new s(e)}yb(){var s;this.vb++,this._primitive!=null&&((s=this._primitive.deref())==null||s.onAccessorUpdated(this.vb))}getTypedArrayClass(s){switch(s){case o.Byte:return Int8Array;case o.UnsignedByte:return Uint8Array;case o.Short:return Int16Array;case o.UnsignedShort:return Uint16Array;case o.Int:return Int32Array;case o.UnsignedInt:return Uint32Array;case o.Float:return Float32Array;case o.Double:return Float64Array;default:V.default.error("Unexpected ComponentType!");return}}getDataViewGetter(s){switch(s){case o.Byte:return"getInt8";case o.UnsignedByte:return"getUint8";case o.Short:return"getInt16";case o.UnsignedShort:return"getUint16";case o.Int:return"getInt32";case o.UnsignedInt:return"getUint32";case o.Float:return"getFloat32";case o.Double:return"getFloat64";default:return V.default.error("Unexpected ComponentType!"),"unknown"}}getDataViewSetter(s){switch(s){case o.Byte:return"setInt8";case o.UnsignedByte:return"setUint8";case o.Short:return"setInt16";case o.UnsignedShort:return"setUint16";case o.Int:return"setInt32";case o.UnsignedInt:return"setUint32";case o.Float:return"setFloat32";case o.Double:return"setFloat64";default:V.default.error("Unexpected ComponentType!")}}takeOne(){let s=this.Fp;this.gb>=this.pb&&V.default.error("You are trying to allocate more than you have secured.");let e=new this.Sb(s,this.bb+this.hb*this.gb,this.o_.getNumberOfComponents()*this.Vb);return e._accessor=this,e._idx_of_accessor=this.gb,this.gb+=1,e}_takeExistedOne(s){let e=this.Fp;s>=this.pb&&V.default.error("You are trying to allocate more than you have secured.");let h=new this.Sb(e,this.bb+this.hb*s,this.o_.getNumberOfComponents()*this.Vb);return h._accessor=this,h._idx_of_accessor=s,h}get takenCount(){return this.gb}get numberOfComponents(){return this.o_.getNumberOfComponents()}get componentSizeInBytes(){return this.s_.getSizeInBytes()}get elementSizeInBytes(){return this.numberOfComponents*this.componentSizeInBytes}get elementCount(){return this.pb}get byteLength(){return this.hb*this.pb}get componentType(){return this.s_}get compositionType(){return this.o_}getTypedArray(){return this._b}setTypedArray(s){if(s.buffer!==this.Fp){if(this.o_===g.Scalar)for(let e=0;e<this.pb;e++)this.setScalar(e,s[e],{endian:!0});else if(this.o_===g.Vec2)for(let e=0;e<this.pb;e++)this.setVec2(e,s[e*2],s[e*2+1],{endian:!0});else if(this.o_===g.Vec3)for(let e=0;e<this.pb;e++)this.setVec3(e,s[e*3],s[e*3+1],s[e*3+2],{endian:!0});else if(this.o_===g.Vec4)for(let e=0;e<this.pb;e++)this.setVec4(e,s[e*4],s[e*4+1],s[e*4+2],s[e*4+3],{endian:!0});else if(this.o_===g.Mat3)for(let e=0;e<this.pb;e++)this.setMat3(e,s[e*9],s[e*9+1],s[e*9+2],s[e*9+3],s[e*9+4],s[e*9+5],s[e*9+6],s[e*9+7],s[e*9+8],{endian:!0});else if(this.o_===g.Mat4)for(let e=0;e<this.pb;e++)this.setMat4(e,s[e*16],s[e*16+1],s[e*16+2],s[e*16+3],s[e*16+4],s[e*16+5],s[e*16+6],s[e*16+7],s[e*16+8],s[e*16+9],s[e*16+10],s[e*16+11],s[e*16+12],s[e*16+13],s[e*16+14],s[e*16+15],{endian:!0});else throw new Error("Unexpected CompositionType!");this.Bb()}}getUint8Array(){return new Uint8Array(this.bufferView.buffer.getArrayBuffer(),this.byteOffsetInRawArrayBufferOfBuffer,this.byteLength)}get isAoS(){return!this.isSoA}get isSoA(){return this.byteStride===this.o_.getNumberOfComponents()*this.s_.getSizeInBytes()}get byteStride(){return this.hb}getScalar(s,{indicesAccessor:e,endian:h=!0}){let t=s;return e&&(t=e.getScalar(s,{})),this.ub(this.hb*t,h)}getScalarAt(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;return h&&(i=h.getScalar(s,{})),this.ub(this.hb*i+e,t)}getVec2AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h)]}getVec3AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h)]}getVec4AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h)]}getMat3AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h),this.ub(this.hb*t+4*i,h),this.ub(this.hb*t+5*i,h),this.ub(this.hb*t+6*i,h),this.ub(this.hb*t+7*i,h),this.ub(this.hb*t+8*i,h)]}getMat4AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h),this.ub(this.hb*t+4*i,h),this.ub(this.hb*t+5*i,h),this.ub(this.hb*t+6*i,h),this.ub(this.hb*t+7*i,h),this.ub(this.hb*t+8*i,h),this.ub(this.hb*t+9*i,h),this.ub(this.hb*t+10*i,h),this.ub(this.hb*t+11*i,h),this.ub(this.hb*t+12*i,h),this.ub(this.hb*t+13*i,h),this.ub(this.hb*t+14*i,h),this.ub(this.hb*t+15*i,h)]}getVec2(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return M.fromCopyArray2([this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h)])}getVec3(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return N.fromCopyArray([this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h)])}getVec4(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return T.fromCopyArray([this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h)])}getMat3(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return z.fromCopy9RowMajor(this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h),this.ub(this.hb*t+4*i,h),this.ub(this.hb*t+5*i,h),this.ub(this.hb*t+6*i,h),this.ub(this.hb*t+7*i,h),this.ub(this.hb*t+8*i,h))}getMat4(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return w.fromCopy16RowMajor(this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h),this.ub(this.hb*t+4*i,h),this.ub(this.hb*t+5*i,h),this.ub(this.hb*t+6*i,h),this.ub(this.hb*t+7*i,h),this.ub(this.hb*t+8*i,h),this.ub(this.hb*t+9*i,h),this.ub(this.hb*t+10*i,h),this.ub(this.hb*t+11*i,h),this.ub(this.hb*t+12*i,h),this.ub(this.hb*t+13*i,h),this.ub(this.hb*t+14*i,h),this.ub(this.hb*t+15*i,h))}getVec2To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t))}getVec3To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t),this.ub(this.hb*i+2*r,t))}getVec4To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t),this.ub(this.hb*i+2*r,t),this.ub(this.hb*i+3*r,t))}getMat3To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t),this.ub(this.hb*i+2*r,t),this.ub(this.hb*i+3*r,t),this.ub(this.hb*i+4*r,t),this.ub(this.hb*i+5*r,t),this.ub(this.hb*i+6*r,t),this.ub(this.hb*i+7*r,t),this.ub(this.hb*i+8*r,t))}getMat4To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t),this.ub(this.hb*i+2*r,t),this.ub(this.hb*i+3*r,t),this.ub(this.hb*i+4*r,t),this.ub(this.hb*i+5*r,t),this.ub(this.hb*i+6*r,t),this.ub(this.hb*i+7*r,t),this.ub(this.hb*i+8*r,t),this.ub(this.hb*i+9*r,t),this.ub(this.hb*i+10*r,t),this.ub(this.hb*i+11*r,t),this.ub(this.hb*i+12*r,t),this.ub(this.hb*i+13*r,t),this.ub(this.hb*i+14*r,t),this.ub(this.hb*i+15*r,t))}setScalar(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{})),this.fb(this.hb*i,e,t),this.cb=!0,this.yb()}setVec2(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{}));let c=this.componentSizeInBytes;this.fb(this.hb*r,e,i),this.fb(this.hb*r+1*c,h,i),this.cb=!0,this.yb()}setVec3(s,e,h,t,{indicesAccessor:i,endian:r=!0}){let c=s;i&&(c=i.getScalar(s,{}));let u=this.componentSizeInBytes;this.fb(this.hb*c,e,r),this.fb(this.hb*c+1*u,h,r),this.fb(this.hb*c+2*u,t,r),this.cb=!0,this.yb()}setVec4(s,e,h,t,i,{indicesAccessor:r,endian:c=!0}){let u=s;r&&(u=r.getScalar(s,{}));let y=this.componentSizeInBytes;this.fb(this.hb*u,e,c),this.fb(this.hb*u+1*y,h,c),this.fb(this.hb*u+2*y,t,c),this.fb(this.hb*u+3*y,i,c),this.cb=!0,this.yb()}setMat3(s,e,h,t,i,r,c,u,y,_,{indicesAccessor:A,endian:p=!0}){let b=s;A&&(b=A.getScalar(s,{}));let l=this.componentSizeInBytes;this.fb(this.hb*b,e,p),this.fb(this.hb*b+1*l,h,p),this.fb(this.hb*b+2*l,t,p),this.fb(this.hb*b+3*l,i,p),this.fb(this.hb*b+4*l,r,p),this.fb(this.hb*b+5*l,c,p),this.fb(this.hb*b+6*l,u,p),this.fb(this.hb*b+7*l,y,p),this.fb(this.hb*b+8*l,_,p),this.cb=!0,this.yb()}setMat4(s,e,h,t,i,r,c,u,y,_,A,p,b,l,v,I,B,{indicesAccessor:S,endian:f=!0}){let n=s;S&&(n=S.getScalar(s,{}));let m=this.componentSizeInBytes;this.fb(this.hb*n,e,f),this.fb(this.hb*n+1*m,h,f),this.fb(this.hb*n+2*m,t,f),this.fb(this.hb*n+3*m,i,f),this.fb(this.hb*n+4*m,r,f),this.fb(this.hb*n+5*m,c,f),this.fb(this.hb*n+6*m,u,f),this.fb(this.hb*n+7*m,y,f),this.fb(this.hb*n+8*m,_,f),this.fb(this.hb*n+9*m,A,f),this.fb(this.hb*n+10*m,p,f),this.fb(this.hb*n+11*m,b,f),this.fb(this.hb*n+12*m,l,f),this.fb(this.hb*n+13*m,v,f),this.fb(this.hb*n+14*m,I,f),this.fb(this.hb*n+15*m,B,f),this.cb=!0,this.yb()}setVec2AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.fb(this.hb*i,e.x,t),this.fb(this.hb*i+1*r,e.y,t),this.cb=!0,this.yb()}setVec3AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.fb(this.hb*i,e.x,t),this.fb(this.hb*i+1*r,e.y,t),this.fb(this.hb*i+2*r,e.z,t),this.cb=!0,this.yb()}setVec4AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.fb(this.hb*i,e.x,t),this.fb(this.hb*i+1*r,e.y,t),this.fb(this.hb*i+2*r,e.z,t),this.fb(this.hb*i+3*r,e.w,t),this.cb=!0,this.yb()}setMat4AsMatrix44(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.fb(this.hb*i,e._v[0],t),this.fb(this.hb*i+1*r,e._v[1],t),this.fb(this.hb*i+2*r,e._v[2],t),this.fb(this.hb*i+3*r,e._v[3],t),this.fb(this.hb*i+4*r,e._v[4],t),this.fb(this.hb*i+5*r,e._v[5],t),this.fb(this.hb*i+6*r,e._v[6],t),this.fb(this.hb*i+7*r,e._v[7],t),this.fb(this.hb*i+8*r,e._v[8],t),this.fb(this.hb*i+9*r,e._v[9],t),this.fb(this.hb*i+10*r,e._v[10],t),this.fb(this.hb*i+11*r,e._v[11],t),this.fb(this.hb*i+12*r,e._v[12],t),this.fb(this.hb*i+13*r,e._v[13],t),this.fb(this.hb*i+14*r,e._v[14],t),this.fb(this.hb*i+15*r,e._v[15],t),this.cb=!0,this.yb()}copyFromTypedArray(s){let e=this.numberOfComponents;for(let h=0;h<s.byteLength/this.componentSizeInBytes;h++){let t=Math.floor(h/e),i=t*e;switch(e){case 1:this.setScalar(t,s[i+0],{});break;case 2:this.setVec2(t,s[i+0],s[i+1],{});break;case 3:this.setVec3(t,s[i+0],s[i+1],s[i+2],{});break;case 4:this.setVec4(t,s[i+0],s[i+1],s[i+2],s[i+3],{});break;default:throw new Error("Other than vectors are currently not supported.")}}this.cb=!0,this.yb()}setScalarAt(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{})),this.fb(this.hb*r+e,h,i),this.cb=!0,this.yb()}setElementFromSameCompositionAccessor(s,e,h){let t=h!=null?h:s;this.compositionType.getNumberOfComponents()===1?this.setScalar(s,e.getScalar(t,{}),{}):this.compositionType.getNumberOfComponents()===2?this.setVec2AsVector(s,e.getVec2(t,{}),{}):this.compositionType.getNumberOfComponents()===3?this.setVec3AsVector(s,e.getVec3(t,{}),{}):this.compositionType.getNumberOfComponents()===4&&this.setVec4AsVector(s,e.getVec4(t,{}),{}),this.cb=!0,this.yb()}copyBuffer(s){new Uint8Array(this.Fp).set(new Uint8Array(s.Fp,s.bb,s.byteLength),this.bb),this.cb=!0,this.yb()}setElementFromAccessor(s,e,h){let t=h!=null?h:s;if(this.compositionType.getNumberOfComponents()===1)e.compositionType.getNumberOfComponents()===1?this.setScalar(s,e.getScalar(t,{}),{}):e.compositionType.getNumberOfComponents()===2?this.setScalar(s,e.getVec2(t,{}).x,{}):e.compositionType.getNumberOfComponents()===3?this.setScalar(s,e.getVec3(t,{}).x,{}):e.compositionType.getNumberOfComponents()===4&&this.setScalar(s,e.getVec4(t,{}).x,{});else if(this.compositionType.getNumberOfComponents()===2){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec2(s,i,0,{})}else if(e.compositionType.getNumberOfComponents()===2)this.setVec2AsVector(s,e.getVec2(t,{}),{});else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec2(s,i.x,i.y,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec2(s,i.x,i.y,{})}}else if(this.compositionType.getNumberOfComponents()===3){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec3(s,i,0,0,{})}else if(e.compositionType.getNumberOfComponents()===2){let i=e.getVec2(t,{});this.setVec3(s,i.x,i.y,0,{})}else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec3AsVector(s,i,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec3(s,i.x,i.y,i.z,{})}}else if(this.compositionType.getNumberOfComponents()===4){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec4(s,i,0,0,0,{})}else if(e.compositionType.getNumberOfComponents()===2){let i=e.getVec2(t,{});this.setVec4(s,i.x,i.y,0,0,{})}else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec4(s,i.x,i.y,i.z,0,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec4AsVector(s,i,{})}}this.cb=!0,this.yb()}addElementFromSameCompositionAccessor(s,e,h,t){let i=t!=null?t:s;this.compositionType.getNumberOfComponents()===1?this.setScalar(s,this.getScalar(s,{})+h*e.getScalar(i,{}),{}):this.compositionType.getNumberOfComponents()===2?this.setVec2AsVector(s,M.add(this.getVec2(s,{}),M.multiply(e.getVec2(i,{}),h)),{}):this.compositionType.getNumberOfComponents()===3?this.setVec3AsVector(s,N.add(this.getVec3(s,{}),N.multiply(e.getVec3(i,{}),h)),{}):this.compositionType.getNumberOfComponents()===4&&this.setVec4AsVector(s,T.add(this.getVec4(s,{}),T.multiply(e.getVec4(i,{}),h)),{}),this.cb=!0,this.yb()}get arrayBufferOfBufferView(){return this.Fp}get dataViewOfBufferView(){return this.lb}get byteOffsetInBufferView(){return this.bb-this.Ab.byteOffsetInRawArrayBufferOfBuffer}get byteOffsetInBuffer(){return this.bb-this.Ab.buffer.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this.bb}get bufferView(){return this.Ab}setMinMax(s,e){let h=this.compositionType.getNumberOfComponents();h===1?(this.sy._v[0]=s[0],this.ny._v[0]=e[0]):h===2?(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.ny._v[0]=e[0],this.ny._v[1]=e[1]):h===3?(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.sy._v[2]=s[2],this.ny._v[0]=e[0],this.ny._v[1]=e[1],this.ny._v[2]=e[2]):h===4&&(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.sy._v[2]=s[2],this.sy._v[3]=s[3],this.ny._v[0]=e[0],this.ny._v[1]=e[1],this.ny._v[2]=e[2],this.ny._v[3]=e[3]),this.cb=!1}get min(){this.cb&&this.Cb();let s=this.compositionType.getNumberOfComponents();return s===4?[this.sy._v[0],this.sy._v[1],this.sy._v[2],this.sy._v[3]]:s===3?[this.sy._v[0],this.sy._v[1],this.sy._v[2]]:s===2?[this.sy._v[0],this.sy._v[1]]:[this.sy._v[0]]}get max(){this.cb&&this.Cb();let s=this.compositionType.getNumberOfComponents();return s===4?[this.ny._v[0],this.ny._v[1],this.ny._v[2],this.ny._v[3]]:s===3?[this.ny._v[0],this.ny._v[1],this.ny._v[2]]:s===2?[this.ny._v[0],this.ny._v[1]]:[this.ny._v[0]]}get normalized(){return this.Ib}Cb(){let s=this.compositionType.getNumberOfComponents();if(s===4){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Ol;for(let h=0;h<this.elementCount;h++){this.getVec4To(h,e,{});for(let t=0;t<4;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===3){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Ze;for(let h=0;h<this.elementCount;h++){this.getVec3To(h,e,{});for(let t=0;t<3;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===2){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Ob;for(let h=0;h<this.elementCount;h++){this.getVec2To(h,e,{});for(let t=0;t<2;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===1){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let e=0;e<this.elementCount;e++){let h=this.getScalar(e,{});this.ny._v[0]<h&&(this.ny._v[0]=h),h<this.sy._v[0]&&(this.sy._v[0]=h)}}this.cb=!1}get isMinMaxDirty(){return this.cb}get version(){return this.vb}get actualByteStride(){return this.hb===0?this.o_.getNumberOfComponents()*this.s_.getSizeInBytes()*this.Vb:this.hb}isSame(s){return this.byteLength===s.byteLength&&this.byteOffsetInRawArrayBufferOfBuffer===s.byteOffsetInRawArrayBufferOfBuffer&&this.bufferView.buffer.getArrayBuffer()===s.bufferView.buffer.getArrayBuffer()}};a.Ol=O.zero(),a.Ze=X.zero(),a.Ob=L.zero();var U=a;export{U as Accessor};
12
+ `),this.xb()),this.yb=this.vb[this.getDataViewGetter(this.c_)].bind(this.vb),this.gb=this.vb[this.getDataViewSetter(this.c_)].bind(this.vb)}xb(){let s=this.getTypedArrayClass(this.c_),e=this.Fp.slice(this._b,this._b+this.p_.getNumberOfComponents()*this.Ab*s.BYTES_PER_ELEMENT);this.Ob=new s(e)}Sb(){var s;this.Nb++,this._primitive!=null&&((s=this._primitive.deref())==null||s.onAccessorUpdated(this.Nb))}getTypedArrayClass(s){switch(s){case o.Byte:return Int8Array;case o.UnsignedByte:return Uint8Array;case o.Short:return Int16Array;case o.UnsignedShort:return Uint16Array;case o.Int:return Int32Array;case o.UnsignedInt:return Uint32Array;case o.Float:return Float32Array;case o.Double:return Float64Array;default:V.default.error("Unexpected ComponentType!");return}}getDataViewGetter(s){switch(s){case o.Byte:return"getInt8";case o.UnsignedByte:return"getUint8";case o.Short:return"getInt16";case o.UnsignedShort:return"getUint16";case o.Int:return"getInt32";case o.UnsignedInt:return"getUint32";case o.Float:return"getFloat32";case o.Double:return"getFloat64";default:return V.default.error("Unexpected ComponentType!"),"unknown"}}getDataViewSetter(s){switch(s){case o.Byte:return"setInt8";case o.UnsignedByte:return"setUint8";case o.Short:return"setInt16";case o.UnsignedShort:return"setUint16";case o.Int:return"setInt32";case o.UnsignedInt:return"setUint32";case o.Float:return"setFloat32";case o.Double:return"setFloat64";default:V.default.error("Unexpected ComponentType!")}}takeOne(){let s=this.Fp;this.Ib>=this.Ab&&V.default.error("You are trying to allocate more than you have secured.");let e=new this.Mb(s,this._b+this.hb*this.Ib,this.p_.getNumberOfComponents()*this.Bb);return e._accessor=this,e._idx_of_accessor=this.Ib,this.Ib+=1,e}_takeExistedOne(s){let e=this.Fp;s>=this.Ab&&V.default.error("You are trying to allocate more than you have secured.");let h=new this.Mb(e,this._b+this.hb*s,this.p_.getNumberOfComponents()*this.Bb);return h._accessor=this,h._idx_of_accessor=s,h}get takenCount(){return this.Ib}get numberOfComponents(){return this.p_.getNumberOfComponents()}get componentSizeInBytes(){return this.c_.getSizeInBytes()}get elementSizeInBytes(){return this.numberOfComponents*this.componentSizeInBytes}get elementCount(){return this.Ab}get byteLength(){return this.hb*this.Ab}get componentType(){return this.c_}get compositionType(){return this.p_}getTypedArray(){return this.Ob}setTypedArray(s){if(s.buffer!==this.Fp){if(this.p_===g.Scalar)for(let e=0;e<this.Ab;e++)this.setScalar(e,s[e],{endian:!0});else if(this.p_===g.Vec2)for(let e=0;e<this.Ab;e++)this.setVec2(e,s[e*2],s[e*2+1],{endian:!0});else if(this.p_===g.Vec3)for(let e=0;e<this.Ab;e++)this.setVec3(e,s[e*3],s[e*3+1],s[e*3+2],{endian:!0});else if(this.p_===g.Vec4)for(let e=0;e<this.Ab;e++)this.setVec4(e,s[e*4],s[e*4+1],s[e*4+2],s[e*4+3],{endian:!0});else if(this.p_===g.Mat3)for(let e=0;e<this.Ab;e++)this.setMat3(e,s[e*9],s[e*9+1],s[e*9+2],s[e*9+3],s[e*9+4],s[e*9+5],s[e*9+6],s[e*9+7],s[e*9+8],{endian:!0});else if(this.p_===g.Mat4)for(let e=0;e<this.Ab;e++)this.setMat4(e,s[e*16],s[e*16+1],s[e*16+2],s[e*16+3],s[e*16+4],s[e*16+5],s[e*16+6],s[e*16+7],s[e*16+8],s[e*16+9],s[e*16+10],s[e*16+11],s[e*16+12],s[e*16+13],s[e*16+14],s[e*16+15],{endian:!0});else throw new Error("Unexpected CompositionType!");this.xb()}}getUint8Array(){return new Uint8Array(this.bufferView.buffer.getArrayBuffer(),this.byteOffsetInRawArrayBufferOfBuffer,this.byteLength)}get isAoS(){return!this.isSoA}get isSoA(){return this.byteStride===this.p_.getNumberOfComponents()*this.c_.getSizeInBytes()}get byteStride(){return this.hb}getScalar(s,{indicesAccessor:e,endian:h=!0}){let t=s;return e&&(t=e.getScalar(s,{})),this.yb(this.hb*t,h)}getScalarAt(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;return h&&(i=h.getScalar(s,{})),this.yb(this.hb*i+e,t)}getVec2AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h)]}getVec3AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h)]}getVec4AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h)]}getMat3AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h),this.yb(this.hb*t+4*i,h),this.yb(this.hb*t+5*i,h),this.yb(this.hb*t+6*i,h),this.yb(this.hb*t+7*i,h),this.yb(this.hb*t+8*i,h)]}getMat4AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h),this.yb(this.hb*t+4*i,h),this.yb(this.hb*t+5*i,h),this.yb(this.hb*t+6*i,h),this.yb(this.hb*t+7*i,h),this.yb(this.hb*t+8*i,h),this.yb(this.hb*t+9*i,h),this.yb(this.hb*t+10*i,h),this.yb(this.hb*t+11*i,h),this.yb(this.hb*t+12*i,h),this.yb(this.hb*t+13*i,h),this.yb(this.hb*t+14*i,h),this.yb(this.hb*t+15*i,h)]}getVec2(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return M.fromCopyArray2([this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h)])}getVec3(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return N.fromCopyArray([this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h)])}getVec4(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return T.fromCopyArray([this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h)])}getMat3(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return z.fromCopy9RowMajor(this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h),this.yb(this.hb*t+4*i,h),this.yb(this.hb*t+5*i,h),this.yb(this.hb*t+6*i,h),this.yb(this.hb*t+7*i,h),this.yb(this.hb*t+8*i,h))}getMat4(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return w.fromCopy16RowMajor(this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h),this.yb(this.hb*t+4*i,h),this.yb(this.hb*t+5*i,h),this.yb(this.hb*t+6*i,h),this.yb(this.hb*t+7*i,h),this.yb(this.hb*t+8*i,h),this.yb(this.hb*t+9*i,h),this.yb(this.hb*t+10*i,h),this.yb(this.hb*t+11*i,h),this.yb(this.hb*t+12*i,h),this.yb(this.hb*t+13*i,h),this.yb(this.hb*t+14*i,h),this.yb(this.hb*t+15*i,h))}getVec2To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t))}getVec3To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t),this.yb(this.hb*i+2*r,t))}getVec4To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t),this.yb(this.hb*i+2*r,t),this.yb(this.hb*i+3*r,t))}getMat3To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t),this.yb(this.hb*i+2*r,t),this.yb(this.hb*i+3*r,t),this.yb(this.hb*i+4*r,t),this.yb(this.hb*i+5*r,t),this.yb(this.hb*i+6*r,t),this.yb(this.hb*i+7*r,t),this.yb(this.hb*i+8*r,t))}getMat4To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t),this.yb(this.hb*i+2*r,t),this.yb(this.hb*i+3*r,t),this.yb(this.hb*i+4*r,t),this.yb(this.hb*i+5*r,t),this.yb(this.hb*i+6*r,t),this.yb(this.hb*i+7*r,t),this.yb(this.hb*i+8*r,t),this.yb(this.hb*i+9*r,t),this.yb(this.hb*i+10*r,t),this.yb(this.hb*i+11*r,t),this.yb(this.hb*i+12*r,t),this.yb(this.hb*i+13*r,t),this.yb(this.hb*i+14*r,t),this.yb(this.hb*i+15*r,t))}setScalar(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{})),this.gb(this.hb*i,e,t),this.Vb=!0,this.Sb()}setVec2(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{}));let c=this.componentSizeInBytes;this.gb(this.hb*r,e,i),this.gb(this.hb*r+1*c,h,i),this.Vb=!0,this.Sb()}setVec3(s,e,h,t,{indicesAccessor:i,endian:r=!0}){let c=s;i&&(c=i.getScalar(s,{}));let u=this.componentSizeInBytes;this.gb(this.hb*c,e,r),this.gb(this.hb*c+1*u,h,r),this.gb(this.hb*c+2*u,t,r),this.Vb=!0,this.Sb()}setVec4(s,e,h,t,i,{indicesAccessor:r,endian:c=!0}){let u=s;r&&(u=r.getScalar(s,{}));let y=this.componentSizeInBytes;this.gb(this.hb*u,e,c),this.gb(this.hb*u+1*y,h,c),this.gb(this.hb*u+2*y,t,c),this.gb(this.hb*u+3*y,i,c),this.Vb=!0,this.Sb()}setMat3(s,e,h,t,i,r,c,u,y,_,{indicesAccessor:A,endian:p=!0}){let b=s;A&&(b=A.getScalar(s,{}));let l=this.componentSizeInBytes;this.gb(this.hb*b,e,p),this.gb(this.hb*b+1*l,h,p),this.gb(this.hb*b+2*l,t,p),this.gb(this.hb*b+3*l,i,p),this.gb(this.hb*b+4*l,r,p),this.gb(this.hb*b+5*l,c,p),this.gb(this.hb*b+6*l,u,p),this.gb(this.hb*b+7*l,y,p),this.gb(this.hb*b+8*l,_,p),this.Vb=!0,this.Sb()}setMat4(s,e,h,t,i,r,c,u,y,_,A,p,b,l,v,I,B,{indicesAccessor:S,endian:f=!0}){let n=s;S&&(n=S.getScalar(s,{}));let m=this.componentSizeInBytes;this.gb(this.hb*n,e,f),this.gb(this.hb*n+1*m,h,f),this.gb(this.hb*n+2*m,t,f),this.gb(this.hb*n+3*m,i,f),this.gb(this.hb*n+4*m,r,f),this.gb(this.hb*n+5*m,c,f),this.gb(this.hb*n+6*m,u,f),this.gb(this.hb*n+7*m,y,f),this.gb(this.hb*n+8*m,_,f),this.gb(this.hb*n+9*m,A,f),this.gb(this.hb*n+10*m,p,f),this.gb(this.hb*n+11*m,b,f),this.gb(this.hb*n+12*m,l,f),this.gb(this.hb*n+13*m,v,f),this.gb(this.hb*n+14*m,I,f),this.gb(this.hb*n+15*m,B,f),this.Vb=!0,this.Sb()}setVec2AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.gb(this.hb*i,e.x,t),this.gb(this.hb*i+1*r,e.y,t),this.Vb=!0,this.Sb()}setVec3AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.gb(this.hb*i,e.x,t),this.gb(this.hb*i+1*r,e.y,t),this.gb(this.hb*i+2*r,e.z,t),this.Vb=!0,this.Sb()}setVec4AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.gb(this.hb*i,e.x,t),this.gb(this.hb*i+1*r,e.y,t),this.gb(this.hb*i+2*r,e.z,t),this.gb(this.hb*i+3*r,e.w,t),this.Vb=!0,this.Sb()}setMat4AsMatrix44(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.gb(this.hb*i,e._v[0],t),this.gb(this.hb*i+1*r,e._v[1],t),this.gb(this.hb*i+2*r,e._v[2],t),this.gb(this.hb*i+3*r,e._v[3],t),this.gb(this.hb*i+4*r,e._v[4],t),this.gb(this.hb*i+5*r,e._v[5],t),this.gb(this.hb*i+6*r,e._v[6],t),this.gb(this.hb*i+7*r,e._v[7],t),this.gb(this.hb*i+8*r,e._v[8],t),this.gb(this.hb*i+9*r,e._v[9],t),this.gb(this.hb*i+10*r,e._v[10],t),this.gb(this.hb*i+11*r,e._v[11],t),this.gb(this.hb*i+12*r,e._v[12],t),this.gb(this.hb*i+13*r,e._v[13],t),this.gb(this.hb*i+14*r,e._v[14],t),this.gb(this.hb*i+15*r,e._v[15],t),this.Vb=!0,this.Sb()}copyFromTypedArray(s){let e=this.numberOfComponents;for(let h=0;h<s.byteLength/this.componentSizeInBytes;h++){let t=Math.floor(h/e),i=t*e;switch(e){case 1:this.setScalar(t,s[i+0],{});break;case 2:this.setVec2(t,s[i+0],s[i+1],{});break;case 3:this.setVec3(t,s[i+0],s[i+1],s[i+2],{});break;case 4:this.setVec4(t,s[i+0],s[i+1],s[i+2],s[i+3],{});break;default:throw new Error("Other than vectors are currently not supported.")}}this.Vb=!0,this.Sb()}setScalarAt(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{})),this.gb(this.hb*r+e,h,i),this.Vb=!0,this.Sb()}setElementFromSameCompositionAccessor(s,e,h){let t=h!=null?h:s;this.compositionType.getNumberOfComponents()===1?this.setScalar(s,e.getScalar(t,{}),{}):this.compositionType.getNumberOfComponents()===2?this.setVec2AsVector(s,e.getVec2(t,{}),{}):this.compositionType.getNumberOfComponents()===3?this.setVec3AsVector(s,e.getVec3(t,{}),{}):this.compositionType.getNumberOfComponents()===4&&this.setVec4AsVector(s,e.getVec4(t,{}),{}),this.Vb=!0,this.Sb()}copyBuffer(s){new Uint8Array(this.Fp).set(new Uint8Array(s.Fp,s._b,s.byteLength),this._b),this.Vb=!0,this.Sb()}setElementFromAccessor(s,e,h){let t=h!=null?h:s;if(this.compositionType.getNumberOfComponents()===1)e.compositionType.getNumberOfComponents()===1?this.setScalar(s,e.getScalar(t,{}),{}):e.compositionType.getNumberOfComponents()===2?this.setScalar(s,e.getVec2(t,{}).x,{}):e.compositionType.getNumberOfComponents()===3?this.setScalar(s,e.getVec3(t,{}).x,{}):e.compositionType.getNumberOfComponents()===4&&this.setScalar(s,e.getVec4(t,{}).x,{});else if(this.compositionType.getNumberOfComponents()===2){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec2(s,i,0,{})}else if(e.compositionType.getNumberOfComponents()===2)this.setVec2AsVector(s,e.getVec2(t,{}),{});else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec2(s,i.x,i.y,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec2(s,i.x,i.y,{})}}else if(this.compositionType.getNumberOfComponents()===3){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec3(s,i,0,0,{})}else if(e.compositionType.getNumberOfComponents()===2){let i=e.getVec2(t,{});this.setVec3(s,i.x,i.y,0,{})}else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec3AsVector(s,i,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec3(s,i.x,i.y,i.z,{})}}else if(this.compositionType.getNumberOfComponents()===4){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec4(s,i,0,0,0,{})}else if(e.compositionType.getNumberOfComponents()===2){let i=e.getVec2(t,{});this.setVec4(s,i.x,i.y,0,0,{})}else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec4(s,i.x,i.y,i.z,0,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec4AsVector(s,i,{})}}this.Vb=!0,this.Sb()}addElementFromSameCompositionAccessor(s,e,h,t){let i=t!=null?t:s;this.compositionType.getNumberOfComponents()===1?this.setScalar(s,this.getScalar(s,{})+h*e.getScalar(i,{}),{}):this.compositionType.getNumberOfComponents()===2?this.setVec2AsVector(s,M.add(this.getVec2(s,{}),M.multiply(e.getVec2(i,{}),h)),{}):this.compositionType.getNumberOfComponents()===3?this.setVec3AsVector(s,N.add(this.getVec3(s,{}),N.multiply(e.getVec3(i,{}),h)),{}):this.compositionType.getNumberOfComponents()===4&&this.setVec4AsVector(s,T.add(this.getVec4(s,{}),T.multiply(e.getVec4(i,{}),h)),{}),this.Vb=!0,this.Sb()}get arrayBufferOfBufferView(){return this.Fp}get dataViewOfBufferView(){return this.vb}get byteOffsetInBufferView(){return this._b-this.Cb.byteOffsetInRawArrayBufferOfBuffer}get byteOffsetInBuffer(){return this._b-this.Cb.buffer.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this._b}get bufferView(){return this.Cb}setMinMax(s,e){let h=this.compositionType.getNumberOfComponents();h===1?(this.sy._v[0]=s[0],this.ny._v[0]=e[0]):h===2?(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.ny._v[0]=e[0],this.ny._v[1]=e[1]):h===3?(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.sy._v[2]=s[2],this.ny._v[0]=e[0],this.ny._v[1]=e[1],this.ny._v[2]=e[2]):h===4&&(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.sy._v[2]=s[2],this.sy._v[3]=s[3],this.ny._v[0]=e[0],this.ny._v[1]=e[1],this.ny._v[2]=e[2],this.ny._v[3]=e[3]),this.Vb=!1}get min(){this.Vb&&this.Eb();let s=this.compositionType.getNumberOfComponents();return s===4?[this.sy._v[0],this.sy._v[1],this.sy._v[2],this.sy._v[3]]:s===3?[this.sy._v[0],this.sy._v[1],this.sy._v[2]]:s===2?[this.sy._v[0],this.sy._v[1]]:[this.sy._v[0]]}get max(){this.Vb&&this.Eb();let s=this.compositionType.getNumberOfComponents();return s===4?[this.ny._v[0],this.ny._v[1],this.ny._v[2],this.ny._v[3]]:s===3?[this.ny._v[0],this.ny._v[1],this.ny._v[2]]:s===2?[this.ny._v[0],this.ny._v[1]]:[this.ny._v[0]]}get normalized(){return this.Tb}Eb(){let s=this.compositionType.getNumberOfComponents();if(s===4){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Zl;for(let h=0;h<this.elementCount;h++){this.getVec4To(h,e,{});for(let t=0;t<4;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===3){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.tr;for(let h=0;h<this.elementCount;h++){this.getVec3To(h,e,{});for(let t=0;t<3;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===2){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Ub;for(let h=0;h<this.elementCount;h++){this.getVec2To(h,e,{});for(let t=0;t<2;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===1){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let e=0;e<this.elementCount;e++){let h=this.getScalar(e,{});this.ny._v[0]<h&&(this.ny._v[0]=h),h<this.sy._v[0]&&(this.sy._v[0]=h)}}this.Vb=!1}get isMinMaxDirty(){return this.Vb}get version(){return this.Nb}get actualByteStride(){return this.hb===0?this.p_.getNumberOfComponents()*this.c_.getSizeInBytes()*this.Bb:this.hb}isSame(s){return this.byteLength===s.byteLength&&this.byteOffsetInRawArrayBufferOfBuffer===s.byteOffsetInRawArrayBufferOfBuffer&&this.bufferView.buffer.getArrayBuffer()===s.bufferView.buffer.getArrayBuffer()}};a.Zl=O.zero(),a.tr=X.zero(),a.Ub=L.zero();var U=a;export{U as Accessor};
@@ -1,4 +1,4 @@
1
- import{Err as h,Ok as m}from"../misc/index.js";import{Accessor as p}from"./Accessor.js";var c=class{constructor({buffer:e,byteOffsetInBuffer:n,defaultByteStride:t,byteLength:r,raw:s}){this.Oy=0;this.Ay=0;this.Ry=0;this.mf=[];this.Cy=e,this.Ly=n,this.bb=e.byteOffsetInRawArrayBuffer+n,this.gy=r,this.Oy=t,this.Fp=s}get defaultByteStride(){return this.Oy}get byteLength(){return this.gy}get byteOffsetInBuffer(){return this.bb-this.Cy.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this.bb}get buffer(){return this.Cy}get isSoA(){return!this.isAoS}get isAoS(){for(let e of this.mf)if(e.isAoS)return!0;return!1}getUint8Array(){return new Uint8Array(this.Fp,this.bb,this.gy)}takeAccessor({compositionType:e,componentType:n,count:t,byteStride:r=this.defaultByteStride,max:s,min:f,arrayLength:i=1,normalized:o=!1}){return this.$y({compositionType:e,componentType:n,count:t,byteStride:r,max:s,min:f,normalized:o,arrayLength:i})}takeAccessorWithByteOffset({compositionType:e,componentType:n,count:t,byteOffsetInBufferView:r,byteStride:s=this.defaultByteStride,max:f,min:i,normalized:o=!1}){return this.Ey({compositionType:e,componentType:n,count:t,byteStride:s,byteOffsetInBufferView:r,max:f,min:i,normalized:o})}$y({compositionType:e,componentType:n,count:t,byteStride:r,max:s,min:f,arrayLength:i,normalized:o}){let u=this.Ay,y=r;if(y===0&&(y=e.getNumberOfComponents()*n.getSizeInBytes()*i),this.Ay+y*(t-1)+n.getSizeInBytes()*e.getNumberOfComponents()>this.byteLength){let B=`The size of the Accessor you are trying to take exceeds the byte length left in the BufferView.
1
+ import{Err as h,Ok as m}from"../misc/index.js";import{Accessor as p}from"./Accessor.js";var c=class{constructor({buffer:e,byteOffsetInBuffer:n,defaultByteStride:t,byteLength:r,raw:s}){this.Oy=0;this.Ay=0;this.Ry=0;this.mf=[];this.Cy=e,this.Ly=n,this._b=e.byteOffsetInRawArrayBuffer+n,this.gy=r,this.Oy=t,this.Fp=s}get defaultByteStride(){return this.Oy}get byteLength(){return this.gy}get byteOffsetInBuffer(){return this._b-this.Cy.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this._b}get buffer(){return this.Cy}get isSoA(){return!this.isAoS}get isAoS(){for(let e of this.mf)if(e.isAoS)return!0;return!1}getUint8Array(){return new Uint8Array(this.Fp,this._b,this.gy)}takeAccessor({compositionType:e,componentType:n,count:t,byteStride:r=this.defaultByteStride,max:s,min:f,arrayLength:i=1,normalized:o=!1}){return this.$y({compositionType:e,componentType:n,count:t,byteStride:r,max:s,min:f,normalized:o,arrayLength:i})}takeAccessorWithByteOffset({compositionType:e,componentType:n,count:t,byteOffsetInBufferView:r,byteStride:s=this.defaultByteStride,max:f,min:i,normalized:o=!1}){return this.Ey({compositionType:e,componentType:n,count:t,byteStride:s,byteOffsetInBufferView:r,max:f,min:i,normalized:o})}$y({compositionType:e,componentType:n,count:t,byteStride:r,max:s,min:f,arrayLength:i,normalized:o}){let u=this.Ay,y=r;if(y===0&&(y=e.getNumberOfComponents()*n.getSizeInBytes()*i),this.Ay+y*(t-1)+n.getSizeInBytes()*e.getNumberOfComponents()>this.byteLength){let B=`The size of the Accessor you are trying to take exceeds the byte length left in the BufferView.
2
2
  BufferView.byteLength: ${this.byteLength}, BufferView.takenSizeInByte: ${this.Ay}, Accessor.byteStride: ${r}, Accessor.count: ${t};
3
3
  byteSizeToTake: ${y*t}, the byte length left in the Buffer: ${this.byteLength-this.Ay}`;return new h({message:B,error:void 0})}let a=new p({bufferView:this,byteOffsetInBufferView:u,compositionType:e,componentType:n,byteStride:r,count:t,raw:this.Fp,max:s,min:f,arrayLength:i,normalized:o});return this.mf.push(a),this.Ay+=y*t,new m(a)}Ey({compositionType:e,componentType:n,count:t,byteStride:r,byteOffsetInBufferView:s,max:f,min:i,normalized:o}){if(this.Ay+r*(t-1)+n.getSizeInBytes()*e.getNumberOfComponents()>this.byteLength){let y=`The size of the Accessor you are trying to take exceeds the byte length left in the BufferView.
4
4
  BufferView.byteLength: ${this.byteLength}, BufferView.takenSizeInByte: ${this.Ay}, Accessor.byteStride: ${r}, Accessor.count: ${t};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Minimal PNG decoder for the RGB9_E5 cubemap faces.
3
+ *
4
+ * The browser PNG decoders do not expose the RGBA bytes directly (a 2D canvas premultiplies alpha and the
5
+ * ImageBitmap path does not hand out the pixel data), and the alpha channel of an RGB9_E5 PNG carries the
6
+ * high byte of the packed word. The files are 8-bit RGBA, non-interlaced PNGs, so a small decoder using the
7
+ * platform DecompressionStream is enough and keeps the packed bytes intact.
8
+ */
9
+ export declare function decodePngToRgba8(bytes: Uint8Array): Promise<{
10
+ width: number;
11
+ height: number;
12
+ data: Uint8Array;
13
+ }>;
14
+ /**
15
+ * Converts the hdrpng.js RGB9_E5 PNG byte layout (R[31:23], G[22:14], B[13:5], E[4:0], stored little-endian)
16
+ * to the native UNSIGNED_INT_5_9_9_9_REV / rgb9e5ufloat layout (E[31:27], B[26:18], G[17:9], R[8:0]).
17
+ */
18
+ export declare function convertHdrpngRgb9E5ToNative(rgba: Uint8Array, pixelCount: number): Uint32Array;
@@ -0,0 +1 @@
1
+ async function S(t){let s=new DataView(t.buffer,t.byteOffset,t.byteLength),h=[137,80,78,71,13,10,26,10];for(let r=0;r<h.length;r++)if(t[r]!==h[r])throw new Error("Not a PNG file");let e=8,n=0,a=0,l=0,p=0,U=0,D=[],P=0;for(;e<t.length;){let r=s.getUint32(e),i=String.fromCharCode(t[e+4],t[e+5],t[e+6],t[e+7]),o=t.subarray(e+8,e+8+r);if(i==="IHDR")n=s.getUint32(e+8),a=s.getUint32(e+12),l=t[e+16],p=t[e+17],U=t[e+20];else if(i==="IDAT")D.push(o),P+=o.length;else if(i==="IEND")break;e+=12+r}if(l!==8||p!==6||U!==0)throw new Error(`Unsupported PNG format (bitDepth ${l}, colorType ${p})`);let T=new Uint8Array(P),E=0;for(let r of D)T.set(r,E),E+=r.length;if(typeof DecompressionStream=="undefined")throw new Error("DecompressionStream is required to decode RGB9_E5 PNG files");let R=new Blob([T]).stream().pipeThrough(new DecompressionStream("deflate")),b=new Uint8Array(await new Response(R).arrayBuffer()),d=4,c=n*d,v=a*(c+1);if(b.length<v)throw new Error("Truncated PNG image data");let u=new Uint8Array(c*a),N=0;for(let r=0;r<a;r++){let i=b[N++];for(let o=0;o<c;o++){let w=b[N++],k=r*c+o,g=o>=d?u[k-d]:0,m=r>0?u[k-c]:0,y=o>=d&&r>0?u[k-c-d]:0,f;switch(i){case 0:f=w;break;case 1:f=w+g;break;case 2:f=w+m;break;case 3:f=w+(g+m>>1);break;case 4:{let A=g+m-y,G=Math.abs(A-g),x=Math.abs(A-m),L=Math.abs(A-y),M=G<=x&&G<=L?g:x<=L?m:y;f=w+M;break}default:throw new Error(`Unsupported PNG filter type ${i}`)}u[k]=f&255}}return{width:n,height:a,data:u}}function B(t,s){let h=new Uint32Array(s);for(let e=0;e<s;e++){let n=t[e*4]|t[e*4+1]<<8|t[e*4+2]<<16|t[e*4+3]<<24,a=n&31,l=n>>>23&511,p=n>>>14&511,U=n>>>5&511;h[e]=(a<<27)+(U<<18)+(p<<9)+l}return h}export{B as convertHdrpngRgb9E5ToNative,S as decodePngToRgba8};
@@ -1 +1 @@
1
- import{SymbolWeakMap as t}from"./SymbolWeakMap.js";var e=class{constructor(){this.Tb=new t}register(r){this.Tb.set(Symbol(),r)}};export{e as Cache};
1
+ import{SymbolWeakMap as t}from"./SymbolWeakMap.js";var e=class{constructor(){this.kb=new t}register(r){this.kb.set(Symbol(),r)}};export{e as Cache};
@@ -1 +1 @@
1
- import{_getGizmoClass as u}from"../../gizmos/GizmoRegistry.js";import{MutableMatrix44 as c}from"../../math/MutableMatrix44.js";import{MutableVector3 as n}from"../../math/MutableVector3.js";import{Vector3 as o}from"../../math/Vector3.js";import{Is as d}from"../../misc/Is.js";var e=class e{constructor(i,s,h,r,t){this.sv=o.zero();this.by=0;this.ez=o.zero();this.ps=c.dummy();this.sz=n.zero();this.iz=n.zero();this.rz=0;this.i=i,this.sv=s,this.by=h,this.ez=r,this.oz=t}updateWorldState(){this.ps=this.oz.matrixInner,this.ps.multiplyVector3To(this.sv,this.sz),this.ps.multiplyVector3To(this.ez,this.iz),o.subtractTo(this.iz,this.sz,this.iz),this.rz=this.iz.lengthSquared(),d.exist(this.tz)&&this.tz.isVisible&&this.tz._update()}collision(i,s){let h=this.sz,r=this.iz,t=o.subtractTo(i,h,e.Or),a=r.dot(t);a<=0||(this.rz<=a?t=o.subtractTo(t,r,e.Or):(o.multiplyTo(r,a/this.rz,e.Nr),t=o.subtractTo(t,e.Nr,e.Or)));let l=this.by+s,m=t.length()-l;return t=o.normalizeTo(t,t),{direction:t,distance:m}}get position(){return this.sv}get tail(){return this.ez}get radius(){return this.by}get baseSceneGraph(){return this.oz}get gizmo(){return this.tz}set gizmo(i){this.tz=i}setGizmoVisible(i){this.tz==null&&(this.tz=new(u("capsuleCollider"))(this.i,this),this.tz._setup()),this.tz.isVisible=i}get isGizmoVisible(){var i,s;return(s=(i=this.tz)==null?void 0:i.isVisible)!=null?s:!1}destroyGizmo(){this.tz!=null&&(this.tz._destroy(),this.tz=void 0)}};e.Or=n.zero(),e.Nr=n.zero();var p=e;export{p as CapsuleCollider};
1
+ import{_getGizmoClass as u}from"../../gizmos/GizmoRegistry.js";import{MutableMatrix44 as c}from"../../math/MutableMatrix44.js";import{MutableVector3 as n}from"../../math/MutableVector3.js";import{Vector3 as o}from"../../math/Vector3.js";import{Is as d}from"../../misc/Is.js";var e=class e{constructor(i,s,h,r,t){this.sv=o.zero();this.by=0;this.ez=o.zero();this.ps=c.dummy();this.sz=n.zero();this.iz=n.zero();this.rz=0;this.i=i,this.sv=s,this.by=h,this.ez=r,this.oz=t}updateWorldState(){this.ps=this.oz.matrixInner,this.ps.multiplyVector3To(this.sv,this.sz),this.ps.multiplyVector3To(this.ez,this.iz),o.subtractTo(this.iz,this.sz,this.iz),this.rz=this.iz.lengthSquared(),d.exist(this.tz)&&this.tz.isVisible&&this.tz._update()}collision(i,s){let h=this.sz,r=this.iz,t=o.subtractTo(i,h,e.Yr),a=r.dot(t);a<=0||(this.rz<=a?t=o.subtractTo(t,r,e.Yr):(o.multiplyTo(r,a/this.rz,e.Zr),t=o.subtractTo(t,e.Zr,e.Yr)));let l=this.by+s,m=t.length()-l;return t=o.normalizeTo(t,t),{direction:t,distance:m}}get position(){return this.sv}get tail(){return this.ez}get radius(){return this.by}get baseSceneGraph(){return this.oz}get gizmo(){return this.tz}set gizmo(i){this.tz=i}setGizmoVisible(i){this.tz==null&&(this.tz=new(u("capsuleCollider"))(this.i,this),this.tz._setup()),this.tz.isVisible=i}get isGizmoVisible(){var i,s;return(s=(i=this.tz)==null?void 0:i.isVisible)!=null?s:!1}destroyGizmo(){this.tz!=null&&(this.tz._destroy(),this.tz=void 0)}};e.Yr=n.zero(),e.Zr=n.zero();var p=e;export{p as CapsuleCollider};
@@ -1 +1 @@
1
- import{_getGizmoClass as m}from"../../gizmos/GizmoRegistry.js";import{MutableVector3 as s}from"../../math/MutableVector3.js";import{Vector3 as n}from"../../math/Vector3.js";import{Is as a}from"../../misc/Is.js";var r=class r{constructor(e,t,i,o){this.sv=n.zero();this.by=0;this.eG=s.zero();this.i=e,this.sv=t,this.by=i,this.oz=o}updateWorldState(){this.oz.matrixInner.multiplyVector3To(this.sv,this.eG),a.exist(this.tz)&&this.tz.isVisible&&this.tz._update()}collision(e,t){let i=n.subtractTo(e,this.eG,r.Nr),o=i.length(),p=this.by+t;return{distance:o-p,delta:i,length:o}}get position(){return this.sv}get worldPosition(){return this.eG}get radius(){return this.by}get baseSceneGraph(){return this.oz}get gizmo(){return this.tz}set gizmo(e){this.tz=e}setGizmoVisible(e){this.tz==null&&(this.tz=new(m("sphereCollider"))(this.i,this),this.tz._setup()),this.tz.isVisible=e}get isGizmoVisible(){var e,t;return(t=(e=this.tz)==null?void 0:e.isVisible)!=null?t:!1}destroyGizmo(){this.tz!=null&&(this.tz._destroy(),this.tz=void 0)}};r.Nr=s.zero();var h=r;export{h as SphereCollider};
1
+ import{_getGizmoClass as m}from"../../gizmos/GizmoRegistry.js";import{MutableVector3 as s}from"../../math/MutableVector3.js";import{Vector3 as n}from"../../math/Vector3.js";import{Is as a}from"../../misc/Is.js";var r=class r{constructor(e,t,i,o){this.sv=n.zero();this.by=0;this.eG=s.zero();this.i=e,this.sv=t,this.by=i,this.oz=o}updateWorldState(){this.oz.matrixInner.multiplyVector3To(this.sv,this.eG),a.exist(this.tz)&&this.tz.isVisible&&this.tz._update()}collision(e,t){let i=n.subtractTo(e,this.eG,r.Zr),o=i.length(),p=this.by+t;return{distance:o-p,delta:i,length:o}}get position(){return this.sv}get worldPosition(){return this.eG}get radius(){return this.by}get baseSceneGraph(){return this.oz}get gizmo(){return this.tz}set gizmo(e){this.tz=e}setGizmoVisible(e){this.tz==null&&(this.tz=new(m("sphereCollider"))(this.i,this),this.tz._setup()),this.tz.isVisible=e}get isGizmoVisible(){var e,t;return(t=(e=this.tz)==null?void 0:e.isVisible)!=null?t:!1}destroyGizmo(){this.tz!=null&&(this.tz._destroy(),this.tz=void 0)}};r.Zr=s.zero();var h=r;export{h as SphereCollider};
@@ -1 +1 @@
1
- import{RnObject as p}from"../../core/RnObject.js";import{Matrix44 as l,MutableVector3 as r}from"../../math/index.js";import{Vector3 as i}from"../../math/Vector3.js";var o=class o extends p{constructor(t){super();this.stiffnessForce=1;this.gravityPower=0;this.gravityDir=i.fromCopyArray([0,-1,0]);this.dragForce=.4;this.hitRadius=.02;this.currentTail=r.zero();this.prevTail=r.zero();this.boneAxis=i.zero();this.boneLength=0;this.initialLocalChildPosition=i.zero();this.initialized=!1;this.node=t}setup(t){if(!this.initialized){this.node.getTransform()._backupTransformAsRest();let e=this.node.getSceneGraph().children;if(e.length>0)this.initialLocalChildPosition=e[0].entity.getTransform().localPosition,this.initialLocalChildPosition.length()===0&&(this.initialLocalChildPosition=i.fromCopyArray([0,-.07,0]));else{let h=this.node.getTransform().localPosition.length()>0?this.node.getTransform().localPosition:i.fromCopyArray([0,-1,0]);this.initialLocalChildPosition=i.multiply(i.normalize(h),.07)}let n=this.node.matrixInner.multiplyVector3(this.initialLocalChildPosition),a=t!=null?t.getLocalPositionOf(n):n;this.currentTail.copyComponents(a),this.prevTail.copyComponents(this.currentTail);let c=this.initialLocalChildPosition.length()>0?this.initialLocalChildPosition:i.fromCopyArray([0,-.07,0]);this.boneAxis=i.normalize(c),this.initialized=!0}}_getMatrixCenterToWorld(t){return t!=null?t.matrixInner:l.identity()}_getMatrixWorldToCenter(t){return t!=null?l.invert(t.matrixInner):l.identity()}_calcWorldSpaceBoneLength(){let t=this.node.getSceneGraph().matrixInner,e=t.getTranslateTo(o.Or),n=o.T0,a=this.node.getSceneGraph().children;a.length>0?n=a[0].matrixInner.getTranslateTo(o.Nr):n=i.multiplyMatrix4To(this.initialLocalChildPosition,t,o.ev),this.boneLength=i.subtractTo(e,n,o.ov).length()}};o.Or=r.zero(),o.Nr=r.zero(),o.T0=i.zero(),o.ev=r.zero(),o.ov=r.zero();var s=o;export{s as VRMSpringBone};
1
+ import{RnObject as p}from"../../core/RnObject.js";import{Matrix44 as l,MutableVector3 as r}from"../../math/index.js";import{Vector3 as i}from"../../math/Vector3.js";var o=class o extends p{constructor(t){super();this.stiffnessForce=1;this.gravityPower=0;this.gravityDir=i.fromCopyArray([0,-1,0]);this.dragForce=.4;this.hitRadius=.02;this.currentTail=r.zero();this.prevTail=r.zero();this.boneAxis=i.zero();this.boneLength=0;this.initialLocalChildPosition=i.zero();this.initialized=!1;this.node=t}setup(t){if(!this.initialized){this.node.getTransform()._backupTransformAsRest();let e=this.node.getSceneGraph().children;if(e.length>0)this.initialLocalChildPosition=e[0].entity.getTransform().localPosition,this.initialLocalChildPosition.length()===0&&(this.initialLocalChildPosition=i.fromCopyArray([0,-.07,0]));else{let h=this.node.getTransform().localPosition.length()>0?this.node.getTransform().localPosition:i.fromCopyArray([0,-1,0]);this.initialLocalChildPosition=i.multiply(i.normalize(h),.07)}let n=this.node.matrixInner.multiplyVector3(this.initialLocalChildPosition),a=t!=null?t.getLocalPositionOf(n):n;this.currentTail.copyComponents(a),this.prevTail.copyComponents(this.currentTail);let c=this.initialLocalChildPosition.length()>0?this.initialLocalChildPosition:i.fromCopyArray([0,-.07,0]);this.boneAxis=i.normalize(c),this.initialized=!0}}_getMatrixCenterToWorld(t){return t!=null?t.matrixInner:l.identity()}_getMatrixWorldToCenter(t){return t!=null?l.invert(t.matrixInner):l.identity()}_calcWorldSpaceBoneLength(){let t=this.node.getSceneGraph().matrixInner,e=t.getTranslateTo(o.Yr),n=o.T0,a=this.node.getSceneGraph().children;a.length>0?n=a[0].matrixInner.getTranslateTo(o.Zr):n=i.multiplyMatrix4To(this.initialLocalChildPosition,t,o.ev),this.boneLength=i.subtractTo(e,n,o.ov).length()}};o.Yr=r.zero(),o.Zr=r.zero(),o.T0=i.zero(),o.ev=r.zero(),o.ov=r.zero();var s=o;export{s as VRMSpringBone};
@@ -1 +1 @@
1
- import{RnObject as m}from"../core/RnObject.js";import{Is as t}from"../misc/Is.js";var i=class i extends m{constructor(){super(...arguments);this.pp=[];this.Jx=[];this.Qx=[]}addExpression(n,{inputRenderPasses:e,outputs:o}={inputRenderPasses:[],outputs:[]}){if(t.exist(o))for(let r of o){let s=r.renderPass.instance;t.exist(r.renderPass.instance)?s=r.renderPass.instance:t.exist(r.renderPass.index)?s=n.renderPasses[r.renderPass.index]:t.exist(r.renderPass.uniqueName)&&(s=m.getRnObjectByName(r.renderPass.uniqueName)),t.exist(s)&&s.setFramebuffer(r.frameBuffer)}this.pp.push({expression:n,inputRenderPasses:t.exist(e)?e:[]}),this.Jx.push(n)}getColorAttachmentFromInputOf(n,e={renderPass:{index:0},colorAttachmentIndex:0,framebufferType:i.FrameBuffer}){return new Promise(r=>{function*s(){let a=yield;return r(a),a}let u=s();this.Qx.push([n,e.renderPass,e.colorAttachmentIndex,u,e.framebufferType])})}resolve(){for(let[n,e,o,r,s]of this.Qx)for(let u of this.pp)if(n===u.expression){let a=e.instance;t.exist(e.instance)?a=e.instance:t.exist(e.index)?a=u.inputRenderPasses[e.index]:t.exist(e.uniqueName)&&(a=m.getRnObjectByName(e.uniqueName));let f;if(s==="ResolveFrameBuffer2"?f=a.getResolveFramebuffer2():s==="ResolveFrameBuffer"?f=a.getResolveFramebuffer():s==="FrameBuffer"&&(f=a.getFramebuffer()),t.exist(f)){let d=f.getColorAttachedRenderTargetTexture(o);t.exist(d)&&(r.next(d),r.next(d))}}}clearExpressions(){this.pp.length=0,this.Jx.length=0}get expressions(){return this.Jx}setViewport(n){for(let e of this.pp)e.expression.setViewport(n)}};i.FrameBuffer="FrameBuffer",i.ResolveFrameBuffer="ResolveFrameBuffer",i.ResolveFrameBuffer2="ResolveFrameBuffer2";var p=i;export{p as Frame};
1
+ import{RnObject as m}from"../core/RnObject.js";import{Is as t}from"../misc/Is.js";var i=class i extends m{constructor(){super(...arguments);this.hp=[];this.Jx=[];this.Qx=[]}addExpression(n,{inputRenderPasses:e,outputs:o}={inputRenderPasses:[],outputs:[]}){if(t.exist(o))for(let r of o){let s=r.renderPass.instance;t.exist(r.renderPass.instance)?s=r.renderPass.instance:t.exist(r.renderPass.index)?s=n.renderPasses[r.renderPass.index]:t.exist(r.renderPass.uniqueName)&&(s=m.getRnObjectByName(r.renderPass.uniqueName)),t.exist(s)&&s.setFramebuffer(r.frameBuffer)}this.hp.push({expression:n,inputRenderPasses:t.exist(e)?e:[]}),this.Jx.push(n)}getColorAttachmentFromInputOf(n,e={renderPass:{index:0},colorAttachmentIndex:0,framebufferType:i.FrameBuffer}){return new Promise(r=>{function*s(){let a=yield;return r(a),a}let u=s();this.Qx.push([n,e.renderPass,e.colorAttachmentIndex,u,e.framebufferType])})}resolve(){for(let[n,e,o,r,s]of this.Qx)for(let u of this.hp)if(n===u.expression){let a=e.instance;t.exist(e.instance)?a=e.instance:t.exist(e.index)?a=u.inputRenderPasses[e.index]:t.exist(e.uniqueName)&&(a=m.getRnObjectByName(e.uniqueName));let f;if(s==="ResolveFrameBuffer2"?f=a.getResolveFramebuffer2():s==="ResolveFrameBuffer"?f=a.getResolveFramebuffer():s==="FrameBuffer"&&(f=a.getFramebuffer()),t.exist(f)){let d=f.getColorAttachedRenderTargetTexture(o);t.exist(d)&&(r.next(d),r.next(d))}}}clearExpressions(){this.hp.length=0,this.Jx.length=0}get expressions(){return this.Jx}setViewport(n){for(let e of this.hp)e.expression.setViewport(n)}};i.FrameBuffer="FrameBuffer",i.ResolveFrameBuffer="ResolveFrameBuffer",i.ResolveFrameBuffer2="ResolveFrameBuffer2";var p=i;export{p as Frame};
@@ -241,6 +241,13 @@ export declare class RenderPass extends RnObject {
241
241
  /**
242
242
  * Removes all entities from this render pass and clears related collections.
243
243
  * This effectively empties the render pass of all renderable content.
244
+ *
245
+ * @remarks
246
+ * `__sceneGraphDirectlyAdded` must be cleared together with the other collections:
247
+ * `addEntities` appends to it on every call, and `processAuto`-style callers call
248
+ * `clearEntities` + `addEntities` once per frame. Leaving it untouched makes it grow
249
+ * by the entity count every frame (keeping every scene graph it ever saw alive) and
250
+ * makes `sceneTopLevelGraphComponents` retain the roots of previously cleared entities.
244
251
  */
245
252
  clearEntities(): void;
246
253
  /**
@@ -1 +1 @@
1
- import{flattenHierarchy as c}from"../components/SceneGraph/SceneGraphOps.js";import{WellKnownComponentTIDs as d}from"../components/WellKnownComponentTIDs.js";import{RnObject as f}from"../core/RnObject.js";import{PrimitiveMode as h}from"../definitions/PrimitiveMode.js";import{Primitive as R}from"../geometry/Primitive.js";import{MutableVector4 as l}from"../math/MutableVector4.js";import{Vector4 as p}from"../math/Vector4.js";var n=class n extends f{constructor(e){super();this.Ep=[];this.WR=[];this.CR=[];this.vR=[];this.gR=[];this.yR=new Map;this.toClearColorBuffer=!1;this.toClearDepthBuffer=!0;this.toClearStencilBuffer=!1;this.isDepthTest=!0;this.depthWriteMask=!0;this.clearColor=p.fromCopyArray([1,1,1,1]);this.clearDepth=1;this.clearStencil=0;this._drawVertexNumberForBufferLessRendering=0;this._primitiveModeForBufferLessRendering=h.Triangles;this.isVrRendering=!0;this.isOutputForVr=!1;this._lastOpaqueIndex=-1;this._lastTranslucentIndex=-1;this._lastBlendWithZWriteIndex=-1;this._lastBlendWithoutZWriteIndex=-1;this._lastPrimitiveUids=[];this._lastPrimitives=null;this._lastTransformComponentsUpdateCount=-1;this._lastCameraControllerComponentsUpdateCount=-1;this._lastSceneGraphComponentsUpdateCount=-1;this._lastMultiDrawGroupVersion=-1;this._renderedSomethingBefore=!0;this._isChangedSortRenderResult=!1;this._toRenderOpaquePrimitives=!0;this._toRenderTranslucentPrimitives=!0;this._toRenderBlendWithZWritePrimitives=!0;this._toRenderBlendWithoutZWritePrimitives=!0;this.toRenderEffekseerEffects=!1;this.i=e,this._dummyPrimitiveForBufferLessRendering=new R(e),this.IR=++n.qu}setToRenderOpaquePrimitives(e){this._toRenderOpaquePrimitives=e,this.ER()}setToRenderBlendWithoutZWritePrimitives(e){this._toRenderBlendWithoutZWritePrimitives=e,this.ER()}setToRenderBlendWithZWritePrimitives(e){this._toRenderBlendWithZWritePrimitives=e,this.ER()}setToRenderTranslucentPrimitives(e){this._toRenderTranslucentPrimitives=e,this.ER()}isBufferLessRenderingMode(){return this._drawVertexNumberForBufferLessRendering>0}setBufferLessRendering(e,t,i){this._primitiveModeForBufferLessRendering=e,this._drawVertexNumberForBufferLessRendering=t,this.Bp=i,this._renderedSomethingBefore=!0}setBufferLessFullScreenRendering(e){this._primitiveModeForBufferLessRendering=h.Triangles,this._drawVertexNumberForBufferLessRendering=3,this.Bp=e,this._renderedSomethingBefore=!0}clone(){var t,i;let e=new n(this.i);return e.tryToSetUniqueName(`${this.uniqueName}_cloned`,!0),e.Ep=this.Ep.concat(),e.WR=this.WR.concat(),e.CR=this.CR.concat(),e.vR=this.vR.concat(),e.gR=this.gR.concat(),e._R=this._R,e.mR=this.mR,e.bR=this.bR,e.BR=(t=this.BR)==null?void 0:t.clone(),e.toClearColorBuffer=this.toClearColorBuffer,e.toClearDepthBuffer=this.toClearDepthBuffer,e.toClearStencilBuffer=this.toClearStencilBuffer,e.isDepthTest=this.isDepthTest,e.clearColor=this.clearColor.clone(),e.clearDepth=this.clearDepth,e.clearStencil=this.clearStencil,e.cameraComponent=this.cameraComponent,e.Bp=this.Bp,e.yR=new Map(this.yR),e.isVrRendering=this.isVrRendering,e.isOutputForVr=this.isOutputForVr,e._toRenderOpaquePrimitives=this._toRenderOpaquePrimitives,e._toRenderTranslucentPrimitives=this._toRenderTranslucentPrimitives,e._toRenderBlendWithoutZWritePrimitives=this._toRenderBlendWithoutZWritePrimitives,e.FR=this.FR,e.MR=this.MR,e.PR=(i=this.PR)==null?void 0:i.concat(),e._lastOpaqueIndex=this._lastOpaqueIndex,e._lastTranslucentIndex=this._lastTranslucentIndex,e._lastBlendWithZWriteIndex=this._lastBlendWithZWriteIndex,e._lastBlendWithoutZWriteIndex=this._lastBlendWithoutZWriteIndex,e._lastPrimitiveUids=this._lastPrimitiveUids.concat(),e._lastTransformComponentsUpdateCount=this._lastTransformComponentsUpdateCount,e._lastCameraControllerComponentsUpdateCount=this._lastCameraControllerComponentsUpdateCount,e._lastSceneGraphComponentsUpdateCount=this._lastSceneGraphComponentsUpdateCount,e._renderedSomethingBefore=this._renderedSomethingBefore,e._isChangedSortRenderResult=this._isChangedSortRenderResult,e}setPreRenderFunction(e){this.FR=e}setPostRenderFunction(e){this.MR=e}doPreRender(){this.FR!=null&&this.FR()}doPostRender(){this.MR!=null&&this.MR()}addEntities(e){for(let t of e){if(t===void 0)continue;let i=t.getSceneGraph();this.WR.push(i);let a=c(i,!1).map(s=>s.entity).filter(s=>s!=null),r=this.Ep.concat(a).reduce((s,u)=>(s.set(u.entityUID,u),s),new Map);this.Ep=Array.from(r.values())}this.ER(),this.CR=[],this.xR()}ER(){this.vR=[],this.gR=[],this.UR()}get entities(){return this.Ep}clearEntities(){this.vR=[],this.gR=[],this.CR=[],this.Ep=[]}xR(){let e=i=>(i.parent&&e(i.parent),i);this.CR=this.WR.map(i=>e(i));let t=new Set(this.CR);this.CR=Array.from(t)}UR(){this.vR=[],this.gR=[];for(let e of this.Ep){let t=e.getComponentByComponentTID(d.MeshComponentTID);if(t!=null&&t.mesh!=null){if(this.vR.push(t),!this._toRenderOpaquePrimitives&&t.mesh.isExistOpaque()||!this._toRenderTranslucentPrimitives&&t.mesh.isExistTranslucent()||!this._toRenderBlendWithZWritePrimitives&&t.mesh.isExistBlendWithZWrite()||!this._toRenderBlendWithoutZWritePrimitives&&t.mesh.isExistBlendWithoutZWrite())continue;this.gR.push(t)}}}get meshComponents(){return this.vR}get _optimizedMeshComponents(){return this.gR}get sceneTopLevelGraphComponents(){return this.CR}setFramebuffer(e){this._R=e,e!=null?this.setViewport(p.fromCopyArray([0,0,e.width,e.height])):this.BR=void 0}setRenderTargetColorAttachments(e){this.PR=e}getRenderTargetColorAttachments(){return this.PR}getFramebuffer(){return this._R}removeFramebuffer(){this._R=void 0}setViewport(e){this.BR!=null?this.BR.copyComponents(e):this.BR=l.fromCopyArray([e.x,e.y,e.z,e.w])}getViewport(){let e=this.BR;return e!=null&&(e=n.GR.copyComponents(e)),e}setScissorRect(e){if(e==null){this.SR=void 0;return}this.SR={x:Math.floor(e.x),y:Math.floor(e.y),width:Math.max(0,Math.floor(e.width)),height:Math.max(0,Math.floor(e.height))}}getScissorRect(){return this.SR}setResolveFramebuffer(e){this.mR=e}getResolveFramebuffer(){return this.mR}setResolveFramebuffer2(e){this.bR=e}getResolveFramebuffer2(){return this.bR}_copyFramebufferToResolveFramebuffersWebGL(){this.TR(this.mR),this.TR(this.bR)}TR(e){if(e==null)return;let t=this.i.webglResourceRepository,i=t.getWebGLResource(this._R.cgApiResourceUid),o=t.getWebGLResource(e.cgApiResourceUid);if(i==null||o==null)return;let r=t.currentWebGLContextWrapper.getRawContextAsWebGL2();r.bindFramebuffer(r.READ_FRAMEBUFFER,i),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,o),r.blitFramebuffer(0,0,this._R.width,this._R.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}_copyResolve1ToResolve2WebGpu(){if(this.mR==null||this.bR==null)return;let e=this.i.webGpuResourceRepository;for(let t=0;t<this.mR.colorAttachments.length;t++)this.mR.colorAttachments[t]==null||this.bR.colorAttachments[t]==null||this.mR.colorAttachments[t]._textureResourceUid===-1||this.bR.colorAttachments[t]._textureResourceUid===-1||e.copyTextureData(this.mR.colorAttachments[t]._textureResourceUid,this.bR.colorAttachments[t]._textureResourceUid)}setMaterialForPrimitive(e,t){this.yR.set(t.objectUID,new WeakRef(e))}setMaterial(e){this.Bp=e}get material(){return this.Bp}_getMaterialOf(e){var t;return(t=this.yR.get(e.objectUID))==null?void 0:t.deref()}getAppropriateMaterial(e){let t=this.yR.size!==0?this._getMaterialOf(e):void 0;return t!=null||(this.Bp!=null?t=this.Bp:t=e.material),t}get renderPassUID(){return this.IR}};n.GR=l.zero(),n.qu=-1;var m=n;export{m as RenderPass};
1
+ import{flattenHierarchy as c}from"../components/SceneGraph/SceneGraphOps.js";import{WellKnownComponentTIDs as d}from"../components/WellKnownComponentTIDs.js";import{RnObject as f}from"../core/RnObject.js";import{PrimitiveMode as l}from"../definitions/PrimitiveMode.js";import{Primitive as R}from"../geometry/Primitive.js";import{MutableVector4 as h}from"../math/MutableVector4.js";import{Vector4 as p}from"../math/Vector4.js";var s=class s extends f{constructor(e){super();this.Gp=[];this.yR=[];this.bR=[];this._R=[];this.vR=[];this.FR=new Map;this.toClearColorBuffer=!1;this.toClearDepthBuffer=!0;this.toClearStencilBuffer=!1;this.isDepthTest=!0;this.depthWriteMask=!0;this.clearColor=p.fromCopyArray([1,1,1,1]);this.clearDepth=1;this.clearStencil=0;this._drawVertexNumberForBufferLessRendering=0;this._primitiveModeForBufferLessRendering=l.Triangles;this.isVrRendering=!0;this.isOutputForVr=!1;this._lastOpaqueIndex=-1;this._lastTranslucentIndex=-1;this._lastBlendWithZWriteIndex=-1;this._lastBlendWithoutZWriteIndex=-1;this._lastPrimitiveUids=[];this._lastPrimitives=null;this._lastTransformComponentsUpdateCount=-1;this._lastCameraControllerComponentsUpdateCount=-1;this._lastSceneGraphComponentsUpdateCount=-1;this._lastMultiDrawGroupVersion=-1;this._renderedSomethingBefore=!0;this._isChangedSortRenderResult=!1;this._toRenderOpaquePrimitives=!0;this._toRenderTranslucentPrimitives=!0;this._toRenderBlendWithZWritePrimitives=!0;this._toRenderBlendWithoutZWritePrimitives=!0;this.toRenderEffekseerEffects=!1;this.i=e,this._dummyPrimitiveForBufferLessRendering=new R(e),this.IR=++s.qu}setToRenderOpaquePrimitives(e){this._toRenderOpaquePrimitives=e,this.WR()}setToRenderBlendWithoutZWritePrimitives(e){this._toRenderBlendWithoutZWritePrimitives=e,this.WR()}setToRenderBlendWithZWritePrimitives(e){this._toRenderBlendWithZWritePrimitives=e,this.WR()}setToRenderTranslucentPrimitives(e){this._toRenderTranslucentPrimitives=e,this.WR()}isBufferLessRenderingMode(){return this._drawVertexNumberForBufferLessRendering>0}setBufferLessRendering(e,t,i){this._primitiveModeForBufferLessRendering=e,this._drawVertexNumberForBufferLessRendering=t,this.kp=i,this._renderedSomethingBefore=!0}setBufferLessFullScreenRendering(e){this._primitiveModeForBufferLessRendering=l.Triangles,this._drawVertexNumberForBufferLessRendering=3,this.kp=e,this._renderedSomethingBefore=!0}clone(){var t,i;let e=new s(this.i);return e.tryToSetUniqueName(`${this.uniqueName}_cloned`,!0),e.Gp=this.Gp.concat(),e.yR=this.yR.concat(),e.bR=this.bR.concat(),e._R=this._R.concat(),e.vR=this.vR.concat(),e.mR=this.mR,e.BR=this.BR,e.CR=this.CR,e.gR=(t=this.gR)==null?void 0:t.clone(),e.toClearColorBuffer=this.toClearColorBuffer,e.toClearDepthBuffer=this.toClearDepthBuffer,e.toClearStencilBuffer=this.toClearStencilBuffer,e.isDepthTest=this.isDepthTest,e.clearColor=this.clearColor.clone(),e.clearDepth=this.clearDepth,e.clearStencil=this.clearStencil,e.cameraComponent=this.cameraComponent,e.kp=this.kp,e.FR=new Map(this.FR),e.isVrRendering=this.isVrRendering,e.isOutputForVr=this.isOutputForVr,e._toRenderOpaquePrimitives=this._toRenderOpaquePrimitives,e._toRenderTranslucentPrimitives=this._toRenderTranslucentPrimitives,e._toRenderBlendWithoutZWritePrimitives=this._toRenderBlendWithoutZWritePrimitives,e.MR=this.MR,e.ER=this.ER,e.PR=(i=this.PR)==null?void 0:i.concat(),e._lastOpaqueIndex=this._lastOpaqueIndex,e._lastTranslucentIndex=this._lastTranslucentIndex,e._lastBlendWithZWriteIndex=this._lastBlendWithZWriteIndex,e._lastBlendWithoutZWriteIndex=this._lastBlendWithoutZWriteIndex,e._lastPrimitiveUids=this._lastPrimitiveUids.concat(),e._lastTransformComponentsUpdateCount=this._lastTransformComponentsUpdateCount,e._lastCameraControllerComponentsUpdateCount=this._lastCameraControllerComponentsUpdateCount,e._lastSceneGraphComponentsUpdateCount=this._lastSceneGraphComponentsUpdateCount,e._renderedSomethingBefore=this._renderedSomethingBefore,e._isChangedSortRenderResult=this._isChangedSortRenderResult,e}setPreRenderFunction(e){this.MR=e}setPostRenderFunction(e){this.ER=e}doPreRender(){this.MR!=null&&this.MR()}doPostRender(){this.ER!=null&&this.ER()}addEntities(e){for(let t of e){if(t===void 0)continue;let i=t.getSceneGraph();this.yR.push(i);let n=c(i,!1).map(a=>a.entity).filter(a=>a!=null),r=this.Gp.concat(n).reduce((a,u)=>(a.set(u.entityUID,u),a),new Map);this.Gp=Array.from(r.values())}this.WR(),this.bR=[],this.xR()}WR(){this._R=[],this.vR=[],this.UR()}get entities(){return this.Gp}clearEntities(){this._R=[],this.vR=[],this.bR=[],this.yR=[],this.Gp=[]}xR(){let e=i=>(i.parent&&e(i.parent),i);this.bR=this.yR.map(i=>e(i));let t=new Set(this.bR);this.bR=Array.from(t)}UR(){this._R=[],this.vR=[];for(let e of this.Gp){let t=e.getComponentByComponentTID(d.MeshComponentTID);if(t!=null&&t.mesh!=null){if(this._R.push(t),!this._toRenderOpaquePrimitives&&t.mesh.isExistOpaque()||!this._toRenderTranslucentPrimitives&&t.mesh.isExistTranslucent()||!this._toRenderBlendWithZWritePrimitives&&t.mesh.isExistBlendWithZWrite()||!this._toRenderBlendWithoutZWritePrimitives&&t.mesh.isExistBlendWithoutZWrite())continue;this.vR.push(t)}}}get meshComponents(){return this._R}get _optimizedMeshComponents(){return this.vR}get sceneTopLevelGraphComponents(){return this.bR}setFramebuffer(e){this.mR=e,e!=null?this.setViewport(p.fromCopyArray([0,0,e.width,e.height])):this.gR=void 0}setRenderTargetColorAttachments(e){this.PR=e}getRenderTargetColorAttachments(){return this.PR}getFramebuffer(){return this.mR}removeFramebuffer(){this.mR=void 0}setViewport(e){this.gR!=null?this.gR.copyComponents(e):this.gR=h.fromCopyArray([e.x,e.y,e.z,e.w])}getViewport(){let e=this.gR;return e!=null&&(e=s.GR.copyComponents(e)),e}setScissorRect(e){if(e==null){this.SR=void 0;return}this.SR={x:Math.floor(e.x),y:Math.floor(e.y),width:Math.max(0,Math.floor(e.width)),height:Math.max(0,Math.floor(e.height))}}getScissorRect(){return this.SR}setResolveFramebuffer(e){this.BR=e}getResolveFramebuffer(){return this.BR}setResolveFramebuffer2(e){this.CR=e}getResolveFramebuffer2(){return this.CR}_copyFramebufferToResolveFramebuffersWebGL(){this.TR(this.BR),this.TR(this.CR)}TR(e){if(e==null)return;let t=this.i.webglResourceRepository,i=t.getWebGLResource(this.mR.cgApiResourceUid),o=t.getWebGLResource(e.cgApiResourceUid);if(i==null||o==null)return;let r=t.currentWebGLContextWrapper.getRawContextAsWebGL2();r.bindFramebuffer(r.READ_FRAMEBUFFER,i),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,o),r.blitFramebuffer(0,0,this.mR.width,this.mR.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}_copyResolve1ToResolve2WebGpu(){var i,o;let e=(i=this.BR)!=null?i:this.mR;if(e==null||this.CR==null)return;let t=this.i.webGpuResourceRepository;for(let n=0;n<e.colorAttachments.length;n++)e.colorAttachments[n]==null||this.CR.colorAttachments[n]==null||!(e.colorAttachments[n]._textureResourceUid>=0)||((o=e.colorAttachments[n].sampleCount)!=null?o:1)>1||this.CR.colorAttachments[n]._textureResourceUid===-1||t.copyTextureData(e.colorAttachments[n]._textureResourceUid,this.CR.colorAttachments[n]._textureResourceUid)}setMaterialForPrimitive(e,t){this.FR.set(t.objectUID,new WeakRef(e))}setMaterial(e){this.kp=e}get material(){return this.kp}_getMaterialOf(e){var t;return(t=this.FR.get(e.objectUID))==null?void 0:t.deref()}getAppropriateMaterial(e){let t=this.FR.size!==0?this._getMaterialOf(e):void 0;return t!=null||(this.kp!=null?t=this.kp:t=e.material),t}get renderPassUID(){return this.IR}};s.GR=h.zero(),s.qu=-1;var m=s;export{m as RenderPass};
@@ -0,0 +1,33 @@
1
+ import type { ISceneGraphEntity } from '../../helpers/EntityHelper';
2
+ /**
3
+ * Keeps the previous frame data of a set of entities (in the GPU instance data) up to date for the motion vectors
4
+ * of temporal anti-aliasing: `previousWorldMatrix` of their scene graph and the previous bone data of their
5
+ * skeleton.
6
+ *
7
+ * @remarks
8
+ * `update` runs once per frame before the logic stage, when the world matrices and the bone data in the GPU instance
9
+ * data are still those of the previous frame. An entity whose world matrix version changed is written in this frame
10
+ * and once more in the next frame: a change made between two frames (after rendering) is only computed in the next
11
+ * frame, so its previous world matrix is only known one frame later. Entities that do not move are not written.
12
+ * The previous bone data is copied whenever it differs from the bone data, which gives the same result.
13
+ *
14
+ * @internal
15
+ */
16
+ export declare class PreviousFrameDataTracker {
17
+ private __entities;
18
+ private __states;
19
+ /**
20
+ * Sets the entities to track. The state of the entities that are no longer tracked is dropped.
21
+ *
22
+ * @param entities - The entities rendered with motion vectors
23
+ */
24
+ setEntities(entities: readonly ISceneGraphEntity[]): void;
25
+ /**
26
+ * Writes the previous world matrices and bone data of the tracked entities that moved.
27
+ *
28
+ * @returns Whether a previous world matrix was written (the GPU instance data has to be uploaded)
29
+ */
30
+ update(): boolean;
31
+ /** Drops all tracked entities. */
32
+ clear(): void;
33
+ }
@@ -0,0 +1 @@
1
+ var s=class{constructor(){this.Gp=[];this._S=new Map}setEntities(n){this.Gp=n;let o=new Set;for(let e of n)o.add(e.getSceneGraph());for(let e of this._S.keys())o.has(e)||this._S.delete(e)}update(){let n=!1;for(let o of this.Gp){let e=o.tryToGetSkeletal();e!=null&&(e._enablePreviousBoneData(),e._updatePreviousBoneData()&&(n=!0));let t=o.getSceneGraph(),r=this._S.get(t);if(r==null){t._previousWorldMatrixInner.copyComponents(t.matrixInner),this._S.set(t,{version:t.worldMatrixVersion,isSettling:!0}),n=!0;continue}let i=t.worldMatrixVersion;(r.version!==i||r.isSettling)&&(t._previousWorldMatrixInner.copyComponents(t._lastComputedWorldMatrixInner),r.isSettling=r.version!==i,r.version=i,n=!0)}return n}clear(){this.Gp=[],this._S.clear()}};export{s as PreviousFrameDataTracker};
@@ -0,0 +1,135 @@
1
+ import { CameraComponent } from '../../components/Camera/CameraComponent';
2
+ import type { ISceneGraphEntity } from '../../helpers/EntityHelper';
3
+ import { Vector2 } from '../../math/Vector2';
4
+ import type { Engine } from '../../system/Engine';
5
+ import type { RenderTargetTexture } from '../../textures/RenderTargetTexture';
6
+ import { Expression } from '../Expression';
7
+ import { RenderPass } from '../RenderPass';
8
+ /**
9
+ * Returns the element of the Halton low-discrepancy sequence with the given index and base.
10
+ *
11
+ * @param index - The index (1 or greater; index 0 returns 0)
12
+ * @param base - The base (2 and 3 for the usual 2D sequence)
13
+ * @returns A value in [0, 1)
14
+ * @internal
15
+ */
16
+ export declare function halton(index: number, base: number): number;
17
+ /**
18
+ * Returns the jitter of the given frame in NDC units: a Halton(2, 3) sub-pixel offset in [-0.5, 0.5) pixels.
19
+ *
20
+ * @param frameIndex - The frame counter
21
+ * @param width - The width of the render target in pixels
22
+ * @param height - The height of the render target in pixels
23
+ * @returns The NDC offset (one pixel is 2 / width horizontally)
24
+ * @internal
25
+ */
26
+ export declare function getTemporalAAJitter(frameIndex: number, width: number, height: number): Vector2;
27
+ /**
28
+ * Temporal anti-aliasing for the ForwardRenderPipeline.
29
+ *
30
+ * @remarks
31
+ * Every frame:
32
+ * 1. `prepareFrame` (before `Engine.process`) moves the projection of the camera by a sub-pixel jitter, and keeps
33
+ * the world matrices, the bone data of the skeletons and the view projection matrix of the previous frame for
34
+ * the motion vectors (the strategies keep the blend shape weights of the previous frame).
35
+ * 2. The motion vector pass renders the opaque primitives with the motion vector material into an RGBA16F target
36
+ * (xy: the motion in texture coordinates, z: the depth).
37
+ * 3. The resolve pass blends the current frame, reconstructed from its 3x3 neighborhood with a filter centered on
38
+ * each pixel, with the history reprojected by the motion vectors (Catmull-Rom history sampling, variance
39
+ * clipping in YCoCg, inverse luminance weighting, a smaller weight of the current frame for pixels that do not
40
+ * move), writes the result into the output target and copies it into the history target.
41
+ *
42
+ * The motion vectors include the motion of skinned and morphed vertices: the motion vector material deforms each
43
+ * vertex a second time with the bone data and the blend shape weights of the previous frame.
44
+ *
45
+ * @internal
46
+ */
47
+ export declare class TemporalAASystem {
48
+ private __engine;
49
+ private __width;
50
+ private __height;
51
+ private __motionVectorFramebuffer;
52
+ private __outputFramebuffer;
53
+ private __historyFramebuffer;
54
+ private __motionVectorMaterial;
55
+ private __resolveMaterial;
56
+ private __linearSampler;
57
+ private __nearestSampler;
58
+ private __motionVectorRenderPass;
59
+ private __resolveRenderPass;
60
+ private __expression;
61
+ private __previousFrameDataTracker;
62
+ private __frameIndex;
63
+ private __isHistoryValid;
64
+ private __historyFrameCount;
65
+ private __lastCamera?;
66
+ private __previousViewProjectionMatrix;
67
+ /**
68
+ * Creates the render targets, the materials and the passes of temporal anti-aliasing.
69
+ *
70
+ * @param engine - The engine instance
71
+ * @param width - The width of the render targets in pixels
72
+ * @param height - The height of the render targets in pixels
73
+ * @param currentColorTexture - The texture of the current (jittered) frame to anti-alias
74
+ */
75
+ constructor(engine: Engine, width: number, height: number, currentColorTexture: RenderTargetTexture);
76
+ /**
77
+ * The expression that renders the motion vectors and resolves the anti-aliasing.
78
+ * It has to run after the scene (opaque and transparent) is rendered into the current color texture.
79
+ */
80
+ get expression(): Expression;
81
+ /** The anti-aliased result (RGBA16F). */
82
+ get outputTexture(): RenderTargetTexture;
83
+ /** The motion vector texture (xy: the motion in texture coordinates, z: the depth). */
84
+ get motionVectorTexture(): RenderTargetTexture;
85
+ /**
86
+ * The weight of the current frame in the exponential blend for pixels that move by a pixel per frame or more
87
+ * (0-1, default 0.1).
88
+ */
89
+ set currentFrameWeight(weight: number);
90
+ get currentFrameWeight(): number;
91
+ /**
92
+ * The weight of the current frame in the exponential blend for pixels that do not move (0-1, default 0.04).
93
+ * Slower pixels interpolate between this weight and `currentFrameWeight`; a value above `currentFrameWeight`
94
+ * is clamped to it.
95
+ */
96
+ set staticFrameWeight(weight: number);
97
+ get staticFrameWeight(): number;
98
+ /**
99
+ * The size of the variance clipping box of the history in standard deviations (default 1). A large value
100
+ * effectively disables the clipping, which makes wrong motion vectors visible as trails (for debugging).
101
+ */
102
+ set varianceClipGamma(gamma: number);
103
+ /** The number of frames prepared since the creation or the last reset of the history. */
104
+ get frameIndex(): number;
105
+ /**
106
+ * Sets the entities whose opaque primitives are rendered into the motion vector target.
107
+ *
108
+ * @param entities - The entities rendered by the main expressions of the pipeline
109
+ */
110
+ setEntities(entities: ISceneGraphEntity[]): void;
111
+ /**
112
+ * Discards the history: the next frame outputs the current frame without blending.
113
+ * Call it when the view changes discontinuously (e.g. a camera cut).
114
+ */
115
+ resetHistory(): void;
116
+ /**
117
+ * Prepares the next frame. Call it once per frame before `Engine.process`.
118
+ *
119
+ * @param camera - The camera of the main render passes
120
+ */
121
+ prepareFrame(camera: CameraComponent | undefined): void;
122
+ /** The number of frames accumulated in the history, as passed to the resolve material in the last frame. */
123
+ get historyFrameCount(): number;
124
+ /**
125
+ * Releases the GPU resources and removes the jitter from the camera.
126
+ */
127
+ destroy3DAPIResources(): void;
128
+ }
129
+ /**
130
+ * Returns the camera used by the given render passes: the camera of the first pass that has one, or the current
131
+ * camera of the engine.
132
+ *
133
+ * @internal
134
+ */
135
+ export declare function _getTemporalAACamera(engine: Engine, renderPasses: readonly RenderPass[]): CameraComponent | undefined;
@@ -0,0 +1 @@
1
+ import{CameraComponent as h}from"../../components/Camera/CameraComponent.js";import{TextureFormat as n}from"../../definitions/TextureFormat.js";import{TextureParameter as s}from"../../definitions/TextureParameter.js";import{createMotionVectorMaterial as d}from"../../helpers/materials/createMotionVectorMaterial.js";import{createTemporalAAResolveMaterial as x}from"../../helpers/materials/createTemporalAAResolveMaterial.js";import{RenderableHelper as p}from"../../helpers/RenderableHelper.js";import{RenderPassHelper as C}from"../../helpers/RenderPassHelper.js";import{MutableMatrix44 as f}from"../../math/MutableMatrix44.js";import{Vector2 as u}from"../../math/Vector2.js";import{Vector4 as v}from"../../math/Vector4.js";import{Sampler as l}from"../../textures/Sampler.js";import{Expression as F}from"../Expression.js";import{RenderPass as R}from"../RenderPass.js";import{PreviousFrameDataTracker as P}from"./PreviousFrameDataTracker.js";var y=8,g=1024;function c(o,e){let t=0,i=1/e,a=o;for(;a>0;)t+=i*(a%e),a=Math.floor(a/e),i/=e;return t}function A(o,e,t){let i=o%y+1,a=c(i,2)-.5,r=c(i,3)-.5;return u.fromCopy2(a*2/e,r*2/t)}var T=class{constructor(e,t,i,a){this.sm=0;this.TT=0;this.lT=new P;this.cT=0;this.oT=!1;this.pT=0;this.dT=f.identity();this.i=e,e._enablePreviousMorphWeights(),this.sm=t,this.TT=i,this.iT=p.createFrameBuffer(e,{width:t,height:i,textureNum:1,textureFormats:[n.RGBA16F],mipLevelCount:1,createDepthBuffer:!0,depthTextureFormat:n.Depth32F}),this.iT.tryToSetUniqueName("TemporalAAMotionVector",!0),this.aT=p.createFrameBuffer(e,{width:t,height:i,textureNum:1,textureFormats:[n.RGBA16F],mipLevelCount:1,createDepthBuffer:!1}),this.aT.tryToSetUniqueName("TemporalAAOutput",!0),this.sT=p.createFrameBuffer(e,{width:t,height:i,textureNum:1,textureFormats:[n.RGBA16F],mipLevelCount:1,createDepthBuffer:!1}),this.sT.tryToSetUniqueName("TemporalAAHistory",!0),this.hT=new l(e,{magFilter:s.Linear,minFilter:s.Linear,wrapS:s.ClampToEdge,wrapT:s.ClampToEdge}),this.hT.create(),this.nT=new l(e,{magFilter:s.Nearest,minFilter:s.Nearest,wrapS:s.ClampToEdge,wrapT:s.ClampToEdge}),this.nT.create(),this.mT=d(e);let r=new R(e);r.tryToSetUniqueName("TemporalAAMotionVector",!0),r.clearColor=v.fromCopy4(0,0,1,0),r.toClearColorBuffer=!0,r.toClearDepthBuffer=!0,r.isVrRendering=!1,r.isOutputForVr=!1,r.setToRenderOpaquePrimitives(!0),r.setToRenderBlendWithZWritePrimitives(!0),r.setToRenderBlendWithoutZWritePrimitives(!1),r.setToRenderTranslucentPrimitives(!1),r.setFramebuffer(this.iT),r.setMaterial(this.mT),this.fT=r,this.tT=x(e),this.tT.setParameter("framebufferSize",u.fromCopy2(t,i)),this.tT.setTextureParameter("historyTexture",this.sT.getColorAttachedRenderTargetTexture(0),this.hT),this.tT.setTextureParameter("velocityTexture",this.iT.getColorAttachedRenderTargetTexture(0),this.nT);let m=C.createScreenDrawRenderPassWithBaseColorTexture(e,this.tT,a,this.nT);m.tryToSetUniqueName("TemporalAAResolve",!0),m.isVrRendering=!1,m.isOutputForVr=!1,m.setFramebuffer(this.aT),m.setResolveFramebuffer2(this.sT),this.xT=m,this.uT=new F,this.uT.tryToSetUniqueName("TemporalAA",!0),this.uT.addRenderPasses([r,m])}get expression(){return this.uT}get outputTexture(){return this.aT.getColorAttachedRenderTargetTexture(0)}get motionVectorTexture(){return this.iT.getColorAttachedRenderTargetTexture(0)}set currentFrameWeight(e){this.tT.setParameter("currentFrameWeight",e)}get currentFrameWeight(){return this.tT.getParameter("currentFrameWeight")._v[0]}set staticFrameWeight(e){this.tT.setParameter("staticFrameWeight",e)}get staticFrameWeight(){return this.tT.getParameter("staticFrameWeight")._v[0]}set varianceClipGamma(e){this.tT.setParameter("varianceClipGamma",e)}get frameIndex(){return this.cT}setEntities(e){this.fT.clearEntities(),this.fT.addEntities(e),this.lT.setEntities(e)}resetHistory(){this.oT=!1}prepareFrame(e){if(e==null)return;e!==this.rT&&(this.rT!=null&&(this.rT.jitterOffset=u.zero()),this.rT=e,this.oT=!1),f.multiplyTo(e.projectionMatrixWithoutJitter,e.viewMatrix,this.dT),this.mT.setParameter("previousViewProjectionMatrix",this.dT);let t=A(this.cT,this.sm,this.TT);e.jitterOffset=t,this.mT.setParameter("currentJitter",t),this.tT.setParameter("currentJitter",t),this.cT++,this.lT.update()&&this.i._markGpuInstanceDataDirty(),this.oT||(this.pT=0),this.tT.setParameter("isHistoryValid",this.oT),this.tT.setParameter("historyFrameCount",this.pT),this.oT=!0,this.pT=Math.min(this.pT+1,g)}get historyFrameCount(){return this.tT.getParameter("historyFrameCount")._v[0]}destroy3DAPIResources(){this.rT!=null&&(this.rT.jitterOffset=u.zero(),this.rT=void 0),this.iT.destroy3DAPIResources(),this.aT.destroy3DAPIResources(),this.sT.destroy3DAPIResources(),this.lT.clear()}};function H(o,e){for(let t of e)if(t.cameraComponent!=null)return t.cameraComponent;return o.componentRepository.getComponent(h,h.getCurrent(o))}export{T as TemporalAASystem,H as _getTemporalAACamera,A as getTemporalAAJitter,c as halton};
@@ -1 +1 @@
1
- import{RnObject as i}from"../../core/RnObject.js";var t=class extends i{constructor(){super(...arguments);this.sm=0;this.Xx=0;this.pp=[]}async setup(s,p){this.sm=s,this.Xx=p}setExpressions(s){this.pp=s}};export{t as DeferredRenderPipeline};
1
+ import{RnObject as i}from"../../core/RnObject.js";var t=class extends i{constructor(){super(...arguments);this.sm=0;this.TT=0;this.hp=[]}async setup(s,p){this.sm=s,this.TT=p}setExpressions(s){this.hp=s}};export{t as DeferredRenderPipeline};
@@ -22,32 +22,33 @@ import { Frame } from '../Frame';
22
22
  * @example
23
23
  * ```typescript
24
24
  * const expressions = [...];
25
- * const matrix = [...];
26
25
  *
27
26
  * // Create and setup the render pipeline
28
- * const forwardRenderPipeline = new Rn.ForwardRenderPipeline();
27
+ * const forwardRenderPipeline = new Rn.ForwardRenderPipeline(engine);
29
28
  * await forwardRenderPipeline.setup(1024, 1024, {isShadow: true, isBloom: true});
30
29
  *
31
30
  * // Configure expressions and IBL
32
31
  * forwardRenderPipeline.setExpressions(expressions);
33
32
  *
34
- * const diffuseCubeTexture = new Rn.CubeTexture();
35
- * diffuseCubeTexture.baseUriToLoad = './../../../assets/ibl/papermill/diffuse/diffuse';
36
- * diffuseCubeTexture.isNamePosNeg = true;
37
- * diffuseCubeTexture.hdriFormat = Rn.HdriFormat.RGBE_PNG;
38
- * diffuseCubeTexture.mipmapLevelNumber = 1;
33
+ * const diffuseCubeTexture = await Rn.CubeTexture.loadFromUrl(engine, {
34
+ * baseUrl: './../../../assets/ibl/papermill/diffuse/diffuse',
35
+ * mipmapLevelNumber: 1,
36
+ * isNamePosNeg: true,
37
+ * hdriFormat: Rn.HdriFormat.RGBE_PNG,
38
+ * });
39
39
  *
40
- * const specularCubeTexture = new Rn.CubeTexture();
41
- * specularCubeTexture.baseUriToLoad = './../../../assets/ibl/papermill/specular/specular';
42
- * specularCubeTexture.isNamePosNeg = true;
43
- * specularCubeTexture.hdriFormat = Rn.HdriFormat.RGBE_PNG;
44
- * specularCubeTexture.mipmapLevelNumber = 10;
40
+ * const specularCubeTexture = await Rn.CubeTexture.loadFromUrl(engine, {
41
+ * baseUrl: './../../../assets/ibl/papermill/specular/specular',
42
+ * mipmapLevelNumber: 10,
43
+ * isNamePosNeg: true,
44
+ * hdriFormat: Rn.HdriFormat.RGBE_PNG,
45
+ * });
45
46
  *
46
47
  * forwardRenderPipeline.setIBLTextures(diffuseCubeTexture, specularCubeTexture);
47
48
  *
48
49
  * // Start the render loop
49
50
  * forwardRenderPipeline.startRenderLoop((frame) => {
50
- * Rn.Engine.process(frame);
51
+ * engine.process(frame);
51
52
  * });
52
53
  * ```
53
54
  */
@@ -57,6 +58,8 @@ export declare class ForwardRenderPipeline extends RnObject {
57
58
  private __isShadow;
58
59
  private __isBloom;
59
60
  private __isSimple;
61
+ private __isTemporalAA;
62
+ private __temporalAA?;
60
63
  private __shadowMapSize;
61
64
  private __frame?;
62
65
  private __frameBufferMultiView?;
@@ -132,6 +135,9 @@ export declare class ForwardRenderPipeline extends RnObject {
132
135
  * @param options.isBloom - Whether to enable bloom post-processing effect (default: false)
133
136
  * @param options.shadowMapSize - Size of the shadow map texture in pixels (default: 1024)
134
137
  * @param options.isSimple - Whether to use simplified rendering without post-processing (default: false)
138
+ * @param options.isTemporalAA - Whether to enable temporal anti-aliasing (default: false). It replaces the 4x MSAA
139
+ * of the main render target: the camera projection is jittered by a sub-pixel offset every frame, and the frames
140
+ * are accumulated with motion vectors. Ignored in the simple mode and for WebXR multi-view rendering.
135
141
  *
136
142
  * @returns A Result indicating success or failure of the setup operation
137
143
  *
@@ -155,10 +161,11 @@ export declare class ForwardRenderPipeline extends RnObject {
155
161
  * }
156
162
  * ```
157
163
  */
158
- setup(canvasWidth: number, canvasHeight: number, { isShadow, isBloom, shadowMapSize, isSimple }?: {
164
+ setup(canvasWidth: number, canvasHeight: number, { isShadow, isBloom, shadowMapSize, isSimple, isTemporalAA }?: {
159
165
  isBloom?: boolean | undefined;
160
166
  isShadow?: boolean | undefined;
161
167
  isSimple?: boolean | undefined;
168
+ isTemporalAA?: boolean | undefined;
162
169
  shadowMapSize?: number | undefined;
163
170
  }): Promise<Err<unknown, undefined> | Ok<unknown, unknown>>;
164
171
  /**
@@ -185,6 +192,11 @@ export declare class ForwardRenderPipeline extends RnObject {
185
192
  * @internal
186
193
  */
187
194
  private __getMainFrameBuffer;
195
+ /**
196
+ * Whether temporal anti-aliasing is used: requested in setup, not in the simple mode, and not in WebXR mode
197
+ * (the eye cameras are not jittered, and stereo rendering keeps MSAA).
198
+ */
199
+ private __isTemporalAAActive;
188
200
  /**
189
201
  * Sets the expressions to be rendered by the pipeline.
190
202
  *
@@ -227,7 +239,7 @@ export declare class ForwardRenderPipeline extends RnObject {
227
239
  * ```typescript
228
240
  * const result = pipeline.startRenderLoop((frame) => {
229
241
  * // Update scene
230
- * Rn.Engine.process(frame);
242
+ * engine.process(frame);
231
243
  *
232
244
  * // Custom per-frame logic
233
245
  * updateAnimations();
@@ -235,7 +247,7 @@ export declare class ForwardRenderPipeline extends RnObject {
235
247
  * });
236
248
  *
237
249
  * if (result.isErr()) {
238
- * console.error('Failed to start render loop:', result.getErr());
250
+ * console.error('Failed to start render loop:', result.getRnError());
239
251
  * }
240
252
  * ```
241
253
  */
@@ -254,6 +266,40 @@ export declare class ForwardRenderPipeline extends RnObject {
254
266
  * ```
255
267
  */
256
268
  draw(): void;
269
+ /**
270
+ * Whether temporal anti-aliasing is enabled (requested in setup and supported by the current render targets).
271
+ */
272
+ get isTemporalAA(): boolean;
273
+ /**
274
+ * Discards the accumulated history of temporal anti-aliasing, so that the next frame does not blend with the
275
+ * previous frames. Call it when the view changes discontinuously (e.g. a camera cut).
276
+ */
277
+ resetTemporalAAHistory(): void;
278
+ /**
279
+ * The weight of the current frame in the temporal anti-aliasing blend for pixels that move by a pixel per frame
280
+ * or more (0-1, default 0.1). Larger values react faster to changes and smooth less.
281
+ */
282
+ set temporalAACurrentFrameWeight(weight: number);
283
+ get temporalAACurrentFrameWeight(): number;
284
+ /**
285
+ * The weight of the current frame in the temporal anti-aliasing blend for pixels that do not move (0-1, default
286
+ * 0.04). Smaller values average more frames of the jitter sequence, which steadies the edges of still images;
287
+ * slower pixels interpolate between this weight and {@link ForwardRenderPipeline.temporalAACurrentFrameWeight}.
288
+ */
289
+ set temporalAAStaticFrameWeight(weight: number);
290
+ get temporalAAStaticFrameWeight(): number;
291
+ /**
292
+ * Sets the size of the variance clipping box of the temporal anti-aliasing history in standard deviations
293
+ * (default 1). A large value effectively disables the clipping, which makes wrong motion vectors visible as
294
+ * trails. For debugging.
295
+ *
296
+ * @internal
297
+ */
298
+ _setTemporalAAVarianceClipGamma(gamma: number): void;
299
+ /**
300
+ * Jitters the camera and keeps the previous frame state for temporal anti-aliasing. Runs before Engine.process.
301
+ */
302
+ private __prepareTemporalAAFrame;
257
303
  /**
258
304
  * Requests a refresh of the shadow map expressions on the next frame.
259
305
  * This is useful when materials with shadow support have been changed or added
@@ -307,7 +353,8 @@ export declare class ForwardRenderPipeline extends RnObject {
307
353
  * The diffuse texture provides ambient lighting, while the specular texture provides
308
354
  * reflections and specular highlights.
309
355
  *
310
- * The sheen texture is optional and used for materials with fabric-like properties.
356
+ * The sheen texture is optional and used for materials with fabric-like properties. Omitting it clears
357
+ * a previously set sheen texture, so switching to an IBL without sheen falls back to the specular cube.
311
358
  *
312
359
  * @example
313
360
  * ```typescript