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,12 +1,12 @@
|
|
|
1
|
-
import{ComponentType as o}from"../definitions/ComponentType.js";import{CompositionType as g}from"../definitions/CompositionType.js";import{Matrix33 as z}from"../math/Matrix33.js";import{MutableMatrix44 as w}from"../math/MutableMatrix44.js";import{MutableVector2 as L}from"../math/MutableVector2.js";import{MutableVector3 as X}from"../math/MutableVector3.js";import{MutableVector4 as O}from"../math/MutableVector4.js";import{Vector2 as M}from"../math/Vector2.js";import{Vector3 as N}from"../math/Vector3.js";import{Vector4 as T}from"../math/Vector4.js";import{Is as C}from"../misc/Is.js";import{Logger as V}from"../misc/Logger.js";var a=class a{constructor({bufferView:s,byteOffsetInBufferView:e,compositionType:h,componentType:t,byteStride:i,count:r,raw:c,max:u,min:y,arrayLength:_,normalized:A}){this.
|
|
1
|
+
import{ComponentType as o}from"../definitions/ComponentType.js";import{CompositionType as g}from"../definitions/CompositionType.js";import{Matrix33 as z}from"../math/Matrix33.js";import{MutableMatrix44 as w}from"../math/MutableMatrix44.js";import{MutableVector2 as L}from"../math/MutableVector2.js";import{MutableVector3 as X}from"../math/MutableVector3.js";import{MutableVector4 as O}from"../math/MutableVector4.js";import{Vector2 as M}from"../math/Vector2.js";import{Vector3 as N}from"../math/Vector3.js";import{Vector4 as T}from"../math/Vector4.js";import{Is as C}from"../misc/Is.js";import{Logger as V}from"../misc/Logger.js";var a=class a{constructor({bufferView:s,byteOffsetInBufferView:e,compositionType:h,componentType:t,byteStride:i,count:r,raw:c,max:u,min:y,arrayLength:_,normalized:A}){this.p_=g.Unknown;this.c_=o.Unknown;this.Ab=0;this.Ob=new Float32Array;this.Ib=0;this.hb=0;this.ny=O.fromCopyArray([-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]);this.sy=O.fromCopyArray([Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE]);this.Bb=1;this.Tb=!1;this.Vb=!0;this.Nb=0;var I,B,S,f,n,m,x,E;this.Cb=s,this._b=s.byteOffsetInRawArrayBufferOfBuffer+e,this.p_=h,this.c_=t,this.Ab=r,this.Bb=_,C.exist(u)&&this.ny.setComponents((I=u[0])!=null?I:-Number.MAX_VALUE,(B=u[1])!=null?B:-Number.MAX_VALUE,(S=u[2])!=null?S:-Number.MAX_VALUE,(f=u[3])!=null?f:-Number.MAX_VALUE),C.exist(y)&&this.sy.setComponents((n=y[0])!=null?n:Number.MAX_VALUE,(m=y[1])!=null?m:Number.MAX_VALUE,(x=y[2])!=null?x:Number.MAX_VALUE,(E=y[3])!=null?E:Number.MAX_VALUE),C.exist(u)&&C.exist(y)&&(this.Vb=!1),this.Fp=c,this.Tb=A,this.hb=i,this.hb===0&&(this.hb=this.p_.getNumberOfComponents()*this.c_.getSizeInBytes()*this.Bb);let p=this.getTypedArrayClass(this.c_);this.Mb=p;let b=this.hb-this.p_.getNumberOfComponents()*this.c_.getSizeInBytes(),l=this.Fp.byteLength-this._b,v=this.byteStride*this.Ab-b;l<v&&V.default.error(`Requesting a data size that exceeds the remaining capacity of the buffer: ${this.bufferView.buffer.name}.
|
|
2
2
|
Exceeded Size: ${v-l}
|
|
3
3
|
this.__raw.byteLength: ${this.Fp.byteLength}
|
|
4
4
|
this.__byteOffsetInRawArrayBufferOfBuffer: ${this.byteOffsetInRawArrayBufferOfBuffer}
|
|
5
5
|
this.byteStride: ${this.byteStride}
|
|
6
|
-
this.__count: ${this.
|
|
7
|
-
this.__raw.byteLength - this.__byteOffsetInRawArrayBufferOfBuffer: ${this.Fp.byteLength-this.
|
|
8
|
-
this.byteStride * this.__count: ${this.byteStride*this.
|
|
6
|
+
this.__count: ${this.Ab}
|
|
7
|
+
this.__raw.byteLength - this.__byteOffsetInRawArrayBufferOfBuffer: ${this.Fp.byteLength-this._b}
|
|
8
|
+
this.byteStride * this.__count: ${this.byteStride*this.Ab}
|
|
9
9
|
maxExceededSizeOnAoS: ${b}
|
|
10
|
-
`),this.
|
|
10
|
+
`),this.vb=new DataView(this.Fp,this._b,Math.min(this.hb*this.Ab,this.Fp.byteLength-this._b)),this._b%p.BYTES_PER_ELEMENT===0?this.Ob=new p(this.Fp,this._b,this.p_.getNumberOfComponents()*this.Ab):(V.default.warn(`This Accessor's byteOffsetInRawArrayBufferOfBuffer is not aligned with the typedArrayClass's BYTES_PER_ELEMENT. So we need to copy the buffer.
|
|
11
11
|
So the typedArray data got by getTypedArray() is copied data, not reference to the original buffer.
|
|
12
|
-
`),this.Bb()),this.ub=this.lb[this.getDataViewGetter(this.s_)].bind(this.lb),this.fb=this.lb[this.getDataViewSetter(this.s_)].bind(this.lb)}Bb(){let s=this.getTypedArrayClass(this.s_),e=this.Fp.slice(this.bb,this.bb+this.o_.getNumberOfComponents()*this.pb*s.BYTES_PER_ELEMENT);this._b=new s(e)}yb(){var s;this.vb++,this._primitive!=null&&((s=this._primitive.deref())==null||s.onAccessorUpdated(this.vb))}getTypedArrayClass(s){switch(s){case o.Byte:return Int8Array;case o.UnsignedByte:return Uint8Array;case o.Short:return Int16Array;case o.UnsignedShort:return Uint16Array;case o.Int:return Int32Array;case o.UnsignedInt:return Uint32Array;case o.Float:return Float32Array;case o.Double:return Float64Array;default:V.default.error("Unexpected ComponentType!");return}}getDataViewGetter(s){switch(s){case o.Byte:return"getInt8";case o.UnsignedByte:return"getUint8";case o.Short:return"getInt16";case o.UnsignedShort:return"getUint16";case o.Int:return"getInt32";case o.UnsignedInt:return"getUint32";case o.Float:return"getFloat32";case o.Double:return"getFloat64";default:return V.default.error("Unexpected ComponentType!"),"unknown"}}getDataViewSetter(s){switch(s){case o.Byte:return"setInt8";case o.UnsignedByte:return"setUint8";case o.Short:return"setInt16";case o.UnsignedShort:return"setUint16";case o.Int:return"setInt32";case o.UnsignedInt:return"setUint32";case o.Float:return"setFloat32";case o.Double:return"setFloat64";default:V.default.error("Unexpected ComponentType!")}}takeOne(){let s=this.Fp;this.gb>=this.pb&&V.default.error("You are trying to allocate more than you have secured.");let e=new this.Sb(s,this.bb+this.hb*this.gb,this.o_.getNumberOfComponents()*this.Vb);return e._accessor=this,e._idx_of_accessor=this.gb,this.gb+=1,e}_takeExistedOne(s){let e=this.Fp;s>=this.pb&&V.default.error("You are trying to allocate more than you have secured.");let h=new this.Sb(e,this.bb+this.hb*s,this.o_.getNumberOfComponents()*this.Vb);return h._accessor=this,h._idx_of_accessor=s,h}get takenCount(){return this.gb}get numberOfComponents(){return this.o_.getNumberOfComponents()}get componentSizeInBytes(){return this.s_.getSizeInBytes()}get elementSizeInBytes(){return this.numberOfComponents*this.componentSizeInBytes}get elementCount(){return this.pb}get byteLength(){return this.hb*this.pb}get componentType(){return this.s_}get compositionType(){return this.o_}getTypedArray(){return this._b}setTypedArray(s){if(s.buffer!==this.Fp){if(this.o_===g.Scalar)for(let e=0;e<this.pb;e++)this.setScalar(e,s[e],{endian:!0});else if(this.o_===g.Vec2)for(let e=0;e<this.pb;e++)this.setVec2(e,s[e*2],s[e*2+1],{endian:!0});else if(this.o_===g.Vec3)for(let e=0;e<this.pb;e++)this.setVec3(e,s[e*3],s[e*3+1],s[e*3+2],{endian:!0});else if(this.o_===g.Vec4)for(let e=0;e<this.pb;e++)this.setVec4(e,s[e*4],s[e*4+1],s[e*4+2],s[e*4+3],{endian:!0});else if(this.o_===g.Mat3)for(let e=0;e<this.pb;e++)this.setMat3(e,s[e*9],s[e*9+1],s[e*9+2],s[e*9+3],s[e*9+4],s[e*9+5],s[e*9+6],s[e*9+7],s[e*9+8],{endian:!0});else if(this.o_===g.Mat4)for(let e=0;e<this.pb;e++)this.setMat4(e,s[e*16],s[e*16+1],s[e*16+2],s[e*16+3],s[e*16+4],s[e*16+5],s[e*16+6],s[e*16+7],s[e*16+8],s[e*16+9],s[e*16+10],s[e*16+11],s[e*16+12],s[e*16+13],s[e*16+14],s[e*16+15],{endian:!0});else throw new Error("Unexpected CompositionType!");this.Bb()}}getUint8Array(){return new Uint8Array(this.bufferView.buffer.getArrayBuffer(),this.byteOffsetInRawArrayBufferOfBuffer,this.byteLength)}get isAoS(){return!this.isSoA}get isSoA(){return this.byteStride===this.o_.getNumberOfComponents()*this.s_.getSizeInBytes()}get byteStride(){return this.hb}getScalar(s,{indicesAccessor:e,endian:h=!0}){let t=s;return e&&(t=e.getScalar(s,{})),this.ub(this.hb*t,h)}getScalarAt(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;return h&&(i=h.getScalar(s,{})),this.ub(this.hb*i+e,t)}getVec2AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h)]}getVec3AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h)]}getVec4AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h)]}getMat3AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h),this.ub(this.hb*t+4*i,h),this.ub(this.hb*t+5*i,h),this.ub(this.hb*t+6*i,h),this.ub(this.hb*t+7*i,h),this.ub(this.hb*t+8*i,h)]}getMat4AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h),this.ub(this.hb*t+4*i,h),this.ub(this.hb*t+5*i,h),this.ub(this.hb*t+6*i,h),this.ub(this.hb*t+7*i,h),this.ub(this.hb*t+8*i,h),this.ub(this.hb*t+9*i,h),this.ub(this.hb*t+10*i,h),this.ub(this.hb*t+11*i,h),this.ub(this.hb*t+12*i,h),this.ub(this.hb*t+13*i,h),this.ub(this.hb*t+14*i,h),this.ub(this.hb*t+15*i,h)]}getVec2(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return M.fromCopyArray2([this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h)])}getVec3(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return N.fromCopyArray([this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h)])}getVec4(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return T.fromCopyArray([this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h)])}getMat3(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return z.fromCopy9RowMajor(this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h),this.ub(this.hb*t+4*i,h),this.ub(this.hb*t+5*i,h),this.ub(this.hb*t+6*i,h),this.ub(this.hb*t+7*i,h),this.ub(this.hb*t+8*i,h))}getMat4(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return w.fromCopy16RowMajor(this.ub(this.hb*t,h),this.ub(this.hb*t+1*i,h),this.ub(this.hb*t+2*i,h),this.ub(this.hb*t+3*i,h),this.ub(this.hb*t+4*i,h),this.ub(this.hb*t+5*i,h),this.ub(this.hb*t+6*i,h),this.ub(this.hb*t+7*i,h),this.ub(this.hb*t+8*i,h),this.ub(this.hb*t+9*i,h),this.ub(this.hb*t+10*i,h),this.ub(this.hb*t+11*i,h),this.ub(this.hb*t+12*i,h),this.ub(this.hb*t+13*i,h),this.ub(this.hb*t+14*i,h),this.ub(this.hb*t+15*i,h))}getVec2To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t))}getVec3To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t),this.ub(this.hb*i+2*r,t))}getVec4To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t),this.ub(this.hb*i+2*r,t),this.ub(this.hb*i+3*r,t))}getMat3To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t),this.ub(this.hb*i+2*r,t),this.ub(this.hb*i+3*r,t),this.ub(this.hb*i+4*r,t),this.ub(this.hb*i+5*r,t),this.ub(this.hb*i+6*r,t),this.ub(this.hb*i+7*r,t),this.ub(this.hb*i+8*r,t))}getMat4To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.ub(this.hb*i,t),this.ub(this.hb*i+1*r,t),this.ub(this.hb*i+2*r,t),this.ub(this.hb*i+3*r,t),this.ub(this.hb*i+4*r,t),this.ub(this.hb*i+5*r,t),this.ub(this.hb*i+6*r,t),this.ub(this.hb*i+7*r,t),this.ub(this.hb*i+8*r,t),this.ub(this.hb*i+9*r,t),this.ub(this.hb*i+10*r,t),this.ub(this.hb*i+11*r,t),this.ub(this.hb*i+12*r,t),this.ub(this.hb*i+13*r,t),this.ub(this.hb*i+14*r,t),this.ub(this.hb*i+15*r,t))}setScalar(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{})),this.fb(this.hb*i,e,t),this.cb=!0,this.yb()}setVec2(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{}));let c=this.componentSizeInBytes;this.fb(this.hb*r,e,i),this.fb(this.hb*r+1*c,h,i),this.cb=!0,this.yb()}setVec3(s,e,h,t,{indicesAccessor:i,endian:r=!0}){let c=s;i&&(c=i.getScalar(s,{}));let u=this.componentSizeInBytes;this.fb(this.hb*c,e,r),this.fb(this.hb*c+1*u,h,r),this.fb(this.hb*c+2*u,t,r),this.cb=!0,this.yb()}setVec4(s,e,h,t,i,{indicesAccessor:r,endian:c=!0}){let u=s;r&&(u=r.getScalar(s,{}));let y=this.componentSizeInBytes;this.fb(this.hb*u,e,c),this.fb(this.hb*u+1*y,h,c),this.fb(this.hb*u+2*y,t,c),this.fb(this.hb*u+3*y,i,c),this.cb=!0,this.yb()}setMat3(s,e,h,t,i,r,c,u,y,_,{indicesAccessor:A,endian:p=!0}){let b=s;A&&(b=A.getScalar(s,{}));let l=this.componentSizeInBytes;this.fb(this.hb*b,e,p),this.fb(this.hb*b+1*l,h,p),this.fb(this.hb*b+2*l,t,p),this.fb(this.hb*b+3*l,i,p),this.fb(this.hb*b+4*l,r,p),this.fb(this.hb*b+5*l,c,p),this.fb(this.hb*b+6*l,u,p),this.fb(this.hb*b+7*l,y,p),this.fb(this.hb*b+8*l,_,p),this.cb=!0,this.yb()}setMat4(s,e,h,t,i,r,c,u,y,_,A,p,b,l,v,I,B,{indicesAccessor:S,endian:f=!0}){let n=s;S&&(n=S.getScalar(s,{}));let m=this.componentSizeInBytes;this.fb(this.hb*n,e,f),this.fb(this.hb*n+1*m,h,f),this.fb(this.hb*n+2*m,t,f),this.fb(this.hb*n+3*m,i,f),this.fb(this.hb*n+4*m,r,f),this.fb(this.hb*n+5*m,c,f),this.fb(this.hb*n+6*m,u,f),this.fb(this.hb*n+7*m,y,f),this.fb(this.hb*n+8*m,_,f),this.fb(this.hb*n+9*m,A,f),this.fb(this.hb*n+10*m,p,f),this.fb(this.hb*n+11*m,b,f),this.fb(this.hb*n+12*m,l,f),this.fb(this.hb*n+13*m,v,f),this.fb(this.hb*n+14*m,I,f),this.fb(this.hb*n+15*m,B,f),this.cb=!0,this.yb()}setVec2AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.fb(this.hb*i,e.x,t),this.fb(this.hb*i+1*r,e.y,t),this.cb=!0,this.yb()}setVec3AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.fb(this.hb*i,e.x,t),this.fb(this.hb*i+1*r,e.y,t),this.fb(this.hb*i+2*r,e.z,t),this.cb=!0,this.yb()}setVec4AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.fb(this.hb*i,e.x,t),this.fb(this.hb*i+1*r,e.y,t),this.fb(this.hb*i+2*r,e.z,t),this.fb(this.hb*i+3*r,e.w,t),this.cb=!0,this.yb()}setMat4AsMatrix44(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.fb(this.hb*i,e._v[0],t),this.fb(this.hb*i+1*r,e._v[1],t),this.fb(this.hb*i+2*r,e._v[2],t),this.fb(this.hb*i+3*r,e._v[3],t),this.fb(this.hb*i+4*r,e._v[4],t),this.fb(this.hb*i+5*r,e._v[5],t),this.fb(this.hb*i+6*r,e._v[6],t),this.fb(this.hb*i+7*r,e._v[7],t),this.fb(this.hb*i+8*r,e._v[8],t),this.fb(this.hb*i+9*r,e._v[9],t),this.fb(this.hb*i+10*r,e._v[10],t),this.fb(this.hb*i+11*r,e._v[11],t),this.fb(this.hb*i+12*r,e._v[12],t),this.fb(this.hb*i+13*r,e._v[13],t),this.fb(this.hb*i+14*r,e._v[14],t),this.fb(this.hb*i+15*r,e._v[15],t),this.cb=!0,this.yb()}copyFromTypedArray(s){let e=this.numberOfComponents;for(let h=0;h<s.byteLength/this.componentSizeInBytes;h++){let t=Math.floor(h/e),i=t*e;switch(e){case 1:this.setScalar(t,s[i+0],{});break;case 2:this.setVec2(t,s[i+0],s[i+1],{});break;case 3:this.setVec3(t,s[i+0],s[i+1],s[i+2],{});break;case 4:this.setVec4(t,s[i+0],s[i+1],s[i+2],s[i+3],{});break;default:throw new Error("Other than vectors are currently not supported.")}}this.cb=!0,this.yb()}setScalarAt(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{})),this.fb(this.hb*r+e,h,i),this.cb=!0,this.yb()}setElementFromSameCompositionAccessor(s,e,h){let t=h!=null?h:s;this.compositionType.getNumberOfComponents()===1?this.setScalar(s,e.getScalar(t,{}),{}):this.compositionType.getNumberOfComponents()===2?this.setVec2AsVector(s,e.getVec2(t,{}),{}):this.compositionType.getNumberOfComponents()===3?this.setVec3AsVector(s,e.getVec3(t,{}),{}):this.compositionType.getNumberOfComponents()===4&&this.setVec4AsVector(s,e.getVec4(t,{}),{}),this.cb=!0,this.yb()}copyBuffer(s){new Uint8Array(this.Fp).set(new Uint8Array(s.Fp,s.bb,s.byteLength),this.bb),this.cb=!0,this.yb()}setElementFromAccessor(s,e,h){let t=h!=null?h:s;if(this.compositionType.getNumberOfComponents()===1)e.compositionType.getNumberOfComponents()===1?this.setScalar(s,e.getScalar(t,{}),{}):e.compositionType.getNumberOfComponents()===2?this.setScalar(s,e.getVec2(t,{}).x,{}):e.compositionType.getNumberOfComponents()===3?this.setScalar(s,e.getVec3(t,{}).x,{}):e.compositionType.getNumberOfComponents()===4&&this.setScalar(s,e.getVec4(t,{}).x,{});else if(this.compositionType.getNumberOfComponents()===2){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec2(s,i,0,{})}else if(e.compositionType.getNumberOfComponents()===2)this.setVec2AsVector(s,e.getVec2(t,{}),{});else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec2(s,i.x,i.y,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec2(s,i.x,i.y,{})}}else if(this.compositionType.getNumberOfComponents()===3){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec3(s,i,0,0,{})}else if(e.compositionType.getNumberOfComponents()===2){let i=e.getVec2(t,{});this.setVec3(s,i.x,i.y,0,{})}else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec3AsVector(s,i,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec3(s,i.x,i.y,i.z,{})}}else if(this.compositionType.getNumberOfComponents()===4){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec4(s,i,0,0,0,{})}else if(e.compositionType.getNumberOfComponents()===2){let i=e.getVec2(t,{});this.setVec4(s,i.x,i.y,0,0,{})}else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec4(s,i.x,i.y,i.z,0,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec4AsVector(s,i,{})}}this.cb=!0,this.yb()}addElementFromSameCompositionAccessor(s,e,h,t){let i=t!=null?t:s;this.compositionType.getNumberOfComponents()===1?this.setScalar(s,this.getScalar(s,{})+h*e.getScalar(i,{}),{}):this.compositionType.getNumberOfComponents()===2?this.setVec2AsVector(s,M.add(this.getVec2(s,{}),M.multiply(e.getVec2(i,{}),h)),{}):this.compositionType.getNumberOfComponents()===3?this.setVec3AsVector(s,N.add(this.getVec3(s,{}),N.multiply(e.getVec3(i,{}),h)),{}):this.compositionType.getNumberOfComponents()===4&&this.setVec4AsVector(s,T.add(this.getVec4(s,{}),T.multiply(e.getVec4(i,{}),h)),{}),this.cb=!0,this.yb()}get arrayBufferOfBufferView(){return this.Fp}get dataViewOfBufferView(){return this.lb}get byteOffsetInBufferView(){return this.bb-this.Ab.byteOffsetInRawArrayBufferOfBuffer}get byteOffsetInBuffer(){return this.bb-this.Ab.buffer.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this.bb}get bufferView(){return this.Ab}setMinMax(s,e){let h=this.compositionType.getNumberOfComponents();h===1?(this.sy._v[0]=s[0],this.ny._v[0]=e[0]):h===2?(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.ny._v[0]=e[0],this.ny._v[1]=e[1]):h===3?(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.sy._v[2]=s[2],this.ny._v[0]=e[0],this.ny._v[1]=e[1],this.ny._v[2]=e[2]):h===4&&(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.sy._v[2]=s[2],this.sy._v[3]=s[3],this.ny._v[0]=e[0],this.ny._v[1]=e[1],this.ny._v[2]=e[2],this.ny._v[3]=e[3]),this.cb=!1}get min(){this.cb&&this.Cb();let s=this.compositionType.getNumberOfComponents();return s===4?[this.sy._v[0],this.sy._v[1],this.sy._v[2],this.sy._v[3]]:s===3?[this.sy._v[0],this.sy._v[1],this.sy._v[2]]:s===2?[this.sy._v[0],this.sy._v[1]]:[this.sy._v[0]]}get max(){this.cb&&this.Cb();let s=this.compositionType.getNumberOfComponents();return s===4?[this.ny._v[0],this.ny._v[1],this.ny._v[2],this.ny._v[3]]:s===3?[this.ny._v[0],this.ny._v[1],this.ny._v[2]]:s===2?[this.ny._v[0],this.ny._v[1]]:[this.ny._v[0]]}get normalized(){return this.Ib}Cb(){let s=this.compositionType.getNumberOfComponents();if(s===4){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Ol;for(let h=0;h<this.elementCount;h++){this.getVec4To(h,e,{});for(let t=0;t<4;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===3){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Ze;for(let h=0;h<this.elementCount;h++){this.getVec3To(h,e,{});for(let t=0;t<3;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===2){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Ob;for(let h=0;h<this.elementCount;h++){this.getVec2To(h,e,{});for(let t=0;t<2;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===1){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let e=0;e<this.elementCount;e++){let h=this.getScalar(e,{});this.ny._v[0]<h&&(this.ny._v[0]=h),h<this.sy._v[0]&&(this.sy._v[0]=h)}}this.cb=!1}get isMinMaxDirty(){return this.cb}get version(){return this.vb}get actualByteStride(){return this.hb===0?this.o_.getNumberOfComponents()*this.s_.getSizeInBytes()*this.Vb:this.hb}isSame(s){return this.byteLength===s.byteLength&&this.byteOffsetInRawArrayBufferOfBuffer===s.byteOffsetInRawArrayBufferOfBuffer&&this.bufferView.buffer.getArrayBuffer()===s.bufferView.buffer.getArrayBuffer()}};a.Ol=O.zero(),a.Ze=X.zero(),a.Ob=L.zero();var U=a;export{U as Accessor};
|
|
12
|
+
`),this.xb()),this.yb=this.vb[this.getDataViewGetter(this.c_)].bind(this.vb),this.gb=this.vb[this.getDataViewSetter(this.c_)].bind(this.vb)}xb(){let s=this.getTypedArrayClass(this.c_),e=this.Fp.slice(this._b,this._b+this.p_.getNumberOfComponents()*this.Ab*s.BYTES_PER_ELEMENT);this.Ob=new s(e)}Sb(){var s;this.Nb++,this._primitive!=null&&((s=this._primitive.deref())==null||s.onAccessorUpdated(this.Nb))}getTypedArrayClass(s){switch(s){case o.Byte:return Int8Array;case o.UnsignedByte:return Uint8Array;case o.Short:return Int16Array;case o.UnsignedShort:return Uint16Array;case o.Int:return Int32Array;case o.UnsignedInt:return Uint32Array;case o.Float:return Float32Array;case o.Double:return Float64Array;default:V.default.error("Unexpected ComponentType!");return}}getDataViewGetter(s){switch(s){case o.Byte:return"getInt8";case o.UnsignedByte:return"getUint8";case o.Short:return"getInt16";case o.UnsignedShort:return"getUint16";case o.Int:return"getInt32";case o.UnsignedInt:return"getUint32";case o.Float:return"getFloat32";case o.Double:return"getFloat64";default:return V.default.error("Unexpected ComponentType!"),"unknown"}}getDataViewSetter(s){switch(s){case o.Byte:return"setInt8";case o.UnsignedByte:return"setUint8";case o.Short:return"setInt16";case o.UnsignedShort:return"setUint16";case o.Int:return"setInt32";case o.UnsignedInt:return"setUint32";case o.Float:return"setFloat32";case o.Double:return"setFloat64";default:V.default.error("Unexpected ComponentType!")}}takeOne(){let s=this.Fp;this.Ib>=this.Ab&&V.default.error("You are trying to allocate more than you have secured.");let e=new this.Mb(s,this._b+this.hb*this.Ib,this.p_.getNumberOfComponents()*this.Bb);return e._accessor=this,e._idx_of_accessor=this.Ib,this.Ib+=1,e}_takeExistedOne(s){let e=this.Fp;s>=this.Ab&&V.default.error("You are trying to allocate more than you have secured.");let h=new this.Mb(e,this._b+this.hb*s,this.p_.getNumberOfComponents()*this.Bb);return h._accessor=this,h._idx_of_accessor=s,h}get takenCount(){return this.Ib}get numberOfComponents(){return this.p_.getNumberOfComponents()}get componentSizeInBytes(){return this.c_.getSizeInBytes()}get elementSizeInBytes(){return this.numberOfComponents*this.componentSizeInBytes}get elementCount(){return this.Ab}get byteLength(){return this.hb*this.Ab}get componentType(){return this.c_}get compositionType(){return this.p_}getTypedArray(){return this.Ob}setTypedArray(s){if(s.buffer!==this.Fp){if(this.p_===g.Scalar)for(let e=0;e<this.Ab;e++)this.setScalar(e,s[e],{endian:!0});else if(this.p_===g.Vec2)for(let e=0;e<this.Ab;e++)this.setVec2(e,s[e*2],s[e*2+1],{endian:!0});else if(this.p_===g.Vec3)for(let e=0;e<this.Ab;e++)this.setVec3(e,s[e*3],s[e*3+1],s[e*3+2],{endian:!0});else if(this.p_===g.Vec4)for(let e=0;e<this.Ab;e++)this.setVec4(e,s[e*4],s[e*4+1],s[e*4+2],s[e*4+3],{endian:!0});else if(this.p_===g.Mat3)for(let e=0;e<this.Ab;e++)this.setMat3(e,s[e*9],s[e*9+1],s[e*9+2],s[e*9+3],s[e*9+4],s[e*9+5],s[e*9+6],s[e*9+7],s[e*9+8],{endian:!0});else if(this.p_===g.Mat4)for(let e=0;e<this.Ab;e++)this.setMat4(e,s[e*16],s[e*16+1],s[e*16+2],s[e*16+3],s[e*16+4],s[e*16+5],s[e*16+6],s[e*16+7],s[e*16+8],s[e*16+9],s[e*16+10],s[e*16+11],s[e*16+12],s[e*16+13],s[e*16+14],s[e*16+15],{endian:!0});else throw new Error("Unexpected CompositionType!");this.xb()}}getUint8Array(){return new Uint8Array(this.bufferView.buffer.getArrayBuffer(),this.byteOffsetInRawArrayBufferOfBuffer,this.byteLength)}get isAoS(){return!this.isSoA}get isSoA(){return this.byteStride===this.p_.getNumberOfComponents()*this.c_.getSizeInBytes()}get byteStride(){return this.hb}getScalar(s,{indicesAccessor:e,endian:h=!0}){let t=s;return e&&(t=e.getScalar(s,{})),this.yb(this.hb*t,h)}getScalarAt(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;return h&&(i=h.getScalar(s,{})),this.yb(this.hb*i+e,t)}getVec2AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h)]}getVec3AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h)]}getVec4AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h)]}getMat3AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h),this.yb(this.hb*t+4*i,h),this.yb(this.hb*t+5*i,h),this.yb(this.hb*t+6*i,h),this.yb(this.hb*t+7*i,h),this.yb(this.hb*t+8*i,h)]}getMat4AsArray(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return[this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h),this.yb(this.hb*t+4*i,h),this.yb(this.hb*t+5*i,h),this.yb(this.hb*t+6*i,h),this.yb(this.hb*t+7*i,h),this.yb(this.hb*t+8*i,h),this.yb(this.hb*t+9*i,h),this.yb(this.hb*t+10*i,h),this.yb(this.hb*t+11*i,h),this.yb(this.hb*t+12*i,h),this.yb(this.hb*t+13*i,h),this.yb(this.hb*t+14*i,h),this.yb(this.hb*t+15*i,h)]}getVec2(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return M.fromCopyArray2([this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h)])}getVec3(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return N.fromCopyArray([this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h)])}getVec4(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return T.fromCopyArray([this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h)])}getMat3(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return z.fromCopy9RowMajor(this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h),this.yb(this.hb*t+4*i,h),this.yb(this.hb*t+5*i,h),this.yb(this.hb*t+6*i,h),this.yb(this.hb*t+7*i,h),this.yb(this.hb*t+8*i,h))}getMat4(s,{indicesAccessor:e,endian:h=!0}){let t=s;e&&(t=e.getScalar(s,{}));let i=this.componentSizeInBytes;return w.fromCopy16RowMajor(this.yb(this.hb*t,h),this.yb(this.hb*t+1*i,h),this.yb(this.hb*t+2*i,h),this.yb(this.hb*t+3*i,h),this.yb(this.hb*t+4*i,h),this.yb(this.hb*t+5*i,h),this.yb(this.hb*t+6*i,h),this.yb(this.hb*t+7*i,h),this.yb(this.hb*t+8*i,h),this.yb(this.hb*t+9*i,h),this.yb(this.hb*t+10*i,h),this.yb(this.hb*t+11*i,h),this.yb(this.hb*t+12*i,h),this.yb(this.hb*t+13*i,h),this.yb(this.hb*t+14*i,h),this.yb(this.hb*t+15*i,h))}getVec2To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t))}getVec3To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t),this.yb(this.hb*i+2*r,t))}getVec4To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t),this.yb(this.hb*i+2*r,t),this.yb(this.hb*i+3*r,t))}getMat3To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t),this.yb(this.hb*i+2*r,t),this.yb(this.hb*i+3*r,t),this.yb(this.hb*i+4*r,t),this.yb(this.hb*i+5*r,t),this.yb(this.hb*i+6*r,t),this.yb(this.hb*i+7*r,t),this.yb(this.hb*i+8*r,t))}getMat4To(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;return e.setComponents(this.yb(this.hb*i,t),this.yb(this.hb*i+1*r,t),this.yb(this.hb*i+2*r,t),this.yb(this.hb*i+3*r,t),this.yb(this.hb*i+4*r,t),this.yb(this.hb*i+5*r,t),this.yb(this.hb*i+6*r,t),this.yb(this.hb*i+7*r,t),this.yb(this.hb*i+8*r,t),this.yb(this.hb*i+9*r,t),this.yb(this.hb*i+10*r,t),this.yb(this.hb*i+11*r,t),this.yb(this.hb*i+12*r,t),this.yb(this.hb*i+13*r,t),this.yb(this.hb*i+14*r,t),this.yb(this.hb*i+15*r,t))}setScalar(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{})),this.gb(this.hb*i,e,t),this.Vb=!0,this.Sb()}setVec2(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{}));let c=this.componentSizeInBytes;this.gb(this.hb*r,e,i),this.gb(this.hb*r+1*c,h,i),this.Vb=!0,this.Sb()}setVec3(s,e,h,t,{indicesAccessor:i,endian:r=!0}){let c=s;i&&(c=i.getScalar(s,{}));let u=this.componentSizeInBytes;this.gb(this.hb*c,e,r),this.gb(this.hb*c+1*u,h,r),this.gb(this.hb*c+2*u,t,r),this.Vb=!0,this.Sb()}setVec4(s,e,h,t,i,{indicesAccessor:r,endian:c=!0}){let u=s;r&&(u=r.getScalar(s,{}));let y=this.componentSizeInBytes;this.gb(this.hb*u,e,c),this.gb(this.hb*u+1*y,h,c),this.gb(this.hb*u+2*y,t,c),this.gb(this.hb*u+3*y,i,c),this.Vb=!0,this.Sb()}setMat3(s,e,h,t,i,r,c,u,y,_,{indicesAccessor:A,endian:p=!0}){let b=s;A&&(b=A.getScalar(s,{}));let l=this.componentSizeInBytes;this.gb(this.hb*b,e,p),this.gb(this.hb*b+1*l,h,p),this.gb(this.hb*b+2*l,t,p),this.gb(this.hb*b+3*l,i,p),this.gb(this.hb*b+4*l,r,p),this.gb(this.hb*b+5*l,c,p),this.gb(this.hb*b+6*l,u,p),this.gb(this.hb*b+7*l,y,p),this.gb(this.hb*b+8*l,_,p),this.Vb=!0,this.Sb()}setMat4(s,e,h,t,i,r,c,u,y,_,A,p,b,l,v,I,B,{indicesAccessor:S,endian:f=!0}){let n=s;S&&(n=S.getScalar(s,{}));let m=this.componentSizeInBytes;this.gb(this.hb*n,e,f),this.gb(this.hb*n+1*m,h,f),this.gb(this.hb*n+2*m,t,f),this.gb(this.hb*n+3*m,i,f),this.gb(this.hb*n+4*m,r,f),this.gb(this.hb*n+5*m,c,f),this.gb(this.hb*n+6*m,u,f),this.gb(this.hb*n+7*m,y,f),this.gb(this.hb*n+8*m,_,f),this.gb(this.hb*n+9*m,A,f),this.gb(this.hb*n+10*m,p,f),this.gb(this.hb*n+11*m,b,f),this.gb(this.hb*n+12*m,l,f),this.gb(this.hb*n+13*m,v,f),this.gb(this.hb*n+14*m,I,f),this.gb(this.hb*n+15*m,B,f),this.Vb=!0,this.Sb()}setVec2AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.gb(this.hb*i,e.x,t),this.gb(this.hb*i+1*r,e.y,t),this.Vb=!0,this.Sb()}setVec3AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.gb(this.hb*i,e.x,t),this.gb(this.hb*i+1*r,e.y,t),this.gb(this.hb*i+2*r,e.z,t),this.Vb=!0,this.Sb()}setVec4AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.gb(this.hb*i,e.x,t),this.gb(this.hb*i+1*r,e.y,t),this.gb(this.hb*i+2*r,e.z,t),this.gb(this.hb*i+3*r,e.w,t),this.Vb=!0,this.Sb()}setMat4AsMatrix44(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.gb(this.hb*i,e._v[0],t),this.gb(this.hb*i+1*r,e._v[1],t),this.gb(this.hb*i+2*r,e._v[2],t),this.gb(this.hb*i+3*r,e._v[3],t),this.gb(this.hb*i+4*r,e._v[4],t),this.gb(this.hb*i+5*r,e._v[5],t),this.gb(this.hb*i+6*r,e._v[6],t),this.gb(this.hb*i+7*r,e._v[7],t),this.gb(this.hb*i+8*r,e._v[8],t),this.gb(this.hb*i+9*r,e._v[9],t),this.gb(this.hb*i+10*r,e._v[10],t),this.gb(this.hb*i+11*r,e._v[11],t),this.gb(this.hb*i+12*r,e._v[12],t),this.gb(this.hb*i+13*r,e._v[13],t),this.gb(this.hb*i+14*r,e._v[14],t),this.gb(this.hb*i+15*r,e._v[15],t),this.Vb=!0,this.Sb()}copyFromTypedArray(s){let e=this.numberOfComponents;for(let h=0;h<s.byteLength/this.componentSizeInBytes;h++){let t=Math.floor(h/e),i=t*e;switch(e){case 1:this.setScalar(t,s[i+0],{});break;case 2:this.setVec2(t,s[i+0],s[i+1],{});break;case 3:this.setVec3(t,s[i+0],s[i+1],s[i+2],{});break;case 4:this.setVec4(t,s[i+0],s[i+1],s[i+2],s[i+3],{});break;default:throw new Error("Other than vectors are currently not supported.")}}this.Vb=!0,this.Sb()}setScalarAt(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{})),this.gb(this.hb*r+e,h,i),this.Vb=!0,this.Sb()}setElementFromSameCompositionAccessor(s,e,h){let t=h!=null?h:s;this.compositionType.getNumberOfComponents()===1?this.setScalar(s,e.getScalar(t,{}),{}):this.compositionType.getNumberOfComponents()===2?this.setVec2AsVector(s,e.getVec2(t,{}),{}):this.compositionType.getNumberOfComponents()===3?this.setVec3AsVector(s,e.getVec3(t,{}),{}):this.compositionType.getNumberOfComponents()===4&&this.setVec4AsVector(s,e.getVec4(t,{}),{}),this.Vb=!0,this.Sb()}copyBuffer(s){new Uint8Array(this.Fp).set(new Uint8Array(s.Fp,s._b,s.byteLength),this._b),this.Vb=!0,this.Sb()}setElementFromAccessor(s,e,h){let t=h!=null?h:s;if(this.compositionType.getNumberOfComponents()===1)e.compositionType.getNumberOfComponents()===1?this.setScalar(s,e.getScalar(t,{}),{}):e.compositionType.getNumberOfComponents()===2?this.setScalar(s,e.getVec2(t,{}).x,{}):e.compositionType.getNumberOfComponents()===3?this.setScalar(s,e.getVec3(t,{}).x,{}):e.compositionType.getNumberOfComponents()===4&&this.setScalar(s,e.getVec4(t,{}).x,{});else if(this.compositionType.getNumberOfComponents()===2){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec2(s,i,0,{})}else if(e.compositionType.getNumberOfComponents()===2)this.setVec2AsVector(s,e.getVec2(t,{}),{});else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec2(s,i.x,i.y,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec2(s,i.x,i.y,{})}}else if(this.compositionType.getNumberOfComponents()===3){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec3(s,i,0,0,{})}else if(e.compositionType.getNumberOfComponents()===2){let i=e.getVec2(t,{});this.setVec3(s,i.x,i.y,0,{})}else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec3AsVector(s,i,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec3(s,i.x,i.y,i.z,{})}}else if(this.compositionType.getNumberOfComponents()===4){if(e.compositionType.getNumberOfComponents()===1){let i=e.getScalar(t,{});this.setVec4(s,i,0,0,0,{})}else if(e.compositionType.getNumberOfComponents()===2){let i=e.getVec2(t,{});this.setVec4(s,i.x,i.y,0,0,{})}else if(e.compositionType.getNumberOfComponents()===3){let i=e.getVec3(t,{});this.setVec4(s,i.x,i.y,i.z,0,{})}else if(e.compositionType.getNumberOfComponents()===4){let i=e.getVec4(t,{});this.setVec4AsVector(s,i,{})}}this.Vb=!0,this.Sb()}addElementFromSameCompositionAccessor(s,e,h,t){let i=t!=null?t:s;this.compositionType.getNumberOfComponents()===1?this.setScalar(s,this.getScalar(s,{})+h*e.getScalar(i,{}),{}):this.compositionType.getNumberOfComponents()===2?this.setVec2AsVector(s,M.add(this.getVec2(s,{}),M.multiply(e.getVec2(i,{}),h)),{}):this.compositionType.getNumberOfComponents()===3?this.setVec3AsVector(s,N.add(this.getVec3(s,{}),N.multiply(e.getVec3(i,{}),h)),{}):this.compositionType.getNumberOfComponents()===4&&this.setVec4AsVector(s,T.add(this.getVec4(s,{}),T.multiply(e.getVec4(i,{}),h)),{}),this.Vb=!0,this.Sb()}get arrayBufferOfBufferView(){return this.Fp}get dataViewOfBufferView(){return this.vb}get byteOffsetInBufferView(){return this._b-this.Cb.byteOffsetInRawArrayBufferOfBuffer}get byteOffsetInBuffer(){return this._b-this.Cb.buffer.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this._b}get bufferView(){return this.Cb}setMinMax(s,e){let h=this.compositionType.getNumberOfComponents();h===1?(this.sy._v[0]=s[0],this.ny._v[0]=e[0]):h===2?(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.ny._v[0]=e[0],this.ny._v[1]=e[1]):h===3?(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.sy._v[2]=s[2],this.ny._v[0]=e[0],this.ny._v[1]=e[1],this.ny._v[2]=e[2]):h===4&&(this.sy._v[0]=s[0],this.sy._v[1]=s[1],this.sy._v[2]=s[2],this.sy._v[3]=s[3],this.ny._v[0]=e[0],this.ny._v[1]=e[1],this.ny._v[2]=e[2],this.ny._v[3]=e[3]),this.Vb=!1}get min(){this.Vb&&this.Eb();let s=this.compositionType.getNumberOfComponents();return s===4?[this.sy._v[0],this.sy._v[1],this.sy._v[2],this.sy._v[3]]:s===3?[this.sy._v[0],this.sy._v[1],this.sy._v[2]]:s===2?[this.sy._v[0],this.sy._v[1]]:[this.sy._v[0]]}get max(){this.Vb&&this.Eb();let s=this.compositionType.getNumberOfComponents();return s===4?[this.ny._v[0],this.ny._v[1],this.ny._v[2],this.ny._v[3]]:s===3?[this.ny._v[0],this.ny._v[1],this.ny._v[2]]:s===2?[this.ny._v[0],this.ny._v[1]]:[this.ny._v[0]]}get normalized(){return this.Tb}Eb(){let s=this.compositionType.getNumberOfComponents();if(s===4){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Zl;for(let h=0;h<this.elementCount;h++){this.getVec4To(h,e,{});for(let t=0;t<4;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===3){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.tr;for(let h=0;h<this.elementCount;h++){this.getVec3To(h,e,{});for(let t=0;t<3;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===2){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);let e=a.Ub;for(let h=0;h<this.elementCount;h++){this.getVec2To(h,e,{});for(let t=0;t<2;t++)this.ny._v[t]<e._v[t]&&(this.ny._v[t]=e._v[t]),e._v[t]<this.sy._v[t]&&(this.sy._v[t]=e._v[t])}}else if(s===1){this.ny.setComponents(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),this.sy.setComponents(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let e=0;e<this.elementCount;e++){let h=this.getScalar(e,{});this.ny._v[0]<h&&(this.ny._v[0]=h),h<this.sy._v[0]&&(this.sy._v[0]=h)}}this.Vb=!1}get isMinMaxDirty(){return this.Vb}get version(){return this.Nb}get actualByteStride(){return this.hb===0?this.p_.getNumberOfComponents()*this.c_.getSizeInBytes()*this.Bb:this.hb}isSame(s){return this.byteLength===s.byteLength&&this.byteOffsetInRawArrayBufferOfBuffer===s.byteOffsetInRawArrayBufferOfBuffer&&this.bufferView.buffer.getArrayBuffer()===s.bufferView.buffer.getArrayBuffer()}};a.Zl=O.zero(),a.tr=X.zero(),a.Ub=L.zero();var U=a;export{U as Accessor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Err as h,Ok as m}from"../misc/index.js";import{Accessor as p}from"./Accessor.js";var c=class{constructor({buffer:e,byteOffsetInBuffer:n,defaultByteStride:t,byteLength:r,raw:s}){this.Oy=0;this.Ay=0;this.Ry=0;this.mf=[];this.Cy=e,this.Ly=n,this.
|
|
1
|
+
import{Err as h,Ok as m}from"../misc/index.js";import{Accessor as p}from"./Accessor.js";var c=class{constructor({buffer:e,byteOffsetInBuffer:n,defaultByteStride:t,byteLength:r,raw:s}){this.Oy=0;this.Ay=0;this.Ry=0;this.mf=[];this.Cy=e,this.Ly=n,this._b=e.byteOffsetInRawArrayBuffer+n,this.gy=r,this.Oy=t,this.Fp=s}get defaultByteStride(){return this.Oy}get byteLength(){return this.gy}get byteOffsetInBuffer(){return this._b-this.Cy.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this._b}get buffer(){return this.Cy}get isSoA(){return!this.isAoS}get isAoS(){for(let e of this.mf)if(e.isAoS)return!0;return!1}getUint8Array(){return new Uint8Array(this.Fp,this._b,this.gy)}takeAccessor({compositionType:e,componentType:n,count:t,byteStride:r=this.defaultByteStride,max:s,min:f,arrayLength:i=1,normalized:o=!1}){return this.$y({compositionType:e,componentType:n,count:t,byteStride:r,max:s,min:f,normalized:o,arrayLength:i})}takeAccessorWithByteOffset({compositionType:e,componentType:n,count:t,byteOffsetInBufferView:r,byteStride:s=this.defaultByteStride,max:f,min:i,normalized:o=!1}){return this.Ey({compositionType:e,componentType:n,count:t,byteStride:s,byteOffsetInBufferView:r,max:f,min:i,normalized:o})}$y({compositionType:e,componentType:n,count:t,byteStride:r,max:s,min:f,arrayLength:i,normalized:o}){let u=this.Ay,y=r;if(y===0&&(y=e.getNumberOfComponents()*n.getSizeInBytes()*i),this.Ay+y*(t-1)+n.getSizeInBytes()*e.getNumberOfComponents()>this.byteLength){let B=`The size of the Accessor you are trying to take exceeds the byte length left in the BufferView.
|
|
2
2
|
BufferView.byteLength: ${this.byteLength}, BufferView.takenSizeInByte: ${this.Ay}, Accessor.byteStride: ${r}, Accessor.count: ${t};
|
|
3
3
|
byteSizeToTake: ${y*t}, the byte length left in the Buffer: ${this.byteLength-this.Ay}`;return new h({message:B,error:void 0})}let a=new p({bufferView:this,byteOffsetInBufferView:u,compositionType:e,componentType:n,byteStride:r,count:t,raw:this.Fp,max:s,min:f,arrayLength:i,normalized:o});return this.mf.push(a),this.Ay+=y*t,new m(a)}Ey({compositionType:e,componentType:n,count:t,byteStride:r,byteOffsetInBufferView:s,max:f,min:i,normalized:o}){if(this.Ay+r*(t-1)+n.getSizeInBytes()*e.getNumberOfComponents()>this.byteLength){let y=`The size of the Accessor you are trying to take exceeds the byte length left in the BufferView.
|
|
4
4
|
BufferView.byteLength: ${this.byteLength}, BufferView.takenSizeInByte: ${this.Ay}, Accessor.byteStride: ${r}, Accessor.count: ${t};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal PNG decoder for the RGB9_E5 cubemap faces.
|
|
3
|
+
*
|
|
4
|
+
* The browser PNG decoders do not expose the RGBA bytes directly (a 2D canvas premultiplies alpha and the
|
|
5
|
+
* ImageBitmap path does not hand out the pixel data), and the alpha channel of an RGB9_E5 PNG carries the
|
|
6
|
+
* high byte of the packed word. The files are 8-bit RGBA, non-interlaced PNGs, so a small decoder using the
|
|
7
|
+
* platform DecompressionStream is enough and keeps the packed bytes intact.
|
|
8
|
+
*/
|
|
9
|
+
export declare function decodePngToRgba8(bytes: Uint8Array): Promise<{
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
data: Uint8Array;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Converts the hdrpng.js RGB9_E5 PNG byte layout (R[31:23], G[22:14], B[13:5], E[4:0], stored little-endian)
|
|
16
|
+
* to the native UNSIGNED_INT_5_9_9_9_REV / rgb9e5ufloat layout (E[31:27], B[26:18], G[17:9], R[8:0]).
|
|
17
|
+
*/
|
|
18
|
+
export declare function convertHdrpngRgb9E5ToNative(rgba: Uint8Array, pixelCount: number): Uint32Array;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function S(t){let s=new DataView(t.buffer,t.byteOffset,t.byteLength),h=[137,80,78,71,13,10,26,10];for(let r=0;r<h.length;r++)if(t[r]!==h[r])throw new Error("Not a PNG file");let e=8,n=0,a=0,l=0,p=0,U=0,D=[],P=0;for(;e<t.length;){let r=s.getUint32(e),i=String.fromCharCode(t[e+4],t[e+5],t[e+6],t[e+7]),o=t.subarray(e+8,e+8+r);if(i==="IHDR")n=s.getUint32(e+8),a=s.getUint32(e+12),l=t[e+16],p=t[e+17],U=t[e+20];else if(i==="IDAT")D.push(o),P+=o.length;else if(i==="IEND")break;e+=12+r}if(l!==8||p!==6||U!==0)throw new Error(`Unsupported PNG format (bitDepth ${l}, colorType ${p})`);let T=new Uint8Array(P),E=0;for(let r of D)T.set(r,E),E+=r.length;if(typeof DecompressionStream=="undefined")throw new Error("DecompressionStream is required to decode RGB9_E5 PNG files");let R=new Blob([T]).stream().pipeThrough(new DecompressionStream("deflate")),b=new Uint8Array(await new Response(R).arrayBuffer()),d=4,c=n*d,v=a*(c+1);if(b.length<v)throw new Error("Truncated PNG image data");let u=new Uint8Array(c*a),N=0;for(let r=0;r<a;r++){let i=b[N++];for(let o=0;o<c;o++){let w=b[N++],k=r*c+o,g=o>=d?u[k-d]:0,m=r>0?u[k-c]:0,y=o>=d&&r>0?u[k-c-d]:0,f;switch(i){case 0:f=w;break;case 1:f=w+g;break;case 2:f=w+m;break;case 3:f=w+(g+m>>1);break;case 4:{let A=g+m-y,G=Math.abs(A-g),x=Math.abs(A-m),L=Math.abs(A-y),M=G<=x&&G<=L?g:x<=L?m:y;f=w+M;break}default:throw new Error(`Unsupported PNG filter type ${i}`)}u[k]=f&255}}return{width:n,height:a,data:u}}function B(t,s){let h=new Uint32Array(s);for(let e=0;e<s;e++){let n=t[e*4]|t[e*4+1]<<8|t[e*4+2]<<16|t[e*4+3]<<24,a=n&31,l=n>>>23&511,p=n>>>14&511,U=n>>>5&511;h[e]=(a<<27)+(U<<18)+(p<<9)+l}return h}export{B as convertHdrpngRgb9E5ToNative,S as decodePngToRgba8};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SymbolWeakMap as t}from"./SymbolWeakMap.js";var e=class{constructor(){this.
|
|
1
|
+
import{SymbolWeakMap as t}from"./SymbolWeakMap.js";var e=class{constructor(){this.kb=new t}register(r){this.kb.set(Symbol(),r)}};export{e as Cache};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_getGizmoClass as u}from"../../gizmos/GizmoRegistry.js";import{MutableMatrix44 as c}from"../../math/MutableMatrix44.js";import{MutableVector3 as n}from"../../math/MutableVector3.js";import{Vector3 as o}from"../../math/Vector3.js";import{Is as d}from"../../misc/Is.js";var e=class e{constructor(i,s,h,r,t){this.sv=o.zero();this.by=0;this.ez=o.zero();this.ps=c.dummy();this.sz=n.zero();this.iz=n.zero();this.rz=0;this.i=i,this.sv=s,this.by=h,this.ez=r,this.oz=t}updateWorldState(){this.ps=this.oz.matrixInner,this.ps.multiplyVector3To(this.sv,this.sz),this.ps.multiplyVector3To(this.ez,this.iz),o.subtractTo(this.iz,this.sz,this.iz),this.rz=this.iz.lengthSquared(),d.exist(this.tz)&&this.tz.isVisible&&this.tz._update()}collision(i,s){let h=this.sz,r=this.iz,t=o.subtractTo(i,h,e.
|
|
1
|
+
import{_getGizmoClass as u}from"../../gizmos/GizmoRegistry.js";import{MutableMatrix44 as c}from"../../math/MutableMatrix44.js";import{MutableVector3 as n}from"../../math/MutableVector3.js";import{Vector3 as o}from"../../math/Vector3.js";import{Is as d}from"../../misc/Is.js";var e=class e{constructor(i,s,h,r,t){this.sv=o.zero();this.by=0;this.ez=o.zero();this.ps=c.dummy();this.sz=n.zero();this.iz=n.zero();this.rz=0;this.i=i,this.sv=s,this.by=h,this.ez=r,this.oz=t}updateWorldState(){this.ps=this.oz.matrixInner,this.ps.multiplyVector3To(this.sv,this.sz),this.ps.multiplyVector3To(this.ez,this.iz),o.subtractTo(this.iz,this.sz,this.iz),this.rz=this.iz.lengthSquared(),d.exist(this.tz)&&this.tz.isVisible&&this.tz._update()}collision(i,s){let h=this.sz,r=this.iz,t=o.subtractTo(i,h,e.Yr),a=r.dot(t);a<=0||(this.rz<=a?t=o.subtractTo(t,r,e.Yr):(o.multiplyTo(r,a/this.rz,e.Zr),t=o.subtractTo(t,e.Zr,e.Yr)));let l=this.by+s,m=t.length()-l;return t=o.normalizeTo(t,t),{direction:t,distance:m}}get position(){return this.sv}get tail(){return this.ez}get radius(){return this.by}get baseSceneGraph(){return this.oz}get gizmo(){return this.tz}set gizmo(i){this.tz=i}setGizmoVisible(i){this.tz==null&&(this.tz=new(u("capsuleCollider"))(this.i,this),this.tz._setup()),this.tz.isVisible=i}get isGizmoVisible(){var i,s;return(s=(i=this.tz)==null?void 0:i.isVisible)!=null?s:!1}destroyGizmo(){this.tz!=null&&(this.tz._destroy(),this.tz=void 0)}};e.Yr=n.zero(),e.Zr=n.zero();var p=e;export{p as CapsuleCollider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_getGizmoClass as m}from"../../gizmos/GizmoRegistry.js";import{MutableVector3 as s}from"../../math/MutableVector3.js";import{Vector3 as n}from"../../math/Vector3.js";import{Is as a}from"../../misc/Is.js";var r=class r{constructor(e,t,i,o){this.sv=n.zero();this.by=0;this.eG=s.zero();this.i=e,this.sv=t,this.by=i,this.oz=o}updateWorldState(){this.oz.matrixInner.multiplyVector3To(this.sv,this.eG),a.exist(this.tz)&&this.tz.isVisible&&this.tz._update()}collision(e,t){let i=n.subtractTo(e,this.eG,r.
|
|
1
|
+
import{_getGizmoClass as m}from"../../gizmos/GizmoRegistry.js";import{MutableVector3 as s}from"../../math/MutableVector3.js";import{Vector3 as n}from"../../math/Vector3.js";import{Is as a}from"../../misc/Is.js";var r=class r{constructor(e,t,i,o){this.sv=n.zero();this.by=0;this.eG=s.zero();this.i=e,this.sv=t,this.by=i,this.oz=o}updateWorldState(){this.oz.matrixInner.multiplyVector3To(this.sv,this.eG),a.exist(this.tz)&&this.tz.isVisible&&this.tz._update()}collision(e,t){let i=n.subtractTo(e,this.eG,r.Zr),o=i.length(),p=this.by+t;return{distance:o-p,delta:i,length:o}}get position(){return this.sv}get worldPosition(){return this.eG}get radius(){return this.by}get baseSceneGraph(){return this.oz}get gizmo(){return this.tz}set gizmo(e){this.tz=e}setGizmoVisible(e){this.tz==null&&(this.tz=new(m("sphereCollider"))(this.i,this),this.tz._setup()),this.tz.isVisible=e}get isGizmoVisible(){var e,t;return(t=(e=this.tz)==null?void 0:e.isVisible)!=null?t:!1}destroyGizmo(){this.tz!=null&&(this.tz._destroy(),this.tz=void 0)}};r.Zr=s.zero();var h=r;export{h as SphereCollider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RnObject as p}from"../../core/RnObject.js";import{Matrix44 as l,MutableVector3 as r}from"../../math/index.js";import{Vector3 as i}from"../../math/Vector3.js";var o=class o extends p{constructor(t){super();this.stiffnessForce=1;this.gravityPower=0;this.gravityDir=i.fromCopyArray([0,-1,0]);this.dragForce=.4;this.hitRadius=.02;this.currentTail=r.zero();this.prevTail=r.zero();this.boneAxis=i.zero();this.boneLength=0;this.initialLocalChildPosition=i.zero();this.initialized=!1;this.node=t}setup(t){if(!this.initialized){this.node.getTransform()._backupTransformAsRest();let e=this.node.getSceneGraph().children;if(e.length>0)this.initialLocalChildPosition=e[0].entity.getTransform().localPosition,this.initialLocalChildPosition.length()===0&&(this.initialLocalChildPosition=i.fromCopyArray([0,-.07,0]));else{let h=this.node.getTransform().localPosition.length()>0?this.node.getTransform().localPosition:i.fromCopyArray([0,-1,0]);this.initialLocalChildPosition=i.multiply(i.normalize(h),.07)}let n=this.node.matrixInner.multiplyVector3(this.initialLocalChildPosition),a=t!=null?t.getLocalPositionOf(n):n;this.currentTail.copyComponents(a),this.prevTail.copyComponents(this.currentTail);let c=this.initialLocalChildPosition.length()>0?this.initialLocalChildPosition:i.fromCopyArray([0,-.07,0]);this.boneAxis=i.normalize(c),this.initialized=!0}}_getMatrixCenterToWorld(t){return t!=null?t.matrixInner:l.identity()}_getMatrixWorldToCenter(t){return t!=null?l.invert(t.matrixInner):l.identity()}_calcWorldSpaceBoneLength(){let t=this.node.getSceneGraph().matrixInner,e=t.getTranslateTo(o.
|
|
1
|
+
import{RnObject as p}from"../../core/RnObject.js";import{Matrix44 as l,MutableVector3 as r}from"../../math/index.js";import{Vector3 as i}from"../../math/Vector3.js";var o=class o extends p{constructor(t){super();this.stiffnessForce=1;this.gravityPower=0;this.gravityDir=i.fromCopyArray([0,-1,0]);this.dragForce=.4;this.hitRadius=.02;this.currentTail=r.zero();this.prevTail=r.zero();this.boneAxis=i.zero();this.boneLength=0;this.initialLocalChildPosition=i.zero();this.initialized=!1;this.node=t}setup(t){if(!this.initialized){this.node.getTransform()._backupTransformAsRest();let e=this.node.getSceneGraph().children;if(e.length>0)this.initialLocalChildPosition=e[0].entity.getTransform().localPosition,this.initialLocalChildPosition.length()===0&&(this.initialLocalChildPosition=i.fromCopyArray([0,-.07,0]));else{let h=this.node.getTransform().localPosition.length()>0?this.node.getTransform().localPosition:i.fromCopyArray([0,-1,0]);this.initialLocalChildPosition=i.multiply(i.normalize(h),.07)}let n=this.node.matrixInner.multiplyVector3(this.initialLocalChildPosition),a=t!=null?t.getLocalPositionOf(n):n;this.currentTail.copyComponents(a),this.prevTail.copyComponents(this.currentTail);let c=this.initialLocalChildPosition.length()>0?this.initialLocalChildPosition:i.fromCopyArray([0,-.07,0]);this.boneAxis=i.normalize(c),this.initialized=!0}}_getMatrixCenterToWorld(t){return t!=null?t.matrixInner:l.identity()}_getMatrixWorldToCenter(t){return t!=null?l.invert(t.matrixInner):l.identity()}_calcWorldSpaceBoneLength(){let t=this.node.getSceneGraph().matrixInner,e=t.getTranslateTo(o.Yr),n=o.T0,a=this.node.getSceneGraph().children;a.length>0?n=a[0].matrixInner.getTranslateTo(o.Zr):n=i.multiplyMatrix4To(this.initialLocalChildPosition,t,o.ev),this.boneLength=i.subtractTo(e,n,o.ov).length()}};o.Yr=r.zero(),o.Zr=r.zero(),o.T0=i.zero(),o.ev=r.zero(),o.ov=r.zero();var s=o;export{s as VRMSpringBone};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RnObject as m}from"../core/RnObject.js";import{Is as t}from"../misc/Is.js";var i=class i extends m{constructor(){super(...arguments);this.
|
|
1
|
+
import{RnObject as m}from"../core/RnObject.js";import{Is as t}from"../misc/Is.js";var i=class i extends m{constructor(){super(...arguments);this.hp=[];this.Jx=[];this.Qx=[]}addExpression(n,{inputRenderPasses:e,outputs:o}={inputRenderPasses:[],outputs:[]}){if(t.exist(o))for(let r of o){let s=r.renderPass.instance;t.exist(r.renderPass.instance)?s=r.renderPass.instance:t.exist(r.renderPass.index)?s=n.renderPasses[r.renderPass.index]:t.exist(r.renderPass.uniqueName)&&(s=m.getRnObjectByName(r.renderPass.uniqueName)),t.exist(s)&&s.setFramebuffer(r.frameBuffer)}this.hp.push({expression:n,inputRenderPasses:t.exist(e)?e:[]}),this.Jx.push(n)}getColorAttachmentFromInputOf(n,e={renderPass:{index:0},colorAttachmentIndex:0,framebufferType:i.FrameBuffer}){return new Promise(r=>{function*s(){let a=yield;return r(a),a}let u=s();this.Qx.push([n,e.renderPass,e.colorAttachmentIndex,u,e.framebufferType])})}resolve(){for(let[n,e,o,r,s]of this.Qx)for(let u of this.hp)if(n===u.expression){let a=e.instance;t.exist(e.instance)?a=e.instance:t.exist(e.index)?a=u.inputRenderPasses[e.index]:t.exist(e.uniqueName)&&(a=m.getRnObjectByName(e.uniqueName));let f;if(s==="ResolveFrameBuffer2"?f=a.getResolveFramebuffer2():s==="ResolveFrameBuffer"?f=a.getResolveFramebuffer():s==="FrameBuffer"&&(f=a.getFramebuffer()),t.exist(f)){let d=f.getColorAttachedRenderTargetTexture(o);t.exist(d)&&(r.next(d),r.next(d))}}}clearExpressions(){this.hp.length=0,this.Jx.length=0}get expressions(){return this.Jx}setViewport(n){for(let e of this.hp)e.expression.setViewport(n)}};i.FrameBuffer="FrameBuffer",i.ResolveFrameBuffer="ResolveFrameBuffer",i.ResolveFrameBuffer2="ResolveFrameBuffer2";var p=i;export{p as Frame};
|
|
@@ -241,6 +241,13 @@ export declare class RenderPass extends RnObject {
|
|
|
241
241
|
/**
|
|
242
242
|
* Removes all entities from this render pass and clears related collections.
|
|
243
243
|
* This effectively empties the render pass of all renderable content.
|
|
244
|
+
*
|
|
245
|
+
* @remarks
|
|
246
|
+
* `__sceneGraphDirectlyAdded` must be cleared together with the other collections:
|
|
247
|
+
* `addEntities` appends to it on every call, and `processAuto`-style callers call
|
|
248
|
+
* `clearEntities` + `addEntities` once per frame. Leaving it untouched makes it grow
|
|
249
|
+
* by the entity count every frame (keeping every scene graph it ever saw alive) and
|
|
250
|
+
* makes `sceneTopLevelGraphComponents` retain the roots of previously cleared entities.
|
|
244
251
|
*/
|
|
245
252
|
clearEntities(): void;
|
|
246
253
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{flattenHierarchy as c}from"../components/SceneGraph/SceneGraphOps.js";import{WellKnownComponentTIDs as d}from"../components/WellKnownComponentTIDs.js";import{RnObject as f}from"../core/RnObject.js";import{PrimitiveMode as
|
|
1
|
+
import{flattenHierarchy as c}from"../components/SceneGraph/SceneGraphOps.js";import{WellKnownComponentTIDs as d}from"../components/WellKnownComponentTIDs.js";import{RnObject as f}from"../core/RnObject.js";import{PrimitiveMode as l}from"../definitions/PrimitiveMode.js";import{Primitive as R}from"../geometry/Primitive.js";import{MutableVector4 as h}from"../math/MutableVector4.js";import{Vector4 as p}from"../math/Vector4.js";var s=class s extends f{constructor(e){super();this.Gp=[];this.yR=[];this.bR=[];this._R=[];this.vR=[];this.FR=new Map;this.toClearColorBuffer=!1;this.toClearDepthBuffer=!0;this.toClearStencilBuffer=!1;this.isDepthTest=!0;this.depthWriteMask=!0;this.clearColor=p.fromCopyArray([1,1,1,1]);this.clearDepth=1;this.clearStencil=0;this._drawVertexNumberForBufferLessRendering=0;this._primitiveModeForBufferLessRendering=l.Triangles;this.isVrRendering=!0;this.isOutputForVr=!1;this._lastOpaqueIndex=-1;this._lastTranslucentIndex=-1;this._lastBlendWithZWriteIndex=-1;this._lastBlendWithoutZWriteIndex=-1;this._lastPrimitiveUids=[];this._lastPrimitives=null;this._lastTransformComponentsUpdateCount=-1;this._lastCameraControllerComponentsUpdateCount=-1;this._lastSceneGraphComponentsUpdateCount=-1;this._lastMultiDrawGroupVersion=-1;this._renderedSomethingBefore=!0;this._isChangedSortRenderResult=!1;this._toRenderOpaquePrimitives=!0;this._toRenderTranslucentPrimitives=!0;this._toRenderBlendWithZWritePrimitives=!0;this._toRenderBlendWithoutZWritePrimitives=!0;this.toRenderEffekseerEffects=!1;this.i=e,this._dummyPrimitiveForBufferLessRendering=new R(e),this.IR=++s.qu}setToRenderOpaquePrimitives(e){this._toRenderOpaquePrimitives=e,this.WR()}setToRenderBlendWithoutZWritePrimitives(e){this._toRenderBlendWithoutZWritePrimitives=e,this.WR()}setToRenderBlendWithZWritePrimitives(e){this._toRenderBlendWithZWritePrimitives=e,this.WR()}setToRenderTranslucentPrimitives(e){this._toRenderTranslucentPrimitives=e,this.WR()}isBufferLessRenderingMode(){return this._drawVertexNumberForBufferLessRendering>0}setBufferLessRendering(e,t,i){this._primitiveModeForBufferLessRendering=e,this._drawVertexNumberForBufferLessRendering=t,this.kp=i,this._renderedSomethingBefore=!0}setBufferLessFullScreenRendering(e){this._primitiveModeForBufferLessRendering=l.Triangles,this._drawVertexNumberForBufferLessRendering=3,this.kp=e,this._renderedSomethingBefore=!0}clone(){var t,i;let e=new s(this.i);return e.tryToSetUniqueName(`${this.uniqueName}_cloned`,!0),e.Gp=this.Gp.concat(),e.yR=this.yR.concat(),e.bR=this.bR.concat(),e._R=this._R.concat(),e.vR=this.vR.concat(),e.mR=this.mR,e.BR=this.BR,e.CR=this.CR,e.gR=(t=this.gR)==null?void 0:t.clone(),e.toClearColorBuffer=this.toClearColorBuffer,e.toClearDepthBuffer=this.toClearDepthBuffer,e.toClearStencilBuffer=this.toClearStencilBuffer,e.isDepthTest=this.isDepthTest,e.clearColor=this.clearColor.clone(),e.clearDepth=this.clearDepth,e.clearStencil=this.clearStencil,e.cameraComponent=this.cameraComponent,e.kp=this.kp,e.FR=new Map(this.FR),e.isVrRendering=this.isVrRendering,e.isOutputForVr=this.isOutputForVr,e._toRenderOpaquePrimitives=this._toRenderOpaquePrimitives,e._toRenderTranslucentPrimitives=this._toRenderTranslucentPrimitives,e._toRenderBlendWithoutZWritePrimitives=this._toRenderBlendWithoutZWritePrimitives,e.MR=this.MR,e.ER=this.ER,e.PR=(i=this.PR)==null?void 0:i.concat(),e._lastOpaqueIndex=this._lastOpaqueIndex,e._lastTranslucentIndex=this._lastTranslucentIndex,e._lastBlendWithZWriteIndex=this._lastBlendWithZWriteIndex,e._lastBlendWithoutZWriteIndex=this._lastBlendWithoutZWriteIndex,e._lastPrimitiveUids=this._lastPrimitiveUids.concat(),e._lastTransformComponentsUpdateCount=this._lastTransformComponentsUpdateCount,e._lastCameraControllerComponentsUpdateCount=this._lastCameraControllerComponentsUpdateCount,e._lastSceneGraphComponentsUpdateCount=this._lastSceneGraphComponentsUpdateCount,e._renderedSomethingBefore=this._renderedSomethingBefore,e._isChangedSortRenderResult=this._isChangedSortRenderResult,e}setPreRenderFunction(e){this.MR=e}setPostRenderFunction(e){this.ER=e}doPreRender(){this.MR!=null&&this.MR()}doPostRender(){this.ER!=null&&this.ER()}addEntities(e){for(let t of e){if(t===void 0)continue;let i=t.getSceneGraph();this.yR.push(i);let n=c(i,!1).map(a=>a.entity).filter(a=>a!=null),r=this.Gp.concat(n).reduce((a,u)=>(a.set(u.entityUID,u),a),new Map);this.Gp=Array.from(r.values())}this.WR(),this.bR=[],this.xR()}WR(){this._R=[],this.vR=[],this.UR()}get entities(){return this.Gp}clearEntities(){this._R=[],this.vR=[],this.bR=[],this.yR=[],this.Gp=[]}xR(){let e=i=>(i.parent&&e(i.parent),i);this.bR=this.yR.map(i=>e(i));let t=new Set(this.bR);this.bR=Array.from(t)}UR(){this._R=[],this.vR=[];for(let e of this.Gp){let t=e.getComponentByComponentTID(d.MeshComponentTID);if(t!=null&&t.mesh!=null){if(this._R.push(t),!this._toRenderOpaquePrimitives&&t.mesh.isExistOpaque()||!this._toRenderTranslucentPrimitives&&t.mesh.isExistTranslucent()||!this._toRenderBlendWithZWritePrimitives&&t.mesh.isExistBlendWithZWrite()||!this._toRenderBlendWithoutZWritePrimitives&&t.mesh.isExistBlendWithoutZWrite())continue;this.vR.push(t)}}}get meshComponents(){return this._R}get _optimizedMeshComponents(){return this.vR}get sceneTopLevelGraphComponents(){return this.bR}setFramebuffer(e){this.mR=e,e!=null?this.setViewport(p.fromCopyArray([0,0,e.width,e.height])):this.gR=void 0}setRenderTargetColorAttachments(e){this.PR=e}getRenderTargetColorAttachments(){return this.PR}getFramebuffer(){return this.mR}removeFramebuffer(){this.mR=void 0}setViewport(e){this.gR!=null?this.gR.copyComponents(e):this.gR=h.fromCopyArray([e.x,e.y,e.z,e.w])}getViewport(){let e=this.gR;return e!=null&&(e=s.GR.copyComponents(e)),e}setScissorRect(e){if(e==null){this.SR=void 0;return}this.SR={x:Math.floor(e.x),y:Math.floor(e.y),width:Math.max(0,Math.floor(e.width)),height:Math.max(0,Math.floor(e.height))}}getScissorRect(){return this.SR}setResolveFramebuffer(e){this.BR=e}getResolveFramebuffer(){return this.BR}setResolveFramebuffer2(e){this.CR=e}getResolveFramebuffer2(){return this.CR}_copyFramebufferToResolveFramebuffersWebGL(){this.TR(this.BR),this.TR(this.CR)}TR(e){if(e==null)return;let t=this.i.webglResourceRepository,i=t.getWebGLResource(this.mR.cgApiResourceUid),o=t.getWebGLResource(e.cgApiResourceUid);if(i==null||o==null)return;let r=t.currentWebGLContextWrapper.getRawContextAsWebGL2();r.bindFramebuffer(r.READ_FRAMEBUFFER,i),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,o),r.blitFramebuffer(0,0,this.mR.width,this.mR.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}_copyResolve1ToResolve2WebGpu(){var i,o;let e=(i=this.BR)!=null?i:this.mR;if(e==null||this.CR==null)return;let t=this.i.webGpuResourceRepository;for(let n=0;n<e.colorAttachments.length;n++)e.colorAttachments[n]==null||this.CR.colorAttachments[n]==null||!(e.colorAttachments[n]._textureResourceUid>=0)||((o=e.colorAttachments[n].sampleCount)!=null?o:1)>1||this.CR.colorAttachments[n]._textureResourceUid===-1||t.copyTextureData(e.colorAttachments[n]._textureResourceUid,this.CR.colorAttachments[n]._textureResourceUid)}setMaterialForPrimitive(e,t){this.FR.set(t.objectUID,new WeakRef(e))}setMaterial(e){this.kp=e}get material(){return this.kp}_getMaterialOf(e){var t;return(t=this.FR.get(e.objectUID))==null?void 0:t.deref()}getAppropriateMaterial(e){let t=this.FR.size!==0?this._getMaterialOf(e):void 0;return t!=null||(this.kp!=null?t=this.kp:t=e.material),t}get renderPassUID(){return this.IR}};s.GR=h.zero(),s.qu=-1;var m=s;export{m as RenderPass};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ISceneGraphEntity } from '../../helpers/EntityHelper';
|
|
2
|
+
/**
|
|
3
|
+
* Keeps the previous frame data of a set of entities (in the GPU instance data) up to date for the motion vectors
|
|
4
|
+
* of temporal anti-aliasing: `previousWorldMatrix` of their scene graph and the previous bone data of their
|
|
5
|
+
* skeleton.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* `update` runs once per frame before the logic stage, when the world matrices and the bone data in the GPU instance
|
|
9
|
+
* data are still those of the previous frame. An entity whose world matrix version changed is written in this frame
|
|
10
|
+
* and once more in the next frame: a change made between two frames (after rendering) is only computed in the next
|
|
11
|
+
* frame, so its previous world matrix is only known one frame later. Entities that do not move are not written.
|
|
12
|
+
* The previous bone data is copied whenever it differs from the bone data, which gives the same result.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare class PreviousFrameDataTracker {
|
|
17
|
+
private __entities;
|
|
18
|
+
private __states;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the entities to track. The state of the entities that are no longer tracked is dropped.
|
|
21
|
+
*
|
|
22
|
+
* @param entities - The entities rendered with motion vectors
|
|
23
|
+
*/
|
|
24
|
+
setEntities(entities: readonly ISceneGraphEntity[]): void;
|
|
25
|
+
/**
|
|
26
|
+
* Writes the previous world matrices and bone data of the tracked entities that moved.
|
|
27
|
+
*
|
|
28
|
+
* @returns Whether a previous world matrix was written (the GPU instance data has to be uploaded)
|
|
29
|
+
*/
|
|
30
|
+
update(): boolean;
|
|
31
|
+
/** Drops all tracked entities. */
|
|
32
|
+
clear(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=class{constructor(){this.Gp=[];this._S=new Map}setEntities(n){this.Gp=n;let o=new Set;for(let e of n)o.add(e.getSceneGraph());for(let e of this._S.keys())o.has(e)||this._S.delete(e)}update(){let n=!1;for(let o of this.Gp){let e=o.tryToGetSkeletal();e!=null&&(e._enablePreviousBoneData(),e._updatePreviousBoneData()&&(n=!0));let t=o.getSceneGraph(),r=this._S.get(t);if(r==null){t._previousWorldMatrixInner.copyComponents(t.matrixInner),this._S.set(t,{version:t.worldMatrixVersion,isSettling:!0}),n=!0;continue}let i=t.worldMatrixVersion;(r.version!==i||r.isSettling)&&(t._previousWorldMatrixInner.copyComponents(t._lastComputedWorldMatrixInner),r.isSettling=r.version!==i,r.version=i,n=!0)}return n}clear(){this.Gp=[],this._S.clear()}};export{s as PreviousFrameDataTracker};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { CameraComponent } from '../../components/Camera/CameraComponent';
|
|
2
|
+
import type { ISceneGraphEntity } from '../../helpers/EntityHelper';
|
|
3
|
+
import { Vector2 } from '../../math/Vector2';
|
|
4
|
+
import type { Engine } from '../../system/Engine';
|
|
5
|
+
import type { RenderTargetTexture } from '../../textures/RenderTargetTexture';
|
|
6
|
+
import { Expression } from '../Expression';
|
|
7
|
+
import { RenderPass } from '../RenderPass';
|
|
8
|
+
/**
|
|
9
|
+
* Returns the element of the Halton low-discrepancy sequence with the given index and base.
|
|
10
|
+
*
|
|
11
|
+
* @param index - The index (1 or greater; index 0 returns 0)
|
|
12
|
+
* @param base - The base (2 and 3 for the usual 2D sequence)
|
|
13
|
+
* @returns A value in [0, 1)
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function halton(index: number, base: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the jitter of the given frame in NDC units: a Halton(2, 3) sub-pixel offset in [-0.5, 0.5) pixels.
|
|
19
|
+
*
|
|
20
|
+
* @param frameIndex - The frame counter
|
|
21
|
+
* @param width - The width of the render target in pixels
|
|
22
|
+
* @param height - The height of the render target in pixels
|
|
23
|
+
* @returns The NDC offset (one pixel is 2 / width horizontally)
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function getTemporalAAJitter(frameIndex: number, width: number, height: number): Vector2;
|
|
27
|
+
/**
|
|
28
|
+
* Temporal anti-aliasing for the ForwardRenderPipeline.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Every frame:
|
|
32
|
+
* 1. `prepareFrame` (before `Engine.process`) moves the projection of the camera by a sub-pixel jitter, and keeps
|
|
33
|
+
* the world matrices, the bone data of the skeletons and the view projection matrix of the previous frame for
|
|
34
|
+
* the motion vectors (the strategies keep the blend shape weights of the previous frame).
|
|
35
|
+
* 2. The motion vector pass renders the opaque primitives with the motion vector material into an RGBA16F target
|
|
36
|
+
* (xy: the motion in texture coordinates, z: the depth).
|
|
37
|
+
* 3. The resolve pass blends the current frame, reconstructed from its 3x3 neighborhood with a filter centered on
|
|
38
|
+
* each pixel, with the history reprojected by the motion vectors (Catmull-Rom history sampling, variance
|
|
39
|
+
* clipping in YCoCg, inverse luminance weighting, a smaller weight of the current frame for pixels that do not
|
|
40
|
+
* move), writes the result into the output target and copies it into the history target.
|
|
41
|
+
*
|
|
42
|
+
* The motion vectors include the motion of skinned and morphed vertices: the motion vector material deforms each
|
|
43
|
+
* vertex a second time with the bone data and the blend shape weights of the previous frame.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare class TemporalAASystem {
|
|
48
|
+
private __engine;
|
|
49
|
+
private __width;
|
|
50
|
+
private __height;
|
|
51
|
+
private __motionVectorFramebuffer;
|
|
52
|
+
private __outputFramebuffer;
|
|
53
|
+
private __historyFramebuffer;
|
|
54
|
+
private __motionVectorMaterial;
|
|
55
|
+
private __resolveMaterial;
|
|
56
|
+
private __linearSampler;
|
|
57
|
+
private __nearestSampler;
|
|
58
|
+
private __motionVectorRenderPass;
|
|
59
|
+
private __resolveRenderPass;
|
|
60
|
+
private __expression;
|
|
61
|
+
private __previousFrameDataTracker;
|
|
62
|
+
private __frameIndex;
|
|
63
|
+
private __isHistoryValid;
|
|
64
|
+
private __historyFrameCount;
|
|
65
|
+
private __lastCamera?;
|
|
66
|
+
private __previousViewProjectionMatrix;
|
|
67
|
+
/**
|
|
68
|
+
* Creates the render targets, the materials and the passes of temporal anti-aliasing.
|
|
69
|
+
*
|
|
70
|
+
* @param engine - The engine instance
|
|
71
|
+
* @param width - The width of the render targets in pixels
|
|
72
|
+
* @param height - The height of the render targets in pixels
|
|
73
|
+
* @param currentColorTexture - The texture of the current (jittered) frame to anti-alias
|
|
74
|
+
*/
|
|
75
|
+
constructor(engine: Engine, width: number, height: number, currentColorTexture: RenderTargetTexture);
|
|
76
|
+
/**
|
|
77
|
+
* The expression that renders the motion vectors and resolves the anti-aliasing.
|
|
78
|
+
* It has to run after the scene (opaque and transparent) is rendered into the current color texture.
|
|
79
|
+
*/
|
|
80
|
+
get expression(): Expression;
|
|
81
|
+
/** The anti-aliased result (RGBA16F). */
|
|
82
|
+
get outputTexture(): RenderTargetTexture;
|
|
83
|
+
/** The motion vector texture (xy: the motion in texture coordinates, z: the depth). */
|
|
84
|
+
get motionVectorTexture(): RenderTargetTexture;
|
|
85
|
+
/**
|
|
86
|
+
* The weight of the current frame in the exponential blend for pixels that move by a pixel per frame or more
|
|
87
|
+
* (0-1, default 0.1).
|
|
88
|
+
*/
|
|
89
|
+
set currentFrameWeight(weight: number);
|
|
90
|
+
get currentFrameWeight(): number;
|
|
91
|
+
/**
|
|
92
|
+
* The weight of the current frame in the exponential blend for pixels that do not move (0-1, default 0.04).
|
|
93
|
+
* Slower pixels interpolate between this weight and `currentFrameWeight`; a value above `currentFrameWeight`
|
|
94
|
+
* is clamped to it.
|
|
95
|
+
*/
|
|
96
|
+
set staticFrameWeight(weight: number);
|
|
97
|
+
get staticFrameWeight(): number;
|
|
98
|
+
/**
|
|
99
|
+
* The size of the variance clipping box of the history in standard deviations (default 1). A large value
|
|
100
|
+
* effectively disables the clipping, which makes wrong motion vectors visible as trails (for debugging).
|
|
101
|
+
*/
|
|
102
|
+
set varianceClipGamma(gamma: number);
|
|
103
|
+
/** The number of frames prepared since the creation or the last reset of the history. */
|
|
104
|
+
get frameIndex(): number;
|
|
105
|
+
/**
|
|
106
|
+
* Sets the entities whose opaque primitives are rendered into the motion vector target.
|
|
107
|
+
*
|
|
108
|
+
* @param entities - The entities rendered by the main expressions of the pipeline
|
|
109
|
+
*/
|
|
110
|
+
setEntities(entities: ISceneGraphEntity[]): void;
|
|
111
|
+
/**
|
|
112
|
+
* Discards the history: the next frame outputs the current frame without blending.
|
|
113
|
+
* Call it when the view changes discontinuously (e.g. a camera cut).
|
|
114
|
+
*/
|
|
115
|
+
resetHistory(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Prepares the next frame. Call it once per frame before `Engine.process`.
|
|
118
|
+
*
|
|
119
|
+
* @param camera - The camera of the main render passes
|
|
120
|
+
*/
|
|
121
|
+
prepareFrame(camera: CameraComponent | undefined): void;
|
|
122
|
+
/** The number of frames accumulated in the history, as passed to the resolve material in the last frame. */
|
|
123
|
+
get historyFrameCount(): number;
|
|
124
|
+
/**
|
|
125
|
+
* Releases the GPU resources and removes the jitter from the camera.
|
|
126
|
+
*/
|
|
127
|
+
destroy3DAPIResources(): void;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns the camera used by the given render passes: the camera of the first pass that has one, or the current
|
|
131
|
+
* camera of the engine.
|
|
132
|
+
*
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
export declare function _getTemporalAACamera(engine: Engine, renderPasses: readonly RenderPass[]): CameraComponent | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CameraComponent as h}from"../../components/Camera/CameraComponent.js";import{TextureFormat as n}from"../../definitions/TextureFormat.js";import{TextureParameter as s}from"../../definitions/TextureParameter.js";import{createMotionVectorMaterial as d}from"../../helpers/materials/createMotionVectorMaterial.js";import{createTemporalAAResolveMaterial as x}from"../../helpers/materials/createTemporalAAResolveMaterial.js";import{RenderableHelper as p}from"../../helpers/RenderableHelper.js";import{RenderPassHelper as C}from"../../helpers/RenderPassHelper.js";import{MutableMatrix44 as f}from"../../math/MutableMatrix44.js";import{Vector2 as u}from"../../math/Vector2.js";import{Vector4 as v}from"../../math/Vector4.js";import{Sampler as l}from"../../textures/Sampler.js";import{Expression as F}from"../Expression.js";import{RenderPass as R}from"../RenderPass.js";import{PreviousFrameDataTracker as P}from"./PreviousFrameDataTracker.js";var y=8,g=1024;function c(o,e){let t=0,i=1/e,a=o;for(;a>0;)t+=i*(a%e),a=Math.floor(a/e),i/=e;return t}function A(o,e,t){let i=o%y+1,a=c(i,2)-.5,r=c(i,3)-.5;return u.fromCopy2(a*2/e,r*2/t)}var T=class{constructor(e,t,i,a){this.sm=0;this.TT=0;this.lT=new P;this.cT=0;this.oT=!1;this.pT=0;this.dT=f.identity();this.i=e,e._enablePreviousMorphWeights(),this.sm=t,this.TT=i,this.iT=p.createFrameBuffer(e,{width:t,height:i,textureNum:1,textureFormats:[n.RGBA16F],mipLevelCount:1,createDepthBuffer:!0,depthTextureFormat:n.Depth32F}),this.iT.tryToSetUniqueName("TemporalAAMotionVector",!0),this.aT=p.createFrameBuffer(e,{width:t,height:i,textureNum:1,textureFormats:[n.RGBA16F],mipLevelCount:1,createDepthBuffer:!1}),this.aT.tryToSetUniqueName("TemporalAAOutput",!0),this.sT=p.createFrameBuffer(e,{width:t,height:i,textureNum:1,textureFormats:[n.RGBA16F],mipLevelCount:1,createDepthBuffer:!1}),this.sT.tryToSetUniqueName("TemporalAAHistory",!0),this.hT=new l(e,{magFilter:s.Linear,minFilter:s.Linear,wrapS:s.ClampToEdge,wrapT:s.ClampToEdge}),this.hT.create(),this.nT=new l(e,{magFilter:s.Nearest,minFilter:s.Nearest,wrapS:s.ClampToEdge,wrapT:s.ClampToEdge}),this.nT.create(),this.mT=d(e);let r=new R(e);r.tryToSetUniqueName("TemporalAAMotionVector",!0),r.clearColor=v.fromCopy4(0,0,1,0),r.toClearColorBuffer=!0,r.toClearDepthBuffer=!0,r.isVrRendering=!1,r.isOutputForVr=!1,r.setToRenderOpaquePrimitives(!0),r.setToRenderBlendWithZWritePrimitives(!0),r.setToRenderBlendWithoutZWritePrimitives(!1),r.setToRenderTranslucentPrimitives(!1),r.setFramebuffer(this.iT),r.setMaterial(this.mT),this.fT=r,this.tT=x(e),this.tT.setParameter("framebufferSize",u.fromCopy2(t,i)),this.tT.setTextureParameter("historyTexture",this.sT.getColorAttachedRenderTargetTexture(0),this.hT),this.tT.setTextureParameter("velocityTexture",this.iT.getColorAttachedRenderTargetTexture(0),this.nT);let m=C.createScreenDrawRenderPassWithBaseColorTexture(e,this.tT,a,this.nT);m.tryToSetUniqueName("TemporalAAResolve",!0),m.isVrRendering=!1,m.isOutputForVr=!1,m.setFramebuffer(this.aT),m.setResolveFramebuffer2(this.sT),this.xT=m,this.uT=new F,this.uT.tryToSetUniqueName("TemporalAA",!0),this.uT.addRenderPasses([r,m])}get expression(){return this.uT}get outputTexture(){return this.aT.getColorAttachedRenderTargetTexture(0)}get motionVectorTexture(){return this.iT.getColorAttachedRenderTargetTexture(0)}set currentFrameWeight(e){this.tT.setParameter("currentFrameWeight",e)}get currentFrameWeight(){return this.tT.getParameter("currentFrameWeight")._v[0]}set staticFrameWeight(e){this.tT.setParameter("staticFrameWeight",e)}get staticFrameWeight(){return this.tT.getParameter("staticFrameWeight")._v[0]}set varianceClipGamma(e){this.tT.setParameter("varianceClipGamma",e)}get frameIndex(){return this.cT}setEntities(e){this.fT.clearEntities(),this.fT.addEntities(e),this.lT.setEntities(e)}resetHistory(){this.oT=!1}prepareFrame(e){if(e==null)return;e!==this.rT&&(this.rT!=null&&(this.rT.jitterOffset=u.zero()),this.rT=e,this.oT=!1),f.multiplyTo(e.projectionMatrixWithoutJitter,e.viewMatrix,this.dT),this.mT.setParameter("previousViewProjectionMatrix",this.dT);let t=A(this.cT,this.sm,this.TT);e.jitterOffset=t,this.mT.setParameter("currentJitter",t),this.tT.setParameter("currentJitter",t),this.cT++,this.lT.update()&&this.i._markGpuInstanceDataDirty(),this.oT||(this.pT=0),this.tT.setParameter("isHistoryValid",this.oT),this.tT.setParameter("historyFrameCount",this.pT),this.oT=!0,this.pT=Math.min(this.pT+1,g)}get historyFrameCount(){return this.tT.getParameter("historyFrameCount")._v[0]}destroy3DAPIResources(){this.rT!=null&&(this.rT.jitterOffset=u.zero(),this.rT=void 0),this.iT.destroy3DAPIResources(),this.aT.destroy3DAPIResources(),this.sT.destroy3DAPIResources(),this.lT.clear()}};function H(o,e){for(let t of e)if(t.cameraComponent!=null)return t.cameraComponent;return o.componentRepository.getComponent(h,h.getCurrent(o))}export{T as TemporalAASystem,H as _getTemporalAACamera,A as getTemporalAAJitter,c as halton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RnObject as i}from"../../core/RnObject.js";var t=class extends i{constructor(){super(...arguments);this.sm=0;this.
|
|
1
|
+
import{RnObject as i}from"../../core/RnObject.js";var t=class extends i{constructor(){super(...arguments);this.sm=0;this.TT=0;this.hp=[]}async setup(s,p){this.sm=s,this.TT=p}setExpressions(s){this.hp=s}};export{t as DeferredRenderPipeline};
|
|
@@ -22,32 +22,33 @@ import { Frame } from '../Frame';
|
|
|
22
22
|
* @example
|
|
23
23
|
* ```typescript
|
|
24
24
|
* const expressions = [...];
|
|
25
|
-
* const matrix = [...];
|
|
26
25
|
*
|
|
27
26
|
* // Create and setup the render pipeline
|
|
28
|
-
* const forwardRenderPipeline = new Rn.ForwardRenderPipeline();
|
|
27
|
+
* const forwardRenderPipeline = new Rn.ForwardRenderPipeline(engine);
|
|
29
28
|
* await forwardRenderPipeline.setup(1024, 1024, {isShadow: true, isBloom: true});
|
|
30
29
|
*
|
|
31
30
|
* // Configure expressions and IBL
|
|
32
31
|
* forwardRenderPipeline.setExpressions(expressions);
|
|
33
32
|
*
|
|
34
|
-
* const diffuseCubeTexture =
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
33
|
+
* const diffuseCubeTexture = await Rn.CubeTexture.loadFromUrl(engine, {
|
|
34
|
+
* baseUrl: './../../../assets/ibl/papermill/diffuse/diffuse',
|
|
35
|
+
* mipmapLevelNumber: 1,
|
|
36
|
+
* isNamePosNeg: true,
|
|
37
|
+
* hdriFormat: Rn.HdriFormat.RGBE_PNG,
|
|
38
|
+
* });
|
|
39
39
|
*
|
|
40
|
-
* const specularCubeTexture =
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
40
|
+
* const specularCubeTexture = await Rn.CubeTexture.loadFromUrl(engine, {
|
|
41
|
+
* baseUrl: './../../../assets/ibl/papermill/specular/specular',
|
|
42
|
+
* mipmapLevelNumber: 10,
|
|
43
|
+
* isNamePosNeg: true,
|
|
44
|
+
* hdriFormat: Rn.HdriFormat.RGBE_PNG,
|
|
45
|
+
* });
|
|
45
46
|
*
|
|
46
47
|
* forwardRenderPipeline.setIBLTextures(diffuseCubeTexture, specularCubeTexture);
|
|
47
48
|
*
|
|
48
49
|
* // Start the render loop
|
|
49
50
|
* forwardRenderPipeline.startRenderLoop((frame) => {
|
|
50
|
-
*
|
|
51
|
+
* engine.process(frame);
|
|
51
52
|
* });
|
|
52
53
|
* ```
|
|
53
54
|
*/
|
|
@@ -57,6 +58,8 @@ export declare class ForwardRenderPipeline extends RnObject {
|
|
|
57
58
|
private __isShadow;
|
|
58
59
|
private __isBloom;
|
|
59
60
|
private __isSimple;
|
|
61
|
+
private __isTemporalAA;
|
|
62
|
+
private __temporalAA?;
|
|
60
63
|
private __shadowMapSize;
|
|
61
64
|
private __frame?;
|
|
62
65
|
private __frameBufferMultiView?;
|
|
@@ -132,6 +135,9 @@ export declare class ForwardRenderPipeline extends RnObject {
|
|
|
132
135
|
* @param options.isBloom - Whether to enable bloom post-processing effect (default: false)
|
|
133
136
|
* @param options.shadowMapSize - Size of the shadow map texture in pixels (default: 1024)
|
|
134
137
|
* @param options.isSimple - Whether to use simplified rendering without post-processing (default: false)
|
|
138
|
+
* @param options.isTemporalAA - Whether to enable temporal anti-aliasing (default: false). It replaces the 4x MSAA
|
|
139
|
+
* of the main render target: the camera projection is jittered by a sub-pixel offset every frame, and the frames
|
|
140
|
+
* are accumulated with motion vectors. Ignored in the simple mode and for WebXR multi-view rendering.
|
|
135
141
|
*
|
|
136
142
|
* @returns A Result indicating success or failure of the setup operation
|
|
137
143
|
*
|
|
@@ -155,10 +161,11 @@ export declare class ForwardRenderPipeline extends RnObject {
|
|
|
155
161
|
* }
|
|
156
162
|
* ```
|
|
157
163
|
*/
|
|
158
|
-
setup(canvasWidth: number, canvasHeight: number, { isShadow, isBloom, shadowMapSize, isSimple }?: {
|
|
164
|
+
setup(canvasWidth: number, canvasHeight: number, { isShadow, isBloom, shadowMapSize, isSimple, isTemporalAA }?: {
|
|
159
165
|
isBloom?: boolean | undefined;
|
|
160
166
|
isShadow?: boolean | undefined;
|
|
161
167
|
isSimple?: boolean | undefined;
|
|
168
|
+
isTemporalAA?: boolean | undefined;
|
|
162
169
|
shadowMapSize?: number | undefined;
|
|
163
170
|
}): Promise<Err<unknown, undefined> | Ok<unknown, unknown>>;
|
|
164
171
|
/**
|
|
@@ -185,6 +192,11 @@ export declare class ForwardRenderPipeline extends RnObject {
|
|
|
185
192
|
* @internal
|
|
186
193
|
*/
|
|
187
194
|
private __getMainFrameBuffer;
|
|
195
|
+
/**
|
|
196
|
+
* Whether temporal anti-aliasing is used: requested in setup, not in the simple mode, and not in WebXR mode
|
|
197
|
+
* (the eye cameras are not jittered, and stereo rendering keeps MSAA).
|
|
198
|
+
*/
|
|
199
|
+
private __isTemporalAAActive;
|
|
188
200
|
/**
|
|
189
201
|
* Sets the expressions to be rendered by the pipeline.
|
|
190
202
|
*
|
|
@@ -227,7 +239,7 @@ export declare class ForwardRenderPipeline extends RnObject {
|
|
|
227
239
|
* ```typescript
|
|
228
240
|
* const result = pipeline.startRenderLoop((frame) => {
|
|
229
241
|
* // Update scene
|
|
230
|
-
*
|
|
242
|
+
* engine.process(frame);
|
|
231
243
|
*
|
|
232
244
|
* // Custom per-frame logic
|
|
233
245
|
* updateAnimations();
|
|
@@ -235,7 +247,7 @@ export declare class ForwardRenderPipeline extends RnObject {
|
|
|
235
247
|
* });
|
|
236
248
|
*
|
|
237
249
|
* if (result.isErr()) {
|
|
238
|
-
* console.error('Failed to start render loop:', result.
|
|
250
|
+
* console.error('Failed to start render loop:', result.getRnError());
|
|
239
251
|
* }
|
|
240
252
|
* ```
|
|
241
253
|
*/
|
|
@@ -254,6 +266,40 @@ export declare class ForwardRenderPipeline extends RnObject {
|
|
|
254
266
|
* ```
|
|
255
267
|
*/
|
|
256
268
|
draw(): void;
|
|
269
|
+
/**
|
|
270
|
+
* Whether temporal anti-aliasing is enabled (requested in setup and supported by the current render targets).
|
|
271
|
+
*/
|
|
272
|
+
get isTemporalAA(): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Discards the accumulated history of temporal anti-aliasing, so that the next frame does not blend with the
|
|
275
|
+
* previous frames. Call it when the view changes discontinuously (e.g. a camera cut).
|
|
276
|
+
*/
|
|
277
|
+
resetTemporalAAHistory(): void;
|
|
278
|
+
/**
|
|
279
|
+
* The weight of the current frame in the temporal anti-aliasing blend for pixels that move by a pixel per frame
|
|
280
|
+
* or more (0-1, default 0.1). Larger values react faster to changes and smooth less.
|
|
281
|
+
*/
|
|
282
|
+
set temporalAACurrentFrameWeight(weight: number);
|
|
283
|
+
get temporalAACurrentFrameWeight(): number;
|
|
284
|
+
/**
|
|
285
|
+
* The weight of the current frame in the temporal anti-aliasing blend for pixels that do not move (0-1, default
|
|
286
|
+
* 0.04). Smaller values average more frames of the jitter sequence, which steadies the edges of still images;
|
|
287
|
+
* slower pixels interpolate between this weight and {@link ForwardRenderPipeline.temporalAACurrentFrameWeight}.
|
|
288
|
+
*/
|
|
289
|
+
set temporalAAStaticFrameWeight(weight: number);
|
|
290
|
+
get temporalAAStaticFrameWeight(): number;
|
|
291
|
+
/**
|
|
292
|
+
* Sets the size of the variance clipping box of the temporal anti-aliasing history in standard deviations
|
|
293
|
+
* (default 1). A large value effectively disables the clipping, which makes wrong motion vectors visible as
|
|
294
|
+
* trails. For debugging.
|
|
295
|
+
*
|
|
296
|
+
* @internal
|
|
297
|
+
*/
|
|
298
|
+
_setTemporalAAVarianceClipGamma(gamma: number): void;
|
|
299
|
+
/**
|
|
300
|
+
* Jitters the camera and keeps the previous frame state for temporal anti-aliasing. Runs before Engine.process.
|
|
301
|
+
*/
|
|
302
|
+
private __prepareTemporalAAFrame;
|
|
257
303
|
/**
|
|
258
304
|
* Requests a refresh of the shadow map expressions on the next frame.
|
|
259
305
|
* This is useful when materials with shadow support have been changed or added
|
|
@@ -307,7 +353,8 @@ export declare class ForwardRenderPipeline extends RnObject {
|
|
|
307
353
|
* The diffuse texture provides ambient lighting, while the specular texture provides
|
|
308
354
|
* reflections and specular highlights.
|
|
309
355
|
*
|
|
310
|
-
* The sheen texture is optional and used for materials with fabric-like properties.
|
|
356
|
+
* The sheen texture is optional and used for materials with fabric-like properties. Omitting it clears
|
|
357
|
+
* a previously set sheen texture, so switching to an IBL without sheen falls back to the specular cube.
|
|
311
358
|
*
|
|
312
359
|
* @example
|
|
313
360
|
* ```typescript
|