Skip to content

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...

#include <view3dscene.h>

Inherits from Kuesa::Qt3D::SceneEntity, Qt3DCore::QEntity

Public Slots

Name
void setShowDebugOverlay(bool showDebugOverlay)
void setScreenSize(const QSize & screenSize)
void setAsynchronous(bool asynchronous)
void setReflectionPlaneName(const QString & reflectionPlaneName)
void setActiveScene(SceneConfiguration * scene)
Sets the active scene configuration to scene. If scene is a valid non null instance, the [View3DScene::source ],.
void adoptNode(QObject * object)
void start()
Starts all the AnimationPlayer instances referenced by the View3DScene instance.
void restart()
Restarts all the AnimationPlayer instances referenced by the View3DScene instance.
void stop()
Stops all the AnimationPlayer instances referenced by the View3DScene instance.
void gotoNormalizedTime(float time)
Set the normalized time of all the AnimationPlayer instances referenced by the View3DScene instance to time.
void gotoStart()
Set the normalized time of all the AnimationPlayer instances referenced by the View3DScene instance to 0.
void gotoEnd()
Set the normalized time of all the AnimationPlayer instances referenced by the View3DScene instance to 1.

Public Signals

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

Public Functions

Name
View3DScene(Qt3DCore::QNode * parent =nullptr)
~View3DScene()
Kuesa::Qt3D::GLTF2Importer * importer() const
Kuesa::Qt3D::ForwardRenderer * frameGraph() const
Qt3DRender::QRenderSettings * renderSettings() const
QUrl source() const
bool showDebugOverlay() const
QSize screenSize() const
bool asynchronous() const
QString reflectionPlaneName() const
const std::vector< Kuesa::Qt3D::AnimationPlayer * > & animationPlayers() const
Returns the AnimationPlayer instances referenced by the View3DScene instance.
SceneConfiguration * activeScene() const
bool isReady() const
bool isLoaded() const

Public Properties

Name
Kuesa::Qt3D::GLTF2Importer * importer
Points to the GLTF2Importer instance wrapped around by the View3DScene.
Kuesa::Qt3D::ForwardRenderer * frameGraph
Points to the ForwardRenderer frame graph instance wrapped around by the View3DScene.
Qt3DRender::QRenderSettings * renderSettings
Points to the.
QUrl source
The source of the glTF file to be loaded. \readonly.
bool showDebugOverlay
Specifies whether the Qt 3D debug overlay should be displayed.
QSize screenSize
Holds the size in pixels of the rendered area. When set, this automatically updates the TransformTracker instances referenced by the View3DScene with the new value for proper coodinate projection.
bool ready
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.
bool loaded
This is true once the glTF file has been properly loaded. The scene might not be visible on screen when this becomes true.
bool asynchronous
If true, glTF parsing is performed in a non blocking manner from a secondary thread. This is false by default.
KuesaUtils::SceneConfiguration * activeScene
If this points to a valid SceneConfiguration instance, the View3DScene::source ,.
QString reflectionPlaneName
If non empty, the View3DScene will try to load the.

Additional inherited members

Public Signals inherited from Kuesa::Qt3D::SceneEntity

Name
void loadingDone()

Public Functions inherited from Kuesa::Qt3D::SceneEntity

Name
SceneEntity(Qt3DCore::QNode * parent =nullptr)
~SceneEntity()
AnimationClipCollection * animationClips() const
Q_INVOKABLE Qt3DAnimation::QAbstractAnimationClip * animationClip(const QString & name) const
ArmatureCollection * armatures() const
Q_INVOKABLE Qt3DCore::QArmature * armature(const QString & name) const
EffectCollection * effects() const
Q_INVOKABLE Qt3DRender::QEffect * effect(const QString & name) const
Q_INVOKABLE Qt3DRender::QEffect * effect(int effectPropertyFlags) const
LayerCollection * layers() const
Q_INVOKABLE Qt3DRender::QLayer * layer(const QString & name) const
MaterialCollection * materials() const
Q_INVOKABLE Kuesa::Qt3D::GLTF2MaterialProperties * material(const QString & name) const
MeshCollection * meshes() const
Q_INVOKABLE Qt3DRender::QGeometryRenderer * mesh(const QString & name) const
SkeletonCollection * skeletons() const
Q_INVOKABLE Qt3DCore::QAbstractSkeleton * skeleton(const QString & name) const
TextureCollection * textures() const
Q_INVOKABLE Qt3DRender::QAbstractTexture * texture(const QString & name) const
CameraCollection * cameras() const
Q_INVOKABLE Qt3DRender::QCamera * camera(const QString & name) const
EntityCollection * entities() const
Q_INVOKABLE Qt3DCore::QEntity * entity(const QString & name) const
TransformCollection * transforms() const
Q_INVOKABLE Qt3DCore::QTransform * transform(const QString & name) const
PlaceholderCollection * placeholders() const
Q_INVOKABLE Kuesa::Qt3D::Placeholder * placeholder(const QString & name) const
TextureImageCollection * textureImages() const
Q_INVOKABLE Qt3DRender::QAbstractTextureImage * textureImage(const QString & name)
AnimationMappingCollection * animationMappings() const
Q_INVOKABLE Qt3DAnimation::QChannelMapper * animationMapping(const QString & name)
Q_INVOKABLE void clearCollections()
Removes all assets from all the collections.
Q_INVOKABLE Qt3DCore::QNode * transformForEntity(const QString & name)
Q_INVOKABLE Qt3DRender::QAbstractTexture * brdfLut() const
SceneEntity::brdfLut Returns the brdfLut texture stored in the SceneEntity.
Kuesa::Qt3D::LightCollection * lights() const
Q_INVOKABLE Qt3DRender::QAbstractLight * light(const QString & name) const
Kuesa::Qt3D::ReflectionPlaneCollection * reflectionPlanes() const
Q_INVOKABLE Kuesa::Qt3D::ReflectionPlane * reflectionPlane(const QString & name) const
Q_INVOKABLE Kuesa::Qt3D::SceneEntity * findParentSceneEntity(Qt3DCore::QEntity * entity)

Public Properties inherited from Kuesa::Qt3D::SceneEntity

Name
Kuesa::Qt3D::AnimationClipCollection * animationClips
Kuesa::Qt3D::ArmatureCollection * armatures
Kuesa::Qt3D::LayerCollection * layers
Kuesa::Qt3D::MaterialCollection * materials
Kuesa::Qt3D::MeshCollection * meshes
Kuesa::Qt3D::SkeletonCollection * skeletons
Kuesa::Qt3D::TextureCollection * textures
Kuesa::Qt3D::CameraCollection * cameras
Kuesa::Qt3D::EntityCollection * entities
Kuesa::Qt3D::TextureImageCollection * textureImages
Kuesa::Qt3D::AnimationMappingCollection * animationMappings
Qt3DRender::QAbstractTexture * brdfLut
Kuesa::Qt3D::LightCollection * lights
Kuesa::Qt3D::TransformCollection * transforms
Kuesa::Qt3D::ReflectionPlaneCollection * reflectionPlanes
Kuesa::Qt3D::PlaceholderCollection * placeholders

Detailed Description

1
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.

Since: Kuesa 2.0

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 SceneEntity which grants access to the various asset collections. Aditionnaly it contains a

The property View3DScene::ready and signal

When used in conjunction with 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 SceneConfiguration must be set as the activeScene property.

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

Public Slots Documentation

slot setShowDebugOverlay

1
2
3
void setShowDebugOverlay(
    bool showDebugOverlay
)

slot setScreenSize

1
2
3
void setScreenSize(
    const QSize & screenSize
)

slot setAsynchronous

1
2
3
void setAsynchronous(
    bool asynchronous
)

slot setReflectionPlaneName

1
2
3
void setReflectionPlaneName(
    const QString & reflectionPlaneName
)

slot setActiveScene

1
2
3
void setActiveScene(
    SceneConfiguration * scene
)

Sets the active scene configuration to scene. If scene is a valid non null instance, the [View3DScene::source ],.

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

slot adoptNode

1
2
3
void adoptNode(
    QObject * object
)

slot start

1
void start()

Starts all the AnimationPlayer instances referenced by the View3DScene instance.

See: View3DScene::stop, View3DScene::restart

slot restart

1
void restart()

Restarts all the AnimationPlayer instances referenced by the View3DScene instance.

See: View3DScene::stop, View3DScene::start

slot stop

1
void stop()

Stops all the AnimationPlayer instances referenced by the View3DScene instance.

See: View3DScene::start

slot gotoNormalizedTime

1
2
3
void gotoNormalizedTime(
    float time
)

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

slot gotoStart

1
void gotoStart()

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

slot gotoEnd

1
void gotoEnd()

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

Public Signals Documentation

signal sourceChanged

1
2
3
void sourceChanged(
    const QUrl & source
)

signal cameraNameChanged

1
2
3
void cameraNameChanged(
    const QString & cameraName
)

signal showDebugOverlayChanged

1
2
3
void showDebugOverlayChanged(
    bool showDebugOverlay
)

signal screenSizeChanged

1
2
3
void screenSizeChanged(
    const QSize & screenSize
)

signal readyChanged

1
2
3
void readyChanged(
    bool ready
)

signal loadedChanged

1
2
3
void loadedChanged(
    bool loaded
)

signal asynchronousChanged

1
2
3
void asynchronousChanged(
    bool asynchronous
)

signal activeSceneChanged

1
2
3
void activeSceneChanged(
    SceneConfiguration * activeScene
)

signal reflectionPlaneNameChanged

1
2
3
void reflectionPlaneNameChanged(
    const QString & reflectionPlaneName
)

Public Functions Documentation

function View3DScene

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

function ~View3DScene

1
~View3DScene()

function importer

1
inline Kuesa::Qt3D::GLTF2Importer * importer() const

function frameGraph

1
inline Kuesa::Qt3D::ForwardRenderer * frameGraph() const

function renderSettings

1
inline Qt3DRender::QRenderSettings * renderSettings() const

function source

1
QUrl source() const

function showDebugOverlay

1
bool showDebugOverlay() const

function screenSize

1
QSize screenSize() const

function asynchronous

1
bool asynchronous() const

function reflectionPlaneName

1
QString reflectionPlaneName() const

function animationPlayers

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

Returns the AnimationPlayer instances referenced by the View3DScene instance.

function activeScene

1
SceneConfiguration * activeScene() const

function isReady

1
bool isReady() const

function isLoaded

1
bool isLoaded() const

Public Property Documentation

property importer

1
Kuesa::Qt3D::GLTF2Importer * importer;

Points to the GLTF2Importer instance wrapped around by the View3DScene.

property frameGraph

1
Kuesa::Qt3D::ForwardRenderer * frameGraph;

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

property renderSettings

1
Qt3DRender::QRenderSettings * renderSettings;

Points to the.

property source

1
QUrl source;

The source of the glTF file to be loaded. \readonly.

property showDebugOverlay

1
bool showDebugOverlay;

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

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

property screenSize

1
QSize screenSize;

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

property ready

1
bool ready;

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.

property loaded

1
bool loaded;

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

property asynchronous

1
bool asynchronous;

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

property activeScene

1
KuesaUtils::SceneConfiguration * activeScene;

If this points to a valid SceneConfiguration instance, the View3DScene::source ,.

property reflectionPlaneName

1
QString reflectionPlaneName;

If non empty, the View3DScene will try to load the.


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