Game.Rendering.Skeleton
Assembly:
Namespace: Game.Rendering
Type: struct
Base: IBufferElementData, IEmptySerializable
Summary:
Represents a single entry of a skeleton buffer used by the rendering/ECS layer. This struct is an IBufferElementData so it is intended to be stored in a DynamicBuffer
Fields
-
public NativeHeapBlock m_BufferAllocation
Holds the native memory block that contains the raw bone data for this skeleton entry. NativeHeapBlock is a low-level allocation wrapper (from the Colossal.Collections namespace). This field points to the allocation that rendering code will read/write for bone matrices or other skeletal data. -
public int m_BoneOffset
An integer offset used when accessing bone data inside a shared allocation or a larger bone buffer. Typically used to index into a packed bone array when multiple skeletons share a contiguous memory region. -
public bool m_CurrentUpdated
Flag indicating whether the current-frame bone data has been updated. Rendering or skinning systems can check this to determine whether they need to process or upload the current pose. -
public bool m_HistoryUpdated
Flag indicating whether historical (previous frame) bone data has been updated. Used when the renderer or animation code needs previous-frame poses (for motion blur, temporal effects, or interpolation). -
public bool m_RequireHistory
Flag indicating that historical bone data must be kept/maintained for this skeleton (e.g., when motion blur or temporal interpolation is required).
Properties
- (none)
Constructors
- (implicit default constructor)
The struct uses the default value-type constructor. Fields must be initialized manually before use. There is no custom ctor defined in the source.
Methods
- (none)
This plain data container defines no methods. It implements IEmptySerializable, which signals the serialization system how to treat the struct (no custom serialization logic in this type).
Usage Example
// Example: attach a Skeleton dynamic buffer to an entity and populate one element.
// (This example assumes you have access to an EntityManager or SystemBase methods.)
// Add the buffer to an entity
entityManager.AddBuffer<Skeleton>(entity);
// Get the buffer
var buffer = entityManager.GetBuffer<Skeleton>(entity);
// Create and initialize a skeleton element.
// Note: constructing a NativeHeapBlock requires the appropriate API - shown here conceptually.
var skel = new Skeleton {
m_BufferAllocation = /* allocate or obtain a NativeHeapBlock containing bone data */,
m_BoneOffset = 0,
m_CurrentUpdated = false,
m_HistoryUpdated = false,
m_RequireHistory = true
};
// Add to the dynamic buffer (InternalBufferCapacity(1) means small inline storage before heap allocation)
buffer.Add(skel);
Additional notes: - InternalBufferCapacity(1) optimizes for a single element stored inline with the entity; adding more elements will allocate externally. - Care must be taken to allocate and free NativeHeapBlock resources correctly to avoid memory leaks. The rendering/animation runtime typically manages those allocations. - Because this is a plain data container with boolean flags, ensure systems that update skeletons set the flags appropriately (m_CurrentUpdated / m_HistoryUpdated) to coordinate uploads and temporal effects.