rhodonite 0.25.0 → 0.26.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/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/createTemporalAAResolveMaterial.d.ts +33 -0
- package/dist/esm/foundation/helpers/materials/createTemporalAAResolveMaterial.js +1 -0
- package/dist/esm/foundation/importer/AnimationAssigner.js +1 -1
- package/dist/esm/foundation/importer/DrcPointCloudImporter.js +1 -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/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/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.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 +62 -16
- 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.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.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/MultiDraw.js +1 -1
- package/dist/esm/webgl/MultiDrawRepository.js +1 -1
- package/dist/esm/webgl/WebGLStereoUtil.js +1 -1
- package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +8 -0
- package/dist/esm/webgl/WebGLStrategyWebGL2.js +47 -28
- package/dist/esm/webgl/shaderity_shaders/ClassicSingleShader/ClassicSingleShader.vert.js +0 -3
- 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/TemporalAAResolveShader/TemporalAAResolveShader.frag.js +175 -0
- package/dist/esm/webgl/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.js +18 -0
- package/dist/esm/webgl/shaders/StandardShaderPart.js +3 -3
- package/dist/esm/webgl/shaders/nodes/ConstantVariableShader.js +5 -5
- package/dist/esm/webgl/shaders/nodes/UniformDataShader.js +9 -9
- 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/WebGpuGpuTimer.js +1 -1
- package/dist/esm/webgpu/WebGpuLightClusterBuilder.js +1 -1
- package/dist/esm/webgpu/WebGpuResourceRepository.js +3 -3
- 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/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/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +169 -0
- package/dist/esm/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +19 -0
- 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.js +25 -25
- 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.js +6 -6
- 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 +218 -218
- package/dist/esmdev/foundation/geometry/Primitive.js +133 -133
- 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 +132 -134
- 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/createTemporalAAResolveMaterial.d.ts +33 -0
- package/dist/esmdev/foundation/helpers/materials/createTemporalAAResolveMaterial.js +127 -0
- package/dist/esmdev/foundation/importer/AnimationAssigner.js +44 -44
- package/dist/esmdev/foundation/importer/DrcPointCloudImporter.js +33 -33
- package/dist/esmdev/foundation/importer/Gltf2Importer.js +14 -14
- package/dist/esmdev/foundation/importer/GltfImporter.js +22 -22
- package/dist/esmdev/foundation/importer/ModelConverter.js +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 +27 -27
- package/dist/esmdev/foundation/materials/contents/DepthEncodeMaterialContent.js +2 -2
- package/dist/esmdev/foundation/materials/contents/MToon0xMaterialContent.js +138 -138
- package/dist/esmdev/foundation/materials/contents/MToon1MaterialContent.js +19 -19
- 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.js +115 -115
- 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 +370 -370
- 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/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 +203 -203
- 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 +51 -51
- 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.js +102 -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 +62 -16
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.js +535 -428
- 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.js +32 -32
- 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.js +19 -19
- 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.js +306 -306
- package/dist/esmdev/webgl/WebGLStereoUtil.js +42 -42
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +8 -0
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.js +296 -261
- 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/MotionVectorShader/MotionVectorShader.frag.js +12 -0
- package/dist/esmdev/webgl/shaderity_shaders/MotionVectorShader/MotionVectorShader.vert.js +12 -0
- 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/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.js +597 -597
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.d.ts +8 -0
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.js +170 -133
- package/dist/esmdev/webgpu/WebGpuVertexDeformer.js +128 -128
- 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/TemporalAAResolveShader/TemporalAAResolveShader.frag.wgsl.js +12 -0
- package/dist/esmdev/webgpu/shaderity_shaders/TemporalAAResolveShader/TemporalAAResolveShader.vert.wgsl.js +12 -0
- package/dist/esmdev/xr/WebARSystem.js +69 -69
- package/dist/esmdev/xr/WebXRSystem.js +153 -153
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{CompositionType as R}from"../definitions/CompositionType.js";import{Logger as h}from"../misc/Logger.js";import{AbstractQuaternion as S}from"./AbstractQuaternion.js";import{MathUtil as A}from"./MathUtil.js";import{MutableMatrix44 as E}from"./MutableMatrix44.js";import{MutableVector3 as M}from"./MutableVector3.js";import{Vector3 as m}from"./Vector3.js";var Q=class extends S{constructor(t,r){super(),this._v=t}get className(){return"Quaternion"}static get compositionType(){return R.Vec4}static identity(){return this.fromCopy4(0,0,0,1)}static dummy(){return new this(new this._type(0))}static invert(t){let r=t.length();if(r===0)return this.fromCopy4(0,0,0,0);let n=-t._v[0]/r,e=-t._v[1]/r,i=-t._v[2]/r,a=t._v[3]/r;return this.fromCopy4(n,e,i,a)}static invertTo(t,r){let n=t.length();return n===0?r.setComponents(0,0,0,0):(r._v[0]=-t._v[0]/n,r._v[1]=-t._v[1]/n,r._v[2]=-t._v[2]/n,r._v[3]=t._v[3]/n,r)}static qlerp(t,r,n){let e=t._v[0]*r._v[0]+t._v[1]*r._v[1]+t._v[2]*r._v[2]+t._v[3]*r._v[3];if(1-e*e===0)return t.clone();e>1?e=.999:e<-1&&(e=-.999);let a=Math.acos(e),s=Math.sin(a),o;e<0?(e*=-1,a=Math.acos(e),o=-1*Math.sin(a*n)/s):o=Math.sin(a*n)/s;let c=Math.sin(a*(1-n))/s,v=t._v[0]*c+r._v[0]*o,l=t._v[1]*c+r._v[1]*o,p=t._v[2]*c+r._v[2]*o,u=t._v[3]*c+r._v[3]*o,y=Math.hypot(v,l,p,u);return v=v/y,l=l/y,p=p/y,u=u/y,this.fromCopy4(v,l,p,u)}static qlerpTo(t,r,n,e){let i=t._v[0]*r._v[0]+t._v[1]*r._v[1]+t._v[2]*r._v[2]+t._v[3]*r._v[3];if(1-i*i===0)return e.copyComponents(t);i>1?i=.999:i<-1&&(i=-.999);let s=Math.acos(i),o=Math.sin(s),c;i<0?(i*=-1,s=Math.acos(i),c=-1*Math.sin(s*n)/o):c=Math.sin(s*n)/o;let v=Math.sin(s*(1-n))/o;return e._v[0]=t._v[0]*v+r._v[0]*c,e._v[1]=t._v[1]*v+r._v[1]*c,e._v[2]=t._v[2]*v+r._v[2]*c,e._v[3]=t._v[3]*v+r._v[3]*c,e.normalize()}static lerp(t,r,n){let e=t._v[0]*(1-n)+r._v[0]*n,i=t._v[1]*(1-n)+r._v[1]*n,a=t._v[2]*(1-n)+r._v[2]*n,s=t._v[3]*(1-n)+r._v[3]*n;return this.fromCopy4(e,i,a,s)}static lerpTo(t,r,n,e){return e._v[0]=t._v[0]*(1-n)+r._v[0]*n,e._v[1]=t._v[1]*(1-n)+r._v[1]*n,e._v[2]=t._v[2]*(1-n)+r._v[2]*n,e._v[3]=t._v[3]*(1-n)+r._v[3]*n,e}static tryAxisAngle(t,r){let n=t.length();if(!Number.isFinite(n)||n===0)return null;let e=.5*r,i=Math.sin(e);return this.fromCopy4(i*t._v[0]/n,i*t._v[1]/n,i*t._v[2]/n,Math.cos(e))}static axisAngle(t,r){let n=this.tryAxisAngle(t,r);return n!==null?n:(h.default.error("the rotation axis has zero length. Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1))}static nv(t,r){let n=Math.hypot(t.m00,t.m10,t.m20),e=Math.hypot(t.m01,t.m11,t.m21),i=Math.hypot(t.m02,t.m12,t.m22),a=t.determinant();if(A.isSingularDet(a,n*e*i,A.getSingularEpsilon(this._type.BYTES_PER_ELEMENT)))return!1;let s=a<0?-n:n,o=E.fromCopyMatrix44(t),c=1/s,v=1/e,l=1/i;o.m00*=c,o.m10*=c,o.m20*=c,o.m01*=v,o.m11*=v,o.m21*=v,o.m02*=l,o.m12*=l,o.m22*=l;let p=o.m00+o.m11+o.m22;if(p>0){let u=.5/Math.sqrt(p+1);r[0]=(o.m21-o.m12)*u,r[1]=(o.m02-o.m20)*u,r[2]=(o.m10-o.m01)*u,r[3]=.25/u}else if(o.m00>o.m11&&o.m00>o.m22){let u=Math.sqrt(1+o.m00-o.m11-o.m22)*2;r[0]=.25*u,r[1]=(o.m01+o.m10)/u,r[2]=(o.m02+o.m20)/u,r[3]=(o.m21-o.m12)/u}else if(o.m11>o.m22){let u=Math.sqrt(1+o.m11-o.m00-o.m22)*2;r[0]=(o.m01+o.m10)/u,r[1]=.25*u,r[2]=(o.m12+o.m21)/u,r[3]=(o.m02-o.m20)/u}else{let u=Math.sqrt(1+o.m22-o.m00-o.m11)*2;r[0]=(o.m02+o.m20)/u,r[1]=(o.m12+o.m21)/u,r[2]=.25*u,r[3]=(o.m10-o.m01)/u}return!0}static tryFromMatrix(t){let r=new this._type(4);return this.nv(t,r)?this.fromCopy4(r[0],r[1],r[2],r[3]):null}static fromMatrix(t){let r=this.tryFromMatrix(t);return r!==null?r:(h.default.error("the rotation cannot be extracted from the matrix (it is singular or contains non-finite values). Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1))}static tryFromMatrixTo(t,r){return this.nv(t,r._v)}static fromMatrixTo(t,r){return this.tryFromMatrixTo(t,r)||(h.default.error("the rotation cannot be extracted from the matrix (it is singular or contains non-finite values). Returning an identity quaternion instead."),r._v[0]=0,r._v[1]=0,r._v[2]=0,r._v[3]=1),r}static lookFromTo(t,r){return t.isEqual(r)?this.fromCopy4(0,0,0,1):this.qlerp(this.lookForward(t),this.lookForward(r),1)}static tryLookForward(t){return this.tv==null&&(this.tv=new t.constructor(0,1,0)),this.tryLookForwardAccordingToThisUp(t,this.tv)}static lookForward(t){let r=this.tryLookForward(t);return r!==null?r:(h.default.error("the forward direction has zero length. Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1))}static tryLookForwardAccordingToThisUp(t,r){let n=t.length(),e=r.length();if(!Number.isFinite(n)||!Number.isFinite(e)||n===0||e===0)return null;let i=t._v[0]/n,a=t._v[1]/n,s=t._v[2]/n,o=r._v[0]/e,c=r._v[1]/e,v=r._v[2]/e,l=r._v[1]*t._v[2]-r._v[2]*t._v[1],p=r._v[2]*t._v[0]-r._v[0]*t._v[2],u=r._v[0]*t._v[1]-r._v[1]*t._v[0],y=Math.hypot(l,p,u);if(!Number.isFinite(y)||y===0)return null;l/=y,p/=y,u/=y;let f=l,g=p,x=u,C=o,d=c,z=v,V=i,F=a,T=s,L=f+d+T;if(L>0){let b=Math.sqrt(L+1),I=.5/b;return this.fromCopy4((z-F)*I,(V-x)*I,(g-C)*I,b*.5)}if(f>=d&&f>=T){let b=Math.sqrt(1+f-d-T),I=.5/b;return this.fromCopy4(.5*b,(g+C)*I,(x+V)*I,(z-F)*I)}if(d>T){let b=Math.sqrt(1+d-f-T),I=.5/b;return this.fromCopy4((C+g)*I,.5*b,(F+z)*I,(V-x)*I)}let k=Math.sqrt(1+T-f-d),w=.5/k;return this.fromCopy4((V+x)*w,(F+z)*w,.5*k,(g-C)*w)}static lookForwardAccordingToThisUp(t,r){let n=this.tryLookForwardAccordingToThisUp(t,r);return n!==null?n:(h.default.error("the forward/up directions are degenerate (zero length or parallel). Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1))}static fromPosition(t){return this.fromCopy4(t._v[0],t._v[1],t._v[2],0)}static add(t,r){let n=t._v[0]+r._v[0],e=t._v[1]+r._v[1],i=t._v[2]+r._v[2],a=t._v[3]+r._v[3];return this.fromCopy4(n,e,i,a)}static addTo(t,r,n){return n._v[0]=t._v[0]+r._v[0],n._v[1]=t._v[1]+r._v[1],n._v[2]=t._v[2]+r._v[2],n._v[3]=t._v[3]+r._v[3],n}static subtract(t,r){let n=t._v[0]-r._v[0],e=t._v[1]-r._v[1],i=t._v[2]-r._v[2],a=t._v[3]-r._v[3];return this.fromCopy4(n,e,i,a)}static subtractTo(t,r,n){return n._v[0]=t._v[0]-r._v[0],n._v[1]=t._v[1]-r._v[1],n._v[2]=t._v[2]-r._v[2],n._v[3]=t._v[3]-r._v[3],n}static multiply(t,r){let n=r._v[3]*t._v[0]+r._v[2]*t._v[1]-r._v[1]*t._v[2]+r._v[0]*t._v[3],e=-r._v[2]*t._v[0]+r._v[3]*t._v[1]+r._v[0]*t._v[2]+r._v[1]*t._v[3],i=r._v[1]*t._v[0]-r._v[0]*t._v[1]+r._v[3]*t._v[2]+r._v[2]*t._v[3],a=-r._v[0]*t._v[0]-r._v[1]*t._v[1]-r._v[2]*t._v[2]+r._v[3]*t._v[3];return this.fromCopy4(n,e,i,a)}static multiplyTo(t,r,n){let e=r._v[3]*t._v[0]+r._v[2]*t._v[1]-r._v[1]*t._v[2]+r._v[0]*t._v[3],i=-r._v[2]*t._v[0]+r._v[3]*t._v[1]+r._v[0]*t._v[2]+r._v[1]*t._v[3],a=r._v[1]*t._v[0]-r._v[0]*t._v[1]+r._v[3]*t._v[2]+r._v[2]*t._v[3],s=-r._v[0]*t._v[0]-r._v[1]*t._v[1]-r._v[2]*t._v[2]+r._v[3]*t._v[3];return n.setComponents(e,i,a,s)}static multiplyNumber(t,r){let n=t._v[0]*r,e=t._v[1]*r,i=t._v[2]*r,a=t._v[3]*r;return this.fromCopy4(n,e,i,a)}static multiplyNumberTo(t,r,n){return n._v[0]=t._v[0]*r,n._v[1]=t._v[1]*r,n._v[2]=t._v[2]*r,n._v[3]=t._v[3]*r,n}static divideNumber(t,r){return r===0?(h.default.error("0 division occurred! The result is set to zero."),this.fromCopy4(0,0,0,0)):this.fromCopy4(t._v[0]/r,t._v[1]/r,t._v[2]/r,t._v[3]/r)}static divideNumberTo(t,r,n){return r===0?(h.default.error("0 division occurred! The result is set to zero."),n._v[0]=0,n._v[1]=0,n._v[2]=0,n._v[3]=0,n):(n._v[0]=t._v[0]/r,n._v[1]=t._v[1]/r,n._v[2]=t._v[2]/r,n._v[3]=t._v[3]/r,n)}toString(){return`(${this._v[0]}, ${this._v[1]}, ${this._v[2]}, ${this._v[3]})`}toStringApproximately(){return`${A.financial(this._v[0])} ${A.financial(this._v[1])} ${A.financial(this._v[2])} ${A.financial(this._v[3])}
|
|
2
|
-
`}flattenAsArray(){return[this._v[0],this._v[1],this._v[2],this._v[3]]}isDummy(){return this._v.length===0}isEqual(t,r=Number.EPSILON){return Math.abs(t._v[0]-this._v[0])<r&&Math.abs(t._v[1]-this._v[1])<r&&Math.abs(t._v[2]-this._v[2])<r&&Math.abs(t._v[3]-this._v[3])<r}isStrictEqual(t){return this._v[0]===t._v[0]&&this._v[1]===t._v[1]&&this._v[2]===t._v[2]&&this._v[3]===t._v[3]}toEulerAnglesTo(t){let r=2*(this._v[3]*this._v[0]+this._v[1]*this._v[2]),n=1-2*(this._v[0]*this._v[0]+this._v[1]*this._v[1]);t._v[0]=Math.atan2(r,n);let e=2*(this._v[3]*this._v[1]-this._v[2]*this._v[0]);e=Math.min(e,1),e=Math.max(e,-1),t._v[1]=Math.asin(e);let i=2*(this._v[3]*this._v[2]+this._v[0]*this._v[1]),a=1-2*(this._v[1]*this._v[1]+this._v[2]*this._v[2]);return t._v[2]=Math.atan2(i,a),t}toEulerAngles(){let t=new m(new Float32Array(3)),r=2*(this._v[3]*this._v[0]+this._v[1]*this._v[2]),n=1-2*(this._v[0]*this._v[0]+this._v[1]*this._v[1]);t._v[0]=Math.atan2(r,n);let e=2*(this._v[3]*this._v[1]-this._v[2]*this._v[0]);e=Math.min(e,1),e=Math.max(e,-1),t._v[1]=Math.asin(e);let i=2*(this._v[3]*this._v[2]+this._v[0]*this._v[1]),a=1-2*(this._v[1]*this._v[1]+this._v[2]*this._v[2]);return t._v[2]=Math.atan2(i,a),t}static _divide(t,r){let n,e,i,a;return r!==0?(n=t._v[0]/r,e=t._v[1]/r,i=t._v[2]/r,a=t._v[3]/r):(h.default.error("0 division occurred! The result is set to zero."),n=0,e=0,i=0,a=0),this.fromCopy4(n,e,i,a)}static _divideTo(t,r,n){let e,i,a,s;return r!==0?(e=t._v[0]/r,i=t._v[1]/r,a=t._v[2]/r,s=t._v[3]/r):(h.default.error("0 division occurred! The result is set to zero."),e=0,i=0,a=0,s=0),n._v[0]=e,n._v[1]=i,n._v[2]=a,n._v[3]=s,n}static normalize(t){let r=t.length();return r===0?(h.default.error("cannot normalize a zero-length quaternion. Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1)):this._divide(t,r)}static normalizeTo(t,r){let n=t.length();return n===0?(h.default.error("cannot normalize a zero-length quaternion. The output is set to the identity quaternion."),r._v[0]=0,r._v[1]=0,r._v[2]=0,r._v[3]=1,r):this._divideTo(t,n,r)}fromToRotation(t,r){let n=M.fromCopyVector3(t),e=M.fromCopyVector3(r);n.normalize(),e.normalize();let i=n.dot(e);if(i>-1+Number.EPSILON){let o=Math.sqrt((1+i)*2),c=1/o,v=m.multiply(n.cross(e),c);return this._v[0]=v.x,this._v[1]=v.y,this._v[2]=v.z,this._v[3]=o*.5,this.constructor.normalize(this)}let a=m.fromCopy3(0,1,0),s=n.cross(a);return s.length()<Number.EPSILON&&(a=m.fromCopy3(1,0,0),s=n.cross(a)),s.normalize(),this.constructor.fromAxisAngle(s,Math.PI)}static fromToRotation(t,r){let n=m.dot(t,r)+1;if(n<Number.EPSILON){if(n=0,Math.abs(t.x)>Math.abs(t.z)){let a=this.fromCopy4(-t.y,t.x,0,n);return this.normalize(a)}let i=this.fromCopy4(0,-t.z,t.y,n);return this.normalize(i)}let e=this.fromCopy4(t.y*r.z-t.z*r.y,t.z*r.x-t.x*r.z,t.x*r.y-t.y*r.x,n);return this.normalize(e)}static fromToRotationTo(t,r,n){let e=m.dot(t,r)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(n._v[0]=-t.y,n._v[1]=t.x,n._v[2]=0,n._v[3]=e,n.normalize(),n):(n._v[0]=0,n._v[1]=-t.z,n._v[2]=t.y,n._v[3]=e,n.normalize(),n)):(n._v[0]=t.y*r.z-t.z*r.y,n._v[1]=t.z*r.x-t.x*r.z,n._v[2]=t.x*r.y-t.y*r.x,n._v[3]=e,n.normalize(),n)}transformVector3(t){let r=_.rv;r.setComponents(this._v[0],this._v[1],this._v[2]);let n=m.cross(r,t),e=m.cross(r,n),i=m.multiply(n,this._v[3]),a=m.add(e,i),s=m.multiply(a,2);return m.add(t,s)}transformVector3To(t,r){let n=_.rv;n.setComponents(this._v[0],this._v[1],this._v[2]);let e=m.crossTo(n,t,_.Or),i=m.crossTo(n,e,_.Nr),a=m.multiplyTo(e,this._v[3],_.Xr),s=m.addTo(i,a,_.ev),o=m.multiplyTo(s,2,_.ov);return m.addTo(t,o,r)}transformVector3Inverse(t){return this.constructor.invert(this).transformVector3(t)}clone(){return this.constructor.fromCopy4(this._v[0],this._v[1],this._v[2],this._v[3])}static fromTypedArray(t){return new this(t)}static fromCopyArray4(t){return new this(new this._type(t))}static fromCopyArray(t){return new this(new this._type(t.slice(0,4)))}static fromCopy4(t,r,n,e){return new this(new this._type([t,r,n,e]))}static fromCopyQuaternion(t){let r=new this._type(4);return r[0]=t._v[0],r[1]=t._v[1],r[2]=t._v[2],r[3]=t._v[3],new this(r)}static fromCopyVector4(t){let r=new this._type(4);return r[0]=t._v[0],r[1]=t._v[1],r[2]=t._v[2],r[3]=t._v[3],new this(r)}static fromCopyLogQuaternion(t){let r=Math.hypot(t._v[0],t._v[1],t._v[2]),n=new this._type(4);if(r===0)return n[0]=0,n[1]=0,n[2]=0,n[3]=1,new this(n);let e=Math.sin(r);return n[0]=t._v[0]*(e/r),n[1]=t._v[1]*(e/r),n[2]=t._v[2]*(e/r),n[3]=Math.cos(r),new this(n)}static fromAxisAngle(t,r){r=r*.5;let n=Math.sin(r);return this.fromCopy4(n*t.x,n*t.y,n*t.z,Math.cos(r))}static fromAxisAngleTo(t,r,n){r=r*.5;let e=Math.sin(r);return n._v[0]=e*t.x,n._v[1]=e*t.y,n._v[2]=e*t.z,n._v[3]=Math.cos(r),n}static getQuaternionAngle(t){let r=Math.max(-1,Math.min(1,t.w));return 2*Math.acos(r)}static clampRotation(t,r){let n=this.getQuaternionAngle(t);if(n<=r)return t;let e=r/n,i=this.fromCopy4(0,0,0,1);return this.qlerp(i,t,e)}};Q._type=Float32Array,Q.tv=void 0,Q.Or=M.zero(),Q.Nr=M.zero(),Q.Xr=M.zero(),Q.ev=M.zero(),Q.ov=M.zero(),Q.rv=M.zero();var _=class extends Q{constructor(t){super(t,{type:Float32Array})}static identity(){return super.identity()}static dummy(){return super.dummy()}static invert(t){return super.invert(t)}static invertTo(t,r){return super.invertTo(t,r)}static qlerp(t,r,n){return super.qlerp(t,r,n)}static qlerpTo(t,r,n,e){return super.qlerpTo(t,r,n,e)}static lerp(t,r,n){return super.lerp(t,r,n)}static lerpTo(t,r,n,e){return super.lerpTo(t,r,n,e)}static tryAxisAngle(t,r){return super.tryAxisAngle(t,r)}static axisAngle(t,r){return super.axisAngle(t,r)}static tryFromMatrix(t){return super.tryFromMatrix(t)}static fromMatrix(t){return super.fromMatrix(t)}static tryFromMatrixTo(t,r){return super.tryFromMatrixTo(t,r)}static fromMatrixTo(t,r){return super.fromMatrixTo(t,r)}static lookFromTo(t,r){return super.lookFromTo(t,r)}static tryLookForward(t){return super.tryLookForward(t)}static lookForward(t){return super.lookForward(t)}static tryLookForwardAccordingToThisUp(t,r){return super.tryLookForwardAccordingToThisUp(t,r)}static lookForwardAccordingToThisUp(t,r){return super.lookForwardAccordingToThisUp(t,r)}static fromPosition(t){return super.fromPosition(t)}static add(t,r){return super.add(t,r)}static addTo(t,r,n){return super.addTo(t,r,n)}static subtract(t,r){return super.subtract(t,r)}static subtractTo(t,r,n){return super.subtractTo(t,r,n)}static multiply(t,r){return super.multiply(t,r)}static multiplyTo(t,r,n){return super.multiplyTo(t,r,n)}static multiplyNumber(t,r){return super.multiplyNumber(t,r)}static multiplyNumberTo(t,r,n){return super.multiplyNumberTo(t,r,n)}static divideNumber(t,r){return super.divideNumber(t,r)}static divideNumberTo(t,r,n){return super.divideNumberTo(t,r,n)}static normalize(t){return super.normalize(t)}static normalizeTo(t,r){return super.normalizeTo(t,r)}static fromToRotation(t,r){return super.fromToRotation(t,r)}static fromToRotationTo(t,r,n){return super.fromToRotationTo(t,r,n)}static fromFloat32Array(t){return super.fromTypedArray(t)}static fromCopyArray4(t){return super.fromCopyArray4(t)}static fromCopyArray(t){return super.fromCopyArray(t)}static fromCopy4(t,r,n,e){return super.fromCopy4(t,r,n,e)}static fromCopyQuaternion(t){return super.fromCopyQuaternion(t)}static fromCopyVector4(t){return super.fromCopyVector4(t)}static fromCopyLogQuaternion(t){return super.fromCopyLogQuaternion(t)}static fromAxisAngle(t,r){return super.fromAxisAngle(t,r)}static fromAxisAngleTo(t,r,n){return super.fromAxisAngleTo(t,r,n)}static getQuaternionAngle(t){return super.getQuaternionAngle(t)}static clampRotation(t,r){return super.clampRotation(t,r)}},D=class extends Q{constructor(t){super(t,{type:Float64Array})}static identity(){return super.identity()}static dummy(){return super.dummy()}static invert(t){return super.invert(t)}static invertTo(t,r){return super.invertTo(t,r)}static qlerp(t,r,n){return super.qlerp(t,r,n)}static qlerpTo(t,r,n,e){return super.qlerpTo(t,r,n,e)}static lerp(t,r,n){return super.lerp(t,r,n)}static lerpTo(t,r,n,e){return super.lerpTo(t,r,n,e)}static tryAxisAngle(t,r){return super.tryAxisAngle(t,r)}static axisAngle(t,r){return super.axisAngle(t,r)}static tryFromMatrix(t){return super.tryFromMatrix(t)}static fromMatrix(t){return super.fromMatrix(t)}static tryFromMatrixTo(t,r){return super.tryFromMatrixTo(t,r)}static fromMatrixTo(t,r){return super.fromMatrixTo(t,r)}static lookFromTo(t,r){return super.lookFromTo(t,r)}static tryLookForward(t){return super.tryLookForward(t)}static lookForward(t){return super.lookForward(t)}static tryLookForwardAccordingToThisUp(t,r){return super.tryLookForwardAccordingToThisUp(t,r)}static lookForwardAccordingToThisUp(t,r){return super.lookForwardAccordingToThisUp(t,r)}static fromPosition(t){return super.fromPosition(t)}static add(t,r){return super.add(t,r)}static addTo(t,r,n){return super.addTo(t,r,n)}static subtract(t,r){return super.subtract(t,r)}static subtractTo(t,r,n){return super.subtractTo(t,r,n)}static multiply(t,r){return super.multiply(t,r)}static multiplyTo(t,r,n){return super.multiplyTo(t,r,n)}static multiplyNumber(t,r){return super.multiplyNumber(t,r)}static multiplyNumberTo(t,r,n){return super.multiplyNumberTo(t,r,n)}static divideNumber(t,r){return super.divideNumber(t,r)}static divideNumberTo(t,r,n){return super.divideNumberTo(t,r,n)}static normalize(t){return super.normalize(t)}static normalizeTo(t,r){return super.normalizeTo(t,r)}static fromToRotation(t,r){return super.fromToRotation(t,r)}static fromToRotationTo(t,r,n){return super.fromToRotationTo(t,r,n)}static fromFloat64Array(t){return super.fromTypedArray(t)}static fromCopyArray4(t){return super.fromCopyArray4(t)}static fromCopyArray(t){return super.fromCopyArray(t)}static fromCopy4(t,r,n,e){return super.fromCopy4(t,r,n,e)}static fromCopyQuaternion(t){return super.fromCopyQuaternion(t)}static fromCopyVector4(t){return super.fromCopyVector4(t)}static fromCopyLogQuaternion(t){return super.fromCopyLogQuaternion(t)}static fromAxisAngle(t,r){return super.fromAxisAngle(t,r)}static fromAxisAngleTo(t,r,n){return super.fromAxisAngleTo(t,r,n)}static getQuaternionAngle(t){return super.getQuaternionAngle(t)}static clampRotation(t,r){return super.clampRotation(t,r)}};D._type=Float64Array;export{_ as Quaternion,D as QuaternionD,_ as QuaternionF,Q as Quaternion_};
|
|
2
|
+
`}flattenAsArray(){return[this._v[0],this._v[1],this._v[2],this._v[3]]}isDummy(){return this._v.length===0}isEqual(t,r=Number.EPSILON){return Math.abs(t._v[0]-this._v[0])<r&&Math.abs(t._v[1]-this._v[1])<r&&Math.abs(t._v[2]-this._v[2])<r&&Math.abs(t._v[3]-this._v[3])<r}isStrictEqual(t){return this._v[0]===t._v[0]&&this._v[1]===t._v[1]&&this._v[2]===t._v[2]&&this._v[3]===t._v[3]}toEulerAnglesTo(t){let r=2*(this._v[3]*this._v[0]+this._v[1]*this._v[2]),n=1-2*(this._v[0]*this._v[0]+this._v[1]*this._v[1]);t._v[0]=Math.atan2(r,n);let e=2*(this._v[3]*this._v[1]-this._v[2]*this._v[0]);e=Math.min(e,1),e=Math.max(e,-1),t._v[1]=Math.asin(e);let i=2*(this._v[3]*this._v[2]+this._v[0]*this._v[1]),a=1-2*(this._v[1]*this._v[1]+this._v[2]*this._v[2]);return t._v[2]=Math.atan2(i,a),t}toEulerAngles(){let t=new m(new Float32Array(3)),r=2*(this._v[3]*this._v[0]+this._v[1]*this._v[2]),n=1-2*(this._v[0]*this._v[0]+this._v[1]*this._v[1]);t._v[0]=Math.atan2(r,n);let e=2*(this._v[3]*this._v[1]-this._v[2]*this._v[0]);e=Math.min(e,1),e=Math.max(e,-1),t._v[1]=Math.asin(e);let i=2*(this._v[3]*this._v[2]+this._v[0]*this._v[1]),a=1-2*(this._v[1]*this._v[1]+this._v[2]*this._v[2]);return t._v[2]=Math.atan2(i,a),t}static _divide(t,r){let n,e,i,a;return r!==0?(n=t._v[0]/r,e=t._v[1]/r,i=t._v[2]/r,a=t._v[3]/r):(h.default.error("0 division occurred! The result is set to zero."),n=0,e=0,i=0,a=0),this.fromCopy4(n,e,i,a)}static _divideTo(t,r,n){let e,i,a,s;return r!==0?(e=t._v[0]/r,i=t._v[1]/r,a=t._v[2]/r,s=t._v[3]/r):(h.default.error("0 division occurred! The result is set to zero."),e=0,i=0,a=0,s=0),n._v[0]=e,n._v[1]=i,n._v[2]=a,n._v[3]=s,n}static normalize(t){let r=t.length();return r===0?(h.default.error("cannot normalize a zero-length quaternion. Returning an identity quaternion instead."),this.fromCopy4(0,0,0,1)):this._divide(t,r)}static normalizeTo(t,r){let n=t.length();return n===0?(h.default.error("cannot normalize a zero-length quaternion. The output is set to the identity quaternion."),r._v[0]=0,r._v[1]=0,r._v[2]=0,r._v[3]=1,r):this._divideTo(t,n,r)}fromToRotation(t,r){let n=M.fromCopyVector3(t),e=M.fromCopyVector3(r);n.normalize(),e.normalize();let i=n.dot(e);if(i>-1+Number.EPSILON){let o=Math.sqrt((1+i)*2),c=1/o,v=m.multiply(n.cross(e),c);return this._v[0]=v.x,this._v[1]=v.y,this._v[2]=v.z,this._v[3]=o*.5,this.constructor.normalize(this)}let a=m.fromCopy3(0,1,0),s=n.cross(a);return s.length()<Number.EPSILON&&(a=m.fromCopy3(1,0,0),s=n.cross(a)),s.normalize(),this.constructor.fromAxisAngle(s,Math.PI)}static fromToRotation(t,r){let n=m.dot(t,r)+1;if(n<Number.EPSILON){if(n=0,Math.abs(t.x)>Math.abs(t.z)){let a=this.fromCopy4(-t.y,t.x,0,n);return this.normalize(a)}let i=this.fromCopy4(0,-t.z,t.y,n);return this.normalize(i)}let e=this.fromCopy4(t.y*r.z-t.z*r.y,t.z*r.x-t.x*r.z,t.x*r.y-t.y*r.x,n);return this.normalize(e)}static fromToRotationTo(t,r,n){let e=m.dot(t,r)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(n._v[0]=-t.y,n._v[1]=t.x,n._v[2]=0,n._v[3]=e,n.normalize(),n):(n._v[0]=0,n._v[1]=-t.z,n._v[2]=t.y,n._v[3]=e,n.normalize(),n)):(n._v[0]=t.y*r.z-t.z*r.y,n._v[1]=t.z*r.x-t.x*r.z,n._v[2]=t.x*r.y-t.y*r.x,n._v[3]=e,n.normalize(),n)}transformVector3(t){let r=_.rv;r.setComponents(this._v[0],this._v[1],this._v[2]);let n=m.cross(r,t),e=m.cross(r,n),i=m.multiply(n,this._v[3]),a=m.add(e,i),s=m.multiply(a,2);return m.add(t,s)}transformVector3To(t,r){let n=_.rv;n.setComponents(this._v[0],this._v[1],this._v[2]);let e=m.crossTo(n,t,_.Yr),i=m.crossTo(n,e,_.Zr),a=m.multiplyTo(e,this._v[3],_._r),s=m.addTo(i,a,_.ev),o=m.multiplyTo(s,2,_.ov);return m.addTo(t,o,r)}transformVector3Inverse(t){return this.constructor.invert(this).transformVector3(t)}clone(){return this.constructor.fromCopy4(this._v[0],this._v[1],this._v[2],this._v[3])}static fromTypedArray(t){return new this(t)}static fromCopyArray4(t){return new this(new this._type(t))}static fromCopyArray(t){return new this(new this._type(t.slice(0,4)))}static fromCopy4(t,r,n,e){return new this(new this._type([t,r,n,e]))}static fromCopyQuaternion(t){let r=new this._type(4);return r[0]=t._v[0],r[1]=t._v[1],r[2]=t._v[2],r[3]=t._v[3],new this(r)}static fromCopyVector4(t){let r=new this._type(4);return r[0]=t._v[0],r[1]=t._v[1],r[2]=t._v[2],r[3]=t._v[3],new this(r)}static fromCopyLogQuaternion(t){let r=Math.hypot(t._v[0],t._v[1],t._v[2]),n=new this._type(4);if(r===0)return n[0]=0,n[1]=0,n[2]=0,n[3]=1,new this(n);let e=Math.sin(r);return n[0]=t._v[0]*(e/r),n[1]=t._v[1]*(e/r),n[2]=t._v[2]*(e/r),n[3]=Math.cos(r),new this(n)}static fromAxisAngle(t,r){r=r*.5;let n=Math.sin(r);return this.fromCopy4(n*t.x,n*t.y,n*t.z,Math.cos(r))}static fromAxisAngleTo(t,r,n){r=r*.5;let e=Math.sin(r);return n._v[0]=e*t.x,n._v[1]=e*t.y,n._v[2]=e*t.z,n._v[3]=Math.cos(r),n}static getQuaternionAngle(t){let r=Math.max(-1,Math.min(1,t.w));return 2*Math.acos(r)}static clampRotation(t,r){let n=this.getQuaternionAngle(t);if(n<=r)return t;let e=r/n,i=this.fromCopy4(0,0,0,1);return this.qlerp(i,t,e)}};Q._type=Float32Array,Q.tv=void 0,Q.Yr=M.zero(),Q.Zr=M.zero(),Q._r=M.zero(),Q.ev=M.zero(),Q.ov=M.zero(),Q.rv=M.zero();var _=class extends Q{constructor(t){super(t,{type:Float32Array})}static identity(){return super.identity()}static dummy(){return super.dummy()}static invert(t){return super.invert(t)}static invertTo(t,r){return super.invertTo(t,r)}static qlerp(t,r,n){return super.qlerp(t,r,n)}static qlerpTo(t,r,n,e){return super.qlerpTo(t,r,n,e)}static lerp(t,r,n){return super.lerp(t,r,n)}static lerpTo(t,r,n,e){return super.lerpTo(t,r,n,e)}static tryAxisAngle(t,r){return super.tryAxisAngle(t,r)}static axisAngle(t,r){return super.axisAngle(t,r)}static tryFromMatrix(t){return super.tryFromMatrix(t)}static fromMatrix(t){return super.fromMatrix(t)}static tryFromMatrixTo(t,r){return super.tryFromMatrixTo(t,r)}static fromMatrixTo(t,r){return super.fromMatrixTo(t,r)}static lookFromTo(t,r){return super.lookFromTo(t,r)}static tryLookForward(t){return super.tryLookForward(t)}static lookForward(t){return super.lookForward(t)}static tryLookForwardAccordingToThisUp(t,r){return super.tryLookForwardAccordingToThisUp(t,r)}static lookForwardAccordingToThisUp(t,r){return super.lookForwardAccordingToThisUp(t,r)}static fromPosition(t){return super.fromPosition(t)}static add(t,r){return super.add(t,r)}static addTo(t,r,n){return super.addTo(t,r,n)}static subtract(t,r){return super.subtract(t,r)}static subtractTo(t,r,n){return super.subtractTo(t,r,n)}static multiply(t,r){return super.multiply(t,r)}static multiplyTo(t,r,n){return super.multiplyTo(t,r,n)}static multiplyNumber(t,r){return super.multiplyNumber(t,r)}static multiplyNumberTo(t,r,n){return super.multiplyNumberTo(t,r,n)}static divideNumber(t,r){return super.divideNumber(t,r)}static divideNumberTo(t,r,n){return super.divideNumberTo(t,r,n)}static normalize(t){return super.normalize(t)}static normalizeTo(t,r){return super.normalizeTo(t,r)}static fromToRotation(t,r){return super.fromToRotation(t,r)}static fromToRotationTo(t,r,n){return super.fromToRotationTo(t,r,n)}static fromFloat32Array(t){return super.fromTypedArray(t)}static fromCopyArray4(t){return super.fromCopyArray4(t)}static fromCopyArray(t){return super.fromCopyArray(t)}static fromCopy4(t,r,n,e){return super.fromCopy4(t,r,n,e)}static fromCopyQuaternion(t){return super.fromCopyQuaternion(t)}static fromCopyVector4(t){return super.fromCopyVector4(t)}static fromCopyLogQuaternion(t){return super.fromCopyLogQuaternion(t)}static fromAxisAngle(t,r){return super.fromAxisAngle(t,r)}static fromAxisAngleTo(t,r,n){return super.fromAxisAngleTo(t,r,n)}static getQuaternionAngle(t){return super.getQuaternionAngle(t)}static clampRotation(t,r){return super.clampRotation(t,r)}},D=class extends Q{constructor(t){super(t,{type:Float64Array})}static identity(){return super.identity()}static dummy(){return super.dummy()}static invert(t){return super.invert(t)}static invertTo(t,r){return super.invertTo(t,r)}static qlerp(t,r,n){return super.qlerp(t,r,n)}static qlerpTo(t,r,n,e){return super.qlerpTo(t,r,n,e)}static lerp(t,r,n){return super.lerp(t,r,n)}static lerpTo(t,r,n,e){return super.lerpTo(t,r,n,e)}static tryAxisAngle(t,r){return super.tryAxisAngle(t,r)}static axisAngle(t,r){return super.axisAngle(t,r)}static tryFromMatrix(t){return super.tryFromMatrix(t)}static fromMatrix(t){return super.fromMatrix(t)}static tryFromMatrixTo(t,r){return super.tryFromMatrixTo(t,r)}static fromMatrixTo(t,r){return super.fromMatrixTo(t,r)}static lookFromTo(t,r){return super.lookFromTo(t,r)}static tryLookForward(t){return super.tryLookForward(t)}static lookForward(t){return super.lookForward(t)}static tryLookForwardAccordingToThisUp(t,r){return super.tryLookForwardAccordingToThisUp(t,r)}static lookForwardAccordingToThisUp(t,r){return super.lookForwardAccordingToThisUp(t,r)}static fromPosition(t){return super.fromPosition(t)}static add(t,r){return super.add(t,r)}static addTo(t,r,n){return super.addTo(t,r,n)}static subtract(t,r){return super.subtract(t,r)}static subtractTo(t,r,n){return super.subtractTo(t,r,n)}static multiply(t,r){return super.multiply(t,r)}static multiplyTo(t,r,n){return super.multiplyTo(t,r,n)}static multiplyNumber(t,r){return super.multiplyNumber(t,r)}static multiplyNumberTo(t,r,n){return super.multiplyNumberTo(t,r,n)}static divideNumber(t,r){return super.divideNumber(t,r)}static divideNumberTo(t,r,n){return super.divideNumberTo(t,r,n)}static normalize(t){return super.normalize(t)}static normalizeTo(t,r){return super.normalizeTo(t,r)}static fromToRotation(t,r){return super.fromToRotation(t,r)}static fromToRotationTo(t,r,n){return super.fromToRotationTo(t,r,n)}static fromFloat64Array(t){return super.fromTypedArray(t)}static fromCopyArray4(t){return super.fromCopyArray4(t)}static fromCopyArray(t){return super.fromCopyArray(t)}static fromCopy4(t,r,n,e){return super.fromCopy4(t,r,n,e)}static fromCopyQuaternion(t){return super.fromCopyQuaternion(t)}static fromCopyVector4(t){return super.fromCopyVector4(t)}static fromCopyLogQuaternion(t){return super.fromCopyLogQuaternion(t)}static fromAxisAngle(t,r){return super.fromAxisAngle(t,r)}static fromAxisAngleTo(t,r,n){return super.fromAxisAngleTo(t,r,n)}static getQuaternionAngle(t){return super.getQuaternionAngle(t)}static clampRotation(t,r){return super.clampRotation(t,r)}};D._type=Float64Array;export{_ as Quaternion,D as QuaternionD,_ as QuaternionF,Q as Quaternion_};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Matrix44 as I}from"./Matrix44.js";import{MutableMatrix44 as _}from"./MutableMatrix44.js";import{MutableQuaternion as l}from"./MutableQuaternion.js";import{MutableVector3 as h}from"./MutableVector3.js";import{Quaternion as q}from"./Quaternion.js";import{Vector3 as x}from"./Vector3.js";var i=class i{constructor(t){this.rt=0;this.hv=_.identity();this.lv=!1;this.uv=new Float64Array(3);this.pv=new Float64Array(4);this.mv=new Float64Array(3);this.sv=h.dummy(),this.av=h.dummy(),this.iv=l.dummy(),t!==void 0?this.setTransform(t.positionInner,t.scaleInner,l.fromCopyQuaternion(t.rotationInner)):(this.sv=h.zero(),this.av=h.one(),this.iv=l.identity())}isEqual(t,o=Number.EPSILON){return this.positionInner.isEqual(t.positionInner,o)&&this.rotationInner.isEqual(t.rotationInner,o)&&this.scaleInner.isEqual(t.scaleInner,o)}clone(){return new i(this)}set position(t){this.sv.copyComponents(t),this.cv("position")}setPositionAsArray3(t){this.sv._v[0]=t[0],this.sv._v[1]=t[1],this.sv._v[2]=t[2],this.cv("position")}get position(){return this.positionInner.clone()}get positionInner(){return this.sv}set eulerAngles(t){let o=Math.sin(t._v[0]*.5),s=Math.cos(t._v[0]*.5),r=Math.sin(t._v[1]*.5),e=Math.cos(t._v[1]*.5),c=Math.sin(t._v[2]*.5),a=Math.cos(t._v[2]*.5);this.rotation=l.fromCopy4(o*e*a-s*r*c,s*r*a+o*e*c,s*e*c-o*r*a,s*e*a+o*r*c)}get eulerAngles(){return this.eulerAnglesInner.clone()}get eulerAnglesInner(){return this.iv.toEulerAngles()}set scale(t){this.av.copyComponents(t),this.cv()}setScaleAsArray3(t){this.av._v[0]=t[0],this.av._v[1]=t[1],this.av._v[2]=t[2],this.cv()}get scale(){return this.scaleInner.clone()}get scaleInner(){return this.av}set rotation(t){this.iv.copyComponents(t),this.cv()}setRotationAsArray4(t){this.iv._v[0]=t[0],this.iv._v[1]=t[1],this.iv._v[2]=t[2],this.iv._v[3]=t[3],this.cv()}get rotation(){return this.rotationInner.clone()}get rotationInner(){return this.iv}cv(t="all"){if(this.rt++,t==="position"&&this.lv){let o=this.hv._v;o[12]=this.sv._v[0],o[13]=this.sv._v[1],o[14]=this.sv._v[2],this.uv.set(this.sv._v)}else this.lv=!1}set matrix(t){this.iv.fromMatrix(t),t.getTranslateTo(this.sv),t.getScaleTo(this.av),this.cv()}get matrix(){return this.matrixInner}get matrixInner(){return this.vv(),this.hv.clone()}yv(){let t=this.scaleInner,o=t._v[0],s=t._v[1],r=t._v[2],e=this.rotationInner,c=e._v[0]*e._v[0],a=e._v[1]*e._v[1],n=e._v[2]*e._v[2],p=e._v[1]*e._v[2],m=e._v[0]*e._v[2],v=e._v[0]*e._v[1],y=e._v[3]*e._v[0],M=e._v[3]*e._v[1],f=e._v[3]*e._v[2],A=1-2*(a+n),g=2*(v-f),V=2*(m+M),z=2*(v+f),C=1-2*(c+n),Q=2*(p-y),d=2*(m-M),w=2*(p+y),T=1-2*(c+a),u=this.positionInner;this.hv.setComponents(A*o,g*s,V*r,u.x,z*o,C*s,Q*r,u.y,d*o,w*s,T*r,u.z,0,0,0,1),this.uv.set(this.sv._v),this.pv.set(this.iv._v),this.mv.set(this.av._v)}vv(){if(!this.lv){this.yv(),this.lv=!0;return}let t=this.sv._v,o=this.iv._v,s=this.av._v,r=this.uv,e=this.pv,c=this.mv,a=!1;for(let n=0;n<4;n++)if(o[n]!==e[n]){a=!0;break}if(!a){for(let n=0;n<3;n++)if(s[n]!==c[n]){a=!0;break}}if(a){this.yv();return}if(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]){let n=this.hv._v;n[12]=t[0],n[13]=t[1],n[14]=t[2],r[0]=t[0],r[1]=t[1],r[2]=t[2]}}getMatrixInnerTo(t){this.vv(),t.copyComponents(this.hv)}get updateCount(){return this.rt}set rotateMatrix44(t){this.rotation=i.
|
|
1
|
+
import{Matrix44 as I}from"./Matrix44.js";import{MutableMatrix44 as _}from"./MutableMatrix44.js";import{MutableQuaternion as l}from"./MutableQuaternion.js";import{MutableVector3 as h}from"./MutableVector3.js";import{Quaternion as q}from"./Quaternion.js";import{Vector3 as x}from"./Vector3.js";var i=class i{constructor(t){this.rt=0;this.hv=_.identity();this.lv=!1;this.uv=new Float64Array(3);this.pv=new Float64Array(4);this.mv=new Float64Array(3);this.sv=h.dummy(),this.av=h.dummy(),this.iv=l.dummy(),t!==void 0?this.setTransform(t.positionInner,t.scaleInner,l.fromCopyQuaternion(t.rotationInner)):(this.sv=h.zero(),this.av=h.one(),this.iv=l.identity())}isEqual(t,o=Number.EPSILON){return this.positionInner.isEqual(t.positionInner,o)&&this.rotationInner.isEqual(t.rotationInner,o)&&this.scaleInner.isEqual(t.scaleInner,o)}clone(){return new i(this)}set position(t){this.sv.copyComponents(t),this.cv("position")}setPositionAsArray3(t){this.sv._v[0]=t[0],this.sv._v[1]=t[1],this.sv._v[2]=t[2],this.cv("position")}get position(){return this.positionInner.clone()}get positionInner(){return this.sv}set eulerAngles(t){let o=Math.sin(t._v[0]*.5),s=Math.cos(t._v[0]*.5),r=Math.sin(t._v[1]*.5),e=Math.cos(t._v[1]*.5),c=Math.sin(t._v[2]*.5),a=Math.cos(t._v[2]*.5);this.rotation=l.fromCopy4(o*e*a-s*r*c,s*r*a+o*e*c,s*e*c-o*r*a,s*e*a+o*r*c)}get eulerAngles(){return this.eulerAnglesInner.clone()}get eulerAnglesInner(){return this.iv.toEulerAngles()}set scale(t){this.av.copyComponents(t),this.cv()}setScaleAsArray3(t){this.av._v[0]=t[0],this.av._v[1]=t[1],this.av._v[2]=t[2],this.cv()}get scale(){return this.scaleInner.clone()}get scaleInner(){return this.av}set rotation(t){this.iv.copyComponents(t),this.cv()}setRotationAsArray4(t){this.iv._v[0]=t[0],this.iv._v[1]=t[1],this.iv._v[2]=t[2],this.iv._v[3]=t[3],this.cv()}get rotation(){return this.rotationInner.clone()}get rotationInner(){return this.iv}cv(t="all"){if(this.rt++,t==="position"&&this.lv){let o=this.hv._v;o[12]=this.sv._v[0],o[13]=this.sv._v[1],o[14]=this.sv._v[2],this.uv.set(this.sv._v)}else this.lv=!1}set matrix(t){this.iv.fromMatrix(t),t.getTranslateTo(this.sv),t.getScaleTo(this.av),this.cv()}get matrix(){return this.matrixInner}get matrixInner(){return this.vv(),this.hv.clone()}yv(){let t=this.scaleInner,o=t._v[0],s=t._v[1],r=t._v[2],e=this.rotationInner,c=e._v[0]*e._v[0],a=e._v[1]*e._v[1],n=e._v[2]*e._v[2],p=e._v[1]*e._v[2],m=e._v[0]*e._v[2],v=e._v[0]*e._v[1],y=e._v[3]*e._v[0],M=e._v[3]*e._v[1],f=e._v[3]*e._v[2],A=1-2*(a+n),g=2*(v-f),V=2*(m+M),z=2*(v+f),C=1-2*(c+n),Q=2*(p-y),d=2*(m-M),w=2*(p+y),T=1-2*(c+a),u=this.positionInner;this.hv.setComponents(A*o,g*s,V*r,u.x,z*o,C*s,Q*r,u.y,d*o,w*s,T*r,u.z,0,0,0,1),this.uv.set(this.sv._v),this.pv.set(this.iv._v),this.mv.set(this.av._v)}vv(){if(!this.lv){this.yv(),this.lv=!0;return}let t=this.sv._v,o=this.iv._v,s=this.av._v,r=this.uv,e=this.pv,c=this.mv,a=!1;for(let n=0;n<4;n++)if(o[n]!==e[n]){a=!0;break}if(!a){for(let n=0;n<3;n++)if(s[n]!==c[n]){a=!0;break}}if(a){this.yv();return}if(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]){let n=this.hv._v;n[12]=t[0],n[13]=t[1],n[14]=t[2],r[0]=t[0],r[1]=t[1],r[2]=t[2]}}getMatrixInnerTo(t){this.vv(),t.copyComponents(this.hv)}get updateCount(){return this.rt}set rotateMatrix44(t){this.rotation=i.Ql.fromMatrix(t)}get rotateMatrix44(){return I.fromCopyQuaternion(this.rotation)}setPropertiesFromJson(t){let o=t;typeof t=="string"&&(o=JSON.parse(t));for(let s in o)Object.hasOwn(o,s)&&s in this&&(s==="quaternion"?this.rotation=q.fromCopyArray4(o[s]):s==="matrix"?this[s]=I.fromCopyArray16RowMajor(o[s]):this[s]=x.fromCopyArray(o[s]))}setRotationFromNewUpAndFront(t,o){let s=t,r=h.crossTo(s,o,i.tr),e=h.crossTo(r,s,i.Ze),c=i.Ge.setComponents(r.x,s.x,e.x,0,r.y,s.y,e.y,0,r.z,s.z,e.z,0,0,0,0,1);this.rotateMatrix44=c}headToDirection(t,o){let s=i.tr.copyComponents(t).normalize(),r=i.Ze.copyComponents(o).normalize(),e=h.crossTo(s,r,i.$e),c=x.dot(s,r),a=Math.acos(c);this.rotation=i.Ql.axisAngle(e,a)}setTransform(t,o,s){this.sv=t.clone(),this.iv=s.clone(),this.av=o.clone(),this.cv()}};i.Ge=_.zero(),i.tr=h.zero(),i.Ze=h.zero(),i.$e=h.zero(),i.Ql=l.identity();var b=i;export{b as Transform3D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Vector3_ as a}from"../Vector3.js";var t=class{constructor(r,o){this.sv=r,this.by=o,this.sv.bytesPerComponent===4?this.
|
|
1
|
+
import{Vector3_ as a}from"../Vector3.js";var t=class{constructor(r,o){this.sv=r,this.by=o,this.sv.bytesPerComponent===4?this.Qe=Float32Array:this.Qe=Float64Array}get position(){return this.sv}get radius(){return this.by}calcCollision(r,o){let e=a._subtract(r,this.sv,this.Qe),s=a.dot(e,o),i=a.dot(e,e)-this.by*this.by;return!(i>0&&s>0||s*s-i<0)}},n=class extends t{},l=class extends t{};export{n as MathSphere,l as MathSphereD,t as MathSphere_};
|
|
@@ -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.Vb=0;this.Cb=new Float32Array;this.vb=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.Ib=1;this.Nb=!1;this.gb=!0;this.Mb=0;var I,B,S,f,n,m,x,E;this.Bb=s,this.Ab=s.byteOffsetInRawArrayBufferOfBuffer+e,this.p_=h,this.c_=t,this.Vb=r,this.Ib=_,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.gb=!1),this.Fp=c,this.Nb=A,this.hb=i,this.hb===0&&(this.hb=this.p_.getNumberOfComponents()*this.c_.getSizeInBytes()*this.Ib);let p=this.getTypedArrayClass(this.c_);this.Ob=p;let b=this.hb-this.p_.getNumberOfComponents()*this.c_.getSizeInBytes(),l=this.Fp.byteLength-this.Ab,v=this.byteStride*this.Vb-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.Vb}
|
|
7
|
+
this.__raw.byteLength - this.__byteOffsetInRawArrayBufferOfBuffer: ${this.Fp.byteLength-this.Ab}
|
|
8
|
+
this.byteStride * this.__count: ${this.byteStride*this.Vb}
|
|
9
9
|
maxExceededSizeOnAoS: ${b}
|
|
10
|
-
`),this.
|
|
10
|
+
`),this.Sb=new DataView(this.Fp,this.Ab,Math.min(this.hb*this.Vb,this.Fp.byteLength-this.Ab)),this.Ab%p.BYTES_PER_ELEMENT===0?this.Cb=new p(this.Fp,this.Ab,this.p_.getNumberOfComponents()*this.Vb):(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.Tb()),this.bb=this.Sb[this.getDataViewGetter(this.c_)].bind(this.Sb),this.yb=this.Sb[this.getDataViewSetter(this.c_)].bind(this.Sb)}Tb(){let s=this.getTypedArrayClass(this.c_),e=this.Fp.slice(this.Ab,this.Ab+this.p_.getNumberOfComponents()*this.Vb*s.BYTES_PER_ELEMENT);this.Cb=new s(e)}_b(){var s;this.Mb++,this._primitive!=null&&((s=this._primitive.deref())==null||s.onAccessorUpdated(this.Mb))}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.vb>=this.Vb&&V.default.error("You are trying to allocate more than you have secured.");let e=new this.Ob(s,this.Ab+this.hb*this.vb,this.p_.getNumberOfComponents()*this.Ib);return e._accessor=this,e._idx_of_accessor=this.vb,this.vb+=1,e}_takeExistedOne(s){let e=this.Fp;s>=this.Vb&&V.default.error("You are trying to allocate more than you have secured.");let h=new this.Ob(e,this.Ab+this.hb*s,this.p_.getNumberOfComponents()*this.Ib);return h._accessor=this,h._idx_of_accessor=s,h}get takenCount(){return this.vb}get numberOfComponents(){return this.p_.getNumberOfComponents()}get componentSizeInBytes(){return this.c_.getSizeInBytes()}get elementSizeInBytes(){return this.numberOfComponents*this.componentSizeInBytes}get elementCount(){return this.Vb}get byteLength(){return this.hb*this.Vb}get componentType(){return this.c_}get compositionType(){return this.p_}getTypedArray(){return this.Cb}setTypedArray(s){if(s.buffer!==this.Fp){if(this.p_===g.Scalar)for(let e=0;e<this.Vb;e++)this.setScalar(e,s[e],{endian:!0});else if(this.p_===g.Vec2)for(let e=0;e<this.Vb;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.Vb;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.Vb;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.Vb;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.Vb;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.Tb()}}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.bb(this.hb*t,h)}getScalarAt(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;return h&&(i=h.getScalar(s,{})),this.bb(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.bb(this.hb*t,h),this.bb(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.bb(this.hb*t,h),this.bb(this.hb*t+1*i,h),this.bb(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.bb(this.hb*t,h),this.bb(this.hb*t+1*i,h),this.bb(this.hb*t+2*i,h),this.bb(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.bb(this.hb*t,h),this.bb(this.hb*t+1*i,h),this.bb(this.hb*t+2*i,h),this.bb(this.hb*t+3*i,h),this.bb(this.hb*t+4*i,h),this.bb(this.hb*t+5*i,h),this.bb(this.hb*t+6*i,h),this.bb(this.hb*t+7*i,h),this.bb(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.bb(this.hb*t,h),this.bb(this.hb*t+1*i,h),this.bb(this.hb*t+2*i,h),this.bb(this.hb*t+3*i,h),this.bb(this.hb*t+4*i,h),this.bb(this.hb*t+5*i,h),this.bb(this.hb*t+6*i,h),this.bb(this.hb*t+7*i,h),this.bb(this.hb*t+8*i,h),this.bb(this.hb*t+9*i,h),this.bb(this.hb*t+10*i,h),this.bb(this.hb*t+11*i,h),this.bb(this.hb*t+12*i,h),this.bb(this.hb*t+13*i,h),this.bb(this.hb*t+14*i,h),this.bb(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.bb(this.hb*t,h),this.bb(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.bb(this.hb*t,h),this.bb(this.hb*t+1*i,h),this.bb(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.bb(this.hb*t,h),this.bb(this.hb*t+1*i,h),this.bb(this.hb*t+2*i,h),this.bb(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.bb(this.hb*t,h),this.bb(this.hb*t+1*i,h),this.bb(this.hb*t+2*i,h),this.bb(this.hb*t+3*i,h),this.bb(this.hb*t+4*i,h),this.bb(this.hb*t+5*i,h),this.bb(this.hb*t+6*i,h),this.bb(this.hb*t+7*i,h),this.bb(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.bb(this.hb*t,h),this.bb(this.hb*t+1*i,h),this.bb(this.hb*t+2*i,h),this.bb(this.hb*t+3*i,h),this.bb(this.hb*t+4*i,h),this.bb(this.hb*t+5*i,h),this.bb(this.hb*t+6*i,h),this.bb(this.hb*t+7*i,h),this.bb(this.hb*t+8*i,h),this.bb(this.hb*t+9*i,h),this.bb(this.hb*t+10*i,h),this.bb(this.hb*t+11*i,h),this.bb(this.hb*t+12*i,h),this.bb(this.hb*t+13*i,h),this.bb(this.hb*t+14*i,h),this.bb(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.bb(this.hb*i,t),this.bb(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.bb(this.hb*i,t),this.bb(this.hb*i+1*r,t),this.bb(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.bb(this.hb*i,t),this.bb(this.hb*i+1*r,t),this.bb(this.hb*i+2*r,t),this.bb(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.bb(this.hb*i,t),this.bb(this.hb*i+1*r,t),this.bb(this.hb*i+2*r,t),this.bb(this.hb*i+3*r,t),this.bb(this.hb*i+4*r,t),this.bb(this.hb*i+5*r,t),this.bb(this.hb*i+6*r,t),this.bb(this.hb*i+7*r,t),this.bb(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.bb(this.hb*i,t),this.bb(this.hb*i+1*r,t),this.bb(this.hb*i+2*r,t),this.bb(this.hb*i+3*r,t),this.bb(this.hb*i+4*r,t),this.bb(this.hb*i+5*r,t),this.bb(this.hb*i+6*r,t),this.bb(this.hb*i+7*r,t),this.bb(this.hb*i+8*r,t),this.bb(this.hb*i+9*r,t),this.bb(this.hb*i+10*r,t),this.bb(this.hb*i+11*r,t),this.bb(this.hb*i+12*r,t),this.bb(this.hb*i+13*r,t),this.bb(this.hb*i+14*r,t),this.bb(this.hb*i+15*r,t))}setScalar(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{})),this.yb(this.hb*i,e,t),this.gb=!0,this._b()}setVec2(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{}));let c=this.componentSizeInBytes;this.yb(this.hb*r,e,i),this.yb(this.hb*r+1*c,h,i),this.gb=!0,this._b()}setVec3(s,e,h,t,{indicesAccessor:i,endian:r=!0}){let c=s;i&&(c=i.getScalar(s,{}));let u=this.componentSizeInBytes;this.yb(this.hb*c,e,r),this.yb(this.hb*c+1*u,h,r),this.yb(this.hb*c+2*u,t,r),this.gb=!0,this._b()}setVec4(s,e,h,t,i,{indicesAccessor:r,endian:c=!0}){let u=s;r&&(u=r.getScalar(s,{}));let y=this.componentSizeInBytes;this.yb(this.hb*u,e,c),this.yb(this.hb*u+1*y,h,c),this.yb(this.hb*u+2*y,t,c),this.yb(this.hb*u+3*y,i,c),this.gb=!0,this._b()}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.yb(this.hb*b,e,p),this.yb(this.hb*b+1*l,h,p),this.yb(this.hb*b+2*l,t,p),this.yb(this.hb*b+3*l,i,p),this.yb(this.hb*b+4*l,r,p),this.yb(this.hb*b+5*l,c,p),this.yb(this.hb*b+6*l,u,p),this.yb(this.hb*b+7*l,y,p),this.yb(this.hb*b+8*l,_,p),this.gb=!0,this._b()}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.yb(this.hb*n,e,f),this.yb(this.hb*n+1*m,h,f),this.yb(this.hb*n+2*m,t,f),this.yb(this.hb*n+3*m,i,f),this.yb(this.hb*n+4*m,r,f),this.yb(this.hb*n+5*m,c,f),this.yb(this.hb*n+6*m,u,f),this.yb(this.hb*n+7*m,y,f),this.yb(this.hb*n+8*m,_,f),this.yb(this.hb*n+9*m,A,f),this.yb(this.hb*n+10*m,p,f),this.yb(this.hb*n+11*m,b,f),this.yb(this.hb*n+12*m,l,f),this.yb(this.hb*n+13*m,v,f),this.yb(this.hb*n+14*m,I,f),this.yb(this.hb*n+15*m,B,f),this.gb=!0,this._b()}setVec2AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.yb(this.hb*i,e.x,t),this.yb(this.hb*i+1*r,e.y,t),this.gb=!0,this._b()}setVec3AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.yb(this.hb*i,e.x,t),this.yb(this.hb*i+1*r,e.y,t),this.yb(this.hb*i+2*r,e.z,t),this.gb=!0,this._b()}setVec4AsVector(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.yb(this.hb*i,e.x,t),this.yb(this.hb*i+1*r,e.y,t),this.yb(this.hb*i+2*r,e.z,t),this.yb(this.hb*i+3*r,e.w,t),this.gb=!0,this._b()}setMat4AsMatrix44(s,e,{indicesAccessor:h,endian:t=!0}){let i=s;h&&(i=h.getScalar(s,{}));let r=this.componentSizeInBytes;this.yb(this.hb*i,e._v[0],t),this.yb(this.hb*i+1*r,e._v[1],t),this.yb(this.hb*i+2*r,e._v[2],t),this.yb(this.hb*i+3*r,e._v[3],t),this.yb(this.hb*i+4*r,e._v[4],t),this.yb(this.hb*i+5*r,e._v[5],t),this.yb(this.hb*i+6*r,e._v[6],t),this.yb(this.hb*i+7*r,e._v[7],t),this.yb(this.hb*i+8*r,e._v[8],t),this.yb(this.hb*i+9*r,e._v[9],t),this.yb(this.hb*i+10*r,e._v[10],t),this.yb(this.hb*i+11*r,e._v[11],t),this.yb(this.hb*i+12*r,e._v[12],t),this.yb(this.hb*i+13*r,e._v[13],t),this.yb(this.hb*i+14*r,e._v[14],t),this.yb(this.hb*i+15*r,e._v[15],t),this.gb=!0,this._b()}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.gb=!0,this._b()}setScalarAt(s,e,h,{indicesAccessor:t,endian:i=!0}){let r=s;t&&(r=t.getScalar(s,{})),this.yb(this.hb*r+e,h,i),this.gb=!0,this._b()}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.gb=!0,this._b()}copyBuffer(s){new Uint8Array(this.Fp).set(new Uint8Array(s.Fp,s.Ab,s.byteLength),this.Ab),this.gb=!0,this._b()}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.gb=!0,this._b()}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.gb=!0,this._b()}get arrayBufferOfBufferView(){return this.Fp}get dataViewOfBufferView(){return this.Sb}get byteOffsetInBufferView(){return this.Ab-this.Bb.byteOffsetInRawArrayBufferOfBuffer}get byteOffsetInBuffer(){return this.Ab-this.Bb.buffer.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this.Ab}get bufferView(){return this.Bb}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.gb=!1}get min(){this.gb&&this.xb();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.gb&&this.xb();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.Nb}xb(){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.Eb;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.gb=!1}get isMinMaxDirty(){return this.gb}get version(){return this.Mb}get actualByteStride(){return this.hb===0?this.p_.getNumberOfComponents()*this.c_.getSizeInBytes()*this.Ib: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.Eb=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.Ab=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.Ab-this.Cy.byteOffsetInRawArrayBuffer}get byteOffsetInRawArrayBufferOfBuffer(){return this.Ab}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.Ab,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};
|
|
@@ -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};
|
|
@@ -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.WR=[];this.bR=[];this._R=[];this.vR=[];this.yR=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.ER()}setToRenderBlendWithoutZWritePrimitives(e){this._toRenderBlendWithoutZWritePrimitives=e,this.ER()}setToRenderBlendWithZWritePrimitives(e){this._toRenderBlendWithZWritePrimitives=e,this.ER()}setToRenderTranslucentPrimitives(e){this._toRenderTranslucentPrimitives=e,this.ER()}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.WR=this.WR.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.yR=new Map(this.yR),e.isVrRendering=this.isVrRendering,e.isOutputForVr=this.isOutputForVr,e._toRenderOpaquePrimitives=this._toRenderOpaquePrimitives,e._toRenderTranslucentPrimitives=this._toRenderTranslucentPrimitives,e._toRenderBlendWithoutZWritePrimitives=this._toRenderBlendWithoutZWritePrimitives,e.FR=this.FR,e.MR=this.MR,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.FR=e}setPostRenderFunction(e){this.MR=e}doPreRender(){this.FR!=null&&this.FR()}doPostRender(){this.MR!=null&&this.MR()}addEntities(e){for(let t of e){if(t===void 0)continue;let i=t.getSceneGraph();this.WR.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.ER(),this.bR=[],this.xR()}ER(){this._R=[],this.vR=[],this.UR()}get entities(){return this.Gp}clearEntities(){this._R=[],this.vR=[],this.bR=[],this.Gp=[]}xR(){let e=i=>(i.parent&&e(i.parent),i);this.bR=this.WR.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.yR.set(t.objectUID,new WeakRef(e))}setMaterial(e){this.kp=e}get material(){return this.kp}_getMaterialOf(e){var t;return(t=this.yR.get(e.objectUID))==null?void 0:t.deref()}getAppropriateMaterial(e){let t=this.yR.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};
|