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,36 +1,54 @@
1
- import{AnimationComponent as re}from"../foundation/components/Animation/AnimationComponent.js";import{BlendShapeComponent as O}from"../foundation/components/BlendShape/BlendShapeComponent.js";import{CameraComponent as k}from"../foundation/components/Camera/CameraComponent.js";import{_getCameraControllerUpdateCount as q}from"../foundation/components/CameraController/CameraControllerUpdateCount.js";import{LightComponent as z}from"../foundation/components/Light/LightComponent.js";import{MeshComponent as ne}from"../foundation/components/Mesh/MeshComponent.js";import{MeshRendererComponent as H}from"../foundation/components/MeshRenderer/MeshRendererComponent.js";import{SceneGraphComponent as J}from"../foundation/components/SceneGraph/SceneGraphComponent.js";import{TransformComponent as Q}from"../foundation/components/Transform/TransformComponent.js";import{WellKnownComponentTIDs as N}from"../foundation/components/WellKnownComponentTIDs.js";import{Component as P}from"../foundation/core/Component.js";import{BufferUse as $}from"../foundation/definitions/BufferUse.js";import{ComponentType as T}from"../foundation/definitions/ComponentType.js";import{CompositionType as g}from"../foundation/definitions/CompositionType.js";import{PixelFormat as j}from"../foundation/definitions/PixelFormat.js";import{ShaderType as X}from"../foundation/definitions/ShaderType.js";import{TextureFormat as ae}from"../foundation/definitions/TextureFormat.js";import{VertexAttribute as E}from"../foundation/definitions/VertexAttribute.js";import{Primitive as U}from"../foundation/geometry/Primitive.js";import{Logger as ee}from"../foundation/misc/Logger.js";import{MiscUtil as oe}from"../foundation/misc/MiscUtil.js";import{CGAPIResourceRepository as v}from"../foundation/renderer/CGAPIResourceRepository.js";import{subtractByteRanges as se}from"../foundation/renderer/lightCluster/LightClusterLayout.js";import{isSkipDrawing as te}from"../foundation/renderer/RenderingCommonMethods.js";import{getMultiDrawStateKeyId as ce,getPrimitiveMeshRendererFingerPrintId as le,planMultiDrawRunsInto as fe}from"./MultiDraw.js";import V,{setupShaderProgram as Y}from"./WebGLStrategyCommonMethod.js";var B=class B{constructor(t){this.__dataTextureUid=v.InvalidCGAPIResourceUid;this.bI=v.InvalidCGAPIResourceUid;this.gI=v.InvalidCGAPIResourceUid;this.yI=v.InvalidCGAPIResourceUid;this.II=v.InvalidCGAPIResourceUid;this.$I=-1;this.IC=-1;this.vI=1;this.SC={starts:new Int32Array(0),counts:new Int32Array(0),keys:new Int32Array(0),count:0};this.SI=0;this.BI=0;this.UI=0;this.RI=0;this.CI=0;this.GI=0;this._totalSizeOfGPUShaderDataStorageExceptMorphData=0;this.FI=-1;this.zI=-1;this.HI=-1;this.jI=-1;this.er=-1;this.XI=-1;this.tr=-1;this.YI=-1;this.kb=-1;this.rr=-1;this.ZI=-1;this.PI=-1;this.KI=-1;this.qI=-1;this.i=t,this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)}static dumpDataTextureBuffer(){this.DI=!1}static JI(t,e){let i="";return P.getMemberInfo(t).forEach((r,c)=>{r.forEach((s,p)=>{var d;if(s.shaderType!==e&&s.shaderType!==X.VertexAndPixelShader)return;let l=(d=P.getComponentCountPerBufferView(t).get(c))!=null?d:1;g.isArray(s.compositionType)?a(s,c,p,l):o(s,c,p,l)})}),i;function a(r,c,s,p){var I,y;let l="",d="";switch(r.compositionType){case g.Vec4Array:l="vec4",d="fetchVec4";break;case g.Mat4Array:l="mat4",d="fetchMat4";break;case g.Mat4x3Array:l="mat4x3",d="fetchMat4x3";break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let m=r.compositionType.getVec4SizeOfProperty();if(r.isVariableLength===!0){let A=P._variableLengthLocationRadix;i+=`
1
+ import{AnimationComponent as re}from"../foundation/components/Animation/AnimationComponent.js";import{BlendShapeComponent as D}from"../foundation/components/BlendShape/BlendShapeComponent.js";import{CameraComponent as k}from"../foundation/components/Camera/CameraComponent.js";import{_getCameraControllerUpdateCount as K}from"../foundation/components/CameraController/CameraControllerUpdateCount.js";import{LightComponent as z}from"../foundation/components/Light/LightComponent.js";import{MeshComponent as ne}from"../foundation/components/Mesh/MeshComponent.js";import{MeshRendererComponent as H}from"../foundation/components/MeshRenderer/MeshRendererComponent.js";import{SceneGraphComponent as q}from"../foundation/components/SceneGraph/SceneGraphComponent.js";import{TransformComponent as J}from"../foundation/components/Transform/TransformComponent.js";import{WellKnownComponentTIDs as N}from"../foundation/components/WellKnownComponentTIDs.js";import{Component as w}from"../foundation/core/Component.js";import{BufferUse as V}from"../foundation/definitions/BufferUse.js";import{ComponentType as C}from"../foundation/definitions/ComponentType.js";import{CompositionType as p}from"../foundation/definitions/CompositionType.js";import{PixelFormat as Q}from"../foundation/definitions/PixelFormat.js";import{ShaderType as j}from"../foundation/definitions/ShaderType.js";import{TextureFormat as ae}from"../foundation/definitions/TextureFormat.js";import{VertexAttribute as $}from"../foundation/definitions/VertexAttribute.js";import{Primitive as A}from"../foundation/geometry/Primitive.js";import{Logger as ee}from"../foundation/misc/Logger.js";import{CGAPIResourceRepository as I}from"../foundation/renderer/CGAPIResourceRepository.js";import{subtractByteRanges as oe}from"../foundation/renderer/lightCluster/LightClusterLayout.js";import{isSkipDrawing as te}from"../foundation/renderer/RenderingCommonMethods.js";import{getMultiDrawStateKeyId as se,getPrimitiveMeshRendererFingerPrintId as ce,planMultiDrawRunsInto as le}from"./MultiDraw.js";import L,{setupShaderProgram as X}from"./WebGLStrategyCommonMethod.js";var ie=class P{constructor(t){this.__dataTextureUid=I.InvalidCGAPIResourceUid;this.bI=I.InvalidCGAPIResourceUid;this.gI=I.InvalidCGAPIResourceUid;this.yI=I.InvalidCGAPIResourceUid;this.SI=I.InvalidCGAPIResourceUid;this.kI=-1;this.S_=-1;this.vI=1;this.M_={starts:new Int32Array(0),counts:new Int32Array(0),keys:new Int32Array(0),count:0};this.RI=0;this.DI=0;this.PI=0;this._I=0;this.MI=0;this.GI=0;this._totalSizeOfGPUShaderDataStorageExceptMorphData=0;this.OI=0;this.VI=!0;this.HI=-1;this.jI=-1;this.XI=-1;this.YI=-1;this.or=-1;this.ZI=-1;this.KI=-1;this.nr=-1;this.qI=-1;this.dC=-1;this.sr=-1;this.JI=-1;this.LI=-1;this.QI=-1;this.LS=-1;this.i=t,this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)}static zS(t,e){let i="";return w.getMemberInfo(t).forEach((r,c)=>{r.forEach((s,m)=>{var d;if(s.shaderType!==e&&s.shaderType!==j.VertexAndPixelShader)return;let l=(d=w.getComponentCountPerBufferView(t).get(c))!=null?d:1;p.isArray(s.compositionType)?a(s,c,m,l):o(s,c,m,l)})}),i;function a(r,c,s,m){var b,y;let l="",d="";switch(r.compositionType){case p.Vec4Array:l="vec4",d="fetchVec4";break;case p.Mat4Array:l="mat4",d="fetchMat4";break;case p.Mat4x3Array:l="mat4x3",d="fetchMat4x3";break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let h=r.compositionType.getVec4SizeOfProperty();if(r.isVariableLength===!0){let B=w._variableLengthLocationRadix;i+=`
2
2
  ${l} get_${s}(uint instanceId, uint idxOfArray) {
3
- vec4 location = get_${P._getVariableLengthLocationMemberName(s)}(instanceId);
4
- int index = int(location.x) * ${A} + int(location.y) + ${m} * int(idxOfArray);
3
+ vec4 location = get_${w._getVariableLengthLocationMemberName(s)}(instanceId);
4
+ int index = int(location.x) * ${B} + int(location.y) + ${h} * int(idxOfArray);
5
5
  ${l} value = ${d}(index);
6
6
  return value;
7
7
  }
8
- `;return}let f=P.getLocationOffsetOfMemberOfComponent(t,c,s),b=`int arrayLength = ${(y=((I=P.getArrayLengthOfMember(t).get(c))!=null?I:new Map).get(s))!=null?y:0};`,u=`rnIndices_${s}`,R=`int index = ${u}[instanceIdOfBufferViews] + int(instanceIdInBufferView) * ${m} * arrayLength + ${m} * int(idxOfArray);`,C="";r.convertToBool&&(C="return (value > 0.5) ? true : false;"),i+=`
8
+ `;return}let f=w.getLocationOffsetOfMemberOfComponent(t,c,s),v=`int arrayLength = ${(y=((b=w.getArrayLengthOfMember(t).get(c))!=null?b:new Map).get(s))!=null?y:0};`,u=`rnIndices_${s}`,R=`int index = ${u}[instanceIdOfBufferViews] + int(instanceIdInBufferView) * ${h} * arrayLength + ${h} * int(idxOfArray);`,S="";r.convertToBool&&(S="return (value > 0.5) ? true : false;"),i+=`
9
9
  const int ${u}[${f.length}] = int[${f.length}](${f.join(", ")});
10
10
  ${r.convertToBool?"bool":l} get_${s}(uint instanceId, uint idxOfArray) {
11
- uint instanceIdOfBufferViews = instanceId / ${p}u;
12
- uint instanceIdInBufferView = instanceId % ${p}u;
13
- ${b}
11
+ uint instanceIdOfBufferViews = instanceId / ${m}u;
12
+ uint instanceIdInBufferView = instanceId % ${m}u;
13
+ ${v}
14
14
  ${R}
15
15
  ${l} value = ${d}(index);
16
- ${r.convertToBool?C:"return value;"}
16
+ ${r.convertToBool?S:"return value;"}
17
17
  }
18
- `}function o(r,c,s,p){let l="",d="";switch(r.compositionType){case g.Mat4:l="mat4",d="fetchMat4";break;case g.Mat3:l="mat3",d="fetchMat3No16BytesAligned";break;case g.Vec4:l="vec4",d="fetchVec4";break;case g.Vec3:l="vec3",d="fetchVec3No16BytesAligned";break;case g.Scalar:l="float",d="fetchScalarNo16BytesAligned";break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let m=P.getLocationOffsetOfMemberOfComponent(t,c,s),f=`rnIndices_${s}`,h="";switch(r.compositionType){case g.Mat4:h=`int index = ${f}[instanceIdOfBufferViews] + 4 * int(instanceIdInBufferView);`;break;case g.Mat3:h=`int index = ${f}[instanceIdOfBufferViews] * 4 + 9 * int(instanceIdInBufferView);`;break;case g.Vec4:h=`int index = ${f}[instanceIdOfBufferViews] + 1 * int(instanceIdInBufferView);`;break;case g.Vec3:h=`int index = ${f}[instanceIdOfBufferViews] * 4 + 3 * int(instanceIdInBufferView);`;break;case g.Scalar:h=`int index = ${f}[instanceIdOfBufferViews] * 4 + 1 * int(instanceIdInBufferView);`;break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let x="";r.convertToBool&&(x="return (value > 0.5) ? true : false;"),i+=`
19
- const int ${f}[${m.length}] = int[${m.length}](${m.join(", ")});
18
+ `}function o(r,c,s,m){let l="",d="";switch(r.compositionType){case p.Mat4:l="mat4",d="fetchMat4";break;case p.Mat3:l="mat3",d="fetchMat3No16BytesAligned";break;case p.Vec4:l="vec4",d="fetchVec4";break;case p.Vec3:l="vec3",d="fetchVec3No16BytesAligned";break;case p.Scalar:l="float",d="fetchScalarNo16BytesAligned";break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let h=w.getLocationOffsetOfMemberOfComponent(t,c,s),f=`rnIndices_${s}`,g="";switch(r.compositionType){case p.Mat4:g=`int index = ${f}[instanceIdOfBufferViews] + 4 * int(instanceIdInBufferView);`;break;case p.Mat3:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 9 * int(instanceIdInBufferView);`;break;case p.Vec4:g=`int index = ${f}[instanceIdOfBufferViews] + 1 * int(instanceIdInBufferView);`;break;case p.Vec3:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 3 * int(instanceIdInBufferView);`;break;case p.Scalar:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 1 * int(instanceIdInBufferView);`;break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let x="";r.convertToBool&&(x="return (value > 0.5) ? true : false;"),i+=`
19
+ const int ${f}[${h.length}] = int[${h.length}](${h.join(", ")});
20
20
  ${r.convertToBool?"bool":l} get_${s}(uint instanceId) {
21
- uint instanceIdOfBufferViews = instanceId / ${p}u;
22
- uint instanceIdInBufferView = instanceId % ${p}u;
23
- ${h}
21
+ uint instanceIdOfBufferViews = instanceId / ${m}u;
22
+ uint instanceIdInBufferView = instanceId % ${m}u;
23
+ ${g}
24
24
  ${l} value = ${d}(index);
25
25
  ${r.convertToBool?x:"return value;"}
26
26
  }
27
- `}}static MC(t){let e=U.getMorphUniformDataTargetNumbers(),i=`
27
+ `}}static C_(t){let e=A.getMorphUniformDataTargetNumbers(),i=`
28
28
  const int rnMorphUniformDataTargetNumbers[${e.length}] = int[${e.length}](${e.join(", ")});
29
- `,n=U.getMorphUniformDataOffsets(),a=`
29
+ `,n=A.getMorphUniformDataOffsets(),a=`
30
30
  const int rnMorphUniformDataOffsets[${n.length}] = int[${n.length}](${n.join(", ")});
31
- `,o=O.getOffsetsInUniform(t),r=`
31
+ `,o=D.getOffsetsInUniform(t),r=`
32
32
  const int rnBlendShapeUniformDataOffsets[${o.length}] = int[${o.length}](${o.join(", ")});
33
- `;return`
33
+ `,c=t._isPreviousMorphWeightsEnabled?`
34
+ vec3 get_previousMorphedPosition(uint vertexId, vec3 basePosition, uint blendShapeComponentSID) {
35
+ int currentPrimitiveIdx = u_currentPrimitiveIdx;
36
+ int offsetInUniform = rnMorphUniformDataOffsets[currentPrimitiveIdx];
37
+ int offsetInUniform2 = rnBlendShapeUniformDataOffsets[blendShapeComponentSID] + ${D._getPreviousMorphWeightsOffset(t)};
38
+ vec3 position = basePosition;
39
+ int scalar_idx = 3 * int(vertexId);
40
+ for (int i=0; i<rnMorphUniformDataTargetNumbers[currentPrimitiveIdx]; i++) {
41
+ int idx = offsetInUniform + i;
42
+ ivec4 offsets = uniformMorphOffsets.data[ idx / 4];
43
+ int offsetPosition = offsets[idx % 4];
44
+ int basePosIn4bytes = offsetPosition * 4 + scalar_idx;
45
+ vec3 addPos = fetchVec3No16BytesAligned(basePosIn4bytes);
46
+ int idx2 = offsetInUniform2 + i;
47
+ vec4 morphWeights = uniformMorphWeights.data[ idx2 / 4];
48
+ position += addPos * morphWeights[idx2 % 4];
49
+ }
50
+ return position;
51
+ }`:"";return`
34
52
  #ifdef RN_IS_VERTEX_SHADER
35
53
  #ifdef RN_IS_MORPHING
36
54
  ${i}
@@ -59,31 +77,32 @@ import{AnimationComponent as re}from"../foundation/components/Animation/Animatio
59
77
 
60
78
  return position;
61
79
  }
80
+ ${c}
62
81
  #endif
63
82
  #endif
64
- `}setupShaderForMaterial(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper,[a,o]=t._createProgramWebGL(this.i,B.JI(this.i,X.VertexShader),B.JI(this.i,X.PixelShader),B._C,B.AC,B.MC(this.i),e);return o&&(t._setupBasicUniformsLocations(e),t._setUniformLocationsOfMaterialNodes(e),t._setupAdditionalUniformLocations(V.getPointSpriteShaderSemanticsInfoArray(),e),this.i.globalDataRepository._setUniformLocationsForWebGL2ModeOnly(t.getShaderProgramUid(e)),i.setUniformBlockBindingForMorphOffsetsAndWeights(a,this.gI,this.yI)),a}_reSetupShaderForMaterialBySpector(t,e,i,n){let[a,o]=t._createProgramByUpdatedSources(i,e,n);return a===v.InvalidCGAPIResourceUid||(o&&(t._setupBasicUniformsLocations(e),t._setUniformLocationsOfMaterialNodes(e),t._setupAdditionalUniformLocations(V.getPointSpriteShaderSemanticsInfoArray(),e)),this.i.globalDataRepository._setUniformLocationsForWebGL2ModeOnly(t.getShaderProgramUid(e))),a}static _C(t,e){var x,b;let i=e.compositionType.getGlslStr(e.componentType),n,a=g.isTexture(e.compositionType),o=e.semantic.replace(".","_"),r="",c=e.compositionType.getGlslStr(e.componentType),s="";e.arrayLength&&(s=`[${e.arrayLength}]`),(e.needUniformInDataTextureMode||a)&&(r=` uniform ${c} u_${o}${s};
65
- `);let p=e.compositionType.getVec4SizeOfProperty(),l=e.compositionType.getNumberOfComponents(),d=B.getOffsetOfPropertyOfGlobalDataRepository(t,e.semantic);d===-1&&ee.default.error("Could not get the location offset of the property.");let m=p;if(n=`int vec4_idx = ${d} + ${m} * instanceId;
66
- `,g.isArray(e.compositionType)){m=p*((x=e.arrayLength)!=null?x:1);let R=Math.ceil(l/4)*4*((b=e.arrayLength)!=null?b:1);n=`int vec4_idx = ${d} + ${m} * instanceId + ${p} * int(idxOfArray);
83
+ `}setupShaderForMaterial(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper,[a,o]=t._createProgramWebGL(this.i,P.zS(this.i,j.VertexShader),P.zS(this.i,j.PixelShader),P.A_,P.B_,P.C_(this.i),e);return o&&(t._setupBasicUniformsLocations(e),t._setUniformLocationsOfMaterialNodes(e),t._setupAdditionalUniformLocations(L.getPointSpriteShaderSemanticsInfoArray(),e),this.i.globalDataRepository._setUniformLocationsForWebGL2ModeOnly(t.getShaderProgramUid(e)),i.setUniformBlockBindingForMorphOffsetsAndWeights(a,this.gI,this.yI)),a}_reSetupShaderForMaterialBySpector(t,e,i,n){let[a,o]=t._createProgramByUpdatedSources(i,e,n);return a===I.InvalidCGAPIResourceUid||(o&&(t._setupBasicUniformsLocations(e),t._setUniformLocationsOfMaterialNodes(e),t._setupAdditionalUniformLocations(L.getPointSpriteShaderSemanticsInfoArray(),e)),this.i.globalDataRepository._setUniformLocationsForWebGL2ModeOnly(t.getShaderProgramUid(e))),a}static A_(t,e){var x,v;let i=e.compositionType.getGlslStr(e.componentType),n,a=p.isTexture(e.compositionType),o=e.semantic.replace(".","_"),r="",c=e.compositionType.getGlslStr(e.componentType),s="";e.arrayLength&&(s=`[${e.arrayLength}]`),(e.needUniformInDataTextureMode||a)&&(r=` uniform ${c} u_${o}${s};
84
+ `);let m=e.compositionType.getVec4SizeOfProperty(),l=e.compositionType.getNumberOfComponents(),d=P.getOffsetOfPropertyOfGlobalDataRepository(t,e.semantic);d===-1&&ee.default.error("Could not get the location offset of the property.");let h=m;if(n=`int vec4_idx = ${d} + ${h} * instanceId;
85
+ `,p.isArray(e.compositionType)){h=m*((x=e.arrayLength)!=null?x:1);let R=Math.ceil(l/4)*4*((v=e.arrayLength)!=null?v:1);n=`int vec4_idx = ${d} + ${h} * instanceId + ${m} * int(idxOfArray);
67
86
  `,n+=`int scalar_idx = ${d*4} + ${R} * instanceId + ${l} * int(idxOfArray);
68
- `}let f="";e.componentType===T.Int&&e.compositionType!==g.Scalar&&(f="i");let h="";if(!a&&!e.needUniformInDataTextureMode){h+=`
87
+ `}let f="";e.componentType===C.Int&&e.compositionType!==p.Scalar&&(f="i");let g="";if(!a&&!e.needUniformInDataTextureMode){g+=`
69
88
  ${i} get_${o}(highp uint _instanceId, const uint idxOfArray) {
70
89
  int instanceId = int(_instanceId);
71
90
  ${n}
72
91
  `;let u=`${r}
73
- ${h}`;switch(e.compositionType){case g.Vec4:case g.Vec4Array:u+=` highp vec4 val = fetchElement(vec4_idx);
74
- `;break;case g.Vec3:u+=` vec4 col0 = fetchElement(vec4_idx);
75
- `,u+=` highp ${f}vec3 val = ${f}vec3(col0.xyz);`;break;case g.Vec3Array:u+=` vec3 val = fetchVec3No16BytesAligned(scalar_idx);
76
- `;break;case g.Vec2:u+=` highp vec4 col0 = fetchElement(vec4_idx);
77
- `,u+=` highp ${f}vec2 val = ${f}vec2(col0.xy);`;break;case g.Vec2Array:u+=` highp vec2 val = fetchVec2No16BytesAligned(scalar_idx);
78
- `;break;case g.Scalar:u+=` vec4 col0 = fetchElement(vec4_idx);
79
- `,e.componentType===T.Int?u+=" int val = int(col0.x);":e.componentType===T.Bool?u+=" bool val = bool(col0.x);":u+=" float val = col0.x;";break;case g.ScalarArray:u+=` float col0 = fetchScalarNo16BytesAligned(scalar_idx);
80
- `,e.componentType===T.Int?u+=" int val = int(col0);":e.componentType===T.Bool?u+=" bool val = bool(col0);":u+=" float val = col0;";break;case g.Mat4:u+=` mat4 val = fetchMat4(vec4_idx);
81
- `;break;case g.Mat4Array:u+=` mat4 val = fetchMat4(vec4_idx);
82
- `;break;case g.Mat3:u+=` mat3 val = fetchMat3(vec4_idx);
83
- `;break;case g.Mat3Array:u+=` mat3 val = fetchMat3No16BytesAligned(scalar_idx);
84
- `;break;case g.Mat2:u+=` mat2 val = fetchMat2(vec4_idx);
85
- `;break;case g.Mat2Array:u+=` mat2 val = fetchMat2No16BytesAligned(scalar_idx);
86
- `;break;case g.Mat4x3Array:u+=` mat4x3 val = fetchMat4x3(vec4_idx);
92
+ ${g}`;switch(e.compositionType){case p.Vec4:case p.Vec4Array:u+=` highp vec4 val = fetchElement(vec4_idx);
93
+ `;break;case p.Vec3:u+=` vec4 col0 = fetchElement(vec4_idx);
94
+ `,u+=` highp ${f}vec3 val = ${f}vec3(col0.xyz);`;break;case p.Vec3Array:u+=` vec3 val = fetchVec3No16BytesAligned(scalar_idx);
95
+ `;break;case p.Vec2:u+=` highp vec4 col0 = fetchElement(vec4_idx);
96
+ `,u+=` highp ${f}vec2 val = ${f}vec2(col0.xy);`;break;case p.Vec2Array:u+=` highp vec2 val = fetchVec2No16BytesAligned(scalar_idx);
97
+ `;break;case p.Scalar:u+=` vec4 col0 = fetchElement(vec4_idx);
98
+ `,e.componentType===C.Int?u+=" int val = int(col0.x);":e.componentType===C.Bool?u+=" bool val = bool(col0.x);":u+=" float val = col0.x;";break;case p.ScalarArray:u+=` float col0 = fetchScalarNo16BytesAligned(scalar_idx);
99
+ `,e.componentType===C.Int?u+=" int val = int(col0);":e.componentType===C.Bool?u+=" bool val = bool(col0);":u+=" float val = col0;";break;case p.Mat4:u+=` mat4 val = fetchMat4(vec4_idx);
100
+ `;break;case p.Mat4Array:u+=` mat4 val = fetchMat4(vec4_idx);
101
+ `;break;case p.Mat3:u+=` mat3 val = fetchMat3(vec4_idx);
102
+ `;break;case p.Mat3Array:u+=` mat3 val = fetchMat3No16BytesAligned(scalar_idx);
103
+ `;break;case p.Mat2:u+=` mat2 val = fetchMat2(vec4_idx);
104
+ `;break;case p.Mat2Array:u+=` mat2 val = fetchMat2No16BytesAligned(scalar_idx);
105
+ `;break;case p.Mat4x3Array:u+=` mat4x3 val = fetchMat4x3(vec4_idx);
87
106
  `;break;default:u+=""}return u+=`
88
107
  return val;
89
108
  }
@@ -91,11 +110,11 @@ ${h}`;switch(e.compositionType){case g.Vec4:case g.Vec4Array:u+=` highp v
91
110
  ${i} get_${o}(highp uint _instanceId, const uint idxOfArray) {
92
111
  return u_${o}${u};
93
112
  }
94
- `}return r}static AC(t,e,i){var C,I;let n=i.compositionType.getGlslStr(i.componentType),a,o=g.isTexture(i.compositionType),r=i.semantic.replace(".","_"),c="",s=i.compositionType.getGlslStr(i.componentType),p="";i.arrayLength&&(p=`[${i.arrayLength}]`),(i.needUniformInDataTextureMode||o)&&(c=` uniform ${s} u_${r}${p};
95
- `);let l=i.compositionType.getVec4SizeOfProperty(),d=i.compositionType.getNumberOfComponents(),m=B.getOffsetOfPropertyOfMaterial(t,i.semantic,e),f=t.materialRepository._getMaterialCountPerBufferView(e),h=`rnOffsets_${r}`,x=`const int ${h}[${m.length}] = int[${m.length}](${m.join(", ")});`,b=l;if(a=`int vec4_idx = ${h}[instanceIdOfBufferViews] + ${b} * int(instanceIdInBufferView);
96
- `,g.isArray(i.compositionType)){b=l*((C=i.arrayLength)!=null?C:1);let A=Math.ceil(d/4)*4*((I=i.arrayLength)!=null?I:1);a=`int vec4_idx = ${h}[instanceIdOfBufferViews] + ${b} * int(instanceIdInBufferView) + ${l} * int(idxOfArray);
97
- `,a+=`int scalar_idx = ${h}[instanceIdOfBufferViews] * 4 + ${A} * int(instanceIdInBufferView) + ${d} * int(idxOfArray);
98
- `}let u="";i.componentType===T.Int&&i.compositionType!==g.Scalar&&(u="i");let R="";if(!o&&!i.needUniformInDataTextureMode){R+=`
113
+ `}return r}static B_(t,e,i){var S,b;let n=i.compositionType.getGlslStr(i.componentType),a,o=p.isTexture(i.compositionType),r=i.semantic.replace(".","_"),c="",s=i.compositionType.getGlslStr(i.componentType),m="";i.arrayLength&&(m=`[${i.arrayLength}]`),(i.needUniformInDataTextureMode||o)&&(c=` uniform ${s} u_${r}${m};
114
+ `);let l=i.compositionType.getVec4SizeOfProperty(),d=i.compositionType.getNumberOfComponents(),h=P.getOffsetOfPropertyOfMaterial(t,i.semantic,e),f=t.materialRepository._getMaterialCountPerBufferView(e),g=`rnOffsets_${r}`,x=`const int ${g}[${h.length}] = int[${h.length}](${h.join(", ")});`,v=l;if(a=`int vec4_idx = ${g}[instanceIdOfBufferViews] + ${v} * int(instanceIdInBufferView);
115
+ `,p.isArray(i.compositionType)){v=l*((S=i.arrayLength)!=null?S:1);let B=Math.ceil(d/4)*4*((b=i.arrayLength)!=null?b:1);a=`int vec4_idx = ${g}[instanceIdOfBufferViews] + ${v} * int(instanceIdInBufferView) + ${l} * int(idxOfArray);
116
+ `,a+=`int scalar_idx = ${g}[instanceIdOfBufferViews] * 4 + ${B} * int(instanceIdInBufferView) + ${d} * int(idxOfArray);
117
+ `}let u="";i.componentType===C.Int&&i.compositionType!==p.Scalar&&(u="i");let R="";if(!o&&!i.needUniformInDataTextureMode){R+=`
99
118
  ${x}
100
119
  ${n} get_${r}(highp uint _instanceId, const uint idxOfArray) {
101
120
  uint instanceId = _instanceId;
@@ -103,20 +122,20 @@ ${n} get_${r}(highp uint _instanceId, const uint idxOfArray) {
103
122
  uint instanceIdInBufferView = instanceId % ${f}u;
104
123
  ${a}
105
124
  `;let y=`${c}
106
- ${R}`;switch(i.compositionType){case g.Vec4:case g.Vec4Array:y+=` highp vec4 val = fetchElement(vec4_idx);
107
- `;break;case g.Vec3:y+=` vec4 col0 = fetchElement(vec4_idx);
108
- `,y+=` highp ${u}vec3 val = ${u}vec3(col0.xyz);`;break;case g.Vec3Array:y+=` vec3 val = fetchVec3No16BytesAligned(scalar_idx);
109
- `;break;case g.Vec2:y+=` highp vec4 col0 = fetchElement(vec4_idx);
110
- `,y+=` highp ${u}vec2 val = ${u}vec2(col0.xy);`;break;case g.Vec2Array:y+=` highp vec2 val = fetchVec2No16BytesAligned(scalar_idx);
111
- `;break;case g.Scalar:y+=` vec4 col0 = fetchElement(vec4_idx);
112
- `,i.componentType===T.Int?y+=" int val = int(col0.x);":i.componentType===T.Bool?y+=" bool val = bool(col0.x);":y+=" float val = col0.x;";break;case g.ScalarArray:y+=` float col0 = fetchScalarNo16BytesAligned(scalar_idx);
113
- `,i.componentType===T.Int?y+=" int val = int(col0);":i.componentType===T.Bool?y+=" bool val = bool(col0);":y+=" float val = col0;";break;case g.Mat4:y+=` mat4 val = fetchMat4(vec4_idx);
114
- `;break;case g.Mat4Array:y+=` mat4 val = fetchMat4(vec4_idx);
115
- `;break;case g.Mat3:y+=` mat3 val = fetchMat3(vec4_idx);
116
- `;break;case g.Mat3Array:y+=` mat3 val = fetchMat3No16BytesAligned(scalar_idx);
117
- `;break;case g.Mat2:y+=` mat2 val = fetchMat2(vec4_idx);
118
- `;break;case g.Mat2Array:y+=` mat2 val = fetchMat2No16BytesAligned(scalar_idx);
119
- `;break;case g.Mat4x3Array:y+=` mat4x3 val = fetchMat4x3(vec4_idx);
125
+ ${R}`;switch(i.compositionType){case p.Vec4:case p.Vec4Array:y+=` highp vec4 val = fetchElement(vec4_idx);
126
+ `;break;case p.Vec3:y+=` vec4 col0 = fetchElement(vec4_idx);
127
+ `,y+=` highp ${u}vec3 val = ${u}vec3(col0.xyz);`;break;case p.Vec3Array:y+=` vec3 val = fetchVec3No16BytesAligned(scalar_idx);
128
+ `;break;case p.Vec2:y+=` highp vec4 col0 = fetchElement(vec4_idx);
129
+ `,y+=` highp ${u}vec2 val = ${u}vec2(col0.xy);`;break;case p.Vec2Array:y+=` highp vec2 val = fetchVec2No16BytesAligned(scalar_idx);
130
+ `;break;case p.Scalar:y+=` vec4 col0 = fetchElement(vec4_idx);
131
+ `,i.componentType===C.Int?y+=" int val = int(col0.x);":i.componentType===C.Bool?y+=" bool val = bool(col0.x);":y+=" float val = col0.x;";break;case p.ScalarArray:y+=` float col0 = fetchScalarNo16BytesAligned(scalar_idx);
132
+ `,i.componentType===C.Int?y+=" int val = int(col0);":i.componentType===C.Bool?y+=" bool val = bool(col0);":y+=" float val = col0;";break;case p.Mat4:y+=` mat4 val = fetchMat4(vec4_idx);
133
+ `;break;case p.Mat4Array:y+=` mat4 val = fetchMat4(vec4_idx);
134
+ `;break;case p.Mat3:y+=` mat3 val = fetchMat3(vec4_idx);
135
+ `;break;case p.Mat3Array:y+=` mat3 val = fetchMat3No16BytesAligned(scalar_idx);
136
+ `;break;case p.Mat2:y+=` mat2 val = fetchMat2(vec4_idx);
137
+ `;break;case p.Mat2Array:y+=` mat2 val = fetchMat2No16BytesAligned(scalar_idx);
138
+ `;break;case p.Mat4x3Array:y+=` mat4x3 val = fetchMat4x3(vec4_idx);
120
139
  `;break;default:y+=""}return y+=`
121
140
  return val;
122
141
  }
@@ -124,4 +143,4 @@ ${R}`;switch(i.compositionType){case g.Vec4:case g.Vec4Array:y+=` highp v
124
143
  ${n} get_${r}(highp uint _instanceId, const uint idxOfArray) {
125
144
  return u_${r}${y};
126
145
  }
127
- `}return c}static getOffsetOfPropertyOfMaterial(t,e,i){return t.materialRepository.getLocationOffsetOfMemberOfMaterial(t,i,e)}static getOffsetOfPropertyOfGlobalDataRepository(t,e){return t.globalDataRepository.getLocationOffsetOfProperty(e)}$load(t){let e=t.mesh;return e==null?(ne.alertNoMeshSet(t),!1):(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0),e.isSetUpDone()||(this.deleteDataTexture(),e._updateVBOAndVAO()),!0)}QI(){let t=U.getMorphUniformDataOffsets();for(let i=0;i<U.getPrimitiveCountHasMorph();i++){let n=U.getPrimitiveHasMorph(i);if(n!=null)for(let a=0;a<n.targets.length;a++){let r=n.targets[a].get(E.Position.XYZ),c=this.i.memoryManager.getByteOffsetOfExistingBuffers($.GPUVertexData,r.bufferView.buffer.indexOfTheBufferUsage);this.wI[t[i]+a]=(this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData+c+r.byteOffsetInBuffer)/4/4}else break}let e=t[t.length-1];this.i.webglResourceRepository.updateUniformBuffer(this.gI,this.wI,0,e)}common_$load(){this.TC()}TC(){let t=!1,e=U.getMorphUniformDataOffsets(),i=Math.max(Math.ceil(e[e.length-1]/4)*4*4,4);if(i!==this.PI){if(this.gI!==v.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.gI),this.gI=v.InvalidCGAPIResourceUid),this.PI=i,this.gI===v.InvalidCGAPIResourceUid){let o=new Uint32Array(i);this.wI=o,this.gI=this.i.webglResourceRepository.createUniformBufferWithBufferView(o),this.QI()}this.PI=i,t=!0}let n=O.getOffsetsInUniform(this.i),a=Math.max(Math.ceil(n[n.length-1]/4)*4*4,4);if(a!==this.KI){if(this.yI!==v.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.yI),this.yI=v.InvalidCGAPIResourceUid),this.yI===v.InvalidCGAPIResourceUid){let o=new Float32Array(a);this.OI=o,this.yI=this.i.webglResourceRepository.createUniformBufferWithBufferView(o),this._S()}this.KI=a,t=!0}t&&this.BC()}BC(){this.gI!==v.InvalidCGAPIResourceUid&&this.yI!==v.InvalidCGAPIResourceUid&&this.i.webglResourceRepository.setUniformBlockBindingForMorphOffsetsAndWeightsWithoutShaderProgram(this.gI,this.yI)}UC(){let t=U.getPrimitiveCountHasMorph();(t!==this.zI||this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData!==this.XI)&&(this.QI(),this.XI=this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData,this.zI=t)}GC(){this.__createAndUpdateDataTextureInner()}__createAndUpdateDataTextureInner(){let t=this.i.memoryManager,i=t.getSizesOfTheBuffers($.GPUInstanceData).reduce((c,s)=>c+s,0),n=t.getBuffers($.GPUInstanceData),a=n.length;a!==this.ZI&&(this.ZI=a,this.deleteDataTexture());let o=this.i.webglResourceRepository.currentWebGLContextWrapper;if(o==null)return;let r=o.getMaxTextureSize();if(this.__dataTextureUid!==v.InvalidCGAPIResourceUid){let c=i/4/4,s=Math.ceil(c/r),p=r*s*4*4,l=this.i.lightClusterSystem,d=l._getExcludedByteRanges(),m=0;for(let f=0;f<n.length;f++){let h=n[f],x=f===n.length-1?h.takenSizeInByte:h.byteLength;x>p&&ee.default.warn("The buffer size exceeds the size of the data texture.");let b=new Float32Array(h.getArrayBuffer());for(let[u,R]of se(m,m+Math.min(x,p),d))this.LS(b,m,u,R,r);B.DI||(oe.downloadTypedArray("Rhodonite_dataTextureBuffer.bin",b),B.DI=!0),m+=h.byteLength}for(let[f,h]of l._takeDirtyByteRanges()){let x=0;for(let b of n){let u=x+b.byteLength;if(f>=x&&h<=u){let R=new Float32Array(b.getArrayBuffer());this.LS(R,x,f,h,r);break}x=u}}}else{let c=t.getBuffers($.GPUVertexData),s=c.map(S=>S.getArrayBuffer()),p=r*4*4,l=n.map(S=>Math.ceil(S.byteLength/p)*p),d=l.reduce((S,M)=>S+M,0),m=c.reduce((S,M)=>S+M.byteLength,0),f=Math.max(Math.ceil((d+m)/p),1),h=this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable,x=this.i.webglResourceRepository.instanceSidTable,b=h?Math.max(x.usedEnd,1):0,u=h?Math.max(Math.ceil(b/r),1):0,R=h?Math.max(Math.ceil(Math.ceil(b/4)/r),1):0,C=f+u+R;this.SI=r,this.BI=f,this.UI=f+u,this.RI=this.BI*r,this.CI=this.UI*r,this.GI=b,h&&x.markAllDirty();let I=p*C,y=new Uint8Array(I),A=0;n.forEach((S,M)=>{y.set(new Uint8Array(S.getArrayBuffer(),0,S.takenSizeInByte),A),A+=l[M]}),c.forEach((S,M)=>{y.set(new Uint8Array(s[M],0,S.byteLength),A),A+=S.byteLength});let L=new Float32Array(y.buffer);this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData=d,this.__dataTextureUid=this.i.webglResourceRepository.createTextureFromTypedArray(L,{internalFormat:ae.RGBA32F,width:r,height:C,format:j.RGBA,type:T.Float,generateMipmap:!1}),this.i.lightClusterSystem._takeDirtyByteRanges()}}LS(t,e,i,n,a){let o=this.i.webglResourceRepository,r=Math.floor(i/16),c=Math.ceil(n/16),s=e/16,p=(l,d,m,f,h)=>{let x=(h-s)*4;o.updateTexture(this.__dataTextureUid,t.subarray(x,x+m*f*4),{level:0,offsetX:l,offsetY:d,width:m,height:f,format:j.RGBA,type:T.Float})};for(;r<c;){let l=r%a,d=Math.floor(r/a);if(l!==0||c-r<a){let m=Math.min(a-l,c-r);p(l,d,m,1,r),r+=m}else{let m=Math.floor((c-r)/a);p(0,d,a,m,r),r+=m*a}}}deleteDataTexture(){this.__dataTextureUid!=null&&(this.i.webglResourceRepository.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=v.InvalidCGAPIResourceUid),this.GI=0,this.SI=0,this.II=v.InvalidCGAPIResourceUid}prerender(){if(this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable){let e=this.i.webglResourceRepository.instanceSidTable;this.__dataTextureUid!==v.InvalidCGAPIResourceUid&&e.usedEnd>this.GI&&this.deleteDataTexture()}(re.getIsAnimating(this.i)||Q.getUpdateCount(this.i)!==this.tr||J.getUpdateCount(this.i)!==this.YI||k.getCurrentCameraUpdateCount(this.i)!==this.kb||q(this.i)!==this.rr||this.i.materialRepository.stateVersion!==this.HI||this.i.lightClusterSystem.dataVersion!==this.jI||z.getUpdateCount(this.i)!==this.er||this.__dataTextureUid===v.InvalidCGAPIResourceUid)&&(this.GC(),this.DC(),this.tr=Q.getUpdateCount(this.i),this.YI=J.getUpdateCount(this.i),this.kb=k.getCurrentCameraUpdateCount(this.i),this.rr=q(this.i),this.HI=this.i.materialRepository.stateVersion,this.jI=this.i.lightClusterSystem.dataVersion,this.er=z.getUpdateCount(this.i)),(O.updateCount!==this.FI||O.getCountOfBlendShapeComponents(this.i)!==this.qI)&&(this._S(),this.FI=O.updateCount,this.qI=O.getCountOfBlendShapeComponents(this.i),this.i.materialRepository._makeShaderInvalidateToMorphMaterials()),this.UC(),this.EI=this.i.componentRepository.getComponentsWithType(z)}_S(){let e=this.i.memoryManager.getBuffer($.GPUVertexData);if(e==null||e.takenSizeInByte===0)return;let i=O.getOffsetsInUniform(this.i),n=this.i.componentRepository.getComponentsWithTypeWithoutFiltering(O);for(let a=0;a<n.length;a++){let o=n[a],r=o!=null?o.weights:[];for(let c=0;c<r.length;c++)this.OI[i[a]+c]=r[c]}if(n.length>0){let a=i[i.length-1];this.i.webglResourceRepository.updateUniformBuffer(this.yI,this.OI,0,a)}}wC(){return this.i.webglResourceRepository.currentWebGLContextWrapper.isWebGL2&&this.i.config.isUboEnabled}DC(){if(this.wC()){let t=this.i.webglResourceRepository.currentWebGLContextWrapper,e=t.getAlignedMaxUniformBlockSize(),i=t.getMaxConventionUniformBlocks(),a=this.i.memoryManager.getBuffer($.GPUInstanceData);if(this.bI===v.InvalidCGAPIResourceUid)this.bI=this.i.webglResourceRepository.setupUniformBufferDataArea(new Float32Array(a.getArrayBuffer()));else{let o=new Float32Array(a.getArrayBuffer());this.i.webglResourceRepository.updateUniformBuffer(this.bI,o,0,e*i/4)}}}attachGPUData(t){}attachGPUDataInner(t,e){}attachVertexData(t,e,i,n){}attachVertexDataInner(t,e,i,n,a){let o=this.i.webglResourceRepository.getWebGLResource(t.getVaoUids(i));if(o!=null)n.bindVertexArray(o);else{n.bindVertexArray(null);let r=e.vertexHandles;this.i.webglResourceRepository.setVertexDataToPipeline(r,e,t._variationVBOUid);let c=this.i.webglResourceRepository.getWebGLResource(r.iboHandle),s=n.getRawContext();s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,c)}}dettachVertexData(t){let e=t.getRawContext();t.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindBuffer(e.ARRAY_BUFFER,null)}static init(t){return new B(t)}zS(t,e,i){if(i){let n=-1,a=this.i._webXRSystemIfEnabled;a!=null&&a.isWebXRMode&&(a.isMultiView()?n=a._getCameraComponentSIDAt(0):n=a._getCameraComponentSIDAt(e)),this.xI._v[N.CameraComponentTID]=n}else{let n=t.cameraComponent;n==null&&(n=this.i.componentRepository.getComponent(k,k.getCurrent(this.i))),n?this.xI._v[N.CameraComponentTID]=n.componentSID:this.xI._v[N.CameraComponentTID]=-1}}HS(t,e,i){this.xI==null&&(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)),this.xI._v[0]=e.materialSID}OC(t,e,i){if(!this.i.config.isMultiDrawEnabled)return;let n=this.i.webglResourceRepository,a=n.currentWebGLContextWrapper;if(a==null||a.webgl2ExtMD==null)return;let o=n.instanceSidTable;if(!o.isSupported)return;let r=H._getInstanceCullingState(e),c=r!=null&&r.culledEntityCount>0;if(this.vI=c?0:1,!c){this.XS(o);return}let s=r.culledEntityStamp,p=r.cullTick,l=r.cullingId;for(let d=0;d<t.length;d++){let m=t[d];if(m===-1)continue;let f=i!=null?i[d]:U.getPrimitive(m);if(f==null)continue;let h=f.mesh;h==null||h._remapPrepassId===l||(h._remapPrepassId=l,h._packVisibleInstancesToVariationVBO(s,p))}this.XS(o)}XS(t){if(this.__dataTextureUid===v.InvalidCGAPIResourceUid||this.SI<=0)return;let e=t.usedEnd;if(e<=0){t.clearSidDirty(),t.clearRemapDirty();return}t.sidDirty&&(this.YS(this.BI,e,(i,n,a)=>t.writeSidTexels(i,n,a)),t.clearSidDirty()),t.remapDirty&&this.vI===0&&(this.YS(this.UI,Math.ceil(e/4),(i,n,a)=>t.writeRemapTexels(i,n,a)),t.clearRemapDirty())}YS(t,e,i){let n=this.SI,a=e,o=0,r=t;for(;a>0;){let c=Math.min(a,n),s=new Float32Array(c*4);i(s,o,c),this.i.webglResourceRepository.updateTexture(this.__dataTextureUid,s,{level:0,offsetX:0,offsetY:r,width:c,height:1,format:j.RGBA,type:T.Float}),a-=c,o+=c,r++}}common_$render(t,e,i,n){typeof spector!="undefined"&&spector.setMarker("| | WebGL2:common_$render#");let a=this.i.webglResourceRepository.currentWebGLContextWrapper,o=a.getRawContextAsWebGL2(),r=V.isVrMainPass(this.i,e),c=V.getDisplayCount(r,this.i._webXRSystemIfEnabled),s=e._lastPrimitiveUids===t?e._lastPrimitives:null;if(e.isBufferLessRenderingMode())return this.PC(o,e,r),o.depthMask(!0),!0;this.OC(t,e,s);let p=!1;return e._toRenderOpaquePrimitives&&(e.depthWriteMask||o.depthMask(!1),p=this.MI(t,s,e._lastOpaqueIndex,0,-1,a,e,r,c)||p),e._toRenderTranslucentPrimitives&&(p=this.MI(t,s,e._lastOpaqueIndex+1,e._lastTranslucentIndex,1,a,e,r,c)||p),e._toRenderBlendWithZWritePrimitives&&(p=this.MI(t,s,e._lastTranslucentIndex+1,e._lastBlendWithZWriteIndex,1,a,e,r,c)||p),e._toRenderBlendWithoutZWritePrimitives&&(o.depthMask(!1),p=this.MI(t,s,e._lastBlendWithZWriteIndex+1,e._lastBlendWithoutZWriteIndex,1,a,e,r,c)||p),o.depthMask(!0),this.dettachVertexData(a),this.IC=i,p}PC(t,e,i){let n=e.material,a=e._dummyPrimitiveForBufferLessRendering;Y(n,a,this);let o=n.getShaderProgramUid(a),r=this.i.webglResourceRepository.getWebGLResource(o);if(t.useProgram(r),this.II=o,this.bindDataTexture(t,r),this.HS(t,n,r),this.zS(e,0,i),this.ZS(t,r),this.KS(t,r),r.vrState!=null&&i){let s=this.i.globalDataRepository.getValue("vrState",0);s._v[0]=i?1:0,s._v[1]=0,r._gl.uniform2iv(r.vrState,s._v)}V.setWebGLParameters(this.i,n,t),n._setParametersToGpuWebGLWithOutInternalSetting({shaderProgram:r,firstTime:!0}),e.depthWriteMask?t.depthMask(!0):t.depthMask(!1),this.i.webglResourceRepository.setViewport(this.i,e.getViewport());let c=this.i.webglResourceRepository.currentWebGLContextWrapper;c!=null&&this.VI(c)&&(t.bindVertexArray(null),t.vertexAttribI4ui(E.MaterialSid.getAttributeSlot(),n.materialSID,0,0,0),t.vertexAttribI4ui(E.Instance.getAttributeSlot(),0,0,0,0),this.qS(t,r),this.JS(t,r)),t.drawArrays(e._primitiveModeForBufferLessRendering.index,0,e._drawVertexNumberForBufferLessRendering)}VI(t){return this.i.config.isMultiDrawEnabled&&t.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported}VC(t,e,i){let n=E.MaterialSid.getAttributeSlot(),a=t._multiDrawGroup,o=i.getRawContextAsWebGL2();if(a==null||a.vertexHandles==null){o.vertexAttribI4ui(n,e.materialSID,0,0,0);return}let r=e===t.material,c=r?a.vertexHandles.vaoHandle:a.genericMaterialSidVaoHandle;if(c!=null){let s=this.i.webglResourceRepository.getWebGLResource(c);s!=null&&i.bindVertexArray(s)}r||o.vertexAttribI4ui(n,e.materialSID,0,0,0)}MI(t,e,i,n,a,o,r,c,s){let p=!c&&s===1&&this.i.config.isMultiDrawEnabled&&o.webgl2ExtMD!=null&&this.i.webglResourceRepository.isInstanceSidTextureCapable,l=!1;if(!p){for(let f=i;a>0?f<=n:f>=n;f+=a)l=this._I(t[f],o,r,c,s,void 0,e==null?void 0:e[f])||l;return l}let m=fe(i,n,a,f=>{let h=t[f];if(h===-1)return null;let x=e!=null?e[f]:U.getPrimitive(h);if(x==null||x._multiDrawGroup==null)return null;let b=r.getAppropriateMaterial(x);return b._materialContent.isMultiDrawCompatible?ce(x,b,le(x)):null},this.SC);for(let f=0;f<m.count;f++){let h=m.starts[f],x=m.counts[f];if(m.keys[f]===-1||x<2)for(let b=0;b<x;b++){let u=h+b*a;l=this._I(t[u],o,r,c,s,void 0,e==null?void 0:e[u])||l}else l=this.LC(t,e,h,x,a,o,r,s)||l}return l}LC(t,e,i,n,a,o,r,c){var S;let s=e!=null?e[i]:U.getPrimitive(t[i]);if(s==null||s._multiDrawGroup==null)return!1;let p=s.mesh,l={primitive:s,mesh:p,indexed:s.hasIndices(),mode:s.primitiveMode.index,indexBitSize:s.getRenderIndexBitSize(),count:0,offset:0,instanceCount:0};if(!this._I(t[i],o,r,!1,c,l,s)){let M=!1;for(let G=1;G<n;G++){let _=i+G*a;M=this._I(t[_],o,r,!1,c,void 0,e==null?void 0:e[_])||M}return M}let m=s._multiDrawGroup,f=m.counts,h=m.offsets,x=m.instanceCounts,b=m.firsts,u=m.vertexCounts,R=l.indexed,C=o.getRawContextAsWebGL2(),I=0;f[I]=l.count,h[I]=l.offset,b[I]=l.offset,u[I]=l.count,x[I]=l.instanceCount,I++;let y=H._getInstanceCullingState(r),A=y==null?void 0:y.culledEntityStamp,L=(S=y==null?void 0:y.cullTick)!=null?S:0;for(let M=1;M<n;M++){let G=i+M*a,_=e!=null?e[G]:U.getPrimitive(t[G]);if(_==null||_._multiDrawGroup!==m)continue;let W=r.getAppropriateMaterial(_);if(W.getShaderProgramUid(_)===-1&&Y(W,_,this),te(W,_))continue;let D=_.mesh._packVisibleInstancesToVariationVBO(A,L);if(D===0)continue;let w=_._multiDrawEntry;w!=null&&(f[I]=w.indexCount,h[I]=w.indexByteOffset,b[I]=w.vertexOffset,u[I]=w.vertexCount,x[I]=D,I++)}return I>=2?R?o.multiDrawElementsInstanced(l.mode,f,0,C.UNSIGNED_INT,h,0,x,0,I):o.multiDrawArraysInstanced(l.mode,b,0,u,0,x,0,I):I===1&&(R?C.drawElementsInstanced(l.mode,f[0],C.UNSIGNED_INT,h[0],x[0]):C.drawArraysInstanced(l.mode,b[0],u[0],x[0])),!0}_I(t,e,i,n,a,o,r){var I,y,A,L;let c=e.getRawContextAsWebGL2(),s=r!=null?r:U.getPrimitive(t);if(s==null)return!1;let p=s.mesh,l=p.meshEntitiesInner[0],d=i.getAppropriateMaterial(s);Y(d,s,this);let m=l.getMeshRenderer(),f=H._getInstanceCullingState(i),h=p._packVisibleInstancesToVariationVBO(f==null?void 0:f.culledEntityStamp,(I=f==null?void 0:f.cullTick)!=null?I:0);if(h===0)return!1;let x=p.getPrimitiveIndexInMesh(s);this.attachVertexDataInner(p,s,x,e,p._variationVBOUid),this.VI(e)&&this.VC(s,d,e);let b=!1,u=!1,R=d.getShaderProgramUid(s);if(R!==this.II||c.JA){if(te(d,s))return this.dettachVertexData(e),!1;let S=this.i.webglResourceRepository.getWebGLResource(R);c.useProgram(S),c.JA=!1,this.bindDataTexture(c,S),this.fI=S,b=!0,u=!0}((y=this.WI)==null?void 0:y.deref())!==d&&(u=!0,this.WI=new WeakRef(d)),this.$I!==d.stateVersion&&(u=!0,this.$I=d.stateVersion),this.VI(e)&&this.fI!=null&&(this.qS(c,this.fI),this.JS(c,this.fI));let C={glw:e,entity:l,worldMatrix:l.getSceneGraph().matrixInner,normalMatrix:l.getSceneGraph().normalMatrixInner,isBillboard:l.getSceneGraph().isBillboard,isVisible:l.getSceneGraph().isVisible,lightComponents:this.EI,renderPass:i,primitive:s,diffuseCube:m.diffuseCubeMap,specularCube:m.specularCubeMap,sheenCube:m.sheenCubeMap,isVr:n,displayIdx:-1};b&&d._setParametersToGpuWebGLPerShaderProgram({engine:this.i,material:d,shaderProgram:this.fI,firstTime:b,args:C}),u&&(this.HS(c,d,this.fI),V.setWebGLParameters(this.i,d,c),d._setParametersToGpuWebGL({engine:this.i,material:d,shaderProgram:this.fI,firstTime:u,args:C})),d._setParametersToGpuWebGLPerPrimitive({material:d,shaderProgram:this.fI,firstTime:u,args:C});for(let S=0;S<a;S++){if(n&&V.setVRViewport(this.i,i,S),this.zS(i,S,n),this.ZS(c,this.fI),this.KS(c,this.fI),this.fI.vrState!=null&&n&&a>1){let F=this.i.globalDataRepository.getValue("vrState",0);F._v[0]=n?1:0,F._v[1]=S,this.fI._gl.uniform2iv(this.fI.vrState,F._v)}this.i.config.isMultiDrawEnabled&&e.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported&&s._multiDrawGroup==null&&c.vertexAttribI4ui(E.Instance.getAttributeSlot(),Math.max(0,p._instanceSidBase),0,0,0);let G=s.indicesAccessor,_=G!=null,W=s.getRenderIndexBitSize(),Z=W==="uint32"?c.UNSIGNED_INT:c.UNSIGNED_SHORT,D=s._multiDrawEntry,w=(A=D==null?void 0:D.indexByteOffset)!=null?A:0,K=(L=D==null?void 0:D.vertexOffset)!=null?L:0;o!=null?(o.primitive=s,o.mesh=p,o.indexed=_,o.mode=s.primitiveMode.index,o.indexBitSize=W,o.count=_?G.elementCount:s.getVertexCountAsVerticesBased(),o.offset=_?w:K,o.instanceCount=h):_?c.drawElementsInstanced(s.primitiveMode.index,G.elementCount,Z,w,h):c.drawArraysInstanced(s.primitiveMode.index,K,s.getVertexCountAsVerticesBased(),h)}return this.II=R,!0}KS(t,e){let i=e,n=i.lightClusterView;if(n==null)return;let a=this.xI._v[N.CameraComponentTID],o=this.i.lightClusterSystem,r=o.dataVersion;i._lightClusterViewCameraSid===a&&i._lightClusterViewVersion===r||(t.uniform4fv(n,o._getViewUniformData(a)),i._lightClusterViewCameraSid=a,i._lightClusterViewVersion=r)}ZS(t,e){let i=this.xI._v,n=this.NI;if(this.kI===e&&n!=null&&n.length===i.length){let a=!0;for(let o=0;o<i.length;o++)if(n[o]!==i[o]){a=!1;break}if(a)return}t.uniform1fv(e.currentComponentSIDs,i),(n==null||n.length!==i.length)&&(n=new Float32Array(i.length),this.NI=n),n.set(i),this.kI=e}bindDataTexture(t,e){t.uniform1i(e.dataTexture,0),this.i.webglResourceRepository.bindTexture2D(0,this.__dataTextureUid);let i=this.i.webglResourceRepository.createOrGetTextureSamplerRepeatNearest();this.i.webglResourceRepository.bindTextureSampler(0,i),this.bindInstanceSidTextures(t,e)}bindInstanceSidTextures(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper;if(n==null||n.webgl2ExtMD==null||!this.i.config.isMultiDrawEnabled||!i.instanceSidTable.isSupported)return;let o=e;o.WC===void 0&&(o.AI=t.getUniformLocation(e,"u_instanceSidDataTextureIndex"),o.LI=t.getUniformLocation(e,"u_instanceRemapDataTextureIndex"),o.TI=t.getUniformLocation(e,"u_instanceRemapIdentity"),o.WC=null),o.AI!=null&&(t.uniform1i(o.AI,this.RI),o.QS=this.RI),o.LI!=null&&(t.uniform1i(o.LI,this.CI),o.xC=this.CI),o.TI!=null&&(t.uniform1i(o.TI,this.vI),o.vC=this.vI)}JS(t,e){let i=e;if(i.AI==null)return;let n=this.RI;i.QS!==n&&(t.uniform1i(i.AI,n),i.QS=n);let a=this.CI;i.xC!==a&&(t.uniform1i(i.LI,a),i.xC=a)}qS(t,e){let i=e;if(i.TI==null)return;let n=this.vI;i.vC!==n&&(t.uniform1i(i.TI,n),i.vC=n)}destroy(){let t=this.i.webglResourceRepository;this.__dataTextureUid!==v.InvalidCGAPIResourceUid&&(t.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=v.InvalidCGAPIResourceUid),this.bI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.bI),this.bI=v.InvalidCGAPIResourceUid),this.gI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.gI),this.gI=v.InvalidCGAPIResourceUid),this.yI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.yI),this.yI=v.InvalidCGAPIResourceUid)}};B.DI=!0;var ie=B;export{ie as WebGLStrategyWebGL2};
146
+ `}return c}static getOffsetOfPropertyOfMaterial(t,e,i){return t.materialRepository.getLocationOffsetOfMemberOfMaterial(t,i,e)}static getOffsetOfPropertyOfGlobalDataRepository(t,e){return t.globalDataRepository.getLocationOffsetOfProperty(e)}$load(t){let e=t.mesh;return e==null?(ne.alertNoMeshSet(t),!1):(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0),e.isSetUpDone()||(e._updateVBOAndVAO(),this.U_()),!0)}U_(){if(this.__dataTextureUid===I.InvalidCGAPIResourceUid)return;let t=this.i.memoryManager.getBuffers(V.GPUVertexData),e=0;for(let i of t)e+=i.byteLength;e!==this.OI&&this.deleteDataTexture()}HS(){let t=A.getMorphUniformDataOffsets();for(let i=0;i<A.getPrimitiveCountHasMorph();i++){let n=A.getPrimitiveHasMorph(i);if(n!=null)for(let a=0;a<n.targets.length;a++){let r=n.targets[a].get($.Position.XYZ),c=this.i.memoryManager.getByteOffsetOfExistingBuffers(V.GPUVertexData,r.bufferView.buffer.indexOfTheBufferUsage);this.wI[t[i]+a]=(this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData+c+r.byteOffsetInBuffer)/4/4}else break}let e=t[t.length-1];this.i.webglResourceRepository.updateUniformBuffer(this.gI,this.wI,0,e)}common_$load(){this.D_()}D_(){let t=!1,e=A.getMorphUniformDataOffsets(),i=Math.max(Math.ceil(e[e.length-1]/4)*4*4,4);if(i!==this.LI){if(this.gI!==I.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.gI),this.gI=I.InvalidCGAPIResourceUid),this.LI=i,this.gI===I.InvalidCGAPIResourceUid){let a=new Uint32Array(i);this.wI=a,this.gI=this.i.webglResourceRepository.createUniformBufferWithBufferView(a),this.HS()}this.LI=i,t=!0}let n=D._getMorphWeightsUniformBufferFloatCount(this.i);if(n!==this.QI){if(this.yI!==I.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.yI),this.yI=I.InvalidCGAPIResourceUid),this.yI===I.InvalidCGAPIResourceUid){let a=new Float32Array(n);this.II=a,this.yI=this.i.webglResourceRepository.createUniformBufferWithBufferView(a),this.XS(!0)}this.QI=n,t=!0}t&&this.P_()}P_(){this.gI!==I.InvalidCGAPIResourceUid&&this.yI!==I.InvalidCGAPIResourceUid&&this.i.webglResourceRepository.setUniformBlockBindingForMorphOffsetsAndWeightsWithoutShaderProgram(this.gI,this.yI)}G_(){let t=A.getPrimitiveCountHasMorph();(t!==this.jI||this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData!==this.KI)&&(this.HS(),this.KI=this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData,this.jI=t)}O_(){this.__createAndUpdateDataTextureInner()}__createAndUpdateDataTextureInner(){let t=this.i.memoryManager,i=t.getSizesOfTheBuffers(V.GPUInstanceData).reduce((c,s)=>c+s,0),n=t.getBuffers(V.GPUInstanceData),a=n.length;a!==this.JI&&(this.JI=a,this.deleteDataTexture());let o=this.i.webglResourceRepository.currentWebGLContextWrapper;if(o==null)return;let r=o.getMaxTextureSize();if(this.__dataTextureUid!==I.InvalidCGAPIResourceUid){let c=i/4/4,s=Math.ceil(c/r),m=r*s*4*4,l=this.i.lightClusterSystem,d=l._getExcludedByteRanges(),h=0;for(let f=0;f<n.length;f++){let g=n[f],x=g.takenSizeInByte;x>m&&ee.default.warn("The buffer size exceeds the size of the data texture.");let v=new Float32Array(g.getArrayBuffer());for(let[u,R]of oe(h,h+Math.min(x,m),d))this.CI(v,h,u,R,r);h+=g.byteLength}for(let[f,g]of l._takeDirtyByteRanges()){let x=0;for(let v of n){let u=x+v.byteLength;if(f>=x&&g<=u){let R=new Float32Array(v.getArrayBuffer());this.CI(R,x,f,g,r);break}x=u}}}else{let c=t.getBuffers(V.GPUVertexData),s=r*4*4,m=n.map(b=>Math.ceil(b.byteLength/s)*s),l=m.reduce((b,y)=>b+y,0),d=c.reduce((b,y)=>b+y.byteLength,0),h=Math.max(Math.ceil((l+d)/s),1),f=this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable,g=this.i.webglResourceRepository.instanceSidTable,x=f?Math.max(g.usedEnd,1):0,v=f?Math.max(Math.ceil(x/r),1):0,u=f?Math.max(Math.ceil(Math.ceil(x/4)/r),1):0,R=h+v+u;this.RI=r,this.DI=h,this.PI=h+v,this._I=this.DI*r,this.MI=this.PI*r,this.GI=x,this.OI=d,f&&g.markAllDirty(),this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData=l,this.__dataTextureUid=this.i.webglResourceRepository.createTexStorage2D({levels:1,internalFormat:ae.RGBA32F,width:r,height:R});let S=0;n.forEach((b,y)=>{this.CI(new Float32Array(b.getArrayBuffer()),S,S,S+b.takenSizeInByte,r),S+=m[y]}),c.forEach(b=>{this.CI(new Float32Array(b.getArrayBuffer()),S,S,S+b.byteLength,r),S+=b.byteLength}),this.i.lightClusterSystem._takeDirtyByteRanges()}}CI(t,e,i,n,a){let o=this.i.webglResourceRepository,r=Math.floor(i/16),c=Math.ceil(n/16),s=e/16,m=(l,d,h,f,g)=>{let x=(g-s)*4;o.updateTexture(this.__dataTextureUid,t.subarray(x,x+h*f*4),{level:0,offsetX:l,offsetY:d,width:h,height:f,format:Q.RGBA,type:C.Float})};for(;r<c;){let l=r%a,d=Math.floor(r/a);if(l!==0||c-r<a){let h=Math.min(a-l,c-r);m(l,d,h,1,r),r+=h}else{let h=Math.floor((c-r)/a);m(0,d,a,h,r),r+=h*a}}}deleteDataTexture(){this.__dataTextureUid!=null&&(this.i.webglResourceRepository.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=I.InvalidCGAPIResourceUid),this.GI=0,this.RI=0,this.OI=0,this.SI=I.InvalidCGAPIResourceUid}prerender(){if(this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable){let e=this.i.webglResourceRepository.instanceSidTable;this.__dataTextureUid!==I.InvalidCGAPIResourceUid&&e.usedEnd>this.GI&&this.deleteDataTexture()}(re.getIsAnimating(this.i)||J.getUpdateCount(this.i)!==this.nr||q.getUpdateCount(this.i)!==this.qI||k.getCurrentCameraUpdateCount(this.i)!==this.dC||K(this.i)!==this.sr||this.i.materialRepository.stateVersion!==this.XI||this.i.lightClusterSystem.dataVersion!==this.YI||z.getUpdateCount(this.i)!==this.or||this.i._gpuInstanceDataVersion!==this.ZI||this.__dataTextureUid===I.InvalidCGAPIResourceUid)&&(this.O_(),this.w_(),this.nr=J.getUpdateCount(this.i),this.qI=q.getUpdateCount(this.i),this.dC=k.getCurrentCameraUpdateCount(this.i),this.sr=K(this.i),this.XI=this.i.materialRepository.stateVersion,this.YI=this.i.lightClusterSystem.dataVersion,this.or=z.getUpdateCount(this.i),this.ZI=this.i._gpuInstanceDataVersion),D.updateCount!==this.HI||D.getCountOfBlendShapeComponents(this.i)!==this.LS?(this.XS(),this.HI=D.updateCount,this.LS=D.getCountOfBlendShapeComponents(this.i),this.i.materialRepository._makeShaderInvalidateToMorphMaterials()):this.V_(),this.G_(),this.NI=this.i.componentRepository.getComponentsWithType(z)}XS(t=!1){let i=this.i.memoryManager.getBuffer(V.GPUVertexData);if(i==null||i.takenSizeInByte===0)return;let n=D._writeMorphWeightsUniformArray(this.i,this.II,t);this.VI=!1,n>0&&this.YS(n)}YS(t){this.i.webglResourceRepository.updateUniformBuffer(this.yI,this.II,0,t)}V_(){if(this.VI||this.II==null)return;this.VI=!0;let t=D._settlePreviousMorphWeights(this.i,this.II);t>0&&this.YS(t)}L_(){return this.i.webglResourceRepository.currentWebGLContextWrapper.isWebGL2&&this.i.config.isUboEnabled}w_(){if(this.L_()){let t=this.i.webglResourceRepository.currentWebGLContextWrapper,e=t.getAlignedMaxUniformBlockSize(),i=t.getMaxConventionUniformBlocks(),a=this.i.memoryManager.getBuffer(V.GPUInstanceData);if(this.bI===I.InvalidCGAPIResourceUid)this.bI=this.i.webglResourceRepository.setupUniformBufferDataArea(new Float32Array(a.getArrayBuffer()));else{let o=new Float32Array(a.getArrayBuffer());this.i.webglResourceRepository.updateUniformBuffer(this.bI,o,0,e*i/4)}}}attachGPUData(t){}attachGPUDataInner(t,e){}attachVertexData(t,e,i,n){}attachVertexDataInner(t,e,i,n,a){let o=this.i.webglResourceRepository.getWebGLResource(t.getVaoUids(i));if(o!=null)n.bindVertexArray(o);else{n.bindVertexArray(null);let r=e.vertexHandles;this.i.webglResourceRepository.setVertexDataToPipeline(r,e,t._variationVBOUid);let c=this.i.webglResourceRepository.getWebGLResource(r.iboHandle),s=n.getRawContext();s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,c)}}dettachVertexData(t){let e=t.getRawContext();t.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindBuffer(e.ARRAY_BUFFER,null)}static init(t){return new P(t)}ZS(t,e,i){if(i){let n=-1,a=this.i._webXRSystemIfEnabled;a!=null&&a.isWebXRMode&&(a.isMultiView()?n=a._getCameraComponentSIDAt(0):n=a._getCameraComponentSIDAt(e)),this.xI._v[N.CameraComponentTID]=n}else{let n=t.cameraComponent;n==null&&(n=this.i.componentRepository.getComponent(k,k.getCurrent(this.i))),n?this.xI._v[N.CameraComponentTID]=n.componentSID:this.xI._v[N.CameraComponentTID]=-1}}KS(t,e,i){this.xI==null&&(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)),this.xI._v[0]=e.materialSID}W_(t,e,i){if(!this.i.config.isMultiDrawEnabled)return;let n=this.i.webglResourceRepository,a=n.currentWebGLContextWrapper;if(a==null||a.webgl2ExtMD==null)return;let o=n.instanceSidTable;if(!o.isSupported)return;let r=H._getInstanceCullingState(e),c=r!=null&&r.culledEntityCount>0;if(this.vI=c?0:1,!c){this.qS(o);return}let s=r.culledEntityStamp,m=r.cullTick,l=r.cullingId;for(let d=0;d<t.length;d++){let h=t[d];if(h===-1)continue;let f=i!=null?i[d]:A.getPrimitive(h);if(f==null)continue;let g=f.mesh;g==null||g._remapPrepassId===l||(g._remapPrepassId=l,g._packVisibleInstancesToVariationVBO(s,m))}this.qS(o)}qS(t){if(this.__dataTextureUid===I.InvalidCGAPIResourceUid||this.RI<=0)return;let e=t.usedEnd;if(e<=0){t.clearSidDirty(),t.clearRemapDirty();return}t.sidDirty&&(this.JS(this.DI,e,(i,n,a)=>t.writeSidTexels(i,n,a)),t.clearSidDirty()),t.remapDirty&&this.vI===0&&(this.JS(this.PI,Math.ceil(e/4),(i,n,a)=>t.writeRemapTexels(i,n,a)),t.clearRemapDirty())}JS(t,e,i){let n=this.RI,a=e,o=0,r=t;for(;a>0;){let c=Math.min(a,n),s=new Float32Array(c*4);i(s,o,c),this.i.webglResourceRepository.updateTexture(this.__dataTextureUid,s,{level:0,offsetX:0,offsetY:r,width:c,height:1,format:Q.RGBA,type:C.Float}),a-=c,o+=c,r++}}common_$render(t,e,i,n){typeof spector!="undefined"&&spector.setMarker("| | WebGL2:common_$render#");let a=this.i.webglResourceRepository.currentWebGLContextWrapper,o=a.getRawContextAsWebGL2(),r=L.isVrMainPass(this.i,e),c=L.getDisplayCount(r,this.i._webXRSystemIfEnabled),s=e._lastPrimitiveUids===t?e._lastPrimitives:null;if(e.isBufferLessRenderingMode())return this.$_(o,e,r),o.depthMask(!0),!0;this.W_(t,e,s);let m=!1;return e._toRenderOpaquePrimitives&&(e.depthWriteMask||o.depthMask(!1),m=this.AI(t,s,e._lastOpaqueIndex,0,-1,a,e,r,c)||m),e._toRenderTranslucentPrimitives&&(m=this.AI(t,s,e._lastOpaqueIndex+1,e._lastTranslucentIndex,1,a,e,r,c)||m),e._toRenderBlendWithZWritePrimitives&&(m=this.AI(t,s,e._lastTranslucentIndex+1,e._lastBlendWithZWriteIndex,1,a,e,r,c)||m),e._toRenderBlendWithoutZWritePrimitives&&(o.depthMask(!1),m=this.AI(t,s,e._lastBlendWithZWriteIndex+1,e._lastBlendWithoutZWriteIndex,1,a,e,r,c)||m),o.depthMask(!0),this.dettachVertexData(a),this.S_=i,m}$_(t,e,i){let n=e.material,a=e._dummyPrimitiveForBufferLessRendering;X(n,a,this);let o=n.getShaderProgramUid(a),r=this.i.webglResourceRepository.getWebGLResource(o);if(t.useProgram(r),this.SI=o,this.bindDataTexture(t,r),this.KS(t,n,r),this.ZS(e,0,i),this.QS(t,r),this.l_(t,r),r.vrState!=null&&i){let s=this.i.globalDataRepository.getValue("vrState",0);s._v[0]=i?1:0,s._v[1]=0,r._gl.uniform2iv(r.vrState,s._v)}L.setWebGLParameters(this.i,n,t),n._setParametersToGpuWebGLWithOutInternalSetting({shaderProgram:r,firstTime:!0}),e.depthWriteMask?t.depthMask(!0):t.depthMask(!1),this.i.webglResourceRepository.setViewport(this.i,e.getViewport());let c=this.i.webglResourceRepository.currentWebGLContextWrapper;c!=null&&this.WI(c)&&(t.bindVertexArray(null),t.vertexAttribI4ui($.MaterialSid.getAttributeSlot(),n.materialSID,0,0,0),t.vertexAttribI4ui($.Instance.getAttributeSlot(),0,0,0,0),this.d_(t,r),this.g_(t,r)),t.drawArrays(e._primitiveModeForBufferLessRendering.index,0,e._drawVertexNumberForBufferLessRendering)}WI(t){return this.i.config.isMultiDrawEnabled&&t.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported}k_(t,e,i){let n=$.MaterialSid.getAttributeSlot(),a=t._multiDrawGroup,o=i.getRawContextAsWebGL2();if(a==null||a.vertexHandles==null){o.vertexAttribI4ui(n,e.materialSID,0,0,0);return}let r=e===t.material,c=r?a.vertexHandles.vaoHandle:a.genericMaterialSidVaoHandle;if(c!=null){let s=this.i.webglResourceRepository.getWebGLResource(c);s!=null&&i.bindVertexArray(s)}r||o.vertexAttribI4ui(n,e.materialSID,0,0,0)}AI(t,e,i,n,a,o,r,c,s){let m=!c&&s===1&&this.i.config.isMultiDrawEnabled&&o.webgl2ExtMD!=null&&this.i.webglResourceRepository.isInstanceSidTextureCapable,l=!1;if(!m){for(let f=i;a>0?f<=n:f>=n;f+=a)l=this.TI(t[f],o,r,c,s,void 0,e==null?void 0:e[f])||l;return l}let h=le(i,n,a,f=>{let g=t[f];if(g===-1)return null;let x=e!=null?e[f]:A.getPrimitive(g);if(x==null||x._multiDrawGroup==null)return null;let v=r.getAppropriateMaterial(x);return v._materialContent.isMultiDrawCompatible?se(x,v,ce(x)):null},this.M_);for(let f=0;f<h.count;f++){let g=h.starts[f],x=h.counts[f];if(h.keys[f]===-1||x<2)for(let v=0;v<x;v++){let u=g+v*a;l=this.TI(t[u],o,r,c,s,void 0,e==null?void 0:e[u])||l}else l=this.N_(t,e,g,x,a,o,r,s)||l}return l}N_(t,e,i,n,a,o,r,c){var M;let s=e!=null?e[i]:A.getPrimitive(t[i]);if(s==null||s._multiDrawGroup==null)return!1;let m=s.mesh,l={primitive:s,mesh:m,indexed:s.hasIndices(),mode:s.primitiveMode.index,indexBitSize:s.getRenderIndexBitSize(),count:0,offset:0,instanceCount:0};if(!this.TI(t[i],o,r,!1,c,l,s)){let G=!1;for(let T=1;T<n;T++){let _=i+T*a;G=this.TI(t[_],o,r,!1,c,void 0,e==null?void 0:e[_])||G}return G}let h=s._multiDrawGroup,f=h.counts,g=h.offsets,x=h.instanceCounts,v=h.firsts,u=h.vertexCounts,R=l.indexed,S=o.getRawContextAsWebGL2(),b=0;f[b]=l.count,g[b]=l.offset,v[b]=l.offset,u[b]=l.count,x[b]=l.instanceCount,b++;let y=H._getInstanceCullingState(r),B=y==null?void 0:y.culledEntityStamp,E=(M=y==null?void 0:y.cullTick)!=null?M:0;for(let G=1;G<n;G++){let T=i+G*a,_=e!=null?e[T]:A.getPrimitive(t[T]);if(_==null||_._multiDrawGroup!==h)continue;let W=r.getAppropriateMaterial(_);if(W.getShaderProgramUid(_)===-1&&X(W,_,this),te(W,_))continue;let U=_.mesh._packVisibleInstancesToVariationVBO(B,E);if(U===0)continue;let O=_._multiDrawEntry;O!=null&&(f[b]=O.indexCount,g[b]=O.indexByteOffset,v[b]=O.vertexOffset,u[b]=O.vertexCount,x[b]=U,b++)}return b>=2?R?o.multiDrawElementsInstanced(l.mode,f,0,S.UNSIGNED_INT,g,0,x,0,b):o.multiDrawArraysInstanced(l.mode,v,0,u,0,x,0,b):b===1&&(R?S.drawElementsInstanced(l.mode,f[0],S.UNSIGNED_INT,g[0],x[0]):S.drawArraysInstanced(l.mode,v[0],u[0],x[0])),!0}TI(t,e,i,n,a,o,r){var b,y,B,E;let c=e.getRawContextAsWebGL2(),s=r!=null?r:A.getPrimitive(t);if(s==null)return!1;let m=s.mesh,l=m.meshEntitiesInner[0],d=i.getAppropriateMaterial(s);X(d,s,this);let h=l.getMeshRenderer(),f=H._getInstanceCullingState(i),g=m._packVisibleInstancesToVariationVBO(f==null?void 0:f.culledEntityStamp,(b=f==null?void 0:f.cullTick)!=null?b:0);if(g===0)return!1;let x=m.getPrimitiveIndexInMesh(s);this.attachVertexDataInner(m,s,x,e,m._variationVBOUid),this.WI(e)&&this.k_(s,d,e);let v=!1,u=!1,R=d.getShaderProgramUid(s);if(R!==this.SI||c.$A){if(te(d,s))return this.dettachVertexData(e),!1;let M=this.i.webglResourceRepository.getWebGLResource(R);c.useProgram(M),c.$A=!1,this.bindDataTexture(c,M),this.fI=M,v=!0,u=!0}((y=this.EI)==null?void 0:y.deref())!==d&&(u=!0,this.EI=new WeakRef(d)),this.kI!==d.stateVersion&&(u=!0,this.kI=d.stateVersion),this.WI(e)&&this.fI!=null&&(this.d_(c,this.fI),this.g_(c,this.fI));let S={glw:e,entity:l,worldMatrix:l.getSceneGraph().matrixInner,normalMatrix:l.getSceneGraph().normalMatrixInner,isBillboard:l.getSceneGraph().isBillboard,isVisible:l.getSceneGraph().isVisible,lightComponents:this.NI,renderPass:i,primitive:s,diffuseCube:h.diffuseCubeMap,specularCube:h.specularCubeMap,sheenCube:h.sheenCubeMap,isVr:n,displayIdx:-1};v&&d._setParametersToGpuWebGLPerShaderProgram({engine:this.i,material:d,shaderProgram:this.fI,firstTime:v,args:S}),u&&(this.KS(c,d,this.fI),L.setWebGLParameters(this.i,d,c),d._setParametersToGpuWebGL({engine:this.i,material:d,shaderProgram:this.fI,firstTime:u,args:S})),d._setParametersToGpuWebGLPerPrimitive({material:d,shaderProgram:this.fI,firstTime:u,args:S});for(let M=0;M<a;M++){if(n&&L.setVRViewport(this.i,i,M),this.ZS(i,M,n),this.QS(c,this.fI),this.l_(c,this.fI),this.fI.vrState!=null&&n&&a>1){let F=this.i.globalDataRepository.getValue("vrState",0);F._v[0]=n?1:0,F._v[1]=M,this.fI._gl.uniform2iv(this.fI.vrState,F._v)}this.i.config.isMultiDrawEnabled&&e.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported&&s._multiDrawGroup==null&&c.vertexAttribI4ui($.Instance.getAttributeSlot(),Math.max(0,m._instanceSidBase),0,0,0);let T=s.indicesAccessor,_=T!=null,W=s.getRenderIndexBitSize(),Y=W==="uint32"?c.UNSIGNED_INT:c.UNSIGNED_SHORT,U=s._multiDrawEntry,O=(B=U==null?void 0:U.indexByteOffset)!=null?B:0,Z=(E=U==null?void 0:U.vertexOffset)!=null?E:0;o!=null?(o.primitive=s,o.mesh=m,o.indexed=_,o.mode=s.primitiveMode.index,o.indexBitSize=W,o.count=_?T.elementCount:s.getVertexCountAsVerticesBased(),o.offset=_?O:Z,o.instanceCount=g):_?c.drawElementsInstanced(s.primitiveMode.index,T.elementCount,Y,O,g):c.drawArraysInstanced(s.primitiveMode.index,Z,s.getVertexCountAsVerticesBased(),g)}return this.SI=R,!0}l_(t,e){let i=e,n=i.lightClusterView;if(n==null)return;let a=this.xI._v[N.CameraComponentTID],o=this.i.lightClusterSystem,r=o.dataVersion;i._lightClusterViewCameraSid===a&&i._lightClusterViewVersion===r||(t.uniform4fv(n,o._getViewUniformData(a)),i._lightClusterViewCameraSid=a,i._lightClusterViewVersion=r)}QS(t,e){let i=this.xI._v,n=this.zI;if(this.FI===e&&n!=null&&n.length===i.length){let a=!0;for(let o=0;o<i.length;o++)if(n[o]!==i[o]){a=!1;break}if(a)return}t.uniform1fv(e.currentComponentSIDs,i),(n==null||n.length!==i.length)&&(n=new Float32Array(i.length),this.zI=n),n.set(i),this.FI=e}bindDataTexture(t,e){t.uniform1i(e.dataTexture,0),this.i.webglResourceRepository.bindTexture2D(0,this.__dataTextureUid);let i=this.i.webglResourceRepository.createOrGetTextureSamplerRepeatNearest();this.i.webglResourceRepository.bindTextureSampler(0,i),this.bindInstanceSidTextures(t,e)}bindInstanceSidTextures(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper;if(n==null||n.webgl2ExtMD==null||!this.i.config.isMultiDrawEnabled||!i.instanceSidTable.isSupported)return;let o=e;o.F_===void 0&&(o.BI=t.getUniformLocation(e,"u_instanceSidDataTextureIndex"),o.$I=t.getUniformLocation(e,"u_instanceRemapDataTextureIndex"),o.UI=t.getUniformLocation(e,"u_instanceRemapIdentity"),o.F_=null),o.BI!=null&&(t.uniform1i(o.BI,this._I),o.y_=this._I),o.$I!=null&&(t.uniform1i(o.$I,this.MI),o.x_=this.MI),o.UI!=null&&(t.uniform1i(o.UI,this.vI),o.I_=this.vI)}g_(t,e){let i=e;if(i.BI==null)return;let n=this._I;i.y_!==n&&(t.uniform1i(i.BI,n),i.y_=n);let a=this.MI;i.x_!==a&&(t.uniform1i(i.$I,a),i.x_=a)}d_(t,e){let i=e;if(i.UI==null)return;let n=this.vI;i.I_!==n&&(t.uniform1i(i.UI,n),i.I_=n)}destroy(){let t=this.i.webglResourceRepository;this.__dataTextureUid!==I.InvalidCGAPIResourceUid&&(t.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=I.InvalidCGAPIResourceUid),this.bI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.bI),this.bI=I.InvalidCGAPIResourceUid),this.gI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.gI),this.gI=I.InvalidCGAPIResourceUid),this.yI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.yI),this.yI=I.InvalidCGAPIResourceUid)}};export{ie as WebGLStrategyWebGL2};
@@ -13,9 +13,6 @@ var t=`
13
13
  uniform float u_pointSize; // initialValue=30
14
14
  uniform vec3 u_pointDistanceAttenuation; // initialValue=(0,0.1,0.01)
15
15
 
16
- // BiasMatrix * LightProjectionMatrix * LightViewMatrix, See: http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/#basic-shader
17
- uniform mat4 u_depthBiasPV; // initialValue=(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)
18
-
19
16
  #ifdef RN_IS_MORPHING
20
17
  uniform int u_currentPrimitiveIdx; // initialValue=0, isInternalSetting=true, soloDatum=false, needUniformInDataTextureMode=true
21
18
  #endif
@@ -23,6 +23,7 @@ in vec3 v_normal_inView;
23
23
 
24
24
  uniform bool u_inverseEnvironment; // initialValue=false
25
25
  uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
26
+ uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
26
27
  uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
27
28
 
28
29
  uniform samplerCube u_diffuseEnvTexture; // initialValue=(6,black), isInternalSetting=true
@@ -291,4 +292,4 @@ void main (){
291
292
 
292
293
 
293
294
  }
294
- `,e="fragment",r=!0,o={code:t,shaderStage:e,isFragmentShader:r};export{t as code,o as default,r as isFragmentShader,e as shaderStage};
295
+ `,e="fragment",r=!0,a={code:t,shaderStage:e,isFragmentShader:r};export{t as code,a as default,r as isFragmentShader,e as shaderStage};
@@ -74,6 +74,7 @@ uniform float u_uvAnimationRotationSpeedFactor; // initialValue=0.0
74
74
 
75
75
  uniform bool u_inverseEnvironment; // initialValue=false
76
76
  uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
77
+ uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
77
78
  uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
78
79
  uniform float u_alphaCutoff; // initialValue=0.5
79
80
  uniform bool u_makeOutputSrgb; // initialValue=false
@@ -0,0 +1,35 @@
1
+ var i=`
2
+
3
+ /* shaderity: @{glslPrecision} */
4
+
5
+ /* shaderity: @{definitions} */
6
+
7
+ /* shaderity: @{prerequisites} */
8
+
9
+ /* shaderity: @{vertexIn} */
10
+
11
+ in vec4 v_currentPosition_inClip;
12
+ in vec4 v_previousPosition_inClip;
13
+
14
+ /* shaderity: @{renderTargetBegin} */
15
+
16
+ /* shaderity: @{getters} */
17
+
18
+
19
+ void main (){
20
+
21
+ /* shaderity: @{mainPrerequisites} */
22
+
23
+ // The motion from the previous frame in texture coordinates. In WebGL, the texture coordinates of a
24
+ // render target have the same orientation as NDC (both y up), so the NDC motion is halved.
25
+ vec2 velocity = vec2(2.0, 2.0); // moves the history lookup off screen, i.e. rejects the history
26
+ if (v_previousPosition_inClip.w > 0.0) {
27
+ vec2 currentNdc = v_currentPosition_inClip.xy / v_currentPosition_inClip.w;
28
+ vec2 previousNdc = v_previousPosition_inClip.xy / v_previousPosition_inClip.w;
29
+ velocity = (currentNdc - previousNdc) * 0.5;
30
+ }
31
+
32
+ // z: the depth, used to pick the motion vector of the closest surface around a pixel.
33
+ rt0 = vec4(velocity, gl_FragCoord.z, 1.0);
34
+ }
35
+ `,t="fragment",r=!0,o={code:i,shaderStage:t,isFragmentShader:r};export{i as code,o as default,r as isFragmentShader,t as shaderStage};
@@ -0,0 +1,140 @@
1
+ var t=`
2
+ /* shaderity: @{enableVertexExtensions} */
3
+ /* shaderity: @{glslPrecision} */
4
+
5
+ /* shaderity: @{definitions} */
6
+
7
+ /* shaderity: @{vertexInOut} */
8
+
9
+ uniform float u_pointSize; // initialValue=30, soloDatum=true
10
+ uniform vec3 u_pointDistanceAttenuation; // initialValue=(0.0, 0.1, 0.01), soloDatum=true
11
+
12
+ // Clip space positions of this frame (without the jitter) and of the previous frame.
13
+ out vec4 v_currentPosition_inClip;
14
+ out vec4 v_previousPosition_inClip;
15
+
16
+ #ifdef RN_IS_MORPHING
17
+ uniform int u_currentPrimitiveIdx; // initialValue=0, isInternalSetting=true, soloDatum=false, needUniformInDataTextureMode=true
18
+ #endif
19
+
20
+
21
+ /* shaderity: @{prerequisites} */
22
+
23
+ /* shaderity: @{getters} */
24
+
25
+ /* shaderity: @{matricesGetters} */
26
+
27
+ /* shaderity: @{processGeometry} */
28
+
29
+ #ifdef RN_IS_SKINNING
30
+ // The matrix of one joint decoded from the bone data of the previous frame (see getBoneMatrix in processGeometry)
31
+ mat4 getPreviousBoneMatrix(uint skeletalComponentSID, uint jointIdx, int boneDataType, vec4 boneDataInfo) {
32
+ if (boneDataType == RN_BONE_DATA_TYPE_MAT43X1) {
33
+ vec4 a = get_previousBoneData(skeletalComponentSID, jointIdx * 3u);
34
+ vec4 b = get_previousBoneData(skeletalComponentSID, jointIdx * 3u + 1u);
35
+ vec4 c = get_previousBoneData(skeletalComponentSID, jointIdx * 3u + 2u);
36
+ return mat4(
37
+ a.x, a.y, a.z, 0.0,
38
+ a.w, b.x, b.y, 0.0,
39
+ b.z, b.w, c.x, 0.0,
40
+ c.y, c.z, c.w, 1.0
41
+ );
42
+ } else if (boneDataType == RN_BONE_DATA_TYPE_VEC4X2) {
43
+ vec4 tq = get_previousBoneData(skeletalComponentSID, jointIdx * 2u);
44
+ vec4 sq = get_previousBoneData(skeletalComponentSID, jointIdx * 2u + 1u);
45
+ vec4 quat = decodeLogQuat(uvec2(floatBitsToUint(tq.w), floatBitsToUint(sq.w)));
46
+ return createMatrixFromQuaternionTranslationScale(quat, tq.xyz, sq.xyz);
47
+ } else {
48
+ uvec4 chunk = floatBitsToUint(get_previousBoneData(skeletalComponentSID, jointIdx));
49
+ vec4 ts = unpackVec4FromUvec2(chunk.zw);
50
+ vec3 translation = ts.xyz * boneDataInfo.xyz;
51
+ float scale = decodeVec4x1Scale(ts.w, chunk.y);
52
+ return createMatrixFromQuaternionTranslationScale(decodeLogQuat(chunk.xy), translation, vec3(scale));
53
+ }
54
+ }
55
+
56
+ // The skinning matrix of the previous frame. The previous bone data info has w = -1 until the skeleton has
57
+ // previous bone data; the current skinning matrix is used then.
58
+ mat4 getPreviousSkinMatrix(uint skeletalComponentSID, uvec4 joint, vec4 weight) {
59
+ vec4 boneDataInfo = get_previousBoneDataInfo(skeletalComponentSID);
60
+ if (boneDataInfo.w < 0.0) {
61
+ return getSkinMatrix(skeletalComponentSID, joint, weight);
62
+ }
63
+ int boneDataType = int(boneDataInfo.w + 0.5);
64
+ mat4 skinMat = weight.x * getPreviousBoneMatrix(skeletalComponentSID, joint.x, boneDataType, boneDataInfo);
65
+ skinMat += weight.y * getPreviousBoneMatrix(skeletalComponentSID, joint.y, boneDataType, boneDataInfo);
66
+ skinMat += weight.z * getPreviousBoneMatrix(skeletalComponentSID, joint.z, boneDataType, boneDataInfo);
67
+ skinMat += weight.w * getPreviousBoneMatrix(skeletalComponentSID, joint.w, boneDataType, boneDataInfo);
68
+ return skinMat;
69
+ }
70
+ #endif
71
+
72
+ void main()
73
+ {
74
+
75
+ /* shaderity: @{mainPrerequisites} */
76
+
77
+ mat4 worldMatrix = get_worldMatrix(uint(a_instanceIds.x));
78
+ mat4 previousWorldMatrix = get_previousWorldMatrix(uint(a_instanceIds.x));
79
+ mat4 viewMatrix = get_viewMatrix(cameraSID);
80
+ mat4 projectionMatrix = get_projectionMatrix(cameraSID);
81
+ mat3 normalMatrix = get_normalMatrix(uint(a_instanceIds.x));
82
+ bool isBillboard = get_isBillboard(uint(a_instanceIds.x));
83
+
84
+ v_color = a_color;
85
+
86
+ bool isSkinning = false;
87
+
88
+ isSkinning = processGeometry(
89
+ worldMatrix,
90
+ normalMatrix,
91
+ viewMatrix,
92
+ a_position,
93
+ a_normal,
94
+ uvec4(a_joint),
95
+ a_weight,
96
+ isBillboard,
97
+ normalMatrix,
98
+ v_position_inWorld,
99
+ v_normal_inWorld
100
+ );
101
+
102
+ // The same (jittered) position as the color pass, so that the motion vectors cover the same pixels.
103
+ vec4 position_inClip = projectionMatrix * viewMatrix * v_position_inWorld;
104
+ gl_Position = position_inClip;
105
+
106
+ // The jitter moves the NDC position by currentJitter, i.e. the clip position by currentJitter * w.
107
+ vec2 currentJitter = get_currentJitter(materialSID, 0u);
108
+ v_currentPosition_inClip = position_inClip - vec4(currentJitter * position_inClip.w, 0.0, 0.0);
109
+
110
+ // The previous world position: the vertex deformed by the blend shape weights and the bone data of the previous
111
+ // frame, transformed by the world matrix of the previous frame.
112
+ vec4 previousPosition_inWorld;
113
+ if (isBillboard) {
114
+ // A billboard faces the camera of each frame: only the motion of its world matrix is considered.
115
+ previousPosition_inWorld = previousWorldMatrix * (inverse(worldMatrix) * v_position_inWorld);
116
+ } else {
117
+ vec3 previousPosition_inLocal = a_position.xyz;
118
+ #ifdef RN_IS_MORPHING
119
+ int blendShapeComponentSID = int(a_instanceIds.z);
120
+ if (blendShapeComponentSID != -1) {
121
+ previousPosition_inLocal = get_previousMorphedPosition(uint(a_baryCentricCoord.w), a_position.xyz, uint(blendShapeComponentSID));
122
+ }
123
+ #endif
124
+ mat4 previousLocalToWorld = previousWorldMatrix;
125
+ #ifdef RN_IS_SKINNING
126
+ if (skeletalComponentSID != INVALID_ID) {
127
+ previousLocalToWorld = previousWorldMatrix * getPreviousSkinMatrix(skeletalComponentSID, uvec4(a_joint), a_weight);
128
+ }
129
+ #endif
130
+ previousPosition_inWorld = previousLocalToWorld * vec4(previousPosition_inLocal, 1.0);
131
+ }
132
+ v_previousPosition_inClip = get_previousViewProjectionMatrix(materialSID, 0u) * previousPosition_inWorld;
133
+
134
+ bool visibility = get_isVisible(uint(a_instanceIds.x));
135
+ if (!visibility)
136
+ {
137
+ gl_Position = vec4(0.0);
138
+ }
139
+ }
140
+ `,i="vertex",o=!1,a={code:t,shaderStage:i,isFragmentShader:o};export{t as code,a as default,o as isFragmentShader,i as shaderStage};
@@ -18,6 +18,7 @@ uniform sampler2D u_metallicRoughnessTexture; // initialValue=(2,white)
18
18
  uniform bool u_isOutputHDR; // initialValue=0
19
19
  uniform bool u_makeOutputSrgb; // initialValue=1
20
20
  uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
21
+ uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
21
22
  uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
22
23
  uniform samplerCube u_diffuseEnvTexture; // initialValue=(6,black), isInternalSetting=true
23
24
  uniform samplerCube u_specularEnvTexture; // initialValue=(7,black), isInternalSetting=true
@@ -777,6 +778,7 @@ vec3 emissiveFactor = get_emissiveFactor(materialSID, 0u);
777
778
  /* shaderity: @{wireframe} */
778
779
 
779
780
  /* shaderity: @{outputSrgb} */
781
+
780
782
  rt0.rgb = rt0.rgb * rt0.a; // alpha premultiplied
781
783
  rt1 = rt0;
782
784
  rt2 = rt0;