1.26.2.1
Gameface
cohtml::ViewRenderer Class Referenceabstract

The ViewRenderer is in charge of drawing a View in a user-supplied texture. More...

Public Types

enum  PaintResult { PR_NotFound, PR_NothingToPaint, PR_PaintedSome, PR_FrameComplete }
 The result of the Paint call. More...
 

Public Member Functions

virtual ~ViewRenderer ()
 
virtual void Destroy ()=0
 Destroys the ViewRenderer. More...
 
virtual PaintResult Paint (unsigned frameId, bool runUntilCompleteFrame)=0
 Call this each frame to update the UI texture. This call will perform the actual rendering using the backend associated in the SystemRenderer. More...
 
virtual void SetRenderTarget (void *nativeTexture, void *nativeDepthStencil, unsigned width, unsigned height, unsigned samples)=0
 Sets the user texture that will be used for rendering. The format of the texture is assumed to be RGBA8. More...
 
virtual void SetRenderTarget (void *nativeTexture, void *nativeDepthStencil, renoir::Texture2D textureDescription)=0
 Sets the user texture that will be used for rendering. More...
 
virtual void FreeRenderingResources ()=0
 Frees all rendering resources used by Cohtml that are associated with this specific view. To free all resources, you need to call this method on all ViewRenderer objects and on the SystemRenderer. More...
 

Detailed Description

The ViewRenderer is in charge of drawing a View in a user-supplied texture.

Member Enumeration Documentation

◆ PaintResult

The result of the Paint call.

Enumerator
PR_NotFound 
PR_NothingToPaint 

Such frame was not found, it might have already been painted.

PR_PaintedSome 

The frame did nothing because there we no actual changes to apply.

PR_FrameComplete 

The call executed some commands but the frame is not yet completely done.

All rendering commands for this frame have been completed

Constructor & Destructor Documentation

◆ ~ViewRenderer()

virtual cohtml::ViewRenderer::~ViewRenderer ( )
virtual

Member Function Documentation

◆ Destroy()

virtual void cohtml::ViewRenderer::Destroy ( )
pure virtual

Destroys the ViewRenderer.

◆ FreeRenderingResources()

virtual void cohtml::ViewRenderer::FreeRenderingResources ( )
pure virtual

Frees all rendering resources used by Cohtml that are associated with this specific view. To free all resources, you need to call this method on all ViewRenderer objects and on the SystemRenderer.

Note
Per-view rendering resources are the constant/vertex/index buffers (except path buffers).
See also
cohtml::SystemRenderer::FreeRenderingResources

◆ Paint()

virtual PaintResult cohtml::ViewRenderer::Paint ( unsigned  frameId,
bool  runUntilCompleteFrame 
)
pure virtual

Call this each frame to update the UI texture. This call will perform the actual rendering using the backend associated in the SystemRenderer.

◆ SetRenderTarget() [1/2]

virtual void cohtml::ViewRenderer::SetRenderTarget ( void *  nativeTexture,
void *  nativeDepthStencil,
unsigned  width,
unsigned  height,
unsigned  samples 
)
pure virtual

Sets the user texture that will be used for rendering. The format of the texture is assumed to be RGBA8.

Parameters
nativeTextureAn opaque object that will later be passed to the rendering backend. This should represent the texture to draw into in whatever object is expected by the backend.
nativeDepthStencilAn opaque object that will later be passed to the rendering backend. This should represent the depth-stencil texture in whatever object is expected by the backend.
widththe width of the backend texture
heightthe height of the backend texture
samplesthe number of samples of the target texture if MSAA is used. Set to 1 if no MSAA is enabled.

◆ SetRenderTarget() [2/2]

virtual void cohtml::ViewRenderer::SetRenderTarget ( void *  nativeTexture,
void *  nativeDepthStencil,
renoir::Texture2D  textureDescription 
)
pure virtual

Sets the user texture that will be used for rendering.

Parameters
nativeTextureAn opaque object that will later be passed to the rendering backend. This should represent the texture to draw into in whatever object is expected by the backend.
nativeDepthStencilAn opaque object that will later be passed to the rendering backend. This should represent the depth-stencil texture in whatever object is expected by the backend.
textureDescriptionA Description of the texture that will be used as render target. This should describe the dimensions, the samples count and the format of the texture.