Public Member Functions | Protected Member Functions | List of all members
RenderableComponentInstance Class Referenceabstract

#include <rendercomponent.h>

Public Member Functions

 RenderableComponentInstance (EntityInstance &entity, Component &resource)
virtual bool init (utility::ErrorState &errorState) override
void draw (IRenderTarget &renderTarget, VkCommandBuffer commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix)
void setVisible (bool visible)
bool isVisible () const
virtual bool isSupported (nap::CameraComponentInstance &camera) const
- Public Member Functions inherited from ComponentInstance
 ComponentInstance (EntityInstance &entity, Component &resource)
virtual void update (double deltaTime)
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

Protected Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...


Represents an object that can be rendered to screen or any other type of render target. This is the base class for all render-able types. Override the draw call to implement custom draw behavior.

Inheritance diagram for RenderableComponentInstance:
Collaboration diagram for RenderableComponentInstance:

Constructor & Destructor Documentation

◆ RenderableComponentInstance()

RenderableComponentInstance ( EntityInstance entity,
Component resource 

Member Function Documentation

◆ draw()

void draw ( IRenderTarget renderTarget,
VkCommandBuffer  commandBuffer,
const glm::mat4 &  viewMatrix,
const glm::mat4 &  projectionMatrix 

Called by the render service, calls onDraw() if visible. Renders the object to the given render target using the provided command buffer, view and projection matrix.

renderTargettarget to render to
commandBufferactive command buffer
viewMatrixoften the camera world space location.
projectionMatrixoften the camera projection matrix.

◆ init()

virtual bool init ( utility::ErrorState errorState)

◆ isSupported()

virtual bool isSupported ( nap::CameraComponentInstance camera) const

Called by the Render Service. By default every camera type is supported If your renderable component doesn't support a specific camera return false In that case the object won't be rendered.

if the object can be rendered with the given camera

Reimplemented in Renderable2DTextComponentInstance, RenderToTextureComponentInstance, RenderVideoComponentInstance, and RenderGnomonComponentInstance.

◆ isVisible()

bool isVisible ( ) const
if the mesh is visible or not, default = true

◆ onDraw()

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

Called by the render service. Override this method to implement your own custom draw behavior. This method won't be called if the mesh isn't visible.

renderTargetcurrently bound render target
commandBufferactive command buffer
viewMatrixthe camera world space location
projectionMatrixthe camera projection matrix

Implemented in Renderable2DTextComponentInstance, RenderableMeshComponentInstance, RenderToTextureComponentInstance, Renderable3DTextComponentInstance, RenderVideoComponentInstance, RenderBloomComponentInstance, and RenderGnomonComponentInstance.

◆ setVisible()

void setVisible ( bool  visible)

Toggles visibility.

visibleif this object should be drawn or not