NAP
Public Member Functions | Protected Member Functions | List of all members
RenderFrustumComponentInstance Class Reference

#include <renderfrustumcomponent.h>

Public Member Functions

 RenderFrustumComponentInstance (EntityInstance &entity, Component &resource)
 
virtual bool init (utility::ErrorState &errorState) override
 
const glm::vec3 & getColor () const
 
void setColor (const glm::vec3 &color)
 
virtual bool isSupported (nap::CameraComponentInstance &camera) const override
 
- 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
 
- 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

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)
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 
- Protected Attributes inherited from RenderableComponentInstance
RenderServicemRenderService = nullptr
 

Description

Instance part of RenderFrustumComponent

Renders a camera frustum to aid in visual debugging. The is a dynamic line mesh that is updated on the CPU to match the latest camera properties e.g. field of view. Ignores the Mesh property and creates a nap::BoxFrameMesh with usage EMemoryUsage::DynamicWrite. Supports nap::PerspCameraComponent and nap::OrthoCameraComponent. As the box frame mesh only has a position attribute this component is rendered with a simple nap::ConstantShader.

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

Constructor & Destructor Documentation

◆ RenderFrustumComponentInstance()

Member Function Documentation

◆ getColor()

const glm::vec3& getColor ( ) const
Returns
frustrum draw color

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Checks whether a transform component is available.

Reimplemented from RenderableComponentInstance.

◆ isSupported()

virtual bool isSupported ( nap::CameraComponentInstance camera) const
overridevirtual

Called by the Render Service. Supports orthographic and perspective cameras

Reimplemented from RenderableComponentInstance.

◆ onDraw()

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

Draws the current camera frustrum

Implements RenderableComponentInstance.

◆ setColor()

void setColor ( const glm::vec3 &  color)

Set the frustrum draw color