#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 |
const std::vector< ResourcePtr< RenderTag > > & | getTags () const |
RenderMask | getMask () const |
bool | includesMask (RenderMask otherMask) |
int | getRank () const |
const RenderLayer * | getLayer () const |
virtual bool | isSupported (nap::CameraComponentInstance &camera) const |
![]() | |
ComponentInstance (EntityInstance &entity, Component &resource) | |
virtual void | update (double deltaTime) |
nap::EntityInstance * | getEntityInstance () const |
nap::Component * | getComponent () const |
template<typename T > | |
T * | getComponent () const |
virtual bool | init (utility::ErrorState &errorState) |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Protected Member Functions | |
virtual void | onDraw (IRenderTarget &renderTarget, VkCommandBuffer commandBuffer, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix)=0 |
Protected Attributes | |
RenderService * | mRenderService = nullptr |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
![]() | |
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.
RenderableComponentInstance | ( | EntityInstance & | entity, |
Component & | resource | ||
) |
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.
renderTarget | target to render to |
commandBuffer | active command buffer |
viewMatrix | often the camera world space location. |
projectionMatrix | often the camera projection matrix. |
const RenderLayer* getLayer | ( | ) | const |
Returns the layer assigned to this component. Every layer is assigned a rank which controls the order in which components are rendered, where 0 is the front and the last index is the back.
RenderMask getMask | ( | ) | const |
int getRank | ( | ) | const |
Returns the rank of this component in the render chain, defaults to 0 (front) if no layer is assigned. The rank controls the order in which components are rendered, where 0 is the front and the last index is the back.
const std::vector<ResourcePtr<RenderTag> >& getTags | ( | ) | const |
bool includesMask | ( | RenderMask | otherMask | ) |
Returns if this component can be rendered with (includes) the given mask. The component can be rendered when included in the other mask or when no mask is provided.
otherMask | the inclusion mask |
|
overridevirtual |
Initializes this component for rendering. Make sure to always call this in derived classes!
errorState | the message when initialization fails |
Reimplemented from ComponentInstance.
Reimplemented in Renderable2DTextComponentInstance, RenderToTextureComponentInstance, RenderableMeshComponentInstance, Renderable3DTextComponentInstance, RenderFaderComponentInstance, RenderGnomonComponentInstance, RenderSkyBoxComponentInstance, RenderBloomComponentInstance, RenderableTextComponentInstance, RenderFrustumComponentInstance, and RenderVideoComponentInstance.
|
virtual |
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.
Reimplemented in Renderable2DTextComponentInstance, RenderToTextureComponentInstance, RenderFrustumComponentInstance, RenderVideoComponentInstance, and RenderGnomonComponentInstance.
bool isVisible | ( | ) | const |
|
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.
renderTarget | currently bound render target |
commandBuffer | active command buffer |
viewMatrix | the camera world space location |
projectionMatrix | the camera projection matrix |
Implemented in Renderable2DTextComponentInstance, RenderableMeshComponentInstance, RenderToTextureComponentInstance, Renderable3DTextComponentInstance, RenderSkyBoxComponentInstance, RenderFaderComponentInstance, RenderVideoComponentInstance, RenderBloomComponentInstance, RenderFrustumComponentInstance, and RenderGnomonComponentInstance.
void setVisible | ( | bool | visible | ) |
Toggles visibility.
visible | if this object should be drawn or not |
|
protected |