Kuesa::Qt3D::ForwardRenderer
Module: Kuesa Qt 3D API
Implements a simple forward rendering FrameGraph. More...
#include <forwardrenderer.h>
Inherits from Kuesa::Qt3D::View, Qt3DRender::QFrameGraphNode
Public Slots
Public Signals
Public Functions
Public Properties
Friends
Additional inherited members
Protected Types inherited from Kuesa::Qt3D::View
|
Name |
enum |
Feature { BackToFrontSorting, Skinning, FrustumCulling, ZFilling, Particles} |
Public Slots inherited from Kuesa::Qt3D::View
Public Signals inherited from Kuesa::Qt3D::View
Public Functions inherited from Kuesa::Qt3D::View
Protected Functions inherited from Kuesa::Qt3D::View
Public Properties inherited from Kuesa::Qt3D::View
Friends inherited from Kuesa::Qt3D::View
Detailed Description
| class Kuesa::Qt3D::ForwardRenderer;
|
Implements a simple forward rendering FrameGraph.
Since: Kuesa 2.0
This FrameGraph will select all Qt3D Entities that reference a Material with Techniques having a FilterKey with the name "renderingStyle" set to the string value "forward".
The rendering will be made on a main viewport whose dimensions can be set with normalized coordinates by calling ForwardRenderer::setViewportRect.
The screen will be cleared with the color set by calling ForwardRenderer::setClearColor. By default the clear color is black.
Unless a call to ForwardRenderer::setClearBuffers has been made, only the color and depth buffers will be cleared before the rest of the scene is rendered.
The scene will be rendered from the camera set with ForwardRenderer::setCamera on the window or offscreen surface set by calling ForwardRenderer::setRenderSurface. Additionally ForwardRenderer::setExternalRenderTargetSize can be called to specify the size of the rendering surface, when different from the size reported by the surface, this can be the case with high DPI screens.
Frustum culling of Entities will be performed by default to only render entities that are visible within the camera's frustum. This can be disabled by calling ForwardRenderer::setFrustumCulling. Please note frustum culling is not performed on skinned meshes.
By default the rendering is performed so that:
Opaque object are rendered first: Entities having a Material with a compatible RenderPass that has a FilterKey KuesaDrawStage with a value set to Opaque will be rendered.
Transparent objects are rendered second: select all Entities having a Material with a compatible RenderPass that has a FilterKey KuesaDrawStage with a value set to Transparent will be rendered.
Scenes containing materials with transparency need to be drawn from back-to-front in relation to the Camera for the blending to work correctly. This sorting can be expensive and is disabled by default. It can be enabled by calling ForwardRenderer::setBackToFrontSorting.
In some case, an optimization technique known as an early z-filling pass can provide a significant performance gain. This is especially true for large scenes using complex rendering materials. The idea consist in filling the depth buffer with a low complexity shader so that subsequent passes incorporating more detailed rendering techniques only render fragments for the depth previously recorded. The optional z-fill pass can be enabled by calling ForwardRenderer::setZFilling. All Entities having a Material with a compatible RenderPass that has a FilterKey KuesaDrawStage with a value set to ZFill will be rendered. This will take place before the Opaque and Transparent pass. Only Opaque objects should be used to fill the depth buffer.
The pipeline steps, from materials to post processing effects are working in linear color space. This ForwardRenderer adds a final gamma correction to perform the final conversion to sRGB, through the use of the GammaCorrectionEffect, as the last step of this pipeline.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 | #include <Qt3DExtras/Qt3DWindow>
#include <Qt3DRender/QCamera>
#include <ForwardRenderer>
#include <SceneEntity>
#include <BloomEffect>
Qt3DExtras::Qt3DWindow win;
Kuesa::Qt3D::SceneEntity *root = new Kuesa::Qt3D::SceneEntity();
Kuesa::Qt3D::ForwardRenderer *frameGraph = new Kuesa::Qt3D::ForwardRenderer();
Kuesa::Qt3D::BloomEffect *bloomEffect = new Kuesa::Qt3D::BloomEffect();
Qt3DRender::QCamera *camera = new Qt3DRender::QCamera();
frameGraph->setCamera(camera);
frameGraph->setFrustumCulling(true);
frameGraph->setClearColor(QColor(Qt::red));
frameGraph->addPostProcessingEffect(bloomEffect);
win->setRootEntity(root);
win->setActiveFrameGraph(frameGraph);
...
|
Public Slots Documentation
slot setRenderSurface
| void setRenderSurface(
QObject * renderSurface
)
|
Sets the surface where rendering will occur to renderSurface. This can be an offscreen surface or a window surface.
slot setClearBuffers
| void setClearBuffers(
Qt3DRender::QClearBuffers::BufferType clearBuffers
)
|
Sets which clearBuffers will be cleared at the start of each frame.
slot setShowDebugOverlay
| void setShowDebugOverlay(
bool showDebugOverlay
)
|
slot addView
| void addView(
View * view
)
|
slot removeView
| void removeView(
View * view
)
|
slot dump
Dumps the FrameGraph tree to the console. Can be really convenient for debug or troubleshooting purposes.
Public Signals Documentation
signal renderSurfaceChanged
| void renderSurfaceChanged(
QObject * renderSurface
)
|
signal clearBuffersChanged
| void clearBuffersChanged(
Qt3DRender::QClearBuffers::BufferType clearBuffers
)
|
signal showDebugOverlayChanged
| void showDebugOverlayChanged(
bool showDebugOverlay
)
|
signal externalRenderTargetSizeChanged
| void externalRenderTargetSizeChanged(
const QSize & renderTargetSize
)
|
Public Functions Documentation
function ForwardRenderer
| explicit ForwardRenderer(
Qt3DCore::QNode * parent =nullptr
)
|
function ~ForwardRenderer
function renderSurface
| QObject * renderSurface() const
|
Returns the surface where rendering will occur.
function clearBuffers
| Qt3DRender::QClearBuffers::BufferType clearBuffers() const
|
Returns which buffers are cleared at the start of each frame.
function showDebugOverlay
| bool showDebugOverlay() const
|
function views
| const std::vector< View * > & views() const
|
Public Property Documentation
property renderSurface
Holds the surface where rendering will occur.
property clearBuffers
| Qt3DRender::QClearBuffers::BufferType clearBuffers;
|
Holds which buffers will be cleared at the start of each frame.
property showDebugOverlay
Friends
friend ::tst_ForwardRenderer
| friend class ::tst_ForwardRenderer(
::tst_ForwardRenderer
);
|
Updated on 2023-07-03 at 11:02:12 +0000