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

#include <renderskyboxcomponent.h>

Public Member Functions

 RenderSkyBoxComponentInstance (EntityInstance &entity, Component &resource)
 
virtual bool init (utility::ErrorState &errorState) override
 
void setTexture (const TextureCube &texture)
 
const TextureCubegetTexture () const
 
void setColor (const glm::vec3 &color)
 
const glm::vec3 & getColor () const
 
void setOpacity (float opacity)
 
float getOpacity () const
 
- 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)
 
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 RenderSkyBoxComponent

Renders a skybox using a cube texture. Creates a nap::BoxMesh with front-face culling enabled internally. The default skybox shader negates the translational component of the view matrix to fake unlimited depth. This object should be rendered first to fill the background; to do this, ensure it is in the back layer. You may also want to exclude this object from a shadow rendering pass using tags. The shader variables are set automatically from this component's properties.

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

Constructor & Destructor Documentation

◆ RenderSkyBoxComponentInstance()

RenderSkyBoxComponentInstance ( EntityInstance entity,
Component resource 
)

Member Function Documentation

◆ getColor()

const glm::vec3& getColor ( ) const
Returns
sky box color

◆ getOpacity()

float getOpacity ( ) const
Returns
sky box opacity

◆ getTexture()

const TextureCube& getTexture ( ) const

Get the current sky box texture

Returns
current sky box texture

◆ init()

virtual bool init ( utility::ErrorState errorState)
overridevirtual

Initializes the skybox render component, including required materials, meshes and bindings.

Parameters
errorStatecontains the error when initialization fails
Returns
if initialization succeeded.

Reimplemented from RenderableComponentInstance.

◆ onDraw()

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

Draws the skybox to the given render target

Implements RenderableComponentInstance.

◆ setColor()

void setColor ( const glm::vec3 &  color)

Set the sky box color

Parameters
colornew skybox color

◆ setOpacity()

void setOpacity ( float  opacity)

Set the sky box opacity

Parameters
opacitynew sky box opacity

◆ setTexture()

void setTexture ( const TextureCube texture)

Update the sky box cube texture

Parameters
texturethe new skybox texture