A compositor, describing how to compose the rendering pipeline. More...
Public Member Functions | |
virtual | ~Compositor () |
unsigned int | getNodeCount () const |
CompositorNode * | getNode (unsigned int index) const |
System * | getSystem () const |
nkMemory::StringView | getName () const |
bool | getHidden () const |
void | setName (nkMemory::StringView value) |
void | setHidden (bool value) |
virtual CompositorNode * | addNode () |
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 |
Compositor & | operator= (const Compositor &)=delete |
Public Member Functions inherited from nkExport::Exportable | |
Exportable () noexcept | |
virtual | ~Exportable () |
Static Public Member Functions | |
static nkMemory::UniquePtr< Compositor > | create (System *system=nullptr) |
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.
|
virtual |
Destructor.
unsigned int nkGraphics::Compositor::getNodeCount | ( | ) | const |
CompositorNode* nkGraphics::Compositor::getNode | ( | unsigned int | index | ) | const |
index | The index of the node to retrieve. |
System* nkGraphics::Compositor::getSystem | ( | ) | const |
nkMemory::StringView nkGraphics::Compositor::getName | ( | ) | const |
bool nkGraphics::Compositor::getHidden | ( | ) | const |
void nkGraphics::Compositor::setName | ( | nkMemory::StringView | value | ) |
Sets the name used by the compositor.
value | The name to use. |
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.
value | Whether it should be hidden (true) or not (false). |
|
virtual |
Adds a node to the compositor.
|
virtual |
Erases and frees a node memory.
index | The index of the node to free. |
|
virtual |
Changes the order of the nodes. Currently, this can be used to reorder the rendering steps (nodes are executed sequentially).
fromIndex | The index of the node to move. |
toIndex | The index to which the node should be moved. |
|
virtual |
Clears and frees all the nodes.
|
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.
|
overridevirtual |
Basic exporting capability.
rootNode | The tree to export to. |
Implements nkExport::Exportable.
|
overridevirtual |
Basic importing capability.
rootNode | The tree to import from. |
Implements nkExport::Exportable.
|
delete |
Copy operator.
|
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.
system | The system to create the resource into. If left to nullptr, then the Singleton instance will be used. |