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

A compositor, describing how to compose the rendering pipeline. More...

Inheritance diagram for nkGraphics::Compositor:
nkExport::Exportable

Public Member Functions

virtual ~Compositor ()
 
unsigned int getNodeCount () const
 
CompositorNodegetNode (unsigned int index) const
 
SystemgetSystem () const
 
nkMemory::StringView getName () const
 
bool getHidden () const
 
void setName (nkMemory::StringView value)
 
void setHidden (bool value)
 
virtual CompositorNodeaddNode ()
 
virtual void deleteNode (unsigned int index)
 
virtual void changeNodeOrder (unsigned int fromIndex, unsigned int toIndex)
 
virtual void clearNodes ()
 
virtual void renderChain ()
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
Compositoroperator= (const Compositor &)=delete
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable () noexcept
 
virtual ~Exportable ()
 

Static Public Member Functions

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

Detailed Description

A compositor, describing how to compose the rendering pipeline.

This class is the basic system that allows the whole rendering to occur.

The purpose is to populate it with CompositorNode. The nodes can be activated and deactivated on the fly.
Those nodes are populated with TargetOperation, which describes the outputs for a rendering operation.
The operations are populated with any kind of Pass. The pass are executed sequentially to reach the rendering result wished.

This descriptive kind of API allows the engine to organize and schedule work to help maintaining an efficient rendering logic. There is currently no other way in nkGraphics to render.

See CompositorManager::createOrRetrieve() or Compositor::create() for instantiation.

Constructor & Destructor Documentation

◆ ~Compositor()

virtual nkGraphics::Compositor::~Compositor ( )
virtual

Destructor.

Member Function Documentation

◆ getNodeCount()

unsigned int nkGraphics::Compositor::getNodeCount ( ) const
Returns
The number of nodes available.

◆ getNode()

CompositorNode* nkGraphics::Compositor::getNode ( unsigned int  index) const
Parameters
indexThe index of the node to retrieve.
Returns
The node requested if available, nullptr else.

◆ getSystem()

System* nkGraphics::Compositor::getSystem ( ) const
Returns
The system the resource is living in.

◆ getName()

nkMemory::StringView nkGraphics::Compositor::getName ( ) const
Returns
The name of the compositor.

◆ getHidden()

bool nkGraphics::Compositor::getHidden ( ) const
Returns
Whether the compositor is hidden during project export (true) or not (false).

◆ setName()

void nkGraphics::Compositor::setName ( nkMemory::StringView  value)

Sets the name used by the compositor.

Parameters
valueThe name to use.

◆ setHidden()

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

Sets whether the compositor should be hidden during project export. During project export, compositors registered in the manager will be exported, unless they are hidden.

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

◆ addNode()

virtual CompositorNode* nkGraphics::Compositor::addNode ( )
virtual

Adds a node to the compositor.

Returns
The newly created node. The compositor owns the memory returned, external code should never delete it. See deleteNode().

◆ deleteNode()

virtual void nkGraphics::Compositor::deleteNode ( unsigned int  index)
virtual

Erases and frees a node memory.

Parameters
indexThe index of the node to free.

◆ changeNodeOrder()

virtual void nkGraphics::Compositor::changeNodeOrder ( unsigned int  fromIndex,
unsigned int  toIndex 
)
virtual

Changes the order of the nodes. Currently, this can be used to reorder the rendering steps (nodes are executed sequentially).

Parameters
fromIndexThe index of the node to move.
toIndexThe index to which the node should be moved.

◆ clearNodes()

virtual void nkGraphics::Compositor::clearNodes ( )
virtual

Clears and frees all the nodes.

◆ renderChain()

virtual void nkGraphics::Compositor::renderChain ( )
virtual

Renders the compositor. This triggers the rendering process for the whole compositor. This method is a good candidate to do off-screen rendering.

However, be sure to prepare the component for the context you will want to render for using MainSystem::tickForNewFrame() and specify the right context for your needs. This will setup the cameras, viewports, and other context dependent variables used to feed the rendering pipeline.

◆ exportClassToTree()

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

Basic exporting capability.

Parameters
rootNodeThe tree to export to.

Implements nkExport::Exportable.

◆ importClassFromTree()

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

Basic importing capability.

Parameters
rootNodeThe tree to import from.

Implements nkExport::Exportable.

◆ operator=()

Compositor& nkGraphics::Compositor::operator= ( const Compositor )
delete

Copy operator.

◆ create()

static nkMemory::UniquePtr<Compositor> nkGraphics::Compositor::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: