XII Release 0.1.0
Loading...
Searching...
No Matches
xiiDecalComponent Class Reference

Places a decal projector or mesh decal into the render world. More...

#include <DecalComponent.h>

Inheritance diagram for xiiDecalComponent:
[legend]

Public Member Functions

xiiBitflags< xiiRenderExtractionCategory > GetRenderExtractionCategories () const override
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
virtual xiiResult GetLocalBounds (xiiBoundingBoxSphere &ref_bounds, bool &ref_bAlwaysVisible, xiiMsgUpdateLocalBounds &ref_msg) override
void SetProjectionMode (xiiEnum< xiiDecalProjectionMode > mode)
 Sets the projection mode for this decal, used to determine how the decal should be rendered. This can be either projected deferred decals or mesh decals, and determines whether the decal is rendered as a projected box in the world or as a mesh with its own geometry.
xiiEnum< xiiDecalProjectionMode > GetProjectionMode () const
 Returns the projection mode for this decal, used to determine how the decal should be rendered. This can be either projected deferred decals or mesh decals, and determines whether the decal is rendered as a projected box in the world or as a mesh with its own geometry.
void SetDecal (const xiiDecalResourceHandle &hDecal)
 Sets the decal resource for this decal, used for rendering. The decal resource contains the textures and properties for this decal, and is used to render the decal in the world. If an atlas is used, the textures from the atlas entry in the decal atlas resource will be used instead of the textures from the decal resource, but the properties from the decal resource will still be used.
const xiiDecalResourceHandle & GetDecal () const
 Returns the decal resource for this decal, used for rendering. The decal resource contains the textures and properties for this decal, and is used to render the decal in the world. If an atlas is used, the textures from the atlas entry in the decal atlas resource will be used instead of the textures from the decal resource, but the properties from the decal resource will still be used.
void SetAtlas (const xiiDecalAtlasResourceHandle &hAtlas)
 Sets the decal atlas resource for this decal, used for rendering. The decal atlas resource contains the atlas textures and properties for this decal, and is used to render the decal in the world. If an atlas is used, the textures from the atlas entry in the decal atlas resource will be used instead of the textures from the decal resource, but the properties from the decal resource will still be used.
const xiiDecalAtlasResourceHandle & GetAtlas () const
 Returns the decal atlas resource for this decal, used for rendering. The decal atlas resource contains the atlas textures and properties for this decal, and is used to render the decal in the world. If an atlas is used, the textures from the atlas entry in the decal atlas resource will be used instead of the textures from the decal resource, but the properties from the decal resource will still be used.
void SetAtlasId (xiiStringView sAtlasId)
 Sets the atlas ID for this decal, used to look up the correct atlas entry in the decal atlas resource for rendering. The atlas ID is used to find the corresponding entry in the decal atlas resource, which contains the UV rectangle and other properties for this decal when using an atlas. If no atlas is used, this is ignored.
xiiStringView GetAtlasId () const
 Returns the atlas ID for this decal, used to look up the correct atlas entry in the decal atlas resource for rendering. The atlas ID is used to find the corresponding entry in the decal atlas resource, which contains the UV rectangle and other properties for this decal when using an atlas. If no atlas is used, this is ignored.
void SetMesh (const xiiMeshResourceHandle &hMesh)
 Sets the mesh resource for this decal, used for rendering mesh decals. The mesh resource contains the geometry and materials for the mesh decal, and is used to render the decal as a mesh in the world. This is only valid if the projection mode is set to Mesh, and is ignored for projected deferred decals.
const xiiMeshResourceHandle & GetMesh () const
 Returns the mesh resource for this decal, used for rendering mesh decals. The mesh resource contains the geometry and materials for the mesh decal, and is used to render the decal as a mesh in the world. This is only valid if the projection mode is set to Mesh, and is ignored for projected deferred decals.
void SetExtents (xiiVec3 vExtents)
 Sets the extents of this decal in world space, used for rendering projected deferred decals. The extents define the size of the box used to project the decal onto the scene, with the center of the box being the position of the decal component in the world. This is only valid if the projection mode is set to Projected, and is ignored for mesh decals.
xiiVec3 GetExtents () const
 Returns the extents of this decal in world space, used for rendering projected deferred decals. The extents define the size of the box used to project the decal onto the scene, with the center of the box being the position of the decal component in the world. This is only valid if the projection mode is set to Projected, and is ignored for mesh decals.
void SetUVOffset (xiiVec2 vOffset)
 Sets the UV offset for this decal, used for rendering. The UV offset is added to the UV coordinates of the decal textures, and can be used to animate the decal or to adjust the placement of the textures on the decal geometry.
xiiVec2 GetUVOffset () const
 Returns the UV offset for this decal, used for rendering. The UV offset is added to the UV coordinates of the decal textures, and can be used to animate the decal or to adjust the placement of the textures on the decal geometry.
void SetUVScale (xiiVec2 vScale)
 Sets the UV scale for this decal, used for rendering. The UV scale is multiplied with the UV coordinates of the decal textures, and can be used to tile the decal textures across the decal geometry or to adjust the placement of the textures on the decal geometry.
xiiVec2 GetUVScale () const
 Returns the UV scale for this decal, used for rendering. The UV scale is multiplied with the UV coordinates of the decal textures, and can be used to tile the decal textures across the decal geometry or to adjust the placement of the textures on the decal geometry.
void SetTint (xiiColor tint)
 Sets the tint color for this decal, used for rendering. The tint color is multiplied with the albedo texture of the decal, and can be used to change the color of the decal without modifying the texture itself.
xiiColor GetTint () const
 Returns the tint color for this decal, used for rendering. The tint color is multiplied with the albedo texture of the decal, and can be used to change the color of the decal without modifying the texture itself.
void SetChannelMask (xiiBitflags< xiiDecalChannelMask > mask)
 Sets the channel mask for this decal, used for rendering. The channel mask is used to specify which channels of the decal textures should be used for rendering, and can be used to optimize rendering by only using the necessary channels of the textures.
xiiBitflags< xiiDecalChannelMask > GetChannelMask () const
 Returns the channel mask for this decal, used for rendering. The channel mask is used to specify which channels of the decal textures should be used for rendering, and can be used to optimize rendering by only using the necessary channels of the textures.
void SetOpacity (float fOpacity)
 Sets the opacity of this decal, used for rendering. The opacity is multiplied with the alpha channel of the albedo texture of the decal, and can be used to make the decal more transparent or more opaque without modifying the texture itself.
float GetOpacity () const
 Returns the opacity of this decal, used for rendering. The opacity is multiplied with the alpha channel of the albedo texture of the decal, and can be used to make the decal more transparent or more opaque without modifying the texture itself.
void SetNormalBlend (float fNormalBlend)
 Sets the normal blend factor for this decal, used for rendering. The normal blend factor is used to blend the normal map of the decal with the underlying surface normals, and can be used to adjust the strength of the normal map effect of the decal.
float GetNormalBlend () const
 Returns the normal blend factor for this decal, used for rendering. The normal blend factor is used to blend the normal map of the decal with the underlying surface normals, and can be used to adjust the strength of the normal map effect of the decal.
void SetRoughness (float fRoughness)
 Sets the roughness of this decal, used for rendering. The roughness is used to specify the roughness value for the material of the decal, and can be used to make the decal appear more glossy or more rough without modifying the material texture itself.
float GetRoughness () const
 Returns the roughness of this decal, used for rendering. The roughness is used to specify the roughness value for the material of the decal, and can be used to make the decal appear more glossy or more rough without modifying the material texture itself.
void SetMetallic (float fMetallic)
 Sets the metallic of this decal, used for rendering. The metallic is used to specify the metallic value for the material of the decal, and can be used to make the decal appear more metallic or more non-metallic without modifying the material texture itself.
float GetMetallic () const
 Returns the metallic of this decal, used for rendering. The metallic is used to specify the metallic value for the material of the decal, and can be used to make the decal appear more metallic or more non-metallic without modifying the material texture itself.
void SetEmissive (float fEmissive)
 Sets the emissive intensity of this decal, used for rendering. The emissive intensity is multiplied with the emissive texture of the decal, and can be used to make the decal appear more emissive or less emissive without modifying the texture itself.
float GetEmissive () const
 Returns the emissive intensity of this decal, used for rendering. The emissive intensity is multiplied with the emissive texture of the decal, and can be used to make the decal appear more emissive or less emissive without modifying the texture itself.
void SetPriority (xiiUInt8 uiPriority)
 Sets the priority of this decal, used for rendering. The priority is used to determine the rendering order of decals when multiple decals overlap, with higher priority decals being rendered on top of lower priority decals. The priority can be used to ensure that important decals are always visible, while less important decals can be faded out or occluded by higher priority decals.
xiiUInt8 GetPriority () const
 Returns the priority of this decal, used for rendering. The priority is used to determine the rendering order of decals when multiple decals overlap, with higher priority decals being rendered on top of lower priority decals. The priority can be used to ensure that important decals are always visible, while less important decals can be faded out or occluded by higher priority decals.
Public Member Functions inherited from xiiRenderComponent
virtual bool IsRenderDataViewIndependent () const
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

void OnMsgExtractRenderData (xiiMsgExtractRenderData &ref_msg) const
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

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 ()
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.

Detailed Description

Places a decal projector or mesh decal into the render world.

Member Function Documentation

◆ DeserializeComponent()

void xiiDecalComponent::DeserializeComponent ( xiiWorldReader & ref_stream)
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 xiiComponent.

◆ GetLocalBounds()

xiiResult xiiDecalComponent::GetLocalBounds ( xiiBoundingBoxSphere & out_bounds,
bool & out_bAlwaysVisible,
xiiMsgUpdateLocalBounds & ref_msg )
overridevirtual

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.

Implements xiiRenderComponent.

◆ GetRenderExtractionCategories()

xiiBitflags< xiiRenderExtractionCategory > xiiDecalComponent::GetRenderExtractionCategories ( ) const
inlineoverridevirtual

Reimplemented from xiiRenderComponent.

◆ SerializeComponent()

void xiiDecalComponent::SerializeComponent ( xiiWorldWriter & ref_stream) const
overridevirtual

Override this to save the current state of the component to the given stream.

Reimplemented from xiiComponent.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/GraphicsCore/Components/Render/DecalComponent.h
  • /home/runner/work/XII/XII/Source/Engine/GraphicsCore/Components/Render/Implementation/DecalComponent.cpp