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,27 @@
|
|
|
1
|
+
import{Component as d}from"../foundation/core/Component.js";import{CompositionType as r}from"../foundation/definitions/CompositionType.js";import{ShaderType as T}from"../foundation/definitions/ShaderType.js";function L(p,x){let u="";return d.getMemberInfo(p).forEach((e,a)=>{e.forEach((n,c)=>{var i;if(n.shaderType!==x&&n.shaderType!==T.VertexAndPixelShader)return;let t=(i=d.getComponentCountPerBufferView(p).get(a))!=null?i:1;r.isArray(n.compositionType)?V(n,a,c,t):B(n,a,c,t)})}),u;function V(e,a,n,c){var h,g;let t="",i="";switch(e.compositionType){case r.Vec4Array:t="vec4",i="fetchVec4";break;case r.Mat4Array:t="mat4",i="fetchMat4";break;case r.Mat4x3Array:t="mat4x3",i="fetchMat4x3";break;default:throw new Error(`Unsupported composition type: ${e.compositionType.str}`)}let s=e.compositionType.getVec4SizeOfProperty();if(e.isVariableLength===!0){let O=d._variableLengthLocationRadix;u+=`
|
|
2
|
+
${t} get_${n}(uint instanceId, uint idxOfArray) {
|
|
3
|
+
vec4 location = get_${d._getVariableLengthLocationMemberName(n)}(instanceId);
|
|
4
|
+
int index = int(location.x) * ${O} + int(location.y) + ${s} * int(idxOfArray);
|
|
5
|
+
${t} value = ${i}(index);
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
`;return}let o=d.getLocationOffsetOfMemberOfComponent(p,a,n),w=`int arrayLength = ${(g=((h=d.getArrayLengthOfMember(p).get(a))!=null?h:new Map).get(n))!=null?g:0};`,l=`rnIndices_${n}`,I=`int index = ${l}[instanceIdOfBufferViews] + int(instanceIdInBufferView) * ${s} * arrayLength + ${s} * int(idxOfArray);`,$="";e.convertToBool&&($="return (value > 0.5) ? true : false;"),u+=`
|
|
9
|
+
const int ${l}[${o.length}] = int[${o.length}](${o.join(", ")});
|
|
10
|
+
${e.convertToBool?"bool":t} get_${n}(uint instanceId, uint idxOfArray) {
|
|
11
|
+
uint instanceIdOfBufferViews = instanceId / ${c}u;
|
|
12
|
+
uint instanceIdInBufferView = instanceId % ${c}u;
|
|
13
|
+
${w}
|
|
14
|
+
${I}
|
|
15
|
+
${t} value = ${i}(index);
|
|
16
|
+
${e.convertToBool?$:"return value;"}
|
|
17
|
+
}
|
|
18
|
+
`}function B(e,a,n,c){let t="",i="";switch(e.compositionType){case r.Mat4:t="mat4",i="fetchMat4";break;case r.Mat3:t="mat3",i="fetchMat3No16BytesAligned";break;case r.Vec4:t="vec4",i="fetchVec4";break;case r.Vec3:t="vec3",i="fetchVec3No16BytesAligned";break;case r.Scalar:t="float",i="fetchScalarNo16BytesAligned";break;default:throw new Error(`Unsupported composition type: ${e.compositionType.str}`)}let s=d.getLocationOffsetOfMemberOfComponent(p,a,n),o=`rnIndices_${n}`,f="";switch(e.compositionType){case r.Mat4:f=`int index = ${o}[instanceIdOfBufferViews] + 4 * int(instanceIdInBufferView);`;break;case r.Mat3:f=`int index = ${o}[instanceIdOfBufferViews] * 4 + 9 * int(instanceIdInBufferView);`;break;case r.Vec4:f=`int index = ${o}[instanceIdOfBufferViews] + 1 * int(instanceIdInBufferView);`;break;case r.Vec3:f=`int index = ${o}[instanceIdOfBufferViews] * 4 + 3 * int(instanceIdInBufferView);`;break;case r.Scalar:f=`int index = ${o}[instanceIdOfBufferViews] * 4 + 1 * int(instanceIdInBufferView);`;break;default:throw new Error(`Unsupported composition type: ${e.compositionType.str}`)}let y="";e.convertToBool&&(y="return (value > 0.5) ? true : false;"),u+=`
|
|
19
|
+
const int ${o}[${s.length}] = int[${s.length}](${s.join(", ")});
|
|
20
|
+
${e.convertToBool?"bool":t} get_${n}(uint instanceId) {
|
|
21
|
+
uint instanceIdOfBufferViews = instanceId / ${c}u;
|
|
22
|
+
uint instanceIdInBufferView = instanceId % ${c}u;
|
|
23
|
+
${f}
|
|
24
|
+
${t} value = ${i}(index);
|
|
25
|
+
${e.convertToBool?y:"return value;"}
|
|
26
|
+
}
|
|
27
|
+
`}}export{L as getGlslComponentDataAccessors};
|
|
@@ -6,8 +6,8 @@ import type { Mesh } from '../foundation/geometry/Mesh';
|
|
|
6
6
|
import type { Primitive } from '../foundation/geometry/Primitive';
|
|
7
7
|
import type { Material } from '../foundation/materials/core/Material';
|
|
8
8
|
import type { Buffer } from '../foundation/memory/Buffer';
|
|
9
|
+
import type { VertexHandles } from '../foundation/renderer/CGAPIResourceRepository';
|
|
9
10
|
import type { PrimitiveUID } from '../types/CommonTypes';
|
|
10
|
-
import type { VertexHandles } from './WebGLResourceRepository';
|
|
11
11
|
/** One vertex attribute layout of a multi-draw group. */
|
|
12
12
|
export type MultiDrawAttribute = {
|
|
13
13
|
semantic: VertexAttributeSemanticsJoinedString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VertexAttribute as z}from"../foundation/definitions/VertexAttribute.js";var g=class g{constructor({key:t,sourceBuffer:r,indexed:u,primitiveMode:e,attributes:o}){this.entries=[];this.totalVertexCount=0;this.totalIndexCount=0;this.version=0;this.uid=++g.
|
|
1
|
+
import{VertexAttribute as z}from"../foundation/definitions/VertexAttribute.js";var g=class g{constructor({key:t,sourceBuffer:r,indexed:u,primitiveMode:e,attributes:o}){this.entries=[];this.totalVertexCount=0;this.totalIndexCount=0;this.version=0;this.uid=++g.wM,this.key=t,this.sourceBuffer=r,this.indexed=u,this.primitiveMode=e,this.attributes=o}};g.wM=0;var S=g,k=new WeakMap,G=0;function H(n){let t=k.get(n);return t==null&&(t=++G,k.set(n,t)),t}var _=(n,t)=>n.attributeAccessors[t].bufferView.buffer;function O(n){if(n.targets.length>0||n.mesh==null)return null;let t=n.attributeAccessors;if(t.length===0)return null;let r=_(n,0),u=n.indicesAccessor,e=n.getVertexCountAsVerticesBased();if(e===0)return null;for(let i of t)if(i.elementCount!==e)return null;let o=n.attributeSemantics,a="";for(let i=0;i<t.length;i++){let s=t[i];a+=`${o[i]}#${s.componentType.index}#${s.compositionType.index}#${s.normalized?1:0}#${s.actualByteStride},`}let l=u!=null;return`${H(r)}#${l?1:0}#${n.primitiveMode.index}#${t.length}#${a}`}function W(n){let t=[],r=n.attributeAccessors,u=n.attributeSemantics;for(let e=0;e<r.length;e++){let o=r[e],a=z.fromString(u[e].split(".")[0]);t.push({semantic:u[e],slot:e,componentType:o.componentType,compositionType:o.compositionType,normalized:o.normalized,byteStride:o.actualByteStride,isIntegerType:a.isIntegerType})}return t}function Y(n){let t=new Map;for(let u of n){let e=O(u);if(e==null)continue;let o=t.get(e);o==null&&(o=[],t.set(e,o)),o.push(u)}let r=[];for(let[u,e]of t){if(e.length<2)continue;let o=e[0],a=o.indicesAccessor!=null,l=W(o),i=_(o,0),s=new S({key:u,sourceBuffer:i,indexed:a,primitiveMode:o.primitiveMode,attributes:l}),c=0,m=0;for(let d of e)c+=d.getVertexCountAsVerticesBased(),a&&(m+=d.indicesAccessor.elementCount);if(c>4294967295)continue;let p=l.map(d=>new Uint8Array(c*d.byteStride)),M=a?new Uint32Array(m):void 0,C=new Uint32Array(c),w=new Uint32Array(c),y=0,I=0;for(let d of e){let B=d.mesh,$=B._webglResources.ensureInstanceSidBase(),b=d.getVertexCountAsVerticesBased(),P=d.attributeAccessors;for(let f=0;f<P.length;f++){let T=l[f],U=P[f].getUint8Array(),E=y*T.byteStride,K=Math.min(U.length,b*T.byteStride);p[f].set(U.subarray(0,K),E)}C.fill($,y,y+b);let V=d.material.materialSID;w.fill(V,y,y+b);let v=d.indicesAccessor,h=a?v.elementCount:0;if(a&&M!=null)for(let f=0;f<h;f++)M[I+f]=v.getScalar(f,{})+y;let R={primitive:d,primitiveUid:d.primitiveUid,mesh:B,vertexOffset:y,vertexCount:b,indexCount:h,indexByteOffset:I*4,materialSid:V};s.entries.push(R),y+=b,I+=h}s.totalVertexCount=c,s.totalIndexCount=m,s.counts=new Int32Array(s.entries.length),s.offsets=new Int32Array(s.entries.length),s.instanceCounts=new Int32Array(s.entries.length),s.firsts=new Int32Array(s.entries.length),s.vertexCounts=new Int32Array(s.entries.length),s.materialSids=w,r.push({group:s,attributeBytes:p,mergedIndices:M,instanceBases:C,materialSids:w})}return r}function j(n){var u,e;let t=n.mesh,r=t==null?void 0:t.meshEntitiesInner[0];return(e=(u=r==null?void 0:r.getMeshRenderer())==null?void 0:u.getFingerPrintId())!=null?e:0}function F(n,t,r){let u=n._multiDrawGroup;if(u==null)return null;let e=t===n.material,o=e?t._getMultiDrawStateKey():`${t.materialUID}|${t._getMultiDrawStateKey()}`;return`${u.uid}|${e?1:0}|${o}|${r}|${n.primitiveMode.index}|${n.getRenderIndexBitSize()}|${n.hasIndices()?1:0}`}var A=new WeakMap,x=new Map,J=0,D=0,L=65536;function q(n,t,r){let u=n._multiDrawGroup;if(u==null)return null;let e=t===n.material,o=n.primitiveMode.index,a=n.getRenderIndexBitSize(),l=n.hasIndices(),i=A.get(n);if(i!=null&&i.generation===D&&i.groupUid===u.uid&&i.materialUid===t.materialUID&&i.materialStateVersion===t.stateVersion&&i.meshRendererFingerPrintId===r&&i.mode===o&&i.indexBitSize===a&&i.indexed===l&&i.isPerVertexMaterial===e)return i.keyId;let s=F(n,t,r);if(s==null)return A.delete(n),null;let c=x.get(s);return c==null&&(x.size>=L&&(x.clear(),D++),c=++J,x.set(s,c)),A.set(n,{groupUid:u.uid,materialUid:t.materialUID,materialStateVersion:t.stateVersion,meshRendererFingerPrintId:r,mode:o,indexBitSize:a,indexed:l,isPerVertexMaterial:e,keyId:c,generation:D}),c}function N(n,t,r,u){let e=[];if(r>0&&n>t||r<0&&n<t)return e;let o=n;for(;;){let a=u(o),l=1,i=o+r;for(;(r>0?i<=t:i>=t)&&u(i)===a;)l++,i+=r;if(e.push({startIndex:o,count:l,step:r,key:a}),r>0&&i>t||r<0&&i<t)break;o=i}return e}function Q(n,t,r,u,e){var s,c;if(e.count=0,r>0&&n>t||r<0&&n<t)return e;let o=Math.abs(t-n)+1;if(e.starts.length<o){let m=Math.max(e.starts.length*2,64);for(;m<o;)m*=2;e.starts=new Int32Array(m),e.counts=new Int32Array(m),e.keys=new Int32Array(m)}let a=n,l=(s=u(n))!=null?s:-1,i=1;for(let m=n+r;r>0?m<=t:m>=t;m+=r){let p=(c=u(m))!=null?c:-1;if(p===l){i++;continue}e.starts[e.count]=a,e.counts[e.count]=i,e.keys[e.count]=l,e.count++,a=m,l=p,i=1}return e.starts[e.count]=a,e.counts[e.count]=i,e.keys[e.count]=l,e.count++,e}export{S as MultiDrawGroup,Y as buildMultiDrawGroups,H as getBufferId,W as getMultiDrawAttributes,q as getMultiDrawStateKeyId,j as getPrimitiveMeshRendererFingerPrintId,O as makeMultiDrawGroupKey,F as makeMultiDrawRenderStateKey,N as planMultiDrawRuns,Q as planMultiDrawRunsInto};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{RenderBackend as m}from"../foundation/definitions/RenderBackend.js";import{VertexAttribute as f}from"../foundation/definitions/VertexAttribute.js";import{Primitive as h}from"../foundation/geometry/Primitive.js";import{buildMultiDrawGroups as v}from"./MultiDraw.js";var p=class{constructor(t){this.eV=new Map;this.tV=!0;this.Tb=0;this.rV=new Set;this.iV=!0;this.i=t}get version(){return this.Tb}hasVaoHandle(t){var e;for(let i of this.eV.values())if(((e=i.vertexHandles)==null?void 0:e.vaoHandle)===t)return!0;return!1}get groups(){return this.eV}markDirty(){this.iV=!0,this.tV=!0}markDirtyForMesh(t){this.rV.add(t),this.tV=!0}rebuildDirtyGroups(){if(!this.tV)return;this.tV=!1;let t=this.iV;this.iV=!1;let e=this.i,i=e.webglResourceRepository,d=e.config.isMultiDrawEnabled&&m.isWebGL2Backend(e.engineState.currentRenderBackend)&&i.isInstanceSidTextureCapable;if(this.aV(),!d){this.rV.clear(),this.Tb++;return}let s=[],o=new Set;h.forEachPrimitive(r=>{if(r._engine!==e)return;s.push(r);let a=r.mesh;a!=null&&o.add(a)});let c=v(s),l=new Set;for(let r of c){let a=r.group;this.nV(r);for(let n=0;n<a.entries.length;n++){let u=a.entries[n];u.primitive.delete3DAPIVertexData(),u.primitive._setMultiDrawGroup(a,n),l.add(u.primitive)}this.eV.set(a.key,a)}for(let r of o)r.updateVariationVBO();for(let r of s)if(!l.has(r))if(r.vertexHandles==null)r.create3DAPIVertexData();else{let a=r.mesh;(t||a!=null&&this.rV.has(a))&&r.update3DAPIVertexData()}for(let r of o)r.updateVAO();this.rV.clear(),this.Tb++}invalidateAll(){this.aV(),this.tV=!0}aV(){let t=this.i.webglResourceRepository;for(let e of this.eV.values()){for(let i of e.entries)i.mesh._webglResources.clearMultiDrawVaoUids(),i.primitive._multiDrawGroup===e&&i.primitive._clearMultiDrawGroup();e.genericMaterialSidVaoHandle!=null&&(t.deleteVertexArray(e.genericMaterialSidVaoHandle),e.genericMaterialSidVaoHandle=void 0),e.vertexHandles!=null&&(t.deleteVertexDataResources(e.vertexHandles),e.vertexHandles=void 0),e.instanceBaseVboHandle!=null&&(t.deleteVertexBuffer(e.instanceBaseVboHandle),e.instanceBaseVboHandle=void 0),e.materialSidVboHandle!=null&&(t.deleteVertexBuffer(e.materialSidVboHandle),e.materialSidVboHandle=void 0)}this.eV.clear()}nV(t){let e=this.i.webglResourceRepository,i=t.group,d=t.attributeBytes.map(n=>e.createVertexBufferFromTypedArray(n)),s=t.mergedIndices!=null?e.createIndexBufferFromTypedArray(t.mergedIndices):void 0,o=e.createVertexBufferFromTypedArray(t.instanceBases),c=e.createVertexBufferFromTypedArray(t.materialSids),l=e.createVertexArray(),r=e.createVertexArray(),a=[];for(let n=0;n<f.AttributeTypeNumber;n++)a[n]=!1;for(let n of i.attributes){let u=f.toAttributeSlotFromJoinedString(n.semantic);a[u]=!0}i.vertexHandles={vaoHandle:l,iboHandle:s,vboHandles:d,attributesFlags:a,setComplete:!1},i.instanceBaseVboHandle=o,i.materialSidVboHandle=c,i.genericMaterialSidVaoHandle=r,i.version++,e.setMultiDrawVertexDataToPipeline(i,l,!0),e.setMultiDrawVertexDataToPipeline(i,r,!1)}};export{p as MultiDrawRepository};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ShaderSemanticsInfo } from '../foundation/definitions/ShaderSemanticsInfo';
|
|
2
|
+
import type { Engine } from '../foundation/system/Engine';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the GLSL accessor of a material property.
|
|
5
|
+
* The instance ID is the material's SID.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getGlslMaterialPropertyAccessor(engine: Engine, materialTypeName: string, info: ShaderSemanticsInfo): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the GLSL accessor of a global property.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getGlslGlobalPropertyAccessor(engine: Engine, info: ShaderSemanticsInfo): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{ComponentType as m}from"../foundation/definitions/ComponentType.js";import{CompositionType as i}from"../foundation/definitions/CompositionType.js";import{Logger as d}from"../foundation/misc/Logger.js";import{getGlobalPropertyOffset as y,getMaterialPropertyOffsets as g,getShaderPropertyFetch as h,getShaderPropertyStrides as S}from"../foundation/renderer/ShaderPropertyLayout.js";var I=new Map([[i.Vec4,"highp vec4"],[i.Vec4Array,"highp vec4"],[i.Vec3Array,"vec3"],[i.Vec2Array,"highp vec2"],[i.Mat4,"mat4"],[i.Mat4Array,"mat4"],[i.Mat3,"mat3"],[i.Mat3Array,"mat3"],[i.Mat2,"mat2"],[i.Mat2Array,"mat2"],[i.Mat4x3Array,"mat4x3"]]);function v(t,e){let{vec4Size:n,scalarSize:r,instanceSize:a,instanceSizeInScalar:o}=t;return t.isArray?`int vec4_idx = ${e.vec4} + ${a} * ${e.instance} + ${n} * int(idxOfArray);
|
|
2
|
+
int scalar_idx = ${e.scalar} + ${o} * ${e.instance} + ${r} * int(idxOfArray);
|
|
3
|
+
`:`int vec4_idx = ${e.vec4} + ${a} * ${e.instance};
|
|
4
|
+
`}function l(t,e){return t.componentType===m.Int?` int val = int(${e});`:t.componentType===m.Bool?` bool val = bool(${e});`:` float val = ${e};`}function x(t){let e=h(t.compositionType);if(e==null)return"";let n=`${e.functionName}(${e.index})`,r=t.componentType===m.Int?"i":"";switch(t.compositionType){case i.Vec3:return` vec4 col0 = ${n};
|
|
5
|
+
highp ${r}vec3 val = ${r}vec3(col0.xyz);`;case i.Vec2:return` highp vec4 col0 = ${n};
|
|
6
|
+
highp ${r}vec2 val = ${r}vec2(col0.xy);`;case i.Scalar:return` vec4 col0 = ${n};
|
|
7
|
+
${l(t,"col0.x")}`;case i.ScalarArray:return` float col0 = ${n};
|
|
8
|
+
${l(t,"col0")}`;default:return` ${I.get(t.compositionType)} val = ${n};
|
|
9
|
+
`}}function u(t,e,n){let r=t.compositionType.getGlslStr(t.componentType),a=i.isTexture(t.compositionType),o=t.semantic.replace(".","_"),c="";if(t.needUniformInDataTextureMode||a){let s=t.arrayLength?`[${t.arrayLength}]`:"";c=` uniform ${r} u_${o}${s};
|
|
10
|
+
`}if(a)return c;if(t.needUniformInDataTextureMode){let s=t.arrayLength?"[idxOfArray]":"";return`${c}
|
|
11
|
+
${r} get_${o}(highp uint _instanceId, const uint idxOfArray) {
|
|
12
|
+
return u_${o}${s};
|
|
13
|
+
}
|
|
14
|
+
`}let p=v(S(t),n);return`${c}
|
|
15
|
+
${e(r,o,p)}${x(t)}
|
|
16
|
+
return val;
|
|
17
|
+
}
|
|
18
|
+
`}function V(t,e,n){let r=g(t,e,n.semantic),a=t.materialRepository._getMaterialCountPerBufferView(e),c=`rnOffsets_${n.semantic.replace(".","_")}`,p=`const int ${c}[${r.length}] = int[${r.length}](${r.join(", ")});`;return u(n,(s,f,$)=>`
|
|
19
|
+
${p}
|
|
20
|
+
${s} get_${f}(highp uint _instanceId, const uint idxOfArray) {
|
|
21
|
+
uint instanceId = _instanceId;
|
|
22
|
+
uint instanceIdOfBufferViews = instanceId / ${a}u;
|
|
23
|
+
uint instanceIdInBufferView = instanceId % ${a}u;
|
|
24
|
+
${$}
|
|
25
|
+
`,{vec4:`${c}[instanceIdOfBufferViews]`,scalar:`${c}[instanceIdOfBufferViews] * 4`,instance:"int(instanceIdInBufferView)"})}function M(t,e){let n=y(t,e.semantic);return n===-1&&d.default.error("Could not get the location offset of the property."),u(e,(r,a,o)=>`
|
|
26
|
+
${r} get_${a}(highp uint _instanceId, const uint idxOfArray) {
|
|
27
|
+
int instanceId = int(_instanceId);
|
|
28
|
+
${o}
|
|
29
|
+
`,{vec4:`${n}`,scalar:`${n*4}`,instance:"instanceId"})}export{M as getGlslGlobalPropertyAccessor,V as getGlslMaterialPropertyAccessor};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CompressionTextureTypeEnum } from '../foundation/definitions/CompressionTextureType';
|
|
2
|
+
import type { TextureData } from '../foundation/renderer/CGAPIResourceRepository';
|
|
3
|
+
import type { BasisFile } from '../types/BasisTexture';
|
|
4
|
+
import type { Size, WebGLResourceHandle } from '../types/CommonTypes';
|
|
5
|
+
import type { WebGLContextWrapper } from './WebGLContextWrapper';
|
|
6
|
+
import type { WebGLResource } from './WebGLResourceRepository';
|
|
7
|
+
/**
|
|
8
|
+
* What `WebGLCompressedTextures` needs from the textures module that owns it.
|
|
9
|
+
*/
|
|
10
|
+
export interface WebGLCompressedTextureResources {
|
|
11
|
+
/** The current WebGL context wrapper, which is replaced when a context is added. */
|
|
12
|
+
getContextWrapper(): WebGLContextWrapper | undefined;
|
|
13
|
+
/** Registers a WebGL object and returns its resource handle. */
|
|
14
|
+
registerResource(obj: WebGLResource): WebGLResourceHandle;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates the compressed textures of the WebGL backend: from pre-transcoded mip data and from Basis Universal files.
|
|
18
|
+
*
|
|
19
|
+
* Owned by `WebGLTextures`, which exposes these operations through its public methods.
|
|
20
|
+
*/
|
|
21
|
+
export declare class WebGLCompressedTextures {
|
|
22
|
+
private __resources;
|
|
23
|
+
constructor(resources: WebGLCompressedTextureResources);
|
|
24
|
+
private get __glw();
|
|
25
|
+
private __registerResource;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a compressed texture from pre-transcoded texture data for multiple mip levels.
|
|
28
|
+
* This method handles various compressed texture formats and uploads the data to GPU.
|
|
29
|
+
*
|
|
30
|
+
* @param textureDataArray - Array of texture data for each mipmap level
|
|
31
|
+
* @param compressionTextureType - The compression format type (e.g., DXT, ETC, ASTC)
|
|
32
|
+
* @returns Promise that resolves to the handle of the created compressed texture
|
|
33
|
+
*/
|
|
34
|
+
createCompressedTexture(textureDataArray: TextureData[], compressionTextureType: CompressionTextureTypeEnum): Promise<WebGLResourceHandle>;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a compressed texture from a Basis Universal file.
|
|
37
|
+
* This method automatically detects the best compression format supported by the hardware
|
|
38
|
+
* and transcodes the Basis file accordingly.
|
|
39
|
+
*
|
|
40
|
+
* @param basisFile - The Basis Universal file containing the compressed texture data
|
|
41
|
+
* @param params - Configuration object for texture creation
|
|
42
|
+
* @param params.border - Border width (must be 0 in WebGL)
|
|
43
|
+
* @returns The handle of the created compressed texture
|
|
44
|
+
*/
|
|
45
|
+
createCompressedTextureFromBasis(basisFile: BasisFile, { border, }: {
|
|
46
|
+
border: Size;
|
|
47
|
+
}): WebGLResourceHandle;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BasisCompressionType as i}from"../foundation/definitions/BasisCompressionType.js";import{decodeBasisImage as W}from"../foundation/textures/decodeBasisImage.js";var E=class{constructor(r){this.x_=r}get u_(){return this.x_.getContextWrapper()}T_(r){return this.x_.registerResource(r)}async createCompressedTexture(r,c){let t=this.u_.getRawContext(),s=t.createTexture(),e=this.T_(s);this.u_.bindTexture2D(15,s);let p=c.index;for(let o of r)t.compressedTexImage2D(t.TEXTURE_2D,o.level,p,o.width,o.height,0,o.buffer);return this.u_.unbindTexture2D(15),e}createCompressedTextureFromBasis(r,{border:c}){let t,s,e=this.u_.getRawContext(),p=e.createTexture(),o=this.T_(p);this.u_.bindTexture2D(15,p);let u=e.getExtension("WEBGL_compressed_texture_s3tc");u&&(t=i.BC3,s=u.COMPRESSED_RGBA_S3TC_DXT5_EXT);let m=e.getExtension("WEBGL_compressed_texture_etc1");m&&(t=i.ETC1,s=m.COMPRESSED_RGB_ETC1_WEBGL);let x=e.getExtension("WEBGL_compressed_texture_atc");x&&(t=i.ATC_RGBA,s=x.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL);let a=e.getExtension("WEBGL_compressed_texture_etc");a&&(t=i.ETC2,s=a.COMPRESSED_RGBA8_ETC2_EAC);let T=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");T&&(t=i.PVRTC1_RGBA,s=T.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG);let _=e.getExtension("WEBGL_compressed_texture_astc");_&&(t=i.ASTC,s=_.COMPRESSED_RGBA_ASTC_4x4_KHR);let d=r.getNumLevels(0);for(let n=0;n<d;n++){let R=r.getImageWidth(0,n),C=r.getImageHeight(0,n),G=W(r,t,0,n);e.compressedTexImage2D(e.TEXTURE_2D,n,s,R,C,c,G)}return this.u_.unbindTexture2D(15),o}};export{E as WebGLCompressedTextures};
|
|
@@ -74,12 +74,7 @@ export declare class WebGLContextWrapper {
|
|
|
74
74
|
readonly webgl2ExtClipCtrl?: any;
|
|
75
75
|
readonly webgl2ExtGmanWM?: any;
|
|
76
76
|
readonly webgl2ExtMD?: WEBGL_multi_draw | null;
|
|
77
|
-
private
|
|
78
|
-
private __activeTextures2D;
|
|
79
|
-
private __activeTextures2DArray;
|
|
80
|
-
private __activeTexturesCube;
|
|
81
|
-
private __boundTextures;
|
|
82
|
-
private __boundSamplers;
|
|
77
|
+
private __textureUnits;
|
|
83
78
|
private __viewport_left;
|
|
84
79
|
private __viewport_top;
|
|
85
80
|
private __viewport_width;
|
|
@@ -219,59 +214,21 @@ export declare class WebGLContextWrapper {
|
|
|
219
214
|
* @param buffers - Array of render buffer targets to draw to
|
|
220
215
|
*/
|
|
221
216
|
drawBuffers(buffers: RenderBufferTargetEnum[]): void;
|
|
222
|
-
/**
|
|
223
|
-
* Activates a texture unit for subsequent texture operations.
|
|
224
|
-
* Optimized to avoid redundant state changes.
|
|
225
|
-
* @param activeTextureIndex - The texture unit index to activate
|
|
226
|
-
*/
|
|
227
|
-
private __activeTexture;
|
|
228
|
-
/**
|
|
229
|
-
* Binds a 2D texture to a specific texture unit.
|
|
230
|
-
* Optimized to avoid redundant state changes.
|
|
231
|
-
* @param activeTextureIndex - The texture unit index
|
|
232
|
-
* @param texture - The 2D texture to bind
|
|
233
|
-
*/
|
|
217
|
+
/** Binds a 2D texture to a specific texture unit. */
|
|
234
218
|
bindTexture2D(activeTextureIndex: Index, texture: WebGLTexture): void;
|
|
235
|
-
/**
|
|
236
|
-
* Binds a 2D array texture to a specific texture unit.
|
|
237
|
-
* Optimized to avoid redundant state changes.
|
|
238
|
-
* @param activeTextureIndex - The texture unit index
|
|
239
|
-
* @param texture - The 2D array texture to bind
|
|
240
|
-
*/
|
|
219
|
+
/** Binds a 2D array texture to a specific texture unit. */
|
|
241
220
|
bindTexture2DArray(activeTextureIndex: Index, texture: WebGLTexture): void;
|
|
242
|
-
/**
|
|
243
|
-
* Binds a sampler object to a specific texture unit.
|
|
244
|
-
* Optimized to avoid redundant state changes.
|
|
245
|
-
* @param activeTextureIndex - The texture unit index
|
|
246
|
-
* @param sampler - The sampler object to bind
|
|
247
|
-
*/
|
|
221
|
+
/** Binds a sampler object to a specific texture unit. */
|
|
248
222
|
bindTextureSampler(activeTextureIndex: Index, sampler: WebGLSampler): void;
|
|
249
|
-
/**
|
|
250
|
-
* Binds a cube map texture to a specific texture unit.
|
|
251
|
-
* Optimized to avoid redundant state changes.
|
|
252
|
-
* @param activeTextureIndex - The texture unit index
|
|
253
|
-
* @param texture - The cube map texture to bind
|
|
254
|
-
*/
|
|
223
|
+
/** Binds a cube map texture to a specific texture unit. */
|
|
255
224
|
bindTextureCube(activeTextureIndex: Index, texture: WebGLTexture): void;
|
|
256
|
-
/**
|
|
257
|
-
* Unbinds a 2D texture from a specific texture unit.
|
|
258
|
-
* @param activeTextureIndex - The texture unit index
|
|
259
|
-
*/
|
|
225
|
+
/** Unbinds a 2D texture from a specific texture unit. */
|
|
260
226
|
unbindTexture2D(activeTextureIndex: Index): void;
|
|
261
|
-
/**
|
|
262
|
-
* Unbinds a 2D array texture from a specific texture unit.
|
|
263
|
-
* @param activeTextureIndex - The texture unit index
|
|
264
|
-
*/
|
|
227
|
+
/** Unbinds a 2D array texture from a specific texture unit. */
|
|
265
228
|
unbindTexture2DArray(activeTextureIndex: Index): void;
|
|
266
|
-
/**
|
|
267
|
-
* Unbinds a cube map texture from a specific texture unit.
|
|
268
|
-
* @param activeTextureIndex - The texture unit index
|
|
269
|
-
*/
|
|
229
|
+
/** Unbinds a cube map texture from a specific texture unit. */
|
|
270
230
|
unbindTextureCube(activeTextureIndex: Index): void;
|
|
271
|
-
/**
|
|
272
|
-
* Unbinds all currently bound textures from all texture units.
|
|
273
|
-
* This is useful for cleanup operations.
|
|
274
|
-
*/
|
|
231
|
+
/** Unbinds all currently bound textures from all texture units. */
|
|
275
232
|
unbindTextures(): void;
|
|
276
233
|
/**
|
|
277
234
|
* Gets a WebGL extension and caches it for future use.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Vector4 as m}from"../foundation/math/Vector4.js";import{Logger as _}from"../foundation/misc/Logger.js";import{WebGLExtension as n}from"./WebGLExtension.js";var u=-1,
|
|
1
|
+
import{Vector4 as m}from"../foundation/math/Vector4.js";import{Logger as _}from"../foundation/misc/Logger.js";import{WebGLExtension as n}from"./WebGLExtension.js";import{WebGLTextureUnitState as h}from"./WebGLTextureUnitState.js";var u=-1,d=class{constructor(e,t,r){this.WE=1;this.width=0;this.height=0;this.LE=0;this.wE=0;this.gE=0;this.TE=0;this.VE=0;this.vE=0;this.AE=0;this.fE=0;this.BE=u;this.ME=u;this.RE=u;this.IE=u;this.OE=u;this.PE=u;this.GE=u;this.DE=u;this.SE=u;this._isWebXRMode=!1;this.CE=new Map;this.bE=t,this.dE=new h({getContext:()=>this.bE}),this.width=r.width,this.height=r.height,this.canvas=r,this.gE=this.AE=this.width,this.TE=this.fE=this.height,this.yE=!0,this.bE.constructor.name==="WebGL2RenderingContext"&&(this.WE=2,this.webgl2ExtTFL=this._E(e,n.TextureFloatLinear),this.webgl2ExtTHFL=this._E(e,n.TextureHalfFloatLinear),this.webgl2ExtTFA=this._E(e,n.TextureFilterAnisotropic),this.webgl2ExtCBF=this._E(e,n.ColorBufferFloatWebGL2),this.webgl2ExtCBHF=this._E(e,n.ColorBufferHalfFloatWebGL2),this.webgl2ExtCTAstc=this.cE(e,n.CompressedTextureAstc),this.webgl2ExtCTS3tc=this.cE(e,n.CompressedTextureS3tc),this.webgl2ExtCTPvrtc=this.cE(e,n.CompressedTexturePvrtc),this.webgl2ExtCTAtc=this.cE(e,n.CompressedTextureAtc),this.webgl2ExtCTEtc=this.cE(e,n.CompressedTextureEtc),this.webgl2ExtCTEtc1=this.cE(e,n.CompressedTextureEtc1),this.webgl2ExtCTBptc=this.cE(e,n.CompressedTextureBptc),this.webgl2ExtMLTVIEW=this._E(e,n.OculusMultiview),this.webgl2ExtMLTVIEW?this.webgl2ExtMLTVIEW.is_multisample=!0:(this.webgl2ExtMLTVIEW=this._E(e,n.OvrMultiview2),this.webgl2ExtMLTVIEW?this.webgl2ExtMLTVIEW.is_multisample=!1:(e.cgApiDebugConsoleOutput&&_.default.info("OCULUS_multiview and OVR_multiview2 extensions are not supported"),this.yE=!1)),this.webgl2ExtClipCtrl=this._E(e,n.ClipControl),this.webgl2ExtMD=this._E(e,n.MultiDraw),e.cgApiDebugConsoleOutput&&(this.webgl2ExtGmanWM=this._E(e,n.GMAN_WEBGL_MEMORY))),this.FE(),this.NE(),this.XE()}getRawContext(){return this.bE}getRawContextAsWebGL1(){return this.bE}getRawContextAsWebGL2(){return this.bE}get viewport(){return m.fromCopyArray([this.LE,this.wE,this.gE,this.TE])}get defaultViewport(){return m.fromCopyArray([this.VE,this.vE,this.AE,this.fE])}isSupportWebGL1Extension(e,t){return!!this._E(e,t)}isNotSupportWebGL1Extension(e,t){return!this.isSupportWebGL1Extension(e,t)}getIsWebGL2(e){return this.isWebGL2}get isWebGL2(){return this.WE===2}createVertexArray(){return this.bE.createVertexArray()}deleteVertexArray(e){this.bE.deleteVertexArray(e)}bindVertexArray(e){this.bE.bindVertexArray(e)}vertexAttribDivisor(e,t){this.bE.vertexAttribDivisor(e,t)}drawElementsInstanced(e,t,r,i,s){this.bE.drawElementsInstanced(e,t,r,i,s)}drawArraysInstanced(e,t,r,i){this.bE.drawArraysInstanced(e,t,r,i)}multiDrawElementsInstanced(e,t,r,i,s,l,a,o,E){let b=this.webgl2ExtMD;if(b!=null){b.multiDrawElementsInstancedWEBGL(e,t,r,i,s,l,a,o,E);return}for(let x=0;x<E;x++)this.bE.drawElementsInstanced(e,t[r+x],i,s[l+x],a[o+x])}multiDrawArraysInstanced(e,t,r,i,s,l,a,o){let E=this.webgl2ExtMD;if(E!=null){E.multiDrawArraysInstancedWEBGL(e,t,r,i,s,l,a,o);return}for(let b=0;b<o;b++)this.bE.drawArraysInstanced(e,t[r+b],i[s+b],l[a+b])}colorAttachment(e){return 36064+e}drawBuffers(e){let t=this.bE;if(e.length===0){t.drawBuffers([t.NONE]);return}let r=e[0].webGLConstantValue();t.drawBuffers(e.map(i=>i.webGLConstantValue())),r===t.NONE||e.length===0?t.colorMask(!1,!1,!1,!1):t.colorMask(!0,!0,!0,!0)}bindTexture2D(e,t){this.dE.bindTexture2D(e,t)}bindTexture2DArray(e,t){this.dE.bindTexture2DArray(e,t)}bindTextureSampler(e,t){this.dE.bindTextureSampler(e,t)}bindTextureCube(e,t){this.dE.bindTextureCube(e,t)}unbindTexture2D(e){this.dE.unbindTexture2D(e)}unbindTexture2DArray(e){this.dE.unbindTexture2DArray(e)}unbindTextureCube(e){this.dE.unbindTextureCube(e)}unbindTextures(){this.dE.unbindTextures()}_E(e,t){let r=this.bE;if(!this.CE.has(t)){let i=r.getExtension(t.toString());if(i==null&&e.cgApiDebugConsoleOutput){let s=`${t.toString()} Not Available in this environment`;_.default.info(s)}return this.CE.set(t,i),i}return this.CE.get(t)}cE(e,t){var i,s;let r=this.bE;if(!this.CE.has(t)){let l=t.toString(),a=(s=(i=r.getExtension(l))!=null?i:r.getExtension(`MOZ_${l}`))!=null?s:r.getExtension(`WEBKIT_${l}`);if(a==null&&e.cgApiDebugConsoleOutput){let o=`${t.toString()} Not Available in this environment`;_.default.info(o)}else this.CE.set(t,a);return a}return this.CE.get(t)}setViewport(e,t,r,i){let s=this.bE;(this.gE!==r||this.TE!==i||this.LE!==e||this.wE!==t)&&(s.viewport(e,t,r,i),this.LE=e,this.wE=t,this.gE=r,this.TE=i)}setViewportAsVector4(e){let t=this.bE;(this.gE!==e.z||this.TE!==e.w||this.LE!==e.x||this.wE!==e.y)&&(t.viewport(e.x,e.y,e.z,e.w),this.LE=e.x,this.wE=e.y,this.gE=e.z,this.TE=e.w)}FE(){if(!this.isWebGL2)return;let e=this.bE,t=e.getParameter(e.UNIFORM_BUFFER_OFFSET_ALIGNMENT),r=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE);this.ME=e.getParameter(e.MAX_VERTEX_UNIFORM_BLOCKS),this.RE=e.getParameter(e.MAX_FRAGMENT_UNIFORM_BLOCKS),this.IE=Math.min(this.ME,this.RE),this.BE=r-r%t,this.OE=t,this.PE=r}NE(){let e=this.getRawContext();this.GE=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.GE=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)}XE(){let e=this.getRawContext();this.SE=e.getParameter(e.MAX_TEXTURE_SIZE)}getMaxTextureSize(){return this.SE}getMaxConventionUniformBlocks(){return this.IE}getAlignedMaxUniformBlockSize(){return this.BE}getMaxVertexUniformVectors(){return this.GE}getMaxFragmentUniformVectors(){return this.DE}getWebGLMemoryInfo(){if(this.webgl2ExtGmanWM)return this.webgl2ExtGmanWM.getMemoryInfo()}isMultiview(e){return this.yE&&e.multiViewForWebVR}};export{d as WebGLContextWrapper};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type HdriFormatEnum } from '../foundation/definitions/HdriFormat';
|
|
2
|
+
import type { DirectTextureData } from '../foundation/renderer/CGAPIResourceRepository';
|
|
3
|
+
import type { Engine } from '../foundation/system/Engine';
|
|
4
|
+
import type { Sampler } from '../foundation/textures/Sampler';
|
|
5
|
+
import type { Count, Size } from '../types/CommonTypes';
|
|
6
|
+
import type { WebGLContextWrapper } from './WebGLContextWrapper';
|
|
7
|
+
/**
|
|
8
|
+
* What `WebGLCubeTextureFileLoader` needs from the cube textures module that owns it.
|
|
9
|
+
*/
|
|
10
|
+
export interface WebGLCubeTextureFileLoaderResources {
|
|
11
|
+
/** The current WebGL context wrapper, which is replaced when a context is added. */
|
|
12
|
+
getContextWrapper(): WebGLContextWrapper | undefined;
|
|
13
|
+
/** Creates the cube texture from the decoded faces of every mip level. */
|
|
14
|
+
createCubeTexture(engine: Engine, mipLevelCount: Count, images: Array<{
|
|
15
|
+
posX: DirectTextureData;
|
|
16
|
+
negX: DirectTextureData;
|
|
17
|
+
posY: DirectTextureData;
|
|
18
|
+
negY: DirectTextureData;
|
|
19
|
+
posZ: DirectTextureData;
|
|
20
|
+
negZ: DirectTextureData;
|
|
21
|
+
}>, width: Size, height: Size): [number, Sampler];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Loads the faces of a cube texture from image files (jpg, hdr, RGBE PNG and RGB9_E5 PNG).
|
|
25
|
+
*
|
|
26
|
+
* Owned by `WebGLCubeTextures`, which exposes these operations through its public methods.
|
|
27
|
+
*/
|
|
28
|
+
export declare class WebGLCubeTextureFileLoader {
|
|
29
|
+
private __resources;
|
|
30
|
+
constructor(resources: WebGLCubeTextureFileLoaderResources);
|
|
31
|
+
private get __glw();
|
|
32
|
+
createCubeTextureFromFiles(engine: Engine, baseUri: string, mipLevelCount: Count, isNamePosNeg: boolean, hdriFormat: HdriFormatEnum): Promise<[number, Sampler, number, number]>;
|
|
33
|
+
/**
|
|
34
|
+
* Reads back an RGB9_E5 PNG image (hdrpng.js layout, little-endian packed word) and repacks it
|
|
35
|
+
* to the native UNSIGNED_INT_5_9_9_9_REV layout: E[31:27], B[26:18], G[17:9], R[8:0].
|
|
36
|
+
*/
|
|
37
|
+
private __decodeRgb9E5PngToNative;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import N from"../_deps/vendor__hdrpng.js";import{HdriFormat as D}from"../foundation/definitions/HdriFormat.js";import{Logger as W}from"../foundation/misc/Logger.js";var L=class{constructor(e){this.x_=e}get u_(){return this.x_.getContextWrapper()}async createCubeTextureFromFiles(e,i,p,b,r){let t=this.u_.getRawContext(),n=this.u_.getRawContextAsWebGL2(),m=r===D.RGB9_E5_PNG,a=null,u=null;m&&(a=n.createTexture(),u=n.createFramebuffer());let R=[],x=0,f=0;for(let T=0;T<p;T++){let G=()=>new Promise((_,s)=>{let C=0,X=[],E=".jpg";r===D.HDR_LINEAR?E=".hdr":r===D.RGBE_PNG?E=".RGBE.PNG":r===D.RGB9_E5_PNG&&(E=".RGB9_E5.PNG");let I="_right_",U="_left_",P="_top_",h="_bottom_",y="_front_",B="_back_";b&&(I="_posx_",U="_negx_",P="_posy_",h="_negy_",y="_posz_",B="_negz_");let g=[[i+I+T+E,t.TEXTURE_CUBE_MAP_POSITIVE_X],[i+U+T+E,t.TEXTURE_CUBE_MAP_NEGATIVE_X],[i+P+T+E,t.TEXTURE_CUBE_MAP_POSITIVE_Y],[i+h+T+E,t.TEXTURE_CUBE_MAP_NEGATIVE_Y],[i+y+T+E,t.TEXTURE_CUBE_MAP_POSITIVE_Z],[i+B+T+E,t.TEXTURE_CUBE_MAP_NEGATIVE_Z]];for(let l=0;l<g.length;l++){let M=g[l][1],o;r===D.HDR_LINEAR?o=new N:o=new Image,o.hdriFormat=r,o.side=M,o.uri=g[l][0],o.crossOrigin="Anonymous",o.onload=()=>{C++,X.push(o),C===6&&_(X)},o.onerror=()=>{s(o.uri)},o.src=g[l][0]}}),A;try{A=await G()}catch{try{A=await G()}catch(s){W.default.error(`failed to load ${s}`)}}let c={};for(let _ of A){let s=m?this.UE(n,_,a,u):_;switch(_.side){case t.TEXTURE_CUBE_MAP_POSITIVE_X:c.posX=s;break;case t.TEXTURE_CUBE_MAP_POSITIVE_Y:c.posY=s;break;case t.TEXTURE_CUBE_MAP_POSITIVE_Z:c.posZ=s;break;case t.TEXTURE_CUBE_MAP_NEGATIVE_X:c.negX=s;break;case t.TEXTURE_CUBE_MAP_NEGATIVE_Y:c.negY=s;break;case t.TEXTURE_CUBE_MAP_NEGATIVE_Z:c.negZ=s;break}T===0&&(x=_.width,f=_.height)}R.push(c)}let[d,F]=this.x_.createCubeTexture(e,p,R,x,f);return a!=null&&n.deleteTexture(a),u!=null&&n.deleteFramebuffer(u),[d,F,x,f]}UE(e,i,p,b){let r=i.width,t=i.height;e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,r,t,0,e.RGBA,e.UNSIGNED_BYTE,i),e.bindFramebuffer(e.FRAMEBUFFER,b),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,p,0);let n=new Uint8Array(r*t*4);e.readPixels(0,0,r,t,e.RGBA,e.UNSIGNED_BYTE,n),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindTexture(e.TEXTURE_2D,null);let m=new Uint32Array(r*t);for(let a=0;a<r*t;a++){let u=n[a*4]|n[a*4+1]<<8|n[a*4+2]<<16|n[a*4+3]<<24,R=u&31,x=u>>>23&511,f=u>>>14&511,d=u>>>5&511;m[a]=(R<<27)+(d<<18)+(f<<9)+x}return{hdriFormat:D.RGB9_E5_PNG,width:r,height:t,rgb9e5:m}}};export{L as WebGLCubeTextureFileLoader};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type HdriFormatEnum } from '../foundation/definitions/HdriFormat';
|
|
2
|
+
import type { DirectTextureData } from '../foundation/renderer/CGAPIResourceRepository';
|
|
3
|
+
import type { Engine } from '../foundation/system/Engine';
|
|
4
|
+
import { Sampler } from '../foundation/textures/Sampler';
|
|
5
|
+
import type { BasisFile } from '../types/BasisTexture';
|
|
6
|
+
import type { Count, Size, WebGLResourceHandle } from '../types/CommonTypes';
|
|
7
|
+
import type { WebGLContextWrapper } from './WebGLContextWrapper';
|
|
8
|
+
import type { WebGLResource } from './WebGLResourceRepository';
|
|
9
|
+
/**
|
|
10
|
+
* What `WebGLCubeTextures` needs from the resource repository that owns it.
|
|
11
|
+
*/
|
|
12
|
+
export interface WebGLCubeTextureResources {
|
|
13
|
+
/** The current WebGL context wrapper, which is replaced when a context is added. */
|
|
14
|
+
getContextWrapper(): WebGLContextWrapper | undefined;
|
|
15
|
+
/** Registers a WebGL object and returns its resource handle. */
|
|
16
|
+
registerResource(obj: WebGLResource): WebGLResourceHandle;
|
|
17
|
+
/** Returns the WebGL object of a resource handle. */
|
|
18
|
+
getWebGLResource(handle: WebGLResourceHandle): WebGLResource | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates the cube textures of the WebGL2 backend (from decoded images, image files and Basis files) and reads
|
|
22
|
+
* their faces back.
|
|
23
|
+
*
|
|
24
|
+
* Owned by `WebGLResourceRepository`, which exposes these operations through its public methods.
|
|
25
|
+
*/
|
|
26
|
+
export declare class WebGLCubeTextures {
|
|
27
|
+
private __resources;
|
|
28
|
+
private __fileLoader;
|
|
29
|
+
constructor(resources: WebGLCubeTextureResources);
|
|
30
|
+
private get __glw();
|
|
31
|
+
private __registerResource;
|
|
32
|
+
private getWebGLResource;
|
|
33
|
+
/**
|
|
34
|
+
* create a CubeTexture
|
|
35
|
+
*
|
|
36
|
+
* @param mipLevelCount
|
|
37
|
+
* @param images
|
|
38
|
+
* @param width
|
|
39
|
+
* @param height
|
|
40
|
+
* @returns resource handle
|
|
41
|
+
*/
|
|
42
|
+
createCubeTexture(engine: Engine, mipLevelCount: Count, images: Array<{
|
|
43
|
+
posX: DirectTextureData;
|
|
44
|
+
negX: DirectTextureData;
|
|
45
|
+
posY: DirectTextureData;
|
|
46
|
+
negY: DirectTextureData;
|
|
47
|
+
posZ: DirectTextureData;
|
|
48
|
+
negZ: DirectTextureData;
|
|
49
|
+
}>, width: Size, height: Size): [number, Sampler];
|
|
50
|
+
/**
|
|
51
|
+
* Create Cube Texture from image files.
|
|
52
|
+
* @param baseUri the base uri to load images;
|
|
53
|
+
* @param mipLevelCount the number of mip levels (include root level). if no mipmap, the value should be 1;
|
|
54
|
+
* @returns the WebGLResourceHandle for the generated Cube Texture
|
|
55
|
+
*/
|
|
56
|
+
createCubeTextureFromFiles(engine: Engine, baseUri: string, mipLevelCount: Count, isNamePosNeg: boolean, hdriFormat: HdriFormatEnum): Promise<[number, Sampler, number, number]>;
|
|
57
|
+
createCubeTextureFromBasis(basisFile: BasisFile, { magFilter, minFilter, wrapS, wrapT, border, }: {
|
|
58
|
+
border?: number | undefined;
|
|
59
|
+
magFilter?: import("..").TextureParameterEnum | undefined;
|
|
60
|
+
minFilter?: import("..").TextureParameterEnum | undefined;
|
|
61
|
+
wrapS?: import("..").TextureParameterEnum | undefined;
|
|
62
|
+
wrapT?: import("..").TextureParameterEnum | undefined;
|
|
63
|
+
}): {
|
|
64
|
+
resourceHandle: number;
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Reads pixel data from a specific face of a cube texture.
|
|
70
|
+
* This creates a temporary framebuffer, attaches the cube face, and reads the pixels.
|
|
71
|
+
* For floating-point textures (HDR), it uses a shader-based approach to sample and convert.
|
|
72
|
+
*
|
|
73
|
+
* @param textureHandle - Handle to the cube texture
|
|
74
|
+
* @param width - Width of the face texture
|
|
75
|
+
* @param height - Height of the face texture
|
|
76
|
+
* @param faceIndex - Index of the cube face (0=+X, 1=-X, 2=+Y, 3=-Y, 4=+Z, 5=-Z)
|
|
77
|
+
* @returns Promise resolving to the pixel data as a Uint8Array (RGBA format)
|
|
78
|
+
*/
|
|
79
|
+
getCubeTexturePixelData(textureHandle: WebGLResourceHandle, width: number, height: number, faceIndex: number): Promise<Uint8Array>;
|
|
80
|
+
/**
|
|
81
|
+
* Reads cube texture data using a shader-based approach.
|
|
82
|
+
* This is used for HDR/float textures that cannot be read directly.
|
|
83
|
+
*
|
|
84
|
+
* @param gl - WebGL2 rendering context
|
|
85
|
+
* @param cubeTexture - The cube texture to read from
|
|
86
|
+
* @param width - Width of the face texture
|
|
87
|
+
* @param height - Height of the face texture
|
|
88
|
+
* @param faceIndex - Index of the cube face (0=+X, 1=-X, 2=+Y, 3=-Y, 4=+Z, 5=-Z)
|
|
89
|
+
* @param isHdrFormat - Whether the texture is HDR format (applies tone mapping and gamma correction if true)
|
|
90
|
+
*/
|
|
91
|
+
private __readCubeTextureWithShader;
|
|
92
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import{BasisCompressionType as G}from"../foundation/definitions/BasisCompressionType.js";import{HdriFormat as P}from"../foundation/definitions/HdriFormat.js";import{TextureParameter as E}from"../foundation/definitions/TextureParameter.js";import{decodeBasisImage as W}from"../foundation/textures/decodeBasisImage.js";import{Sampler as h}from"../foundation/textures/Sampler.js";import{WebGLCubeTextureFileLoader as v}from"./WebGLCubeTextureFileLoader.js";import{WebGLExtension as y}from"./WebGLExtension.js";var I=class{constructor(e){this.x_=e,this.HE=new v({getContextWrapper:()=>this.x_.getContextWrapper(),createCubeTexture:(u,n,c,o,a)=>this.createCubeTexture(u,n,c,o,a)})}get u_(){return this.x_.getContextWrapper()}T_(e){return this.x_.registerResource(e)}getWebGLResource(e){return this.x_.getWebGLResource(e)}createCubeTexture(e,u,n,c,o){let a=this.u_.getRawContext(),t=a.createTexture(),_=this.T_(t);this.u_.bindTextureCube(15,t);let R=E.ClampToEdge,d=E.ClampToEdge,A=E.Linear,b=E.Linear;n[0].posX.hdriFormat===P.HDR_LINEAR&&this.u_.isNotSupportWebGL1Extension(e.config,y.TextureFloatLinear)?(u>=2?A=E.NearestMipmapNearest:A=E.Nearest,b=E.Nearest):(u>=2?A=E.LinearMipmapLinear:A=E.Linear,b=E.Linear);let C=new h(e,{wrapS:R,wrapT:d,minFilter:A,magFilter:b});C.create();let p=(r,i,T)=>{if(r.hdriFormat===P.HDR_LINEAR){let s=this.u_.getRawContextAsWebGL2();s.texImage2D(i,T,e.config.isMobile?s.RGB16F:s.RGB32F,r.width,r.height,0,s.RGB,s.FLOAT,r.dataFloat)}else if(r.rgb9e5!=null){let s=this.u_.getRawContextAsWebGL2();s.texImage2D(i,T,s.RGB9_E5,r.width,r.height,0,s.RGB,s.UNSIGNED_INT_5_9_9_9_REV,r.rgb9e5)}else r instanceof HTMLImageElement||r instanceof HTMLCanvasElement?a.texImage2D(i,T,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,r):a.texImage2D(i,T,a.RGBA,c/2**T,o/2**T,0,a.RGBA,a.UNSIGNED_BYTE,r)};for(let r=0;r<n.length;r++){let i=n[r];p(i.posX,a.TEXTURE_CUBE_MAP_POSITIVE_X,r),p(i.negX,a.TEXTURE_CUBE_MAP_NEGATIVE_X,r),p(i.posY,a.TEXTURE_CUBE_MAP_POSITIVE_Y,r),p(i.negY,a.TEXTURE_CUBE_MAP_NEGATIVE_Y,r),p(i.posZ,a.TEXTURE_CUBE_MAP_POSITIVE_Z,r),p(i.negZ,a.TEXTURE_CUBE_MAP_NEGATIVE_Z,r)}if(this.u_.isWebGL2&&n.length>0){let r=this.u_.getRawContextAsWebGL2();r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAX_LEVEL,n.length-1)}return this.u_.unbindTextureCube(15),[_,C]}async createCubeTextureFromFiles(e,u,n,c,o){return this.HE.createCubeTextureFromFiles(e,u,n,c,o)}createCubeTextureFromBasis(e,{magFilter:u=E.Linear,minFilter:n=E.LinearMipmapLinear,wrapS:c=E.Repeat,wrapT:o=E.Repeat,border:a=0}){let t=this.u_.getRawContext(),_,R,d=t.createTexture(),A=this.T_(d);this.u_.bindTextureCube(15,d);let b=t.getExtension("WEBGL_compressed_texture_s3tc");b&&(_=G.BC3,R=b.COMPRESSED_RGBA_S3TC_DXT5_EXT);let C=t.getExtension("WEBGL_compressed_texture_etc1");C&&(_=G.ETC1,R=C.COMPRESSED_RGB_ETC1_WEBGL);let p=t.getExtension("WEBGL_compressed_texture_atc");p&&(_=G.ATC_RGBA,R=p.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL);let r=t.getExtension("WEBGL_compressed_texture_etc");r&&(_=G.ETC2,R=r.COMPRESSED_RGBA8_ETC2_EAC);let i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");i&&(_=G.PVRTC1_RGBA,R=i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG);let T=t.getExtension("WEBGL_compressed_texture_astc");T&&(_=G.ASTC,R=T.COMPRESSED_RGBA_ASTC_4x4_KHR);let s=e.getNumImages(),m=e.getNumLevels(0);if(t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,c.index),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,o.index),m>=2)t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,n.index),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,u.index);else{let x=n;n===E.LinearMipmapLinear&&(x=E.Linear),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,x.index),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,u.index)}let L=e.getImageWidth(0,0),B=e.getImageHeight(0,0);for(let x=0;x<m;x++)for(let f=0;f<s;f++){let U=e.getImageWidth(f,x),F=e.getImageHeight(f,x),D=W(e,_,f,x);t.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+f,x,R,U,F,a,D)}return this.u_.unbindTextureCube(15),{resourceHandle:A,width:L,height:B}}async getCubeTexturePixelData(e,u,n,c){let o=this.u_.getRawContext(),a=this.getWebGLResource(e),t=o.createFramebuffer();o.bindFramebuffer(o.FRAMEBUFFER,t);let _=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;if(o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,_,a,0),o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)return o.bindFramebuffer(o.FRAMEBUFFER,null),o.deleteFramebuffer(t),this.YE(o,a,u,n,c,!0);let d=new Uint8Array(u*n*4);return o.readPixels(0,0,u,n,o.RGBA,o.UNSIGNED_BYTE,d),o.bindFramebuffer(o.FRAMEBUFFER,null),o.deleteFramebuffer(t),d}YE(e,u,n,c,o,a){let t=e.getParameter(e.VIEWPORT),_=e.getParameter(e.CURRENT_PROGRAM),R=e.getParameter(e.VERTEX_ARRAY_BINDING),d=e.getParameter(e.ARRAY_BUFFER_BINDING),A=e.getParameter(e.FRAMEBUFFER_BINDING),b=e.getParameter(e.ACTIVE_TEXTURE),C=e.getParameter(e.TEXTURE_BINDING_CUBE_MAP),p=e.getParameter(e.TEXTURE_BINDING_2D),r=`#version 300 es
|
|
2
|
+
in vec2 a_position;
|
|
3
|
+
out vec2 v_texCoord;
|
|
4
|
+
void main() {
|
|
5
|
+
v_texCoord = a_position * 0.5 + 0.5;
|
|
6
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
7
|
+
}
|
|
8
|
+
`,i=`#version 300 es
|
|
9
|
+
precision highp float;
|
|
10
|
+
uniform samplerCube u_cubemap;
|
|
11
|
+
uniform int u_faceIndex;
|
|
12
|
+
uniform int u_isHdr;
|
|
13
|
+
in vec2 v_texCoord;
|
|
14
|
+
out vec4 fragColor;
|
|
15
|
+
|
|
16
|
+
vec3 getDirection(int face, vec2 uv) {
|
|
17
|
+
vec2 st = uv * 2.0 - 1.0;
|
|
18
|
+
if (face == 0) return vec3( 1.0, -st.y, -st.x); // +X
|
|
19
|
+
if (face == 1) return vec3(-1.0, -st.y, st.x); // -X
|
|
20
|
+
if (face == 2) return vec3( st.x, 1.0, st.y); // +Y
|
|
21
|
+
if (face == 3) return vec3( st.x, -1.0, -st.y); // -Y
|
|
22
|
+
if (face == 4) return vec3( st.x, -st.y, 1.0); // +Z
|
|
23
|
+
return vec3(-st.x, -st.y, -1.0); // -Z
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void main() {
|
|
27
|
+
vec3 dir = normalize(getDirection(u_faceIndex, v_texCoord));
|
|
28
|
+
vec3 color = texture(u_cubemap, dir).rgb;
|
|
29
|
+
|
|
30
|
+
// Only apply tone mapping and gamma correction for HDR textures
|
|
31
|
+
// LDR textures (e.g., RGBA8) should pass through unchanged
|
|
32
|
+
if (u_isHdr != 0) {
|
|
33
|
+
// Reinhard tone mapping
|
|
34
|
+
color = color / (1.0 + color);
|
|
35
|
+
|
|
36
|
+
// Gamma correction
|
|
37
|
+
color = pow(color, vec3(1.0 / 2.2));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fragColor = vec4(color, 1.0);
|
|
41
|
+
}
|
|
42
|
+
`,T=e.createShader(e.VERTEX_SHADER);e.shaderSource(T,r),e.compileShader(T);let s=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(s,i),e.compileShader(s);let m=e.createProgram();e.attachShader(m,T),e.attachShader(m,s),e.linkProgram(m);let L=e.createVertexArray();e.bindVertexArray(L);let B=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,B),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,1]),e.STATIC_DRAW);let x=e.getAttribLocation(m,"a_position");e.enableVertexAttribArray(x),e.vertexAttribPointer(x,2,e.FLOAT,!1,0,0);let f=e.createTexture();e.bindTexture(e.TEXTURE_2D,f),e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,n,c,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR);let U=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,U),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,f,0),e.viewport(0,0,n,c),e.useProgram(m),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,u),e.uniform1i(e.getUniformLocation(m,"u_cubemap"),0),e.uniform1i(e.getUniformLocation(m,"u_faceIndex"),o),e.uniform1i(e.getUniformLocation(m,"u_isHdr"),a?1:0),e.drawArrays(e.TRIANGLE_STRIP,0,4);let F=new Uint8Array(n*c*4);return e.readPixels(0,0,n,c,e.RGBA,e.UNSIGNED_BYTE,F),e.deleteFramebuffer(U),e.deleteTexture(f),e.deleteBuffer(B),e.deleteVertexArray(L),e.deleteProgram(m),e.deleteShader(T),e.deleteShader(s),e.bindVertexArray(R),e.bindBuffer(e.ARRAY_BUFFER,d),e.bindFramebuffer(e.FRAMEBUFFER,A),e.activeTexture(b),e.bindTexture(e.TEXTURE_CUBE_MAP,C),e.bindTexture(e.TEXTURE_2D,p),e.useProgram(_),e.viewport(t[0],t[1],t[2],t[3]),F}};export{I as WebGLCubeTextures};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Engine } from '../foundation/system/Engine';
|
|
2
|
+
import type { CGAPIResourceHandle } from '../types/CommonTypes';
|
|
3
|
+
import type { InstanceSidTable } from './InstanceSidTable';
|
|
4
|
+
/**
|
|
5
|
+
* The data texture of the WebGL2 renderer: an RGBA32F texture that holds the GPU instance data (the component and
|
|
6
|
+
* material data read by the shaders), the morph target data after it, and, for multi-draw rendering, the instance
|
|
7
|
+
* SID / remap tables in reserved rows at the end.
|
|
8
|
+
*
|
|
9
|
+
* Owned by `WebGLStrategyWebGL2`, which calls `update` when the GPU instance data changed and binds the texture to
|
|
10
|
+
* texture unit 0 when it draws.
|
|
11
|
+
*/
|
|
12
|
+
export declare class WebGLDataTexture {
|
|
13
|
+
private __engine;
|
|
14
|
+
private __onDeleted;
|
|
15
|
+
private __dataTextureUid;
|
|
16
|
+
/** Layout of the instance SID / remap regions inside the data texture. */
|
|
17
|
+
private __dataTextureWidth;
|
|
18
|
+
private __instanceSidBaseRow;
|
|
19
|
+
private __instanceRemapBaseRow;
|
|
20
|
+
private __instanceSidBaseVec4;
|
|
21
|
+
private __instanceRemapBaseVec4;
|
|
22
|
+
private __instanceSidCapacity;
|
|
23
|
+
/**
|
|
24
|
+
* Total byte length of the GPUVertexData (morph target) buffers that the current data texture
|
|
25
|
+
* contains. They are appended after the instance data, so the texture has to be recreated when
|
|
26
|
+
* a mesh setup adds new ones.
|
|
27
|
+
*/
|
|
28
|
+
private __dataTextureMorphDataByteLength;
|
|
29
|
+
private __lastGpuInstanceDataBufferCount;
|
|
30
|
+
/**
|
|
31
|
+
* @param engine - The engine
|
|
32
|
+
* @param onDeleted - Called whenever the texture is deleted (to be recreated by the next `update`), so that the
|
|
33
|
+
* owner binds the new texture at the next draw
|
|
34
|
+
*/
|
|
35
|
+
constructor(engine: Engine, onDeleted: () => void);
|
|
36
|
+
/** The texture, or `InvalidCGAPIResourceUid` until the next `update` creates it. */
|
|
37
|
+
get textureUid(): CGAPIResourceHandle;
|
|
38
|
+
/** The index (in vec4 texels) of the instance SID region in the data texture. */
|
|
39
|
+
get instanceSidBaseVec4(): number;
|
|
40
|
+
/** The index (in vec4 texels) of the instance remap region in the data texture. */
|
|
41
|
+
get instanceRemapBaseVec4(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Creates the data texture, or uploads the changed data of the GPU instance data to it.
|
|
44
|
+
* This method handles the actual texture creation, data copying, and GPU upload.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* This method performs several critical operations:
|
|
48
|
+
* - Retrieves the GPU instance data buffer from memory manager
|
|
49
|
+
* - Calculates appropriate texture size based on the reserved layout
|
|
50
|
+
* - Handles both texture creation (first time) and texture updates (subsequent calls)
|
|
51
|
+
* - Combines GPU instance data with morph target data for complete texture
|
|
52
|
+
* - Uploads only the bytes in use, not the whole reserved capacity
|
|
53
|
+
* - Manages texture alignment and padding requirements
|
|
54
|
+
*/
|
|
55
|
+
update(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Uploads the bytes `[start, end)` of the GPU instance data (16-byte aligned, in the concatenated layers) to the
|
|
58
|
+
* data texture, where texel `n` holds bytes `16n` to `16n + 15`. The range is split into a partial first row, full
|
|
59
|
+
* rows and a partial last row.
|
|
60
|
+
*
|
|
61
|
+
* @param layerArray - The whole memory of the layer that contains the range
|
|
62
|
+
* @param layerByteOffset - The byte offset of the layer in the concatenated layers
|
|
63
|
+
*/
|
|
64
|
+
private __uploadDataTextureTexels;
|
|
65
|
+
/**
|
|
66
|
+
* Recreates the data texture when the mesh setup added morph target data.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* The GPUVertexData (morph target) buffers are laid out after the instance data in the data
|
|
70
|
+
* texture, so new buffers change the texture layout and the texture has to be recreated. Any
|
|
71
|
+
* other mesh setup only adds instance data within the already allocated layers, which the
|
|
72
|
+
* row-range update of `update` uploads without a full recreation.
|
|
73
|
+
*/
|
|
74
|
+
recreateIfMorphDataGrew(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Recreates the data texture when the instance SID / remap regions appended to it are too small: when the number
|
|
77
|
+
* of stable instance slots outgrows the currently reserved rows.
|
|
78
|
+
*/
|
|
79
|
+
recreateIfInstanceSidCapacityExceeded(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Uploads the dirty instance SID / remap rows into the engine data texture.
|
|
82
|
+
* The two tables are stored in reserved rows after the component data, so the
|
|
83
|
+
* shader can read them from texture unit 0 and no extra texture unit is consumed.
|
|
84
|
+
*
|
|
85
|
+
* @param table - The engine-wide instance SID table
|
|
86
|
+
* @param instanceRemapIdentity - 1 when no instance of the pass is culled (the shader skips the remap lookup)
|
|
87
|
+
*/
|
|
88
|
+
uploadInstanceSidTables(table: InstanceSidTable, instanceRemapIdentity: number): void;
|
|
89
|
+
/**
|
|
90
|
+
* Uploads `texelCount` texels starting at `baseRow` to the data texture. Rows are
|
|
91
|
+
* `this.__dataTextureWidth` texels wide, so the last row is uploaded partially.
|
|
92
|
+
*/
|
|
93
|
+
private __uploadInstanceRegion;
|
|
94
|
+
/**
|
|
95
|
+
* Deletes the current data texture and frees associated GPU resources.
|
|
96
|
+
* This method should be called when the data texture needs to be recreated
|
|
97
|
+
* or when cleaning up resources.
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* After calling this method, the data texture UID is reset to an invalid state,
|
|
101
|
+
* and a new data texture will be created on the next rendering cycle.
|
|
102
|
+
*/
|
|
103
|
+
delete(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Deletes the texture when the engine is destroyed.
|
|
106
|
+
*/
|
|
107
|
+
destroy(): void;
|
|
108
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BufferUse as I}from"../foundation/definitions/BufferUse.js";import{ComponentType as S}from"../foundation/definitions/ComponentType.js";import{PixelFormat as v}from"../foundation/definitions/PixelFormat.js";import{TextureFormat as U}from"../foundation/definitions/TextureFormat.js";import{Logger as A}from"../foundation/misc/Logger.js";import{CGAPIResourceRepository as x}from"../foundation/renderer/CGAPIResourceRepository.js";import{subtractByteRanges as w}from"../foundation/renderer/lightCluster/LightClusterLayout.js";var _=class{constructor(t,c){this.__dataTextureUid=x.InvalidCGAPIResourceUid;this.tB=0;this.iB=0;this.sB=0;this.cB=0;this.dB=0;this.aB=0;this.oB=0;this.uB=-1;this.i=t,this.nB=c}get textureUid(){return this.__dataTextureUid}get instanceSidBaseVec4(){return this.cB}get instanceRemapBaseVec4(){return this.dB}update(){let t=this.i.memoryManager,h=t.getSizesOfTheBuffers(I.GPUInstanceData).reduce((i,d)=>i+d,0),a=t.getBuffers(I.GPUInstanceData),r=a.length;r!==this.uB&&(this.uB=r,this.delete());let l=this.i.webglResourceRepository.currentWebGLContextWrapper;if(l==null)return;let e=l.getMaxTextureSize();if(this.__dataTextureUid!==x.InvalidCGAPIResourceUid){let i=h/4/4,d=Math.ceil(i/e),p=e*d*4*4,f=this.i.lightClusterSystem,m=f._getExcludedByteRanges(),s=0;for(let o=0;o<a.length;o++){let y=a[o],n=y.takenSizeInByte;n>p&&A.default.warn("The buffer size exceeds the size of the data texture.");let R=new Float32Array(y.getArrayBuffer());for(let[T,b]of w(s,s+Math.min(n,p),m))this.rB(R,s,T,b,e);s+=y.byteLength}for(let[o,y]of f._takeDirtyByteRanges()){let n=0;for(let R of a){let T=n+R.byteLength;if(o>=n&&y<=T){let b=new Float32Array(R.getArrayBuffer());this.rB(b,n,o,y,e);break}n=T}}}else{let i=t.getBuffers(I.GPUVertexData),d=e*4*4,p=a.map(u=>Math.ceil(u.byteLength/d)*d),f=p.reduce((u,B)=>u+B,0),m=i.reduce((u,B)=>u+B.byteLength,0),s=Math.max(Math.ceil((f+m)/d),1),o=this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable,y=this.i.webglResourceRepository.instanceSidTable,n=o?Math.max(y.usedEnd,1):0,R=o?Math.max(Math.ceil(n/e),1):0,T=o?Math.max(Math.ceil(Math.ceil(n/4)/e),1):0,b=s+R+T;this.tB=e,this.iB=s,this.sB=s+R,this.cB=this.iB*e,this.dB=this.sB*e,this.aB=n,this.oB=m,o&&y.markAllDirty(),this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData=f,this.__dataTextureUid=this.i.webglResourceRepository.createTexStorage2D({levels:1,internalFormat:U.RGBA32F,width:e,height:b});let g=0;a.forEach((u,B)=>{this.rB(new Float32Array(u.getArrayBuffer()),g,g,g+u.takenSizeInByte,e),g+=p[B]}),i.forEach(u=>{this.rB(new Float32Array(u.getArrayBuffer()),g,g,g+u.byteLength,e),g+=u.byteLength}),this.i.lightClusterSystem._takeDirtyByteRanges()}}rB(t,c,h,a,r){let l=this.i.webglResourceRepository,e=Math.floor(h/16),i=Math.ceil(a/16),d=c/16,p=(f,m,s,o,y)=>{let n=(y-d)*4;l.updateTexture(this.__dataTextureUid,t.subarray(n,n+s*o*4),{level:0,offsetX:f,offsetY:m,width:s,height:o,format:v.RGBA,type:S.Float})};for(;e<i;){let f=e%r,m=Math.floor(e/r);if(f!==0||i-e<r){let s=Math.min(r-f,i-e);p(f,m,s,1,e),e+=s}else{let s=Math.floor((i-e)/r);p(0,m,r,s,e),e+=s*r}}}recreateIfMorphDataGrew(){if(this.__dataTextureUid===x.InvalidCGAPIResourceUid)return;let t=this.i.memoryManager.getBuffers(I.GPUVertexData),c=0;for(let h of t)c+=h.byteLength;c!==this.oB&&this.delete()}recreateIfInstanceSidCapacityExceeded(){if(this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable){let c=this.i.webglResourceRepository.instanceSidTable;this.__dataTextureUid!==x.InvalidCGAPIResourceUid&&c.usedEnd>this.aB&&this.delete()}}uploadInstanceSidTables(t,c){if(this.__dataTextureUid===x.InvalidCGAPIResourceUid||this.tB<=0)return;let h=t.usedEnd;if(h<=0){t.clearSidDirty(),t.clearRemapDirty();return}t.sidDirty&&(this.hB(this.iB,h,(a,r,l)=>t.writeSidTexels(a,r,l)),t.clearSidDirty()),t.remapDirty&&c===0&&(this.hB(this.sB,Math.ceil(h/4),(a,r,l)=>t.writeRemapTexels(a,r,l)),t.clearRemapDirty())}hB(t,c,h){let a=this.tB,r=c,l=0,e=t;for(;r>0;){let i=Math.min(r,a),d=new Float32Array(i*4);h(d,l,i),this.i.webglResourceRepository.updateTexture(this.__dataTextureUid,d,{level:0,offsetX:0,offsetY:e,width:i,height:1,format:v.RGBA,type:S.Float}),r-=i,l+=i,e++}}delete(){this.__dataTextureUid!=null&&(this.i.webglResourceRepository.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=x.InvalidCGAPIResourceUid),this.aB=0,this.tB=0,this.oB=0,this.nB()}destroy(){let t=this.i.webglResourceRepository;this.__dataTextureUid!==x.InvalidCGAPIResourceUid&&(t.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=x.InvalidCGAPIResourceUid)}};export{_ as WebGLDataTexture};
|