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,263 @@
|
|
|
1
|
+
import { RaymarchingComponent } from '../../components/Raymarching/RaymarchingComponent';
|
|
2
|
+
import type { RaymarchingShadowPassProvider, ShadowSystem } from '../../helpers/Shadow/ShadowSystem';
|
|
3
|
+
import type { Material } from '../../materials/core/Material';
|
|
4
|
+
import { Vector3 } from '../../math/Vector3';
|
|
5
|
+
import type { Engine } from '../../system/Engine';
|
|
6
|
+
import type { AbstractTexture } from '../../textures/AbstractTexture';
|
|
7
|
+
import type { CubeTexture } from '../../textures/CubeTexture';
|
|
8
|
+
import type { Sampler } from '../../textures/Sampler';
|
|
9
|
+
import { Expression } from '../Expression';
|
|
10
|
+
import { RenderPass } from '../RenderPass';
|
|
11
|
+
/** Cached world AABB of one SDF component (invalidated by version or world matrix). */
|
|
12
|
+
export type RaymarchingAabb = {
|
|
13
|
+
min: Vector3;
|
|
14
|
+
max: Vector3;
|
|
15
|
+
};
|
|
16
|
+
/** The IBL environment of the pipeline, applied to the raymarching PBR materials. */
|
|
17
|
+
export type RaymarchingIblEnvironment = {
|
|
18
|
+
diffuse?: CubeTexture;
|
|
19
|
+
specular?: CubeTexture;
|
|
20
|
+
sheen?: CubeTexture;
|
|
21
|
+
rotation: number;
|
|
22
|
+
diffuseContribution: number;
|
|
23
|
+
specularContribution: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The pipeline state that the raymarching renderer reads. {@link ForwardRenderPipeline} implements it.
|
|
27
|
+
*/
|
|
28
|
+
export interface RaymarchingRendererHost {
|
|
29
|
+
/** Size of the main render target in pixels, used for the scissor rectangles of the SDFs. */
|
|
30
|
+
getRenderTargetSize(): {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
};
|
|
34
|
+
/** The shadow system, if shadows are enabled. */
|
|
35
|
+
getShadowSystem(): ShadowSystem | undefined;
|
|
36
|
+
/** Points a buffer-less full-screen pass at the pipeline's main render targets. */
|
|
37
|
+
configurePassTargets(renderPass: RenderPass): void;
|
|
38
|
+
/** The current IBL environment. */
|
|
39
|
+
getIblEnvironment(): RaymarchingIblEnvironment;
|
|
40
|
+
/** The resolved scene color that transmission samples, or undefined if there is none. */
|
|
41
|
+
getBackBuffer(): {
|
|
42
|
+
texture: AbstractTexture;
|
|
43
|
+
sampler: Sampler;
|
|
44
|
+
} | undefined;
|
|
45
|
+
/** Rebuilds the frame's expression order, if the pipeline is set up. */
|
|
46
|
+
requestExpressionRebuild(): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Renders the raymarching (SDF) objects for {@link ForwardRenderPipeline}.
|
|
50
|
+
*
|
|
51
|
+
* It owns the raymarching materials (one per component, or the legacy merged material),
|
|
52
|
+
* their buffer-less full-screen passes, the SDF shadow caster materials and passes that
|
|
53
|
+
* the ShadowSystem renders, and the per-frame updates of all of them (world matrices,
|
|
54
|
+
* AABB clipping, scissor rectangles, IBL and back buffer bindings, shadow parameters).
|
|
55
|
+
* The pipeline decides where its expression runs in the frame.
|
|
56
|
+
*/
|
|
57
|
+
export declare class RaymarchingRenderer {
|
|
58
|
+
private __engine;
|
|
59
|
+
private __host;
|
|
60
|
+
/** IBL state already applied to each material (by material object UID). */
|
|
61
|
+
private __iblStates;
|
|
62
|
+
/** Per-component raymarching materials and their buffer-less full-screen passes. */
|
|
63
|
+
private __componentMaterials;
|
|
64
|
+
private __componentPasses;
|
|
65
|
+
/** SID of the first per-component pass (it applies the per-frame shared material setup). */
|
|
66
|
+
private __firstComponentPassSID;
|
|
67
|
+
/** Cached world AABBs of the SDFs, used for ray interval clipping and scissors. */
|
|
68
|
+
private __aabbCache;
|
|
69
|
+
private __expression?;
|
|
70
|
+
/** The pass of the legacy merged material. */
|
|
71
|
+
private __legacyRenderPass?;
|
|
72
|
+
/** The merged SDF graph of the shadow-casting components. */
|
|
73
|
+
private __shadowJson?;
|
|
74
|
+
private __shadowRegularMaterial?;
|
|
75
|
+
/** Point light paraboloid shadow materials, one front/back pair per shadow slot. */
|
|
76
|
+
private __shadowPointSlots;
|
|
77
|
+
/** Whether the SDF shadow casters are split per component (mirrors the visible materials). */
|
|
78
|
+
private __isComponentShadowMode;
|
|
79
|
+
/** Per-component regular (spot / directional) SDF shadow caster materials. */
|
|
80
|
+
private __componentShadowRegularMaterials;
|
|
81
|
+
/** Per shadow slot, per component paraboloid front/back SDF shadow caster materials. */
|
|
82
|
+
private __componentShadowPointSlots;
|
|
83
|
+
constructor(engine: Engine, host: RaymarchingRendererHost);
|
|
84
|
+
/**
|
|
85
|
+
* Drops the passes and shadow caster materials that reference the pipeline's render targets
|
|
86
|
+
* and shadow maps, when the pipeline destroys its resources. The visible materials are kept:
|
|
87
|
+
* the component materials stay assigned, and the pipeline reassigns the legacy material.
|
|
88
|
+
*/
|
|
89
|
+
resetResources(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Creates the legacy merged raymarching pass for the pipeline's current render targets.
|
|
92
|
+
* The new pass has no material: the pipeline reassigns it with {@link setLegacyMaterial}
|
|
93
|
+
* after a resize.
|
|
94
|
+
*/
|
|
95
|
+
setupLegacyPass(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Per-frame setup of the legacy merged raymarching pass.
|
|
98
|
+
*
|
|
99
|
+
* The merged material evaluates every component's graph in one distance function,
|
|
100
|
+
* so the object id and world matrix uniforms are postfixed with the component SID,
|
|
101
|
+
* and the march is clipped to the union of all component AABBs.
|
|
102
|
+
*
|
|
103
|
+
* @param renderPass - The legacy raymarching pass
|
|
104
|
+
*/
|
|
105
|
+
private __prepareLegacyPass;
|
|
106
|
+
/** Implements {@link ForwardRenderPipeline.setRaymarchingMaterial}. */
|
|
107
|
+
setLegacyMaterial(material: Material): void;
|
|
108
|
+
/** Implements {@link ForwardRenderPipeline.getRaymarchingMaterial}. */
|
|
109
|
+
getLegacyMaterial(): Material | undefined;
|
|
110
|
+
/** Implements {@link ForwardRenderPipeline.setRaymarchingComponentMaterial}. */
|
|
111
|
+
setComponentMaterial(component: RaymarchingComponent, material: Material): void;
|
|
112
|
+
/** Implements {@link ForwardRenderPipeline.getRaymarchingComponentMaterial}. */
|
|
113
|
+
getComponentMaterial(component: RaymarchingComponent): Material | undefined;
|
|
114
|
+
/** Implements {@link ForwardRenderPipeline.removeRaymarchingComponentMaterial}. */
|
|
115
|
+
removeComponentMaterial(component: RaymarchingComponent): void;
|
|
116
|
+
/** All raymarching materials the pipeline manages (legacy or per component). */
|
|
117
|
+
getAllMaterials(): Material[];
|
|
118
|
+
/**
|
|
119
|
+
* Whether a raymarching material shades with transmission, which means it
|
|
120
|
+
* samples the scene color behind the SDF.
|
|
121
|
+
*
|
|
122
|
+
* Only then does the raymarching expression have to run after the opaque
|
|
123
|
+
* expressions. Without transmission it keeps its legacy position before them,
|
|
124
|
+
* so blended meshes that are drawn in the opaque expression (the pipeline may be
|
|
125
|
+
* configured with isTransmission: false) keep blending over the SDF.
|
|
126
|
+
*/
|
|
127
|
+
isTransmissionEnabled(): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Builds the raymarching expression from the current materials.
|
|
130
|
+
*
|
|
131
|
+
* With per-component materials, the expression contains one buffer-less pass per
|
|
132
|
+
* component (component SID order), composited by the depth test. Otherwise the
|
|
133
|
+
* legacy merged pass is used. The expression is empty while no raymarching material
|
|
134
|
+
* is assigned.
|
|
135
|
+
*/
|
|
136
|
+
buildExpression(): Expression;
|
|
137
|
+
/**
|
|
138
|
+
* Creates or updates the buffer-less render pass of each component that owns a
|
|
139
|
+
* raymarching material, in component SID order. Components without a material are
|
|
140
|
+
* skipped, and stale passes are dropped.
|
|
141
|
+
*/
|
|
142
|
+
private __getComponentPasses;
|
|
143
|
+
/**
|
|
144
|
+
* Per-frame setup of one component's raymarching pass: its world matrix, the world
|
|
145
|
+
* AABB used for ray interval clipping, and the scissor rectangle on the screen.
|
|
146
|
+
*
|
|
147
|
+
* The world matrix and the AABB are sampled together so the clip interval matches
|
|
148
|
+
* the transform the shader uses, including on backends that upload material values
|
|
149
|
+
* one frame later.
|
|
150
|
+
*
|
|
151
|
+
* @param componentSID - The SID of the component rendered by the pass
|
|
152
|
+
*/
|
|
153
|
+
private __prepareComponentPass;
|
|
154
|
+
/**
|
|
155
|
+
* Returns the conservative world AABB of a component's SDF, caching it until the
|
|
156
|
+
* component's AABB version or world matrix changes.
|
|
157
|
+
*
|
|
158
|
+
* @param component - The SDF component
|
|
159
|
+
*
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
_getCachedAabb(component: RaymarchingComponent): RaymarchingAabb | null;
|
|
163
|
+
/**
|
|
164
|
+
* Projects a world AABB to a screen-space scissor rectangle.
|
|
165
|
+
*
|
|
166
|
+
* Returns undefined (render the whole target) when the bounds are unbounded or
|
|
167
|
+
* when any corner is behind the camera, where a naive projection is invalid.
|
|
168
|
+
*
|
|
169
|
+
* @param aabb - The world AABB of the SDF
|
|
170
|
+
*
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
_calcScissorRect(aabb: RaymarchingAabb | null): {
|
|
174
|
+
x: number;
|
|
175
|
+
y: number;
|
|
176
|
+
width: number;
|
|
177
|
+
height: number;
|
|
178
|
+
} | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* The raymarching components in a deterministic (component SID) order.
|
|
181
|
+
*/
|
|
182
|
+
private __getSortedComponents;
|
|
183
|
+
/**
|
|
184
|
+
* Applies the pipeline's IBL environment to every raymarching PBR material.
|
|
185
|
+
*
|
|
186
|
+
* The raymarching draw is buffer-less and has no mesh renderer component, so
|
|
187
|
+
* the IBL parameters that material contents normally read from the mesh
|
|
188
|
+
* renderer are set on the material here instead.
|
|
189
|
+
*/
|
|
190
|
+
applyIbl(): void;
|
|
191
|
+
/**
|
|
192
|
+
* Applies the pipeline's IBL environment to one raymarching material.
|
|
193
|
+
* @param material - The raymarching material
|
|
194
|
+
*/
|
|
195
|
+
private __applyIblToMaterial;
|
|
196
|
+
/**
|
|
197
|
+
* Binds the resolved scene color to every raymarching material for transmission.
|
|
198
|
+
*
|
|
199
|
+
* This is the same reference texture the transmission materials of the transparent
|
|
200
|
+
* pass sample. The raymarching expression is rendered after the opaque expressions,
|
|
201
|
+
* so the texture holds the current frame. Materials without the semantic ignore the
|
|
202
|
+
* call, and an identical binding is a no-op, so this is safe to run every frame.
|
|
203
|
+
*/
|
|
204
|
+
private __applyBackBufferTexture;
|
|
205
|
+
/** Implements {@link ForwardRenderPipeline.refreshRaymarchingShadowMaterial}. */
|
|
206
|
+
refreshShadowMaterials(): void;
|
|
207
|
+
/** Implements {@link ForwardRenderPipeline.getRaymarchingShadowMaterial}. */
|
|
208
|
+
getShadowMaterial(): Material | undefined;
|
|
209
|
+
/** Implements {@link ForwardRenderPipeline.getRaymarchingComponentShadowMaterial}. */
|
|
210
|
+
getComponentShadowMaterial(component: RaymarchingComponent): Material | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Provider of the SDF shadow caster passes handed to the ShadowSystem.
|
|
213
|
+
*/
|
|
214
|
+
getShadowPassProvider(): RaymarchingShadowPassProvider;
|
|
215
|
+
/**
|
|
216
|
+
* Returns the paraboloid shadow caster material pair for a shadow slot, creating it on
|
|
217
|
+
* first use. A pair per slot is needed because the light index and the far plane are
|
|
218
|
+
* material parameters, which WebGPU uploads once per frame.
|
|
219
|
+
*/
|
|
220
|
+
private __getShadowPointMaterials;
|
|
221
|
+
private __setShadowPointFarPlane;
|
|
222
|
+
/**
|
|
223
|
+
* Returns the paraboloid caster material pair of one component for a shadow slot,
|
|
224
|
+
* creating it on first use.
|
|
225
|
+
*
|
|
226
|
+
* @param shadowSlot - The shadow slot of the point light
|
|
227
|
+
* @param lightComponentSID - The light component SID stored as `lightIndex`
|
|
228
|
+
* @param farPlane - The far plane of the point light shadow
|
|
229
|
+
* @param component - The SDF component rendered into the shadow map
|
|
230
|
+
*/
|
|
231
|
+
private __getComponentShadowPointMaterials;
|
|
232
|
+
private __updateShadowPointFarPlane;
|
|
233
|
+
private __createShadowPasses;
|
|
234
|
+
/**
|
|
235
|
+
* Creates one buffer-less SDF shadow caster pass with the given material.
|
|
236
|
+
*
|
|
237
|
+
* @param material - The component's (or merged) shadow caster material
|
|
238
|
+
* @param params - The shadow map variant request
|
|
239
|
+
*/
|
|
240
|
+
private __createShadowPass;
|
|
241
|
+
/**
|
|
242
|
+
* Copies the graph parameters (uniform values, textures) and the current transforms
|
|
243
|
+
* from the visible raymarching materials to the SDF shadow caster materials.
|
|
244
|
+
*
|
|
245
|
+
* With per-component visible materials, each component's caster materials are its
|
|
246
|
+
* own (same semantic names, no postfixing): their uniforms/textures are copied from
|
|
247
|
+
* that component's visible material and the component's world matrix is set on them.
|
|
248
|
+
* Otherwise the legacy merged casters are fed from the merged visible material.
|
|
249
|
+
*
|
|
250
|
+
* This runs once per frame BEFORE Engine.process: WebGPU uploads material values in the
|
|
251
|
+
* prerender stage, so updating them only in a render pass hook would leave the shadow
|
|
252
|
+
* passes one frame behind. setParameter / setTextureParameter return early for identical
|
|
253
|
+
* values, so the copy is cheap.
|
|
254
|
+
*/
|
|
255
|
+
syncShadowMaterialParameters(): void;
|
|
256
|
+
/**
|
|
257
|
+
* Per-component variant of the shadow caster parameter sync: copies each component's
|
|
258
|
+
* visible uniforms/textures to its own caster materials (their names match) and sets
|
|
259
|
+
* the component's world matrix and world AABB, which the shadow shader uses for the
|
|
260
|
+
* distance scale and the ray interval.
|
|
261
|
+
*/
|
|
262
|
+
private __syncComponentShadowMaterialParameters;
|
|
263
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CameraComponent as V}from"../../components/Camera/CameraComponent.js";import{RaymarchingComponent as P}from"../../components/Raymarching/RaymarchingComponent.js";import{CompositionType as v}from"../../definitions/index.js";import{ShaderSemantics as S}from"../../definitions/ShaderSemantics.js";import{collectRrnJson as O,createNodeBasedRaymarchingComponentShadowMaterial as w,createNodeBasedRaymarchingShadowMaterial as A,RAYMARCHING_COMPONENT_WORLD_MATRIX_SEMANTIC as E}from"../../helpers/materials/createNodeBasedRaymarchingMaterials.js";import{Scalar as N}from"../../math/Scalar.js";import{Vector2 as z}from"../../math/Vector2.js";import{Vector3 as I}from"../../math/Vector3.js";import{Vector4 as k}from"../../math/Vector4.js";import{Expression as B}from"../Expression.js";import{RenderPass as _}from"../RenderPass.js";var R=Object.freeze(I.fromCopy3(-1e20,-1e20,-1e20)),C=Object.freeze(I.fromCopy3(1e20,1e20,1e20)),Y=class{constructor(e,t){this.dM=new Map;this.tM=new Map;this.iM=new Map;this.bM=-1;this.hM=new Map;this.mM=new Map;this.lM=!1;this.aM=new Map;this.cM=new Map;this.i=e,this.rM=t}resetResources(){this.pT=void 0,this.oM=void 0,this.nM=void 0,this.mM.clear(),this.lM=!1,this.aM.clear(),this.cM.clear(),this.iM.clear(),this.hM.clear(),this.dM.clear()}setupLegacyPass(){let e=new B;e.tryToSetUniqueName("Raymarching",!0);let t=new _(this.i);t.toClearDepthBuffer=!1,t.isDepthTest=!0,this.rM.configurePassTargets(t),t.setPreRenderFunction(()=>this.yM(t)),e.addRenderPasses([t]),t.tryToSetUniqueName("Raymarching",!0),this.pT=e,this.sM=t}yM(e){this.applyIbl(),this.uM();let t=e.material;if(t==null)return;let r=this.i.componentRepository.getComponentsWithType(P),a=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY,c=r.length>0;for(let u of r){let b=u.entity.tryToGetSceneGraph();b!=null&&(t.setParameter(`worldMatrix_${u.componentSID}`,b.matrixInner),t.setParameter(`raymarchObjectId_${u.componentSID}`,N.fromCopyNumber(u.componentSID)));let f=this._getCachedAabb(u);if(f==null){c=!1;continue}a=Math.min(a,f.min.x),n=Math.min(n,f.min.y),i=Math.min(i,f.min.z),s=Math.max(s,f.max.x),o=Math.max(o,f.max.y),h=Math.max(h,f.max.z)}c?(t.setParameter("raymarchAabbMin",I.fromCopy3(a,n,i)),t.setParameter("raymarchAabbMax",I.fromCopy3(s,o,h))):(t.setParameter("raymarchAabbMin",R),t.setParameter("raymarchAabbMax",C))}setLegacyMaterial(e){var t,r;(t=this.sM)==null||t.setBufferLessFullScreenRendering(e),this.applyIbl(),this.uM(),(r=this.rM.getShadowSystem())==null||r.applyShadowParametersToMaterials([e]),this.refreshShadowMaterials(),this.rM.requestExpressionRebuild()}getLegacyMaterial(){var e;return(e=this.sM)==null?void 0:e.material}setComponentMaterial(e,t){var r;this.tM.set(e.componentSID,t),this.applyIbl(),this.uM(),(r=this.rM.getShadowSystem())==null||r.applyShadowParametersToMaterials([t]),this.refreshShadowMaterials(),this.rM.requestExpressionRebuild()}getComponentMaterial(e){return this.tM.get(e.componentSID)}removeComponentMaterial(e){this.tM.delete(e.componentSID)&&(this.refreshShadowMaterials(),this.rM.requestExpressionRebuild())}getAllMaterials(){let e=[];for(let r of this.tM.values())e.push(r);let t=this.getLegacyMaterial();return t!=null&&e.push(t),e}isTransmissionEnabled(){return this.getAllMaterials().some(e=>e.isShaderDefine("RN_USE_TRANSMISSION"))}buildExpression(){let e=new B;e.tryToSetUniqueName("Raymarching",!0);let t=this.xM();return t.length>0?e.addRenderPasses(t):this.sM!=null&&this.sM.material!=null&&e.addRenderPasses([this.sM]),this.pT=e,e}xM(){let e=[],t=new Set;if(this.bM=-1,this.tM.size>0)for(let r of this.fM()){let a=r.componentSID,n=this.tM.get(a);if(n==null)continue;t.add(a);let i=this.iM.get(a);i==null&&(i=new _(this.i),i.toClearDepthBuffer=!1,i.isDepthTest=!0,i.setPreRenderFunction(()=>this.MM(a)),i.tryToSetUniqueName(`Raymarching_${a}`,!0),this.iM.set(a,i)),i.setBufferLessFullScreenRendering(n),this.rM.configurePassTargets(i),e.length===0&&(this.bM=a),e.push(i)}for(let r of[...this.iM.keys()])t.has(r)||this.iM.delete(r);for(let r of[...this.tM.keys()])!t.has(r)&&this.i.componentRepository.getComponent(P,r)==null&&this.tM.delete(r);return e}MM(e){var i,s,o;e===this.bM&&(this.applyIbl(),this.uM());let t=this.tM.get(e),r=this.i.componentRepository.getComponent(P,e),a=r==null?void 0:r.entity.tryToGetSceneGraph();if(t==null||r==null||a==null)return;t.setParameter(E,a.matrixInner);let n=this._getCachedAabb(r);t.setParameter("raymarchAabbMin",(i=n==null?void 0:n.min)!=null?i:R),t.setParameter("raymarchAabbMax",(s=n==null?void 0:n.max)!=null?s:C),(o=this.iM.get(e))==null||o.setScissorRect(this._calcScissorRect(n))}_getCachedAabb(e){let t=e.entity.tryToGetSceneGraph();if(t==null)return null;let r=t.matrixInner,a=[r.m00,r.m01,r.m02,r.m03,r.m10,r.m11,r.m12,r.m13,r.m20,r.m21,r.m22,r.m23,r.m30,r.m31,r.m32,r.m33],n=P.getAABBVersion(this.i),i=e.componentSID,s=this.hM.get(i);if(s!=null&&s.aabbVersion===n&&s.matrix.length===a.length&&s.matrix.every((c,u)=>c===a[u]))return s.aabb;let o=e.calcWorldAABB();if(o==null)return this.hM.delete(i),null;let h={min:I.fromCopy3(o.minPoint.x,o.minPoint.y,o.minPoint.z),max:I.fromCopy3(o.maxPoint.x,o.maxPoint.y,o.maxPoint.z)};return this.hM.set(i,{aabbVersion:n,matrix:a,aabb:h}),h}_calcScissorRect(e){let{width:t,height:r}=this.rM.getRenderTargetSize();if(e==null||t<=0||r<=0)return;let a=this.i.componentRepository.getComponent(V,V.getCurrent(this.i));if(a==null)return;let n=a.viewProjectionMatrix,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(let l=0;l<8;l++){let d=(l&1)===0?e.min.x:e.max.x,y=(l&2)===0?e.min.y:e.max.y,T=(l&4)===0?e.min.z:e.max.z,x=n.multiplyVector(k.fromCopy4(d,y,T,1));if(x.w<=0)return;let M=x.x/x.w,G=x.y/x.w,D=(M*.5+.5)*t,F=(-G*.5+.5)*r;i=Math.min(i,D),s=Math.min(s,F),o=Math.max(o,D),h=Math.max(h,F)}let c=2,u=Math.max(0,Math.floor(i)-c),b=Math.max(0,Math.floor(s)-c),f=Math.min(t,Math.ceil(o)+c),g=Math.min(r,Math.ceil(h)+c),p=f-u,m=g-b;if(p<=0||m<=0)return{x:0,y:0,width:1,height:1};if(!(u===0&&b===0&&p===t&&m===r))return{x:u,y:b,width:p,height:m}}fM(){let e=this.i.componentRepository.getComponentsWithType(P).slice();return e.sort((t,r)=>t.componentSID-r.componentSID),e}applyIbl(){for(let e of this.getAllMaterials())this.IM(e)}IM(e){var c,u,b,f,g,p;let t=e.getTextureParameter(S.DiffuseEnvTexture.str),r=e.getTextureParameter(S.SpecularEnvTexture.str);if(t==null||r==null)return;let a=e.getTextureParameter(S.SheenEnvTexture.str),n=this.rM.getIblEnvironment(),i=n.diffuse,s=n.specular;if(i==null||s==null)return;let o=`${i.objectUID}:${i.isTextureReady}:${s.objectUID}:${s.isTextureReady}:${(u=(c=n.sheen)==null?void 0:c.objectUID)!=null?u:-1}:${(f=(b=n.sheen)==null?void 0:b.isTextureReady)!=null?f:!1}:${n.rotation}:${n.diffuseContribution}:${n.specularContribution}:${s.iblMipLevelSkip}`;if(o===this.dM.get(e.objectUID))return;this.dM.set(e.objectUID,o);let h=t[2];if(i.isTextureReady&&e.setTextureParameter(S.DiffuseEnvTexture.str,i,h),s.isTextureReady&&(e.setTextureParameter(S.SpecularEnvTexture.str,s,h),a!=null)){let m=(g=n.sheen)!=null&&g.isTextureReady?n.sheen:s,l=(p=a[2])!=null?p:h;e.setTextureParameter(S.SheenEnvTexture.str,m,l)}e.setParameter("iblParameter",k.fromCopy4(s.mipmapLevelNumber,n.diffuseContribution,n.specularContribution,n.rotation)),e.setParameter("iblMipLevelSkip",s.iblMipLevelSkip),e.setParameter("hdriFormat",z.fromCopy2(i.hdriFormat.index,s.hdriFormat.index))}uM(){let e=this.rM.getBackBuffer();if(e!=null)for(let t of this.getAllMaterials())t.setTextureParameter(S.BackBufferTexture.str,e.texture,e.sampler)}refreshShadowMaterials(){let e=this.nM,t=new Map(this.aM);this.oM=void 0,this.nM=void 0,this.mM.clear(),this.aM.clear(),this.cM.clear(),this.lM=this.tM.size>0;let r=this.rM.getShadowSystem();if(!(r==null||this.i.config.maxLightNumber<=0)){if(this.lM)for(let a of this.fM()){let n=a.componentSID;if(!a.castShadow||!this.tM.has(n))continue;let i=w(this.i,a,"regular",t.get(n));i!=null&&this.aM.set(n,i)}else{let a=O(this.i,{castShadowOnly:!0});if(a.nodes.length>0){let n=a;this.oM=n,this.nM=A(this.i,n,"regular",e)}}r.invalidateShadowVolumeFitting(),r.setNeedsRefresh()}}getShadowMaterial(){return this.nM}getComponentShadowMaterial(e){return this.aM.get(e.componentSID)}getShadowPassProvider(){return{hasCaster:()=>this.lM?this.aM.size>0:this.oM!=null&&this.nM!=null,createPasses:e=>this.SM(e),updatePointLightFarPlane:(e,t)=>this.PM(e,t)}}TM(e,t,r){let a=this.mM.get(e);if(a==null){let i=this.oM;if(i==null)return;let s=A(this.i,i,"paraboloidFront"),o=A(this.i,i,"paraboloidBack");if(s==null||o==null)return;a={front:s,back:o},this.mM.set(e,a)}let n=N.fromCopyNumber(t);return a.front.setParameter("lightIndex",n),a.back.setParameter("lightIndex",n),this.pM(a,r),a}pM(e,t){let r=N.fromCopyNumber(t);e.front.setParameter("shadowFarPlane",r),e.back.setParameter("shadowFarPlane",r)}NM(e,t,r,a){let n=this.cM.get(e);n==null&&(n=new Map,this.cM.set(e,n));let i=n.get(a.componentSID);if(i==null){let o=w(this.i,a,"paraboloidFront"),h=w(this.i,a,"paraboloidBack");if(o==null||h==null)return;i={front:o,back:h},n.set(a.componentSID,i)}let s=N.fromCopyNumber(t);return i.front.setParameter("lightIndex",s),i.back.setParameter("lightIndex",s),this.pM(i,r),i}PM(e,t){let r=this.mM.get(e);r!=null&&this.pM(r,t);let a=this.cM.get(e);if(a!=null)for(let n of a.values())this.pM(n,t)}SM(e){let{lightComponent:t,kind:r,shadowSlot:a,farPlane:n}=e;if(this.lM){let s=[];for(let o of this.fM()){let h=o.componentSID;if(!o.castShadow||!this.tM.has(h))continue;let c;if(r==="regular")c=this.aM.get(h);else{let u=this.NM(a,t.componentSID,n!=null?n:1e3,o);c=r==="paraboloidFront"?u==null?void 0:u.front:u==null?void 0:u.back}c!=null&&s.push(this.gM(c,e))}return s}let i;if(r==="regular")i=this.nM;else{let s=this.TM(a,t.componentSID,n!=null?n:1e3);i=r==="paraboloidFront"?s==null?void 0:s.front:s==null?void 0:s.back}return i==null?[]:[this.gM(i,e)]}gM(e,{lightEntity:t,framebuffer:r,kind:a}){let n=new _(this.i);return n.isVrRendering=!1,n.setBufferLessFullScreenRendering(e),n.setFramebuffer(r),n.toClearColorBuffer=!1,n.toClearDepthBuffer=!1,n.isDepthTest=!0,n.depthWriteMask=!0,a==="regular"&&(n.cameraComponent=t.getCamera()),n.tryToSetUniqueName(`RaymarchingShadow_${a}`,!0),n}syncShadowMaterialParameters(){if(this.lM){this.RM();return}if(this.oM==null)return;let e=[];this.nM!=null&&e.push(this.nM);for(let m of this.mM.values())e.push(m.front,m.back);let t=this.tM,r=this.getLegacyMaterial(),a=t.size>0?t.values().next().value:r,n=(m,l,d)=>{if(a!=null)if(v.isTexture(d.compositionType)){let y=a.getTextureParameter(l);y!=null&&m.setTextureParameter(l,y[1],y[2])}else{let y=a.getParameter(l);y!=null&&m.setParameter(l,y)}},i=this.i.componentRepository.getComponentsWithType(P),s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY,b=Number.NEGATIVE_INFINITY,f=!1;for(let m of i){if(!m.castShadow)continue;f=!0;let l=this._getCachedAabb(m);if(l==null){f=!1;break}s=Math.min(s,l.min.x),o=Math.min(o,l.min.y),h=Math.min(h,l.min.z),c=Math.max(c,l.max.x),u=Math.max(u,l.max.y),b=Math.max(b,l.max.z)}let g=f?I.fromCopy3(s,o,h):R,p=f?I.fromCopy3(c,u,b):C;for(let m of e){m.setParameter("raymarchAabbMin",g),m.setParameter("raymarchAabbMax",p);for(let l of m.fieldsInfoArray){let d=l.semantic;if(d.startsWith("worldMatrix_")||d.startsWith("raymarchObjectId_")||d==="raymarchAabbMin"||d==="raymarchAabbMax"||d==="lightIndex"||d==="shadowFarPlane")continue;let y=/^(.*)_(\d+)$/.exec(d),T=y!=null?t.get(Number(y[2])):void 0;if(T!=null){let x=y[1];if(v.isTexture(l.compositionType)){let M=T.getTextureParameter(x);M!=null&&m.setTextureParameter(d,M[1],M[2])}else{let M=T.getParameter(x);M!=null&&m.setParameter(d,M)}}else n(m,d,l)}for(let l of i){if(!l.castShadow)continue;let d=l.entity.tryToGetSceneGraph();d!=null&&m.setParameter(`worldMatrix_${l.componentSID}`,d.matrixInner),m.setParameter(`raymarchObjectId_${l.componentSID}`,N.fromCopyNumber(l.componentSID))}}}RM(){var e,t;for(let r of this.fM()){let a=r.componentSID;if(!r.castShadow)continue;let n=this.tM.get(a);if(n==null)continue;let i=[],s=this.aM.get(a);s!=null&&i.push(s);for(let f of this.cM.values()){let g=f.get(a);g!=null&&i.push(g.front,g.back)}if(i.length===0)continue;let o=r.entity.tryToGetSceneGraph(),h=o==null?void 0:o.matrixInner,c=this._getCachedAabb(r),u=(e=c==null?void 0:c.min)!=null?e:R,b=(t=c==null?void 0:c.max)!=null?t:C;for(let f of i){h!=null&&f.setParameter(E,h),f.setParameter("raymarchAabbMin",u),f.setParameter("raymarchAabbMax",b);for(let g of f.fieldsInfoArray){let p=g.semantic;if(!(p===E||p==="raymarchAabbMin"||p==="raymarchAabbMax"||p==="lightIndex"||p==="shadowFarPlane"))if(v.isTexture(g.compositionType)){let m=n.getTextureParameter(p);m!=null&&f.setTextureParameter(p,m[1],m[2])}else{let m=n.getParameter(p);m!=null&&f.setParameter(p,m)}}}}}};export{Y as RaymarchingRenderer};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { ObjectUID } from '../../types/CommonTypes';
|
|
2
2
|
import type { WebGLResourceRepository } from '../../webgl/WebGLResourceRepository';
|
|
3
3
|
import type { WebGpuResourceRepository } from '../../webgpu/WebGpuResourceRepository';
|
|
4
|
+
import type { WebARSystem } from '../../xr/WebARSystem';
|
|
5
|
+
import type { WebXRSystem } from '../../xr/WebXRSystem';
|
|
4
6
|
import { ComponentMemoryRegistry } from '../core/ComponentMemoryRegistry';
|
|
5
7
|
import { ComponentRepository } from '../core/ComponentRepository';
|
|
6
8
|
import { Config } from '../core/Config';
|
|
7
9
|
import { EntityRepository } from '../core/EntityRepository';
|
|
8
10
|
import { GlobalDataRepository } from '../core/GlobalDataRepository';
|
|
9
11
|
import { MemoryManager } from '../core/MemoryManager';
|
|
10
|
-
import {
|
|
12
|
+
import { RnObject } from '../core/RnObject';
|
|
13
|
+
import { type RenderBackendEnum } from '../definitions/RenderBackend';
|
|
11
14
|
import { DummyTextures } from '../materials/core/DummyTextures';
|
|
15
|
+
import { MaterialRepository } from '../materials/core/MaterialRepository';
|
|
12
16
|
import { Vector4 } from '../math/Vector4';
|
|
13
17
|
import { Logger } from '../misc/Logger';
|
|
14
18
|
import { type ICGAPIResourceRepository } from '../renderer/CGAPIResourceRepository';
|
|
@@ -16,15 +20,11 @@ import { Expression } from '../renderer/Expression';
|
|
|
16
20
|
import { Frame } from '../renderer/Frame';
|
|
17
21
|
import type { ILightClusterSystem } from '../renderer/lightCluster/LightClusterSystemStub';
|
|
18
22
|
import { EngineState } from './EngineState';
|
|
19
|
-
import type { WebARSystem } from '../../xr/WebARSystem';
|
|
20
|
-
import type { WebXRSystem } from '../../xr/WebXRSystem';
|
|
21
|
-
import { RnObject } from '../core/RnObject';
|
|
22
|
-
import { MaterialRepository } from '../materials/core/MaterialRepository';
|
|
23
23
|
/**
|
|
24
24
|
* The argument type for Engine.init() method.
|
|
25
25
|
*/
|
|
26
26
|
interface EngineInitDescription {
|
|
27
|
-
|
|
27
|
+
backend: RenderBackendEnum;
|
|
28
28
|
canvas: HTMLCanvasElement;
|
|
29
29
|
webglOption?: WebGLContextAttributes;
|
|
30
30
|
notToDisplayRnInfoAtInit?: boolean;
|
|
@@ -42,7 +42,7 @@ interface EngineInitDescription {
|
|
|
42
42
|
* @example
|
|
43
43
|
* ```
|
|
44
44
|
* const engine = await Rn.Engine.init({
|
|
45
|
-
*
|
|
45
|
+
* backend: Rn.RenderBackend.WebGL2,
|
|
46
46
|
* canvas: document.getElementById('world') as HTMLCanvasElement,
|
|
47
47
|
* });
|
|
48
48
|
*
|
|
@@ -56,7 +56,7 @@ interface EngineInitDescription {
|
|
|
56
56
|
export declare class Engine extends RnObject {
|
|
57
57
|
private __expressionForProcessAuto?;
|
|
58
58
|
private __renderPassForProcessAuto?;
|
|
59
|
-
private
|
|
59
|
+
private __renderBackend;
|
|
60
60
|
private __cgApiResourceRepository;
|
|
61
61
|
private __webglResourceRepository?;
|
|
62
62
|
private __webGpuResourceRepository?;
|
|
@@ -97,7 +97,8 @@ export declare class Engine extends RnObject {
|
|
|
97
97
|
/** Shader program cache map for this engine instance. Maps shader text to program UIDs. */
|
|
98
98
|
private __shaderProgramCache;
|
|
99
99
|
private __gpuTimerEnabled;
|
|
100
|
-
|
|
100
|
+
/** Runs the Render stage; undefined for RenderBackend.None. */
|
|
101
|
+
private __frameRenderer?;
|
|
101
102
|
private static __engines;
|
|
102
103
|
private static __engineCount;
|
|
103
104
|
private __engineUid;
|
|
@@ -210,31 +211,19 @@ export declare class Engine extends RnObject {
|
|
|
210
211
|
* Like {@link gpuTimeMilliseconds}, the value lags behind by a few frames.
|
|
211
212
|
*/
|
|
212
213
|
get gpuPassTimesMilliseconds(): ReadonlyMap<string, number> | undefined;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
private
|
|
218
|
-
private __renderMeshesWebGPU;
|
|
219
|
-
private _processWebGPU;
|
|
214
|
+
/**
|
|
215
|
+
* Runs the process stages of the components. The frame renderer of the backend runs the Render stage; the
|
|
216
|
+
* other stages run only when a component changed since the last frame, or when the frame renderer requires them.
|
|
217
|
+
*/
|
|
218
|
+
private __processStages;
|
|
220
219
|
private __processComponentRuntimeHooksBeginFrame;
|
|
221
220
|
private __isComponentRuntimeHookDirty;
|
|
222
221
|
private __processComponentRuntimeHooksMarkUpdated;
|
|
223
222
|
private __cleanupComponentRuntimeHooks;
|
|
224
|
-
private _processWebGL;
|
|
225
223
|
static get processTime(): number;
|
|
226
224
|
static get timeAtProcessBegin(): number;
|
|
227
225
|
static get timeAtProcessEnd(): number;
|
|
228
226
|
static createCamera(engine: Engine): void;
|
|
229
|
-
private setViewportForNormalRendering;
|
|
230
|
-
/**
|
|
231
|
-
* Applies the pass's scissor rectangle for normal (non-XR) rendering.
|
|
232
|
-
*
|
|
233
|
-
* The scissor is a culling hint; XR/AR passes use their own viewports, so they
|
|
234
|
-
* run without one.
|
|
235
|
-
*/
|
|
236
|
-
private setScissorForNormalRendering;
|
|
237
|
-
private bindFramebufferWebGL;
|
|
238
227
|
private __displayRnInfo;
|
|
239
228
|
/**
|
|
240
229
|
* Initialize the Rhodonite system.
|
|
@@ -245,7 +234,7 @@ export declare class Engine extends RnObject {
|
|
|
245
234
|
* @example
|
|
246
235
|
* ```
|
|
247
236
|
* const engine = await Rn.Engine.init({
|
|
248
|
-
*
|
|
237
|
+
* backend: Rn.RenderBackend.WebGL2,
|
|
249
238
|
* canvas: document.getElementById('world') as HTMLCanvasElement,
|
|
250
239
|
* });
|
|
251
240
|
* ```
|
|
@@ -266,7 +255,7 @@ export declare class Engine extends RnObject {
|
|
|
266
255
|
*/
|
|
267
256
|
private static __registerCoreComponentClasses;
|
|
268
257
|
static init(desc: EngineInitDescription): Promise<Engine>;
|
|
269
|
-
get
|
|
258
|
+
get renderBackend(): import("..").RenderBackendClass;
|
|
270
259
|
resizeCanvas(width: number, height: number): void;
|
|
271
260
|
getCanvasSize(): [number, number];
|
|
272
261
|
getCurrentWebGLContextWrapper(): import("../..").WebGLContextWrapper | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VERSION as N}from"../../version.js";import{CameraComponent as x}from"../components/Camera/CameraComponent.js";import{createCameraEntity as j}from"../components/Camera/createCameraEntity.js";import{LightComponent as G}from"../components/Light/LightComponent.js";import{MeshComponent as J}from"../components/Mesh/MeshComponent.js";import{MeshRendererComponent as E}from"../components/MeshRenderer/MeshRendererComponent.js";import{SceneGraphComponent as T}from"../components/SceneGraph/SceneGraphComponent.js";import{SkeletalComponent as H}from"../components/Skeletal/SkeletalComponent.js";import{TransformComponent as _}from"../components/Transform/TransformComponent.js";import{WellKnownComponentTIDs as A}from"../components/WellKnownComponentTIDs.js";import{Component as B}from"../core/Component.js";import{ComponentMemoryRegistry as K}from"../core/ComponentMemoryRegistry.js";import{ComponentRepository as R}from"../core/ComponentRepository.js";import{_getComponentRuntimeHooks as U}from"../core/ComponentRuntimeHooks.js";import{Config as O}from"../core/Config.js";import{EntityRepository as Q}from"../core/EntityRepository.js";import{GlobalDataRepository as Y}from"../core/GlobalDataRepository.js";import{MemoryManager as Z}from"../core/MemoryManager.js";import{CameraType as ee}from"../definitions/CameraType.js";import{ProcessApproach as h}from"../definitions/ProcessApproach.js";import{ProcessStage as D}from"../definitions/ProcessStage.js";import{Primitive as F}from"../geometry/Primitive.js";import{DummyTextures as te}from"../materials/core/DummyTextures.js";import{Vector3 as re}from"../math/Vector3.js";import{Vector4 as ie}from"../math/Vector4.js";import{Is as L}from"../misc/Is.js";import{Logger as z}from"../misc/Logger.js";import{Time as S}from"../misc/Time.js";import{_getPhysicsBackend as se}from"../physics/PhysicsBackend.js";import{CGAPIResourceRepository as $}from"../renderer/CGAPIResourceRepository.js";import{Expression as oe}from"../renderer/Expression.js";import{Frame as ne}from"../renderer/Frame.js";import{LightClusterSystemStub as ae}from"../renderer/lightCluster/LightClusterSystemStub.js";import{RenderPass as q}from"../renderer/RenderPass.js";import{EngineState as pe}from"./EngineState.js";import{detectGpuIdentity as ue,findComputeDeformationBrokenGpu as ce}from"./GpuDriverWorkarounds.js";import{ModuleManager as k}from"./ModuleManager.js";import{WebGLGpuTimer as de}from"../../webgl/WebGLGpuTimer.js";import{_cleanupWebGLStatesCacheForEngine as fe}from"../../webgl/WebGLStrategyCommonMethod.js";import{RnObject as he}from"../core/RnObject.js";import{_cleanupGizmosForEngine as me}from"../gizmos/GizmoRegistry.js";import{_cleanupRenderPassHelperForEngine as le}from"../helpers/RenderPassHelper.js";import{AbstractMaterialContent as ge}from"../materials/core/AbstractMaterialContent.js";import{MaterialRepository as be}from"../materials/core/MaterialRepository.js";var m=class m extends he{constructor(e,t,r,i,s){super();this.tC=h.None;this.oC=new pe;this.nC=0;this.pC=-1;this.WC=[];this.cC=new ae;this.wC=!1;this.o=!1;this.hC=-1;this.nr=-1;this.mC=-1;this.or=-1;this._C=0;this.LC=!1;this.BC=new Map;this.lC=!1;this.TC=-1;this.dC=i!=null?i:new O,this.xC=new z,this.xC.logLevel=this.dC.logLevel,this.TC=m.kC,this.tC=e,this.rC=t,this.GC=new K,this.uC=new R(this),this.Na=new Q(this),this.EC=new be,this.of=Z.createInstanceIfNotCreated(this,r),s!=null&&this.UC(s),this.yC=Y.init(this),m.kC++}get engineUid(){return this.TC}static getEngine(e){let t=m.SC.get(e);if(!L.not.exist(t))return t}destroy(){this.stopRenderLoop(),this.RC=void 0,this.WC=[],this._M()}_M(){var t,r;this.o=!0,this.EC._makeShaderInvalidateToAllMaterials();let e=this.Na._getEntities();for(let i of e)this.Na.deleteEntity(i.entityUID);if(L.exist(this.fC)&&(this.fC.destroy(),this.fC=void 0),L.exist(this.iC)){this.iC.clearCache();try{let i=this.iC.getWebGpuDeviceWrapper();i&&i.context.unconfigure()}catch{}}L.exist(this.of)&&(this.of.destroy(),this.of=void 0),this.XC(),_._cleanupForEngine(this),T._cleanupForEngine(this),x._cleanupForEngine(this),G._cleanupForEngine(this),E._cleanupForEngine(this),(t=se())==null||t.cleanupForEngine(this),me(this),ge._cleanupForEngine(this),le(this),fe(this),(r=this.aC)==null||r.destroy(),this.aC=void 0,this.GC.destroy(),this.gC=void 0,this.bC=void 0,this.nC=0,this.hC=-1,this.nr=-1,this.mC=-1,m.SC.delete(this.objectUID),this.unregister()}startRenderLoop(e,...t){this.RC=e,this.WC=t,this.pC!==-1&&this.stopRenderLoop();let r=this.DC();this.vC=r;let i=r.requestAnimationFrame.bind(r),s=this.eC,n=this.sC,f=t.length>0,a=f?[0,...t]:[],c=f?o=>{a[0]=o,e.apply(e,a)}:o=>{e.call(e,o)},p=((o,l)=>{s!=null&&s.isReadyForWebXR?(s._preRender(o,l),c(o),s._postRender()):n!=null&&n.isReadyForWebAR?(n._preRender(o,l),c(o),n._postRender()):c(o),this.pC=i(p)});this.pC=i(p)}DC(){let e=window,t=this.eC,r=this.sC;return t!=null&&t.requestedToEnterWebXR?e=t.xrSession:r!=null&&r.requestedToEnterWebAR&&(e=r.arSession),L.not.exist(e)?window:e}stopRenderLoop(){var t;let e=(t=this.vC)!=null?t:this.DC();this.pC!==-1&&e.cancelAnimationFrame(this.pC),this.pC=-1,this.vC=void 0}restartRenderLoop(){this.RC!=null&&this.startRenderLoop(this.RC,...this.WC)}processAuto(e=ie.fromCopy4(0,0,0,1)){if(L.not.exist(this.gC)){let r=new oe,i=new q(this);i.toClearColorBuffer=!0,i.toClearDepthBuffer=!0,i.clearColor=e;let s=new q(this);r.addRenderPasses([i,s]),this.gC=r,this.bC=s}this.bC.clearEntities();let t=this.Na._getEntities();this.bC.addEntities(t),this.process([this.gC])}process(e){let t=this.lC;t&&this.NC(),S._processBegin(this),this.OC(),!this.wC&&G.getUpdateCount(this)>0&&this._requestLightClusterSystem();let r=e;e instanceof ne&&(r=e.expressions),x.getCurrent(this)===B.InvalidObjectUID&&m.createCamera(this);let i=this.yC.getValue("time",0);i._v[0]=S.timeFromSystemStart,this.processApproach===h.WebGPU?this._processWebGPU(r):this._processWebGL(r),S._processEnd(),t&&this.zC()}get gpuTimerEnabled(){return this.lC}set gpuTimerEnabled(e){this.lC=e}get isGpuTimerSupported(){var e,t;return this.tC===h.WebGPU?this.webGpuResourceRepository._getGpuTimer().isSupported:(t=(e=this.FC())==null?void 0:e.isSupported)!=null?t:!1}get gpuTimeMilliseconds(){var e,t;if(this.lC)return this.tC===h.WebGPU?(e=this.iC)==null?void 0:e._getGpuTimer().lastGpuTimeMilliseconds:(t=this.aC)==null?void 0:t.lastGpuTimeMilliseconds}get gpuPassTimesMilliseconds(){var e;if(!(!this.lC||this.tC!==h.WebGPU))return(e=this.iC)==null?void 0:e._getGpuTimer().lastPassGpuTimesMilliseconds}FC(){var e;if(this.aC==null){let t=(e=this.CC)==null?void 0:e.currentWebGLContextWrapper;if(t==null)return;this.aC=new de(t.getRawContextAsWebGL2())}return this.aC}NC(){var e,t;this.tC===h.WebGPU?(e=this.iC)==null||e._getGpuTimer().beginFrame():(t=this.FC())==null||t.begin()}zC(){var e,t;this.tC===h.WebGPU?(e=this.iC)==null||e._getGpuTimer().endFrame():(t=this.aC)==null||t.end()}$C({webGpuResourceRepository:e,renderPass:t,renderPassTickCount:r,primitiveUids:i,displayIdx:s,hasAnyEffekseerComponents:n,deferredEffekseerRenderJobs:f}){t.doPreRender();let a;if(n&&t.toRenderEffekseerEffects){a=[];let g=t.entities;for(let d=0;d<g.length;d++){let u=g[d].tryToGetEffekseer();u!=null&&a.push(u)}a.length===0&&(a=void 0)}let c=a!=null,p=c?e.getEffekseerRenderPassOptions(this,t,s):void 0,o=t.toRenderEffekseerEffects&&c,l=o&&t.getResolveFramebuffer()!=null&&f!=null;if(o&&p!=null)for(let g of a)g.prepareWebGPURendering(p);if(l&&f.push({renderPass:t,displayIdx:s,renderPassOptions:p,effekseerComponents:a}),e.clearFrameBuffer(this,t,s),this.qC({webGpuResourceRepository:e,renderPass:t,renderPassTickCount:r,primitiveUids:i,displayIdx:s,shouldKeepRenderPassForEffekseer:o&&!l}),o&&!l){let g=e.getOrCreateRenderPassEncoderForEffekseerExternalRendering(this,t,s);if(g!=null)for(let d of a)d.$renderWebGPU(g,p,s);e.endRenderPassEncoderForExternalRendering()}return t._copyResolve1ToResolve2WebGpu(),t.doPostRender(),o}VC({webGpuResourceRepository:e,currentRenderPass:t,deferredEffekseerRenderJobs:r,displayIdx:i}){if(r.length===0)return;let s=t.getResolveFramebuffer();if(s!=null)for(let n of r){if(n.displayIdx!==i||n.renderPass.getResolveFramebuffer()!==s)continue;let f=e.getOrCreateRenderPassEncoderForEffekseerExternalRendering(this,n.renderPass,i);if(f!=null)for(let a of n.effekseerComponents)a.$renderWebGPU(f,n.renderPassOptions,i);e.endRenderPassEncoderForExternalRendering(),n.renderPass._copyResolve1ToResolve2WebGpu()}}qC({webGpuResourceRepository:e,renderPass:t,renderPassTickCount:r,primitiveUids:i,displayIdx:s,shouldKeepRenderPassForEffekseer:n}){var p;let f,a=t._renderedSomethingBefore;if(a&&(n?(f=e.renderWithRenderBundleAndKeepRenderPass(this,t,s),a=f==null):a=!e.renderWithRenderBundle(this,t,s),(p=this.oC).webgpuRenderBundleMode||(p.webgpuRenderBundleMode=a)),!a)return f;e.createRenderBundleEncoder(this,t,s);let c=E.common_$render({renderPass:t,renderPassTickCount:r,primitiveUids:i,displayIdx:s,engine:this});if(t._renderedSomethingBefore=c,!c)return f;if(n)return e.finishRenderBundleEncoderAndKeepRenderPass(this,t,s);e.finishRenderBundleEncoder(this,t,s)}_processWebGPU(e){var s,n;let t=this.uC.getComponentTIDs(),r=this.webGpuResourceRepository,i=this.eC;for(let f of B._processStages){if(f===D.Render){this.cC.update(e),E.common_$prerender(this);let a=(s=i==null?void 0:i.isWebXRMode)!=null?s:!1,c=(n=i==null?void 0:i.isMultiView())!=null?n:!1,p=this.oC.xrPoseWebGPU,o=a&&!c&&p!=null?p.views.length:1,l=this.uC.hasAnyComponent(A.EffekseerComponentTID),g=o>1,d=g?new Map:void 0,u=g?new Map:void 0;for(let y=0;y<o;y++){let C=l?[]:void 0,v=!1;for(let M of e)for(let P of M.renderPasses){let W=P.renderPassUID,b=d==null?void 0:d.get(W),w;b===void 0?(b=this.nC,P._isChangedSortRenderResult=!1,w=E.sort_$render(this,P),d!=null&&(d.set(W,b),u.set(W,w))):w=u.get(W);let I=this.$C({webGpuResourceRepository:r,renderPass:P,renderPassTickCount:b,primitiveUids:w,displayIdx:y,hasAnyEffekseerComponents:l,deferredEffekseerRenderJobs:C});v||(v=I),C!=null&&C.length>0&&this.VC({webGpuResourceRepository:r,currentRenderPass:P,deferredEffekseerRenderJobs:C,displayIdx:y}),y===o-1&&(d==null||d.delete(W),u==null||u.delete(W),this.nC++)}y<o-1&&v&&r.flush()}r.flush()}else if(!this.oC.webgpuRenderBundleMode||E.hasPendingLoad||this.MC()||_.getUpdateCount(this)!==this.nr||x.getCurrentCameraUpdateCount(this)!==this.hC||F.getPrimitiveCount()!==this.mC||G.getUpdateCount(this)!==this.or){let a=`common_${f.methodName}`;for(let c of t){let p=R.getComponentClass(c),o=p[a];o&&o({processApproach:this.tC,renderPass:void 0,processStage:f,renderPassTickCount:this.nC,displayIdx:0,engine:this}),p.process(this,p,f)}}f===D.Logic&&(T._updateTransformGizmosByCameraChange(this),G._updateLightGizmosByCameraChange(this))}this.hC=x.getCurrentCameraUpdateCount(this),this.IC(),this.nr=_.getUpdateCount(this),this.mC=F.getPrimitiveCount(),this.or=G.getUpdateCount(this)}OC(){var e;for(let t of U())(e=t.beginFrame)==null||e.call(t,this)}MC(){var e;for(let t of U())if(((e=t.isDirty)==null?void 0:e.call(t,this))===!0)return!0;return!1}IC(){var e;for(let t of U())(e=t.markUpdated)==null||e.call(t,this)}XC(){var e;for(let t of U())(e=t.cleanup)==null||e.call(t,this)}_processWebGL(e){let t=this.webglResourceRepository,r=this.uC.getComponentTIDs(),i=this.uC.getRenderingComponentTIDs();for(let s of B._processStages){let f=`common_${s.methodName}`;if(s===D.Render){t.getMultiDrawRepository(this).rebuildDirtyGroups(),this.cC.update(e),E.common_$prerender(this);for(let a of e)for(let c of i){let p=R.getComponentClass(c);for(let o of a.renderPasses){typeof spector!="undefined"&&spector.setMarker(`| ${a.uniqueName}: ${o.uniqueName}#`),o.doPreRender(),t.switchDepthTest(o.isDepthTest),this.bindFramebufferWebGL(o),this.setViewportForNormalRendering(o),this.setScissorForNormalRendering(o),c===A.MeshRendererComponentTID&&this.rC.clearFrameBuffer(this,o),o._isChangedSortRenderResult=!1;let l=E.sort_$render(this,o);if(o._renderedSomethingBefore){let d=p[f];if(d){let u=d({processApproach:this.tC,renderPass:o,processStage:s,renderPassTickCount:this.nC,primitiveUids:l,displayIdx:0,engine:this});o._renderedSomethingBefore=u}}if(c===A.EffekseerComponentTID&&o.entities.length>0){let d=this.webglResourceRepository,u=d.getCurrentTexture2DBindingsForEffekseer();d.setWebGLStateToDefaultForEffekseer();for(let y of o.entities){let C=y.tryToGetEffekseer();C!=null&&C.$render()}d.restoreTexture2DBindingsForEffekseer(u)}this.nC++,o._copyFramebufferToResolveFramebuffersWebGL(),o.doPostRender()}}}else if(E.hasPendingLoad||this.MC()||_.getUpdateCount(this)!==this.nr||x.getCurrentCameraUpdateCount(this)!==this.hC||F.getPrimitiveCount()!==this.mC||G.getUpdateCount(this)!==this.or)for(let a of r){let c=R.getComponentClass(a),p=c[f];p&&p({processApproach:this.tC,renderPass:void 0,processStage:s,renderPassTickCount:this.nC,displayIdx:0,engine:this}),c.process(this,c,s)}s===D.Logic&&(T._updateTransformGizmosByCameraChange(this),G._updateLightGizmosByCameraChange(this))}this.hC=x.getCurrentCameraUpdateCount(this),this.IC(),this.nr=_.getUpdateCount(this),this.mC=F.getPrimitiveCount(),this.or=G.getUpdateCount(this)}static get processTime(){return S.lastTimeTimeIntervalInMilliseconds}static get timeAtProcessBegin(){return S.timeAtProcessBeginMilliseconds}static get timeAtProcessEnd(){return S.timeAtProcessEndMilliseconds}static createCamera(e){let t=j(e,!0);t.getTransform().localPosition=re.fromCopyArray([0,0,1]),t.getCamera().type=ee.Orthographic,t.getCamera().zNear=.1,t.getCamera().zFar=1e4;let r=e.cgApiResourceRepository,[i,s]=r.getCanvasSize();t.getCamera().xMag=i/s,t.getCamera().yMag=1}setViewportForNormalRendering(e){let t=this.eC,r=this.sC;(!(t!=null&&t.isWebXRMode)||!e.isVrRendering)&&!(r!=null&&r.isWebARMode)&&this.rC.setViewport(this,e.getViewport())}setScissorForNormalRendering(e){let t=this.eC,r=this.sC,i=this.rC;(!(t!=null&&t.isWebXRMode)||!e.isVrRendering)&&!(r!=null&&r.isWebARMode)?i.setScissorRect(e):i.setScissorRect(void 0)}bindFramebufferWebGL(e){let t=this.eC,r=this.sC;if(t!=null&&t.isWebXRMode&&e.isOutputForVr){let s=this.rC.currentWebGLContextWrapper.getRawContext();s.bindFramebuffer(s.FRAMEBUFFER,t.framebuffer)}else if(r!=null&&r.isWebARMode){let s=this.rC.currentWebGLContextWrapper.getRawContext();s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}else this.rC.bindFramebuffer(e.getFramebuffer()),this.rC.setDrawTargets(e)}jC(){console.log(`%cRhodonite%cWeb3D Library%c %cversion%c${N.version}%c %cbranch%c${N.branch}%c %cmode%c${this.tC.str}`,"font-weight: bold; padding: 4px 8px; border-radius: 6px 0px 0px 6px; background: linear-gradient(to right, #ff0084 0%,#ff0022 100%);","padding: 4px; border-radius: 0px 6px 6px 0px; background: linear-gradient(to right, #8400ff 0%,#4400ff 100%);","","background: #666; padding: 4px; border-radius: 6px 0px 0px 6px","background: firebrick; padding: 4px; border-radius: 0px 6px 6px 0px","","background: #666; padding: 4px; border-radius: 6px 0px 0px 6px","background: green; padding: 4px; border-radius: 0px 6px 6px 0px","","background: #666; padding: 4px; border-radius: 6px 0px 0px 6px","background: blue; padding: 4px; border-radius: 0px 6px 6px 0px")}static JC(){R._ensureComponentClassRegistered(_),R._ensureComponentClassRegistered(T),R._ensureComponentClassRegistered(J),R._ensureComponentClassRegistered(E),R._ensureComponentClassRegistered(x),R._ensureComponentClassRegistered(G),R._ensureComponentClassRegistered(H)}static async init(e){var c,p,o,l,g,d;if(e.approach!==h.None&&e.approach!==h.WebGL2&&e.approach!==h.WebGPU){let u=(p=(c=e.approach)==null?void 0:c.str)!=null?p:String(e.approach);throw new Error(`Unsupported process approach "${u}". The "Uniform" and "DataTexture" modes were removed. Use ProcessApproach.WebGL2 ("WebGL2") or ProcessApproach.WebGPU ("WebGPU").`)}if(e.approach===h.WebGL2&&typeof __RN_WEBGL__!="undefined"&&!__RN_WEBGL__)throw new Error("ProcessApproach.WebGL2 is unavailable: this build was bundled with __RN_WEBGL__ = false.");if(e.approach===h.WebGPU&&typeof __RN_WEBGPU__!="undefined"&&!__RN_WEBGPU__)throw new Error("ProcessApproach.WebGPU is unavailable: this build was bundled with __RN_WEBGPU__ = false.");m.JC();let t=((o=e.xr)!=null?o:m._loadXRByDefault)?await k.getInstance().loadModule("xr"):void 0,r=0,i,s;if(e.approach===h.WebGPU){let b=function(X){v.features.has(X)&&W.push(X)};var a=b;await k.getInstance().loadModule("webgpu");let u=$.getWebGpuResourceRepository(),C=k.getInstance().getModule("webgpu").WebGpuDeviceWrapper,v=await navigator.gpu.requestAdapter({xrCompatible:!0});s=((l=e.config)==null?void 0:l.isComputeSkinningWorkaroundEnabled)!==!1?ue(v):void 0;let{maxBufferSize:M,maxStorageBufferBindingSize:P}=v.limits,W=[];b("float32-filterable"),b("rg11b10ufloat-renderable"),b("texture-compression-bc"),b("texture-compression-etc2"),b("texture-compression-astc"),b("timestamp-query");let w=await v.requestDevice({requiredFeatures:W,requiredLimits:{maxStorageBufferBindingSize:P,maxBufferSize:M}});r=P;let I=new C(e.canvas,v,w);u.addWebGpuDeviceWrapper(I),u.recreateSystemDepthTexture(),u.createBindGroupLayoutForDrawParameters(),i=u}else e.approach===h.WebGL2?(await k.getInstance().loadModule("webgl"),i=$.getWebGLResourceRepository(),i.generateWebGLContext((g=e.config)!=null?g:new O,e.canvas,!0,e.webglOption),i.switchDepthTest(!0),r=i.currentWebGLContextWrapper.getMaxTextureSize()**2*4*4):r=1024**2*4*4;let n=new m(e.approach,i,r,e.config,t);if(n.oC.currentProcessApproach=e.approach,n.dC.eventTargetDom=(d=n.dC.eventTargetDom)!=null?d:e.canvas,e.approach===h.WebGPU&&(n.iC=i),e.approach===h.WebGL2&&(n.CC=i),n.rC=i,s!==void 0&&n.config.isComputeSkinningWorkaroundEnabled){let u=ce(s);u!==void 0&&(n.config.isComputeSkinningEnabled=!1,n.engineState.computeSkinningWorkaroundGpu=u,n.logger.warn(`Rhodonite: compute skinning is disabled because this GPU (${u}) is known to misrender it. Skinned and morphing meshes are deformed in the vertex shaders instead, and the other meshes keep the GPU culling. Set Config.isComputeSkinningWorkaroundEnabled = false to keep the compute skinning.`))}return e.notToDisplayRnInfoAtInit!==!0&&n.jC(),n.yC.initialize(e.approach),e.canvas!=null&&e.approach===h.WebGL2&&(e.canvas.addEventListener("webglcontextlost",(u=>{u.preventDefault(),n.stopRenderLoop(),n.logger.error("WebGL context lost occurred.")}).bind(this)),e.canvas.addEventListener("webglcontextrestored",()=>{n.logger.error("WebGL context restored."),n.restartRenderLoop()})),n.fC=await te.init(n),n.oC.viewportAspectRatio=e.canvas!=null?e.canvas.width/e.canvas.height:1,n}get processApproach(){return this.tC}resizeCanvas(e,t){this.cgApiResourceRepository.resizeCanvas(e,t),this.oC.viewportAspectRatio=e/t}getCanvasSize(){return this.cgApiResourceRepository.getCanvasSize()}getCurrentWebGLContextWrapper(){return this.rC.currentWebGLContextWrapper}get entityRepository(){return this.Na}get componentRepository(){return this.uC}get componentMemoryRegistry(){return this.GC}get webXRSystem(){if(this.eC==null)throw new Error(m.AC);return this.eC}get webARSystem(){if(this.sC==null)throw new Error(m.AC);return this.sC}get isXREnabled(){return this.eC!=null}get _webXRSystemIfEnabled(){return this.eC}get _webARSystemIfEnabled(){return this.sC}async enableXR(){if(this.eC==null){let e=await k.getInstance().loadModule("xr");this.eC==null&&this.UC(e)}return this.eC}UC(e){this.eC=e.WebXRSystem.init(this),this.sC=e.WebARSystem.init(this)}get memoryManager(){return this.of}get globalDataRepository(){return this.yC}_requestLightClusterSystem(){this.o||this.PC!=null||(this.PC=import("../renderer/lightCluster/LightClusterSystem.js").then(({LightClusterSystem:e})=>{this.o||(this.cC=new e(this),this.wC=!0)}).catch(e=>{z.default.warn(`Failed to load the light cluster system: ${e}`)}))}async _ensureLightClusterSystem(){return this._requestLightClusterSystem(),await this.PC,this.cC}get lightClusterSystem(){return this.cC}get materialRepository(){return this.EC}get webglResourceRepository(){return this.CC}get cgApiResourceRepository(){return this.rC}get webGpuResourceRepository(){return this.iC}get dummyTextures(){return this.fC}get engineState(){return this.oC}get config(){return this.dC}get _gpuInstanceDataVersion(){return this._C}_markGpuInstanceDataDirty(){this._C++}get _isPreviousMorphWeightsEnabled(){return this.LC}_enablePreviousMorphWeights(){this.LC=!0}get logger(){return this.xC}get shaderProgramCache(){return this.BC}};m._loadXRByDefault=!1,m.SC=new Map,m.kC=0,m.AC="The XR support is not enabled. Initialize the engine with Engine.init({ xr: true }) or call await engine.enableXR() first. The default Rn namespace export enables it automatically.";var V=m;export{V as Engine};
|
|
1
|
+
import{VERSION as M}from"../../version.js";import{_cleanupWebGLStatesCacheForEngine as j}from"../../webgl/WebGLStrategyCommonMethod.js";import{CameraComponent as x}from"../components/Camera/CameraComponent.js";import{createCameraEntity as $}from"../components/Camera/createCameraEntity.js";import{LightComponent as b}from"../components/Light/LightComponent.js";import{MeshComponent as V}from"../components/Mesh/MeshComponent.js";import{MeshRendererComponent as w}from"../components/MeshRenderer/MeshRendererComponent.js";import{SceneGraphComponent as S}from"../components/SceneGraph/SceneGraphComponent.js";import{SkeletalComponent as H}from"../components/Skeletal/SkeletalComponent.js";import{TransformComponent as W}from"../components/Transform/TransformComponent.js";import{Component as P}from"../core/Component.js";import{ComponentMemoryRegistry as J}from"../core/ComponentMemoryRegistry.js";import{ComponentRepository as c}from"../core/ComponentRepository.js";import{_getComponentRuntimeHooks as G}from"../core/ComponentRuntimeHooks.js";import{Config as D}from"../core/Config.js";import{EntityRepository as K}from"../core/EntityRepository.js";import{GlobalDataRepository as Q}from"../core/GlobalDataRepository.js";import{MemoryManager as Y}from"../core/MemoryManager.js";import{RnObject as Z}from"../core/RnObject.js";import{CameraType as ee}from"../definitions/CameraType.js";import{ProcessStage as T}from"../definitions/ProcessStage.js";import{RenderBackend as u}from"../definitions/RenderBackend.js";import{Primitive as A}from"../geometry/Primitive.js";import{_cleanupGizmosForEngine as te}from"../gizmos/GizmoRegistry.js";import{_cleanupRenderPassHelperForEngine as ie}from"../helpers/RenderPassHelper.js";import{AbstractMaterialContent as re}from"../materials/core/AbstractMaterialContent.js";import{DummyTextures as ne}from"../materials/core/DummyTextures.js";import{MaterialRepository as se}from"../materials/core/MaterialRepository.js";import{Vector3 as oe}from"../math/Vector3.js";import{Vector4 as ae}from"../math/Vector4.js";import{Is as f}from"../misc/Is.js";import{Logger as B}from"../misc/Logger.js";import{Time as R}from"../misc/Time.js";import{_getPhysicsBackend as pe}from"../physics/PhysicsBackend.js";import{CGAPIResourceRepository as U}from"../renderer/CGAPIResourceRepository.js";import{Expression as ue}from"../renderer/Expression.js";import{Frame as ce}from"../renderer/Frame.js";import{LightClusterSystemStub as me}from"../renderer/lightCluster/LightClusterSystemStub.js";import{RenderPass as F}from"../renderer/RenderPass.js";import{EngineState as de}from"./EngineState.js";import{detectGpuIdentity as le,findComputeDeformationBrokenGpu as he}from"./GpuDriverWorkarounds.js";import{ModuleManager as l}from"./ModuleManager.js";var a=class a extends Z{constructor(e,t,n,i,s){super();this.cC=u.None;this.dC=new de;this.lC=0;this.iC=-1;this.fC=[];this.vC=new me;this.EC=!1;this.a=!1;this.GC=-1;this.nr=-1;this.wC=-1;this.or=-1;this.kC=0;this.LC=!1;this.AC=new Map;this.aC=!1;this.MC=-1;this.sC=i!=null?i:new D,this.WC=new B,this.WC.logLevel=this.sC.logLevel,this.MC=a.IC,this.cC=e,this.mC=t,this.yC=new J,this.RC=new c(this),this.Na=new K(this),this.CC=new se,this.of=Y.createInstanceIfNotCreated(this,n),s!=null&&this.PC(s),this.gC=Q.init(this),a.IC++}get engineUid(){return this.MC}static getEngine(e){let t=a._C.get(e);if(!f.not.exist(t))return t}destroy(){this.stopRenderLoop(),this.hC=void 0,this.fC=[],this.YT()}YT(){var t,n;this.a=!0,this.CC._makeShaderInvalidateToAllMaterials();let e=this.Na._getEntities();for(let i of e)this.Na.deleteEntity(i.entityUID);if(f.exist(this.oC)&&(this.oC.destroy(),this.oC=void 0),f.exist(this.nC)){this.nC.clearCache();try{let i=this.nC.getWebGpuDeviceWrapper();i&&i.context.unconfigure()}catch{}}f.exist(this.of)&&(this.of.destroy(),this.of=void 0),this.BC(),W._cleanupForEngine(this),S._cleanupForEngine(this),x._cleanupForEngine(this),b._cleanupForEngine(this),w._cleanupForEngine(this),(t=pe())==null||t.cleanupForEngine(this),te(this),re._cleanupForEngine(this),ie(this),j(this),(n=this.tC)==null||n.destroy(),this.yC.destroy(),this.pC=void 0,this.uC=void 0,this.lC=0,this.GC=-1,this.nr=-1,this.wC=-1,a._C.delete(this.objectUID),this.unregister()}startRenderLoop(e,...t){this.hC=e,this.fC=t,this.iC!==-1&&this.stopRenderLoop();let n=this.DC();this.bC=n;let i=n.requestAnimationFrame.bind(n),s=this.eC,r=this.rC,m=t.length>0,h=m?[0,...t]:[],g=m?p=>{h[0]=p,e.apply(e,h)}:p=>{e.call(e,p)},y=((p,C)=>{s!=null&&s.isReadyForWebXR?(s._preRender(p,C),g(p),s._postRender()):r!=null&&r.isReadyForWebAR?(r._preRender(p,C),g(p),r._postRender()):g(p),this.iC=i(y)});this.iC=i(y)}DC(){let e=window,t=this.eC,n=this.rC;return t!=null&&t.requestedToEnterWebXR?e=t.xrSession:n!=null&&n.requestedToEnterWebAR&&(e=n.arSession),f.not.exist(e)?window:e}stopRenderLoop(){var t;let e=(t=this.bC)!=null?t:this.DC();this.iC!==-1&&e.cancelAnimationFrame(this.iC),this.iC=-1,this.bC=void 0}restartRenderLoop(){this.hC!=null&&this.startRenderLoop(this.hC,...this.fC)}processAuto(e=ae.fromCopy4(0,0,0,1)){if(f.not.exist(this.pC)){let n=new ue,i=new F(this);i.toClearColorBuffer=!0,i.toClearDepthBuffer=!0,i.clearColor=e;let s=new F(this);n.addRenderPasses([i,s]),this.pC=n,this.uC=s}this.uC.clearEntities();let t=this.Na._getEntities();this.uC.addEntities(t),this.process([this.pC])}process(e){let t=this.tC,n=this.aC;n&&(t==null||t.beginGpuTimer()),R._processBegin(this),this.UC(),!this.EC&&b.getUpdateCount(this)>0&&this._requestLightClusterSystem();let i=e;e instanceof ce&&(i=e.expressions),x.getCurrent(this)===P.InvalidObjectUID&&a.createCamera(this);let s=this.gC.getValue("time",0);s._v[0]=R.timeFromSystemStart,this.FC(i),R._processEnd(),n&&(t==null||t.endGpuTimer())}get gpuTimerEnabled(){return this.aC}set gpuTimerEnabled(e){this.aC=e}get isGpuTimerSupported(){var e,t;return(t=(e=this.tC)==null?void 0:e.isGpuTimerSupported)!=null?t:!1}get gpuTimeMilliseconds(){var e;if(this.aC)return(e=this.tC)==null?void 0:e.lastGpuTimeMilliseconds}get gpuPassTimesMilliseconds(){var e;if(this.aC)return(e=this.tC)==null?void 0:e.lastPassGpuTimesMilliseconds}FC(e){let t=this.tC,n=this.RC.getComponentTIDs();for(let i of P._processStages){if(i===T.Render)t!=null&&(this.lC=t.render(e,this.lC));else if((t==null?void 0:t.requiresNonRenderStages)===!0||w.hasPendingLoad||this.XC()||W.getUpdateCount(this)!==this.nr||x.getCurrentCameraUpdateCount(this)!==this.GC||A.getPrimitiveCount()!==this.wC||b.getUpdateCount(this)!==this.or){let s=`common_${i.methodName}`;for(let r of n){let m=c.getComponentClass(r),h=m[s];h&&h({renderBackend:this.cC,renderPass:void 0,processStage:i,renderPassTickCount:this.lC,displayIdx:0,engine:this}),m.process(this,m,i)}}i===T.Logic&&(S._updateTransformGizmosByCameraChange(this),b._updateLightGizmosByCameraChange(this))}this.GC=x.getCurrentCameraUpdateCount(this),this.zC(),this.nr=W.getUpdateCount(this),this.wC=A.getPrimitiveCount(),this.or=b.getUpdateCount(this)}UC(){var e;for(let t of G())(e=t.beginFrame)==null||e.call(t,this)}XC(){var e;for(let t of G())if(((e=t.isDirty)==null?void 0:e.call(t,this))===!0)return!0;return!1}zC(){var e;for(let t of G())(e=t.markUpdated)==null||e.call(t,this)}BC(){var e;for(let t of G())(e=t.cleanup)==null||e.call(t,this)}static get processTime(){return R.lastTimeTimeIntervalInMilliseconds}static get timeAtProcessBegin(){return R.timeAtProcessBeginMilliseconds}static get timeAtProcessEnd(){return R.timeAtProcessEndMilliseconds}static createCamera(e){let t=$(e,!0);t.getTransform().localPosition=oe.fromCopyArray([0,0,1]),t.getCamera().type=ee.Orthographic,t.getCamera().zNear=.1,t.getCamera().zFar=1e4;let n=e.cgApiResourceRepository,[i,s]=n.getCanvasSize();t.getCamera().xMag=i/s,t.getCamera().yMag=1}NC(){console.log(`%cRhodonite%cWeb3D Library%c %cversion%c${M.version}%c %cbranch%c${M.branch}%c %cmode%c${this.cC.str}`,"font-weight: bold; padding: 4px 8px; border-radius: 6px 0px 0px 6px; background: linear-gradient(to right, #ff0084 0%,#ff0022 100%);","padding: 4px; border-radius: 0px 6px 6px 0px; background: linear-gradient(to right, #8400ff 0%,#4400ff 100%);","","background: #666; padding: 4px; border-radius: 6px 0px 0px 6px","background: firebrick; padding: 4px; border-radius: 0px 6px 6px 0px","","background: #666; padding: 4px; border-radius: 6px 0px 0px 6px","background: green; padding: 4px; border-radius: 0px 6px 6px 0px","","background: #666; padding: 4px; border-radius: 6px 0px 0px 6px","background: blue; padding: 4px; border-radius: 0px 6px 6px 0px")}static qC(){c._ensureComponentClassRegistered(W),c._ensureComponentClassRegistered(S),c._ensureComponentClassRegistered(V),c._ensureComponentClassRegistered(w),c._ensureComponentClassRegistered(x),c._ensureComponentClassRegistered(b),c._ensureComponentClassRegistered(H)}static async init(e){var g,y,p,C,E,k;if(e.backend!==u.None&&e.backend!==u.WebGL2&&e.backend!==u.WebGPU){let o=(y=(g=e.backend)==null?void 0:g.str)!=null?y:String(e.backend);throw new Error(`Unsupported render backend "${o}". The "Uniform" and "DataTexture" modes were removed. Use RenderBackend.WebGL2 ("WebGL2") or RenderBackend.WebGPU ("WebGPU").`)}if(e.backend===u.WebGL2&&typeof __RN_WEBGL__!="undefined"&&!__RN_WEBGL__)throw new Error("RenderBackend.WebGL2 is unavailable: this build was bundled with __RN_WEBGL__ = false.");if(e.backend===u.WebGPU&&typeof __RN_WEBGPU__!="undefined"&&!__RN_WEBGPU__)throw new Error("RenderBackend.WebGPU is unavailable: this build was bundled with __RN_WEBGPU__ = false.");a.qC();let t=((p=e.xr)!=null?p:a._loadXRByDefault)?await l.getInstance().loadModule("xr"):void 0,n=0,i,s;if(e.backend===u.WebGPU){let d=function(I){v.features.has(I)&&_.push(I)};var h=d;await l.getInstance().loadModule("webgpu");let o=U.getWebGpuResourceRepository(),z=l.getInstance().getModule("webgpu").WebGpuDeviceWrapper,v=await navigator.gpu.requestAdapter({xrCompatible:!0});s=((C=e.config)==null?void 0:C.isComputeSkinningWorkaroundEnabled)!==!1?le(v):void 0;let{maxBufferSize:N,maxStorageBufferBindingSize:L}=v.limits,_=[];d("float32-filterable"),d("rg11b10ufloat-renderable"),d("texture-compression-bc"),d("texture-compression-etc2"),d("texture-compression-astc"),d("timestamp-query");let q=await v.requestDevice({requiredFeatures:_,requiredLimits:{maxStorageBufferBindingSize:L,maxBufferSize:N}});n=L;let O=new z(e.canvas,v,q);o.addWebGpuDeviceWrapper(O),o.recreateSystemDepthTexture(),o.createBindGroupLayoutForDrawParameters(),i=o}else e.backend===u.WebGL2?(await l.getInstance().loadModule("webgl"),i=U.getWebGLResourceRepository(),i.generateWebGLContext((E=e.config)!=null?E:new D,e.canvas,!0,e.webglOption),i.switchDepthTest(!0),n=i.currentWebGLContextWrapper.getMaxTextureSize()**2*4*4):n=1024**2*4*4;let r=new a(e.backend,i,n,e.config,t);if(r.dC.currentRenderBackend=e.backend,r.sC.eventTargetDom=(k=r.sC.eventTargetDom)!=null?k:e.canvas,e.backend===u.WebGPU){r.nC=i;let o=l.getInstance().getModule("webgpu");r.tC=new o.WebGpuFrameRenderer(r)}if(e.backend===u.WebGL2){r.SC=i;let o=l.getInstance().getModule("webgl");r.tC=new o.WebGLFrameRenderer(r)}if(r.mC=i,s!==void 0&&r.config.isComputeSkinningWorkaroundEnabled){let o=he(s);o!==void 0&&(r.config.isComputeSkinningEnabled=!1,r.engineState.computeSkinningWorkaroundGpu=o,r.logger.warn(`Rhodonite: compute skinning is disabled because this GPU (${o}) is known to misrender it. Skinned and morphing meshes are deformed in the vertex shaders instead, and the other meshes keep the GPU culling. Set Config.isComputeSkinningWorkaroundEnabled = false to keep the compute skinning.`))}return e.notToDisplayRnInfoAtInit!==!0&&r.NC(),r.gC.initialize(e.backend),e.canvas!=null&&e.backend===u.WebGL2&&(e.canvas.addEventListener("webglcontextlost",(o=>{o.preventDefault(),r.stopRenderLoop(),r.logger.error("WebGL context lost occurred.")}).bind(this)),e.canvas.addEventListener("webglcontextrestored",()=>{r.logger.error("WebGL context restored."),r.restartRenderLoop()})),r.oC=await ne.init(r),r.dC.viewportAspectRatio=e.canvas!=null?e.canvas.width/e.canvas.height:1,r}get renderBackend(){return this.cC}resizeCanvas(e,t){this.cgApiResourceRepository.resizeCanvas(e,t),this.dC.viewportAspectRatio=e/t}getCanvasSize(){return this.cgApiResourceRepository.getCanvasSize()}getCurrentWebGLContextWrapper(){return this.mC.currentWebGLContextWrapper}get entityRepository(){return this.Na}get componentRepository(){return this.RC}get componentMemoryRegistry(){return this.yC}get webXRSystem(){if(this.eC==null)throw new Error(a.TC);return this.eC}get webARSystem(){if(this.rC==null)throw new Error(a.TC);return this.rC}get isXREnabled(){return this.eC!=null}get _webXRSystemIfEnabled(){return this.eC}get _webARSystemIfEnabled(){return this.rC}async enableXR(){if(this.eC==null){let e=await l.getInstance().loadModule("xr");this.eC==null&&this.PC(e)}return this.eC}PC(e){this.eC=e.WebXRSystem.init(this),this.rC=e.WebARSystem.init(this)}get memoryManager(){return this.of}get globalDataRepository(){return this.gC}_requestLightClusterSystem(){this.a||this.xC!=null||(this.xC=import("../renderer/lightCluster/LightClusterSystem.js").then(({LightClusterSystem:e})=>{this.a||(this.vC=new e(this),this.EC=!0)}).catch(e=>{B.default.warn(`Failed to load the light cluster system: ${e}`)}))}async _ensureLightClusterSystem(){return this._requestLightClusterSystem(),await this.xC,this.vC}get lightClusterSystem(){return this.vC}get materialRepository(){return this.CC}get webglResourceRepository(){return this.SC}get cgApiResourceRepository(){return this.mC}get webGpuResourceRepository(){return this.nC}get dummyTextures(){return this.oC}get engineState(){return this.dC}get config(){return this.sC}get _gpuInstanceDataVersion(){return this.kC}_markGpuInstanceDataDirty(){this.kC++}get _isPreviousMorphWeightsEnabled(){return this.LC}_enablePreviousMorphWeights(){this.LC=!0}get logger(){return this.WC}get shaderProgramCache(){return this.AC}};a._loadXRByDefault=!1,a._C=new Map,a.IC=0,a.TC="The XR support is not enabled. Initialize the engine with Engine.init({ xr: true }) or call await engine.enableXR() first. The default Rn namespace export enables it automatically.";var X=a;export{X as Engine};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type RenderBackendEnum } from '../definitions/RenderBackend';
|
|
2
2
|
/**
|
|
3
3
|
* Global engine state object that holds various runtime configuration and state information.
|
|
4
4
|
* This object contains engine-wide settings that affect rendering behavior and performance.
|
|
5
5
|
*/
|
|
6
6
|
export declare class EngineState {
|
|
7
7
|
/**
|
|
8
|
-
* The current
|
|
8
|
+
* The current render backend being used for rendering operations.
|
|
9
9
|
* Determines whether to use the WebGL2 data texture approach, WebGPU, or none.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
currentRenderBackend: RenderBackendEnum;
|
|
12
12
|
/**
|
|
13
13
|
* The aspect ratio of the current viewport (width / height).
|
|
14
14
|
* Used for camera projection calculations and responsive rendering.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{RenderBackend as r}from"../definitions/RenderBackend.js";var e=class{constructor(){this.currentRenderBackend=r.None;this.viewportAspectRatio=0;this.webgpuRenderBundleMode=!1;this.totalSizeOfGPUShaderDataStorageExceptMorphData=0}};export{e as EngineState};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Index } from '../../types/CommonTypes';
|
|
2
|
+
import { Vector4 } from '../math/Vector4';
|
|
3
|
+
import { AbstractRenderTargetTexture } from './AbstractRenderTargetTexture';
|
|
4
|
+
/**
|
|
5
|
+
* Base class for render target textures whose rendered image can be read back to the CPU.
|
|
6
|
+
*
|
|
7
|
+
* The rows of the read data start from the bottom of the rendered image on every backend, which is the
|
|
8
|
+
* row order of WebGL readPixels. So y counts from the bottom row in getPixelValueAt, and
|
|
9
|
+
* downloadTexturePixelData flips the rows for the canvas, whose rows start from the top.
|
|
10
|
+
*
|
|
11
|
+
* @abstract
|
|
12
|
+
* @extends AbstractRenderTargetTexture
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class AbstractReadableRenderTargetTexture extends AbstractRenderTargetTexture {
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves the pixel data from the render target texture.
|
|
17
|
+
* This operation reads back the texture data from GPU memory to CPU memory.
|
|
18
|
+
*
|
|
19
|
+
* @returns A promise that resolves to a Uint8Array containing the pixel data,
|
|
20
|
+
* `width * 4` bytes per row, starting from the bottom row of the rendered image
|
|
21
|
+
*/
|
|
22
|
+
getTexturePixelData(): Promise<Uint8Array<ArrayBufferLike>>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the pixel value at the specified coordinates.
|
|
25
|
+
* The coordinate system has its origin at the bottom-left corner.
|
|
26
|
+
*
|
|
27
|
+
* @param x - Horizontal pixel position (0 is left edge)
|
|
28
|
+
* @param y - Vertical pixel position (0 is bottom edge)
|
|
29
|
+
* @param argByteArray - Optional pre-fetched pixel data array to avoid redundant GPU reads
|
|
30
|
+
* @returns A promise that resolves to a Vector4 containing the RGBA pixel values (0-255)
|
|
31
|
+
*/
|
|
32
|
+
getPixelValueAt(x: Index, y: Index, argByteArray?: Uint8Array): Promise<Vector4>;
|
|
33
|
+
/**
|
|
34
|
+
* Downloads the texture pixel data as a PNG image file.
|
|
35
|
+
* This method creates a canvas, draws the texture data to it, and triggers
|
|
36
|
+
* a download of the resulting image.
|
|
37
|
+
*/
|
|
38
|
+
downloadTexturePixelData(): Promise<void>;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Vector4 as f}from"../math/Vector4.js";import{AbstractRenderTargetTexture as p}from"./AbstractRenderTargetTexture.js";var h=class extends p{async getTexturePixelData(){var i,t,e,o;return this.i.cgApiResourceRepository.getTexturePixelData(this._textureResourceUid,this.am,this.TT,(t=(i=this.cw)==null?void 0:i.framebufferUID)!=null?t:-1,(o=(e=this.cw)==null?void 0:e.whichColorAttachment(this))!=null?o:-1)}async getPixelValueAt(r,a,i){let t=i;t||(t=await this.getTexturePixelData());let e=(a*this.width+r)*4;return f.fromCopyArray([t[e+0],t[e+1],t[e+2],t[e+3]])}async downloadTexturePixelData(){let r=await this.getTexturePixelData(),a=document.createElement("canvas");a.width=this.width,a.height=this.height;let i=a.getContext("2d");if(!(r.buffer instanceof ArrayBuffer))throw new Error("SharedArrayBuffer is not supported when downloading texture pixel data.");let t=new Uint8ClampedArray(r.buffer,r.byteOffset,r.byteLength/Uint8ClampedArray.BYTES_PER_ELEMENT),e=this.width*4,o=new Uint8ClampedArray(t.length);for(let n=0;n<this.height;n++)o.set(t.subarray(n*e,(n+1)*e),(this.height-1-n)*e);let d=new ImageData(o,this.width,this.height);i.putImageData(d,0,0);let u=a.toDataURL("image/png"),s=document.createElement("a"),c=document.createEvent("MouseEvent");s.href=u,s.download="texture.png",c.initEvent("click",!0,!0),s.dispatchEvent(c)}};export{h as AbstractReadableRenderTargetTexture};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Index, Size } from '../../types/CommonTypes';
|
|
2
|
+
import type { FrameBuffer } from '../renderer/FrameBuffer';
|
|
3
|
+
import { AbstractTexture } from './AbstractTexture';
|
|
4
|
+
import type { IRenderable } from './IRenderable';
|
|
5
|
+
/**
|
|
6
|
+
* Base class for textures that can be used as render targets for off-screen rendering.
|
|
7
|
+
*
|
|
8
|
+
* It holds what the 2D, 2D array and cube render target textures share: the frame buffer association,
|
|
9
|
+
* destroying the 3D API resources and recreating them on resize, and the empty cube face view.
|
|
10
|
+
* Reading the rendered image back to the CPU, which only the 2D render target textures support, is in
|
|
11
|
+
* AbstractReadableRenderTargetTexture.
|
|
12
|
+
*
|
|
13
|
+
* @abstract
|
|
14
|
+
* @extends AbstractTexture
|
|
15
|
+
*/
|
|
16
|
+
export declare abstract class AbstractRenderTargetTexture extends AbstractTexture implements IRenderable {
|
|
17
|
+
protected __fbo?: FrameBuffer;
|
|
18
|
+
/**
|
|
19
|
+
* Sets the framebuffer object associated with this render target texture.
|
|
20
|
+
*
|
|
21
|
+
* @param fbo - The FrameBuffer object to associate with this texture
|
|
22
|
+
*/
|
|
23
|
+
set _fbo(fbo: FrameBuffer);
|
|
24
|
+
/**
|
|
25
|
+
* Gets the framebuffer object associated with this render target texture.
|
|
26
|
+
*
|
|
27
|
+
* @returns The associated FrameBuffer object, or undefined if not set
|
|
28
|
+
*/
|
|
29
|
+
get fbo(): FrameBuffer | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Creates the underlying 3D API resources of the texture.
|
|
32
|
+
* Called when the texture is created and when it is resized.
|
|
33
|
+
*
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
protected abstract __createRenderTargetTexture(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Resizes the render target texture to the specified dimensions.
|
|
39
|
+
* This operation destroys the existing resources and creates new ones.
|
|
40
|
+
*
|
|
41
|
+
* @param width - New width in pixels
|
|
42
|
+
* @param height - New height in pixels
|
|
43
|
+
*/
|
|
44
|
+
resize(width: Size, height: Size): void;
|
|
45
|
+
/**
|
|
46
|
+
* Destroys all 3D API resources associated with this render target texture.
|
|
47
|
+
* This method should be called when the texture is no longer needed to free GPU memory.
|
|
48
|
+
*
|
|
49
|
+
* @returns True if the resources were successfully destroyed
|
|
50
|
+
*/
|
|
51
|
+
destroy3DAPIResources(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a cube texture view as a render target for the specified face and mip level.
|
|
54
|
+
* Only a cube render target has faces to view, so this is a no-op for the other textures.
|
|
55
|
+
*
|
|
56
|
+
* @param _faceIdx - Index of the cube face (0-5)
|
|
57
|
+
* @param _mipLevel - Mip level to create the view for
|
|
58
|
+
*/
|
|
59
|
+
createCubeTextureViewAsRenderTarget(_faceIdx: Index, _mipLevel: Index): void;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CGAPIResourceRepository as o}from"../renderer/CGAPIResourceRepository.js";import{AbstractTexture as s}from"./AbstractTexture.js";var t=class extends s{set _fbo(e){this.cw=e}get fbo(){return this.cw}resize(e,r){this.destroy3DAPIResources(),this.am=e,this.TT=r,this.eI()}destroy3DAPIResources(){return this.i.cgApiResourceRepository.deleteTexture(this._textureResourceUid),this._textureResourceUid=o.InvalidCGAPIResourceUid,!0}createCubeTextureViewAsRenderTarget(e,r){}};export{t as AbstractRenderTargetTexture};
|