API Documentation
Public Member Functions | Static Public Member Functions | List of all members
nkGraphics::RenderQueue Class Reference

A render queue, where all items that have to be rendered are queued. More...

Inheritance diagram for nkGraphics::RenderQueue:
nkExport::Exportable

Public Member Functions

virtual ~RenderQueue ()
 
virtual BuffergetAccelerationStructureBuffer () const
 
System * getSystem () const
 
nkMemory::StringView getName () const
 
bool getRaytraced () const
 
bool getHidden () const
 
EntitygetEntity (unsigned int index) const
 
unsigned int getEntityCount () const
 
RenderStrategygetRenderStrategy () const
 
virtual void setName (nkMemory::StringView name)
 
virtual void setRaytraced (bool value)
 
void setRenderStrategy (RenderStrategy *value)
 
void setHidden (bool value)
 
virtual EntityaddEntity ()
 
virtual void eraseEntity (Entity *ent)
 
virtual void clearQueue ()
 
RenderCommandQueue bakeRenderCommandQueue (Shader *shader=nullptr, bool transparent=false)
 
virtual void updateEntityNode (Entity *ent, Node *oldNode)
 
virtual void updateEntityRenderInfo (Entity *ent, EntityRenderInfo *oldInfo, EntityRenderInfo *newInfo)
 
virtual void updateMesh (Entity *ent, EntityRenderInfoSlot *slot, EntityRenderLodSlot *lod, Mesh *oldMesh, Mesh *newMesh)
 
virtual void updateShader (Entity *ent, EntityRenderInfoSlot *slot, EntityRenderLodSlot *lod, Shader *oldShader, Shader *newShader)
 
virtual void updateShaderRaytracing (Entity *ent, EntityRenderInfoSlot *slot, EntityRenderLodSlot *lod, Shader *oldShader, Shader *newShader)
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable () noexcept
 
virtual ~Exportable ()
 

Static Public Member Functions

static nkMemory::UniquePtr< RenderQueuecreate (System *system=nullptr)
 

Detailed Description

A render queue, where all items that have to be rendered are queued.

A queue can allocate entities to render. The entities can be used as-is, or attached to a Node, using Entity::setParentNode(). When an object is attached to the graph, it enables it to work with the transformations from the graph system.

See RenderQueueManager::createOrRetrieve() or RenderQueue::create() for instantiation.

Constructor & Destructor Documentation

◆ ~RenderQueue()

virtual nkGraphics::RenderQueue::~RenderQueue ( )
virtual

Destructor.

Member Function Documentation

◆ getAccelerationStructureBuffer()

virtual Buffer* nkGraphics::RenderQueue::getAccelerationStructureBuffer ( ) const
virtual

Retrieves the acceleration structure's buffer. This buffer can be fed to shaders for raytracing. If raytracing is not supported, this buffer will be empty.

Returns
The acceleration structure's buffer used.

◆ getSystem()

System* nkGraphics::RenderQueue::getSystem ( ) const
Returns
The system the resource lives in.

◆ getName()

nkMemory::StringView nkGraphics::RenderQueue::getName ( ) const
Returns
The name assigned.

◆ getRaytraced()

bool nkGraphics::RenderQueue::getRaytraced ( ) const
Returns
Whether the queue is marked as raytraced (true) or not (false).

◆ getHidden()

bool nkGraphics::RenderQueue::getHidden ( ) const
Returns
Whether the render queue is hidden from project exporting (true) or not (false).

◆ getEntity()

Entity* nkGraphics::RenderQueue::getEntity ( unsigned int  index) const
Parameters
indexThe index of the entity to retrieve.
Returns
The entity requested if available, nullptr else.

◆ getEntityCount()

unsigned int nkGraphics::RenderQueue::getEntityCount ( ) const
Returns
The number of entities currently in the queue.

◆ getRenderStrategy()

RenderStrategy* nkGraphics::RenderQueue::getRenderStrategy ( ) const
Returns
The currently used render strategy.
Remarks
By default, this will be an instance of a DefaultRenderStrategy.

◆ setName()

virtual void nkGraphics::RenderQueue::setName ( nkMemory::StringView  name)
virtual
Parameters
nameThe name to set.

◆ setRaytraced()

virtual void nkGraphics::RenderQueue::setRaytraced ( bool  value)
virtual

Sets whether this queue should be raytraced. Raytraced queues will keep their acceleration structures updated as they change. Enable this only when needed.

Parameters
valueIf the queue should be raytraced (true) or not (false).

◆ setRenderStrategy()

void nkGraphics::RenderQueue::setRenderStrategy ( RenderStrategy value)

Sets the strategy to use when rendering a pass using the render queue.

Parameters
valueThe strategy to use, nullptr to reset to the default strategy.
Remarks
Ownership of provided object remains in the hands of the client code, the render queue won't delete it.

◆ setHidden()

void nkGraphics::RenderQueue::setHidden ( bool  value)

Sets whether the render queue should be hidden from the project exporting functions.

Parameters
valueIf it should be hidden (true) or not (false).

◆ addEntity()

virtual Entity* nkGraphics::RenderQueue::addEntity ( )
virtual

Adds an entity into the queue.

Returns
The entity allocated and added to the queue.

◆ eraseEntity()

virtual void nkGraphics::RenderQueue::eraseEntity ( Entity ent)
virtual

Erases and frees the memory of an entity.

Parameters
entThe entity to forget.

◆ clearQueue()

virtual void nkGraphics::RenderQueue::clearQueue ( )
virtual

Clears the queue and makes it empty again.

◆ bakeRenderCommandQueue()

RenderCommandQueue nkGraphics::RenderQueue::bakeRenderCommandQueue ( Shader shader = nullptr,
bool  transparent = false 
)

Translates the render queue into a command queue to render. Called by the MonoMaterialPass and RenderScenePass to eventually tansmit it to the renderer. This can also be called to check on custom strategies during their development time.

Parameters
shaderA Shader to communicate as a parameter to the strategy, used by the MonoMaterialPass to provide its own shader.
transparentWhether the calling pass is flagged as transparent, or not.
Returns
The command queue the strategy currently used provides back.

◆ updateEntityNode()

virtual void nkGraphics::RenderQueue::updateEntityNode ( Entity ent,
Node oldNode 
)
virtual

Updates called from registered objects. In theory, external code should not use it.

Parameters
entThe caller.
oldNodeThe node the entity updates from.

◆ updateEntityRenderInfo()

virtual void nkGraphics::RenderQueue::updateEntityRenderInfo ( Entity ent,
EntityRenderInfo oldInfo,
EntityRenderInfo newInfo 
)
virtual

Update called from registered object. In theory, external code should not use it.

Parameters
entThe caller.
oldInfoThe information the call updates from.
newInfoThe new information the call updates to.

◆ updateMesh()

virtual void nkGraphics::RenderQueue::updateMesh ( Entity ent,
EntityRenderInfoSlot slot,
EntityRenderLodSlot lod,
Mesh oldMesh,
Mesh newMesh 
)
virtual

Update called from registered object. In theory, external code should not use it.

Parameters
entThe caller.
slotThe parent slot call is made from.
lodThe LOD the call is made from.
oldMeshThe mesh the call updates from.
newMeshThe mesh the call updates to.

◆ updateShader()

virtual void nkGraphics::RenderQueue::updateShader ( Entity ent,
EntityRenderInfoSlot slot,
EntityRenderLodSlot lod,
Shader oldShader,
Shader newShader 
)
virtual

Update called from registered object. In theory, external code should not use it.

Parameters
entThe caller.
slotThe parent slot call is made from.
lodThe LOD the call is made from.
oldShaderThe shader the call udpates from.
newShaderThe shader the call updates to.

◆ updateShaderRaytracing()

virtual void nkGraphics::RenderQueue::updateShaderRaytracing ( Entity ent,
EntityRenderInfoSlot slot,
EntityRenderLodSlot lod,
Shader oldShader,
Shader newShader 
)
virtual

Update called from registered object. In theory, external code should not use it.

Parameters
entThe caller.
slotThe parent slot call is made from.
lodThe LOD the call is made from.
oldShaderThe shader the call udpates from.
newShaderThe shader the call updates to.

◆ exportClassToTree()

virtual void nkGraphics::RenderQueue::exportClassToTree ( nkExport::Node rootNode)
overridevirtual

Exports an item into a tree describing its structure and its data.

Parameters
rootNodeThe node into which the object has to write its related information.

Implements nkExport::Exportable.

◆ importClassFromTree()

virtual void nkGraphics::RenderQueue::importClassFromTree ( nkExport::Node rootNode)
overridevirtual

Imports information from a tree which is supposed to describe its structure and data.

Parameters
rootNodeThe root node of the tree holding the information.

Implements nkExport::Exportable.

◆ create()

static nkMemory::UniquePtr<RenderQueue> nkGraphics::RenderQueue::create ( System *  system = nullptr)
static

Creates a standalone resource, linking it to a system, but no manager. This method can be used to allocate a resource and manually manage its lifetime.

Parameters
systemThe system to create the resource into. If left to nullptr, then the Singleton instance will be used.
Returns
The created resource instance.

The documentation for this class was generated from the following file: