Kuesa Runtime

View3DScene Class

class KuesaUtils::View3DScene

View3DScene is a convenience wrapper aiming at simplifying the set up of a 3D scene and the loading of a glTF 2 scene file. More...

Header: #include <View3DScene>
Since: Kuesa 1.3
Instantiated By: View3DScene
Inherits: Kuesa::SceneEntity

This class was introduced in Kuesa 1.3.

Properties

Public Functions

KuesaUtils::SceneConfiguration *activeScene() const
const std::vector<Kuesa::AnimationPlayer *> &animationPlayers() const
bool asynchronous() const
Kuesa::ForwardRenderer *frameGraph() const
Kuesa::GLTF2Importer *importer() const
bool isLoaded() const
bool isReady() const
QString reflectionPlaneName() const
Qt3DRender::QRenderSettings *renderSettings() const
QSize screenSize() const
bool showDebugOverlay() const
QUrl source() const

Public Slots

void gotoEnd()
void gotoNormalizedTime(float time)
void gotoStart()
void restart()
void setActiveScene(KuesaUtils::SceneConfiguration *scene)
void setAsynchronous(bool asynchronous)
void setReflectionPlaneName(const QString &reflectionPlaneName)
void setScreenSize(const QSize &screenSize)
void setShowDebugOverlay(bool showDebugOverlay)
void start()
void stop()

Signals

void activeSceneChanged(KuesaUtils::SceneConfiguration *activeScene)
void asynchronousChanged(bool asynchronous)
void loadedChanged(bool loaded)
void readyChanged(bool ready)
void reflectionPlaneNameChanged(const QString &reflectionPlaneName)
void screenSizeChanged(const QSize &screenSize)
void showDebugOverlayChanged(bool showDebugOverlay)
void sourceChanged(const QUrl &source)

Detailed Description

View3DScene is a convenience wrapper aiming at simplifying the set up of a 3D scene and the loading of a glTF 2 scene file.

It is a subclass of Kuesa::SceneEntity which grants access to the various asset collections. Aditionnaly it contains a Kuesa::GLTF2Importer and sets up a Kuesa::ForwardRenderer framegraph.

The property KuesaUtils::View3DScene::ready and signal View3DScene::readyChanged can be used to detect when the scene is visible on screen and therefore synchronize with other aspect of your application.

When used in conjunction with KuesaUtils::SceneConfiguration this class makes it convenient to set up a Kuesa renderer that can easily load and unload scenes.

To set the scene to be loaded by the View3DScene, an instance of KuesaUtils::SceneConfiguration must be set as the activeScene property.

Kuesa::AnimationPlayer and Kuesa::TransformTracker instances defined on the activeScene will be added. Additionally, the View3DScene will take care of population the camera, screenSize and sceneEntity properties.

Furthermore, animation playback and control is abstracted by convenience methods on the View3DScene instance.

Property Documentation

activeScene : KuesaUtils::SceneConfiguration*

If this points to a valid KuesaUtils::SceneConfiguration instance, the KuesaUtils::View3DScene::source, KuesaUtils::View3DScene::cameraName as well as the Kuesa::AnimationPlayer and Kuesa::TransformTracker instances will be automatically set based on the values provided by the SceneConfiguration. This a more convenient way of specifying content when dealing with multiple scenes.

Access functions:

KuesaUtils::SceneConfiguration *activeScene() const
void setActiveScene(KuesaUtils::SceneConfiguration *scene)

Notifier signal:

void activeSceneChanged(KuesaUtils::SceneConfiguration *activeScene)

asynchronous : bool

If true, glTF parsing is performed in a non blocking manner from a secondary thread. This is false by default.

Access functions:

bool asynchronous() const
void setAsynchronous(bool asynchronous)

Notifier signal:

void asynchronousChanged(bool asynchronous)

frameGraph : Kuesa::ForwardRenderer* const

Points to the Kuesa::ForwardRenderer frame graph instance wrapped around by the View3DScene.

Access functions:

Kuesa::ForwardRenderer *frameGraph() const

importer : Kuesa::GLTF2Importer* const

Points to the Kuesa::GLTF2Importer instance wrapped around by the View3DScene.

Access functions:

Kuesa::GLTF2Importer *importer() const

loaded : const bool

This is true once the glTF file has been properly loaded. The scene might not be visible on screen when this becomes true.

Access functions:

bool isLoaded() const

Notifier signal:

void loadedChanged(bool loaded)

ready : const bool

This is true once the glTF file has been properly loaded and that Qt 3D GPU resources have been successfully loaded onto the GPU. The scene should be visible on screen when this becomes true.

Access functions:

bool isReady() const

Notifier signal:

void readyChanged(bool ready)

reflectionPlaneName : QString

If non empty, the View3DScene will try to load the Kuesa::ReflectionPlane matching the name from the collection and set it on the ForwardRenderer framegraph views.

Access functions:

QString reflectionPlaneName() const
void setReflectionPlaneName(const QString &reflectionPlaneName)

Notifier signal:

void reflectionPlaneNameChanged(const QString &reflectionPlaneName)

renderSettings : Qt3DRender::QRenderSettings* const

Points to the Qt3DRender::QRenderSettings render settings instance wrapped around by the View3DScene.

Access functions:

Qt3DRender::QRenderSettings *renderSettings() const

screenSize : QSize

Holds the size in pixels of the rendered area. When set, this automatically updates the Kuesa::TransformTracker instances referenced by the View3DScene with the new value for proper coodinate projection.

Access functions:

QSize screenSize() const
void setScreenSize(const QSize &screenSize)

Notifier signal:

void screenSizeChanged(const QSize &screenSize)

showDebugOverlay : bool

Specifies whether the Qt 3D debug overlay should be displayed.

Note: this only works when Qt is running with its OpenGL backend.

Access functions:

bool showDebugOverlay() const
void setShowDebugOverlay(bool showDebugOverlay)

Notifier signal:

void showDebugOverlayChanged(bool showDebugOverlay)

source : const QUrl

This property holds the source of the glTF file to be loaded.

Access functions:

QUrl source() const

Notifier signal:

void sourceChanged(const QUrl &source)

Member Function Documentation

[slot] void View3DScene::gotoEnd()

Set the normalized time of all the Kuesa::AnimationPlayer instances referenced by the View3DScene instance to 1.

[slot] void View3DScene::gotoNormalizedTime(float time)

Set the normalized time of all the Kuesa::AnimationPlayer instances referenced by the View3DScene instance to time.

[slot] void View3DScene::gotoStart()

Set the normalized time of all the Kuesa::AnimationPlayer instances referenced by the View3DScene instance to 0.

[slot] void View3DScene::restart()

Restarts all the Kuesa::AnimationPlayer instances referenced by the View3DScene instance.

See also View3DScene::stop and View3DScene::start.

[slot] void View3DScene::setActiveScene(KuesaUtils::SceneConfiguration *scene)

Sets the active scene configuration to scene. If scene is a valid non null instance, the KuesaUtils::View3DScene::source, KuesaUtils::View3DScene::cameraName as well as the Kuesa::AnimationPlayer and Kuesa::TransformTracker instances will be automatically set based on the values provided by the SceneConfiguration. If null, all of these will be cleared.

When switching between two KuesaUtils::SceneConfiguration instances, the collections, assets and gltf files are clear prior to being reloaded, even if both instances reference the same source file.

Note: Setter function for property activeScene.

See also activeScene().

[slot] void View3DScene::start()

Starts all the Kuesa::AnimationPlayer instances referenced by the View3DScene instance.

See also View3DScene::stop and View3DScene::restart.

[slot] void View3DScene::stop()

Stops all the Kuesa::AnimationPlayer instances referenced by the View3DScene instance.

See also View3DScene::start.

const std::vector<Kuesa::AnimationPlayer *> &View3DScene::animationPlayers() const

Returns the Kuesa::AnimationPlayer instances referenced by the View3DScene instance.