rhodonite 0.19.9 → 0.20.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 +32 -2
- package/VERSION-FILE +1 -1
- package/dist/esm/effekseer/main.d.ts +3 -1
- package/dist/esm/foundation/components/Animation/AnimationComponent.d.ts +15 -1
- package/dist/esm/foundation/components/Animation/AnimationStateRepository.d.ts +26 -10
- package/dist/esm/foundation/components/AnimationState/AnimationStateComponent.d.ts +14 -0
- package/dist/esm/foundation/components/CharacterController/CharacterAnimationController.d.ts +63 -0
- package/dist/esm/foundation/components/CharacterController/CharacterControllerComponent.d.ts +67 -0
- package/dist/esm/foundation/components/CharacterController/ICharacterControllerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/CharacterController/createCharacterControllerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/CharacterController/index.d.ts +4 -0
- package/dist/esm/foundation/components/ComponentTypes.d.ts +6 -0
- package/dist/esm/foundation/components/Physics/PhysicsComponent.d.ts +27 -0
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +30 -0
- package/dist/esm/foundation/components/Shape/IShapeEntity.d.ts +4 -0
- package/dist/esm/foundation/components/Shape/ShapeComponent.d.ts +43 -0
- package/dist/esm/foundation/components/Shape/createShapeEntity.d.ts +3 -0
- package/dist/esm/foundation/components/Shape/index.d.ts +3 -0
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +138 -45
- package/dist/esm/foundation/components/Transform/TransformComponent.d.ts +2 -3
- package/dist/esm/foundation/components/Trigger/ITriggerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/Trigger/TriggerComponent.d.ts +58 -0
- package/dist/esm/foundation/components/Trigger/index.d.ts +2 -0
- package/dist/esm/foundation/components/Vrm/VrmComponent.d.ts +16 -1
- package/dist/esm/foundation/components/WellKnownComponentTIDs.d.ts +4 -1
- package/dist/esm/foundation/components/index.d.ts +3 -0
- package/dist/esm/foundation/core/Component.d.ts +63 -3
- package/dist/esm/foundation/core/ComponentMemoryRegistry.d.ts +59 -1
- package/dist/esm/foundation/core/Config.d.ts +8 -7
- package/dist/esm/foundation/core/Entity.d.ts +15 -0
- package/dist/esm/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esm/foundation/definitions/PhysicsShapeType.d.ts +1 -0
- package/dist/esm/foundation/definitions/ProcessApproach.d.ts +8 -4
- package/dist/esm/foundation/exporter/Gltf2ExporterOps.d.ts +2 -0
- package/dist/esm/foundation/geometry/Shape.d.ts +35 -0
- package/dist/esm/foundation/geometry/index.d.ts +1 -0
- package/dist/esm/foundation/geometry/shapes/Cylinder.d.ts +16 -0
- package/dist/esm/foundation/geometry/shapes/index.d.ts +1 -0
- package/dist/esm/foundation/gizmos/ShapeGizmo.d.ts +22 -0
- package/dist/esm/foundation/gizmos/index.d.ts +1 -0
- package/dist/esm/foundation/helpers/EntityHelper.d.ts +6 -0
- package/dist/esm/foundation/helpers/MeshHelper.d.ts +275 -15
- package/dist/esm/foundation/importer/AnimationAssigner.d.ts +62 -3
- package/dist/esm/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esm/foundation/importer/Gltf2Importer.d.ts +6 -0
- package/dist/esm/foundation/importer/KhrPhysicsImporter.d.ts +58 -0
- package/dist/esm/foundation/importer/VrmaImporter.d.ts +11 -3
- package/dist/esm/foundation/importer/index.d.ts +2 -0
- package/dist/esm/foundation/math/AbstractMatrix.d.ts +3 -2
- package/dist/esm/foundation/math/AbstractQuaternion.d.ts +2 -1
- package/dist/esm/foundation/math/AnimatedQuaternion.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedScalar.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector2.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector3.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector4.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVectorN.d.ts +4 -0
- package/dist/esm/foundation/math/IAnimatedValue.d.ts +12 -0
- package/dist/esm/foundation/math/IMatrix.d.ts +2 -2
- package/dist/esm/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esm/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esm/foundation/math/MathUtil.d.ts +63 -1
- package/dist/esm/foundation/math/Matrix22.d.ts +176 -30
- package/dist/esm/foundation/math/Matrix33.d.ts +206 -38
- package/dist/esm/foundation/math/Matrix44.d.ts +222 -39
- package/dist/esm/foundation/math/MutableMatrix22.d.ts +125 -130
- package/dist/esm/foundation/math/MutableMatrix33.d.ts +148 -162
- package/dist/esm/foundation/math/MutableMatrix44.d.ts +159 -183
- package/dist/esm/foundation/math/MutableQuaternion.d.ts +241 -132
- package/dist/esm/foundation/math/MutableScalar.d.ts +11 -12
- package/dist/esm/foundation/math/MutableVector2.d.ts +30 -31
- package/dist/esm/foundation/math/MutableVector3.d.ts +28 -26
- package/dist/esm/foundation/math/MutableVector4.d.ts +37 -37
- package/dist/esm/foundation/math/Quaternion.d.ts +529 -36
- package/dist/esm/foundation/math/Scalar.d.ts +13 -14
- package/dist/esm/foundation/math/Vector2.d.ts +38 -38
- package/dist/esm/foundation/math/Vector3.d.ts +55 -54
- package/dist/esm/foundation/math/Vector4.d.ts +54 -55
- package/dist/esm/foundation/misc/MiscUtil.d.ts +79 -16
- package/dist/esm/foundation/misc/Time.d.ts +10 -1
- package/dist/esm/foundation/physics/CharacterControllerStrategy.d.ts +65 -0
- package/dist/esm/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +17 -1
- package/dist/esm/foundation/physics/PhysicsProperty.d.ts +43 -0
- package/dist/esm/foundation/physics/PhysicsStrategy.d.ts +15 -0
- package/dist/esm/foundation/physics/PhysicsWorldQuery.d.ts +65 -0
- package/dist/esm/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +58 -0
- package/dist/esm/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +157 -19
- package/dist/esm/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.d.ts +11 -0
- package/dist/esm/foundation/physics/Rapier/index.d.ts +2 -0
- package/dist/esm/foundation/physics/ShapeTransformResolver.d.ts +19 -0
- package/dist/esm/foundation/physics/index.d.ts +2 -0
- package/dist/esm/index.js +728 -723
- package/dist/esm/types/AnimationTypes.d.ts +1 -1
- package/dist/esm/types/KHR_implicit_shapes.d.ts +47 -0
- package/dist/esm/types/KHR_physics_rigid_bodies.d.ts +54 -0
- package/dist/esm/types/VRMC.d.ts +12 -12
- package/dist/esm/types/VRMC_vrm_animation.d.ts +5 -0
- package/dist/esm/types/glTF2.d.ts +8 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/webgl/main.d.ts +2 -1
- package/dist/esm/webgl/textureLoader/KTX2TextureLoader.d.ts +12 -0
- package/dist/esmdev/effekseer/main.d.ts +3 -1
- package/dist/esmdev/foundation/components/Animation/AnimationComponent.d.ts +15 -1
- package/dist/esmdev/foundation/components/Animation/AnimationStateRepository.d.ts +26 -10
- package/dist/esmdev/foundation/components/AnimationState/AnimationStateComponent.d.ts +14 -0
- package/dist/esmdev/foundation/components/CharacterController/CharacterAnimationController.d.ts +63 -0
- package/dist/esmdev/foundation/components/CharacterController/CharacterControllerComponent.d.ts +67 -0
- package/dist/esmdev/foundation/components/CharacterController/ICharacterControllerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/CharacterController/createCharacterControllerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/CharacterController/index.d.ts +4 -0
- package/dist/esmdev/foundation/components/ComponentTypes.d.ts +6 -0
- package/dist/esmdev/foundation/components/Physics/PhysicsComponent.d.ts +27 -0
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +30 -0
- package/dist/esmdev/foundation/components/Shape/IShapeEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/Shape/ShapeComponent.d.ts +43 -0
- package/dist/esmdev/foundation/components/Shape/createShapeEntity.d.ts +3 -0
- package/dist/esmdev/foundation/components/Shape/index.d.ts +3 -0
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +138 -45
- package/dist/esmdev/foundation/components/Transform/TransformComponent.d.ts +2 -3
- package/dist/esmdev/foundation/components/Trigger/ITriggerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/Trigger/TriggerComponent.d.ts +58 -0
- package/dist/esmdev/foundation/components/Trigger/index.d.ts +2 -0
- package/dist/esmdev/foundation/components/Vrm/VrmComponent.d.ts +16 -1
- package/dist/esmdev/foundation/components/WellKnownComponentTIDs.d.ts +4 -1
- package/dist/esmdev/foundation/components/index.d.ts +3 -0
- package/dist/esmdev/foundation/core/Component.d.ts +63 -3
- package/dist/esmdev/foundation/core/ComponentMemoryRegistry.d.ts +59 -1
- package/dist/esmdev/foundation/core/Config.d.ts +8 -7
- package/dist/esmdev/foundation/core/Entity.d.ts +15 -0
- package/dist/esmdev/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esmdev/foundation/definitions/PhysicsShapeType.d.ts +1 -0
- package/dist/esmdev/foundation/definitions/ProcessApproach.d.ts +8 -4
- package/dist/esmdev/foundation/exporter/Gltf2ExporterOps.d.ts +2 -0
- package/dist/esmdev/foundation/geometry/Shape.d.ts +35 -0
- package/dist/esmdev/foundation/geometry/index.d.ts +1 -0
- package/dist/esmdev/foundation/geometry/shapes/Cylinder.d.ts +16 -0
- package/dist/esmdev/foundation/geometry/shapes/index.d.ts +1 -0
- package/dist/esmdev/foundation/gizmos/ShapeGizmo.d.ts +22 -0
- package/dist/esmdev/foundation/gizmos/index.d.ts +1 -0
- package/dist/esmdev/foundation/helpers/EntityHelper.d.ts +6 -0
- package/dist/esmdev/foundation/helpers/MeshHelper.d.ts +275 -15
- package/dist/esmdev/foundation/importer/AnimationAssigner.d.ts +62 -3
- package/dist/esmdev/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esmdev/foundation/importer/Gltf2Importer.d.ts +6 -0
- package/dist/esmdev/foundation/importer/KhrPhysicsImporter.d.ts +58 -0
- package/dist/esmdev/foundation/importer/VrmaImporter.d.ts +11 -3
- package/dist/esmdev/foundation/importer/index.d.ts +2 -0
- package/dist/esmdev/foundation/math/AbstractMatrix.d.ts +3 -2
- package/dist/esmdev/foundation/math/AbstractQuaternion.d.ts +2 -1
- package/dist/esmdev/foundation/math/AnimatedQuaternion.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedScalar.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector2.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector3.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector4.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVectorN.d.ts +4 -0
- package/dist/esmdev/foundation/math/IAnimatedValue.d.ts +12 -0
- package/dist/esmdev/foundation/math/IMatrix.d.ts +2 -2
- package/dist/esmdev/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esmdev/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esmdev/foundation/math/MathUtil.d.ts +63 -1
- package/dist/esmdev/foundation/math/Matrix22.d.ts +176 -30
- package/dist/esmdev/foundation/math/Matrix33.d.ts +206 -38
- package/dist/esmdev/foundation/math/Matrix44.d.ts +222 -39
- package/dist/esmdev/foundation/math/MutableMatrix22.d.ts +125 -130
- package/dist/esmdev/foundation/math/MutableMatrix33.d.ts +148 -162
- package/dist/esmdev/foundation/math/MutableMatrix44.d.ts +159 -183
- package/dist/esmdev/foundation/math/MutableQuaternion.d.ts +241 -132
- package/dist/esmdev/foundation/math/MutableScalar.d.ts +11 -12
- package/dist/esmdev/foundation/math/MutableVector2.d.ts +30 -31
- package/dist/esmdev/foundation/math/MutableVector3.d.ts +28 -26
- package/dist/esmdev/foundation/math/MutableVector4.d.ts +37 -37
- package/dist/esmdev/foundation/math/Quaternion.d.ts +529 -36
- package/dist/esmdev/foundation/math/Scalar.d.ts +13 -14
- package/dist/esmdev/foundation/math/Vector2.d.ts +38 -38
- package/dist/esmdev/foundation/math/Vector3.d.ts +55 -54
- package/dist/esmdev/foundation/math/Vector4.d.ts +54 -55
- package/dist/esmdev/foundation/misc/MiscUtil.d.ts +79 -16
- package/dist/esmdev/foundation/misc/Time.d.ts +10 -1
- package/dist/esmdev/foundation/physics/CharacterControllerStrategy.d.ts +65 -0
- package/dist/esmdev/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +17 -1
- package/dist/esmdev/foundation/physics/PhysicsProperty.d.ts +43 -0
- package/dist/esmdev/foundation/physics/PhysicsStrategy.d.ts +15 -0
- package/dist/esmdev/foundation/physics/PhysicsWorldQuery.d.ts +65 -0
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +58 -0
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +157 -19
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.d.ts +11 -0
- package/dist/esmdev/foundation/physics/Rapier/index.d.ts +2 -0
- package/dist/esmdev/foundation/physics/ShapeTransformResolver.d.ts +19 -0
- package/dist/esmdev/foundation/physics/index.d.ts +2 -0
- package/dist/esmdev/index.js +35168 -27712
- package/dist/esmdev/types/AnimationTypes.d.ts +1 -1
- package/dist/esmdev/types/KHR_implicit_shapes.d.ts +47 -0
- package/dist/esmdev/types/KHR_physics_rigid_bodies.d.ts +54 -0
- package/dist/esmdev/types/VRMC.d.ts +12 -12
- package/dist/esmdev/types/VRMC_vrm_animation.d.ts +5 -0
- package/dist/esmdev/types/glTF2.d.ts +8 -0
- package/dist/esmdev/types/index.d.ts +2 -0
- package/dist/esmdev/webgl/main.d.ts +2 -1
- package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.d.ts +12 -0
- package/package.json +25 -23
|
@@ -2,6 +2,7 @@ import type { ComponentSID, ComponentTID, EntityUID, Index, TypedArray } from '.
|
|
|
2
2
|
import { Component } from '../../core/Component';
|
|
3
3
|
import type { IEntity } from '../../core/Entity';
|
|
4
4
|
import { type EntityRepository } from '../../core/EntityRepository';
|
|
5
|
+
import { type BoneDataTypeEnum } from '../../definitions/BoneDataType';
|
|
5
6
|
import type { ISkeletalEntity } from '../../helpers/EntityHelper';
|
|
6
7
|
import type { IMatrix44 } from '../../math/IMatrix';
|
|
7
8
|
import { Matrix44 } from '../../math/Matrix44';
|
|
@@ -24,13 +25,36 @@ export declare class SkeletalComponent extends Component {
|
|
|
24
25
|
private __jointMatrices?;
|
|
25
26
|
topOfJointsHierarchy?: SceneGraphComponent;
|
|
26
27
|
isSkinning: boolean;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
/**
|
|
29
|
+
* GPU bone data of all joints. The layout per joint depends on the bone data type:
|
|
30
|
+
* - Mat43x1: 3 vec4 per joint (4x3 matrix, column-major)
|
|
31
|
+
* - Vec4x2: 2 vec4 per joint ([translation.xyz, logQuat.lo], [scale.xyz, logQuat.hi]).
|
|
32
|
+
* The x scale is negative for a mirrored joint matrix.
|
|
33
|
+
* - Vec4x1: 1 vec4 per joint ([logQuat.lo, logQuat.hi, packedTranslateScale.lo, packedTranslateScale.hi]).
|
|
34
|
+
* packedTranslateScale is snorm16 x 4: the translation divided by `_boneDataInfo.xyz`, and
|
|
35
|
+
* log2(|uniform scale|) / 16 (see MathUtil.encodeVec4x1Scale). Bit 31 of logQuat.hi is the sign of the scale.
|
|
36
|
+
*
|
|
37
|
+
* This is a variable-length member: each component gets exactly (joint count) x (vec4 per joint) vec4s,
|
|
38
|
+
* even though skeletal components share buffer views, and shaders find it through `_boneDataLocation`.
|
|
39
|
+
*/
|
|
40
|
+
private _boneData;
|
|
41
|
+
/**
|
|
42
|
+
* The location of `_boneData` in the GPU data (written by the memory allocation of Component).
|
|
43
|
+
*/
|
|
44
|
+
private _boneDataLocation;
|
|
45
|
+
/**
|
|
46
|
+
* Per-component bone data info: xyz = dequantization factors of translation (Vec4x1 only),
|
|
47
|
+
* w = bone data type index (used by shaders to select the decoding path).
|
|
48
|
+
*/
|
|
49
|
+
private _boneDataInfo;
|
|
50
|
+
private __boneDataUint32?;
|
|
51
|
+
private __boneDataType;
|
|
52
|
+
/** Whether __boneDataType was chosen automatically (an automatic Vec4x1 may be switched to Vec4x2) */
|
|
53
|
+
private __isBoneDataTypeAutoSelected;
|
|
54
|
+
private __hasWarnedNonUniformScale;
|
|
55
|
+
private __allocatedBoneDataType?;
|
|
56
|
+
private __boneDataArrayLength;
|
|
57
|
+
private __boneTranslateScaleWork;
|
|
34
58
|
private __jointMatrix;
|
|
35
59
|
private __isWorldMatrixVanilla;
|
|
36
60
|
_isCulled: boolean;
|
|
@@ -41,7 +65,6 @@ export declare class SkeletalComponent extends Component {
|
|
|
41
65
|
private __skinCacheKey?;
|
|
42
66
|
private __inverseBindMatricesSignature?;
|
|
43
67
|
private static __tookGlobalDataNum;
|
|
44
|
-
private static __tmpVec3_0;
|
|
45
68
|
private static __tmp_mat4;
|
|
46
69
|
private static __tmp_q;
|
|
47
70
|
private static __tmp_mat4_2;
|
|
@@ -90,71 +113,85 @@ export declare class SkeletalComponent extends Component {
|
|
|
90
113
|
*/
|
|
91
114
|
setJoints(joints: SceneGraphComponent[]): void;
|
|
92
115
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
116
|
+
* Gets the effective bone data type of this component.
|
|
117
|
+
* If Config.boneDataType is set, it overrides the bone data type of each component.
|
|
118
|
+
*
|
|
119
|
+
* @returns The effective bone data type
|
|
96
120
|
*/
|
|
97
|
-
|
|
121
|
+
get boneDataType(): BoneDataTypeEnum;
|
|
98
122
|
/**
|
|
99
|
-
*
|
|
123
|
+
* Sets the bone data type of this component.
|
|
124
|
+
* Mat43x1 is the most precise (and the largest), Vec4x2 supports non-uniform scale,
|
|
125
|
+
* and Vec4x1 is the most compact but supports only uniform scale.
|
|
126
|
+
* If joints are already set and the GPU data layout changes, the bone data is re-allocated.
|
|
127
|
+
* Note that Config.boneDataType, if set, takes precedence over this value.
|
|
100
128
|
*
|
|
101
|
-
*
|
|
129
|
+
* If a non-uniform scale is found at runtime with Vec4x1, an automatically selected Vec4x1 is switched to Vec4x2,
|
|
130
|
+
* while an explicitly specified Vec4x1 is kept (the largest scale is used, and a warning is logged once).
|
|
131
|
+
*
|
|
132
|
+
* @param boneDataType - The bone data type to use
|
|
133
|
+
* @param isAutoSelected - True if the type was chosen automatically (e.g. by the glTF importer) rather than
|
|
134
|
+
* specified by the user
|
|
102
135
|
*/
|
|
103
|
-
|
|
136
|
+
setBoneDataType(boneDataType: BoneDataTypeEnum, isAutoSelected?: boolean): void;
|
|
104
137
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* @returns The world matrix of the top joint, or undefined if no top joint exists
|
|
138
|
+
* Re-allocates the bone data if the effective bone data type differs from the allocated layout.
|
|
108
139
|
*/
|
|
109
|
-
|
|
140
|
+
private __ensureBoneDataLayout;
|
|
110
141
|
/**
|
|
111
|
-
*
|
|
142
|
+
* Calculates the array length (in vec4) of the bone data.
|
|
143
|
+
* The bone data is a variable-length member, so this is exact regardless of skeletalComponentCountPerBufferView.
|
|
112
144
|
*
|
|
113
|
-
* @
|
|
145
|
+
* @param boneDataType - The bone data type
|
|
146
|
+
* @param jointCount - The number of joints
|
|
147
|
+
* @returns The array length in vec4
|
|
114
148
|
*/
|
|
115
|
-
|
|
149
|
+
private static __calcBoneDataArrayLength;
|
|
116
150
|
/**
|
|
117
|
-
*
|
|
151
|
+
* Returns the per-instance array length of the bone data for memory allocation.
|
|
118
152
|
*
|
|
119
|
-
* @
|
|
153
|
+
* @param memberName - The name of the member field
|
|
154
|
+
* @returns The array length, or undefined for other members
|
|
120
155
|
*/
|
|
121
|
-
|
|
156
|
+
protected _getArrayLengthForAllocation(memberName: string): number | undefined;
|
|
157
|
+
private __setBoneDataInfo;
|
|
122
158
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
159
|
+
* Lightweight joint update for remapping during shallow copy.
|
|
160
|
+
* Only updates joint references without reinitializing buffers.
|
|
161
|
+
* Used when joints are remapped to new entities during shallow copy.
|
|
126
162
|
*/
|
|
127
|
-
|
|
163
|
+
updateJointsLightweight(joints: SceneGraphComponent[]): void;
|
|
128
164
|
/**
|
|
129
|
-
* Gets
|
|
165
|
+
* Gets a copy of the joints array.
|
|
130
166
|
*
|
|
131
|
-
* @returns
|
|
167
|
+
* @returns A copy of the SceneGraphComponents representing the joints
|
|
132
168
|
*/
|
|
133
|
-
|
|
169
|
+
getJoints(): SceneGraphComponent[];
|
|
134
170
|
/**
|
|
135
|
-
* Gets the
|
|
171
|
+
* Gets the world matrix of the root joint in the hierarchy.
|
|
136
172
|
*
|
|
137
|
-
* @returns The
|
|
173
|
+
* @returns The world matrix of the top joint, or undefined if no top joint exists
|
|
138
174
|
*/
|
|
139
|
-
get
|
|
175
|
+
get rootJointWorldMatrixInner(): MutableMatrix44 | undefined;
|
|
140
176
|
/**
|
|
141
|
-
* Gets the joint matrices array
|
|
177
|
+
* Gets the computed joint matrices array.
|
|
142
178
|
*
|
|
143
|
-
* @returns The
|
|
179
|
+
* @returns The joint matrices array
|
|
144
180
|
*/
|
|
145
|
-
get
|
|
181
|
+
get jointMatrices(): number[] | undefined;
|
|
146
182
|
/**
|
|
147
|
-
* Gets the
|
|
183
|
+
* Gets the GPU bone data array of all joints.
|
|
184
|
+
* The layout depends on the bone data type (see the `boneDataType` getter).
|
|
148
185
|
*
|
|
149
|
-
* @returns The Float32Array containing
|
|
186
|
+
* @returns The Float32Array containing the bone data
|
|
150
187
|
*/
|
|
151
|
-
get
|
|
188
|
+
get boneDataArray(): TypedArray;
|
|
152
189
|
/**
|
|
153
|
-
* Gets the
|
|
190
|
+
* Gets the bone data info (xyz: translation dequantization factors for Vec4x1, w: bone data type index).
|
|
154
191
|
*
|
|
155
|
-
* @returns The
|
|
192
|
+
* @returns The bone data info vector
|
|
156
193
|
*/
|
|
157
|
-
get
|
|
194
|
+
get boneDataInfo(): MutableVector4;
|
|
158
195
|
/**
|
|
159
196
|
* Gets a copy of the world matrix.
|
|
160
197
|
*
|
|
@@ -210,6 +247,53 @@ export declare class SkeletalComponent extends Component {
|
|
|
210
247
|
* Only follower joints are registered for early return (__currentFrameCachedEntityUIDs).
|
|
211
248
|
*/
|
|
212
249
|
$logic(): void;
|
|
250
|
+
/**
|
|
251
|
+
* Calculates the determinant of the upper-left 3x3 part of a column-major 4x4 matrix.
|
|
252
|
+
*
|
|
253
|
+
* @param v - The matrix elements (column-major)
|
|
254
|
+
* @returns The determinant
|
|
255
|
+
*/
|
|
256
|
+
private static __determinant3x3;
|
|
257
|
+
/**
|
|
258
|
+
* Extracts the rotation R of M = T * R * S, given the (signed) scales of S.
|
|
259
|
+
* The columns of the upper-left 3x3 of `m` are divided by the scales in place.
|
|
260
|
+
*
|
|
261
|
+
* If the rotation cannot be extracted (e.g. a zero scale used to hide a part of a mesh), the identity is
|
|
262
|
+
* returned without logging an error, since the rotation does not affect the result in that case.
|
|
263
|
+
*
|
|
264
|
+
* @param m - The matrix to decompose (overwritten)
|
|
265
|
+
* @param sx - The x scale (negative for a mirrored axis)
|
|
266
|
+
* @param sy - The y scale (negative for a mirrored axis)
|
|
267
|
+
* @param sz - The z scale (negative for a mirrored axis)
|
|
268
|
+
* @returns The rotation (a shared temporary quaternion)
|
|
269
|
+
*/
|
|
270
|
+
private static __extractRotation;
|
|
271
|
+
/**
|
|
272
|
+
* Handles a non-uniform scale found with the Vec4x1 bone data type, which supports only uniform scale.
|
|
273
|
+
* An automatically selected Vec4x1 is switched to Vec4x2. An explicitly specified Vec4x1 (setBoneDataType or
|
|
274
|
+
* Config.boneDataType) is kept, and a warning is logged once (the largest scale of each joint is used).
|
|
275
|
+
*
|
|
276
|
+
* The components sharing the skinning cache with this one are switched together. Otherwise they would get
|
|
277
|
+
* a different cache key and lose the shared result, and a follower would fall back to its own joints, which
|
|
278
|
+
* may not be animated (see the AnimationComponent early return). If any of them specifies Vec4x1 explicitly,
|
|
279
|
+
* none of them is switched.
|
|
280
|
+
*
|
|
281
|
+
* @returns True if the bone data type has been switched to Vec4x2
|
|
282
|
+
*/
|
|
283
|
+
private __handleNonUniformScaleOfVec4x1;
|
|
284
|
+
/**
|
|
285
|
+
* Gets the skeletal components that share the skinning cache with this component (including this one).
|
|
286
|
+
*
|
|
287
|
+
* @returns The components with the same skinning cache key
|
|
288
|
+
*/
|
|
289
|
+
private __getComponentsSharingSkinCache;
|
|
290
|
+
/**
|
|
291
|
+
* Gets a CPU-side work buffer for translation and scale (used only in Vec4x1 bone data type).
|
|
292
|
+
*
|
|
293
|
+
* @param boneDataType - The bone data type
|
|
294
|
+
* @returns The work buffer (empty unless Vec4x1)
|
|
295
|
+
*/
|
|
296
|
+
private __getTranslateScaleWork;
|
|
213
297
|
/**
|
|
214
298
|
* Copies matrix data to the matrix array in a specific format.
|
|
215
299
|
* Extracts the first 3 rows of a 4x4 matrix (Mat43 format) for efficient GPU storage.
|
|
@@ -280,7 +364,16 @@ export declare class SkeletalComponent extends Component {
|
|
|
280
364
|
*/
|
|
281
365
|
_getInverseBindMatrices(sg: SceneGraphComponent): IMatrix44;
|
|
282
366
|
private __copyBoneBuffersFrom;
|
|
283
|
-
|
|
367
|
+
/**
|
|
368
|
+
* Registers the bone data member and its location member.
|
|
369
|
+
* The bone data is a variable-length member, so its size is decided per component
|
|
370
|
+
* (see `_getArrayLengthForAllocation`).
|
|
371
|
+
*/
|
|
372
|
+
static _registerBoneDataMember(): void;
|
|
373
|
+
/**
|
|
374
|
+
* Registers the bone data info member (one vec4 per component).
|
|
375
|
+
*/
|
|
376
|
+
static _registerBoneDataInfoMember(): void;
|
|
284
377
|
private static __buildJointListKey;
|
|
285
378
|
private static __hashBytes;
|
|
286
379
|
private static __getAccessorSignature;
|
|
@@ -9,7 +9,6 @@ import type { MutableMatrix44 } from '../../math/MutableMatrix44';
|
|
|
9
9
|
import type { MutableVector3 } from '../../math/MutableVector3';
|
|
10
10
|
import { Quaternion } from '../../math/Quaternion';
|
|
11
11
|
import { Transform3D } from '../../math/Transform3D';
|
|
12
|
-
import { Vector3 } from '../../math/Vector3';
|
|
13
12
|
import type { Engine } from '../../system/Engine';
|
|
14
13
|
import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
15
14
|
/**
|
|
@@ -145,7 +144,7 @@ export declare class TransformComponent extends Component {
|
|
|
145
144
|
* Gets the internal mutable local Euler angles vector.
|
|
146
145
|
* @returns The internal mutable Euler angles vector
|
|
147
146
|
*/
|
|
148
|
-
get localEulerAnglesInner(): Vector3;
|
|
147
|
+
get localEulerAnglesInner(): import("../..").Vector3;
|
|
149
148
|
/**
|
|
150
149
|
* Sets the local Euler angles as rest pose.
|
|
151
150
|
* @param vec - The Euler angles vector to set as rest (XYZ order)
|
|
@@ -160,7 +159,7 @@ export declare class TransformComponent extends Component {
|
|
|
160
159
|
* Gets the internal mutable local Euler angles rest vector.
|
|
161
160
|
* @returns The internal mutable rest Euler angles vector
|
|
162
161
|
*/
|
|
163
|
-
get localEulerAnglesRestInner(): Vector3;
|
|
162
|
+
get localEulerAnglesRestInner(): import("../..").Vector3;
|
|
164
163
|
/**
|
|
165
164
|
* Sets the local scale and updates physics if applicable.
|
|
166
165
|
* @param vec - The new scale vector
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ComponentSID, ComponentTID, EntityUID } from '../../../types/CommonTypes';
|
|
2
|
+
import { Component } from '../../core/Component';
|
|
3
|
+
import type { IEntity } from '../../core/Entity';
|
|
4
|
+
import { type EntityRepository } from '../../core/EntityRepository';
|
|
5
|
+
import type { Engine } from '../../system/Engine';
|
|
6
|
+
import { type EventSubscriberIndex } from '../../system/EventPubSub';
|
|
7
|
+
import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
8
|
+
export type TriggerEventType = 'enter' | 'stay' | 'exit';
|
|
9
|
+
export interface TriggerEvent {
|
|
10
|
+
type: TriggerEventType;
|
|
11
|
+
triggerComponent: TriggerComponent;
|
|
12
|
+
triggerEntity: IEntity;
|
|
13
|
+
otherEntity: IEntity;
|
|
14
|
+
sensorBindingId: number;
|
|
15
|
+
otherBindingId?: number;
|
|
16
|
+
}
|
|
17
|
+
/** Groups one or more physics sensors into a logical trigger volume. */
|
|
18
|
+
export declare class TriggerComponent extends Component {
|
|
19
|
+
private static __sensorOwners;
|
|
20
|
+
private static __components;
|
|
21
|
+
private static __physicsSteps;
|
|
22
|
+
private static __fallbackPhysicsStep;
|
|
23
|
+
private __pubsub;
|
|
24
|
+
private __sensorKeys;
|
|
25
|
+
private __activeOverlaps;
|
|
26
|
+
constructor(engine: Engine, entityUid: EntityUID, componentSid: ComponentSID, entityRepository: EntityRepository, isReUse: boolean);
|
|
27
|
+
static get componentTID(): 19;
|
|
28
|
+
get componentTID(): ComponentTID;
|
|
29
|
+
subscribe(type: TriggerEventType, handler: (event: TriggerEvent) => void): EventSubscriberIndex;
|
|
30
|
+
unsubscribe(type: TriggerEventType, index: EventSubscriberIndex): void;
|
|
31
|
+
get activeOverlapCount(): number;
|
|
32
|
+
/** @internal Associates a PhysicsComponent binding with this logical trigger. */
|
|
33
|
+
_registerSensorBinding(physicsEntityUid: EntityUID, bindingId: number): void;
|
|
34
|
+
/** @internal Removes ownership when a sensor binding is permanently deleted. */
|
|
35
|
+
static _unregisterSensorBinding(engine: Engine, physicsEntityUid: EntityUID, sensorBindingId: number): void;
|
|
36
|
+
/** @internal Called by the Rapier event bridge. */
|
|
37
|
+
static _processOverlap(engine: Engine, sensorEntityUid: EntityUID, sensorBindingId: number, otherEntity: IEntity, otherBindingId: number | undefined, started: boolean, otherColliderHandle?: number): void;
|
|
38
|
+
/** @internal Starts reconciliation of collider pairs suspended before this physics step. */
|
|
39
|
+
static _beginPhysicsStep(engine?: Engine): void;
|
|
40
|
+
/** @internal Ends suspended overlaps that were not restored by the current physics step. */
|
|
41
|
+
static _finalizeRebuiltOverlaps(engine?: Engine): void;
|
|
42
|
+
/** @internal Emits one Stay event per active logical overlap after each physics step. */
|
|
43
|
+
static _publishStayEvents(engine?: Engine): void;
|
|
44
|
+
/** @internal Temporarily suspends overlaps owned by a sensor collider that is being rebuilt. */
|
|
45
|
+
static _suspendSensorBinding(engine: Engine, physicsEntityUid: EntityUID, sensorBindingId: number): void;
|
|
46
|
+
/** @internal Temporarily suspends overlaps in which a collider being rebuilt is the non-owning side. */
|
|
47
|
+
static _suspendOtherBinding(otherEntity: IEntity, otherBindingId: number | undefined, otherColliderHandle?: number): void;
|
|
48
|
+
/** @internal Ends overlaps owned by a sensor collider that is being permanently removed. */
|
|
49
|
+
static _deactivateSensorBinding(engine: Engine, physicsEntityUid: EntityUID, sensorBindingId: number): void;
|
|
50
|
+
/** @internal Ends overlaps in which a collider being removed is the non-owning side. */
|
|
51
|
+
static _deactivateOtherBinding(otherEntity: IEntity, otherBindingId: number | undefined, otherColliderHandle?: number): void;
|
|
52
|
+
private __publish;
|
|
53
|
+
private static __sensorKey;
|
|
54
|
+
private static __getPhysicsStep;
|
|
55
|
+
private static __matchesOtherBinding;
|
|
56
|
+
_destroy(): void;
|
|
57
|
+
addThisComponentToEntity<EntityBase extends IEntity, SomeComponentClass extends typeof Component>(base: EntityBase, _componentClass: SomeComponentClass): ComponentToComponentMethods<SomeComponentClass> & EntityBase;
|
|
58
|
+
}
|
|
@@ -51,11 +51,26 @@ export declare class VrmComponent extends Component {
|
|
|
51
51
|
setVrmExpressions(expressions: VrmExpression[]): void;
|
|
52
52
|
/**
|
|
53
53
|
* Sets the weight for a specific VRM expression.
|
|
54
|
-
* This method
|
|
54
|
+
* This method clamps the input, applies binary-expression behavior, and updates
|
|
55
|
+
* all associated blend shape binds using the accumulated contribution from every expression.
|
|
55
56
|
* @param expressionName - The name of the expression to modify
|
|
56
57
|
* @param weight - The weight value to apply (typically between 0 and 1)
|
|
57
58
|
*/
|
|
58
59
|
setExpressionWeight(expressionName: VrmExpressionName, weight: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* Sets multiple VRM expression weights and updates morph targets in one pass.
|
|
62
|
+
* This is used when several expression animation channels are evaluated together.
|
|
63
|
+
* @param expressionWeights - Expression names and their evaluated weights
|
|
64
|
+
*/
|
|
65
|
+
setExpressionWeights(expressionWeights: ReadonlyMap<VrmExpressionName, number>): void;
|
|
66
|
+
private __setExpressionWeight;
|
|
67
|
+
/**
|
|
68
|
+
* Recomputes morph target weights from all expression contributions.
|
|
69
|
+
*
|
|
70
|
+
* Multiple VRM expressions may bind the same morph target. Applying each expression directly
|
|
71
|
+
* would make the result depend on map insertion order, so contributions are accumulated first.
|
|
72
|
+
*/
|
|
73
|
+
private __applyExpressionWeightsToMorphTargets;
|
|
59
74
|
/**
|
|
60
75
|
* Gets the current weight of a specific VRM expression.
|
|
61
76
|
* @param expressionName - The name of the expression to query
|
|
@@ -15,5 +15,8 @@ export declare const WellKnownComponentTIDs: {
|
|
|
15
15
|
readonly VrmComponentTID: 14;
|
|
16
16
|
readonly ConstraintComponentTID: 15;
|
|
17
17
|
readonly RaymarchingComponentTID: 16;
|
|
18
|
-
readonly
|
|
18
|
+
readonly CharacterControllerComponentTID: 17;
|
|
19
|
+
readonly ShapeComponentTID: 18;
|
|
20
|
+
readonly TriggerComponentTID: 19;
|
|
21
|
+
readonly maxWellKnownTidNumber: 19;
|
|
19
22
|
};
|
|
@@ -3,6 +3,7 @@ export * from './AnimationState/index';
|
|
|
3
3
|
export * from './BlendShape/index';
|
|
4
4
|
export * from './Camera/index';
|
|
5
5
|
export * from './CameraController/index';
|
|
6
|
+
export * from './CharacterController/index';
|
|
6
7
|
export * from './ComponentTypes';
|
|
7
8
|
export * from './Constraint/index';
|
|
8
9
|
export * from './Light/index';
|
|
@@ -12,7 +13,9 @@ export * from './Physics/index';
|
|
|
12
13
|
export * from './Raymarching/index';
|
|
13
14
|
export * from './registerComponents';
|
|
14
15
|
export * from './SceneGraph/index';
|
|
16
|
+
export * from './Shape/index';
|
|
15
17
|
export * from './Skeletal/index';
|
|
16
18
|
export * from './Transform/index';
|
|
19
|
+
export * from './Trigger/index';
|
|
17
20
|
export * from './Vrm/index';
|
|
18
21
|
export * from './WellKnownComponentTIDs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentTypeEnum } from '../../foundation/definitions/ComponentType';
|
|
2
2
|
import { type CompositionTypeEnum } from '../../foundation/definitions/CompositionType';
|
|
3
3
|
import type { ComponentSID, Count, EntityUID, IndexOf16Bytes } from '../../types/CommonTypes';
|
|
4
4
|
import type { ComponentToComponentMethods } from '../components/ComponentTypes';
|
|
@@ -29,6 +29,15 @@ export type MemberInfo = {
|
|
|
29
29
|
componentType: ComponentTypeEnum;
|
|
30
30
|
initValues: number[] | VectorN;
|
|
31
31
|
convertToBool?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Multiplier applied to the uniform array length in uniform mode
|
|
34
|
+
* (the array length becomes Config.maxSkeletalBoneNumberForUniformMode * this value).
|
|
35
|
+
*/
|
|
36
|
+
uniformArrayLengthMultiplier?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this array member has a per-instance length (see `Component.registerMember`).
|
|
39
|
+
*/
|
|
40
|
+
isVariableLength?: boolean;
|
|
32
41
|
};
|
|
33
42
|
type MemberName = string;
|
|
34
43
|
/**
|
|
@@ -165,12 +174,45 @@ export declare class Component extends RnObject {
|
|
|
165
174
|
* @param memberName - The name of the member field
|
|
166
175
|
* @param dataClassType - The data class type for the member
|
|
167
176
|
* @param initValues - Initial values to set for the member
|
|
168
|
-
* @param
|
|
177
|
+
* @param _isReUse - Whether this component is being reused (the existing slot is detected from the accessor)
|
|
169
178
|
* @param componentSid - The component scoped ID
|
|
170
179
|
* @param componentCountPerBufferView - The number of components per buffer view
|
|
171
180
|
* @returns null on success
|
|
172
181
|
*/
|
|
173
182
|
private __takeOne;
|
|
183
|
+
/**
|
|
184
|
+
* Allocates memory for a variable-length array member of this component instance.
|
|
185
|
+
*
|
|
186
|
+
* Unlike fixed members, the data is not placed in the slot layout shared by the components of a buffer view.
|
|
187
|
+
* Each instance gets its own chunk sized by `_getArrayLengthForAllocation`, and the location of the chunk
|
|
188
|
+
* (index of 16 bytes in the GPU data) is written to the `${memberName}Location` member so that shaders can find it.
|
|
189
|
+
* The chunk is kept per component SID and reused when it is large enough.
|
|
190
|
+
*
|
|
191
|
+
* @param info - The member info of the variable-length array member
|
|
192
|
+
* @param componentSid - The component scoped ID
|
|
193
|
+
*/
|
|
194
|
+
private __takeVariableLengthOne;
|
|
195
|
+
/**
|
|
196
|
+
* Creates a new chunk of memory for a variable-length array member.
|
|
197
|
+
*
|
|
198
|
+
* @param engine - The engine instance
|
|
199
|
+
* @param bufferUse - The intended use of the buffer
|
|
200
|
+
* @param byteLength - The byte length of the chunk
|
|
201
|
+
* @returns The created chunk
|
|
202
|
+
*/
|
|
203
|
+
private static __createVariableLengthChunk;
|
|
204
|
+
/**
|
|
205
|
+
* The radix used to split the location of a variable-length array member into two floats
|
|
206
|
+
* (`location = x * radix + y`), so that both are exactly representable as 32-bit floats.
|
|
207
|
+
*/
|
|
208
|
+
static readonly _variableLengthLocationRadix = 65536;
|
|
209
|
+
/**
|
|
210
|
+
* Gets the name of the member which holds the location of a variable-length array member.
|
|
211
|
+
*
|
|
212
|
+
* @param memberName - The name of the variable-length array member
|
|
213
|
+
* @returns The name of the location member
|
|
214
|
+
*/
|
|
215
|
+
static _getVariableLengthLocationMemberName(memberName: string): string;
|
|
174
216
|
/**
|
|
175
217
|
* Gets the ComponentMemoryRegistry for this component's engine.
|
|
176
218
|
*/
|
|
@@ -195,6 +237,11 @@ export declare class Component extends RnObject {
|
|
|
195
237
|
* Registers a member field of the component class for memory allocation.
|
|
196
238
|
* This method defines the memory layout and characteristics of component data members.
|
|
197
239
|
*
|
|
240
|
+
* Variable-length array members (`isVariableLength: true`) are allocated per instance with the length
|
|
241
|
+
* returned by `_getArrayLengthForAllocation`, instead of the fixed slot layout shared by the components
|
|
242
|
+
* of a buffer view. Shaders find the data through a Vec4 member named `${memberName}Location`,
|
|
243
|
+
* which must be registered before the variable-length member.
|
|
244
|
+
*
|
|
198
245
|
* @param bufferUse - The intended purpose/type of buffer use
|
|
199
246
|
* @param memberName - The name of the member field
|
|
200
247
|
* @param dataClassType - The class type of the data
|
|
@@ -202,8 +249,10 @@ export declare class Component extends RnObject {
|
|
|
202
249
|
* @param componentType - The primitive data type (e.g., Float32, Int32)
|
|
203
250
|
* @param initValues - Initial values for the member field
|
|
204
251
|
* @param convertToBool - Whether to convert the member value to a boolean
|
|
252
|
+
* @param uniformArrayLengthMultiplier - Multiplier of the uniform array length in uniform mode
|
|
253
|
+
* @param isVariableLength - Whether the array member has a per-instance length
|
|
205
254
|
*/
|
|
206
|
-
static registerMember(this: typeof Component, { bufferUse, memberName, dataClassType, shaderType, compositionType, componentType, initValues, arrayLength, componentSID, convertToBool, }: {
|
|
255
|
+
static registerMember(this: typeof Component, { bufferUse, memberName, dataClassType, shaderType, compositionType, componentType, initValues, arrayLength, componentSID, convertToBool, uniformArrayLengthMultiplier, isVariableLength, }: {
|
|
207
256
|
bufferUse: BufferUseEnum;
|
|
208
257
|
memberName: string;
|
|
209
258
|
dataClassType: DataClassType;
|
|
@@ -214,6 +263,8 @@ export declare class Component extends RnObject {
|
|
|
214
263
|
arrayLength?: Count | undefined;
|
|
215
264
|
componentSID?: ComponentSID;
|
|
216
265
|
convertToBool?: boolean;
|
|
266
|
+
uniformArrayLengthMultiplier?: number;
|
|
267
|
+
isVariableLength?: boolean;
|
|
217
268
|
}): void;
|
|
218
269
|
/**
|
|
219
270
|
* Allocates memory for all member fields of this component instance.
|
|
@@ -224,6 +275,15 @@ export declare class Component extends RnObject {
|
|
|
224
275
|
* @param isReUse - Whether to reuse existing memory allocations
|
|
225
276
|
*/
|
|
226
277
|
submitToAllocation(componentCountPerBufferView: Count, isReUse: boolean): void;
|
|
278
|
+
/**
|
|
279
|
+
* Returns the array length to allocate for a variable-length array member of this component instance
|
|
280
|
+
* (see `registerMember`). Override this to allocate a per-instance size. When undefined is returned,
|
|
281
|
+
* the maximum array length registered for the component class is used.
|
|
282
|
+
*
|
|
283
|
+
* @param _memberName - The name of the variable-length array member
|
|
284
|
+
* @returns The array length, or undefined to use the class-wide value
|
|
285
|
+
*/
|
|
286
|
+
protected _getArrayLengthForAllocation(_memberName: string): Count | undefined;
|
|
227
287
|
/**
|
|
228
288
|
* Gets the entity that owns this component.
|
|
229
289
|
* This provides access to the entity and its other components.
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import type { Byte, Count } from '../../types/CommonTypes';
|
|
1
|
+
import type { Byte, ComponentSID, Count, IndexOf16Bytes } from '../../types/CommonTypes';
|
|
2
2
|
import type { Accessor } from '../memory/Accessor';
|
|
3
|
+
import type { BufferView } from '../memory/BufferView';
|
|
3
4
|
import type { Component } from './Component';
|
|
4
5
|
type MemberName = string;
|
|
5
6
|
type IndexOfTheBufferView = number;
|
|
7
|
+
/**
|
|
8
|
+
* A chunk of memory allocated for a variable-length array member of a component.
|
|
9
|
+
*/
|
|
10
|
+
export type VariableLengthChunk = {
|
|
11
|
+
/** The buffer view which owns the memory of the chunk */
|
|
12
|
+
bufferView: BufferView;
|
|
13
|
+
/** The capacity of the chunk in bytes */
|
|
14
|
+
byteCapacity: Byte;
|
|
15
|
+
/** The location of the chunk in the GPU data (index of 16 bytes) */
|
|
16
|
+
location: IndexOf16Bytes;
|
|
17
|
+
};
|
|
6
18
|
/**
|
|
7
19
|
* ComponentMemoryRegistry manages memory-related data for components per Engine instance.
|
|
8
20
|
*
|
|
@@ -41,6 +53,16 @@ export declare class ComponentMemoryRegistry {
|
|
|
41
53
|
* Tracks which byte offset keys exist for each component class and member name.
|
|
42
54
|
*/
|
|
43
55
|
private __byteOffsetKeysByMember;
|
|
56
|
+
/**
|
|
57
|
+
* Chunks of variable-length array members, per component SID.
|
|
58
|
+
* Key format: "ComponentTID:MemberName:ComponentSID"
|
|
59
|
+
*/
|
|
60
|
+
private __variableLengthChunks;
|
|
61
|
+
/**
|
|
62
|
+
* Chunks of variable-length array members which are no longer used, per member.
|
|
63
|
+
* Key format: "ComponentTID:MemberName"
|
|
64
|
+
*/
|
|
65
|
+
private __freeVariableLengthChunks;
|
|
44
66
|
/**
|
|
45
67
|
* The state version, incremented when component memory layout changes.
|
|
46
68
|
*/
|
|
@@ -137,6 +159,42 @@ export declare class ComponentMemoryRegistry {
|
|
|
137
159
|
* @returns True if byte offset data exists
|
|
138
160
|
*/
|
|
139
161
|
hasByteOffsetsForComponent(componentClass: typeof Component): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Gets the chunk of a variable-length array member of a component.
|
|
164
|
+
*
|
|
165
|
+
* @param componentClass - The component class
|
|
166
|
+
* @param memberName - The name of the variable-length array member
|
|
167
|
+
* @param componentSID - The component SID
|
|
168
|
+
* @returns The chunk or undefined if not allocated yet
|
|
169
|
+
*/
|
|
170
|
+
getVariableLengthChunk(componentClass: typeof Component, memberName: MemberName, componentSID: ComponentSID): VariableLengthChunk | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Sets the chunk of a variable-length array member of a component.
|
|
173
|
+
* Note that this does not change the state version, since shaders read the locations of chunks at runtime.
|
|
174
|
+
*
|
|
175
|
+
* @param componentClass - The component class
|
|
176
|
+
* @param memberName - The name of the variable-length array member
|
|
177
|
+
* @param componentSID - The component SID
|
|
178
|
+
* @param chunk - The chunk to set
|
|
179
|
+
*/
|
|
180
|
+
setVariableLengthChunk(componentClass: typeof Component, memberName: MemberName, componentSID: ComponentSID, chunk: VariableLengthChunk): void;
|
|
181
|
+
/**
|
|
182
|
+
* Puts a chunk which is no longer used into the free list so that it can be reused.
|
|
183
|
+
*
|
|
184
|
+
* @param componentClass - The component class
|
|
185
|
+
* @param memberName - The name of the variable-length array member
|
|
186
|
+
* @param chunk - The chunk to release
|
|
187
|
+
*/
|
|
188
|
+
releaseVariableLengthChunk(componentClass: typeof Component, memberName: MemberName, chunk: VariableLengthChunk): void;
|
|
189
|
+
/**
|
|
190
|
+
* Takes the smallest free chunk which has enough capacity.
|
|
191
|
+
*
|
|
192
|
+
* @param componentClass - The component class
|
|
193
|
+
* @param memberName - The name of the variable-length array member
|
|
194
|
+
* @param byteLength - The required byte length
|
|
195
|
+
* @returns The chunk, or undefined if there is no suitable free chunk
|
|
196
|
+
*/
|
|
197
|
+
takeFreeVariableLengthChunk(componentClass: typeof Component, memberName: MemberName, byteLength: Byte): VariableLengthChunk | undefined;
|
|
140
198
|
/**
|
|
141
199
|
* Gets the current state version.
|
|
142
200
|
* This is incremented whenever the memory layout changes.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Config.ts is a configuration file that contains the configuration for the library.
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import type { BoneDataTypeEnum } from '../definitions/BoneDataType';
|
|
5
5
|
import { LogLevel } from '../misc/Logger';
|
|
6
6
|
type ConfigInitDescription = {
|
|
7
7
|
scenegraphComponentCountPerBufferView?: number;
|
|
@@ -9,7 +9,6 @@ type ConfigInitDescription = {
|
|
|
9
9
|
cameraComponentCountPerBufferView?: number;
|
|
10
10
|
lightComponentCountPerBufferView?: number;
|
|
11
11
|
maxLightNumber?: number;
|
|
12
|
-
maxBoneNumberForMemoryBoostMode?: number;
|
|
13
12
|
materialCountPerBufferView?: number;
|
|
14
13
|
boneDataType?: BoneDataTypeEnum;
|
|
15
14
|
maxSkeletalBoneNumberForUniformMode?: number;
|
|
@@ -37,16 +36,19 @@ export declare class Config {
|
|
|
37
36
|
lightComponentCountPerBufferView: number;
|
|
38
37
|
/** The maximum number of lights that Rhodonite can handle */
|
|
39
38
|
maxLightNumber: number;
|
|
40
|
-
/** The maximum number of bones that Rhodonite can handle for Memory Boost Mode */
|
|
41
|
-
maxBoneNumberForMemoryBoostMode: number;
|
|
42
39
|
/**
|
|
43
40
|
* Number of instances of each material type to be placed consecutively in memory.
|
|
44
41
|
* This is on the memory layout, and the number of material instances that can be generated is not limited by this setting.
|
|
45
42
|
* If this limit is exceeded, the material type is internally treated as a separate material type.
|
|
46
43
|
*/
|
|
47
44
|
materialCountPerBufferView: number;
|
|
48
|
-
/**
|
|
49
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Forces the bone data type of all SkeletalComponents.
|
|
47
|
+
* When undefined (default), each SkeletalComponent uses its own bone data type
|
|
48
|
+
* (see SkeletalComponent.setBoneDataType). Importers choose Vec4x1 or Vec4x2 automatically,
|
|
49
|
+
* and other SkeletalComponents default to Vec4x2.
|
|
50
|
+
*/
|
|
51
|
+
boneDataType: BoneDataTypeEnum | undefined;
|
|
50
52
|
/** The maximum number of bones of each skeleton that Rhodonite can handle for Uniform Mode */
|
|
51
53
|
maxSkeletalBoneNumberForUniformMode: number;
|
|
52
54
|
/** Whether the UBO is enabled */
|
|
@@ -68,6 +70,5 @@ export declare class Config {
|
|
|
68
70
|
/** The minimum log level that will be output. Messages below this level are ignored. */
|
|
69
71
|
logLevel: LogLevel;
|
|
70
72
|
constructor(initDescription?: ConfigInitDescription);
|
|
71
|
-
setUpAsMemoryBoostMode(): void;
|
|
72
73
|
}
|
|
73
74
|
export {};
|