NAP
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
RenderFaderComponentInstance Class Reference

#include <renderfadercomponent.h>

Public Types

enum  EFadeState : nap::uint8 { FadingIn = 0, FadedIn = 1, FadingOut = 2, FadedOut = 3 }
 

Public Member Functions

 RenderFaderComponentInstance (EntityInstance &entity, Component &component)
 
virtual bool init (utility::ErrorState &errorState) override
 
virtual void update (double deltaTime) override
 
EFadeState getState () const
 
void fadeIn ()
 
void fadeOut ()
 
- Public Member Functions inherited from RenderableComponentInstance
 RenderableComponentInstance (EntityInstance &entity, Component &resource)
 
void draw (IRenderTarget &renderTarget, VkCommandBuffer commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix)
 
void setVisible (bool visible)
 
bool isVisible () const
 
const std::vector< ResourcePtr< RenderTag > > & getTags () const
 
RenderMask getMask () const
 
bool includesMask (RenderMask otherMask)
 
int getRank () const
 
const RenderLayergetLayer () const
 
virtual bool isSupported (nap::CameraComponentInstance &camera) const
 
- Public Member Functions inherited from ComponentInstance
 ComponentInstance (EntityInstance &entity, Component &resource)
 
nap::EntityInstancegetEntityInstance () const
 
nap::ComponentgetComponent () const
 
template<typename T >
T * getComponent () const
 
virtual bool init (utility::ErrorState &errorState)
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

nap::Signal mFadedIn
 Triggered when a fade transition finished fading from 'FadeColor'. More...
 
nap::Signal mFadedOut
 Triggered when a fade transition finished fading to 'FadeColor'. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Protected Member Functions

virtual void onDraw (IRenderTarget &renderTarget, VkCommandBuffer commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix) override
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 
- Protected Attributes inherited from RenderableComponentInstance
RenderServicemRenderService = nullptr
 

Description

Instance part of RenderFaderComponent

Renders a alpha-blended full-screen triangle in front of all previously rendered objects. Uses a nap::EmptyMesh internally to avoid using buffers. The FadedIn and FadedOut signals can be used to hook up any user callbacks in response to changes of transition states.

Ensure this component is excluded from shadow rendering passes using render tags, and is rendered last (on top of previously rendered objects) using render layers. When setup this way, the component can be rendered without a depth buffer: EDepthMode::NoReadWrite.

Inheritance diagram for RenderFaderComponentInstance:
[legend]
Collaboration diagram for RenderFaderComponentInstance:
[legend]

Member Enumeration Documentation

◆ EFadeState

enum EFadeState : nap::uint8
strong
Enumerator
FadingIn 

Currently fading in.

FadedIn 

Completely faded in (no effect)

FadingOut 

Currently fading out.

FadedOut 

Completely faded out.

Constructor & Destructor Documentation

◆ RenderFaderComponentInstance()

RenderFaderComponentInstance ( EntityInstance entity,
Component component 
)

Member Function Documentation

◆ fadeIn()

void fadeIn ( )

Starts a fade-in transition.

◆ fadeOut()

void fadeOut ( )

Starts a fade-out transition.

◆ getState()

EFadeState getState ( ) const
Returns
current fade state

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initializes this component.

Reimplemented from RenderableComponentInstance.

◆ onDraw()

virtual void onDraw ( IRenderTarget renderTarget,
VkCommandBuffer  commandBuffer,
const glm::mat4 &  viewMatrix,
const glm::mat4 &  projectionMatrix 
)
overrideprotectedvirtual

Renders the triangle mesh using the fade material.

Implements RenderableComponentInstance.

◆ update()

virtual void update ( double  deltaTime)
overridevirtual

Updates the local transform of this component such that it represents the location of the back plane. This ensures the depth sorter considers this object to be behind other components inside the box.

Parameters
deltaTimethe time in between cooks in seconds

Reimplemented from ComponentInstance.

Member Data Documentation

◆ mFadedIn

nap::Signal mFadedIn

Triggered when a fade transition finished fading from 'FadeColor'.

◆ mFadedOut

nap::Signal mFadedOut

Triggered when a fade transition finished fading to 'FadeColor'.