API Documentation
Public Member Functions | List of all members
nkGraphics::TargetOperations Class Referenceabstract

Describes a target operation set. More...

Inheritance diagram for nkGraphics::TargetOperations:
nkExport::Exportable

Public Member Functions

 TargetOperations (System *system) noexcept
 
 TargetOperations (const TargetOperations &)=delete
 
virtual ~TargetOperations ()
 
nkMemory::StringView getName () const
 
void setName (nkMemory::StringView name)
 
virtual ClearTargetsPassaddClearTargetsPass (unsigned int index=-1)
 
virtual ComputePassaddComputePass (unsigned int index=-1)
 
virtual InstancingPassaddInstancingPass (unsigned int index=-1)
 
virtual MonoMaterialPassaddMonoMaterialPass (unsigned int index=-1)
 
virtual PostProcessPassaddPostProcessPass (unsigned int index=-1)
 
virtual RaytracingPassaddRaytracingPass (unsigned int index=-1)
 
virtual RenderScenePassaddRenderScenePass (unsigned int index=-1)
 
unsigned int getPassCount () const
 
PassgetPass (unsigned int index) const
 
virtual void deletePass (unsigned int index)
 
virtual void changePassOrder (unsigned int fromIndex, unsigned int toIndex)
 
virtual void setColorTarget (const TargetDescriptor &targetDesc, unsigned int outputIndex=0)
 
virtual void addColorTarget (const TargetDescriptor &targetDesc)
 
virtual void changeColorTargetOrder (unsigned int fromIndex, unsigned int toIndex)
 
virtual void removeColorTarget (unsigned int index)
 
virtual void setDepthTarget (Texture *target)
 
unsigned int getColorTargetCount () const
 
TexturegetColorTarget (unsigned int index) const
 
int getColorTargetRenderIndex (unsigned int index) const
 
TexturegetDepthTarget () const
 
virtual void setToBackBuffer (bool val, unsigned int indexInArray=0)
 
bool isToBackBuffer () const
 
unsigned int getBackBufferViewIndex () const
 
virtual void setToChainDepthBuffer (bool val)
 
bool isToChainDepthBuffer () const
 
virtual void setOverloadedViewport (Viewport *value)
 
ViewportgetOverloadedViewport () const
 
virtual void execute ()=0
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
void processColorTargetObjectNode (nkExport::Node *targetNode)
 
void processPassObjectNode (nkExport::Node *passNode)
 
TargetOperationsoperator= (const TargetOperations &)=delete
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable () noexcept
 
virtual ~Exportable ()
 

Detailed Description

Describes a target operation set.

Its role is to specify where a rendering should happen. This implies setting any number of render target and the depth target. The passes are then executed sequentially to paint and use given targets.

Constructor & Destructor Documentation

◆ TargetOperations() [1/2]

nkGraphics::TargetOperations::TargetOperations ( System system)
noexcept

Constructor. In theory, should not be called by external code. See CompositorNode::addOperations().

Parameters
systemThe system the resource should live in.

◆ TargetOperations() [2/2]

nkGraphics::TargetOperations::TargetOperations ( const TargetOperations )
delete

Copy constructor.

◆ ~TargetOperations()

virtual nkGraphics::TargetOperations::~TargetOperations ( )
virtual

Destructor.

Member Function Documentation

◆ getName()

nkMemory::StringView nkGraphics::TargetOperations::getName ( ) const
Returns
The name of the operation.

◆ setName()

void nkGraphics::TargetOperations::setName ( nkMemory::StringView  name)

Sets the name of the operations.

Parameters
nameThe name to use for the operations.

◆ addClearTargetsPass()

virtual ClearTargetsPass* nkGraphics::TargetOperations::addClearTargetsPass ( unsigned int  index = -1)
virtual

Adds a clear targets pass to the operations.

Parameters
indexIf specified within [0, nbPass], will replace the pass specified by the index. Else, creates a new pass.
Returns
The newly created pass. The TargetOperations owns the memory returned, external code should not delete it. See deletePass().
Remarks
Passes are executed sequentially, the order in which they are added matters.

◆ addComputePass()

virtual ComputePass* nkGraphics::TargetOperations::addComputePass ( unsigned int  index = -1)
virtual

Adds a compute pass to the operations.

Parameters
indexIf specified within [0, nbPass], will replace the pass specified by the index. Else, creates a new pass.
Returns
The newly created pass. The TargetOperations owns the memory returned, external code should not delete it. See deletePass().
Remarks
Passes are executed sequentially, the order in which they are added matters.

◆ addInstancingPass()

virtual InstancingPass* nkGraphics::TargetOperations::addInstancingPass ( unsigned int  index = -1)
virtual

Adds an instancing pass to the operations.

Parameters
indexIf specified within [0, nbPass], will replace the pass specified by the index. Else, creates a new pass.
Returns
The newly created pass. The TargetOperations owns the memory returned, external code should not delete it. See deletePass().
Remarks
Passes are executed sequentially, the order in which they are added matters.

◆ addMonoMaterialPass()

virtual MonoMaterialPass* nkGraphics::TargetOperations::addMonoMaterialPass ( unsigned int  index = -1)
virtual

Adds a mono-material pass to the operations.

Parameters
indexIf specified within [0, nbPass], will replace the pass specified by the index. Else, creates a new pass.
Returns
The newly created pass. The TargetOperations owns the memory returned, external code should not delete it. See deletePass().
Remarks
Passes are executed sequentially, the order in which they are added matters.

◆ addPostProcessPass()

virtual PostProcessPass* nkGraphics::TargetOperations::addPostProcessPass ( unsigned int  index = -1)
virtual

Adds a post processing pass to the operations.

Parameters
indexIf specified within [0, nbPass], will replace the pass specified by the index. Else, creates a new pass.
Returns
The newly created pass. The TargetOperations owns the memory returned, external code should not delete it. See deletePass().
Remarks
Passes are executed sequentially, the order in which they are added matters.

◆ addRaytracingPass()

virtual RaytracingPass* nkGraphics::TargetOperations::addRaytracingPass ( unsigned int  index = -1)
virtual

Adds a raytracing pass to the operations.

Parameters
indexIf specified within [0, nbPass], will replace the pass specified by the index. Else, creates a new pass.
Returns
The newly created pass. The TargetOperations owns the memory returned, external code should not delete it. See deletePass().
Remarks
Passes are executed sequentially, the order in which they are added matters.

◆ addRenderScenePass()

virtual RenderScenePass* nkGraphics::TargetOperations::addRenderScenePass ( unsigned int  index = -1)
virtual

Adds a render scene pass to the operations.

Parameters
indexIf specified within [0, nbPass], will replace the pass specified by the index. Else, creates a new pass.
Returns
The newly created pass. The TargetOperations owns the memory returned, external code should not delete it. See deletePass().
Remarks
Passes are executed sequentially, the order in which they are added matters.

◆ getPassCount()

unsigned int nkGraphics::TargetOperations::getPassCount ( ) const
Returns
The number of active pass.

◆ getPass()

Pass* nkGraphics::TargetOperations::getPass ( unsigned int  index) const
Parameters
indexThe index of the pass to retrieve.
Returns
The pass linked to the index if available, nullptr else.
Remarks
Due to usage of polymorphism, the base Pass class is returned. If need be, check Pass::getPassType().

◆ deletePass()

virtual void nkGraphics::TargetOperations::deletePass ( unsigned int  index)
virtual

Erases and frees the memory of a pass.

Parameters
indexThe index of the pass to erase.

◆ changePassOrder()

virtual void nkGraphics::TargetOperations::changePassOrder ( unsigned int  fromIndex,
unsigned int  toIndex 
)
virtual

Changes the ordering in the pass execution.

Parameters
fromIndexThe index of the pass to move.
toIndexThe index of the pass to swap with.

◆ setColorTarget()

virtual void nkGraphics::TargetOperations::setColorTarget ( const TargetDescriptor targetDesc,
unsigned int  outputIndex = 0 
)
virtual

Sets a color target to a particular slot in the rendering array. It overrides any target previously set at given index. If the index is bigger than the target count, target just gets added as the last target.

Parameters
targetDescThe description of the target to render to.
outputIndexThe index at which the target should be set.

◆ addColorTarget()

virtual void nkGraphics::TargetOperations::addColorTarget ( const TargetDescriptor targetDesc)
virtual

Adds a color target to the operations. Multi target is possible by adding multiple targets. The index associated in the output mergers will be given by the order in which targets are added, starting at 0.

Parameters
targetDescThe description of the target to render to.

◆ changeColorTargetOrder()

virtual void nkGraphics::TargetOperations::changeColorTargetOrder ( unsigned int  fromIndex,
unsigned int  toIndex 
)
virtual

Allows to change a target to make it attach to another slot.

Parameters
fromIndexThe current index ot the target to move.
toIndexTo which index it should be moved.
Remarks
If a target is present at given toIndex, it is swapped with the one moving from fromIndex.

◆ removeColorTarget()

virtual void nkGraphics::TargetOperations::removeColorTarget ( unsigned int  index)
virtual
Parameters
indexThe index of the target to remove in the operations tracking memory.

◆ setDepthTarget()

virtual void nkGraphics::TargetOperations::setDepthTarget ( Texture target)
virtual
Parameters
targetThe depth target to use.

◆ getColorTargetCount()

unsigned int nkGraphics::TargetOperations::getColorTargetCount ( ) const
Returns
The number of color rendering target for the operations.

◆ getColorTarget()

Texture* nkGraphics::TargetOperations::getColorTarget ( unsigned int  index) const
Parameters
indexThe index of the target to retrieve in the operations tracking memory.
Returns
The render target attached to the index if available, nullptr else.

◆ getColorTargetRenderIndex()

int nkGraphics::TargetOperations::getColorTargetRenderIndex ( unsigned int  index) const

Allows to retrieve the index of the render target view used for a render target at given index in tracking memory.

Parameters
indexThe index of the render target, in the operations memory.
Returns
The used render target view's index from the render target if available, -1 else.

◆ getDepthTarget()

Texture* nkGraphics::TargetOperations::getDepthTarget ( ) const
Returns
The depth target written by the operations.

◆ setToBackBuffer()

virtual void nkGraphics::TargetOperations::setToBackBuffer ( bool  val,
unsigned int  indexInArray = 0 
)
virtual

Enables the operations to render to the target provided by the context.

Parameters
valIf the rendering should happen (true) or not (false).
indexInArrayThe index in which the back buffer should be written, if multi-target rendering is needed.

◆ isToBackBuffer()

bool nkGraphics::TargetOperations::isToBackBuffer ( ) const
Returns
If the operations is rendering to the context back buffer.

◆ getBackBufferViewIndex()

unsigned int nkGraphics::TargetOperations::getBackBufferViewIndex ( ) const
Returns
At which index the back buffer is being written in the operations, if enabled. This can serve during multi-target rendering.

◆ setToChainDepthBuffer()

virtual void nkGraphics::TargetOperations::setToChainDepthBuffer ( bool  val)
virtual

Sets if the operations should use the depth buffer provided by the context.

Parameters
valIf the compositor's depth buffer should be used (true) or not (false).

◆ isToChainDepthBuffer()

bool nkGraphics::TargetOperations::isToChainDepthBuffer ( ) const
Returns
If the operations is rendering to the chain depth buffer (the one provided by the context).

◆ setOverloadedViewport()

virtual void nkGraphics::TargetOperations::setOverloadedViewport ( Viewport value)
virtual

Sets the viewport to use during the operations. By default, the viewport corresponds with the render targets dimensions. This function can be used to override this behaviour.

Parameters
valueThe viewport to use when executing.

◆ getOverloadedViewport()

Viewport* nkGraphics::TargetOperations::getOverloadedViewport ( ) const
Returns
The overloaded viewport for the operations.

◆ execute()

virtual void nkGraphics::TargetOperations::execute ( )
pure virtual

Executes the operations and run all the passes. In theory, this function should not be called by external code, it is part of the rendering routine. See Compositor::renderChain().

◆ exportClassToTree()

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

Basic exporting capabilities.

Parameters
rootNodeThe tree to export to.

Implements nkExport::Exportable.

◆ importClassFromTree()

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

Basic importing capabilities.

Parameters
rootNodeThe tree to import from.

Implements nkExport::Exportable.

◆ processColorTargetObjectNode()

void nkGraphics::TargetOperations::processColorTargetObjectNode ( nkExport::Node targetNode)

Utility function to process a target from its declaration. In theory, should not be called by external code. Used during import.

Parameters
targetNodeThe tree describing the render target.

◆ processPassObjectNode()

void nkGraphics::TargetOperations::processPassObjectNode ( nkExport::Node passNode)

Utility function to process a pass from its declaration. In theory, should not be called by external code. Used during import.

Parameters
passNodeThe tree describing the pass.

◆ operator=()

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

Copy assignment.


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