rhodonite 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -19
- package/VERSION-FILE +1 -1
- package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.d.ts +54 -0
- package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.js +1 -1
- package/dist/esm/foundation/components/Camera/CameraComponent.d.ts +34 -0
- package/dist/esm/foundation/components/Camera/CameraComponent.js +1 -1
- package/dist/esm/foundation/components/Light/LightComponent.d.ts +3 -1
- package/dist/esm/foundation/components/Light/LightComponent.js +1 -1
- package/dist/esm/foundation/components/Mesh/MeshComponent.js +1 -1
- package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.js +1 -1
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -0
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.js +1 -1
- package/dist/esm/foundation/components/Shape/ShapeComponent.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/AbsoluteAnimation.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/GlobalRetarget.js +1 -1
- package/dist/esm/foundation/components/Skeletal/AnimationRetarget/GlobalRetargetReverse.js +1 -1
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +48 -0
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.js +1 -1
- package/dist/esm/foundation/components/Transform/TransformComponent.js +1 -1
- package/dist/esm/foundation/components/Trigger/TriggerComponent.js +1 -1
- package/dist/esm/foundation/components/Vrm/VrmComponent.js +1 -1
- package/dist/esm/foundation/constraints/VrmAimConstraint.js +1 -1
- package/dist/esm/foundation/constraints/VrmRollConstraint.js +1 -1
- package/dist/esm/foundation/constraints/VrmRotationConstraint.js +1 -1
- package/dist/esm/foundation/core/Component.js +1 -1
- package/dist/esm/foundation/core/ComponentRepository.js +1 -1
- package/dist/esm/foundation/core/Entity.js +1 -1
- package/dist/esm/foundation/core/EntityRepository.js +1 -1
- package/dist/esm/foundation/core/MemoryManager.d.ts +19 -0
- package/dist/esm/foundation/core/MemoryManager.js +2 -2
- package/dist/esm/foundation/definitions/ShaderSemantics.d.ts +1 -0
- package/dist/esm/foundation/definitions/ShaderSemantics.js +2 -2
- package/dist/esm/foundation/geometry/ComplexVertexAttribute.js +1 -1
- package/dist/esm/foundation/geometry/Mesh.js +1 -1
- package/dist/esm/foundation/geometry/Primitive.js +1 -1
- package/dist/esm/foundation/gizmos/AABBGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/CapsuleColliderGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/Gizmo.d.ts +13 -0
- package/dist/esm/foundation/gizmos/Gizmo.js +1 -1
- package/dist/esm/foundation/gizmos/JointGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/LightGizmo.d.ts +0 -1
- package/dist/esm/foundation/gizmos/LightGizmo.js +1 -1
- package/dist/esm/foundation/gizmos/LocatorGizmo.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/ShapeGizmo.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/ShadowMap.js +1 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowSystem.js +1 -1
- package/dist/esm/foundation/helpers/materials/createMotionVectorMaterial.d.ts +25 -0
- package/dist/esm/foundation/helpers/materials/createMotionVectorMaterial.js +1 -0
- package/dist/esm/foundation/helpers/materials/createNodeBasedRaymarchingMaterials.js +1 -1
- package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.d.ts +33 -0
- package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.js +1 -0
- package/dist/esm/foundation/helpers/materials/nodeBasedMaterialCommon.js +1 -1
- package/dist/esm/foundation/importer/AnimationAssigner.js +1 -1
- package/dist/esm/foundation/importer/DrcPointCloudImporter.js +1 -1
- package/dist/esm/foundation/importer/Gltf2Importer.d.ts +2 -1
- package/dist/esm/foundation/importer/Gltf2Importer.js +1 -1
- package/dist/esm/foundation/importer/GltfImporter.js +1 -1
- package/dist/esm/foundation/importer/ModelConverter.js +1 -1
- package/dist/esm/foundation/importer/RhodoniteImportExtension.js +1 -1
- package/dist/esm/foundation/importer/Vrm0xImporter.js +1 -1
- package/dist/esm/foundation/importer/VrmImporter.js +1 -1
- package/dist/esm/foundation/materials/contents/CustomMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/contents/MToon0xMaterialContent.js +18 -18
- package/dist/esm/foundation/materials/contents/MToon1MaterialContent.js +6 -6
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.d.ts +11 -0
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.js +1 -1
- package/dist/esm/foundation/materials/core/Material.d.ts +7 -2
- package/dist/esm/foundation/materials/core/Material.js +1 -1
- package/dist/esm/foundation/materials/core/ShaderityUtilityWebGL.js +2 -2
- package/dist/esm/foundation/materials/core/ShaderityUtilityWebGPU.js +2 -2
- package/dist/esm/foundation/materials/nodes/CastToFloatShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/MergeVectorShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/Random_HashPRNGShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/Random_SinHashShaderNode.js +1 -1
- package/dist/esm/foundation/materials/nodes/SplitVectorShaderNode.js +1 -1
- package/dist/esm/foundation/math/MathClassUtil.js +1 -1
- package/dist/esm/foundation/math/Quaternion.js +1 -1
- package/dist/esm/foundation/math/Transform3D.js +1 -1
- package/dist/esm/foundation/math/shapes/MathSphere.js +1 -1
- package/dist/esm/foundation/memory/Accessor.js +6 -6
- package/dist/esm/foundation/memory/BufferView.js +1 -1
- package/dist/esm/foundation/misc/PngDecoder.d.ts +18 -0
- package/dist/esm/foundation/misc/PngDecoder.js +1 -0
- package/dist/esm/foundation/misc/cache/Cache.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/CapsuleCollider.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/SphereCollider.js +1 -1
- package/dist/esm/foundation/physics/VRMSpring/VRMSpringBone.js +1 -1
- package/dist/esm/foundation/renderer/Frame.js +1 -1
- package/dist/esm/foundation/renderer/RenderPass.d.ts +7 -0
- package/dist/esm/foundation/renderer/RenderPass.js +1 -1
- package/dist/esm/foundation/renderer/TemporalAA/PreviousFrameDataTracker.d.ts +33 -0
- package/dist/esm/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +1 -0
- package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +135 -0
- package/dist/esm/foundation/renderer/TemporalAA/TemporalAASystem.js +1 -0
- package/dist/esm/foundation/renderer/pipelines/DeferredRenderPipeline.js +1 -1
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +64 -17
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.js +1 -1
- package/dist/esm/foundation/system/Engine.d.ts +37 -3
- package/dist/esm/foundation/system/Engine.js +1 -1
- package/dist/esm/foundation/textures/AbstractTexture.js +1 -1
- package/dist/esm/foundation/textures/CubeTexture.d.ts +11 -2
- package/dist/esm/foundation/textures/CubeTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTexture2DArray.js +1 -1
- package/dist/esm/foundation/textures/RenderTargetTextureCube.d.ts +6 -0
- package/dist/esm/foundation/textures/RenderTargetTextureCube.js +1 -1
- package/dist/esm/foundation/textures/Texture.js +1 -1
- package/dist/esm/foundation/textures/TextureDataFloat.js +1 -1
- package/dist/esm/foundation/textures/VideoTexture.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/webgl/MultiDrawRepository.js +1 -1
- package/dist/esm/webgl/WebGLResourceRepository.d.ts +5 -0
- package/dist/esm/webgl/WebGLResourceRepository.js +3 -3
- package/dist/esm/webgl/WebGLStereoUtil.js +1 -1
- package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +27 -14
- package/dist/esm/webgl/WebGLStrategyWebGL2.js +74 -55
- package/dist/esm/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +0 -3
- package/dist/esm/webgl/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.glsl.js +2 -1
- package/dist/esm/webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.glsl.js +1 -0
- package/dist/esm/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.js +35 -0
- package/dist/esm/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +140 -0
- package/dist/esm/webgl/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -0
- package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +175 -0
- package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +18 -0
- package/dist/esm/webgl/shaderity_shaders/common/iblDefinition.glsl.js +11 -5
- package/dist/esm/webgl/shaders/StandardShaderPart.js +3 -3
- 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.js +9 -9
- package/dist/esm/webgl/shaders/nodes/RaymarchObjectIdUniform.js +3 -3
- package/dist/esm/webgl/shaders/nodes/SdApplyWorldMatrix.js +3 -3
- package/dist/esm/webgl/shaders/nodes/Texture2DShader.js +14 -14
- package/dist/esm/webgl/shaders/nodes/UniformDataShader.js +13 -13
- package/dist/esm/webgpu/GpuCullingRegistry.js +1 -1
- package/dist/esm/webgpu/GpuDeformRegistry.js +1 -1
- package/dist/esm/webgpu/WebGpuGpuCulling.js +1 -1
- package/dist/esm/webgpu/WebGpuLightClusterBuilder.js +1 -1
- package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +6 -0
- package/dist/esm/webgpu/WebGpuResourceRepository.js +5 -5
- package/dist/esm/webgpu/WebGpuStrategyBasic.d.ts +8 -0
- package/dist/esm/webgpu/WebGpuStrategyBasic.js +78 -59
- package/dist/esm/webgpu/WebGpuVertexDeformer.js +1 -1
- package/dist/esm/webgpu/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.wgsl.js +1 -0
- package/dist/esm/webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.wgsl.js +1 -0
- package/dist/esm/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.wgsl.js +30 -0
- package/dist/esm/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.wgsl.js +133 -0
- package/dist/esm/webgpu/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +1 -0
- package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +169 -0
- package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +19 -0
- package/dist/esm/webgpu/shaderity_shaders/common/iblDefinition.wgsl.js +10 -4
- package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.d.ts +54 -0
- package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.js +107 -1
- package/dist/esmdev/foundation/components/Camera/CameraComponent.d.ts +34 -0
- package/dist/esmdev/foundation/components/Camera/CameraComponent.js +118 -46
- package/dist/esmdev/foundation/components/CameraController/CameraControllerComponent.js +8 -8
- package/dist/esmdev/foundation/components/CharacterController/CharacterAnimationController.js +74 -74
- package/dist/esmdev/foundation/components/CharacterController/CharacterControllerComponent.js +39 -39
- package/dist/esmdev/foundation/components/Constraint/ConstraintComponent.js +4 -4
- package/dist/esmdev/foundation/components/Light/LightComponent.d.ts +3 -1
- package/dist/esmdev/foundation/components/Light/LightComponent.js +126 -121
- package/dist/esmdev/foundation/components/Mesh/MeshComponent.js +50 -50
- package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.js +96 -92
- package/dist/esmdev/foundation/components/Physics/PhysicsComponent.js +73 -73
- package/dist/esmdev/foundation/components/Raymarching/RaymarchingComponent.js +54 -54
- package/dist/esmdev/foundation/components/Raymarching/RaymarchingSdfEvaluator.js +251 -251
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +16 -0
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.js +375 -343
- package/dist/esmdev/foundation/components/Shape/ShapeComponent.js +31 -31
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/AbsoluteAnimation.js +5 -5
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/GlobalRetarget.js +5 -5
- package/dist/esmdev/foundation/components/Skeletal/AnimationRetarget/GlobalRetargetReverse.js +9 -9
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +48 -0
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.js +337 -205
- package/dist/esmdev/foundation/components/Transform/TransformComponent.js +93 -93
- package/dist/esmdev/foundation/components/Trigger/TriggerComponent.js +61 -61
- package/dist/esmdev/foundation/components/Vrm/VrmComponent.js +44 -44
- package/dist/esmdev/foundation/constraints/VrmAimConstraint.js +11 -11
- package/dist/esmdev/foundation/constraints/VrmRollConstraint.js +16 -16
- package/dist/esmdev/foundation/constraints/VrmRotationConstraint.js +10 -10
- package/dist/esmdev/foundation/core/Component.js +32 -32
- package/dist/esmdev/foundation/core/ComponentMemoryRegistry.js +42 -42
- package/dist/esmdev/foundation/core/ComponentRepository.js +37 -37
- package/dist/esmdev/foundation/core/Config.js +9 -9
- package/dist/esmdev/foundation/core/Entity.js +9 -9
- package/dist/esmdev/foundation/core/EntityRepository.js +19 -19
- package/dist/esmdev/foundation/core/GlobalDataRepository.js +17 -17
- package/dist/esmdev/foundation/core/MemoryManager.d.ts +19 -0
- package/dist/esmdev/foundation/core/MemoryManager.js +52 -27
- package/dist/esmdev/foundation/core/RnObject.js +37 -37
- package/dist/esmdev/foundation/definitions/Blend.js +3 -3
- package/dist/esmdev/foundation/definitions/ComponentType.js +7 -7
- package/dist/esmdev/foundation/definitions/CompositionType.js +50 -50
- package/dist/esmdev/foundation/definitions/CompressionTextureType.js +6 -6
- package/dist/esmdev/foundation/definitions/ShaderSemantics.d.ts +1 -0
- package/dist/esmdev/foundation/definitions/ShaderSemantics.js +12 -7
- package/dist/esmdev/foundation/definitions/TextureFormat.js +3 -3
- package/dist/esmdev/foundation/definitions/TextureParameter.js +3 -3
- package/dist/esmdev/foundation/definitions/VertexAttribute.js +30 -30
- package/dist/esmdev/foundation/enhanced_js_objects/Array.js +2 -2
- package/dist/esmdev/foundation/exporter/Gltf2Exporter.js +112 -112
- package/dist/esmdev/foundation/geometry/ComplexVertexAttribute.js +24 -24
- package/dist/esmdev/foundation/geometry/Frustum.js +41 -41
- package/dist/esmdev/foundation/geometry/Mesh.js +219 -219
- package/dist/esmdev/foundation/geometry/Primitive.js +134 -134
- package/dist/esmdev/foundation/geometry/SimpleVertexAttribute.js +7 -7
- 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 +17 -20
- package/dist/esmdev/foundation/gizmos/CapsuleColliderGizmo.js +24 -26
- package/dist/esmdev/foundation/gizmos/Gizmo.d.ts +13 -0
- package/dist/esmdev/foundation/gizmos/Gizmo.js +43 -21
- package/dist/esmdev/foundation/gizmos/JointGizmo.js +38 -40
- package/dist/esmdev/foundation/gizmos/LightGizmo.d.ts +0 -1
- package/dist/esmdev/foundation/gizmos/LightGizmo.js +26 -30
- package/dist/esmdev/foundation/gizmos/LocatorGizmo.js +26 -29
- package/dist/esmdev/foundation/gizmos/RotationGizmo.js +217 -219
- package/dist/esmdev/foundation/gizmos/ScaleGizmo.js +135 -137
- package/dist/esmdev/foundation/gizmos/ShapeGizmo.js +44 -47
- package/dist/esmdev/foundation/gizmos/SphereColliderGizmo.js +25 -27
- package/dist/esmdev/foundation/gizmos/TranslationGizmo.js +133 -135
- 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/ShadowMap.js +5 -5
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.js +119 -119
- package/dist/esmdev/foundation/helpers/materials/createMotionVectorMaterial.d.ts +25 -0
- package/dist/esmdev/foundation/helpers/materials/createMotionVectorMaterial.js +61 -0
- package/dist/esmdev/foundation/helpers/materials/createNodeBasedRaymarchingMaterials.js +10 -1
- package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.d.ts +33 -0
- package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.js +127 -0
- package/dist/esmdev/foundation/helpers/materials/nodeBasedMaterialCommon.js +11 -1
- package/dist/esmdev/foundation/importer/AnimationAssigner.js +44 -44
- package/dist/esmdev/foundation/importer/DrcPointCloudImporter.js +33 -33
- package/dist/esmdev/foundation/importer/Gltf2Importer.d.ts +2 -1
- package/dist/esmdev/foundation/importer/Gltf2Importer.js +21 -17
- package/dist/esmdev/foundation/importer/GltfImporter.js +22 -22
- package/dist/esmdev/foundation/importer/ModelConverter.js +131 -131
- 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/CustomMaterialContent.js +37 -28
- package/dist/esmdev/foundation/materials/contents/DepthEncodeMaterialContent.js +2 -2
- package/dist/esmdev/foundation/materials/contents/MToon0xMaterialContent.js +147 -139
- package/dist/esmdev/foundation/materials/contents/MToon1MaterialContent.js +28 -20
- package/dist/esmdev/foundation/materials/contents/ShadowMapDecodeClassicMaterialContent.js +5 -5
- package/dist/esmdev/foundation/materials/contents/VarianceShadowMapDecodeClassicMaterialContent.js +5 -5
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.d.ts +11 -0
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.js +68 -53
- package/dist/esmdev/foundation/materials/core/AbstractShaderNode.js +26 -26
- package/dist/esmdev/foundation/materials/core/DummyTextures.js +3 -3
- package/dist/esmdev/foundation/materials/core/Material.d.ts +7 -2
- package/dist/esmdev/foundation/materials/core/Material.js +132 -118
- package/dist/esmdev/foundation/materials/core/MaterialRepository.js +65 -65
- package/dist/esmdev/foundation/materials/core/ShaderGraphResolver.js +38 -38
- package/dist/esmdev/foundation/materials/core/ShaderHandler.js +4 -4
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGL.js +16 -17
- package/dist/esmdev/foundation/materials/core/ShaderityUtilityWebGPU.js +17 -18
- package/dist/esmdev/foundation/materials/nodes/AbsShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/AcosShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/AddShaderNode.js +18 -18
- 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 +15 -15
- 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 +15 -15
- package/dist/esmdev/foundation/materials/nodes/CalcBitangentShaderNode.js +7 -7
- package/dist/esmdev/foundation/materials/nodes/CastToFloatShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/ClampShaderNode.js +15 -15
- 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.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/DiscardShaderNode.js +2 -2
- package/dist/esmdev/foundation/materials/nodes/DotProductShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/EqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/FlatShaderNode.js +5 -5
- package/dist/esmdev/foundation/materials/nodes/GreaterOrEqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/GreaterShaderNode.js +3 -3
- package/dist/esmdev/foundation/materials/nodes/GreaterThanShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/LengthShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/LessOrEqualShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/LessThanShaderNode.js +10 -10
- package/dist/esmdev/foundation/materials/nodes/MergeVectorShaderNode.js +19 -19
- package/dist/esmdev/foundation/materials/nodes/MinShaderNode.js +18 -18
- package/dist/esmdev/foundation/materials/nodes/MultiplyShaderNode.js +21 -21
- package/dist/esmdev/foundation/materials/nodes/NormalMatrixShaderNode.js +1 -1
- package/dist/esmdev/foundation/materials/nodes/NormalizeShaderNode.js +9 -9
- package/dist/esmdev/foundation/materials/nodes/NotEqualShaderNode.js +10 -10
- 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.js +4 -4
- 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 +12 -12
- package/dist/esmdev/foundation/materials/nodes/Random_SinHashShaderNode.js +12 -12
- package/dist/esmdev/foundation/materials/nodes/RemapShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/SinShaderNode.js +13 -13
- package/dist/esmdev/foundation/materials/nodes/SmoothStepShaderNode.js +15 -15
- package/dist/esmdev/foundation/materials/nodes/SplitVectorShaderNode.js +17 -17
- package/dist/esmdev/foundation/materials/nodes/StepShaderNode.js +14 -14
- package/dist/esmdev/foundation/materials/nodes/TanShaderNode.js +13 -13
- 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.js +10 -10
- 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/Quaternion.js +20 -20
- package/dist/esmdev/foundation/math/Transform3D.js +83 -83
- package/dist/esmdev/foundation/math/shapes/MathSphere.js +9 -9
- package/dist/esmdev/foundation/memory/Accessor.js +371 -371
- package/dist/esmdev/foundation/memory/Buffer.js +40 -40
- package/dist/esmdev/foundation/memory/BufferView.js +33 -33
- 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/PngDecoder.d.ts +18 -0
- package/dist/esmdev/foundation/misc/PngDecoder.js +113 -0
- 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 +13 -13
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.js +202 -202
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.js +241 -241
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.js +3 -3
- package/dist/esmdev/foundation/physics/VRMSpring/CapsuleCollider.js +42 -42
- package/dist/esmdev/foundation/physics/VRMSpring/SphereCollider.js +27 -27
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBone.js +10 -10
- package/dist/esmdev/foundation/physics/VRMSpring/VRMSpringBonePhysicsStrategy.js +50 -50
- package/dist/esmdev/foundation/renderer/Expression.js +6 -6
- package/dist/esmdev/foundation/renderer/Frame.js +12 -12
- package/dist/esmdev/foundation/renderer/FrameBuffer.js +25 -25
- package/dist/esmdev/foundation/renderer/RenderPass.d.ts +7 -0
- package/dist/esmdev/foundation/renderer/RenderPass.js +110 -99
- package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.d.ts +33 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/PreviousFrameDataTracker.js +66 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.d.ts +135 -0
- package/dist/esmdev/foundation/renderer/TemporalAA/TemporalAASystem.js +275 -0
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystem.js +153 -153
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystemStub.js +3 -3
- package/dist/esmdev/foundation/renderer/pipelines/DeferredRenderPipeline.js +6 -6
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +64 -17
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.js +537 -430
- package/dist/esmdev/foundation/system/Engine.d.ts +37 -3
- package/dist/esmdev/foundation/system/Engine.js +266 -224
- 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 +6 -6
- package/dist/esmdev/foundation/textures/AbstractTexture.js +50 -50
- package/dist/esmdev/foundation/textures/CubeTexture.d.ts +11 -2
- package/dist/esmdev/foundation/textures/CubeTexture.js +47 -36
- package/dist/esmdev/foundation/textures/RenderBuffer.js +11 -11
- package/dist/esmdev/foundation/textures/RenderTargetTexture.js +25 -25
- package/dist/esmdev/foundation/textures/RenderTargetTexture2DArray.js +37 -37
- package/dist/esmdev/foundation/textures/RenderTargetTextureCube.d.ts +6 -0
- package/dist/esmdev/foundation/textures/RenderTargetTextureCube.js +26 -20
- package/dist/esmdev/foundation/textures/Sampler.js +24 -24
- package/dist/esmdev/foundation/textures/Texture.js +83 -83
- package/dist/esmdev/foundation/textures/TextureArray.js +8 -8
- package/dist/esmdev/foundation/textures/TextureDataFloat.js +26 -26
- package/dist/esmdev/foundation/textures/VideoTexture.js +24 -24
- package/dist/esmdev/version.js +2 -2
- package/dist/esmdev/webgl/InstanceSidTable.js +62 -62
- package/dist/esmdev/webgl/MultiDraw.js +2 -2
- package/dist/esmdev/webgl/MultiDrawRepository.js +30 -30
- package/dist/esmdev/webgl/WebGLContextWrapper.js +164 -164
- package/dist/esmdev/webgl/WebGLGpuTimer.js +32 -32
- package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +5 -0
- package/dist/esmdev/webgl/WebGLResourceRepository.js +375 -314
- package/dist/esmdev/webgl/WebGLStereoUtil.js +42 -42
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +27 -14
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.js +350 -301
- package/dist/esmdev/webgl/debug/ShaderParameterDebugger.js +4 -4
- package/dist/esmdev/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.glsl.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.glsl.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -2
- package/dist/esmdev/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/common/iblDefinition.glsl.js +2 -2
- package/dist/esmdev/webgl/shaders/RaymarchingShaderPart.js +4 -4
- package/dist/esmdev/webgl/shaders/RaymarchingShadowShaderPart.js +14 -14
- package/dist/esmdev/webgl/shaders/StandardShaderPart.js +3 -3
- 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.js +21 -21
- package/dist/esmdev/webgl/shaders/nodes/DiscardShader.js +3 -3
- package/dist/esmdev/webgl/shaders/nodes/EndShader.js +3 -3
- package/dist/esmdev/webgl/shaders/nodes/OutDistance.js +12 -12
- package/dist/esmdev/webgl/shaders/nodes/OutUnion.js +9 -9
- package/dist/esmdev/webgl/shaders/nodes/RaymarchObjectIdUniform.js +8 -8
- package/dist/esmdev/webgl/shaders/nodes/SdApplyTransform.js +9 -9
- package/dist/esmdev/webgl/shaders/nodes/SdApplyWorldMatrix.js +8 -8
- package/dist/esmdev/webgl/shaders/nodes/Texture2DShader.js +23 -23
- package/dist/esmdev/webgl/shaders/nodes/UniformDataShader.js +23 -23
- package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.js +27 -27
- package/dist/esmdev/webgpu/GpuCullingRegistry.js +94 -94
- package/dist/esmdev/webgpu/GpuDeformRegistry.js +53 -53
- package/dist/esmdev/webgpu/RangeAllocator.js +16 -16
- package/dist/esmdev/webgpu/WebGpuBufferArena.js +21 -21
- package/dist/esmdev/webgpu/WebGpuDeviceWrapper.js +7 -7
- package/dist/esmdev/webgpu/WebGpuGpuCulling.js +198 -198
- package/dist/esmdev/webgpu/WebGpuGpuTimer.js +52 -52
- package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.js +37 -37
- package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +6 -0
- package/dist/esmdev/webgpu/WebGpuResourceRepository.js +660 -598
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.d.ts +8 -0
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.js +169 -132
- package/dist/esmdev/webgpu/WebGpuVertexDeformer.js +128 -128
- package/dist/esmdev/webgpu/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.wgsl.js +2 -2
- package/dist/esmdev/webgpu/shaderity_shaders/MToon1SingleShader/MToon1SingleShader.frag.wgsl.js +2 -2
- package/dist/esmdev/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.frag.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/PbrSingleShader/PbrSingleShader.frag.js +2 -2
- package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/common/iblDefinition.wgsl.js +2 -2
- package/dist/esmdev/xr/WebARSystem.js +69 -69
- package/dist/esmdev/xr/WebXRSystem.js +153 -153
- package/package.json +2 -1
|
@@ -1,36 +1,54 @@
|
|
|
1
|
-
import{AnimationComponent as re}from"../foundation/components/Animation/AnimationComponent.js";import{BlendShapeComponent as
|
|
1
|
+
import{AnimationComponent as re}from"../foundation/components/Animation/AnimationComponent.js";import{BlendShapeComponent as D}from"../foundation/components/BlendShape/BlendShapeComponent.js";import{CameraComponent as k}from"../foundation/components/Camera/CameraComponent.js";import{_getCameraControllerUpdateCount as K}from"../foundation/components/CameraController/CameraControllerUpdateCount.js";import{LightComponent as z}from"../foundation/components/Light/LightComponent.js";import{MeshComponent as ne}from"../foundation/components/Mesh/MeshComponent.js";import{MeshRendererComponent as H}from"../foundation/components/MeshRenderer/MeshRendererComponent.js";import{SceneGraphComponent as q}from"../foundation/components/SceneGraph/SceneGraphComponent.js";import{TransformComponent as J}from"../foundation/components/Transform/TransformComponent.js";import{WellKnownComponentTIDs as N}from"../foundation/components/WellKnownComponentTIDs.js";import{Component as w}from"../foundation/core/Component.js";import{BufferUse as V}from"../foundation/definitions/BufferUse.js";import{ComponentType as C}from"../foundation/definitions/ComponentType.js";import{CompositionType as p}from"../foundation/definitions/CompositionType.js";import{PixelFormat as Q}from"../foundation/definitions/PixelFormat.js";import{ShaderType as j}from"../foundation/definitions/ShaderType.js";import{TextureFormat as ae}from"../foundation/definitions/TextureFormat.js";import{VertexAttribute as $}from"../foundation/definitions/VertexAttribute.js";import{Primitive as A}from"../foundation/geometry/Primitive.js";import{Logger as ee}from"../foundation/misc/Logger.js";import{CGAPIResourceRepository as I}from"../foundation/renderer/CGAPIResourceRepository.js";import{subtractByteRanges as oe}from"../foundation/renderer/lightCluster/LightClusterLayout.js";import{isSkipDrawing as te}from"../foundation/renderer/RenderingCommonMethods.js";import{getMultiDrawStateKeyId as se,getPrimitiveMeshRendererFingerPrintId as ce,planMultiDrawRunsInto as le}from"./MultiDraw.js";import L,{setupShaderProgram as X}from"./WebGLStrategyCommonMethod.js";var ie=class P{constructor(t){this.__dataTextureUid=I.InvalidCGAPIResourceUid;this.bI=I.InvalidCGAPIResourceUid;this.gI=I.InvalidCGAPIResourceUid;this.yI=I.InvalidCGAPIResourceUid;this.SI=I.InvalidCGAPIResourceUid;this.kI=-1;this.S_=-1;this.vI=1;this.M_={starts:new Int32Array(0),counts:new Int32Array(0),keys:new Int32Array(0),count:0};this.RI=0;this.DI=0;this.PI=0;this._I=0;this.MI=0;this.GI=0;this._totalSizeOfGPUShaderDataStorageExceptMorphData=0;this.OI=0;this.VI=!0;this.HI=-1;this.jI=-1;this.XI=-1;this.YI=-1;this.or=-1;this.ZI=-1;this.KI=-1;this.nr=-1;this.qI=-1;this.dC=-1;this.sr=-1;this.JI=-1;this.LI=-1;this.QI=-1;this.LS=-1;this.i=t,this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)}static zS(t,e){let i="";return w.getMemberInfo(t).forEach((r,c)=>{r.forEach((s,m)=>{var d;if(s.shaderType!==e&&s.shaderType!==j.VertexAndPixelShader)return;let l=(d=w.getComponentCountPerBufferView(t).get(c))!=null?d:1;p.isArray(s.compositionType)?a(s,c,m,l):o(s,c,m,l)})}),i;function a(r,c,s,m){var b,y;let l="",d="";switch(r.compositionType){case p.Vec4Array:l="vec4",d="fetchVec4";break;case p.Mat4Array:l="mat4",d="fetchMat4";break;case p.Mat4x3Array:l="mat4x3",d="fetchMat4x3";break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let h=r.compositionType.getVec4SizeOfProperty();if(r.isVariableLength===!0){let B=w._variableLengthLocationRadix;i+=`
|
|
2
2
|
${l} get_${s}(uint instanceId, uint idxOfArray) {
|
|
3
|
-
vec4 location = get_${
|
|
4
|
-
int index = int(location.x) * ${
|
|
3
|
+
vec4 location = get_${w._getVariableLengthLocationMemberName(s)}(instanceId);
|
|
4
|
+
int index = int(location.x) * ${B} + int(location.y) + ${h} * int(idxOfArray);
|
|
5
5
|
${l} value = ${d}(index);
|
|
6
6
|
return value;
|
|
7
7
|
}
|
|
8
|
-
`;return}let f=
|
|
8
|
+
`;return}let f=w.getLocationOffsetOfMemberOfComponent(t,c,s),v=`int arrayLength = ${(y=((b=w.getArrayLengthOfMember(t).get(c))!=null?b:new Map).get(s))!=null?y:0};`,u=`rnIndices_${s}`,R=`int index = ${u}[instanceIdOfBufferViews] + int(instanceIdInBufferView) * ${h} * arrayLength + ${h} * int(idxOfArray);`,S="";r.convertToBool&&(S="return (value > 0.5) ? true : false;"),i+=`
|
|
9
9
|
const int ${u}[${f.length}] = int[${f.length}](${f.join(", ")});
|
|
10
10
|
${r.convertToBool?"bool":l} get_${s}(uint instanceId, uint idxOfArray) {
|
|
11
|
-
uint instanceIdOfBufferViews = instanceId / ${
|
|
12
|
-
uint instanceIdInBufferView = instanceId % ${
|
|
13
|
-
${
|
|
11
|
+
uint instanceIdOfBufferViews = instanceId / ${m}u;
|
|
12
|
+
uint instanceIdInBufferView = instanceId % ${m}u;
|
|
13
|
+
${v}
|
|
14
14
|
${R}
|
|
15
15
|
${l} value = ${d}(index);
|
|
16
|
-
${r.convertToBool?
|
|
16
|
+
${r.convertToBool?S:"return value;"}
|
|
17
17
|
}
|
|
18
|
-
`}function o(r,c,s,
|
|
19
|
-
const int ${f}[${
|
|
18
|
+
`}function o(r,c,s,m){let l="",d="";switch(r.compositionType){case p.Mat4:l="mat4",d="fetchMat4";break;case p.Mat3:l="mat3",d="fetchMat3No16BytesAligned";break;case p.Vec4:l="vec4",d="fetchVec4";break;case p.Vec3:l="vec3",d="fetchVec3No16BytesAligned";break;case p.Scalar:l="float",d="fetchScalarNo16BytesAligned";break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let h=w.getLocationOffsetOfMemberOfComponent(t,c,s),f=`rnIndices_${s}`,g="";switch(r.compositionType){case p.Mat4:g=`int index = ${f}[instanceIdOfBufferViews] + 4 * int(instanceIdInBufferView);`;break;case p.Mat3:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 9 * int(instanceIdInBufferView);`;break;case p.Vec4:g=`int index = ${f}[instanceIdOfBufferViews] + 1 * int(instanceIdInBufferView);`;break;case p.Vec3:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 3 * int(instanceIdInBufferView);`;break;case p.Scalar:g=`int index = ${f}[instanceIdOfBufferViews] * 4 + 1 * int(instanceIdInBufferView);`;break;default:throw new Error(`Unsupported composition type: ${r.compositionType.str}`)}let x="";r.convertToBool&&(x="return (value > 0.5) ? true : false;"),i+=`
|
|
19
|
+
const int ${f}[${h.length}] = int[${h.length}](${h.join(", ")});
|
|
20
20
|
${r.convertToBool?"bool":l} get_${s}(uint instanceId) {
|
|
21
|
-
uint instanceIdOfBufferViews = instanceId / ${
|
|
22
|
-
uint instanceIdInBufferView = instanceId % ${
|
|
23
|
-
${
|
|
21
|
+
uint instanceIdOfBufferViews = instanceId / ${m}u;
|
|
22
|
+
uint instanceIdInBufferView = instanceId % ${m}u;
|
|
23
|
+
${g}
|
|
24
24
|
${l} value = ${d}(index);
|
|
25
25
|
${r.convertToBool?x:"return value;"}
|
|
26
26
|
}
|
|
27
|
-
`}}static
|
|
27
|
+
`}}static C_(t){let e=A.getMorphUniformDataTargetNumbers(),i=`
|
|
28
28
|
const int rnMorphUniformDataTargetNumbers[${e.length}] = int[${e.length}](${e.join(", ")});
|
|
29
|
-
`,n=
|
|
29
|
+
`,n=A.getMorphUniformDataOffsets(),a=`
|
|
30
30
|
const int rnMorphUniformDataOffsets[${n.length}] = int[${n.length}](${n.join(", ")});
|
|
31
|
-
`,o=
|
|
31
|
+
`,o=D.getOffsetsInUniform(t),r=`
|
|
32
32
|
const int rnBlendShapeUniformDataOffsets[${o.length}] = int[${o.length}](${o.join(", ")});
|
|
33
|
-
|
|
33
|
+
`,c=t._isPreviousMorphWeightsEnabled?`
|
|
34
|
+
vec3 get_previousMorphedPosition(uint vertexId, vec3 basePosition, uint blendShapeComponentSID) {
|
|
35
|
+
int currentPrimitiveIdx = u_currentPrimitiveIdx;
|
|
36
|
+
int offsetInUniform = rnMorphUniformDataOffsets[currentPrimitiveIdx];
|
|
37
|
+
int offsetInUniform2 = rnBlendShapeUniformDataOffsets[blendShapeComponentSID] + ${D._getPreviousMorphWeightsOffset(t)};
|
|
38
|
+
vec3 position = basePosition;
|
|
39
|
+
int scalar_idx = 3 * int(vertexId);
|
|
40
|
+
for (int i=0; i<rnMorphUniformDataTargetNumbers[currentPrimitiveIdx]; i++) {
|
|
41
|
+
int idx = offsetInUniform + i;
|
|
42
|
+
ivec4 offsets = uniformMorphOffsets.data[ idx / 4];
|
|
43
|
+
int offsetPosition = offsets[idx % 4];
|
|
44
|
+
int basePosIn4bytes = offsetPosition * 4 + scalar_idx;
|
|
45
|
+
vec3 addPos = fetchVec3No16BytesAligned(basePosIn4bytes);
|
|
46
|
+
int idx2 = offsetInUniform2 + i;
|
|
47
|
+
vec4 morphWeights = uniformMorphWeights.data[ idx2 / 4];
|
|
48
|
+
position += addPos * morphWeights[idx2 % 4];
|
|
49
|
+
}
|
|
50
|
+
return position;
|
|
51
|
+
}`:"";return`
|
|
34
52
|
#ifdef RN_IS_VERTEX_SHADER
|
|
35
53
|
#ifdef RN_IS_MORPHING
|
|
36
54
|
${i}
|
|
@@ -59,31 +77,32 @@ import{AnimationComponent as re}from"../foundation/components/Animation/Animatio
|
|
|
59
77
|
|
|
60
78
|
return position;
|
|
61
79
|
}
|
|
80
|
+
${c}
|
|
62
81
|
#endif
|
|
63
82
|
#endif
|
|
64
|
-
`}setupShaderForMaterial(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper,[a,o]=t._createProgramWebGL(this.i,
|
|
65
|
-
`);let
|
|
66
|
-
`,
|
|
83
|
+
`}setupShaderForMaterial(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper,[a,o]=t._createProgramWebGL(this.i,P.zS(this.i,j.VertexShader),P.zS(this.i,j.PixelShader),P.A_,P.B_,P.C_(this.i),e);return o&&(t._setupBasicUniformsLocations(e),t._setUniformLocationsOfMaterialNodes(e),t._setupAdditionalUniformLocations(L.getPointSpriteShaderSemanticsInfoArray(),e),this.i.globalDataRepository._setUniformLocationsForWebGL2ModeOnly(t.getShaderProgramUid(e)),i.setUniformBlockBindingForMorphOffsetsAndWeights(a,this.gI,this.yI)),a}_reSetupShaderForMaterialBySpector(t,e,i,n){let[a,o]=t._createProgramByUpdatedSources(i,e,n);return a===I.InvalidCGAPIResourceUid||(o&&(t._setupBasicUniformsLocations(e),t._setUniformLocationsOfMaterialNodes(e),t._setupAdditionalUniformLocations(L.getPointSpriteShaderSemanticsInfoArray(),e)),this.i.globalDataRepository._setUniformLocationsForWebGL2ModeOnly(t.getShaderProgramUid(e))),a}static A_(t,e){var x,v;let i=e.compositionType.getGlslStr(e.componentType),n,a=p.isTexture(e.compositionType),o=e.semantic.replace(".","_"),r="",c=e.compositionType.getGlslStr(e.componentType),s="";e.arrayLength&&(s=`[${e.arrayLength}]`),(e.needUniformInDataTextureMode||a)&&(r=` uniform ${c} u_${o}${s};
|
|
84
|
+
`);let m=e.compositionType.getVec4SizeOfProperty(),l=e.compositionType.getNumberOfComponents(),d=P.getOffsetOfPropertyOfGlobalDataRepository(t,e.semantic);d===-1&&ee.default.error("Could not get the location offset of the property.");let h=m;if(n=`int vec4_idx = ${d} + ${h} * instanceId;
|
|
85
|
+
`,p.isArray(e.compositionType)){h=m*((x=e.arrayLength)!=null?x:1);let R=Math.ceil(l/4)*4*((v=e.arrayLength)!=null?v:1);n=`int vec4_idx = ${d} + ${h} * instanceId + ${m} * int(idxOfArray);
|
|
67
86
|
`,n+=`int scalar_idx = ${d*4} + ${R} * instanceId + ${l} * int(idxOfArray);
|
|
68
|
-
`}let f="";e.componentType===
|
|
87
|
+
`}let f="";e.componentType===C.Int&&e.compositionType!==p.Scalar&&(f="i");let g="";if(!a&&!e.needUniformInDataTextureMode){g+=`
|
|
69
88
|
${i} get_${o}(highp uint _instanceId, const uint idxOfArray) {
|
|
70
89
|
int instanceId = int(_instanceId);
|
|
71
90
|
${n}
|
|
72
91
|
`;let u=`${r}
|
|
73
|
-
${
|
|
74
|
-
`;break;case
|
|
75
|
-
`,u+=` highp ${f}vec3 val = ${f}vec3(col0.xyz);`;break;case
|
|
76
|
-
`;break;case
|
|
77
|
-
`,u+=` highp ${f}vec2 val = ${f}vec2(col0.xy);`;break;case
|
|
78
|
-
`;break;case
|
|
79
|
-
`,e.componentType===
|
|
80
|
-
`,e.componentType===
|
|
81
|
-
`;break;case
|
|
82
|
-
`;break;case
|
|
83
|
-
`;break;case
|
|
84
|
-
`;break;case
|
|
85
|
-
`;break;case
|
|
86
|
-
`;break;case
|
|
92
|
+
${g}`;switch(e.compositionType){case p.Vec4:case p.Vec4Array:u+=` highp vec4 val = fetchElement(vec4_idx);
|
|
93
|
+
`;break;case p.Vec3:u+=` vec4 col0 = fetchElement(vec4_idx);
|
|
94
|
+
`,u+=` highp ${f}vec3 val = ${f}vec3(col0.xyz);`;break;case p.Vec3Array:u+=` vec3 val = fetchVec3No16BytesAligned(scalar_idx);
|
|
95
|
+
`;break;case p.Vec2:u+=` highp vec4 col0 = fetchElement(vec4_idx);
|
|
96
|
+
`,u+=` highp ${f}vec2 val = ${f}vec2(col0.xy);`;break;case p.Vec2Array:u+=` highp vec2 val = fetchVec2No16BytesAligned(scalar_idx);
|
|
97
|
+
`;break;case p.Scalar:u+=` vec4 col0 = fetchElement(vec4_idx);
|
|
98
|
+
`,e.componentType===C.Int?u+=" int val = int(col0.x);":e.componentType===C.Bool?u+=" bool val = bool(col0.x);":u+=" float val = col0.x;";break;case p.ScalarArray:u+=` float col0 = fetchScalarNo16BytesAligned(scalar_idx);
|
|
99
|
+
`,e.componentType===C.Int?u+=" int val = int(col0);":e.componentType===C.Bool?u+=" bool val = bool(col0);":u+=" float val = col0;";break;case p.Mat4:u+=` mat4 val = fetchMat4(vec4_idx);
|
|
100
|
+
`;break;case p.Mat4Array:u+=` mat4 val = fetchMat4(vec4_idx);
|
|
101
|
+
`;break;case p.Mat3:u+=` mat3 val = fetchMat3(vec4_idx);
|
|
102
|
+
`;break;case p.Mat3Array:u+=` mat3 val = fetchMat3No16BytesAligned(scalar_idx);
|
|
103
|
+
`;break;case p.Mat2:u+=` mat2 val = fetchMat2(vec4_idx);
|
|
104
|
+
`;break;case p.Mat2Array:u+=` mat2 val = fetchMat2No16BytesAligned(scalar_idx);
|
|
105
|
+
`;break;case p.Mat4x3Array:u+=` mat4x3 val = fetchMat4x3(vec4_idx);
|
|
87
106
|
`;break;default:u+=""}return u+=`
|
|
88
107
|
return val;
|
|
89
108
|
}
|
|
@@ -91,11 +110,11 @@ ${h}`;switch(e.compositionType){case g.Vec4:case g.Vec4Array:u+=` highp v
|
|
|
91
110
|
${i} get_${o}(highp uint _instanceId, const uint idxOfArray) {
|
|
92
111
|
return u_${o}${u};
|
|
93
112
|
}
|
|
94
|
-
`}return r}static
|
|
95
|
-
`);let l=i.compositionType.getVec4SizeOfProperty(),d=i.compositionType.getNumberOfComponents(),
|
|
96
|
-
`,
|
|
97
|
-
`,a+=`int scalar_idx = ${
|
|
98
|
-
`}let u="";i.componentType===
|
|
113
|
+
`}return r}static B_(t,e,i){var S,b;let n=i.compositionType.getGlslStr(i.componentType),a,o=p.isTexture(i.compositionType),r=i.semantic.replace(".","_"),c="",s=i.compositionType.getGlslStr(i.componentType),m="";i.arrayLength&&(m=`[${i.arrayLength}]`),(i.needUniformInDataTextureMode||o)&&(c=` uniform ${s} u_${r}${m};
|
|
114
|
+
`);let l=i.compositionType.getVec4SizeOfProperty(),d=i.compositionType.getNumberOfComponents(),h=P.getOffsetOfPropertyOfMaterial(t,i.semantic,e),f=t.materialRepository._getMaterialCountPerBufferView(e),g=`rnOffsets_${r}`,x=`const int ${g}[${h.length}] = int[${h.length}](${h.join(", ")});`,v=l;if(a=`int vec4_idx = ${g}[instanceIdOfBufferViews] + ${v} * int(instanceIdInBufferView);
|
|
115
|
+
`,p.isArray(i.compositionType)){v=l*((S=i.arrayLength)!=null?S:1);let B=Math.ceil(d/4)*4*((b=i.arrayLength)!=null?b:1);a=`int vec4_idx = ${g}[instanceIdOfBufferViews] + ${v} * int(instanceIdInBufferView) + ${l} * int(idxOfArray);
|
|
116
|
+
`,a+=`int scalar_idx = ${g}[instanceIdOfBufferViews] * 4 + ${B} * int(instanceIdInBufferView) + ${d} * int(idxOfArray);
|
|
117
|
+
`}let u="";i.componentType===C.Int&&i.compositionType!==p.Scalar&&(u="i");let R="";if(!o&&!i.needUniformInDataTextureMode){R+=`
|
|
99
118
|
${x}
|
|
100
119
|
${n} get_${r}(highp uint _instanceId, const uint idxOfArray) {
|
|
101
120
|
uint instanceId = _instanceId;
|
|
@@ -103,20 +122,20 @@ ${n} get_${r}(highp uint _instanceId, const uint idxOfArray) {
|
|
|
103
122
|
uint instanceIdInBufferView = instanceId % ${f}u;
|
|
104
123
|
${a}
|
|
105
124
|
`;let y=`${c}
|
|
106
|
-
${R}`;switch(i.compositionType){case
|
|
107
|
-
`;break;case
|
|
108
|
-
`,y+=` highp ${u}vec3 val = ${u}vec3(col0.xyz);`;break;case
|
|
109
|
-
`;break;case
|
|
110
|
-
`,y+=` highp ${u}vec2 val = ${u}vec2(col0.xy);`;break;case
|
|
111
|
-
`;break;case
|
|
112
|
-
`,i.componentType===
|
|
113
|
-
`,i.componentType===
|
|
114
|
-
`;break;case
|
|
115
|
-
`;break;case
|
|
116
|
-
`;break;case
|
|
117
|
-
`;break;case
|
|
118
|
-
`;break;case
|
|
119
|
-
`;break;case
|
|
125
|
+
${R}`;switch(i.compositionType){case p.Vec4:case p.Vec4Array:y+=` highp vec4 val = fetchElement(vec4_idx);
|
|
126
|
+
`;break;case p.Vec3:y+=` vec4 col0 = fetchElement(vec4_idx);
|
|
127
|
+
`,y+=` highp ${u}vec3 val = ${u}vec3(col0.xyz);`;break;case p.Vec3Array:y+=` vec3 val = fetchVec3No16BytesAligned(scalar_idx);
|
|
128
|
+
`;break;case p.Vec2:y+=` highp vec4 col0 = fetchElement(vec4_idx);
|
|
129
|
+
`,y+=` highp ${u}vec2 val = ${u}vec2(col0.xy);`;break;case p.Vec2Array:y+=` highp vec2 val = fetchVec2No16BytesAligned(scalar_idx);
|
|
130
|
+
`;break;case p.Scalar:y+=` vec4 col0 = fetchElement(vec4_idx);
|
|
131
|
+
`,i.componentType===C.Int?y+=" int val = int(col0.x);":i.componentType===C.Bool?y+=" bool val = bool(col0.x);":y+=" float val = col0.x;";break;case p.ScalarArray:y+=` float col0 = fetchScalarNo16BytesAligned(scalar_idx);
|
|
132
|
+
`,i.componentType===C.Int?y+=" int val = int(col0);":i.componentType===C.Bool?y+=" bool val = bool(col0);":y+=" float val = col0;";break;case p.Mat4:y+=` mat4 val = fetchMat4(vec4_idx);
|
|
133
|
+
`;break;case p.Mat4Array:y+=` mat4 val = fetchMat4(vec4_idx);
|
|
134
|
+
`;break;case p.Mat3:y+=` mat3 val = fetchMat3(vec4_idx);
|
|
135
|
+
`;break;case p.Mat3Array:y+=` mat3 val = fetchMat3No16BytesAligned(scalar_idx);
|
|
136
|
+
`;break;case p.Mat2:y+=` mat2 val = fetchMat2(vec4_idx);
|
|
137
|
+
`;break;case p.Mat2Array:y+=` mat2 val = fetchMat2No16BytesAligned(scalar_idx);
|
|
138
|
+
`;break;case p.Mat4x3Array:y+=` mat4x3 val = fetchMat4x3(vec4_idx);
|
|
120
139
|
`;break;default:y+=""}return y+=`
|
|
121
140
|
return val;
|
|
122
141
|
}
|
|
@@ -124,4 +143,4 @@ ${R}`;switch(i.compositionType){case g.Vec4:case g.Vec4Array:y+=` highp v
|
|
|
124
143
|
${n} get_${r}(highp uint _instanceId, const uint idxOfArray) {
|
|
125
144
|
return u_${r}${y};
|
|
126
145
|
}
|
|
127
|
-
`}return c}static getOffsetOfPropertyOfMaterial(t,e,i){return t.materialRepository.getLocationOffsetOfMemberOfMaterial(t,i,e)}static getOffsetOfPropertyOfGlobalDataRepository(t,e){return t.globalDataRepository.getLocationOffsetOfProperty(e)}$load(t){let e=t.mesh;return e==null?(ne.alertNoMeshSet(t),!1):(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0),e.isSetUpDone()||(this.deleteDataTexture(),e._updateVBOAndVAO()),!0)}QI(){let t=U.getMorphUniformDataOffsets();for(let i=0;i<U.getPrimitiveCountHasMorph();i++){let n=U.getPrimitiveHasMorph(i);if(n!=null)for(let a=0;a<n.targets.length;a++){let r=n.targets[a].get(E.Position.XYZ),c=this.i.memoryManager.getByteOffsetOfExistingBuffers($.GPUVertexData,r.bufferView.buffer.indexOfTheBufferUsage);this.wI[t[i]+a]=(this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData+c+r.byteOffsetInBuffer)/4/4}else break}let e=t[t.length-1];this.i.webglResourceRepository.updateUniformBuffer(this.gI,this.wI,0,e)}common_$load(){this.TC()}TC(){let t=!1,e=U.getMorphUniformDataOffsets(),i=Math.max(Math.ceil(e[e.length-1]/4)*4*4,4);if(i!==this.PI){if(this.gI!==v.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.gI),this.gI=v.InvalidCGAPIResourceUid),this.PI=i,this.gI===v.InvalidCGAPIResourceUid){let o=new Uint32Array(i);this.wI=o,this.gI=this.i.webglResourceRepository.createUniformBufferWithBufferView(o),this.QI()}this.PI=i,t=!0}let n=O.getOffsetsInUniform(this.i),a=Math.max(Math.ceil(n[n.length-1]/4)*4*4,4);if(a!==this.KI){if(this.yI!==v.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.yI),this.yI=v.InvalidCGAPIResourceUid),this.yI===v.InvalidCGAPIResourceUid){let o=new Float32Array(a);this.OI=o,this.yI=this.i.webglResourceRepository.createUniformBufferWithBufferView(o),this._S()}this.KI=a,t=!0}t&&this.BC()}BC(){this.gI!==v.InvalidCGAPIResourceUid&&this.yI!==v.InvalidCGAPIResourceUid&&this.i.webglResourceRepository.setUniformBlockBindingForMorphOffsetsAndWeightsWithoutShaderProgram(this.gI,this.yI)}UC(){let t=U.getPrimitiveCountHasMorph();(t!==this.zI||this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData!==this.XI)&&(this.QI(),this.XI=this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData,this.zI=t)}GC(){this.__createAndUpdateDataTextureInner()}__createAndUpdateDataTextureInner(){let t=this.i.memoryManager,i=t.getSizesOfTheBuffers($.GPUInstanceData).reduce((c,s)=>c+s,0),n=t.getBuffers($.GPUInstanceData),a=n.length;a!==this.ZI&&(this.ZI=a,this.deleteDataTexture());let o=this.i.webglResourceRepository.currentWebGLContextWrapper;if(o==null)return;let r=o.getMaxTextureSize();if(this.__dataTextureUid!==v.InvalidCGAPIResourceUid){let c=i/4/4,s=Math.ceil(c/r),p=r*s*4*4,l=this.i.lightClusterSystem,d=l._getExcludedByteRanges(),m=0;for(let f=0;f<n.length;f++){let h=n[f],x=f===n.length-1?h.takenSizeInByte:h.byteLength;x>p&&ee.default.warn("The buffer size exceeds the size of the data texture.");let b=new Float32Array(h.getArrayBuffer());for(let[u,R]of se(m,m+Math.min(x,p),d))this.LS(b,m,u,R,r);B.DI||(oe.downloadTypedArray("Rhodonite_dataTextureBuffer.bin",b),B.DI=!0),m+=h.byteLength}for(let[f,h]of l._takeDirtyByteRanges()){let x=0;for(let b of n){let u=x+b.byteLength;if(f>=x&&h<=u){let R=new Float32Array(b.getArrayBuffer());this.LS(R,x,f,h,r);break}x=u}}}else{let c=t.getBuffers($.GPUVertexData),s=c.map(S=>S.getArrayBuffer()),p=r*4*4,l=n.map(S=>Math.ceil(S.byteLength/p)*p),d=l.reduce((S,M)=>S+M,0),m=c.reduce((S,M)=>S+M.byteLength,0),f=Math.max(Math.ceil((d+m)/p),1),h=this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable,x=this.i.webglResourceRepository.instanceSidTable,b=h?Math.max(x.usedEnd,1):0,u=h?Math.max(Math.ceil(b/r),1):0,R=h?Math.max(Math.ceil(Math.ceil(b/4)/r),1):0,C=f+u+R;this.SI=r,this.BI=f,this.UI=f+u,this.RI=this.BI*r,this.CI=this.UI*r,this.GI=b,h&&x.markAllDirty();let I=p*C,y=new Uint8Array(I),A=0;n.forEach((S,M)=>{y.set(new Uint8Array(S.getArrayBuffer(),0,S.takenSizeInByte),A),A+=l[M]}),c.forEach((S,M)=>{y.set(new Uint8Array(s[M],0,S.byteLength),A),A+=S.byteLength});let L=new Float32Array(y.buffer);this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData=d,this.__dataTextureUid=this.i.webglResourceRepository.createTextureFromTypedArray(L,{internalFormat:ae.RGBA32F,width:r,height:C,format:j.RGBA,type:T.Float,generateMipmap:!1}),this.i.lightClusterSystem._takeDirtyByteRanges()}}LS(t,e,i,n,a){let o=this.i.webglResourceRepository,r=Math.floor(i/16),c=Math.ceil(n/16),s=e/16,p=(l,d,m,f,h)=>{let x=(h-s)*4;o.updateTexture(this.__dataTextureUid,t.subarray(x,x+m*f*4),{level:0,offsetX:l,offsetY:d,width:m,height:f,format:j.RGBA,type:T.Float})};for(;r<c;){let l=r%a,d=Math.floor(r/a);if(l!==0||c-r<a){let m=Math.min(a-l,c-r);p(l,d,m,1,r),r+=m}else{let m=Math.floor((c-r)/a);p(0,d,a,m,r),r+=m*a}}}deleteDataTexture(){this.__dataTextureUid!=null&&(this.i.webglResourceRepository.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=v.InvalidCGAPIResourceUid),this.GI=0,this.SI=0,this.II=v.InvalidCGAPIResourceUid}prerender(){if(this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable){let e=this.i.webglResourceRepository.instanceSidTable;this.__dataTextureUid!==v.InvalidCGAPIResourceUid&&e.usedEnd>this.GI&&this.deleteDataTexture()}(re.getIsAnimating(this.i)||Q.getUpdateCount(this.i)!==this.tr||J.getUpdateCount(this.i)!==this.YI||k.getCurrentCameraUpdateCount(this.i)!==this.kb||q(this.i)!==this.rr||this.i.materialRepository.stateVersion!==this.HI||this.i.lightClusterSystem.dataVersion!==this.jI||z.getUpdateCount(this.i)!==this.er||this.__dataTextureUid===v.InvalidCGAPIResourceUid)&&(this.GC(),this.DC(),this.tr=Q.getUpdateCount(this.i),this.YI=J.getUpdateCount(this.i),this.kb=k.getCurrentCameraUpdateCount(this.i),this.rr=q(this.i),this.HI=this.i.materialRepository.stateVersion,this.jI=this.i.lightClusterSystem.dataVersion,this.er=z.getUpdateCount(this.i)),(O.updateCount!==this.FI||O.getCountOfBlendShapeComponents(this.i)!==this.qI)&&(this._S(),this.FI=O.updateCount,this.qI=O.getCountOfBlendShapeComponents(this.i),this.i.materialRepository._makeShaderInvalidateToMorphMaterials()),this.UC(),this.EI=this.i.componentRepository.getComponentsWithType(z)}_S(){let e=this.i.memoryManager.getBuffer($.GPUVertexData);if(e==null||e.takenSizeInByte===0)return;let i=O.getOffsetsInUniform(this.i),n=this.i.componentRepository.getComponentsWithTypeWithoutFiltering(O);for(let a=0;a<n.length;a++){let o=n[a],r=o!=null?o.weights:[];for(let c=0;c<r.length;c++)this.OI[i[a]+c]=r[c]}if(n.length>0){let a=i[i.length-1];this.i.webglResourceRepository.updateUniformBuffer(this.yI,this.OI,0,a)}}wC(){return this.i.webglResourceRepository.currentWebGLContextWrapper.isWebGL2&&this.i.config.isUboEnabled}DC(){if(this.wC()){let t=this.i.webglResourceRepository.currentWebGLContextWrapper,e=t.getAlignedMaxUniformBlockSize(),i=t.getMaxConventionUniformBlocks(),a=this.i.memoryManager.getBuffer($.GPUInstanceData);if(this.bI===v.InvalidCGAPIResourceUid)this.bI=this.i.webglResourceRepository.setupUniformBufferDataArea(new Float32Array(a.getArrayBuffer()));else{let o=new Float32Array(a.getArrayBuffer());this.i.webglResourceRepository.updateUniformBuffer(this.bI,o,0,e*i/4)}}}attachGPUData(t){}attachGPUDataInner(t,e){}attachVertexData(t,e,i,n){}attachVertexDataInner(t,e,i,n,a){let o=this.i.webglResourceRepository.getWebGLResource(t.getVaoUids(i));if(o!=null)n.bindVertexArray(o);else{n.bindVertexArray(null);let r=e.vertexHandles;this.i.webglResourceRepository.setVertexDataToPipeline(r,e,t._variationVBOUid);let c=this.i.webglResourceRepository.getWebGLResource(r.iboHandle),s=n.getRawContext();s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,c)}}dettachVertexData(t){let e=t.getRawContext();t.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindBuffer(e.ARRAY_BUFFER,null)}static init(t){return new B(t)}zS(t,e,i){if(i){let n=-1,a=this.i._webXRSystemIfEnabled;a!=null&&a.isWebXRMode&&(a.isMultiView()?n=a._getCameraComponentSIDAt(0):n=a._getCameraComponentSIDAt(e)),this.xI._v[N.CameraComponentTID]=n}else{let n=t.cameraComponent;n==null&&(n=this.i.componentRepository.getComponent(k,k.getCurrent(this.i))),n?this.xI._v[N.CameraComponentTID]=n.componentSID:this.xI._v[N.CameraComponentTID]=-1}}HS(t,e,i){this.xI==null&&(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)),this.xI._v[0]=e.materialSID}OC(t,e,i){if(!this.i.config.isMultiDrawEnabled)return;let n=this.i.webglResourceRepository,a=n.currentWebGLContextWrapper;if(a==null||a.webgl2ExtMD==null)return;let o=n.instanceSidTable;if(!o.isSupported)return;let r=H._getInstanceCullingState(e),c=r!=null&&r.culledEntityCount>0;if(this.vI=c?0:1,!c){this.XS(o);return}let s=r.culledEntityStamp,p=r.cullTick,l=r.cullingId;for(let d=0;d<t.length;d++){let m=t[d];if(m===-1)continue;let f=i!=null?i[d]:U.getPrimitive(m);if(f==null)continue;let h=f.mesh;h==null||h._remapPrepassId===l||(h._remapPrepassId=l,h._packVisibleInstancesToVariationVBO(s,p))}this.XS(o)}XS(t){if(this.__dataTextureUid===v.InvalidCGAPIResourceUid||this.SI<=0)return;let e=t.usedEnd;if(e<=0){t.clearSidDirty(),t.clearRemapDirty();return}t.sidDirty&&(this.YS(this.BI,e,(i,n,a)=>t.writeSidTexels(i,n,a)),t.clearSidDirty()),t.remapDirty&&this.vI===0&&(this.YS(this.UI,Math.ceil(e/4),(i,n,a)=>t.writeRemapTexels(i,n,a)),t.clearRemapDirty())}YS(t,e,i){let n=this.SI,a=e,o=0,r=t;for(;a>0;){let c=Math.min(a,n),s=new Float32Array(c*4);i(s,o,c),this.i.webglResourceRepository.updateTexture(this.__dataTextureUid,s,{level:0,offsetX:0,offsetY:r,width:c,height:1,format:j.RGBA,type:T.Float}),a-=c,o+=c,r++}}common_$render(t,e,i,n){typeof spector!="undefined"&&spector.setMarker("| | WebGL2:common_$render#");let a=this.i.webglResourceRepository.currentWebGLContextWrapper,o=a.getRawContextAsWebGL2(),r=V.isVrMainPass(this.i,e),c=V.getDisplayCount(r,this.i._webXRSystemIfEnabled),s=e._lastPrimitiveUids===t?e._lastPrimitives:null;if(e.isBufferLessRenderingMode())return this.PC(o,e,r),o.depthMask(!0),!0;this.OC(t,e,s);let p=!1;return e._toRenderOpaquePrimitives&&(e.depthWriteMask||o.depthMask(!1),p=this.MI(t,s,e._lastOpaqueIndex,0,-1,a,e,r,c)||p),e._toRenderTranslucentPrimitives&&(p=this.MI(t,s,e._lastOpaqueIndex+1,e._lastTranslucentIndex,1,a,e,r,c)||p),e._toRenderBlendWithZWritePrimitives&&(p=this.MI(t,s,e._lastTranslucentIndex+1,e._lastBlendWithZWriteIndex,1,a,e,r,c)||p),e._toRenderBlendWithoutZWritePrimitives&&(o.depthMask(!1),p=this.MI(t,s,e._lastBlendWithZWriteIndex+1,e._lastBlendWithoutZWriteIndex,1,a,e,r,c)||p),o.depthMask(!0),this.dettachVertexData(a),this.IC=i,p}PC(t,e,i){let n=e.material,a=e._dummyPrimitiveForBufferLessRendering;Y(n,a,this);let o=n.getShaderProgramUid(a),r=this.i.webglResourceRepository.getWebGLResource(o);if(t.useProgram(r),this.II=o,this.bindDataTexture(t,r),this.HS(t,n,r),this.zS(e,0,i),this.ZS(t,r),this.KS(t,r),r.vrState!=null&&i){let s=this.i.globalDataRepository.getValue("vrState",0);s._v[0]=i?1:0,s._v[1]=0,r._gl.uniform2iv(r.vrState,s._v)}V.setWebGLParameters(this.i,n,t),n._setParametersToGpuWebGLWithOutInternalSetting({shaderProgram:r,firstTime:!0}),e.depthWriteMask?t.depthMask(!0):t.depthMask(!1),this.i.webglResourceRepository.setViewport(this.i,e.getViewport());let c=this.i.webglResourceRepository.currentWebGLContextWrapper;c!=null&&this.VI(c)&&(t.bindVertexArray(null),t.vertexAttribI4ui(E.MaterialSid.getAttributeSlot(),n.materialSID,0,0,0),t.vertexAttribI4ui(E.Instance.getAttributeSlot(),0,0,0,0),this.qS(t,r),this.JS(t,r)),t.drawArrays(e._primitiveModeForBufferLessRendering.index,0,e._drawVertexNumberForBufferLessRendering)}VI(t){return this.i.config.isMultiDrawEnabled&&t.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported}VC(t,e,i){let n=E.MaterialSid.getAttributeSlot(),a=t._multiDrawGroup,o=i.getRawContextAsWebGL2();if(a==null||a.vertexHandles==null){o.vertexAttribI4ui(n,e.materialSID,0,0,0);return}let r=e===t.material,c=r?a.vertexHandles.vaoHandle:a.genericMaterialSidVaoHandle;if(c!=null){let s=this.i.webglResourceRepository.getWebGLResource(c);s!=null&&i.bindVertexArray(s)}r||o.vertexAttribI4ui(n,e.materialSID,0,0,0)}MI(t,e,i,n,a,o,r,c,s){let p=!c&&s===1&&this.i.config.isMultiDrawEnabled&&o.webgl2ExtMD!=null&&this.i.webglResourceRepository.isInstanceSidTextureCapable,l=!1;if(!p){for(let f=i;a>0?f<=n:f>=n;f+=a)l=this._I(t[f],o,r,c,s,void 0,e==null?void 0:e[f])||l;return l}let m=fe(i,n,a,f=>{let h=t[f];if(h===-1)return null;let x=e!=null?e[f]:U.getPrimitive(h);if(x==null||x._multiDrawGroup==null)return null;let b=r.getAppropriateMaterial(x);return b._materialContent.isMultiDrawCompatible?ce(x,b,le(x)):null},this.SC);for(let f=0;f<m.count;f++){let h=m.starts[f],x=m.counts[f];if(m.keys[f]===-1||x<2)for(let b=0;b<x;b++){let u=h+b*a;l=this._I(t[u],o,r,c,s,void 0,e==null?void 0:e[u])||l}else l=this.LC(t,e,h,x,a,o,r,s)||l}return l}LC(t,e,i,n,a,o,r,c){var S;let s=e!=null?e[i]:U.getPrimitive(t[i]);if(s==null||s._multiDrawGroup==null)return!1;let p=s.mesh,l={primitive:s,mesh:p,indexed:s.hasIndices(),mode:s.primitiveMode.index,indexBitSize:s.getRenderIndexBitSize(),count:0,offset:0,instanceCount:0};if(!this._I(t[i],o,r,!1,c,l,s)){let M=!1;for(let G=1;G<n;G++){let _=i+G*a;M=this._I(t[_],o,r,!1,c,void 0,e==null?void 0:e[_])||M}return M}let m=s._multiDrawGroup,f=m.counts,h=m.offsets,x=m.instanceCounts,b=m.firsts,u=m.vertexCounts,R=l.indexed,C=o.getRawContextAsWebGL2(),I=0;f[I]=l.count,h[I]=l.offset,b[I]=l.offset,u[I]=l.count,x[I]=l.instanceCount,I++;let y=H._getInstanceCullingState(r),A=y==null?void 0:y.culledEntityStamp,L=(S=y==null?void 0:y.cullTick)!=null?S:0;for(let M=1;M<n;M++){let G=i+M*a,_=e!=null?e[G]:U.getPrimitive(t[G]);if(_==null||_._multiDrawGroup!==m)continue;let W=r.getAppropriateMaterial(_);if(W.getShaderProgramUid(_)===-1&&Y(W,_,this),te(W,_))continue;let D=_.mesh._packVisibleInstancesToVariationVBO(A,L);if(D===0)continue;let w=_._multiDrawEntry;w!=null&&(f[I]=w.indexCount,h[I]=w.indexByteOffset,b[I]=w.vertexOffset,u[I]=w.vertexCount,x[I]=D,I++)}return I>=2?R?o.multiDrawElementsInstanced(l.mode,f,0,C.UNSIGNED_INT,h,0,x,0,I):o.multiDrawArraysInstanced(l.mode,b,0,u,0,x,0,I):I===1&&(R?C.drawElementsInstanced(l.mode,f[0],C.UNSIGNED_INT,h[0],x[0]):C.drawArraysInstanced(l.mode,b[0],u[0],x[0])),!0}_I(t,e,i,n,a,o,r){var I,y,A,L;let c=e.getRawContextAsWebGL2(),s=r!=null?r:U.getPrimitive(t);if(s==null)return!1;let p=s.mesh,l=p.meshEntitiesInner[0],d=i.getAppropriateMaterial(s);Y(d,s,this);let m=l.getMeshRenderer(),f=H._getInstanceCullingState(i),h=p._packVisibleInstancesToVariationVBO(f==null?void 0:f.culledEntityStamp,(I=f==null?void 0:f.cullTick)!=null?I:0);if(h===0)return!1;let x=p.getPrimitiveIndexInMesh(s);this.attachVertexDataInner(p,s,x,e,p._variationVBOUid),this.VI(e)&&this.VC(s,d,e);let b=!1,u=!1,R=d.getShaderProgramUid(s);if(R!==this.II||c.JA){if(te(d,s))return this.dettachVertexData(e),!1;let S=this.i.webglResourceRepository.getWebGLResource(R);c.useProgram(S),c.JA=!1,this.bindDataTexture(c,S),this.fI=S,b=!0,u=!0}((y=this.WI)==null?void 0:y.deref())!==d&&(u=!0,this.WI=new WeakRef(d)),this.$I!==d.stateVersion&&(u=!0,this.$I=d.stateVersion),this.VI(e)&&this.fI!=null&&(this.qS(c,this.fI),this.JS(c,this.fI));let C={glw:e,entity:l,worldMatrix:l.getSceneGraph().matrixInner,normalMatrix:l.getSceneGraph().normalMatrixInner,isBillboard:l.getSceneGraph().isBillboard,isVisible:l.getSceneGraph().isVisible,lightComponents:this.EI,renderPass:i,primitive:s,diffuseCube:m.diffuseCubeMap,specularCube:m.specularCubeMap,sheenCube:m.sheenCubeMap,isVr:n,displayIdx:-1};b&&d._setParametersToGpuWebGLPerShaderProgram({engine:this.i,material:d,shaderProgram:this.fI,firstTime:b,args:C}),u&&(this.HS(c,d,this.fI),V.setWebGLParameters(this.i,d,c),d._setParametersToGpuWebGL({engine:this.i,material:d,shaderProgram:this.fI,firstTime:u,args:C})),d._setParametersToGpuWebGLPerPrimitive({material:d,shaderProgram:this.fI,firstTime:u,args:C});for(let S=0;S<a;S++){if(n&&V.setVRViewport(this.i,i,S),this.zS(i,S,n),this.ZS(c,this.fI),this.KS(c,this.fI),this.fI.vrState!=null&&n&&a>1){let F=this.i.globalDataRepository.getValue("vrState",0);F._v[0]=n?1:0,F._v[1]=S,this.fI._gl.uniform2iv(this.fI.vrState,F._v)}this.i.config.isMultiDrawEnabled&&e.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported&&s._multiDrawGroup==null&&c.vertexAttribI4ui(E.Instance.getAttributeSlot(),Math.max(0,p._instanceSidBase),0,0,0);let G=s.indicesAccessor,_=G!=null,W=s.getRenderIndexBitSize(),Z=W==="uint32"?c.UNSIGNED_INT:c.UNSIGNED_SHORT,D=s._multiDrawEntry,w=(A=D==null?void 0:D.indexByteOffset)!=null?A:0,K=(L=D==null?void 0:D.vertexOffset)!=null?L:0;o!=null?(o.primitive=s,o.mesh=p,o.indexed=_,o.mode=s.primitiveMode.index,o.indexBitSize=W,o.count=_?G.elementCount:s.getVertexCountAsVerticesBased(),o.offset=_?w:K,o.instanceCount=h):_?c.drawElementsInstanced(s.primitiveMode.index,G.elementCount,Z,w,h):c.drawArraysInstanced(s.primitiveMode.index,K,s.getVertexCountAsVerticesBased(),h)}return this.II=R,!0}KS(t,e){let i=e,n=i.lightClusterView;if(n==null)return;let a=this.xI._v[N.CameraComponentTID],o=this.i.lightClusterSystem,r=o.dataVersion;i._lightClusterViewCameraSid===a&&i._lightClusterViewVersion===r||(t.uniform4fv(n,o._getViewUniformData(a)),i._lightClusterViewCameraSid=a,i._lightClusterViewVersion=r)}ZS(t,e){let i=this.xI._v,n=this.NI;if(this.kI===e&&n!=null&&n.length===i.length){let a=!0;for(let o=0;o<i.length;o++)if(n[o]!==i[o]){a=!1;break}if(a)return}t.uniform1fv(e.currentComponentSIDs,i),(n==null||n.length!==i.length)&&(n=new Float32Array(i.length),this.NI=n),n.set(i),this.kI=e}bindDataTexture(t,e){t.uniform1i(e.dataTexture,0),this.i.webglResourceRepository.bindTexture2D(0,this.__dataTextureUid);let i=this.i.webglResourceRepository.createOrGetTextureSamplerRepeatNearest();this.i.webglResourceRepository.bindTextureSampler(0,i),this.bindInstanceSidTextures(t,e)}bindInstanceSidTextures(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper;if(n==null||n.webgl2ExtMD==null||!this.i.config.isMultiDrawEnabled||!i.instanceSidTable.isSupported)return;let o=e;o.WC===void 0&&(o.AI=t.getUniformLocation(e,"u_instanceSidDataTextureIndex"),o.LI=t.getUniformLocation(e,"u_instanceRemapDataTextureIndex"),o.TI=t.getUniformLocation(e,"u_instanceRemapIdentity"),o.WC=null),o.AI!=null&&(t.uniform1i(o.AI,this.RI),o.QS=this.RI),o.LI!=null&&(t.uniform1i(o.LI,this.CI),o.xC=this.CI),o.TI!=null&&(t.uniform1i(o.TI,this.vI),o.vC=this.vI)}JS(t,e){let i=e;if(i.AI==null)return;let n=this.RI;i.QS!==n&&(t.uniform1i(i.AI,n),i.QS=n);let a=this.CI;i.xC!==a&&(t.uniform1i(i.LI,a),i.xC=a)}qS(t,e){let i=e;if(i.TI==null)return;let n=this.vI;i.vC!==n&&(t.uniform1i(i.TI,n),i.vC=n)}destroy(){let t=this.i.webglResourceRepository;this.__dataTextureUid!==v.InvalidCGAPIResourceUid&&(t.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=v.InvalidCGAPIResourceUid),this.bI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.bI),this.bI=v.InvalidCGAPIResourceUid),this.gI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.gI),this.gI=v.InvalidCGAPIResourceUid),this.yI!==v.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.yI),this.yI=v.InvalidCGAPIResourceUid)}};B.DI=!0;var ie=B;export{ie as WebGLStrategyWebGL2};
|
|
146
|
+
`}return c}static getOffsetOfPropertyOfMaterial(t,e,i){return t.materialRepository.getLocationOffsetOfMemberOfMaterial(t,i,e)}static getOffsetOfPropertyOfGlobalDataRepository(t,e){return t.globalDataRepository.getLocationOffsetOfProperty(e)}$load(t){let e=t.mesh;return e==null?(ne.alertNoMeshSet(t),!1):(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0),e.isSetUpDone()||(e._updateVBOAndVAO(),this.U_()),!0)}U_(){if(this.__dataTextureUid===I.InvalidCGAPIResourceUid)return;let t=this.i.memoryManager.getBuffers(V.GPUVertexData),e=0;for(let i of t)e+=i.byteLength;e!==this.OI&&this.deleteDataTexture()}HS(){let t=A.getMorphUniformDataOffsets();for(let i=0;i<A.getPrimitiveCountHasMorph();i++){let n=A.getPrimitiveHasMorph(i);if(n!=null)for(let a=0;a<n.targets.length;a++){let r=n.targets[a].get($.Position.XYZ),c=this.i.memoryManager.getByteOffsetOfExistingBuffers(V.GPUVertexData,r.bufferView.buffer.indexOfTheBufferUsage);this.wI[t[i]+a]=(this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData+c+r.byteOffsetInBuffer)/4/4}else break}let e=t[t.length-1];this.i.webglResourceRepository.updateUniformBuffer(this.gI,this.wI,0,e)}common_$load(){this.D_()}D_(){let t=!1,e=A.getMorphUniformDataOffsets(),i=Math.max(Math.ceil(e[e.length-1]/4)*4*4,4);if(i!==this.LI){if(this.gI!==I.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.gI),this.gI=I.InvalidCGAPIResourceUid),this.LI=i,this.gI===I.InvalidCGAPIResourceUid){let a=new Uint32Array(i);this.wI=a,this.gI=this.i.webglResourceRepository.createUniformBufferWithBufferView(a),this.HS()}this.LI=i,t=!0}let n=D._getMorphWeightsUniformBufferFloatCount(this.i);if(n!==this.QI){if(this.yI!==I.InvalidCGAPIResourceUid&&(this.i.webglResourceRepository.deleteUniformBuffer(this.yI),this.yI=I.InvalidCGAPIResourceUid),this.yI===I.InvalidCGAPIResourceUid){let a=new Float32Array(n);this.II=a,this.yI=this.i.webglResourceRepository.createUniformBufferWithBufferView(a),this.XS(!0)}this.QI=n,t=!0}t&&this.P_()}P_(){this.gI!==I.InvalidCGAPIResourceUid&&this.yI!==I.InvalidCGAPIResourceUid&&this.i.webglResourceRepository.setUniformBlockBindingForMorphOffsetsAndWeightsWithoutShaderProgram(this.gI,this.yI)}G_(){let t=A.getPrimitiveCountHasMorph();(t!==this.jI||this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData!==this.KI)&&(this.HS(),this.KI=this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData,this.jI=t)}O_(){this.__createAndUpdateDataTextureInner()}__createAndUpdateDataTextureInner(){let t=this.i.memoryManager,i=t.getSizesOfTheBuffers(V.GPUInstanceData).reduce((c,s)=>c+s,0),n=t.getBuffers(V.GPUInstanceData),a=n.length;a!==this.JI&&(this.JI=a,this.deleteDataTexture());let o=this.i.webglResourceRepository.currentWebGLContextWrapper;if(o==null)return;let r=o.getMaxTextureSize();if(this.__dataTextureUid!==I.InvalidCGAPIResourceUid){let c=i/4/4,s=Math.ceil(c/r),m=r*s*4*4,l=this.i.lightClusterSystem,d=l._getExcludedByteRanges(),h=0;for(let f=0;f<n.length;f++){let g=n[f],x=g.takenSizeInByte;x>m&&ee.default.warn("The buffer size exceeds the size of the data texture.");let v=new Float32Array(g.getArrayBuffer());for(let[u,R]of oe(h,h+Math.min(x,m),d))this.CI(v,h,u,R,r);h+=g.byteLength}for(let[f,g]of l._takeDirtyByteRanges()){let x=0;for(let v of n){let u=x+v.byteLength;if(f>=x&&g<=u){let R=new Float32Array(v.getArrayBuffer());this.CI(R,x,f,g,r);break}x=u}}}else{let c=t.getBuffers(V.GPUVertexData),s=r*4*4,m=n.map(b=>Math.ceil(b.byteLength/s)*s),l=m.reduce((b,y)=>b+y,0),d=c.reduce((b,y)=>b+y.byteLength,0),h=Math.max(Math.ceil((l+d)/s),1),f=this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable,g=this.i.webglResourceRepository.instanceSidTable,x=f?Math.max(g.usedEnd,1):0,v=f?Math.max(Math.ceil(x/r),1):0,u=f?Math.max(Math.ceil(Math.ceil(x/4)/r),1):0,R=h+v+u;this.RI=r,this.DI=h,this.PI=h+v,this._I=this.DI*r,this.MI=this.PI*r,this.GI=x,this.OI=d,f&&g.markAllDirty(),this.i.engineState.totalSizeOfGPUShaderDataStorageExceptMorphData=l,this.__dataTextureUid=this.i.webglResourceRepository.createTexStorage2D({levels:1,internalFormat:ae.RGBA32F,width:r,height:R});let S=0;n.forEach((b,y)=>{this.CI(new Float32Array(b.getArrayBuffer()),S,S,S+b.takenSizeInByte,r),S+=m[y]}),c.forEach(b=>{this.CI(new Float32Array(b.getArrayBuffer()),S,S,S+b.byteLength,r),S+=b.byteLength}),this.i.lightClusterSystem._takeDirtyByteRanges()}}CI(t,e,i,n,a){let o=this.i.webglResourceRepository,r=Math.floor(i/16),c=Math.ceil(n/16),s=e/16,m=(l,d,h,f,g)=>{let x=(g-s)*4;o.updateTexture(this.__dataTextureUid,t.subarray(x,x+h*f*4),{level:0,offsetX:l,offsetY:d,width:h,height:f,format:Q.RGBA,type:C.Float})};for(;r<c;){let l=r%a,d=Math.floor(r/a);if(l!==0||c-r<a){let h=Math.min(a-l,c-r);m(l,d,h,1,r),r+=h}else{let h=Math.floor((c-r)/a);m(0,d,a,h,r),r+=h*a}}}deleteDataTexture(){this.__dataTextureUid!=null&&(this.i.webglResourceRepository.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=I.InvalidCGAPIResourceUid),this.GI=0,this.RI=0,this.OI=0,this.SI=I.InvalidCGAPIResourceUid}prerender(){if(this.i.config.isMultiDrawEnabled&&this.i.webglResourceRepository.isInstanceSidTextureCapable){let e=this.i.webglResourceRepository.instanceSidTable;this.__dataTextureUid!==I.InvalidCGAPIResourceUid&&e.usedEnd>this.GI&&this.deleteDataTexture()}(re.getIsAnimating(this.i)||J.getUpdateCount(this.i)!==this.nr||q.getUpdateCount(this.i)!==this.qI||k.getCurrentCameraUpdateCount(this.i)!==this.dC||K(this.i)!==this.sr||this.i.materialRepository.stateVersion!==this.XI||this.i.lightClusterSystem.dataVersion!==this.YI||z.getUpdateCount(this.i)!==this.or||this.i._gpuInstanceDataVersion!==this.ZI||this.__dataTextureUid===I.InvalidCGAPIResourceUid)&&(this.O_(),this.w_(),this.nr=J.getUpdateCount(this.i),this.qI=q.getUpdateCount(this.i),this.dC=k.getCurrentCameraUpdateCount(this.i),this.sr=K(this.i),this.XI=this.i.materialRepository.stateVersion,this.YI=this.i.lightClusterSystem.dataVersion,this.or=z.getUpdateCount(this.i),this.ZI=this.i._gpuInstanceDataVersion),D.updateCount!==this.HI||D.getCountOfBlendShapeComponents(this.i)!==this.LS?(this.XS(),this.HI=D.updateCount,this.LS=D.getCountOfBlendShapeComponents(this.i),this.i.materialRepository._makeShaderInvalidateToMorphMaterials()):this.V_(),this.G_(),this.NI=this.i.componentRepository.getComponentsWithType(z)}XS(t=!1){let i=this.i.memoryManager.getBuffer(V.GPUVertexData);if(i==null||i.takenSizeInByte===0)return;let n=D._writeMorphWeightsUniformArray(this.i,this.II,t);this.VI=!1,n>0&&this.YS(n)}YS(t){this.i.webglResourceRepository.updateUniformBuffer(this.yI,this.II,0,t)}V_(){if(this.VI||this.II==null)return;this.VI=!0;let t=D._settlePreviousMorphWeights(this.i,this.II);t>0&&this.YS(t)}L_(){return this.i.webglResourceRepository.currentWebGLContextWrapper.isWebGL2&&this.i.config.isUboEnabled}w_(){if(this.L_()){let t=this.i.webglResourceRepository.currentWebGLContextWrapper,e=t.getAlignedMaxUniformBlockSize(),i=t.getMaxConventionUniformBlocks(),a=this.i.memoryManager.getBuffer(V.GPUInstanceData);if(this.bI===I.InvalidCGAPIResourceUid)this.bI=this.i.webglResourceRepository.setupUniformBufferDataArea(new Float32Array(a.getArrayBuffer()));else{let o=new Float32Array(a.getArrayBuffer());this.i.webglResourceRepository.updateUniformBuffer(this.bI,o,0,e*i/4)}}}attachGPUData(t){}attachGPUDataInner(t,e){}attachVertexData(t,e,i,n){}attachVertexDataInner(t,e,i,n,a){let o=this.i.webglResourceRepository.getWebGLResource(t.getVaoUids(i));if(o!=null)n.bindVertexArray(o);else{n.bindVertexArray(null);let r=e.vertexHandles;this.i.webglResourceRepository.setVertexDataToPipeline(r,e,t._variationVBOUid);let c=this.i.webglResourceRepository.getWebGLResource(r.iboHandle),s=n.getRawContext();s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,c)}}dettachVertexData(t){let e=t.getRawContext();t.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindBuffer(e.ARRAY_BUFFER,null)}static init(t){return new P(t)}ZS(t,e,i){if(i){let n=-1,a=this.i._webXRSystemIfEnabled;a!=null&&a.isWebXRMode&&(a.isMultiView()?n=a._getCameraComponentSIDAt(0):n=a._getCameraComponentSIDAt(e)),this.xI._v[N.CameraComponentTID]=n}else{let n=t.cameraComponent;n==null&&(n=this.i.componentRepository.getComponent(k,k.getCurrent(this.i))),n?this.xI._v[N.CameraComponentTID]=n.componentSID:this.xI._v[N.CameraComponentTID]=-1}}KS(t,e,i){this.xI==null&&(this.xI=this.i.globalDataRepository.getValue("currentComponentSIDs",0)),this.xI._v[0]=e.materialSID}W_(t,e,i){if(!this.i.config.isMultiDrawEnabled)return;let n=this.i.webglResourceRepository,a=n.currentWebGLContextWrapper;if(a==null||a.webgl2ExtMD==null)return;let o=n.instanceSidTable;if(!o.isSupported)return;let r=H._getInstanceCullingState(e),c=r!=null&&r.culledEntityCount>0;if(this.vI=c?0:1,!c){this.qS(o);return}let s=r.culledEntityStamp,m=r.cullTick,l=r.cullingId;for(let d=0;d<t.length;d++){let h=t[d];if(h===-1)continue;let f=i!=null?i[d]:A.getPrimitive(h);if(f==null)continue;let g=f.mesh;g==null||g._remapPrepassId===l||(g._remapPrepassId=l,g._packVisibleInstancesToVariationVBO(s,m))}this.qS(o)}qS(t){if(this.__dataTextureUid===I.InvalidCGAPIResourceUid||this.RI<=0)return;let e=t.usedEnd;if(e<=0){t.clearSidDirty(),t.clearRemapDirty();return}t.sidDirty&&(this.JS(this.DI,e,(i,n,a)=>t.writeSidTexels(i,n,a)),t.clearSidDirty()),t.remapDirty&&this.vI===0&&(this.JS(this.PI,Math.ceil(e/4),(i,n,a)=>t.writeRemapTexels(i,n,a)),t.clearRemapDirty())}JS(t,e,i){let n=this.RI,a=e,o=0,r=t;for(;a>0;){let c=Math.min(a,n),s=new Float32Array(c*4);i(s,o,c),this.i.webglResourceRepository.updateTexture(this.__dataTextureUid,s,{level:0,offsetX:0,offsetY:r,width:c,height:1,format:Q.RGBA,type:C.Float}),a-=c,o+=c,r++}}common_$render(t,e,i,n){typeof spector!="undefined"&&spector.setMarker("| | WebGL2:common_$render#");let a=this.i.webglResourceRepository.currentWebGLContextWrapper,o=a.getRawContextAsWebGL2(),r=L.isVrMainPass(this.i,e),c=L.getDisplayCount(r,this.i._webXRSystemIfEnabled),s=e._lastPrimitiveUids===t?e._lastPrimitives:null;if(e.isBufferLessRenderingMode())return this.$_(o,e,r),o.depthMask(!0),!0;this.W_(t,e,s);let m=!1;return e._toRenderOpaquePrimitives&&(e.depthWriteMask||o.depthMask(!1),m=this.AI(t,s,e._lastOpaqueIndex,0,-1,a,e,r,c)||m),e._toRenderTranslucentPrimitives&&(m=this.AI(t,s,e._lastOpaqueIndex+1,e._lastTranslucentIndex,1,a,e,r,c)||m),e._toRenderBlendWithZWritePrimitives&&(m=this.AI(t,s,e._lastTranslucentIndex+1,e._lastBlendWithZWriteIndex,1,a,e,r,c)||m),e._toRenderBlendWithoutZWritePrimitives&&(o.depthMask(!1),m=this.AI(t,s,e._lastBlendWithZWriteIndex+1,e._lastBlendWithoutZWriteIndex,1,a,e,r,c)||m),o.depthMask(!0),this.dettachVertexData(a),this.S_=i,m}$_(t,e,i){let n=e.material,a=e._dummyPrimitiveForBufferLessRendering;X(n,a,this);let o=n.getShaderProgramUid(a),r=this.i.webglResourceRepository.getWebGLResource(o);if(t.useProgram(r),this.SI=o,this.bindDataTexture(t,r),this.KS(t,n,r),this.ZS(e,0,i),this.QS(t,r),this.l_(t,r),r.vrState!=null&&i){let s=this.i.globalDataRepository.getValue("vrState",0);s._v[0]=i?1:0,s._v[1]=0,r._gl.uniform2iv(r.vrState,s._v)}L.setWebGLParameters(this.i,n,t),n._setParametersToGpuWebGLWithOutInternalSetting({shaderProgram:r,firstTime:!0}),e.depthWriteMask?t.depthMask(!0):t.depthMask(!1),this.i.webglResourceRepository.setViewport(this.i,e.getViewport());let c=this.i.webglResourceRepository.currentWebGLContextWrapper;c!=null&&this.WI(c)&&(t.bindVertexArray(null),t.vertexAttribI4ui($.MaterialSid.getAttributeSlot(),n.materialSID,0,0,0),t.vertexAttribI4ui($.Instance.getAttributeSlot(),0,0,0,0),this.d_(t,r),this.g_(t,r)),t.drawArrays(e._primitiveModeForBufferLessRendering.index,0,e._drawVertexNumberForBufferLessRendering)}WI(t){return this.i.config.isMultiDrawEnabled&&t.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported}k_(t,e,i){let n=$.MaterialSid.getAttributeSlot(),a=t._multiDrawGroup,o=i.getRawContextAsWebGL2();if(a==null||a.vertexHandles==null){o.vertexAttribI4ui(n,e.materialSID,0,0,0);return}let r=e===t.material,c=r?a.vertexHandles.vaoHandle:a.genericMaterialSidVaoHandle;if(c!=null){let s=this.i.webglResourceRepository.getWebGLResource(c);s!=null&&i.bindVertexArray(s)}r||o.vertexAttribI4ui(n,e.materialSID,0,0,0)}AI(t,e,i,n,a,o,r,c,s){let m=!c&&s===1&&this.i.config.isMultiDrawEnabled&&o.webgl2ExtMD!=null&&this.i.webglResourceRepository.isInstanceSidTextureCapable,l=!1;if(!m){for(let f=i;a>0?f<=n:f>=n;f+=a)l=this.TI(t[f],o,r,c,s,void 0,e==null?void 0:e[f])||l;return l}let h=le(i,n,a,f=>{let g=t[f];if(g===-1)return null;let x=e!=null?e[f]:A.getPrimitive(g);if(x==null||x._multiDrawGroup==null)return null;let v=r.getAppropriateMaterial(x);return v._materialContent.isMultiDrawCompatible?se(x,v,ce(x)):null},this.M_);for(let f=0;f<h.count;f++){let g=h.starts[f],x=h.counts[f];if(h.keys[f]===-1||x<2)for(let v=0;v<x;v++){let u=g+v*a;l=this.TI(t[u],o,r,c,s,void 0,e==null?void 0:e[u])||l}else l=this.N_(t,e,g,x,a,o,r,s)||l}return l}N_(t,e,i,n,a,o,r,c){var M;let s=e!=null?e[i]:A.getPrimitive(t[i]);if(s==null||s._multiDrawGroup==null)return!1;let m=s.mesh,l={primitive:s,mesh:m,indexed:s.hasIndices(),mode:s.primitiveMode.index,indexBitSize:s.getRenderIndexBitSize(),count:0,offset:0,instanceCount:0};if(!this.TI(t[i],o,r,!1,c,l,s)){let G=!1;for(let T=1;T<n;T++){let _=i+T*a;G=this.TI(t[_],o,r,!1,c,void 0,e==null?void 0:e[_])||G}return G}let h=s._multiDrawGroup,f=h.counts,g=h.offsets,x=h.instanceCounts,v=h.firsts,u=h.vertexCounts,R=l.indexed,S=o.getRawContextAsWebGL2(),b=0;f[b]=l.count,g[b]=l.offset,v[b]=l.offset,u[b]=l.count,x[b]=l.instanceCount,b++;let y=H._getInstanceCullingState(r),B=y==null?void 0:y.culledEntityStamp,E=(M=y==null?void 0:y.cullTick)!=null?M:0;for(let G=1;G<n;G++){let T=i+G*a,_=e!=null?e[T]:A.getPrimitive(t[T]);if(_==null||_._multiDrawGroup!==h)continue;let W=r.getAppropriateMaterial(_);if(W.getShaderProgramUid(_)===-1&&X(W,_,this),te(W,_))continue;let U=_.mesh._packVisibleInstancesToVariationVBO(B,E);if(U===0)continue;let O=_._multiDrawEntry;O!=null&&(f[b]=O.indexCount,g[b]=O.indexByteOffset,v[b]=O.vertexOffset,u[b]=O.vertexCount,x[b]=U,b++)}return b>=2?R?o.multiDrawElementsInstanced(l.mode,f,0,S.UNSIGNED_INT,g,0,x,0,b):o.multiDrawArraysInstanced(l.mode,v,0,u,0,x,0,b):b===1&&(R?S.drawElementsInstanced(l.mode,f[0],S.UNSIGNED_INT,g[0],x[0]):S.drawArraysInstanced(l.mode,v[0],u[0],x[0])),!0}TI(t,e,i,n,a,o,r){var b,y,B,E;let c=e.getRawContextAsWebGL2(),s=r!=null?r:A.getPrimitive(t);if(s==null)return!1;let m=s.mesh,l=m.meshEntitiesInner[0],d=i.getAppropriateMaterial(s);X(d,s,this);let h=l.getMeshRenderer(),f=H._getInstanceCullingState(i),g=m._packVisibleInstancesToVariationVBO(f==null?void 0:f.culledEntityStamp,(b=f==null?void 0:f.cullTick)!=null?b:0);if(g===0)return!1;let x=m.getPrimitiveIndexInMesh(s);this.attachVertexDataInner(m,s,x,e,m._variationVBOUid),this.WI(e)&&this.k_(s,d,e);let v=!1,u=!1,R=d.getShaderProgramUid(s);if(R!==this.SI||c.$A){if(te(d,s))return this.dettachVertexData(e),!1;let M=this.i.webglResourceRepository.getWebGLResource(R);c.useProgram(M),c.$A=!1,this.bindDataTexture(c,M),this.fI=M,v=!0,u=!0}((y=this.EI)==null?void 0:y.deref())!==d&&(u=!0,this.EI=new WeakRef(d)),this.kI!==d.stateVersion&&(u=!0,this.kI=d.stateVersion),this.WI(e)&&this.fI!=null&&(this.d_(c,this.fI),this.g_(c,this.fI));let S={glw:e,entity:l,worldMatrix:l.getSceneGraph().matrixInner,normalMatrix:l.getSceneGraph().normalMatrixInner,isBillboard:l.getSceneGraph().isBillboard,isVisible:l.getSceneGraph().isVisible,lightComponents:this.NI,renderPass:i,primitive:s,diffuseCube:h.diffuseCubeMap,specularCube:h.specularCubeMap,sheenCube:h.sheenCubeMap,isVr:n,displayIdx:-1};v&&d._setParametersToGpuWebGLPerShaderProgram({engine:this.i,material:d,shaderProgram:this.fI,firstTime:v,args:S}),u&&(this.KS(c,d,this.fI),L.setWebGLParameters(this.i,d,c),d._setParametersToGpuWebGL({engine:this.i,material:d,shaderProgram:this.fI,firstTime:u,args:S})),d._setParametersToGpuWebGLPerPrimitive({material:d,shaderProgram:this.fI,firstTime:u,args:S});for(let M=0;M<a;M++){if(n&&L.setVRViewport(this.i,i,M),this.ZS(i,M,n),this.QS(c,this.fI),this.l_(c,this.fI),this.fI.vrState!=null&&n&&a>1){let F=this.i.globalDataRepository.getValue("vrState",0);F._v[0]=n?1:0,F._v[1]=M,this.fI._gl.uniform2iv(this.fI.vrState,F._v)}this.i.config.isMultiDrawEnabled&&e.webgl2ExtMD!=null&&this.i.webglResourceRepository.instanceSidTable.isSupported&&s._multiDrawGroup==null&&c.vertexAttribI4ui($.Instance.getAttributeSlot(),Math.max(0,m._instanceSidBase),0,0,0);let T=s.indicesAccessor,_=T!=null,W=s.getRenderIndexBitSize(),Y=W==="uint32"?c.UNSIGNED_INT:c.UNSIGNED_SHORT,U=s._multiDrawEntry,O=(B=U==null?void 0:U.indexByteOffset)!=null?B:0,Z=(E=U==null?void 0:U.vertexOffset)!=null?E:0;o!=null?(o.primitive=s,o.mesh=m,o.indexed=_,o.mode=s.primitiveMode.index,o.indexBitSize=W,o.count=_?T.elementCount:s.getVertexCountAsVerticesBased(),o.offset=_?O:Z,o.instanceCount=g):_?c.drawElementsInstanced(s.primitiveMode.index,T.elementCount,Y,O,g):c.drawArraysInstanced(s.primitiveMode.index,Z,s.getVertexCountAsVerticesBased(),g)}return this.SI=R,!0}l_(t,e){let i=e,n=i.lightClusterView;if(n==null)return;let a=this.xI._v[N.CameraComponentTID],o=this.i.lightClusterSystem,r=o.dataVersion;i._lightClusterViewCameraSid===a&&i._lightClusterViewVersion===r||(t.uniform4fv(n,o._getViewUniformData(a)),i._lightClusterViewCameraSid=a,i._lightClusterViewVersion=r)}QS(t,e){let i=this.xI._v,n=this.zI;if(this.FI===e&&n!=null&&n.length===i.length){let a=!0;for(let o=0;o<i.length;o++)if(n[o]!==i[o]){a=!1;break}if(a)return}t.uniform1fv(e.currentComponentSIDs,i),(n==null||n.length!==i.length)&&(n=new Float32Array(i.length),this.zI=n),n.set(i),this.FI=e}bindDataTexture(t,e){t.uniform1i(e.dataTexture,0),this.i.webglResourceRepository.bindTexture2D(0,this.__dataTextureUid);let i=this.i.webglResourceRepository.createOrGetTextureSamplerRepeatNearest();this.i.webglResourceRepository.bindTextureSampler(0,i),this.bindInstanceSidTextures(t,e)}bindInstanceSidTextures(t,e){let i=this.i.webglResourceRepository,n=i.currentWebGLContextWrapper;if(n==null||n.webgl2ExtMD==null||!this.i.config.isMultiDrawEnabled||!i.instanceSidTable.isSupported)return;let o=e;o.F_===void 0&&(o.BI=t.getUniformLocation(e,"u_instanceSidDataTextureIndex"),o.$I=t.getUniformLocation(e,"u_instanceRemapDataTextureIndex"),o.UI=t.getUniformLocation(e,"u_instanceRemapIdentity"),o.F_=null),o.BI!=null&&(t.uniform1i(o.BI,this._I),o.y_=this._I),o.$I!=null&&(t.uniform1i(o.$I,this.MI),o.x_=this.MI),o.UI!=null&&(t.uniform1i(o.UI,this.vI),o.I_=this.vI)}g_(t,e){let i=e;if(i.BI==null)return;let n=this._I;i.y_!==n&&(t.uniform1i(i.BI,n),i.y_=n);let a=this.MI;i.x_!==a&&(t.uniform1i(i.$I,a),i.x_=a)}d_(t,e){let i=e;if(i.UI==null)return;let n=this.vI;i.I_!==n&&(t.uniform1i(i.UI,n),i.I_=n)}destroy(){let t=this.i.webglResourceRepository;this.__dataTextureUid!==I.InvalidCGAPIResourceUid&&(t.deleteTexture(this.__dataTextureUid),this.__dataTextureUid=I.InvalidCGAPIResourceUid),this.bI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.bI),this.bI=I.InvalidCGAPIResourceUid),this.gI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.gI),this.gI=I.InvalidCGAPIResourceUid),this.yI!==I.InvalidCGAPIResourceUid&&(t.deleteUniformBuffer(this.yI),this.yI=I.InvalidCGAPIResourceUid)}};export{ie as WebGLStrategyWebGL2};
|
|
@@ -13,9 +13,6 @@ var t=`
|
|
|
13
13
|
uniform float u_pointSize; // initialValue=30
|
|
14
14
|
uniform vec3 u_pointDistanceAttenuation; // initialValue=(0,0.1,0.01)
|
|
15
15
|
|
|
16
|
-
// BiasMatrix * LightProjectionMatrix * LightViewMatrix, See: http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/#basic-shader
|
|
17
|
-
uniform mat4 u_depthBiasPV; // initialValue=(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)
|
|
18
|
-
|
|
19
16
|
#ifdef RN_IS_MORPHING
|
|
20
17
|
uniform int u_currentPrimitiveIdx; // initialValue=0, isInternalSetting=true, soloDatum=false, needUniformInDataTextureMode=true
|
|
21
18
|
#endif
|
package/dist/esm/webgl/shaderity_shaders/MToon0xSingleShader/MToon0xSingleShader.frag.glsl.js
CHANGED
|
@@ -23,6 +23,7 @@ in vec3 v_normal_inView;
|
|
|
23
23
|
|
|
24
24
|
uniform bool u_inverseEnvironment; // initialValue=false
|
|
25
25
|
uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
|
|
26
|
+
uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
|
|
26
27
|
uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
|
|
27
28
|
|
|
28
29
|
uniform samplerCube u_diffuseEnvTexture; // initialValue=(6,black), isInternalSetting=true
|
|
@@ -291,4 +292,4 @@ void main (){
|
|
|
291
292
|
|
|
292
293
|
|
|
293
294
|
}
|
|
294
|
-
`,e="fragment",r=!0,
|
|
295
|
+
`,e="fragment",r=!0,a={code:t,shaderStage:e,isFragmentShader:r};export{t as code,a as default,r as isFragmentShader,e as shaderStage};
|
|
@@ -74,6 +74,7 @@ uniform float u_uvAnimationRotationSpeedFactor; // initialValue=0.0
|
|
|
74
74
|
|
|
75
75
|
uniform bool u_inverseEnvironment; // initialValue=false
|
|
76
76
|
uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
|
|
77
|
+
uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
|
|
77
78
|
uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
|
|
78
79
|
uniform float u_alphaCutoff; // initialValue=0.5
|
|
79
80
|
uniform bool u_makeOutputSrgb; // initialValue=false
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var i=`
|
|
2
|
+
|
|
3
|
+
/* shaderity: @{glslPrecision} */
|
|
4
|
+
|
|
5
|
+
/* shaderity: @{definitions} */
|
|
6
|
+
|
|
7
|
+
/* shaderity: @{prerequisites} */
|
|
8
|
+
|
|
9
|
+
/* shaderity: @{vertexIn} */
|
|
10
|
+
|
|
11
|
+
in vec4 v_currentPosition_inClip;
|
|
12
|
+
in vec4 v_previousPosition_inClip;
|
|
13
|
+
|
|
14
|
+
/* shaderity: @{renderTargetBegin} */
|
|
15
|
+
|
|
16
|
+
/* shaderity: @{getters} */
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
void main (){
|
|
20
|
+
|
|
21
|
+
/* shaderity: @{mainPrerequisites} */
|
|
22
|
+
|
|
23
|
+
// The motion from the previous frame in texture coordinates. In WebGL, the texture coordinates of a
|
|
24
|
+
// render target have the same orientation as NDC (both y up), so the NDC motion is halved.
|
|
25
|
+
vec2 velocity = vec2(2.0, 2.0); // moves the history lookup off screen, i.e. rejects the history
|
|
26
|
+
if (v_previousPosition_inClip.w > 0.0) {
|
|
27
|
+
vec2 currentNdc = v_currentPosition_inClip.xy / v_currentPosition_inClip.w;
|
|
28
|
+
vec2 previousNdc = v_previousPosition_inClip.xy / v_previousPosition_inClip.w;
|
|
29
|
+
velocity = (currentNdc - previousNdc) * 0.5;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// z: the depth, used to pick the motion vector of the closest surface around a pixel.
|
|
33
|
+
rt0 = vec4(velocity, gl_FragCoord.z, 1.0);
|
|
34
|
+
}
|
|
35
|
+
`,t="fragment",r=!0,o={code:i,shaderStage:t,isFragmentShader:r};export{i as code,o as default,r as isFragmentShader,t as shaderStage};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
var t=`
|
|
2
|
+
/* shaderity: @{enableVertexExtensions} */
|
|
3
|
+
/* shaderity: @{glslPrecision} */
|
|
4
|
+
|
|
5
|
+
/* shaderity: @{definitions} */
|
|
6
|
+
|
|
7
|
+
/* shaderity: @{vertexInOut} */
|
|
8
|
+
|
|
9
|
+
uniform float u_pointSize; // initialValue=30, soloDatum=true
|
|
10
|
+
uniform vec3 u_pointDistanceAttenuation; // initialValue=(0.0, 0.1, 0.01), soloDatum=true
|
|
11
|
+
|
|
12
|
+
// Clip space positions of this frame (without the jitter) and of the previous frame.
|
|
13
|
+
out vec4 v_currentPosition_inClip;
|
|
14
|
+
out vec4 v_previousPosition_inClip;
|
|
15
|
+
|
|
16
|
+
#ifdef RN_IS_MORPHING
|
|
17
|
+
uniform int u_currentPrimitiveIdx; // initialValue=0, isInternalSetting=true, soloDatum=false, needUniformInDataTextureMode=true
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/* shaderity: @{prerequisites} */
|
|
22
|
+
|
|
23
|
+
/* shaderity: @{getters} */
|
|
24
|
+
|
|
25
|
+
/* shaderity: @{matricesGetters} */
|
|
26
|
+
|
|
27
|
+
/* shaderity: @{processGeometry} */
|
|
28
|
+
|
|
29
|
+
#ifdef RN_IS_SKINNING
|
|
30
|
+
// The matrix of one joint decoded from the bone data of the previous frame (see getBoneMatrix in processGeometry)
|
|
31
|
+
mat4 getPreviousBoneMatrix(uint skeletalComponentSID, uint jointIdx, int boneDataType, vec4 boneDataInfo) {
|
|
32
|
+
if (boneDataType == RN_BONE_DATA_TYPE_MAT43X1) {
|
|
33
|
+
vec4 a = get_previousBoneData(skeletalComponentSID, jointIdx * 3u);
|
|
34
|
+
vec4 b = get_previousBoneData(skeletalComponentSID, jointIdx * 3u + 1u);
|
|
35
|
+
vec4 c = get_previousBoneData(skeletalComponentSID, jointIdx * 3u + 2u);
|
|
36
|
+
return mat4(
|
|
37
|
+
a.x, a.y, a.z, 0.0,
|
|
38
|
+
a.w, b.x, b.y, 0.0,
|
|
39
|
+
b.z, b.w, c.x, 0.0,
|
|
40
|
+
c.y, c.z, c.w, 1.0
|
|
41
|
+
);
|
|
42
|
+
} else if (boneDataType == RN_BONE_DATA_TYPE_VEC4X2) {
|
|
43
|
+
vec4 tq = get_previousBoneData(skeletalComponentSID, jointIdx * 2u);
|
|
44
|
+
vec4 sq = get_previousBoneData(skeletalComponentSID, jointIdx * 2u + 1u);
|
|
45
|
+
vec4 quat = decodeLogQuat(uvec2(floatBitsToUint(tq.w), floatBitsToUint(sq.w)));
|
|
46
|
+
return createMatrixFromQuaternionTranslationScale(quat, tq.xyz, sq.xyz);
|
|
47
|
+
} else {
|
|
48
|
+
uvec4 chunk = floatBitsToUint(get_previousBoneData(skeletalComponentSID, jointIdx));
|
|
49
|
+
vec4 ts = unpackVec4FromUvec2(chunk.zw);
|
|
50
|
+
vec3 translation = ts.xyz * boneDataInfo.xyz;
|
|
51
|
+
float scale = decodeVec4x1Scale(ts.w, chunk.y);
|
|
52
|
+
return createMatrixFromQuaternionTranslationScale(decodeLogQuat(chunk.xy), translation, vec3(scale));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// The skinning matrix of the previous frame. The previous bone data info has w = -1 until the skeleton has
|
|
57
|
+
// previous bone data; the current skinning matrix is used then.
|
|
58
|
+
mat4 getPreviousSkinMatrix(uint skeletalComponentSID, uvec4 joint, vec4 weight) {
|
|
59
|
+
vec4 boneDataInfo = get_previousBoneDataInfo(skeletalComponentSID);
|
|
60
|
+
if (boneDataInfo.w < 0.0) {
|
|
61
|
+
return getSkinMatrix(skeletalComponentSID, joint, weight);
|
|
62
|
+
}
|
|
63
|
+
int boneDataType = int(boneDataInfo.w + 0.5);
|
|
64
|
+
mat4 skinMat = weight.x * getPreviousBoneMatrix(skeletalComponentSID, joint.x, boneDataType, boneDataInfo);
|
|
65
|
+
skinMat += weight.y * getPreviousBoneMatrix(skeletalComponentSID, joint.y, boneDataType, boneDataInfo);
|
|
66
|
+
skinMat += weight.z * getPreviousBoneMatrix(skeletalComponentSID, joint.z, boneDataType, boneDataInfo);
|
|
67
|
+
skinMat += weight.w * getPreviousBoneMatrix(skeletalComponentSID, joint.w, boneDataType, boneDataInfo);
|
|
68
|
+
return skinMat;
|
|
69
|
+
}
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
void main()
|
|
73
|
+
{
|
|
74
|
+
|
|
75
|
+
/* shaderity: @{mainPrerequisites} */
|
|
76
|
+
|
|
77
|
+
mat4 worldMatrix = get_worldMatrix(uint(a_instanceIds.x));
|
|
78
|
+
mat4 previousWorldMatrix = get_previousWorldMatrix(uint(a_instanceIds.x));
|
|
79
|
+
mat4 viewMatrix = get_viewMatrix(cameraSID);
|
|
80
|
+
mat4 projectionMatrix = get_projectionMatrix(cameraSID);
|
|
81
|
+
mat3 normalMatrix = get_normalMatrix(uint(a_instanceIds.x));
|
|
82
|
+
bool isBillboard = get_isBillboard(uint(a_instanceIds.x));
|
|
83
|
+
|
|
84
|
+
v_color = a_color;
|
|
85
|
+
|
|
86
|
+
bool isSkinning = false;
|
|
87
|
+
|
|
88
|
+
isSkinning = processGeometry(
|
|
89
|
+
worldMatrix,
|
|
90
|
+
normalMatrix,
|
|
91
|
+
viewMatrix,
|
|
92
|
+
a_position,
|
|
93
|
+
a_normal,
|
|
94
|
+
uvec4(a_joint),
|
|
95
|
+
a_weight,
|
|
96
|
+
isBillboard,
|
|
97
|
+
normalMatrix,
|
|
98
|
+
v_position_inWorld,
|
|
99
|
+
v_normal_inWorld
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// The same (jittered) position as the color pass, so that the motion vectors cover the same pixels.
|
|
103
|
+
vec4 position_inClip = projectionMatrix * viewMatrix * v_position_inWorld;
|
|
104
|
+
gl_Position = position_inClip;
|
|
105
|
+
|
|
106
|
+
// The jitter moves the NDC position by currentJitter, i.e. the clip position by currentJitter * w.
|
|
107
|
+
vec2 currentJitter = get_currentJitter(materialSID, 0u);
|
|
108
|
+
v_currentPosition_inClip = position_inClip - vec4(currentJitter * position_inClip.w, 0.0, 0.0);
|
|
109
|
+
|
|
110
|
+
// The previous world position: the vertex deformed by the blend shape weights and the bone data of the previous
|
|
111
|
+
// frame, transformed by the world matrix of the previous frame.
|
|
112
|
+
vec4 previousPosition_inWorld;
|
|
113
|
+
if (isBillboard) {
|
|
114
|
+
// A billboard faces the camera of each frame: only the motion of its world matrix is considered.
|
|
115
|
+
previousPosition_inWorld = previousWorldMatrix * (inverse(worldMatrix) * v_position_inWorld);
|
|
116
|
+
} else {
|
|
117
|
+
vec3 previousPosition_inLocal = a_position.xyz;
|
|
118
|
+
#ifdef RN_IS_MORPHING
|
|
119
|
+
int blendShapeComponentSID = int(a_instanceIds.z);
|
|
120
|
+
if (blendShapeComponentSID != -1) {
|
|
121
|
+
previousPosition_inLocal = get_previousMorphedPosition(uint(a_baryCentricCoord.w), a_position.xyz, uint(blendShapeComponentSID));
|
|
122
|
+
}
|
|
123
|
+
#endif
|
|
124
|
+
mat4 previousLocalToWorld = previousWorldMatrix;
|
|
125
|
+
#ifdef RN_IS_SKINNING
|
|
126
|
+
if (skeletalComponentSID != INVALID_ID) {
|
|
127
|
+
previousLocalToWorld = previousWorldMatrix * getPreviousSkinMatrix(skeletalComponentSID, uvec4(a_joint), a_weight);
|
|
128
|
+
}
|
|
129
|
+
#endif
|
|
130
|
+
previousPosition_inWorld = previousLocalToWorld * vec4(previousPosition_inLocal, 1.0);
|
|
131
|
+
}
|
|
132
|
+
v_previousPosition_inClip = get_previousViewProjectionMatrix(materialSID, 0u) * previousPosition_inWorld;
|
|
133
|
+
|
|
134
|
+
bool visibility = get_isVisible(uint(a_instanceIds.x));
|
|
135
|
+
if (!visibility)
|
|
136
|
+
{
|
|
137
|
+
gl_Position = vec4(0.0);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
`,i="vertex",o=!1,a={code:t,shaderStage:i,isFragmentShader:o};export{t as code,a as default,o as isFragmentShader,i as shaderStage};
|
|
@@ -18,6 +18,7 @@ uniform sampler2D u_metallicRoughnessTexture; // initialValue=(2,white)
|
|
|
18
18
|
uniform bool u_isOutputHDR; // initialValue=0
|
|
19
19
|
uniform bool u_makeOutputSrgb; // initialValue=1
|
|
20
20
|
uniform vec4 u_iblParameter; // initialValue=(1,1,1,1), isInternalSetting=true
|
|
21
|
+
uniform float u_iblMipLevelSkip; // initialValue=0, isInternalSetting=true
|
|
21
22
|
uniform ivec2 u_hdriFormat; // initialValue=(0,0), isInternalSetting=true
|
|
22
23
|
uniform samplerCube u_diffuseEnvTexture; // initialValue=(6,black), isInternalSetting=true
|
|
23
24
|
uniform samplerCube u_specularEnvTexture; // initialValue=(7,black), isInternalSetting=true
|
|
@@ -777,6 +778,7 @@ vec3 emissiveFactor = get_emissiveFactor(materialSID, 0u);
|
|
|
777
778
|
/* shaderity: @{wireframe} */
|
|
778
779
|
|
|
779
780
|
/* shaderity: @{outputSrgb} */
|
|
781
|
+
|
|
780
782
|
rt0.rgb = rt0.rgb * rt0.a; // alpha premultiplied
|
|
781
783
|
rt1 = rt0;
|
|
782
784
|
rt2 = rt0;
|