Skip to content

Kuesa::Qt3D::ForwardRendererLight

Module: Kuesa Qt 3D API

Implements a simple forward rendering FrameGraph. More...

#include <forwardrendererlight.h>

Inherits from Qt3DRender::QRenderSurfaceSelector

Public Slots

Name
void setViewportRect(const QRectF & viewportRect)
void setCamera(Qt3DCore::QEntity * camera)
void setClearColor(const QColor & clearColor)
void setFrustumCulling(bool frustumCulling)
void setSkinning(bool skinning)
void setShowDebugOverlay(bool showDebugOverlay)
void setBackToFrontSorting(bool backToFrontSorting)

Public Signals

Name
void viewportRectChanged(const QRectF & viewportRect)
void cameraChanged(Qt3DCore::QEntity * camera)
void frustumCullingChanged(bool frustumCulling)
void skinningChanged(bool skinning)
void clearColorChanged(const QColor & clearColor)
void showDebugOverlayChanged(bool showDebugOverlay)
void backToFrontSortingChanged(bool backToFrontSorting)

Public Functions

Name
ForwardRendererLight(Qt3DCore::QNode * parent =nullptr)
~ForwardRendererLight()
QRectF viewportRect() const
Qt3DCore::QEntity * camera() const
QColor clearColor() const
bool frustumCulling() const
bool skinning() const
bool showDebugOverlay() const
bool backToFrontSorting() const

Public Properties

Name
QRectF viewportRect
Qt3DCore::QEntity * camera
QColor clearColor
bool frustumCulling
bool skinning
bool showDebugOverlay
bool backToFrontSorting

Detailed Description

1
class Kuesa::Qt3D::ForwardRendererLight;

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 ForwardRendererLight::setViewportRect.

The screen will be cleared with the color set by calling ForwardRendererLight::setClearColor. By default the clear color is black.

The scene will be rendered from the camera set with ForwardRendererLight::setCamera on the window.

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 ForwardRendererLight::setFrustumCulling.

Please note that this FrameGraph does not support 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 but is disabled by default. It can be disabled by calling ForwardRendererLight::setBackToFrontSorting.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#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::ForwardRendererLight *frameGraph = new Kuesa::Qt3D::ForwardRendererLight();
Qt3DRender::QCamera *camera = new Qt3DRender::QCamera();

frameGraph->setCamera(camera);
frameGraph->setClearColor(QColor(Qt::red));

win->setRootEntity(root);
win->setActiveFrameGraph(frameGraph);

...

Public Slots Documentation

slot setViewportRect

1
2
3
void setViewportRect(
    const QRectF & viewportRect
)

slot setCamera

1
2
3
void setCamera(
    Qt3DCore::QEntity * camera
)

slot setClearColor

1
2
3
void setClearColor(
    const QColor & clearColor
)

slot setFrustumCulling

1
2
3
void setFrustumCulling(
    bool frustumCulling
)

slot setSkinning

1
2
3
void setSkinning(
    bool skinning
)

slot setShowDebugOverlay

1
2
3
void setShowDebugOverlay(
    bool showDebugOverlay
)

slot setBackToFrontSorting

1
2
3
void setBackToFrontSorting(
    bool backToFrontSorting
)

Public Signals Documentation

signal viewportRectChanged

1
2
3
void viewportRectChanged(
    const QRectF & viewportRect
)

signal cameraChanged

1
2
3
void cameraChanged(
    Qt3DCore::QEntity * camera
)

signal frustumCullingChanged

1
2
3
void frustumCullingChanged(
    bool frustumCulling
)

signal skinningChanged

1
2
3
void skinningChanged(
    bool skinning
)

signal clearColorChanged

1
2
3
void clearColorChanged(
    const QColor & clearColor
)

signal showDebugOverlayChanged

1
2
3
void showDebugOverlayChanged(
    bool showDebugOverlay
)

signal backToFrontSortingChanged

1
2
3
void backToFrontSortingChanged(
    bool backToFrontSorting
)

Public Functions Documentation

function ForwardRendererLight

1
2
3
explicit ForwardRendererLight(
    Qt3DCore::QNode * parent =nullptr
)

function ~ForwardRendererLight

1
~ForwardRendererLight()

function viewportRect

1
QRectF viewportRect() const

function camera

1
Qt3DCore::QEntity * camera() const

function clearColor

1
QColor clearColor() const

function frustumCulling

1
bool frustumCulling() const

function skinning

1
bool skinning() const

function showDebugOverlay

1
bool showDebugOverlay() const

function backToFrontSorting

1
bool backToFrontSorting() const

Public Property Documentation

property viewportRect

1
QRectF viewportRect;

Holds the viewport rectangle from within which the rendering will occur. Rectangle is in normalized coordinates.

property camera

1
Qt3DCore::QEntity * camera;

Holds the camera used to view the scene.

property clearColor

1
QColor clearColor;

Holds the color used to clear the screen at the start of each frame.

property frustumCulling

1
bool frustumCulling;

Holds whether frustum culling is enabled or not. Enabled by default.

property skinning

1
bool skinning;

Holds whether skinned mesh support is required. Disabled by default.

property showDebugOverlay

1
bool showDebugOverlay;

Shows the Qt 3D debug overlay when true. False by default;

property backToFrontSorting

1
bool backToFrontSorting;

Holds whether back to front sorting to render objects in back-to-front order is enabled. This is required for proper alpha blending rendering. Enabled by default.


Updated on 2023-07-03 at 11:02:09 +0000