| CMakeLists.txt |
|
5119 |
- |
| designer |
|
|
- |
| doc |
|
|
- |
| extensions |
|
|
- |
| LightmapperOutputWindow.qml |
|
3228 |
- |
| plugin.cpp |
|
3620 |
- |
| qquick3d.cpp |
!
\class QQuick3D
\inmodule QtQuick3D
\since 5.15
\brief Helper class for selecting correct surface format.
When using Qt Quick 3D with OpenGL it is necessary to take extra steps to
define what kind of \l {QSurfaceFormat}{surface format} is used when
initializing Qt Quick. This is because by the time Qt Quick is aware that
3D content is being used, the OpenGL context and window surface has already
been initialized. So this helper class is provided to request the ideal
surface format from Qt Quick 3D so that it can be set as the default surface
for Qt Quick before initialization.
If this helper is run when using any other rendering backends than OpenGL
then it just returns a copy of the current default QSurfaceFormat with the
requested samples.
If this helper is run when using the OpenGL rendering backend, then it will
test for sufficiently modern versions of OpenGL and support for
multisampling if requested. Normally Qt Quick will request an OpenGL 2.0 or
OpenGL ES 2.0 context, which would limit the features available when using
Qt Quick 3D, so an extra step is needed to request a more capable context.
The correct usage pattern is to call \l QSurfaceFormat::setDefaultFormat
to set the \l QSurfaceFormat returned by \l QQuick3D::idealSurfaceFormat.
It is important that this method is called after \l QGuiApplication is
constructed, but before the Qt Quick application content is loaded. This
code snippet shows the correct usage pattern:
\code
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtGui>
#include <QtQuick3D/qquick3d.h>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QSurfaceFormat::setDefaultFormat(QQuick3D::idealSurfaceFormat(4));
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
\endcode
\sa {Qt Quick 3D Graphics Requirements} {OpenGL specifics}
|
9202 |
- |
| qquick3d.h |
|
427 |
- |
| qquick3dabstractlight.cpp |
!
\qmltype Light
\inherits Node
\inqmlmodule QtQuick3D
\brief An uncreatable abstract base type for all lights.
Light itself is an uncreatable base for all of its subtypes. The subtypes provide multiple
options to determine the style of the light.
For usage examples, see \l{Qt Quick 3D - Lights Example}.
\sa DirectionalLight, PointLight
|
16143 |
- |
| qquick3dabstractlight_p.h |
|
6165 |
- |
| qquick3dbakedlightmap.cpp |
!
\qmltype BakedLightmap
\inherits QtObject
\inqmlmodule QtQuick3D
\brief Specifies baked lightmap settings for a model.
\since 6.4
A BakedLightmap object can be used to enable:
\list
\li persistently storing the baked lightmap data - during baking, or
\li loading the previously generated and stored lightmaps - at run time.
\endlist
A Model with \l{Model::usedInBakedLighting}{usedInBakedLighting} set to
true is considered to be part of the raytraced scene when baking lightmaps,
meaning the model's geometry and material contribute to direct and indirect
lighting. This on its own does not however enable generating, including
full calculation of bounced indirect lighting, and finally saving a
lightmap for the model. To do that, the model also needs to be associated
with an \l enabled BakedLightmap object with a unique key set.
When running in normal mode, the same BakedLightmap object indicates that
the Model has lightmap data, and that the engine should attempt to load
this data (based on the unique key) and use it when rendering.
For more information on how to bake lightmaps, see the \l Lightmapper
documentation.
\note As of Qt 6.4, lightmap baking is in an early technology preview state.
Changes to features, quality, and API are likely happen in future releases.
\sa Lightmapper, Model::usedInBakedLighting
|
3078 |
- |
| qquick3dbakedlightmap_p.h |
|
1391 |
- |
| qquick3dcamera.cpp |
!
\qmltype Camera
\inherits Node
\inqmlmodule QtQuick3D
\brief Defines an abstract base for Cameras.
A Camera defines how the content of the 3D scene is projected onto a 2D surface,
such as a View3D. A scene needs at least one Camera in order to visualize its
contents.
It is possible to position and rotate the Camera like any other spatial \l{QtQuick3D::Node}{Node} in
the scene. The \l{QtQuick3D::Node}{Node}'s location and orientation determines where the Camera is in
the scene, and what direction it is facing. The default orientation of the camera
has its forward vector pointing along the negative Z axis and its up vector along
the positive Y axis.
Together with the position and orientation, the frustum defines which parts of
a scene are visible to the Camera and how they are projected onto the 2D surface.
The different Camera subtypes provide multiple options to determine the shape of the
Camera's frustum.
\list
\li PerspectiveCamera provides a camera with a pyramid-shaped frustum, where objects are
projected so that those further away from the camera appear to be smaller. This is the
most commonly used camera type, and corresponds to how most real world cameras work.
\li OrthographicCamera provides a camera where the lines of the frustum are parallel,
making the perceived scale of an object unaffected by its distance to the camera. Typical
use cases for this type of camera are CAD (Computer-Assisted Design) applications and
cartography.
\li FrustumCamera is a perspective camera type where the frustum can be freely customized
by the coordinates of its intersection with the near plane. It can be useful if an
asymmetrical camera frustum is needed.
\li CustomCamera is a camera type where the projection matrix can be freely customized,
and can be useful for advanced users who wish to calculate their own projection matrix.
\endlist
To illustrate the difference, these screenshots show the same scene as projected by a
PerspectiveCamera and an OrthographicCamera. Notice how the red box is smaller than the
green box in the image rendered using the perspective projection.
\table
\header
\li Perspective camera
\li Orthographic camera
\row
\li \image perspectivecamera.png
{Perspective camera view of plate}
\li \image orthographiccamera.png
{Orthographic camera view of plate}
\endtable
\sa {Qt Quick 3D - View3D Example}
|
16220 |
- |
| qquick3dcamera_p.h |
|
2710 |
- |
| qquick3dcontentlayer.cpp |
!
\qmltype ContentLayer
\inqmlmodule QtQuick3D
\since 6.11
\brief Singleton providing layer flag constants for grouping and filtering scene nodes.
ContentLayer is a singleton that exposes the \c LayerFlag enumeration, which provides
bit flag constants for assigning nodes to named content layers. Layers can be used to
group scene nodes together or to filter which nodes are rendered by a camera.
The predefined layer names are not necessarily descriptive for specific use cases. You
can define your own semantic layer names by aliasing the \l ContentLayer values. For
example, in a city scene with buildings, streets, and vehicles:
\qml
readonly property int layerBuildings: ContentLayer.Layer1
readonly property int layerStreets: ContentLayer.Layer2
readonly property int layerVehicles: ContentLayer.Layer3 | ContentLayer.Layer4
\endqml
Once defined, assign these flags to nodes via \l {Node::layers}{Node.layers} and set
the matching flags on a \l Camera to control which layers it renders.
\sa {Qt Quick 3D - Layers Example}{Layers Example}
\note Some layers have special meanings:
\table
\header
\li Layer
\li Description
\row
\li LayerNone
\li No layer assigned. Nodes with this value do not belong to any layer and are not rendered.
\row
\li Layer0
\li The default main layer. Nodes are assigned to this layer by default.
\row
\li Layer1–Layer23
\li Freely assignable user layers for grouping nodes by purpose or functionality.
\row
\li Layer24 and above
\li Reserved for internal use by Qt Quick 3D.
\row
\li LayerAll
\li Matches all layers; nodes with this value are rendered by every camera.
\endtable
\note Layers are bit flags and can be combined with the \c | operator.
\note Layer assignment is not inherited; setting \l {Node::layers}{Node.layers}
on a node does not propagate the value from parent to child. Each node keeps its
own layer assignment and must be set individually.
\note ContentLayer is a singleton and is not intended to be instantiated directly.
|
2595 |
- |
| qquick3dcontentlayer_p.h |
|
2154 |
- |
| qquick3dcubemaptexture.cpp |
!
\qmltype CubeMapTexture
\inherits Texture
\inqmlmodule QtQuick3D
\brief Defines a cube map texture for use in 3D scenes.
CubeMapTexture is a Texture that represents a cube map texture. A cube map
texture has 6 faces (X+, X-, Y+, Y-, Z+, Z-), where each face is an
individual 2D image. CubeMapTexture allows \l{CustomMaterial}{custom
materials} and \l{Effect}{post-processing effects} to work with cube map
textures in their shaders. A cube map can also be used to define the scene
environment's \l{SceneEnvironment::skyBoxCubeMap}{skybox}.
\qml
CustomMaterial {
property TextureInput customTexture: TextureInput {
texture: CubeMapTexture {
source: "cubemap.ktx"
}
}
fragmentShader: "shader.frag"
}
\endqml
Here shader.frag can be implemented assuming \c customTexture is sampler
uniform with the GLSL type a \c samplerCube. This means that the
\c{texture()} GLSL function takes a \c vec3 as the texture coordinate for
that sampler. If we used \l Texture, the type would have been \c sampler2D.
\badcode
void MAIN()
{
vec4 c = texture(customTexture, NORMAL);
BASE_COLOR = vec4(c.rgb, 1.0);
}
\endcode
Sourcing a Texture from a container with a cubemap only loads face 0 (X+)
and results in a 2D texture. Whereas sourcing a CubeMapTexture from the
same asset loads all 6 faces and results in a cubemap texture.
CubeMapTexture inherits all its properties from Texture. The important
difference is that \l {Texture::}{source} must refer to a image file
containing a cubemap, or to a list of image files. In practice a single
file means a \l{https://www.khronos.org/ktx/}{KTX} container containing 6
face images.
Sourcing a CubeMapTexture from 6 individual images can be done in two
different ways. Either as a semicolon-separated list of file names in
X+, X-, Y+, Y-, Z+, Z- order:
\qml
CubeMapTexture {
source: "maps/right.jpg;maps/left.jpg;maps/top.jpg;maps/bottom.jpg;maps/front.jpg;maps/back.jpg"
}
\endqml
or as a string containing a "%p" placeholder, where "%p" will be replaced by the strings
"posx", "negx", "posy", "negy", "posz", and "negz" to generate the six filenames:
\qml
CubeMapTexture {
source: "maps/sky_%p.png"
// equivalent to:
// source: "maps/sky_posx.png;maps/sky_negx.png;maps/sky_posy.png;maps/sky_negy.png;maps/sky_posz.png;maps/sky_negz.png"
}
\endqml
\note Sourcing image data via other means, such as \l {Texture::}{sourceItem}
or \l {Texture::}{textureData} is not supported for CubeMapTexture at the
moment.
\sa Texture, CustomMaterial, Effect
|
3290 |
- |
| qquick3dcubemaptexture_p.h |
|
851 |
- |
| qquick3dcustomcamera.cpp |
!
\qmltype CustomCamera
\inherits Camera
\inqmlmodule QtQuick3D
\brief Defines a Camera with a custom projection matrix.
A \l Camera defines how the content of the 3D scene is projected onto a 2D surface,
such as a View3D. A scene needs at least one \l Camera in order to visualize its
contents.
It is possible to position and rotate the \l Camera like any other spatial \l{QtQuick3D::Node}{Node} in
the scene. The \l{QtQuick3D::Node}{Node}'s location and orientation determines where the \l Camera is in
the scene, and what direction it is facing. The default orientation of the \l Camera
has its forward vector pointing along the negative Z axis and its up vector along
the positive Y axis.
The CustomCamera type provides a \l Camera where the projection matrix can be customized
freely.
The following example creates a CustomCamera at position [0, 200, 300] in the scene, with
a 30 degree downward pitch, and a custom projection matrix based on custom near and far plane
distances, and a custom field of view.
\code
CustomCamera {
position: Qt.vector3d(0, 200, 300)
eulerRotation.x: -30
property real near: 10.0
property real far: 10000.0
property real fov: 60.0 * Math.PI / 180.0
projection: Qt.matrix4x4(Math.cos(fov / 2) / Math.sin(fov / 2) * (window.height / window.width), 0, 0, 0,
0, Math.cos(fov / 2) / Math.sin(fov / 2), 0, 0,
0, 0, -(near + far) / (far - near), -(2.0 * near * far) / (far - near),
0, 0, -1, 0);
}
\endcode
\note When using CustomCamera, some anti-aliasing modes(Temporal AA and Progressive AA) cannot be applied correctly.
\sa PerspectiveCamera, OrthographicCamera, FrustumCamera
|
3320 |
- |
| qquick3dcustomcamera_p.h |
|
1185 |
- |
| qquick3dcustommaterial.cpp |
|
98509 |
- |
| qquick3dcustommaterial_p.h |
|
5795 |
- |
| qquick3ddebugsettings.cpp |
!
\qmltype DebugSettings
\inherits QtObject
\inqmlmodule QtQuick3D
\brief Used to configure debug settings.
The renderer can be configured to output many different views to facilitate
debugging. This component is used to configure these debug views.
In addition to programatic control, properties such as \l materialOverride
and \l wireframeEnabled can also be controlled interactively via the \l
DebugView item if an instance of that is added to the Qt Quick scene by the
application.
|
10547 |
- |
| qquick3ddebugsettings_p.h |
|
5219 |
- |
| qquick3ddefaultmaterial.cpp |
!
\qmltype DefaultMaterial
\inherits Material
\inqmlmodule QtQuick3D
\brief Lets you define a material for 3D items using the specular/glossiness workflow.
\deprecated [6.4] Prefer using the \l PrincipledMaterial or \l SpecularGlossyMaterial instead.
\warning This material is only provided for compatibility reasons, and should not be used in new code.
Prefer using the \l SpecularGlossyMaterial for creating materials using the specular/glossiness
workflow or the \l PrincipledMaterial for creating materials using the metal/roughness workflow.
Before a Model can be rendered in a scene, it must have at least one material attached
to it that describes how the mesh should be shaded. The DefaultMaterial is an easy to
use material that lets you describe your material using a specular/glossiness type workflow.
The material has sensible default and can be used to shade a model without changing any properties.
\section1 Specular/Glossiness workflow
The Default material provides a way to create materials using a specular/glossiness
type workflow. The main properties of the material are controlled through the
\l {DefaultMaterial::specularMap} {specular}, \l {DefaultMaterial::roughnessMap} {roughness},
and the \l {DefaultMaterial::diffuseMap} {diffuse color} property.
\section2 Specular
The \l {DefaultMaterial::specularMap} {specular reflectivity} describes the specular
amount and color of an object's surface. For reflective materials the main color
contribution, comes from this property.
\section2 Glossiness (Roughness)
The glossiness of a surface depends on how smooth or irregular the surface is.
A smooth surface will have a more intense light reflection then a rough surface, where
the light reflection will be more spread out. In the Default material the material's glossiness
is controlled through the \l {DefaultMaterial::roughnessMap} {roughness} property.
\section2 Diffuse color
The \l {DefaultMaterial::diffuseMap} {diffuse color} property describes the basic color
of the material, and unlike the \l {PrincipledMaterial}'s base color, the diffuse color
does not contain any information about the material reflectance. However, for
reflective surfaces the diffuse color should be set to a black tint, as that will allow
for the specular color to contribute.
|
33210 |
- |
| qquick3ddefaultmaterial_p.h |
|
11036 |
- |
| qquick3ddirectionallight.cpp |
!
\qmltype DirectionalLight
\inherits Light
\inqmlmodule QtQuick3D
\brief Defines a directional light in the scene.
The directional light emits light in one direction from an unidentifiable source located
infinitely far away. This is similar to the way sunlight works in real life. A directional
light has infinite range and does not diminish.
If \l {Light::castsShadow}{castsShadow} is enabled, shadows will be parallel to the light
direction.
A directional light effectively have no position, so moving it does not
have any effect. The light will always be emitted in the direction of the
light's Z axis.
Rotating the light along its X or Y axis will change the direction of the light emission.
Scaling a directional light will only have an effect in the following cases:
\list
\li If Z scale is set to a negative number, the light will be emitted in the opposite direction.
\li If the scale of any axis is set to 0, the light will be emitted along the world's Z axis.
\note Rotating the light will then have no effect.
\endlist
Let's look at a simple example:
\qml
import QtQuick
import QtQuick3D
View3D {
anchors.fill: parent
PerspectiveCamera { z: 600 }
DirectionalLight {
}
Model {
source: "#Sphere"
scale: Qt.vector3d(4, 4, 4)
materials: PrincipledMaterial {
baseColor: "#40c060"
roughness: 0.1 // make specular highlight visible
}
}
}
\endqml
Here the DirectionalLight uses the default \c white color, emitting in the
direction of the DirectionalLight node's Z axis.
\image directionallight-1.png
{Green circle showing directional light emitting along Z axis}
Rotating 60 degrees around the X axis would lead to the following. Instead
of emitting straight in the direction of the Z axis, the light is now
pointing 60 degrees "down":
\qml
DirectionalLight {
eulerRotation.x: 60
}
\endqml
\image directionallight-2.png
{Green circle with shading showing rotated directional light}
For further usage examples, see \l{Qt Quick 3D - Lights Example}.
\sa PointLight, SpotLight, {Shadow Mapping}
|
8329 |
- |
| qquick3ddirectionallight_p.h |
|
2921 |
- |
| qquick3deffect.cpp |
|
59763 |
- |
| qquick3deffect_p.h |
|
2610 |
- |
| qquick3dfog.cpp |
!
\qmltype Fog
\inherits QtObject
\inqmlmodule QtQuick3D
\brief Specifies fog settings for a scene.
\since 6.5
When the \l{SceneEnvironment::fog}{fog} property of a \l
SceneEnvironment is set to a valid Fog object, the properties are used to
configure the rendering of fog.
\image fog.jpg
{Scene with fog effect}
The simple fog provided by this type is implemented by the materials. It is
not a post-processing effect, meaning it does not involve additional render
passes processing the texture with the output of the \l View3D, but is
rather implemented in the fragment shader for each renderable object
(submesh of \l Model) with a \l PrincipledMaterial or shaded \l
CustomMaterial.
Fog is configured by a number of properties:
\list
\li General settings: \l color and \l density
\li Depth fog settings: \l depthEnabled, \l depthNear, \l depthFar, \l depthCurve
\li Height fog settings: \l heightEnabled, \l leastIntenseY, \l mostIntenseY, \l heightCurve
\li Color transmission settings: \l transmitEnabled, \l transmitCurve
\endlist
For example, the following snippet enables depth (but not height) fog using
the default fog parameters:
\qml
environment: SceneEnvironment {
backgroundMode: SceneEnvironment.Color
clearColor: theFog.color
fog: Fog {
id: theFog
enabled: true
depthEnabled: true
}
}
\endqml
Instead of defining the Fog object inline, it is also possible to reference
a Fog object by \c id. And since \l ExtendedSceneEnvironment inherits
everything from its parent type \l SceneEnvironment, fog can be used with
\l ExtendedSceneEnvironment as well:
\qml
Fog {
id: theFog
enabled: true
depthEnabled: true
}
environment: ExtendedSceneEnvironment {
fog: theFog
}
\endqml
\sa {Qt Quick 3D - Simple Fog Example}, {Qt Quick 3D - Scene Effects Example}
|
13765 |
- |
| qquick3dfog_p.h |
|
3851 |
- |
| qquick3dfrustumcamera.cpp |
!
\qmltype FrustumCamera
\inherits PerspectiveCamera
\inqmlmodule QtQuick3D
\brief Defines a PerspectiveCamera with a custom frustum.
A \l Camera defines how the content of the 3D scene is projected onto a 2D surface,
such as a View3D. A scene needs at least one \l Camera in order to visualize its
contents.
It is possible to position and rotate the \l Camera like any other spatial \l{QtQuick3D::Node}{Node} in
the scene. The \l{QtQuick3D::Node}{Node}'s location and orientation determines where the \l Camera is in
the scene, and what direction it is facing. The default orientation of the \l Camera
has its forward vector pointing along the negative Z axis and its up vector along
the positive Y axis.
The FrustumCamera type provides a PerspectiveCamera where the frustum bounds can be
customized. This can be useful for creating asymmetrical frustums.
The following example creates a FrustumCamera at [0, 0, 100] in the scene.
The \l {PerspectiveCamera::clipNear}{near plane} is placed 100 units in front of the camera at the origin.
The intersection of the frustum and the near plane is then given by the rectangle that has a bottom left corner at [-5, -5],
and a top right corner at [5, 5], and continues until it intersect the
\l {PerspectiveCamera::clipFar}{far plane}, which is located 1000 units from the camera at [0, 0, -900].
\note The \l{PerspectiveCamera::fieldOfViewOrientation}{vertical field of view} angle is
a product of the distance between the camera, the \l {PerspectiveCamera::clipNear}{near plane}
and the length between the \c top and \c bottom of the near plane.
\note If the top and bottom, or left right, values are asymmetric,
the apex of the frustum will be shifted, effectively offsetting the camera from its location.
\code
FrustumCamera {
position: Qt.vector3d(0, 0, 100)
clipNear: 100
clipFar: 1000
top: 5
bottom: -5
left: -5
right: 5
}
\endcode
\sa PerspectiveCamera, OrthographicCamera, CustomCamera
|
5073 |
- |
| qquick3dfrustumcamera_p.h |
|
1676 |
- |
| qquick3dgeometry.cpp |
!
\qmltype Geometry
\inherits Object3D
\inqmlmodule QtQuick3D
\nativetype QQuick3DGeometry
\brief Base type for custom geometry.
Custom geometry allows using application-generated vertex and index data,
that can possibly change dynamically as well. To use custom geometry, do
not assign a \c{.mesh} file as the \l{Model::source}{source} to a Model.
Instead, set its \l{Model::geometry}{geometry} property to reference a
Geometry object.
A typical way of implementing custom geometry is by creating a
\l QQuick3DGeometry subclass in C++ and registering the new type for use
with QML.
It is also possible to use the built-in custom geometry provider
\l GridGeometry in the \c Helpers module. The following is an example of
\l GridGeometry. Any application-provided Geometry subclass can be taken into
use in the same manner.
\code
import QtQuick3D.Helpers
Model {
geometry: GridGeometry {
}
materials: [
DefaultMaterial {
diffuseColor: "white"
lighting: DefaultMaterial.NoLighting
}
]
}
\endcode
\sa {Qt Quick 3D - Custom Geometry Example}, Model, QQuick3DGeometry
|
36531 |
- |
| qquick3dgeometry.h |
|
4316 |
- |
| qquick3dgeometry_p.h |
|
1943 |
- |
| qquick3dinstancing.cpp |
!
\qmltype Instancing
\inherits Object3D
\inqmlmodule QtQuick3D
\nativetype QQuick3DInstancing
\since 6.2
\brief Base type for instance tables.
\l {Instanced Rendering}{Instanced rendering} allows duplicating a model with variations.
The Instancing type defines a table that specifies how each instance is modified relative to the
base model. The table has an entry for each index, containing a transform matrix, a color, and
generic data for use by custom materials. To use instancing, set a model's
\l{Model::instancing}{instancing} property to reference an Instancing object.
An application can define an Instancing object in C++ by subclassing QQuick3DInstancing,
or it can use one of the pre-defined QML types: InstanceList FileInstancing, or RandomInstancing.
In addition, it is possible to use a \l {ParticleSystem3D}{particle system} to define an
instancing table by using the \l{ModelParticle3D::instanceTable}{ModelParticle3D.instanceTable}
property.
|
36958 |
- |
| qquick3dinstancing.h |
|
3951 |
- |
| qquick3dinstancing_p.h |
|
5771 |
- |
| qquick3ditem2d.cpp |
internal
|
5094 |
- |
| qquick3ditem2d_p.h |
|
1656 |
- |
| qquick3djoint.cpp |
!
\qmltype Joint
\inherits Node
\inqmlmodule QtQuick3D
\brief Defines a node in a skeletal animation hierarchy.
A joint is a transformable node inside a \l {Skeleton}, used for \l {Vertex Skinning}
{skeletal animation}. It is called a "joint" because it can be seen as a joint between the bones
of a skeleton.
All the joints must be contained inside a Skeleton, and each joint must have a \l skeletonRoot
pointing back to that skeleton.
\qml
Skeleton {
id: qmlskeleton
Joint {
id: joint0
index: 0
skeletonRoot: qmlskeleton
Joint {
id: joint1
index: 1
skeletonRoot: qmlskeleton
}
}
}
\endqml
|
4567 |
- |
| qquick3djoint_p.h |
|
1658 |
- |
| qquick3dlightmapbaker.cpp |
!
\class QQuick3DLightmapBaker
\inmodule QtQuick3D
\internal
|
7347 |
- |
| qquick3dlightmapbaker_p.h |
|
1924 |
- |
| qquick3dlightmapper.cpp |
!
\qmltype Lightmapper
\inherits QtObject
\inqmlmodule QtQuick3D
\brief Specifies lightmap baking settings for a scene.
\since 6.4
Used when baking direct and indirect lighting. Most of these settings are not
relevant at other times, such as when using already generated lightmaps to
render a scene. The exception is \l source, though this has a sensible default
for development.
On a successfull bake a single file will be generated at the value specified by
\l source. This binary file contains the results of the bake, including the
per-model lightmaps and the mesh files with lightmap-compatible UVs.
The individual model data is accessed via \l BakedLightmap::key.
The data contained in the resulting lightmap file is all tightly coupled
to each other and to the current scene state. This means that any modifications
to the original mesh files, Lightmapper settings or other scene changes will
require a new bake to be executed to see the updated result.
\note As of Qt 6.4, lightmap baking is in an early technology preview state.
Changes to features, quality, and API are likely to happen in future releases.
The Lightmapper object works in combination with:
\list
\li \l Model::bakedLightmap and the associated \l BakedLightmap,
\li \l Model::usedInBakedLighting and \l Model::texelsPerUnit,
\li \l Light::bakeMode,
\li the engine's built-in lightmap baker.
\endlist
\sa {Lightmaps and Global Illumination},
{Qt Quick 3D - Baked Lightmap Example},
{Qt Quick 3D - SSGI Lightmap Example}
|
10289 |
- |
| qquick3dlightmapper_p.h |
|
3855 |
- |
| qquick3dloader.cpp |
!
\qmltype Loader3D
\inqmlmodule QtQuick3D
\inherits Node
\brief Allows dynamic loading of a 3D subtree from a URL or Component.
Loader3D is used to dynamically load QML components for Qt Quick 3D.
Loader3D can load a
QML file (using the \l source property) or a \l Component object (using
the \l sourceComponent property). It is useful for delaying the creation
of a component until it is required: for example, when a component should
be created on demand, or when a component should not be created
unnecessarily for performance reasons.
\note Loader3D works the same way as \l Loader. The difference between the
two is that \l Loader provides a way to dynamically load objects that inherit
\l Item, whereas Loader3D provides a way to load objects that inherit \l Object3D
and is part of a 3D scene.
|
19705 |
- |
| qquick3dloader_p.h |
|
3653 |
- |
| qquick3dmaterial.cpp |
!
\qmltype Material
\inherits Object3D
\inqmlmodule QtQuick3D
\brief Abstract base type providing functionality common to materials.
|
6593 |
- |
| qquick3dmaterial_p.h |
|
3176 |
- |
| qquick3dmodel.cpp |
!
\qmltype Model
\inherits Node
\inqmlmodule QtQuick3D
\brief Lets you load a 3D model data.
The Model item makes it possible to load a mesh and modify how its shaded, by adding materials
to it. For a model to be renderable, it needs at least a mesh and a material.
\section1 Mesh format and built-in primitives
The model can load static meshes from storage or one of the built-in primitive types.
The mesh format used is a run-time format that's native to the engine, but additional formats are
supported through the asset import tool \l {Balsam Asset Import Tool}{Balsam}.
The built-in primitives can be loaded by setting the \c source property to one of these values:
\c {#Rectangle, #Sphere, #Cube, #Cylinder or #Cone}.
\qml
Model {
source: "#Sphere"
}
\endqml
The table below describes the built-in meshes in more detail.
\table
\header
\li Name
\li Description
\li No. faces
\row
\li #Cone
\li A cone with a height and diameter of \c{100}. The base is at the
origin and the cone is pointing upwards in the y direction.
\li \c{78}
\row
\li #Cube
\li A cube centered at the origin with \c{100} long sides along x, y and z.
\li \c{12}
\row
\li #Cylinder
\li A cylinder with \c{100} height and diameter centered at the origin
expanding along the y direction.
\li \c{316}
\row
\li #Rectangle
\li A rectangle with \c{100} width and height centered at the origin
lying in the xy plane.
\li \c{2}
\row
\li #Sphere
\li A sphere with \c{100} diameter centered at the origin.
\li \c{4900}
\endtable
\section2 Custom geometry
In addition to using static meshes, you can implement a
\l {QQuick3DGeometry}{custom geometry} provider that provides the model with
custom vertex data at run-time. See the
\l {Qt Quick 3D - Custom Geometry Example}{Custom Geometry Example} for an
example on how to create and use a custom material with your model.
\section1 Materials
A model can consist of several sub-meshes, each of which can have its own
material. The sub-mesh uses a material from the \l{materials} list,
corresponding to its index. If the number of materials is less than the
sub-meshes, the last material in the list is used for subsequent sub-meshes.
This is demonstrated in the
\l {Qt Quick 3D - Sub-mesh Example}{Sub-mesh example}.
You can use the following materials with the model item:
\l {PrincipledMaterial}, \l {DefaultMaterial}, and \l {CustomMaterial}.
\section1 Picking
\e Picking is the process of sending a ray through the scene from some
starting position to find which models intersect with the ray. In
Qt Quick 3D, the ray is normally sent from the view using 2D coordinates
resulting from a touch or mouse event. If a model was hit by the ray,
\l {pickResult} will be returned with a handle to the model and information
about where the ray hit the model. For models that use
\l {QQuick3DGeometry}{custom geometry}, the picking is less accurate than
for static mesh data, as picking is only done against the model's
\l {bounds}{bounding volume}. If the ray goes through more than one model,
the closest \l {Model::pickable}{pickable} model is selected.
Note that for models to be \l {Model::pickable}{pickable}, their
\l {Model::pickable}{pickable} property must be set to \c true. For more
information, see \l {Qt Quick 3D - Picking example}.
|
43608 |
- |
| qquick3dmodel_p.h |
|
11901 |
- |
| qquick3dmorphtarget.cpp |
!
\qmltype MorphTarget
\inherits Object3D
\inqmlmodule QtQuick3D
\brief Defines the properties of a morph target.
Each \e MorphTarget is a morph target for a \l{Morphing Animation}{vertex animation}. The degree
of morphing is controlled by changing the \l {weight} property.
\qml
MorphTarget {
id: morphtarget0
attributes: MorphTarget.Position | MorphTarget.Normal
weight: 0.5
}
\endqml
The \l {Qt Quick 3D - Morphing Example}{morphing example} shows how to use a morph target.
|
3931 |
- |
| qquick3dmorphtarget_p.h |
|
2354 |
- |
| qquick3dnode.cpp |
!
\qmltype Node
\inherits Object3D
\inqmlmodule QtQuick3D
\brief The base component for an object that exists in a 3D scene.
The Node type serves as the base class for other spatial types, such as, \l Model, \l Camera, \l Light.
These objects represent an entity that exists in the 3D scene, due to having a position and
other properties in the 3D world. With the exception of the root node(s), all Node types are
transformed relative to their parent Node, that is, in local coordinates. In many ways the Node
type serves the same purpose in Qt Quick 3D scenes as \l Item does for Qt Quick scenes.
In addition to types deriving from Node, it is also possible to parent other types to
a Node. This includes QObject instances, where the Node merely serves as the
\l{QObject::parent()}{QObject parent}, and \l{Qt Quick 3D Scenes with 2D Content}{Qt
Quick items}.
Wrapping other objects for the purpose of grouping them into components or sub-trees can be
a convenient way to, for example, animated a group of nodes as a whole. This snippet shows how
to use Node to animate a camera:
\qml
Node {
PerspectiveCamera {
position: Qt.vector3d(0, 0, -600)
}
SequentialAnimation on eulerRotation.y {
loops: Animation.Infinite
PropertyAnimation {
duration: 5000
from: 0
to: 360
}
}
}
\endqml
Node has to be used also if creating a scene outside of \l View3D, for example for the
purpose of switching scenes on the fly, or showing the same scene on multiple views.
\qml
Node {
id: standAloneScene
DirectionalLight {}
Model {
source: "#Sphere"
materials: [ DefaultMaterial {} ]
}
PerspectiveCamera {
z: 600
}
}
View3D {
importScene: standAloneScene
}
\endqml
|
33760 |
- |
| qquick3dnode_p.h |
|
5718 |
- |
| qquick3dnode_p_p.h |
|
2311 |
- |
| qquick3dobject.cpp |
!
\qmltype Object3D
\inqmlmodule QtQuick3D
\nativetype QQuick3DObject
\inherits QtObject
\brief Abstract base type of all 3D nodes and resources.
Object3D is the base class for all Qt Quick 3D types. This includes:
\list
\li Spatial types that represent objects in the 3D scene, these will normally have a position and/or a direction.
For example, \l Model, \l Camera, or \l Light. Such types inherit from \l Node, which in turn inherits from Object3D.
\li Resource types that do not themselves represent an object in the 3D world, but rather serve
as components to \l Node subclasses, providing data of some kind. This includes, among
others, \l Material, \l Geometry, and \l Texture.
\endlist
In addition to the above types, Object3D can also serve as the parent for \l{Item}{Qt
Quick items}, as well as arbitrary QObject instances. For more information on adding
2D items to the 3D scene, refer to \l{Qt Quick 3D Scenes with 2D Content}.
\sa Node
|
38653 |
- |
| qquick3dobject.h |
|
3912 |
- |
| qquick3dobject_p.h |
!
Flags::RequiresSecondaryUpdate indicates that the object needs a secondary update, meaning an
additional call to updateSpatialNode() will be made after the first one. This is useful for objects
that depend on other objects being fully updated before they can update themselves properly, as
when the second call happens all objects have had their first updateSpatialNode() called.
In addition to setting this flag the object must also call requestSecondaryUpdate() when it knows
that it needs the secondary update!
NOTE: This flag is only relevant for resource objects, spatial nodes will be ignored.
|
12366 |
- |
| qquick3dobjectchangelistener_p.h |
child |
1263 |
- |
| qquick3dorthographiccamera.cpp |
!
\qmltype OrthographicCamera
\inherits Camera
\inqmlmodule QtQuick3D
\brief Defines an Camera with an orthographic projection matrix.
A \l Camera defines how the content of the 3D scene is projected onto a 2D surface,
such as a View3D. A scene needs at least one \l Camera in order to visualize its
contents.
It is possible to position and rotate the \l Camera like any other spatial \l{QtQuick3D::Node}{Node} in
the scene. The \l{QtQuick3D::Node}{Node}'s location and orientation determines where the \l Camera is in
the scene, and what direction it is facing. The default orientation of the \l Camera
has its forward vector pointing along the negative Z axis and its up vector along
the positive Y axis.
\image orthographiccamera.png {Orthographic camera projection diagram}
The OrthographicCamera is a parallel projection \l Camera, in which parallel lines remain
parallel and an object's perceived scale is unaffected by its distance from the \l Camera.
Typical use cases for this type of \l Camera are CAD (Computer-Assisted Design) applications
and cartography.
The following example creates a OrthographicCamera at position [0, 200, 300] in the scene, and
with a 30 degree downward pitch.
\code
OrthographicCamera {
position: Qt.vector3d(0, 200, 300)
eulerRotation.x: -30
}
\endcode
\sa {Qt Quick 3D - View3D Example}, PerspectiveCamera, FrustumCamera, CustomCamera
|
5391 |
- |
| qquick3dorthographiccamera_p.h |
|
2060 |
- |
| qquick3dperspectivecamera.cpp |
!
\qmltype PerspectiveCamera
\inherits Camera
\inqmlmodule QtQuick3D
\brief Defines a Perspective Camera for viewing the content of a 3D scene.
A \l Camera defines how the content of the 3D scene is projected onto a 2D surface,
such as a View3D. A scene needs at least one \l Camera in order to visualize its
contents.
It is possible to position and rotate the \l Camera like any other spatial \l{QtQuick3D::Node}{Node} in
the scene. The \l{QtQuick3D::Node}{Node}'s location and orientation determines where the \l Camera is in
the scene, and what direction it is facing. The default orientation of the \l Camera
has its forward vector pointing along the negative Z axis and its up vector along
the positive Y axis.
\image perspectivecamera.png {Perspective camera projection diagram}
PerspectiveCamera is the standard \l Camera type. It gives a realistic projection of the
scene, where distant objects are perceived as smaller. The frustum is defined by
the fieldOfView property as well as near and far clip planes.
The following example creates a PerspectiveCamera at position [0, 200, 300] in the scene, a
field of view of 90 degrees and with a 30 degree downward pitch.
\code
PerspectiveCamera {
position: Qt.vector3d(0, 200, 300)
eulerRotation.x: -30
fieldOfView: 90
}
\endcode
\sa {Qt Quick 3D - View3D Example}, OrthographicCamera, FrustumCamera, CustomCamera
|
6763 |
- |
| qquick3dperspectivecamera_p.h |
|
2264 |
- |
| qquick3dpickresult.cpp |
!
\qmlvaluetype pickResult
\inqmlmodule QtQuick3D
\brief Contains the results of a pick.
Created as a return object to View3D::pick.
|
5752 |
- |
| qquick3dpickresult_p.h |
|
3305 |
- |
| qquick3dpointlight.cpp |
!
\qmltype PointLight
\inherits Light
\inqmlmodule QtQuick3D
\brief Defines a point light in the scene.
The point light can be described as a sphere, emitting light with equal strength in all
directions from the center of the light. This is similar to the way a light bulb emits light.
Rotating or scaling a point light does not have any effect. Moving a point light will change
the position from where the light is emitted.
By default, a point light intensity diminishes according to inverse-square-law. However, the fade-off
(and range) can be controlled with the \l {constantFade}, \l {linearFade}, and
\l quadraticFade properties. Light attenuation is calculated using the formula:
\l {constantFade} + \c distance * (\l {linearFade} * 0.01) + \c distance^2 * (\l {quadraticFade} * 0.0001)
\section2 A simple example: shading a sphere in three different ways
Take a scene containing a sphere in front of a scaled up rectangle in the
background. The default base color of the PrincipledMaterial of the
rectangle is white.
Without any lights and disabling light-related shading for the two meshes,
we get the following:
\qml
import QtQuick
import QtQuick3D
View3D {
anchors.fill: parent
PerspectiveCamera { z: 600 }
Model {
source: "#Rectangle"
scale: Qt.vector3d(10, 10, 10)
z: -100
materials: PrincipledMaterial {
lighting: PrincipledMaterial.NoLighting
}
}
Model {
source: "#Sphere"
scale: Qt.vector3d(2, 2, 2)
materials: PrincipledMaterial {
lighting: PrincipledMaterial.NoLighting
baseColor: "#40c060"
roughness: 0.1
}
}
}
\endqml
\image pointlight-1.png
{Green circle with white background}
Adding a directional light, emitting down the Z axis by default, leads to the following:
\qml
import QtQuick
import QtQuick3D
View3D {
anchors.fill: parent
PerspectiveCamera { z: 600 }
DirectionalLight { }
Model {
source: "#Rectangle"
scale: Qt.vector3d(10, 10, 10)
z: -100
materials: PrincipledMaterial { }
}
Model {
source: "#Sphere"
scale: Qt.vector3d(2, 2, 2)
materials: PrincipledMaterial {
baseColor: "#40c060"
roughness: 0.1
}
}
}
\endqml
\image pointlight-2.png
{Green circle with black edge}
What if we now replace DirectionalLight with:
\qml
PointLight {
z: 300
}
\endqml
The white colored PointLight here is moved on the Z axis so that it is
halfway between the camera and the center of the scene. Unlike
DirectionalLight, the rotation of the PointLight does not matter, whereas
its position is significant. The diminishing intensity is visible here,
especially on the rectangle mesh in the background.
\image pointlight-3.png
{Green gradient circle with black edge and dark gray gradient
background showing point light attenuation}
For more usage examples, see \l{Qt Quick 3D - Lights Example}.
\sa DirectionalLight, SpotLight, {Shadow Mapping}
|
6637 |
- |
| qquick3dpointlight_p.h |
|
1698 |
- |
| qquick3dprincipledmaterial.cpp |
!
\qmltype PrincipledMaterial
\inherits Material
\inqmlmodule QtQuick3D
\brief Lets you define a material for 3D items using the metal/roughness workflow.
Before a Model can be rendered in a scene, it must have at least one material attached
to it that describes how the mesh should be shaded. The PrincipledMaterial is a PBR
metal/roughness material that aims at being an easy to use material with a minimal
set of parameters.
In addition to having few parameters, all input values are strictly normalized
between 0 and 1 and have sensible defaults, meaning even without changing any values,
the material can be used to shader a model. For an introduction on how the
different properties of the principled material affects how a model is shaded,
see the \l{Qt Quick 3D - Principled Material Example}{Principled Material example}.
\section1 Metal/Roughness workflow
The Principled material is what's known as a metal/roughness material, in essence
that means the main characteristics of the material is controlled through
the \l {PrincipledMaterial::metalnessMap} {metallness}, \l {PrincipledMaterial::roughnessMap} {roughness},
and the \l {PrincipledMaterial::baseColorMap} {base color} property.
\section2 Metalness
Real world materials are put into two main categories, metals and dielectrics (non-metals).
In the Principled material, the category a material belongs to is decided by the
\c metalness value. Setting the \c metalness value to 0, means the material is a dialectric,
while everything above 0 is a considered to be a metal. In reality metals will have
a \c metalness value of 1, but values between 0 and 1 are possible, and usually used
for metals with reduced reflectance. For example, to render corrosion, or similar,
on a material, the \c metalness of the material should be reduced to give the output
properties more similar to a dielectric material.
Since the \c metalness value affects the reflectance of the material it might be tempting to
use the metalness to adjust glossiness, but consider what type of material you want
to describe first. Increasing the \c metalness value to give a dielectric material
a more polished look, will introduce properties that are not accurate for a dielectric
material, so consider if it would be more appropriate to adjust, for example,
the \c roughness value instead.
\section2 Roughness
The \c roughness of a material describes the condition of an object's surface.
A low \c roughness value means the object has a smooth surface and therefore be more
reflective then a material with a higher \c roughness value.
\section2 Base color
The \l {PrincipledMaterial::baseColorMap} {base color} of a metal/roughness material
contains both the diffuse and the specular data, how much the base color is interpreted
as one or the other is primarily dictated by the \c metalness value. For example,
a material with a metalness value of 1, will have most of its base color interpreted
as specular color, while the diffuse color would be a black tint. The opposite would
happen for a material with a metalness value of 0. This is of course a bit simplified,
but gives a rough idea how the \l {PrincipledMaterial::baseColor} {base color} and
\c metalness value interacts. For those more familiar with a Specular/Glossiness workflow,
there's a clear difference here which is worth noting, namely that the color data of the
two materials are not directly compatible, since in a Specular/Glossiness
\l {DefaultMaterial} {material}, the diffuse and specular color comes from separate inputs.
|
99788 |
- |
| qquick3dprincipledmaterial_p.h |
|
38504 |
- |
| qquick3dquaternionanimation.cpp |
!
\qmltype QuaternionAnimation
\inherits PropertyAnimation
\inqmlmodule QtQuick3D
\since 5.15
\brief A PropertyAnimation for quaternions.
A specialized \l{PropertyAnimation} that defines an animation between two
\l{QQuaternion}{quaternions}.
By default spherical linear interpolation is used. This can be changed to
the faster but less accurate normalized linear interpolation by setting the
\a type property.
Instead of specifying quaternions directly in the \a from and \a to
properties, it is also possible to provide euler angles in degrees in the
\a fromXRotation, \a toXRotation, \a fromYRotation, \a toYRotation,
\a fromZRotation, \a toZRotation properties.
\note Avoid mixing the quaternion and euler angle-based properties. The
from and to values are expected to be fully specified either via a
quaternion or the three euler angles.
\sa {Animation and Transitions in Qt Quick} QQuaternion QQuaternion::slerp()
QQuaternion::fastSlerp() QQuaternion::nlerp()
|
7665 |
- |
| qquick3dquaternionanimation_p.h |
|
2930 |
- |
| qquick3dquaternionutils.cpp |
!
\qmltype Quaternion
\inqmlmodule QtQuick3D
\since 5.15
\brief Provides utility functions for quaternion.
The \c Quaternion is a global object with utility functions.
It is not instantiable; to use it, call the members of the global \c Quaternion object
directly. For example:
\qml
Node {
rotation: Quaternion.fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
}
\endqml
|
5690 |
- |
| qquick3dquaternionutils_p.h |
|
2328 |
- |
| qquick3dreflectionprobe.cpp |
!
\qmltype ReflectionProbe
\inherits Node
\inqmlmodule QtQuick3D
\brief Defines a reflection probe in the scene.
A reflection probe is used to provide reflections of the current scene to the objects. The probe
provides properties to the runtime which are then used to render the scene to a cube map. The cube map
is then used as the reflection information for the reflecting objects.
\sa {Qt Quick 3D - Reflection Probes Example}
|
17617 |
- |
| qquick3dreflectionprobe_p.h |
|
5954 |
- |
| qquick3drenderpass.cpp |
!
\qmltype RenderPass
\inherits Object3D
\inqmlmodule QtQuick3D
\brief Defines a custom render pass for rendering 3D content.
\since 6.11
A RenderPass defines a rendering step and the render target it writes
into. It is the combination of three concerns:
\list
\li \b {Where to render} — one or more output textures declared as
\l ColorAttachment or \l DepthTextureAttachment commands in
\l {RenderPass::commands}{commands}.
\li \b {What to render} — which scene objects the pass draws,
controlled by \l RenderablesFilter commands. Sub-divisions of
work within the same render target are described using
\l SubRenderPass commands.
\li \b {How to render} — the \l materialMode and any
\l PipelineStateOverride commands.
\endlist
A RenderPass becomes active for a scene when it is placed as a child
of a \l View3D or a \l Node, or of another RenderPass.
\section1 Render order
Nesting a RenderPass inside another RenderPass expresses ordering:
nested passes render \e before their parent, so a pass that produces a
texture consumed by another pass is declared as a child of its
consumer, and results merge towards the top of the pass hierarchy.
Only RenderPass ancestors count towards the nesting depth; other
ancestors, such as \l Node items used for grouping, do not affect the
order. The relative render order of passes at the same nesting depth
is not defined; use nesting to express an ordering requirement.
Nesting affects ordering only; a nested pass still renders into its
own render target. To render into the parent pass's render target,
reference the pass from a \l SubRenderPass command instead. A pass
referenced by a SubRenderPass command is invoked by its parent and
never renders on its own.
The following example sets up a simple off-screen pass that renders
all scene objects into a custom texture, which can then be consumed
by a material or a \l SimpleQuadRenderer:
\qml
import QtQuick3D
View3D {
// Declare the off-screen color buffer
RenderPassTexture {
id: myColorTexture
format: RenderPassTexture.RGBA8
}
// The render pass: where + what + how
RenderPass {
id: myRenderPass
commands: [
// Where: attach the texture as the color output
ColorAttachment {
name: "color0"
target: myColorTexture
},
// What: render all objects into it
RenderablesFilter {
renderableTypes: RenderablesFilter.Opaque | RenderablesFilter.Transparent
}
]
}
}
\endqml
\section1 Exposing data to the shaders
As with Effects and Custom Materials, the RenderPass will expose and
update user-defined properties to the shaders automatically. Any QML
properties declared on a RenderPass subtype will be available as
uniforms in the shader.
\sa SubRenderPass, RenderOutputProvider, RenderablesFilter
|
27532 |
- |
| qquick3drenderpass_p.h |
|
6336 |
- |
| qquick3drenderstats.cpp |
!
\qmltype RenderStats
\inqmlmodule QtQuick3D
\brief Provides information of the scene rendering.
The RenderStats type provides information about scene rendering statistics. This
cannot be created directly, but can be retrieved from a \l View3D.
Use the \l DebugView item to display the data on-screen.
|
32406 |
- |
| qquick3drenderstats_p.h |
|
6738 |
- |
| qquick3drepeater.cpp |
!
\qmltype Repeater3D
\inqmlmodule QtQuick3D
\inherits Node
\brief Instantiates a number of Node-based components using a provided model.
The Repeater3D type is used to create a large number of
similar items. Like other view types, a Repeater3D has a \l model and a \l delegate:
for each entry in the model, the delegate is instantiated
in a context seeded with data from the model.
A Repeater's \l model can be any of the supported \l {qml-data-models}{data models}.
Additionally, like delegates for other views, a Repeater delegate can access
its index within the repeater, as well as the model data relevant to the
delegate. See the \l delegate property documentation for details.
\note A Repeater3D item owns all items it instantiates. Removing or dynamically destroying
an item created by a Repeater3D results in unpredictable behavior.
\note Repeater3D is \l {Node}-based, and can only repeat \l {Node}-derived objects.
|
18805 |
- |
| qquick3drepeater_p.h |
|
3099 |
- |
| qquick3dresourceloader.cpp |
!
\qmltype ResourceLoader
\inqmlmodule QtQuick3D
\inherits Object3D
\brief Allows pre-loading of 3D resources.
ResourceLoader is used to pre-load resources for Qt Quick 3D. Normally
resources are only loaded when they are needed to render a frame, and are
unloaded when they are not used to render the scene. This aggressive
approach to resource lifetimes means that only the bare minimum of GPU
resources are used to render a frame, but for some dynamic scenes this
can lead to resources being loaded and released frequently. The
ResourceLoader component enables a finer grain control on the lifetimes
of resources in the scene. Resources listed in the ResourceLoader
component are loaded into GPU memory and will remain there until they
are removed from the ResourceLoader lists or the ResourceLoader is
destroyed.
ResourceLoader can also be used to make sure that large resources are
available before rendering a frame. Since resources are loaded only
when needed for a frame, this can lead to frames being dropped waiting
for a large resource to be loaded. By pre-loading large resources before
showing a scene, there is no risk of dropping any frames due to resources
being loaded during an animation.
For usage examples, see \l {Qt Quick 3D - Principled Material Example}
|
12210 |
- |
| qquick3dresourceloader_p.h |
|
2979 |
- |
| qquick3dsceneenvironment.cpp |
!
\qmltype SceneEnvironment
\inherits Object3D
\inqmlmodule QtQuick3D
\brief Lets you configure how a scene is rendered.
SceneEnvironment defines a set of global properties for how a scene should be rendered.
\note The QtQuick3D.Helpers module offers an \l ExtendedSceneEnvironment
type which inherits from SceneEnvironment and adds a number of built-in
effects on top.
To use SceneEnvironment or \l ExtendedSceneEnvironment, associate the
\l{View3D::environment}{environment property} of a View3D with an instance
of these types. The object can be declared inline, for example like this:
\qml
View3D {
environment: SceneEnvironment {
antialiasingMode: SceneEnvironment.MSAA
tonemapMode: SceneEnvironment.TonemapModeFilmic
backgroundMode: SceneEnvironment.SkyBox
lightProbe: Texture {
source: "panoramic_hdri_background.hdr"
}
}
}
\endqml
Alternatively, the environment object can be defined separately. It can
then be referenced by one or more View3D objects. An example code snippet,
using \l ExtendedSceneEnvironment this time:
\qml
ExtendedSceneEnvironment {
id: myEnv
vignetteEnabled: true
}
View3D {
width: parent.width / 2
environment: myEnv
}
View3D {
width: parent.width / 2
x: parent.width / 2
environment: myEnv
}
\endqml
\section1 Feature Overview
\list
\li Anti-aliasing settings. See \l{Anti-Aliasing Best Practices} for an
overview of this topic. The relevant properties are \l antialiasingMode, \l
antialiasingQuality, \l specularAAEnabled, \l temporalAAEnabled, \l
temporalAAStrength. In addition, if \l ExtendedSceneEnvironment is used,
another method is available via
\l{ExtendedSceneEnvironment::fxaaEnabled}{fxaaEnabled}.
\li Screen space ambient occlusion. The relevant properties are \l
aoEnabled, \l aoStrength, \l aoBias, \l aoDistance, \l aoDither, \l
aoSampleRate, \l aoSoftness. Note that
\l{ExtendedSceneEnvironment::ssgiEnabled}{SSGI} also provides ambient
occlusion, and it will often give better quality results, albeit possibly at
a higher performance cost. Avoid enabling SceneEnvironment's ambient
occlusion and ExtendedSceneEnvironment's SSGI together.
\li Clear color, skybox, image-based lighting. For more information on IBL,
see \l{Using Image-Based Lighting}. The relevant properties are \l
backgroundMode, \l clearColor, \l lightProbe, \l probeExposure, \l
probeHorizon, \l probeOrientation, \l skyboxBlurAmount, \l skyBoxCubeMap.
\li Tonemapping. \l tonemapMode configures the tonemapping method that is
used to convert the high dynamic range color values to the 0-1 range at the
end of the graphics pipeline. \l ExtendedSceneEnvironment offers a few
additional properties, such as
\l{ExtendedSceneEnvironment::whitePoint}{whitePoint} and
\l{ExtendedSceneEnvironment::sharpnessAmount}{sharpnessAmount} that can be
used to tune the tonemapping calculations.
\li Depth buffer settings. The relevant properties are \l
depthPrePassEnabled, \l depthTestEnabled.
\li Post-processing effects. In addition to the built-in post-processing
effects provided by \l ExtendedSceneEnvironment, applications can provide
their own custom effects via the \l Effect type. The \l effects property is
a list of \l Effect instances.
\li Debug visualization settings, such as wireframe mode or rendering only
certain color contributions for the materials. This is controlled by the \l
DebugSettings object referenced from the \l debugSettings property. Most of
these settings can also be controlled interactively when a \l DebugView
item is added to the scene.
\li Fog settings. To enable fog, set an appropriately configured
\l [QML] Fog object in the \l [QML] fog property.
\li Lightmap baking settings. When pre-baked lightmaps are used for some
models in the scene, the \l Lightmapper object set in the \l lightmapper
property defines the settings used during the baking process.
\li Scissor settings. To apply a scissor different than the viewport, set
the \l scissorRect property.
\endlist
\sa ExtendedSceneEnvironment
|
58320 |
- |
| qquick3dsceneenvironment_p.h |
|
13567 |
- |
| qquick3dscenemanager.cpp |
|
34076 |
- |
| qquick3dscenemanager_p.h |
|
7846 |
- |
| qquick3dscenerenderer.cpp |
|
96320 |
- |
| qquick3dscenerenderer_p.h |
|
7998 |
- |
| qquick3dscenerootnode.cpp |
|
848 |
- |
| qquick3dscenerootnode_p.h |
|
1068 |
- |
| qquick3dshaderutils.cpp |
!
\qmltype Shader
\inherits QtObject
\inqmlmodule QtQuick3D
\brief Container component for defining shader code used by post-processing effects.
The Shader type is used for populating the \l{Pass::shaders}{shaders} list in the
render \l{Pass}{pass} of an \l Effect.
A shader is code which is executed directly on the graphic hardware at a particular
\l{Shader::stage}{stage} of the rendering pipeline.
\sa Effect
|
85974 |
- |
| qquick3dshaderutils_p.h |
|
27929 |
- |
| qquick3dskeleton.cpp |
!
\qmltype Skeleton
\inherits Node
\inqmlmodule QtQuick3D
\brief Defines a skeletal animation hierarchy.
A skeleton defines how a model can be animated using \l {Vertex Skinning}
{skeletal animation}. It contains a hierarchy of \l {Joint} nodes. Each joint can be
transformed for a skinning animation.
\qml
Skeleton {
id: qmlskeleton
Joint {
id: joint0
index: 0
skeletonRoot: qmlskeleton
Joint {
id: joint1
index: 1
skeletonRoot: qmlskeleton
}
}
}
\endqml
\sa {Joint::skeletonRoot}, {Model::skeleton}, {Qt Quick 3D - Simple Skinning Example#skeleton-and-joint-hierarchy}
|
1599 |
- |
| qquick3dskeleton_p.h |
|
937 |
- |
| qquick3dskin.cpp |
!
\qmltype Skin
\inherits Object3D
\inqmlmodule QtQuick3D
\brief Defines a skinning animation.
A skin defines how a model can be animated using \l {Vertex Skinning}
{skeletal animation}. It contains a list of \l {Node}s and an optional list
of the Inverse Bind Pose Matrices.
Each \l {Node}'s transform becomes a transform of the bone with the
corresponding index in the list.
\qml
Skin {
id: skin0
joints: [
node0,
node1,
node2
]
inverseBindPoses: [
Qt.matrix4x4(...),
Qt.matrix4x4(...),
Qt.matrix4x4(...)
]
}
\endqml
\note \l {Skeleton} and \l {Joint} will be deprecated.
|
7413 |
- |
| qquick3dskin_p.h |
|
2074 |
- |
| qquick3dskymaterial.cpp |
!
\qmltype SkyMaterial
\inqmlmodule QtQuick3D
\since 6.12
\brief Renders a procedural sky and generates image-based lighting data.
SkyMaterial renders a sky environment into a cubemap using custom
fragment shader code. The resulting cubemap can optionally be filtered
and used as image-based lighting (IBL) for physically based rendering.
The shader is evaluated for all six faces of the cubemap and may
implement arbitrary procedural skies, gradients, or analytical models.
The generated cubemap is used both as the visible scene background and
as the source for image-based lighting when enabled.
\note Changes to shader code or properties may take a frame or more
before being reflected in the generated IBL.
A ready-made SkyMaterial with a gradient sky, ground, and sun disk is
available as \l ProceduralSkyMaterial in the \l{Qt Quick 3D Helpers QML
Types}{QtQuick3D.Helpers} module. It can be used directly without writing
any shader code.
\section1 Shader
The shader has access to the built-in variable \c qt_eyeDir (\c vec3),
which provides the non-normalized direction vector from the center of
the cubemap to the current sample direction.
The fragment shader must define a \c MAIN() entry point, which is
executed for each fragment generated while rendering the cubemap.
The final pixel color must be written to \c FRAGCOLOR (\c vec4), which
is the output variable of the fragment shader.
A minimal shader example:
\badcode
void MAIN()
{
vec3 dir = normalize(qt_eyeDir);
// Output color (encoded direction as RGB)
FRAGCOLOR = vec4(dir * 0.5 + 0.5, 1.0);
}
\endcode
Custom QML properties declared on SkyMaterial are automatically exposed
as uniforms in the fragment shader. The property name must match the GLSL
variable name. No explicit uniform declaration is required.
The following type mappings are supported:
\table
\header
\li QML Type
\li Shader Type
\li Notes
\row \li real, int, bool \li float, int, bool \li
\row \li color \li vec4 \li sRGB is converted to linear space
\row \li vector2d, vector3d, vector4d \li vec2, vec3, vec4 \li
\row \li matrix4x4 \li mat4 \li
\row \li quaternion \li vec4 \li w stores scalar component
\row \li rect \li vec4 \li
\row \li point, size \li vec2 \li
\row \li Texture \li sampler2D, samplerCube, sampler3D
\li The sampler type follows the referenced texture: a \l CubeMapTexture
becomes a \c samplerCube, a \l Texture with 3D texture data becomes a
\c sampler3D, and any other \l Texture becomes a \c sampler2D.
\endtable
A texture property that has no texture set is not exposed to the shader at
all, so referencing it in the shader code results in a compilation error.
\sa SceneEnvironment::skyMaterial, ProceduralSkyMaterial
|
13461 |
- |
| qquick3dskymaterial_p.h |
|
3885 |
- |
| qquick3dspecularglossymaterial.cpp |
!
\qmltype SpecularGlossyMaterial
\inherits Material
\inqmlmodule QtQuick3D
\brief Lets you define a material for 3D items using the specular/glossiness workflow.
Before a Model can be rendered in a scene, it must have at least one material attached
to it that describes how the mesh should be shaded. The SpecularGlossyMaterial is a PBR
specular/glossiness material that aims at being an easy to use material with a minimal
set of parameters.
In addition to having few parameters, all input values are strictly normalized
between 0 and 1 and have sensible defaults, meaning even without changing any values,
the material can be used to shader a model. For an introduction on how the
different properties of the SpecularGlossyMaterial affects how a model is shaded,
see the \l{Qt Quick 3D - Principled Material Example}{Principled Material example} which
provides a mode for using the Specular/Glossy workflow.
Alternatively to use the metallic/roughness workflow instead use \l {PrincipledMaterial}.
\section1 Specular/Glossiness workflow
The SpecularGlossyMaterial provides a way to create materials using a specular/glossiness
type workflow. The main properties of the material is controlled through
the \l {SpecularGlossyMaterial::specularMap} {specular},
\l {SpecularGlossyMaterial::glossinessMap} {glossiness},
and \l {SpecularGlossyMaterial::albedoMap} {albedo} properties.
\section2 Specular
The \l {SpecularGlossyMaterial::specularMap} {specularColor} property describes the specular
amount and color of an object's surface. For reflective materials the main color
contribution, comes from this property.
\section2 Glossiness
The \l {SpecularGlossyMaterial::glossinessMap} {glossiness} of a material describes the
condition of an object's surface. A high \c glossiness value means the object has a smooth
surface and therefore be more reflective then a material with a lower \c glossiness value.
\section2 Albedo
The \l {SpecularGlossyMaterial::albedoMap} {albedoColor} property describes the diffuse color
of the material, and unlike the \l {PrincipledMaterial}'s base color, the albedo
does not contain any information about the material reflectance. That means that for
reflective surfaces the albedo's color value should be set to a black tint, as that
will allow for the specular color to contribute.
|
68230 |
- |
| qquick3dspecularglossymaterial_p.h |
|
25712 |
- |
| qquick3dspotlight.cpp |
!
\qmltype SpotLight
\inherits Light
\inqmlmodule QtQuick3D
\brief Defines a spot light in the scene.
\since 5.15
The spot light emits light towards one direction in a cone shape, which is defined by the
\l {coneAngle} property. The light intensity diminishes when approaching the \l {coneAngle}.
The angle at which the light intensity starts to diminish is defined by \l {innerConeAngle}.
Both angles are defined in degrees.
Inside the \l {innerConeAngle}, the spot light behaves similarly to the point light.
There the light intensity diminishes according to inverse-square-law. However, the fade-off
(and range) can be controlled with the \l {constantFade}, \l {linearFade}, and
\l quadraticFade properties. Light attenuation is calculated using the formula:
\l {constantFade} + \c distance * (\l {linearFade} * 0.01) + \c distance * (\l {quadraticFade} * 0.0001)^2
Let's look at a simple example. Here a SpotLight is placed at 300 on the Z
axis, so halfway between the camera and the scene center. By default the
light is emitting in the direction of the Z axis. The \l {Light::}{brightness} is
increased to 10 to make it look more like a typical spot light.
\qml
import QtQuick
import QtQuick3D
View3D {
anchors.fill: parent
PerspectiveCamera { z: 600 }
SpotLight {
z: 300
brightness: 10
ambientColor: Qt.rgba(0.1, 0.1, 0.1, 1.0)
}
Model {
source: "#Rectangle"
scale: Qt.vector3d(10, 10, 10)
z: -100
materials: PrincipledMaterial { }
}
Model {
source: "#Sphere"
scale: Qt.vector3d(2, 2, 2)
materials: PrincipledMaterial {
baseColor: "#40c060"
roughness: 0.1
}
}
}
\endqml
\image spotlight-1.png {Green sphere with spotlight cone angle visualization}
Rotations happens similarly to \l DirectionalLight. Here we want to light to
emit more to the right, so we rotate around the Y axis by -20 degrees. The
cone is reduced by setting coneAngle to 30 instead of the default 40. We
also make the intensity start diminish earlier, by changing innerConeAngle
to 10.
\qml
SpotLight {
z: 300
brightness: 10
ambientColor: Qt.rgba(0.1, 0.1, 0.1, 1.0)
eulerRotation.y: -20
coneAngle: 30
innerConeAngle: 10
}
\endqml
\image spotlight-2.png {Green sphere with spotlight inner and outer cone angles}
For further usage examples, see \l{Qt Quick 3D - Lights Example}.
\sa DirectionalLight, PointLight, {Shadow Mapping}
|
7915 |
- |
| qquick3dspotlight_p.h |
|
2168 |
- |
| qquick3dtexture.cpp |
!
\qmltype Texture
\inherits Object3D
\inqmlmodule QtQuick3D
\brief Defines a texture for use in 3D scenes.
A texture is technically any array of pixels (1D, 2D or 3D) and its related
settings, such as minification and magnification filters, scaling and UV
transformations.
The Texture type in Qt Quick 3D represents a two-dimensional image. Its use
is typically to map onto / wrap around three-dimensional geometry to emulate
additional detail which cannot be efficiently modelled in 3D. It can also be
used to emulate other lighting effects, such as reflections.
While Texture itself always represents a 2D texture, other kinds of
textures are available as well via subclasses of Texture. For example, to
create a cube map texture with 6 faces, use the \l CubeMapTexture type.
When the geometry is being rendered, each location on its surface will be
transformed to a corresponding location in the texture by transforming and
interpolating the UV coordinates (texture coordinate) that have been set for
the mesh's vertexes. The fragment shader program that is being used to render
the active material will then typically sample the material's texture(s) at
the given coordinates and use the sampled data in its light calculations.
\note A Material may use multiple textures to give the desired interaction with
light in the 3D scene. It can represent the color of each texel on the geometry
surface, but also other attributes of the surface. For instance, a "normal map"
can represent the deviation from the geometry normals for each texel on the
surface, emulating light interaction with finer details on the surface, such
as cracks or bumps. See \l{Qt Quick 3D - Principled Material Example}{the principled
material example} for a demonstration of a material with multiple texture maps.
Texture objects can source image data from:
\list
\li an image or texture file by using the \l source property,
\li a Qt Quick \l Item by using the sourceItem property,
\li or by setting the \l textureData property to a \l TextureData item
subclass for defining the custom texture contents.
\endlist
The following example maps the image "madewithqt.png" onto the default sphere
mesh, and scales the UV coordinates to tile the image on the sphere surface.
\qml
Model {
source: "#Sphere"
materials: [ PrincipledMaterial {
baseColorMap: Texture {
source: "madewithqt.png"
scaleU: 4.0
scaleV: 4.0
}
}
]
}
\endqml
The result looks as follows:
\table
\header
\li Original image
\li Mapped onto a sphere
\row
\li \image madewithqt.png {Built with Qt logo}
\li \image spheremap.png {Sphere with Qt logo as texture map}
\endtable
\sa {Qt Quick 3D - Procedural Texture Example}
|
58928 |
- |
| qquick3dtexture_p.h |
|
9520 |
- |
| qquick3dtexturedata.cpp |
!
\qmltype TextureData
\inherits Object3D
\inqmlmodule QtQuick3D
\nativetype QQuick3DTextureData
\brief Base type for custom texture data.
Custom texture data allows using application-generated texture data, that
can possibly change dynamically as well. To use custom texture data set the
\l{Texture::textureData}{textureData} property of \l {Texture} to reference
a TextureData object.
Custom Texture data is implemented in C++ by creating a QQuick3DTextureData
instance, often subclassing it. The QQuick3DTextureData type is registered to
QML under the name of TextureData. Once the subclass is registered to QML,
Texture objects can start referencing it.
An example of when to use this API is when there is a need to procedurally
generate a texture at runtime rather than loading a static image from a file.
\code
import MyCustomTexture 1.0
Model {
source: "#Cube"
materials: [
DefaultMaterial {
diffuseMap: diffuseMapCustomTexture
}
]
}
Texture {
id: diffuseMapCustomTexture
textureData: MyCustomTextureData {
}
}
\endcode
\sa Texture
|
16599 |
- |
| qquick3dtexturedata.h |
|
1900 |
- |
| qquick3dtexturedata_p.h |
|
974 |
- |
| qquick3dutils_p.h |
|
1445 |
- |
| qquick3dviewport.cpp |
Transforms viewport coordinates to 2D scene coordinates.
Returns the point in targetItem corresponding to \a viewportPoint,
assuming that targetItem is mapped onto sceneParentNode.
If it's no longer a "hit" on sceneParentNode, returns the last-good point.
|
92539 |
- |
| qquick3dviewport_p.h |
|
12307 |
- |
| Qt6Quick3DMacros.cmake |
|
6390 |
- |
| qtquick3dglobal.h |
|
311 |
- |
| qtquick3dglobal_p.h |
|
667 |
- |