Creates a new SkeletalComponent instance. Initializes the component with skeletal animation capabilities and reserves global data resources.
The engine instance
The unique identifier of the entity this component belongs to
The component's system identifier
The repository managing entities
Whether this component is being reused from a pool
Protected__Protected__Protected__the instance of EntityRepository
Protected__the entity unique Id which this component belongs to
Protected__Protected__the instance of MemoryManager
Optional_Collection of tags associated with this object
OptionaltopStatic Readonly_StaticcurrentCurrent maximum object count for UID generation
Static ReadonlyInvalidInvalid object UID constant
Gets the ComponentMemoryRegistry for this component's engine.
Gets the Scoped ID of this Component instance. The SID is unique within the component type and represents the instance index.
The component scoped ID
Gets the component type identifier for this instance.
The component type identifier
Gets the current process stage of the component. This determines which update methods are currently being called.
The current process stage
Gets the entity that owns this component.
The entity with skeletal capabilities that has this component
Gets the unique ID of the entity that owns this component.
The entity unique ID
Gets the visibility state of the joint gizmo.
True if the joint gizmo is visible, false otherwise
Sets the visibility of the joint gizmo that visualizes skeletal joints.
True to show the joint gizmo, false to hide it
Checks if the world matrix has been updated from its initial state.
True if the world matrix has been modified, false otherwise
Gets the compressed joint data chunk (used in Vec4x1 bone data type).
The Float32Array containing compressed joint data
Gets the compression information for joint data (used in Vec4x1 bone data type).
The compression information vector
Gets the computed joint matrices array.
The joint matrices array
Gets the joint matrices array (used in Mat43x1 bone data type).
The Float32Array containing joint matrices
Gets the quaternion array for joints (used in Vec4x2Old bone data type).
The Float32Array containing joint quaternions
Gets the scale-packed quaternion array for joints (used in Vec4x2 bone data type).
The Float32Array containing scale and packed quaternion data
Gets the translate-packed quaternion array for joints (used in Vec4x2 bone data type).
The Float32Array containing translation and packed quaternion data
Gets the translate-scale array for joints.
The Float32Array containing joint translation and scale data
Gets the unique object identifier
The object's UID
Gets the world matrix of the root joint in the hierarchy.
The world matrix of the top joint, or undefined if no top joint exists
Gets the unique name of this object
The unique name string
StaticcomponentGets the static component type identifier for SkeletalComponent.
The component type identifier
InternalCopies tag data from another RnObject instance to this object
The source RnObject to copy tags from
Protected_ProtectedDestroys this component and cleans up resources.
Protected_ProtectedPerforms a shallow copy from another SkeletalComponent. Copies all relevant skeletal data without deep cloning complex objects.
The source component to copy from
Performs the logic update for skeletal animation. Calculates joint transformations and updates bone data arrays based on the configured bone data type. This method is called during the Logic processing stage.
This method implements a two-level optimization for VRM models with shared skeleton:
SkeletalComponents with the same joint structure and animation state share skinning results. The first SkeletalComponent ("leader") computes skinning, others reuse the cached result.
When skinning cache hits, we track the joint EntityUIDs. In the next frame, AnimationComponent can early return for these joints, skipping animation calculations.
Key concepts:
The leader's joints are protected (__leaderJointEntityUIDs) to ensure animation continues. Only follower joints are registered for early return (__currentFrameCachedEntityUIDs).
Adds this component to an entity, extending it with skeletal functionality. This method uses mixins to add skeletal-specific methods to the target entity.
The target entity to extend
The component class being added
The entity extended with skeletal component methods
Gets the inverse bind matrices accessor.
The accessor containing inverse bind matrices, or undefined if not set
Gets a copy of the joints array.
A copy of the SceneGraphComponents representing the joints
Retrieves a complete tag object (name and value) for the specified tag name
The name of the tag to retrieve
A Tag object containing the name and value
Retrieves the value associated with a specific tag name
The name of the tag whose value to retrieve
The tag value, or undefined if the tag doesn't exist
Checks whether this object has a tag with the specified name
The name of the tag to check for
True if the tag exists (value is not null/undefined), false otherwise
Checks whether the specified ProcessStage method exists in this Component instance. This is used to determine if this component can handle a particular process stage.
The process stage to check for
True if the method exists, false otherwise
Checks if this object has a tag with the specified name and value
The tag name to match
The tag value to match
True if the object has a matching tag, false otherwise
Checks if this object has all the specified tags with exactly matching values
Object containing tag names as keys and expected values
True if all specified tags exist with matching values, false otherwise
Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.
Array of strings that must all be present in the combined tag string
True if all strings are found in the combined tag string, false otherwise
Transitions the component to a different process stage. This affects which update methods will be called during the frame processing.
The target stage to move to
Registers a dependency relationship with another component. This method is intended for future use in managing component dependencies.
Removes a tag from this object
The name of the tag to remove
Sets the accessor for inverse bind matrices used in skeletal animation. These matrices transform vertices from model space to bone space.
The accessor containing inverse bind matrices data
Sets the joint hierarchy for this skeletal component. Initializes the appropriate data arrays based on the configured bone data type.
Array of SceneGraphComponents representing the joints/bones
Allocates memory for all member fields of this component instance. This method is called during component initialization to set up memory layout and allocate space for the specified number of entities.
The number of components per buffer view
Whether to reuse existing memory allocations
Attempts to set a tag on this object. If the tag already exists, it will be replaced.
The tag object containing the name and value to set
True if the tag was successfully set, false if the tag name contains invalid characters
Attempts to set a unique name for this object
The desired unique name
If true, appends UID to make name unique when conflicts occur; if false, fails on conflict
True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false
Unregisters this object from all tracking collections. Should be called when the object is being destroyed.
Lightweight joint update for remapping during shallow copy. Only updates joint references without reinitializing buffers. Used when joints are remapped to new entities during shallow copy.
Validates that a tag string contains only allowed characters (alphanumeric and underscore)
The string to validate
True if the string contains only valid characters, false if it contains invalid characters
Static_InternalResets all static object tracking data. Used primarily for testing.
StaticdoesChecks whether the specified ProcessStage method exists in the given Component class. This is used to determine if a component can handle a particular process stage.
The component class to check
The process stage to check for
True if the method exists, false otherwise
StaticgetStaticgetStaticgetGets the ComponentType of a specific member field in a component class. This is useful for understanding the primitive data type of component members.
The ComponentType of the member or undefined if not found
StaticgetGets the CompositionType of a specific member field in a component class. This is useful for understanding the data structure of component members.
The CompositionType of the member or undefined if not found
StaticgetGets the pixel location offset in the buffer for a specific member of a component type. This is useful for GPU texture-based data access where locations are measured in pixels.
The pixel location offset in the buffer
StaticgetGets the member info of the component. This is useful for getting the member info of the component.
The member info of the component
StaticgetRetrieves an RnObject instance by its unique identifier
The unique identifier of the object to retrieve
The RnObject instance or undefined if not found or garbage collected
StaticgetRetrieves an RnObject instance by its unique name
The unique name of the object to retrieve
The RnObject instance or undefined if not found or garbage collected
StaticgetGets the state version of the component memory layout. This is incremented whenever the component's memory layout changes.
The engine instance
The state version number
StaticisChecks if an entity's AnimationComponent can perform early return.
This is called by AnimationComponent.$logic to determine if animation calculations can be skipped. An entity is considered "cached" if:
This method also handles the frame transition (swapping current/previous cached UIDs) since AnimationComponent.$logic runs before SkeletalComponent.$logic in each frame.
The entity UID to check (typically a joint/bone entity)
The engine instance for multi-engine support
True if the entity can skip animation calculation, false if it must animate
StaticprocessProcesses all components of a given type for a specific process stage. This method iterates through all components of the specified type and calls their corresponding process stage method if they are in that stage.
The component class to process
The process stage to execute
StaticregisterRegisters a member field of the component class for memory allocation. This method defines the memory layout and characteristics of component data members.
The intended purpose/type of buffer use
StaticsearchSearches for the first object that has a specific tag with the given value
The tag name to search for
The tag value to match
WeakRef to the first matching object, or undefined if not found
StaticupdateUpdates components specifically for the render stage with render pass context. This method calls the sort_$render method of the component class to handle render-specific processing and sorting.
The component class to update
The current render pass context
The result of the sort_$render method
SkeletalComponent manages skeletal animation for entities. This component handles bone transformations, joint matrices, and skinning calculations for 3D models with skeletal animation systems.