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.
- package/README.md +10 -10
- package/VERSION-FILE +1 -1
- package/dist/esm/effekseer/EffekseerComponent.js +3 -3
- package/dist/esm/foundation/components/Camera/CameraComponent.js +1 -1
- package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +5 -5
- package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.js +1 -1
- package/dist/esm/foundation/core/GlobalDataRepository.d.ts +3 -3
- package/dist/esm/foundation/core/GlobalDataRepository.js +1 -1
- package/dist/esm/foundation/definitions/RenderBackend.d.ts +21 -0
- package/dist/esm/foundation/definitions/RenderBackend.js +1 -0
- package/dist/esm/foundation/definitions/index.d.ts +1 -1
- package/dist/esm/foundation/definitions/index.js +1 -1
- package/dist/esm/foundation/geometry/Mesh.d.ts +18 -68
- package/dist/esm/foundation/geometry/Mesh.js +1 -1
- package/dist/esm/foundation/geometry/Primitive.d.ts +1 -1
- package/dist/esm/foundation/geometry/Primitive.js +1 -1
- package/dist/esm/foundation/gizmos/RotationGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/ScaleGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/SphereColliderGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/TranslationGizmo.js +1 -1
- package/dist/esm/foundation/helpers/BloomHelper.js +1 -1
- package/dist/esm/foundation/helpers/GaussianBlurHelper.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/PointShadowMap.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowCasterFilter.d.ts +8 -0
- package/dist/esm/foundation/helpers/Shadow/ShadowCasterFilter.js +1 -0
- package/dist/esm/foundation/helpers/Shadow/ShadowDirectionalAutoFit.d.ts +28 -0
- package/dist/esm/foundation/helpers/Shadow/ShadowDirectionalAutoFit.js +1 -0
- package/dist/esm/foundation/helpers/Shadow/ShadowMap.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowSpotLightZNear.d.ts +8 -0
- package/dist/esm/foundation/helpers/Shadow/ShadowSpotLightZNear.js +1 -0
- package/dist/esm/foundation/helpers/Shadow/ShadowSystem.d.ts +1 -29
- package/dist/esm/foundation/helpers/Shadow/ShadowSystem.js +1 -1
- package/dist/esm/foundation/helpers/materials/nodeBasedMaterialCommon.js +1 -1
- package/dist/esm/foundation/materials/contents/ColorGradingUsingLUTsMaterialContent.d.ts +0 -20
- package/dist/esm/foundation/materials/contents/ColorGradingUsingLUTsMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/CustomMaterialContent.d.ts +3 -1
- package/dist/esm/foundation/materials/contents/CustomMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/DetectHighLuminanceMaterialContent.d.ts +0 -16
- package/dist/esm/foundation/materials/contents/DetectHighLuminanceMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/EntityUIDOutputMaterialContent.d.ts +0 -17
- package/dist/esm/foundation/materials/contents/EntityUIDOutputMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/FurnaceTestMaterialContent.d.ts +0 -21
- package/dist/esm/foundation/materials/contents/FurnaceTestMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/MToon0xMaterialContent.js +4 -4
- package/dist/esm/foundation/materials/contents/MToon1MaterialContent.js +3 -3
- package/dist/esm/foundation/materials/contents/MatCapMaterialContent.d.ts +0 -16
- package/dist/esm/foundation/materials/contents/MatCapMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/SynthesizeHdrMaterialContent.d.ts +0 -23
- package/dist/esm/foundation/materials/contents/SynthesizeHdrMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.d.ts +6 -61
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/core/AbstractShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/core/AbstractShaderNode.js +2 -2
- package/dist/esm/foundation/materials/core/Material.d.ts +7 -114
- package/dist/esm/foundation/materials/core/Material.js +1 -1
- package/dist/esm/foundation/materials/core/MaterialRepository.js +1 -1
- package/dist/esm/foundation/materials/core/ShaderGraphResolver.js +6 -6
- package/dist/esm/foundation/materials/core/ShaderNodeFactories.d.ts +23 -0
- package/dist/esm/foundation/materials/core/ShaderNodeFactories.js +1 -0
- package/dist/esm/foundation/materials/core/ShaderProgramDefinitions.d.ts +41 -0
- package/dist/esm/foundation/materials/core/ShaderProgramDefinitions.js +23 -0
- package/dist/esm/foundation/materials/nodes/AbsShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/AcosShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/AddShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/Atan2ShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/BranchShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/CastToFloatShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/CastToFloatShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/ClampShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/ClampShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/CosShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/CosShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/DotProductShaderNode.d.ts +2 -2
- package/dist/esm/foundation/materials/nodes/DotProductShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/EqualShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/EqualShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/GreaterOrEqualShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/GreaterOrEqualShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/GreaterThanShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/GreaterThanShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/LengthShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/LengthShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/LessOrEqualShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/LessOrEqualShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/LessThanShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/LessThanShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/MergeVectorShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/MinShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/MultiplyShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/MultiplyShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/NormalizeShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/NormalizeShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/NotEqualShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/NotEqualShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/PremultipliedAlphaShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/PremultipliedAlphaShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/Random_HashPRNGShaderNode.js +2 -2
- package/dist/esm/foundation/materials/nodes/Random_SinHashShaderNode.js +2 -2
- package/dist/esm/foundation/materials/nodes/RemapShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/RemapShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/SinShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/SinShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/SmoothStepShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/SmoothStepShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/SplitVectorShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/SplitVectorShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/StepShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/TanShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/TanShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/TransformShaderNode.d.ts +1 -1
- package/dist/esm/foundation/materials/nodes/TransformShaderNode.js +1 -1
- package/dist/esm/foundation/math/MathClassUtil.js +1 -1
- package/dist/esm/foundation/math/MathUtil.d.ts +11 -0
- package/dist/esm/foundation/math/MathUtil.js +1 -1
- package/dist/esm/foundation/math/Transform3D.js +1 -1
- package/dist/esm/foundation/memory/Accessor.js +1 -1
- package/dist/esm/foundation/memory/Buffer.js +3 -3
- package/dist/esm/foundation/renderer/CGAPIResourceRepository.d.ts +74 -4
- package/dist/esm/foundation/renderer/CGAPIResourceRepository.js +1 -1
- package/dist/esm/foundation/renderer/FrameBuffer.js +1 -1
- package/dist/esm/foundation/renderer/FrameRenderer.d.ts +42 -0
- package/dist/esm/foundation/renderer/FrameRenderer.js +0 -0
- package/dist/esm/foundation/renderer/RenderPass.js +1 -1
- package/dist/esm/foundation/renderer/ShaderPropertyLayout.d.ts +77 -0
- package/dist/esm/foundation/renderer/ShaderPropertyLayout.js +1 -0
- package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +9 -3
- package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.js +1 -1
- package/dist/esm/foundation/renderer/lightCluster/LightClusterSystem.js +1 -1
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +4 -171
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.js +1 -1
- package/dist/esm/foundation/renderer/pipelines/RaymarchingRenderer.d.ts +263 -0
- package/dist/esm/foundation/renderer/pipelines/RaymarchingRenderer.js +1 -0
- package/dist/esm/foundation/system/Engine.d.ts +17 -28
- package/dist/esm/foundation/system/Engine.js +1 -1
- package/dist/esm/foundation/system/EngineState.d.ts +3 -3
- package/dist/esm/foundation/system/EngineState.js +1 -1
- package/dist/esm/foundation/textures/AbstractReadableRenderTargetTexture.d.ts +39 -0
- package/dist/esm/foundation/textures/AbstractReadableRenderTargetTexture.js +1 -0
- package/dist/esm/foundation/textures/AbstractRenderTargetTexture.d.ts +60 -0
- package/dist/esm/foundation/textures/AbstractRenderTargetTexture.js +1 -0
- package/dist/esm/foundation/textures/AbstractTexture.js +1 -1
- package/dist/esm/foundation/textures/CubeTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderBuffer.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture.d.ts +5 -67
- package/dist/esm/foundation/textures/RenderTargetTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture2DArray.d.ts +5 -71
- package/dist/esm/foundation/textures/RenderTargetTexture2DArray.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTextureCube.d.ts +8 -50
- package/dist/esm/foundation/textures/RenderTargetTextureCube.js +1 -1
- package/dist/esm/foundation/textures/Texture.d.ts +19 -1
- package/dist/esm/foundation/textures/Texture.js +1 -1
- package/dist/esm/foundation/textures/TextureArray.js +1 -1
- package/dist/esm/foundation/textures/TextureDataFloat.js +1 -1
- package/dist/esm/foundation/textures/VideoTexture.d.ts +11 -0
- package/dist/esm/foundation/textures/VideoTexture.js +1 -1
- package/dist/esm/foundation/textures/decodeBasisImage.d.ts +14 -0
- package/dist/esm/foundation/textures/decodeBasisImage.js +1 -0
- package/dist/esm/foundation/textures/index.d.ts +2 -0
- package/dist/esm/foundation/textures/index.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/webgl/ComponentDataAccessorGLSL.d.ts +9 -0
- package/dist/esm/webgl/ComponentDataAccessorGLSL.js +27 -0
- package/dist/esm/webgl/MultiDraw.d.ts +1 -1
- package/dist/esm/webgl/MultiDraw.js +1 -1
- package/dist/esm/webgl/MultiDrawRepository.js +1 -1
- package/dist/esm/webgl/ShaderPropertyAccessorGLSL.d.ts +11 -0
- package/dist/esm/webgl/ShaderPropertyAccessorGLSL.js +29 -0
- package/dist/esm/webgl/WebGLCompressedTextures.d.ts +48 -0
- package/dist/esm/webgl/WebGLCompressedTextures.js +1 -0
- package/dist/esm/webgl/WebGLContextWrapper.d.ts +9 -52
- package/dist/esm/webgl/WebGLContextWrapper.js +1 -1
- package/dist/esm/webgl/WebGLCubeTextureFileLoader.d.ts +38 -0
- package/dist/esm/webgl/WebGLCubeTextureFileLoader.js +1 -0
- package/dist/esm/webgl/WebGLCubeTextures.d.ts +92 -0
- package/dist/esm/webgl/WebGLCubeTextures.js +42 -0
- package/dist/esm/webgl/WebGLDataTexture.d.ts +108 -0
- package/dist/esm/webgl/WebGLDataTexture.js +1 -0
- package/dist/esm/webgl/WebGLDrawState.d.ts +84 -0
- package/dist/esm/webgl/WebGLDrawState.js +1 -0
- package/dist/esm/webgl/WebGLExternalState.d.ts +43 -0
- package/dist/esm/webgl/WebGLExternalState.js +1 -0
- package/dist/esm/webgl/WebGLFrameRenderer.d.ts +32 -0
- package/dist/esm/webgl/WebGLFrameRenderer.js +1 -0
- package/dist/esm/webgl/WebGLFramebuffers.d.ts +142 -0
- package/dist/esm/webgl/WebGLFramebuffers.js +1 -0
- package/dist/esm/webgl/WebGLGpuTimer.js +1 -1
- package/dist/esm/webgl/WebGLMaterialParameters.d.ts +47 -0
- package/dist/esm/webgl/WebGLMaterialParameters.js +1 -0
- package/dist/esm/webgl/WebGLMeshResources.d.ts +115 -0
- package/dist/esm/webgl/WebGLMeshResources.js +1 -0
- package/dist/esm/webgl/WebGLMorphUniformBuffers.d.ts +66 -0
- package/dist/esm/webgl/WebGLMorphUniformBuffers.js +57 -0
- package/dist/esm/webgl/WebGLResourceRepository.d.ts +100 -178
- package/dist/esm/webgl/WebGLResourceRepository.js +1 -55
- package/dist/esm/webgl/WebGLSamplers.d.ts +78 -0
- package/dist/esm/webgl/WebGLSamplers.js +1 -0
- package/dist/esm/webgl/WebGLShaderProgramBuilder.d.ts +40 -0
- package/dist/esm/webgl/WebGLShaderProgramBuilder.js +15 -0
- package/dist/esm/webgl/WebGLShaderPrograms.d.ts +88 -0
- package/dist/esm/webgl/WebGLShaderPrograms.js +14 -0
- package/dist/esm/webgl/WebGLStereoUtil.d.ts +0 -27
- package/dist/esm/webgl/WebGLStereoUtil.js +3 -3
- package/dist/esm/webgl/WebGLStrategyDataUploader.d.ts +152 -0
- package/dist/esm/webgl/WebGLStrategyDataUploader.js +1 -0
- package/dist/esm/webgl/WebGLStrategyMeshBatchRenderer.d.ts +40 -0
- package/dist/esm/webgl/WebGLStrategyMeshBatchRenderer.js +1 -0
- package/dist/esm/webgl/WebGLStrategyMeshDrawer.d.ts +92 -0
- package/dist/esm/webgl/WebGLStrategyMeshDrawer.js +1 -0
- package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +7 -360
- package/dist/esm/webgl/WebGLStrategyWebGL2.js +1 -146
- package/dist/esm/webgl/WebGLTextureUnitState.d.ts +79 -0
- package/dist/esm/webgl/WebGLTextureUnitState.js +1 -0
- package/dist/esm/webgl/WebGLTextureUploads.d.ts +106 -0
- package/dist/esm/webgl/WebGLTextureUploads.js +1 -0
- package/dist/esm/webgl/WebGLTextures.d.ts +316 -0
- package/dist/esm/webgl/WebGLTextures.js +1 -0
- package/dist/esm/webgl/WebGLUniformBuffers.d.ts +35 -0
- package/dist/esm/webgl/WebGLUniformBuffers.js +1 -0
- package/dist/esm/webgl/WebGLUniforms.d.ts +117 -0
- package/dist/esm/webgl/WebGLUniforms.js +1 -0
- package/dist/esm/webgl/WebGLVertexBuffers.d.ts +172 -0
- package/dist/esm/webgl/WebGLVertexBuffers.js +1 -0
- package/dist/esm/webgl/debug/BufferLayoutDecoder.d.ts +4 -4
- package/dist/esm/webgl/debug/BufferLayoutDecoder.js +1 -1
- package/dist/esm/webgl/debug/ShaderParameterDebugger.js +1 -1
- package/dist/esm/webgl/debug/types.d.ts +2 -2
- package/dist/esm/webgl/getRenderingStrategy.d.ts +2 -2
- package/dist/esm/webgl/getRenderingStrategy.js +1 -1
- package/dist/esm/webgl/main.d.ts +4 -17
- package/dist/esm/webgl/main.js +1 -1
- package/dist/esm/webgl/readColorAttachmentAsRgba8.d.ts +36 -0
- package/dist/esm/webgl/readColorAttachmentAsRgba8.js +1 -0
- package/dist/esm/webgl/shaders/RaymarchingShaderPart.d.ts +2 -2
- package/dist/esm/webgl/shaders/RaymarchingShaderPart.js +9 -9
- package/dist/esm/webgl/shaders/RaymarchingShadowShaderPart.js +9 -9
- package/dist/esm/webgl/shaders/StandardShaderPart.d.ts +3 -3
- package/dist/esm/webgl/shaders/StandardShaderPart.js +16 -16
- package/dist/esm/webgl/shaders/glslCommonChunks.d.ts +2 -2
- package/dist/esm/webgl/shaders/nodes/BlockBeginShader.js +1 -1
- package/dist/esm/webgl/shaders/nodes/BlockEndShader.js +1 -1
- package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.d.ts +2 -2
- package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.js +7 -7
- package/dist/esm/webgl/shaders/nodes/DiscardShader.d.ts +1 -1
- package/dist/esm/webgl/shaders/nodes/DiscardShader.js +3 -3
- package/dist/esm/webgl/shaders/nodes/EndShader.d.ts +2 -2
- package/dist/esm/webgl/shaders/nodes/EndShader.js +3 -3
- package/dist/esm/webgl/shaders/nodes/OutDistance.d.ts +1 -1
- package/dist/esm/webgl/shaders/nodes/OutDistance.js +1 -1
- package/dist/esm/webgl/shaders/nodes/OutUnion.js +1 -1
- package/dist/esm/webgl/shaders/nodes/RaymarchObjectIdUniform.js +3 -3
- package/dist/esm/webgl/shaders/nodes/SdApplyTransform.js +1 -1
- package/dist/esm/webgl/shaders/nodes/SdApplyWorldMatrix.d.ts +1 -1
- package/dist/esm/webgl/shaders/nodes/SdApplyWorldMatrix.js +3 -3
- package/dist/esm/webgl/shaders/nodes/Texture2DShader.js +18 -18
- package/dist/esm/webgl/shaders/nodes/UniformDataShader.js +14 -14
- package/dist/esm/webgl/textureLoader/KTX2TextureLoader.d.ts +1 -1
- package/dist/esm/webgl/textureLoader/KTX2TextureLoader.js +1 -1
- package/dist/esm/webgpu/AttributeReader.d.ts +18 -0
- package/dist/esm/webgpu/AttributeReader.js +1 -0
- package/dist/esm/webgpu/GpuCullingRegistry.js +1 -1
- package/dist/esm/webgpu/GpuDeformRegistry.js +1 -1
- package/dist/esm/webgpu/RangeAllocator.js +1 -1
- package/dist/esm/webgpu/ShaderPropertyAccessorWGSL.d.ts +11 -0
- package/dist/esm/webgpu/ShaderPropertyAccessorWGSL.js +24 -0
- package/dist/esm/webgpu/WebGpuBindGroups.d.ts +131 -0
- package/dist/esm/webgpu/WebGpuBindGroups.js +1 -0
- package/dist/esm/webgpu/WebGpuBufferArena.js +1 -1
- package/dist/esm/webgpu/WebGpuCompressedTextures.d.ts +38 -0
- package/dist/esm/webgpu/WebGpuCompressedTextures.js +1 -0
- package/dist/esm/webgpu/WebGpuCubeTextureShaders.d.ts +1 -0
- package/dist/esm/webgpu/WebGpuCubeTextureShaders.js +60 -0
- package/dist/esm/webgpu/WebGpuCubeTextures.d.ts +72 -0
- package/dist/esm/webgpu/WebGpuCubeTextures.js +1 -0
- package/dist/esm/webgpu/WebGpuDraw.d.ts +63 -0
- package/dist/esm/webgpu/WebGpuDraw.js +1 -0
- package/dist/esm/webgpu/WebGpuDrawParameters.d.ts +61 -0
- package/dist/esm/webgpu/WebGpuDrawParameters.js +1 -0
- package/dist/esm/webgpu/WebGpuExternalRenderPass.d.ts +44 -0
- package/dist/esm/webgpu/WebGpuExternalRenderPass.js +1 -0
- package/dist/esm/webgpu/WebGpuFrame.d.ts +55 -0
- package/dist/esm/webgpu/WebGpuFrame.js +1 -0
- package/dist/esm/webgpu/WebGpuFrameRenderer.d.ts +25 -0
- package/dist/esm/webgpu/WebGpuFrameRenderer.js +1 -0
- package/dist/esm/webgpu/WebGpuGpuCulling.js +1 -236
- package/dist/esm/webgpu/WebGpuGpuCullingShaders.d.ts +34 -0
- package/dist/esm/webgpu/WebGpuGpuCullingShaders.js +236 -0
- package/dist/esm/webgpu/WebGpuGpuTimer.js +1 -1
- package/dist/esm/webgpu/WebGpuLightClusterBuilder.js +1 -153
- package/dist/esm/webgpu/WebGpuLightClusterShaders.d.ts +14 -0
- package/dist/esm/webgpu/WebGpuLightClusterShaders.js +153 -0
- package/dist/esm/webgpu/WebGpuMipmapGenerator.d.ts +54 -0
- package/dist/esm/webgpu/WebGpuMipmapGenerator.js +1 -0
- package/dist/esm/webgpu/WebGpuMipmapShaders.d.ts +1 -0
- package/dist/esm/webgpu/WebGpuMipmapShaders.js +26 -0
- package/dist/esm/webgpu/WebGpuRenderBundles.d.ts +117 -0
- package/dist/esm/webgpu/WebGpuRenderBundles.js +1 -0
- package/dist/esm/webgpu/WebGpuRenderPassEncoders.d.ts +140 -0
- package/dist/esm/webgpu/WebGpuRenderPassEncoders.js +1 -0
- package/dist/esm/webgpu/WebGpuRenderPipelines.d.ts +75 -0
- package/dist/esm/webgpu/WebGpuRenderPipelines.js +3 -0
- package/dist/esm/webgpu/WebGpuRenderTargetTextures.d.ts +78 -0
- package/dist/esm/webgpu/WebGpuRenderTargetTextures.js +1 -0
- package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +52 -322
- package/dist/esm/webgpu/WebGpuResourceRepository.js +1 -116
- package/dist/esm/webgpu/WebGpuSamplers.d.ts +45 -0
- package/dist/esm/webgpu/WebGpuSamplers.js +1 -0
- package/dist/esm/webgpu/WebGpuShaderProgramBuilder.d.ts +25 -0
- package/dist/esm/webgpu/WebGpuShaderProgramBuilder.js +9 -0
- package/dist/esm/webgpu/WebGpuStorageBuffers.d.ts +77 -0
- package/dist/esm/webgpu/WebGpuStorageBuffers.js +1 -0
- package/dist/esm/webgpu/WebGpuStrategyBasic.d.ts +1 -73
- package/dist/esm/webgpu/WebGpuStrategyBasic.js +1 -139
- package/dist/esm/webgpu/WebGpuStrategyStorage.d.ts +62 -0
- package/dist/esm/webgpu/WebGpuStrategyStorage.js +1 -0
- package/dist/esm/webgpu/WebGpuTextureReadback.d.ts +111 -0
- package/dist/esm/webgpu/WebGpuTextureReadback.js +1 -0
- package/dist/esm/webgpu/WebGpuTextureReadbackShaders.d.ts +4 -0
- package/dist/esm/webgpu/WebGpuTextureReadbackShaders.js +26 -0
- package/dist/esm/webgpu/WebGpuTextureUploads.d.ts +109 -0
- package/dist/esm/webgpu/WebGpuTextureUploads.js +1 -0
- package/dist/esm/webgpu/WebGpuTextures.d.ts +196 -0
- package/dist/esm/webgpu/WebGpuTextures.js +1 -0
- package/dist/esm/webgpu/WebGpuVertexBuffers.d.ts +142 -0
- package/dist/esm/webgpu/WebGpuVertexBuffers.js +1 -0
- package/dist/esm/webgpu/WebGpuVertexDeformer.js +1 -124
- package/dist/esm/webgpu/WebGpuVertexDeformerShaders.d.ts +7 -0
- package/dist/esm/webgpu/WebGpuVertexDeformerShaders.js +124 -0
- package/dist/esm/webgpu/WebGpuVertexShaderDefinitions.d.ts +16 -0
- package/dist/esm/webgpu/WebGpuVertexShaderDefinitions.js +84 -0
- package/dist/esm/webgpu/assertArrayBufferView.d.ts +9 -0
- package/dist/esm/webgpu/assertArrayBufferView.js +1 -0
- package/dist/esm/webgpu/main.d.ts +2 -16
- package/dist/esm/webgpu/main.js +1 -1
- package/dist/esm/webgpu/padCompressedRowsForUpload.d.ts +20 -0
- package/dist/esm/webgpu/padCompressedRowsForUpload.js +1 -0
- package/dist/esm/webgpu/removeRowPadding.d.ts +21 -0
- package/dist/esm/webgpu/removeRowPadding.js +1 -0
- package/dist/esm/webgpu/shaderity_shaders/common/processGeometry.wgsl.js +1 -1
- package/dist/esm/webgpu/wgslCommonChunks.d.ts +2 -2
- package/dist/esm/xr/WebARSystem.js +1 -1
- package/dist/esm/xr/WebXRSystem.d.ts +0 -4
- package/dist/esm/xr/WebXRSystem.js +1 -1
- package/dist/esmdev/effekseer/EffekseerComponent.js +3 -3
- package/dist/esmdev/foundation/components/Camera/CameraComponent.js +4 -4
- package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +5 -5
- package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.js +11 -11
- package/dist/esmdev/foundation/core/GlobalDataRepository.d.ts +3 -3
- package/dist/esmdev/foundation/core/GlobalDataRepository.js +3 -3
- package/dist/esmdev/foundation/definitions/RenderBackend.d.ts +21 -0
- package/dist/esmdev/foundation/definitions/RenderBackend.js +60 -0
- package/dist/esmdev/foundation/definitions/index.d.ts +1 -1
- package/dist/esmdev/foundation/definitions/index.js +2 -2
- package/dist/esmdev/foundation/geometry/Mesh.d.ts +18 -68
- package/dist/esmdev/foundation/geometry/Mesh.js +159 -383
- package/dist/esmdev/foundation/geometry/Primitive.d.ts +1 -1
- package/dist/esmdev/foundation/geometry/Primitive.js +123 -123
- package/dist/esmdev/foundation/geometry/SimpleVertexAttribute.js +5 -5
- package/dist/esmdev/foundation/geometry/shapes/Cylinder.js +3 -3
- package/dist/esmdev/foundation/geometry/shapes/Joint.js +33 -33
- package/dist/esmdev/foundation/gizmos/AABBGizmo.js +12 -12
- package/dist/esmdev/foundation/gizmos/CapsuleColliderGizmo.js +23 -23
- package/dist/esmdev/foundation/gizmos/Gizmo.js +23 -23
- package/dist/esmdev/foundation/gizmos/JointGizmo.js +37 -37
- package/dist/esmdev/foundation/gizmos/LightGizmo.js +69 -69
- package/dist/esmdev/foundation/gizmos/LocatorGizmo.js +22 -22
- package/dist/esmdev/foundation/gizmos/RotationGizmo.js +212 -212
- package/dist/esmdev/foundation/gizmos/ScaleGizmo.js +130 -130
- package/dist/esmdev/foundation/gizmos/ShapeGizmo.js +43 -43
- package/dist/esmdev/foundation/gizmos/SphereColliderGizmo.js +24 -24
- package/dist/esmdev/foundation/gizmos/TranslationGizmo.js +129 -129
- package/dist/esmdev/foundation/helpers/BloomHelper.js +34 -34
- package/dist/esmdev/foundation/helpers/GaussianBlurHelper.js +18 -18
- package/dist/esmdev/foundation/helpers/Shadow/PointShadowMap.js +12 -12
- package/dist/esmdev/foundation/helpers/Shadow/ShadowCasterFilter.d.ts +8 -0
- package/dist/esmdev/foundation/helpers/Shadow/ShadowCasterFilter.js +17 -0
- package/dist/esmdev/foundation/helpers/Shadow/ShadowDirectionalAutoFit.d.ts +28 -0
- package/dist/esmdev/foundation/helpers/Shadow/ShadowDirectionalAutoFit.js +126 -0
- package/dist/esmdev/foundation/helpers/Shadow/ShadowMap.js +3 -3
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSpotLightZNear.d.ts +8 -0
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSpotLightZNear.js +87 -0
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.d.ts +1 -29
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.js +76 -285
- package/dist/esmdev/foundation/helpers/materials/nodeBasedMaterialCommon.js +3 -3
- package/dist/esmdev/foundation/importer/AnimationAssigner.js +44 -44
- package/dist/esmdev/foundation/importer/DrcPointCloudImporter.js +30 -30
- package/dist/esmdev/foundation/importer/Gltf2Importer.js +14 -14
- package/dist/esmdev/foundation/importer/GltfImporter.js +22 -22
- package/dist/esmdev/foundation/importer/ModelConverter.js +137 -137
- package/dist/esmdev/foundation/importer/RhodoniteImportExtension.js +6 -6
- package/dist/esmdev/foundation/importer/Vrm0xImporter.js +48 -48
- package/dist/esmdev/foundation/importer/VrmImporter.js +10 -10
- package/dist/esmdev/foundation/materials/contents/ColorGradingUsingLUTsMaterialContent.d.ts +0 -20
- package/dist/esmdev/foundation/materials/contents/ColorGradingUsingLUTsMaterialContent.js +1 -33
- package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.d.ts +3 -1
- package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.js +31 -30
- package/dist/esmdev/foundation/materials/contents/DepthEncodeMaterialContent.js +2 -2
- package/dist/esmdev/foundation/materials/contents/DetectHighLuminanceMaterialContent.d.ts +0 -16
- package/dist/esmdev/foundation/materials/contents/DetectHighLuminanceMaterialContent.js +3 -19
- package/dist/esmdev/foundation/materials/contents/EntityUIDOutputMaterialContent.d.ts +0 -17
- package/dist/esmdev/foundation/materials/contents/EntityUIDOutputMaterialContent.js +1 -17
- package/dist/esmdev/foundation/materials/contents/FurnaceTestMaterialContent.d.ts +0 -21
- package/dist/esmdev/foundation/materials/contents/FurnaceTestMaterialContent.js +1 -21
- package/dist/esmdev/foundation/materials/contents/MToon0xMaterialContent.js +142 -143
- package/dist/esmdev/foundation/materials/contents/MToon1MaterialContent.js +21 -22
- package/dist/esmdev/foundation/materials/contents/MatCapMaterialContent.d.ts +0 -16
- package/dist/esmdev/foundation/materials/contents/MatCapMaterialContent.js +1 -17
- package/dist/esmdev/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +7 -8
- package/dist/esmdev/foundation/materials/contents/SynthesizeHdrMaterialContent.d.ts +0 -23
- package/dist/esmdev/foundation/materials/contents/SynthesizeHdrMaterialContent.js +3 -29
- package/dist/esmdev/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +7 -8
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.d.ts +6 -61
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.js +61 -153
- package/dist/esmdev/foundation/materials/core/AbstractShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/core/AbstractShaderNode.js +31 -31
- package/dist/esmdev/foundation/materials/core/DummyTextures.js +3 -3
- package/dist/esmdev/foundation/materials/core/Material.d.ts +7 -114
- package/dist/esmdev/foundation/materials/core/Material.js +100 -348
- package/dist/esmdev/foundation/materials/core/MaterialRepository.js +55 -55
- package/dist/esmdev/foundation/materials/core/ShaderGraphResolver.js +46 -1399
- package/dist/esmdev/foundation/materials/core/ShaderNodeFactories.d.ts +23 -0
- package/dist/esmdev/foundation/materials/core/ShaderNodeFactories.js +609 -0
- package/dist/esmdev/foundation/materials/core/ShaderProgramDefinitions.d.ts +41 -0
- package/dist/esmdev/foundation/materials/core/ShaderProgramDefinitions.js +95 -0
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGL.js +14 -14
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGPU.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/AbsShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/AcosShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/AddShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/AlphaTestShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/AndShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/Atan2ShaderNode.js +18 -18
- package/dist/esmdev/foundation/materials/nodes/AttributeColorShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeInstanceIdsShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeJointShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeNormalShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributePositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/AttributeTangentShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/AttributeTexcoordShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/AttributeWeightShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/BlockBeginShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/BlockEndShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/BranchShaderNode.js +18 -18
- package/dist/esmdev/foundation/materials/nodes/CalcBitangentShaderNode.js +7 -7
- package/dist/esmdev/foundation/materials/nodes/CastToFloatShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/CastToFloatShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/ClampShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/ClampShaderNode.js +19 -19
- package/dist/esmdev/foundation/materials/nodes/ClassicShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/ConstantScalarVariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVariableShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/ConstantVector2VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVector3VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/ConstantVector4VariableShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/CosShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/CosShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/DiscardShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/DotProductShaderNode.d.ts +2 -2
- package/dist/esmdev/foundation/materials/nodes/DotProductShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/EqualShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/EqualShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/FlatShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/GreaterOrEqualShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/GreaterOrEqualShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/GreaterShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/GreaterThanShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/GreaterThanShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/LengthShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/LengthShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/LessOrEqualShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/LessOrEqualShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/LessThanShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/LessThanShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/MergeVectorShaderNode.js +23 -23
- package/dist/esmdev/foundation/materials/nodes/MinShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/MultiplyShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/MultiplyShaderNode.js +25 -25
- package/dist/esmdev/foundation/materials/nodes/NormalMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/NormalizeShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/NormalizeShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/NotEqualShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/NotEqualShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/OrShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/OutColorShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/OutPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyPropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrAnisotropyRotationShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/PbrBaseColorPropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrClearcoatPropsShaderNode.js +7 -7
- package/dist/esmdev/foundation/materials/nodes/PbrDiffuseTransmissionPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrEmissivePropsShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/PbrIridescencePropsShaderNode.js +8 -8
- package/dist/esmdev/foundation/materials/nodes/PbrMetallicRoughnessPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrNormalPropsShaderNode.js +11 -11
- package/dist/esmdev/foundation/materials/nodes/PbrOcclusionPropsShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/PbrShaderShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/PbrSheenPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrSpecularPropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PbrTransmissionPropsShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/PbrVolumePropsShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/PremultipliedAlphaShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/PremultipliedAlphaShaderNode.js +8 -8
- package/dist/esmdev/foundation/materials/nodes/ProcessGeometryShaderNode.js +22 -22
- package/dist/esmdev/foundation/materials/nodes/ProjectionMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/Random_HashPRNGShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/Random_SinHashShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/RemapShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/RemapShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/SinShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/SinShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/SmoothStepShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/SmoothStepShaderNode.js +19 -19
- package/dist/esmdev/foundation/materials/nodes/SplitVectorShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/SplitVectorShaderNode.js +22 -22
- package/dist/esmdev/foundation/materials/nodes/StepShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/TanShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/TanShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/Texture2DShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/TimeShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/TransformShaderNode.d.ts +1 -1
- package/dist/esmdev/foundation/materials/nodes/TransformShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/UniformDataShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/ViewMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/WireframeMaterialNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/WorldMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendXYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendXZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendYXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendYZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendZXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/BendZYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/InitialPositionShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothIntersectionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothSubtractionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSmoothUnionShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpSubtractionShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/raymarching/OpUnionShaderNode.js +6 -6
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutDistanceShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutShadingColorShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/OutUnionShaderNode.js +16 -16
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchCameraPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitDistanceShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitNormalShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchHitPositionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchObjectIdUniformShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchRayDirectionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchTBNShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/RaymarchViewDirectionShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyTransformShaderNode.js +9 -9
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdApplyWorldMatrixShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarXShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarYShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBarZShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdBoxShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdCapsuleShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatXYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatYZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRepeatZXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdRoundBoxShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdSphereShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTorusShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeXShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeYShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/SdTubeZShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistXShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistYShaderNode.js +4 -4
- package/dist/esmdev/foundation/materials/nodes/raymarching/TwistZShaderNode.js +4 -4
- package/dist/esmdev/foundation/math/AABB.js +132 -132
- package/dist/esmdev/foundation/math/AnimatedQuaternion.js +54 -54
- package/dist/esmdev/foundation/math/AnimatedScalar.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedValueEvaluationState.js +20 -20
- package/dist/esmdev/foundation/math/AnimatedVector2.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVector3.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVector4.js +55 -55
- package/dist/esmdev/foundation/math/AnimatedVectorN.js +55 -55
- package/dist/esmdev/foundation/math/IdentityMatrix33.js +2 -2
- package/dist/esmdev/foundation/math/IdentityMatrix44.js +2 -2
- package/dist/esmdev/foundation/math/MathClassUtil.js +4 -4
- package/dist/esmdev/foundation/math/MathUtil.d.ts +11 -0
- package/dist/esmdev/foundation/math/MathUtil.js +5 -1
- package/dist/esmdev/foundation/math/Quaternion.js +14 -14
- package/dist/esmdev/foundation/math/Transform3D.js +74 -74
- package/dist/esmdev/foundation/math/shapes/MathSphere.js +7 -7
- package/dist/esmdev/foundation/memory/Accessor.js +359 -359
- package/dist/esmdev/foundation/memory/Buffer.js +34 -34
- package/dist/esmdev/foundation/memory/BufferView.js +26 -26
- package/dist/esmdev/foundation/misc/DataUtil.js +2 -2
- package/dist/esmdev/foundation/misc/EnumIO.js +10 -10
- package/dist/esmdev/foundation/misc/Logger.js +14 -14
- package/dist/esmdev/foundation/misc/RnPromise.js +14 -14
- package/dist/esmdev/foundation/misc/Time.js +27 -27
- package/dist/esmdev/foundation/misc/WeakOption.js +14 -14
- package/dist/esmdev/foundation/misc/cache/Cache.js +2 -2
- package/dist/esmdev/foundation/misc/cache/SymbolWeakMap.js +8 -8
- package/dist/esmdev/foundation/physics/PhysicsWorldQuery.js +10 -10
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.js +190 -190
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.js +225 -225
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.js +3 -3
- package/dist/esmdev/foundation/physics/VRMSpring/CapsuleCollider.js +36 -36
- package/dist/esmdev/foundation/physics/VRMSpring/SphereCollider.js +26 -26
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBone.js +6 -6
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBonePhysicsStrategy.js +56 -56
- package/dist/esmdev/foundation/renderer/CGAPIResourceRepository.d.ts +74 -4
- package/dist/esmdev/foundation/renderer/CGAPIResourceRepository.js +4 -4
- package/dist/esmdev/foundation/renderer/Expression.js +6 -6
- package/dist/esmdev/foundation/renderer/Frame.js +7 -7
- package/dist/esmdev/foundation/renderer/FrameBuffer.js +28 -28
- package/dist/esmdev/foundation/renderer/FrameRenderer.d.ts +42 -0
- package/dist/esmdev/foundation/renderer/FrameRenderer.js +1 -0
- package/dist/esmdev/foundation/renderer/RenderPass.js +94 -94
- package/dist/esmdev/foundation/renderer/ShaderPropertyLayout.d.ts +77 -0
- package/dist/esmdev/foundation/renderer/ShaderPropertyLayout.js +61 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +6 -6
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +9 -3
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.js +97 -83
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystem.js +162 -162
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystemStub.js +3 -3
- package/dist/esmdev/foundation/renderer/pipelines/DeferredRenderPipeline.js +4 -4
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +4 -171
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.js +335 -1127
- package/dist/esmdev/foundation/renderer/pipelines/RaymarchingRenderer.d.ts +263 -0
- package/dist/esmdev/foundation/renderer/pipelines/RaymarchingRenderer.js +858 -0
- package/dist/esmdev/foundation/system/Engine.d.ts +17 -28
- package/dist/esmdev/foundation/system/Engine.js +207 -574
- package/dist/esmdev/foundation/system/EngineState.d.ts +3 -3
- package/dist/esmdev/foundation/system/EngineState.js +4 -4
- package/dist/esmdev/foundation/system/EventPubSub.js +8 -8
- package/dist/esmdev/foundation/system/InputManager.js +56 -56
- package/dist/esmdev/foundation/system/ModuleManager.js +3 -3
- package/dist/esmdev/foundation/textures/AbstractReadableRenderTargetTexture.d.ts +39 -0
- package/dist/esmdev/foundation/textures/AbstractReadableRenderTargetTexture.js +88 -0
- package/dist/esmdev/foundation/textures/AbstractRenderTargetTexture.d.ts +60 -0
- package/dist/esmdev/foundation/textures/AbstractRenderTargetTexture.js +59 -0
- package/dist/esmdev/foundation/textures/AbstractTexture.js +49 -49
- package/dist/esmdev/foundation/textures/CubeTexture.js +35 -42
- package/dist/esmdev/foundation/textures/RenderBuffer.js +16 -17
- package/dist/esmdev/foundation/textures/RenderTargetTexture.d.ts +5 -67
- package/dist/esmdev/foundation/textures/RenderTargetTexture.js +18 -140
- package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.d.ts +5 -71
- package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.js +34 -177
- package/dist/esmdev/foundation/textures/RenderTargetTextureCube.d.ts +8 -50
- package/dist/esmdev/foundation/textures/RenderTargetTextureCube.js +31 -88
- package/dist/esmdev/foundation/textures/Sampler.js +24 -24
- package/dist/esmdev/foundation/textures/Texture.d.ts +19 -1
- package/dist/esmdev/foundation/textures/Texture.js +133 -146
- package/dist/esmdev/foundation/textures/TextureArray.js +13 -16
- package/dist/esmdev/foundation/textures/TextureDataFloat.js +26 -26
- package/dist/esmdev/foundation/textures/VideoTexture.d.ts +11 -0
- package/dist/esmdev/foundation/textures/VideoTexture.js +47 -46
- package/dist/esmdev/foundation/textures/decodeBasisImage.d.ts +14 -0
- package/dist/esmdev/foundation/textures/decodeBasisImage.js +14 -0
- package/dist/esmdev/foundation/textures/index.d.ts +2 -0
- package/dist/esmdev/foundation/textures/index.js +3 -1
- package/dist/esmdev/version.js +2 -2
- package/dist/esmdev/webgl/ComponentDataAccessorGLSL.d.ts +9 -0
- package/dist/esmdev/webgl/ComponentDataAccessorGLSL.js +146 -0
- package/dist/esmdev/webgl/InstanceSidTable.js +62 -62
- package/dist/esmdev/webgl/MultiDraw.d.ts +1 -1
- package/dist/esmdev/webgl/MultiDraw.js +4 -4
- package/dist/esmdev/webgl/MultiDrawRepository.js +34 -34
- package/dist/esmdev/webgl/ShaderPropertyAccessorGLSL.d.ts +11 -0
- package/dist/esmdev/webgl/ShaderPropertyAccessorGLSL.js +142 -0
- package/dist/esmdev/webgl/WebGLCompressedTextures.d.ts +48 -0
- package/dist/esmdev/webgl/WebGLCompressedTextures.js +105 -0
- package/dist/esmdev/webgl/WebGLContextWrapper.d.ts +9 -52
- package/dist/esmdev/webgl/WebGLContextWrapper.js +128 -230
- package/dist/esmdev/webgl/WebGLCubeTextureFileLoader.d.ts +38 -0
- package/dist/esmdev/webgl/WebGLCubeTextureFileLoader.js +178 -0
- package/dist/esmdev/webgl/WebGLCubeTextures.d.ts +92 -0
- package/dist/esmdev/webgl/WebGLCubeTextures.js +358 -0
- package/dist/esmdev/webgl/WebGLDataTexture.d.ts +108 -0
- package/dist/esmdev/webgl/WebGLDataTexture.js +337 -0
- package/dist/esmdev/webgl/WebGLDrawState.d.ts +84 -0
- package/dist/esmdev/webgl/WebGLDrawState.js +164 -0
- package/dist/esmdev/webgl/WebGLExternalState.d.ts +43 -0
- package/dist/esmdev/webgl/WebGLExternalState.js +70 -0
- package/dist/esmdev/webgl/WebGLFrameRenderer.d.ts +32 -0
- package/dist/esmdev/webgl/WebGLFrameRenderer.js +155 -0
- package/dist/esmdev/webgl/WebGLFramebuffers.d.ts +142 -0
- package/dist/esmdev/webgl/WebGLFramebuffers.js +245 -0
- package/dist/esmdev/webgl/WebGLGpuTimer.js +30 -30
- package/dist/esmdev/webgl/WebGLMaterialParameters.d.ts +47 -0
- package/dist/esmdev/webgl/WebGLMaterialParameters.js +81 -0
- package/dist/esmdev/webgl/WebGLMeshResources.d.ts +115 -0
- package/dist/esmdev/webgl/WebGLMeshResources.js +303 -0
- package/dist/esmdev/webgl/WebGLMorphUniformBuffers.d.ts +66 -0
- package/dist/esmdev/webgl/WebGLMorphUniformBuffers.js +272 -0
- package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +100 -178
- package/dist/esmdev/webgl/WebGLResourceRepository.js +345 -2596
- package/dist/esmdev/webgl/WebGLSamplers.d.ts +78 -0
- package/dist/esmdev/webgl/WebGLSamplers.js +143 -0
- package/dist/esmdev/webgl/WebGLShaderProgramBuilder.d.ts +40 -0
- package/dist/esmdev/webgl/WebGLShaderProgramBuilder.js +208 -0
- package/dist/esmdev/webgl/WebGLShaderPrograms.d.ts +88 -0
- package/dist/esmdev/webgl/WebGLShaderPrograms.js +240 -0
- package/dist/esmdev/webgl/WebGLStereoUtil.d.ts +0 -27
- package/dist/esmdev/webgl/WebGLStereoUtil.js +33 -112
- package/dist/esmdev/webgl/WebGLStrategyDataUploader.d.ts +152 -0
- package/dist/esmdev/webgl/WebGLStrategyDataUploader.js +370 -0
- package/dist/esmdev/webgl/WebGLStrategyMeshBatchRenderer.d.ts +40 -0
- package/dist/esmdev/webgl/WebGLStrategyMeshBatchRenderer.js +213 -0
- package/dist/esmdev/webgl/WebGLStrategyMeshDrawer.d.ts +92 -0
- package/dist/esmdev/webgl/WebGLStrategyMeshDrawer.js +300 -0
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +7 -360
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.js +75 -1863
- package/dist/esmdev/webgl/WebGLTextureUnitState.d.ts +79 -0
- package/dist/esmdev/webgl/WebGLTextureUnitState.js +149 -0
- package/dist/esmdev/webgl/WebGLTextureUploads.d.ts +106 -0
- package/dist/esmdev/webgl/WebGLTextureUploads.js +168 -0
- package/dist/esmdev/webgl/WebGLTextures.d.ts +316 -0
- package/dist/esmdev/webgl/WebGLTextures.js +577 -0
- package/dist/esmdev/webgl/WebGLUniformBuffers.d.ts +35 -0
- package/dist/esmdev/webgl/WebGLUniformBuffers.js +89 -0
- package/dist/esmdev/webgl/WebGLUniforms.d.ts +117 -0
- package/dist/esmdev/webgl/WebGLUniforms.js +283 -0
- package/dist/esmdev/webgl/WebGLVertexBuffers.d.ts +172 -0
- package/dist/esmdev/webgl/WebGLVertexBuffers.js +391 -0
- package/dist/esmdev/webgl/debug/BufferLayoutDecoder.d.ts +4 -4
- package/dist/esmdev/webgl/debug/BufferLayoutDecoder.js +52 -59
- package/dist/esmdev/webgl/debug/ShaderParameterDebugger.js +17 -17
- package/dist/esmdev/webgl/debug/types.d.ts +2 -2
- package/dist/esmdev/webgl/getRenderingStrategy.d.ts +2 -2
- package/dist/esmdev/webgl/getRenderingStrategy.js +5 -5
- package/dist/esmdev/webgl/main.d.ts +4 -17
- package/dist/esmdev/webgl/main.js +5 -3
- package/dist/esmdev/webgl/readColorAttachmentAsRgba8.d.ts +36 -0
- package/dist/esmdev/webgl/readColorAttachmentAsRgba8.js +47 -0
- package/dist/esmdev/webgl/shaders/RaymarchingShaderPart.d.ts +2 -2
- package/dist/esmdev/webgl/shaders/RaymarchingShaderPart.js +15 -15
- package/dist/esmdev/webgl/shaders/RaymarchingShadowShaderPart.js +17 -17
- package/dist/esmdev/webgl/shaders/StandardShaderPart.d.ts +3 -3
- package/dist/esmdev/webgl/shaders/StandardShaderPart.js +15 -15
- package/dist/esmdev/webgl/shaders/glslCommonChunks.d.ts +2 -2
- package/dist/esmdev/webgl/shaders/glslCommonChunks.js +1 -1
- package/dist/esmdev/webgl/shaders/nodes/BlockBeginShader.js +10 -10
- package/dist/esmdev/webgl/shaders/nodes/BlockEndShader.js +10 -10
- package/dist/esmdev/webgl/shaders/nodes/ConstantVariableShader.d.ts +2 -2
- package/dist/esmdev/webgl/shaders/nodes/ConstantVariableShader.js +27 -27
- package/dist/esmdev/webgl/shaders/nodes/DiscardShader.d.ts +1 -1
- package/dist/esmdev/webgl/shaders/nodes/DiscardShader.js +5 -5
- package/dist/esmdev/webgl/shaders/nodes/EndShader.d.ts +2 -2
- package/dist/esmdev/webgl/shaders/nodes/EndShader.js +6 -6
- package/dist/esmdev/webgl/shaders/nodes/OutDistance.d.ts +1 -1
- package/dist/esmdev/webgl/shaders/nodes/OutDistance.js +17 -17
- package/dist/esmdev/webgl/shaders/nodes/OutUnion.js +12 -12
- package/dist/esmdev/webgl/shaders/nodes/RaymarchObjectIdUniform.js +11 -11
- package/dist/esmdev/webgl/shaders/nodes/SdApplyTransform.js +12 -12
- package/dist/esmdev/webgl/shaders/nodes/SdApplyWorldMatrix.d.ts +1 -1
- package/dist/esmdev/webgl/shaders/nodes/SdApplyWorldMatrix.js +13 -13
- package/dist/esmdev/webgl/shaders/nodes/Texture2DShader.js +27 -27
- package/dist/esmdev/webgl/shaders/nodes/UniformDataShader.js +27 -27
- package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.d.ts +1 -1
- package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.js +33 -27
- package/dist/esmdev/webgpu/AttributeReader.d.ts +18 -0
- package/dist/esmdev/webgpu/AttributeReader.js +57 -0
- package/dist/esmdev/webgpu/GpuCullingRegistry.js +91 -91
- package/dist/esmdev/webgpu/GpuDeformRegistry.js +53 -53
- package/dist/esmdev/webgpu/RangeAllocator.js +16 -16
- package/dist/esmdev/webgpu/ShaderPropertyAccessorWGSL.d.ts +11 -0
- package/dist/esmdev/webgpu/ShaderPropertyAccessorWGSL.js +131 -0
- package/dist/esmdev/webgpu/WebGpuBindGroups.d.ts +131 -0
- package/dist/esmdev/webgpu/WebGpuBindGroups.js +377 -0
- package/dist/esmdev/webgpu/WebGpuBufferArena.js +21 -21
- package/dist/esmdev/webgpu/WebGpuCompressedTextures.d.ts +38 -0
- package/dist/esmdev/webgpu/WebGpuCompressedTextures.js +155 -0
- package/dist/esmdev/webgpu/WebGpuCubeTextureShaders.d.ts +1 -0
- package/dist/esmdev/webgpu/WebGpuCubeTextureShaders.js +68 -0
- package/dist/esmdev/webgpu/WebGpuCubeTextures.d.ts +72 -0
- package/dist/esmdev/webgpu/WebGpuCubeTextures.js +340 -0
- package/dist/esmdev/webgpu/WebGpuDeviceWrapper.js +7 -7
- package/dist/esmdev/webgpu/WebGpuDraw.d.ts +63 -0
- package/dist/esmdev/webgpu/WebGpuDraw.js +133 -0
- package/dist/esmdev/webgpu/WebGpuDrawParameters.d.ts +61 -0
- package/dist/esmdev/webgpu/WebGpuDrawParameters.js +120 -0
- package/dist/esmdev/webgpu/WebGpuExternalRenderPass.d.ts +44 -0
- package/dist/esmdev/webgpu/WebGpuExternalRenderPass.js +115 -0
- package/dist/esmdev/webgpu/WebGpuFrame.d.ts +55 -0
- package/dist/esmdev/webgpu/WebGpuFrame.js +89 -0
- package/dist/esmdev/webgpu/WebGpuFrameRenderer.d.ts +25 -0
- package/dist/esmdev/webgpu/WebGpuFrameRenderer.js +248 -0
- package/dist/esmdev/webgpu/WebGpuGpuCulling.js +200 -454
- package/dist/esmdev/webgpu/WebGpuGpuCullingShaders.d.ts +34 -0
- package/dist/esmdev/webgpu/WebGpuGpuCullingShaders.js +264 -0
- package/dist/esmdev/webgpu/WebGpuGpuTimer.js +52 -52
- package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.js +39 -194
- package/dist/esmdev/webgpu/WebGpuLightClusterShaders.d.ts +14 -0
- package/dist/esmdev/webgpu/WebGpuLightClusterShaders.js +161 -0
- package/dist/esmdev/webgpu/WebGpuMipmapGenerator.d.ts +54 -0
- package/dist/esmdev/webgpu/WebGpuMipmapGenerator.js +187 -0
- package/dist/esmdev/webgpu/WebGpuMipmapShaders.d.ts +1 -0
- package/dist/esmdev/webgpu/WebGpuMipmapShaders.js +34 -0
- package/dist/esmdev/webgpu/WebGpuRenderBundles.d.ts +117 -0
- package/dist/esmdev/webgpu/WebGpuRenderBundles.js +299 -0
- package/dist/esmdev/webgpu/WebGpuRenderPassEncoders.d.ts +140 -0
- package/dist/esmdev/webgpu/WebGpuRenderPassEncoders.js +611 -0
- package/dist/esmdev/webgpu/WebGpuRenderPipelines.d.ts +75 -0
- package/dist/esmdev/webgpu/WebGpuRenderPipelines.js +249 -0
- package/dist/esmdev/webgpu/WebGpuRenderTargetTextures.d.ts +78 -0
- package/dist/esmdev/webgpu/WebGpuRenderTargetTextures.js +108 -0
- package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +52 -322
- package/dist/esmdev/webgpu/WebGpuResourceRepository.js +332 -3127
- package/dist/esmdev/webgpu/WebGpuSamplers.d.ts +45 -0
- package/dist/esmdev/webgpu/WebGpuSamplers.js +58 -0
- package/dist/esmdev/webgpu/WebGpuShaderProgramBuilder.d.ts +25 -0
- package/dist/esmdev/webgpu/WebGpuShaderProgramBuilder.js +108 -0
- package/dist/esmdev/webgpu/WebGpuStorageBuffers.d.ts +77 -0
- package/dist/esmdev/webgpu/WebGpuStorageBuffers.js +191 -0
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.d.ts +1 -73
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.js +58 -780
- package/dist/esmdev/webgpu/WebGpuStrategyStorage.d.ts +62 -0
- package/dist/esmdev/webgpu/WebGpuStrategyStorage.js +267 -0
- package/dist/esmdev/webgpu/WebGpuTextureReadback.d.ts +111 -0
- package/dist/esmdev/webgpu/WebGpuTextureReadback.js +188 -0
- package/dist/esmdev/webgpu/WebGpuTextureReadbackShaders.d.ts +4 -0
- package/dist/esmdev/webgpu/WebGpuTextureReadbackShaders.js +34 -0
- package/dist/esmdev/webgpu/WebGpuTextureUploads.d.ts +109 -0
- package/dist/esmdev/webgpu/WebGpuTextureUploads.js +197 -0
- package/dist/esmdev/webgpu/WebGpuTextures.d.ts +196 -0
- package/dist/esmdev/webgpu/WebGpuTextures.js +344 -0
- package/dist/esmdev/webgpu/WebGpuVertexBuffers.d.ts +142 -0
- package/dist/esmdev/webgpu/WebGpuVertexBuffers.js +281 -0
- package/dist/esmdev/webgpu/WebGpuVertexDeformer.js +106 -284
- package/dist/esmdev/webgpu/WebGpuVertexDeformerShaders.d.ts +7 -0
- package/dist/esmdev/webgpu/WebGpuVertexDeformerShaders.js +134 -0
- package/dist/esmdev/webgpu/WebGpuVertexShaderDefinitions.d.ts +16 -0
- package/dist/esmdev/webgpu/WebGpuVertexShaderDefinitions.js +216 -0
- package/dist/esmdev/webgpu/assertArrayBufferView.d.ts +9 -0
- package/dist/esmdev/webgpu/assertArrayBufferView.js +10 -0
- package/dist/esmdev/webgpu/main.d.ts +2 -16
- package/dist/esmdev/webgpu/main.js +3 -3
- package/dist/esmdev/webgpu/padCompressedRowsForUpload.d.ts +20 -0
- package/dist/esmdev/webgpu/padCompressedRowsForUpload.js +20 -0
- package/dist/esmdev/webgpu/removeRowPadding.d.ts +21 -0
- package/dist/esmdev/webgpu/removeRowPadding.js +23 -0
- package/dist/esmdev/webgpu/shaderity_shaders/common/processGeometry.wgsl.js +2 -2
- package/dist/esmdev/webgpu/wgslCommonChunks.d.ts +2 -2
- package/dist/esmdev/webgpu/wgslCommonChunks.js +1 -1
- package/dist/esmdev/xr/WebARSystem.js +65 -65
- package/dist/esmdev/xr/WebXRSystem.d.ts +0 -4
- package/dist/esmdev/xr/WebXRSystem.js +155 -160
- package/package.json +1 -1
- package/dist/esm/foundation/definitions/ProcessApproach.d.ts +0 -21
- package/dist/esm/foundation/definitions/ProcessApproach.js +0 -1
- package/dist/esm/foundation/materials/core/ShaderHandler.d.ts +0 -125
- package/dist/esm/foundation/materials/core/ShaderHandler.js +0 -48
- package/dist/esmdev/foundation/definitions/ProcessApproach.d.ts +0 -21
- package/dist/esmdev/foundation/definitions/ProcessApproach.js +0 -60
- package/dist/esmdev/foundation/materials/core/ShaderHandler.d.ts +0 -125
- package/dist/esmdev/foundation/materials/core/ShaderHandler.js +0 -416
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
var e=`
|
|
2
|
+
struct CullGroup {
|
|
3
|
+
rangeBase: u32, // the first instance slot of the group
|
|
4
|
+
instanceCount: u32, // the number of instances (0 for an unused group slot)
|
|
5
|
+
viewIndex: u32, // the view the instances are culled with
|
|
6
|
+
chunkBase: u32, // the first chunk slot of the group
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
struct Params {
|
|
10
|
+
groupCount: u32,
|
|
11
|
+
drawCount: u32,
|
|
12
|
+
chunkCount: u32,
|
|
13
|
+
chunksPerRow: u32,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const CHUNK_SIZE: u32 = 64u;
|
|
17
|
+
const INVALID: u32 = 0xffffffffu;
|
|
18
|
+
`,r=`
|
|
19
|
+
${e}
|
|
20
|
+
struct CullRecord {
|
|
21
|
+
ids: vec4<u32>, // the instance variation data (sceneGraphSID, skeletalSID, blendShapeSID, 0)
|
|
22
|
+
center: vec3<f32>, // the center of the local AABB of the mesh
|
|
23
|
+
worldMatrixIndex: u32, // vec4 index of the world matrix of the instance in data
|
|
24
|
+
extent: vec3<f32>, // the half size of the local AABB of the mesh
|
|
25
|
+
isVisibleIndex: u32, // float index of the isVisible flag of the instance in data
|
|
26
|
+
isBillboardIndex: u32, // float index of the isBillboard flag of the instance in data
|
|
27
|
+
flags: u32, // bit 0: always visible (not culled), bit 1: deformed (the AABB is in bounds)
|
|
28
|
+
boundsSlot: u32, // the deformed bounding box of the instance (WebGpuVertexDeformer)
|
|
29
|
+
pad1: u32,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
struct CullView {
|
|
33
|
+
header: vec4<f32>, // x: 1 if the view culls
|
|
34
|
+
planes: array<vec4<f32>, 6>, // top, bottom, right, left, near, far (as Frustum.getPlane)
|
|
35
|
+
corners: array<vec4<f32>, 8>, // the frustum corners in world space
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@group(0) @binding(0) var<storage, read> data: array<vec4<f32>>;
|
|
39
|
+
@group(0) @binding(1) var<uniform> params: Params;
|
|
40
|
+
@group(0) @binding(2) var<storage, read> records: array<CullRecord>;
|
|
41
|
+
@group(0) @binding(3) var<storage, read> groups: array<CullGroup>;
|
|
42
|
+
@group(0) @binding(4) var<storage, read> views: array<CullView>;
|
|
43
|
+
// (group index, index of the chunk's first instance in the group), or (INVALID, 0) for an unused chunk slot
|
|
44
|
+
@group(0) @binding(5) var<storage, read> chunks: array<vec2<u32>>;
|
|
45
|
+
@group(0) @binding(6) var<storage, read_write> scratchIds: array<vec4<u32>>;
|
|
46
|
+
@group(0) @binding(7) var<storage, read_write> chunkCounts: array<u32>;
|
|
47
|
+
// The local bounding boxes of the deformed instances (2 vec4 per instance: ~min.xyz and max.xyz, encoded by
|
|
48
|
+
// encodeOrderedFloat in WebGpuVertexDeformer; all 0 before the first deformation)
|
|
49
|
+
@group(0) @binding(8) var<storage, read> bounds: array<vec4<u32>>;
|
|
50
|
+
|
|
51
|
+
const ALWAYS_VISIBLE: u32 = 1u;
|
|
52
|
+
const DEFORMED: u32 = 2u;
|
|
53
|
+
|
|
54
|
+
fn decodeOrderedFloat(encoded: vec3<u32>) -> vec3<f32> {
|
|
55
|
+
return bitcast<vec3<f32>>(select(~encoded, encoded & vec3<u32>(0x7fffffffu), (encoded & vec3<u32>(0x80000000u)) != vec3<u32>(0u)));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var<workgroup> scan: array<u32, 64>;
|
|
59
|
+
|
|
60
|
+
fn fetchScalar(floatIndex: u32) -> f32 {
|
|
61
|
+
let value = data[floatIndex / 4u];
|
|
62
|
+
return value[floatIndex % 4u];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
fn isInstanceVisible(record: CullRecord, view: CullView) -> bool {
|
|
66
|
+
if ((record.flags & ALWAYS_VISIBLE) != 0u) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
// The same rule as the CPU culling (SceneGraphComponent.isVisible) and the vertex shaders (get_isVisible).
|
|
70
|
+
if (fetchScalar(record.isVisibleIndex) <= 0.5) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (view.header.x < 0.5) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
// A billboard is rotated toward the camera in the vertex shader, so its world AABB is not known here.
|
|
77
|
+
if (fetchScalar(record.isBillboardIndex) > 0.5) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
var localCenter = record.center;
|
|
81
|
+
var localExtent = record.extent;
|
|
82
|
+
if ((record.flags & DEFORMED) != 0u) {
|
|
83
|
+
let encodedMax = bounds[record.boundsSlot * 2u + 1u];
|
|
84
|
+
if (encodedMax.x == 0u) {
|
|
85
|
+
// Not deformed yet.
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
let localMin = decodeOrderedFloat(~bounds[record.boundsSlot * 2u].xyz);
|
|
89
|
+
let localMax = decodeOrderedFloat(encodedMax.xyz);
|
|
90
|
+
localCenter = (localMin + localMax) * 0.5;
|
|
91
|
+
localExtent = (localMax - localMin) * 0.5;
|
|
92
|
+
}
|
|
93
|
+
let m = mat4x4<f32>(
|
|
94
|
+
data[record.worldMatrixIndex],
|
|
95
|
+
data[record.worldMatrixIndex + 1u],
|
|
96
|
+
data[record.worldMatrixIndex + 2u],
|
|
97
|
+
data[record.worldMatrixIndex + 3u]
|
|
98
|
+
);
|
|
99
|
+
// The world AABB of the transformed local AABB (the same box as transforming its 8 corners).
|
|
100
|
+
let center = (m * vec4<f32>(localCenter, 1.0)).xyz;
|
|
101
|
+
let extent = abs(m[0].xyz) * localExtent.x + abs(m[1].xyz) * localExtent.y + abs(m[2].xyz) * localExtent.z;
|
|
102
|
+
let minPoint = center - extent;
|
|
103
|
+
let maxPoint = center + extent;
|
|
104
|
+
|
|
105
|
+
// The box is completely outside of a plane exactly when its corner farthest along the plane normal is.
|
|
106
|
+
for (var i = 0u; i < 6u; i = i + 1u) {
|
|
107
|
+
let plane = view.planes[i];
|
|
108
|
+
let farthest = select(minPoint, maxPoint, plane.xyz >= vec3<f32>(0.0));
|
|
109
|
+
if (dot(plane.xyz, farthest) + plane.w < 0.0) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// The frustum is completely outside of one of the box faces.
|
|
115
|
+
var outMax = vec3<u32>(0u);
|
|
116
|
+
var outMin = vec3<u32>(0u);
|
|
117
|
+
for (var i = 0u; i < 8u; i = i + 1u) {
|
|
118
|
+
let corner = view.corners[i].xyz;
|
|
119
|
+
outMax = outMax + select(vec3<u32>(0u), vec3<u32>(1u), corner > maxPoint);
|
|
120
|
+
outMin = outMin + select(vec3<u32>(0u), vec3<u32>(1u), corner < minPoint);
|
|
121
|
+
}
|
|
122
|
+
if (any(outMax == vec3<u32>(8u)) || any(outMin == vec3<u32>(8u))) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@compute @workgroup_size(64)
|
|
129
|
+
fn cullChunks(@builtin(workgroup_id) workgroupId: vec3<u32>, @builtin(local_invocation_index) lid: u32) {
|
|
130
|
+
// c is uniform in the workgroup, so this return keeps the barriers below in uniform control flow.
|
|
131
|
+
let c = workgroupId.y * params.chunksPerRow + workgroupId.x;
|
|
132
|
+
if (c >= params.chunkCount) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
let chunk = chunks[c];
|
|
136
|
+
var visible = 0u;
|
|
137
|
+
var ids = vec4<u32>(0u);
|
|
138
|
+
var chunkSlotBase = 0u;
|
|
139
|
+
if (chunk.x != INVALID) {
|
|
140
|
+
let group = groups[chunk.x];
|
|
141
|
+
chunkSlotBase = group.rangeBase + chunk.y;
|
|
142
|
+
if (chunk.y + lid < group.instanceCount) {
|
|
143
|
+
let record = records[chunkSlotBase + lid];
|
|
144
|
+
ids = record.ids;
|
|
145
|
+
if (isInstanceVisible(record, views[group.viewIndex])) {
|
|
146
|
+
visible = 1u;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Inclusive prefix sum of the visibility (Hillis-Steele).
|
|
151
|
+
scan[lid] = visible;
|
|
152
|
+
workgroupBarrier();
|
|
153
|
+
for (var offset = 1u; offset < CHUNK_SIZE; offset = offset << 1u) {
|
|
154
|
+
var addend = 0u;
|
|
155
|
+
if (lid >= offset) {
|
|
156
|
+
addend = scan[lid - offset];
|
|
157
|
+
}
|
|
158
|
+
workgroupBarrier();
|
|
159
|
+
scan[lid] = scan[lid] + addend;
|
|
160
|
+
workgroupBarrier();
|
|
161
|
+
}
|
|
162
|
+
if (visible == 1u) {
|
|
163
|
+
scratchIds[chunkSlotBase + scan[lid] - 1u] = ids;
|
|
164
|
+
}
|
|
165
|
+
if (lid == CHUNK_SIZE - 1u) {
|
|
166
|
+
chunkCounts[c] = scan[lid];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
`,a=`
|
|
170
|
+
${e}
|
|
171
|
+
@group(0) @binding(0) var<uniform> params: Params;
|
|
172
|
+
@group(0) @binding(1) var<storage, read> groups: array<CullGroup>;
|
|
173
|
+
@group(0) @binding(2) var<storage, read> chunkCounts: array<u32>;
|
|
174
|
+
@group(0) @binding(3) var<storage, read_write> chunkOffsets: array<u32>;
|
|
175
|
+
@group(0) @binding(4) var<storage, read_write> visibleCounts: array<u32>;
|
|
176
|
+
|
|
177
|
+
@compute @workgroup_size(64)
|
|
178
|
+
fn prefixGroups(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
179
|
+
let g = id.x;
|
|
180
|
+
if (g >= params.groupCount) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
let group = groups[g];
|
|
184
|
+
let chunkCount = (group.instanceCount + CHUNK_SIZE - 1u) / CHUNK_SIZE;
|
|
185
|
+
var sum = 0u;
|
|
186
|
+
for (var k = 0u; k < chunkCount; k = k + 1u) {
|
|
187
|
+
chunkOffsets[group.chunkBase + k] = sum;
|
|
188
|
+
sum = sum + chunkCounts[group.chunkBase + k];
|
|
189
|
+
}
|
|
190
|
+
visibleCounts[g] = sum;
|
|
191
|
+
}
|
|
192
|
+
`,o=`
|
|
193
|
+
${e}
|
|
194
|
+
@group(0) @binding(0) var<uniform> params: Params;
|
|
195
|
+
@group(0) @binding(1) var<storage, read> groups: array<CullGroup>;
|
|
196
|
+
@group(0) @binding(2) var<storage, read> chunks: array<vec2<u32>>;
|
|
197
|
+
@group(0) @binding(3) var<storage, read> chunkCounts: array<u32>;
|
|
198
|
+
@group(0) @binding(4) var<storage, read> chunkOffsets: array<u32>;
|
|
199
|
+
@group(0) @binding(5) var<storage, read> scratchIds: array<vec4<u32>>;
|
|
200
|
+
@group(0) @binding(6) var<storage, read_write> visibleIds: array<vec4<u32>>;
|
|
201
|
+
|
|
202
|
+
@compute @workgroup_size(64)
|
|
203
|
+
fn scatter(@builtin(workgroup_id) workgroupId: vec3<u32>, @builtin(local_invocation_index) lid: u32) {
|
|
204
|
+
let c = workgroupId.y * params.chunksPerRow + workgroupId.x;
|
|
205
|
+
if (c >= params.chunkCount) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
let chunk = chunks[c];
|
|
209
|
+
if (chunk.x == INVALID || lid >= chunkCounts[c]) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
let rangeBase = groups[chunk.x].rangeBase;
|
|
213
|
+
visibleIds[rangeBase + chunkOffsets[c] + lid] = scratchIds[rangeBase + chunk.y + lid];
|
|
214
|
+
}
|
|
215
|
+
`,n=`
|
|
216
|
+
${e}
|
|
217
|
+
@group(0) @binding(0) var<uniform> params: Params;
|
|
218
|
+
@group(0) @binding(1) var<storage, read> visibleCounts: array<u32>;
|
|
219
|
+
@group(0) @binding(2) var<storage, read> drawGroups: array<u32>;
|
|
220
|
+
@group(0) @binding(3) var<storage, read_write> args: array<u32>;
|
|
221
|
+
|
|
222
|
+
@compute @workgroup_size(64)
|
|
223
|
+
fn finalize(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
224
|
+
let d = id.x;
|
|
225
|
+
if (d >= params.drawCount) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
let g = drawGroups[d];
|
|
229
|
+
var count = 0u;
|
|
230
|
+
if (g != INVALID) {
|
|
231
|
+
count = visibleCounts[g];
|
|
232
|
+
}
|
|
233
|
+
// The indirect arguments are [indexCount or vertexCount, instanceCount, ...].
|
|
234
|
+
args[d * 5u + 1u] = count;
|
|
235
|
+
}
|
|
236
|
+
`;export{e as commonWgsl,r as cullChunksWgsl,n as finalizeWgsl,a as prefixGroupsWgsl,o as scatterWgsl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=class{constructor(e){this.
|
|
1
|
+
var c=class{constructor(e){this.BM=[];this.FM=0;this.vM=0;this.EM=[];this.kM=[];this.yB=e}get isSupported(){return this.yB.features.has("timestamp-query")}get lastGpuTimeMilliseconds(){return this.zE}get lastPassGpuTimesMilliseconds(){return this._M}beginFrame(){this.isSupported&&(this.CM={sumNanoseconds:0,passNanoseconds:new Map,pendingReadbacks:0,ended:!1,isComplete:!0})}endFrame(){let e=this.CM;e!=null&&(e.ended=!0,this.CM=void 0,this.DM(e))}getTimestampWrites(e){let s=this.CM;if(s==null)return;if(this.GM!=null&&this.GM!==s){s.isComplete=!1;return}if(this.vM+2>512){s.isComplete=!1;return}this.AM==null&&(this.AM=this.yB.createQuerySet({type:"timestamp",count:512}),this.UM=this.yB.createBuffer({size:512*8,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}));let t=this.vM;return this.vM+=2,this.EM.push(e),this.GM=s,{querySet:this.AM,beginningOfPassWriteIndex:t,endOfPassWriteIndex:t+1}}encodeResolve(e){let s=this.vM,t=this.EM,i=this.GM;if(this.vM=0,this.EM=[],this.GM=void 0,s===0||i==null)return;let n=this.BM.pop();if(n==null){if(this.FM>=8){i.isComplete=!1;return}n=this.yB.createBuffer({size:512*8,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),this.FM++}e.resolveQuerySet(this.AM,0,s,this.UM,0),e.copyBufferToBuffer(this.UM,0,n,0,s*8),i.pendingReadbacks++,this.kM.push({buffer:n,timestampCount:s,labels:t,frame:i})}afterSubmit(){let e=this.kM;for(let s=0;s<e.length;s++)this.XM(e[s]);e.length=0}XM(e){let{buffer:s,timestampCount:t,labels:i,frame:n}=e,u=t*8;s.mapAsync(GPUMapMode.READ,0,u).then(()=>{var d,p;let o=new BigUint64Array(s.getMappedRange(0,u));for(let r=0,f=0;r+1<t;r+=2,f++){let a=Number(o[r]),h=Number(o[r+1]);if(a!==0&&h>a){let m=h-a;n.sumNanoseconds+=m;let l=(d=i[f])!=null?d:"pass";n.passNanoseconds.set(l,((p=n.passNanoseconds.get(l))!=null?p:0)+m)}}s.unmap(),this.BM.push(s)}).catch(()=>{n.isComplete=!1}).finally(()=>{n.pendingReadbacks--,this.DM(n)})}DM(e){if(e.ended&&e.pendingReadbacks===0&&e.isComplete){this.zE=e.sumNanoseconds/1e6;let s=new Map;for(let[t,i]of e.passNanoseconds)s.set(t,i/1e6);this._M=s}}destroy(){var e,s;(e=this.AM)==null||e.destroy(),(s=this.UM)==null||s.destroy();for(let t of this.BM)t.destroy();this.BM.length=0,this.AM=void 0,this.UM=void 0,this._M=void 0}};export{c as WebGpuGpuTimer};
|
|
@@ -1,153 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
// Per-view parameters (one uniform element per dispatched view, selected with a dynamic offset).
|
|
3
|
-
// viewBase is a vec4 index of data (the GPU instance data); the other offsets are float indices of buildData.
|
|
4
|
-
struct Params {
|
|
5
|
-
viewBase: u32, // vec4 index of the view header in data (the same value as lightClusterViewInfo.x)
|
|
6
|
-
sphereBase: u32, // float index of the sorted spheres in buildData (cx, cy, cz, r per light)
|
|
7
|
-
entryBase: u32, // float index of the sorted light entries in buildData (parallel to the spheres)
|
|
8
|
-
rangeBase: u32, // float index of the per-slice light ranges in buildData (start, end per slice)
|
|
9
|
-
localCount: u32, // the number of local lights (spheres/entries) of the view
|
|
10
|
-
clusterCount: u32, // the number of clusters of the view (gridX * gridY * gridZ)
|
|
11
|
-
entriesPerCluster: u32, // the number of vec4 of the light index list owned by each cluster
|
|
12
|
-
capacity: u32, // the maximum number of lights stored in one cluster
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// data is the GPU instance data (the storage buffer the shaders read). The view header, the cluster table and the
|
|
16
|
-
// light index list are written here, at the offsets LightClusterLayout.ts defines for them.
|
|
17
|
-
@group(0) @binding(0) var<storage, read_write> data: array<vec4<f32>>;
|
|
18
|
-
@group(0) @binding(1) var<uniform> params: Params;
|
|
19
|
-
// buildData is the build input of the view: it is separate from the GPU instance data because it is not needed by
|
|
20
|
-
// the render shaders, is small, and is regenerated by the CPU whenever the lights or the camera move.
|
|
21
|
-
@group(0) @binding(2) var<storage, read> buildData: array<f32>;
|
|
22
|
-
|
|
23
|
-
// The view region layout: [header (6 vec4)][cluster table (clusterCount vec4)][light index list].
|
|
24
|
-
fn tableBase() -> u32 {
|
|
25
|
-
return params.viewBase + 6u;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
fn indexBase() -> u32 {
|
|
29
|
-
return params.viewBase + 6u + params.clusterCount;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Whether the sphere (center, radius) is on the inner side of a tile border plane. The signed distance is compared
|
|
33
|
-
// with -radius, so the sphere passes while it touches the plane.
|
|
34
|
-
// The header rows are scaled by 0.5 * grid (see LightClusterBuilder.ts), so the plane is normalized here.
|
|
35
|
-
// A degenerate plane passes, like in the CPU build.
|
|
36
|
-
fn planePasses(plane: vec4<f32>, center: vec3<f32>, radius: f32) -> bool {
|
|
37
|
-
let planeLength = length(plane.xyz);
|
|
38
|
-
if (!(planeLength > 1e-30)) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
return (dot(plane.xyz, center) + plane.w) / planeLength >= -radius;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@compute @workgroup_size(64)
|
|
45
|
-
fn buildClusters(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
46
|
-
// One invocation per cluster. id.y and id.z are not used: the dispatch is 1D, so every workgroup covers 64
|
|
47
|
-
// consecutive clusters and each invocation writes only its own cluster's table entry and list.
|
|
48
|
-
let cluster = id.x;
|
|
49
|
-
if (cluster >= params.clusterCount) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// Decode the cluster index into (x, y, z). The layout is the same as in the CPU build and the shaders:
|
|
53
|
-
// cluster = (z * gridY + y) * gridX + x.
|
|
54
|
-
let base = params.viewBase;
|
|
55
|
-
// Header (see LightClusterLayout.ts): the tile rows, the eye plane row, the depth row, the grid size and the
|
|
56
|
-
// parameters of the logarithmic depth slices.
|
|
57
|
-
let rowX = data[base];
|
|
58
|
-
let rowY = data[base + 1u];
|
|
59
|
-
let rowW = data[base + 2u];
|
|
60
|
-
let rowDepth = data[base + 3u];
|
|
61
|
-
let grid = data[base + 4u];
|
|
62
|
-
let slice = data[base + 5u];
|
|
63
|
-
let gridX = u32(grid.x);
|
|
64
|
-
let gridY = u32(grid.y);
|
|
65
|
-
let gridZ = u32(grid.z);
|
|
66
|
-
let x = cluster % gridX;
|
|
67
|
-
let y = (cluster / gridX) % gridY;
|
|
68
|
-
let z = cluster / (gridX * gridY);
|
|
69
|
-
let fx = f32(x);
|
|
70
|
-
let fy = f32(y);
|
|
71
|
-
let fz = f32(z);
|
|
72
|
-
// The four border planes of this cluster: the left / bottom borders are row - k * rowW, the right / top
|
|
73
|
-
// borders are the negated planes of the next row (tile k + 1). A border test is skipped for a cluster at the
|
|
74
|
-
// border of the grid, because those clusters extend to infinity.
|
|
75
|
-
let leftPlane = rowX - fx * rowW;
|
|
76
|
-
let rightPlane = (fx + 1.0) * rowW - rowX;
|
|
77
|
-
let bottomPlane = rowY - fy * rowW;
|
|
78
|
-
let topPlane = (fy + 1.0) * rowW - rowY;
|
|
79
|
-
// The depth range of this cluster's slice, from the same log mapping as the header:
|
|
80
|
-
// slice(depth) = floor(log(depth) * sliceScale + sliceBias).
|
|
81
|
-
let sliceNear = exp((fz - slice.y) / slice.x);
|
|
82
|
-
let sliceFar = exp((fz + 1.0 - slice.y) / slice.x);
|
|
83
|
-
let wLength = length(rowW.xyz);
|
|
84
|
-
|
|
85
|
-
// Only the lights whose sphere reaches the depth range of this slice are tested: the CPU already computed those
|
|
86
|
-
// ranges (LightClusterSystem.__prepareViewBuild) and the lights are sorted by view depth, so the range is a
|
|
87
|
-
// contiguous part of the input.
|
|
88
|
-
let rangeBase = params.rangeBase + z * 2u;
|
|
89
|
-
let rangeStart = u32(buildData[rangeBase]);
|
|
90
|
-
let rangeEnd = u32(buildData[rangeBase + 1u]);
|
|
91
|
-
// The list of this cluster: its own fixed slot in the index list (no other invocation writes it, so the light
|
|
92
|
-
// index list needs no atomics).
|
|
93
|
-
let listBase = indexBase() + cluster * params.entriesPerCluster;
|
|
94
|
-
|
|
95
|
-
// pending gathers 4 entries into one vec4 before storing it, because a vec4 store is the smallest unit this
|
|
96
|
-
// shader may write (and other invocations must never observe a partially written vec4 of this list).
|
|
97
|
-
var count = 0u;
|
|
98
|
-
var pending = vec4<f32>(0.0);
|
|
99
|
-
for (var i = rangeStart; i < rangeEnd; i = i + 1u) {
|
|
100
|
-
// Stop at the capacity: because the lights are sorted nearest first, the lights that are dropped are the
|
|
101
|
-
// farthest ones.
|
|
102
|
-
if (count >= params.capacity) {
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
let sphereBase = params.sphereBase + i * 4u;
|
|
106
|
-
let center = vec3<f32>(buildData[sphereBase], buildData[sphereBase + 1u], buildData[sphereBase + 2u]);
|
|
107
|
-
let radius = buildData[sphereBase + 3u];
|
|
108
|
-
// The tests below are the same as the light-centric tests of LightClusterBuilder.ts, evaluated for this
|
|
109
|
-
// cluster; see the comment block at the top of that file for the reasoning.
|
|
110
|
-
// entirely behind the eye plane (fragments there use the all-light list)
|
|
111
|
-
if (wLength > 1e-30 && (dot(rowW.xyz, center) + rowW.w) / wLength <= -radius) {
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
if (x > 0u && !planePasses(leftPlane, center, radius)) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (x < gridX - 1u && !planePasses(rightPlane, center, radius)) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
if (y > 0u && !planePasses(bottomPlane, center, radius)) {
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
if (y < gridY - 1u && !planePasses(topPlane, center, radius)) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
let depth = dot(rowDepth.xyz, center) + rowDepth.w;
|
|
127
|
-
if (z > 0u && depth + radius < sliceNear) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
if (z < gridZ - 1u && depth - radius > sliceFar) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
// Append the entry of the light to the list. The light is accepted, so it is one of the nearest capacity
|
|
134
|
-
// lights (the input is sorted by depth).
|
|
135
|
-
pending[count & 3u] = buildData[params.entryBase + i];
|
|
136
|
-
if ((count & 3u) == 3u) {
|
|
137
|
-
// The vec4 is full: store it, and start a new one (its unused components are zero, which is the padding
|
|
138
|
-
// the CPU build also writes).
|
|
139
|
-
data[listBase + (count >> 2u)] = pending;
|
|
140
|
-
pending = vec4<f32>(0.0);
|
|
141
|
-
}
|
|
142
|
-
count++;
|
|
143
|
-
}
|
|
144
|
-
// Store the last partial vec4 (if any).
|
|
145
|
-
if ((count & 3u) != 0u) {
|
|
146
|
-
data[listBase + (count >> 2u)] = pending;
|
|
147
|
-
}
|
|
148
|
-
// The table entry of the cluster: (vec4 offset of its list from the index list start, light count, 0, 0).
|
|
149
|
-
// The offset is fixed (cluster * entriesPerCluster), unlike the dense packing of the CPU build, so the shaders
|
|
150
|
-
// use the same table lookup for both builds.
|
|
151
|
-
data[tableBase() + cluster] = vec4<f32>(f32(cluster * params.entriesPerCluster), f32(count), 0.0, 0.0);
|
|
152
|
-
}
|
|
153
|
-
`;var y=class{constructor(t){this.ww=0;this.gB=new Uint32Array(32/4);this.Pw=0;this.uB=t,this.bw=Math.max(t.limits.minUniformBufferOffsetAlignment,32),this.yw=t.createBindGroupLayout({label:"LightClusterBuild",entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform",hasDynamicOffset:!0,minBindingSize:32}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]});let i=t.createPipelineLayout({bindGroupLayouts:[this.yw]}),r=t.createShaderModule({label:"LightClusterBuild",code:v});this.Bw=t.createComputePipeline({label:"LightClusterBuild.buildClusters",layout:i,compute:{module:r,entryPoint:"buildClusters"}})}build(t,i,r){var g,b;let n=i.views.length;if(n===0)return;let a=this.uB;(this.gG==null||this.ww<n)&&((g=this.gG)==null||g.destroy(),this.ww=Math.max(n,4),this.gG=a.createBuffer({label:"LightClusterBuild.params",size:this.bw*this.ww,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.gw=void 0);let l=0;for(let e of i.views)l=Math.max(l,e.dataOffset+i.dataStride);if(this.dw==null||this.Pw<l){(b=this.dw)==null||b.destroy();let e=1;for(;e<l;)e*=2;this.Pw=e,this.dw=a.createBuffer({label:"LightClusterBuild.buildData",size:e*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.gw=void 0}a.queue.writeBuffer(this.dw,0,i.data.subarray(0,l)),(this.gw==null||this.vw!==t)&&(this.gw=a.createBindGroup({label:"LightClusterBuild",layout:this.yw,entries:[{binding:0,resource:{buffer:t}},{binding:1,resource:{buffer:this.gG,size:32}},{binding:2,resource:{buffer:this.dw}}]}),this.vw=t);let d=i.layout,f=d.clusterLightCapacity,m=Math.ceil(f/4),s=this.gB;for(let e=0;e<n;e++){let o=i.views[e];s[0]=o.viewVec4Base,s[1]=o.dataOffset,s[2]=o.dataOffset+i.localCapacity*4,s[3]=o.dataOffset+i.localCapacity*5,s[4]=o.localCount,s[5]=d.clusterCount,s[6]=m,s[7]=f,a.queue.writeBuffer(this.gG,e*this.bw,s)}let c=a.createCommandEncoder({label:"LightClusterBuild"}),p={label:"LightClusterBuild"},u=r==null?void 0:r.getTimestampWrites("LightClusterBuild");u!=null&&(p.timestampWrites=u);let h=c.beginComputePass(p),w=Math.ceil(d.clusterCount/64);for(let e=0;e<n;e++)h.setBindGroup(0,this.gw,[e*this.bw]),h.setPipeline(this.Bw),h.dispatchWorkgroups(w);h.end(),u!=null&&r.encodeResolve(c),a.queue.submit([c.finish()]),u!=null&&r.afterSubmit()}destroy(){var t,i;(t=this.gG)==null||t.destroy(),this.gG=void 0,(i=this.dw)==null||i.destroy(),this.dw=void 0,this.gw=void 0,this.vw=void 0}};export{y as WebGpuLightClusterBuilder};
|
|
1
|
+
import{lightClusterBuildWgsl as G}from"./WebGpuLightClusterShaders.js";var h=32,m=64,y=class{constructor(e){this.CP=0;this.xU=new Uint32Array(h/4);this.PP=0;this.yB=e,this.cP=Math.max(e.limits.minUniformBufferOffsetAlignment,h),this.bP=e.createBindGroupLayout({label:"LightClusterBuild",entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform",hasDynamicOffset:!0,minBindingSize:h}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]});let i=e.createPipelineLayout({bindGroupLayouts:[this.bP]}),r=e.createShaderModule({label:"LightClusterBuild",code:G});this.yP=e.createComputePipeline({label:"LightClusterBuild.buildClusters",layout:i,compute:{module:r,entryPoint:"buildClusters"}})}build(e,i,r){var g,C;let a=i.views.length;if(a===0)return;let u=this.yB;(this.kB==null||this.CP<a)&&((g=this.kB)==null||g.destroy(),this.CP=Math.max(a,4),this.kB=u.createBuffer({label:"LightClusterBuild.params",size:this.cP*this.CP,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.hP=void 0);let l=0;for(let t of i.views)l=Math.max(l,t.dataOffset+i.dataStride);if(this.lP==null||this.PP<l){(C=this.lP)==null||C.destroy();let t=1;for(;t<l;)t*=2;this.PP=t,this.lP=u.createBuffer({label:"LightClusterBuild.buildData",size:t*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.hP=void 0}u.queue.writeBuffer(this.lP,0,i.data.subarray(0,l)),(this.hP==null||this.xG!==e)&&(this.hP=u.createBindGroup({label:"LightClusterBuild",layout:this.bP,entries:[{binding:0,resource:{buffer:e}},{binding:1,resource:{buffer:this.kB,size:h}},{binding:2,resource:{buffer:this.lP}}]}),this.xG=e);let d=i.layout,p=d.clusterLightCapacity,P=Math.ceil(p/4),s=this.xU;for(let t=0;t<a;t++){let n=i.views[t];s[0]=n.viewVec4Base,s[1]=n.dataOffset,s[2]=n.dataOffset+i.localCapacity*4,s[3]=n.dataOffset+i.localCapacity*5,s[4]=n.localCount,s[5]=d.clusterCount,s[6]=P,s[7]=p,u.queue.writeBuffer(this.kB,t*this.cP,s)}let c=u.createCommandEncoder({label:"LightClusterBuild"}),b={label:"LightClusterBuild"},o=r==null?void 0:r.getTimestampWrites("LightClusterBuild");o!=null&&(b.timestampWrites=o);let f=c.beginComputePass(b),B=Math.ceil(d.clusterCount/m);for(let t=0;t<a;t++)f.setBindGroup(0,this.hP,[t*this.cP]),f.setPipeline(this.yP),f.dispatchWorkgroups(B);f.end(),o!=null&&r.encodeResolve(c),u.queue.submit([c.finish()]),o!=null&&r.afterSubmit()}destroy(){var e,i;(e=this.kB)==null||e.destroy(),this.kB=void 0,(i=this.lP)==null||i.destroy(),this.lP=void 0,this.hP=void 0,this.xG=void 0}};export{y as WebGpuLightClusterBuilder};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The WGSL of the light cluster build. It implements the assignment test documented in LightClusterBuilder.ts
|
|
3
|
+
* (`sphereIntersectsLightCluster`) and writes the same layout as `buildLightClustersOnCpu` (LightClusterLayout.ts).
|
|
4
|
+
*
|
|
5
|
+
* One dispatch per view, one invocation per cluster, no atomics:
|
|
6
|
+
* - The caller sorts the local lights by view depth (nearest first) and passes the range of the sorted lights whose
|
|
7
|
+
* sphere overlaps the depth slice of each cluster, so an invocation only tests the lights that can reach its slice.
|
|
8
|
+
* - Each cluster owns `entriesPerCluster` vec4s of the light index list and writes its nearest lights until it is full.
|
|
9
|
+
* The table entry of the cluster holds the vec4 offset of its list and its light count; the clusters of the same view
|
|
10
|
+
* do not share the list, so the shader reads it with the same table lookup as the CPU build.
|
|
11
|
+
* - Every invocation writes only whole vec4s that no other invocation of the dispatch accesses. Some backends store a
|
|
12
|
+
* vector component by rewriting the whole vector, so component writes to shared vec4s would lose data.
|
|
13
|
+
*/
|
|
14
|
+
export declare const lightClusterBuildWgsl = "\n// Per-view parameters (one uniform element per dispatched view, selected with a dynamic offset).\n// viewBase is a vec4 index of data (the GPU instance data); the other offsets are float indices of buildData.\nstruct Params {\n viewBase: u32, // vec4 index of the view header in data (the same value as lightClusterViewInfo.x)\n sphereBase: u32, // float index of the sorted spheres in buildData (cx, cy, cz, r per light)\n entryBase: u32, // float index of the sorted light entries in buildData (parallel to the spheres)\n rangeBase: u32, // float index of the per-slice light ranges in buildData (start, end per slice)\n localCount: u32, // the number of local lights (spheres/entries) of the view\n clusterCount: u32, // the number of clusters of the view (gridX * gridY * gridZ)\n entriesPerCluster: u32, // the number of vec4 of the light index list owned by each cluster\n capacity: u32, // the maximum number of lights stored in one cluster\n}\n\n// data is the GPU instance data (the storage buffer the shaders read). The view header, the cluster table and the\n// light index list are written here, at the offsets LightClusterLayout.ts defines for them.\n@group(0) @binding(0) var<storage, read_write> data: array<vec4<f32>>;\n@group(0) @binding(1) var<uniform> params: Params;\n// buildData is the build input of the view: it is separate from the GPU instance data because it is not needed by\n// the render shaders, is small, and is regenerated by the CPU whenever the lights or the camera move.\n@group(0) @binding(2) var<storage, read> buildData: array<f32>;\n\n// The view region layout: [header (6 vec4)][cluster table (clusterCount vec4)][light index list].\nfn tableBase() -> u32 {\n return params.viewBase + 6u;\n}\n\nfn indexBase() -> u32 {\n return params.viewBase + 6u + params.clusterCount;\n}\n\n// Whether the sphere (center, radius) is on the inner side of a tile border plane. The signed distance is compared\n// with -radius, so the sphere passes while it touches the plane.\n// The header rows are scaled by 0.5 * grid (see LightClusterBuilder.ts), so the plane is normalized here.\n// A degenerate plane passes, like in the CPU build.\nfn planePasses(plane: vec4<f32>, center: vec3<f32>, radius: f32) -> bool {\n let planeLength = length(plane.xyz);\n if (!(planeLength > 1e-30)) {\n return true;\n }\n return (dot(plane.xyz, center) + plane.w) / planeLength >= -radius;\n}\n\n@compute @workgroup_size(64)\nfn buildClusters(@builtin(global_invocation_id) id: vec3<u32>) {\n // One invocation per cluster. id.y and id.z are not used: the dispatch is 1D, so every workgroup covers 64\n // consecutive clusters and each invocation writes only its own cluster's table entry and list.\n let cluster = id.x;\n if (cluster >= params.clusterCount) {\n return;\n }\n // Decode the cluster index into (x, y, z). The layout is the same as in the CPU build and the shaders:\n // cluster = (z * gridY + y) * gridX + x.\n let base = params.viewBase;\n // Header (see LightClusterLayout.ts): the tile rows, the eye plane row, the depth row, the grid size and the\n // parameters of the logarithmic depth slices.\n let rowX = data[base];\n let rowY = data[base + 1u];\n let rowW = data[base + 2u];\n let rowDepth = data[base + 3u];\n let grid = data[base + 4u];\n let slice = data[base + 5u];\n let gridX = u32(grid.x);\n let gridY = u32(grid.y);\n let gridZ = u32(grid.z);\n let x = cluster % gridX;\n let y = (cluster / gridX) % gridY;\n let z = cluster / (gridX * gridY);\n let fx = f32(x);\n let fy = f32(y);\n let fz = f32(z);\n // The four border planes of this cluster: the left / bottom borders are row - k * rowW, the right / top\n // borders are the negated planes of the next row (tile k + 1). A border test is skipped for a cluster at the\n // border of the grid, because those clusters extend to infinity.\n let leftPlane = rowX - fx * rowW;\n let rightPlane = (fx + 1.0) * rowW - rowX;\n let bottomPlane = rowY - fy * rowW;\n let topPlane = (fy + 1.0) * rowW - rowY;\n // The depth range of this cluster's slice, from the same log mapping as the header:\n // slice(depth) = floor(log(depth) * sliceScale + sliceBias).\n let sliceNear = exp((fz - slice.y) / slice.x);\n let sliceFar = exp((fz + 1.0 - slice.y) / slice.x);\n let wLength = length(rowW.xyz);\n\n // Only the lights whose sphere reaches the depth range of this slice are tested: the CPU already computed those\n // ranges (LightClusterSystem.__prepareViewBuild) and the lights are sorted by view depth, so the range is a\n // contiguous part of the input.\n let rangeBase = params.rangeBase + z * 2u;\n let rangeStart = u32(buildData[rangeBase]);\n let rangeEnd = u32(buildData[rangeBase + 1u]);\n // The list of this cluster: its own fixed slot in the index list (no other invocation writes it, so the light\n // index list needs no atomics).\n let listBase = indexBase() + cluster * params.entriesPerCluster;\n\n // pending gathers 4 entries into one vec4 before storing it, because a vec4 store is the smallest unit this\n // shader may write (and other invocations must never observe a partially written vec4 of this list).\n var count = 0u;\n var pending = vec4<f32>(0.0);\n for (var i = rangeStart; i < rangeEnd; i = i + 1u) {\n // Stop at the capacity: because the lights are sorted nearest first, the lights that are dropped are the\n // farthest ones.\n if (count >= params.capacity) {\n break;\n }\n let sphereBase = params.sphereBase + i * 4u;\n let center = vec3<f32>(buildData[sphereBase], buildData[sphereBase + 1u], buildData[sphereBase + 2u]);\n let radius = buildData[sphereBase + 3u];\n // The tests below are the same as the light-centric tests of LightClusterBuilder.ts, evaluated for this\n // cluster; see the comment block at the top of that file for the reasoning.\n // entirely behind the eye plane (fragments there use the all-light list)\n if (wLength > 1e-30 && (dot(rowW.xyz, center) + rowW.w) / wLength <= -radius) {\n continue;\n }\n if (x > 0u && !planePasses(leftPlane, center, radius)) {\n continue;\n }\n if (x < gridX - 1u && !planePasses(rightPlane, center, radius)) {\n continue;\n }\n if (y > 0u && !planePasses(bottomPlane, center, radius)) {\n continue;\n }\n if (y < gridY - 1u && !planePasses(topPlane, center, radius)) {\n continue;\n }\n let depth = dot(rowDepth.xyz, center) + rowDepth.w;\n if (z > 0u && depth + radius < sliceNear) {\n continue;\n }\n if (z < gridZ - 1u && depth - radius > sliceFar) {\n continue;\n }\n // Append the entry of the light to the list. The light is accepted, so it is one of the nearest capacity\n // lights (the input is sorted by depth).\n pending[count & 3u] = buildData[params.entryBase + i];\n if ((count & 3u) == 3u) {\n // The vec4 is full: store it, and start a new one (its unused components are zero, which is the padding\n // the CPU build also writes).\n data[listBase + (count >> 2u)] = pending;\n pending = vec4<f32>(0.0);\n }\n count++;\n }\n // Store the last partial vec4 (if any).\n if ((count & 3u) != 0u) {\n data[listBase + (count >> 2u)] = pending;\n }\n // The table entry of the cluster: (vec4 offset of its list from the index list start, light count, 0, 0).\n // The offset is fixed (cluster * entriesPerCluster), unlike the dense packing of the CPU build, so the shaders\n // use the same table lookup for both builds.\n data[tableBase() + cluster] = vec4<f32>(f32(cluster * params.entriesPerCluster), f32(count), 0.0, 0.0);\n}\n";
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var e=`
|
|
2
|
+
// Per-view parameters (one uniform element per dispatched view, selected with a dynamic offset).
|
|
3
|
+
// viewBase is a vec4 index of data (the GPU instance data); the other offsets are float indices of buildData.
|
|
4
|
+
struct Params {
|
|
5
|
+
viewBase: u32, // vec4 index of the view header in data (the same value as lightClusterViewInfo.x)
|
|
6
|
+
sphereBase: u32, // float index of the sorted spheres in buildData (cx, cy, cz, r per light)
|
|
7
|
+
entryBase: u32, // float index of the sorted light entries in buildData (parallel to the spheres)
|
|
8
|
+
rangeBase: u32, // float index of the per-slice light ranges in buildData (start, end per slice)
|
|
9
|
+
localCount: u32, // the number of local lights (spheres/entries) of the view
|
|
10
|
+
clusterCount: u32, // the number of clusters of the view (gridX * gridY * gridZ)
|
|
11
|
+
entriesPerCluster: u32, // the number of vec4 of the light index list owned by each cluster
|
|
12
|
+
capacity: u32, // the maximum number of lights stored in one cluster
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// data is the GPU instance data (the storage buffer the shaders read). The view header, the cluster table and the
|
|
16
|
+
// light index list are written here, at the offsets LightClusterLayout.ts defines for them.
|
|
17
|
+
@group(0) @binding(0) var<storage, read_write> data: array<vec4<f32>>;
|
|
18
|
+
@group(0) @binding(1) var<uniform> params: Params;
|
|
19
|
+
// buildData is the build input of the view: it is separate from the GPU instance data because it is not needed by
|
|
20
|
+
// the render shaders, is small, and is regenerated by the CPU whenever the lights or the camera move.
|
|
21
|
+
@group(0) @binding(2) var<storage, read> buildData: array<f32>;
|
|
22
|
+
|
|
23
|
+
// The view region layout: [header (6 vec4)][cluster table (clusterCount vec4)][light index list].
|
|
24
|
+
fn tableBase() -> u32 {
|
|
25
|
+
return params.viewBase + 6u;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fn indexBase() -> u32 {
|
|
29
|
+
return params.viewBase + 6u + params.clusterCount;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Whether the sphere (center, radius) is on the inner side of a tile border plane. The signed distance is compared
|
|
33
|
+
// with -radius, so the sphere passes while it touches the plane.
|
|
34
|
+
// The header rows are scaled by 0.5 * grid (see LightClusterBuilder.ts), so the plane is normalized here.
|
|
35
|
+
// A degenerate plane passes, like in the CPU build.
|
|
36
|
+
fn planePasses(plane: vec4<f32>, center: vec3<f32>, radius: f32) -> bool {
|
|
37
|
+
let planeLength = length(plane.xyz);
|
|
38
|
+
if (!(planeLength > 1e-30)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return (dot(plane.xyz, center) + plane.w) / planeLength >= -radius;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@compute @workgroup_size(64)
|
|
45
|
+
fn buildClusters(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
46
|
+
// One invocation per cluster. id.y and id.z are not used: the dispatch is 1D, so every workgroup covers 64
|
|
47
|
+
// consecutive clusters and each invocation writes only its own cluster's table entry and list.
|
|
48
|
+
let cluster = id.x;
|
|
49
|
+
if (cluster >= params.clusterCount) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Decode the cluster index into (x, y, z). The layout is the same as in the CPU build and the shaders:
|
|
53
|
+
// cluster = (z * gridY + y) * gridX + x.
|
|
54
|
+
let base = params.viewBase;
|
|
55
|
+
// Header (see LightClusterLayout.ts): the tile rows, the eye plane row, the depth row, the grid size and the
|
|
56
|
+
// parameters of the logarithmic depth slices.
|
|
57
|
+
let rowX = data[base];
|
|
58
|
+
let rowY = data[base + 1u];
|
|
59
|
+
let rowW = data[base + 2u];
|
|
60
|
+
let rowDepth = data[base + 3u];
|
|
61
|
+
let grid = data[base + 4u];
|
|
62
|
+
let slice = data[base + 5u];
|
|
63
|
+
let gridX = u32(grid.x);
|
|
64
|
+
let gridY = u32(grid.y);
|
|
65
|
+
let gridZ = u32(grid.z);
|
|
66
|
+
let x = cluster % gridX;
|
|
67
|
+
let y = (cluster / gridX) % gridY;
|
|
68
|
+
let z = cluster / (gridX * gridY);
|
|
69
|
+
let fx = f32(x);
|
|
70
|
+
let fy = f32(y);
|
|
71
|
+
let fz = f32(z);
|
|
72
|
+
// The four border planes of this cluster: the left / bottom borders are row - k * rowW, the right / top
|
|
73
|
+
// borders are the negated planes of the next row (tile k + 1). A border test is skipped for a cluster at the
|
|
74
|
+
// border of the grid, because those clusters extend to infinity.
|
|
75
|
+
let leftPlane = rowX - fx * rowW;
|
|
76
|
+
let rightPlane = (fx + 1.0) * rowW - rowX;
|
|
77
|
+
let bottomPlane = rowY - fy * rowW;
|
|
78
|
+
let topPlane = (fy + 1.0) * rowW - rowY;
|
|
79
|
+
// The depth range of this cluster's slice, from the same log mapping as the header:
|
|
80
|
+
// slice(depth) = floor(log(depth) * sliceScale + sliceBias).
|
|
81
|
+
let sliceNear = exp((fz - slice.y) / slice.x);
|
|
82
|
+
let sliceFar = exp((fz + 1.0 - slice.y) / slice.x);
|
|
83
|
+
let wLength = length(rowW.xyz);
|
|
84
|
+
|
|
85
|
+
// Only the lights whose sphere reaches the depth range of this slice are tested: the CPU already computed those
|
|
86
|
+
// ranges (LightClusterSystem.__prepareViewBuild) and the lights are sorted by view depth, so the range is a
|
|
87
|
+
// contiguous part of the input.
|
|
88
|
+
let rangeBase = params.rangeBase + z * 2u;
|
|
89
|
+
let rangeStart = u32(buildData[rangeBase]);
|
|
90
|
+
let rangeEnd = u32(buildData[rangeBase + 1u]);
|
|
91
|
+
// The list of this cluster: its own fixed slot in the index list (no other invocation writes it, so the light
|
|
92
|
+
// index list needs no atomics).
|
|
93
|
+
let listBase = indexBase() + cluster * params.entriesPerCluster;
|
|
94
|
+
|
|
95
|
+
// pending gathers 4 entries into one vec4 before storing it, because a vec4 store is the smallest unit this
|
|
96
|
+
// shader may write (and other invocations must never observe a partially written vec4 of this list).
|
|
97
|
+
var count = 0u;
|
|
98
|
+
var pending = vec4<f32>(0.0);
|
|
99
|
+
for (var i = rangeStart; i < rangeEnd; i = i + 1u) {
|
|
100
|
+
// Stop at the capacity: because the lights are sorted nearest first, the lights that are dropped are the
|
|
101
|
+
// farthest ones.
|
|
102
|
+
if (count >= params.capacity) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
let sphereBase = params.sphereBase + i * 4u;
|
|
106
|
+
let center = vec3<f32>(buildData[sphereBase], buildData[sphereBase + 1u], buildData[sphereBase + 2u]);
|
|
107
|
+
let radius = buildData[sphereBase + 3u];
|
|
108
|
+
// The tests below are the same as the light-centric tests of LightClusterBuilder.ts, evaluated for this
|
|
109
|
+
// cluster; see the comment block at the top of that file for the reasoning.
|
|
110
|
+
// entirely behind the eye plane (fragments there use the all-light list)
|
|
111
|
+
if (wLength > 1e-30 && (dot(rowW.xyz, center) + rowW.w) / wLength <= -radius) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (x > 0u && !planePasses(leftPlane, center, radius)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (x < gridX - 1u && !planePasses(rightPlane, center, radius)) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (y > 0u && !planePasses(bottomPlane, center, radius)) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (y < gridY - 1u && !planePasses(topPlane, center, radius)) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
let depth = dot(rowDepth.xyz, center) + rowDepth.w;
|
|
127
|
+
if (z > 0u && depth + radius < sliceNear) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (z < gridZ - 1u && depth - radius > sliceFar) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
// Append the entry of the light to the list. The light is accepted, so it is one of the nearest capacity
|
|
134
|
+
// lights (the input is sorted by depth).
|
|
135
|
+
pending[count & 3u] = buildData[params.entryBase + i];
|
|
136
|
+
if ((count & 3u) == 3u) {
|
|
137
|
+
// The vec4 is full: store it, and start a new one (its unused components are zero, which is the padding
|
|
138
|
+
// the CPU build also writes).
|
|
139
|
+
data[listBase + (count >> 2u)] = pending;
|
|
140
|
+
pending = vec4<f32>(0.0);
|
|
141
|
+
}
|
|
142
|
+
count++;
|
|
143
|
+
}
|
|
144
|
+
// Store the last partial vec4 (if any).
|
|
145
|
+
if ((count & 3u) != 0u) {
|
|
146
|
+
data[listBase + (count >> 2u)] = pending;
|
|
147
|
+
}
|
|
148
|
+
// The table entry of the cluster: (vec4 offset of its list from the index list start, light count, 0, 0).
|
|
149
|
+
// The offset is fixed (cluster * entriesPerCluster), unlike the dense packing of the CPU build, so the shaders
|
|
150
|
+
// use the same table lookup for both builds.
|
|
151
|
+
data[tableBase() + cluster] = vec4<f32>(f32(cluster * params.entriesPerCluster), f32(count), 0.0, 0.0);
|
|
152
|
+
}
|
|
153
|
+
`;export{e as lightClusterBuildWgsl};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { WebGpuDeviceWrapper } from './WebGpuDeviceWrapper';
|
|
2
|
+
/**
|
|
3
|
+
* What `WebGpuMipmapGenerator` needs from the resource repository that owns it.
|
|
4
|
+
*/
|
|
5
|
+
export interface WebGpuMipmapGeneratorResources {
|
|
6
|
+
/** The device wrapper, which is set when the repository is given a device. */
|
|
7
|
+
getDeviceWrapper(): WebGpuDeviceWrapper | undefined;
|
|
8
|
+
/** Ends the open render pass and encodes a pending clear, so that passes can be recorded on the encoder. */
|
|
9
|
+
flushRenderPassWork(): void;
|
|
10
|
+
/** The command encoder of the current frame, on which the mipmap passes are recorded. */
|
|
11
|
+
getCommandEncoder(): GPUCommandEncoder | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generates the mip levels of 2D and cube textures with render passes, and caches the pipeline, the per-texture
|
|
15
|
+
* views and the bind groups that it uses.
|
|
16
|
+
*
|
|
17
|
+
* Owned by `WebGpuResourceRepository`, which exposes this through its public methods and calls `forgetTexture`
|
|
18
|
+
* when a texture is deleted.
|
|
19
|
+
*/
|
|
20
|
+
export declare class WebGpuMipmapGenerator {
|
|
21
|
+
private __resources;
|
|
22
|
+
private __generateMipmapsShaderModule?;
|
|
23
|
+
/** One pipeline per render target format. They share the bind group layout and the pipeline layout. */
|
|
24
|
+
private __generateMipmapsPipelines;
|
|
25
|
+
private __generateMipmapsSampler?;
|
|
26
|
+
private __generateMipmapsBindGroupLayout?;
|
|
27
|
+
private __generateMipmapsPipelineLayout?;
|
|
28
|
+
private __srcTextureViewsForGeneratingMipmaps;
|
|
29
|
+
private __dstTextureViewsForGeneratingMipmaps;
|
|
30
|
+
private __bindGroupsForGeneratingMipmaps;
|
|
31
|
+
constructor(resources: WebGpuMipmapGeneratorResources);
|
|
32
|
+
private get __webGpuDeviceWrapper();
|
|
33
|
+
private get __commandEncoder();
|
|
34
|
+
private __flushRenderPassWork;
|
|
35
|
+
/**
|
|
36
|
+
* Generates mipmaps for a texture using render passes (including CubeMap support).
|
|
37
|
+
* This is an optimized method adapted from WebGPU best practices that uses
|
|
38
|
+
* a custom shader to generate each mipmap level from the previous one.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* Adapted from: https://toji.dev/webgpu-best-practices/img-textures#generating-mipmaps
|
|
42
|
+
*
|
|
43
|
+
* The levels and the format are those of the texture itself, so a texture allocated with a single level is left
|
|
44
|
+
* unchanged (as `gl.generateMipmap` does in WebGL), instead of creating views of levels it does not have.
|
|
45
|
+
*
|
|
46
|
+
* @param texture - The GPU texture to generate mipmaps for
|
|
47
|
+
*/
|
|
48
|
+
generateMipmaps(texture: GPUTexture): void;
|
|
49
|
+
/**
|
|
50
|
+
* Drops the views and bind groups cached for a texture. Called when the texture is deleted.
|
|
51
|
+
* @param texture - The deleted texture
|
|
52
|
+
*/
|
|
53
|
+
forgetTexture(texture: GPUTexture): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mipmapShaderWgsl as G}from"./WebGpuMipmapShaders.js";var c=class{constructor(e){this.WP=new Map;this.MP=new Map;this.mP=new Map;this.GP=new Map;this.x_=e}get yG(){return this.x_.getDeviceWrapper()}get vW(){return this.x_.getCommandEncoder()}AP(){this.x_.flushRenderPassWork()}generateMipmaps(e){let d=e.mipLevelCount;if(d<=1)return;let r=this.yG.gpuDevice;this.UP==null&&(this.UP=r.createShaderModule({code:G})),this.wP==null&&(this.wP=r.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{viewDimension:"2d"}}]}),this.TP=r.createPipelineLayout({bindGroupLayouts:[this.wP]}));let n=this.WP.get(e.format);n==null&&(n=r.createRenderPipeline({layout:this.TP,vertex:{module:this.UP,entryPoint:"vertexMain"},fragment:{module:this.UP,entryPoint:"fragmentMain",targets:[{format:e.format}]},primitive:{topology:"triangle-strip",stripIndexFormat:"uint32"}}),this.WP.set(e.format,n)),this.LP==null&&(this.LP=r.createSampler({minFilter:"linear"})),this.AP();let m=e.dimension==="2d"&&e.depthOrArrayLayers===6?6:1;for(let i=0;i<m;++i){let p=this.MP.get(e);if(p==null||p[i]==null){let t=e.createView({dimension:"2d",baseMipLevel:0,mipLevelCount:1,baseArrayLayer:i,arrayLayerCount:1});p==null&&this.MP.set(e,[]),this.MP.get(e)[i]=t}let u=this.MP.get(e)[i];for(let t=1;t<d;++t){let s=this.mP.get(e);if(s==null||s[i]==null||s[i][t]==null){let l=e.createView({dimension:"2d",baseMipLevel:t,mipLevelCount:1,baseArrayLayer:i,arrayLayerCount:1});s==null&&this.mP.set(e,[]),this.mP.get(e)[i]==null&&(this.mP.get(e)[i]=[]),this.mP.get(e)[i][t]=l}let h=this.mP.get(e)[i][t],a=this.vW.beginRenderPass({colorAttachments:[{view:h,loadOp:"load",storeOp:"store"}]}),o=this.GP.get(e);if(o==null||o[i]==null||o[i][t]==null){let l=r.createBindGroup({layout:this.wP,entries:[{binding:0,resource:this.LP},{binding:1,resource:u}]});o==null&&this.GP.set(e,[]),this.GP.get(e)[i]==null&&(this.GP.get(e)[i]=[]),this.GP.get(e)[i][t]=l}let g=this.GP.get(e)[i][t];a.setPipeline(n),a.setBindGroup(0,g),a.draw(4),a.end(),u=h}}}forgetTexture(e){this.MP.delete(e),this.mP.delete(e),this.GP.delete(e)}};export{c as WebGpuMipmapGenerator};
|