![]() |
XII Release 0.1.0
|
Mesh component carrying palette skinning and morph target data. More...
#include <MeshComponent.h>
Public Member Functions | |
| virtual void | SerializeComponent (xiiWorldWriter &inout_stream) const override |
| Override this to save the current state of the component to the given stream. | |
| virtual void | DeserializeComponent (xiiWorldReader &inout_stream) override |
| void | SetSkeleton (const xiiSkeletonResourceHandle &hSkeleton) |
| Sets the skeleton resource for this skinned mesh component, used to specify the skeleton for skinning this mesh. | |
| const xiiSkeletonResourceHandle & | GetSkeleton () const |
| Returns a handle to the skeleton resource for this skinned mesh component, used to access the skeleton for skinning this mesh. | |
| xiiResult | SetSkinningMatrices (xiiArrayPtr< const xiiMat4 > pMatrices) |
| xiiResult | SetAnimationPose (const xiiSkeletonResourceHandle &hSkeleton, const xiiAnimationPose &pose) |
| xiiArrayPtr< const xiiMat4 > | GetSkinningMatrices () const |
| Returns a reference to the array of skinning matrices for this skinned mesh component, used to access the skinning transformation data for rendering this mesh. | |
| void | SetMorphWeights (xiiArrayPtr< const float > pWeights) |
| Sets the morph target weights for this skinned mesh component, used to provide the morph target blending data for rendering this mesh. | |
| xiiArrayPtr< const float > | GetMorphWeights () const |
| Returns a reference to the array of morph target weights for this skinned mesh component, used to access the morph target blending data for rendering this mesh. | |
| void | ClearPose () |
| Clears all skinning and morph target data, used to reset the skinning and morphing state for this mesh. | |
| Public Member Functions inherited from xiiMeshComponentBase | |
| xiiBitflags< xiiRenderExtractionCategory > | GetRenderExtractionCategories () const override |
| bool | IsRenderDataViewIndependent () const override |
| void | SetMesh (const xiiMeshResourceHandle &hMesh) |
| Sets the mesh resource for this component, used to specify the geometry and materials to render. | |
| const xiiMeshResourceHandle & | GetMesh () const |
| Returns a handle to the mesh resource for this component, used to access the geometry and materials for rendering. | |
| void | SetMaterialOverride (xiiUInt32 uiMaterialIndex, const xiiMaterialResourceHandle &hMaterial) |
| Sets a material override for the material slot at the given index, used to override the material for rendering. | |
| const xiiMaterialResourceHandle & | GetMaterialOverride (xiiUInt32 uiMaterialIndex) const |
| Returns a handle to the material override for the material slot at the given index, used to access the overridden material for rendering. | |
| void | ClearMaterialOverrides () |
| Clears all material overrides, used to reset the materials to the defaults specified in the mesh resource. | |
| xiiArrayPtr< const xiiMaterialResourceHandle > | GetMaterialOverrides () const |
| Returns a reference to the array of material overrides for this component, used to access all overridden materials for rendering. | |
| xiiUInt32 | GetMaterialOverrideCount () const |
| Reflection accessor: returns material override count. | |
| xiiStringView | GetMaterialOverrideFile (xiiUInt32 uiMaterialIndex) const |
| Reflection accessor: returns the material override resource ID at the given index. | |
| void | SetMaterialOverrideFile (xiiUInt32 uiMaterialIndex, xiiStringView sFile) |
| Reflection accessor: sets a material override from a resource ID. | |
| void | InsertMaterialOverrideFile (xiiUInt32 uiMaterialIndex, xiiStringView sFile) |
| Reflection accessor: inserts a material override from a resource ID. | |
| void | RemoveMaterialOverrideFile (xiiUInt32 uiMaterialIndex) |
| Reflection accessor: removes a material override at the given index. | |
| void | SetSectionIndex (xiiUInt32 uiSectionIndex) |
| Sets the section index for this component, used to select a specific section of the mesh for rendering. | |
| xiiUInt32 | GetSectionIndex () const |
| Returns the section index for this component, used to select a specific section of the mesh for rendering. | |
| void | SetPreferMeshShaders (bool bPreferMeshShaders) |
| Sets whether to prefer using mesh shaders for rendering this mesh, if available, used to optimize rendering performance on supported hardware. | |
| bool | GetPreferMeshShaders () const |
| Returns whether to prefer using mesh shaders for rendering this mesh, if available, used to determine the rendering path for this mesh. | |
| void | SetRayTracingVisible (bool bVisible) |
| Sets whether this mesh should be visible to ray tracing, used to control ray tracing visibility for this mesh. | |
| bool | GetRayTracingVisible () const |
| Returns whether this mesh is visible to ray tracing, used to determine ray tracing visibility for this mesh. | |
| void | SetVisibilityMask (xiiUInt32 mask) |
| xiiUInt32 | GetVisibilityMask () const |
| Public Member Functions inherited from xiiRenderComponent | |
| void | TriggerLocalBoundsUpdate () |
| Call this when some value was modified that affects the size of the local bounding box and it should be recomputed. | |
| XII_ALWAYS_INLINE xiiUInt32 | GetUniqueIdForRendering (xiiUInt32 uiInnerIndex=0, xiiUInt32 uiInnerIndexShift=24) const |
| Computes a unique ID for the given component, that is usually given to the renderer to distinguish objects. | |
| Public Member Functions inherited from xiiComponent | |
| void | SetActiveFlag (bool bEnabled) |
| bool | GetActiveFlag () const |
| bool | IsActive () const |
| bool | IsActiveAndInitialized () const |
| bool | IsActiveAndSimulating () const |
| xiiComponentManagerBase * | GetOwningManager () |
| Returns the corresponding manager for this component. | |
| const xiiComponentManagerBase * | GetOwningManager () const |
| Returns the corresponding manager for this component. | |
| xiiGameObject * | GetOwner () |
| Returns the owner game object if the component is attached to one or nullptr. | |
| const xiiGameObject * | GetOwner () const |
| Returns the owner game object if the component is attached to one or nullptr. | |
| xiiWorld * | GetWorld () |
| Returns the corresponding world for this component. | |
| const xiiWorld * | GetWorld () const |
| Returns the corresponding world for this component. | |
| xiiComponentHandle | GetHandle () const |
| Returns a handle to this component. | |
| xiiUInt32 | GetUniqueID () const |
| Returns the unique id for this component. | |
| void | SetUniqueID (xiiUInt32 uiUniqueID) |
| Sets the unique id for this component. | |
| void | EnsureInitialized () |
| Ensures that the component is initialized. Must only be called from another component's Initialize callback. | |
| void | EnsureSimulationStarted () |
| XII_ALWAYS_INLINE bool | SendMessage (xiiMessage &ref_msg) |
| Sends a message to this component. | |
| XII_ALWAYS_INLINE bool | SendMessage (xiiMessage &ref_msg) const |
| void | PostMessage (const xiiMessage &msg, xiiTime delay=xiiTime::MakeZero(), xiiObjectMsgQueueType::Enum queueType=xiiObjectMsgQueueType::NextFrame) const |
| Queues the message for the given phase. The message is processed after the given delay in the corresponding phase. | |
| virtual bool | HandlesMessage (const xiiMessage &msg) const |
| Returns whether the given Message is handled by this component. | |
| void | SetUserFlag (xiiUInt8 uiFlagIndex, bool bSet) |
| Be careful to check which flags may already be in use by base classes. | |
| bool | GetUserFlag (xiiUInt8 uiFlagIndex) const |
| Retrieves a custom flag. Index must be between 0 and 7. | |
| void | SetCreatedByPrefab () |
| Adds xiiObjectFlags::CreatedByPrefab to the component. See the flag for details. | |
| bool | WasCreatedByPrefab () const |
| Checks whether the xiiObjectFlags::CreatedByPrefab flag is set on this component. | |
| void | DeleteComponent () |
| Deletes this component. Note that the component will be invalidated first and the actual deletion is postponed. | |
| Public Member Functions inherited from xiiReflectedClass | |
| virtual const xiiRTTI * | GetDynamicRTTI () const |
| bool | IsInstanceOf (const xiiRTTI *pType) const |
| Returns whether the type of this instance is of the given type or derived from it. | |
| template<typename T> | |
| XII_ALWAYS_INLINE bool | IsInstanceOf () const |
| Returns whether the type of this instance is of the given type or derived from it. | |
Protected Member Functions | |
| virtual xiiResult | GetLocalBounds (xiiBoundingBoxSphere &ref_bounds, bool &ref_bAlwaysVisible, xiiMsgUpdateLocalBounds &ref_msg) override |
| virtual void | FillRenderData (xiiMeshRenderData &ref_renderData, const xiiMeshResource &mesh) const override |
| Fills the given mesh render data with the appropriate data for rendering this mesh, used to prepare the render data for this mesh based on the mesh resource and component properties. | |
| virtual xiiBitflags< xiiMeshRenderDataFlags > | GetMeshRenderFlags () const override |
| Returns the mesh render data flags for this mesh component, used to specify various properties of the mesh render data that can affect how it is rendered. | |
| Protected Member Functions inherited from xiiMeshComponentBase | |
| void | OnMsgExtractRenderData (xiiMsgExtractRenderData &ref_msg) const |
| Handles the message for extracting render data for this mesh, used to prepare and submit the render data for this mesh when requested by the renderer. | |
| virtual xiiUInt32 | SelectLOD (const xiiMeshResource &mesh) const |
| Selects the appropriate LOD index for rendering this mesh based on the given mesh resource, used to determine which LOD level of the mesh to render based on distance or performance requirements. | |
| virtual xiiRenderData::Caching::Enum | GetRenderDataCaching () const |
| Returns the render data caching strategy for this mesh component, used to determine how the render data for this mesh should be cached and reused. | |
| virtual void | UpdateLocalBoundsForInstances (xiiBoundingBoxSphere &ref_bounds) const |
| Updates the local bounds for this mesh component based on the given mesh resource, used to calculate the bounding volume for this mesh for culling and LOD selection. | |
| Protected Member Functions inherited from xiiRenderComponent | |
| virtual void | Deinitialize () override |
| virtual void | OnActivated () override |
| virtual void | OnDeactivated () override |
| void | OnUpdateLocalBounds (xiiMsgUpdateLocalBounds &msg) |
| void | InvalidateCachedRenderData () |
| void | OnTransformChanged (xiiMsgTransformChanged &msg) |
| Protected Member Functions inherited from xiiComponent | |
| xiiComponent () | |
| Keep the constructor private or protected in derived classes, so it cannot be called manually. | |
| bool | IsDynamic () const |
| Returns whether this component is dynamic and thus can only be attached to dynamic game objects. | |
| virtual xiiWorldModuleTypeId | GetTypeId () const =0 |
| virtual xiiComponentMode::Enum | GetMode () const =0 |
| virtual void | Initialize () |
| virtual void | OnSimulationStarted () |
| void | EnableUnhandledMessageHandler (bool enable) |
| By default disabled. Enable to have OnUnhandledMessage() called for every unhandled message. | |
| virtual bool | OnUnhandledMessage (xiiMessage &msg, bool bWasPostedMsg) |
| virtual bool | OnUnhandledMessage (xiiMessage &msg, bool bWasPostedMsg) const |
| bool | IsInitialized () const |
| bool | IsInitializing () const |
| bool | IsSimulationStarted () const |
Protected Attributes | |
| xiiSkeletonResourceHandle | m_hSkeleton |
| The skeleton resource for this skinned mesh component, used to specify the skeleton for skinning this mesh. | |
| xiiDynamicArray< xiiMat4 > | m_SkinningMatrices |
| Array of skinning matrices for this skinned mesh component, used to provide the skinning transformation data for rendering this mesh. | |
| xiiDynamicBitfield | m_UsedPaletteSlots |
| xiiDynamicArray< float > | m_MorphWeights |
| Array of morph target weights for this skinned mesh component, used to provide the morph target blending data for rendering this mesh. | |
| Protected Attributes inherited from xiiMeshComponentBase | |
| xiiMeshResourceHandle | m_hMesh |
| The mesh resource for this component, containing the mesh buffer and materials, used to specify the geometry and materials to render. | |
| xiiDynamicArray< xiiMaterialResourceHandle > | m_MaterialOverrides |
| Array of material overrides for this component, used to override the materials specified in the mesh resource for rendering. | |
| xiiUInt32 | m_uiSectionIndex = xiiInvalidIndex |
| The section index for this component, used to select a specific section of the mesh for rendering. | |
| xiiUInt32 | m_uiVisibilityMask = 0xFFFFFFFFU |
| bool | m_bPreferMeshShaders = true |
| Whether to prefer using mesh shaders for rendering this mesh, if available, used to optimize rendering performance on supported hardware. | |
| bool | m_bRayTracingVisible = true |
| Whether this mesh should be visible to ray tracing, used to control ray tracing visibility for this mesh. | |
| bool | m_bCpuCullingFallback = true |
| Whether to use CPU culling as a fallback, used to determine whether to fall back to CPU culling if GPU culling is not available or fails for this mesh. | |
| Protected Attributes inherited from xiiComponent | |
| const xiiRTTI * | m_pMessageDispatchType = nullptr |
| Messages will be dispatched to this type. Default is what GetDynamicRTTI() returns, can be redirected if necessary. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from xiiRenderComponent | |
| static xiiUInt32 | GetUniqueIdForRendering (const xiiComponent &component, xiiUInt32 uiInnerIndex=0, xiiUInt32 uiInnerIndexShift=24) |
| Computes a unique ID for the given component, that is usually given to the renderer to distinguish objects. | |
| Static Public Member Functions inherited from xiiNoBase | |
| static const xiiRTTI * | GetStaticRTTI () |
Mesh component carrying palette skinning and morph target data.
|
overridevirtual |
Override this to load the current state of the component from the given stream.
The active state will be automatically serialized. The 'initialized' state is not serialized, all components will be initialized after creation, even if they were already in an initialized state when they were serialized.
Reimplemented from xiiMeshComponentBase.
|
overrideprotectedvirtual |
Fills the given mesh render data with the appropriate data for rendering this mesh, used to prepare the render data for this mesh based on the mesh resource and component properties.
Reimplemented from xiiMeshComponentBase.
|
overrideprotectedvirtual |
Called by xiiRenderComponent::OnUpdateLocalBounds().
If XII_SUCCESS is returned, out_bounds and out_bAlwaysVisible will be integrated into the xiiMsgUpdateLocalBounds ref_msg, otherwise the out values are simply ignored.
Reimplemented from xiiMeshComponentBase.
|
overrideprotectedvirtual |
Returns the mesh render data flags for this mesh component, used to specify various properties of the mesh render data that can affect how it is rendered.
Reimplemented from xiiDynamicMeshComponent.
|
overridevirtual |
Override this to save the current state of the component to the given stream.
Reimplemented from xiiMeshComponentBase.
| xiiResult xiiSkinnedMeshComponent::SetAnimationPose | ( | const xiiSkeletonResourceHandle & | hSkeleton, |
| const xiiAnimationPose & | pose ) |
Applies an evaluated skeleton pose in this mesh's bone palette order. Acquires current mesh/skeleton definitions. Failure clears stale skinning matrices without changing morph weights. Scratch capacity is reused.
| xiiResult xiiSkinnedMeshComponent::SetSkinningMatrices | ( | xiiArrayPtr< const xiiMat4 > | pMatrices | ) |
Sets finite affine mesh-space skinning matrices and refreshes spatial bounds. Empty restores bind pose. Invalid palettes fail without changing the current pose. Input may alias the current palette.