Skip to content

Kuesa::Qt3D::View

Module: Kuesa Qt 3D API

View allows to specify the rendering description for a rendered view of the scene. They are to be used along with the QForwardRenderer FrameGraph. More...

#include <view.h>

Inherits from Qt3DRender::QFrameGraphNode

Inherited by Kuesa::Qt3D::ForwardRenderer

Protected Types

Name
enum Feature { BackToFrontSorting = (1 << 0), Skinning = (1 << 1), FrustumCulling = (1 << 2), ZFilling = (1 << 3), Particles = (1 << 4)}

Public Slots

Name
void setViewportRect(const QRectF & viewportRect)
void setCamera(Qt3DCore::QEntity * camera)
void setFrustumCulling(bool frustumCulling)
void setSkinning(bool frustumCulling)
void setBackToFrontSorting(bool backToFrontSorting)
void setZFilling(bool zfilling)
void setParticlesEnabled(bool enabled)
void setReflectionTextureSize(const QSize & reflectionTextureSize)
void setClearColor(const QColor & clearColor)
void setGamma(float gamma)
void setExposure(float exposure)
void setToneMappingAlgorithm(ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm)
void setUsesStencilMask(bool usesStencilMask)
void addPostProcessingEffect(AbstractPostProcessingEffect * effect)
void removePostProcessingEffect(AbstractPostProcessingEffect * effect)
void addLayer(Qt3DRender::QLayer * layer)
void removeLayer(Qt3DRender::QLayer * layer)
void addReflectionPlane(ReflectionPlane * plane)
void removeReflectionPlane(ReflectionPlane * plane)
void setShadowMaps(const QVector< ShadowMapPtr > & activeShadowMaps)
void dump()

Public Signals

Name
void viewportRectChanged(const QRectF & viewportRect)
void cameraChanged(Qt3DCore::QEntity * camera)
void frustumCullingChanged(bool frustumCulling)
void skinningChanged(bool skinning)
void backToFrontSortingChanged(bool backToFrontSorting)
void zFillingChanged(bool zFilling)
void particlesEnabledChanged(bool enabled)
void reflectionTextureChanged(Qt3DRender::QAbstractTexture * reflectionTexture)
void reflectionTextureSizeChanged(const QSize & reflectionTextureSize)
void clearColorChanged(const QColor & clearColor)
void gammaChanged(float gamma)
void shadowMapsChanged(const QVector< ShadowMapPtr > & shadowMaps)
void exposureChanged(float exposure)
void toneMappingAlgorithmChanged(ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm)
void usesStencilMaskChanged(bool usesStencilMask)
void frameGraphTreeReconfigured()

Public Functions

Name
View(Qt3DCore::QNode * parent =nullptr)
~View()
QRectF viewportRect() const
Qt3DCore::QEntity * camera() const
bool frustumCulling() const
bool skinning() const
bool backToFrontSorting() const
bool zFilling() const
bool particlesEnabled() const
Qt3DRender::QAbstractTexture * reflectionTexture() const
QSize reflectionTextureSize() const
QColor clearColor() const
float exposure() const
float gamma() const
ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm() const
bool usesStencilMask() const
const std::vector< AbstractPostProcessingEffect * > & postProcessingEffects() const
const std::vector< Qt3DRender::QLayer * > & layers() const
const std::vector< ReflectionPlane * > & reflectionPlanes() const
QVector< ShadowMapPtr > shadowMaps() const

Protected Functions

Name
void scheduleFGTreeRebuild()
void rebuildFGTree()
virtual void reconfigureStages()
virtual void reconfigureFrameGraph()
View * rootView() const
AbstractPostProcessingEffect::FrameGraphNodePtr frameGraphSubtreeForPostProcessingEffect(AbstractPostProcessingEffect * effect) const

Public Properties

Name
QRectF viewportRect
Qt3DCore::QEntity * camera
bool frustumCulling
bool skinning
bool backToFrontSorting
bool zFilling
bool particlesEnabled
Qt3DRender::QAbstractTexture * reflectionTexture
QSize reflectionTextureSize
ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm
bool usesStencilMask
float exposure
float gamma
QColor clearColor

Friends

Name
class ForwardRenderer
class ViewResolver

Detailed Description

1
class Kuesa::Qt3D::View;

View allows to specify the rendering description for a rendered view of the scene. They are to be used along with the QForwardRenderer FrameGraph.

Since: Kuesa 2.0

View allows to specify the description of a rendered view of the scene. They are to be used along with the QForwardRenderer FrameGraph.

This is especially useful to render on the same window multiple views of different subset of content coming from a glTF file and scene from different view points.

Views are rendered in the order in which they were added to the ForwardRenderer.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Kuesa::Qt3D::ForwardRenderer *frameGraph = new Kuesa::Qt3D::ForwardRenderer();

Kuesa::Qt3D::View *view1 = new Kuesa::Qt3D::View();
view1->setCamera(sceneCamera1);
view1->setViewportRect(QRectF(0, 0, 0.5, 1);

Kuesa::Qt3D::View *view2 = new Kuesa::Qt3D::View();
view2->setCamera(sceneCamera2);
view2->setViewportRect(QRectF(0.5, 0, 0.5, 1);
view2->addLayer(groundLayer);

frameGraph->addView(view1);
frameGraph->addView(view2);

Protected Types Documentation

enum Feature

Enumerator Value Description
BackToFrontSorting (1 << 0)
Skinning (1 << 1)
FrustumCulling (1 << 2)
ZFilling (1 << 3)
Particles (1 << 4)

Public Slots Documentation

slot setViewportRect

1
2
3
void setViewportRect(
    const QRectF & viewportRect
)

slot setCamera

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

slot setFrustumCulling

1
2
3
void setFrustumCulling(
    bool frustumCulling
)

slot setSkinning

1
2
3
void setSkinning(
    bool frustumCulling
)

slot setBackToFrontSorting

1
2
3
void setBackToFrontSorting(
    bool backToFrontSorting
)

slot setZFilling

1
2
3
void setZFilling(
    bool zfilling
)

slot setParticlesEnabled

1
2
3
void setParticlesEnabled(
    bool enabled
)

slot setReflectionTextureSize

1
2
3
void setReflectionTextureSize(
    const QSize & reflectionTextureSize
)

slot setClearColor

1
2
3
void setClearColor(
    const QColor & clearColor
)

Sets the clearColor used to clear the screen at the start of each frame. The color is expected to be in sRGB color space.

slot setGamma

1
2
3
void setGamma(
    float gamma
)

Sets the gamma value to use for gamma correction that brings linear colors to sRGB colors. \default 2.2

slot setExposure

1
2
3
void setExposure(
    float exposure
)

Sets the exposure value to use for exposure correction \default 0

slot setToneMappingAlgorithm

1
2
3
void setToneMappingAlgorithm(
    ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm
)

Since: Kuesa 2.0

Sets the tone mapping algorithm to toneMappingAlgorithm.

slot setUsesStencilMask

1
2
3
void setUsesStencilMask(
    bool usesStencilMask
)

Since: Kuesa 2.0

Allows to use stencil buffer during the render phase depending on the value of usesStencilMask. The resulting stencil buffer is then accessible from the post processing effects. This allows to apply post process effects only to part of the scene.

slot addPostProcessingEffect

1
2
3
void addPostProcessingEffect(
    AbstractPostProcessingEffect * effect
)

Registers a new post processing effect effect with the View. In essence this will complete the FrameGraph tree with a dedicated subtree provided by the effect.

Lifetime of the subtree will be entirely managed by the View.

Be aware that registering several effects of the same type might have unexpected behavior. It is advised against unless explicitly documented in the effect.

The FrameGraph tree is reconfigured upon insertion of a new effect.

Effects added to a view, contrary to effects added to the ForwardRenderer, only affect the view.

slot removePostProcessingEffect

1
2
3
void removePostProcessingEffect(
    AbstractPostProcessingEffect * effect
)

Unregisters effect from the current View. This will destroy the FrameGraph subtree associated with the effect.

The FrameGraph tree is reconfigured upon removal of an effect.

slot addLayer

1
2
3
void addLayer(
    Qt3DRender::QLayer * layer
)

slot removeLayer

1
2
3
void removeLayer(
    Qt3DRender::QLayer * layer
)

slot addReflectionPlane

1
2
3
void addReflectionPlane(
    ReflectionPlane * plane
)

slot removeReflectionPlane

1
2
3
void removeReflectionPlane(
    ReflectionPlane * plane
)

slot setShadowMaps

1
2
3
void setShadowMaps(
    const QVector< ShadowMapPtr > & activeShadowMaps
)

slot dump

1
void dump()

Dumps the FrameGraph tree to the console. Can be really convenient for debug or troubleshooting purposes.

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 backToFrontSortingChanged

1
2
3
void backToFrontSortingChanged(
    bool backToFrontSorting
)

signal zFillingChanged

1
2
3
void zFillingChanged(
    bool zFilling
)

signal particlesEnabledChanged

1
2
3
void particlesEnabledChanged(
    bool enabled
)

signal reflectionTextureChanged

1
2
3
void reflectionTextureChanged(
    Qt3DRender::QAbstractTexture * reflectionTexture
)

signal reflectionTextureSizeChanged

1
2
3
void reflectionTextureSizeChanged(
    const QSize & reflectionTextureSize
)

signal clearColorChanged

1
2
3
void clearColorChanged(
    const QColor & clearColor
)

signal gammaChanged

1
2
3
void gammaChanged(
    float gamma
)

signal shadowMapsChanged

1
2
3
void shadowMapsChanged(
    const QVector< ShadowMapPtr > & shadowMaps
)

signal exposureChanged

1
2
3
void exposureChanged(
    float exposure
)

signal toneMappingAlgorithmChanged

1
2
3
void toneMappingAlgorithmChanged(
    ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm
)

signal usesStencilMaskChanged

1
2
3
void usesStencilMaskChanged(
    bool usesStencilMask
)

signal frameGraphTreeReconfigured

1
void frameGraphTreeReconfigured()

Public Functions Documentation

function View

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

function ~View

1
~View()

function viewportRect

1
QRectF viewportRect() const

function camera

1
Qt3DCore::QEntity * camera() const

function frustumCulling

1
bool frustumCulling() const

function skinning

1
bool skinning() const

function backToFrontSorting

1
bool backToFrontSorting() const

function zFilling

1
bool zFilling() const

function particlesEnabled

1
bool particlesEnabled() const

function reflectionTexture

1
Qt3DRender::QAbstractTexture * reflectionTexture() const

function reflectionTextureSize

1
QSize reflectionTextureSize() const

function clearColor

1
QColor clearColor() const

Returns the color used to clear the screen at the start of each frame. The color is returned in sRGB color space.

function exposure

1
float exposure() const

Exposure correction factor used before the linear to sRGB conversion.

\default 0.0

function gamma

1
float gamma() const

Since: Kuesa 2.0

Gamma correction value used for the linear to sRGB conversion. \default 2.2

function toneMappingAlgorithm

1
ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm() const

Since: Kuesa 2.0

Returns the tone mapping algorithm used by the shader. \default ToneMappingAndGammaCorrectionEffect::None

function usesStencilMask

1
bool usesStencilMask() const

function postProcessingEffects

1
const std::vector< AbstractPostProcessingEffect * > & postProcessingEffects() const

function layers

1
const std::vector< Qt3DRender::QLayer * > & layers() const

Returns all layers used by the view.

function reflectionPlanes

1
const std::vector< ReflectionPlane * > & reflectionPlanes() const

function shadowMaps

1
QVector< ShadowMapPtr > shadowMaps() const

Protected Functions Documentation

function scheduleFGTreeRebuild

1
void scheduleFGTreeRebuild()

function rebuildFGTree

1
void rebuildFGTree()

function reconfigureStages

1
virtual void reconfigureStages()

function reconfigureFrameGraph

1
virtual void reconfigureFrameGraph()

Reimplemented by: Kuesa::Qt3D::ForwardRenderer::reconfigureFrameGraph

function rootView

1
View * rootView() const

function frameGraphSubtreeForPostProcessingEffect

1
2
3
AbstractPostProcessingEffect::FrameGraphNodePtr frameGraphSubtreeForPostProcessingEffect(
    AbstractPostProcessingEffect * effect
) 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 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 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.

property zFilling

1
bool zFilling;

Holds whether multi-pass zFilling support is enabled. Disabled by default.

property particlesEnabled

1
bool particlesEnabled;

Holds whether particles support is enabled. Disabled by default.

property reflectionTexture

1
Qt3DRender::QAbstractTexture * reflectionTexture;

Returns a 2D texture containing the reflections obtained from the reflection planes set for the View.

property reflectionTextureSize

1
QSize reflectionTextureSize;

The size of the reflectionTexture. Defaults to 512x512. Increasing the size will lead to better reflections at the expense of more memory consumption.

property toneMappingAlgorithm

1
ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm;

Since: Kuesa 2.0 \default ToneMappingAndGammaCorrectionEffect::None

Tone mapping specifies how we perform color conversion from HDR (high dynamic range) content to LDR (low dynamic range) content which our monitor displays.

property usesStencilMask

1
bool usesStencilMask;

Since: Kuesa 2.0 \default False

Enables/disables stencil buffers. If true, stencil operations be used during the render phase to modify the stencil buffer. The resulting stencil buffer can later be used to apply post process effect to only part of the scene

property exposure

1
float exposure;

Since: Kuesa 2.0

Exposure correction factor used before the linear to sRGB conversion. \default 0

property gamma

1
float gamma;

Since: Kuesa 2.0

Holds the gamma value to use for gamma correction that brings linear colors to sRGB colors. \default 2.2

property clearColor

1
QColor clearColor;

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

Friends

friend ForwardRenderer

1
2
3
friend class ForwardRenderer(
    ForwardRenderer 
);

friend ViewResolver

1
2
3
friend class ViewResolver(
    ViewResolver 
);

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