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
package/README.md
CHANGED
|
@@ -19,6 +19,9 @@ https://librn.com/
|
|
|
19
19
|
* Physically-based Rendering with Image-based Lighting
|
|
20
20
|
* Clustered Forward Rendering
|
|
21
21
|
* GPU frustum culling (including skinned and morph meshes)
|
|
22
|
+
* Temporal anti-aliasing (with motion vectors of skinned and morphed meshes)
|
|
23
|
+
* WebGL2 multi-draw batching
|
|
24
|
+
* Tree-shakeable ES modules
|
|
22
25
|
* Node-based Shader System
|
|
23
26
|
* Node-based Raymarching System (with integration to polygon rendering)
|
|
24
27
|
* Support loading the following 3D model files: [glTF2](https://github.com/KhronosGroup/glTF), glTF1, [VRM](https://vrm.dev/en/)
|
|
@@ -71,10 +74,6 @@ You can install Rhodonite easily.
|
|
|
71
74
|
$ npm install rhodonite
|
|
72
75
|
```
|
|
73
76
|
|
|
74
|
-
### Note
|
|
75
|
-
|
|
76
|
-
If you get an error like "webxr-input-profiles not found" when building a project using Rhodonite, Try "npm install" or "pnpm install" again.
|
|
77
|
-
|
|
78
77
|
## Migration to WebGL2 mode
|
|
79
78
|
|
|
80
79
|
- `ProcessApproach.Uniform` was removed. Use `ProcessApproach.WebGL2`.
|
|
@@ -114,12 +113,46 @@ If you get an error like "webxr-input-profiles not found" when building a projec
|
|
|
114
113
|
|
|
115
114
|
There are two package versions of Rhodonite: ESModule and IIFE.
|
|
116
115
|
|
|
117
|
-
#### Using ESModule package
|
|
116
|
+
#### Using the ESModule package
|
|
117
|
+
|
|
118
|
+
##### With a bundler
|
|
119
|
+
|
|
120
|
+
Import the package by its name. The bundler resolves `rhodonite` to `dist/esm/index.js` through the `exports` field of
|
|
121
|
+
`package.json`.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// main.ts
|
|
125
|
+
import Rn from 'rhodonite';
|
|
126
|
+
// import Rn from 'rhodonite/dist/esmdev/index.js'; // use this if you want to display the source map or step through the library
|
|
127
|
+
|
|
128
|
+
// Init Rhodonite
|
|
129
|
+
const engine = await Rn.Engine.init({
|
|
130
|
+
approach: Rn.ProcessApproach.WebGL2,
|
|
131
|
+
canvas: document.getElementById('world') as HTMLCanvasElement,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// create a Plane mesh
|
|
135
|
+
const planeEntity = Rn.MeshHelper.createPlane(engine);
|
|
136
|
+
planeEntity.eulerAngles = Rn.Vector3.fromCopy3(Math.PI * 0.5, 0, 0);
|
|
137
|
+
|
|
138
|
+
// Render Loop
|
|
139
|
+
engine.startRenderLoop(() => {
|
|
140
|
+
engine.processAuto();
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The `esmdev` build is not minified and carries inline source maps, so keep it for development and switch back to
|
|
145
|
+
`rhodonite` for production builds.
|
|
146
|
+
|
|
147
|
+
The default export `Rn` references every export, so it always bundles the whole library. To keep only what you use in
|
|
148
|
+
the bundle, import the functions by name instead. See [Tree shaking](#tree-shaking).
|
|
118
149
|
|
|
119
|
-
|
|
150
|
+
##### Without a bundler
|
|
151
|
+
|
|
152
|
+
A browser cannot resolve the bare specifier `rhodonite` by itself, so import the built file directly.
|
|
120
153
|
|
|
121
154
|
```html
|
|
122
|
-
<script type="module" src="main.js">
|
|
155
|
+
<script type="module" src="main.js"></script>
|
|
123
156
|
```
|
|
124
157
|
|
|
125
158
|
```typescript
|
|
@@ -143,13 +176,30 @@ engine.startRenderLoop(() => {
|
|
|
143
176
|
});
|
|
144
177
|
```
|
|
145
178
|
|
|
179
|
+
Alternatively, keep the bare specifier with an
|
|
180
|
+
[import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap). It has to be declared
|
|
181
|
+
before any module script:
|
|
182
|
+
|
|
183
|
+
```html
|
|
184
|
+
<script type="importmap">
|
|
185
|
+
{
|
|
186
|
+
"imports": {
|
|
187
|
+
"rhodonite": "./node_modules/rhodonite/dist/esm/index.js"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
</script>
|
|
191
|
+
<script type="module" src="main.js"></script>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Either way, `tsconfig.json` looks like this:
|
|
195
|
+
|
|
146
196
|
```
|
|
147
197
|
// tsconfig.json
|
|
148
198
|
{
|
|
149
199
|
...
|
|
150
200
|
"compilerOptions": {
|
|
151
201
|
"module": "ESNext",
|
|
152
|
-
"moduleResolution": "
|
|
202
|
+
"moduleResolution": "bundler",
|
|
153
203
|
"esModuleInterop": true,
|
|
154
204
|
...
|
|
155
205
|
}
|
|
@@ -157,17 +207,15 @@ engine.startRenderLoop(() => {
|
|
|
157
207
|
}
|
|
158
208
|
```
|
|
159
209
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
import Rn from 'rhodonite';
|
|
164
|
-
```
|
|
210
|
+
`"moduleResolution": "bundler"` (or `"node16"` / `"nodenext"`) is needed for TypeScript to read the `exports` field
|
|
211
|
+
of `package.json`, which the `rhodonite/optional-materials` subpath relies on.
|
|
165
212
|
|
|
166
213
|
#### Tree shaking
|
|
167
214
|
|
|
168
|
-
The ESModule packages (`dist/esm`, `dist/esmdev`) keep one file per source module, and
|
|
169
|
-
|
|
170
|
-
and the bundler leaves the rest of Rhodonite
|
|
215
|
+
The ESModule packages (`dist/esm`, `dist/esmdev`) keep one file per source module, and `package.json` marks every
|
|
216
|
+
module except the shared dependency chunks (`_deps/chunk-*.js`) as free of side effects. With a bundler (Vite,
|
|
217
|
+
Rollup, Rolldown, webpack, esbuild, ...), import what you use by name and the bundler leaves the rest of Rhodonite
|
|
218
|
+
out of your bundle:
|
|
171
219
|
|
|
172
220
|
```typescript
|
|
173
221
|
import { Engine, MeshHelper, ProcessApproach, Vector3 } from 'rhodonite';
|
|
@@ -184,6 +232,15 @@ The default export `Rn` references every export, so `import Rn from 'rhodonite'`
|
|
|
184
232
|
Likewise, `MaterialHelper.createXxxMaterial()` bundles every material; import the functions instead
|
|
185
233
|
(`import { createPbrUberMaterial } from 'rhodonite'`).
|
|
186
234
|
|
|
235
|
+
The node-based material, raymarching and MToon factories are not exported from the package root, because they
|
|
236
|
+
pull in the whole shader node library. Import them from the `rhodonite/optional-materials` subpath:
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
import { createMToon1Material, createNodeBasedCustomMaterial } from 'rhodonite/optional-materials';
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
The glTF/VRM importer loads what it needs from there by itself.
|
|
243
|
+
|
|
187
244
|
An application that uses only one rendering backend can drop the shaders of the other one by defining a flag in its
|
|
188
245
|
bundler. Without the flags, the shaders of both backends are kept.
|
|
189
246
|
|
|
@@ -287,7 +344,7 @@ $ E2E_WEBGPU_SMOKE=1 pnpm run test-e2e
|
|
|
287
344
|
|
|
288
345
|
With `E2E_WEBGPU_SMOKE=1` the WebGPU samples only have to reach their render loop; no screenshot comparison is performed.
|
|
289
346
|
|
|
290
|
-
The E2E runner passes the Mesa-specific flags automatically on Linux. Set `E2E_SOFTWARE_RENDERING=0` to opt out, or `PUPPETEER_EXECUTABLE_PATH` to use a specific Chrome binary. `E2E_REFERENCE_FAILURE_THRESHOLD` (percent, default `0`) is a tolerance floor for the reference environment
|
|
347
|
+
The E2E runner passes the Mesa-specific flags automatically on Linux. Set `E2E_SOFTWARE_RENDERING=0` to opt out, or `PUPPETEER_EXECUTABLE_PATH` to use a specific Chrome binary. `E2E_REFERENCE_FAILURE_THRESHOLD` (percent, default `0`) is a tolerance floor for the reference environment (any Linux run); the CI workflow does not set it, so CI compares strictly. `E2E_NON_REFERENCE_FAILURE_THRESHOLD` (default `2`, percent) is the floor used outside the reference environment; `E2E_REFERENCE_ENVIRONMENT=0` forces that floor on Linux too.
|
|
291
348
|
|
|
292
349
|
You can execute a part of tests like this.
|
|
293
350
|
|
|
@@ -307,9 +364,21 @@ $ pnpm run test-unit-part -- ./src/foundation/core/Entity.test.ts
|
|
|
307
364
|
$ pnpm run test-e2e-part -- ./samples/test_e2e/DataTextureInstancedDrawing
|
|
308
365
|
```
|
|
309
366
|
|
|
367
|
+
The E2E tests run the compiled samples, so run `pnpm run build-samples` first.
|
|
368
|
+
|
|
369
|
+
`pnpm run test-e2e-update` rewrites the reference images that currently fail, in the current environment. To update the reference images of one sample in the reference environment, open the container shell (`pnpm test-e2e:docker:shell`) and run:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
$ npx vitest run --config ./config/test/vitest.config.e2e.ts ./samples/test_e2e/<Sample> --update=all
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
This rewrites only the reference images that fail. To regenerate every reference image of that sample, prefix the command with `E2E_UPDATE_ALL_SNAPSHOTS=1`.
|
|
376
|
+
|
|
377
|
+
(`--update` takes an optional value, so `--update ./samples/<Sample>` would swallow the path and update the whole suite.)
|
|
378
|
+
|
|
310
379
|
### Running the E2E suite in the CI environment (Docker)
|
|
311
380
|
|
|
312
|
-
The E2E job runs on `ubuntu-
|
|
381
|
+
The E2E job runs on `ubuntu-24.04-arm` with Mesa's software stack (llvmpipe for GL, lavapipe for Vulkan). To reproduce exactly the same environment on any machine with Docker:
|
|
313
382
|
|
|
314
383
|
```bash
|
|
315
384
|
$ pnpm test-e2e:docker # run the full E2E suite in the container
|
|
@@ -335,12 +404,17 @@ After a new dev container window opens, You can work in the Debian Linux contain
|
|
|
335
404
|
|
|
336
405
|
## Debugging inside VSCode (Step execution in VSCode Debug tab)
|
|
337
406
|
|
|
338
|
-
1.
|
|
407
|
+
1. Use VSCode's built-in JavaScript debugger (the old "Debugger for Chrome" extension is deprecated and no longer needed).
|
|
339
408
|
2. Start the local server with `$ pnpm start`.
|
|
340
409
|
3. Push the run icon by choosing "Launch Chrome to debug Rhodonite samples" in the RUN tab of VSCode's left pane to start debugging.
|
|
341
410
|
|
|
342
411
|
If you use the VSCode devcontainer environment, You should open another RhodoniteTS VSCode window locally and do debug ops on it instead of the devcontainer VSCode window.
|
|
343
412
|
|
|
413
|
+
## Documentation
|
|
414
|
+
|
|
415
|
+
- [docs/](docs/README.md): architecture, API tour and developer workflow
|
|
416
|
+
- [docs/design-notes/](docs/design-notes/README.md): why the rendering and performance features (Clustered Forward, GPU culling, TAA, multi-draw, tree shaking, ...) are built the way they are, with the measurements behind their defaults
|
|
417
|
+
|
|
344
418
|
## Contributing
|
|
345
419
|
|
|
346
420
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on setting up the project, running tests and submitting pull requests.
|
package/VERSION-FILE
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
v0.
|
|
1
|
+
v0.26.0-1-g0df3359c4-dirty
|
|
2
2
|
main
|
|
@@ -91,6 +91,60 @@ export declare class BlendShapeComponent extends Component {
|
|
|
91
91
|
*/
|
|
92
92
|
setWeightByIndex(index: Index, weight: number): void;
|
|
93
93
|
static getOffsetsInUniform(engine: Engine): Offset[];
|
|
94
|
+
/**
|
|
95
|
+
* The number of vec4 of the blend shape weights in the morph weights uniform buffer of the shaders.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* With `Engine._isPreviousMorphWeightsEnabled` (temporal anti-aliasing), the buffer also holds the weights of the
|
|
99
|
+
* previous frame after the current ones (at `getPreviousMorphWeightsOffset`), which doubles it.
|
|
100
|
+
*
|
|
101
|
+
* @param engine - The engine instance
|
|
102
|
+
* @returns The array length (in vec4) of the morph weights uniform buffer
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
static _getMorphWeightsVec4Count(engine: Engine): number;
|
|
106
|
+
/**
|
|
107
|
+
* The offset (in floats) of the weights of the previous frame in the morph weights uniform buffer.
|
|
108
|
+
* Only meaningful when `Engine._isPreviousMorphWeightsEnabled` is true.
|
|
109
|
+
*
|
|
110
|
+
* @param engine - The engine instance
|
|
111
|
+
* @returns The offset in floats
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
static _getPreviousMorphWeightsOffset(engine: Engine): number;
|
|
115
|
+
/**
|
|
116
|
+
* The size (in floats) of the morph weights uniform buffer allocated by the rendering strategies.
|
|
117
|
+
*
|
|
118
|
+
* @param engine - The engine instance
|
|
119
|
+
* @returns The number of floats
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
static _getMorphWeightsUniformBufferFloatCount(engine: Engine): number;
|
|
123
|
+
/**
|
|
124
|
+
* Writes the blend shape weights of all components into the data of the morph weights uniform buffer.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* With `Engine._isPreviousMorphWeightsEnabled`, the weights written by the previous call (the weights of the
|
|
128
|
+
* previous frame) are first moved to the previous weights section. For a new buffer (`isNewBuffer`), the previous
|
|
129
|
+
* weights are the current ones (no motion).
|
|
130
|
+
*
|
|
131
|
+
* @param engine - The engine instance
|
|
132
|
+
* @param array - The data of the morph weights uniform buffer
|
|
133
|
+
* @param isNewBuffer - Whether the buffer was just created
|
|
134
|
+
* @returns The number of floats to upload from the beginning of the array
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
static _writeMorphWeightsUniformArray(engine: Engine, array: Float32Array, isNewBuffer: boolean): number;
|
|
138
|
+
/**
|
|
139
|
+
* Makes the previous weights section equal to the current weights, in the frame after the weights stopped
|
|
140
|
+
* changing (until then, it still holds the weights of two frames ago).
|
|
141
|
+
*
|
|
142
|
+
* @param engine - The engine instance
|
|
143
|
+
* @param array - The data of the morph weights uniform buffer
|
|
144
|
+
* @returns The number of floats to upload, or 0 if nothing changed
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
static _settlePreviousMorphWeights(engine: Engine, array: Float32Array): number;
|
|
94
148
|
static getCountOfBlendShapeComponents(engine: Engine): number;
|
|
95
149
|
/**
|
|
96
150
|
* Logic processing method called during the logic stage.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as
|
|
1
|
+
import{Component as c}from"../../core/Component.js";import{applyMixins as y}from"../../core/EntityRepository.js";import{ProcessStage as C}from"../../definitions/ProcessStage.js";import{WellKnownComponentTIDs as m}from"../WellKnownComponentTIDs.js";var e=class e extends c{constructor(t,n,s,o,i){super(t,n,s,o,i);this.We=[];this.Ae=!1;this.Ve=[];e.Be++,this.moveStageTo(C.Logic)}static get updateCount(){return e.rt}static get componentTID(){return m.BlendShapeComponentTID}get componentTID(){return m.BlendShapeComponentTID}set weights(t){this.We.length!==t.length&&e.Be++,this.We=t,this.Ae=!1,e.Re[this.componentSID]=t.length,e.rt++}get weights(){return this.We}set targetNames(t){this.Ve=t,e.rt++}get targetNames(){return this.Ve}Ke(){this.Ae||(this.We=this.We.slice(),this.Ae=!0)}setWeightsFromArrayLike(t){let n=t.length;if(this.We.length!==n){let o=new Array(n);for(let i=0;i<n;i++)o[i]=t[i];this.We=o,this.Ae=!0,e.Re[this.componentSID]=n,e.Be++,e.rt++;return}this.Ke();let s=!1;for(let o=0;o<n;o++){let i=t[o];this.We[o]!==i&&(this.We[o]=i,s=!0)}s&&e.rt++}setWeightByIndex(t,n){this.We[t]!==n&&(this.Ke(),t>=this.We.length&&e.Be++,this.We[t]=n,e.Re[this.componentSID]=this.We.length,e.rt++)}static getOffsetsInUniform(t){var i;let n=e.je.get(t);if(n!==void 0&&n.layoutVersion===e.Be)return n.offsets;let s=t.componentRepository.getComponentsWithTypeWithoutFiltering(e),o=[0];for(let r=0;r<s.length;r++){let p=s[r]!=null?s[r].weights.length:(i=e.Re[r])!=null?i:0;o.push(o[o.length-1]+p)}return e.je.set(t,{layoutVersion:e.Be,offsets:o}),o}static _getMorphWeightsVec4Count(t){let n=e.getOffsetsInUniform(t),s=Math.max(Math.ceil(n[n.length-1]/4),1);return t._isPreviousMorphWeightsEnabled?s*2:s}static _getPreviousMorphWeightsOffset(t){let n=e.getOffsetsInUniform(t);return Math.max(Math.ceil(n[n.length-1]/4),1)*4}static _getMorphWeightsUniformBufferFloatCount(t){let n=e.getOffsetsInUniform(t),s=Math.max(Math.ceil(n[n.length-1]/4)*4*4,4);return t._isPreviousMorphWeightsEnabled?s*2:s}static _writeMorphWeightsUniformArray(t,n,s){let o=e.getOffsetsInUniform(t),i=o[o.length-1],r=t._isPreviousMorphWeightsEnabled,p=e._getPreviousMorphWeightsOffset(t);r&&!s&&n.copyWithin(p,0,i);let a=t.componentRepository.getComponentsWithTypeWithoutFiltering(e);for(let h=0;h<a.length;h++){let l=a[h],u=l!=null?l.weights:[];for(let f=0;f<u.length;f++)n[o[h]+f]=u[f]}return r&&s&&n.copyWithin(p,0,i),r?p+i:i}static _settlePreviousMorphWeights(t,n){if(!t._isPreviousMorphWeightsEnabled)return 0;let s=e.getOffsetsInUniform(t),o=s[s.length-1],i=e._getPreviousMorphWeightsOffset(t),r=!0;for(let p=0;p<o;p++)if(n[i+p]!==n[p]){r=!1;break}return r?0:(n.copyWithin(i,0,o),i+o)}static getCountOfBlendShapeComponents(t){return t.componentRepository.getComponentCount(e.componentTID)}$logic(){}_destroy(){e.Be++,super._destroy()}addThisComponentToEntity(t,n){class s extends t.constructor{getBlendShape(){return this.getComponentByComponentTID(m.BlendShapeComponentTID)}}return y(t,s),t}};e.rt=0,e.Re=[],e.Be=0,e.je=new WeakMap;var g=e;export{g as BlendShapeComponent};
|
|
@@ -5,10 +5,12 @@ import { type EntityRepository } from '../../core/EntityRepository';
|
|
|
5
5
|
import { type CameraTypeEnum } from '../../definitions/CameraType';
|
|
6
6
|
import { Frustum } from '../../geometry/Frustum';
|
|
7
7
|
import type { ICameraEntity } from '../../helpers/EntityHelper';
|
|
8
|
+
import type { IVector2 } from '../../math/IVector';
|
|
8
9
|
import { Matrix44 } from '../../math/Matrix44';
|
|
9
10
|
import { MutableMatrix44 } from '../../math/MutableMatrix44';
|
|
10
11
|
import { MutableVector3 } from '../../math/MutableVector3';
|
|
11
12
|
import { MutableVector4 } from '../../math/MutableVector4';
|
|
13
|
+
import type { Vector2 } from '../../math/Vector2';
|
|
12
14
|
import { Vector3 } from '../../math/Vector3';
|
|
13
15
|
import { Vector4 } from '../../math/Vector4';
|
|
14
16
|
import type { Engine } from '../../system/Engine';
|
|
@@ -38,6 +40,9 @@ export declare class CameraComponent extends Component {
|
|
|
38
40
|
private _parametersInner;
|
|
39
41
|
private __type;
|
|
40
42
|
private _projectionMatrix;
|
|
43
|
+
private __projectionMatrixWithoutJitter;
|
|
44
|
+
private __hasProjectionMatrixWithoutJitter;
|
|
45
|
+
private __jitterOffset;
|
|
41
46
|
private _viewMatrix;
|
|
42
47
|
private _viewPosition;
|
|
43
48
|
private _lightClusterViewInfo;
|
|
@@ -458,6 +463,35 @@ export declare class CameraComponent extends Component {
|
|
|
458
463
|
* @returns The calculated projection matrix
|
|
459
464
|
*/
|
|
460
465
|
calcProjectionMatrix(): MutableMatrix44;
|
|
466
|
+
/**
|
|
467
|
+
* Writes the jittered projection matrix (`__projectionMatrixWithoutJitter` offset by `__jitterOffset`)
|
|
468
|
+
* into `_projectionMatrix`.
|
|
469
|
+
*
|
|
470
|
+
* @remarks
|
|
471
|
+
* Offsetting the NDC position by (jx, jy) is the clip space translation `x' = x + jx * w`, so the
|
|
472
|
+
* w row (row 3) is added, scaled, to the x and y rows. This works for every projection type.
|
|
473
|
+
*/
|
|
474
|
+
private __applyJitterToProjectionMatrix;
|
|
475
|
+
/**
|
|
476
|
+
* The sub-pixel offset added to the projected position, in NDC units (2 / width is one pixel).
|
|
477
|
+
*
|
|
478
|
+
* @remarks
|
|
479
|
+
* Used by temporal anti-aliasing. The offset is applied to the projection matrix uploaded to the GPU
|
|
480
|
+
* and to {@link CameraComponent.projectionMatrix}; {@link CameraComponent.projectionMatrixWithoutJitter}
|
|
481
|
+
* keeps the matrix without it. Setting the offset does not count as a camera update (it does not
|
|
482
|
+
* re-run the logic stage of the components); it rewrites the projection matrix in place and requests
|
|
483
|
+
* an upload of the GPU instance data. It is not applied to WebXR eye cameras.
|
|
484
|
+
*/
|
|
485
|
+
get jitterOffset(): Vector2;
|
|
486
|
+
set jitterOffset(offset: IVector2);
|
|
487
|
+
/**
|
|
488
|
+
* The projection matrix without the jitter offset of temporal anti-aliasing.
|
|
489
|
+
*
|
|
490
|
+
* @remarks
|
|
491
|
+
* Equal to {@link CameraComponent.projectionMatrix} when the jitter offset is zero.
|
|
492
|
+
* Not defined for WebXR eye cameras.
|
|
493
|
+
*/
|
|
494
|
+
get projectionMatrixWithoutJitter(): Matrix44;
|
|
461
495
|
/**
|
|
462
496
|
* Calculates and returns the view matrix based on camera position and orientation.
|
|
463
497
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as j}from"../../core/Component.js";import{applyMixins as V}from"../../core/EntityRepository.js";import{BufferUse as y}from"../../definitions/BufferUse.js";import{CameraType as c}from"../../definitions/CameraType.js";import{ComponentType as g}from"../../definitions/ComponentType.js";import{CompositionType as I}from"../../definitions/CompositionType.js";import{LightType as C}from"../../definitions/LightType.js";import{ProcessApproach as d}from"../../definitions/ProcessApproach.js";import{ProcessStage as z}from"../../definitions/ProcessStage.js";import{ShaderType as M}from"../../definitions/ShaderType.js";import{Frustum as P}from"../../geometry/Frustum.js";import{MathUtil as l}from"../../math/MathUtil.js";import{Matrix44 as v}from"../../math/Matrix44.js";import{MutableMatrix44 as h}from"../../math/MutableMatrix44.js";import{MutableVector3 as s}from"../../math/MutableVector3.js";import{MutableVector4 as m}from"../../math/MutableVector4.js";import{Vector3 as _}from"../../math/Vector3.js";import{Vector4 as E}from"../../math/Vector4.js";import{Is as b}from"../../misc/Is.js";import{_getCameraControllerUpdateCount as T}from"../CameraController/CameraControllerUpdateCount.js";import{TransformComponent as w}from"../Transform/TransformComponent.js";import{WellKnownComponentTIDs as x}from"../WellKnownComponentTIDs.js";var i=class i extends j{constructor(t,r,e,n,o){super(t,r,e,n,o);this._eyeInner=s.zero();this._direction=s.fromCopy3(0,0,-1);this._directionInner=s.fromCopy3(0,0,-1);this._up=s.fromCopy3(0,1,0);this._upInner=s.fromCopy3(0,1,0);this._filmWidth=36;this._filmHeight=24;this._focalLength=20;this.primitiveMode=!1;this._corner=m.fromCopy4(-1,1,1,-1);this._cornerInner=m.fromCopy4(-1,1,1,-1);this._parameters=m.fromCopy4(.1,1e4,90,1);this._parametersInner=m.fromCopy4(.1,1e4,90,1);this.Ye=c.Perspective;this._projectionMatrix=h.dummy();this._viewMatrix=h.dummy();this._viewPosition=s.dummy();this._lightClusterViewInfo=m.dummy();this._xrLeft=!1;this._xrRight=!1;this.isSyncToLight=!1;this.qe=new P;this.rt=0;this.Qe=-1;this.tr=-1;this.er=-1;this.rr=-1;this.setFovyAndChangeFocalLength(90),i.getCurrent(t)===-1&&i.setCurrent(t,e),this.submitToAllocation(t.config.cameraComponentCountPerBufferView,o)}static getCurrent(t){var r;return(r=this.Ge.get(t.engineUid))!=null?r:-1}static setCurrent(t,r){this.Ge.set(t.engineUid,r)}get updateCount(){return this.rt}static getCurrentCameraUpdateCount(t){var e;let r=t.componentRepository.getComponent(i,i.getCurrent(t));return(e=r==null?void 0:r.updateCount)!=null?e:0}set type(t){this.Ye=t,t===c.Orthographic?(this._parameters.z=1,this._parameters.w=1,this._parametersInner.z=1,this._parametersInner.w=1):(this.setFovyAndChangeFocalLength(90),this._parameters.w=1,this._parametersInner.z=90,this._parametersInner.w=1),this.rt++}get type(){return this.Ye}get eye(){return i._eye}set eye(t){throw Error("In Rhodonite, eye is always (0,0,0). Use TransformComponent for Camera positioning.")}get eyeInner(){return this._eyeInner}set eyeInner(t){this._eyeInner.copyComponents(t),this.rt++}set upInner(t){this._upInner.copyComponents(t),this.rt++}set up(t){this._up.copyComponents(t),this.rt++}get up(){return this._up.clone()}get upInner(){return this._upInner}set direction(t){let r=this._direction,e=t,n=this._up,p=s.crossTo(e,n,i.Ze).length()===0,a;if(p){let f=s.crossTo(r,n,i.He);a=s.crossTo(f,e,i.Xe)}else{let f=s.multiplyTo(e,e.dot(n),i.He);a=s.subtractTo(n,f,i.Xe)}this._up.copyComponents(a).normalize(),this._direction.copyComponents(e),this.rt++}set directionInner(t){this._directionInner.copyComponents(t),this.rt++}get direction(){return this._direction.clone()}get directionInner(){return this._directionInner}set corner(t){this._corner.copyComponents(t),this.rt++}get corner(){return this._corner.clone()}set left(t){this._corner.x=t,this.rt++}set leftInner(t){this._cornerInner.x=t,this.rt++}get left(){return this._corner.x}set right(t){this._corner.y=t,this.rt++}set rightInner(t){this._cornerInner.y=t,this.rt++}get right(){return this._corner.y}set top(t){this._corner.z=t,this.rt++}set topInner(t){this._cornerInner.z=t,this.rt++}get top(){return this._corner.z}set bottom(t){this._corner.w=t,this.rt++}set bottomInner(t){this._cornerInner.w=t,this.rt++}get bottom(){return this._corner.w}set cornerInner(t){this._cornerInner.copyComponents(t),this.rt++}get cornerInner(){return this._cornerInner}set parametersInner(t){this._parametersInner.copyComponents(t),this.rt++}get parametersInner(){return this._parametersInner}get parameters(){return this._parameters.clone()}set zNear(t){this._parameters.x=t,this.rt++}set zNearInner(t){this._parametersInner.x=t,this.rt++}get zNearInner(){return this._parametersInner.x}get zNear(){return this._parameters.x}set focalLength(t){this._focalLength=t,this._parameters.z=2*l.radianToDegree(Math.atan(this._filmHeight/(t*2))),this.rt++}get focalLength(){return this._focalLength}set focalLengthInner(t){this._parametersInner.z=2*l.radianToDegree(Math.atan(this._filmHeight/(t*2))),this.rt++}get focalLengthInner(){return this._parametersInner.z}set zFar(t){this._parameters.y=t,this.rt++}set zFarInner(t){this._parametersInner.y=t,this.rt++}get zFarInner(){return this._parametersInner.y}get zFar(){return this._parameters.y}setFovyAndChangeFilmSize(t){this._parameters.z=t,this._filmHeight=2*this.focalLength*Math.tan(l.degreeToRadian(t)/2),this._filmWidth=this._filmHeight*this.aspect,this.rt++}setFovyAndChangeFocalLength(t){this._parameters.z=t,this._focalLength=this._filmHeight/2/Math.tan(l.degreeToRadian(t)/2),this.rt++}get fovy(){return this._parameters.z}set fovyInner(t){this._parametersInner.z=t,this.rt++}set aspect(t){this._parameters.w=t,this._filmWidth=this._filmHeight*t,this.rt++}set aspectInner(t){this._parametersInner.w=t,this.rt++}get aspectInner(){return this._parametersInner.w}get aspect(){return this._parameters.w}set xMag(t){this._parameters.z=t,this.rt++}get xMag(){return this._parameters.z}set yMag(t){this._parameters.w=t}get yMag(){return this._parameters.w}static get componentTID(){return x.CameraComponentTID}get componentTID(){return x.CameraComponentTID}calcProjectionMatrix(){let t=this._parametersInner.x,r=this._parametersInner.y;if(this.i.engineState.currentProcessApproach===d.WebGPU)if(this.type===c.Perspective){let e=this._parametersInner.z,n=this._parametersInner.w;n<0&&(n=this.i.engineState.viewportAspectRatio);let o=1/Math.tan(.5*e*Math.PI/180),p=o/n;if(this._projectionMatrix.m00=p,this._projectionMatrix.m01=0,this._projectionMatrix.m02=0,this._projectionMatrix.m03=0,this._projectionMatrix.m10=0,this._projectionMatrix.m11=o,this._projectionMatrix.m12=0,this._projectionMatrix.m13=0,this._projectionMatrix.m20=0,this._projectionMatrix.m21=0,r===Number.POSITIVE_INFINITY)this._projectionMatrix.m22=-1,this._projectionMatrix.m23=-t;else{let a=1/(t-r);this._projectionMatrix.m22=r*a,this._projectionMatrix.m23=r*t*a}this._projectionMatrix.m30=0,this._projectionMatrix.m31=0,this._projectionMatrix.m32=-1,this._projectionMatrix.m33=0}else if(this.type===c.Orthographic){let e=this._parametersInner.z,n=this._parametersInner.w;this._projectionMatrix.setComponents(1/e,0,0,0,0,1/n,0,0,0,0,-1/(r-t),-t/(r-t),0,0,0,1)}else{let e=this._cornerInner.x,n=this._cornerInner.y,o=this._cornerInner.z,p=this._cornerInner.w,a=1/(t-r);this._projectionMatrix.setComponents(2*t/(n-e),0,(n+e)/(n-e),0,0,2*t/(o-p),(o+p)/(o-p),0,0,0,r*a,r*t*a,0,0,-1,0)}else if(this.type===c.Perspective){let e=this._parametersInner.z,n=this._parametersInner.w;n<0&&(n=this.i.engineState.viewportAspectRatio);let o=1/Math.tan(.5*e*Math.PI/180),p=o/n;if(this._projectionMatrix.m00=p,this._projectionMatrix.m01=0,this._projectionMatrix.m02=0,this._projectionMatrix.m03=0,this._projectionMatrix.m10=0,this._projectionMatrix.m11=o,this._projectionMatrix.m12=0,this._projectionMatrix.m13=0,this._projectionMatrix.m20=0,this._projectionMatrix.m21=0,r===Number.POSITIVE_INFINITY)this._projectionMatrix.m22=-1,this._projectionMatrix.m23=-2*t;else{let a=1/(t-r);this._projectionMatrix.m22=(r+t)*a,this._projectionMatrix.m23=2*r*t*a}this._projectionMatrix.m30=0,this._projectionMatrix.m31=0,this._projectionMatrix.m32=-1,this._projectionMatrix.m33=0}else if(this.type===c.Orthographic){let e=this._parametersInner.z,n=this._parametersInner.w;this._projectionMatrix.setComponents(1/e,0,0,0,0,1/n,0,0,0,0,-2/(r-t),-(r+t)/(r-t),0,0,0,1)}else{let e=this._cornerInner.x,n=this._cornerInner.y,o=this._cornerInner.z,p=this._cornerInner.w,a=1/(t-r);this._projectionMatrix.setComponents(2*t/(n-e),0,(n+e)/(n-e),0,0,2*t/(o-p),(o+p)/(o-p),0,0,0,(r+t)*a,2*r*t*a,0,0,-1,0)}return this._projectionMatrix}calcViewMatrix(){let t=this.eyeInner,r=s.subtractTo(this._directionInner,t,i.Ze).normalize(),e=s.crossTo(r,this._upInner,i.He).normalize(),n=s.crossTo(e,r,i.Xe);if(this._viewMatrix.setComponents(e.x,e.y,e.z,-_.dot(e,t),n.x,n.y,n.z,-_.dot(n,t),-r.x,-r.y,-r.z,_.dot(r,t),0,0,0,1),!this.primitiveMode){let o=h.invertTo(this.entity.getSceneGraph().matrixInner,i.je);this._viewMatrix.multiply(o)}return this._viewMatrix}get viewMatrix(){return this._viewMatrix}set viewMatrix(t){this._viewMatrix.copyComponents(t),this.rt++}get projectionMatrix(){if(this._xrLeft||this._xrRight){let t=this.i._webXRSystemIfEnabled;if(t!=null&&t.isWebXRMode){if(this._xrLeft)return t.leftProjectionMatrix;if(this._xrRight)return t.rightProjectionMatrix}}return this._projectionMatrix}set projectionMatrix(t){this._projectionMatrix.copyComponents(t),this.rt++}get _projectionMatrixForGpu(){return this._projectionMatrix}get _lightClusterViewInfoForGpu(){return this._lightClusterViewInfo}get viewProjectionMatrix(){return h.multiplyTo(this._projectionMatrix,this._viewMatrix,i.je)}get biasViewProjectionMatrix(){return h.multiplyTo(this._projectionMatrix,this._viewMatrix,i.je),this.i.engineState.currentProcessApproach===d.WebGPU?h.multiplyTo(i.nr,i.je,i.$e):h.multiplyTo(i.ir,i.je,i.$e)}or(){this._viewPosition.copyComponents(this.worldPosition)}get worldPosition(){return this.entity.getSceneGraph().matrixInner.multiplyVector3To(this.eyeInner,i.returnVector3),i.returnVector3}updateFrustum(){this.qe.update(this.viewMatrix,this.projectionMatrix)}get frustum(){return this.qe}$load(){this.moveStageTo(z.Logic)}$logic(){let t=this.entity.tryToGetLight(),r=t!=null?t.updateCount:-1;if(!(this.Qe===this.rt&&this.tr===w.getUpdateCount(this.i)&&this.er===r&&this.rr===T(this.i))){if(this.isSyncToLight&&b.exist(t)){if(this._eyeInner.copyComponents(i._eye),this._directionInner.copyComponents(this._direction),this._upInner.copyComponents(this._up),t.type===C.Spot)this.type=c.Perspective,this.setFovyAndChangeFilmSize(l.radianToDegree(t.outerConeAngle*2)),this._cornerInner.copyComponents(this._corner),this.aspect=1,this.zNear=t.shadowZNearForSpotLight,this.zFar=t.range!==-1?t.range:100,this._parametersInner.copyComponents(this._parameters);else if(t.type===C.Directional){this.type=c.Orthographic;let e=t.shadowAreaSizeForDirectionalLight;this._cornerInner.copyComponents(E.fromCopy4(-e,e,e,-e)),this.aspect=1,this.zNear=t.shadowZNearForDirectionalLight,this.zFar=t.range!==-1?t.range:100,this._parametersInner.x=this.zNear,this._parametersInner.y=this.zFar,this._parametersInner.z=e,this._parametersInner.w=e}}else{let e=this.entity.tryToGetCameraController();b.exist(e)?this._parametersInner.w=this._parameters.w:this.primitiveMode||(this._eyeInner.copyComponents(i._eye),this._directionInner.copyComponents(this._direction),this._upInner.copyComponents(this._up),this._cornerInner.copyComponents(this._corner),this._parametersInner.copyComponents(this._parameters))}if(this.calcViewMatrix(),this._xrLeft||this._xrRight){let e=this.i._webXRSystemIfEnabled;e!=null&&e.isWebXRMode&&(this._xrLeft?this._projectionMatrix.copyComponents(e.leftProjectionMatrix):this._xrRight&&this._projectionMatrix.copyComponents(e.rightProjectionMatrix))}else this.calcProjectionMatrix();this.or(),this.Qe=this.rt,this.tr=w.getUpdateCount(this.i),this.er=r,this.rr=T(this.i)}}get entity(){return this.i.entityRepository.getEntity(this.gn)}addThisComponentToEntity(t,r){class e extends t.constructor{getCamera(){return this.getComponentByComponentTID(x.CameraComponentTID)}}return V(t,e),t}static _cleanupForEngine(t){i.Ge.delete(t.engineUid)}};i._eye=_.zero(),i.Ge=new Map,i.returnVector3=s.zero(),i.Ze=s.zero(),i.He=s.zero(),i.Xe=s.zero(),i.je=h.zero(),i.$e=h.zero(),i.ir=v.fromCopy16ColumnMajor(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),i.nr=v.fromCopy16ColumnMajor(.5,0,0,0,0,-.5,0,0,0,0,1,0,.5,.5,0,1);var u=i;u.registerMember({bufferUse:y.GPUInstanceData,memberName:"viewMatrix",dataClassType:h,shaderType:M.VertexAndPixelShader,compositionType:I.Mat4,componentType:g.Float,initValues:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]});u.registerMember({bufferUse:y.GPUInstanceData,memberName:"projectionMatrix",dataClassType:h,shaderType:M.VertexAndPixelShader,compositionType:I.Mat4,componentType:g.Float,initValues:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]});u.registerMember({bufferUse:y.GPUInstanceData,memberName:"viewPosition",dataClassType:s,shaderType:M.VertexAndPixelShader,compositionType:I.Vec3,componentType:g.Float,initValues:[0,0,0]});u.registerMember({bufferUse:y.GPUInstanceData,memberName:"lightClusterViewInfo",dataClassType:m,shaderType:M.VertexAndPixelShader,compositionType:I.Vec4,componentType:g.Float,initValues:[-1,0,0,0]});export{u as CameraComponent};
|
|
1
|
+
import{Component as w}from"../../core/Component.js";import{applyMixins as V}from"../../core/EntityRepository.js";import{BufferUse as _}from"../../definitions/BufferUse.js";import{CameraType as m}from"../../definitions/CameraType.js";import{ComponentType as g}from"../../definitions/ComponentType.js";import{CompositionType as I}from"../../definitions/CompositionType.js";import{LightType as C}from"../../definitions/LightType.js";import{ProcessApproach as d}from"../../definitions/ProcessApproach.js";import{ProcessStage as z}from"../../definitions/ProcessStage.js";import{ShaderType as x}from"../../definitions/ShaderType.js";import{Frustum as P}from"../../geometry/Frustum.js";import{MathUtil as l}from"../../math/MathUtil.js";import{Matrix44 as v}from"../../math/Matrix44.js";import{MutableMatrix44 as h}from"../../math/MutableMatrix44.js";import{MutableVector2 as D}from"../../math/MutableVector2.js";import{MutableVector3 as s}from"../../math/MutableVector3.js";import{MutableVector4 as c}from"../../math/MutableVector4.js";import{Vector3 as y}from"../../math/Vector3.js";import{Vector4 as E}from"../../math/Vector4.js";import{Is as b}from"../../misc/Is.js";import{_getCameraControllerUpdateCount as j}from"../CameraController/CameraControllerUpdateCount.js";import{TransformComponent as T}from"../Transform/TransformComponent.js";import{WellKnownComponentTIDs as f}from"../WellKnownComponentTIDs.js";var n=class n extends w{constructor(t,r,e,i,o){super(t,r,e,i,o);this._eyeInner=s.zero();this._direction=s.fromCopy3(0,0,-1);this._directionInner=s.fromCopy3(0,0,-1);this._up=s.fromCopy3(0,1,0);this._upInner=s.fromCopy3(0,1,0);this._filmWidth=36;this._filmHeight=24;this._focalLength=20;this.primitiveMode=!1;this._corner=c.fromCopy4(-1,1,1,-1);this._cornerInner=c.fromCopy4(-1,1,1,-1);this._parameters=c.fromCopy4(.1,1e4,90,1);this._parametersInner=c.fromCopy4(.1,1e4,90,1);this.Qe=m.Perspective;this._projectionMatrix=h.dummy();this.He=h.identity();this.Xe=!1;this.Ne=D.zero();this._viewMatrix=h.dummy();this._viewPosition=s.dummy();this._lightClusterViewInfo=c.dummy();this._xrLeft=!1;this._xrRight=!1;this.isSyncToLight=!1;this.rr=new P;this.rt=0;this.ir=-1;this.nr=-1;this.or=-1;this.sr=-1;this.setFovyAndChangeFocalLength(90),n.getCurrent(t)===-1&&n.setCurrent(t,e),this.submitToAllocation(t.config.cameraComponentCountPerBufferView,o)}static getCurrent(t){var r;return(r=this.Ye.get(t.engineUid))!=null?r:-1}static setCurrent(t,r){this.Ye.set(t.engineUid,r)}get updateCount(){return this.rt}static getCurrentCameraUpdateCount(t){var e;let r=t.componentRepository.getComponent(n,n.getCurrent(t));return(e=r==null?void 0:r.updateCount)!=null?e:0}set type(t){this.Qe=t,t===m.Orthographic?(this._parameters.z=1,this._parameters.w=1,this._parametersInner.z=1,this._parametersInner.w=1):(this.setFovyAndChangeFocalLength(90),this._parameters.w=1,this._parametersInner.z=90,this._parametersInner.w=1),this.rt++}get type(){return this.Qe}get eye(){return n._eye}set eye(t){throw Error("In Rhodonite, eye is always (0,0,0). Use TransformComponent for Camera positioning.")}get eyeInner(){return this._eyeInner}set eyeInner(t){this._eyeInner.copyComponents(t),this.rt++}set upInner(t){this._upInner.copyComponents(t),this.rt++}set up(t){this._up.copyComponents(t),this.rt++}get up(){return this._up.clone()}get upInner(){return this._upInner}set direction(t){let r=this._direction,e=t,i=this._up,p=s.crossTo(e,i,n.tr).length()===0,a;if(p){let M=s.crossTo(r,i,n.Ze);a=s.crossTo(M,e,n.$e)}else{let M=s.multiplyTo(e,e.dot(i),n.Ze);a=s.subtractTo(i,M,n.$e)}this._up.copyComponents(a).normalize(),this._direction.copyComponents(e),this.rt++}set directionInner(t){this._directionInner.copyComponents(t),this.rt++}get direction(){return this._direction.clone()}get directionInner(){return this._directionInner}set corner(t){this._corner.copyComponents(t),this.rt++}get corner(){return this._corner.clone()}set left(t){this._corner.x=t,this.rt++}set leftInner(t){this._cornerInner.x=t,this.rt++}get left(){return this._corner.x}set right(t){this._corner.y=t,this.rt++}set rightInner(t){this._cornerInner.y=t,this.rt++}get right(){return this._corner.y}set top(t){this._corner.z=t,this.rt++}set topInner(t){this._cornerInner.z=t,this.rt++}get top(){return this._corner.z}set bottom(t){this._corner.w=t,this.rt++}set bottomInner(t){this._cornerInner.w=t,this.rt++}get bottom(){return this._corner.w}set cornerInner(t){this._cornerInner.copyComponents(t),this.rt++}get cornerInner(){return this._cornerInner}set parametersInner(t){this._parametersInner.copyComponents(t),this.rt++}get parametersInner(){return this._parametersInner}get parameters(){return this._parameters.clone()}set zNear(t){this._parameters.x=t,this.rt++}set zNearInner(t){this._parametersInner.x=t,this.rt++}get zNearInner(){return this._parametersInner.x}get zNear(){return this._parameters.x}set focalLength(t){this._focalLength=t,this._parameters.z=2*l.radianToDegree(Math.atan(this._filmHeight/(t*2))),this.rt++}get focalLength(){return this._focalLength}set focalLengthInner(t){this._parametersInner.z=2*l.radianToDegree(Math.atan(this._filmHeight/(t*2))),this.rt++}get focalLengthInner(){return this._parametersInner.z}set zFar(t){this._parameters.y=t,this.rt++}set zFarInner(t){this._parametersInner.y=t,this.rt++}get zFarInner(){return this._parametersInner.y}get zFar(){return this._parameters.y}setFovyAndChangeFilmSize(t){this._parameters.z=t,this._filmHeight=2*this.focalLength*Math.tan(l.degreeToRadian(t)/2),this._filmWidth=this._filmHeight*this.aspect,this.rt++}setFovyAndChangeFocalLength(t){this._parameters.z=t,this._focalLength=this._filmHeight/2/Math.tan(l.degreeToRadian(t)/2),this.rt++}get fovy(){return this._parameters.z}set fovyInner(t){this._parametersInner.z=t,this.rt++}set aspect(t){this._parameters.w=t,this._filmWidth=this._filmHeight*t,this.rt++}set aspectInner(t){this._parametersInner.w=t,this.rt++}get aspectInner(){return this._parametersInner.w}get aspect(){return this._parameters.w}set xMag(t){this._parameters.z=t,this.rt++}get xMag(){return this._parameters.z}set yMag(t){this._parameters.w=t}get yMag(){return this._parameters.w}static get componentTID(){return f.CameraComponentTID}get componentTID(){return f.CameraComponentTID}calcProjectionMatrix(){let t=this._parametersInner.x,r=this._parametersInner.y;if(this.i.engineState.currentProcessApproach===d.WebGPU)if(this.type===m.Perspective){let e=this._parametersInner.z,i=this._parametersInner.w;i<0&&(i=this.i.engineState.viewportAspectRatio);let o=1/Math.tan(.5*e*Math.PI/180),p=o/i;if(this._projectionMatrix.m00=p,this._projectionMatrix.m01=0,this._projectionMatrix.m02=0,this._projectionMatrix.m03=0,this._projectionMatrix.m10=0,this._projectionMatrix.m11=o,this._projectionMatrix.m12=0,this._projectionMatrix.m13=0,this._projectionMatrix.m20=0,this._projectionMatrix.m21=0,r===Number.POSITIVE_INFINITY)this._projectionMatrix.m22=-1,this._projectionMatrix.m23=-t;else{let a=1/(t-r);this._projectionMatrix.m22=r*a,this._projectionMatrix.m23=r*t*a}this._projectionMatrix.m30=0,this._projectionMatrix.m31=0,this._projectionMatrix.m32=-1,this._projectionMatrix.m33=0}else if(this.type===m.Orthographic){let e=this._parametersInner.z,i=this._parametersInner.w;this._projectionMatrix.setComponents(1/e,0,0,0,0,1/i,0,0,0,0,-1/(r-t),-t/(r-t),0,0,0,1)}else{let e=this._cornerInner.x,i=this._cornerInner.y,o=this._cornerInner.z,p=this._cornerInner.w,a=1/(t-r);this._projectionMatrix.setComponents(2*t/(i-e),0,(i+e)/(i-e),0,0,2*t/(o-p),(o+p)/(o-p),0,0,0,r*a,r*t*a,0,0,-1,0)}else if(this.type===m.Perspective){let e=this._parametersInner.z,i=this._parametersInner.w;i<0&&(i=this.i.engineState.viewportAspectRatio);let o=1/Math.tan(.5*e*Math.PI/180),p=o/i;if(this._projectionMatrix.m00=p,this._projectionMatrix.m01=0,this._projectionMatrix.m02=0,this._projectionMatrix.m03=0,this._projectionMatrix.m10=0,this._projectionMatrix.m11=o,this._projectionMatrix.m12=0,this._projectionMatrix.m13=0,this._projectionMatrix.m20=0,this._projectionMatrix.m21=0,r===Number.POSITIVE_INFINITY)this._projectionMatrix.m22=-1,this._projectionMatrix.m23=-2*t;else{let a=1/(t-r);this._projectionMatrix.m22=(r+t)*a,this._projectionMatrix.m23=2*r*t*a}this._projectionMatrix.m30=0,this._projectionMatrix.m31=0,this._projectionMatrix.m32=-1,this._projectionMatrix.m33=0}else if(this.type===m.Orthographic){let e=this._parametersInner.z,i=this._parametersInner.w;this._projectionMatrix.setComponents(1/e,0,0,0,0,1/i,0,0,0,0,-2/(r-t),-(r+t)/(r-t),0,0,0,1)}else{let e=this._cornerInner.x,i=this._cornerInner.y,o=this._cornerInner.z,p=this._cornerInner.w,a=1/(t-r);this._projectionMatrix.setComponents(2*t/(i-e),0,(i+e)/(i-e),0,0,2*t/(o-p),(o+p)/(o-p),0,0,0,(r+t)*a,2*r*t*a,0,0,-1,0)}return this.He.copyComponents(this._projectionMatrix),this.Xe=!0,this.qe(),this._projectionMatrix}qe(){let t=this.Ne.x,r=this.Ne.y,e=this.He,i=this._projectionMatrix;if(t===0&&r===0){i.copyComponents(e);return}i.copyComponents(e),i.m00=e.m00+t*e.m30,i.m01=e.m01+t*e.m31,i.m02=e.m02+t*e.m32,i.m03=e.m03+t*e.m33,i.m10=e.m10+r*e.m30,i.m11=e.m11+r*e.m31,i.m12=e.m12+r*e.m32,i.m13=e.m13+r*e.m33}get jitterOffset(){return this.Ne}set jitterOffset(t){this.Ne.x===t.x&&this.Ne.y===t.y||(this.Ne.setComponents(t.x,t.y),!(this._xrLeft||this._xrRight||!this.Xe)&&(this.qe(),this.i._markGpuInstanceDataDirty()))}get projectionMatrixWithoutJitter(){return this.He}calcViewMatrix(){let t=this.eyeInner,r=s.subtractTo(this._directionInner,t,n.tr).normalize(),e=s.crossTo(r,this._upInner,n.Ze).normalize(),i=s.crossTo(e,r,n.$e);if(this._viewMatrix.setComponents(e.x,e.y,e.z,-y.dot(e,t),i.x,i.y,i.z,-y.dot(i,t),-r.x,-r.y,-r.z,y.dot(r,t),0,0,0,1),!this.primitiveMode){let o=h.invertTo(this.entity.getSceneGraph().matrixInner,n.Ge);this._viewMatrix.multiply(o)}return this._viewMatrix}get viewMatrix(){return this._viewMatrix}set viewMatrix(t){this._viewMatrix.copyComponents(t),this.rt++}get projectionMatrix(){if(this._xrLeft||this._xrRight){let t=this.i._webXRSystemIfEnabled;if(t!=null&&t.isWebXRMode){if(this._xrLeft)return t.leftProjectionMatrix;if(this._xrRight)return t.rightProjectionMatrix}}return this._projectionMatrix}set projectionMatrix(t){this.He.copyComponents(t),this.Xe=!0,this.qe(),this.rt++}get _projectionMatrixForGpu(){return this._projectionMatrix}get _lightClusterViewInfoForGpu(){return this._lightClusterViewInfo}get viewProjectionMatrix(){return h.multiplyTo(this._projectionMatrix,this._viewMatrix,n.Ge)}get biasViewProjectionMatrix(){return h.multiplyTo(this._projectionMatrix,this._viewMatrix,n.Ge),this.i.engineState.currentProcessApproach===d.WebGPU?h.multiplyTo(n.pr,n.Ge,n.er):h.multiplyTo(n.ar,n.Ge,n.er)}hr(){this._viewPosition.copyComponents(this.worldPosition)}get worldPosition(){return this.entity.getSceneGraph().matrixInner.multiplyVector3To(this.eyeInner,n.returnVector3),n.returnVector3}updateFrustum(){this.rr.update(this.viewMatrix,this.projectionMatrix)}get frustum(){return this.rr}$load(){this.moveStageTo(z.Logic)}$logic(){let t=this.entity.tryToGetLight(),r=t!=null?t.updateCount:-1;if(!(this.ir===this.rt&&this.nr===T.getUpdateCount(this.i)&&this.or===r&&this.sr===j(this.i))){if(this.isSyncToLight&&b.exist(t)){if(this._eyeInner.copyComponents(n._eye),this._directionInner.copyComponents(this._direction),this._upInner.copyComponents(this._up),t.type===C.Spot)this.type=m.Perspective,this.setFovyAndChangeFilmSize(l.radianToDegree(t.outerConeAngle*2)),this._cornerInner.copyComponents(this._corner),this.aspect=1,this.zNear=t.shadowZNearForSpotLight,this.zFar=t.range!==-1?t.range:100,this._parametersInner.copyComponents(this._parameters);else if(t.type===C.Directional){this.type=m.Orthographic;let e=t.shadowAreaSizeForDirectionalLight;this._cornerInner.copyComponents(E.fromCopy4(-e,e,e,-e)),this.aspect=1,this.zNear=t.shadowZNearForDirectionalLight,this.zFar=t.range!==-1?t.range:100,this._parametersInner.x=this.zNear,this._parametersInner.y=this.zFar,this._parametersInner.z=e,this._parametersInner.w=e}}else{let e=this.entity.tryToGetCameraController();b.exist(e)?this._parametersInner.w=this._parameters.w:this.primitiveMode||(this._eyeInner.copyComponents(n._eye),this._directionInner.copyComponents(this._direction),this._upInner.copyComponents(this._up),this._cornerInner.copyComponents(this._corner),this._parametersInner.copyComponents(this._parameters))}if(this.calcViewMatrix(),this._xrLeft||this._xrRight){let e=this.i._webXRSystemIfEnabled;e!=null&&e.isWebXRMode&&(this._xrLeft?this._projectionMatrix.copyComponents(e.leftProjectionMatrix):this._xrRight&&this._projectionMatrix.copyComponents(e.rightProjectionMatrix))}else this.calcProjectionMatrix();this.hr(),this.ir=this.rt,this.nr=T.getUpdateCount(this.i),this.or=r,this.sr=j(this.i)}}get entity(){return this.i.entityRepository.getEntity(this.gn)}addThisComponentToEntity(t,r){class e extends t.constructor{getCamera(){return this.getComponentByComponentTID(f.CameraComponentTID)}}return V(t,e),t}static _cleanupForEngine(t){n.Ye.delete(t.engineUid)}};n._eye=y.zero(),n.Ye=new Map,n.returnVector3=s.zero(),n.tr=s.zero(),n.Ze=s.zero(),n.$e=s.zero(),n.Ge=h.zero(),n.er=h.zero(),n.ar=v.fromCopy16ColumnMajor(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),n.pr=v.fromCopy16ColumnMajor(.5,0,0,0,0,-.5,0,0,0,0,1,0,.5,.5,0,1);var u=n;u.registerMember({bufferUse:_.GPUInstanceData,memberName:"viewMatrix",dataClassType:h,shaderType:x.VertexAndPixelShader,compositionType:I.Mat4,componentType:g.Float,initValues:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]});u.registerMember({bufferUse:_.GPUInstanceData,memberName:"projectionMatrix",dataClassType:h,shaderType:x.VertexAndPixelShader,compositionType:I.Mat4,componentType:g.Float,initValues:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]});u.registerMember({bufferUse:_.GPUInstanceData,memberName:"viewPosition",dataClassType:s,shaderType:x.VertexAndPixelShader,compositionType:I.Vec3,componentType:g.Float,initValues:[0,0,0]});u.registerMember({bufferUse:_.GPUInstanceData,memberName:"lightClusterViewInfo",dataClassType:c,shaderType:x.VertexAndPixelShader,compositionType:I.Vec4,componentType:g.Float,initValues:[-1,0,0,0]});export{u as CameraComponent};
|
|
@@ -354,7 +354,9 @@ export declare class LightComponent extends Component {
|
|
|
354
354
|
private __getEffectiveRange;
|
|
355
355
|
/**
|
|
356
356
|
* Cleans up the light component when it's being destroyed.
|
|
357
|
-
*
|
|
357
|
+
* Destroys the light gizmo so that it does not stay in the scene after the light
|
|
358
|
+
* entity (or only its LightComponent) is removed, and resets the light intensity
|
|
359
|
+
* values in the global data arrays.
|
|
358
360
|
*
|
|
359
361
|
* @override
|
|
360
362
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as I}from"../../core/Component.js";import{applyMixins as v}from"../../core/EntityRepository.js";import{BufferUse as g}from"../../definitions/BufferUse.js";import{ComponentType as y}from"../../definitions/ComponentType.js";import{CompositionType as l}from"../../definitions/CompositionType.js";import{LightType as o}from"../../definitions/LightType.js";import{ProcessStage as D}from"../../definitions/ProcessStage.js";import{ShaderType as u}from"../../definitions/ShaderType.js";import{_getGizmoClass as L}from"../../gizmos/GizmoRegistry.js";import{MutableVector3 as d}from"../../math/index.js";import{MutableVector4 as p}from"../../math/MutableVector4.js";import{Scalar as P}from"../../math/Scalar.js";import{Vector3 as h}from"../../math/Vector3.js";import{Is as m}from"../../misc/Is.js";import{TransformComponent as
|
|
1
|
+
import{Component as I}from"../../core/Component.js";import{applyMixins as v}from"../../core/EntityRepository.js";import{BufferUse as g}from"../../definitions/BufferUse.js";import{ComponentType as y}from"../../definitions/ComponentType.js";import{CompositionType as l}from"../../definitions/CompositionType.js";import{LightType as o}from"../../definitions/LightType.js";import{ProcessStage as D}from"../../definitions/ProcessStage.js";import{ShaderType as u}from"../../definitions/ShaderType.js";import{_getGizmoClass as L}from"../../gizmos/GizmoRegistry.js";import{MutableVector3 as d}from"../../math/index.js";import{MutableVector4 as p}from"../../math/MutableVector4.js";import{Scalar as P}from"../../math/Scalar.js";import{Vector3 as h}from"../../math/Vector3.js";import{Is as m}from"../../misc/Is.js";import{TransformComponent as _}from"../Transform/TransformComponent.js";import{WellKnownComponentTIDs as f}from"../WellKnownComponentTIDs.js";var i=class i extends I{constructor(t,e,r,a,n){super(t,e,r,a,n);this.Qe=o.Point;this.ii=h.fromCopyArray([1,1,1]);this.Ti=[1,1,1];this.oi=1;this.Ii=h.fromCopyArray([0,0,-1]);this.ni=h.fromCopyArray([0,0,-1]);this.ai=0;this.mi=Math.PI/4;this.si=-1;this.gi=!0;this.yi=10;this.li=.1;this.ri=.1;this.hi=!0;this.ui=-1;this.di=h.zero();this.castShadow=!1;this._lightPosition=p.dummy();this._lightDirection=p.dummy();this._lightIntensity=p.dummy();this._lightProperty=p.dummy();this.ci=void 0;this.rt=0;this.ir=-1;this.Ci=-1;this._i=-1;this.submitToAllocation(t.config.lightComponentCountPerBufferView,n),i.fi(t),t._requestLightClusterSystem()}static getUpdateCount(t){var e;return(e=this.pi.get(t))!=null?e:0}static fi(t){var e;this.pi.set(t,((e=this.pi.get(t))!=null?e:0)+1)}static _cleanupForEngine(t){this.pi.delete(t)}ti(){this.rt++,i.fi(this.i)}get type(){return this.Qe}set type(t){this.Qe!==t&&(this.Qe=t,this.ti())}get enable(){return this.gi}set enable(t){this.gi!==t&&(this.gi=t,this.ti())}get innerConeAngle(){return this.ai}set innerConeAngle(t){this.ai!==t&&(this.ai=t,this.ti())}get outerConeAngle(){return this.mi}set outerConeAngle(t){this.mi!==t&&(this.mi=t,this.ti())}static get componentTID(){return f.LightComponentTID}get componentTID(){return f.LightComponentTID}get updateCount(){return this.rt}get direction(){return this.ni}set intensity(t){this.oi!==t&&(this.oi=t,this.ti())}get intensity(){return this.oi}set range(t){this.si!==t&&(this.si=t,this.ti())}get range(){return this.si}set shadowAreaSizeForDirectionalLight(t){this.yi!==t&&(this.yi=t,this.ti())}get shadowAreaSizeForDirectionalLight(){return this.yi}set shadowZNearForDirectionalLight(t){this.li!==t&&(this.li=t,this.ti())}get shadowZNearForDirectionalLight(){return this.li}set shadowZNearForSpotLight(t){(this.ri!==t||this.hi)&&(this.ri=t,this.hi=!1,this.ti())}get shadowZNearForSpotLight(){return this.ri}set pointLightShadowFarPlane(t){this.ui!==t&&(this.ui=t,this.ti())}get pointLightShadowFarPlane(){return this.ui}get isShadowZNearForSpotLightAuto(){return this.hi}_setShadowZNearForSpotLightAuto(t){this.hi&&this.ri!==t&&(this.ri=t,this.ti())}set shadowCameraOffsetForDirectionalLight(t){this.di=t,this.ti()}get shadowCameraOffsetForDirectionalLight(){return this.di}set color(t){this.ii=t;let e=this.Ti;(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(e[0]=t.x,e[1]=t.y,e[2]=t.z,this.ti())}get color(){return this.ii}get _shadowSlot(){return this.ci!==void 0?this.ci:this.componentSID<this.i.config.maxLightNumber?this.componentSID:-1}set _shadowSlot(t){this.ci=t}get _lightPositionForGpu(){return this._lightPosition}get _lightDirectionForGpu(){return this._lightDirection}get _lightPropertyForGpu(){return this._lightProperty}get _lightIntensityForGpu(){return this._lightIntensity}get _up(){return h.fromCopy3(0,1,0)}set isLightGizmoVisible(t){t?(m.not.defined(this.ei)&&(this.ei=new(L("light"))(this.entity.engine,this.entity),this.ei._setup()),this.ei.isVisible=!0):m.defined(this.ei)&&(this.ei.isVisible=!1),this.ti()}get isLightGizmoVisible(){return m.defined(this.ei)?this.ei.isVisible:!1}$load(){i.bi=this.entity.engine.globalDataRepository.getValue("lightNumber",0),this.moveStageTo(D.Logic)}vi(){m.defined(this.ei)&&this.ei.isSetup&&this.isLightGizmoVisible&&this.ei._update()}static common_$logic({engine:t}){let e=t.componentRepository.getComponentsWithType(i);i.bi._v[0]=e.length}$logic(){let t=this.i.config.lightRangeScale;if(_.getUpdateCount(this.i)===this.Ci&&this.ir===this.rt&&this._i===t)return;let e=this.entity.getSceneGraph();(this.type===o.Spot||this.type===o.Directional)&&(this.ni=e.normalMatrixInner.multiplyVector(this.Ii),this._lightDirection._v[0]=this.ni.x,this._lightDirection._v[1]=this.ni.y,this._lightDirection._v[2]=this.ni.z);let r=Math.cos(this.innerConeAngle),a=Math.cos(this.outerConeAngle),n=e.worldPosition;this._lightPosition._v[0]=n.x,this._lightPosition._v[1]=n.y,this._lightPosition._v[2]=n.z;let b=this.Di(),C=(this.type===o.Point||this.type===o.Spot)&&b>0,c=C?i.Li(t):1,T=C?t:1;this._lightIntensity._v[0]=this.ii.x*this.oi*c,this._lightIntensity._v[1]=this.ii.y*this.oi*c,this._lightIntensity._v[2]=this.ii.z*this.oi*c,this._lightProperty._v[0]=this.enable?this.type.index:-1,this._lightProperty._v[1]=b*T,this._lightProperty._v[2]=r,this._lightProperty._v[3]=a,this.vi(),this.Ci=_.getUpdateCount(this.i),this.ir=this.rt,this._i=t}static Li(t){return t>=1?1:t>=.9?1+(1-t)*1.6:t>=.8?1.16+(.9-t)*1.9:1.35+(.8-t)*1.9}Di(){let t=this.i.config.lightAutoRangeThreshold;if(this.si>0||!(t>0)||this.type!==o.Point&&this.type!==o.Spot)return this.si;let e=Math.max(this.ii.x,this.ii.y,this.ii.z)*this.oi;return Math.max(Math.sqrt(Math.max(e,0)/t),1e-6)}_destroy(){var t;(t=this.ei)==null||t._destroy(),this.ei=void 0,super._destroy(),i.fi(this.i)}get entity(){return this.i.entityRepository.getEntity(this.gn)}addThisComponentToEntity(t,e){class r extends t.constructor{getLight(){return this.getComponentByComponentTID(f.LightComponentTID)}}return v(t,r),t}};i.bi=P.zero(),i.pi=new Map;var s=i;s.registerMember({bufferUse:g.GPUInstanceData,memberName:"lightPosition",dataClassType:d,shaderType:u.VertexAndPixelShader,compositionType:l.Vec3,componentType:y.Float,initValues:[0,0,0]});s.registerMember({bufferUse:g.GPUInstanceData,memberName:"lightDirection",dataClassType:d,shaderType:u.VertexAndPixelShader,compositionType:l.Vec3,componentType:y.Float,initValues:[0,0,0]});s.registerMember({bufferUse:g.GPUInstanceData,memberName:"lightIntensity",dataClassType:d,shaderType:u.VertexAndPixelShader,compositionType:l.Vec3,componentType:y.Float,initValues:[0,0,0]});s.registerMember({bufferUse:g.GPUInstanceData,memberName:"lightProperty",dataClassType:p,shaderType:u.VertexAndPixelShader,compositionType:l.Vec4,componentType:y.Float,initValues:[-1,0,0,0]});export{s as LightComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as I}from"../../core/Component.js";import{applyMixins as v}from"../../core/EntityRepository.js";import{ProcessStage as x}from"../../definitions/ProcessStage.js";import{MathClassUtil as C}from"../../math/MathClassUtil.js";import{Matrix44 as T}from"../../math/Matrix44.js";import{MutableMatrix44 as M}from"../../math/MutableMatrix44.js";import{MutableVector3 as u}from"../../math/MutableVector3.js";import{Vector3 as p}from"../../math/Vector3.js";import{Vector4 as d}from"../../math/Vector4.js";import{Is as h}from"../../misc/Is.js";import{Logger as g}from"../../misc/Logger.js";import{assertExist as S}from"../../misc/MiscUtil.js";import{WellKnownComponentTIDs as f}from"../WellKnownComponentTIDs.js";var r=class r extends I{constructor(){super(...arguments);this.oo=-Number.MAX_VALUE;this.isPickable=!0}static get componentTID(){return f.MeshComponentTID}get componentTID(){return f.MeshComponentTID}setMesh(t){var e;this.eo!==t&&(this.eo&&this.eo._removeMeshComponent(this),this.eo=t,t._belongToMeshComponent(this),(e=this.entity.tryToGetSceneGraph())==null||e.setWorldAABBDirtyParentRecursively())}unsetMesh(){var t;return this.eo==null?!1:(this.eo._removeMeshComponent(this),this.eo=void 0,(t=this.entity.tryToGetSceneGraph())==null||t.setWorldAABBDirtyParentRecursively(),!0)}get mesh(){return this.eo}calcViewDepth(t){if(h.not.exist(this.eo))return Number.MAX_VALUE;let e=this.eo.AABB.centerPoint,n=this.entity.tryToGetSkeletal();h.exist(n)&&h.exist(n._bindShapeMatrix)&&n._bindShapeMatrix.multiplyVector3To(this.eo.AABB.centerPoint,e);let c=this.entity.getSceneGraph().matrixInner.multiplyVector3To(e,r.
|
|
1
|
+
import{Component as I}from"../../core/Component.js";import{applyMixins as v}from"../../core/EntityRepository.js";import{ProcessStage as x}from"../../definitions/ProcessStage.js";import{MathClassUtil as C}from"../../math/MathClassUtil.js";import{Matrix44 as T}from"../../math/Matrix44.js";import{MutableMatrix44 as M}from"../../math/MutableMatrix44.js";import{MutableVector3 as u}from"../../math/MutableVector3.js";import{Vector3 as p}from"../../math/Vector3.js";import{Vector4 as d}from"../../math/Vector4.js";import{Is as h}from"../../misc/Is.js";import{Logger as g}from"../../misc/Logger.js";import{assertExist as S}from"../../misc/MiscUtil.js";import{WellKnownComponentTIDs as f}from"../WellKnownComponentTIDs.js";var r=class r extends I{constructor(){super(...arguments);this.oo=-Number.MAX_VALUE;this.isPickable=!0}static get componentTID(){return f.MeshComponentTID}get componentTID(){return f.MeshComponentTID}setMesh(t){var e;this.eo!==t&&(this.eo&&this.eo._removeMeshComponent(this),this.eo=t,t._belongToMeshComponent(this),(e=this.entity.tryToGetSceneGraph())==null||e.setWorldAABBDirtyParentRecursively())}unsetMesh(){var t;return this.eo==null?!1:(this.eo._removeMeshComponent(this),this.eo=void 0,(t=this.entity.tryToGetSceneGraph())==null||t.setWorldAABBDirtyParentRecursively(),!0)}get mesh(){return this.eo}calcViewDepth(t){if(h.not.exist(this.eo))return Number.MAX_VALUE;let e=this.eo.AABB.centerPoint,n=this.entity.tryToGetSkeletal();h.exist(n)&&h.exist(n._bindShapeMatrix)&&n._bindShapeMatrix.multiplyVector3To(this.eo.AABB.centerPoint,e);let c=this.entity.getSceneGraph().matrixInner.multiplyVector3To(e,r.tr),s=t.viewMatrix.multiplyVector3To(c,r.Ze);return this.oo=s.z,this.oo}get viewDepth(){return this.oo}static alertNoMeshSet(t){g.default.debug(`No mesh is set on this MeshComponent:${t.componentSID}`)}castRay(t,e,n=0){if(this.eo){let i=t,c=e,o=this.entity.tryToGetSceneGraph();if(o!=null){let s=T.invert(o.matrixInner);i=p.fromCopyVector4(s.multiplyVector(d.fromCopyVector3(t)));let l=p.add(t,e),y=p.fromCopyVector4(s.multiplyVector(d.fromCopyVector3(l)));c=p.normalize(p.subtract(y,i));let m=this.eo.castRay(i,c,n),a=null;if(h.defined(m.data)&&m.data.t>=0)return a=p.fromCopyVector4(o.matrixInner.multiplyVector(d.fromCopyVector3(m.data.position))),{result:!0,data:{t:m.data.t,u:m.data.u,v:m.data.v,position:a}}}}return{result:!1}}castRayFromScreenInLocal(t,e,n,i,c=0){if(this.eo){let o=this.entity.tryToGetSceneGraph();if(o!=null){let s=M.multiplyTo(n.projectionMatrix,n.viewMatrix,r.Ge).multiply(o.matrixInner).invert(),l=C.unProjectTo(t,e,0,s,i,r.tr),y=C.unProjectTo(t,e,1,s,i,r.Ze),m=u.subtractTo(y,l,r.$e).normalize(),a=this.eo.castRay(l,m,c);if(h.defined(a.data)&&a.data.t>=0)return{result:!0,data:{t:a.data.t,u:a.data.u,v:a.data.v,position:a.data.position}}}}return{result:!1}}castRayFromScreenInWorld(t,e,n,i,c=0){let o=this.castRayFromScreenInLocal(t,e,n,i,c),s=this.entity.tryToGetSceneGraph();if(this.eo&&s!=null&&o.result){S(o.data);let l=s.matrixInner.multiplyVector3To(o.data.position,r.ro);return{result:!0,data:{t:o.data.t,u:o.data.u,v:o.data.v,position:l}}}return o}$load(){if(this.eo==null)return;this.eo._calcTangents(),this.eo._calcFaceNormalsIfNonNormal();let t=this.entity.tryToGetBlendShape();t!=null&&t.weights.length>0&&this.eo._calcBaryCentricCoord(),this.moveStageTo(x.Logic)}no(){this.eo!=null&&(this.eo.delete3DAPIVertexData(),this.eo._updateVBOAndVAO())}calcBaryCentricCoord(){if(this.eo!=null){for(let t of this.eo.primitives)t.convertToUnindexedGeometry();this.eo._calcBaryCentricCoord()}this.no()}$logic(){}_shallowCopyFrom(t){let e=t;this.oo=e.oo,h.exist(e.eo)&&this.setMesh(e.eo),this.isPickable=e.isPickable}_destroy(){if(super._destroy(),this.eo){let t=this.eo;t._removeMeshComponent(this),t.meshEntitiesInner.length>0||(t.delete3DAPIVertexData(),t.deleteVAO()),this.eo=void 0}}get entity(){return this.i.entityRepository.getEntity(this.gn)}addThisComponentToEntity(t,e){class n extends t.constructor{getMesh(){return this.getComponentByComponentTID(f.MeshComponentTID)}}return v(t,n),t}};r.tr=u.zero(),r.Ze=u.zero(),r.$e=u.zero(),r.ro=u.zero(),r.Ge=M.zero(),r.io=0;var V=r;export{V as MeshComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getMultiDrawStateKeyId as R,getPrimitiveMeshRendererFingerPrintId as A}from"../../../webgl/MultiDraw.js";import{Component as w}from"../../core/Component.js";import{applyMixins as G}from"../../core/EntityRepository.js";import{ProcessApproach as M}from"../../definitions/ProcessApproach.js";import{ProcessStage as B}from"../../definitions/ProcessStage.js";import{isBlend as P,isBlendWithoutZWrite as T,isBlendWithZWrite as k,isTranslucent as Z}from"../../geometry/types/GeometryTypes.js";import{ModuleManager as j}from"../../system/ModuleManager.js";import{CameraComponent as I}from"../Camera/CameraComponent.js";import{_getCameraControllerUpdateCount as U}from"../CameraController/CameraControllerUpdateCount.js";import{SceneGraphComponent as W}from"../SceneGraph/SceneGraphComponent.js";import{TransformComponent as D}from"../Transform/TransformComponent.js";import{WellKnownComponentTIDs as E}from"../WellKnownComponentTIDs.js";var i=class i extends w{constructor(t,e,o,n,a){super(t,e,o,n,a);this.Yn=1;this.Si=1;this.Mi=0;this.rt=0;this.Nn="";this.Ei=0;this.calcFingerPrint()}static get componentTID(){return E.MeshRendererComponentTID}get componentTID(){return E.MeshRendererComponentTID}get diffuseCubeMap(){return this.Zn}get specularCubeMap(){return this.jn}get sheenCubeMap(){return this.$n}get updateCount(){return this.rt}static get updateCount(){return i.rt}get diffuseCubeMapContribution(){return this.Yn}set diffuseCubeMapContribution(t){this.Yn=t,this.rt++,i.rt++}get specularCubeMapContribution(){return this.Si}set specularCubeMapContribution(t){this.Si=t,this.rt++,i.rt++}get rotationOfCubeMap(){return this.Mi}set rotationOfCubeMap(t){this.Mi=t,this.rt++,i.rt++}calcFingerPrint(){this.Nn=`${this.Zn!=null?this.Zn.textureUID:-1} ${this.jn!=null?this.jn.textureUID:-1} ${this.$n!=null?this.$n.textureUID:-1}`,this.Ei=i.wi(this.Nn)}static wi(t){let e=i.ki.get(t);return e==null&&(e=++i.Ai,i.ki.set(t,e)),e}getFingerPrint(){return this.Nn}getFingerPrintId(){return this.Ei}setIBLCubeMap(t,e,o){t==null||e==null||(this.Zn=t,this.jn=e,this.$n=o,this.calcFingerPrint(),this.rt++,i.rt++)}static common_$load({processApproach:t,engine:e}){let o=j.getInstance(),n=e.objectUID;if(t===M.WebGPU){let u=o.getModule("webgpu");i.Wn.has(n)||i.Wn.set(n,u.WebGpuStrategyBasic.init(e)),i.Wn.get(n).common_$load()}else{let u=o.getModule("webgl");i.Wn.has(n)||i.Wn.set(n,u.getRenderingStrategy(e,t)),i.Wn.get(n).common_$load()}}$load(){i.Wn.get(this.i.objectUID).$load(this.entity.tryToGetMesh())&&this.moveStageTo(B.Unknown)}static sort_$render(t,e){var b;let o=t.webglResourceRepository,n=o!=null?o.getMultiDrawRepository(t).version:0,a=i.Gi(e),u=i._isGpuCullingActive(t,e);if(D.getUpdateCount(t)===e._lastTransformComponentsUpdateCount&&U(t)===e._lastCameraControllerComponentsUpdateCount&&W.getUpdateCount(t)===e._lastSceneGraphComponentsUpdateCount&&n===e._lastMultiDrawGroupVersion&&u===a.isGpuCullingActive&&t.config.isComputeSkinningEnabled===a.isComputeSkinningEnabled)return e._lastPrimitiveUids;a.isGpuCullingActive=u,a.isComputeSkinningEnabled=t.config.isComputeSkinningEnabled;let d=e.cameraComponent;if(d==null&&(d=t.componentRepository.getComponent(I,I.getCurrent(t))),d==null&&(d=t.componentRepository.getComponentsWithType(I).find(m=>m==null?void 0:m._isAlive),I.setCurrent(t,d.componentSID)),e.isVrRendering){let l=t._webXRSystemIfEnabled;l!=null&&l.isWebXRMode&&(d=l._getCameraComponentAt(0))}let r=i.Bi(d,e._optimizedMeshComponents,a.primitives,a,u);i.Pi(r,a),r.length>1&&r.sort(i.Zi);let s=r.length-1,c=r.length-1,g=r.length-1,p=r.length-1;for(let l=0;l<r.length;l++){let m=r[l];if(Z(m)){s=l-1;break}if(k(m)){s=l-1;break}if(T(m)){s=l-1;break}}for(let l=s+1;l<r.length;l++){let m=r[l];if(k(m)){c=l-1;break}if(T(m)){c=l-1;break}}for(let l=c+1;l<r.length;l++){let m=r[l];if(T(m)){g=l-1;break}}if(s>0&&t.config.isMultiDrawEnabled&&M.isWebGL2Approach(t.engineState.currentProcessApproach)){let l=s+1,m=a.keyedPrimitives;if(m.length<l)for(let f=m.length;f<l;f++)m.push({primitive:null,keyId:0,index:0});else m.length=l;for(let f=0;f<l;f++){let y=r[f],v=e.getAppropriateMaterial(y),S=m[f];S.primitive=y,S.index=f,S.keyId=(b=R(y,v,A(y)))!=null?b:-(v.materialUID+1)}m.sort((f,y)=>f.keyId-y.keyId||f.index-y.index);for(let f=0;f<l;f++)r[f]=m[f].primitive}let h=i.ji(r),C=!1;if(s!==e._lastOpaqueIndex&&(e._lastOpaqueIndex=s,C||(C=!0)),c!==e._lastTranslucentIndex&&(e._lastTranslucentIndex=c,C||(C=!0)),g!==e._lastBlendWithZWriteIndex&&(e._lastBlendWithZWriteIndex=g,C||(C=!0)),p!==e._lastBlendWithoutZWriteIndex&&(e._lastBlendWithoutZWriteIndex=p,C||(C=!0)),h.length!==e._lastPrimitiveUids.length)C||(C=!0);else{let l=e._lastPrimitiveUids;for(let m=0;m<h.length;m++)if(h[m]!==l[m]){C||(C=!0);break}}return e._isChangedSortRenderResult=C,e._lastPrimitiveUids=h,e._lastPrimitives=r,e._lastTransformComponentsUpdateCount=D.getUpdateCount(t),e._lastCameraControllerComponentsUpdateCount=U(t),e._lastSceneGraphComponentsUpdateCount=W.getUpdateCount(t),e._lastMultiDrawGroupVersion=n,C&&(e._renderedSomethingBefore=!0),h}static Bi(t,e,o,n,a){var c;o.length=0;let u=n.cullTick+1;u===4294967295&&(n.culledEntityStamp.fill(0),n.handledEntityStamp.fill(0),n.meshCullTick=new WeakMap,n.meshAppendTick=new WeakMap,u=1),n.cullTick=u,n.culledEntityCount=0;let d=n.culledInstancedMeshComponents;d.length=0,n.cullingId=++i.Ri;let r=t!=null&&i._isFrustumCullingEnabled,s;r&&(t.updateFrustum(),s=t.frustum);for(let g=0;g<e.length;g++){let p=e[g],h=p.entity.getSceneGraph();if(p._isAlive){if(n.handledEntityStamp=i.Ui(n.handledEntityStamp,p.entityUID,u),a&&((c=p.mesh)==null?void 0:c._isGpuCullable)===!0){h._isCulled=!1;let C=p.entity.tryToGetSkeletal();if(C!==void 0){let b=h.isVisible;b&&s!=null&&p.entity.getTagValue("type")!=="background-assets"&&(b=s.culling(p)),C._isCulled=!b}i.Jn(p,t,o),i.Wi(p,n,u);continue}if(!h.isVisible){i.Qn(n,p.entityUID,u),i.xi(p,n);continue}if(s!=null){let b=p.entity.getTagValue("type")==="background-assets"?!0:s.culling(p);h._isCulled=!b;let l=p.entity.tryToGetSkeletal();if(l!==void 0&&(l._isCulled=!b),!b){i.Qn(n,p.entityUID,u),i.xi(p,n);continue}}i.Jn(p,t,o),i.Wi(p,n,u)}}return i.Vi(e,s,n,u,a),i.$i(t,o,n,u),o}static Vi(t,e,o,n,a){for(let u=0;u<t.length;u++){let d=t[u];if(!d._isAlive)continue;let r=d.mesh;if(r===void 0||a&&r._isGpuCullable)continue;let s=r.meshEntitiesInner;if(!(s.length<=1||o.meshCullTick.get(r)===n)){o.meshCullTick.set(r,n);for(let c=0;c<s.length;c++){let g=s[c],p=g.entityUID;if(p<o.handledEntityStamp.length&&o.handledEntityStamp[p]===n)continue;let h=g.getSceneGraph().isVisible;h&&e!=null&&g.getTagValue("type")!=="background-assets"&&(h=e.culling(g.getMesh())),h||i.Qn(o,p,n)}}}}static xi(t,e){let o=t.mesh;o!==void 0&&o.meshEntitiesInner.length>1&&e.culledInstancedMeshComponents.push(t)}static Wi(t,e,o){let n=t.mesh;n!==void 0&&e.meshAppendTick.set(n,o)}static $i(t,e,o,n){let a=o.culledInstancedMeshComponents,u=o.culledEntityStamp;for(let d=0;d<a.length;d++){let r=a[d],s=r.mesh;if(s===void 0||o.meshAppendTick.get(s)===n)continue;o.meshAppendTick.set(s,n);let c=s.meshEntitiesInner,g=!1;for(let p=0;p<c.length;p++){let h=c[p].entityUID;if(h>=u.length||u[h]!==n){g=!0;break}}g&&i.Jn(r,t,e)}a.length=0}static Qn(t,e,o){t.culledEntityStamp=i.Ui(t.culledEntityStamp,e,o),t.culledEntityCount++}static Ui(t,e,o){let n=t;return e>=t.length&&(n=new Uint32Array(Math.max(e+1,t.length*2,64)),n.set(t)),n[e]=o,n}static _isGpuCullingActive(t,e){if(!t.config.isGpuCullingEnabled||!i._isFrustumCullingEnabled||!M.isWebGpuApproach(t.engineState.currentProcessApproach)||e.isBufferLessRenderingMode())return!1;let o=t._webXRSystemIfEnabled;return!(e.isVrRendering&&(o!=null&&o.isWebXRMode)&&o.isMultiView())}static _getInstanceCullingState(t){let e=i.Xn.get(t);if(!(e===void 0||e.cullTick===0))return e}static Jn(t,e,o){let n=t.mesh;if(n===void 0)return;let a=n.primitives,u=a.length,d=!1;for(let r=0;r<u;r++){let s=a[r];o.push(s),!d&&P(s)&&(d=!0)}if(d){let r=t.calcViewDepth(e);for(let s=0;s<u;s++)a[s]._viewDepth=r}}static Pi(t,e){let o=t.length;if(o<=1)return;let n=e.stamp,a=e.stampTick+1;a===4294967295&&(n.fill(0),a=1),e.stampTick=a;let u=0;for(let d=0;d<o;d++){let r=t[d],s=r.primitiveUid;if(s<0){t[u++]=r;continue}if(s>=n.length){let c=new Uint32Array(Math.max(s+1,n.length*2,64));c.set(n),e.stamp=c,n=c}n[s]!==a&&(n[s]=a,t[u++]=r)}t.length=u}static Zi(t,e){let o=t._sortkey-e._sortkey;return o!==0?o:t._viewDepth-e._viewDepth}static ji(t){let e=t.length,o=new Array(e+1);for(let n=0;n<e;n++)o[n]=t[n].primitiveUid;return o[e]=-1,o}static Gi(t){let e=i.Xn.get(t);return e===void 0&&(e={primitives:[],stamp:new Uint32Array(64),stampTick:0,culledEntityStamp:new Uint32Array(64),handledEntityStamp:new Uint32Array(64),meshCullTick:new WeakMap,cullTick:0,culledEntityCount:0,cullingId:0,keyedPrimitives:[],isGpuCullingActive:void 0,isComputeSkinningEnabled:void 0,culledInstancedMeshComponents:[],meshAppendTick:new WeakMap},i.Xn.set(t,e)),e}static common_$prerender(t){let e=t.objectUID,o=i.Kn;if(o===void 0||i.On!==e){if(o=i.Wn.get(e),o===void 0){let n=t.engineState.currentProcessApproach;if(this.common_$load({processApproach:n,engine:t}),o=i.Wn.get(e),o===void 0)return}i.On=e,i.Kn=o}o.prerender()}static common_$render({renderPass:t,renderPassTickCount:e,primitiveUids:o,displayIdx:n,engine:a}){return i.Wn.get(a.objectUID).common_$render(o,t,e,n)}$render(){}_shallowCopyFrom(t){let e=t;this.Zn=e.Zn,this.jn=e.jn,this.diffuseCubeMapContribution=e.diffuseCubeMapContribution,this.specularCubeMapContribution=e.specularCubeMapContribution,this.rotationOfCubeMap=e.rotationOfCubeMap}_destroy(){super._destroy(),this.Zn=void 0,this.jn=void 0}addThisComponentToEntity(t,e){class o extends t.constructor{getMeshRenderer(){return this.getComponentByComponentTID(E.MeshRendererComponentTID)}}return G(t,o),t}static _cleanupForEngine(t){let e=i.Wn.get(t.objectUID);e!=null&&e.destroy(),i.Wn.delete(t.objectUID),i.On===t.objectUID&&(i.On=-1,i.Kn=void 0)}};i.Wn=new Map,i.Fi=new Map,i.rt=0,i._isFrustumCullingEnabled=!0,i.Ri=0,i.ki=new Map,i.Ai=0,i.Xn=new WeakMap,i.On=-1;var x=i;export{x as MeshRendererComponent};
|
|
1
|
+
import{getMultiDrawStateKeyId as R,getPrimitiveMeshRendererFingerPrintId as A}from"../../../webgl/MultiDraw.js";import{Component as w}from"../../core/Component.js";import{applyMixins as G}from"../../core/EntityRepository.js";import{ProcessApproach as M}from"../../definitions/ProcessApproach.js";import{ProcessStage as B}from"../../definitions/ProcessStage.js";import{isBlend as P,isBlendWithoutZWrite as T,isBlendWithZWrite as k,isTranslucent as Z}from"../../geometry/types/GeometryTypes.js";import{ModuleManager as j}from"../../system/ModuleManager.js";import{CameraComponent as I}from"../Camera/CameraComponent.js";import{_getCameraControllerUpdateCount as U}from"../CameraController/CameraControllerUpdateCount.js";import{SceneGraphComponent as W}from"../SceneGraph/SceneGraphComponent.js";import{TransformComponent as D}from"../Transform/TransformComponent.js";import{WellKnownComponentTIDs as E}from"../WellKnownComponentTIDs.js";var i=class i extends w{constructor(t,e,o,n,a){super(t,e,o,n,a);this.Yn=1;this.Si=1;this.Mi=0;this.rt=0;this.Nn="";this.Ei=0;this.calcFingerPrint()}static get componentTID(){return E.MeshRendererComponentTID}get componentTID(){return E.MeshRendererComponentTID}get diffuseCubeMap(){return this.Zn}get specularCubeMap(){return this.jn}get sheenCubeMap(){return this.$n}get updateCount(){return this.rt}static get updateCount(){return i.rt}get diffuseCubeMapContribution(){return this.Yn}set diffuseCubeMapContribution(t){this.Yn=t,this.rt++,i.rt++}get specularCubeMapContribution(){return this.Si}set specularCubeMapContribution(t){this.Si=t,this.rt++,i.rt++}get rotationOfCubeMap(){return this.Mi}set rotationOfCubeMap(t){this.Mi=t,this.rt++,i.rt++}calcFingerPrint(){this.Nn=`${this.Zn!=null?this.Zn.textureUID:-1} ${this.jn!=null?this.jn.textureUID:-1} ${this.$n!=null?this.$n.textureUID:-1}`,this.Ei=i.wi(this.Nn)}static wi(t){let e=i.ki.get(t);return e==null&&(e=++i.Ai,i.ki.set(t,e)),e}getFingerPrint(){return this.Nn}getFingerPrintId(){return this.Ei}setIBLCubeMap(t,e,o){t==null||e==null||(this.Zn=t,this.jn=e,this.$n=o,this.calcFingerPrint(),this.rt++,i.rt++)}static common_$load({processApproach:t,engine:e}){let o=j.getInstance(),n=e.objectUID;if(t===M.WebGPU){let u=o.getModule("webgpu");i.Wn.has(n)||i.Wn.set(n,u.WebGpuStrategyBasic.init(e)),i.Wn.get(n).common_$load()}else{let u=o.getModule("webgl");i.Wn.has(n)||i.Wn.set(n,u.getRenderingStrategy(e,t)),i.Wn.get(n).common_$load()}}$load(){i.Wn.get(this.i.objectUID).$load(this.entity.tryToGetMesh())&&this.moveStageTo(B.Unknown)}static sort_$render(t,e){var y;let o=t.webglResourceRepository,n=o!=null?o.getMultiDrawRepository(t).version:0,a=i.Gi(e),u=i._isGpuCullingActive(t,e);if(D.getUpdateCount(t)===e._lastTransformComponentsUpdateCount&&U(t)===e._lastCameraControllerComponentsUpdateCount&&W.getUpdateCount(t)===e._lastSceneGraphComponentsUpdateCount&&n===e._lastMultiDrawGroupVersion&&u===a.isGpuCullingActive&&t.config.isComputeSkinningEnabled===a.isComputeSkinningEnabled)return e._lastPrimitiveUids;a.isGpuCullingActive=u,a.isComputeSkinningEnabled=t.config.isComputeSkinningEnabled;let d=e.cameraComponent;if(d==null&&(d=t.componentRepository.getComponent(I,I.getCurrent(t))),d==null&&(d=t.componentRepository.getComponentsWithType(I).find(m=>m==null?void 0:m._isAlive),I.setCurrent(t,d.componentSID)),e.isVrRendering){let r=t._webXRSystemIfEnabled;r!=null&&r.isWebXRMode&&(d=r._getCameraComponentAt(0))}let s=i.Bi(d,e._optimizedMeshComponents,a.primitives,a,u);i.Pi(s,a),s.length>1&&s.sort(i.Zi);let l=s.length-1,c=s.length-1,h=s.length-1,p=s.length-1;for(let r=0;r<s.length;r++){let m=s[r];if(Z(m)){l=r-1;break}if(k(m)){l=r-1;break}if(T(m)){l=r-1;break}}for(let r=l+1;r<s.length;r++){let m=s[r];if(k(m)){c=r-1;break}if(T(m)){c=r-1;break}}for(let r=c+1;r<s.length;r++){let m=s[r];if(T(m)){h=r-1;break}}if(l>0&&t.config.isMultiDrawEnabled&&M.isWebGL2Approach(t.engineState.currentProcessApproach)){let r=l+1,m=a.keyedPrimitives;if(m.length<r)for(let C=m.length;C<r;C++)m.push({primitive:null,keyId:0,index:0});else m.length=r;for(let C=0;C<r;C++){let b=s[C],v=e.getAppropriateMaterial(b),S=m[C];S.primitive=b,S.index=C,S.keyId=(y=R(b,v,A(b)))!=null?y:-(v.materialUID+1)}m.sort((C,b)=>C.keyId-b.keyId||C.index-b.index);for(let C=0;C<r;C++)s[C]=m[C].primitive}let g=i.ji(s),f=!1;if(l!==e._lastOpaqueIndex&&(e._lastOpaqueIndex=l,f||(f=!0)),c!==e._lastTranslucentIndex&&(e._lastTranslucentIndex=c,f||(f=!0)),h!==e._lastBlendWithZWriteIndex&&(e._lastBlendWithZWriteIndex=h,f||(f=!0)),p!==e._lastBlendWithoutZWriteIndex&&(e._lastBlendWithoutZWriteIndex=p,f||(f=!0)),g.length!==e._lastPrimitiveUids.length)f||(f=!0);else{let r=e._lastPrimitiveUids;for(let m=0;m<g.length;m++)if(g[m]!==r[m]){f||(f=!0);break}}return e._isChangedSortRenderResult=f,e._lastPrimitiveUids=g,e._lastPrimitives=s,e._lastTransformComponentsUpdateCount=D.getUpdateCount(t),e._lastCameraControllerComponentsUpdateCount=U(t),e._lastSceneGraphComponentsUpdateCount=W.getUpdateCount(t),e._lastMultiDrawGroupVersion=n,f&&(e._renderedSomethingBefore=!0),g}static Bi(t,e,o,n,a){var c;o.length=0;let u=n.cullTick+1;u===4294967295&&(n.culledEntityStamp.fill(0),n.handledEntityStamp.fill(0),n.meshCullTick=new WeakMap,n.meshAppendTick=new WeakMap,u=1),n.cullTick=u,n.culledEntityCount=0;let d=n.culledInstancedMeshComponents;d.length=0,n.cullingId=++i.Ri;let s=t!=null&&i._isFrustumCullingEnabled,l;s&&(t.updateFrustum(),l=t.frustum);for(let h=0;h<e.length;h++){let p=e[h];if(!p._isAlive)continue;let g=p.entity;if(g==null)continue;let f=g.getSceneGraph();if(n.handledEntityStamp=i.Ui(n.handledEntityStamp,p.entityUID,u),a&&((c=p.mesh)==null?void 0:c._isGpuCullable)===!0){f._isCulled=!1;let y=p.entity.tryToGetSkeletal();if(y!==void 0){let r=f.isVisible;r&&l!=null&&p.entity.getTagValue("type")!=="background-assets"&&(r=l.culling(p)),y._isCulled=!r}i.Jn(p,t,o),i.Wi(p,n,u);continue}if(!f.isVisible){i.Qn(n,p.entityUID,u),i.xi(p,n);continue}if(l!=null){let r=p.entity.getTagValue("type")==="background-assets"?!0:l.culling(p);f._isCulled=!r;let m=p.entity.tryToGetSkeletal();if(m!==void 0&&(m._isCulled=!r),!r){i.Qn(n,p.entityUID,u),i.xi(p,n);continue}}i.Jn(p,t,o),i.Wi(p,n,u)}return i.Vi(e,l,n,u,a),i.$i(t,o,n,u),o}static Vi(t,e,o,n,a){for(let u=0;u<t.length;u++){let d=t[u];if(!d._isAlive)continue;let s=d.mesh;if(s===void 0||a&&s._isGpuCullable)continue;let l=s.meshEntitiesInner;if(!(l.length<=1||o.meshCullTick.get(s)===n)){o.meshCullTick.set(s,n);for(let c=0;c<l.length;c++){let h=l[c],p=h.entityUID;if(p<o.handledEntityStamp.length&&o.handledEntityStamp[p]===n)continue;let g=h.getSceneGraph().isVisible;g&&e!=null&&h.getTagValue("type")!=="background-assets"&&(g=e.culling(h.getMesh())),g||i.Qn(o,p,n)}}}}static xi(t,e){let o=t.mesh;o!==void 0&&o.meshEntitiesInner.length>1&&e.culledInstancedMeshComponents.push(t)}static Wi(t,e,o){let n=t.mesh;n!==void 0&&e.meshAppendTick.set(n,o)}static $i(t,e,o,n){let a=o.culledInstancedMeshComponents,u=o.culledEntityStamp;for(let d=0;d<a.length;d++){let s=a[d],l=s.mesh;if(l===void 0||o.meshAppendTick.get(l)===n)continue;o.meshAppendTick.set(l,n);let c=l.meshEntitiesInner,h=!1;for(let p=0;p<c.length;p++){let g=c[p].entityUID;if(g>=u.length||u[g]!==n){h=!0;break}}h&&i.Jn(s,t,e)}a.length=0}static Qn(t,e,o){t.culledEntityStamp=i.Ui(t.culledEntityStamp,e,o),t.culledEntityCount++}static Ui(t,e,o){let n=t;return e>=t.length&&(n=new Uint32Array(Math.max(e+1,t.length*2,64)),n.set(t)),n[e]=o,n}static _isGpuCullingActive(t,e){if(!t.config.isGpuCullingEnabled||!i._isFrustumCullingEnabled||!M.isWebGpuApproach(t.engineState.currentProcessApproach)||e.isBufferLessRenderingMode())return!1;let o=t._webXRSystemIfEnabled;return!(e.isVrRendering&&(o!=null&&o.isWebXRMode)&&o.isMultiView())}static _getInstanceCullingState(t){let e=i.Xn.get(t);if(!(e===void 0||e.cullTick===0))return e}static Jn(t,e,o){let n=t.mesh;if(n===void 0)return;let a=n.primitives,u=a.length,d=!1;for(let s=0;s<u;s++){let l=a[s];o.push(l),!d&&P(l)&&(d=!0)}if(d){let s=t.calcViewDepth(e);for(let l=0;l<u;l++)a[l]._viewDepth=s}}static Pi(t,e){let o=t.length;if(o<=1)return;let n=e.stamp,a=e.stampTick+1;a===4294967295&&(n.fill(0),a=1),e.stampTick=a;let u=0;for(let d=0;d<o;d++){let s=t[d],l=s.primitiveUid;if(l<0){t[u++]=s;continue}if(l>=n.length){let c=new Uint32Array(Math.max(l+1,n.length*2,64));c.set(n),e.stamp=c,n=c}n[l]!==a&&(n[l]=a,t[u++]=s)}t.length=u}static Zi(t,e){let o=t._sortkey-e._sortkey;return o!==0?o:t._viewDepth-e._viewDepth}static ji(t){let e=t.length,o=new Array(e+1);for(let n=0;n<e;n++)o[n]=t[n].primitiveUid;return o[e]=-1,o}static Gi(t){let e=i.Xn.get(t);return e===void 0&&(e={primitives:[],stamp:new Uint32Array(64),stampTick:0,culledEntityStamp:new Uint32Array(64),handledEntityStamp:new Uint32Array(64),meshCullTick:new WeakMap,cullTick:0,culledEntityCount:0,cullingId:0,keyedPrimitives:[],isGpuCullingActive:void 0,isComputeSkinningEnabled:void 0,culledInstancedMeshComponents:[],meshAppendTick:new WeakMap},i.Xn.set(t,e)),e}static common_$prerender(t){let e=t.objectUID,o=i.Kn;if(o===void 0||i.On!==e){if(o=i.Wn.get(e),o===void 0){let n=t.engineState.currentProcessApproach;if(this.common_$load({processApproach:n,engine:t}),o=i.Wn.get(e),o===void 0)return}i.On=e,i.Kn=o}o.prerender()}static common_$render({renderPass:t,renderPassTickCount:e,primitiveUids:o,displayIdx:n,engine:a}){return i.Wn.get(a.objectUID).common_$render(o,t,e,n)}$render(){}_shallowCopyFrom(t){let e=t;this.Zn=e.Zn,this.jn=e.jn,this.diffuseCubeMapContribution=e.diffuseCubeMapContribution,this.specularCubeMapContribution=e.specularCubeMapContribution,this.rotationOfCubeMap=e.rotationOfCubeMap}_destroy(){super._destroy(),this.Zn=void 0,this.jn=void 0}addThisComponentToEntity(t,e){class o extends t.constructor{getMeshRenderer(){return this.getComponentByComponentTID(E.MeshRendererComponentTID)}}return G(t,o),t}static _cleanupForEngine(t){let e=i.Wn.get(t.objectUID);e!=null&&e.destroy(),i.Wn.delete(t.objectUID),i.On===t.objectUID&&(i.On=-1,i.Kn=void 0)}};i.Wn=new Map,i.Fi=new Map,i.rt=0,i._isFrustumCullingEnabled=!0,i.Ri=0,i.ki=new Map,i.Ai=0,i.Xn=new WeakMap,i.On=-1;var x=i;export{x as MeshRendererComponent};
|
|
@@ -40,6 +40,7 @@ export declare class SceneGraphComponent extends Component {
|
|
|
40
40
|
private _worldMatrix;
|
|
41
41
|
private _worldMatrixRest;
|
|
42
42
|
private _normalMatrix;
|
|
43
|
+
private _previousWorldMatrix;
|
|
43
44
|
private _worldRotation;
|
|
44
45
|
private __isWorldMatrixUpToDate;
|
|
45
46
|
/**
|
|
@@ -266,6 +267,21 @@ export declare class SceneGraphComponent extends Component {
|
|
|
266
267
|
* @returns The world matrix version
|
|
267
268
|
*/
|
|
268
269
|
get worldMatrixVersion(): number;
|
|
270
|
+
/**
|
|
271
|
+
* The world matrix of the previous frame, used by the motion vectors of temporal anti-aliasing.
|
|
272
|
+
* It is part of the GPU instance data (`get_previousWorldMatrix` in the shaders) and is only kept up to date
|
|
273
|
+
* while temporal anti-aliasing is enabled.
|
|
274
|
+
*
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
get _previousWorldMatrixInner(): MutableMatrix44;
|
|
278
|
+
/**
|
|
279
|
+
* The world matrix as it was last computed (the value in the GPU instance data), without recomputing a dirty
|
|
280
|
+
* matrix.
|
|
281
|
+
*
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
get _lastComputedWorldMatrixInner(): MutableMatrix44;
|
|
269
285
|
/**
|
|
270
286
|
* Marks the world matrix as dirty and propagates changes up the hierarchy.
|
|
271
287
|
*/
|