Kuesa Runtime

View Class

class Kuesa::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. More...

Header: #include <View>
Since: Kuesa 1.3
Instantiated By: View
Inherited By:

Kuesa::ForwardRenderer

This class was introduced in Kuesa 1.3.

Properties

Public Functions

bool backToFrontSorting() const
Qt3DCore::QEntity *camera() const
QColor clearColor() const
float exposure() const
bool frustumCulling() const
float gamma() const
const std::vector<Qt3DRender::QLayer *> &layers() const
bool particlesEnabled() const
Qt3DRender::QAbstractTexture *reflectionTexture() const
QSize reflectionTextureSize() const
bool skinning() const
ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm() const
bool usesStencilMask() const
QRectF viewportRect() const
bool zFilling() const

Public Slots

void addPostProcessingEffect(Kuesa::AbstractPostProcessingEffect *effect)
void dump()
void removePostProcessingEffect(Kuesa::AbstractPostProcessingEffect *effect)
void setBackToFrontSorting(bool backToFrontSorting)
void setCamera(Qt3DCore::QEntity *camera)
void setClearColor(const QColor &clearColor)
void setExposure(float exposure)
void setFrustumCulling(bool frustumCulling)
void setGamma(float gamma)
void setParticlesEnabled(bool enabled)
void setReflectionTextureSize(const QSize &reflectionTextureSize)
void setSkinning(bool frustumCulling)
void setToneMappingAlgorithm(ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm)
void setUsesStencilMask(bool usesStencilMask)
void setViewportRect(const QRectF &viewportRect)
void setZFilling(bool zfilling)

Signals

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

Protected Types

flags Features

Detailed Description

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.

 Kuesa::ForwardRenderer *frameGraph = new Kuesa::ForwardRenderer();

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

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

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

Property Documentation

backToFrontSorting : bool

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.

Access functions:

bool backToFrontSorting() const
void setBackToFrontSorting(bool backToFrontSorting)

Notifier signal:

void backToFrontSortingChanged(bool backToFrontSorting)

camera : Qt3DCore::QEntity*

Holds the camera used to view the scene.

Access functions:

Qt3DCore::QEntity *camera() const
void setCamera(Qt3DCore::QEntity *camera)

Notifier signal:

void cameraChanged(Qt3DCore::QEntity *camera)

clearColor : QColor

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

Access functions:

QColor clearColor() const
void setClearColor(const QColor &clearColor)

Notifier signal:

void clearColorChanged(const QColor &clearColor)

exposure : float

Exposure correction factor used before the linear to sRGB conversion.

This property was introduced in Kuesa 1.3.

Access functions:

float exposure() const
void setExposure(float exposure)

Notifier signal:

void exposureChanged(float exposure)

frustumCulling : bool

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

Access functions:

bool frustumCulling() const
void setFrustumCulling(bool frustumCulling)

Notifier signal:

void frustumCullingChanged(bool frustumCulling)

gamma : float

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

This property was introduced in Kuesa 1.3.

Access functions:

float gamma() const
void setGamma(float gamma)

Notifier signal:

void gammaChanged(float gamma)

particlesEnabled : bool

Holds whether particles support is enabled. Disabled by default.

Access functions:

bool particlesEnabled() const
void setParticlesEnabled(bool enabled)

Notifier signal:

void particlesEnabledChanged(bool enabled)

reflectionTexture : Qt3DRender::QAbstractTexture* const

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

Access functions:

Qt3DRender::QAbstractTexture *reflectionTexture() const

Notifier signal:

void reflectionTextureChanged(Qt3DRender::QAbstractTexture *reflectionTexture)

reflectionTextureSize : QSize

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

Access functions:

QSize reflectionTextureSize() const
void setReflectionTextureSize(const QSize &reflectionTextureSize)

Notifier signal:

void reflectionTextureSizeChanged(const QSize &reflectionTextureSize)

skinning : bool

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

Access functions:

bool skinning() const
void setSkinning(bool frustumCulling)

Notifier signal:

void skinningChanged(bool skinning)

toneMappingAlgorithm : ToneMappingAndGammaCorrectionEffect::ToneMapping

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

This property was introduced in Kuesa 1.3.

Access functions:

ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm() const
void setToneMappingAlgorithm(ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm)

Notifier signal:

void toneMappingAlgorithmChanged(ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm)

usesStencilMask : bool

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

This property was introduced in Kuesa 1.3.

Access functions:

bool usesStencilMask() const
void setUsesStencilMask(bool usesStencilMask)

Notifier signal:

void usesStencilMaskChanged(bool usesStencilMask)

viewportRect : QRectF

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

Access functions:

QRectF viewportRect() const
void setViewportRect(const QRectF &viewportRect)

Notifier signal:

void viewportRectChanged(const QRectF &viewportRect)

zFilling : bool

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

Access functions:

bool zFilling() const
void setZFilling(bool zfilling)

Notifier signal:

void zFillingChanged(bool zFilling)

Member Function Documentation

[slot] void View::addPostProcessingEffect(Kuesa::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] void View::dump()

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

[slot] void View::removePostProcessingEffect(Kuesa::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] void View::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.

Note: Setter function for property clearColor.

See also clearColor().

[slot] void View::setExposure(float exposure)

Sets the exposure value to use for exposure correction

Note: Setter function for property exposure.

See also exposure().

[slot] void View::setGamma(float gamma)

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

Note: Setter function for property gamma.

See also gamma().

[slot] void View::setToneMappingAlgorithm(ToneMappingAndGammaCorrectionEffect::ToneMapping toneMappingAlgorithm)

Sets the tone mapping algorithm to toneMappingAlgorithm.

Note: Setter function for property toneMappingAlgorithm.

This function was introduced in Kuesa 1.1.

See also toneMappingAlgorithm().

[slot] void View::setUsesStencilMask(bool usesStencilMask)

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.

Note: Setter function for property usesStencilMask.

This function was introduced in Kuesa 1.3.

See also usesStencilMask().

QColor View::clearColor() const

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

Note: Getter function for property clearColor.

See also setClearColor().

float View::exposure() const

Exposure correction factor used before the linear to sRGB conversion.

Note: Getter function for property exposure.

See also setExposure().

float View::gamma() const

Gamma correction value used for the linear to sRGB conversion.

Note: Getter function for property gamma.

This function was introduced in Kuesa 1.1.

See also setGamma().

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

Returns all layers used by the view.

ToneMappingAndGammaCorrectionEffect::ToneMapping View::toneMappingAlgorithm() const

Returns the tone mapping algorithm used by the shader.

Note: Getter function for property toneMappingAlgorithm.

This function was introduced in Kuesa 1.1.

See also setToneMappingAlgorithm().