rhodonite 0.27.1 → 0.28.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 (855) hide show
  1. package/README.md +10 -10
  2. package/VERSION-FILE +1 -1
  3. package/dist/esm/effekseer/EffekseerComponent.js +3 -3
  4. package/dist/esm/foundation/components/Camera/CameraComponent.js +1 -1
  5. package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +5 -5
  6. package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.js +1 -1
  7. package/dist/esm/foundation/core/GlobalDataRepository.d.ts +3 -3
  8. package/dist/esm/foundation/core/GlobalDataRepository.js +1 -1
  9. package/dist/esm/foundation/definitions/RenderBackend.d.ts +21 -0
  10. package/dist/esm/foundation/definitions/RenderBackend.js +1 -0
  11. package/dist/esm/foundation/definitions/index.d.ts +1 -1
  12. package/dist/esm/foundation/definitions/index.js +1 -1
  13. package/dist/esm/foundation/geometry/Mesh.d.ts +18 -68
  14. package/dist/esm/foundation/geometry/Mesh.js +1 -1
  15. package/dist/esm/foundation/geometry/Primitive.d.ts +1 -1
  16. package/dist/esm/foundation/geometry/Primitive.js +1 -1
  17. package/dist/esm/foundation/gizmos/RotationGizmo.js +1 -1
  18. package/dist/esm/foundation/gizmos/ScaleGizmo.js +1 -1
  19. package/dist/esm/foundation/gizmos/SphereColliderGizmo.js +1 -1
  20. package/dist/esm/foundation/gizmos/TranslationGizmo.js +1 -1
  21. package/dist/esm/foundation/helpers/BloomHelper.js +1 -1
  22. package/dist/esm/foundation/helpers/GaussianBlurHelper.js +1 -1
  23. package/dist/esm/foundation/helpers/Shadow/PointShadowMap.js +1 -1
  24. package/dist/esm/foundation/helpers/Shadow/ShadowCasterFilter.d.ts +8 -0
  25. package/dist/esm/foundation/helpers/Shadow/ShadowCasterFilter.js +1 -0
  26. package/dist/esm/foundation/helpers/Shadow/ShadowDirectionalAutoFit.d.ts +28 -0
  27. package/dist/esm/foundation/helpers/Shadow/ShadowDirectionalAutoFit.js +1 -0
  28. package/dist/esm/foundation/helpers/Shadow/ShadowMap.js +1 -1
  29. package/dist/esm/foundation/helpers/Shadow/ShadowSpotLightZNear.d.ts +8 -0
  30. package/dist/esm/foundation/helpers/Shadow/ShadowSpotLightZNear.js +1 -0
  31. package/dist/esm/foundation/helpers/Shadow/ShadowSystem.d.ts +1 -29
  32. package/dist/esm/foundation/helpers/Shadow/ShadowSystem.js +1 -1
  33. package/dist/esm/foundation/helpers/materials/nodeBasedMaterialCommon.js +1 -1
  34. package/dist/esm/foundation/materials/contents/ColorGradingUsingLUTsMaterialContent.d.ts +0 -20
  35. package/dist/esm/foundation/materials/contents/ColorGradingUsingLUTsMaterialContent.js +1 -1
  36. package/dist/esm/foundation/materials/contents/CustomMaterialContent.d.ts +3 -1
  37. package/dist/esm/foundation/materials/contents/CustomMaterialContent.js +1 -1
  38. package/dist/esm/foundation/materials/contents/DetectHighLuminanceMaterialContent.d.ts +0 -16
  39. package/dist/esm/foundation/materials/contents/DetectHighLuminanceMaterialContent.js +1 -1
  40. package/dist/esm/foundation/materials/contents/EntityUIDOutputMaterialContent.d.ts +0 -17
  41. package/dist/esm/foundation/materials/contents/EntityUIDOutputMaterialContent.js +1 -1
  42. package/dist/esm/foundation/materials/contents/FurnaceTestMaterialContent.d.ts +0 -21
  43. package/dist/esm/foundation/materials/contents/FurnaceTestMaterialContent.js +1 -1
  44. package/dist/esm/foundation/materials/contents/MToon0xMaterialContent.js +4 -4
  45. package/dist/esm/foundation/materials/contents/MToon1MaterialContent.js +3 -3
  46. package/dist/esm/foundation/materials/contents/MatCapMaterialContent.d.ts +0 -16
  47. package/dist/esm/foundation/materials/contents/MatCapMaterialContent.js +1 -1
  48. package/dist/esm/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +1 -1
  49. package/dist/esm/foundation/materials/contents/SynthesizeHdrMaterialContent.d.ts +0 -23
  50. package/dist/esm/foundation/materials/contents/SynthesizeHdrMaterialContent.js +1 -1
  51. package/dist/esm/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +1 -1
  52. package/dist/esm/foundation/materials/core/AbstractMaterialContent.d.ts +6 -61
  53. package/dist/esm/foundation/materials/core/AbstractMaterialContent.js +1 -1
  54. package/dist/esm/foundation/materials/core/AbstractShaderNode.d.ts +1 -1
  55. package/dist/esm/foundation/materials/core/AbstractShaderNode.js +2 -2
  56. package/dist/esm/foundation/materials/core/Material.d.ts +7 -114
  57. package/dist/esm/foundation/materials/core/Material.js +1 -1
  58. package/dist/esm/foundation/materials/core/MaterialRepository.js +1 -1
  59. package/dist/esm/foundation/materials/core/ShaderGraphResolver.js +6 -6
  60. package/dist/esm/foundation/materials/core/ShaderNodeFactories.d.ts +23 -0
  61. package/dist/esm/foundation/materials/core/ShaderNodeFactories.js +1 -0
  62. package/dist/esm/foundation/materials/core/ShaderProgramDefinitions.d.ts +41 -0
  63. package/dist/esm/foundation/materials/core/ShaderProgramDefinitions.js +23 -0
  64. package/dist/esm/foundation/materials/nodes/AbsShaderNode.js +1 -1
  65. package/dist/esm/foundation/materials/nodes/AcosShaderNode.js +1 -1
  66. package/dist/esm/foundation/materials/nodes/AddShaderNode.js +1 -1
  67. package/dist/esm/foundation/materials/nodes/Atan2ShaderNode.js +1 -1
  68. package/dist/esm/foundation/materials/nodes/BranchShaderNode.js +1 -1
  69. package/dist/esm/foundation/materials/nodes/CastToFloatShaderNode.d.ts +1 -1
  70. package/dist/esm/foundation/materials/nodes/CastToFloatShaderNode.js +1 -1
  71. package/dist/esm/foundation/materials/nodes/ClampShaderNode.d.ts +1 -1
  72. package/dist/esm/foundation/materials/nodes/ClampShaderNode.js +1 -1
  73. package/dist/esm/foundation/materials/nodes/CosShaderNode.d.ts +1 -1
  74. package/dist/esm/foundation/materials/nodes/CosShaderNode.js +1 -1
  75. package/dist/esm/foundation/materials/nodes/DotProductShaderNode.d.ts +2 -2
  76. package/dist/esm/foundation/materials/nodes/DotProductShaderNode.js +1 -1
  77. package/dist/esm/foundation/materials/nodes/EqualShaderNode.d.ts +1 -1
  78. package/dist/esm/foundation/materials/nodes/EqualShaderNode.js +1 -1
  79. package/dist/esm/foundation/materials/nodes/GreaterOrEqualShaderNode.d.ts +1 -1
  80. package/dist/esm/foundation/materials/nodes/GreaterOrEqualShaderNode.js +1 -1
  81. package/dist/esm/foundation/materials/nodes/GreaterThanShaderNode.d.ts +1 -1
  82. package/dist/esm/foundation/materials/nodes/GreaterThanShaderNode.js +1 -1
  83. package/dist/esm/foundation/materials/nodes/LengthShaderNode.d.ts +1 -1
  84. package/dist/esm/foundation/materials/nodes/LengthShaderNode.js +1 -1
  85. package/dist/esm/foundation/materials/nodes/LessOrEqualShaderNode.d.ts +1 -1
  86. package/dist/esm/foundation/materials/nodes/LessOrEqualShaderNode.js +1 -1
  87. package/dist/esm/foundation/materials/nodes/LessThanShaderNode.d.ts +1 -1
  88. package/dist/esm/foundation/materials/nodes/LessThanShaderNode.js +1 -1
  89. package/dist/esm/foundation/materials/nodes/MergeVectorShaderNode.js +1 -1
  90. package/dist/esm/foundation/materials/nodes/MinShaderNode.js +1 -1
  91. package/dist/esm/foundation/materials/nodes/MultiplyShaderNode.d.ts +1 -1
  92. package/dist/esm/foundation/materials/nodes/MultiplyShaderNode.js +1 -1
  93. package/dist/esm/foundation/materials/nodes/NormalizeShaderNode.d.ts +1 -1
  94. package/dist/esm/foundation/materials/nodes/NormalizeShaderNode.js +1 -1
  95. package/dist/esm/foundation/materials/nodes/NotEqualShaderNode.d.ts +1 -1
  96. package/dist/esm/foundation/materials/nodes/NotEqualShaderNode.js +1 -1
  97. package/dist/esm/foundation/materials/nodes/PremultipliedAlphaShaderNode.d.ts +1 -1
  98. package/dist/esm/foundation/materials/nodes/PremultipliedAlphaShaderNode.js +1 -1
  99. package/dist/esm/foundation/materials/nodes/Random_HashPRNGShaderNode.js +2 -2
  100. package/dist/esm/foundation/materials/nodes/Random_SinHashShaderNode.js +2 -2
  101. package/dist/esm/foundation/materials/nodes/RemapShaderNode.d.ts +1 -1
  102. package/dist/esm/foundation/materials/nodes/RemapShaderNode.js +1 -1
  103. package/dist/esm/foundation/materials/nodes/SinShaderNode.d.ts +1 -1
  104. package/dist/esm/foundation/materials/nodes/SinShaderNode.js +1 -1
  105. package/dist/esm/foundation/materials/nodes/SmoothStepShaderNode.d.ts +1 -1
  106. package/dist/esm/foundation/materials/nodes/SmoothStepShaderNode.js +1 -1
  107. package/dist/esm/foundation/materials/nodes/SplitVectorShaderNode.d.ts +1 -1
  108. package/dist/esm/foundation/materials/nodes/SplitVectorShaderNode.js +1 -1
  109. package/dist/esm/foundation/materials/nodes/StepShaderNode.js +1 -1
  110. package/dist/esm/foundation/materials/nodes/TanShaderNode.d.ts +1 -1
  111. package/dist/esm/foundation/materials/nodes/TanShaderNode.js +1 -1
  112. package/dist/esm/foundation/materials/nodes/TransformShaderNode.d.ts +1 -1
  113. package/dist/esm/foundation/materials/nodes/TransformShaderNode.js +1 -1
  114. package/dist/esm/foundation/math/MathClassUtil.js +1 -1
  115. package/dist/esm/foundation/math/MathUtil.d.ts +11 -0
  116. package/dist/esm/foundation/math/MathUtil.js +1 -1
  117. package/dist/esm/foundation/math/Transform3D.js +1 -1
  118. package/dist/esm/foundation/memory/Accessor.js +1 -1
  119. package/dist/esm/foundation/memory/Buffer.js +3 -3
  120. package/dist/esm/foundation/renderer/CGAPIResourceRepository.d.ts +74 -4
  121. package/dist/esm/foundation/renderer/CGAPIResourceRepository.js +1 -1
  122. package/dist/esm/foundation/renderer/FrameBuffer.js +1 -1
  123. package/dist/esm/foundation/renderer/FrameRenderer.d.ts +42 -0
  124. package/dist/esm/foundation/renderer/FrameRenderer.js +0 -0
  125. package/dist/esm/foundation/renderer/RenderPass.js +1 -1
  126. package/dist/esm/foundation/renderer/ShaderPropertyLayout.d.ts +77 -0
  127. package/dist/esm/foundation/renderer/ShaderPropertyLayout.js +1 -0
  128. package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +9 -3
  129. package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.js +1 -1
  130. package/dist/esm/foundation/renderer/lightCluster/LightClusterSystem.js +1 -1
  131. package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +4 -171
  132. package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.js +1 -1
  133. package/dist/esm/foundation/renderer/pipelines/RaymarchingRenderer.d.ts +263 -0
  134. package/dist/esm/foundation/renderer/pipelines/RaymarchingRenderer.js +1 -0
  135. package/dist/esm/foundation/system/Engine.d.ts +17 -28
  136. package/dist/esm/foundation/system/Engine.js +1 -1
  137. package/dist/esm/foundation/system/EngineState.d.ts +3 -3
  138. package/dist/esm/foundation/system/EngineState.js +1 -1
  139. package/dist/esm/foundation/textures/AbstractReadableRenderTargetTexture.d.ts +39 -0
  140. package/dist/esm/foundation/textures/AbstractReadableRenderTargetTexture.js +1 -0
  141. package/dist/esm/foundation/textures/AbstractRenderTargetTexture.d.ts +60 -0
  142. package/dist/esm/foundation/textures/AbstractRenderTargetTexture.js +1 -0
  143. package/dist/esm/foundation/textures/AbstractTexture.js +1 -1
  144. package/dist/esm/foundation/textures/CubeTexture.js +1 -1
  145. package/dist/esm/foundation/textures/RenderBuffer.js +1 -1
  146. package/dist/esm/foundation/textures/RenderTargetTexture.d.ts +5 -67
  147. package/dist/esm/foundation/textures/RenderTargetTexture.js +1 -1
  148. package/dist/esm/foundation/textures/RenderTargetTexture2DArray.d.ts +5 -71
  149. package/dist/esm/foundation/textures/RenderTargetTexture2DArray.js +1 -1
  150. package/dist/esm/foundation/textures/RenderTargetTextureCube.d.ts +8 -50
  151. package/dist/esm/foundation/textures/RenderTargetTextureCube.js +1 -1
  152. package/dist/esm/foundation/textures/Texture.d.ts +19 -1
  153. package/dist/esm/foundation/textures/Texture.js +1 -1
  154. package/dist/esm/foundation/textures/TextureArray.js +1 -1
  155. package/dist/esm/foundation/textures/TextureDataFloat.js +1 -1
  156. package/dist/esm/foundation/textures/VideoTexture.d.ts +11 -0
  157. package/dist/esm/foundation/textures/VideoTexture.js +1 -1
  158. package/dist/esm/foundation/textures/decodeBasisImage.d.ts +14 -0
  159. package/dist/esm/foundation/textures/decodeBasisImage.js +1 -0
  160. package/dist/esm/foundation/textures/index.d.ts +2 -0
  161. package/dist/esm/foundation/textures/index.js +1 -1
  162. package/dist/esm/version.js +1 -1
  163. package/dist/esm/webgl/ComponentDataAccessorGLSL.d.ts +9 -0
  164. package/dist/esm/webgl/ComponentDataAccessorGLSL.js +27 -0
  165. package/dist/esm/webgl/MultiDraw.d.ts +1 -1
  166. package/dist/esm/webgl/MultiDraw.js +1 -1
  167. package/dist/esm/webgl/MultiDrawRepository.js +1 -1
  168. package/dist/esm/webgl/ShaderPropertyAccessorGLSL.d.ts +11 -0
  169. package/dist/esm/webgl/ShaderPropertyAccessorGLSL.js +29 -0
  170. package/dist/esm/webgl/WebGLCompressedTextures.d.ts +48 -0
  171. package/dist/esm/webgl/WebGLCompressedTextures.js +1 -0
  172. package/dist/esm/webgl/WebGLContextWrapper.d.ts +9 -52
  173. package/dist/esm/webgl/WebGLContextWrapper.js +1 -1
  174. package/dist/esm/webgl/WebGLCubeTextureFileLoader.d.ts +38 -0
  175. package/dist/esm/webgl/WebGLCubeTextureFileLoader.js +1 -0
  176. package/dist/esm/webgl/WebGLCubeTextures.d.ts +92 -0
  177. package/dist/esm/webgl/WebGLCubeTextures.js +42 -0
  178. package/dist/esm/webgl/WebGLDataTexture.d.ts +108 -0
  179. package/dist/esm/webgl/WebGLDataTexture.js +1 -0
  180. package/dist/esm/webgl/WebGLDrawState.d.ts +84 -0
  181. package/dist/esm/webgl/WebGLDrawState.js +1 -0
  182. package/dist/esm/webgl/WebGLExternalState.d.ts +43 -0
  183. package/dist/esm/webgl/WebGLExternalState.js +1 -0
  184. package/dist/esm/webgl/WebGLFrameRenderer.d.ts +32 -0
  185. package/dist/esm/webgl/WebGLFrameRenderer.js +1 -0
  186. package/dist/esm/webgl/WebGLFramebuffers.d.ts +142 -0
  187. package/dist/esm/webgl/WebGLFramebuffers.js +1 -0
  188. package/dist/esm/webgl/WebGLGpuTimer.js +1 -1
  189. package/dist/esm/webgl/WebGLMaterialParameters.d.ts +47 -0
  190. package/dist/esm/webgl/WebGLMaterialParameters.js +1 -0
  191. package/dist/esm/webgl/WebGLMeshResources.d.ts +115 -0
  192. package/dist/esm/webgl/WebGLMeshResources.js +1 -0
  193. package/dist/esm/webgl/WebGLMorphUniformBuffers.d.ts +66 -0
  194. package/dist/esm/webgl/WebGLMorphUniformBuffers.js +57 -0
  195. package/dist/esm/webgl/WebGLResourceRepository.d.ts +100 -178
  196. package/dist/esm/webgl/WebGLResourceRepository.js +1 -55
  197. package/dist/esm/webgl/WebGLSamplers.d.ts +78 -0
  198. package/dist/esm/webgl/WebGLSamplers.js +1 -0
  199. package/dist/esm/webgl/WebGLShaderProgramBuilder.d.ts +40 -0
  200. package/dist/esm/webgl/WebGLShaderProgramBuilder.js +15 -0
  201. package/dist/esm/webgl/WebGLShaderPrograms.d.ts +88 -0
  202. package/dist/esm/webgl/WebGLShaderPrograms.js +14 -0
  203. package/dist/esm/webgl/WebGLStereoUtil.d.ts +0 -27
  204. package/dist/esm/webgl/WebGLStereoUtil.js +3 -3
  205. package/dist/esm/webgl/WebGLStrategyDataUploader.d.ts +152 -0
  206. package/dist/esm/webgl/WebGLStrategyDataUploader.js +1 -0
  207. package/dist/esm/webgl/WebGLStrategyMeshBatchRenderer.d.ts +40 -0
  208. package/dist/esm/webgl/WebGLStrategyMeshBatchRenderer.js +1 -0
  209. package/dist/esm/webgl/WebGLStrategyMeshDrawer.d.ts +92 -0
  210. package/dist/esm/webgl/WebGLStrategyMeshDrawer.js +1 -0
  211. package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +7 -360
  212. package/dist/esm/webgl/WebGLStrategyWebGL2.js +1 -146
  213. package/dist/esm/webgl/WebGLTextureUnitState.d.ts +79 -0
  214. package/dist/esm/webgl/WebGLTextureUnitState.js +1 -0
  215. package/dist/esm/webgl/WebGLTextureUploads.d.ts +106 -0
  216. package/dist/esm/webgl/WebGLTextureUploads.js +1 -0
  217. package/dist/esm/webgl/WebGLTextures.d.ts +316 -0
  218. package/dist/esm/webgl/WebGLTextures.js +1 -0
  219. package/dist/esm/webgl/WebGLUniformBuffers.d.ts +35 -0
  220. package/dist/esm/webgl/WebGLUniformBuffers.js +1 -0
  221. package/dist/esm/webgl/WebGLUniforms.d.ts +117 -0
  222. package/dist/esm/webgl/WebGLUniforms.js +1 -0
  223. package/dist/esm/webgl/WebGLVertexBuffers.d.ts +172 -0
  224. package/dist/esm/webgl/WebGLVertexBuffers.js +1 -0
  225. package/dist/esm/webgl/debug/BufferLayoutDecoder.d.ts +4 -4
  226. package/dist/esm/webgl/debug/BufferLayoutDecoder.js +1 -1
  227. package/dist/esm/webgl/debug/ShaderParameterDebugger.js +1 -1
  228. package/dist/esm/webgl/debug/types.d.ts +2 -2
  229. package/dist/esm/webgl/getRenderingStrategy.d.ts +2 -2
  230. package/dist/esm/webgl/getRenderingStrategy.js +1 -1
  231. package/dist/esm/webgl/main.d.ts +4 -17
  232. package/dist/esm/webgl/main.js +1 -1
  233. package/dist/esm/webgl/readColorAttachmentAsRgba8.d.ts +36 -0
  234. package/dist/esm/webgl/readColorAttachmentAsRgba8.js +1 -0
  235. package/dist/esm/webgl/shaders/RaymarchingShaderPart.d.ts +2 -2
  236. package/dist/esm/webgl/shaders/RaymarchingShaderPart.js +9 -9
  237. package/dist/esm/webgl/shaders/RaymarchingShadowShaderPart.js +9 -9
  238. package/dist/esm/webgl/shaders/StandardShaderPart.d.ts +3 -3
  239. package/dist/esm/webgl/shaders/StandardShaderPart.js +16 -16
  240. package/dist/esm/webgl/shaders/glslCommonChunks.d.ts +2 -2
  241. package/dist/esm/webgl/shaders/nodes/BlockBeginShader.js +1 -1
  242. package/dist/esm/webgl/shaders/nodes/BlockEndShader.js +1 -1
  243. package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.d.ts +2 -2
  244. package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.js +7 -7
  245. package/dist/esm/webgl/shaders/nodes/DiscardShader.d.ts +1 -1
  246. package/dist/esm/webgl/shaders/nodes/DiscardShader.js +3 -3
  247. package/dist/esm/webgl/shaders/nodes/EndShader.d.ts +2 -2
  248. package/dist/esm/webgl/shaders/nodes/EndShader.js +3 -3
  249. package/dist/esm/webgl/shaders/nodes/OutDistance.d.ts +1 -1
  250. package/dist/esm/webgl/shaders/nodes/OutDistance.js +1 -1
  251. package/dist/esm/webgl/shaders/nodes/OutUnion.js +1 -1
  252. package/dist/esm/webgl/shaders/nodes/RaymarchObjectIdUniform.js +3 -3
  253. package/dist/esm/webgl/shaders/nodes/SdApplyTransform.js +1 -1
  254. package/dist/esm/webgl/shaders/nodes/SdApplyWorldMatrix.d.ts +1 -1
  255. package/dist/esm/webgl/shaders/nodes/SdApplyWorldMatrix.js +3 -3
  256. package/dist/esm/webgl/shaders/nodes/Texture2DShader.js +18 -18
  257. package/dist/esm/webgl/shaders/nodes/UniformDataShader.js +14 -14
  258. package/dist/esm/webgl/textureLoader/KTX2TextureLoader.d.ts +1 -1
  259. package/dist/esm/webgl/textureLoader/KTX2TextureLoader.js +1 -1
  260. package/dist/esm/webgpu/AttributeReader.d.ts +18 -0
  261. package/dist/esm/webgpu/AttributeReader.js +1 -0
  262. package/dist/esm/webgpu/GpuCullingRegistry.js +1 -1
  263. package/dist/esm/webgpu/GpuDeformRegistry.js +1 -1
  264. package/dist/esm/webgpu/RangeAllocator.js +1 -1
  265. package/dist/esm/webgpu/ShaderPropertyAccessorWGSL.d.ts +11 -0
  266. package/dist/esm/webgpu/ShaderPropertyAccessorWGSL.js +24 -0
  267. package/dist/esm/webgpu/WebGpuBindGroups.d.ts +131 -0
  268. package/dist/esm/webgpu/WebGpuBindGroups.js +1 -0
  269. package/dist/esm/webgpu/WebGpuBufferArena.js +1 -1
  270. package/dist/esm/webgpu/WebGpuCompressedTextures.d.ts +38 -0
  271. package/dist/esm/webgpu/WebGpuCompressedTextures.js +1 -0
  272. package/dist/esm/webgpu/WebGpuCubeTextureShaders.d.ts +1 -0
  273. package/dist/esm/webgpu/WebGpuCubeTextureShaders.js +60 -0
  274. package/dist/esm/webgpu/WebGpuCubeTextures.d.ts +72 -0
  275. package/dist/esm/webgpu/WebGpuCubeTextures.js +1 -0
  276. package/dist/esm/webgpu/WebGpuDraw.d.ts +63 -0
  277. package/dist/esm/webgpu/WebGpuDraw.js +1 -0
  278. package/dist/esm/webgpu/WebGpuDrawParameters.d.ts +61 -0
  279. package/dist/esm/webgpu/WebGpuDrawParameters.js +1 -0
  280. package/dist/esm/webgpu/WebGpuExternalRenderPass.d.ts +44 -0
  281. package/dist/esm/webgpu/WebGpuExternalRenderPass.js +1 -0
  282. package/dist/esm/webgpu/WebGpuFrame.d.ts +55 -0
  283. package/dist/esm/webgpu/WebGpuFrame.js +1 -0
  284. package/dist/esm/webgpu/WebGpuFrameRenderer.d.ts +25 -0
  285. package/dist/esm/webgpu/WebGpuFrameRenderer.js +1 -0
  286. package/dist/esm/webgpu/WebGpuGpuCulling.js +1 -236
  287. package/dist/esm/webgpu/WebGpuGpuCullingShaders.d.ts +34 -0
  288. package/dist/esm/webgpu/WebGpuGpuCullingShaders.js +236 -0
  289. package/dist/esm/webgpu/WebGpuGpuTimer.js +1 -1
  290. package/dist/esm/webgpu/WebGpuLightClusterBuilder.js +1 -153
  291. package/dist/esm/webgpu/WebGpuLightClusterShaders.d.ts +14 -0
  292. package/dist/esm/webgpu/WebGpuLightClusterShaders.js +153 -0
  293. package/dist/esm/webgpu/WebGpuMipmapGenerator.d.ts +54 -0
  294. package/dist/esm/webgpu/WebGpuMipmapGenerator.js +1 -0
  295. package/dist/esm/webgpu/WebGpuMipmapShaders.d.ts +1 -0
  296. package/dist/esm/webgpu/WebGpuMipmapShaders.js +26 -0
  297. package/dist/esm/webgpu/WebGpuRenderBundles.d.ts +117 -0
  298. package/dist/esm/webgpu/WebGpuRenderBundles.js +1 -0
  299. package/dist/esm/webgpu/WebGpuRenderPassEncoders.d.ts +140 -0
  300. package/dist/esm/webgpu/WebGpuRenderPassEncoders.js +1 -0
  301. package/dist/esm/webgpu/WebGpuRenderPipelines.d.ts +75 -0
  302. package/dist/esm/webgpu/WebGpuRenderPipelines.js +3 -0
  303. package/dist/esm/webgpu/WebGpuRenderTargetTextures.d.ts +78 -0
  304. package/dist/esm/webgpu/WebGpuRenderTargetTextures.js +1 -0
  305. package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +52 -322
  306. package/dist/esm/webgpu/WebGpuResourceRepository.js +1 -116
  307. package/dist/esm/webgpu/WebGpuSamplers.d.ts +45 -0
  308. package/dist/esm/webgpu/WebGpuSamplers.js +1 -0
  309. package/dist/esm/webgpu/WebGpuShaderProgramBuilder.d.ts +25 -0
  310. package/dist/esm/webgpu/WebGpuShaderProgramBuilder.js +9 -0
  311. package/dist/esm/webgpu/WebGpuStorageBuffers.d.ts +77 -0
  312. package/dist/esm/webgpu/WebGpuStorageBuffers.js +1 -0
  313. package/dist/esm/webgpu/WebGpuStrategyBasic.d.ts +1 -73
  314. package/dist/esm/webgpu/WebGpuStrategyBasic.js +1 -139
  315. package/dist/esm/webgpu/WebGpuStrategyStorage.d.ts +62 -0
  316. package/dist/esm/webgpu/WebGpuStrategyStorage.js +1 -0
  317. package/dist/esm/webgpu/WebGpuTextureReadback.d.ts +111 -0
  318. package/dist/esm/webgpu/WebGpuTextureReadback.js +1 -0
  319. package/dist/esm/webgpu/WebGpuTextureReadbackShaders.d.ts +4 -0
  320. package/dist/esm/webgpu/WebGpuTextureReadbackShaders.js +26 -0
  321. package/dist/esm/webgpu/WebGpuTextureUploads.d.ts +109 -0
  322. package/dist/esm/webgpu/WebGpuTextureUploads.js +1 -0
  323. package/dist/esm/webgpu/WebGpuTextures.d.ts +196 -0
  324. package/dist/esm/webgpu/WebGpuTextures.js +1 -0
  325. package/dist/esm/webgpu/WebGpuVertexBuffers.d.ts +142 -0
  326. package/dist/esm/webgpu/WebGpuVertexBuffers.js +1 -0
  327. package/dist/esm/webgpu/WebGpuVertexDeformer.js +1 -124
  328. package/dist/esm/webgpu/WebGpuVertexDeformerShaders.d.ts +7 -0
  329. package/dist/esm/webgpu/WebGpuVertexDeformerShaders.js +124 -0
  330. package/dist/esm/webgpu/WebGpuVertexShaderDefinitions.d.ts +16 -0
  331. package/dist/esm/webgpu/WebGpuVertexShaderDefinitions.js +84 -0
  332. package/dist/esm/webgpu/assertArrayBufferView.d.ts +9 -0
  333. package/dist/esm/webgpu/assertArrayBufferView.js +1 -0
  334. package/dist/esm/webgpu/main.d.ts +2 -16
  335. package/dist/esm/webgpu/main.js +1 -1
  336. package/dist/esm/webgpu/padCompressedRowsForUpload.d.ts +20 -0
  337. package/dist/esm/webgpu/padCompressedRowsForUpload.js +1 -0
  338. package/dist/esm/webgpu/removeRowPadding.d.ts +21 -0
  339. package/dist/esm/webgpu/removeRowPadding.js +1 -0
  340. package/dist/esm/webgpu/shaderity_shaders/common/processGeometry.wgsl.js +1 -1
  341. package/dist/esm/webgpu/wgslCommonChunks.d.ts +2 -2
  342. package/dist/esm/xr/WebARSystem.js +1 -1
  343. package/dist/esm/xr/WebXRSystem.d.ts +0 -4
  344. package/dist/esm/xr/WebXRSystem.js +1 -1
  345. package/dist/esmdev/effekseer/EffekseerComponent.js +3 -3
  346. package/dist/esmdev/foundation/components/Camera/CameraComponent.js +4 -4
  347. package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +5 -5
  348. package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.js +11 -11
  349. package/dist/esmdev/foundation/core/GlobalDataRepository.d.ts +3 -3
  350. package/dist/esmdev/foundation/core/GlobalDataRepository.js +3 -3
  351. package/dist/esmdev/foundation/definitions/RenderBackend.d.ts +21 -0
  352. package/dist/esmdev/foundation/definitions/RenderBackend.js +60 -0
  353. package/dist/esmdev/foundation/definitions/index.d.ts +1 -1
  354. package/dist/esmdev/foundation/definitions/index.js +2 -2
  355. package/dist/esmdev/foundation/geometry/Mesh.d.ts +18 -68
  356. package/dist/esmdev/foundation/geometry/Mesh.js +159 -383
  357. package/dist/esmdev/foundation/geometry/Primitive.d.ts +1 -1
  358. package/dist/esmdev/foundation/geometry/Primitive.js +123 -123
  359. package/dist/esmdev/foundation/geometry/SimpleVertexAttribute.js +5 -5
  360. package/dist/esmdev/foundation/geometry/shapes/Cylinder.js +3 -3
  361. package/dist/esmdev/foundation/geometry/shapes/Joint.js +33 -33
  362. package/dist/esmdev/foundation/gizmos/AABBGizmo.js +12 -12
  363. package/dist/esmdev/foundation/gizmos/CapsuleColliderGizmo.js +23 -23
  364. package/dist/esmdev/foundation/gizmos/Gizmo.js +23 -23
  365. package/dist/esmdev/foundation/gizmos/JointGizmo.js +37 -37
  366. package/dist/esmdev/foundation/gizmos/LightGizmo.js +69 -69
  367. package/dist/esmdev/foundation/gizmos/LocatorGizmo.js +22 -22
  368. package/dist/esmdev/foundation/gizmos/RotationGizmo.js +212 -212
  369. package/dist/esmdev/foundation/gizmos/ScaleGizmo.js +130 -130
  370. package/dist/esmdev/foundation/gizmos/ShapeGizmo.js +43 -43
  371. package/dist/esmdev/foundation/gizmos/SphereColliderGizmo.js +24 -24
  372. package/dist/esmdev/foundation/gizmos/TranslationGizmo.js +129 -129
  373. package/dist/esmdev/foundation/helpers/BloomHelper.js +34 -34
  374. package/dist/esmdev/foundation/helpers/GaussianBlurHelper.js +18 -18
  375. package/dist/esmdev/foundation/helpers/Shadow/PointShadowMap.js +12 -12
  376. package/dist/esmdev/foundation/helpers/Shadow/ShadowCasterFilter.d.ts +8 -0
  377. package/dist/esmdev/foundation/helpers/Shadow/ShadowCasterFilter.js +17 -0
  378. package/dist/esmdev/foundation/helpers/Shadow/ShadowDirectionalAutoFit.d.ts +28 -0
  379. package/dist/esmdev/foundation/helpers/Shadow/ShadowDirectionalAutoFit.js +126 -0
  380. package/dist/esmdev/foundation/helpers/Shadow/ShadowMap.js +3 -3
  381. package/dist/esmdev/foundation/helpers/Shadow/ShadowSpotLightZNear.d.ts +8 -0
  382. package/dist/esmdev/foundation/helpers/Shadow/ShadowSpotLightZNear.js +87 -0
  383. package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.d.ts +1 -29
  384. package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.js +76 -285
  385. package/dist/esmdev/foundation/helpers/materials/nodeBasedMaterialCommon.js +3 -3
  386. package/dist/esmdev/foundation/importer/AnimationAssigner.js +44 -44
  387. package/dist/esmdev/foundation/importer/DrcPointCloudImporter.js +30 -30
  388. package/dist/esmdev/foundation/importer/Gltf2Importer.js +14 -14
  389. package/dist/esmdev/foundation/importer/GltfImporter.js +22 -22
  390. package/dist/esmdev/foundation/importer/ModelConverter.js +137 -137
  391. package/dist/esmdev/foundation/importer/RhodoniteImportExtension.js +6 -6
  392. package/dist/esmdev/foundation/importer/Vrm0xImporter.js +48 -48
  393. package/dist/esmdev/foundation/importer/VrmImporter.js +10 -10
  394. package/dist/esmdev/foundation/materials/contents/ColorGradingUsingLUTsMaterialContent.d.ts +0 -20
  395. package/dist/esmdev/foundation/materials/contents/ColorGradingUsingLUTsMaterialContent.js +1 -33
  396. package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.d.ts +3 -1
  397. package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.js +31 -30
  398. package/dist/esmdev/foundation/materials/contents/DepthEncodeMaterialContent.js +2 -2
  399. package/dist/esmdev/foundation/materials/contents/DetectHighLuminanceMaterialContent.d.ts +0 -16
  400. package/dist/esmdev/foundation/materials/contents/DetectHighLuminanceMaterialContent.js +3 -19
  401. package/dist/esmdev/foundation/materials/contents/EntityUIDOutputMaterialContent.d.ts +0 -17
  402. package/dist/esmdev/foundation/materials/contents/EntityUIDOutputMaterialContent.js +1 -17
  403. package/dist/esmdev/foundation/materials/contents/FurnaceTestMaterialContent.d.ts +0 -21
  404. package/dist/esmdev/foundation/materials/contents/FurnaceTestMaterialContent.js +1 -21
  405. package/dist/esmdev/foundation/materials/contents/MToon0xMaterialContent.js +142 -143
  406. package/dist/esmdev/foundation/materials/contents/MToon1MaterialContent.js +21 -22
  407. package/dist/esmdev/foundation/materials/contents/MatCapMaterialContent.d.ts +0 -16
  408. package/dist/esmdev/foundation/materials/contents/MatCapMaterialContent.js +1 -17
  409. package/dist/esmdev/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +7 -8
  410. package/dist/esmdev/foundation/materials/contents/SynthesizeHdrMaterialContent.d.ts +0 -23
  411. package/dist/esmdev/foundation/materials/contents/SynthesizeHdrMaterialContent.js +3 -29
  412. package/dist/esmdev/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +7 -8
  413. package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.d.ts +6 -61
  414. package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.js +61 -153
  415. package/dist/esmdev/foundation/materials/core/AbstractShaderNode.d.ts +1 -1
  416. package/dist/esmdev/foundation/materials/core/AbstractShaderNode.js +31 -31
  417. package/dist/esmdev/foundation/materials/core/DummyTextures.js +3 -3
  418. package/dist/esmdev/foundation/materials/core/Material.d.ts +7 -114
  419. package/dist/esmdev/foundation/materials/core/Material.js +100 -348
  420. package/dist/esmdev/foundation/materials/core/MaterialRepository.js +55 -55
  421. package/dist/esmdev/foundation/materials/core/ShaderGraphResolver.js +46 -1399
  422. package/dist/esmdev/foundation/materials/core/ShaderNodeFactories.d.ts +23 -0
  423. package/dist/esmdev/foundation/materials/core/ShaderNodeFactories.js +609 -0
  424. package/dist/esmdev/foundation/materials/core/ShaderProgramDefinitions.d.ts +41 -0
  425. package/dist/esmdev/foundation/materials/core/ShaderProgramDefinitions.js +95 -0
  426. package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGL.js +14 -14
  427. package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGPU.js +15 -15
  428. package/dist/esmdev/foundation/materials/nodes/AbsShaderNode.js +16 -16
  429. package/dist/esmdev/foundation/materials/nodes/AcosShaderNode.js +16 -16
  430. package/dist/esmdev/foundation/materials/nodes/AddShaderNode.js +21 -21
  431. package/dist/esmdev/foundation/materials/nodes/AlphaTestShaderNode.js +5 -5
  432. package/dist/esmdev/foundation/materials/nodes/AndShaderNode.js +6 -6
  433. package/dist/esmdev/foundation/materials/nodes/Atan2ShaderNode.js +18 -18
  434. package/dist/esmdev/foundation/materials/nodes/AttributeColorShaderNode.js +1 -1
  435. package/dist/esmdev/foundation/materials/nodes/AttributeInstanceIdsShaderNode.js +1 -1
  436. package/dist/esmdev/foundation/materials/nodes/AttributeJointShaderNode.js +1 -1
  437. package/dist/esmdev/foundation/materials/nodes/AttributeNormalShaderNode.js +1 -1
  438. package/dist/esmdev/foundation/materials/nodes/AttributePositionShaderNode.js +2 -2
  439. package/dist/esmdev/foundation/materials/nodes/AttributeTangentShaderNode.js +1 -1
  440. package/dist/esmdev/foundation/materials/nodes/AttributeTexcoordShaderNode.js +2 -2
  441. package/dist/esmdev/foundation/materials/nodes/AttributeWeightShaderNode.js +1 -1
  442. package/dist/esmdev/foundation/materials/nodes/BlockBeginShaderNode.js +11 -11
  443. package/dist/esmdev/foundation/materials/nodes/BlockEndShaderNode.js +6 -6
  444. package/dist/esmdev/foundation/materials/nodes/BranchShaderNode.js +18 -18
  445. package/dist/esmdev/foundation/materials/nodes/CalcBitangentShaderNode.js +7 -7
  446. package/dist/esmdev/foundation/materials/nodes/CastToFloatShaderNode.d.ts +1 -1
  447. package/dist/esmdev/foundation/materials/nodes/CastToFloatShaderNode.js +17 -17
  448. package/dist/esmdev/foundation/materials/nodes/ClampShaderNode.d.ts +1 -1
  449. package/dist/esmdev/foundation/materials/nodes/ClampShaderNode.js +19 -19
  450. package/dist/esmdev/foundation/materials/nodes/ClassicShaderNode.js +11 -11
  451. package/dist/esmdev/foundation/materials/nodes/ConstantScalarVariableShaderNode.js +1 -1
  452. package/dist/esmdev/foundation/materials/nodes/ConstantVariableShaderNode.js +5 -5
  453. package/dist/esmdev/foundation/materials/nodes/ConstantVector2VariableShaderNode.js +1 -1
  454. package/dist/esmdev/foundation/materials/nodes/ConstantVector3VariableShaderNode.js +1 -1
  455. package/dist/esmdev/foundation/materials/nodes/ConstantVector4VariableShaderNode.js +1 -1
  456. package/dist/esmdev/foundation/materials/nodes/CosShaderNode.d.ts +1 -1
  457. package/dist/esmdev/foundation/materials/nodes/CosShaderNode.js +17 -17
  458. package/dist/esmdev/foundation/materials/nodes/DiscardShaderNode.js +2 -2
  459. package/dist/esmdev/foundation/materials/nodes/DotProductShaderNode.d.ts +2 -2
  460. package/dist/esmdev/foundation/materials/nodes/DotProductShaderNode.js +15 -15
  461. package/dist/esmdev/foundation/materials/nodes/EqualShaderNode.d.ts +1 -1
  462. package/dist/esmdev/foundation/materials/nodes/EqualShaderNode.js +14 -14
  463. package/dist/esmdev/foundation/materials/nodes/FlatShaderNode.js +5 -5
  464. package/dist/esmdev/foundation/materials/nodes/GreaterOrEqualShaderNode.d.ts +1 -1
  465. package/dist/esmdev/foundation/materials/nodes/GreaterOrEqualShaderNode.js +14 -14
  466. package/dist/esmdev/foundation/materials/nodes/GreaterShaderNode.js +3 -3
  467. package/dist/esmdev/foundation/materials/nodes/GreaterThanShaderNode.d.ts +1 -1
  468. package/dist/esmdev/foundation/materials/nodes/GreaterThanShaderNode.js +14 -14
  469. package/dist/esmdev/foundation/materials/nodes/LengthShaderNode.d.ts +1 -1
  470. package/dist/esmdev/foundation/materials/nodes/LengthShaderNode.js +17 -17
  471. package/dist/esmdev/foundation/materials/nodes/LessOrEqualShaderNode.d.ts +1 -1
  472. package/dist/esmdev/foundation/materials/nodes/LessOrEqualShaderNode.js +14 -14
  473. package/dist/esmdev/foundation/materials/nodes/LessThanShaderNode.d.ts +1 -1
  474. package/dist/esmdev/foundation/materials/nodes/LessThanShaderNode.js +14 -14
  475. package/dist/esmdev/foundation/materials/nodes/MergeVectorShaderNode.js +23 -23
  476. package/dist/esmdev/foundation/materials/nodes/MinShaderNode.js +21 -21
  477. package/dist/esmdev/foundation/materials/nodes/MultiplyShaderNode.d.ts +1 -1
  478. package/dist/esmdev/foundation/materials/nodes/MultiplyShaderNode.js +25 -25
  479. package/dist/esmdev/foundation/materials/nodes/NormalMatrixShaderNode.js +1 -1
  480. package/dist/esmdev/foundation/materials/nodes/NormalizeShaderNode.d.ts +1 -1
  481. package/dist/esmdev/foundation/materials/nodes/NormalizeShaderNode.js +13 -13
  482. package/dist/esmdev/foundation/materials/nodes/NotEqualShaderNode.d.ts +1 -1
  483. package/dist/esmdev/foundation/materials/nodes/NotEqualShaderNode.js +14 -14
  484. package/dist/esmdev/foundation/materials/nodes/OrShaderNode.js +6 -6
  485. package/dist/esmdev/foundation/materials/nodes/OutColorShaderNode.js +2 -2
  486. package/dist/esmdev/foundation/materials/nodes/OutPositionShaderNode.js +2 -2
  487. package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyPropsShaderNode.js +5 -5
  488. package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyRotationShaderNode.js +3 -3
  489. package/dist/esmdev/foundation/materials/nodes/PbrBaseColorPropsShaderNode.js +5 -5
  490. package/dist/esmdev/foundation/materials/nodes/PbrClearcoatPropsShaderNode.js +7 -7
  491. package/dist/esmdev/foundation/materials/nodes/PbrDiffuseTransmissionPropsShaderNode.js +6 -6
  492. package/dist/esmdev/foundation/materials/nodes/PbrEmissivePropsShaderNode.js +5 -5
  493. package/dist/esmdev/foundation/materials/nodes/PbrIridescencePropsShaderNode.js +8 -8
  494. package/dist/esmdev/foundation/materials/nodes/PbrMetallicRoughnessPropsShaderNode.js +6 -6
  495. package/dist/esmdev/foundation/materials/nodes/PbrNormalPropsShaderNode.js +11 -11
  496. package/dist/esmdev/foundation/materials/nodes/PbrOcclusionPropsShaderNode.js +4 -4
  497. package/dist/esmdev/foundation/materials/nodes/PbrShaderShaderNode.js +21 -21
  498. package/dist/esmdev/foundation/materials/nodes/PbrSheenPropsShaderNode.js +6 -6
  499. package/dist/esmdev/foundation/materials/nodes/PbrSpecularPropsShaderNode.js +6 -6
  500. package/dist/esmdev/foundation/materials/nodes/PbrTransmissionPropsShaderNode.js +4 -4
  501. package/dist/esmdev/foundation/materials/nodes/PbrVolumePropsShaderNode.js +6 -6
  502. package/dist/esmdev/foundation/materials/nodes/PremultipliedAlphaShaderNode.d.ts +1 -1
  503. package/dist/esmdev/foundation/materials/nodes/PremultipliedAlphaShaderNode.js +8 -8
  504. package/dist/esmdev/foundation/materials/nodes/ProcessGeometryShaderNode.js +22 -22
  505. package/dist/esmdev/foundation/materials/nodes/ProjectionMatrixShaderNode.js +1 -1
  506. package/dist/esmdev/foundation/materials/nodes/Random_HashPRNGShaderNode.js +15 -15
  507. package/dist/esmdev/foundation/materials/nodes/Random_SinHashShaderNode.js +15 -15
  508. package/dist/esmdev/foundation/materials/nodes/RemapShaderNode.d.ts +1 -1
  509. package/dist/esmdev/foundation/materials/nodes/RemapShaderNode.js +21 -21
  510. package/dist/esmdev/foundation/materials/nodes/SinShaderNode.d.ts +1 -1
  511. package/dist/esmdev/foundation/materials/nodes/SinShaderNode.js +17 -17
  512. package/dist/esmdev/foundation/materials/nodes/SmoothStepShaderNode.d.ts +1 -1
  513. package/dist/esmdev/foundation/materials/nodes/SmoothStepShaderNode.js +19 -19
  514. package/dist/esmdev/foundation/materials/nodes/SplitVectorShaderNode.d.ts +1 -1
  515. package/dist/esmdev/foundation/materials/nodes/SplitVectorShaderNode.js +22 -22
  516. package/dist/esmdev/foundation/materials/nodes/StepShaderNode.js +17 -17
  517. package/dist/esmdev/foundation/materials/nodes/TanShaderNode.d.ts +1 -1
  518. package/dist/esmdev/foundation/materials/nodes/TanShaderNode.js +17 -17
  519. package/dist/esmdev/foundation/materials/nodes/Texture2DShaderNode.js +16 -16
  520. package/dist/esmdev/foundation/materials/nodes/TimeShaderNode.js +1 -1
  521. package/dist/esmdev/foundation/materials/nodes/TransformShaderNode.d.ts +1 -1
  522. package/dist/esmdev/foundation/materials/nodes/TransformShaderNode.js +14 -14
  523. package/dist/esmdev/foundation/materials/nodes/UniformDataShaderNode.js +5 -5
  524. package/dist/esmdev/foundation/materials/nodes/ViewMatrixShaderNode.js +1 -1
  525. package/dist/esmdev/foundation/materials/nodes/WireframeMaterialNode.js +3 -3
  526. package/dist/esmdev/foundation/materials/nodes/WorldMatrixShaderNode.js +1 -1
  527. package/dist/esmdev/foundation/materials/nodes/raymarching/BendXYShaderNode.js +4 -4
  528. package/dist/esmdev/foundation/materials/nodes/raymarching/BendXZShaderNode.js +4 -4
  529. package/dist/esmdev/foundation/materials/nodes/raymarching/BendYXShaderNode.js +4 -4
  530. package/dist/esmdev/foundation/materials/nodes/raymarching/BendYZShaderNode.js +4 -4
  531. package/dist/esmdev/foundation/materials/nodes/raymarching/BendZXShaderNode.js +4 -4
  532. package/dist/esmdev/foundation/materials/nodes/raymarching/BendZYShaderNode.js +4 -4
  533. package/dist/esmdev/foundation/materials/nodes/raymarching/InitialPositionShaderNode.js +1 -1
  534. package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothIntersectionShaderNode.js +5 -5
  535. package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothSubtractionShaderNode.js +5 -5
  536. package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothUnionShaderNode.js +5 -5
  537. package/dist/esmdev/foundation/materials/nodes/raymarching/OpSubtractionShaderNode.js +6 -6
  538. package/dist/esmdev/foundation/materials/nodes/raymarching/OpUnionShaderNode.js +6 -6
  539. package/dist/esmdev/foundation/materials/nodes/raymarching/OutDistanceShaderNode.js +16 -16
  540. package/dist/esmdev/foundation/materials/nodes/raymarching/OutShadingColorShaderNode.js +2 -2
  541. package/dist/esmdev/foundation/materials/nodes/raymarching/OutUnionShaderNode.js +16 -16
  542. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchCameraPositionShaderNode.js +2 -2
  543. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitDistanceShaderNode.js +2 -2
  544. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitNormalShaderNode.js +2 -2
  545. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitPositionShaderNode.js +2 -2
  546. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdShaderNode.js +2 -2
  547. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdUniformShaderNode.js +4 -4
  548. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchRayDirectionShaderNode.js +2 -2
  549. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchTBNShaderNode.js +2 -2
  550. package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchViewDirectionShaderNode.js +2 -2
  551. package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyTransformShaderNode.js +9 -9
  552. package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyWorldMatrixShaderNode.js +5 -5
  553. package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarXShaderNode.js +3 -3
  554. package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarYShaderNode.js +3 -3
  555. package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarZShaderNode.js +3 -3
  556. package/dist/esmdev/foundation/materials/nodes/raymarching/SdBoxShaderNode.js +3 -3
  557. package/dist/esmdev/foundation/materials/nodes/raymarching/SdCapsuleShaderNode.js +5 -5
  558. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatShaderNode.js +4 -4
  559. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXShaderNode.js +4 -4
  560. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXYShaderNode.js +4 -4
  561. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYShaderNode.js +4 -4
  562. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYZShaderNode.js +4 -4
  563. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZShaderNode.js +4 -4
  564. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZXShaderNode.js +4 -4
  565. package/dist/esmdev/foundation/materials/nodes/raymarching/SdRoundBoxShaderNode.js +4 -4
  566. package/dist/esmdev/foundation/materials/nodes/raymarching/SdSphereShaderNode.js +3 -3
  567. package/dist/esmdev/foundation/materials/nodes/raymarching/SdTorusShaderNode.js +4 -4
  568. package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeXShaderNode.js +3 -3
  569. package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeYShaderNode.js +3 -3
  570. package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeZShaderNode.js +3 -3
  571. package/dist/esmdev/foundation/materials/nodes/raymarching/TwistXShaderNode.js +4 -4
  572. package/dist/esmdev/foundation/materials/nodes/raymarching/TwistYShaderNode.js +4 -4
  573. package/dist/esmdev/foundation/materials/nodes/raymarching/TwistZShaderNode.js +4 -4
  574. package/dist/esmdev/foundation/math/AABB.js +132 -132
  575. package/dist/esmdev/foundation/math/AnimatedQuaternion.js +54 -54
  576. package/dist/esmdev/foundation/math/AnimatedScalar.js +55 -55
  577. package/dist/esmdev/foundation/math/AnimatedValueEvaluationState.js +20 -20
  578. package/dist/esmdev/foundation/math/AnimatedVector2.js +55 -55
  579. package/dist/esmdev/foundation/math/AnimatedVector3.js +55 -55
  580. package/dist/esmdev/foundation/math/AnimatedVector4.js +55 -55
  581. package/dist/esmdev/foundation/math/AnimatedVectorN.js +55 -55
  582. package/dist/esmdev/foundation/math/IdentityMatrix33.js +2 -2
  583. package/dist/esmdev/foundation/math/IdentityMatrix44.js +2 -2
  584. package/dist/esmdev/foundation/math/MathClassUtil.js +4 -4
  585. package/dist/esmdev/foundation/math/MathUtil.d.ts +11 -0
  586. package/dist/esmdev/foundation/math/MathUtil.js +5 -1
  587. package/dist/esmdev/foundation/math/Quaternion.js +14 -14
  588. package/dist/esmdev/foundation/math/Transform3D.js +74 -74
  589. package/dist/esmdev/foundation/math/shapes/MathSphere.js +7 -7
  590. package/dist/esmdev/foundation/memory/Accessor.js +359 -359
  591. package/dist/esmdev/foundation/memory/Buffer.js +34 -34
  592. package/dist/esmdev/foundation/memory/BufferView.js +26 -26
  593. package/dist/esmdev/foundation/misc/DataUtil.js +2 -2
  594. package/dist/esmdev/foundation/misc/EnumIO.js +10 -10
  595. package/dist/esmdev/foundation/misc/Logger.js +14 -14
  596. package/dist/esmdev/foundation/misc/RnPromise.js +14 -14
  597. package/dist/esmdev/foundation/misc/Time.js +27 -27
  598. package/dist/esmdev/foundation/misc/WeakOption.js +14 -14
  599. package/dist/esmdev/foundation/misc/cache/Cache.js +2 -2
  600. package/dist/esmdev/foundation/misc/cache/SymbolWeakMap.js +8 -8
  601. package/dist/esmdev/foundation/physics/PhysicsWorldQuery.js +10 -10
  602. package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.js +190 -190
  603. package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.js +225 -225
  604. package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.js +3 -3
  605. package/dist/esmdev/foundation/physics/VRMSpring/CapsuleCollider.js +36 -36
  606. package/dist/esmdev/foundation/physics/VRMSpring/SphereCollider.js +26 -26
  607. package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBone.js +6 -6
  608. package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBonePhysicsStrategy.js +56 -56
  609. package/dist/esmdev/foundation/renderer/CGAPIResourceRepository.d.ts +74 -4
  610. package/dist/esmdev/foundation/renderer/CGAPIResourceRepository.js +4 -4
  611. package/dist/esmdev/foundation/renderer/Expression.js +6 -6
  612. package/dist/esmdev/foundation/renderer/Frame.js +7 -7
  613. package/dist/esmdev/foundation/renderer/FrameBuffer.js +28 -28
  614. package/dist/esmdev/foundation/renderer/FrameRenderer.d.ts +42 -0
  615. package/dist/esmdev/foundation/renderer/FrameRenderer.js +1 -0
  616. package/dist/esmdev/foundation/renderer/RenderPass.js +94 -94
  617. package/dist/esmdev/foundation/renderer/ShaderPropertyLayout.d.ts +77 -0
  618. package/dist/esmdev/foundation/renderer/ShaderPropertyLayout.js +61 -0
  619. package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +6 -6
  620. package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +9 -3
  621. package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.js +97 -83
  622. package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystem.js +162 -162
  623. package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystemStub.js +3 -3
  624. package/dist/esmdev/foundation/renderer/pipelines/DeferredRenderPipeline.js +4 -4
  625. package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +4 -171
  626. package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.js +335 -1127
  627. package/dist/esmdev/foundation/renderer/pipelines/RaymarchingRenderer.d.ts +263 -0
  628. package/dist/esmdev/foundation/renderer/pipelines/RaymarchingRenderer.js +858 -0
  629. package/dist/esmdev/foundation/system/Engine.d.ts +17 -28
  630. package/dist/esmdev/foundation/system/Engine.js +207 -574
  631. package/dist/esmdev/foundation/system/EngineState.d.ts +3 -3
  632. package/dist/esmdev/foundation/system/EngineState.js +4 -4
  633. package/dist/esmdev/foundation/system/EventPubSub.js +8 -8
  634. package/dist/esmdev/foundation/system/InputManager.js +56 -56
  635. package/dist/esmdev/foundation/system/ModuleManager.js +3 -3
  636. package/dist/esmdev/foundation/textures/AbstractReadableRenderTargetTexture.d.ts +39 -0
  637. package/dist/esmdev/foundation/textures/AbstractReadableRenderTargetTexture.js +88 -0
  638. package/dist/esmdev/foundation/textures/AbstractRenderTargetTexture.d.ts +60 -0
  639. package/dist/esmdev/foundation/textures/AbstractRenderTargetTexture.js +59 -0
  640. package/dist/esmdev/foundation/textures/AbstractTexture.js +49 -49
  641. package/dist/esmdev/foundation/textures/CubeTexture.js +35 -42
  642. package/dist/esmdev/foundation/textures/RenderBuffer.js +16 -17
  643. package/dist/esmdev/foundation/textures/RenderTargetTexture.d.ts +5 -67
  644. package/dist/esmdev/foundation/textures/RenderTargetTexture.js +18 -140
  645. package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.d.ts +5 -71
  646. package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.js +34 -177
  647. package/dist/esmdev/foundation/textures/RenderTargetTextureCube.d.ts +8 -50
  648. package/dist/esmdev/foundation/textures/RenderTargetTextureCube.js +31 -88
  649. package/dist/esmdev/foundation/textures/Sampler.js +24 -24
  650. package/dist/esmdev/foundation/textures/Texture.d.ts +19 -1
  651. package/dist/esmdev/foundation/textures/Texture.js +133 -146
  652. package/dist/esmdev/foundation/textures/TextureArray.js +13 -16
  653. package/dist/esmdev/foundation/textures/TextureDataFloat.js +26 -26
  654. package/dist/esmdev/foundation/textures/VideoTexture.d.ts +11 -0
  655. package/dist/esmdev/foundation/textures/VideoTexture.js +47 -46
  656. package/dist/esmdev/foundation/textures/decodeBasisImage.d.ts +14 -0
  657. package/dist/esmdev/foundation/textures/decodeBasisImage.js +14 -0
  658. package/dist/esmdev/foundation/textures/index.d.ts +2 -0
  659. package/dist/esmdev/foundation/textures/index.js +3 -1
  660. package/dist/esmdev/version.js +2 -2
  661. package/dist/esmdev/webgl/ComponentDataAccessorGLSL.d.ts +9 -0
  662. package/dist/esmdev/webgl/ComponentDataAccessorGLSL.js +146 -0
  663. package/dist/esmdev/webgl/InstanceSidTable.js +62 -62
  664. package/dist/esmdev/webgl/MultiDraw.d.ts +1 -1
  665. package/dist/esmdev/webgl/MultiDraw.js +4 -4
  666. package/dist/esmdev/webgl/MultiDrawRepository.js +34 -34
  667. package/dist/esmdev/webgl/ShaderPropertyAccessorGLSL.d.ts +11 -0
  668. package/dist/esmdev/webgl/ShaderPropertyAccessorGLSL.js +142 -0
  669. package/dist/esmdev/webgl/WebGLCompressedTextures.d.ts +48 -0
  670. package/dist/esmdev/webgl/WebGLCompressedTextures.js +105 -0
  671. package/dist/esmdev/webgl/WebGLContextWrapper.d.ts +9 -52
  672. package/dist/esmdev/webgl/WebGLContextWrapper.js +128 -230
  673. package/dist/esmdev/webgl/WebGLCubeTextureFileLoader.d.ts +38 -0
  674. package/dist/esmdev/webgl/WebGLCubeTextureFileLoader.js +178 -0
  675. package/dist/esmdev/webgl/WebGLCubeTextures.d.ts +92 -0
  676. package/dist/esmdev/webgl/WebGLCubeTextures.js +358 -0
  677. package/dist/esmdev/webgl/WebGLDataTexture.d.ts +108 -0
  678. package/dist/esmdev/webgl/WebGLDataTexture.js +337 -0
  679. package/dist/esmdev/webgl/WebGLDrawState.d.ts +84 -0
  680. package/dist/esmdev/webgl/WebGLDrawState.js +164 -0
  681. package/dist/esmdev/webgl/WebGLExternalState.d.ts +43 -0
  682. package/dist/esmdev/webgl/WebGLExternalState.js +70 -0
  683. package/dist/esmdev/webgl/WebGLFrameRenderer.d.ts +32 -0
  684. package/dist/esmdev/webgl/WebGLFrameRenderer.js +155 -0
  685. package/dist/esmdev/webgl/WebGLFramebuffers.d.ts +142 -0
  686. package/dist/esmdev/webgl/WebGLFramebuffers.js +245 -0
  687. package/dist/esmdev/webgl/WebGLGpuTimer.js +30 -30
  688. package/dist/esmdev/webgl/WebGLMaterialParameters.d.ts +47 -0
  689. package/dist/esmdev/webgl/WebGLMaterialParameters.js +81 -0
  690. package/dist/esmdev/webgl/WebGLMeshResources.d.ts +115 -0
  691. package/dist/esmdev/webgl/WebGLMeshResources.js +303 -0
  692. package/dist/esmdev/webgl/WebGLMorphUniformBuffers.d.ts +66 -0
  693. package/dist/esmdev/webgl/WebGLMorphUniformBuffers.js +272 -0
  694. package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +100 -178
  695. package/dist/esmdev/webgl/WebGLResourceRepository.js +345 -2596
  696. package/dist/esmdev/webgl/WebGLSamplers.d.ts +78 -0
  697. package/dist/esmdev/webgl/WebGLSamplers.js +143 -0
  698. package/dist/esmdev/webgl/WebGLShaderProgramBuilder.d.ts +40 -0
  699. package/dist/esmdev/webgl/WebGLShaderProgramBuilder.js +208 -0
  700. package/dist/esmdev/webgl/WebGLShaderPrograms.d.ts +88 -0
  701. package/dist/esmdev/webgl/WebGLShaderPrograms.js +240 -0
  702. package/dist/esmdev/webgl/WebGLStereoUtil.d.ts +0 -27
  703. package/dist/esmdev/webgl/WebGLStereoUtil.js +33 -112
  704. package/dist/esmdev/webgl/WebGLStrategyDataUploader.d.ts +152 -0
  705. package/dist/esmdev/webgl/WebGLStrategyDataUploader.js +370 -0
  706. package/dist/esmdev/webgl/WebGLStrategyMeshBatchRenderer.d.ts +40 -0
  707. package/dist/esmdev/webgl/WebGLStrategyMeshBatchRenderer.js +213 -0
  708. package/dist/esmdev/webgl/WebGLStrategyMeshDrawer.d.ts +92 -0
  709. package/dist/esmdev/webgl/WebGLStrategyMeshDrawer.js +300 -0
  710. package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +7 -360
  711. package/dist/esmdev/webgl/WebGLStrategyWebGL2.js +75 -1863
  712. package/dist/esmdev/webgl/WebGLTextureUnitState.d.ts +79 -0
  713. package/dist/esmdev/webgl/WebGLTextureUnitState.js +149 -0
  714. package/dist/esmdev/webgl/WebGLTextureUploads.d.ts +106 -0
  715. package/dist/esmdev/webgl/WebGLTextureUploads.js +168 -0
  716. package/dist/esmdev/webgl/WebGLTextures.d.ts +316 -0
  717. package/dist/esmdev/webgl/WebGLTextures.js +577 -0
  718. package/dist/esmdev/webgl/WebGLUniformBuffers.d.ts +35 -0
  719. package/dist/esmdev/webgl/WebGLUniformBuffers.js +89 -0
  720. package/dist/esmdev/webgl/WebGLUniforms.d.ts +117 -0
  721. package/dist/esmdev/webgl/WebGLUniforms.js +283 -0
  722. package/dist/esmdev/webgl/WebGLVertexBuffers.d.ts +172 -0
  723. package/dist/esmdev/webgl/WebGLVertexBuffers.js +391 -0
  724. package/dist/esmdev/webgl/debug/BufferLayoutDecoder.d.ts +4 -4
  725. package/dist/esmdev/webgl/debug/BufferLayoutDecoder.js +52 -59
  726. package/dist/esmdev/webgl/debug/ShaderParameterDebugger.js +17 -17
  727. package/dist/esmdev/webgl/debug/types.d.ts +2 -2
  728. package/dist/esmdev/webgl/getRenderingStrategy.d.ts +2 -2
  729. package/dist/esmdev/webgl/getRenderingStrategy.js +5 -5
  730. package/dist/esmdev/webgl/main.d.ts +4 -17
  731. package/dist/esmdev/webgl/main.js +5 -3
  732. package/dist/esmdev/webgl/readColorAttachmentAsRgba8.d.ts +36 -0
  733. package/dist/esmdev/webgl/readColorAttachmentAsRgba8.js +47 -0
  734. package/dist/esmdev/webgl/shaders/RaymarchingShaderPart.d.ts +2 -2
  735. package/dist/esmdev/webgl/shaders/RaymarchingShaderPart.js +15 -15
  736. package/dist/esmdev/webgl/shaders/RaymarchingShadowShaderPart.js +17 -17
  737. package/dist/esmdev/webgl/shaders/StandardShaderPart.d.ts +3 -3
  738. package/dist/esmdev/webgl/shaders/StandardShaderPart.js +15 -15
  739. package/dist/esmdev/webgl/shaders/glslCommonChunks.d.ts +2 -2
  740. package/dist/esmdev/webgl/shaders/glslCommonChunks.js +1 -1
  741. package/dist/esmdev/webgl/shaders/nodes/BlockBeginShader.js +10 -10
  742. package/dist/esmdev/webgl/shaders/nodes/BlockEndShader.js +10 -10
  743. package/dist/esmdev/webgl/shaders/nodes/ConstantVariableShader.d.ts +2 -2
  744. package/dist/esmdev/webgl/shaders/nodes/ConstantVariableShader.js +27 -27
  745. package/dist/esmdev/webgl/shaders/nodes/DiscardShader.d.ts +1 -1
  746. package/dist/esmdev/webgl/shaders/nodes/DiscardShader.js +5 -5
  747. package/dist/esmdev/webgl/shaders/nodes/EndShader.d.ts +2 -2
  748. package/dist/esmdev/webgl/shaders/nodes/EndShader.js +6 -6
  749. package/dist/esmdev/webgl/shaders/nodes/OutDistance.d.ts +1 -1
  750. package/dist/esmdev/webgl/shaders/nodes/OutDistance.js +17 -17
  751. package/dist/esmdev/webgl/shaders/nodes/OutUnion.js +12 -12
  752. package/dist/esmdev/webgl/shaders/nodes/RaymarchObjectIdUniform.js +11 -11
  753. package/dist/esmdev/webgl/shaders/nodes/SdApplyTransform.js +12 -12
  754. package/dist/esmdev/webgl/shaders/nodes/SdApplyWorldMatrix.d.ts +1 -1
  755. package/dist/esmdev/webgl/shaders/nodes/SdApplyWorldMatrix.js +13 -13
  756. package/dist/esmdev/webgl/shaders/nodes/Texture2DShader.js +27 -27
  757. package/dist/esmdev/webgl/shaders/nodes/UniformDataShader.js +27 -27
  758. package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.d.ts +1 -1
  759. package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.js +33 -27
  760. package/dist/esmdev/webgpu/AttributeReader.d.ts +18 -0
  761. package/dist/esmdev/webgpu/AttributeReader.js +57 -0
  762. package/dist/esmdev/webgpu/GpuCullingRegistry.js +91 -91
  763. package/dist/esmdev/webgpu/GpuDeformRegistry.js +53 -53
  764. package/dist/esmdev/webgpu/RangeAllocator.js +16 -16
  765. package/dist/esmdev/webgpu/ShaderPropertyAccessorWGSL.d.ts +11 -0
  766. package/dist/esmdev/webgpu/ShaderPropertyAccessorWGSL.js +131 -0
  767. package/dist/esmdev/webgpu/WebGpuBindGroups.d.ts +131 -0
  768. package/dist/esmdev/webgpu/WebGpuBindGroups.js +377 -0
  769. package/dist/esmdev/webgpu/WebGpuBufferArena.js +21 -21
  770. package/dist/esmdev/webgpu/WebGpuCompressedTextures.d.ts +38 -0
  771. package/dist/esmdev/webgpu/WebGpuCompressedTextures.js +155 -0
  772. package/dist/esmdev/webgpu/WebGpuCubeTextureShaders.d.ts +1 -0
  773. package/dist/esmdev/webgpu/WebGpuCubeTextureShaders.js +68 -0
  774. package/dist/esmdev/webgpu/WebGpuCubeTextures.d.ts +72 -0
  775. package/dist/esmdev/webgpu/WebGpuCubeTextures.js +340 -0
  776. package/dist/esmdev/webgpu/WebGpuDeviceWrapper.js +7 -7
  777. package/dist/esmdev/webgpu/WebGpuDraw.d.ts +63 -0
  778. package/dist/esmdev/webgpu/WebGpuDraw.js +133 -0
  779. package/dist/esmdev/webgpu/WebGpuDrawParameters.d.ts +61 -0
  780. package/dist/esmdev/webgpu/WebGpuDrawParameters.js +120 -0
  781. package/dist/esmdev/webgpu/WebGpuExternalRenderPass.d.ts +44 -0
  782. package/dist/esmdev/webgpu/WebGpuExternalRenderPass.js +115 -0
  783. package/dist/esmdev/webgpu/WebGpuFrame.d.ts +55 -0
  784. package/dist/esmdev/webgpu/WebGpuFrame.js +89 -0
  785. package/dist/esmdev/webgpu/WebGpuFrameRenderer.d.ts +25 -0
  786. package/dist/esmdev/webgpu/WebGpuFrameRenderer.js +248 -0
  787. package/dist/esmdev/webgpu/WebGpuGpuCulling.js +200 -454
  788. package/dist/esmdev/webgpu/WebGpuGpuCullingShaders.d.ts +34 -0
  789. package/dist/esmdev/webgpu/WebGpuGpuCullingShaders.js +264 -0
  790. package/dist/esmdev/webgpu/WebGpuGpuTimer.js +52 -52
  791. package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.js +39 -194
  792. package/dist/esmdev/webgpu/WebGpuLightClusterShaders.d.ts +14 -0
  793. package/dist/esmdev/webgpu/WebGpuLightClusterShaders.js +161 -0
  794. package/dist/esmdev/webgpu/WebGpuMipmapGenerator.d.ts +54 -0
  795. package/dist/esmdev/webgpu/WebGpuMipmapGenerator.js +187 -0
  796. package/dist/esmdev/webgpu/WebGpuMipmapShaders.d.ts +1 -0
  797. package/dist/esmdev/webgpu/WebGpuMipmapShaders.js +34 -0
  798. package/dist/esmdev/webgpu/WebGpuRenderBundles.d.ts +117 -0
  799. package/dist/esmdev/webgpu/WebGpuRenderBundles.js +299 -0
  800. package/dist/esmdev/webgpu/WebGpuRenderPassEncoders.d.ts +140 -0
  801. package/dist/esmdev/webgpu/WebGpuRenderPassEncoders.js +611 -0
  802. package/dist/esmdev/webgpu/WebGpuRenderPipelines.d.ts +75 -0
  803. package/dist/esmdev/webgpu/WebGpuRenderPipelines.js +249 -0
  804. package/dist/esmdev/webgpu/WebGpuRenderTargetTextures.d.ts +78 -0
  805. package/dist/esmdev/webgpu/WebGpuRenderTargetTextures.js +108 -0
  806. package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +52 -322
  807. package/dist/esmdev/webgpu/WebGpuResourceRepository.js +332 -3127
  808. package/dist/esmdev/webgpu/WebGpuSamplers.d.ts +45 -0
  809. package/dist/esmdev/webgpu/WebGpuSamplers.js +58 -0
  810. package/dist/esmdev/webgpu/WebGpuShaderProgramBuilder.d.ts +25 -0
  811. package/dist/esmdev/webgpu/WebGpuShaderProgramBuilder.js +108 -0
  812. package/dist/esmdev/webgpu/WebGpuStorageBuffers.d.ts +77 -0
  813. package/dist/esmdev/webgpu/WebGpuStorageBuffers.js +191 -0
  814. package/dist/esmdev/webgpu/WebGpuStrategyBasic.d.ts +1 -73
  815. package/dist/esmdev/webgpu/WebGpuStrategyBasic.js +58 -780
  816. package/dist/esmdev/webgpu/WebGpuStrategyStorage.d.ts +62 -0
  817. package/dist/esmdev/webgpu/WebGpuStrategyStorage.js +267 -0
  818. package/dist/esmdev/webgpu/WebGpuTextureReadback.d.ts +111 -0
  819. package/dist/esmdev/webgpu/WebGpuTextureReadback.js +188 -0
  820. package/dist/esmdev/webgpu/WebGpuTextureReadbackShaders.d.ts +4 -0
  821. package/dist/esmdev/webgpu/WebGpuTextureReadbackShaders.js +34 -0
  822. package/dist/esmdev/webgpu/WebGpuTextureUploads.d.ts +109 -0
  823. package/dist/esmdev/webgpu/WebGpuTextureUploads.js +197 -0
  824. package/dist/esmdev/webgpu/WebGpuTextures.d.ts +196 -0
  825. package/dist/esmdev/webgpu/WebGpuTextures.js +344 -0
  826. package/dist/esmdev/webgpu/WebGpuVertexBuffers.d.ts +142 -0
  827. package/dist/esmdev/webgpu/WebGpuVertexBuffers.js +281 -0
  828. package/dist/esmdev/webgpu/WebGpuVertexDeformer.js +106 -284
  829. package/dist/esmdev/webgpu/WebGpuVertexDeformerShaders.d.ts +7 -0
  830. package/dist/esmdev/webgpu/WebGpuVertexDeformerShaders.js +134 -0
  831. package/dist/esmdev/webgpu/WebGpuVertexShaderDefinitions.d.ts +16 -0
  832. package/dist/esmdev/webgpu/WebGpuVertexShaderDefinitions.js +216 -0
  833. package/dist/esmdev/webgpu/assertArrayBufferView.d.ts +9 -0
  834. package/dist/esmdev/webgpu/assertArrayBufferView.js +10 -0
  835. package/dist/esmdev/webgpu/main.d.ts +2 -16
  836. package/dist/esmdev/webgpu/main.js +3 -3
  837. package/dist/esmdev/webgpu/padCompressedRowsForUpload.d.ts +20 -0
  838. package/dist/esmdev/webgpu/padCompressedRowsForUpload.js +20 -0
  839. package/dist/esmdev/webgpu/removeRowPadding.d.ts +21 -0
  840. package/dist/esmdev/webgpu/removeRowPadding.js +23 -0
  841. package/dist/esmdev/webgpu/shaderity_shaders/common/processGeometry.wgsl.js +2 -2
  842. package/dist/esmdev/webgpu/wgslCommonChunks.d.ts +2 -2
  843. package/dist/esmdev/webgpu/wgslCommonChunks.js +1 -1
  844. package/dist/esmdev/xr/WebARSystem.js +65 -65
  845. package/dist/esmdev/xr/WebXRSystem.d.ts +0 -4
  846. package/dist/esmdev/xr/WebXRSystem.js +155 -160
  847. package/package.json +1 -1
  848. package/dist/esm/foundation/definitions/ProcessApproach.d.ts +0 -21
  849. package/dist/esm/foundation/definitions/ProcessApproach.js +0 -1
  850. package/dist/esm/foundation/materials/core/ShaderHandler.d.ts +0 -125
  851. package/dist/esm/foundation/materials/core/ShaderHandler.js +0 -48
  852. package/dist/esmdev/foundation/definitions/ProcessApproach.d.ts +0 -21
  853. package/dist/esmdev/foundation/definitions/ProcessApproach.js +0 -60
  854. package/dist/esmdev/foundation/materials/core/ShaderHandler.d.ts +0 -125
  855. package/dist/esmdev/foundation/materials/core/ShaderHandler.js +0 -416
@@ -1,25 +1,25 @@
1
- import{ProcessApproach as e}from"../../../foundation/definitions/ProcessApproach.js";import{StandardShaderPart as r}from"../StandardShaderPart.js";var i=class extends r{constructor(t,s,a){super();this.qA=t;this.p_=s;this.c_=a;this.QA="";this.t$=""}setVariableName(t){this.QA=t}setDefaultValue(t){this.t$=t.toString()}getVertexShaderDefinitions(t){return t.engineState.currentProcessApproach===e.WebGPU?`
2
- // #param ${this.QA}: ${this.p_.toWGSLType(this.c_)}; // initialValue=${this.t$}
3
- fn ${this.qA}(outValue: ptr<function, ${this.p_.toWGSLType(this.c_)}>) {
4
- *outValue = get_${this.QA}(uniformDrawParameters.materialSid, 0u);
1
+ import{RenderBackend as e}from"../../../foundation/definitions/RenderBackend.js";import{StandardShaderPart as r}from"../StandardShaderPart.js";var i=class extends r{constructor(t,a,s){super();this.YS=t;this.p_=a;this.c_=s;this.uV="";this.t$=""}setVariableName(t){this.uV=t}setDefaultValue(t){this.t$=t.toString()}getVertexShaderDefinitions(t){return t.engineState.currentRenderBackend===e.WebGPU?`
2
+ // #param ${this.uV}: ${this.p_.toWGSLType(this.c_)}; // initialValue=${this.t$}
3
+ fn ${this.YS}(outValue: ptr<function, ${this.p_.toWGSLType(this.c_)}>) {
4
+ *outValue = get_${this.uV}(uniformDrawParameters.materialSid, 0u);
5
5
  }
6
6
  `:`
7
- uniform ${this.p_.getGlslStr(this.c_)} u_${this.QA}; // initialValue=${this.t$}
8
- void ${this.qA}(out ${this.p_.getGlslStr(this.c_)} outValue) {
7
+ uniform ${this.p_.getGlslStr(this.c_)} u_${this.uV}; // initialValue=${this.t$}
8
+ void ${this.YS}(out ${this.p_.getGlslStr(this.c_)} outValue) {
9
9
  ${this.getMaterialSIDForWebGL()}
10
10
 
11
- outValue = get_${this.QA}(materialSID, 0u);
11
+ outValue = get_${this.uV}(materialSID, 0u);
12
12
  }
13
- `}getPixelShaderDefinitions(t){return t.engineState.currentProcessApproach===e.WebGPU?`
14
- // #param ${this.QA}: ${this.p_.toWGSLType(this.c_)}; // initialValue=${this.t$}
15
- fn ${this.qA}(outValue: ptr<function, ${this.p_.toWGSLType(this.c_)}>) {
16
- *outValue = get_${this.QA}(uniformDrawParameters.materialSid, 0u);
13
+ `}getPixelShaderDefinitions(t){return t.engineState.currentRenderBackend===e.WebGPU?`
14
+ // #param ${this.uV}: ${this.p_.toWGSLType(this.c_)}; // initialValue=${this.t$}
15
+ fn ${this.YS}(outValue: ptr<function, ${this.p_.toWGSLType(this.c_)}>) {
16
+ *outValue = get_${this.uV}(uniformDrawParameters.materialSid, 0u);
17
17
  }
18
18
  `:`
19
- uniform ${this.p_.getGlslStr(this.c_)} u_${this.QA}; // initialValue=${this.t$}
20
- void ${this.qA}(out ${this.p_.getGlslStr(this.c_)} outValue) {
19
+ uniform ${this.p_.getGlslStr(this.c_)} u_${this.uV}; // initialValue=${this.t$}
20
+ void ${this.YS}(out ${this.p_.getGlslStr(this.c_)} outValue) {
21
21
  ${this.getMaterialSIDForWebGL()}
22
22
 
23
- outValue = get_${this.QA}(materialSID, 0u);
23
+ outValue = get_${this.uV}(materialSID, 0u);
24
24
  }
25
25
  `}get attributeNames(){return[]}get attributeSemantics(){return[]}get attributeCompositions(){return[]}};export{i as UniformDataShader};
@@ -1,6 +1,6 @@
1
1
  import { type CompressionTextureTypeEnum } from '../../foundation/definitions/CompressionTextureType';
2
+ import type { TextureData } from '../../foundation/renderer/CGAPIResourceRepository';
2
3
  import type { Engine } from '../../foundation/system/Engine';
3
- import type { TextureData } from '../WebGLResourceRepository';
4
4
  /**
5
5
  * A texture loader for KTX2 format files that handles transcoding of compressed texture data.
6
6
  *
@@ -1 +1 @@
1
- import{KHR_DF_MODEL_UASTC as V,KHR_DF_TRANSFER_SRGB as W,KHR_SUPERCOMPRESSION_BASISLZ as N,KHR_SUPERCOMPRESSION_ZSTD as v,read as Z}from"../../_deps/ktx-parse.js";import{ZSTDDecoder as H}from"../../_deps/zstddec.js";import{CompressionTextureType as a}from"../../foundation/definitions/CompressionTextureType.js";import{ProcessApproach as z}from"../../foundation/definitions/ProcessApproach.js";import{Logger as Y}from"../../foundation/misc/Logger.js";var I={RGB:0,RRR:3,GGG:4,AAA:15},j={RGB:0,RGBA:3,RRR:4,RRRG:5},G={ETC1S:0,UASTC4x4:1},o={ETC1_RGB:"ETC1_RGB",BC1_RGB:"BC1_RGB",BC4_R:"BC4_R",BC5_RG:"BC5_RG",BC3_RGBA:"BC3_RGBA",PVRTC1_4_RGB:"PVRTC1_4_RGB",PVRTC1_4_RGBA:"PVRTC1_4_RGBA",BC7_RGBA:"BC7_RGBA",BC7_M6_RGB:"BC7_M6_RGB",BC7_M5_RGBA:"BC7_M5_RGBA",ETC2_RGBA:"ETC2_RGBA",ASTC_4x4_RGBA:"ASTC_4x4_RGBA",RGBA32:"RGBA32",RGB565:"RGB565",BGR565:"BGR565",RGBA4444:"RGBA4444",PVRTC2_4_RGB:"PVRTC2_4_RGB",PVRTC2_4_RGBA:"PVRTC2_4_RGBA",EAC_R11:"EAC_R11",EAC_RG11:"EAC_RG11"},M=class p{constructor(){typeof MSC_TRANSCODER=="undefined"&&Y.default.error("Failed to call MSC_TRANSCODER() function. Please check to import msc_basis_transcoder.js."),this.sB=this.nB()}static getInstance(){return this.rm||(this.rm=new p),this.rm}transcode(t,e){let n=this.cB(e);if(n.pixelDepth>0)throw new Error("Only 2D textures are currently supported");if(n.layerCount>1)throw new Error("Array textures are not currently supported");if(n.faceCount>1)throw new Error("Cube textures are not currently supported");return n.supercompressionScheme===v?(p.tB==null&&(p.tB=new H),p.tB.init().then(()=>this.sB.then(()=>this.oB(t,n)))):this.sB.then(()=>this.oB(t,n))}nB(){return new Promise(t=>{p.rB&&t(),MSC_TRANSCODER().then(e=>{e.initTranscoders(),p.rB=e,t()})})}iB(t,e){let r=t.webglResourceRepository.currentWebGLContextWrapper,g=r.webgl2ExtCTAstc||r.webgl1ExtCTAstc,u=r.webgl2ExtCTBptc||r.webgl1ExtCTBptc,m=r.webgl2ExtCTS3tc||r.webgl1ExtCTS3tc,c=r.webgl2ExtCTPvrtc||r.webgl1ExtCTPvrtc,l=r.webgl2ExtCTEtc||r.webgl1ExtCTEtc,d=r.webgl2ExtCTEtc1||r.webgl1ExtCTEtc1,s,i;return g?(s=o.ASTC_4x4_RGBA,i=a.ASTC_RGBA_4x4):u?(s=o.BC7_RGBA,i=a.BPTC_RGBA):m?e?(s=o.BC3_RGBA,i=a.S3TC_RGBA_DXT5):(s=o.BC1_RGB,i=a.S3TC_RGB_DXT1):c?e?(s=o.PVRTC1_4_RGBA,i=a.PVRTC_RGBA_4BPPV1):(s=o.PVRTC1_4_RGB,i=a.PVRTC_RGB_4BPPV1):l?e?(s=o.ETC2_RGBA,i=a.ETC2_RGBA8_EAC):(s=o.ETC1_RGB,i=a.ETC2_RGB8):d?(s=o.ETC1_RGB,i=a.ETC1_RGB):(s=o.RGBA32,i=a.RGBA8_EXT),{transcodeTargetStr:s,compressionTextureType:i}}TB(t,e){let r=t.webGpuResourceRepository.getWebGpuDeviceWrapper().gpuAdapter,g=r.features.has("texture-compression-astc"),u=r.features.has("texture-compression-bc"),m=r.features.has("texture-compression-etc2"),c,l;return g?(c=o.ASTC_4x4_RGBA,l=a.ASTC_RGBA_4x4):u?e?(c=o.BC3_RGBA,l=a.S3TC_RGBA_DXT5):(c=o.BC1_RGB,l=a.S3TC_RGB_DXT1):m?e?(c=o.ETC2_RGBA,l=a.ETC2_RGBA8_EAC):(c=o.ETC1_RGB,l=a.ETC2_RGB8):(c=o.RGBA32,l=a.RGBA8_EXT),{transcodeTargetStr:c,compressionTextureType:l}}cB(t){return Z(t)}oB(t,e){var b;let n=e.pixelWidth,r=e.pixelHeight,g=e.faceCount,u=(b=e.globalData)==null?void 0:b.imageDescs,m=e.dataFormatDescriptor[0],c=m.colorModel===V?G.UASTC4x4:G.ETC1S,l=this.lB(m,c),d=!1,s=p.rB,i=c===G.UASTC4x4?new s.UastcImageTranscoder:new s.BasisLzEtc1sImageTranscoder,O=c===G.UASTC4x4?s.TextureFormat.UASTC4x4:s.TextureFormat.ETC1S,{transcodeTargetStr:U,compressionTextureType:F}=t.engineState.currentProcessApproach===z.WebGPU?this.TB(t,l):this.iB(t,l),E=s.TranscodeTarget[U],S=[],X={width:n,height:r,compressionTextureType:F,mipmapData:S,needGammaCorrection:m.transferFunction!==W};for(let B=0;B<e.levels.length;B++){let x=Math.max(1,n>>B),D=Math.max(1,r>>B),T=new s.ImageInfo(O,x,D,B),C=e.levels[B].levelData,w=e.levels[B].uncompressedByteLength,L=T.numBlocksX*T.numBlocksY*m.bytesPlane[0];e.supercompressionScheme===v&&(C=new Uint8Array(p.tB.decode(new Uint8Array(C.buffer,C.byteOffset,C.byteLength),w)));let P=0,K=B*Math.max(e.layerCount,1)*g*Math.max(e.pixelDepth,1);for(let h=0;h<g;h++){let R=null,y;e.supercompressionScheme===N?(R=u==null?void 0:u[K+h],y=new Uint8Array(C.buffer,C.byteOffset+R.rgbSliceByteOffset,R.rgbSliceByteLength+R.alphaSliceByteLength)):(y=new Uint8Array(C.buffer,C.byteOffset+P,L),P+=L);let f;if(c===G.UASTC4x4)T.flags=0,T.rgbByteOffset=0,T.rgbByteLength=w,T.alphaByteOffset=0,T.alphaByteLength=0,f=i.transcodeImage(E,y,T,0,l,d);else{let _=e.globalData,A=i;A.decodePalettes(_.endpointCount,_.endpointsData,_.selectorCount,_.selectorsData),A.decodeTables(_.tablesData),T.flags=R.imageFlags,T.rgbByteOffset=0,T.rgbByteLength=R.rgbSliceByteLength,T.alphaByteOffset=R.alphaSliceByteOffset>0?R.rgbSliceByteLength:0,T.alphaByteLength=R.alphaSliceByteLength,f=A.transcodeImage(E,y,T,0,d)}if((f==null?void 0:f.transcodedImage)!=null){let _=f.transcodedImage.get_typed_memory_view().slice();f.transcodedImage.delete();let A={level:B,width:x,height:D,buffer:_};S.push(A)}}}return X}lB(t,e){return e===G.UASTC4x4?p.aB(t.samples[0])===j.RGBA:t.samples.length===2&&(p.aB(t.samples[0])===I.AAA||p.aB(t.samples[1])===I.AAA)}static aB(t){var n,r;let e=t;return(r=(n=e.channelType)!=null?n:e.channelID)!=null?r:0}};export{M as KTX2TextureLoader};
1
+ import{KHR_DF_MODEL_UASTC as W,KHR_DF_TRANSFER_SRGB as N,KHR_SUPERCOMPRESSION_BASISLZ as Z,KHR_SUPERCOMPRESSION_ZSTD as I,read as H}from"../../_deps/ktx-parse.js";import{ZSTDDecoder as $}from"../../_deps/zstddec.js";import{CompressionTextureType as a}from"../../foundation/definitions/CompressionTextureType.js";import{RenderBackend as Y}from"../../foundation/definitions/RenderBackend.js";import{Logger as U}from"../../foundation/misc/Logger.js";var O={RGB:0,RRR:3,GGG:4,AAA:15},z={RGB:0,RGBA:3,RRR:4,RRRG:5},d={ETC1S:0,UASTC4x4:1},j=16,o={ETC1_RGB:"ETC1_RGB",BC1_RGB:"BC1_RGB",BC4_R:"BC4_R",BC5_RG:"BC5_RG",BC3_RGBA:"BC3_RGBA",PVRTC1_4_RGB:"PVRTC1_4_RGB",PVRTC1_4_RGBA:"PVRTC1_4_RGBA",BC7_RGBA:"BC7_RGBA",BC7_M6_RGB:"BC7_M6_RGB",BC7_M5_RGBA:"BC7_M5_RGBA",ETC2_RGBA:"ETC2_RGBA",ASTC_4x4_RGBA:"ASTC_4x4_RGBA",RGBA32:"RGBA32",RGB565:"RGB565",BGR565:"BGR565",RGBA4444:"RGBA4444",PVRTC2_4_RGB:"PVRTC2_4_RGB",PVRTC2_4_RGBA:"PVRTC2_4_RGBA",EAC_R11:"EAC_R11",EAC_RG11:"EAC_RG11"},M=class B{constructor(){typeof MSC_TRANSCODER=="undefined"&&U.default.error("Failed to call MSC_TRANSCODER() function. Please check to import msc_basis_transcoder.js."),this.BB=this.CB()}static getInstance(){return this.rm||(this.rm=new B),this.rm}transcode(t,e){let c=this.mB(e);if(c.pixelDepth>0)throw new Error("Only 2D textures are currently supported");if(c.layerCount>1)throw new Error("Array textures are not currently supported");if(c.faceCount>1)throw new Error("Cube textures are not currently supported");return c.supercompressionScheme===I?(B.TB==null&&(B.TB=new $),B.TB.init().then(()=>this.BB.then(()=>this.RB(t,c)))):this.BB.then(()=>this.RB(t,c))}CB(){return new Promise(t=>{B.lB&&t(),MSC_TRANSCODER().then(e=>{e.initTranscoders(),B.lB=e,t()})})}fB(t,e){let r=t.webglResourceRepository.currentWebGLContextWrapper,G=r.webgl2ExtCTAstc||r.webgl1ExtCTAstc,u=r.webgl2ExtCTBptc||r.webgl1ExtCTBptc,f=r.webgl2ExtCTS3tc||r.webgl1ExtCTS3tc,n=r.webgl2ExtCTPvrtc||r.webgl1ExtCTPvrtc,l=r.webgl2ExtCTEtc||r.webgl1ExtCTEtc,A=r.webgl2ExtCTEtc1||r.webgl1ExtCTEtc1,s,i;return G?(s=o.ASTC_4x4_RGBA,i=a.ASTC_RGBA_4x4):u?(s=o.BC7_RGBA,i=a.BPTC_RGBA):f?e?(s=o.BC3_RGBA,i=a.S3TC_RGBA_DXT5):(s=o.BC1_RGB,i=a.S3TC_RGB_DXT1):n?e?(s=o.PVRTC1_4_RGBA,i=a.PVRTC_RGBA_4BPPV1):(s=o.PVRTC1_4_RGB,i=a.PVRTC_RGB_4BPPV1):l?e?(s=o.ETC2_RGBA,i=a.ETC2_RGBA8_EAC):(s=o.ETC1_RGB,i=a.ETC2_RGB8):A?(s=o.ETC1_RGB,i=a.ETC1_RGB):(s=o.RGBA32,i=a.RGBA8_EXT),{transcodeTargetStr:s,compressionTextureType:i}}_B(t,e){let r=t.webGpuResourceRepository.getWebGpuDeviceWrapper().gpuAdapter,G=r.features.has("texture-compression-astc"),u=r.features.has("texture-compression-bc"),f=r.features.has("texture-compression-etc2"),n,l;return G?(n=o.ASTC_4x4_RGBA,l=a.ASTC_RGBA_4x4):u?e?(n=o.BC3_RGBA,l=a.S3TC_RGBA_DXT5):(n=o.BC1_RGB,l=a.S3TC_RGB_DXT1):f?e?(n=o.ETC2_RGBA,l=a.ETC2_RGBA8_EAC):(n=o.ETC1_RGB,l=a.ETC2_RGB8):(n=o.RGBA32,l=a.RGBA8_EXT),{transcodeTargetStr:n,compressionTextureType:l}}mB(t){return H(t)}RB(t,e){var w;let c=e.pixelWidth,r=e.pixelHeight,G=e.faceCount,u=(w=e.globalData)==null?void 0:w.imageDescs,f=e.dataFormatDescriptor[0],n=f.colorModel===W?d.UASTC4x4:d.ETC1S,l=this.GB(f,n),A=!1,s=B.lB,i=n===d.UASTC4x4?new s.UastcImageTranscoder:new s.BasisLzEtc1sImageTranscoder,F=n===d.UASTC4x4?s.TextureFormat.UASTC4x4:s.TextureFormat.ETC1S,{transcodeTargetStr:b,compressionTextureType:X}=t.engineState.currentRenderBackend===Y.WebGPU?this._B(t,l):this.fB(t,l),x=s.TranscodeTarget[b],D=[],K={width:c,height:r,compressionTextureType:X,mipmapData:D,needGammaCorrection:f.transferFunction!==N};for(let p=0;p<e.levels.length;p++){let E=Math.max(1,c>>p),h=Math.max(1,r>>p),T=new s.ImageInfo(F,E,h,p),m=e.levels[p].levelData,L=e.levels[p].uncompressedByteLength,P=T.numBlocksX*T.numBlocksY*j;e.supercompressionScheme===I&&(m=new Uint8Array(B.TB.decode(new Uint8Array(m.buffer,m.byteOffset,m.byteLength),L)));let v=0,V=p*Math.max(e.layerCount,1)*G*Math.max(e.pixelDepth,1);for(let y=0;y<G;y++){let R=null,S;e.supercompressionScheme===Z?(R=u==null?void 0:u[V+y],S=new Uint8Array(m.buffer,m.byteOffset+R.rgbSliceByteOffset,R.rgbSliceByteLength+R.alphaSliceByteLength)):(S=new Uint8Array(m.buffer,m.byteOffset+v,P),v+=P);let _;if(n===d.UASTC4x4)T.flags=0,T.rgbByteOffset=0,T.rgbByteLength=L,T.alphaByteOffset=0,T.alphaByteLength=0,_=i.transcodeImage(x,S,T,0,l,A);else{let C=e.globalData,g=i;g.decodePalettes(C.endpointCount,C.endpointsData,C.selectorCount,C.selectorsData),g.decodeTables(C.tablesData),T.flags=R.imageFlags,T.rgbByteOffset=0,T.rgbByteLength=R.rgbSliceByteLength,T.alphaByteOffset=R.alphaSliceByteOffset>0?R.rgbSliceByteLength:0,T.alphaByteLength=R.alphaSliceByteLength,_=g.transcodeImage(x,S,T,0,A)}if((_==null?void 0:_.transcodedImage)!=null){let C=_.transcodedImage.get_typed_memory_view().slice();_.transcodedImage.delete();let g={level:p,width:E,height:h,buffer:C};D.push(g)}else{let C=n===d.UASTC4x4?"UASTC":"ETC1S";U.default.warn(`KTX2TextureLoader: failed to transcode level ${p} (face ${y}, ${E}x${h}) of a ${C} texture to ${b}. The level is skipped.`)}}}return K}GB(t,e){return e===d.UASTC4x4?B.pB(t.samples[0])===z.RGBA:t.samples.length===2&&(B.pB(t.samples[0])===O.AAA||B.pB(t.samples[1])===O.AAA)}static pB(t){var c,r;let e=t;return(r=(c=e.channelType)!=null?c:e.channelID)!=null?r:0}};export{M as KTX2TextureLoader};
@@ -0,0 +1,18 @@
1
+ import type { Accessor } from '../foundation/memory/Accessor';
2
+ /**
3
+ * Reads the components of the vertex attributes as the vertex fetch of the GPU does
4
+ * (WebGpuResourceRepository.__getVertexFormat): a normalized 8 or 16 bit accessor with 2 or 4 components is
5
+ * converted to [0, 1] / [-1, 1], the other values are read as they are. The missing components are (0, 0, 0, 1).
6
+ */
7
+ export declare class AttributeReader {
8
+ private __accessor?;
9
+ private __componentCount;
10
+ private __byteSize;
11
+ private __scale;
12
+ private __isSigned;
13
+ private __isNormalized;
14
+ constructor(accessor: Accessor | undefined);
15
+ get exists(): boolean;
16
+ /** Reads the component `c` of the element `i`. */
17
+ read(i: number, c: number): number;
18
+ }
@@ -0,0 +1 @@
1
+ import{ComponentType as i}from"../foundation/definitions/ComponentType.js";var m={},o=class{constructor(t){this.CA=0;this.OA=4;this.av=1;this.zA=!1;this.vA=!1;if(this.eA=t,t===void 0)return;this.CA=Math.min(t.numberOfComponents,4),this.OA=t.componentSizeInBytes;let e=t.componentType,n=t.numberOfComponents===2||t.numberOfComponents===4;t.normalized&&n&&(e===i.UnsignedByte?(this.vA=!0,this.av=255):e===i.Byte?(this.vA=!0,this.av=127,this.zA=!0):e===i.UnsignedShort?(this.vA=!0,this.av=65535):e===i.Short&&(this.vA=!0,this.av=32767,this.zA=!0))}get exists(){return this.eA!==void 0}read(t,e){let n=this.eA;if(n===void 0||e>=this.CA)return e===3?1:0;let s=n.getScalarAt(t,e*this.OA,m);if(!this.vA)return s;let r=s/this.av;return this.zA?Math.max(r,-1):r}};export{o as AttributeReader};
@@ -1 +1 @@
1
- import{RangeAllocator as a}from"./RangeAllocator.js";var c=64,p=class{constructor(e){this.hG=0;this.aG=0;this.YC=[];this.rG=0;this.ZC=[];this.uG=0;this.KC=new Map;this.tG=new Map;this.QC=[];this.lG=!1;this.pG={instances:0,groups:0,draws:0,chunks:0};this.oG=0;this.Tb=0;this.iG={...e},this.sG=new a(e.instances),this.nG=new a(e.chunks)}get capacities(){return this.iG}get groupHighWater(){return this.rG}get chunkHighWater(){return this.hG}get drawHighWater(){return this.uG}get liveGroupCount(){return this.rG-this.YC.length}get version(){return this.Tb}get isOverflowed(){return this.lG}get isRecording(){return this.HC!==void 0}get requiredCapacities(){let e=this.pG;return{instances:this.oG+e.instances,groups:this.liveGroupCount+e.groups,draws:this.uG-this.ZC.length+e.draws,chunks:this.aG+e.chunks}}beginRecording(){this.HC!==void 0&&this.QC.push(this.HC),this.HC={groups:[],draws:[]},this.tG.clear()}getOrAllocateGroup(e,t,s){let i=this.HC;if(i===void 0||s<=0)return;let n=this.tG.get(e),o=n==null?void 0:n.get(t);if(o!==void 0&&o.instanceCount===s)return o;let r=Math.ceil(s/c),h=this.sG.allocate(s,1),u=this.nG.allocate(r,1),d=this.YC.length>0||this.rG<this.iG.groups;if(h<0||u<0||!d){h>=0&&this.sG.release(h,s),u>=0&&this.nG.release(u,r),this.dG(s,1,0,r);return}let l={index:this.YC.length>0?this.YC.pop():this.rG++,rangeBase:h,instanceCount:s,viewIndex:t,chunkBase:u,chunkCount:r};return this.oG+=s,this.aG+=r,this.hG=Math.max(this.hG,u+r),i.groups.push(l),n===void 0&&(n=new Map,this.tG.set(e,n)),n.set(t,l),this.Tb++,l}allocateDraw(){let e=this.HC;if(e===void 0)return-1;if(this.ZC.length===0&&this.uG>=this.iG.draws)return this.dG(0,0,1,0),-1;let t=this.ZC.length>0?this.ZC.pop():this.uG++;return e.draws.push(t),this.Tb++,t}finishRecording(e){let t=this.HC;if(t!==void 0){if(this.HC=void 0,this.tG.clear(),e===void 0){this.QC.push(t);return}this.retireBundle(e),(t.groups.length>0||t.draws.length>0)&&this.KC.set(e,t)}}abortRecording(){this.HC!==void 0&&(this.QC.push(this.HC),this.HC=void 0,this.tG.clear())}retireBundle(e){let t=this.KC.get(e);t!==void 0&&(this.KC.delete(e),this.QC.push(t))}retireAllBundles(){for(let e of this.KC.values())this.QC.push(e);this.KC.clear()}releaseRetired(){let e=this.QC;if(e.length===0)return;let t={groups:[],draws:[]};for(let s of e){for(let i of s.groups)this.sG.release(i.rangeBase,i.instanceCount),this.oG-=i.instanceCount,this.nG.release(i.chunkBase,i.chunkCount),this.aG-=i.chunkCount,this.YC.push(i.index),t.groups.push(i);for(let i of s.draws)this.ZC.push(i),t.draws.push(i)}return e.length=0,this.Tb++,t}reset(e){this.iG={...e},this.sG=new a(e.instances),this.nG=new a(e.chunks),this.hG=0,this.aG=0,this.YC.length=0,this.rG=0,this.ZC.length=0,this.uG=0,this.KC.clear(),this.HC=void 0,this.tG.clear(),this.QC.length=0,this.lG=!1,this.pG={instances:0,groups:0,draws:0,chunks:0},this.oG=0,this.Tb++}dG(e,t,s,i){this.lG=!0;let n=this.pG;n.instances+=e,n.groups+=t,n.draws+=s,n.chunks+=i}};export{c as GpuCullingChunkSize,p as GpuCullingRegistry};
1
+ import{RangeAllocator as a}from"./RangeAllocator.js";var c=64,p=class{constructor(e){this.cG=0;this.gG=0;this.sG=[];this.pG=0;this.nG=[];this.dG=0;this.uG=new Map;this.hG=new Map;this.iG=[];this.bG=!1;this.mG={instances:0,groups:0,draws:0,chunks:0};this.fG=0;this.Tb=0;this.aG={...e},this.oG=new a(e.instances),this.lG=new a(e.chunks)}get capacities(){return this.aG}get groupHighWater(){return this.pG}get chunkHighWater(){return this.cG}get drawHighWater(){return this.dG}get liveGroupCount(){return this.pG-this.sG.length}get version(){return this.Tb}get isOverflowed(){return this.bG}get isRecording(){return this.tG!==void 0}get requiredCapacities(){let e=this.mG;return{instances:this.fG+e.instances,groups:this.liveGroupCount+e.groups,draws:this.dG-this.nG.length+e.draws,chunks:this.gG+e.chunks}}beginRecording(){this.tG!==void 0&&this.iG.push(this.tG),this.tG={groups:[],draws:[]},this.hG.clear()}getOrAllocateGroup(e,t,s){let i=this.tG;if(i===void 0||s<=0)return;let n=this.hG.get(e),o=n==null?void 0:n.get(t);if(o!==void 0&&o.instanceCount===s)return o;let r=Math.ceil(s/c),h=this.oG.allocate(s,1),u=this.lG.allocate(r,1),d=this.sG.length>0||this.pG<this.aG.groups;if(h<0||u<0||!d){h>=0&&this.oG.release(h,s),u>=0&&this.lG.release(u,r),this.CG(s,1,0,r);return}let l={index:this.sG.length>0?this.sG.pop():this.pG++,rangeBase:h,instanceCount:s,viewIndex:t,chunkBase:u,chunkCount:r};return this.fG+=s,this.gG+=r,this.cG=Math.max(this.cG,u+r),i.groups.push(l),n===void 0&&(n=new Map,this.hG.set(e,n)),n.set(t,l),this.Tb++,l}allocateDraw(){let e=this.tG;if(e===void 0)return-1;if(this.nG.length===0&&this.dG>=this.aG.draws)return this.CG(0,0,1,0),-1;let t=this.nG.length>0?this.nG.pop():this.dG++;return e.draws.push(t),this.Tb++,t}finishRecording(e){let t=this.tG;if(t!==void 0){if(this.tG=void 0,this.hG.clear(),e===void 0){this.iG.push(t);return}this.retireBundle(e),(t.groups.length>0||t.draws.length>0)&&this.uG.set(e,t)}}abortRecording(){this.tG!==void 0&&(this.iG.push(this.tG),this.tG=void 0,this.hG.clear())}retireBundle(e){let t=this.uG.get(e);t!==void 0&&(this.uG.delete(e),this.iG.push(t))}retireAllBundles(){for(let e of this.uG.values())this.iG.push(e);this.uG.clear()}releaseRetired(){let e=this.iG;if(e.length===0)return;let t={groups:[],draws:[]};for(let s of e){for(let i of s.groups)this.oG.release(i.rangeBase,i.instanceCount),this.fG-=i.instanceCount,this.lG.release(i.chunkBase,i.chunkCount),this.gG-=i.chunkCount,this.sG.push(i.index),t.groups.push(i);for(let i of s.draws)this.nG.push(i),t.draws.push(i)}return e.length=0,this.Tb++,t}reset(e){this.aG={...e},this.oG=new a(e.instances),this.lG=new a(e.chunks),this.cG=0,this.gG=0,this.sG.length=0,this.pG=0,this.nG.length=0,this.dG=0,this.uG.clear(),this.tG=void 0,this.hG.clear(),this.iG.length=0,this.bG=!1,this.mG={instances:0,groups:0,draws:0,chunks:0},this.fG=0,this.Tb++}CG(e,t,s,i){this.bG=!0;let n=this.mG;n.instances+=e,n.groups+=t,n.draws+=s,n.chunks+=i}};export{c as GpuCullingChunkSize,p as GpuCullingRegistry};
@@ -1 +1 @@
1
- import{RangeAllocator as o}from"./RangeAllocator.js";var x=64,k=class{constructor(e){this.X0=new Map;this.nk=0;this.hG=0;this.lG=!1;this.pG={sourceVertices:0,deformedVertices:0,bounds:0,chunks:0};this.Tb=0;this.iG={...e},this.ek=new o(e.sourceVertices),this.rk=new o(e.deformedVertices),this.tk=new o(e.bounds),this.nG=new o(e.chunks)}get capacities(){return this.iG}get entries(){return this.X0.values()}get entryCount(){return this.X0.size}get boundsHighWater(){return this.nk}get chunkHighWater(){return this.hG}get version(){return this.Tb}get isOverflowed(){return this.lG}get requiredCapacities(){let e={...this.pG};for(let r of this.X0.values())e.sourceVertices+=r.vertexCount,e.deformedVertices+=r.vertexCount*r.instanceCount,e.bounds+=r.instanceCount,e.chunks+=r.chunkCount;return e}acquire(e,r,n){let d=this.X0.get(e);if(d!==void 0)return d.refCount++,{entry:d,isNew:!1};if(n<=0||r.length===0)return;let b=[],p=[],s=0,l=0;for(let u of r){b.push(s);let v=Math.ceil(u/x);p.push(v),s+=u,l+=v}if(s===0)return;let m=s*n,i=l*n,c=this.ek.allocate(s,1),f=this.rk.allocate(m,1),a=this.tk.allocate(n,1),h=this.nG.allocate(i,1);if(c<0||f<0||a<0||h<0){c>=0&&this.ek.release(c,s),f>=0&&this.rk.release(f,m),a>=0&&this.tk.release(a,n),h>=0&&this.nG.release(h,i),this.lG=!0;let u=this.pG;u.sourceVertices+=s,u.deformedVertices+=m,u.bounds+=n,u.chunks+=i;return}let C={key:e,primitiveVertexCounts:r.slice(),primitiveOffsets:b,primitiveChunkCounts:p,vertexCount:s,chunkCountPerInstance:l,instanceCount:n,sourceBase:c,deformedBase:f,boundsBase:a,chunkBase:h,chunkCount:i,refCount:1};return this.X0.set(e,C),this.nk=Math.max(this.nk,a+n),this.hG=Math.max(this.hG,h+i),this.Tb++,{entry:C,isNew:!0}}release(e){return this.X0.get(e.key)!==e||(e.refCount--,e.refCount>0)?!1:(this.X0.delete(e.key),this.ek.release(e.sourceBase,e.vertexCount),this.rk.release(e.deformedBase,e.vertexCount*e.instanceCount),this.tk.release(e.boundsBase,e.instanceCount),this.nG.release(e.chunkBase,e.chunkCount),this.Tb++,!0)}reset(e){this.iG={...e},this.ek=new o(e.sourceVertices),this.rk=new o(e.deformedVertices),this.tk=new o(e.bounds),this.nG=new o(e.chunks),this.X0.clear(),this.nk=0,this.hG=0,this.lG=!1,this.pG={sourceVertices:0,deformedVertices:0,bounds:0,chunks:0},this.Tb++}};function y(t){return(t&2147483648)!==0?~t>>>0:(t|2147483648)>>>0}function D(t){return(t&2147483648)!==0?(t&2147483647)>>>0:~t>>>0}export{x as GpuDeformChunkSize,k as GpuDeformRegistry,D as decodeOrderedFloat,y as encodeOrderedFloat};
1
+ import{RangeAllocator as o}from"./RangeAllocator.js";var x=64,k=class{constructor(e){this.X0=new Map;this.nk=0;this.cG=0;this.bG=!1;this.mG={sourceVertices:0,deformedVertices:0,bounds:0,chunks:0};this.Tb=0;this.aG={...e},this.ek=new o(e.sourceVertices),this.rk=new o(e.deformedVertices),this.tk=new o(e.bounds),this.lG=new o(e.chunks)}get capacities(){return this.aG}get entries(){return this.X0.values()}get entryCount(){return this.X0.size}get boundsHighWater(){return this.nk}get chunkHighWater(){return this.cG}get version(){return this.Tb}get isOverflowed(){return this.bG}get requiredCapacities(){let e={...this.mG};for(let r of this.X0.values())e.sourceVertices+=r.vertexCount,e.deformedVertices+=r.vertexCount*r.instanceCount,e.bounds+=r.instanceCount,e.chunks+=r.chunkCount;return e}acquire(e,r,n){let d=this.X0.get(e);if(d!==void 0)return d.refCount++,{entry:d,isNew:!1};if(n<=0||r.length===0)return;let b=[],p=[],s=0,l=0;for(let u of r){b.push(s);let v=Math.ceil(u/x);p.push(v),s+=u,l+=v}if(s===0)return;let m=s*n,i=l*n,c=this.ek.allocate(s,1),f=this.rk.allocate(m,1),a=this.tk.allocate(n,1),h=this.lG.allocate(i,1);if(c<0||f<0||a<0||h<0){c>=0&&this.ek.release(c,s),f>=0&&this.rk.release(f,m),a>=0&&this.tk.release(a,n),h>=0&&this.lG.release(h,i),this.bG=!0;let u=this.mG;u.sourceVertices+=s,u.deformedVertices+=m,u.bounds+=n,u.chunks+=i;return}let C={key:e,primitiveVertexCounts:r.slice(),primitiveOffsets:b,primitiveChunkCounts:p,vertexCount:s,chunkCountPerInstance:l,instanceCount:n,sourceBase:c,deformedBase:f,boundsBase:a,chunkBase:h,chunkCount:i,refCount:1};return this.X0.set(e,C),this.nk=Math.max(this.nk,a+n),this.cG=Math.max(this.cG,h+i),this.Tb++,{entry:C,isNew:!0}}release(e){return this.X0.get(e.key)!==e||(e.refCount--,e.refCount>0)?!1:(this.X0.delete(e.key),this.ek.release(e.sourceBase,e.vertexCount),this.rk.release(e.deformedBase,e.vertexCount*e.instanceCount),this.tk.release(e.boundsBase,e.instanceCount),this.lG.release(e.chunkBase,e.chunkCount),this.Tb++,!0)}reset(e){this.aG={...e},this.ek=new o(e.sourceVertices),this.rk=new o(e.deformedVertices),this.tk=new o(e.bounds),this.lG=new o(e.chunks),this.X0.clear(),this.nk=0,this.cG=0,this.bG=!1,this.mG={sourceVertices:0,deformedVertices:0,bounds:0,chunks:0},this.Tb++}};function y(t){return(t&2147483648)!==0?~t>>>0:(t|2147483648)>>>0}function D(t){return(t&2147483648)!==0?(t&2147483647)>>>0:~t>>>0}export{x as GpuDeformChunkSize,k as GpuDeformRegistry,D as decodeOrderedFloat,y as encodeOrderedFloat};
@@ -1 +1 @@
1
- var b=class{constructor(e){this.e1=[];this.t1=[];this.s1=0;this.F0=e,e>0&&(this.e1.push(0),this.t1.push(e))}get capacity(){return this.F0}get usedSize(){return this.s1}get isEmpty(){return this.s1===0}allocate(e,n){let s=this.e1,i=this.t1;for(let r=0;r<s.length;r++){let c=s[r],t=i[r],u=Math.ceil(c/n)*n,h=u-c;if(h+e>t)continue;let o=u+e,l=c+t-o,p=[],m=[];return h>0&&(p.push(c),m.push(h)),l>0&&(p.push(o),m.push(l)),s.splice(r,1,...p),i.splice(r,1,...m),this.s1+=e,u}return-1}release(e,n){let s=this.e1,i=this.t1,r=0,c=s.length;for(;r<c;){let l=r+c>>1;s[l]<e?r=l+1:c=l}let t=r,u=t-1,h=u>=0&&s[u]+i[u]===e,o=t<s.length&&e+n===s[t];h&&o?(i[u]+=n+i[t],s.splice(t,1),i.splice(t,1)):h?i[u]+=n:o?(s[t]=e,i[t]+=n):(s.splice(t,0,e),i.splice(t,0,n)),this.s1-=n}getFreeRanges(){return this.e1.map((e,n)=>[e,this.t1[n]])}};export{b as RangeAllocator};
1
+ var b=class{constructor(e){this.s1=[];this.u1=[];this.c1=0;this.F0=e,e>0&&(this.s1.push(0),this.u1.push(e))}get capacity(){return this.F0}get usedSize(){return this.c1}get isEmpty(){return this.c1===0}allocate(e,n){let s=this.s1,i=this.u1;for(let r=0;r<s.length;r++){let c=s[r],t=i[r],u=Math.ceil(c/n)*n,h=u-c;if(h+e>t)continue;let o=u+e,l=c+t-o,p=[],m=[];return h>0&&(p.push(c),m.push(h)),l>0&&(p.push(o),m.push(l)),s.splice(r,1,...p),i.splice(r,1,...m),this.c1+=e,u}return-1}release(e,n){let s=this.s1,i=this.u1,r=0,c=s.length;for(;r<c;){let l=r+c>>1;s[l]<e?r=l+1:c=l}let t=r,u=t-1,h=u>=0&&s[u]+i[u]===e,o=t<s.length&&e+n===s[t];h&&o?(i[u]+=n+i[t],s.splice(t,1),i.splice(t,1)):h?i[u]+=n:o?(s[t]=e,i[t]+=n):(s.splice(t,0,e),i.splice(t,0,n)),this.c1-=n}getFreeRanges(){return this.s1.map((e,n)=>[e,this.u1[n]])}};export{b as RangeAllocator};
@@ -0,0 +1,11 @@
1
+ import type { ShaderSemanticsInfo } from '../foundation/definitions/ShaderSemanticsInfo';
2
+ import type { Engine } from '../foundation/system/Engine';
3
+ /**
4
+ * Returns the WGSL accessor (or texture bindings) of a material property.
5
+ * The instance ID is the material's SID.
6
+ */
7
+ export declare function getWgslMaterialPropertyAccessor(engine: Engine, materialTypeName: string, info: ShaderSemanticsInfo): string;
8
+ /**
9
+ * Returns the WGSL accessor (or texture bindings) of a global property.
10
+ */
11
+ export declare function getWgslGlobalPropertyAccessor(engine: Engine, info: ShaderSemanticsInfo): string;
@@ -0,0 +1,24 @@
1
+ import{ComponentType as l}from"../foundation/definitions/ComponentType.js";import{CompositionType as i}from"../foundation/definitions/CompositionType.js";import{getTextureAndSamplerNames as d}from"../foundation/helpers/ShaderHelper.js";import{Logger as y}from"../foundation/misc/Logger.js";import{getGlobalPropertyOffset as S,getMaterialPropertyOffsets as x,getShaderPropertyFetch as I,getShaderPropertyStrides as h}from"../foundation/renderer/ShaderPropertyLayout.js";function T(t,e){let{vec4Size:r,scalarSize:n,instanceSize:a,instanceSizeInScalar:s}=t;return t.isArray?` let vec4_idx: u32 = ${e.vec4} + ${a} * ${e.instance} + ${r}u * idxOfArray;
2
+ let scalar_idx: u32 = ${e.scalar} + ${s} * ${e.instance} + ${n}u * idxOfArray;
3
+ `:` let vec4_idx: u32 = ${e.vec4} + ${a}u * ${e.instance};
4
+ `}function u(t,e){switch(t.componentType){case l.Int:return` let val = i32(${e});`;case l.UnsignedInt:return` let val = u32(${e});`;case l.Bool:return` let val = ${e} >= 0.5;`;default:return` let val = ${e};`}}function v(t,e){let r=I(t.compositionType);if(r==null)return"";let n=`${r.functionName}(${r.index})`;switch(t.compositionType){case i.Vec3:return` let col0 = ${n};
5
+ let val = ${e}(col0.xyz);`;case i.Vec2:return` let col0 = ${n};
6
+ let val = ${e}(col0.xy);`;case i.Scalar:return` let col0 = ${n};
7
+ ${u(t,"col0.x")}`;case i.ScalarArray:return` let col0 = ${n};
8
+ ${u(t,"col0")}`;default:return` let val = ${n};
9
+ `}}function m(t,e){let r="texture_2d<f32>";t.compositionType===i.TextureCube?r="texture_cube<f32>":t.compositionType===i.Texture2DArray&&(r="texture_2d_array<f32>");let{textureName:n,samplerName:a}=d(e);return`
10
+ @group(1) @binding(${t.initialValue[0]}) var ${n}: ${r};
11
+ @group(2) @binding(${t.initialValue[0]}) var ${a}: sampler;
12
+ `}function p(t,e,r){let n=t.compositionType.toWGSLType(t.componentType),a=t.semantic.replace(".","_"),s=T(h(t),r);return`${e(n,a,s)}${v(t,n)}
13
+ return val;
14
+ }
15
+ `}function O(t,e,r){let n=r.semantic.replace(".","_");if(i.isTexture(r.compositionType))return m(r,n);let a=x(t,e,r.semantic),s=t.materialRepository._getMaterialCountPerBufferView(e),o=`rnOffsets_${n}`,f=`const ${o}: array<u32, ${a.length}> = array<u32, ${a.length}>(${a.map(c=>`${c}u`).join(", ")});`;return p(r,(c,g,$)=>`
16
+ ${f}
17
+ fn get_${g}(instanceId: u32, idxOfArray: u32) -> ${c} {
18
+ let instanceIdOfBufferViews = instanceId / ${s};
19
+ let instanceIdInBufferView = instanceId % ${s};
20
+ ${$}
21
+ `,{vec4:`${o}[instanceIdOfBufferViews]`,scalar:`${o}[instanceIdOfBufferViews] * 4`,instance:"instanceIdInBufferView"})}function w(t,e){let r=e.semantic.replace(".","_");if(i.isTexture(e.compositionType))return m(e,r);let n=S(t,e.semantic);return n===-1&&y.default.error("Could not get the location offset of the property."),p(e,(a,s,o)=>`
22
+ fn get_${s}(instanceId: u32, idxOfArray: u32) -> ${a} {
23
+ ${o}
24
+ `,{vec4:`${n}u`,scalar:`${n*4}`,instance:"instanceId"})}export{w as getWgslGlobalPropertyAccessor,O as getWgslMaterialPropertyAccessor};
@@ -0,0 +1,131 @@
1
+ import type { Material } from '../foundation/materials/core/Material';
2
+ import type { Engine } from '../foundation/system/Engine';
3
+ import { CubeTexture } from '../foundation/textures/CubeTexture';
4
+ import { RenderTargetTextureCube } from '../foundation/textures/RenderTargetTextureCube';
5
+ import type { WebGPUResourceHandle } from '../types/CommonTypes';
6
+ import type { WebGpuDeviceWrapper } from './WebGpuDeviceWrapper';
7
+ import type { WebGpuDrawParameters } from './WebGpuDrawParameters';
8
+ import type { WebGpuGpuCulling } from './WebGpuGpuCulling';
9
+ import type { WebGpuResource } from './WebGpuResourceRepository';
10
+ import type { WebGpuStorageBuffers } from './WebGpuStorageBuffers';
11
+ /** Bind groups and their layouts used by a draw, shared by every draw with the same content. */
12
+ export type DrawBindGroups = {
13
+ storage: GPUBindGroup;
14
+ texture: GPUBindGroup;
15
+ sampler: GPUBindGroup;
16
+ pipelineLayout: GPUPipelineLayout;
17
+ pipelineLayoutKey: string;
18
+ };
19
+ /**
20
+ * What `WebGpuBindGroups` needs from the resource repository that owns it.
21
+ */
22
+ export interface WebGpuBindGroupResources {
23
+ /** The device wrapper, which is set when the repository is given a device. */
24
+ getDeviceWrapper(): WebGpuDeviceWrapper | undefined;
25
+ /** Returns the WebGPU object of a resource handle. */
26
+ getResource(handle: WebGPUResourceHandle): WebGpuResource | undefined;
27
+ /** The GPU culling compute pass, whose deformed vertex buffer is bound at group 0 while it runs. */
28
+ getGpuCulling(): WebGpuGpuCulling | undefined;
29
+ /** The storage and morph buffers bound at group 0. */
30
+ getStorageBuffers(): WebGpuStorageBuffers;
31
+ /** The draw parameters bind group layout used by the pipeline layouts. */
32
+ getDrawParameters(): WebGpuDrawParameters;
33
+ /** Drops the recorded render bundles, which bind bind groups that may have been replaced. */
34
+ clearRenderBundleCache(): void;
35
+ }
36
+ /**
37
+ * Builds the bind groups of a draw: the storage buffers (group 0), the textures (group 1), the samplers
38
+ * (group 2) and, with their layouts, the pipeline layout of the draw.
39
+ *
40
+ * Bind groups and pipelines are cached independently of each other:
41
+ * - Bind group layouts and pipeline layouts are keyed by their descriptors, so every pipeline and bind group
42
+ * with the same layout shares one object.
43
+ * - Bind groups are keyed by their layout and the resources they bind, so draws binding the same resources
44
+ * share one bind group regardless of the pipeline, material or render pass. Sharing lets draw() skip a
45
+ * setBindGroup() that would rebind the same group, which is otherwise replayed by the browser's GPU process
46
+ * for every draw of a render bundle on every frame.
47
+ *
48
+ * Owned by `WebGpuResourceRepository`, which exposes getDrawBindGroups through its public methods.
49
+ */
50
+ export declare class WebGpuBindGroups {
51
+ private __resources;
52
+ /** Group 0: the storage buffer, the blend shape buffer and the morph uniform buffers. */
53
+ private __bindGroupStorageBuffer?;
54
+ private __bindGroupLayoutStorageBuffer?;
55
+ private __bindGroupLayoutKeyStorageBuffer;
56
+ /** The buffers bound by `__bindGroupStorageBuffer`, used to detect when it must be recreated. */
57
+ private __storageBindGroupBuffers;
58
+ /** Bound to the blend shape slot of group 0 when there is no blend shape buffer. */
59
+ private __dummyBlendShapeBuffer?;
60
+ /** Bound at group 0, binding 4 while the GPU culling (and its deformed vertex buffer) does not exist. */
61
+ private __dummyDeformedVerticesBuffer?;
62
+ private __bindGroupLayoutCache;
63
+ private __pipelineLayoutCache;
64
+ /** Group 1 (textures), keyed by layout and bound texture views. */
65
+ private __textureBindGroupCache;
66
+ /** Group 2 (samplers), keyed by layout and bound samplers. */
67
+ private __samplerBindGroupCache;
68
+ /** Views created for dummy textures when a texture has no view yet, by texture and dimension. */
69
+ private __dummyTextureViews;
70
+ /** Identifiers of GPU objects used to build cache keys. */
71
+ private __gpuObjectIds;
72
+ private __gpuObjectIdCount;
73
+ private __textureSamplerBindings;
74
+ private __drawBindGroups;
75
+ constructor(resources: WebGpuBindGroupResources);
76
+ private get __webGpuDeviceWrapper();
77
+ private __getResource;
78
+ private get __storageBuffers();
79
+ private get __drawParameters();
80
+ private __clearRenderBundleCache;
81
+ /**
82
+ * Clears the bind groups cached for the deleted textures and the group 0 bind group.
83
+ */
84
+ clearCache(): void;
85
+ /**
86
+ * Whether the group 0 bind group binds other buffers than the current storage and morph buffers
87
+ * (for example after WebGpuStorageBuffers replaced one of them).
88
+ */
89
+ isStorageBindGroupStale(): boolean;
90
+ /**
91
+ * Returns a stable identifier of a GPU object for cache keys.
92
+ */
93
+ private __getGpuObjectId;
94
+ /**
95
+ * Returns the bind group layout for the given descriptor, shared by every bind group and pipeline
96
+ * layout with the same descriptor.
97
+ */
98
+ private __getOrCreateBindGroupLayout;
99
+ /**
100
+ * Returns the view of a dummy texture with the given dimension. The view is created once per texture.
101
+ */
102
+ private __getDummyTextureView;
103
+ /**
104
+ * The buffer bound at group 0, binding 4: the vertices deformed by the GPU culling, or a dummy buffer without it.
105
+ */
106
+ private __getDeformedVerticesBuffer;
107
+ /**
108
+ * Returns the group 0 bind group (storage buffer, blend shape buffer, morph uniform buffers, deformed vertices).
109
+ * It is recreated only when one of those buffers is replaced.
110
+ */
111
+ private __getStorageBindGroup;
112
+ /**
113
+ * Appends a texture binding and its sampler to `__textureSamplerBindings`.
114
+ */
115
+ private __pushTextureSamplerBinding;
116
+ /**
117
+ * Collects the textures and samplers bound by a material into `__textureSamplerBindings`.
118
+ * The IBL cube maps come from the mesh renderer component, not from the material.
119
+ */
120
+ private __collectTextureSamplerBindings;
121
+ /**
122
+ * Returns the bind groups and the pipeline layout for drawing with a material.
123
+ *
124
+ * The texture (group 1) and sampler (group 2) bind groups are looked up by the resources they bind,
125
+ * so materials binding the same textures and samplers share them. They do not depend on the render
126
+ * pipeline, so a pipeline can be recreated without recreating bind groups and vice versa.
127
+ */
128
+ getDrawBindGroups(engine: Engine, material: Material, diffuseCubeMap?: CubeTexture | RenderTargetTextureCube, specularCubeMap?: CubeTexture | RenderTargetTextureCube, sheenCubeMap?: CubeTexture | RenderTargetTextureCube): DrawBindGroups;
129
+ private __getTextureBindGroupLayout;
130
+ private __getSamplerBindGroupLayout;
131
+ }
@@ -0,0 +1 @@
1
+ import{CompositionType as w}from"../foundation/definitions/CompositionType.js";import{ShaderSemantics as v}from"../foundation/definitions/ShaderSemantics.js";import{Is as m}from"../foundation/misc/Is.js";import{CubeTexture as R}from"../foundation/textures/CubeTexture.js";import{RenderTargetTexture2DArray as W}from"../foundation/textures/RenderTargetTexture2DArray.js";import{RenderTargetTextureCube as V}from"../foundation/textures/RenderTargetTextureCube.js";import{TextureArray as D}from"../foundation/textures/TextureArray.js";var P=class{constructor(e){this.VG="";this.PG=[];this.BG=new Map;this.LG=new Map;this.TG=new Map;this.SG=new Map;this.MG=new WeakMap;this.$G=new WeakMap;this.OG=0;this.UG={count:0,slots:[],dimensions:[],visibilities:[],views:[],samplers:[]};this.x_=e}get yG(){return this.x_.getDeviceWrapper()}KG(e){return this.x_.getResource(e)}get GG(){return this.x_.getStorageBuffers()}get kG(){return this.x_.getDrawParameters()}FG(){this.x_.clearRenderBundleCache()}clearCache(){this.TG.clear(),this.SG.clear(),this.xG=void 0,this.PG.length=0}isStorageBindGroupStale(){let e=this.PG;return this.xG!=null&&(e[0]!==this.GG.getStorageBuffer()||e[1]!==this.GG.getStorageBlendShapeBuffer()||e[2]!==this.GG.getUniformMorphOffsetsBuffer()||e[3]!==this.GG.getUniformMorphWeightsBuffer()||e[4]!==this.wG())}AG(e){let r=this.$G.get(e);return r===void 0&&(r=++this.OG,this.$G.set(e,r)),r}RG(e,r){let t=this.BG.get(e);return t==null&&(t=this.yG.gpuDevice.createBindGroupLayout({entries:r}),this.BG.set(e,t)),t}HG(e,r){let t=this.MG.get(e);t==null&&(t=new Map,this.MG.set(e,t));let s=t.get(r);return s==null&&(s=r==="2d"?e.createView():e.createView({dimension:r}),t.set(r,s)),s}wG(){var r,t,s;let e=(r=this.x_.getGpuCulling())==null?void 0:r.deformedVerticesBuffer;return e!=null?e:((s=this[t="EG"])!=null||(this[t]=this.yG.gpuDevice.createBuffer({size:32,usage:GPUBufferUsage.STORAGE})),this.EG)}NG(){var y,d;let e=this.PG;if(this.xG!=null&&e[0]===this.GG.getStorageBuffer()&&e[1]===this.GG.getStorageBlendShapeBuffer()&&e[2]===this.GG.getUniformMorphOffsetsBuffer()&&e[3]===this.GG.getUniformMorphWeightsBuffer()&&e[4]===this.wG())return this.xG;e[0]=this.GG.getStorageBuffer(),e[1]=this.GG.getStorageBlendShapeBuffer(),e[2]=this.GG.getUniformMorphOffsetsBuffer(),e[3]=this.GG.getUniformMorphWeightsBuffer(),e[4]=this.wG();let r=this.yG.gpuDevice,t=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,s=[],n=[],i="",u=this.GG.getStorageBuffer();u!=null&&(s.push({binding:0,resource:{buffer:u}}),n.push({binding:0,buffer:{type:"read-only-storage"},visibility:t}),i+="s");let l=this.GG.getStorageBlendShapeBuffer();l==null&&((d=this[y="DG"])!=null||(this[y]=r.createBuffer({size:16,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.STORAGE})),l=this.DG),s.push({binding:1,resource:{buffer:l}}),n.push({binding:1,buffer:{type:"read-only-storage"},visibility:t}),i+="b";let g=this.GG.getUniformMorphOffsetsBuffer();g!=null&&(s.push({binding:2,resource:{buffer:g}}),n.push({binding:2,buffer:{type:"uniform"},visibility:t}),i+="o");let G=this.GG.getUniformMorphWeightsBuffer();G!=null&&(s.push({binding:3,resource:{buffer:G}}),n.push({binding:3,buffer:{type:"uniform"},visibility:t}),i+="w"),s.push({binding:4,resource:{buffer:e[4]}}),n.push({binding:4,buffer:{type:"read-only-storage"},visibility:GPUShaderStage.VERTEX}),i+="d",i=`storage:${i}`;let b=this.RG(i,n);return this.xG=r.createBindGroup({layout:b,entries:s}),this.WG=b,this.VG=i,this.FG(),this.xG}vG(e,r,t,s,n){let i=this.UG,u=i.count++;i.slots[u]=e,i.dimensions[u]=r,i.visibilities[u]=t,i.views[u]=s,i.samplers[u]=n}XG(e,r,t,s,n){this.UG.count=0;let i={get:o=>this.KG(o)},u=GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,l=e.dummyTextures;for(let o of r._autoTextureFieldVariablesOnly.values()){let a=o.info;if(a.semantic==="diffuseEnvTexture"||a.semantic==="specularEnvTexture"||a.semantic==="sheenEnvTexture"||!w.isTexture(a.compositionType))continue;let U=o.value[0],h=o.value[1],x=o.value[2],f="2d";h instanceof R||h instanceof V?f="cube":(h instanceof D||h instanceof W)&&(f="2d-array");let p=i.get(h._textureViewResourceUid);if(p==null){let T=f==="cube"?l.dummyBlackCubeTexture:l.dummyWhiteTexture,S=i.get(T._textureResourceUid);p=this.HG(S,f)}x.created||x.create();let c=i.get(x._samplerResourceUid);this.vG(U,f,u,p,c)}let g=l.dummyBlackCubeTexture,G=()=>i.get(g._textureViewResourceUid),b=()=>i.get(g._samplerResourceUid),y=r.getTextureParameter(v.DiffuseEnvTexture.str);if(m.exist(y)){let o=i.get(m.exist(t)?t._textureViewResourceUid:-1),a=i.get(m.exist(t)?t._samplerResourceUid:-1);this.vG(y[0],"cube",u,o!=null?o:G(),a!=null?a:b())}let d=r.getTextureParameter(v.SpecularEnvTexture.str);if(m.exist(d)){let o=i.get(m.exist(s)?s._textureViewResourceUid:-1),a=i.get(m.exist(s)?s._samplerResourceUid:-1);this.vG(d[0],"cube",u,o!=null?o:G(),a!=null?a:b())}let B=r.getTextureParameter(v.SheenEnvTexture.str);if(m.exist(B)){let o=m.exist(n)?n:s,a=m.exist(o)?i.get(o._textureViewResourceUid):void 0,U=m.exist(o)?i.get(o._samplerResourceUid):void 0;this.vG(B[0],"cube",GPUShaderStage.FRAGMENT,a!=null?a:G(),U!=null?U:b())}}getDrawBindGroups(e,r,t,s,n){let i=this.NG();this.XG(e,r,t,s,n);let u=this.UG,l="texture:",g="sampler:",G="",b="";for(let p=0;p<u.count;p++)l+=`${u.slots[p]}/${u.dimensions[p]}/${u.visibilities[p]},`,g+=`${u.slots[p]}/${u.visibilities[p]},`,G+=`${this.AG(u.views[p])},`,b+=`${this.AG(u.samplers[p])},`;let y=`${l}|${G}`,d=this.TG.get(y),B=this.zG(l);if(d==null){let p=[];for(let c=0;c<u.count;c++)p.push({binding:u.slots[c],resource:u.views[c]});d=this.yG.gpuDevice.createBindGroup({layout:B,entries:p}),this.TG.set(y,d)}let o=`${g}|${b}`,a=this.SG.get(o),U=this.jG(g);if(a==null){let p=[];for(let c=0;c<u.count;c++)p.push({binding:u.slots[c],resource:u.samplers[c]});a=this.yG.gpuDevice.createBindGroup({layout:U,entries:p}),this.SG.set(o,a)}let h=`${this.VG}#${l}#${g}`,x=this.LG.get(h);x==null&&(x=this.yG.gpuDevice.createPipelineLayout({bindGroupLayouts:[this.WG,B,U,this.kG.getBindGroupLayout()]}),this.LG.set(h,x));let f=this._G;return f==null?(f={storage:i,texture:d,sampler:a,pipelineLayout:x,pipelineLayoutKey:h},this._G=f):(f.storage=i,f.texture=d,f.sampler=a,f.pipelineLayout=x,f.pipelineLayoutKey=h),f}zG(e){let r=this.BG.get(e);if(r!=null)return r;let t=this.UG,s=[];for(let n=0;n<t.count;n++)s.push({binding:t.slots[n],texture:{viewDimension:t.dimensions[n]},visibility:t.visibilities[n]});return this.RG(e,s)}jG(e){let r=this.BG.get(e);if(r!=null)return r;let t=this.UG,s=[];for(let n=0;n<t.count;n++)s.push({binding:t.slots[n],sampler:{type:"filtering"},visibility:t.visibilities[n]});return this.RG(e,s)}};export{P as WebGpuBindGroups};
@@ -1 +1 @@
1
- import{RangeAllocator as l}from"./RangeAllocator.js";var u=16,s=4,c=64*1024*1024,o=class{constructor(e,r,t=c){this.fB=[];this.Y0=new Uint8Array(0);this.uB=e,this.hB=r|GPUBufferUsage.COPY_DST,this.bB=Math.min(t,e.limits.maxBufferSize)}get chunkCount(){return this.fB.length}allocate(e){let r=e.byteLength,t=Math.max(Math.ceil(r/s)*s,s),f,i=-1;for(let a=0;a<this.fB.length;a++)if(i=this.fB[a].allocator.allocate(t,u),i>=0){f=this.fB[a];break}if(f==null){let a=Math.max(this.bB,Math.ceil(t/u)*u);f={buffer:this.uB.createBuffer({size:a,usage:this.hB}),allocator:new l(a)},this.fB.push(f),i=f.allocator.allocate(t,u)}let n={buffer:f.buffer,offset:i,size:r,allocatedSize:t,chunk:f};return this.write(n,e),n}write(e,r){let t=Math.min(r.byteLength,e.allocatedSize);if(t===0)return;let f=Math.ceil(t/s)*s,i=r;(f!==t||!(r.buffer instanceof ArrayBuffer))&&(this.Y0.byteLength<f&&(this.Y0=new Uint8Array(f)),i=this.Y0.subarray(0,f),i.set(r.subarray(0,t)),i.fill(0,t)),this.uB.queue.writeBuffer(e.buffer,e.offset,i,0,f)}release(e){let r=e.chunk;if(r.allocator.release(e.offset,e.allocatedSize),r.allocator.isEmpty&&this.fB.length>1){let t=this.fB.indexOf(r);t>=0&&this.fB.splice(t,1),r.buffer.destroy()}}destroy(){for(let e of this.fB)e.buffer.destroy();this.fB.length=0}};export{o as WebGpuBufferArena};
1
+ import{RangeAllocator as l}from"./RangeAllocator.js";var u=16,s=4,c=64*1024*1024,o=class{constructor(e,r,t=c){this.bB=[];this.Y0=new Uint8Array(0);this.yB=e,this.gB=r|GPUBufferUsage.COPY_DST,this.UB=Math.min(t,e.limits.maxBufferSize)}get chunkCount(){return this.bB.length}allocate(e){let r=e.byteLength,t=Math.max(Math.ceil(r/s)*s,s),f,i=-1;for(let a=0;a<this.bB.length;a++)if(i=this.bB[a].allocator.allocate(t,u),i>=0){f=this.bB[a];break}if(f==null){let a=Math.max(this.UB,Math.ceil(t/u)*u);f={buffer:this.yB.createBuffer({size:a,usage:this.gB}),allocator:new l(a)},this.bB.push(f),i=f.allocator.allocate(t,u)}let n={buffer:f.buffer,offset:i,size:r,allocatedSize:t,chunk:f};return this.write(n,e),n}write(e,r){let t=Math.min(r.byteLength,e.allocatedSize);if(t===0)return;let f=Math.ceil(t/s)*s,i=r;(f!==t||!(r.buffer instanceof ArrayBuffer))&&(this.Y0.byteLength<f&&(this.Y0=new Uint8Array(f)),i=this.Y0.subarray(0,f),i.set(r.subarray(0,t)),i.fill(0,t)),this.yB.queue.writeBuffer(e.buffer,e.offset,i,0,f)}release(e){let r=e.chunk;if(r.allocator.release(e.offset,e.allocatedSize),r.allocator.isEmpty&&this.bB.length>1){let t=this.bB.indexOf(r);t>=0&&this.bB.splice(t,1),r.buffer.destroy()}}destroy(){for(let e of this.bB)e.buffer.destroy();this.bB.length=0}};export{o as WebGpuBufferArena};
@@ -0,0 +1,38 @@
1
+ import type { CompressionTextureTypeEnum } from '../foundation/definitions/CompressionTextureType';
2
+ import type { TextureData } from '../foundation/renderer/CGAPIResourceRepository';
3
+ import type { BasisFile } from '../types/BasisTexture';
4
+ import type { WebGPUResourceHandle } from '../types/CommonTypes';
5
+ import type { WebGpuDeviceWrapper } from './WebGpuDeviceWrapper';
6
+ import type { WebGpuResource } from './WebGpuResourceRepository';
7
+ /**
8
+ * What `WebGpuCompressedTextures` needs from the resource repository that owns it.
9
+ */
10
+ export interface WebGpuCompressedTextureResources {
11
+ /** The device wrapper, which is set when the repository is given a device. */
12
+ getDeviceWrapper(): WebGpuDeviceWrapper | undefined;
13
+ /** Registers a WebGPU object and returns its resource handle. */
14
+ registerResource(obj: WebGpuResource): WebGPUResourceHandle;
15
+ }
16
+ /**
17
+ * Creates the block-compressed textures of the WebGPU backend, from Basis files and from transcoded level data.
18
+ *
19
+ * Owned by `WebGpuResourceRepository`, which exposes these operations through its public methods.
20
+ */
21
+ export declare class WebGpuCompressedTextures {
22
+ private __resources;
23
+ constructor(resources: WebGpuCompressedTextureResources);
24
+ private get __webGpuDeviceWrapper();
25
+ private __registerResource;
26
+ /**
27
+ * create CompressedTextureFromBasis
28
+ * @param basisFile
29
+ * @returns
30
+ */
31
+ createCompressedTextureFromBasis(basisFile: BasisFile): WebGPUResourceHandle;
32
+ /**
33
+ * Create and bind compressed texture object
34
+ * @param textureDataArray transcoded texture data for each mipmaps(levels)
35
+ * @param compressionTextureType
36
+ */
37
+ createCompressedTexture(textureDataArray: TextureData[], compressionTextureType: CompressionTextureTypeEnum): Promise<WebGPUResourceHandle>;
38
+ }
@@ -0,0 +1 @@
1
+ import{BasisCompressionType as b}from"../foundation/definitions/BasisCompressionType.js";import{decodeBasisImage as C}from"../foundation/textures/decodeBasisImage.js";import{assertArrayBufferView as y}from"./assertArrayBufferView.js";import{padCompressedRowsForUpload as W}from"./padCompressedRowsForUpload.js";var G=class{constructor(e){this.x_=e}get yG(){return this.x_.getDeviceWrapper()}T_(e){return this.x_.registerResource(e)}createCompressedTextureFromBasis(e){let u,t,r=e.getNumLevels(0),n=e.getImageWidth(0,0),f=e.getImageHeight(0,0),a=this.yG.gpuDevice,p=this.yG.gpuAdapter,c=p.features.has("texture-compression-bc"),s=p.features.has("texture-compression-etc2"),h=p.features.has("texture-compression-astc");if(c?(u=b.BC3,t="bc3-rgba-unorm"):s?(u=b.ETC2,t="etc2-rgba8unorm"):h&&(u=b.ASTC,t="astc-4x4-unorm"),!t)throw console.warn("No supported compression format found, falling back to uncompressed"),new Error("No supported compression format found");let m={size:[n,f,1],format:t,mipLevelCount:r,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},g=a.createTexture(m),o={byteSize:16,width:4,height:4};t==="bc1-rgba-unorm"?o={byteSize:8,width:4,height:4}:t==="bc3-rgba-unorm"||t==="astc-4x4-unorm"?o={byteSize:16,width:4,height:4}:t==="etc2-rgba8unorm"?o={byteSize:16,width:4,height:4}:t==="etc2-rgb8unorm"&&(o={byteSize:8,width:4,height:4});for(let i=0;i<r;i++){let d=e.getImageWidth(0,i),x=e.getImageHeight(0,i),D=C(e,u,0,i),R=Math.max(1,Math.ceil(d/o.width)),T=Math.max(1,Math.ceil(x/o.height)),{data:w,bytesPerRow:U}=W(D,R,T,o.byteSize);y(w),a.queue.writeTexture({texture:g,mipLevel:i},w,{offset:0,bytesPerRow:U,rowsPerImage:T},{width:Math.ceil(d/o.width)*o.width,height:Math.ceil(x/o.height)*o.height})}return this.T_(g)}async createCompressedTexture(e,u){let t=this.yG.gpuDevice,r=u.blockInfo||{byteSize:4,width:1,height:1},n=e[0],f={size:[Math.ceil(n.width/r.width)*r.width,Math.ceil(n.height/r.height)*r.height,1],format:u.webgpu,mipLevelCount:e.length,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST},a=t.createTexture(f);for(let c=0;c<e.length;c++){let s=e[c],h=s.width,m=s.height,g=Math.max(1,Math.ceil(h/r.width)),o=Math.max(1,Math.ceil(m/r.height)),l=s.buffer instanceof Uint8Array?s.buffer:new Uint8Array(s.buffer.buffer,s.buffer.byteOffset,s.buffer.byteLength),{data:i,bytesPerRow:d}=W(l,g,o,r.byteSize);y(i),t.queue.writeTexture({texture:a,mipLevel:c},i,{offset:0,bytesPerRow:d,rowsPerImage:o},{width:Math.ceil(h/r.width)*r.width,height:Math.ceil(m/r.height)*r.height})}return await t.queue.onSubmittedWorkDone(),this.T_(a)}};export{G as WebGpuCompressedTextures};
@@ -0,0 +1 @@
1
+ export declare const cubeTextureReadWgsl = "\n struct VertexOutput {\n @builtin(position) position: vec4f,\n @location(0) texCoord: vec2f,\n };\n\n @vertex\n fn vertexMain(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {\n var pos = array<vec2f, 4>(\n vec2f(-1.0, -1.0),\n vec2f( 1.0, -1.0),\n vec2f(-1.0, 1.0),\n vec2f( 1.0, 1.0)\n );\n\n var output: VertexOutput;\n output.position = vec4f(pos[vertexIndex], 0.0, 1.0);\n output.texCoord = pos[vertexIndex] * 0.5 + 0.5;\n return output;\n }\n\n @group(0) @binding(0) var cubemapTexture: texture_cube<f32>;\n @group(0) @binding(1) var cubemapSampler: sampler;\n\n struct Uniforms {\n faceIndex: i32,\n isHdr: i32,\n };\n @group(0) @binding(2) var<uniform> uniforms: Uniforms;\n\n fn getDirection(face: i32, uv: vec2f) -> vec3f {\n var st = uv * 2.0 - 1.0;\n if (face == 0) { return vec3f( 1.0, -st.y, -st.x); } // +X\n if (face == 1) { return vec3f(-1.0, -st.y, st.x); } // -X\n if (face == 2) { return vec3f( st.x, 1.0, st.y); } // +Y\n if (face == 3) { return vec3f( st.x, -1.0, -st.y); } // -Y\n if (face == 4) { return vec3f( st.x, -st.y, 1.0); } // +Z\n return vec3f(-st.x, -st.y, -1.0); // -Z\n }\n\n @fragment\n fn fragmentMain(input: VertexOutput) -> @location(0) vec4f {\n // Flip Y coordinate to match WebGPU's top-left origin coordinate system\n var flippedTexCoord = vec2f(input.texCoord.x, 1.0 - input.texCoord.y);\n var dir = normalize(getDirection(uniforms.faceIndex, flippedTexCoord));\n var color = textureSample(cubemapTexture, cubemapSampler, dir).rgb;\n\n // Only apply tone mapping and gamma correction for HDR textures\n // LDR textures (e.g., rgba8unorm) should pass through unchanged\n if (uniforms.isHdr != 0) {\n // Reinhard tone mapping\n color = color / (1.0 + color);\n\n // Gamma correction\n color = pow(color, vec3f(1.0 / 2.2));\n }\n\n return vec4f(color, 1.0);\n }\n ";
@@ -0,0 +1,60 @@
1
+ var e=`
2
+ struct VertexOutput {
3
+ @builtin(position) position: vec4f,
4
+ @location(0) texCoord: vec2f,
5
+ };
6
+
7
+ @vertex
8
+ fn vertexMain(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
9
+ var pos = array<vec2f, 4>(
10
+ vec2f(-1.0, -1.0),
11
+ vec2f( 1.0, -1.0),
12
+ vec2f(-1.0, 1.0),
13
+ vec2f( 1.0, 1.0)
14
+ );
15
+
16
+ var output: VertexOutput;
17
+ output.position = vec4f(pos[vertexIndex], 0.0, 1.0);
18
+ output.texCoord = pos[vertexIndex] * 0.5 + 0.5;
19
+ return output;
20
+ }
21
+
22
+ @group(0) @binding(0) var cubemapTexture: texture_cube<f32>;
23
+ @group(0) @binding(1) var cubemapSampler: sampler;
24
+
25
+ struct Uniforms {
26
+ faceIndex: i32,
27
+ isHdr: i32,
28
+ };
29
+ @group(0) @binding(2) var<uniform> uniforms: Uniforms;
30
+
31
+ fn getDirection(face: i32, uv: vec2f) -> vec3f {
32
+ var st = uv * 2.0 - 1.0;
33
+ if (face == 0) { return vec3f( 1.0, -st.y, -st.x); } // +X
34
+ if (face == 1) { return vec3f(-1.0, -st.y, st.x); } // -X
35
+ if (face == 2) { return vec3f( st.x, 1.0, st.y); } // +Y
36
+ if (face == 3) { return vec3f( st.x, -1.0, -st.y); } // -Y
37
+ if (face == 4) { return vec3f( st.x, -st.y, 1.0); } // +Z
38
+ return vec3f(-st.x, -st.y, -1.0); // -Z
39
+ }
40
+
41
+ @fragment
42
+ fn fragmentMain(input: VertexOutput) -> @location(0) vec4f {
43
+ // Flip Y coordinate to match WebGPU's top-left origin coordinate system
44
+ var flippedTexCoord = vec2f(input.texCoord.x, 1.0 - input.texCoord.y);
45
+ var dir = normalize(getDirection(uniforms.faceIndex, flippedTexCoord));
46
+ var color = textureSample(cubemapTexture, cubemapSampler, dir).rgb;
47
+
48
+ // Only apply tone mapping and gamma correction for HDR textures
49
+ // LDR textures (e.g., rgba8unorm) should pass through unchanged
50
+ if (uniforms.isHdr != 0) {
51
+ // Reinhard tone mapping
52
+ color = color / (1.0 + color);
53
+
54
+ // Gamma correction
55
+ color = pow(color, vec3f(1.0 / 2.2));
56
+ }
57
+
58
+ return vec4f(color, 1.0);
59
+ }
60
+ `;export{e as cubeTextureReadWgsl};
@@ -0,0 +1,72 @@
1
+ import { type HdriFormatEnum } from '../foundation/definitions/HdriFormat';
2
+ import type { DirectTextureData } from '../foundation/renderer/CGAPIResourceRepository';
3
+ import type { Engine } from '../foundation/system/Engine';
4
+ import { Sampler } from '../foundation/textures/Sampler';
5
+ import type { Count, Size, WebGPUResourceHandle } from '../types/CommonTypes';
6
+ import type { WebGpuDeviceWrapper } from './WebGpuDeviceWrapper';
7
+ import type { WebGpuResource } from './WebGpuResourceRepository';
8
+ /**
9
+ * What `WebGpuCubeTextures` needs from the resource repository that owns it.
10
+ */
11
+ export interface WebGpuCubeTextureResources {
12
+ /** The device wrapper, which is set when the repository is given a device. */
13
+ getDeviceWrapper(): WebGpuDeviceWrapper | undefined;
14
+ /** Registers a WebGPU object and returns its resource handle. */
15
+ registerResource(obj: WebGpuResource): WebGPUResourceHandle;
16
+ /** Returns the WebGPU object of a resource handle. */
17
+ getResource(handle: WebGPUResourceHandle): WebGpuResource | undefined;
18
+ }
19
+ /**
20
+ * Creates the cube textures of the WebGPU backend (from decoded images and image files) and reads their faces back.
21
+ *
22
+ * Owned by `WebGpuResourceRepository`, which exposes these operations through its public methods.
23
+ */
24
+ export declare class WebGpuCubeTextures {
25
+ private __resources;
26
+ constructor(resources: WebGpuCubeTextureResources);
27
+ private get __webGpuDeviceWrapper();
28
+ private __registerResource;
29
+ private __getResource;
30
+ /**
31
+ * create a CubeTexture
32
+ *
33
+ * @param mipLevelCount
34
+ * @param images
35
+ * @param width
36
+ * @param height
37
+ * @returns resource handle
38
+ */
39
+ createCubeTexture(engine: Engine, mipLevelCount: Count, images: Array<{
40
+ posX: DirectTextureData;
41
+ negX: DirectTextureData;
42
+ posY: DirectTextureData;
43
+ negY: DirectTextureData;
44
+ posZ: DirectTextureData;
45
+ negZ: DirectTextureData;
46
+ }>, width: Size, height: Size): [number, Sampler];
47
+ /**
48
+ * Create Cube Texture from image files.
49
+ * @param baseUri the base uri to load images;
50
+ * @param mipLevelCount the number of mip levels (include root level). if no mipmap, the value should be 1;
51
+ * @returns the WebGLResourceHandle for the generated Cube Texture
52
+ */
53
+ createCubeTextureFromFiles(engine: Engine, baseUri: string, mipLevelCount: Count, isNamePosNeg: boolean, hdriFormat: HdriFormatEnum): Promise<[number, Sampler, number, number]>;
54
+ /**
55
+ * Loads RGB9_E5 PNG cubemap faces and uploads them as a native rgb9e5ufloat cube texture.
56
+ * rgb9e5ufloat is 4 bytes per texel and filterable; the hardware converts the shared-exponent
57
+ * values before filtering, so smooth prefiltered reflections do not band.
58
+ */
59
+ private __createCubeTextureRgb9E5FromFiles;
60
+ /**
61
+ * Reads pixel data from a specific face of a cube texture.
62
+ * Uses a shader-based approach to sample the cubemap and render to a 2D texture,
63
+ * then copies the result to a buffer for CPU access.
64
+ *
65
+ * @param textureHandle - Handle to the cube texture
66
+ * @param width - Width of the face texture
67
+ * @param height - Height of the face texture
68
+ * @param faceIndex - Index of the cube face (0=+X, 1=-X, 2=+Y, 3=-Y, 4=+Z, 5=-Z)
69
+ * @returns Promise resolving to the pixel data as a Uint8Array (RGBA format)
70
+ */
71
+ getCubeTexturePixelData(textureHandle: WebGPUResourceHandle, width: number, height: number, faceIndex: number): Promise<Uint8Array>;
72
+ }
@@ -0,0 +1 @@
1
+ import F from"../_deps/vendor__hdrpng.js";import{HdriFormat as w}from"../foundation/definitions/HdriFormat.js";import{TextureParameter as b}from"../foundation/definitions/TextureParameter.js";import{Logger as L}from"../foundation/misc/Logger.js";import{convertHdrpngRgb9E5ToNative as v,decodePngToRgba8 as X}from"../foundation/misc/PngDecoder.js";import{Sampler as W}from"../foundation/textures/Sampler.js";import{packRgbaRowsForUpload as Y}from"./packRgbaRowsForUpload.js";import{cubeTextureReadWgsl as C}from"./WebGpuCubeTextureShaders.js";import{drawRgba8AndReadBack as Z}from"./WebGpuTextureReadback.js";var I=class{constructor(p){this.x_=p}get yG(){return this.x_.getDeviceWrapper()}T_(p){return this.x_.registerResource(p)}KG(p){return this.x_.getResource(p)}createCubeTexture(p,i,a,x,g){var f;let c=[];for(let t=0;t<i;t++){let u=[];(a[t].posX instanceof ImageBitmap||a[0].posX instanceof HTMLCanvasElement)&&(u.push(a[t].posX),u.push(a[t].negX),u.push(a[t].posY),u.push(a[t].negY),u.push(a[t].posZ),u.push(a[t].negZ)),c.push(u)}let n=this.yG.gpuDevice,y=((f=c[0][0])==null?void 0:f.hdriFormat)===w.HDR_LINEAR?n.features.has("float32-filterable")?"rgba32float":"rgba16float":"rgba8unorm",T=n.createTexture({dimension:"2d",size:[x,g,6],format:y,mipLevelCount:i,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});for(let t=0;t<i;t++)for(let u=0;u<c[t].length;u++){let r=c[t][u];if(r.hdriFormat===w.HDR_LINEAR){let R=new Float32Array(r.width*r.height*4),B=r.dataFloat,A=r.width*r.height;for(let h=0;h<A;h++)R[h*4]=B[h*3],R[h*4+1]=B[h*3+1],R[h*4+2]=B[h*3+2],R[h*4+3]=1;let U=y==="rgba16float",G=Y(R,r.width,r.height,U),E=n.createBuffer({size:G.data.byteLength,usage:GPUBufferUsage.COPY_SRC,mappedAtCreation:!0});U?new Uint16Array(E.getMappedRange()).set(G.data):new Float32Array(E.getMappedRange()).set(G.data),E.unmap();let P=n.createCommandEncoder();P.copyBufferToTexture({buffer:E,bytesPerRow:G.bytesPerRow,rowsPerImage:r.height},{texture:T,origin:[0,0,u],mipLevel:t},[r.width,r.height,1]);let H=P.finish();n.queue.submit([H])}else n.queue.copyExternalImageToTexture({source:r},{texture:T,origin:[0,0,u],mipLevel:t},[r.width,r.height,1])}let o=this.T_(T),_=b.Repeat,s=b.Repeat,d=i===1?b.Linear:b.LinearMipmapLinear,m=b.Linear,e=new W(p,{wrapS:_,wrapT:s,minFilter:d,magFilter:m,anisotropy:!1});return e.create(),[o,e]}async createCubeTextureFromFiles(p,i,a,x,g){if(g===w.RGB9_E5_PNG)return this.rD(p,i,a,x);let c=[],n=0,l=0;for(let o=0;o<a;o++){let _=()=>new Promise((e,f)=>{let t=0,u=[],r=".jpg";g===w.HDR_LINEAR?r=".hdr":g===w.RGBE_PNG&&(r=".RGBE.PNG");let R="_right_",B="_left_",A="_top_",U="_bottom_",G="_front_",E="_back_";x&&(R="_posx_",B="_negx_",A="_posy_",U="_negy_",G="_posz_",E="_negz_");let P=[[i+R+o+r,"posX"],[i+B+o+r,"negX"],[i+A+o+r,"posY"],[i+U+o+r,"negY"],[i+G+o+r,"posZ"],[i+E+o+r,"negZ"]];for(let H=0;H<P.length;H++){let h=P[H][1],D;g===w.HDR_LINEAR||g===w.RGB9_E5_PNG?D=new F:D=new Image,D.hdriFormat=g,D.side=h,D.uri=P[H][0],D.crossOrigin="Anonymous",D.onload=()=>{t++,u.push(D),t===6&&e(u)},D.onerror=()=>{f(D.uri)},D.src=P[H][0]}}),s;try{s=await _()}catch{try{s=await _()}catch(f){L.default.error(`failed to load ${f}`)}}let d=[];for(let e of s)if(e.hdriFormat===w.HDR_LINEAR)d.push(e);else{await e.decode();let f=await createImageBitmap(e);d.push(f),f.side=e.side}let m={};for(let e of d){switch(e.side){case"posX":m.posX=e;break;case"posY":m.posY=e;break;case"posZ":m.posZ=e;break;case"negX":m.negX=e;break;case"negY":m.negY=e;break;case"negZ":m.negZ=e;break}o===0&&(n=e.width,l=e.height)}c.push(m)}let[y,T]=this.createCubeTexture(p,a,c,n,l);return[y,T,n,l]}async rD(p,i,a,x){let g=x?["posx","negx","posy","negy","posz","negz"]:["right","left","top","bottom","front","back"],c=[],n=0,l=0;for(let s=0;s<a;s++){let d=[];for(let m of g){let e=`${i}_${m}_${s}.RGB9_E5.PNG`,f=await fetch(e);if(!f.ok)throw new Error(`Failed to load ${e}: ${f.status}`);let t=await X(new Uint8Array(await f.arrayBuffer()));s===0&&(n=t.width,l=t.height),d.push(v(t.data,t.width*t.height))}c.push(d)}let y=this.yG.gpuDevice,T=y.createTexture({dimension:"2d",size:[n,l,6],format:"rgb9e5ufloat",mipLevelCount:a,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST});for(let s=0;s<a;s++){let d=Math.max(1,n>>s),m=Math.max(1,l>>s);for(let e=0;e<6;e++)y.queue.writeTexture({texture:T,mipLevel:s,origin:[0,0,e]},c[s][e],{bytesPerRow:d*4,rowsPerImage:m},{width:d,height:m,depthOrArrayLayers:1})}let o=this.T_(T),_=new W(p,{wrapS:b.Repeat,wrapT:b.Repeat,minFilter:a===1?b.Linear:b.LinearMipmapLinear,magFilter:b.Linear,anisotropy:!1});return _.create(),[o,_,n,l]}async getCubeTexturePixelData(p,i,a,x){let g=this.KG(p),c=this.yG.gpuDevice,n=g.format,l=n.includes("float")||n==="rgb10a2unorm",y=C,T=c.createSampler({magFilter:"linear",minFilter:"linear"}),o=c.createBuffer({size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(o,0,new Int32Array([x,l?1:0]));try{return await Z(c,y,i,a,[{binding:0,resource:g.createView({dimension:"cube"})},{binding:1,resource:T},{binding:2,resource:{buffer:o}}])}finally{o.destroy()}}};export{I as WebGpuCubeTextures};