summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/nodes/qentity.cpp44
-rw-r--r--src/doc/src/qmlextracontrollers.qdoc170
-rw-r--r--src/doc/src/qmlextramaterials.qdoc568
-rw-r--r--src/extras/defaults/qdiffusemapmaterial.cpp37
-rw-r--r--src/extras/defaults/qdiffusespecularmapmaterial.cpp35
-rw-r--r--src/extras/defaults/qfirstpersoncameracontroller.cpp54
-rw-r--r--src/extras/defaults/qforwardrenderer.cpp99
-rw-r--r--src/extras/defaults/qgoochmaterial.cpp21
-rw-r--r--src/extras/defaults/qnormaldiffusemapalphamaterial.cpp23
-rw-r--r--src/extras/defaults/qnormaldiffusemapmaterial.cpp40
-rw-r--r--src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp42
-rw-r--r--src/extras/defaults/qorbitcameracontroller.cpp68
-rw-r--r--src/extras/defaults/qorbitcameracontroller.h1
-rw-r--r--src/extras/defaults/qpervertexcolormaterial.cpp19
-rw-r--r--src/extras/defaults/qphongalphamaterial.cpp65
-rw-r--r--src/extras/defaults/qphongmaterial.cpp28
-rw-r--r--src/extras/geometries/qconegeometry.cpp200
-rw-r--r--src/extras/geometries/qconemesh.cpp93
-rw-r--r--src/extras/geometries/qcuboidgeometry.cpp82
-rw-r--r--src/extras/geometries/qcuboidmesh.cpp58
-rw-r--r--src/extras/geometries/qcylindergeometry.cpp27
-rw-r--r--src/extras/geometries/qcylindermesh.cpp12
-rw-r--r--src/extras/geometries/qplanegeometry.cpp27
-rw-r--r--src/extras/geometries/qplanemesh.cpp16
-rw-r--r--src/extras/geometries/qspheregeometry.cpp31
-rw-r--r--src/extras/geometries/qspheremesh.cpp16
-rw-r--r--src/extras/geometries/qtorusgeometry.cpp27
-rw-r--r--src/extras/geometries/qtorusmesh.cpp16
-rw-r--r--src/input/backend/inputhandler.cpp1
-rw-r--r--src/input/backend/mousedevice.cpp18
-rw-r--r--src/input/backend/mousedevice_p.h5
-rw-r--r--src/input/frontend/qinputsettings.cpp56
-rw-r--r--src/input/frontend/qmousedevice.cpp78
-rw-r--r--src/input/frontend/qmousedevice.h4
-rw-r--r--src/logic/qframeaction.cpp26
-rw-r--r--src/plugins/sceneparsers/assimp/assimpio.cpp1
-rw-r--r--src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml18
-rw-r--r--src/quick3d/quick3d/items/quick3dentity.cpp27
-rw-r--r--src/quick3d/quick3drender/items/quick3dbuffer.cpp5
-rw-r--r--src/quick3d/quick3drender/items/quick3dparameter.cpp4
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdata.cpp6
-rw-r--r--src/render/backend/commandexecuter.cpp8
-rw-r--r--src/render/backend/render-backend.pri10
-rw-r--r--src/render/backend/rendercommand_p.h2
-rw-r--r--src/render/backend/renderer.cpp6
-rw-r--r--src/render/backend/renderer_p.h2
-rw-r--r--src/render/backend/renderview.cpp127
-rw-r--r--src/render/backend/renderview_p.h46
-rw-r--r--src/render/backend/shaderparameterpack.cpp (renamed from src/render/backend/quniformvalue.cpp)34
-rw-r--r--src/render/backend/shaderparameterpack_p.h (renamed from src/render/backend/quniformvalue_p.h)125
-rw-r--r--src/render/backend/uniform.cpp164
-rw-r--r--src/render/backend/uniform_p.h208
-rw-r--r--src/render/framegraph/qcameraselector.cpp38
-rw-r--r--src/render/framegraph/qclearbuffers.cpp56
-rw-r--r--src/render/framegraph/qframegraphnode.cpp109
-rw-r--r--src/render/framegraph/qlayerfilter.cpp32
-rw-r--r--src/render/framegraph/qrendercapture.h2
-rw-r--r--src/render/framegraph/qrendersurfaceselector.cpp106
-rw-r--r--src/render/framegraph/qsortpolicy.cpp63
-rw-r--r--src/render/framegraph/qviewport.cpp54
-rw-r--r--src/render/frontend/qabstractfunctor.cpp36
-rw-r--r--src/render/frontend/qcamera.cpp391
-rw-r--r--src/render/frontend/qcameralens.cpp287
-rw-r--r--src/render/frontend/qpickingsettings.cpp89
-rw-r--r--src/render/frontend/qrendersettings.cpp100
-rw-r--r--src/render/frontend/qrendersettings.h1
-rw-r--r--src/render/frontend/qrendersettings_p.h2
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp153
-rw-r--r--src/render/graphicshelpers/graphicscontext_p.h56
-rw-r--r--src/render/graphicshelpers/graphicshelperes2.cpp145
-rw-r--r--src/render/graphicshelpers/graphicshelperes2_p.h3
-rw-r--r--src/render/graphicshelpers/graphicshelperes3.cpp11
-rw-r--r--src/render/graphicshelpers/graphicshelperes3_p.h4
-rw-r--r--src/render/graphicshelpers/graphicshelpergl2.cpp162
-rw-r--r--src/render/graphicshelpers/graphicshelpergl2_p.h3
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3.cpp258
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3.cpp275
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3_p.h6
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_p.h3
-rw-r--r--src/render/graphicshelpers/graphicshelpergl4.cpp277
-rw-r--r--src/render/graphicshelpers/graphicshelpergl4_p.h3
-rw-r--r--src/render/graphicshelpers/graphicshelperinterface_p.h3
-rw-r--r--src/render/io/qsceneloader.cpp130
-rw-r--r--src/render/jobs/loadscenejob.cpp36
-rw-r--r--src/render/jobs/loadscenejob_p.h8
-rw-r--r--src/render/jobs/renderviewjobutils.cpp21
-rw-r--r--src/render/jobs/renderviewjobutils_p.h10
-rw-r--r--src/render/materialsystem/material_p.h2
-rw-r--r--src/render/materialsystem/parameter.cpp12
-rw-r--r--src/render/materialsystem/parameter_p.h5
-rw-r--r--src/render/materialsystem/qeffect.cpp40
-rw-r--r--src/render/materialsystem/qfilterkey.cpp40
-rw-r--r--src/render/materialsystem/qmaterial.cpp80
-rw-r--r--src/render/materialsystem/qrenderpass.cpp112
-rw-r--r--src/render/materialsystem/qrenderpass.h4
-rw-r--r--src/render/materialsystem/qshaderprogram.cpp139
-rw-r--r--src/render/materialsystem/qtechnique.cpp92
-rw-r--r--src/render/materialsystem/shader_p.h2
-rw-r--r--src/render/materialsystem/shaderdata.cpp195
-rw-r--r--src/render/materialsystem/shaderdata_p.h25
-rw-r--r--src/render/renderstates/qblendequation.cpp43
-rw-r--r--src/render/renderstates/qblendequationarguments.cpp38
-rw-r--r--src/render/renderstates/qblendequationarguments.h1
-rw-r--r--src/render/renderstates/qpointsize.cpp31
-rw-r--r--src/render/texture/qabstracttextureimage.cpp41
-rw-r--r--src/render/texture/qtextureimage.cpp81
106 files changed, 4474 insertions, 2342 deletions
diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp
index 67238ca7e..ea3523c0c 100644
--- a/src/core/nodes/qentity.cpp
+++ b/src/core/nodes/qentity.cpp
@@ -55,15 +55,6 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-QEntityPrivate::QEntityPrivate()
- : QNodePrivate()
- , m_parentEntityId()
-{}
-
-QEntityPrivate::~QEntityPrivate()
-{
-}
-
/*!
\class Qt3DCore::QEntity
\inmodule Qt3DCore
@@ -78,14 +69,25 @@ QEntityPrivate::~QEntityPrivate()
backend aspect will be able to interpret and process an Entity by
recognizing which components it is made up of. One aspect may decide to only
process entities composed of a single Qt3DCore::QTransform component whilst
- another may focus on Qt3DCore::QMouseHandler.
+ another may focus on Qt3DInput::QMouseHandler.
\sa Qt3DCore::QComponent, Qt3DCore::QTransform
-*/
+ */
+
+/*! \internal */
+QEntityPrivate::QEntityPrivate()
+ : QNodePrivate()
+ , m_parentEntityId()
+{}
+
+/*! \internal */
+QEntityPrivate::~QEntityPrivate()
+{
+}
/*!
Constructs a new Qt3DCore::QEntity instance with \a parent as parent.
-*/
+ */
QEntity::QEntity(QNode *parent)
: QEntity(*new QEntityPrivate, parent) {}
@@ -113,11 +115,11 @@ QEntity::~QEntity()
\relates Qt3DCore::QEntity
List of QComponent pointers.
-*/
+ */
/*!
Returns the list of Qt3DCore::QComponent instances the entity is referencing.
-*/
+ */
QComponentVector QEntity::components() const
{
Q_D(const QEntity);
@@ -129,7 +131,7 @@ QComponentVector QEntity::components() const
\note If the Qt3DCore::QComponent has no parent, the Qt3DCore::QEntity will set
itself as its parent thereby taking ownership of the component.
-*/
+ */
void QEntity::addComponent(QComponent *comp)
{
Q_D(QEntity);
@@ -161,7 +163,7 @@ void QEntity::addComponent(QComponent *comp)
/*!
Removes the reference to \a comp.
-*/
+ */
void QEntity::removeComponent(QComponent *comp)
{
Q_CHECK_PTR(comp);
@@ -186,7 +188,7 @@ void QEntity::removeComponent(QComponent *comp)
immediate parent isn't a Qt3DCore::QEntity, this function traverses up the
scene hierarchy until a parent Qt3DCore::QEntity is found. If no
Qt3DCore::QEntity parent can be found, returns null.
-*/
+ */
QEntity *QEntity::parentEntity() const
{
Q_D(const QEntity);
@@ -208,10 +210,10 @@ QEntity *QEntity::parentEntity() const
}
/*!
- Returns the Qt3DCore::QNodeId id of the parent Qt3DCore::QEntity instance of the
- current Qt3DCore::QEntity object. The QNodeId isNull method will return true if
- there is no Qt3DCore::QEntity parent of the current Qt3DCore::QEntity in the scene
- hierarchy.
+ Returns the Qt3DCore::QNodeId id of the parent Qt3DCore::QEntity instance of the
+ current Qt3DCore::QEntity object. The QNodeId isNull method will return true if
+ there is no Qt3DCore::QEntity parent of the current Qt3DCore::QEntity in the scene
+ hierarchy.
*/
QNodeId QEntityPrivate::parentEntityId() const
{
diff --git a/src/doc/src/qmlextracontrollers.qdoc b/src/doc/src/qmlextracontrollers.qdoc
new file mode 100644
index 000000000..737d0f823
--- /dev/null
+++ b/src/doc/src/qmlextracontrollers.qdoc
@@ -0,0 +1,170 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmltype FirstPersonCameraController
+ \inqmlmodule Qt3D.Extras
+ \brief The FirstPersonCameraController allows controlling the scene camera
+ from the first person perspective.
+ \since 5.7
+ \inherits Qt3D.Core::Entity
+
+ The FirstPersonCameraController allows controlling the scene camera from the first person
+ perspective.
+
+ The controls are:
+ \table
+ \header
+ \li Input
+ \li Action
+ \row
+ \li Left mouse button
+ \li While the left mouse button is pressed, mouse movement along x-axis pans the camera and
+ movement along y-axis tilts it.
+ \row
+ \li Shift key
+ \li Turns the fine motion control active while pressed. Makes mouse pan and tilt less
+ sensitive.
+ \row
+ \li Arrow keys
+ \li Move the camera horizontally relative to camera viewport.
+ \row
+ \li Page up and page down keys
+ \li Move the camera vertically relative to camera viewport.
+ \endtable
+*/
+/*!
+ \qmlproperty Camera FirstPersonCameraController::camera
+
+ Holds the currently controlled camera.
+*/
+/*!
+ \qmlproperty real FirstPersonCameraController::linearSpeed
+
+ Holds the current linear speed of the camera controller. Linear speed determines the
+ movement speed of the camera.
+*/
+/*!
+ \qmlproperty real FirstPersonCameraController::lookSpeed
+
+ Holds the current look speed of the camera controller. The look speed determines the turn rate
+ of the camera pan and tilt.
+*/
+/*!
+ \qmlproperty real FirstPersonCameraController::acceleration
+
+ Holds the current acceleration.
+ Specifies the rate at which the camera linear speed increases when a key is held.
+ If the acceleration is negative, the linear speed stays constant.
+ Defaults to -1.0.
+*/
+/*!
+ \qmlproperty real FirstPersonCameraController::deceleration
+
+ Specifies the rate at which the camera linear speed decreases when a key is released.
+ If the deceleration is negative, the linear speed stays constant.
+ Defaults to -1.0.
+*/
+
+/*!
+ \qmltype OrbitCameraController
+ \inqmlmodule Qt3D.Extras
+ \brief The OrbitCameraController class allows controlling the scene camera along orbital path.
+ \since 5.7
+ \inherits Qt3D.Core::Entity
+
+ The OrbitCameraController class allows controlling the scene camera along orbital path.
+
+ The controls are:
+ \table
+ \header
+ \li Input
+ \li Action
+ \row
+ \li Left mouse button
+ \li While the left mouse button is pressed, mouse movement along x-axis moves the camera
+ left and right and movement along y-axis moves it up and down.
+ \row
+ \li Right mouse button
+ \li While the right mouse button is pressed, mouse movement along x-axis pans the camera
+ around the camera view center and movement along y-axis tilts it around the camera
+ view center.
+ \row
+ \li Both left and right mouse button
+ \li While both the left and the right mouse button are pressed, mouse movement along y-axis
+ zooms the camera in and out without changing the view center.
+ \row
+ \li Arrow keys
+ \li Move the camera vertically and horizontally relative to camera viewport.
+ \row
+ \li Page up and page down keys
+ \li Move the camera forwards and backwards.
+ \row
+ \li Shift key
+ \li Changes the behavior of the up and down arrow keys to zoom the camera in and out
+ without changing the view center. The other movement keys are disabled.
+ \row
+ \li Alt key
+ \li Changes the behovior of the arrow keys to pan and tilt the camera around the view
+ center. Disables the page up and page down keys.
+ \endtable
+*/
+/*!
+ \qmlproperty Camera OrbitCameraController::camera
+
+ Holds the currently controlled camera.
+*/
+/*!
+ \qmlproperty real OrbitCameraController::linearSpeed
+
+ Holds the current linear speed of the camera controller. Linear speed determines the
+ movement speed of the camera.
+*/
+/*!
+ \qmlproperty real OrbitCameraController::lookSpeed
+
+ Holds the current look speed of the camera controller. The look speed determines the turn rate
+ of the camera pan and tilt.
+*/
+/*!
+ \qmlproperty real OrbitCameraController::zoomLimit
+
+ Holds the current zoom-in limit. The zoom-in limit determines how close to the view center
+ the camera can be zoomed.
+*/
diff --git a/src/doc/src/qmlextramaterials.qdoc b/src/doc/src/qmlextramaterials.qdoc
new file mode 100644
index 000000000..48f1a2326
--- /dev/null
+++ b/src/doc/src/qmlextramaterials.qdoc
@@ -0,0 +1,568 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmltype DiffuseMapMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The DiffuseMapMaterial provides a default implementation of the phong lighting effect
+ where the diffuse light component is read from a texture map.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ \qmlproperty color DiffuseMapMaterial::ambient
+
+ Holds the current ambient color.
+*/
+/*!
+ \qmlproperty color DiffuseMapMaterial::specular
+
+ Holds the current specular color.
+*/
+/*!
+ \qmlproperty real DiffuseMapMaterial::shininess
+
+ Holds the current shininess.
+*/
+/*!
+ \qmlproperty real DiffuseMapMaterial::textureScale
+
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
+*/
+/*!
+ \qmlproperty TextureImage DiffuseMapMaterial::diffuse
+
+ Holds the current texture used as the diffuse map.
+
+ By default, the diffuse texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+
+/*!
+ \qmltype DiffuseSpecularMapMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The DiffuseSpecularMapMaterial provides a default implementation of the phong lighting
+ effect where the diffuse and specular light components are read from texture maps.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ \qmlproperty color DiffuseSpecularMapMaterial::ambient
+
+ Holds the current ambient color.
+*/
+/*!
+ \qmlproperty TextureImage DiffuseSpecularMapMaterial::diffuse
+
+ Holds the current diffuse map texture.
+
+ By default, the diffuse texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty TextureImage DiffuseSpecularMapMaterial::specular
+
+ Holds the current specular map texture.
+
+ By default, the specular texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty real DiffuseSpecularMapMaterial::shininess
+
+ Holds the current shininess.
+*/
+/*!
+ \qmlproperty real DiffuseSpecularMapMaterial::textureScale
+
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
+*/
+
+/*!
+ \qmltype GoochMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The GoochMaterial provides a material that implements the Gooch
+ shading model, popular in CAD and CAM applications.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ The Gooch lighting model uses both color and brightness to help show the
+ curvature of 3D surfaces. This is often better than models such as Phong
+ that rely purely upon changes in brightness. In situations such as in CAD
+ and CAM applications where photorealism is not a goal, the Gooch shading
+ model in conjunction with some kind of silhouette edge inking is a popular
+ solution.
+
+ The Gooch lighting model is explained fully in the \l{original Gooch
+ paper}. The Gooch model mixes a diffuse object color with a user-provided
+ cool color and warm color to produce the end points of a color ramp that is
+ used to shade the object based upon the cosine of the angle between the
+ vector from the fragment to the light source and the fragment's normal
+ vector. Optionally, a specular highlight can be added on top. The relative
+ contributions to the cool and warm colors by the diffuse color are
+ controlled by the alpha and beta properties respecitvely.
+
+ This material uses an effect with a single render pass approach and
+ performs per fragment lighting. Techniques are provided for OpenGL 2,
+ OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ \qmlproperty color GoochMaterial::diffuse
+
+ Holds the current diffuse color.
+*/
+/*!
+ \qmlproperty color GoochMaterial::specular
+
+ Holds the current specular color.
+*/
+/*!
+ \qmlproperty color GoochMaterial::coolColor
+
+ Holds the current coolColor color.
+*/
+/*!
+ \qmlproperty color GoochMaterial::warmColor
+
+ Holds the current warmColor color.
+*/
+/*!
+ \qmlproperty real GoochMaterial::alpha
+
+ Holds the current alpha value. The start point of the color ramp
+ used by the Gooch shader is calculated as {c = cool + alpha * diffuse}.
+*/
+/*!
+ \qmlproperty real GoochMaterial::beta
+
+ Holds the current beta value. The start point of the color ramp
+ used by the Gooch shader is calculated as {c = warm + beta * diffuse}.
+*/
+/*!
+ \qmlproperty real GoochMaterial::shininess
+
+ Holds the current shininess value. Higher values of shininess result in
+ a smaller and brighter highlight.
+*/
+
+/*!
+ \qmltype NormalDiffuseMapAlphaMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The NormalDiffuseMapAlphaMaterial provides a specialization of NormalDiffuseMapMaterial
+ with alpha coverage and a depth test performed in the rendering pass.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ \qmlproperty color NormalDiffuseMapAlphaMaterial::ambient
+
+ Holds the current ambient color.
+*/
+/*!
+ \qmlproperty TextureImage NormalDiffuseMapAlphaMaterial::diffuse
+
+ Holds the current diffuse map texture.
+
+ By default, the diffuse texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty color NormalDiffuseMapAlphaMaterial::specular
+
+ Holds the current specular color.
+*/
+/*!
+ \qmlproperty TextureImage NormalDiffuseMapAlphaMaterial::normal
+
+ Holds the current normal map texture.
+
+ By default, the normal texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty real NormalDiffuseMapAlphaMaterial::shininess
+
+ Holds the current shininess.
+*/
+/*!
+ \qmlproperty real NormalDiffuseMapAlphaMaterial::textureScale
+
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
+*/
+
+/*!
+ \qmltype NormalDiffuseMapMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The NormalDiffuseMapMaterial provides a default implementation of the phong lighting
+ and bump effect where the diffuse light component is read from a texture map and the normals of
+ the mesh being rendered from a normal texture map.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ \qmlproperty color NormalDiffuseMapMaterial::ambient
+
+ Holds the current ambient color.
+*/
+/*!
+ \qmlproperty TextureImage NormalDiffuseMapMaterial::diffuse
+
+ Holds the current diffuse map texture.
+
+ By default, the diffuse texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty color NormalDiffuseMapMaterial::specular
+
+ Holds the current specular color.
+*/
+/*!
+ \qmlproperty TextureImage NormalDiffuseMapMaterial::normal
+
+ Holds the current normal map texture.
+
+ By default, the normal texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty real NormalDiffuseMapMaterial::shininess
+
+ Holds the current shininess.
+*/
+/*!
+ \qmlproperty real NormalDiffuseMapMaterial::textureScale
+
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
+*/
+
+/*!
+ \qmltype NormalDiffuseSpecularMapMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The NormalDiffuseSpecularMapMaterial provides a default implementation of the phong
+ lighting and bump effect where the diffuse and specular light components are read from texture
+ maps and the normals of the mesh being rendered from a normal texture map.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ \qmlproperty color NormalDiffuseSpecularMapMaterial::ambient
+
+ Holds the current ambient color.
+*/
+/*!
+ \qmlproperty TextureImage NormalDiffuseSpecularMapMaterial::diffuse
+
+ Holds the current diffuse map texture.
+
+ By default, the diffuse texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty TextureImage NormalDiffuseSpecularMapMaterial::specular
+
+ Holds the current specular map texture.
+
+ By default, the specular texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty TextureImage NormalDiffuseSpecularMapMaterial::normal
+
+ Holds the current normal map texture.
+
+ By default, the normal texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+/*!
+ \qmlproperty real NormalDiffuseSpecularMapMaterial::shininess
+
+ Holds the current shininess.
+*/
+/*!
+ \qmlproperty real NormalDiffuseSpecularMapMaterial::textureScale
+
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
+*/
+
+/*!
+ \qmltype PerVertexColorMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The PerVertexColorMaterial class provides a default implementation for rendering the
+ color properties set for each vertex.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ This lighting effect is based on the combination of 2 lighting components ambient and diffuse.
+ Ambient is set by the vertex color.
+ Diffuse takes in account the normal distribution of each vertex.
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rough surface reflections with the lights
+ \endlist
+
+ This material uses an effect with a single render pass approach and forms fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ \qmltype PhongAlphaMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The PhongAlphaMaterial class provides a default implementation of
+ the phong lighting effect with alpha.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse
+ and specular. The relative strengths of these components are controlled by means of their
+ reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \li Alpha is the transparency of the surface between 0 (fully transparent) and 1 (opaque).
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ \qmlproperty color PhongAlphaMaterial::ambient
+
+ Holds the current ambient color.
+*/
+/*!
+ \qmlproperty color PhongAlphaMaterial::diffuse
+
+ Holds the current diffuse color.
+*/
+/*!
+ \qmlproperty color PhongAlphaMaterial::specular
+
+ Holds the current specular color.
+*/
+/*!
+ \qmlproperty real PhongAlphaMaterial::shininess
+
+ Holds the current shininess.
+*/
+/*!
+ \qmlproperty real PhongAlphaMaterial::alpha
+
+ Holds the alpha component of the object which varies between 0 and 1.
+
+ The default value is 0.5.
+*/
+
+/*!
+ \qmltype PhongMaterial
+ \inqmlmodule Qt3D.Extras
+ \brief The PhongMaterial class provides a default implementation of the phong lighting effect.
+ \since 5.7
+ \inherits Qt3D.Render::Material
+
+ The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse
+ and specular. The relative strengths of these components are controlled by means of their
+ reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ \qmlproperty color PhongMaterial::ambient
+
+ Holds the current ambient color.
+*/
+/*!
+ \qmlproperty color PhongMaterial::diffuse
+
+ Holds the current diffuse color.
+*/
+/*!
+ \qmlproperty color PhongMaterial::specular
+
+ Holds the current specular color.
+*/
+/*!
+ \qmlproperty real PhongMaterial::shininess
+
+ Holds the current shininess.
+*/
diff --git a/src/extras/defaults/qdiffusemapmaterial.cpp b/src/extras/defaults/qdiffusemapmaterial.cpp
index 854d0a809..b3aa3bf00 100644
--- a/src/extras/defaults/qdiffusemapmaterial.cpp
+++ b/src/extras/defaults/qdiffusemapmaterial.cpp
@@ -178,14 +178,16 @@ void QDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
}
/*!
- \class Qt3DRender::QDiffuseMapMaterial
- \brief The QDiffuseMapMaterial provides a default implementation of the phong lighting effect where the diffuse light component
- is read from a texture map.
- \inmodule Qt3DRender
- \since 5.5
+ \class Qt3DExtras::QDiffuseMapMaterial
+ \brief The QDiffuseMapMaterial provides a default implementation of the phong lighting effect
+ where the diffuse light component is read from a texture map.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DRender::QMaterial
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
\list
\li Ambient is the color that is emitted by an object without any other light source.
@@ -194,12 +196,12 @@ void QDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
\li The shininess of a surface is controlled by a float property.
\endlist
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
*/
/*!
- Constructs a new Qt3DRender::QDiffuseMapMaterial instance with parent object \a parent.
+ Constructs a new QDiffuseMapMaterial instance with parent object \a parent.
*/
QDiffuseMapMaterial::QDiffuseMapMaterial(QNode *parent)
: QMaterial(*new QDiffuseMapMaterialPrivate, parent)
@@ -216,7 +218,7 @@ QDiffuseMapMaterial::~QDiffuseMapMaterial()
}
/*!
- \property Qt3DRender::QDiffuseMapMaterial::ambient
+ \property QDiffuseMapMaterial::ambient
Holds the current ambient color.
*/
@@ -228,7 +230,7 @@ QColor QDiffuseMapMaterial::ambient() const
}
/*!
- \property Qt3DRender::QDiffuseMapMaterial::specular
+ \property QDiffuseMapMaterial::specular
Holds the current specular color.
*/
@@ -239,7 +241,7 @@ QColor QDiffuseMapMaterial::specular() const
}
/*!
- \property Qt3DRender::QDiffuseMapMaterial::shininess
+ \property QDiffuseMapMaterial::shininess
Holds the current shininess as a float value.
*/
@@ -250,9 +252,9 @@ float QDiffuseMapMaterial::shininess() const
}
/*!
- \property Qt3DRender::QDiffuseMapMaterial::diffuse
+ \property QDiffuseMapMaterial::diffuse
- Holds the current QTexture used as the diffuse map.
+ Holds the current texture used as the diffuse map.
By default, the diffuse texture has the following properties:
@@ -270,9 +272,10 @@ QAbstractTexture *QDiffuseMapMaterial::diffuse() const
}
/*!
- \property Qt3DRender::QDiffuseMapMaterial::textureScale
+ \property QDiffuseMapMaterial::textureScale
- Holds the current texture scale as a float value.
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
*/
float QDiffuseMapMaterial::textureScale() const
diff --git a/src/extras/defaults/qdiffusespecularmapmaterial.cpp b/src/extras/defaults/qdiffusespecularmapmaterial.cpp
index a4ccb6121..4b79eea2b 100644
--- a/src/extras/defaults/qdiffusespecularmapmaterial.cpp
+++ b/src/extras/defaults/qdiffusespecularmapmaterial.cpp
@@ -185,14 +185,16 @@ void QDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const QVarian
}
/*!
- \class Qt3DRender::QDiffuseSpecularMapMaterial
- \brief The QDiffuseSpecularMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse and specular light components
- are read from texture maps.
- \inmodule Qt3DRender
- \since 5.5
+ \class Qt3DExtras::QDiffuseSpecularMapMaterial
+ \brief The QDiffuseSpecularMapMaterial provides a default implementation of the phong lighting
+ effect where the diffuse and specular light components are read from texture maps.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DRender::QMaterial
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
\list
\li Ambient is the color that is emitted by an object without any other light source.
@@ -201,12 +203,12 @@ void QDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const QVarian
\li The shininess of a surface is controlled by a float property.
\endlist
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
*/
/*!
- Constructs a new Qt3DRender::QDiffuseSpecularMapMaterial instance with parent object \a parent.
+ Constructs a new QDiffuseSpecularMapMaterial instance with parent object \a parent.
*/
QDiffuseSpecularMapMaterial::QDiffuseSpecularMapMaterial(QNode *parent)
: QMaterial(*new QDiffuseSpecularMapMaterialPrivate, parent)
@@ -223,7 +225,7 @@ QDiffuseSpecularMapMaterial::~QDiffuseSpecularMapMaterial()
}
/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::ambient
+ \property QDiffuseSpecularMapMaterial::ambient
Holds the current ambient color.
*/
@@ -234,7 +236,7 @@ QColor QDiffuseSpecularMapMaterial::ambient() const
}
/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::diffuse
+ \property QDiffuseSpecularMapMaterial::diffuse
Holds the current diffuse map texture.
@@ -254,7 +256,7 @@ QAbstractTexture *QDiffuseSpecularMapMaterial::diffuse() const
}
/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::specular
+ \property QDiffuseSpecularMapMaterial::specular
Holds the current specular map texture.
@@ -274,7 +276,7 @@ QAbstractTexture *QDiffuseSpecularMapMaterial::specular() const
}
/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::shininess
+ \property QDiffuseSpecularMapMaterial::shininess
Holds the current shininess as a float value.
*/
@@ -285,9 +287,10 @@ float QDiffuseSpecularMapMaterial::shininess() const
}
/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::textureScale
+ \property QDiffuseSpecularMapMaterial::textureScale
- Holds the current texture scale as a float value.
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
*/
float QDiffuseSpecularMapMaterial::textureScale() const
{
diff --git a/src/extras/defaults/qfirstpersoncameracontroller.cpp b/src/extras/defaults/qfirstpersoncameracontroller.cpp
index 37892d3d3..19446d3ba 100644
--- a/src/extras/defaults/qfirstpersoncameracontroller.cpp
+++ b/src/extras/defaults/qfirstpersoncameracontroller.cpp
@@ -188,12 +188,45 @@ void QFirstPersonCameraControllerPrivate::_q_onTriggered(float dt)
m_tyAxis->value() * m_linearSpeed,
m_tzAxis->value() * m_linearSpeed) * dt);
if (m_leftMouseButtonAction->isActive()) {
- m_camera->pan(m_rxAxis->value() * m_lookSpeed * dt, m_firstPersonUp);
- m_camera->tilt(m_ryAxis->value() * m_lookSpeed * dt);
+ float lookSpeed = m_lookSpeed;
+ if (m_fineMotionAction->isActive())
+ lookSpeed *= 0.2f;
+ m_camera->pan(m_rxAxis->value() * lookSpeed * dt, m_firstPersonUp);
+ m_camera->tilt(m_ryAxis->value() * lookSpeed * dt);
}
}
}
+/*!
+ \class Qt3DExtras::QFirstPersonCameraController
+ \brief The QFirstPersonCameraController class allows controlling the scene camera
+ from the first person perspective.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DCore::QEntity
+
+ The controls are:
+ \table
+ \header
+ \li Input
+ \li Action
+ \row
+ \li Left mouse button
+ \li While the left mouse button is pressed, mouse movement along x-axis pans the camera and
+ movement along y-axis tilts it.
+ \row
+ \li Shift key
+ \li Turns the fine motion control active while pressed. Makes mouse pan and tilt less
+ sensitive.
+ \row
+ \li Arrow keys
+ \li Move the camera horizontally relative to camera viewport.
+ \row
+ \li Page up and page down keys
+ \li Move the camera vertically relative to camera viewport.
+ \endtable
+*/
+
QFirstPersonCameraController::QFirstPersonCameraController(Qt3DCore::QNode *parent)
: Qt3DCore::QEntity(*new QFirstPersonCameraControllerPrivate, parent)
{
@@ -205,18 +238,35 @@ QFirstPersonCameraController::~QFirstPersonCameraController()
{
}
+/*!
+ \property QFirstPersonCameraController::camera
+
+ Holds the currently controlled camera.
+*/
Qt3DRender::QCamera *QFirstPersonCameraController::camera() const
{
Q_D(const QFirstPersonCameraController);
return d->m_camera;
}
+/*!
+ \property QFirstPersonCameraController::linearSpeed
+
+ Holds the current linear speed of the camera controller. Linear speed determines the
+ movement speed of the camera.
+*/
float QFirstPersonCameraController::linearSpeed() const
{
Q_D(const QFirstPersonCameraController);
return d->m_linearSpeed;
}
+/*!
+ \property QFirstPersonCameraController::lookSpeed
+
+ Holds the current look speed of the camera controller. The look speed determines the turn rate
+ of the camera pan and tilt.
+*/
float QFirstPersonCameraController::lookSpeed() const
{
Q_D(const QFirstPersonCameraController);
diff --git a/src/extras/defaults/qforwardrenderer.cpp b/src/extras/defaults/qforwardrenderer.cpp
index 43d8c1029..d556b58d3 100644
--- a/src/extras/defaults/qforwardrenderer.cpp
+++ b/src/extras/defaults/qforwardrenderer.cpp
@@ -85,26 +85,46 @@ void QForwardRendererPrivate::init()
}
/*!
- \class Qt3DRender::QForwardRenderer
- \brief The Qt3DRender::QForwardRenderer provides a default \l {QFrameGraph}{FrameGraph} implementation of a forward renderer.
- \inmodule Qt3DRender
- \since 5.5
-
- Forward rendering is how OpenGL is traditionally. It renders directly to the backbuffer
+ \class Qt3DExtras::QForwardRenderer
+ \brief The QForwardRenderer provides a default \l{Qt 3D Render Framegraph}{FrameGraph}
+ implementation of a forward renderer.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DRender::QTechniqueFilter
+
+ Forward rendering is what OpenGL traditionally uses. It renders directly to the backbuffer
one object at a time shading each one as it goes.
- Internally the Qt3DRender::QForwardRenderer is a subclass of Qt3DRender::QTechniqueFilter.
- This a is a single leaf Framegraph tree which contains a Qt3DRender::QViewport, a Qt3DRender::QCameraSelector
- and a Qt3DRender::QClearBuffers.
- The Qt3DRender::QForwardRenderer has a default requirement annotation whose name is "renderingStyle" and value "forward".
- If you need to filter out your techniques, you should do so based on that annotation.
+ QForwardRenderer is a single leaf \l{Qt 3D Render Framegraph}{FrameGraph} tree which contains
+ a Qt3DRender::QViewport, a Qt3DRender::QCameraSelector, and a Qt3DRender::QClearBuffers.
+ The QForwardRenderer has a default requirement filter key whose name is "renderingStyle" and
+ value "forward".
+ If you need to filter out your techniques, you should do so based on that filter key.
- By default the viewport occupies the whole screen and the clear color is white. Frustum culling is also enabled.
+ By default the viewport occupies the whole screen and the clear color is white.
+ Frustum culling is also enabled.
*/
-
/*!
- Constructs a new Qt3DRender::QForwardRenderer instance with parent object \a parent.
+ \qmltype ForwardRenderer
+ \brief The ForwardRenderer provides a default \l{Qt 3D Render Framegraph}{FrameGraph}
+ implementation of a forward renderer.
+ \since 5.7
+ \inqmlmodule Qt3D.Extras
+ \instantiates Qt3DExtras::QForwardRenderer
+
+ Forward rendering is what OpenGL traditionally uses. It renders directly to the backbuffer
+ one object at a time shading each one as it goes.
+
+ ForwardRenderer is a single leaf \l{Qt 3D Render Framegraph}{FrameGraph} tree which contains
+ a Viewport, a CameraSelector, and a ClearBuffers.
+ The ForwardRenderer has a default requirement filter key whose name is "renderingStyle" and
+ value "forward".
+ If you need to filter out your techniques, you should do so based on that filter key.
+
+ By default the viewport occupies the whole screen and the clear color is white.
+ Frustum culling is also enabled.
*/
+
QForwardRenderer::QForwardRenderer(QNode *parent)
: QTechniqueFilter(*new QForwardRendererPrivate, parent)
{
@@ -117,9 +137,6 @@ QForwardRenderer::QForwardRenderer(QNode *parent)
d->init();
}
-/*!
- Destroys the QForwardRenderer instance.
-*/
QForwardRenderer::~QForwardRenderer()
{
}
@@ -136,11 +153,6 @@ void QForwardRenderer::setClearColor(const QColor &clearColor)
d->m_clearBuffer->setClearColor(clearColor);
}
-/*!
- Sets the camera which should be used to render the scene to \a camera.
-
- \note A camera is a QEntity having a QCameraLens as one of its components.
-*/
void QForwardRenderer::setCamera(Qt3DCore::QEntity *camera)
{
Q_D(QForwardRenderer);
@@ -160,10 +172,15 @@ void QForwardRenderer::setExternalRenderTargetSize(const QSize &size)
}
/*!
- \property Qt3DRender::QForwardRenderer::viewportRect
+ \qmlproperty rect ForwardRenderer::viewportRect
- Holds the current viewport normalizedRect.
- */
+ Holds the current normalized viewport rectangle.
+*/
+/*!
+ \property QForwardRenderer::viewportRect
+
+ Holds the current normalized viewport rectangle.
+*/
QRectF QForwardRenderer::viewportRect() const
{
Q_D(const QForwardRenderer);
@@ -171,9 +188,16 @@ QRectF QForwardRenderer::viewportRect() const
}
/*!
- \property Qt3DRender::QForwardRenderer::clearColor
+ \qmlproperty color ForwardRenderer::clearColor
+
+ Holds the current clear color of the scene. The frame buffer is initialized to the clear color
+ before rendering.
+*/
+/*!
+ \property QForwardRenderer::clearColor
- Holds the current clearColor.
+ Holds the current clear color of the scene. The frame buffer is initialized to the clear color
+ before rendering.
*/
QColor QForwardRenderer::clearColor() const
{
@@ -182,9 +206,16 @@ QColor QForwardRenderer::clearColor() const
}
/*!
- \property Qt3DRender::QForwardRenderer::camera
+ \qmlproperty Entity ForwardRenderer::camera
+
+ Holds the current camera entity used to render the scene.
+
+ \note A camera is an Entity that has a CameraLens as one of its components.
+*/
+/*!
+ \property QForwardRenderer::camera
- Holds the current QEntity camera used to render the scene.
+ Holds the current camera entity used to render the scene.
\note A camera is a QEntity that has a QCameraLens as one of its components.
*/
@@ -194,6 +225,16 @@ Qt3DCore::QEntity *QForwardRenderer::camera() const
return d->m_cameraSelector->camera();
}
+/*!
+ \qmlproperty Object ForwardRenderer::surface
+
+ Holds the current render surface.
+*/
+/*!
+ \property QForwardRenderer::surface
+
+ Holds the current render surface.
+*/
QObject *QForwardRenderer::surface() const
{
Q_D(const QForwardRenderer);
diff --git a/src/extras/defaults/qgoochmaterial.cpp b/src/extras/defaults/qgoochmaterial.cpp
index 6b6ea131a..f2f34fc84 100644
--- a/src/extras/defaults/qgoochmaterial.cpp
+++ b/src/extras/defaults/qgoochmaterial.cpp
@@ -191,7 +191,8 @@ void QGoochMaterialPrivate::handleShininessChanged(const QVariant &var)
\brief The QGoochMaterial provides a material that implements the Gooch
shading model, popular in CAD and CAM applications.
\inmodule Qt3DExtras
- \since 5.5
+ \since 5.7
+ \inherits Qt3DRender::QMaterial
The Gooch lighting model uses both color and brightness to help show the
curvature of 3D surfaces. This is often better than models such as Phong
@@ -201,7 +202,7 @@ void QGoochMaterialPrivate::handleShininessChanged(const QVariant &var)
solution.
The Gooch lighting model is explained fully in the \l{original Gooch
- paper}. The Gooch model mixes a diffuse objetc color with a user-provided
+ paper}. The Gooch model mixes a diffuse object color with a user-provided
cool color and warm color to produce the end points of a color ramp that is
used to shade the object based upon the cosine of the angle between the
vector from the fragment to the light source and the fragment's normal
@@ -215,7 +216,7 @@ void QGoochMaterialPrivate::handleShininessChanged(const QVariant &var)
*/
/*!
- Constructs a new Qt3DExtras::QGoochMaterial instance with parent object \a parent.
+ Constructs a new QGoochMaterial instance with parent object \a parent.
*/
QGoochMaterial::QGoochMaterial(QNode *parent)
: QMaterial(*new QGoochMaterialPrivate, parent)
@@ -237,7 +238,7 @@ QGoochMaterial::QGoochMaterial(QGoochMaterialPrivate &dd, QNode *parent)
}
/*!
- \property Qt3DExtras::QGoochMaterial::diffuse
+ \property QGoochMaterial::diffuse
Holds the current diffuse color.
*/
@@ -248,7 +249,7 @@ QColor QGoochMaterial::diffuse() const
}
/*!
- \property Qt3DExtras::QGoochMaterial::specular
+ \property QGoochMaterial::specular
Holds the current specular color.
*/
@@ -259,7 +260,7 @@ QColor QGoochMaterial::specular() const
}
/*!
- \property Qt3DExtras::QGoochMaterial::cool
+ \property QGoochMaterial::cool
Holds the current cool color.
*/
@@ -270,7 +271,7 @@ QColor QGoochMaterial::cool() const
}
/*!
- \property Qt3DExtras::QGoochMaterial::warm
+ \property QGoochMaterial::warm
Holds the current warm color.
*/
@@ -281,7 +282,7 @@ QColor QGoochMaterial::warm() const
}
/*!
- \property Qt3DExtras::QGoochMaterial::alpha
+ \property QGoochMaterial::alpha
Holds the current alpha value. The start point of the color ramp
used by the Gooch shader is calculated as {c = cool + alpha * diffuse}.
@@ -293,7 +294,7 @@ float QGoochMaterial::alpha() const
}
/*!
- \property Qt3DExtras::QGoochMaterial::beta
+ \property QGoochMaterial::beta
Holds the current beta value. The start point of the color ramp
used by the Gooch shader is calculated as {c = warm + beta * diffuse}.
@@ -305,7 +306,7 @@ float QGoochMaterial::beta() const
}
/*!
- \property Qt3DExtras::QGoochMaterial::shininess
+ \property QGoochMaterial::shininess
Holds the current shininess value. Higher values of shininess result in
a smaller and brighter highlight.
diff --git a/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp b/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp
index 61b8def84..92564ee3f 100644
--- a/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp
+++ b/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp
@@ -146,15 +146,16 @@ void QNormalDiffuseMapAlphaMaterialPrivate::init()
/*!
- \class Qt3DRender::QNormalDiffuseMapAlphaMaterial
- \brief The QNormalDiffuseMapAlphaMaterial provides a default implementation of the phong lighting and bump effect where the diffuse light component
- is read from a texture map and the normals of the mesh being rendered from a normal texture map. In addition, it defines an alpha to coverage and
- a depth test to be performed in the rendering pass.
- \inmodule Qt3DRender
- \since 5.5
+ \class Qt3DExtras::QNormalDiffuseMapAlphaMaterial
+ \brief The QNormalDiffuseMapAlphaMaterial provides a specialization of QNormalDiffuseMapMaterial
+ with alpha coverage and a depth test performed in the rendering pass.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DExtras::QNormalDiffuseMapMaterial
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
\list
\li Ambient is the color that is emitted by an object without any other light source.
@@ -163,11 +164,11 @@ void QNormalDiffuseMapAlphaMaterialPrivate::init()
\li The shininess of a surface is controlled by a float property.
\endlist
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
*/
/*!
- Constructs a new Qt3DRender::QNormalDiffuseMapAlphaMaterial instance with parent object \a parent.
+ Constructs a new QNormalDiffuseMapAlphaMaterial instance with parent object \a parent.
*/
QNormalDiffuseMapAlphaMaterial::QNormalDiffuseMapAlphaMaterial(QNode *parent)
: QNormalDiffuseMapMaterial(*new QNormalDiffuseMapAlphaMaterialPrivate, parent)
diff --git a/src/extras/defaults/qnormaldiffusemapmaterial.cpp b/src/extras/defaults/qnormaldiffusemapmaterial.cpp
index c38756c98..8373c4d5d 100644
--- a/src/extras/defaults/qnormaldiffusemapmaterial.cpp
+++ b/src/extras/defaults/qnormaldiffusemapmaterial.cpp
@@ -195,14 +195,17 @@ void QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant
}
/*!
- \class Qt3DRender::QNormalDiffuseMapMaterial
- \brief The QNormalDiffuseMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse light component
- is read from a texture map and the normals of the mesh being rendered from a normal texture map.
- \inmodule Qt3DRender
- \since 5.5
-
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+ \class Qt3DExtras::QNormalDiffuseMapMaterial
+ \brief The QNormalDiffuseMapMaterial provides a default implementation of the phong lighting
+ and bump effect where the diffuse light component is read from a texture map and the normals of
+ the mesh being rendered from a normal texture map.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DRender::QMaterial
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
\list
\li Ambient is the color that is emitted by an object without any other light source.
@@ -211,12 +214,12 @@ void QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant
\li The shininess of a surface is controlled by a float property.
\endlist
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
*/
/*!
- Constructs a new Qt3DRender::QNormalDiffuseMapMaterial instance with parent object \a parent.
+ Constructs a new QNormalDiffuseMapMaterial instance with parent object \a parent.
*/
QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNode *parent)
: QMaterial(*new QNormalDiffuseMapMaterialPrivate, parent)
@@ -241,7 +244,7 @@ QNormalDiffuseMapMaterial::~QNormalDiffuseMapMaterial()
}
/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::ambient
+ \property QNormalDiffuseMapMaterial::ambient
Holds the current ambient color.
*/
@@ -252,7 +255,7 @@ QColor QNormalDiffuseMapMaterial::ambient() const
}
/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::specular
+ \property QNormalDiffuseMapMaterial::specular
Holds the current specular color.
*/
@@ -263,7 +266,7 @@ QColor QNormalDiffuseMapMaterial::specular() const
}
/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::diffuse
+ \property QNormalDiffuseMapMaterial::diffuse
Holds the current diffuse map texture.
@@ -283,7 +286,7 @@ QAbstractTexture *QNormalDiffuseMapMaterial::diffuse() const
}
/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::normal
+ \property QNormalDiffuseMapMaterial::normal
Holds the current normal map texture.
@@ -302,7 +305,7 @@ QAbstractTexture *QNormalDiffuseMapMaterial::normal() const
}
/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::shininess
+ \property QNormalDiffuseMapMaterial::shininess
Holds the current shininess as a float value.
*/
@@ -313,9 +316,10 @@ float QNormalDiffuseMapMaterial::shininess() const
}
/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::textureScale
+ \property QNormalDiffuseMapMaterial::textureScale
- Holds the current texture scale as a float value.
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
*/
float QNormalDiffuseMapMaterial::textureScale() const
{
diff --git a/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp b/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp
index 3c26fde5a..e4a83c50c 100644
--- a/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp
+++ b/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp
@@ -202,14 +202,17 @@ void QNormalDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const Q
}
/*!
- \class Qt3DRender::QNormalDiffuseSpecularMapMaterial
- \brief The QNormalDiffuseSpecularMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse and specular light components
- are read from texture maps and the normals of the mesh being rendered from a normal texture map.
- \inmodule Qt3DRender
- \since 5.5
-
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+ \class Qt3DExtras::QNormalDiffuseSpecularMapMaterial
+ \brief The QNormalDiffuseSpecularMapMaterial provides a default implementation of the phong
+ lighting and bump effect where the diffuse and specular light components are read from texture
+ maps and the normals of the mesh being rendered from a normal texture map.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DRender::QMaterial
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient,
+ diffuse and specular. The relative strengths of these components are controlled by means of
+ their reflectivity coefficients which are modelled as RGB triplets:
\list
\li Ambient is the color that is emitted by an object without any other light source.
@@ -218,12 +221,12 @@ void QNormalDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const Q
\li The shininess of a surface is controlled by a float property.
\endlist
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
*/
/*!
- Constructs a new Qt3DRender::QNormalDiffuseSpecularMapMaterial instance with parent object \a parent.
+ Constructs a new QNormalDiffuseSpecularMapMaterial instance with parent object \a parent.
*/
QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNode *parent)
: QMaterial(*new QNormalDiffuseSpecularMapMaterialPrivate, parent)
@@ -241,14 +244,14 @@ QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNormalDiff
}
/*!
- Destroys the Qt3DRender::QNormalDiffuseSpecularMapMaterial instance.
+ Destroys the QNormalDiffuseSpecularMapMaterial instance.
*/
QNormalDiffuseSpecularMapMaterial::~QNormalDiffuseSpecularMapMaterial()
{
}
/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::ambient
+ \property QNormalDiffuseSpecularMapMaterial::ambient
Holds the current ambient color.
*/
@@ -259,7 +262,7 @@ QColor QNormalDiffuseSpecularMapMaterial::ambient() const
}
/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::diffuse
+ \property QNormalDiffuseSpecularMapMaterial::diffuse
Holds the current diffuse map texture.
@@ -279,7 +282,7 @@ QAbstractTexture *QNormalDiffuseSpecularMapMaterial::diffuse() const
}
/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::normal
+ \property QNormalDiffuseSpecularMapMaterial::normal
Holds the current normal map texture.
@@ -298,7 +301,7 @@ QAbstractTexture *QNormalDiffuseSpecularMapMaterial::normal() const
}
/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::specular
+ \property QNormalDiffuseSpecularMapMaterial::specular
Holds the current specular map texture.
@@ -318,7 +321,7 @@ QAbstractTexture *QNormalDiffuseSpecularMapMaterial::specular() const
}
/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::shininess
+ \property QNormalDiffuseSpecularMapMaterial::shininess
Holds the current shininess as a float value.
*/
@@ -329,9 +332,10 @@ float QNormalDiffuseSpecularMapMaterial::shininess() const
}
/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::textureScale
+ \property QNormalDiffuseSpecularMapMaterial::textureScale
- Holds the current texture scale as a float value.
+ Holds the current texture scale. It is applied as a multiplier to texture
+ coordinates at render time. Defaults to 1.0.
*/
float QNormalDiffuseSpecularMapMaterial::textureScale() const
{
diff --git a/src/extras/defaults/qorbitcameracontroller.cpp b/src/extras/defaults/qorbitcameracontroller.cpp
index c12a78292..e340941a8 100644
--- a/src/extras/defaults/qorbitcameracontroller.cpp
+++ b/src/extras/defaults/qorbitcameracontroller.cpp
@@ -54,9 +54,46 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
/*!
- * \class QOrbitCameraController::QOrbitCameraController
- * \internal
- */
+ \class Qt3DExtras::QOrbitCameraController
+ \brief The QOrbitCameraController class allows controlling the scene camera along orbital path.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DCore::QEntity
+
+ The controls are:
+ \table
+ \header
+ \li Input
+ \li Action
+ \row
+ \li Left mouse button
+ \li While the left mouse button is pressed, mouse movement along x-axis moves the camera
+ left and right and movement along y-axis moves it up and down.
+ \row
+ \li Right mouse button
+ \li While the right mouse button is pressed, mouse movement along x-axis pans the camera
+ around the camera view center and movement along y-axis tilts it around the camera
+ view center.
+ \row
+ \li Both left and right mouse button
+ \li While both the left and the right mouse button are pressed, mouse movement along y-axis
+ zooms the camera in and out without changing the view center.
+ \row
+ \li Arrow keys
+ \li Move the camera vertically and horizontally relative to camera viewport.
+ \row
+ \li Page up and page down keys
+ \li Move the camera forwards and backwards.
+ \row
+ \li Shift key
+ \li Changes the behavior of the up and down arrow keys to zoom the camera in and out
+ without changing the view center. The other movement keys are disabled.
+ \row
+ \li Alt key
+ \li Changes the behovior of the arrow keys to pan and tilt the camera around the view
+ center. Disables the page up and page down keys.
+ \endtable
+*/
QOrbitCameraControllerPrivate::QOrbitCameraControllerPrivate()
: Qt3DCore::QEntityPrivate()
@@ -218,8 +255,8 @@ void QOrbitCameraControllerPrivate::_q_onTriggered(float dt)
m_camera->translate(QVector3D(clampInputs(m_rxAxis->value(), m_txAxis->value()) * m_linearSpeed,
clampInputs(m_ryAxis->value(), m_tyAxis->value()) * m_linearSpeed,
0) * dt);
- return;
}
+ return;
}
else if (m_rightMouseButtonAction->isActive()) {
// Orbit
@@ -258,24 +295,47 @@ QOrbitCameraController::~QOrbitCameraController()
{
}
+/*!
+ \property QOrbitCameraController::camera
+
+ Holds the currently controlled camera.
+*/
Qt3DRender::QCamera *QOrbitCameraController::camera() const
{
Q_D(const QOrbitCameraController);
return d->m_camera;
}
+/*!
+ \property QOrbitCameraController::linearSpeed
+
+ Holds the current linear speed of the camera controller. Linear speed determines the
+ movement speed of the camera.
+*/
float QOrbitCameraController::linearSpeed() const
{
Q_D(const QOrbitCameraController);
return d->m_linearSpeed;
}
+/*!
+ \property QOrbitCameraController::lookSpeed
+
+ Holds the current look speed of the camera controller. The look speed determines the turn rate
+ of the camera pan and tilt.
+*/
float QOrbitCameraController::lookSpeed() const
{
Q_D(const QOrbitCameraController);
return d->m_lookSpeed;
}
+/*!
+ \property QOrbitCameraController::zoomInLimit
+
+ Holds the current zoom-in limit. The zoom-in limit determines how close to the view center
+ the camera can be zoomed.
+*/
float QOrbitCameraController::zoomInLimit() const
{
Q_D(const QOrbitCameraController);
diff --git a/src/extras/defaults/qorbitcameracontroller.h b/src/extras/defaults/qorbitcameracontroller.h
index fb4d0aa7a..e48e39142 100644
--- a/src/extras/defaults/qorbitcameracontroller.h
+++ b/src/extras/defaults/qorbitcameracontroller.h
@@ -62,7 +62,6 @@ public:
explicit QOrbitCameraController(Qt3DCore::QNode *parent = nullptr);
~QOrbitCameraController();
- float clampInputs(float input1, float input2);
Qt3DRender::QCamera *camera() const;
float linearSpeed() const;
float lookSpeed() const;
diff --git a/src/extras/defaults/qpervertexcolormaterial.cpp b/src/extras/defaults/qpervertexcolormaterial.cpp
index 2a301cd3f..514f994c1 100644
--- a/src/extras/defaults/qpervertexcolormaterial.cpp
+++ b/src/extras/defaults/qpervertexcolormaterial.cpp
@@ -73,12 +73,15 @@ QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate()
}
/*!
- \class Qt3DRender::QPerVertexColorMaterial
- \brief The QPerVertexColorMaterial class provides a default implementation for rendering the color properties set for each vertex.
- \inmodule Qt3DRender
- \since 5.5
-
- This lighting effect is based on the combination of 2 lighting components ambient and diffuse. Ambient is set by the vertex color.
+ \class Qt3DExtras::QPerVertexColorMaterial
+ \brief The QPerVertexColorMaterial class provides a default implementation for rendering the
+ color properties set for each vertex.
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DRender::QMaterial
+
+ This lighting effect is based on the combination of 2 lighting components ambient and diffuse.
+ Ambient is set by the vertex color.
Diffuse takes in account the normal distribution of each vertex.
\list
@@ -91,8 +94,6 @@ QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate()
*/
/*!
- \fn Qt3DRender::QPerVertexColorMaterial::QPerVertexColorMaterial(Qt3DCore::QNode *parent)
-
Constructs a new QPerVertexColorMaterial instance with parent object \a parent.
*/
QPerVertexColorMaterial::QPerVertexColorMaterial(QNode *parent)
@@ -103,8 +104,6 @@ QPerVertexColorMaterial::QPerVertexColorMaterial(QNode *parent)
}
/*!
- \fn Qt3DRender::QPerVertexColorMaterial::~QPerVertexColorMaterial()
-
Destroys the QPerVertexColorMaterial
*/
QPerVertexColorMaterial::~QPerVertexColorMaterial()
diff --git a/src/extras/defaults/qphongalphamaterial.cpp b/src/extras/defaults/qphongalphamaterial.cpp
index efc413a86..7a05610c2 100644
--- a/src/extras/defaults/qphongalphamaterial.cpp
+++ b/src/extras/defaults/qphongalphamaterial.cpp
@@ -194,15 +194,17 @@ void QPhongAlphaMaterialPrivate::handleAlphaChanged(const QVariant &var)
}
/*!
- \class Qt3DRender::QPhongAlphaMaterial
+ \class Qt3DExtras::QPhongAlphaMaterial
\brief The QPhongAlphaMaterial class provides a default implementation of
the phong lighting effect with alpha.
- \inmodule Qt3DRenderer
- \since 5.5
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DRender::QMaterial
- The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+ The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse
+ and specular. The relative strengths of these components are controlled by means of their
+ reflectivity coefficients which are modelled as RGB triplets:
\list
\li Ambient is the color that is emitted by an object without any other light source.
@@ -212,13 +214,11 @@ void QPhongAlphaMaterialPrivate::handleAlphaChanged(const QVariant &var)
\li Alpha is the transparency of the surface between 0 (fully transparent) and 1 (opaque).
\endlist
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
*/
/*!
- \fn Qt3DRender::QPhongAlphaMaterial::QPhongAlphaMaterial(Qt3DCore::QNode *parent)
-
Constructs a new QPhongAlphaMaterial instance with parent object \a parent.
*/
QPhongAlphaMaterial::QPhongAlphaMaterial(QNode *parent)
@@ -247,7 +247,7 @@ QPhongAlphaMaterial::~QPhongAlphaMaterial()
}
/*!
- \property Qt3DRender::QPhongAlphaMaterial::ambient
+ \property QPhongAlphaMaterial::ambient
Holds the ambient color.
*/
@@ -258,7 +258,7 @@ QColor QPhongAlphaMaterial::ambient() const
}
/*!
- \property Qt3DRender::QPhongAlphaMaterial::diffuse
+ \property QPhongAlphaMaterial::diffuse
Holds the diffuse color.
*/
@@ -269,7 +269,7 @@ QColor QPhongAlphaMaterial::diffuse() const
}
/*!
- \property Qt3DRender::QPhongAlphaMaterial::specular
+ \property QPhongAlphaMaterial::specular
Holds the specular color.
*/
@@ -280,7 +280,7 @@ QColor QPhongAlphaMaterial::specular() const
}
/*!
- \property Qt3DRender::QPhongAlphaMaterial::shininess
+ \property QPhongAlphaMaterial::shininess
Holds the shininess exponent.
*/
@@ -291,11 +291,11 @@ float QPhongAlphaMaterial::shininess() const
}
/*!
- \property Qt3DRender::QPhongAlphaMaterial::alpha
+ \property QPhongAlphaMaterial::alpha
Holds the alpha component of the object which varies between 0 and 1.
- \note: default value is 0.5f
+ The default value is 0.5f.
*/
float QPhongAlphaMaterial::alpha() const
{
@@ -303,30 +303,65 @@ float QPhongAlphaMaterial::alpha() const
return d->m_alphaParameter->value().toFloat();
}
+/*!
+ \property QPhongAlphaMaterial::sourceRgbArg
+
+ Holds the blend equation source RGB blending argument.
+
+ \sa Qt3DRender::QBlendEquationArguments::Blending
+*/
QBlendEquationArguments::Blending QPhongAlphaMaterial::sourceRgbArg() const
{
Q_D(const QPhongAlphaMaterial);
return d->m_blendState->sourceRgb();
}
+/*!
+ \property QPhongAlphaMaterial::destinationRgbArg
+
+ Holds the blend equation destination RGB blending argument.
+
+ \sa Qt3DRender::QBlendEquationArguments::Blending
+*/
QBlendEquationArguments::Blending QPhongAlphaMaterial::destinationRgbArg() const
{
Q_D(const QPhongAlphaMaterial);
return d->m_blendState->destinationRgb();
}
+/*!
+ \property QPhongAlphaMaterial::sourceAlphaArg
+
+ Holds the blend equation source alpha blending argument.
+
+ \sa Qt3DRender::QBlendEquationArguments::Blending
+*/
QBlendEquationArguments::Blending QPhongAlphaMaterial::sourceAlphaArg() const
{
Q_D(const QPhongAlphaMaterial);
return d->m_blendState->sourceAlpha();
}
+/*!
+ \property QPhongAlphaMaterial::destinationAlphaArg
+
+ Holds the blend equation destination alpha blending argument.
+
+ \sa Qt3DRender::QBlendEquationArguments::Blending
+*/
QBlendEquationArguments::Blending QPhongAlphaMaterial::destinationAlphaArg() const
{
Q_D(const QPhongAlphaMaterial);
return d->m_blendState->destinationAlpha();
}
+/*!
+ \property QPhongAlphaMaterial::blendFunctionArg
+
+ Holds the blend equation function argument.
+
+ \sa Qt3DRender::QBlendEquation::BlendFunction
+*/
QBlendEquation::BlendFunction QPhongAlphaMaterial::blendFunctionArg() const
{
Q_D(const QPhongAlphaMaterial);
diff --git a/src/extras/defaults/qphongmaterial.cpp b/src/extras/defaults/qphongmaterial.cpp
index f9c51bae8..c294984b6 100644
--- a/src/extras/defaults/qphongmaterial.cpp
+++ b/src/extras/defaults/qphongmaterial.cpp
@@ -162,13 +162,15 @@ void QPhongMaterialPrivate::handleShininessChanged(const QVariant &var)
}
/*!
- \class Qt3DRender::QPhongMaterial
+ \class Qt3DExtras::QPhongMaterial
\brief The QPhongMaterial class provides a default implementation of the phong lighting effect.
- \inmodule Qt3DRender
- \since 5.5
+ \inmodule Qt3DExtras
+ \since 5.7
+ \inherits Qt3DRender::QMaterial
- The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+ The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse
+ and specular. The relative strengths of these components are controlled by means of their
+ reflectivity coefficients which are modelled as RGB triplets:
\list
\li Ambient is the color that is emitted by an object without any other light source.
@@ -177,13 +179,11 @@ void QPhongMaterialPrivate::handleShininessChanged(const QVariant &var)
\li The shininess of a surface is controlled by a float property.
\endlist
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+ This material uses an effect with a single render pass approach and performs per fragment
+ lighting. Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
*/
/*!
- \fn Qt3DRender::QPhongMaterial::QPhongMaterial(Qt3DCore::QNode *parent)
-
Constructs a new QPhongMaterial instance with parent object \a parent.
*/
QPhongMaterial::QPhongMaterial(QNode *parent)
@@ -194,8 +194,6 @@ QPhongMaterial::QPhongMaterial(QNode *parent)
}
/*!
- \fn Qt3DRender::QPhongMaterial::~QPhongMaterial()
-
Destroys the QPhongMaterial.
*/
QPhongMaterial::~QPhongMaterial()
@@ -203,7 +201,7 @@ QPhongMaterial::~QPhongMaterial()
}
/*!
- \property Qt3DRender::QPhongMaterial::ambient
+ \property QPhongMaterial::ambient
Holds the ambient color.
*/
@@ -214,7 +212,7 @@ QColor QPhongMaterial::ambient() const
}
/*!
- \property Qt3DRender::QPhongMaterial::diffuse
+ \property QPhongMaterial::diffuse
Holds the diffuse color.
*/
@@ -225,7 +223,7 @@ QColor QPhongMaterial::diffuse() const
}
/*!
- \property Qt3DRender::QPhongMaterial::specular
+ \property QPhongMaterial::specular
Holds the specular color.
*/
@@ -236,7 +234,7 @@ QColor QPhongMaterial::specular() const
}
/*!
- \property Qt3DRender::QPhongMaterial::shininess
+ \property QPhongMaterial::shininess
Holds the shininess exponent.
*/
diff --git a/src/extras/geometries/qconegeometry.cpp b/src/extras/geometries/qconegeometry.cpp
index ab652b5dd..9db7e2b46 100644
--- a/src/extras/geometries/qconegeometry.cpp
+++ b/src/extras/geometries/qconegeometry.cpp
@@ -38,18 +38,16 @@
****************************************************************************/
/*!
- * \class QConeGeometry
+ * \class Qt3DExtras::QConeGeometry
+ * \inmodule Qt3DExtras
* \brief The QConeGeometry class allows creation of a cone in 3D space.
* \since 5.7
* \ingroup geometries
+ * \inherits Qt3DRender::QGeometry
*
- * The Cone is a common sight in 3D software shape libraries.
- *
- * The QConeGeometry class is most commonly used as part of the QConeMesh
- * but can also be used in custom QGeometryRenderer subclasses. The class
- * allows for creation of both the cone and truncated cone.
- *
- * \sa Qt3DExtras::QCylinderGeometry, Qt3DExtras::QConeMesh, Qt3DExtras::QGeometryRenderer
+ * The QConeGeometry class is most commonly used internally by the QConeMesh
+ * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses. The class
+ * allows for creation of both a cone and a truncated cone.
*/
#ifndef _USE_MATH_DEFINES
@@ -417,6 +415,83 @@ void QConeGeometryPrivate::init()
q->addAttribute(m_indexAttribute);
}
+/*!
+ * \qmltype ConeGeometry
+ * \instantiates Qt3DExtras::QConeGeometry
+ * \inqmlmodule Qt3D.Extras
+ * \brief ConeGeometry allows creation of a cone in 3D space.
+ *
+ * The ConeGeometry type is most commonly used internally by the ConeMesh type
+ * but can also be used in custom GeometryRenderer types.
+ * The ConeGeometry type allows for creation of both a cone and a truncated cone.
+ */
+
+/*!
+ * \qmlproperty bool ConeGeometry::hasTopEndcap
+ *
+ * Determines if the cone top is capped or open.
+ */
+
+/*!
+ * \qmlproperty bool ConeGeometry::hasBottomEndcap
+ *
+ * Determines if the cone bottom is capped or open.
+ */
+
+/*!
+ * \qmlproperty int ConeGeometry::rings
+ *
+ * Holds the number of rings in the geometry.
+ */
+
+/*!
+ * \qmlproperty int ConeGeometry::slices
+ *
+ * Holds the number of slices in the geometry.
+ */
+
+/*!
+ * \qmlproperty real ConeGeometry::topRadius
+ *
+ * Holds the top radius of the cone.
+ */
+
+/*!
+ * \qmlproperty real ConeGeometry::bottomRadius
+ *
+ * Holds the bottom radius of the cone.
+ */
+
+/*!
+ * \qmlproperty real ConeGeometry::length
+ *
+ * Holds the length of the cone.
+ */
+
+/*!
+ * \qmlproperty Attribute ConeGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute ConeGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute ConeGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute ConeGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+
QConeGeometry::QConeGeometry(QNode *parent)
: QGeometry(*new QConeGeometryPrivate, parent)
{
@@ -437,6 +512,9 @@ QConeGeometry::~QConeGeometry()
{
}
+/*!
+ * Updates vertices based on geometry properties.
+ */
void QConeGeometry::updateVertices()
{
Q_D(QConeGeometry);
@@ -448,6 +526,9 @@ void QConeGeometry::updateVertices()
d->m_topRadius, d->m_bottomRadius, d->m_length));
}
+/*!
+ * Updates indices based on geometry properties.
+ */
void QConeGeometry::updateIndices()
{
Q_D(QConeGeometry);
@@ -462,8 +543,70 @@ void QConeGeometry::updateIndices()
}
/*!
- * Sets whether the cone has a sealed top to \a hasTopEndcap.
+ * \property QConeGeometry::hasTopEndcap
+ *
+ * Determines if the cone top is capped or open.
+ */
+/*!
+ * \property QConeGeometry::hasBottomEndcap
+ *
+ * Determines if the cone bottom is capped or open.
*/
+
+/*!
+ * \property QConeGeometry::rings
+ *
+ * Holds the number of rings in the geometry.
+ */
+
+/*!
+ * \property QConeGeometry::slices
+ *
+ * Holds the number of slices in the geometry.
+ */
+
+/*!
+ * \property QConeGeometry::topRadius
+ *
+ * Holds the top radius of the cone.
+ */
+
+/*!
+ * \property QConeGeometry::bottomRadius
+ *
+ * Holds the bottom radius of the cone.
+ */
+
+/*!
+ * \property QConeGeometry::length
+ *
+ * Holds the length of the cone.
+ */
+
+/*!
+ * \property QConeGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+
+/*!
+ * \property QConeGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+
+/*!
+ * \property QConeGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+
+/*!
+ * \property QConeGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+
void QConeGeometry::setHasTopEndcap(bool hasTopEndcap)
{
Q_D(QConeGeometry);
@@ -474,9 +617,6 @@ void QConeGeometry::setHasTopEndcap(bool hasTopEndcap)
}
}
-/*!
- * Sets whether the cone has a sealed bottom to \a hasBottomEndcap.
- */
void QConeGeometry::setHasBottomEndcap(bool hasBottomEndcap)
{
Q_D(QConeGeometry);
@@ -487,9 +627,6 @@ void QConeGeometry::setHasBottomEndcap(bool hasBottomEndcap)
}
}
-/*!
- * Sets the number of rings used in the cone's construction tp \a rings.
- */
void QConeGeometry::setRings(int rings)
{
Q_D(QConeGeometry);
@@ -501,9 +638,6 @@ void QConeGeometry::setRings(int rings)
}
}
-/*!
- * Sets the number of slices used in the cone's construction to \a slices.
- */
void QConeGeometry::setSlices(int slices)
{
Q_D(QConeGeometry);
@@ -515,9 +649,6 @@ void QConeGeometry::setSlices(int slices)
}
}
-/*!
- * Sets the radius for the top of the cone tp \a topRadius.
- */
void QConeGeometry::setTopRadius(float topRadius)
{
Q_D(QConeGeometry);
@@ -528,9 +659,6 @@ void QConeGeometry::setTopRadius(float topRadius)
}
}
-/*!
- * Sets the radius for the bottom of the cone to \a bottomRadius.
- */
void QConeGeometry::setBottomRadius(float bottomRadius)
{
Q_D(QConeGeometry);
@@ -541,9 +669,6 @@ void QConeGeometry::setBottomRadius(float bottomRadius)
}
}
-/*!
- * Sets the cone's length to \a length.
- */
void QConeGeometry::setLength(float length)
{
Q_D(QConeGeometry);
@@ -555,63 +680,42 @@ void QConeGeometry::setLength(float length)
}
}
-/*!
- * \return whether the cone has a top endcap.
- */
bool QConeGeometry::hasTopEndcap() const
{
Q_D(const QConeGeometry);
return d->m_hasTopEndcap;
}
-/*!
- * \return whether the cone has a bottom endcap.
- */
bool QConeGeometry::hasBottomEndcap() const
{
Q_D(const QConeGeometry);
return d->m_hasBottomEndcap;
}
-/*!
- * \return the top radius of the cone.
- */
float QConeGeometry::topRadius() const
{
Q_D(const QConeGeometry);
return d->m_topRadius;
}
-/*!
- * \return the bottom radius of the cone.
- */
float QConeGeometry::bottomRadius() const
{
Q_D(const QConeGeometry);
return d->m_bottomRadius;
}
-/*!
- * \return the number of rings used in the construction of the cone.
- */
int QConeGeometry::rings() const
{
Q_D(const QConeGeometry);
return d->m_rings;
}
-/*!
- * \return the number of slices used in the construction of the cone.
- */
int QConeGeometry::slices() const
{
Q_D(const QConeGeometry);
return d->m_slices;
}
-/*!
- * \return the cone's length.
- */
float QConeGeometry::length() const
{
Q_D(const QConeGeometry);
diff --git a/src/extras/geometries/qconemesh.cpp b/src/extras/geometries/qconemesh.cpp
index e2f43b16d..385c469e0 100644
--- a/src/extras/geometries/qconemesh.cpp
+++ b/src/extras/geometries/qconemesh.cpp
@@ -53,6 +53,64 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
+/*!
+ * \qmltype ConeMesh
+ * \instantiates Qt3DExtras::QConeMesh
+ * \inqmlmodule Qt3D.Extras
+ * \brief A conical mesh.
+ */
+
+/*!
+ * \qmlproperty int ConeMesh::rings
+ *
+ * Holds the number of rings in the mesh.
+ */
+
+/*!
+ * \qmlproperty int ConeMesh::slices
+ *
+ * Holds the number of slices in the mesh.
+ */
+
+/*!
+ * \qmlproperty bool ConeMesh::hasTopEndcap
+ *
+ * Determines if the cone top is capped or open.
+ */
+
+/*!
+ * \qmlproperty bool ConeMesh::hasBottomEndcap
+ *
+ * Determines if the cone bottom is capped or open.
+ */
+
+/*!
+ * \qmlproperty real ConeMesh::topRadius
+ *
+ * Holds the top radius of the cone.
+ */
+
+/*!
+ * \qmlproperty real ConeMesh::bottomRadius
+ *
+ * Holds the bottom radius of the cone.
+ */
+
+/*!
+ * \qmlproperty real ConeMesh::length
+ *
+ * Holds the length of the cone.
+ */
+
+/*!
+ * \class Qt3DExtras::QConeMesh
+ * \inmodule Qt3DExtras
+ *
+ * \inherits Qt3DRender::QGeometryRenderer
+ *
+ * \brief A conical mesh.
+ */
+
QConeMesh::QConeMesh(QNode *parent)
: QGeometryRenderer(parent)
{
@@ -108,36 +166,71 @@ void QConeMesh::setLength(float length)
static_cast<QConeGeometry *>(geometry())->setLength(length);
}
+/*!
+ * \property QConeMesh::hasTopEndcap
+ *
+ * Determines if the cone top is capped or open.
+ */
bool QConeMesh::hasTopEndcap() const
{
return static_cast<QConeGeometry *>(geometry())->hasTopEndcap();
}
+/*!
+ * \property QConeMesh::hasBottomEndcap
+ *
+ * Determines if the cone bottom is capped or open.
+ */
bool QConeMesh::hasBottomEndcap() const
{
return static_cast<QConeGeometry *>(geometry())->hasBottomEndcap();
}
+/*!
+ * \property QConeMesh::topRadius
+ *
+ * Holds the top radius of the cone.
+ */
float QConeMesh::topRadius() const
{
return static_cast<QConeGeometry *>(geometry())->topRadius();
}
+/*!
+ * \property QConeMesh::bottomRadius
+ *
+ * Holds the bottom radius of the cone.
+ */
float QConeMesh::bottomRadius() const
{
return static_cast<QConeGeometry *>(geometry())->bottomRadius();
}
+/*!
+ * \property QConeMesh::rings
+ *
+ * Holds the number of rings in the mesh.
+ */
int QConeMesh::rings() const
{
return static_cast<QConeGeometry *>(geometry())->rings();
}
+/*!
+ * \property QConeMesh::slices
+ *
+ * Holds the number of slices in the mesh.
+ */
int QConeMesh::slices() const
{
return static_cast<QConeGeometry *>(geometry())->slices();
}
+/*!
+ * \property QConeMesh::length
+ *
+ * Holds the length of the cone.
+ */
float QConeMesh::length() const
{
return static_cast<QConeGeometry *>(geometry())->length();
diff --git a/src/extras/geometries/qcuboidgeometry.cpp b/src/extras/geometries/qcuboidgeometry.cpp
index a632111f6..0f7b5220f 100644
--- a/src/extras/geometries/qcuboidgeometry.cpp
+++ b/src/extras/geometries/qcuboidgeometry.cpp
@@ -76,23 +76,23 @@ void createPlaneVertexData(float w, float h, const QSize &resolution,
switch (normal) {
case NegativeX:
// Iterate over z
- for (int j = resolution.width() - 1; j >= 0; --j) {
- const float a = a0 + static_cast<float>(j) * da;
- const float u = static_cast<float>(j) * du;
+ for (int j = resolution.height() - 1; j >= 0; --j) {
+ const float b = b0 + static_cast<float>(j) * db;
+ const float v = static_cast<float>(j) * dv;
// Iterate over y
- for (int i = 0; i < resolution.height(); ++i) {
- const float b = b0 + static_cast<float>(i) * db;
- const float v = static_cast<float>(i) * dv;
+ for (int i = 0; i < resolution.width(); ++i) {
+ const float a = a0 + static_cast<float>(i) * da;
+ const float u = static_cast<float>(i) * du;
// position
*vertices++ = planeDistance;
- *vertices++ = b;
*vertices++ = a;
+ *vertices++ = b;
// texture coordinates
- *vertices++ = 1.0f - u;
*vertices++ = v;
+ *vertices++ = u;
// normal
*vertices++ = -1.0f;
@@ -102,8 +102,8 @@ void createPlaneVertexData(float w, float h, const QSize &resolution,
// tangent
*vertices++ = 0.0f;
*vertices++ = 0.0f;
- *vertices++ = -1.0f;
- *vertices++ = -1.0f;
+ *vertices++ = 1.0f;
+ *vertices++ = 1.0f;
}
}
break;
@@ -111,22 +111,22 @@ void createPlaneVertexData(float w, float h, const QSize &resolution,
case PositiveX: {
// Iterate over z
for (int j = 0; j < resolution.height(); ++j) {
- const float a = a0 + static_cast<float>(j) * da;
- const float u = static_cast<float>(j) * du;
+ const float b = b0 + static_cast<float>(j) * db;
+ const float v = static_cast<float>(j) * dv;
// Iterate over y
for (int i = 0; i < resolution.width(); ++i) {
- const float b = b0 + static_cast<float>(i) * db;
- const float v = static_cast<float>(i) * dv;
+ const float a = a0 + static_cast<float>(i) * da;
+ const float u = static_cast<float>(i) * du;
// position
*vertices++ = planeDistance;
- *vertices++ = b;
*vertices++ = a;
+ *vertices++ = b;
// texture coordinates
+ *vertices++ = 1.0f - v;
*vertices++ = u;
- *vertices++ = v;
// normal
*vertices++ = 1.0f;
@@ -136,8 +136,8 @@ void createPlaneVertexData(float w, float h, const QSize &resolution,
// tangent
*vertices++ = 0.0f;
*vertices++ = 0.0f;
- *vertices++ = 1.0f;
*vertices++ = -1.0f;
+ *vertices++ = 1.0f;
}
}
break;
@@ -563,44 +563,54 @@ void QCuboidGeometryPrivate::init()
/*!
* \qmltype CuboidGeometry
- * \instantiates Qt3DRender::QCuboidGeometry
- * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DExtras::QCuboidGeometry
+ * \inqmlmodule Qt3D.Extras
+ * \brief CuboidGeometry allows creation of a cuboid in 3D space.
+ *
+ * The CuboidGeometry type is most commonly used internally by the CuboidMesh type
+ * but can also be used in custom GeometryRenderer types.
*/
/*!
- * \qmlproperty float CuboidGeometry::xExtent
+ * \qmlproperty real CuboidGeometry::xExtent
*
- * Holds the x extent.
+ * Holds the x extent of the geometry.
*/
/*!
- * \qmlproperty float CuboidGeometry::yExtent
+ * \qmlproperty real CuboidGeometry::yExtent
*
- * Holds the y extent.
+ * Holds the y extent of the geometry.
*/
/*!
- * \qmlproperty float CuboidGeometry::zExtent
+ * \qmlproperty real CuboidGeometry::zExtent
*
- * Holds the z extent.
+ * Holds the z extent of the geometry.
*/
/*!
* \qmlproperty size CuboidGeometry::yzMeshResolution
*
* Holds the y-z resolution.
+ * The width and height values of this property specify the number of vertices generated for
+ * the y-z faces of the mesh.
*/
/*!
* \qmlproperty size CuboidGeometry::xzMeshResolution
*
* Holds the x-z resolution.
+ * The width and height values of this property specify the number of vertices generated for
+ * the x-z faces of the mesh.
*/
/*!
* \qmlproperty size CuboidGeometry::xyMeshResolution
*
* Holds the x-y resolution.
+ * The width and height values of this property specify the number of vertices generated for
+ * the x-y faces of the mesh.
*/
/*!
@@ -634,11 +644,15 @@ void QCuboidGeometryPrivate::init()
*/
/*!
- * \class Qt3DRender::QCuboidGeometry
- * \inmodule Qt3DRender
- *
+ * \class Qt3DExtras::QCuboidGeometry
+ * \inmodule Qt3DExtras
+ * \brief The QCuboidGeometry class allows creation of a cuboid in 3D space.
+ * \since 5.7
+ * \ingroup geometries
* \inherits Qt3DRender::QGeometry
*
+ * The QCuboidGeometry class is most commonly used internally by the QCuboidMesh
+ * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses.
*/
/*!
@@ -770,7 +784,7 @@ void QCuboidGeometry::setXYMeshResolution(const QSize &resolution)
/*!
* \property QCuboidGeometry::xExtent
*
- * Holds the x extent.
+ * Holds the x extent of the geometry.
*/
float QCuboidGeometry::xExtent() const
{
@@ -781,7 +795,7 @@ float QCuboidGeometry::xExtent() const
/*!
* \property QCuboidGeometry::yExtent
*
- * Holds the y extent.
+ * Holds the y extent of the geometry.
*/
float QCuboidGeometry::yExtent() const
{
@@ -792,7 +806,7 @@ float QCuboidGeometry::yExtent() const
/*!
* \property QCuboidGeometry::zExtent
*
- * Holds the z extent.
+ * Holds the z extent of the geometry.
*/
float QCuboidGeometry::zExtent() const
{
@@ -804,6 +818,8 @@ float QCuboidGeometry::zExtent() const
* \property QCuboidGeometry::yzMeshResolution
*
* Holds the y-z resolution.
+ * The width and height values of this property specify the number of vertices generated for
+ * the y-z faces of the mesh.
*/
QSize QCuboidGeometry::yzMeshResolution() const
{
@@ -815,6 +831,8 @@ QSize QCuboidGeometry::yzMeshResolution() const
* \property QCuboidGeometry::xzMeshResolution
*
* Holds the x-z resolution.
+ * The width and height values of this property specify the number of vertices generated for
+ * the x-z faces of the mesh.
*/
QSize QCuboidGeometry::xyMeshResolution() const
{
@@ -826,6 +844,8 @@ QSize QCuboidGeometry::xyMeshResolution() const
* \property QCuboidGeometry::xyMeshResolution
*
* Holds the x-y resolution.
+ * The width and height values of this property specify the number of vertices generated for
+ * the x-y faces of the mesh.
*/
QSize QCuboidGeometry::xzMeshResolution() const
{
diff --git a/src/extras/geometries/qcuboidmesh.cpp b/src/extras/geometries/qcuboidmesh.cpp
index 004fca472..7df77ec63 100644
--- a/src/extras/geometries/qcuboidmesh.cpp
+++ b/src/extras/geometries/qcuboidmesh.cpp
@@ -45,59 +45,65 @@ QT_BEGIN_NAMESPACE
namespace Qt3DExtras {
/*!
- * \qmltype QCuboidMesh
- * \instantiates Qt3DRender::QCuboidMesh
- * \inqmlmodule Qt3D.Render
- * \brief A cube mesh.
+ * \qmltype CuboidMesh
+ * \instantiates Qt3DExtras::QCuboidMesh
+ * \inqmlmodule Qt3D.Extras
+ * \brief A cuboid mesh.
*/
/*!
- * \qmlproperty float CuboidMesh::xExtent
+ * \qmlproperty real CuboidMesh::xExtent
*
- * Holds the x extent.
+ * Holds the x extent of the mesh.
*/
/*!
- * \qmlproperty float CuboidMesh::yExtent
+ * \qmlproperty real CuboidMesh::yExtent
*
- * Holds the y extent.
+ * Holds the y extent of the mesh.
*/
/*!
- * \qmlproperty float CuboidMesh::zExtent
+ * \qmlproperty real CuboidMesh::zExtent
*
- * Holds the z extent.
+ * Holds the z extent of the mesh.
*/
/*!
* \qmlproperty size CuboidMesh::yzMeshResolution
*
- * Holds the y-z resolution.
+ * Holds the y-z resolution of the mesh.
+ * The width and height values of this property specify the number of vertices generated for
+ * the y-z faces of the mesh.
*/
/*!
* \qmlproperty size CuboidMesh::xzMeshResolution
*
- * Holds the x-z resolution.
+ * Holds the x-z resolution of the mesh.
+ * The width and height values of this property specify the number of vertices generated for
+ * the x-z faces of the mesh.
*/
/*!
* \qmlproperty size CuboidMesh::xyMeshResolution
*
- * Holds the x-y resolution.
+ * Holds the x-y resolution of the mesh.
+ * The width and height values of this property specify the number of vertices generated for
+ * the x-y faces of the mesh.
*/
/*!
- * \class Qt3DRender::QCuboidMesh
- * \inmodule Qt3DRender
+ * \class Qt3DExtras::QCuboidMesh
+ * \inmodule Qt3DExtras
*
* \inherits Qt3DRender::QGeometryRenderer
*
- * \brief A cube mesh.
+ * \brief A cuboid mesh.
*/
/*!
- * Constructs a new QCuboidMedh with \a parent.
+ * Constructs a new QCuboidMesh with \a parent.
*/
QCuboidMesh::QCuboidMesh(QNode *parent)
: QGeometryRenderer(parent)
@@ -125,7 +131,7 @@ void QCuboidMesh::setXExtent(float xExtent)
/*!
* \property QCuboidMesh::xExtent
*
- * Holds the x extent.
+ * Holds the x extent of the mesh.
*/
float QCuboidMesh::xExtent() const
{
@@ -140,7 +146,7 @@ void QCuboidMesh::setYExtent(float yExtent)
/*!
* \property QCuboidMesh::yExtent
*
- * Holds the y extent.
+ * Holds the y extent of the mesh.
*/
float QCuboidMesh::yExtent() const
{
@@ -155,7 +161,7 @@ void QCuboidMesh::setZExtent(float zExtent)
/*!
* \property QCuboidMesh::zExtent
*
- * Holds the z extent.
+ * Holds the z extent of the mesh.
*/
float QCuboidMesh::zExtent() const
{
@@ -170,7 +176,9 @@ void QCuboidMesh::setYZMeshResolution(const QSize &resolution)
/*!
* \property QCuboidMesh::yzMeshResolution
*
- * Holds the y-z resolution.
+ * Holds the y-z resolution of the mesh.
+ * The width and height values of this property specify the number of vertices generated for
+ * the y-z faces of the mesh.
*/
QSize QCuboidMesh::yzMeshResolution() const
{
@@ -185,7 +193,9 @@ void QCuboidMesh::setXZMeshResolution(const QSize &resolution)
/*!
* \property QCuboidMesh::xzMeshResolution
*
- * Holds the x-z resolution.
+ * Holds the x-z resolution of the mesh.
+ * The width and height values of this property specify the number of vertices generated for
+ * the x-z faces of the mesh.
*/
QSize QCuboidMesh::xzMeshResolution() const
{
@@ -200,7 +210,9 @@ void QCuboidMesh::setXYMeshResolution(const QSize &resolution)
/*!
* \property QCuboidMesh::xyMeshResolution
*
- * Holds the x-y resolution.
+ * Holds the x-y resolution of the mesh.
+ * The width and height values of this property specify the number of vertices generated for
+ * the x-y faces of the mesh.
*/
QSize QCuboidMesh::xyMeshResolution() const
{
diff --git a/src/extras/geometries/qcylindergeometry.cpp b/src/extras/geometries/qcylindergeometry.cpp
index 659d38359..136258162 100644
--- a/src/extras/geometries/qcylindergeometry.cpp
+++ b/src/extras/geometries/qcylindergeometry.cpp
@@ -338,8 +338,12 @@ void QCylinderGeometryPrivate::init()
/*!
* \qmltype CylinderGeometry
- * \instantiates Qt3DRender::QCylinderGeometry
- * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DExtras::QCylinderGeometry
+ * \inqmlmodule Qt3D.Extras
+ * \brief CylinderGeometry allows creation of a cylinder in 3D space.
+ *
+ * The CylinderGeometry type is most commonly used internally by the CylinderMesh type
+ * but can also be used in custom GeometryRenderer types.
*/
/*!
@@ -355,13 +359,13 @@ void QCylinderGeometryPrivate::init()
*/
/*!
- * \qmlproperty float CylinderGeometry::radius
+ * \qmlproperty real CylinderGeometry::radius
*
* Holds the radius of the cylinder.
*/
/*!
- * \qmlproperty float CylinderGeometry::length
+ * \qmlproperty real CylinderGeometry::length
*
* Holds the length of the cylinder.
*/
@@ -391,10 +395,15 @@ void QCylinderGeometryPrivate::init()
*/
/*!
- * \class Qt3DRender::QCylinderGeometry
- * \inmodule Qt3DRender
- *
+ * \class Qt3DExtras::QCylinderGeometry
+ * \inmodule Qt3DExtras
+ * \brief The QCylinderGeometry class allows creation of a cylinder in 3D space.
+ * \since 5.7
+ * \ingroup geometries
* \inherits Qt3DRender::QGeometry
+ *
+ * The QCylinderGeometry class is most commonly used internally by the QCylinderMesh
+ * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses.
*/
/*!
@@ -425,7 +434,7 @@ QCylinderGeometry::~QCylinderGeometry()
}
/*!
- * Updates the vertices based on rings and slices.
+ * Updates the vertices based on rings, slices, and length properties.
*/
void QCylinderGeometry::updateVertices()
{
@@ -439,7 +448,7 @@ void QCylinderGeometry::updateVertices()
}
/*!
- * Updates the indices based on rings and slices.
+ * Updates the indices based on rings, slices, and length properties.
*/
void QCylinderGeometry::updateIndices()
{
diff --git a/src/extras/geometries/qcylindermesh.cpp b/src/extras/geometries/qcylindermesh.cpp
index ef405cb6e..875d8ed9a 100644
--- a/src/extras/geometries/qcylindermesh.cpp
+++ b/src/extras/geometries/qcylindermesh.cpp
@@ -58,8 +58,8 @@ namespace Qt3DExtras {
/*!
* \qmltype CylinderMesh
- * \instantiates Qt3DRender::QCylinderMesh
- * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DExtras::QCylinderMesh
+ * \inqmlmodule Qt3D.Extras
* \brief A cylindrical mesh.
*/
@@ -76,20 +76,20 @@ namespace Qt3DExtras {
*/
/*!
- * \qmlproperty float CylinderMesh::radius
+ * \qmlproperty real CylinderMesh::radius
*
* Holds the radius of the cylinder.
*/
/*!
- * \qmlproperty float CylinderMesh::length
+ * \qmlproperty real CylinderMesh::length
*
* Holds the length of the cylinder.
*/
/*!
- * \class Qt3DRender::QCylinderMesh
- * \inmodule Qt3DRender
+ * \class Qt3DExtras::QCylinderMesh
+ * \inmodule Qt3DExtras
*
* \inherits Qt3DRender::QGeometryRenderer
*
diff --git a/src/extras/geometries/qplanegeometry.cpp b/src/extras/geometries/qplanegeometry.cpp
index dad3147ff..74c90cf1b 100644
--- a/src/extras/geometries/qplanegeometry.cpp
+++ b/src/extras/geometries/qplanegeometry.cpp
@@ -208,18 +208,22 @@ public:
/*!
* \qmltype PlaneGeometry
- * \instantiates Qt3DRender::QPlaneGeometry
- * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DExtras::QPlaneGeometry
+ * \inqmlmodule Qt3D.Extras
+ * \brief PlaneGeometry allows creation of a plane in 3D space.
+ *
+ * The PlaneGeometry type is most commonly used internally by the PlaneMesh type
+ * but can also be used in custom GeometryRenderer types.
*/
/*!
- * \qmlproperty float PlaneGeometry::width
+ * \qmlproperty real PlaneGeometry::width
*
* Holds the plane width.
*/
/*!
- * \qmlproperty float PlaneGeometry::height
+ * \qmlproperty real PlaneGeometry::height
*
* Holds the plane height.
*/
@@ -261,10 +265,15 @@ public:
*/
/*!
- * \class Qt3DRender::QPlaneGeometry
- * \inmodule Qt3DRender
- *
+ * \class Qt3DExtras::QPlaneGeometry
+ * \inmodule Qt3DExtras
+ * \brief The QPlaneGeometry class allows creation of a plane in 3D space.
+ * \since 5.7
+ * \ingroup geometries
* \inherits Qt3DRender::QGeometry
+ *
+ * The QPlaneGeometry class is most commonly used internally by the QPlaneMesh
+ * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses.
*/
/*!
@@ -295,7 +304,7 @@ QPlaneGeometry::~QPlaneGeometry()
}
/*!
- * Updates vertices based on resolution.
+ * Updates vertices based on mesh resolution, width, and height properties.
*/
void QPlaneGeometry::updateVertices()
{
@@ -310,7 +319,7 @@ void QPlaneGeometry::updateVertices()
}
/*!
- * Updates indices based on resolution.
+ * Updates indices based on mesh resolution.
*/
void QPlaneGeometry::updateIndices()
{
diff --git a/src/extras/geometries/qplanemesh.cpp b/src/extras/geometries/qplanemesh.cpp
index f9d1a105b..f14d7cb97 100644
--- a/src/extras/geometries/qplanemesh.cpp
+++ b/src/extras/geometries/qplanemesh.cpp
@@ -46,19 +46,19 @@ namespace Qt3DExtras {
/*!
* \qmltype PlaneMesh
- * \instantiates Qt3DRender::QPlaneMesh
- * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DExtras::QPlaneMesh
+ * \inqmlmodule Qt3D.Extras
* \brief A square planar mesh.
*/
/*!
- * \qmlproperty float PlaneMesh::width
+ * \qmlproperty real PlaneMesh::width
*
* Holds the plane width.
*/
/*!
- * \qmlproperty float PlaneMesh::height
+ * \qmlproperty real PlaneMesh::height
*
* Holds the plane height.
*/
@@ -67,11 +67,13 @@ namespace Qt3DExtras {
* \qmlproperty size PlaneMesh::meshResolution
*
* Holds the plane resolution.
+ * The width and height values of this property specify the number of vertices generated for
+ * the mesh in the respective dimensions.
*/
/*!
- * \class Qt3DRender::QPlaneMesh
- * \inmodule Qt3DRender
+ * \class Qt3DExtras::QPlaneMesh
+ * \inmodule Qt3DExtras
*
* \inherits Qt3DRender::QGeometryRenderer
*
@@ -135,6 +137,8 @@ void QPlaneMesh::setMeshResolution(const QSize &resolution)
* \property QPlaneMesh::meshResolution
*
* Holds the plane resolution.
+ * The width and height values of this property specify the number of vertices generated for
+ * the mesh in the respective dimensions.
*/
QSize QPlaneMesh::meshResolution() const
{
diff --git a/src/extras/geometries/qspheregeometry.cpp b/src/extras/geometries/qspheregeometry.cpp
index 77844b2af..277d4fcb9 100644
--- a/src/extras/geometries/qspheregeometry.cpp
+++ b/src/extras/geometries/qspheregeometry.cpp
@@ -315,8 +315,12 @@ void QSphereGeometryPrivate::init()
/*!
* \qmltype SphereGeometry
- * \instantiates QSphereGeometry
- * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DExtras::QSphereGeometry
+ * \inqmlmodule Qt3D.Extras
+ * \brief SphereGeometry allows creation of a sphere in 3D space.
+ *
+ * The SphereGeometry type is most commonly used internally by the SphereMesh type
+ * but can also be used in custom GeometryRenderer types.
*/
/*!
@@ -332,7 +336,7 @@ void QSphereGeometryPrivate::init()
*/
/*!
- * \qmlproperty float SphereGeometry::radius
+ * \qmlproperty real SphereGeometry::radius
*
* Holds the radius of the sphere.
*/
@@ -340,7 +344,8 @@ void QSphereGeometryPrivate::init()
/*!
* \qmlproperty bool SphereGeometry::generateTangents
*
- * Holds the value of the automatic tangent generation flag.
+ * Holds the value of the automatic tangent vectors generation flag.
+ * Tangent vectors are orthogonal to normal vectors.
*/
/*!
@@ -374,10 +379,15 @@ void QSphereGeometryPrivate::init()
*/
/*!
- * \class QSphereGeometry
- * \inmodule Qt3DRender
+ * \class Qt3DExtras::QSphereGeometry
+ * \inmodule Qt3DExtras
+ * \brief The QSphereGeometry class allows creation of a sphere in 3D space.
+ * \since 5.7
+ * \ingroup geometries
+ * \inherits Qt3DRender::QGeometry
*
- * \inherits QGeometry
+ * The QSphereGeometry class is most commonly used internally by the QSphereMesh
+ * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses.
*/
/*!
@@ -408,7 +418,7 @@ QSphereGeometry::~QSphereGeometry()
}
/*!
- * Updates vertices based on rings and slices.
+ * Updates vertices based on rings, slices, and radius properties
*/
void QSphereGeometry::updateVertices()
{
@@ -422,7 +432,7 @@ void QSphereGeometry::updateVertices()
}
/*!
- * Updates indices based on rings and slices.
+ * Updates indices based on rings and slices properties.
*/
void QSphereGeometry::updateIndices()
{
@@ -481,7 +491,8 @@ void QSphereGeometry::setGenerateTangents(bool gen)
/*!
* \property QSphereGeometry::generateTangents
*
- * Holds the value of the automatic tangent generation flag.
+ * Holds the value of the automatic tangent vectors generation flag.
+ * Tangent vectors are orthogonal to normal vectors.
*/
bool QSphereGeometry::generateTangents() const
{
diff --git a/src/extras/geometries/qspheremesh.cpp b/src/extras/geometries/qspheremesh.cpp
index 205f6437f..90cf5a872 100644
--- a/src/extras/geometries/qspheremesh.cpp
+++ b/src/extras/geometries/qspheremesh.cpp
@@ -47,8 +47,8 @@ namespace Qt3DExtras {
/*!
* \qmltype SphereMesh
- * \instantiates Qt3DRender::QSphereMesh
- * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DExtras::QSphereMesh
+ * \inqmlmodule Qt3D.Extras
* \brief A spherical mesh.
*/
@@ -65,7 +65,7 @@ namespace Qt3DExtras {
*/
/*!
- * \qmlproperty float SphereMesh::radius
+ * \qmlproperty real SphereMesh::radius
*
* Holds the radius of the sphere.
*/
@@ -73,12 +73,13 @@ namespace Qt3DExtras {
/*!
* \qmlproperty bool SphereMesh::generateTangents
*
- * Holds the value of the automatic tangent generation flag.
+ * Holds the value of the automatic tangent vectors generation flag.
+ * Tangent vectors are orthogonal to normal vectors.
*/
/*!
- * \class Qt3DRender::QSphereMesh
- * \inmodule Qt3DRender
+ * \class Qt3DExtras::QSphereMesh
+ * \inmodule Qt3DExtras
*
* \inherits Qt3DRender::QGeometryRenderer
*
@@ -127,7 +128,8 @@ void QSphereMesh::setGenerateTangents(bool gen)
/*!
* \property QSphereMesh::generateTangents
*
- * Holds the value of the automatic tangent generation flag.
+ * Holds the value of the automatic tangent vectors generation flag.
+ * Tangent vectors are orthogonal to normal vectors.
*/
bool QSphereMesh::generateTangents() const
{
diff --git a/src/extras/geometries/qtorusgeometry.cpp b/src/extras/geometries/qtorusgeometry.cpp
index 1d292dec3..801281110 100644
--- a/src/extras/geometries/qtorusgeometry.cpp
+++ b/src/extras/geometries/qtorusgeometry.cpp
@@ -264,8 +264,12 @@ void QTorusGeometryPrivate::init()
/*!
* \qmltype TorusGeometry
- * \instantiates Qt3DRender::QTorusGeometry
- * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DExtras::QTorusGeometry
+ * \inqmlmodule Qt3D.Extras
+ * \brief TorusGeometry allows creation of a torus in 3D space.
+ *
+ * The TorusGeometry type is most commonly used internally by the TorusMesh type
+ * but can also be used in custom GeometryRenderer types.
*/
/*!
@@ -281,13 +285,13 @@ void QTorusGeometryPrivate::init()
*/
/*!
- * \qmlproperty float TorusGeometry::radius
+ * \qmlproperty real TorusGeometry::radius
*
* Holds the outer radius of the torus.
*/
/*!
- * \qmlproperty float TorusGeometry::minorRadius
+ * \qmlproperty real TorusGeometry::minorRadius
*
* Holds the inner radius of the torus.
*/
@@ -317,10 +321,15 @@ void QTorusGeometryPrivate::init()
*/
/*!
- * \class Qt3DRender::QTorusGeometry
- * \inmodule Qt3DRender
- *
+ * \class Qt3DExtras::QTorusGeometry
+ * \inmodule Qt3DExtras
+ * \brief The QTorusGeometry class allows creation of a torus in 3D space.
+ * \since 5.7
+ * \ingroup geometries
* \inherits Qt3DRender::QGeometry
+ *
+ * The QTorusGeometry class is most commonly used internally by the QTorusMesh
+ * but can also be used in custom Qt3DRender::QGeometryRenderer subclasses.
*/
/*!
@@ -351,7 +360,7 @@ QTorusGeometry::~QTorusGeometry()
}
/*!
- * Updates vertices based on rings and slices.
+ * Updates vertices based on rings, slices, and radius properties.
*/
void QTorusGeometry::updateVertices()
{
@@ -364,7 +373,7 @@ void QTorusGeometry::updateVertices()
}
/*!
- * Updates indices based on rings and slices.
+ * Updates indices based on rings and slices properties.
*/
void QTorusGeometry::updateIndices()
{
diff --git a/src/extras/geometries/qtorusmesh.cpp b/src/extras/geometries/qtorusmesh.cpp
index e3b5b61d0..a77631b73 100644
--- a/src/extras/geometries/qtorusmesh.cpp
+++ b/src/extras/geometries/qtorusmesh.cpp
@@ -51,9 +51,9 @@ namespace Qt3DExtras {
/*!
* \qmltype TorusMesh
- * \instantiates Qt3DRender::QTorusMesh
- * \inqmlmodule Qt3D.Render
- * \brief A custom mesh.
+ * \instantiates Qt3DExtras::QTorusMesh
+ * \inqmlmodule Qt3D.Extras
+ * \brief A toroidal mesh.
*/
/*!
@@ -69,24 +69,24 @@ namespace Qt3DExtras {
*/
/*!
- * \qmlproperty float TorusMesh::radius
+ * \qmlproperty real TorusMesh::radius
*
* Holds the outer radius of the torus.
*/
/*!
- * \qmlproperty float TorusMesh::minorRadius
+ * \qmlproperty real TorusMesh::minorRadius
*
* Holds the inner radius of the torus.
*/
/*!
- * \class Qt3DRender::QTorusMesh
- * \inmodule Qt3DRender
+ * \class Qt3DExtras::QTorusMesh
+ * \inmodule Qt3DExtras
*
* \inherits Qt3DRender::QGeometryRenderer
*
- * \brief A custom mesh.
+ * \brief A toroidal mesh.
*/
/*!
diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp
index 82b017b1c..fe2a04bd7 100644
--- a/src/input/backend/inputhandler.cpp
+++ b/src/input/backend/inputhandler.cpp
@@ -249,6 +249,7 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs()
MouseDevice *controller = m_mouseDeviceManager->data(cHandle);
controller->updateMouseEvents(mouseEvents);
+ controller->updateWheelEvents(wheelEvents);
// Event dispacthing job
if (!mouseEvents.isEmpty() || !wheelEvents.empty()) {
// Send the events to the mouse handlers that have for sourceDevice controller
diff --git a/src/input/backend/mousedevice.cpp b/src/input/backend/mousedevice.cpp
index a2f106d94..e649824a4 100644
--- a/src/input/backend/mousedevice.cpp
+++ b/src/input/backend/mousedevice.cpp
@@ -84,7 +84,10 @@ float MouseDevice::axisValue(int axisIdentifier) const
return m_mouseState.xAxis;
case QMouseDevice::Y:
return m_mouseState.yAxis;
- break;
+ case QMouseDevice::WheelX:
+ return m_mouseState.wXAxis;
+ case QMouseDevice::WheelY:
+ return m_mouseState.wYAxis;
default:
break;
}
@@ -106,6 +109,19 @@ bool MouseDevice::isButtonPressed(int buttonIdentifier) const
return false;
}
+void MouseDevice::updateWheelEvents(const QList<QT_PREPEND_NAMESPACE (QWheelEvent)> &events)
+{
+ // Reset axis values before we accumulate new values for this frame
+ m_mouseState.wXAxis = 0.0f;
+ m_mouseState.wYAxis = 0.0f;
+ if (!events.isEmpty()) {
+ for (const QT_PREPEND_NAMESPACE(QWheelEvent) &e : events) {
+ m_mouseState.wXAxis += m_sensitivity * e.angleDelta().x();
+ m_mouseState.wYAxis += m_sensitivity * e.angleDelta().y();
+ }
+ }
+}
+
void MouseDevice::updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events)
{
// Reset axis values before we accumulate new values for this frame
diff --git a/src/input/backend/mousedevice_p.h b/src/input/backend/mousedevice_p.h
index 723945554..02a6d916e 100644
--- a/src/input/backend/mousedevice_p.h
+++ b/src/input/backend/mousedevice_p.h
@@ -76,6 +76,7 @@ public:
bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE;
void updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events);
+ void updateWheelEvents(const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> &events);
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
@@ -90,6 +91,8 @@ private:
MouseState()
: xAxis(0.0f)
, yAxis(0.0f)
+ , wXAxis(0.0f)
+ , wYAxis(0.0f)
, leftPressed(false)
, rightPressed(false)
, centerPressed(false)
@@ -97,6 +100,8 @@ private:
float xAxis;
float yAxis;
+ float wXAxis;
+ float wYAxis;
bool leftPressed;
bool rightPressed;
bool centerPressed;
diff --git a/src/input/frontend/qinputsettings.cpp b/src/input/frontend/qinputsettings.cpp
index 08e3ce300..34ed3b438 100644
--- a/src/input/frontend/qinputsettings.cpp
+++ b/src/input/frontend/qinputsettings.cpp
@@ -48,10 +48,15 @@ namespace Qt3DInput {
/*!
\class Qt3DInput::QInputSettings
\inmodule Qt3DInput
- \inherits Qt3DCore::QComponant
- \brief QInputSettings stores settings for the specified eventSource.
-
+ \inherits Qt3DCore::QComponent
+ \brief QInputSettings class holds the pointer to an input event source object.
\since 5.7
+
+ The QInputSettings component must be set as a component of the scene root entity.
+ It stores a pointer to the object that acts as the source of input events to be handled
+ by various input classes. For example, a QWindow instance can be an event source.
+
+ \sa QMouseDevice, QKeyboardDevice
*/
/*!
@@ -59,10 +64,14 @@ namespace Qt3DInput {
\inqmlmodule Qt3D.Input
\inherits Component3D
\instantiates Qt3DInput::QInputSettings
- \brief QML frontend for the Qt3DInput::QInputSettings C++ class.
-
- Stores settings the specified eventSource
+ \brief InputSettings holds the pointer to an input event source object.
\since 5.7
+
+ The InputSettings component must be set as a component of the scene root entity.
+ It stores a pointer to the object that acts as the source of input events to be handled
+ by various input classes. For example, a Window instance can be an event source.
+
+ \sa MouseDevice, KeyboardDevice
*/
QInputSettingsPrivate::QInputSettingsPrivate()
@@ -71,15 +80,11 @@ QInputSettingsPrivate::QInputSettingsPrivate()
{
}
-/*!
- Constructs a new QInputSettings instance with \a parent.
- */
QInputSettings::QInputSettings(Qt3DCore::QNode *parent)
: Qt3DCore::QComponent(*new QInputSettingsPrivate(), parent)
{
}
-/*! \internal */
QInputSettings::~QInputSettings()
{
}
@@ -87,41 +92,24 @@ QInputSettings::~QInputSettings()
/*!
\property QInputSettings::eventSource
- Holds the source for the QInputSettings.
+ Holds the current event source. An event source is an object that is capable
+ of receiving various input events, such as mouse or keyboard events.
+ Typically it is a QWindow instance.
*/
-/*!
- \fn QInputSettings::eventSourceChanged(QObject *)
-
- This signal is emitted when the even source associated with the input setting is changed.
-*/
/*!
- \qmlproperty QObject Qt3D.Input::InputSettings::eventSource
+ \qmlproperty Object InputSettings::eventSource
- The current event source of the InputSettings object
+ Holds the current event source. An event source is an object that is capable
+ of receiving various input events, such as mouse or keyboard events.
+ Typically it is a Window instance.
*/
-
-/*!
- \qmlsignal Qt3D.Input::InputSettings::ventSourceChanged(QObject *)
-
- This signal is emitted when the even source associated with the input setting is changed.
-
- The corresponding handler is \c onEventSourceChanged
-*/
-
-/*!
- * \brief QInputSettings::eventSource
- * \return the current event source of the QInputSettings instance.
- */
QObject *QInputSettings::eventSource() const
{
Q_D(const QInputSettings);
return d->m_eventSource;
}
-/*!
- Set the current event source of the QInputSettings instance to \a eventSource.
- */
void QInputSettings::setEventSource(QObject *eventSource)
{
Q_D(QInputSettings);
diff --git a/src/input/frontend/qmousedevice.cpp b/src/input/frontend/qmousedevice.cpp
index d0ae0317d..56d3731ce 100644
--- a/src/input/frontend/qmousedevice.cpp
+++ b/src/input/frontend/qmousedevice.cpp
@@ -45,35 +45,43 @@
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
+
/*! \internal */
QMouseDevicePrivate::QMouseDevicePrivate()
: QAbstractPhysicalDevicePrivate()
, m_sensitivity(0.1f)
{
}
-/*!
- * \qmltype MouseDevice
- * \instantiates Qt3DInput::QMouseDevice
- * \inqmlmodule Qt3D.Input
- * \since 5.5
- * \brief Delegates mouse events to the attached MouseHandler objects.
- * \TODO
- * \sa MouseHandler
- */
/*!
- * \class Qt3DInput::QMouseDevice
- * \inmodule Qt3DInput
- *
- * \brief QMouseDevice is in charge of dispatching mouse events to
- * attached QMouseHandler objects.
- *
- * \since 5.5
- * \sa QMouseHandler
+ \qmltype MouseDevice
+ \instantiates Qt3DInput::QMouseDevice
+ \inqmlmodule Qt3D.Input
+ \since 5.5
+ \brief Delegates mouse events to the attached MouseHandler objects.
+
+ A MouseDevice delegates mouse events from physical mouse device to
+ MouseHandler objects. The sensitivity of the mouse can be controlled
+ with the \l MouseDevice::sensitivity property, which specifies the rate
+ in which the logical mouse coordinates change in response to physical
+ movement of the mouse.
+
+ \sa MouseHandler
*/
/*!
- \qmlproperty real MouseDevice::sensitivity
+ \class Qt3DInput::QMouseDevice
+ \inmodule Qt3DInput
+ \since 5.5
+ \brief Delegates mouse events to the attached MouseHandler objects.
+
+ A QMouseDevice delegates mouse events from physical mouse device to
+ QMouseHandler objects. The sensitivity of the mouse can be controlled
+ with the \l QMouseDevice::sensitivity property, which specifies the rate
+ in which the logical mouse coordinates change in response to physical
+ movement of the mouse.
+
+ \sa QMouseHandler
*/
/*!
@@ -83,11 +91,27 @@ QMouseDevicePrivate::QMouseDevicePrivate()
\value X
\value Y
+ \value WheelX
+ \value WheelY
\sa Qt3DInput::QAnalogAxisInput::setAxis
*/
/*!
+ \qmlproperty real MouseDevice::sensitivity
+
+ Holds the current sensitivity of the mouse device.
+ Default is 0.1.
+ */
+
+/*!
+ \property Qt3DInput::QMouseDevice::sensitivity
+
+ Holds the sensitivity of the mouse device.
+ Default is 0.1.
+ */
+
+/*!
Constructs a new QMouseDevice instance with parent \a parent.
*/
QMouseDevice::QMouseDevice(QNode *parent)
@@ -103,12 +127,11 @@ QMouseDevice::~QMouseDevice()
/*!
\return the axis count.
- \note Currently always returns 2.
+ \note Currently always returns 4.
*/
int QMouseDevice::axisCount() const
{
- // TO DO: we could have mouse wheel later on
- return 2;
+ return 4;
}
/*!
@@ -130,7 +153,9 @@ QStringList QMouseDevice::axisNames() const
{
return QStringList()
<< QStringLiteral("X")
- << QStringLiteral("Y");
+ << QStringLiteral("Y")
+ << QStringLiteral("WheelX")
+ << QStringLiteral("WheelY");
}
/*!
@@ -155,14 +180,13 @@ int QMouseDevice::axisIdentifier(const QString &name) const
return X;
else if (name == QLatin1String("Y"))
return Y;
+ else if (name == QLatin1String("WheelX"))
+ return WheelX;
+ else if (name == QLatin1String("WheelY"))
+ return WheelY;
return -1;
}
-/*!
- \property Qt3DInput::QMouseDevice::sensitivity
-
- The sensitivity of the device.
- */
float QMouseDevice::sensitivity() const
{
Q_D(const QMouseDevice);
diff --git a/src/input/frontend/qmousedevice.h b/src/input/frontend/qmousedevice.h
index fe43c6c84..7a1f6332a 100644
--- a/src/input/frontend/qmousedevice.h
+++ b/src/input/frontend/qmousedevice.h
@@ -63,7 +63,9 @@ public:
enum Axis {
X,
- Y
+ Y,
+ WheelX,
+ WheelY
};
Q_ENUM(Axis)
diff --git a/src/logic/qframeaction.cpp b/src/logic/qframeaction.cpp
index a7ca8d5d4..fa4cefe06 100644
--- a/src/logic/qframeaction.cpp
+++ b/src/logic/qframeaction.cpp
@@ -55,8 +55,8 @@ QFrameActionPrivate::QFrameActionPrivate()
\since 5.5
\brief Provides a way to have a synchronous function executed each frame.
- The QFrameAction provides a way to perform tasks each frame in
- synchronized with the Qt3D backend. This is useful to implement some
+ The QFrameAction provides a way to perform tasks each frame in a
+ synchronized way with the Qt3D backend. This is useful to implement some
aspects of application logic and to prototype functionality that can later
be folded into an additional Qt3D aspect.
@@ -64,7 +64,7 @@ QFrameActionPrivate::QFrameActionPrivate()
with the Qt3D engine where a Qt Quick animation element is not perfectly
synchronized and may lead to stutters in some cases.
- To execute your own code each frame override the onTriggered function.
+ To execute your own code each frame connect to the QFrameAction::triggered signal.
*/
/*!
@@ -73,6 +73,18 @@ QFrameActionPrivate::QFrameActionPrivate()
\instantiates Qt3DLogic::QFrameAction
\inherits Component3D
\since 5.5
+ \brief Provides a way to have a synchronous function executed each frame.
+
+ The FrameAction provides a way to perform tasks each frame in a
+ synchronized way with the Qt3D backend. This is useful to implement some
+ aspects of application logic and to prototype functionality that can later
+ be folded into an additional Qt3D aspect.
+
+ For example, the FrameAction can be used to animate a property in sync
+ with the Qt3D engine where a Qt Quick animation element is not perfectly
+ synchronized and may lead to stutters in some cases.
+
+ To execute your own code each frame connect to the FrameAction::triggered signal.
*/
/*!
@@ -107,15 +119,13 @@ void QFrameAction::onTriggered(float dt)
}
/*!
- \qmlsignal Qt3D.Logic::FrameAction::triggered(float dt)
+ \qmlsignal Qt3D.Logic::FrameAction::triggered(real dt)
This signal is emitted each frame.
-
- The corresponding handler is \c onTriggered
*/
/*!
- \fn QFrameAction::triggered(float dt)
- This signal is emitted each frame with \a dt being the time since the last triggering.
+ \fn QFrameAction::triggered(float dt)
+ This signal is emitted each frame with \a dt being the time since the last triggering.
*/
} // namespace Qt3DLogic
diff --git a/src/plugins/sceneparsers/assimp/assimpio.cpp b/src/plugins/sceneparsers/assimp/assimpio.cpp
index 65fa7b538..cc40fd1f7 100644
--- a/src/plugins/sceneparsers/assimp/assimpio.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpio.cpp
@@ -301,6 +301,7 @@ QStringList AssimpIO::assimpSupportedFormats()
formats.append(QStringLiteral("vta"));
formats.append(QStringLiteral("x"));
formats.append(QStringLiteral("xml"));
+ formats.append(QStringLiteral("fbx"));
return formats;
}
diff --git a/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml b/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml
index 4e3af0352..ae8869473 100644
--- a/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml
+++ b/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml
@@ -163,13 +163,13 @@ Entity {
id: keyboardZAxis
ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- buttons: [Qt.Key_Up]
- scale: d.shiftPressed ? 1.0 : 0.0
+ buttons: [Qt.Key_PageUp]
+ scale: 1.0
}
ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- buttons: [Qt.Key_Down]
- scale: d.shiftPressed ? -1.0 : 0.0
+ buttons: [Qt.Key_PageDown]
+ scale: -1.0
}
},
Axis {
@@ -177,12 +177,12 @@ Entity {
ButtonAxisInput {
sourceDevice: keyboardSourceDevice
buttons: [Qt.Key_Up]
- scale: d.shiftPressed ? 0.0 : 1.0
+ scale: 1.0
}
ButtonAxisInput {
sourceDevice: keyboardSourceDevice
buttons: [Qt.Key_Down]
- scale: d.shiftPressed ? 0.0 : -1.0
+ scale: -1.0
}
}
] // axes
@@ -206,8 +206,8 @@ Entity {
} else {
// Translate
root.camera.translate(Qt.vector3d(d.translationX, d.translationY, 0).times(dt));
- return
}
+ return
} else if (d.rightMouseButtonPressed) {
// Orbit
root.camera.panAboutViewCenter(d.orbitX * dt, d.firstPersonUp);
@@ -221,14 +221,14 @@ Entity {
} else if (d.shiftPressed) {
if (zoomDistance(root.camera.position, root.camera.viewCenter) > root.zoomLimit * root.zoomLimit) {
// Dolly up to limit
- root.camera.translate(Qt.vector3d(0, 0, d.translationZ).times(dt), Camera.DontTranslateViewCenter);
+ root.camera.translate(Qt.vector3d(0, 0, d.translationY).times(dt), Camera.DontTranslateViewCenter);
} else {
// Too close, Dolly backwards
root.camera.translate(Qt.vector3d(0, 0, -1).times(dt), Camera.DontTranslateViewCenter);
}
} else {
// Translate
- root.camera.translate(Qt.vector3d(d.translationX, d.translationY, 0).times(dt));
+ root.camera.translate(Qt.vector3d(d.translationX, d.translationY, d.translationZ).times(dt));
}
}
}
diff --git a/src/quick3d/quick3d/items/quick3dentity.cpp b/src/quick3d/quick3d/items/quick3dentity.cpp
index 4eac4400e..ebc92e843 100644
--- a/src/quick3d/quick3d/items/quick3dentity.cpp
+++ b/src/quick3d/quick3d/items/quick3dentity.cpp
@@ -47,20 +47,37 @@ namespace Quick {
/*!
\qmltype Entity
+ \instantiates Qt3DCore::QEntity
\inherits Node
\inqmlmodule Qt3D.Core
\since 5.5
-*/
+
+ \brief Entity is a \l Node subclass that can aggregate several
+ \l Component3D instances that will specify its behavior.
+
+ By itself a Entity is an empty shell. The behavior of a Entity
+ object is defined by the \l Component3D objects it references. Each Qt3D
+ backend aspect will be able to interpret and process an Entity by
+ recognizing which components it is made up of. One aspect may decide to only
+ process entities composed of a single \l Transform component whilst
+ another may focus on \l MouseHandler.
+
+ \sa Qt3D.Core::Component3D, Qt3D.Core::Transform
+ */
+
+/*!
+ \qmlproperty list<Component3D> Entity::components
+ Holds the list of \l Component3D instances, which define the behavior
+ of the entity.
+ \readonly
+ */
Quick3DEntity::Quick3DEntity(QObject *parent)
: QObject(parent)
{
}
-/*!
- \qmlproperty list<Component3D> Qt3DCore::Entity::components
- \readonly
-*/
+
QQmlListProperty<QComponent> Quick3DEntity::componentList()
{
return QQmlListProperty<Qt3DCore::QComponent>(this, 0,
diff --git a/src/quick3d/quick3drender/items/quick3dbuffer.cpp b/src/quick3d/quick3drender/items/quick3dbuffer.cpp
index 68ac21577..5701adf07 100644
--- a/src/quick3d/quick3drender/items/quick3dbuffer.cpp
+++ b/src/quick3d/quick3drender/items/quick3dbuffer.cpp
@@ -37,9 +37,10 @@
**
****************************************************************************/
-#include "quick3dbuffer_p.h"
-#include <QQmlEngine>
#include <QJSValue>
+#include <QQmlEngine>
+
+#include "quick3dbuffer_p.h"
#include <QtQml/private/qqmlengine_p.h>
#include <QtQml/private/qjsvalue_p.h>
#include <QtQml/private/qv4typedarray_p.h>
diff --git a/src/quick3d/quick3drender/items/quick3dparameter.cpp b/src/quick3d/quick3drender/items/quick3dparameter.cpp
index 22b6bba96..783f152c1 100644
--- a/src/quick3d/quick3drender/items/quick3dparameter.cpp
+++ b/src/quick3d/quick3drender/items/quick3dparameter.cpp
@@ -37,11 +37,11 @@
**
****************************************************************************/
-#include "quick3dparameter_p_p.h"
-
#include <QJSValue>
#include <QJSValueIterator>
+#include "quick3dparameter_p_p.h"
+
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdata.cpp b/src/quick3d/quick3drender/items/quick3dshaderdata.cpp
index e5901e8fb..dbf351695 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdata.cpp
+++ b/src/quick3d/quick3drender/items/quick3dshaderdata.cpp
@@ -37,12 +37,12 @@
**
****************************************************************************/
-#include "quick3dshaderdata_p.h"
-#include <private/qshaderdata_p.h>
-
#include <Qt3DQuickRender/private/quick3dshaderdataarray_p.h>
#include <QMetaProperty>
+#include "quick3dshaderdata_p.h"
+#include <private/qshaderdata_p.h>
+
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
diff --git a/src/render/backend/commandexecuter.cpp b/src/render/backend/commandexecuter.cpp
index 92f44c511..2f13b27ea 100644
--- a/src/render/backend/commandexecuter.cpp
+++ b/src/render/backend/commandexecuter.cpp
@@ -251,13 +251,9 @@ QJsonObject parameterPackToJson(const Render::ShaderParameterPack &pack)
for (auto it = uniforms.cbegin(), end = uniforms.cend(); it != end; ++it) {
QJsonObject uniformObj;
uniformObj.insert(QLatin1String("name"), Render::StringToInt::lookupString(it.key()));
- const Render::QUniformValue::UniformType type = it.value().type();
- uniformObj.insert(QLatin1String("value"),
- type == Render::QUniformValue::Value
- ? typeToJsonValue(it.value().value())
- : typeToJsonValue(it.value().textureId()));
+ const Render::UniformValue::ValueType type = it.value().valueType();
uniformObj.insert(QLatin1String("type"),
- type == Render::QUniformValue::Value
+ type == Render::UniformValue::ScalarValue
? QLatin1String("value")
: QLatin1String("texture"));
uniformsArray.push_back(uniformObj);
diff --git a/src/render/backend/render-backend.pri b/src/render/backend/render-backend.pri
index 256cba78e..a55a72d8b 100644
--- a/src/render/backend/render-backend.pri
+++ b/src/render/backend/render-backend.pri
@@ -7,7 +7,6 @@ HEADERS += \
$$PWD/renderthread_p.h \
$$PWD/renderconfiguration_p.h \
$$PWD/renderer_p.h \
- $$PWD/quniformvalue_p.h \
$$PWD/renderview_p.h \
$$PWD/rendercommand_p.h \
$$PWD/renderqueue_p.h \
@@ -36,13 +35,14 @@ HEADERS += \
$$PWD/stringtoint_p.h \
$$PWD/backendnode_p.h \
$$PWD/rendertargetoutput_p.h \
- $$PWD/commandexecuter_p.h
+ $$PWD/commandexecuter_p.h \
+ $$PWD/uniform_p.h \
+ $$PWD/shaderparameterpack_p.h
SOURCES += \
$$PWD/renderthread.cpp \
$$PWD/renderconfiguration.cpp \
$$PWD/renderer.cpp \
- $$PWD/quniformvalue.cpp \
$$PWD/renderview.cpp \
$$PWD/rendercommand.cpp \
$$PWD/renderqueue.cpp \
@@ -66,5 +66,7 @@ SOURCES += \
$$PWD/rendertargetoutput.cpp \
$$PWD/attachmentpack.cpp \
$$PWD/commandexecuter.cpp \
- $$PWD/openglvertexarrayobject.cpp
+ $$PWD/openglvertexarrayobject.cpp \
+ $$PWD/uniform.cpp \
+ $$PWD/shaderparameterpack.cpp
diff --git a/src/render/backend/rendercommand_p.h b/src/render/backend/rendercommand_p.h
index dc65ac7ed..012cdbe9a 100644
--- a/src/render/backend/rendercommand_p.h
+++ b/src/render/backend/rendercommand_p.h
@@ -53,7 +53,7 @@
//
#include <qglobal.h>
-#include <Qt3DRender/private/quniformvalue_p.h>
+#include <Qt3DRender/private/shaderparameterpack_p.h>
#include <Qt3DRender/private/handle_types_p.h>
#include <Qt3DRender/qgeometryrenderer.h>
#include <QOpenGLShaderProgram>
diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp
index ca60b8e33..7f53d3c99 100644
--- a/src/render/backend/renderer.cpp
+++ b/src/render/backend/renderer.cpp
@@ -919,6 +919,12 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren
frameElapsed = timer.elapsed();
}
+ // Bind lastBoundFBOId back. Needed also in threaded mode.
+ // lastBoundFBOId != m_graphicsContext->activeFBO() when the last FrameGraph leaf node/renderView
+ // contains RenderTargetSelector/RenderTarget
+ if (lastBoundFBOId != m_graphicsContext->activeFBO())
+ m_graphicsContext->bindFramebuffer(lastBoundFBOId);
+
// Reset state and call doneCurrent if the surface
// is valid and was actually activated
if (surface && m_graphicsContext->hasValidGLHelper()) {
diff --git a/src/render/backend/renderer_p.h b/src/render/backend/renderer_p.h
index da3d4e1e9..ffc60273a 100644
--- a/src/render/backend/renderer_p.h
+++ b/src/render/backend/renderer_p.h
@@ -54,7 +54,7 @@
#include <Qt3DRender/qrenderaspect.h>
#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/private/quniformvalue_p.h>
+#include <Qt3DRender/private/shaderparameterpack_p.h>
#include <Qt3DRender/private/handle_types_p.h>
#include <Qt3DRender/private/abstractrenderer_p.h>
#include <Qt3DCore/qaspectjob.h>
diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp
index 552e66f6d..df165e2d0 100644
--- a/src/render/backend/renderview.cpp
+++ b/src/render/backend/renderview.cpp
@@ -133,80 +133,80 @@ RenderView::StandardUniformsPFuncsHash RenderView::initializeStandardUniformSett
return setters;
}
-QUniformValue RenderView::modelMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::modelMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue(QVariant::fromValue(model));
+ return UniformValue(model);
}
-QUniformValue RenderView::viewMatrix(const QMatrix4x4 &) const
+UniformValue RenderView::viewMatrix(const QMatrix4x4 &) const
{
- return QUniformValue(QVariant::fromValue(m_data.m_viewMatrix));
+ return UniformValue(m_data.m_viewMatrix);
}
-QUniformValue RenderView::projectionMatrix(const QMatrix4x4 &) const
+UniformValue RenderView::projectionMatrix(const QMatrix4x4 &) const
{
- return QUniformValue(QVariant::fromValue(m_data.m_renderCameraLens->projection()));
+ return UniformValue(m_data.m_renderCameraLens->projection());
}
-QUniformValue RenderView::modelViewMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::modelViewMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue(QVariant::fromValue(m_data.m_viewMatrix * model));
+ return UniformValue(m_data.m_viewMatrix * model);
}
-QUniformValue RenderView::viewProjectionMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::viewProjectionMatrix(const QMatrix4x4 &model) const
{
Q_UNUSED(model);
- return QUniformValue(QVariant::fromValue(m_data.m_renderCameraLens->projection() * m_data.m_viewMatrix));
+ return UniformValue(m_data.m_renderCameraLens->projection() * m_data.m_viewMatrix);
}
-QUniformValue RenderView::modelViewProjectionMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::modelViewProjectionMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue(QVariant::fromValue(m_data.m_viewProjectionMatrix * model));
+ return UniformValue(m_data.m_viewProjectionMatrix * model);
}
-QUniformValue RenderView::inverseModelMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::inverseModelMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue(QVariant::fromValue(model.inverted()));
+ return UniformValue(model.inverted());
}
-QUniformValue RenderView::inverseViewMatrix(const QMatrix4x4 &) const
+UniformValue RenderView::inverseViewMatrix(const QMatrix4x4 &) const
{
- return QUniformValue(QVariant::fromValue(m_data.m_viewMatrix.inverted()));
+ return UniformValue(m_data.m_viewMatrix.inverted());
}
-QUniformValue RenderView::inverseProjectionMatrix(const QMatrix4x4 &) const
+UniformValue RenderView::inverseProjectionMatrix(const QMatrix4x4 &) const
{
QMatrix4x4 projection;
if (m_data.m_renderCameraLens)
projection = m_data.m_renderCameraLens->projection();
- return QUniformValue(QVariant::fromValue(projection.inverted()));
+ return UniformValue(projection.inverted());
}
-QUniformValue RenderView::inverseModelViewMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::inverseModelViewMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue(QVariant::fromValue((m_data.m_viewMatrix * model).inverted()));
+ return UniformValue((m_data.m_viewMatrix * model).inverted());
}
-QUniformValue RenderView::inverseViewProjectionMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::inverseViewProjectionMatrix(const QMatrix4x4 &model) const
{
Q_UNUSED(model);
const auto viewProjectionMatrix = m_data.m_renderCameraLens->projection() * m_data.m_viewMatrix;
- return QUniformValue(QVariant::fromValue(viewProjectionMatrix.inverted()));
+ return UniformValue(viewProjectionMatrix.inverted());
}
-QUniformValue RenderView::inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue(QVariant::fromValue((m_data.m_viewProjectionMatrix * model).inverted(0)));
+ return UniformValue((m_data.m_viewProjectionMatrix * model).inverted(0));
}
-QUniformValue RenderView::modelNormalMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::modelNormalMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue(QVariant::fromValue(model.normalMatrix()));
+ return UniformValue(model.normalMatrix());
}
-QUniformValue RenderView::modelViewNormalMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::modelViewNormalMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue(QVariant::fromValue((m_data.m_viewMatrix * model).normalMatrix()));
+ return UniformValue((m_data.m_viewMatrix * model).normalMatrix());
}
// TODO: Move this somewhere global where GraphicsContext::setViewport() can use it too
@@ -218,38 +218,38 @@ static QRectF resolveViewport(const QRectF &fractionalViewport, const QSize &sur
fractionalViewport.height() * surfaceSize.height());
}
-QUniformValue RenderView::viewportMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::viewportMatrix(const QMatrix4x4 &model) const
{
// TODO: Can we avoid having to pass the model matrix in to these functions?
Q_UNUSED(model);
QMatrix4x4 viewportMatrix;
viewportMatrix.viewport(resolveViewport(m_viewport, m_surfaceSize));
- return QUniformValue(QVariant::fromValue(viewportMatrix));
+ return UniformValue(viewportMatrix);
}
-QUniformValue RenderView::inverseViewportMatrix(const QMatrix4x4 &model) const
+UniformValue RenderView::inverseViewportMatrix(const QMatrix4x4 &model) const
{
Q_UNUSED(model);
QMatrix4x4 viewportMatrix;
viewportMatrix.viewport(resolveViewport(m_viewport, m_surfaceSize));
QMatrix4x4 inverseViewportMatrix = viewportMatrix.inverted();
- return QUniformValue(QVariant::fromValue(inverseViewportMatrix));
+ return UniformValue(inverseViewportMatrix);
}
-QUniformValue RenderView::time(const QMatrix4x4 &model) const
+UniformValue RenderView::time(const QMatrix4x4 &model) const
{
Q_UNUSED(model);
qint64 time = m_renderer->time();
float t = time / 1000000000.0f;
- return QUniformValue(QVariant(t));
+ return UniformValue(t);
}
-QUniformValue RenderView::eyePosition(const QMatrix4x4 &model) const
+UniformValue RenderView::eyePosition(const QMatrix4x4 &model) const
{
Q_UNUSED(model);
- return QUniformValue(QVariant::fromValue(m_data.m_eyePos));
+ return UniformValue(m_data.m_eyePos);
}
RenderView::RenderView()
@@ -326,7 +326,7 @@ void RenderView::sort()
// sharing the same material (shader) are rendered, we can't have the case
// where two uniforms, referencing the same texture eventually have 2 different
// texture unit values
- const QUniformValue refValue = cachedUniforms.value(it.key());
+ const UniformValue refValue = cachedUniforms.value(it.key());
if (it.value() == refValue) {
it = uniforms.erase(it);
} else {
@@ -532,27 +532,24 @@ void RenderView::updateMatrices()
}
}
-void RenderView::setUniformValue(ShaderParameterPack &uniformPack, int nameId, const QVariant &value) const
+void RenderView::setUniformValue(ShaderParameterPack &uniformPack, int nameId, const UniformValue &value) const
{
- Texture *tex = nullptr;
// At this point a uniform value can only be a scalar type
// or a Qt3DCore::QNodeId corresponding to a Texture
// ShaderData/Buffers would be handled as UBO/SSBO and would therefore
// not be in the default uniform block
- if (static_cast<QMetaType::Type>(value.userType()) == qNodeIdTypeId) {
- // Speed up conversion to avoid using QVariant::value()
- const Qt3DCore::QNodeId texId = variant_value<Qt3DCore::QNodeId>(value);
+ if (value.valueType() == UniformValue::NodeId) {
+ Texture *tex = nullptr;
+ const Qt3DCore::QNodeId texId = *value.constData<Qt3DCore::QNodeId>();
if ((tex = m_manager->textureManager()->lookupResource(texId))
!= nullptr) {
uniformPack.setTexture(nameId, tex->peerId());
- //TextureUniform *texUniform = m_allocator->allocate<TextureUniform>();
- QUniformValue texUniform;
- texUniform.setType(QUniformValue::TextureSampler);
- texUniform.setTextureId(tex->peerId());
- uniformPack.setUniform(nameId, texUniform);
+ UniformValue::Texture textureValue;
+ textureValue.nodeId = texId;
+ uniformPack.setUniform(nameId, UniformValue(textureValue));
}
} else {
- uniformPack.setUniform(nameId, QUniformValue(value));
+ uniformPack.setUniform(nameId, value);
}
}
@@ -564,14 +561,14 @@ void RenderView::setStandardUniformValue(ShaderParameterPack &uniformPack, int g
void RenderView::setUniformBlockValue(ShaderParameterPack &uniformPack,
Shader *shader,
const ShaderUniformBlock &block,
- const QVariant &value) const
+ const UniformValue &value) const
{
Q_UNUSED(shader)
- if (static_cast<QMetaType::Type>(value.userType()) == qNodeIdTypeId) {
+ if (value.valueType() == UniformValue::NodeId) {
Buffer *buffer = nullptr;
- if ((buffer = m_manager->bufferManager()->lookupResource(variant_value<Qt3DCore::QNodeId>(value))) != nullptr) {
+ if ((buffer = m_manager->bufferManager()->lookupResource(*value.constData<Qt3DCore::QNodeId>())) != nullptr) {
BlockToUBO uniformBlockUBO;
uniformBlockUBO.m_blockIndex = block.m_index;
uniformBlockUBO.m_bufferID = buffer->peerId();
@@ -634,12 +631,12 @@ void RenderView::setUniformBlockValue(ShaderParameterPack &uniformPack,
void RenderView::setShaderStorageValue(ShaderParameterPack &uniformPack,
Shader *shader,
const ShaderStorageBlock &block,
- const QVariant &value) const
+ const UniformValue &value) const
{
Q_UNUSED(shader)
- if (static_cast<QMetaType::Type>(value.userType()) == qNodeIdTypeId) {
+ if (value.valueType() == UniformValue::NodeId) {
Buffer *buffer = nullptr;
- if ((buffer = m_manager->bufferManager()->lookupResource(variant_value<Qt3DCore::QNodeId>(value))) != nullptr) {
+ if ((buffer = m_manager->bufferManager()->lookupResource(*value.constData<Qt3DCore::QNodeId>())) != nullptr) {
BlockToSSBO shaderStorageBlock;
shaderStorageBlock.m_blockIndex = block.m_index;
shaderStorageBlock.m_bufferID = buffer->peerId();
@@ -654,10 +651,8 @@ void RenderView::setDefaultUniformBlockShaderDataValue(ShaderParameterPack &unif
UniformBlockValueBuilder *builder = m_localData.localData();
builder->activeUniformNamesToValue.clear();
- // updates transformed properties;
- // Fix me: this will lead to races when having multiple cameras
- shaderData->updateViewTransform(m_data.m_viewMatrix);
-
+ // Set the view matrix to be used to transform "Transformed" properties in the ShaderData
+ builder->viewMatrix = m_data.m_viewMatrix;
// Force to update the whole block
builder->updatedPropertiesOnly = false;
// Retrieve names and description of each active uniforms in the uniform block
@@ -668,8 +663,9 @@ void RenderView::setDefaultUniformBlockShaderDataValue(ShaderParameterPack &unif
QHash<int, QVariant>::const_iterator activeValuesIt = builder->activeUniformNamesToValue.constBegin();
const QHash<int, QVariant>::const_iterator activeValuesEnd = builder->activeUniformNamesToValue.constEnd();
+ // TO DO: Make the ShaderData store UniformValue
while (activeValuesIt != activeValuesEnd) {
- setUniformValue(uniformPack, activeValuesIt.key(), activeValuesIt.value());
+ setUniformValue(uniformPack, activeValuesIt.key(), UniformValue::fromVariant(activeValuesIt.value()));
++activeValuesIt;
}
}
@@ -769,10 +765,10 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass,
} else if (shaderStorageBlockNamesIds.indexOf(it->nameId) != -1) { // Parameters is a SSBO
setShaderStorageValue(command->m_parameterPack, shader, shader->storageBlockForBlockNameId(it->nameId), it->value);
} else { // Parameter is a struct
- const QVariant &v = it->value;
+ const UniformValue &v = it->value;
ShaderData *shaderData = nullptr;
- if (static_cast<QMetaType::Type>(v.userType()) == qNodeIdTypeId &&
- (shaderData = m_manager->shaderDataManager()->lookupResource(variant_value<Qt3DCore::QNodeId>(v))) != nullptr) {
+ if (v.valueType() == UniformValue::NodeId &&
+ (shaderData = m_manager->shaderDataManager()->lookupResource(*v.constData<Qt3DCore::QNodeId>())) != nullptr) {
// Try to check if we have a struct or array matching a QShaderData parameter
setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, StringToInt::lookupString(it->nameId));
}
@@ -797,11 +793,15 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass,
if (lightIdx == MAX_LIGHTS)
break;
+ // Note: implicit conversion of values to UniformValue
setUniformValue(command->m_parameterPack, LIGHT_POSITION_NAMES[lightIdx], worldPos);
setUniformValue(command->m_parameterPack, LIGHT_TYPE_NAMES[lightIdx], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[lightIdx], QVector3D(1.0f, 1.0f, 1.0f));
setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_NAMES[lightIdx], 0.5f);
+ // There is no risk in doing that even if multithreaded
+ // since we are sure that a shaderData is unique for a given light
+ // and won't ever be referenced as a Component either
QMatrix4x4 *worldTransform = lightEntity->worldTransform();
if (worldTransform)
shaderData->updateWorldTransform(*worldTransform);
@@ -812,9 +812,10 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass,
}
if (uniformNamesIds.contains(LIGHT_COUNT_NAME_ID))
- setUniformValue(command->m_parameterPack, LIGHT_COUNT_NAME_ID, qMax(1, lightIdx));
+ setUniformValue(command->m_parameterPack, LIGHT_COUNT_NAME_ID, UniformValue(qMax(1, lightIdx)));
if (activeLightSources.isEmpty()) {
+ // Note: implicit conversion of values to UniformValue
setUniformValue(command->m_parameterPack, LIGHT_POSITION_NAMES[0], QVector3D(10.0f, 10.0f, 0.0f));
setUniformValue(command->m_parameterPack, LIGHT_TYPE_NAMES[0], int(QAbstractLight::PointLight));
setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[0], QVector3D(1.0f, 1.0f, 1.0f));
diff --git a/src/render/backend/renderview_p.h b/src/render/backend/renderview_p.h
index f974741aa..41b0192c0 100644
--- a/src/render/backend/renderview_p.h
+++ b/src/render/backend/renderview_p.h
@@ -279,39 +279,39 @@ private:
QHash<Qt3DCore::QNodeId, QVector<RenderPassParameterData>> m_parameters;
- typedef QHash<int, QUniformValue (RenderView::*)(const QMatrix4x4& model) const> StandardUniformsPFuncsHash;
+ typedef QHash<int, UniformValue (RenderView::*)(const QMatrix4x4& model) const> StandardUniformsPFuncsHash;
static StandardUniformsPFuncsHash ms_standardUniformSetters;
static StandardUniformsPFuncsHash initializeStandardUniformSetters();
- QUniformValue modelMatrix(const QMatrix4x4& model) const;
- QUniformValue viewMatrix(const QMatrix4x4&) const;
- QUniformValue projectionMatrix(const QMatrix4x4 &) const;
- QUniformValue modelViewMatrix(const QMatrix4x4 &model) const;
- QUniformValue viewProjectionMatrix(const QMatrix4x4 &model) const;
- QUniformValue modelViewProjectionMatrix(const QMatrix4x4 &model) const;
- QUniformValue inverseModelMatrix(const QMatrix4x4 &model) const;
- QUniformValue inverseViewMatrix(const QMatrix4x4 &) const;
- QUniformValue inverseProjectionMatrix(const QMatrix4x4 &) const;
- QUniformValue inverseModelViewMatrix(const QMatrix4x4 &model) const;
- QUniformValue inverseViewProjectionMatrix(const QMatrix4x4 &model) const;
- QUniformValue inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const;
- QUniformValue modelNormalMatrix(const QMatrix4x4 &model) const;
- QUniformValue modelViewNormalMatrix(const QMatrix4x4 &model) const;
- QUniformValue viewportMatrix(const QMatrix4x4 &model) const;
- QUniformValue inverseViewportMatrix(const QMatrix4x4 &model) const;
- QUniformValue time(const QMatrix4x4 &model) const;
- QUniformValue eyePosition(const QMatrix4x4 &model) const;
-
- void setUniformValue(ShaderParameterPack &uniformPack, int nameId, const QVariant &value) const;
+ UniformValue modelMatrix(const QMatrix4x4& model) const;
+ UniformValue viewMatrix(const QMatrix4x4&) const;
+ UniformValue projectionMatrix(const QMatrix4x4 &) const;
+ UniformValue modelViewMatrix(const QMatrix4x4 &model) const;
+ UniformValue viewProjectionMatrix(const QMatrix4x4 &model) const;
+ UniformValue modelViewProjectionMatrix(const QMatrix4x4 &model) const;
+ UniformValue inverseModelMatrix(const QMatrix4x4 &model) const;
+ UniformValue inverseViewMatrix(const QMatrix4x4 &) const;
+ UniformValue inverseProjectionMatrix(const QMatrix4x4 &) const;
+ UniformValue inverseModelViewMatrix(const QMatrix4x4 &model) const;
+ UniformValue inverseViewProjectionMatrix(const QMatrix4x4 &model) const;
+ UniformValue inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const;
+ UniformValue modelNormalMatrix(const QMatrix4x4 &model) const;
+ UniformValue modelViewNormalMatrix(const QMatrix4x4 &model) const;
+ UniformValue viewportMatrix(const QMatrix4x4 &model) const;
+ UniformValue inverseViewportMatrix(const QMatrix4x4 &model) const;
+ UniformValue time(const QMatrix4x4 &model) const;
+ UniformValue eyePosition(const QMatrix4x4 &model) const;
+
+ void setUniformValue(ShaderParameterPack &uniformPack, int nameId, const UniformValue &value) const;
void setStandardUniformValue(ShaderParameterPack &uniformPack, int glslNameId, int nameId, const QMatrix4x4 &worldTransform) const;
void setUniformBlockValue(ShaderParameterPack &uniformPack,
Shader *shader,
const ShaderUniformBlock &block,
- const QVariant &value) const;
+ const UniformValue &value) const;
void setShaderStorageValue(ShaderParameterPack &uniformPack,
Shader *shader,
const ShaderStorageBlock &block,
- const QVariant &value) const;
+ const UniformValue &value) const;
void setDefaultUniformBlockShaderDataValue(ShaderParameterPack &uniformPack,
Shader *shader,
ShaderData *shaderData,
diff --git a/src/render/backend/quniformvalue.cpp b/src/render/backend/shaderparameterpack.cpp
index 09327c213..01a977aee 100644
--- a/src/render/backend/quniformvalue.cpp
+++ b/src/render/backend/shaderparameterpack.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "quniformvalue_p.h"
+#include "shaderparameterpack_p.h"
#include <Qt3DRender/private/graphicscontext_p.h>
#include <Qt3DRender/private/texture_p.h>
@@ -55,42 +55,12 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-void QUniformValue::apply(GraphicsContext *ctx, const ShaderUniform &description) const
-{
- switch (m_type) {
- case Value:
- ctx->bindUniform(m_var, description);
- break;
-
- case TextureSampler:
- // We assume that the texture has been successfully bound and attache to a texture unit
- if (m_textureIdUnit.m_textureUnit != -1) {
- ctx->bindUniform(m_textureIdUnit.m_textureUnit, description);
-#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
- int err = ctx->openGLContext()->functions()->glGetError();
- if (err) {
- qCWarning(Render::Backend, "Error %d after setting uniform \"%s\" at location %d",
- err, qUtf8Printable(description.m_name), description.m_location);
- }
-#endif
- } else {
- qCWarning(Render::Backend, "Invalid texture unit supplied for \"%s\"",
- qUtf8Printable(description.m_nameId));
- }
- break;
-
- default:
- break;
- }
-}
-
-
ShaderParameterPack::~ShaderParameterPack()
{
m_uniforms.clear();
}
-void ShaderParameterPack::setUniform(const int glslNameId, const QUniformValue &val)
+void ShaderParameterPack::setUniform(const int glslNameId, const UniformValue &val)
{
m_uniforms.insert(glslNameId, val);
}
diff --git a/src/render/backend/quniformvalue_p.h b/src/render/backend/shaderparameterpack_p.h
index fb8158d84..c0ab05e57 100644
--- a/src/render/backend/quniformvalue_p.h
+++ b/src/render/backend/shaderparameterpack_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QT3DRENDER_RENDER_QUNIFORMVALUE_H
-#define QT3DRENDER_RENDER_QUNIFORMVALUE_H
+#ifndef QT3DRENDER_RENDER_SHADERPARAMETERPACK_P_H
+#define QT3DRENDER_RENDER_SHADERPARAMETERPACK_P_H
//
// W A R N I N G
@@ -58,6 +58,7 @@
#include <Qt3DCore/qnodeid.h>
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DRender/private/shadervariables_p.h>
+#include <Qt3DRender/private/uniform_p.h>
QT_BEGIN_NAMESPACE
@@ -72,118 +73,6 @@ namespace Render {
class GraphicsContext;
-class QUniformValue
-{
-public:
- enum UniformType {
- Value,
- TextureSampler,
- Unknown
- };
-
- QUniformValue()
- : m_type(Unknown)
- , m_var()
- {
- }
-
- explicit QUniformValue(const QVariant &var, UniformType type = Value)
- : m_type(type)
- , m_var(var)
- {
- }
-
- void setType(UniformType type) Q_DECL_NOTHROW { m_type = type; }
- UniformType type() const Q_DECL_NOTHROW { return m_type; }
- bool isTexture() const Q_DECL_NOTHROW { return m_type == TextureSampler; }
-
- void setValue(const QVariant &value)
- {
- Q_ASSERT(m_type == Value);
- m_var = value;
- }
-
- QVariant value() const
- {
- Q_ASSERT(m_type == Value);
- return m_var;
- }
-
- void setTextureUnit(int textureUnit)
- {
- Q_ASSERT(m_type == TextureSampler);
- m_textureIdUnit.m_textureUnit = textureUnit;
- }
-
- int textureUnit() const
- {
- Q_ASSERT(m_type == TextureSampler);
- return m_textureIdUnit.m_textureUnit;
- }
-
- void setTextureId(Qt3DCore::QNodeId textureId)
- {
- Q_ASSERT(m_type == TextureSampler);
- m_textureIdUnit.m_textureId = textureId;
- }
-
- Qt3DCore::QNodeId textureId() const
- {
- Q_ASSERT(m_type == TextureSampler);
- return m_textureIdUnit.m_textureId;
- }
-
- bool operator ==(const QUniformValue &other)
- {
- if (other.m_type != m_type)
- return false;
-
- switch (m_type) {
- case Value:
- return other.m_var == m_var;
- case TextureSampler:
- return other.m_textureIdUnit == m_textureIdUnit;
- default:
- break;
- }
- return false;
- }
-
- bool operator !=(const QUniformValue &other)
- {
- return !operator ==(other);
- }
-
- void apply(GraphicsContext *ctx, const ShaderUniform &description) const;
-
-protected:
- struct TextureIdUnit {
- Qt3DCore::QNodeId m_textureId;
- int m_textureUnit;
-
- TextureIdUnit()
- : m_textureId()
- , m_textureUnit(-1)
- {}
-
- bool operator == (const TextureIdUnit &other) const Q_DECL_NOTHROW
- {
- return (other.m_textureId == m_textureId) && (other.m_textureUnit == m_textureUnit);
- }
-
- bool operator !=(const TextureIdUnit &other) const Q_DECL_NOTHROW
- {
- return !operator ==(other);
- }
- };
-
- // TODO: Replace QVariant with our own union of GLSL types as we don't
- // need the full flexibility of QVariant on the backend
- UniformType m_type;
- QVariant m_var;
- TextureIdUnit m_textureIdUnit;
-};
-
struct BlockToUBO {
int m_blockIndex;
Qt3DCore::QNodeId m_bufferID;
@@ -199,14 +88,14 @@ struct BlockToSSBO {
QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToSSBO, Q_PRIMITIVE_TYPE)
-typedef QHash<int, QUniformValue> PackUniformHash;
+typedef QHash<int, UniformValue> PackUniformHash;
class ShaderParameterPack
{
public:
~ShaderParameterPack();
- void setUniform(const int glslNameId, const QUniformValue &val);
+ void setUniform(const int glslNameId, const UniformValue &val);
void setTexture(const int glslNameId, Qt3DCore::QNodeId id);
void setUniformBuffer(BlockToUBO blockToUBO);
void setShaderStorageBuffer(BlockToSSBO blockToSSBO);
@@ -214,7 +103,7 @@ public:
inline PackUniformHash &uniforms() { return m_uniforms; }
inline const PackUniformHash &uniforms() const { return m_uniforms; }
- QUniformValue uniform(const int glslNameId) const { return m_uniforms.value(glslNameId); }
+ UniformValue uniform(const int glslNameId) const { return m_uniforms.value(glslNameId); }
struct NamedTexture
{
@@ -249,4 +138,4 @@ QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ShaderParameterPack::NamedTexture, Q
QT_END_NAMESPACE
-#endif // QT3DRENDER_RENDER_QUNIFORMVALUE_H
+#endif // QT3DRENDER_RENDER_SHADERPARAMETERPACK_P_H
diff --git a/src/render/backend/uniform.cpp b/src/render/backend/uniform.cpp
new file mode 100644
index 000000000..3bc1f78ce
--- /dev/null
+++ b/src/render/backend/uniform.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "uniform_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+namespace {
+
+const int qNodeIdTypeId = qMetaTypeId<Qt3DCore::QNodeId>();
+
+}
+
+UniformValue UniformValue::fromVariant(const QVariant &variant)
+{
+ // Texture/Buffer case
+ if (variant.userType() == qNodeIdTypeId)
+ return UniformValue(variant.value<Qt3DCore::QNodeId>());
+
+ UniformValue v;
+ switch (variant.userType()) {
+ case QMetaType::Bool:
+ v.m_data.ivec[0] = variant.toBool();
+ break;
+ case QMetaType::Int:
+ case QMetaType::UInt:
+ case QMetaType::Long:
+ case QMetaType::LongLong:
+ case QMetaType::Short:
+ case QMetaType::ULong:
+ case QMetaType::ULongLong:
+ case QMetaType::UShort:
+ case QMetaType::Char:
+ case QMetaType::UChar:
+ v.m_data.ivec[0] = variant.toInt();
+ break;
+ case QMetaType::Float:
+ case QMetaType::Double: // Convert double to floats
+ v.m_data.fvec[0] = variant.toFloat();
+ break;
+ case QMetaType::QPoint: {
+ const QPoint p = variant.toPoint();
+ v.m_data.ivec[0] = p.x();
+ v.m_data.ivec[1] = p.y();
+ break;
+ }
+ case QMetaType::QSize: {
+ const QSize s = variant.toSize();
+ v.m_data.ivec[0] = s.width();
+ v.m_data.ivec[1] = s.height();
+ break;
+ }
+ case QMetaType::QRect: {
+ const QRect r = variant.toRect();
+ v.m_data.ivec[0] = r.x();
+ v.m_data.ivec[1] = r.y();
+ v.m_data.ivec[2] = r.width();
+ v.m_data.ivec[3] = r.height();
+ break;
+ }
+ case QMetaType::QSizeF: {
+ const QSizeF s = variant.toSize();
+ v.m_data.fvec[0] = s.width();
+ v.m_data.fvec[1] = s.height();
+ break;
+ }
+ case QMetaType::QPointF: {
+ const QPointF p = variant.toPointF();
+ v.m_data.fvec[0] = p.x();
+ v.m_data.fvec[1] = p.y();
+ break;
+ }
+ case QMetaType::QRectF: {
+ const QRectF r = variant.toRect();
+ v.m_data.fvec[0] = r.x();
+ v.m_data.fvec[1] = r.y();
+ v.m_data.fvec[2] = r.width();
+ v.m_data.fvec[3] = r.height();
+ break;
+ }
+ case QMetaType::QVector2D: {
+ const QVector2D vec2 = variant.value<QVector2D>();
+ v.m_data.fvec[0] = vec2.x();
+ v.m_data.fvec[1] = vec2.y();
+ break;
+ }
+ case QMetaType::QVector3D: {
+ const QVector3D vec3 = variant.value<QVector3D>();
+ v.m_data.fvec[0] = vec3.x();
+ v.m_data.fvec[1] = vec3.y();
+ v.m_data.fvec[2] = vec3.z();
+ break;
+ }
+ case QMetaType::QVector4D: {
+ const QVector4D vec4 = variant.value<QVector4D>();
+ v.m_data.fvec[0] = vec4.x();
+ v.m_data.fvec[1] = vec4.y();
+ v.m_data.fvec[2] = vec4.z();
+ v.m_data.fvec[3] = vec4.w();
+ break;
+ }
+ case QMetaType::QColor: {
+ const QColor col = variant.value<QColor>();
+ v.m_data.fvec[0] = col.redF();
+ v.m_data.fvec[1] = col.greenF();
+ v.m_data.fvec[2] = col.blueF();
+ v.m_data.fvec[3] = col.alphaF();
+ break;
+ }
+ case QMetaType::QMatrix4x4: {
+ const QMatrix4x4 mat44 = variant.value<QMatrix4x4>();
+ // Use constData because we want column-major layout
+ memcpy(v.data<float>(), mat44.constData(), sizeof(16 * sizeof(float)));
+ break;
+ }
+ default:
+ Q_UNREACHABLE();
+ }
+ return v;
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/backend/uniform_p.h b/src/render/backend/uniform_p.h
new file mode 100644
index 000000000..aa4b06bf9
--- /dev/null
+++ b/src/render/backend/uniform_p.h
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_UNIFORM_P_H
+#define QT3DRENDER_RENDER_UNIFORM_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qt3drender_global.h>
+#include <Qt3DCore/qnodeid.h>
+
+#include <QMatrix4x4>
+#include <QVector2D>
+#include <QVector3D>
+#include <QColor>
+
+#include <QDebug>
+#include <string.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+enum UniformType {
+ Float = 0,
+ Vec2,
+ Vec3,
+ Vec4,
+ Double,
+ DVec2,
+ DVec3,
+ DVec4,
+ Int,
+ IVec2,
+ IVec3,
+ IVec4,
+ UInt,
+ UIVec2,
+ UIVec3,
+ UIVec4,
+ Bool,
+ BVec2,
+ BVec3,
+ BVec4,
+ Mat2,
+ Mat3,
+ Mat4,
+ Mat2x3,
+ Mat3x2,
+ Mat2x4,
+ Mat4x2,
+ Mat3x4,
+ Mat4x3,
+ Sampler,
+ Unknown
+};
+
+class Q_AUTOTEST_EXPORT UniformValue
+{
+public:
+ enum ValueType {
+ ScalarValue,
+ NodeId,
+ TextureValue,
+ BufferValue
+ };
+
+ struct Texture {
+ int textureId = 0; // Set first so that glUniform1iv will work
+ Qt3DCore::QNodeId nodeId;
+ };
+
+ // UniformValue implicitely converts doubles to floats to ensure
+ // correct rendering behavior for the cases where Qt3D parameters created from
+ // a double or QVariant(double) are used to fill uniform values that in reality
+ // should be floats. This occur especially with QML where qreal might be double
+ // and not float. Otherwise, at when filling the uniforms, calling constData<float>
+ // on something that contains a double will result in wrong values
+
+ UniformValue() {}
+ UniformValue(int i) { m_data.ivec[0] = i; }
+ UniformValue(uint i) { m_data.ivec[0] = i; }
+ UniformValue(float f) { m_data.fvec[0] = f; }
+ UniformValue(double d) { m_data.fvec[0] = d; } // Double to float conversion
+ UniformValue(bool b) { m_data.ivec[0] = b; }
+ UniformValue(const QVector2D &vec2) { memcpy(&m_data, &vec2, sizeof(QVector2D)); }
+ UniformValue(const QVector3D &vec3) { memcpy(&m_data, &vec3, sizeof(QVector3D)); }
+ UniformValue(const QVector4D &vec4) { memcpy(&m_data, &vec4, sizeof(QVector4D)); }
+
+ UniformValue(const QMatrix3x3 &mat33)
+ {
+ // Use constData because we want column-major layout
+ memcpy(&m_data, mat33.constData(), 9 * sizeof(float));
+ }
+
+ UniformValue(const QMatrix4x4 &mat44)
+ {
+ // Use constData because we want column-major layout
+ memcpy(&m_data, mat44.constData(), 16 * sizeof(float));
+ }
+
+ // For nodes which will later be replaced by a Texture or Buffer
+ UniformValue(Qt3DCore::QNodeId id)
+ {
+ m_valueType = NodeId;
+ memcpy(&m_data, &id, sizeof(Qt3DCore::QNodeId));
+ }
+
+ // For textures
+ UniformValue(UniformValue::Texture t)
+ {
+ m_valueType = TextureValue;
+ memcpy(&m_data, &t, sizeof(Texture));
+ }
+
+ ValueType valueType() const { return m_valueType; }
+
+ static UniformValue fromVariant(const QVariant &variant);
+
+ template<typename T>
+ const T *constData() const
+ {
+ return reinterpret_cast<const T *>(&m_data);
+ }
+
+ template<typename T>
+ T *data()
+ {
+ return reinterpret_cast<T *>(&m_data);
+ }
+
+ bool operator==(const UniformValue &other) const
+ {
+ return memcmp(&m_data, &other.m_data, sizeof(u_Uniform)) == 0;
+ }
+
+ bool operator!=(const UniformValue &other) const
+ {
+ return !(*this == other);
+ }
+private:
+ union u_Uniform {
+ int ivec[4]; // store uint/ints/bools
+ float fvec[16]; // for matrix4 (note: we could have a special case for matrices)
+
+ u_Uniform()
+ {
+ memset(this, 0, sizeof(u_Uniform));
+ }
+ } m_data;
+
+ ValueType m_valueType = ScalarValue;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::Render::UniformType)
+
+#endif // QT3DRENDER_RENDER_UNIFORM_P_H
diff --git a/src/render/framegraph/qcameraselector.cpp b/src/render/framegraph/qcameraselector.cpp
index a9188cd99..c7d299b9b 100644
--- a/src/render/framegraph/qcameraselector.cpp
+++ b/src/render/framegraph/qcameraselector.cpp
@@ -48,13 +48,15 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- \class Qt3DRender::QCameraSelector
- \inmodule Qt3DRender
- \since 5.5
- \ingroup framegraph
+ \class Qt3DRender::QCameraSelector
+ \inmodule Qt3DRender
+ \since 5.5
+ \ingroup framegraph
- \brief Class to allow for selection of camera to be used
+ \brief Class to allow for selection of camera to be used
+ A Qt3DRender::QCameraSelector can be used to select the camera, which is used
+ by the FrameGraph when drawing the entities.
*/
/*!
@@ -63,9 +65,25 @@ namespace Qt3DRender {
\instantiates Qt3DRender::QCameraSelector
\inherits FrameGraphNode
\since 5.5
- \qmlabstract
+ \brief Class to allow for selection of camera to be used
+
+ A CameraSelector can be used to select the camera, which is used
+ by the FrameGraph when drawing the entities.
+*/
+
+/*!
+ \qmlproperty Entity Qt3D.Render::CameraSelector::camera
+
+ Holds the currently selected camera.
*/
+/*!
+ \property Qt3DRender::QCameraSelector::camera
+
+ Holds the currently selected camera.
+*/
+
+
/*! \internal */
QCameraSelector::QCameraSelector(QCameraSelectorPrivate &dd, QNode *parent)
: QFrameGraphNode(dd, parent)
@@ -91,14 +109,6 @@ QCameraSelector::~QCameraSelector()
{
}
-/*!
- \property Qt3DRender::QCameraSelector::camera
-*/
-
-/*!
- \qmlproperty Entity Qt3D.Render::CameraSelector::camera
-
-*/
void QCameraSelector::setCamera(Qt3DCore::QEntity *camera)
{
Q_D(QCameraSelector);
diff --git a/src/render/framegraph/qclearbuffers.cpp b/src/render/framegraph/qclearbuffers.cpp
index 1e8a5c6e3..6fec60364 100644
--- a/src/render/framegraph/qclearbuffers.cpp
+++ b/src/render/framegraph/qclearbuffers.cpp
@@ -45,12 +45,14 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- \class Qt3DRender::QClearBuffers
- \inmodule Qt3DRender
- \since 5.7
- \ingroup framegraph
+ \class Qt3DRender::QClearBuffers
+ \inmodule Qt3DRender
+ \since 5.7
+ \ingroup framegraph
+ \brief Class to clear buffers
- \brief Class to clear buffers
+ A Qt3DRender::QClearBuffers FrameGraph node enables clearing of the specific
+ render target buffers with specific values.
*/
/*!
@@ -59,21 +61,24 @@ namespace Qt3DRender {
\instantiates Qt3DRender::QClearBuffers
\inherits FrameGraphNode
\since 5.7
- \qmlabstract
+ \brief Class to clear buffers
+
+ A Qt3DRender::QClearBuffers FrameGraph node enables clearing of the specific
+ render target buffers with specific values.
*/
/*!
\enum QClearBuffers::BufferType
This enum type describes types of buffer to be cleared.
- \value None
- \value ColorBuffer
- \value DepthBuffer
- \value StencilBuffer
- \value DepthStencilBuffer
- \value ColorDepthBuffer
- \value ColorDepthStencilBuffer
- \value AllBuffers
+ \value None No buffers will be cleared
+ \value ColorBuffer Clear color buffers
+ \value DepthBuffer Clear depth buffer
+ \value StencilBuffer Clear stencil buffer
+ \value DepthStencilBuffer Clear depth and stencil buffers
+ \value ColorDepthBuffer Clear color and depth buffers
+ \value ColorDepthStencilBuffer Clear color, depth and stencil buffers
+ \value AllBuffers Clear all buffers
*/
QClearBuffersPrivate::QClearBuffersPrivate()
@@ -86,7 +91,7 @@ QClearBuffersPrivate::QClearBuffersPrivate()
}
/*!
- The constructor creates an instance with the specified \a parent.
+ The constructor creates an instance with the specified \a parent.
*/
QClearBuffers::QClearBuffers(QNode *parent)
: QFrameGraphNode(*new QClearBuffersPrivate, parent)
@@ -141,8 +146,8 @@ QRenderTargetOutput *QClearBuffers::colorBuffer() const
*/
/*!
- \qmlproperty BufferType Qt3D.Render::ClearBuffers::buffers
-
+ \qmlproperty enumeration Qt3D.Render::ClearBuffers::buffers
+ Specifies the buffer type to be used.
*/
void QClearBuffers::setBuffers(QClearBuffers::BufferType buffers)
{
@@ -158,8 +163,8 @@ void QClearBuffers::setBuffers(QClearBuffers::BufferType buffers)
Specifies the clear color to be used.
*/
/*!
- \qmlproperty Color Qt3D.Render::ClearBuffers::color
-
+ \qmlproperty color Qt3D.Render::ClearBuffers::color
+ Specifies the clear color to be used.
*/
void QClearBuffers::setClearColor(const QColor &color)
{
@@ -176,8 +181,8 @@ void QClearBuffers::setClearColor(const QColor &color)
Specifies the clear depth value to be used.
*/
/*!
- \qmlproperty float Qt3D.Render::ClearBuffers::clearDepthValue
-
+ \qmlproperty real Qt3D.Render::ClearBuffers::clearDepthValue
+ Specifies the clear depth value to be used.
*/
void QClearBuffers::setClearDepthValue(float clearDepthValue)
{
@@ -196,8 +201,8 @@ void QClearBuffers::setClearDepthValue(float clearDepthValue)
Specifies the stencil value to be used.
*/
/*!
- \qmlproperty int Qt3D.Render::ClearBuffers::clearStencilValue
-
+ \qmlproperty int Qt3D.Render::ClearBuffers::clearStencilValue
+ Specifies the stencil value to be used.
*/
void QClearBuffers::setClearStencilValue(int clearStencilValue)
{
@@ -214,8 +219,9 @@ void QClearBuffers::setClearStencilValue(int clearStencilValue)
ColorBuffer flag is set, all color buffers will be cleared.
*/
/*!
- \qmlproperty Qt3D.Render::RenderTargetOutput Qt3D.Render::ClearBuffers::colorbuffer
-
+ \qmlproperty RenderTargetOutput Qt3D.Render::ClearBuffers::colorbuffer
+ Specifies a specific color buffer to clear. If set to NULL (default), and
+ ColorBuffer flag is set, all color buffers will be cleared.
*/
void QClearBuffers::setColorBuffer(QRenderTargetOutput *buffer)
{
diff --git a/src/render/framegraph/qframegraphnode.cpp b/src/render/framegraph/qframegraphnode.cpp
index add8fc75d..c60c859ac 100644
--- a/src/render/framegraph/qframegraphnode.cpp
+++ b/src/render/framegraph/qframegraphnode.cpp
@@ -50,14 +50,57 @@ QFrameGraphNodePrivate::QFrameGraphNodePrivate()
}
/*!
- \class Qt3DRender::QFrameGraphNode
- \inmodule Qt3DRender
- \since 5.5
-
- \brief Base class of all FrameGraph configuration nodes.
+ \class Qt3DRender::QFrameGraphNode
+ \inmodule Qt3DRender
+ \since 5.5
- This is an abstract class so it cannot be instanced directly
- but rather through one of its subclasses.
+ \brief Base class of all FrameGraph configuration nodes.
+
+ This is an abstract class so it cannot be instanced directly
+ but rather through one of its subclasses.
+
+ The subclasses are:
+ \table
+ \header
+ \li class
+ \li description
+ \row
+ \li Qt3DRender::QCameraSelector
+ \li Select camera from all available cameras in the scene
+ \row
+ \li Qt3DRender::QClearBuffers
+ \li Specify which buffers to clear and to what values
+ \row
+ \li Qt3DRender::QDispatchCompute
+ \li Specify Compute operation kernels
+ \row
+ \li Qt3DRender::QFrustumCulling
+ \li Enable frustum culling
+ \row
+ \li Qt3DRender::QLayerFilter
+ \li Select which layers to draw
+ \row
+ \li Qt3DRender::QNoDraw
+ \li Disable drawing
+ \row
+ \li Qt3DRender::QRenderPassFilter
+ \li Select which render passes to draw
+ \row
+ \li Qt3DRender::QRenderStateSet
+ \li Set render states
+ \row
+ \li Qt3DRender::QRenderSurfaceSelector
+ \li Select which surface to draw to
+ \row
+ \li Qt3DRender::QSortPolicy
+ \li Specify how entities are sorted to determine draw order
+ \row
+ \li Qt3DRender::QTechniqueFilter
+ \li Select which techniques to draw
+ \row
+ \li Qt3DRender::QViewport
+ \li Specify viewport
+ \endtable
*/
@@ -67,11 +110,57 @@ QFrameGraphNodePrivate::QFrameGraphNodePrivate()
\instantiates Qt3DRender::QFrameGraphNode
\inherits Node
\since 5.5
- \qmlabstract
+ \brief Base class of all FrameGraph configuration nodes.
+
+ This is an abstract class so it cannot be instanced directly
+ but rather through one of its subclasses.
+
+ The subclasses are:
+ \table
+ \header
+ \li class
+ \li description
+ \row
+ \li CameraSelector
+ \li Select camera from all available cameras in the scene
+ \row
+ \li ClearBuffers
+ \li Specify which buffers to clear and to what values
+ \row
+ \li DispatchCompute
+ \li Specify Compute operation kernels
+ \row
+ \li FrustumCulling
+ \li Enable frustum culling
+ \row
+ \li LayerFilter
+ \li Select which layers to draw
+ \row
+ \li NoDraw
+ \li Disable drawing
+ \row
+ \li RenderPassFilter
+ \li Select which render passes to draw
+ \row
+ \li RenderStateSet
+ \li Set render states
+ \row
+ \li RenderSurfaceSelector
+ \li Select which surface to draw to
+ \row
+ \li SortPolicy
+ \li Specify how entities are sorted to determine draw order
+ \row
+ \li TechniqueFilter
+ \li Select which techniques to draw
+ \row
+ \li Viewport
+ \li Specify viewport
+ \endtable
*/
/*!
- The constructor creates an instance with the specified \a parent.
+ The constructor creates an instance with the specified \a parent.
*/
QFrameGraphNode::QFrameGraphNode(QNode *parent)
: QNode(*new QFrameGraphNodePrivate, parent)
@@ -84,7 +173,7 @@ QFrameGraphNode::~QFrameGraphNode()
}
/*!
- Returns a pointer to the parent.
+ Returns a pointer to the parent.
*/
QFrameGraphNode *QFrameGraphNode::parentFrameGraphNode() const
{
diff --git a/src/render/framegraph/qlayerfilter.cpp b/src/render/framegraph/qlayerfilter.cpp
index 92c1e1266..f7f4dd12c 100644
--- a/src/render/framegraph/qlayerfilter.cpp
+++ b/src/render/framegraph/qlayerfilter.cpp
@@ -59,7 +59,10 @@ QLayerFilterPrivate::QLayerFilterPrivate()
\since 5.5
\brief Controls layers Drawn in a frame graph branch.
- A QLayerFiler can be used to instruct the renderer as to which layer(s) to draw in that branch of the frame graph.
+ A Qt3DRender::QLayerFilter can be used to instruct the renderer as to which layer(s)
+ to draw in that branch of the frame graph. The Qt3DRender::QLayerFilter selects which
+ entities to draw based on the Qt3DRender::QLayer instances added to the QLayerFilter
+ and as components to the \l Qt3DCore::QEntity.
*/
/*!
@@ -70,12 +73,20 @@ QLayerFilterPrivate::QLayerFilterPrivate()
\since 5.5
\brief Controls layers Drawn in a frame graph branch.
- A QLayerFiler can be used to instruct the renderer as to which layer(s) to draw in that branch of the frame graph.
+ A LayerFilter can be used to instruct the renderer as to which layer(s)
+ to draw in that branch of the frame graph. The LayerFilter selects which
+ entities to draw based on the \l Layer instances added to the LayerFilter
+ and as components to the \l Entity.
*/
+/*!
+ \qmlproperty list<Layer> Qt3D.Render::LayerFilter::layers
+ Holds a list of layers specifying the layers to select for drawing.
+ \readonly
+ */
/*!
- The constructor creates an instance with the specified \a parent.
+ The constructor creates an instance with the specified \a parent.
*/
QLayerFilter::QLayerFilter(QNode *parent)
: QFrameGraphNode(*new QLayerFilterPrivate, parent)
@@ -94,16 +105,7 @@ QLayerFilter::~QLayerFilter()
}
/*!
- \property Qt3DRender::QLayerFilter::layers
-
- */
-
-/*!
- \qmlproperty stringlist Qt3D.Render::LayerFilter::layers
-
-*/
-/*!
- Add \a layer to the current list of layers
+ Add \a layer to the current list of layers
*/
void QLayerFilter::addLayer(QLayer *layer)
{
@@ -131,7 +133,7 @@ void QLayerFilter::addLayer(QLayer *layer)
}
/*!
- Remove \a layer from the current list of layers
+ Remove \a layer from the current list of layers
*/
void QLayerFilter::removeLayer(QLayer *layer)
{
@@ -148,7 +150,7 @@ void QLayerFilter::removeLayer(QLayer *layer)
}
/*!
- \return the current list of layers
+ \return the current list of layers
*/
QVector<QLayer *> QLayerFilter::layers() const
{
diff --git a/src/render/framegraph/qrendercapture.h b/src/render/framegraph/qrendercapture.h
index 810cedb99..f3be273f3 100644
--- a/src/render/framegraph/qrendercapture.h
+++ b/src/render/framegraph/qrendercapture.h
@@ -79,7 +79,7 @@ class QT3DRENDERSHARED_EXPORT QRenderCapture : public QFrameGraphNode
public:
explicit QRenderCapture(Qt3DCore::QNode *parent = nullptr);
- Q_INVOKABLE QRenderCaptureReply *requestCapture(int captureId);
+ Q_INVOKABLE Qt3DRender::QRenderCaptureReply *requestCapture(int captureId);
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
diff --git a/src/render/framegraph/qrendersurfaceselector.cpp b/src/render/framegraph/qrendersurfaceselector.cpp
index 4063f4997..905669ff9 100644
--- a/src/render/framegraph/qrendersurfaceselector.cpp
+++ b/src/render/framegraph/qrendersurfaceselector.cpp
@@ -52,57 +52,70 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- * \class Qt3DRender::QRenderSurfaceSelector
- * \inmodule Qt3DRender
- * \brief Provides a way of specifying the render surface
- * \since 5.7
- *
- * \inherits Qt3DRender::QFrameGraphNode
- *
- * Qt3DRender::QRenderSurfaceSelector specifies which window should be used for
- * the rendering of a FrameGraph branch. In some cases you may also want to
- * specify the size of what needs to be drawn when rendering with a frame
- * buffer object. In such cases, the externalRenderTargetSize should be set and
- * updated accordingly. If it is not set, the renderer will assume it should use
- * the surface's size.
- *
+ \class Qt3DRender::QRenderSurfaceSelector
+ \inmodule Qt3DRender
+ \brief Provides a way of specifying the render surface
+ \since 5.7
+
+ The Qt3DRender::QRenderSurfaceSelector can be used to select the surface, where
+ Qt3D renders the content. The surface can either be window surface or offscreen
+ surface. The externalRenderTargetSize is used to specify the actual size of the
+ surface when offscreen surface is used.
+
+ When DPI scaling is used by the system, the logical surface size, which is used
+ by mouse events, and the actual 'physical' size of the surface can differ.
+ The surfacePixelRatio is the factor to convert the logical size to the physical
+ size.
+
+ \sa QWindow, QOffscreenSurface, QSurface
*/
/*!
- * \qmltype RenderSurfaceSelector
- * \inqmlmodule Qt3D.Render
- * \since 5.7
- * \ingroup
- * \instantiates Qt3DRender::QRenderSurfaceSelector
- * \brief Provides a way of specifying the render surface
- *
- * RenderSurfaceSelector specifies which window should be used for
- * the rendering of a FrameGraph branch. In some cases you may also want to
- * specify the size of what needs to be drawn when rendering with a frame
- * buffer object. In such cases, the externalRenderTargetSize should be set and
- * updated accordingly. If it is not set, the renderer will assume it should use
- * the surface's size.
- *
+ \qmltype RenderSurfaceSelector
+ \inqmlmodule Qt3D.Render
+ \since 5.7
+ \instantiates Qt3DRender::QRenderSurfaceSelector
+ \inherits FrameGraphNode
+ \brief Provides a way of specifying the render surface
+
+ The RenderSurfaceSelector can be used to select the surface, where
+ Qt3D renders the content. The surface can either be window surface or offscreen
+ surface. The externalRenderTargetSize is used to specify the actual size of the
+ render target when offscreen surface is used.
+
+ When DPI scaling is used by the system, the logical surface size, which is used
+ by mouse events, and the actual 'physical' size of the surface can differ.
+ The surfacePixelRatio is the factor to convert the logical size to the physical
+ size.
*/
/*! \qmlproperty QSurface Qt3D.Render::RenderSurfaceSelector::surface
- *
- * Holds the surface.
+ Holds the surface.
*/
-/*!
- * \property QRenderSurfaceSelector::surface
- * Holds the surface
+/*! \qmlproperty size Qt3D.Render::RenderSurfaceSelector::externalRenderTargetSize
+
+ Holds the size of the external render target.
+ */
+
+/*! \qmlproperty real Qt3D.Render::RenderSurfaceSelector::surfacePixelRatio
+
+ Holds the surfacePixelRatio of the surface.
*/
-/*! \qmlproperty QSize Qt3D.Render::RenderSurfaceSelector::externalRenderTargetSize
- *
- * Holds the size of the external render target.
+/*!
+ \property QRenderSurfaceSelector::surface
+ Holds the surface
*/
/*!
- * \property QRenderSurfaceSelector::externalRenderTargetSize
- * Holds the size of the external render target.
+ \property QRenderSurfaceSelector::externalRenderTargetSize
+ Holds the size of the external render target.
+ */
+
+/*! \property QRenderSurfaceSelector::surfacePixelRatio
+
+ Holds the surfacePixelRatio of the surface.
*/
QRenderSurfaceSelectorPrivate::QRenderSurfaceSelectorPrivate()
@@ -150,7 +163,7 @@ void QRenderSurfaceSelectorPrivate::setExternalRenderTargetSize(const QSize &siz
}
/*!
- * Constructs QRenderSurfaceSelector with given \a parent.
+ Constructs QRenderSurfaceSelector with given \a parent.
*/
QRenderSurfaceSelector::QRenderSurfaceSelector(Qt3DCore::QNode *parent)
: Qt3DRender::QFrameGraphNode(*new QRenderSurfaceSelectorPrivate, parent)
@@ -158,14 +171,14 @@ QRenderSurfaceSelector::QRenderSurfaceSelector(Qt3DCore::QNode *parent)
}
/*!
- * \internal
+ \internal
*/
QRenderSurfaceSelector::~QRenderSurfaceSelector()
{
}
/*!
- * \internal
+ \internal
*/
QRenderSurfaceSelector::QRenderSurfaceSelector(QRenderSurfaceSelectorPrivate &dd, Qt3DCore::QNode *parent)
: Qt3DRender::QFrameGraphNode(dd, parent)
@@ -192,9 +205,8 @@ QObject *QRenderSurfaceSelector::surface() const
return surfaceObj;
}
-/*! \property QRenderSurfaceSelector::surface
- *
- * Sets \a surface.
+/*!
+ Sets \a surfaceObject.
*/
void QRenderSurfaceSelector::setSurface(QObject *surfaceObject)
{
@@ -211,7 +223,7 @@ void QRenderSurfaceSelector::setSurface(QObject *surfaceObject)
surface = static_cast<QSurface *>(offscreen);
}
- Q_ASSERT_X(surface, Q_FUNC_INFO, "surfaceObject is not a valid QSurface * object");
+ Q_ASSERT_X(surface, Q_FUNC_INFO, "surfaceObject is not a valid QSurface object");
}
if (d->m_surface == surface)
@@ -299,8 +311,8 @@ float QRenderSurfaceSelector::surfacePixelRatio() const
return d->m_surfacePixelRatio;
}
/*!
- * Sets render target \a size if different than underlying surface size.
- * Tells picking the correct size.
+ Sets render target \a size if different than underlying surface size.
+ Tells picking the correct size.
*/
void QRenderSurfaceSelector::setExternalRenderTargetSize(const QSize &size)
{
diff --git a/src/render/framegraph/qsortpolicy.cpp b/src/render/framegraph/qsortpolicy.cpp
index 50fcae50f..a20ebd201 100644
--- a/src/render/framegraph/qsortpolicy.cpp
+++ b/src/render/framegraph/qsortpolicy.cpp
@@ -53,23 +53,34 @@ QSortPolicyPrivate::QSortPolicyPrivate()
}
/*!
- * \class Qt3DRender::QSortPolicy
- * \inmodule Qt3DRender
- * \brief Provides storage for the sort types to be used
- * \since 5.7
- *
- * \inherits Qt3DRender::QFrameGraphNode
- *
+ \class Qt3DRender::QSortPolicy
+ \inmodule Qt3DRender
+ \brief Provides storage for the sort types to be used
+ \since 5.7
+
+ \inherits Qt3DRender::QFrameGraphNode
+
+ A Qt3DRender::QSortPolicy class stores the sorting type used by the FrameGraph.
+ The sort types determine how drawable entities are sorted before drawing to
+ determine the drawing order. When QSortPolicy is present in the FrameGraph,
+ the sorting mechanism is determined by the SortTypes list. Multiple sort types
+ can be used simultanously. If QSortPolicy is not present in the FrameGraph,
+ entities are drawn in the order they appear in the entity hierarchy.
*/
/*!
- * \qmltype SortPolicy
- * \inqmlmodule Qt3D.Render
- * \since 5.7
- * \ingroup
- * \instantiates Qt3DRender::QSortPolicy
- * \brief Provides storage for the sort types to be used
- *
+ \qmltype SortPolicy
+ \inqmlmodule Qt3D.Render
+ \since 5.7
+ \instantiates Qt3DRender::QSortPolicy
+ \brief Provides storage for the sort types to be used
+
+ A SortPolicy class stores the sorting type used by the FrameGraph.
+ The sort types determine how drawable entities are sorted before drawing to
+ determine the drawing order. When SortPolicy is present in the FrameGraph,
+ the sorting mechanism is determined by the SortTypes list. Multiple sort
+ types can be used simultanously. If SortPolicy is not present in the FrameGraph,
+ entities are drawn in the order they appear in the entity hierarchy.
*/
/*!
@@ -82,7 +93,17 @@ QSortPolicyPrivate::QSortPolicyPrivate()
*/
/*!
- * Constructs QSortPolicy with given \a parent.
+ \property QSortPolicy::sortTypes
+ Specifies the sorting types to be used.
+*/
+
+/*!
+ \qmlproperty QVariantList SortPolicy::sortTypes
+ Specifies the sorting types to be used.
+*/
+
+/*!
+ Constructs QSortPolicy with given \a parent.
*/
QSortPolicy::QSortPolicy(QNode *parent)
: QFrameGraphNode(*new QSortPolicyPrivate, parent)
@@ -110,17 +131,7 @@ QNodeCreatedChangeBasePtr QSortPolicy::createNodeCreationChange() const
}
/*!
- \property Qt3DRender::QSortPolicy::sortTypes
- Specifies the sorting types to be used.
-*/
-
-/*!
- \qmlproperty QVariantList Qt3D.Render::QSortPolicy::sortTypes
- Specifies the sorting types to be used.
-
-*/
-/*!
- * \return the current sort types in use
+ \return the current sort types in use
*/
QVector<QSortPolicy::SortType> QSortPolicy::sortTypes() const
{
diff --git a/src/render/framegraph/qviewport.cpp b/src/render/framegraph/qviewport.cpp
index c68ff141f..cf7667289 100644
--- a/src/render/framegraph/qviewport.cpp
+++ b/src/render/framegraph/qviewport.cpp
@@ -53,27 +53,39 @@ QViewportPrivate::QViewportPrivate()
}
/*!
- * \class Qt3DRender::QViewport
- * \inmodule Qt3DRender
- * \brief A viewport on the Qt3D Scene
- * \since 5.7
- *
- * \inherits Qt3DRender::QFrameGraphNode
- *
+ \class Qt3DRender::QViewport
+ \inmodule Qt3DRender
+ \brief A viewport on the Qt3D Scene
+ \since 5.7
+
+ \inherits Qt3DRender::QFrameGraphNode
+
+ Qt3DRender::QViewport of the scene specifies at which portion of the render surface Qt3D
+ is rendering to. Area outside the viewport is left untouched.
*/
/*!
- * \qmltype Viewport
- * \inqmlmodule Qt3D.Render
- * \since 5.7
- * \ingroup
- * \instantiates Qt3DRender::QViewport
- * \brief A viewport on the Qt3D Scene
- *
+ \qmltype Viewport
+ \inqmlmodule Qt3D.Render
+ \since 5.7
+ \ingroup
+ \instantiates Qt3DRender::QViewport
+ \brief A viewport on the Qt3D Scene
+
+ Viewport of the scene specifies at which portion of the render surface Qt3D is
+ rendering to. Area outside the viewport is left untouched.
*/
/*!
- * Constructs QViewport with given \a parent.
+ \qmlproperty rect Viewport::normalizedRect
+
+ Specifies the normalised rectangle for the viewport, i.e. the viewport rectangle
+ is specified relative to the render surface size. Whole surface sized viewport
+ is specified as [0.0, 0.0, 1.0, 1.0], which is the default.
+ */
+
+/*!
+ Constructs QViewport with given \a parent.
*/
QViewport::QViewport(QNode *parent)
: QFrameGraphNode(*new QViewportPrivate, parent)
@@ -99,14 +111,12 @@ QRectF QViewport::normalizedRect() const
}
/*!
- \property Qt3DRender::QViewport::normalizedRect
- Specifies the normalise rect for the viewport
-*/
-
-/*!
- \qmlproperty QRectF Qt3D.Render::QViewport::normalizedRect
+ \property QViewport::normalizedRect
-*/
+ Specifies the normalised rectangle for the viewport, i.e. the viewport rectangle
+ is specified relative to the render surface size. Whole surface sized viewport
+ is specified as [0.0, 0.0, 1.0, 1.0], which is the default.
+ */
void QViewport::setNormalizedRect(const QRectF &normalizedRect)
{
Q_D(QViewport);
diff --git a/src/render/frontend/qabstractfunctor.cpp b/src/render/frontend/qabstractfunctor.cpp
index f3367a2b5..817d06a27 100644
--- a/src/render/frontend/qabstractfunctor.cpp
+++ b/src/render/frontend/qabstractfunctor.cpp
@@ -43,8 +43,44 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+/*!
+ \class Qt3DRender::QAbstractFunctor
+ \inmodule Qt3DRender
+ \since 5.7
+ \brief QAbstractFunctor is an abstract base class for all functors.
+
+ The QAbstractFunctor is used as a base class for all functors and data
+ generators in Qt3DRender module.
+
+ When user defines a new functor or generator, they need to implement the
+ \l QAbstractFunctor::id() method, which should be done using the \c {QT3D_FUNCTOR}
+ macro in the class definition.
+ */
+/*!
+ \fn qintptr QAbstractFunctor::id() const
+ */
+/*!
+ \macro QT3D_FUNCTOR(Class)
+ \relates Qt3DRender::QAbstractFunctor
+
+ This macro assigns functor id to the \a Class, which is used by QAbstractFunctor::functor_cast
+ to determine if the cast can be done.
+ */
+
+/*!
+ \fn const T *QAbstractFunctor::functor_cast(const QAbstractFunctor *other) const
+
+ This method is used to cast functor \a other to type T if the other is of
+ type T (or of subclass); otherwise returns 0. This method works similarly
+ to \l QObject::qobject_cast, except with functors derived from QAbstractFunctor.
+
+ \warning If T was not declared with \l QT3D_FUNCTOR macro, then the results are undefined.
+ */
+
+/*! Desctructor */
QAbstractFunctor::~QAbstractFunctor()
{
+
}
} // Qt3D
diff --git a/src/render/frontend/qcamera.cpp b/src/render/frontend/qcamera.cpp
index b28d3bbbb..7a1f133a8 100644
--- a/src/render/frontend/qcamera.cpp
+++ b/src/render/frontend/qcamera.cpp
@@ -78,6 +78,298 @@ QCameraPrivate::QCameraPrivate()
*/
/*!
+ * \enum Qt3DRender::QCamera::CameraTranslationOption
+ *
+ * This enum specifies how camera view center is translated
+ * \value TranslateViewCenter Translate the view center causing the view direction to remain the same
+ * \value DontTranslateViewCenter Don't translate the view center causing the view direction to change
+ */
+
+/*!
+ * \qmlmethod quaternion Qt3D.Render::Camera::tiltRotation(real angle)
+ *
+ * Returns the calculated tilt rotation in relation to the \a angle in degrees taken in
+ * to adjust the camera's tilt or up/down rotation on the X axis.
+ */
+
+/*!
+ * \qmlmethod quaternion Qt3D.Render::Camera::panRotation(real angle)
+ *
+ * Returns the calculated pan rotation in relation to the \a angle in degrees taken in
+ * to adjust the camera's pan or left/right rotation on the Y axis.
+ */
+
+/*!
+ * \qmlmethod quaternion Qt3D.Render::Camera::rollRotation(real angle)
+ *
+ * Returns the calculated roll rotation in relation to the \a angle in degrees taken in
+ * to adjust the camera's roll or lean left/right rotation on the Z axis.
+ */
+
+/*!
+ * \qmlmethod quaternion Qt3D.Render::Camera::rotation(real angle, vector3d axis)
+ *
+ * Returns the calculated rotation in relation to the \a angle in degrees and
+ * chosen \a axis taken in.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::translate(vector3d vLocal, enumeration option)
+ *
+ * Translates the camera's position and its view vector by \a vLocal in local coordinates.
+ * The \a option allows for toggling whether the view center should be translated.
+ * \list
+ * \li Camera.TranslateViewCenter
+ * \li Camera.DontTranslateViewCenter
+ * \endlist
+ * \sa Qt3DRender::QCamera::CameraTranslationOption
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::translateWorld(vector3d vWorld, enumeration option)
+ *
+ * Translates the camera's position and its view vector by \a vWorld in world coordinates.
+ * The \a option allows for toggling whether the view center should be translated.
+ * \list
+ * \li Camera.TranslateViewCenter
+ * \li Camera.DontTranslateViewCenter
+ * \endlist
+ * \sa Qt3DRender::QCamera::CameraTranslationOption
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::tilt(real angle)
+ *
+ * Adjusts the tilt angle of the camera by \a angle in degrees.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::pan(real angle)
+ *
+ * Adjusts the pan angle of the camera by \a angle in degrees.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::pan(real angle, vector3d axis)
+ *
+ * Adjusts the camera pan about view center by \a angle in degrees on \a axis.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::roll(real angle)
+ *
+ * Adjusts the camera roll by \a angle in degrees.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::tiltAboutViewCenter(real angle)
+ *
+ * Adjusts the camera tilt about view center by \a angle in degrees.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::panAboutViewCenter(real angle)
+ *
+ * Adjusts the camera pan about view center by \a angle in degrees.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::panAboutViewCenter(real angle, vector3d axis)
+ *
+ * Adjusts the camera pan about view center by \a angle in degrees on \a axis.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::rollAboutViewCenter(real angle)
+ *
+ * Adjusts the camera roll about view center by \a angle in degrees.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::rotate(quaternion q)
+ *
+ * Rotates the camera with the use of a Quaternion in \a q.
+ */
+
+/*!
+ * \qmlmethod void Qt3D.Render::Camera::rotateAboutViewCenter(quaternion q)
+ *
+ * Rotates the camera about the view center with the use of a Quaternion in \a q.
+ */
+
+/*!
+ * \qmlproperty enumeration Qt3D.Render::Camera::projectionType
+ *
+ * Holds the type of the camera projection.
+ *
+ * \list
+ * \li CameraLens.OrthographicProjection
+ * \li CameraLens.PerspectiveProjection
+ * \li CameraLens.FrustumProjection
+ * \li CameraLens.CustomProjection
+ * \endlist
+ * \sa Qt3DRender::QCameraLens::ProjectionType
+ */
+
+/*!
+ * \qmlproperty real Qt3D.Render::Camera::nearPlane
+ * Holds the current camera near plane of the camera.
+ */
+
+/*!
+ * \qmlproperty real Qt3D.Render::Camera::farPlane
+ * Holds the current camera far plane of the camera.
+ */
+
+/*!
+ * \qmlproperty real Qt3D.Render::Camera::fieldOfView
+ * Holds the current field of view of the camera in degrees.
+ */
+
+/*!
+ * \qmlproperty real Qt3D.Render::Camera::aspectRatio
+ * Holds the current aspect ratio of the camera.
+ */
+
+/*!
+ *\qmlproperty real Qt3D.Render::Camera::left
+ * Holds the current left of the camera.
+ */
+
+/*!
+ * \qmlproperty real Qt3D.Render::Camera::right
+ * Holds the current right of the camera.
+ */
+
+/*!
+ * \qmlproperty real Qt3D.Render::Camera::bottom
+ * Holds the current bottom of the camera.
+ */
+
+/*!
+ * \qmlproperty real Qt3D.Render::Camera::top
+ * Holds the current top of the camera.
+ */
+
+/*!
+ * \qmlproperty matrix4x4 Qt3D.Render::Camera::projectionMatrix
+ * Holds the current projection matrix of the camera.
+ */
+
+
+/*!
+ * \qmlproperty vector3d Qt3D.Render::Camera::position
+ * Holds the current position of the camera.
+ */
+
+/*!
+ * \qmlproperty vector3d Qt3D.Render::Camera::upVector
+ * Holds the current up vector of the camera.
+ */
+
+/*!
+ * \qmlproperty vector3d Qt3D.Render::Camera::viewCenter
+ * Holds the current view center of the camera.
+ * \readonly
+ */
+
+/*!
+ * \qmlproperty vector3d Qt3D.Render::Camera::viewVector
+ * Holds the camera's view vector.
+ * \readonly
+ */
+
+/*!
+ * \qmlproperty matrix4x4 Qt3D.Render::Camera::viewMatrix
+ * Holds the camera's view matrix.
+ * \readonly
+ */
+
+/*!
+ * \property QCamera::projectionType
+ *
+ * Holds the type of the camera projection.
+ *
+ * \list
+ * \li CameraLens.OrthographicProjection
+ * \li CameraLens.PerspectiveProjection
+ * \li CameraLens.FrustumProjection
+ * \li CameraLens.CustomProjection
+ * \endlist
+ * \sa Qt3DRender::QCameraLens::ProjectionType
+ */
+
+/*!
+ * \property QCamera::nearPlane
+ * Holds the current camera near plane.
+ */
+
+/*!
+ * \property QCamera::farPlane
+ * Holds the current camera far plane.
+ */
+
+/*!
+ * \property QCamera::fieldOfView
+ * Holds the current field of view in degrees.
+ */
+
+/*!
+ * \property QCamera::aspectRatio
+ * Holds the current aspect ratio.
+ */
+
+/*!
+ *\property QCamera::left
+ * Holds the current left of the camera.
+ */
+
+/*!
+ * \property QCamera::right
+ * Holds the current right of the camera.
+ */
+
+/*!
+ * \property QCamera::bottom
+ * Holds the current bottom of the camera.
+ */
+
+/*!
+ * \property QCamera::top
+ * Holds the current top of the camera.
+ */
+
+/*!
+ * \property QCamera::projectionMatrix
+ * Holds the current projection matrix of the camera.
+ */
+
+/*!
+ * \property QCamera::position
+ * Holds the camera's position.
+ */
+
+/*!
+ * \property QCamera::upVector
+ * Holds the camera's up vector.
+ */
+
+/*!
+ * \property QCamera::viewCenter
+ * Holds the camera's view center.
+ */
+
+/*!
+ * \property QCamera::viewVector
+ * Holds the camera's view vector.
+ */
+
+/*!
+ * \property QCamera::viewMatrix
+ * Holds the camera's view matrix.
+ */
+
+/*!
* Creates a new QCamera instance with the
* specified \a parent.
*/
@@ -202,8 +494,8 @@ void QCamera::translateWorld(const QVector3D &vWorld, CameraTranslationOption op
}
/*!
- * Returns the calculated tilt rotation in relation to the \a angle taken in to adjust the camera's
- * tilt or up/down rotation on the X axis.
+ * Returns the calculated tilt rotation in relation to the \a angle in degrees taken in
+ * to adjust the camera's tilt or up/down rotation on the X axis.
*/
QQuaternion QCamera::tiltRotation(float angle) const
{
@@ -213,8 +505,8 @@ QQuaternion QCamera::tiltRotation(float angle) const
}
/*!
- * Returns the calculated pan rotation in relation to the \a angle taken in to adjust the camera's
- * pan or left/right rotation on the Y axis.
+ * Returns the calculated pan rotation in relation to the \a angle in degrees taken in
+ * to adjust the camera's pan or left/right rotation on the Y axis.
*/
QQuaternion QCamera::panRotation(float angle) const
{
@@ -222,8 +514,8 @@ QQuaternion QCamera::panRotation(float angle) const
}
/*!
- * Returns the calculated roll rotation in relation to the \a angle taken in to adjust the camera's
- * roll or lean left/right rotation on the Z axis.
+ * Returns the calculated roll rotation in relation to the \a angle in degrees taken in
+ * to adjust the camera's roll or lean left/right rotation on the Z axis.
*/
QQuaternion QCamera::rollRotation(float angle) const
{
@@ -232,7 +524,8 @@ QQuaternion QCamera::rollRotation(float angle) const
}
/*!
- * Returns the calculated rotation in relation to the \a angle and chosen \a axis taken in.
+ * Returns the calculated rotation in relation to the \a angle in degrees and
+ * chosen \a axis taken in.
*/
QQuaternion QCamera::rotation(float angle, const QVector3D &axis) const
{
@@ -240,7 +533,7 @@ QQuaternion QCamera::rotation(float angle, const QVector3D &axis) const
}
/*!
- * Adjusts the tilt angle of the camera by \a angle.
+ * Adjusts the tilt angle of the camera by \a angle in degrees.
*/
void QCamera::tilt(float angle)
{
@@ -249,7 +542,7 @@ void QCamera::tilt(float angle)
}
/*!
- * Adjusts the pan angle of the camera by \a angle.
+ * Adjusts the pan angle of the camera by \a angle in degrees.
*/
void QCamera::pan(float angle)
{
@@ -258,7 +551,7 @@ void QCamera::pan(float angle)
}
/*!
- * Adjusts the pan angle of the camera by \a angle on a chosen \a axis.
+ * Adjusts the pan angle of the camera by \a angle in degrees on a chosen \a axis.
*/
void QCamera::pan(float angle, const QVector3D &axis)
{
@@ -267,7 +560,7 @@ void QCamera::pan(float angle, const QVector3D &axis)
}
/*!
- * Adjusts the camera roll by \a angle.
+ * Adjusts the camera roll by \a angle in degrees.
*/
void QCamera::roll(float angle)
{
@@ -276,7 +569,7 @@ void QCamera::roll(float angle)
}
/*!
- * Adjusts the camera tilt about view center by \a angle.
+ * Adjusts the camera tilt about view center by \a angle in degrees.
*/
void QCamera::tiltAboutViewCenter(float angle)
{
@@ -285,7 +578,7 @@ void QCamera::tiltAboutViewCenter(float angle)
}
/*!
- * Adjusts the camera pan about view center by \a angle.
+ * Adjusts the camera pan about view center by \a angle in degrees.
*/
void QCamera::panAboutViewCenter(float angle)
{
@@ -294,7 +587,7 @@ void QCamera::panAboutViewCenter(float angle)
}
/*!
- * Adjusts the camera pan about view center by \a angle on \a axis.
+ * Adjusts the camera pan about view center by \a angle in degrees on \a axis.
*/
void QCamera::panAboutViewCenter(float angle, const QVector3D &axis)
{
@@ -303,7 +596,7 @@ void QCamera::panAboutViewCenter(float angle, const QVector3D &axis)
}
/*!
- * Adjusts the camera roll about view center by \a angle.
+ * Adjusts the camera roll about view center by \a angle in degrees.
*/
void QCamera::rollAboutViewCenter(float angle)
{
@@ -344,14 +637,6 @@ void QCamera::setProjectionType(QCameraLens::ProjectionType type)
d->m_lens->setProjectionType(type);
}
-/*!
- * \qmlproperty enumeration Qt3DCore::Camera::projectionType
- *
- * Holds the type of the camera projection (orthogonal or perspective).
- *
- * \value CameraLens.OrthographicProjection Orthographic projection
- * \value CameraLens.PerspectiveProjection Perspective projection
- */
QCameraLens::ProjectionType QCamera::projectionType() const
{
Q_D(const QCamera);
@@ -367,10 +652,6 @@ void QCamera::setNearPlane(float nearPlane)
d->m_lens->setNearPlane(nearPlane);
}
-/*!
- * \qmlproperty float Qt3DCore::Camera::nearPlane
- * The current camera near plane.
- */
float QCamera::nearPlane() const
{
Q_D(const QCamera);
@@ -386,10 +667,6 @@ void QCamera::setFarPlane(float farPlane)
d->m_lens->setFarPlane(farPlane);
}
-/*!
- * \qmlproperty float Qt3DCore::Camera::farPlane
- * The current camera far plane.
- */
float QCamera::farPlane() const
{
Q_D(const QCamera);
@@ -397,7 +674,7 @@ float QCamera::farPlane() const
}
/*!
- * Sets the camera's field of view to \a fiedOfView.
+ * Sets the camera's field of view to \a fieldOfView in degrees.
*/
void QCamera::setFieldOfView(float fieldOfView)
{
@@ -405,10 +682,6 @@ void QCamera::setFieldOfView(float fieldOfView)
d->m_lens->setFieldOfView(fieldOfView);
}
-/*!
- * \qmlproperty float Qt3DCore::Camera::fieldOfView
- * The current field of view.
- */
float QCamera::fieldOfView() const
{
Q_D(const QCamera);
@@ -424,10 +697,6 @@ void QCamera::setAspectRatio(float aspectRatio)
d->m_lens->setAspectRatio(aspectRatio);
}
-/*!
- * \qmlproperty float Qt3DCore::Camera::aspectRatio
- * The current aspect ratio.
- */
float QCamera::aspectRatio() const
{
Q_D(const QCamera);
@@ -443,10 +712,6 @@ void QCamera::setLeft(float left)
d->m_lens->setLeft(left);
}
-/*!
- *\qmlproperty float Qt3DCore::Camera::left
- * The current left of the camera.
- */
float QCamera::left() const
{
Q_D(const QCamera);
@@ -462,10 +727,6 @@ void QCamera::setRight(float right)
d->m_lens->setRight(right);
}
-/*!
- * \qmlproperty float Qt3DCore::Camera::right
- * The current right of the camera.
- */
float QCamera::right() const
{
Q_D(const QCamera);
@@ -481,10 +742,6 @@ void QCamera::setBottom(float bottom)
d->m_lens->setBottom(bottom);
}
-/*!
- * \qmlproperty float Qt3DCore::Camera::bottom
- * The current bottom of the camera.
- */
float QCamera::bottom() const
{
Q_D(const QCamera);
@@ -500,10 +757,6 @@ void QCamera::setTop(float top)
d->m_lens->setTop(top);
}
-/*!
- * \qmlproperty float Qt3DCore::Camera::top
- * The current top of the camera.
- */
float QCamera::top() const
{
Q_D(const QCamera);
@@ -511,7 +764,7 @@ float QCamera::top() const
}
/*!
- * Sets the camera's projection matrix.
+ * Sets the camera's projection matrix to \a projectionMatrix.
*/
void QCamera::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
{
@@ -519,10 +772,6 @@ void QCamera::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
d->m_lens->setProjectionMatrix(projectionMatrix);
}
-/*!
- * \qmlproperty QMatri4x4 Qt3DCore::Camera:projectionMatrix
- * The current projection matrix of the camera.
- */
QMatrix4x4 QCamera::projectionMatrix() const
{
Q_D(const QCamera);
@@ -545,10 +794,6 @@ void QCamera::setPosition(const QVector3D &position)
}
}
-/*!
- * \qmlproperty vector3d Qt3DCore::Camera::position
- * The camera's position.
- */
QVector3D QCamera::position() const
{
Q_D(const QCamera);
@@ -569,10 +814,6 @@ void QCamera::setUpVector(const QVector3D &upVector)
}
}
-/*!
- * \qmlproperty vector3d Qt3DCore::Camera::upVector
- * The camera's up vector.
- */
QVector3D QCamera::upVector() const
{
Q_D(const QCamera);
@@ -595,30 +836,18 @@ void QCamera::setViewCenter(const QVector3D &viewCenter)
}
}
-/*!
- * \qmlproperty vector3d Qt3DCore::Camera::viewCenter
- * The camera's view center.
- */
QVector3D QCamera::viewCenter() const
{
Q_D(const QCamera);
return d->m_viewCenter;
}
-/*!
- * \qmlproperty vector3d Qt3DCore::Camera::viewVector
- * The camera's view vector.
- */
QVector3D QCamera::viewVector() const
{
Q_D(const QCamera);
return d->m_cameraToCenter;
}
-/*!
- * \qmlproperty matrix4x4 Qt3DCore::Camera::viewMatrix
- * The camera's view matrix.
- */
QMatrix4x4 QCamera::viewMatrix() const
{
Q_D(const QCamera);
diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp
index 8c730c763..4725251b5 100644
--- a/src/render/frontend/qcameralens.cpp
+++ b/src/render/frontend/qcameralens.cpp
@@ -45,8 +45,164 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- \internal
-*/
+ * \class Qt3DRender::QCameraLens
+ * \inmodule Qt3DRender
+ *
+ * \brief Qt3DRender::QCameraLens specifies the projection matrix that will be used to
+ * define a Camera for a 3D scene.
+ *
+ * \since 5.5
+ */
+
+/*!
+ * \qmltype CameraLens
+ * \instantiates Qt3DRender::QCameraLens
+ * \inqmlmodule Qt3D.Render
+ * \inherits Component3D
+ * \since 5.5
+ * \brief Provides the projection matrix that is used to define a Camera for 3D scene.
+ */
+
+/*!
+ * \enum Qt3DRender::QCameraLens::ProjectionType
+ *
+ * Specifies which parameters of Qt3DRender::QCameraLens are used to compute the projection matrix.
+ *
+ * \value OrthographicProjection Orthogonal projection
+ * \value PerspectiveProjection Perspective projection
+ * \value FrustumProjection Frustum projection
+ * \value CustomProjection Custom user-defined projection
+ */
+
+/*!
+ * \qmlproperty enumeration CameraLens::projectionType
+ *
+ * Holds the type of the camera projection.
+ *
+ * \list
+ * \li CameraLens.OrthographicProjection
+ * \li CameraLens.PerspectiveProjection
+ * \li CameraLens.FrustumProjection
+ * \li CameraLens.CustomProjection
+ * \endlist
+ * \sa Qt3DRender::QCameraLens::ProjectionType
+ */
+
+/*!
+ * \qmlproperty real CameraLens::nearPlane
+ * Holds the current near plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::farPlane
+ * Holds the current near plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::fieldOfView
+ * Holds the current field of view of the camera lens in degrees.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::aspectRatio
+ * Holds the current aspect ratio of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::left
+ * Holds the current left plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::right
+ * Holds the current right plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::bottom
+ * Holds the current bottom plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty real CameraLens::top
+ * Holds the current top plane of the camera lens.
+ */
+
+/*!
+ * \qmlproperty matrix4x4 CameraLens::projectionMatrix
+ * Holds the current projection matrix of the camera lens.
+ * \readonly
+ */
+
+
+/*!
+ * \property QCameraLens::projectionType
+ *
+ * Holds the type of the camera projection.
+ * \sa Qt3DRender::QCameraLens::ProjectionType
+ */
+
+/*!
+ * \property QCameraLens::nearPlane
+ * Holds the current near plane of the camera lens.
+ */
+
+/*!
+ * \property QCameraLens::farPlane
+ * Holds the current near plane of the camera lens.
+ */
+
+/*!
+ * \property QCameraLens::fieldOfView
+ * Holds the current field of view of the camera lens.
+ * \note: The return value may be undefined if the projection type is not
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::aspectRatio
+ * Holds the current aspect ratio of the camera lens.
+ * \note: The return value may be undefined if the projection type is not
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::left
+ * Holds the current left plane of the camera lens.
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::right
+ * Holds the current right plane of the camera lens.
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::bottom
+ * Holds the current bottom plane of the camera lens.
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::top
+ * Holds the current top plane of the camera lens.
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+
+/*!
+ * \property QCameraLens::projectionMatrix
+ * Holds the current projection matrix of the camera lens.
+ * \readonly
+ */
+
+/*!
+ * \internal
+ */
QCameraLensPrivate::QCameraLensPrivate()
: Qt3DCore::QComponentPrivate()
, m_projectionType(QCameraLens::PerspectiveProjection)
@@ -61,6 +217,9 @@ QCameraLensPrivate::QCameraLensPrivate()
{
}
+/*!
+ * Constructs a QCameraLens with given \a parent
+ */
QCameraLens::QCameraLens(QNode *parent)
: Qt3DCore::QComponent(*new QCameraLensPrivate, parent)
{
@@ -73,14 +232,6 @@ QCameraLens::~QCameraLens()
{
}
-/*! \class Qt3DRender::QCameraLens
- * \inmodule Qt3DCore
- *
- * \brief Qt3DRender::QCameraLens specifies the projection matrix that will be used to
- * define a Camera for a 3D scene.
- *
- * \since 5.5
- */
QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent)
: QComponent(dd, parent)
{
@@ -89,17 +240,6 @@ QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent)
}
/*!
- * \enum Qt3DRender::QCameraLens::ProjectionType
- *
- * Specifies which parameters of Qt3DRender::QCameraLens are used to compute the projection matrix.
- *
- * \value OrthographicProjection
- * \value PerspectiveProjection
- * \value FrustumProjection
- * \value CustomProjection
- */
-
-/*!
* Sets the lens' projection type \a projectionType.
*
* \note Qt3DRender::QCameraLens::Frustum and
@@ -120,9 +260,6 @@ void QCameraLens::setProjectionType(QCameraLens::ProjectionType projectionType)
}
}
-/*!
- * Returns the lens' projection type.
- */
QCameraLens::ProjectionType QCameraLens::projectionType() const
{
Q_D(const QCameraLens);
@@ -207,9 +344,6 @@ void QCameraLens::setNearPlane(float nearPlane)
d->updateProjectionMatrix();
}
-/*!
- * Returns the projection's near plane.
- */
float QCameraLens::nearPlane() const
{
Q_D(const QCameraLens);
@@ -234,9 +368,6 @@ void QCameraLens::setFarPlane(float farPlane)
d->updateProjectionMatrix();
}
-/*!
- * Returns the projection's far plane.
- */
float QCameraLens::farPlane() const
{
Q_D(const QCameraLens);
@@ -264,12 +395,6 @@ void QCameraLens::setFieldOfView(float fieldOfView)
d->updateProjectionMatrix();
}
-/*!
- * Returns the projection's field of view in degrees.
- *
- * \note: The return value may be undefined if the projection type is not
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::fieldOfView() const
{
Q_D(const QCameraLens);
@@ -297,12 +422,6 @@ void QCameraLens::setAspectRatio(float aspectRatio)
d->updateProjectionMatrix();
}
-/*!
- * Returns the projection's aspect ratio.
- *
- * \note: The return value may be undefined if the projection type is not
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::aspectRatio() const
{
Q_D(const QCameraLens);
@@ -330,12 +449,6 @@ void QCameraLens::setLeft(float left)
d->updateProjectionMatrix();
}
-/*!
- * Returns the lower left window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::left() const
{
Q_D(const QCameraLens);
@@ -363,12 +476,6 @@ void QCameraLens::setRight(float right)
d->updateProjectionMatrix();
}
-/*!
- * Returns the upper right window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::right() const
{
Q_D(const QCameraLens);
@@ -396,12 +503,6 @@ void QCameraLens::setBottom(float bottom)
d->updateProjectionMatrix();
}
-/*!
- * Returns the bottom window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::bottom() const
{
Q_D(const QCameraLens);
@@ -429,12 +530,6 @@ void QCameraLens::setTop(float top)
d->updateProjectionMatrix();
}
-/*!
- * Returns the bottom window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DRender::QCameraLens::PerspectiveProjection.
- */
float QCameraLens::top() const
{
Q_D(const QCameraLens);
@@ -442,7 +537,7 @@ float QCameraLens::top() const
}
/*!
- * Sets the project matrix.
+ * Sets the project matrix to \a projectionMatrix.
*
* \note This will set the projection type to Qt3DRender::QCameraLens::CustomProjection and thus
* ignore all other camera parameters that might have been specified.
@@ -457,9 +552,6 @@ void QCameraLens::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
emit projectionMatrixChanged(projectionMatrix);
}
-/*!
- * Returns the projection matrix.
- */
QMatrix4x4 QCameraLens::projectionMatrix() const
{
Q_D(const QCameraLens);
@@ -476,59 +568,4 @@ Qt3DCore::QNodeCreatedChangeBasePtr QCameraLens::createNodeCreationChange() cons
} // Qt3DRender
-/*!
- \qmltype CameraLens
- \instantiates Qt3DRender::QCameraLens
- \inqmlmodule Qt3D.Core
- \inherits Component3D
- \since 5.5
- \brief Provides the projection matrix that is used to define a Camera for 3D scene.
-*/
-
-/*!
- \qmlproperty enumeration Qt3DCore::CameraLens::projectionType
-
- Holds the type of the camera projection (orthogonal or perspective).
-
- \value CameraLens.OrthographicProjection Orthogonal projection
- \value CameraLens.PerspectiveProjection Perspective projection
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::nearPlane
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::farPlane
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::fieldOfView
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::aspectRatio
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::left
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::right
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::bottom
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::top
-*/
-
-/*!
- \qmlproperty matrix4x4 Qt3DCore::CameraLens::projectionMatrix
- \readonly
-*/
-
QT_END_NAMESPACE
diff --git a/src/render/frontend/qpickingsettings.cpp b/src/render/frontend/qpickingsettings.cpp
index 2805ec5a8..c1524547c 100644
--- a/src/render/frontend/qpickingsettings.cpp
+++ b/src/render/frontend/qpickingsettings.cpp
@@ -45,12 +45,25 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- * \class Qt3DRender::QPickingSettings
- * \brief The QPickingSettings class specifies the current framegraph to be used
- * by the renderer and specifies whether rendering is always active or updated
- * only on changes.
- * \since 5.7
- * \inmodule Qt3DRender
+ \class Qt3DRender::QPickingSettings
+ \brief The QPickingSettings class specifies how entity picking is handled.
+ \since 5.7
+ \inmodule Qt3DRender
+ \inherits Qt3DCore::QNode
+
+ The picking settings determine how the entity picking is handled. For more details about
+ entity picking, see QObjectPicker component documentation.
+ */
+
+/*!
+ \qmltype PickingSettings
+ \brief The PickingSettings class specifies how entity picking is handled.
+ \since 5.7
+ \inqmlmodule Qt3D.Render
+ \instantiates Qt3DRender::QPickingSettings
+
+ The picking settings determine how the entity picking is handled. For more details about
+ entity picking, see Qt3DRender::QObjectPicker component documentation.
*/
QPickingSettingsPrivate::QPickingSettingsPrivate()
@@ -61,11 +74,6 @@ QPickingSettingsPrivate::QPickingSettingsPrivate()
{
}
-/*!
- * The constructor creates a new Qt3DRender::QPickingSettings
- * instance with the specified \a parent.
- * \param parent
- */
QPickingSettings::QPickingSettings(Qt3DCore::QNode *parent)
: Qt3DCore::QNode(*new QPickingSettingsPrivate, parent)
{
@@ -82,18 +90,12 @@ QPickingSettings::QPickingSettings(QPickingSettingsPrivate &dd, Qt3DCore::QNode
{
}
-/*!
- * \return the current pick method.
- */
QPickingSettings::PickMethod QPickingSettings::pickMethod() const
{
Q_D(const QPickingSettings);
return d->m_pickMethod;
}
-/*!
- * \return the current pick result mode.
- */
QPickingSettings::PickResultMode QPickingSettings::pickResultMode() const
{
Q_D(const QPickingSettings);
@@ -112,16 +114,31 @@ QPickingSettings::FaceOrientationPickingMode QPickingSettings::faceOrientationPi
/*!
* \enum Qt3DRender::QPickingSettings::PickMethod
*
- * Specifies which parameters of Qt3DRender::QPickingSettings are used.
+ * Specifies the picking method.
*
- * \value BoundingVolumePicking
- * \value TrianglePicking
+ * \value BoundingVolumePicking An entity is considered picked if the picking ray intersects
+ * the bounding volume of the entity.
+ * \value TrianglePicking An entity is considered picked if the picking ray intersects with
+ * any triangle of the entity's mesh component.
*/
/*!
- * Sets the pick method to \a pickMethod
- * \param pickMethod
- */
+ \qmlproperty enumeration PickingSettings::pickMethod
+
+ Holds the current pick method.
+
+ \list
+ \li PickingSettings.BoundingVolumePicking
+ \li PickingSettings.TrianglePicking
+ \endlist
+
+ \sa Qt3DRender::QPickingSettings::PickMethod
+*/
+/*!
+ \property QPickingSettings::pickMethod
+
+ Holds the current pick method.
+*/
void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
{
Q_D(QPickingSettings);
@@ -135,16 +152,30 @@ void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
/*!
* \enum Qt3DRender::QPickingSettings::PickResultMode
*
- * Specifies which parameters of Qt3DRender::PickResultMode are used.
+ * Specifies what is included into the picking results.
*
- * \value NearestPick
- * \value AllPicks
+ * \value NearestPick Only the nearest entity to picking ray origin intersected by the picking ray
+ * is picked.
+ * \value AllPicks All entities that intersect the picking ray are picked.
*/
/*!
- * Sets the pick result mode to \a pickResultMode
- * \param pickResultMode
- */
+ \qmlproperty enumeration PickingSettings::pickResultMode
+
+ Holds the current pick results mode.
+
+ \list
+ \li PickingSettings.NearestPick
+ \li PickingSettings.AllPicks
+ \endlist
+
+ \sa Qt3DRender::QPickingSettings::PickResultMode
+*/
+/*!
+ \property QPickingSettings::pickResultMode
+
+ Holds the current pick results mode.
+*/
void QPickingSettings::setPickResultMode(QPickingSettings::PickResultMode pickResultMode)
{
Q_D(QPickingSettings);
diff --git a/src/render/frontend/qrendersettings.cpp b/src/render/frontend/qrendersettings.cpp
index c15a7810c..616c3a64e 100644
--- a/src/render/frontend/qrendersettings.cpp
+++ b/src/render/frontend/qrendersettings.cpp
@@ -46,10 +46,29 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
/*!
- * \class Qt3DRender::QRenderSettings
- * \brief The QRenderSettings class
- * \since 5.7
- * \inmodule Qt3DRender
+ \class Qt3DRender::QRenderSettings
+ \brief The QRenderSettings class holds settings related to rendering process and host the active
+ \l{Qt 3D Render Framegraph}{FrameGraph}.
+ \since 5.7
+ \inmodule Qt3DRender
+ \inherits Qt3DCore::QComponent
+
+ The QRenderSettings component must be set as a component of the scene root entity. It specifies
+ render policy and picking settings, as well as hosts the active
+ \l{Qt 3D Render Framegraph}{FrameGraph}.
+ */
+
+/*!
+ \qmltype RenderSettings
+ \brief The RenderSettings type holds settings related to rendering process and host the active
+ \l{Qt 3D Render Framegraph}{FrameGraph}.
+ \since 5.7
+ \inqmlmodule Qt3D.Render
+ \instantiates Qt3DRender::QRenderSettings
+
+ The RenderSettings component must be set as a component of the scene root entity. It specifies
+ render policy and picking settings, as well as hosts the active
+ \l{Qt 3D Render Framegraph}{FrameGraph}.
*/
/*! \internal */
@@ -69,7 +88,7 @@ void QRenderSettingsPrivate::init()
QObject::connect(&m_pickingSettings, SIGNAL(pickResultModeChanged(QPickingSettings::PickResultMode)),
q, SLOT(_q_onPickResultModeChanged(QPickingSettings::PickResultMode)));
QObject::connect(&m_pickingSettings, SIGNAL(faceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode)),
- q, SLOT(_q_onFaceOrientationPickingMode(QPickingSettings::FaceOrientationPickingMode)));
+ q, SLOT(_q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode)));
}
/*! \internal */
@@ -85,16 +104,11 @@ void QRenderSettingsPrivate::_q_onPickResultModeChanged(QPickingSettings::PickRe
}
/*! \internal */
-void QRenderSettingsPrivate::_q_onFaceOrientationPickingModeChanged(bool faceOrientationPickingMode)
+void QRenderSettingsPrivate::_q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode)
{
notifyPropertyChange("faceOrientationPickingMode", faceOrientationPickingMode);
}
-/*!
- * The constructor creates a new QRenderSettings::QRenderSettings instance with the
- * specified \a parent.
- * \param parent
- */
QRenderSettings::QRenderSettings(Qt3DCore::QNode *parent)
: QRenderSettings(*new QRenderSettingsPrivate, parent) {}
@@ -112,8 +126,19 @@ QRenderSettings::~QRenderSettings()
}
/*!
- * \return the current picking settings.
- */
+ \qmlproperty PickingSettings RenderSettings::pickingSettings
+
+ Holds the current pick settings for the \l{Qt 3D Render Framegraph}{FrameGraph}.
+
+ \readonly
+*/
+/*!
+ \property QRenderSettings::pickingSettings
+
+ Holds the current pick settings for the \l{Qt 3D Render Framegraph}{FrameGraph}.
+
+ \readonly
+*/
QPickingSettings *QRenderSettings::pickingSettings()
{
Q_D(QRenderSettings);
@@ -121,27 +146,56 @@ QPickingSettings *QRenderSettings::pickingSettings()
}
/*!
- * \return the current active framegraph.
- */
+ \qmlproperty FrameGraphNode RenderSettings::activeFrameGraph
+
+ Holds the currently active \l{Qt 3D Render Framegraph}{FrameGraph}.
+*/
+/*!
+ \property QRenderSettings::activeFrameGraph
+
+ Holds the currently active \l{Qt 3D Render Framegraph}{FrameGraph}.
+*/
QFrameGraphNode *QRenderSettings::activeFrameGraph() const
{
Q_D(const QRenderSettings);
return d->m_activeFrameGraph;
}
+
/*!
- * \return the current render policy
- */
+ \enum QRenderSettings::RenderPolicy
+
+ The render policy.
+
+ \value OnDemand The \l{Qt 3D Render Framegraph}{FrameGraph} is rendered only when something
+ changes.
+ \value Always The \l{Qt 3D Render Framegraph}{FrameGraph} is rendered continuously, even if
+ nothing has changed.
+*/
+
+/*!
+ \qmlproperty enumeration RenderSettings::renderPolicy
+
+ Holds the current render policy.
+
+ \list
+ \li RenderSettings.OnDemand
+ \li RenderSettings.Always
+ \endlist
+
+ \sa Qt3DRender::QRenderSettings::RenderPolicy
+*/
+/*!
+ \property QRenderSettings::renderPolicy
+
+ Holds the current render policy.
+*/
QRenderSettings::RenderPolicy QRenderSettings::renderPolicy() const
{
Q_D(const QRenderSettings);
return d->m_renderPolicy;
}
-/*!
- * Sets the active framegraph to \a activeFrameGraph.
- * \param activeFrameGraph
- */
void QRenderSettings::setActiveFrameGraph(QFrameGraphNode *activeFrameGraph)
{
Q_D(QRenderSettings);
@@ -163,10 +217,6 @@ void QRenderSettings::setActiveFrameGraph(QFrameGraphNode *activeFrameGraph)
emit activeFrameGraphChanged(activeFrameGraph);
}
-/*!
- * Sets the render policy to \a renderPolicy.
- * \param renderPolicy
- */
void QRenderSettings::setRenderPolicy(QRenderSettings::RenderPolicy renderPolicy)
{
Q_D(QRenderSettings);
diff --git a/src/render/frontend/qrendersettings.h b/src/render/frontend/qrendersettings.h
index 55fe3007a..68e8f8d7f 100644
--- a/src/render/frontend/qrendersettings.h
+++ b/src/render/frontend/qrendersettings.h
@@ -89,6 +89,7 @@ protected:
private:
Q_PRIVATE_SLOT(d_func(), void _q_onPickingMethodChanged(QPickingSettings::PickMethod))
Q_PRIVATE_SLOT(d_func(), void _q_onPickResultModeChanged(QPickingSettings::PickResultMode))
+ Q_PRIVATE_SLOT(d_func(), void _q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode))
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/frontend/qrendersettings_p.h b/src/render/frontend/qrendersettings_p.h
index b590ada00..f05124296 100644
--- a/src/render/frontend/qrendersettings_p.h
+++ b/src/render/frontend/qrendersettings_p.h
@@ -72,7 +72,7 @@ public:
void _q_onPickingMethodChanged(QPickingSettings::PickMethod pickMethod);
void _q_onPickResultModeChanged(QPickingSettings::PickResultMode pickResultMode);
- void _q_onFaceOrientationPickingModeChanged(bool faceOrientationPickingMode);
+ void _q_onFaceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode);
Q_DECLARE_PUBLIC(QRenderSettings)
};
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index acec8edf6..4c2d902f1 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -852,6 +852,11 @@ void GraphicsContext::alphaTest(GLenum mode1, GLenum mode2)
m_glHelper->alphaTest(mode1, mode2);
}
+void GraphicsContext::bindFramebuffer(GLuint fbo)
+{
+ m_glHelper->bindFrameBufferObject(fbo);
+}
+
void GraphicsContext::depthTest(GLenum mode)
{
m_glHelper->depthTest(mode);
@@ -874,11 +879,6 @@ void GraphicsContext::bindFragOutputs(GLuint shader, const QHash<QString, int> &
m_glHelper->bindFragDataLocation(shader, outputs);
}
-void GraphicsContext::bindUniform(const QVariant &v, const ShaderUniform &description)
-{
- m_glHelper->bindUniform(v, description);
-}
-
void GraphicsContext::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
m_glHelper->bindUniformBlock(programId, uniformBlockIndex, uniformBlockBinding);
@@ -1079,12 +1079,12 @@ void GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
for (int i = 0; i < parameterPack.textures().size(); ++i) {
const ShaderParameterPack::NamedTexture &namedTex = parameterPack.textures().at(i);
Texture *t = manager->lookupResource<Texture, TextureManager>(namedTex.texId);
- // TO DO : Rework the way textures are loaded
if (t != nullptr) {
int texUnit = activateTexture(TextureScopeMaterial, t);
if (uniformValues.contains(namedTex.glslNameId)) {
- QUniformValue &texUniform = uniformValues[namedTex.glslNameId];
- texUniform.setTextureUnit(texUnit);
+ UniformValue &texUniform = uniformValues[namedTex.glslNameId];
+ Q_ASSERT(texUniform.valueType() == UniformValue::TextureValue);
+ texUniform.data<UniformValue::Texture>()->textureId = texUnit;
}
}
}
@@ -1140,8 +1140,7 @@ void GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
for (const ShaderUniform &uniform : activeUniforms) {
// We can use [] as we are sure the the uniform wouldn't
// be un activeUniforms if there wasn't a matching value
- const QUniformValue &value = values[uniform.m_nameId];
- value.apply(this, uniform);
+ applyUniform(uniform, values[uniform.m_nameId]);
}
}
@@ -1171,6 +1170,109 @@ void GraphicsContext::disableAttribute(const GraphicsContext::VAOVertexAttribute
prog->disableAttributeArray(attr.location);
}
+void GraphicsContext::applyUniform(const ShaderUniform &description, const UniformValue &v)
+{
+ const UniformType type = m_glHelper->uniformTypeFromGLType(description.m_type);
+
+ switch (type) {
+ case UniformType::Float:
+ applyUniformHelper<UniformType::Float>(description.m_location, v);
+ break;
+ case UniformType::Vec2:
+ applyUniformHelper<UniformType::Vec2>(description.m_location, v);
+ break;
+ case UniformType::Vec3:
+ applyUniformHelper<UniformType::Vec3>(description.m_location, v);
+ break;
+ case UniformType::Vec4:
+ applyUniformHelper<UniformType::Vec4>(description.m_location, v);
+ break;
+
+ case UniformType::Double:
+ applyUniformHelper<UniformType::Double>(description.m_location, v);
+ break;
+ case UniformType::DVec2:
+ applyUniformHelper<UniformType::DVec2>(description.m_location, v);
+ break;
+ case UniformType::DVec3:
+ applyUniformHelper<UniformType::DVec3>(description.m_location, v);
+ break;
+ case UniformType::DVec4:
+ applyUniformHelper<UniformType::DVec4>(description.m_location, v);
+ break;
+
+ case UniformType::Sampler:
+ case UniformType::Int:
+ applyUniformHelper<UniformType::Int>(description.m_location, v);
+ break;
+ case UniformType::IVec2:
+ applyUniformHelper<UniformType::IVec2>(description.m_location, v);
+ break;
+ case UniformType::IVec3:
+ applyUniformHelper<UniformType::IVec3>(description.m_location, v);
+ break;
+ case UniformType::IVec4:
+ applyUniformHelper<UniformType::IVec4>(description.m_location, v);
+ break;
+
+ case UniformType::UInt:
+ applyUniformHelper<UniformType::Int>(description.m_location, v);
+ break;
+ case UniformType::UIVec2:
+ applyUniformHelper<UniformType::IVec2>(description.m_location, v);
+ break;
+ case UniformType::UIVec3:
+ applyUniformHelper<UniformType::IVec3>(description.m_location, v);
+ break;
+ case UniformType::UIVec4:
+ applyUniformHelper<UniformType::IVec4>(description.m_location, v);
+ break;
+
+ case UniformType::Bool:
+ applyUniformHelper<UniformType::Bool>(description.m_location, v);
+ break;
+ case UniformType::BVec2:
+ applyUniformHelper<UniformType::BVec2>(description.m_location, v);
+ break;
+ case UniformType::BVec3:
+ applyUniformHelper<UniformType::BVec3>(description.m_location, v);
+ break;
+ case UniformType::BVec4:
+ applyUniformHelper<UniformType::BVec4>(description.m_location, v);
+ break;
+
+ case UniformType::Mat2:
+ applyUniformHelper<UniformType::Mat2>(description.m_location, v);
+ break;
+ case UniformType::Mat3:
+ applyUniformHelper<UniformType::Mat3>(description.m_location, v);
+ break;
+ case UniformType::Mat4:
+ applyUniformHelper<UniformType::Mat4>(description.m_location, v);
+ break;
+ case UniformType::Mat2x3:
+ applyUniformHelper<UniformType::Mat2x3>(description.m_location, v);
+ break;
+ case UniformType::Mat3x2:
+ applyUniformHelper<UniformType::Mat3x2>(description.m_location, v);
+ break;
+ case UniformType::Mat2x4:
+ applyUniformHelper<UniformType::Mat2x4>(description.m_location, v);
+ break;
+ case UniformType::Mat4x2:
+ applyUniformHelper<UniformType::Mat4x2>(description.m_location, v);
+ case UniformType::Mat3x4:
+ applyUniformHelper<UniformType::Mat3x4>(description.m_location, v);
+ break;
+ case UniformType::Mat4x3:
+ applyUniformHelper<UniformType::Mat4x3>(description.m_location, v);
+ break;
+
+ default:
+ break;
+ }
+}
+
// Note: needs to be called while VAO is bound
void GraphicsContext::specifyAttribute(const Attribute *attribute, Buffer *buffer, int location)
{
@@ -1452,6 +1554,37 @@ QImage GraphicsContext::readFramebuffer(QSize size)
return qt_gl_read_framebuffer(size, true, true);
}
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Float, float, glUniform1fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Vec2, float, glUniform2fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Vec3, float, glUniform3fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Vec4, float, glUniform4fv)
+
+// OpenGL expects int* as values for booleans
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Bool, int, glUniform1iv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::BVec2, int, glUniform2iv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::BVec3, int, glUniform3iv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::BVec4, int, glUniform4iv)
+
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Int, int, glUniform1iv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::IVec2, int, glUniform2iv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::IVec3, int, glUniform3iv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::IVec4, int, glUniform4iv)
+
+QT3D_UNIFORM_TYPE_IMPL(UniformType::UInt, uint, glUniform1uiv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::UIVec2, uint, glUniform2uiv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::UIVec3, uint, glUniform3uiv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::UIVec4, uint, glUniform4uiv)
+
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat2, float, glUniformMatrix2fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat3, float, glUniformMatrix3fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat4, float, glUniformMatrix4fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat2x3, float, glUniformMatrix2x3fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat3x2, float, glUniformMatrix3x2fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat2x4, float, glUniformMatrix2x4fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat4x2, float, glUniformMatrix4x2fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat3x4, float, glUniformMatrix3x4fv)
+QT3D_UNIFORM_TYPE_IMPL(UniformType::Mat4x3, float, glUniformMatrix4x3fv)
+
} // namespace Render
} // namespace Qt3DRender of namespace
diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h
index d1b21a1d6..647db9e47 100644
--- a/src/render/graphicshelpers/graphicscontext_p.h
+++ b/src/render/graphicshelpers/graphicscontext_p.h
@@ -60,7 +60,7 @@
#include <QMatrix4x4>
#include <QBitArray>
#include <QImage>
-#include <Qt3DRender/private/quniformvalue_p.h>
+#include <Qt3DRender/private/shaderparameterpack_p.h>
#include <Qt3DRender/qclearbuffers.h>
#include <Qt3DRender/private/shader_p.h>
#include <Qt3DRender/private/glbuffer_p.h>
@@ -68,6 +68,7 @@
#include <Qt3DRender/private/handle_types_p.h>
#include <Qt3DRender/private/qgraphicsapifilter_p.h>
#include <Qt3DRender/private/shadercache_p.h>
+#include <Qt3DRender/private/uniform_p.h>
QT_BEGIN_NAMESPACE
@@ -183,10 +184,10 @@ public:
// Wrapper methods
void alphaTest(GLenum mode1, GLenum mode2);
+ void bindFramebuffer(GLuint fbo);
void bindBufferBase(GLenum target, GLuint bindingIndex, GLuint buffer);
void bindFragOutputs(GLuint shader, const QHash<QString, int> &outputs);
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void bindUniform(const QVariant &v, const ShaderUniform &description);
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding);
void blendEquation(GLenum mode);
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor);
@@ -314,8 +315,59 @@ private:
void enableAttribute(const VAOVertexAttribute &attr);
void disableAttribute(const VAOVertexAttribute &attr);
+
+ void applyUniform(const ShaderUniform &description, const UniformValue &v);
+
+ template<UniformType>
+ void applyUniformHelper(int, const UniformValue &) const
+ {
+ Q_ASSERT_X(false, Q_FUNC_INFO, "Uniform: Didn't provide specialized apply() implementation");
+ }
};
+#define QT3D_UNIFORM_TYPE_PROTO(UniformTypeEnum, BaseType, Func) \
+template<> \
+void GraphicsContext::applyUniformHelper<UniformTypeEnum>(int location, const UniformValue &value) const;
+
+#define QT3D_UNIFORM_TYPE_IMPL(UniformTypeEnum, BaseType, Func) \
+ template<> \
+ void GraphicsContext::applyUniformHelper<UniformTypeEnum>(int location, const UniformValue &value) const \
+{ \
+ m_glHelper->Func(location, 1, value.constData<BaseType>()); \
+}
+
+
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Float, float, glUniform1fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Vec2, float, glUniform2fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Vec3, float, glUniform3fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Vec4, float, glUniform4fv)
+
+// OpenGL expects int* as values for booleans
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Bool, int, glUniform1iv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::BVec2, int, glUniform2iv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::BVec3, int, glUniform3iv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::BVec4, int, glUniform4iv)
+
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Int, int, glUniform1iv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::IVec2, int, glUniform2iv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::IVec3, int, glUniform3iv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::IVec4, int, glUniform4iv)
+
+QT3D_UNIFORM_TYPE_PROTO(UniformType::UInt, uint, glUniform1uiv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::UIVec2, uint, glUniform2uiv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::UIVec3, uint, glUniform3uiv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::UIVec4, uint, glUniform4uiv)
+
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat2, float, glUniformMatrix2fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat3, float, glUniformMatrix3fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat4, float, glUniformMatrix4fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat2x3, float, glUniformMatrix2x3fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat3x2, float, glUniformMatrix3x2fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat2x4, float, glUniformMatrix2x4fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat4x2, float, glUniformMatrix4x2fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat3x4, float, glUniformMatrix3x4fv)
+QT3D_UNIFORM_TYPE_PROTO(UniformType::Mat4x3, float, glUniformMatrix4x3fv)
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp
index bf26fcc63..3a268cb5f 100644
--- a/src/render/graphicshelpers/graphicshelperes2.cpp
+++ b/src/render/graphicshelpers/graphicshelperes2.cpp
@@ -359,108 +359,6 @@ void GraphicsHelperES2::drawBuffers(GLsizei, const int *)
qWarning() << "drawBuffers is not supported by ES 2.0";
}
-void GraphicsHelperES2::bindUniform(const QVariant &v, const ShaderUniform &description)
-{
- switch (description.m_type) {
-
- case GL_FLOAT:
- m_funcs->glUniform1fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 1));
- break;
-
- case GL_FLOAT_VEC2:
- m_funcs->glUniform2fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 2));
- break;
-
- case GL_FLOAT_VEC3:
- m_funcs->glUniform3fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 3));
- break;
-
- case GL_FLOAT_VEC4:
- m_funcs->glUniform4fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT2:
- m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT3:
- m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 9));
- break;
-
- case GL_FLOAT_MAT4:
- m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 16));
- break;
-
- case GL_INT:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_INT_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_INT_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_INT_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_BOOL:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_BOOL_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_BOOL_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_BOOL_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE: {
- Q_ASSERT(description.m_size == 1);
- m_funcs->glUniform1i(description.m_location, v.toInt());
- break;
- }
-
- // ES 3.0+
- case GL_SAMPLER_3D:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- qWarning() << Q_FUNC_INFO << "ES 3.0 uniform type" << description.m_type << "for"
- << description.m_name << "is not supported in ES 2.0";
- break;
-
- default:
- qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name;
- break;
- }
-}
-
void GraphicsHelperES2::bindFragDataLocation(GLuint , const QHash<QString, int> &)
{
qCritical() << "bindFragDataLocation is not supported by ES 2.0";
@@ -760,6 +658,49 @@ void GraphicsHelperES2::glUniformMatrix4x3fv(GLint , GLsizei , const GLfloat *)
qWarning() << "glUniformMatrix4x3fv not supported by ES 2";
}
+UniformType GraphicsHelperES2::uniformTypeFromGLType(GLenum type)
+{
+ switch (type) {
+ case GL_FLOAT:
+ return UniformType::Float;
+ case GL_FLOAT_VEC2:
+ return UniformType::Vec2;
+ case GL_FLOAT_VEC3:
+ return UniformType::Vec3;
+ case GL_FLOAT_VEC4:
+ return UniformType::Vec4;
+ case GL_FLOAT_MAT2:
+ return UniformType::Mat2;
+ case GL_FLOAT_MAT3:
+ return UniformType::Mat3;
+ case GL_FLOAT_MAT4:
+ return UniformType::Mat4;
+ case GL_INT:
+ return UniformType::Int;
+ case GL_INT_VEC2:
+ return UniformType::IVec2;
+ case GL_INT_VEC3:
+ return UniformType::IVec3;
+ case GL_INT_VEC4:
+ return UniformType::IVec4;
+ case GL_BOOL:
+ return UniformType::Bool;
+ case GL_BOOL_VEC2:
+ return UniformType::BVec2;
+ case GL_BOOL_VEC3:
+ return UniformType::BVec3;
+ case GL_BOOL_VEC4:
+ return UniformType::BVec4;
+
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ return UniformType::Sampler;
+ default:
+ Q_UNREACHABLE();
+ return UniformType::Float;
+ }
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h
index 0fd510a4d..52d68f691 100644
--- a/src/render/graphicshelpers/graphicshelperes2_p.h
+++ b/src/render/graphicshelpers/graphicshelperes2_p.h
@@ -74,7 +74,6 @@ public:
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
- void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
@@ -144,6 +143,8 @@ public:
void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
+ UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE;
+
protected:
QOpenGLFunctions *m_funcs;
};
diff --git a/src/render/graphicshelpers/graphicshelperes3.cpp b/src/render/graphicshelpers/graphicshelperes3.cpp
index fe39d9d3f..eb492e98d 100644
--- a/src/render/graphicshelpers/graphicshelperes3.cpp
+++ b/src/render/graphicshelpers/graphicshelperes3.cpp
@@ -150,20 +150,17 @@ void GraphicsHelperES3::drawBuffers(GLsizei n, const int *bufs)
m_extraFuncs->glDrawBuffers(n, drawBufs.constData());
}
-void GraphicsHelperES3::bindUniform(const QVariant &v, const ShaderUniform &description)
+UniformType GraphicsHelperES3::uniformTypeFromGLType(GLenum glType)
{
- switch (description.m_type) {
+ switch (glType) {
case GL_SAMPLER_3D:
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_CUBE_SHADOW:
case GL_SAMPLER_2D_ARRAY:
case GL_SAMPLER_2D_ARRAY_SHADOW:
- Q_ASSERT(description.m_size == 1);
- m_funcs->glUniform1i(description.m_location, v.toInt());
- break;
+ return UniformType::Sampler;
default:
- GraphicsHelperES2::bindUniform(v, description);
- break;
+ return GraphicsHelperES2::uniformTypeFromGLType(glType);
}
}
diff --git a/src/render/graphicshelpers/graphicshelperes3_p.h b/src/render/graphicshelpers/graphicshelperes3_p.h
index e5bb51c53..2844c140d 100644
--- a/src/render/graphicshelpers/graphicshelperes3_p.h
+++ b/src/render/graphicshelpers/graphicshelperes3_p.h
@@ -67,12 +67,14 @@ public:
// QGraphicHelperInterface interface
virtual void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE;
- virtual void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
virtual void drawBuffers(GLsizei n, const int *bufs) Q_DECL_OVERRIDE;
virtual void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
virtual void initializeHelper(QOpenGLContext *context, QAbstractOpenGLFunctions *functions) Q_DECL_OVERRIDE;
virtual bool supportsFeature(Feature feature) const Q_DECL_OVERRIDE;
virtual void vertexAttribDivisor(GLuint index, GLuint divisor) Q_DECL_OVERRIDE;
+
+ UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE;
+
protected:
QOpenGLExtraFunctions *m_extraFuncs = Q_NULLPTR;
};
diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp
index 6ab69b491..1315b4ab8 100644
--- a/src/render/graphicshelpers/graphicshelpergl2.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl2.cpp
@@ -58,7 +58,7 @@ GraphicsHelperGL2::GraphicsHelperGL2()
}
void GraphicsHelperGL2::initializeHelper(QOpenGLContext *context,
- QAbstractOpenGLFunctions *functions)
+ QAbstractOpenGLFunctions *functions)
{
Q_UNUSED(context);
m_funcs = static_cast<QOpenGLFunctions_2_0*>(functions);
@@ -95,9 +95,9 @@ void GraphicsHelperGL2::drawElementsInstancedBaseVertexBaseInstance(GLenum primi
}
void GraphicsHelperGL2::drawArraysInstanced(GLenum primitiveType,
- GLint first,
- GLsizei count,
- GLsizei instances)
+ GLint first,
+ GLsizei count,
+ GLsizei instances)
{
for (GLint i = 0; i < instances; i++)
drawArrays(primitiveType,
@@ -116,10 +116,10 @@ void GraphicsHelperGL2::drawArraysInstancedBaseInstance(GLenum primitiveType, GL
}
void GraphicsHelperGL2::drawElements(GLenum primitiveType,
- GLsizei primitiveCount,
- GLint indexType,
- void *indices,
- GLint baseVertex)
+ GLsizei primitiveCount,
+ GLint indexType,
+ void *indices,
+ GLint baseVertex)
{
if (baseVertex != 0)
qWarning() << "glDrawElementsBaseVertex is not supported with OpenGL 2";
@@ -131,8 +131,8 @@ void GraphicsHelperGL2::drawElements(GLenum primitiveType,
}
void GraphicsHelperGL2::drawArrays(GLenum primitiveType,
- GLint first,
- GLsizei count)
+ GLint first,
+ GLsizei count)
{
m_funcs->glDrawArrays(primitiveType,
first,
@@ -211,7 +211,7 @@ QVector<ShaderStorageBlock> GraphicsHelperGL2::programShaderStorageBlocks(GLuint
}
void GraphicsHelperGL2::vertexAttribDivisor(GLuint index,
- GLuint divisor)
+ GLuint divisor)
{
Q_UNUSED(index);
Q_UNUSED(divisor);
@@ -358,98 +358,6 @@ void GraphicsHelperGL2::bindFragDataLocation(GLuint, const QHash<QString, int> &
qCritical() << "bindFragDataLocation is not supported by GL 2.0";
}
-void GraphicsHelperGL2::bindUniform(const QVariant &v, const ShaderUniform &description)
-{
- switch (description.m_type) {
-
- case GL_FLOAT:
- m_funcs->glUniform1fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 1));
- break;
-
- case GL_FLOAT_VEC2:
- m_funcs->glUniform2fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 2));
- break;
-
- case GL_FLOAT_VEC3:
- m_funcs->glUniform3fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 3));
- break;
-
- case GL_FLOAT_VEC4:
- m_funcs->glUniform4fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT2:
- m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT3:
- m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 9));
- break;
-
- case GL_FLOAT_MAT4:
- m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 16));
- break;
-
- case GL_INT:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_INT_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_INT_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_INT_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_BOOL:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_BOOL_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_BOOL_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_BOOL_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE: {
- Q_ASSERT(description.m_size == 1);
- m_funcs->glUniform1i(description.m_location, v.toInt());
- break;
- }
-
- default:
- qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name;
- break;
- }
-}
-
void GraphicsHelperGL2::bindFrameBufferObject(GLuint frameBufferId)
{
if (m_fboFuncs != nullptr)
@@ -775,6 +683,54 @@ void GraphicsHelperGL2::glUniformMatrix4x3fv(GLint , GLsizei , const GLfloat *)
qWarning() << "glUniformMatrix4x3fv not supported by GL 2";
}
+UniformType GraphicsHelperGL2::uniformTypeFromGLType(GLenum type)
+{
+ switch (type) {
+ case GL_FLOAT:
+ return UniformType::Float;
+ case GL_FLOAT_VEC2:
+ return UniformType::Vec2;
+ case GL_FLOAT_VEC3:
+ return UniformType::Vec3;
+ case GL_FLOAT_VEC4:
+ return UniformType::Vec4;
+ case GL_FLOAT_MAT2:
+ return UniformType::Mat2;
+ case GL_FLOAT_MAT3:
+ return UniformType::Mat3;
+ case GL_FLOAT_MAT4:
+ return UniformType::Mat4;
+ case GL_INT:
+ return UniformType::Int;
+ case GL_INT_VEC2:
+ return UniformType::IVec2;
+ case GL_INT_VEC3:
+ return UniformType::IVec3;
+ case GL_INT_VEC4:
+ return UniformType::IVec4;
+ case GL_BOOL:
+ return UniformType::Bool;
+ case GL_BOOL_VEC2:
+ return UniformType::BVec2;
+ case GL_BOOL_VEC3:
+ return UniformType::BVec3;
+ case GL_BOOL_VEC4:
+ return UniformType::BVec4;
+
+ case GL_SAMPLER_1D:
+ case GL_SAMPLER_1D_SHADOW:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_3D:
+ return UniformType::Sampler;
+
+ default:
+ Q_UNREACHABLE();
+ return UniformType::Float;
+ }
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelpergl2_p.h b/src/render/graphicshelpers/graphicshelpergl2_p.h
index 3b9c1e881..0352c77d3 100644
--- a/src/render/graphicshelpers/graphicshelpergl2_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl2_p.h
@@ -76,7 +76,6 @@ public:
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
- void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
@@ -146,6 +145,8 @@ public:
void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
+ UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE;
+
private:
QOpenGLFunctions_2_0 *m_funcs;
QOpenGLExtension_ARB_framebuffer_object *m_fboFuncs;
diff --git a/src/render/graphicshelpers/graphicshelpergl3.cpp b/src/render/graphicshelpers/graphicshelpergl3.cpp
index 52028b1c9..da1b95db8 100644
--- a/src/render/graphicshelpers/graphicshelpergl3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3.cpp
@@ -410,182 +410,6 @@ void GraphicsHelperGL3::bindFragDataLocation(GLuint shader, const QHash<QString,
m_funcs->glBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str());
}
-void GraphicsHelperGL3::bindUniform(const QVariant &v, const ShaderUniform &description)
-{
- switch (description.m_type) {
-
- case GL_FLOAT:
- m_funcs->glUniform1fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 1));
- break;
-
- case GL_FLOAT_VEC2:
- m_funcs->glUniform2fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 2));
- break;
-
- case GL_FLOAT_VEC3:
- m_funcs->glUniform3fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 3));
- break;
-
- case GL_FLOAT_VEC4:
- m_funcs->glUniform4fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT2:
- m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT2x3:
- m_funcs->glUniformMatrix2x3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 6));
- break;
-
- case GL_FLOAT_MAT2x4:
- m_funcs->glUniformMatrix2x4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 8));
- break;
-
- case GL_FLOAT_MAT3:
- m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 9));
- break;
-
- case GL_FLOAT_MAT3x2:
- m_funcs->glUniformMatrix3x2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 6));
- break;
-
- case GL_FLOAT_MAT3x4:
- m_funcs->glUniformMatrix3x4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 12));
- break;
-
- case GL_FLOAT_MAT4:
- m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 16));
- break;
-
- case GL_FLOAT_MAT4x2:
- m_funcs->glUniformMatrix4x2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 8));
- break;
-
- case GL_FLOAT_MAT4x3:
- m_funcs->glUniformMatrix4x3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 12));
- break;
-
- case GL_INT:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_INT_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_INT_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_INT_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_UNSIGNED_INT:
- m_funcs->glUniform1uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 1));
- break;
-
- case GL_UNSIGNED_INT_VEC2:
- m_funcs->glUniform2uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 2));
- break;
-
- case GL_UNSIGNED_INT_VEC3:
- m_funcs->glUniform3uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 3));
- break;
-
- case GL_UNSIGNED_INT_VEC4:
- m_funcs->glUniform4uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 4));
- break;
-
- case GL_BOOL:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_BOOL_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_BOOL_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_BOOL_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_SAMPLER_1D:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_3D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_BUFFER:
- case GL_SAMPLER_2D_RECT:
- case GL_INT_SAMPLER_1D:
- case GL_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_BUFFER:
- case GL_INT_SAMPLER_2D_RECT:
- case GL_UNSIGNED_INT_SAMPLER_1D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_BUFFER:
- case GL_UNSIGNED_INT_SAMPLER_2D_RECT:
- case GL_SAMPLER_1D_SHADOW:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_1D_ARRAY:
- case GL_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_1D_ARRAY:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_1D_ARRAY_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_SAMPLER_2D_RECT_SHADOW:
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
- case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: {
- Q_ASSERT(description.m_size == 1);
- m_funcs->glUniform1i(description.m_location, v.toInt());
- break;
- }
-
- default:
- qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name;
- break;
- }
-}
-
void GraphicsHelperGL3::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding);
@@ -1139,6 +963,88 @@ void GraphicsHelperGL3::glUniformMatrix4x3fv(GLint location, GLsizei count, cons
m_funcs->glUniformMatrix4x3fv(location, count, false, values);
}
+UniformType GraphicsHelperGL3::uniformTypeFromGLType(GLenum type)
+{
+ switch (type) {
+ case GL_FLOAT:
+ return UniformType::Float;
+ case GL_FLOAT_VEC2:
+ return UniformType::Vec2;
+ case GL_FLOAT_VEC3:
+ return UniformType::Vec3;
+ case GL_FLOAT_VEC4:
+ return UniformType::Vec4;
+ case GL_FLOAT_MAT2:
+ return UniformType::Mat2;
+ case GL_FLOAT_MAT3:
+ return UniformType::Mat3;
+ case GL_FLOAT_MAT4:
+ return UniformType::Mat4;
+ case GL_FLOAT_MAT2x3:
+ return UniformType::Mat2x3;
+ case GL_FLOAT_MAT3x2:
+ return UniformType::Mat3x2;
+ case GL_FLOAT_MAT2x4:
+ return UniformType::Mat2x4;
+ case GL_FLOAT_MAT4x2:
+ return UniformType::Mat4x2;
+ case GL_FLOAT_MAT3x4:
+ return UniformType::Mat3x4;
+ case GL_FLOAT_MAT4x3:
+ return UniformType::Mat4x3;
+ case GL_INT:
+ return UniformType::Int;
+ case GL_INT_VEC2:
+ return UniformType::IVec2;
+ case GL_INT_VEC3:
+ return UniformType::IVec3;
+ case GL_INT_VEC4:
+ return UniformType::IVec4;
+ case GL_BOOL:
+ return UniformType::Bool;
+ case GL_BOOL_VEC2:
+ return UniformType::BVec2;
+ case GL_BOOL_VEC3:
+ return UniformType::BVec3;
+ case GL_BOOL_VEC4:
+ return UniformType::BVec4;
+
+ case GL_SAMPLER_1D:
+ case GL_SAMPLER_1D_SHADOW:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_2D_RECT:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_RECT_SHADOW:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_3D:
+ case GL_INT_SAMPLER_1D:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_1D_ARRAY:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_1D:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ return UniformType::Sampler;
+ default:
+ Q_UNREACHABLE();
+ return UniformType::Float;
+ }
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
index e701887a9..53b89bdef 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
@@ -76,6 +76,10 @@ GraphicsHelperGL3_3::GraphicsHelperGL3_3()
{
}
+GraphicsHelperGL3_3::~GraphicsHelperGL3_3()
+{
+}
+
void GraphicsHelperGL3_3::initializeHelper(QOpenGLContext *context,
QAbstractOpenGLFunctions *functions)
{
@@ -383,6 +387,7 @@ bool GraphicsHelperGL3_3::supportsFeature(GraphicsHelperInterface::Feature featu
case PrimitiveRestart:
case RenderBufferDimensionRetrieval:
case TextureDimensionRetrieval:
+ case BindableFragmentOutputs:
return true;
case Tessellation:
return !m_tessFuncs.isNull();
@@ -407,182 +412,6 @@ void GraphicsHelperGL3_3::bindFragDataLocation(GLuint shader, const QHash<QStrin
m_funcs->glBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str());
}
-void GraphicsHelperGL3_3::bindUniform(const QVariant &v, const ShaderUniform &description)
-{
- switch (description.m_type) {
-
- case GL_FLOAT:
- m_funcs->glUniform1fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 1));
- break;
-
- case GL_FLOAT_VEC2:
- m_funcs->glUniform2fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 2));
- break;
-
- case GL_FLOAT_VEC3:
- m_funcs->glUniform3fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 3));
- break;
-
- case GL_FLOAT_VEC4:
- m_funcs->glUniform4fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT2:
- m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT2x3:
- m_funcs->glUniformMatrix2x3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 6));
- break;
-
- case GL_FLOAT_MAT2x4:
- m_funcs->glUniformMatrix2x4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 8));
- break;
-
- case GL_FLOAT_MAT3:
- m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 9));
- break;
-
- case GL_FLOAT_MAT3x2:
- m_funcs->glUniformMatrix3x2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 6));
- break;
-
- case GL_FLOAT_MAT3x4:
- m_funcs->glUniformMatrix3x4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 12));
- break;
-
- case GL_FLOAT_MAT4:
- m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 16));
- break;
-
- case GL_FLOAT_MAT4x2:
- m_funcs->glUniformMatrix4x2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 8));
- break;
-
- case GL_FLOAT_MAT4x3:
- m_funcs->glUniformMatrix4x3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 12));
- break;
-
- case GL_INT:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_INT_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_INT_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_INT_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_UNSIGNED_INT:
- m_funcs->glUniform1uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 1));
- break;
-
- case GL_UNSIGNED_INT_VEC2:
- m_funcs->glUniform2uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 2));
- break;
-
- case GL_UNSIGNED_INT_VEC3:
- m_funcs->glUniform3uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 3));
- break;
-
- case GL_UNSIGNED_INT_VEC4:
- m_funcs->glUniform4uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 4));
- break;
-
- case GL_BOOL:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_BOOL_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_BOOL_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_BOOL_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_SAMPLER_1D:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_3D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_BUFFER:
- case GL_SAMPLER_2D_RECT:
- case GL_INT_SAMPLER_1D:
- case GL_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_BUFFER:
- case GL_INT_SAMPLER_2D_RECT:
- case GL_UNSIGNED_INT_SAMPLER_1D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_BUFFER:
- case GL_UNSIGNED_INT_SAMPLER_2D_RECT:
- case GL_SAMPLER_1D_SHADOW:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_1D_ARRAY:
- case GL_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_1D_ARRAY:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_1D_ARRAY_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_SAMPLER_2D_RECT_SHADOW:
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
- case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: {
- Q_ASSERT(description.m_size == 1);
- m_funcs->glUniform1i(description.m_location, v.toInt());
- break;
- }
-
- default:
- qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name;
- break;
- }
-}
-
void GraphicsHelperGL3_3::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding);
@@ -1138,6 +967,100 @@ void GraphicsHelperGL3_3::glUniformMatrix4x3fv(GLint location, GLsizei count, co
m_funcs->glUniformMatrix4x3fv(location, count, false, values);
}
+UniformType GraphicsHelperGL3_3::uniformTypeFromGLType(GLenum type)
+{
+ switch (type) {
+ case GL_FLOAT:
+ return UniformType::Float;
+ case GL_FLOAT_VEC2:
+ return UniformType::Vec2;
+ case GL_FLOAT_VEC3:
+ return UniformType::Vec3;
+ case GL_FLOAT_VEC4:
+ return UniformType::Vec4;
+ case GL_FLOAT_MAT2:
+ return UniformType::Mat2;
+ case GL_FLOAT_MAT3:
+ return UniformType::Mat3;
+ case GL_FLOAT_MAT4:
+ return UniformType::Mat4;
+ case GL_FLOAT_MAT2x3:
+ return UniformType::Mat2x3;
+ case GL_FLOAT_MAT3x2:
+ return UniformType::Mat3x2;
+ case GL_FLOAT_MAT2x4:
+ return UniformType::Mat2x4;
+ case GL_FLOAT_MAT4x2:
+ return UniformType::Mat4x2;
+ case GL_FLOAT_MAT3x4:
+ return UniformType::Mat3x4;
+ case GL_FLOAT_MAT4x3:
+ return UniformType::Mat4x3;
+ case GL_INT:
+ return UniformType::Int;
+ case GL_INT_VEC2:
+ return UniformType::IVec2;
+ case GL_INT_VEC3:
+ return UniformType::IVec3;
+ case GL_INT_VEC4:
+ return UniformType::IVec4;
+ case GL_UNSIGNED_INT:
+ return UniformType::UInt;
+ case GL_UNSIGNED_INT_VEC2:
+ return UniformType::UIVec2;
+ case GL_UNSIGNED_INT_VEC3:
+ return UniformType::UIVec3;
+ case GL_UNSIGNED_INT_VEC4:
+ return UniformType::UIVec4;
+ case GL_BOOL:
+ return UniformType::Bool;
+ case GL_BOOL_VEC2:
+ return UniformType::BVec2;
+ case GL_BOOL_VEC3:
+ return UniformType::BVec3;
+ case GL_BOOL_VEC4:
+ return UniformType::BVec4;
+
+ case GL_SAMPLER_BUFFER:
+ case GL_SAMPLER_1D:
+ case GL_SAMPLER_1D_SHADOW:
+ case GL_SAMPLER_1D_ARRAY:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_2D_RECT:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_RECT_SHADOW:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_3D:
+ case GL_INT_SAMPLER_BUFFER:
+ case GL_INT_SAMPLER_1D:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_1D_ARRAY:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_BUFFER:
+ case GL_UNSIGNED_INT_SAMPLER_1D:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ return UniformType::Sampler;
+ default:
+ Q_UNREACHABLE();
+ return UniformType::Float;
+ }
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/graphicshelpers/graphicshelpergl3_3_p.h
index de26f86f7..bbea8806a 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl3_3_p.h
@@ -64,10 +64,11 @@ class QOpenGLExtension_ARB_tessellation_shader;
namespace Qt3DRender {
namespace Render {
-class GraphicsHelperGL3_3 : public GraphicsHelperInterface
+class Q_AUTOTEST_EXPORT GraphicsHelperGL3_3 : public GraphicsHelperInterface
{
public:
GraphicsHelperGL3_3();
+ ~GraphicsHelperGL3_3();
// QGraphicHelperInterface interface
void alphaTest(GLenum mode1, GLenum mode2) Q_DECL_OVERRIDE;
@@ -77,7 +78,6 @@ public:
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
- void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
@@ -147,6 +147,8 @@ public:
void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
+ UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE;
+
private:
QOpenGLFunctions_3_3_Core *m_funcs;
QScopedPointer<QOpenGLExtension_ARB_tessellation_shader> m_tessFuncs;
diff --git a/src/render/graphicshelpers/graphicshelpergl3_p.h b/src/render/graphicshelpers/graphicshelpergl3_p.h
index 559b4c97d..3cc58bd26 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl3_p.h
@@ -77,7 +77,6 @@ public:
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
- void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
@@ -147,6 +146,8 @@ public:
void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
+ UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE;
+
private:
QOpenGLFunctions_3_2_Core *m_funcs;
QScopedPointer<QOpenGLExtension_ARB_tessellation_shader> m_tessFuncs;
diff --git a/src/render/graphicshelpers/graphicshelpergl4.cpp b/src/render/graphicshelpers/graphicshelpergl4.cpp
index cd63bcd82..230b02a63 100644
--- a/src/render/graphicshelpers/graphicshelpergl4.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl4.cpp
@@ -371,6 +371,105 @@ void GraphicsHelperGL4::glUniformMatrix4x3fv(GLint location, GLsizei count, cons
m_funcs->glUniformMatrix4x3fv(location, count, false, values);
}
+UniformType GraphicsHelperGL4::uniformTypeFromGLType(GLenum type)
+{
+ switch (type) {
+ case GL_FLOAT:
+ return UniformType::Float;
+ case GL_FLOAT_VEC2:
+ return UniformType::Vec2;
+ case GL_FLOAT_VEC3:
+ return UniformType::Vec3;
+ case GL_FLOAT_VEC4:
+ return UniformType::Vec4;
+ case GL_FLOAT_MAT2:
+ return UniformType::Mat2;
+ case GL_FLOAT_MAT3:
+ return UniformType::Mat3;
+ case GL_FLOAT_MAT4:
+ return UniformType::Mat4;
+ case GL_FLOAT_MAT2x3:
+ return UniformType::Mat2x3;
+ case GL_FLOAT_MAT3x2:
+ return UniformType::Mat3x2;
+ case GL_FLOAT_MAT2x4:
+ return UniformType::Mat2x4;
+ case GL_FLOAT_MAT4x2:
+ return UniformType::Mat4x2;
+ case GL_FLOAT_MAT3x4:
+ return UniformType::Mat3x4;
+ case GL_FLOAT_MAT4x3:
+ return UniformType::Mat4x3;
+ case GL_INT:
+ return UniformType::Int;
+ case GL_INT_VEC2:
+ return UniformType::IVec2;
+ case GL_INT_VEC3:
+ return UniformType::IVec3;
+ case GL_INT_VEC4:
+ return UniformType::IVec4;
+ case GL_UNSIGNED_INT:
+ return UniformType::UInt;
+ case GL_UNSIGNED_INT_VEC2:
+ return UniformType::UIVec2;
+ case GL_UNSIGNED_INT_VEC3:
+ return UniformType::UIVec3;
+ case GL_UNSIGNED_INT_VEC4:
+ return UniformType::UIVec4;
+ case GL_BOOL:
+ return UniformType::Bool;
+ case GL_BOOL_VEC2:
+ return UniformType::BVec2;
+ case GL_BOOL_VEC3:
+ return UniformType::BVec3;
+ case GL_BOOL_VEC4:
+ return UniformType::BVec4;
+
+ case GL_SAMPLER_1D:
+ case GL_SAMPLER_1D_ARRAY:
+ case GL_SAMPLER_1D_SHADOW:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_2D_RECT:
+ case GL_SAMPLER_2D_SHADOW:
+ case GL_SAMPLER_2D_RECT_SHADOW:
+ case GL_SAMPLER_CUBE:
+ case GL_SAMPLER_CUBE_SHADOW:
+ case GL_SAMPLER_CUBE_MAP_ARRAY:
+ case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW:
+ case GL_SAMPLER_2D_ARRAY:
+ case GL_SAMPLER_2D_ARRAY_SHADOW:
+ case GL_SAMPLER_2D_MULTISAMPLE:
+ case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_3D:
+ case GL_SAMPLER_BUFFER:
+ case GL_INT_SAMPLER_1D:
+ case GL_INT_SAMPLER_2D:
+ case GL_INT_SAMPLER_3D:
+ case GL_INT_SAMPLER_BUFFER:
+ case GL_INT_SAMPLER_CUBE:
+ case GL_INT_SAMPLER_CUBE_MAP_ARRAY:
+ case GL_INT_SAMPLER_1D_ARRAY:
+ case GL_INT_SAMPLER_2D_ARRAY:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_1D:
+ case GL_UNSIGNED_INT_SAMPLER_2D:
+ case GL_UNSIGNED_INT_SAMPLER_3D:
+ case GL_UNSIGNED_INT_SAMPLER_BUFFER:
+ case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+ case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE:
+ case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY:
+ return UniformType::Sampler;
+ default:
+ // TO DO: Add support for Doubles and Images
+ Q_UNREACHABLE();
+ return UniformType::Float;
+ }
+}
+
void GraphicsHelperGL4::blendEquation(GLenum mode)
{
m_funcs->glBlendEquation(mode);
@@ -480,6 +579,8 @@ bool GraphicsHelperGL4::supportsFeature(GraphicsHelperInterface::Feature feature
case MRT:
case Tessellation:
case UniformBufferObject:
+ case BindableFragmentOutputs:
+ case PrimitiveRestart:
case RenderBufferDimensionRetrieval:
case TextureDimensionRetrieval:
case ShaderStorageObject:
@@ -507,182 +608,6 @@ void GraphicsHelperGL4::bindFragDataLocation(GLuint shader, const QHash<QString,
m_funcs->glBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str());
}
-void GraphicsHelperGL4::bindUniform(const QVariant &v, const ShaderUniform &description)
-{
- switch (description.m_type) {
-
- case GL_FLOAT:
- m_funcs->glUniform1fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 1));
- break;
-
- case GL_FLOAT_VEC2:
- m_funcs->glUniform2fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 2));
- break;
-
- case GL_FLOAT_VEC3:
- m_funcs->glUniform3fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 3));
- break;
-
- case GL_FLOAT_VEC4:
- m_funcs->glUniform4fv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT2:
- m_funcs->glUniformMatrix2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 4));
- break;
-
- case GL_FLOAT_MAT2x3:
- m_funcs->glUniformMatrix2x3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 6));
- break;
-
- case GL_FLOAT_MAT2x4:
- m_funcs->glUniformMatrix2x4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 8));
- break;
-
- case GL_FLOAT_MAT3:
- m_funcs->glUniformMatrix3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 9));
- break;
-
- case GL_FLOAT_MAT3x2:
- m_funcs->glUniformMatrix3x2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 6));
- break;
-
- case GL_FLOAT_MAT3x4:
- m_funcs->glUniformMatrix3x4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 12));
- break;
-
- case GL_FLOAT_MAT4:
- m_funcs->glUniformMatrix4fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 16));
- break;
-
- case GL_FLOAT_MAT4x2:
- m_funcs->glUniformMatrix4x2fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 8));
- break;
-
- case GL_FLOAT_MAT4x3:
- m_funcs->glUniformMatrix4x3fv(description.m_location, description.m_size, GL_FALSE,
- QGraphicsUtils::valueArrayFromVariant<GLfloat>(v, description.m_size, 12));
- break;
-
- case GL_INT:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_INT_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_INT_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_INT_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_UNSIGNED_INT:
- m_funcs->glUniform1uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 1));
- break;
-
- case GL_UNSIGNED_INT_VEC2:
- m_funcs->glUniform2uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 2));
- break;
-
- case GL_UNSIGNED_INT_VEC3:
- m_funcs->glUniform3uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 3));
- break;
-
- case GL_UNSIGNED_INT_VEC4:
- m_funcs->glUniform4uiv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLuint>(v, description.m_size, 4));
- break;
-
- case GL_BOOL:
- m_funcs->glUniform1iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 1));
- break;
-
- case GL_BOOL_VEC2:
- m_funcs->glUniform2iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 2));
- break;
-
- case GL_BOOL_VEC3:
- m_funcs->glUniform3iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 3));
- break;
-
- case GL_BOOL_VEC4:
- m_funcs->glUniform4iv(description.m_location, description.m_size,
- QGraphicsUtils::valueArrayFromVariant<GLint>(v, description.m_size, 4));
- break;
-
- case GL_SAMPLER_1D:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_3D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_BUFFER:
- case GL_SAMPLER_2D_RECT:
- case GL_INT_SAMPLER_1D:
- case GL_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_BUFFER:
- case GL_INT_SAMPLER_2D_RECT:
- case GL_UNSIGNED_INT_SAMPLER_1D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_BUFFER:
- case GL_UNSIGNED_INT_SAMPLER_2D_RECT:
- case GL_SAMPLER_1D_SHADOW:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_1D_ARRAY:
- case GL_SAMPLER_2D_ARRAY:
- case GL_INT_SAMPLER_1D_ARRAY:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_1D_ARRAY_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_SAMPLER_2D_RECT_SHADOW:
- case GL_SAMPLER_2D_MULTISAMPLE:
- case GL_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
- case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
- case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY: {
- Q_ASSERT(description.m_size == 1);
- m_funcs->glUniform1i(description.m_location, v.toInt());
- break;
- }
-
- default:
- qWarning() << Q_FUNC_INFO << "unsupported uniform type:" << description.m_type << "for " << description.m_name;
- break;
- }
-}
-
void GraphicsHelperGL4::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding);
diff --git a/src/render/graphicshelpers/graphicshelpergl4_p.h b/src/render/graphicshelpers/graphicshelpergl4_p.h
index 0333b4258..ad4875f2e 100644
--- a/src/render/graphicshelpers/graphicshelpergl4_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl4_p.h
@@ -76,7 +76,6 @@ public:
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
- void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
@@ -146,6 +145,8 @@ public:
void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) Q_DECL_OVERRIDE;
+ UniformType uniformTypeFromGLType(GLenum glType) Q_DECL_OVERRIDE;
+
private:
QOpenGLFunctions_4_3_Core *m_funcs;
};
diff --git a/src/render/graphicshelpers/graphicshelperinterface_p.h b/src/render/graphicshelpers/graphicshelperinterface_p.h
index 355c8f429..1a7199a2c 100644
--- a/src/render/graphicshelpers/graphicshelperinterface_p.h
+++ b/src/render/graphicshelpers/graphicshelperinterface_p.h
@@ -55,6 +55,7 @@
#include <QOpenGLTexture>
#include <QVector>
#include <Qt3DRender/private/shadervariables_p.h>
+#include <Qt3DRender/private/uniform_p.h>
QT_BEGIN_NAMESPACE
@@ -87,7 +88,6 @@ public:
virtual void bindFrameBufferObject(GLuint frameBufferId) = 0;
virtual void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) = 0;
virtual void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) = 0;
- virtual void bindUniform(const QVariant &v, const ShaderUniform &description) = 0;
virtual void blendEquation(GLenum mode) = 0;
virtual void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) = 0;
virtual void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) = 0;
@@ -157,6 +157,7 @@ public:
virtual void glUniformMatrix3x4fv(GLint location, GLsizei count, const GLfloat *value) = 0;
virtual void glUniformMatrix4x3fv(GLint location, GLsizei count, const GLfloat *value) = 0;
+ virtual UniformType uniformTypeFromGLType(GLenum glType) = 0;
};
diff --git a/src/render/io/qsceneloader.cpp b/src/render/io/qsceneloader.cpp
index 69bd8528b..9cb067161 100644
--- a/src/render/io/qsceneloader.cpp
+++ b/src/render/io/qsceneloader.cpp
@@ -51,44 +51,36 @@ using namespace Qt3DCore;
namespace Qt3DRender {
-QSceneLoaderPrivate::QSceneLoaderPrivate()
- : QComponentPrivate()
- , m_status(QSceneLoader::None)
- , m_subTreeRoot(nullptr)
-{
- m_shareable = false;
-}
-
/*!
- \class Qt3DRender::QSceneLoader
- \inmodule Qt3DRender
- \since 5.7
- \ingroup io
+ \class Qt3DRender::QSceneLoader
+ \inmodule Qt3DRender
+ \since 5.7
+ \ingroup io
- \brief Provides the facility to load an existing Scene
+ \brief Provides the facility to load an existing Scene
- Given a 3D source file, the Qt3DRender::QSceneLoader will try to parse it and
- build a tree of Qt3DCore::QEntity with proper Qt3DRender::QGeometryRenderer
- Qt3DCore::QTransform and QtRender::QMaterial components.
+ Given a 3D source file, the Qt3DRender::QSceneLoader will try to parse it and
+ build a tree of Qt3DCore::QEntity objects with proper Qt3DRender::QGeometryRenderer,
+ Qt3DCore::QTransform and Qt3DRender::QMaterial components.
- The loader will try to determine the best material to be used based on the properties
- of the model file. If you wish to use a custom material, you will have to traverse
- the tree and replace the default associated materials with yours.
+ The loader will try to determine the best material to be used based on the properties
+ of the model file. If you wish to use a custom material, you will have to traverse
+ the tree and replace the default associated materials with yours.
- As the name implies, Qt3DRender::QSceneLoader loads a complete scene subtree.
- If you wish to load a single piece of geometry, you should rather be using
- the Qt3DRender::QMesh instead.
+ As the name implies, Qt3DRender::QSceneLoader loads a complete scene subtree.
+ If you wish to load a single piece of geometry, you should rather use
+ the Qt3DRender::QMesh instead.
- Qt3DRender::QSceneLoader internally relies on the use of plugins to support a
- wide variety of 3D file formats. \l
- {http://www.assimp.org/main_features_formats.html}{Here} is a list of formats
- that are supported by Qt3D.
+ Qt3DRender::QSceneLoader internally relies on the use of plugins to support a
+ wide variety of 3D file formats. \l
+ {http://www.assimp.org/main_features_formats.html}{Here} is a list of formats
+ that are supported by Qt3D.
- \note this component shouldn't be shared among several Qt3DCore::QEntity instances.
- Undefined behavior will result.
+ \note this component shouldn't be shared among several Qt3DCore::QEntity instances.
+ Undefined behavior will result.
- \sa Qt3DRender::QMesh
- \sa Qt3DRender::QGeometryRenderer
+ \sa Qt3DRender::QMesh
+ \sa Qt3DRender::QGeometryRenderer
*/
/*!
@@ -97,10 +89,10 @@ QSceneLoaderPrivate::QSceneLoaderPrivate()
\instantiates Qt3DRender::QSceneLoader
\inherits Component
\since 5.7
- \qmlabstract Provides the facility to load an existing Scene
+ \brief Provides the facility to load an existing Scene
Given a 3D source file, the SceneLoader will try to parse it and build a
- tree of Entity with proper GeometryRenderer, Transform and Material
+ tree of Entity objects with proper GeometryRenderer, Transform and Material
components.
The loader will try to determine the best material to be used based on the
@@ -109,7 +101,7 @@ QSceneLoaderPrivate::QSceneLoaderPrivate()
with yours.
As the name implies, SceneLoader loads a complete scene subtree. If you
- wish to load a single piece of geometry, you should rather be using the
+ wish to load a single piece of geometry, you should rather use the
Mesh instead.
SceneLoader internally relies on the use of plugins to support a wide
@@ -122,7 +114,7 @@ QSceneLoaderPrivate::QSceneLoaderPrivate()
\sa Mesh
\sa GeometryRenderer
-*/
+ */
/*!
\enum QSceneLoader::Status
@@ -132,10 +124,58 @@ QSceneLoaderPrivate::QSceneLoaderPrivate()
\value Loading The Qt3DRender::QSceneLoader is currently loading the scene file.
\value Ready The Qt3DRender::QSceneLoader successfully loaded the scene file.
\value Error The Qt3DRender::QSceneLoader encountered an error while loading the scene file.
-*/
+ */
+
+/*!
+ \qmlproperty url SceneLoader::source
+
+ Holds the url to the source to be loaded.
+ */
/*!
- The constructor creates an instance with the specified \a parent.
+ \qmlproperty enumeration SceneLoader::status
+
+ Holds the status of scene loading.
+ \list
+ \li SceneLoader.None
+ \li SceneLoader.Loading
+ \li SceneLoader.Ready
+ \li SceneLoader.Error
+ \endlist
+ \sa Qt3DRender::QSceneLoader::Status
+ \readonly
+ */
+
+/*!
+ \property QSceneLoader::source
+
+ Holds the url to the source to be loaded.
+ */
+
+/*!
+ \property QSceneLoader::status
+
+ Holds the status of scene loading.
+ \list
+ \li SceneLoader.None
+ \li SceneLoader.Loading
+ \li SceneLoader.Ready
+ \li SceneLoader.Error
+ \endlist
+ \sa Qt3DRender::QSceneLoader::Status
+ */
+
+/*! \internal */
+QSceneLoaderPrivate::QSceneLoaderPrivate()
+ : QComponentPrivate()
+ , m_status(QSceneLoader::None)
+ , m_subTreeRoot(nullptr)
+{
+ m_shareable = false;
+}
+
+/*!
+ The constructor creates an instance with the specified \a parent.
*/
QSceneLoader::QSceneLoader(QNode *parent)
: Qt3DCore::QComponent(*new QSceneLoaderPrivate, parent)
@@ -190,15 +230,6 @@ QUrl QSceneLoader::source() const
return d->m_source;
}
-/*!
- \property Qt3DRender::QSceneLoader::source
- Specifies the url for the source to be loaded.
-*/
-
-/*!
- \qmlproperty QUrl Qt3D.Render::SceneLoader::source
-
-*/
void QSceneLoader::setSource(const QUrl &arg)
{
Q_D(QSceneLoader);
@@ -208,15 +239,6 @@ void QSceneLoader::setSource(const QUrl &arg)
}
}
-/*!
- \property Qt3DRender::QSceneLoader::status
- Indicates the status of scene loading.
-*/
-
-/*!
- \qmlproperty Status Qt3D.Render::SceneLoader::status
-
-*/
QSceneLoader::Status QSceneLoader::status() const
{
Q_D(const QSceneLoader);
diff --git a/src/render/jobs/loadscenejob.cpp b/src/render/jobs/loadscenejob.cpp
index 3111e1ba3..701942976 100644
--- a/src/render/jobs/loadscenejob.cpp
+++ b/src/render/jobs/loadscenejob.cpp
@@ -60,6 +60,26 @@ LoadSceneJob::LoadSceneJob(const QUrl &source, Qt3DCore::QNodeId m_sceneComponen
SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadScene, 0);
}
+NodeManagers *LoadSceneJob::nodeManagers() const
+{
+ return m_managers;
+}
+
+QList<QSceneIOHandler *> LoadSceneJob::sceneIOHandlers() const
+{
+ return m_sceneIOHandlers;
+}
+
+QUrl LoadSceneJob::source() const
+{
+ return m_source;
+}
+
+Qt3DCore::QNodeId LoadSceneJob::sceneComponentId() const
+{
+ return m_sceneComponent;
+}
+
void LoadSceneJob::run()
{
// Iterate scene IO handlers until we find one that can handle this file type
@@ -70,9 +90,11 @@ void LoadSceneJob::run()
// Reset status
scene->setStatus(QSceneLoader::None);
+ QSceneLoader::Status finalStatus = QSceneLoader::None;
// Perform the loading only if the source wasn't explicitly set to empty
if (!m_source.isEmpty()) {
+ finalStatus = QSceneLoader::Error;
for (QSceneIOHandler *sceneIOHandler : qAsConst(m_sceneIOHandlers)) {
if (!sceneIOHandler->isFileTypeSupported(m_source))
continue;
@@ -82,15 +104,11 @@ void LoadSceneJob::run()
// File type is supported, try to load it
sceneIOHandler->setSource(m_source);
- Qt3DCore::QEntity *sub = sceneIOHandler->scene();
- if (sub) {
- sceneSubTree = sub;
+ sceneSubTree = sceneIOHandler->scene();
+ if (sceneSubTree != nullptr) {
// Successfully built a subtree
- scene->setStatus(QSceneLoader::Ready);
+ finalStatus = QSceneLoader::Ready;
break;
- } else {
- // Tree wasn't build so something went wrong obviously
- scene->setStatus(QSceneLoader::Error);
}
}
}
@@ -100,6 +118,10 @@ void LoadSceneJob::run()
// Set clone of sceneTree in sceneComponent. This will move the sceneSubTree
// to the QCoreApplication thread which is where the frontend object tree lives.
scene->setSceneSubtree(sceneSubTree);
+
+ // Note: the status is set after the subtree so that bindinds depending on the status
+ // in the frontend will be consistent
+ scene->setStatus(finalStatus);
}
} // namespace Render
diff --git a/src/render/jobs/loadscenejob_p.h b/src/render/jobs/loadscenejob_p.h
index bc122d705..0ed0d2c83 100644
--- a/src/render/jobs/loadscenejob_p.h
+++ b/src/render/jobs/loadscenejob_p.h
@@ -66,14 +66,18 @@ namespace Render {
class NodeManagers;
-class LoadSceneJob : public Qt3DCore::QAspectJob
+class Q_AUTOTEST_EXPORT LoadSceneJob : public Qt3DCore::QAspectJob
{
public:
explicit LoadSceneJob(const QUrl &source, Qt3DCore::QNodeId sceneComponent);
void setNodeManagers(NodeManagers *managers) { m_managers = managers; }
void setSceneIOHandlers(const QList<QSceneIOHandler *> sceneIOHandlers) { m_sceneIOHandlers = sceneIOHandlers; }
-protected:
+ NodeManagers *nodeManagers() const;
+ QList<QSceneIOHandler *> sceneIOHandlers() const;
+ QUrl source() const;
+ Qt3DCore::QNodeId sceneComponentId() const;
+
void run() Q_DECL_OVERRIDE;
private:
diff --git a/src/render/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp
index e5b763fcf..3face7197 100644
--- a/src/render/jobs/renderviewjobutils.cpp
+++ b/src/render/jobs/renderviewjobutils.cpp
@@ -391,7 +391,7 @@ void addParametersForIds(ParameterInfoList *params, ParameterManager *manager,
Parameter *param = manager->lookupResource(paramId);
ParameterInfoList::iterator it = std::lower_bound(params->begin(), params->end(), param->nameId());
if (it == params->end() || it->nameId != param->nameId())
- params->insert(it, ParameterInfo(param->nameId(), param->value()));
+ params->insert(it, ParameterInfo(param->nameId(), param->uniformValue()));
}
}
@@ -438,7 +438,7 @@ UniformBlockValueBuilder::~UniformBlockValueBuilder()
{
}
-void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QString &blockName, const QString &qmlPropertyName, const QVariant &value)
+void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(ShaderData *currentShaderData, const QString &blockName, const QString &qmlPropertyName, const QVariant &value)
{
// In the end, values are either scalar or a scalar array
// Composed elements (structs, structs array) are simplified into simple scalars
@@ -471,27 +471,36 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QStrin
QString varName = blockName + QLatin1Char('.') + qmlPropertyName;
if (uniforms.contains(varName)) {
qCDebug(Shaders) << "UBO scalar member " << varName << " set for update";
- activeUniformNamesToValue.insert(StringToInt::lookupId(varName), value);
+
+ // If the property needs to be transformed, we transform it here as
+ // the shaderdata cannot hold transformed properties for multiple
+ // thread contexts at once
+ if (currentShaderData->propertyTransformType(qmlPropertyName) != ShaderData::NoTransform)
+ activeUniformNamesToValue.insert(StringToInt::lookupId(varName),
+ currentShaderData->getTransformedProperty(qmlPropertyName, viewMatrix));
+ else
+ activeUniformNamesToValue.insert(StringToInt::lookupId(varName), value);
}
}
}
void UniformBlockValueBuilder::buildActiveUniformNameValueMapStructHelper(ShaderData *rShaderData, const QString &blockName, const QString &qmlPropertyName)
{
- const QHash<QString, QVariant> &properties = updatedPropertiesOnly ? rShaderData->updatedProperties() : rShaderData->properties();
+ const QHash<QString, QVariant> &properties = rShaderData->properties();
QHash<QString, QVariant>::const_iterator it = properties.begin();
const QHash<QString, QVariant>::const_iterator end = properties.end();
while (it != end) {
const auto prefix = qmlPropertyName.isEmpty() ? QLatin1String("") : QLatin1String(".");
- buildActiveUniformNameValueMapHelper(blockName + prefix + qmlPropertyName,
+ buildActiveUniformNameValueMapHelper(rShaderData,
+ blockName + prefix + qmlPropertyName,
it.key(),
it.value());
++it;
}
}
-ParameterInfo::ParameterInfo(const int nameId, const QVariant &value)
+ParameterInfo::ParameterInfo(const int nameId, const UniformValue &value)
: nameId(nameId)
, value(value)
{}
diff --git a/src/render/jobs/renderviewjobutils_p.h b/src/render/jobs/renderviewjobutils_p.h
index 7f70690d7..c08083494 100644
--- a/src/render/jobs/renderviewjobutils_p.h
+++ b/src/render/jobs/renderviewjobutils_p.h
@@ -55,6 +55,8 @@
#include <Qt3DCore/qnodeid.h>
#include <QtCore/qhash.h>
#include <QtCore/qvariant.h>
+#include <QMatrix4x4>
+#include <Qt3DRender/private/uniform_p.h>
QT_BEGIN_NAMESPACE
@@ -106,10 +108,10 @@ Q_AUTOTEST_EXPORT inline T variant_value(const QVariant &v)
struct ParameterInfo
{
- explicit ParameterInfo(const int nameId = -1, const QVariant &value = QVariant());
+ explicit ParameterInfo(const int nameId = -1, const UniformValue &value = UniformValue());
int nameId;
- QVariant value;
+ UniformValue value;
bool operator<(const int otherNameId) const Q_DECL_NOEXCEPT;
bool operator<(const ParameterInfo &other) const Q_DECL_NOEXCEPT;
@@ -157,7 +159,8 @@ struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder
UniformBlockValueBuilder();
~UniformBlockValueBuilder();
- void buildActiveUniformNameValueMapHelper(const QString &blockName,
+ void buildActiveUniformNameValueMapHelper(ShaderData *currentShaderData,
+ const QString &blockName,
const QString &qmlPropertyName,
const QVariant &value);
void buildActiveUniformNameValueMapStructHelper(ShaderData *rShaderData,
@@ -168,6 +171,7 @@ struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder
QHash<QString, ShaderUniform> uniforms;
UniformBlockValueBuilderHash activeUniformNamesToValue;
ShaderDataManager *shaderDataManager;
+ QMatrix4x4 viewMatrix;
};
} // namespace Render
diff --git a/src/render/materialsystem/material_p.h b/src/render/materialsystem/material_p.h
index b415e2975..fe2707549 100644
--- a/src/render/materialsystem/material_p.h
+++ b/src/render/materialsystem/material_p.h
@@ -54,7 +54,7 @@
#include <QVariant>
#include <Qt3DRender/private/backendnode_p.h>
-#include <Qt3DRender/private/quniformvalue_p.h>
+#include <Qt3DRender/private/shaderparameterpack_p.h>
#include <Qt3DRender/private/parameterpack_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/materialsystem/parameter.cpp b/src/render/materialsystem/parameter.cpp
index b13c0d5ae..2cd026422 100644
--- a/src/render/materialsystem/parameter.cpp
+++ b/src/render/materialsystem/parameter.cpp
@@ -68,7 +68,7 @@ void Parameter::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &ch
const auto &data = typedChange->data;
m_name = data.name;
m_nameId = StringToInt::lookupId(m_name);
- m_value = data.backendValue;
+ m_uniformValue = UniformValue::fromVariant(data.backendValue);
}
void Parameter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
@@ -80,7 +80,7 @@ void Parameter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_name = propertyChange->value().toString();
m_nameId = StringToInt::lookupId(m_name);
} else if (propertyChange->propertyName() == QByteArrayLiteral("value")) {
- m_value = propertyChange->value();
+ m_uniformValue = UniformValue::fromVariant(propertyChange->value());
}
markDirty(AbstractRenderer::AllDirty);
}
@@ -93,14 +93,14 @@ QString Parameter::name() const
return m_name;
}
-QVariant Parameter::value() const
+int Parameter::nameId() const Q_DECL_NOTHROW
{
- return m_value;
+ return m_nameId;
}
-int Parameter::nameId() const Q_DECL_NOTHROW
+UniformValue Parameter::uniformValue() const
{
- return m_nameId;
+ return m_uniformValue;
}
} // namespace Render
diff --git a/src/render/materialsystem/parameter_p.h b/src/render/materialsystem/parameter_p.h
index c5c94243d..c6861ca36 100644
--- a/src/render/materialsystem/parameter_p.h
+++ b/src/render/materialsystem/parameter_p.h
@@ -52,6 +52,7 @@
//
#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/private/uniform_p.h>
#include <QVariant>
QT_BEGIN_NAMESPACE
@@ -72,14 +73,14 @@ public:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
QString name() const;
- QVariant value() const;
int nameId() const Q_DECL_NOTHROW;
+ UniformValue uniformValue() const;
private:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
QString m_name;
- QVariant m_value;
+ UniformValue m_uniformValue;
int m_nameId;
};
diff --git a/src/render/materialsystem/qeffect.cpp b/src/render/materialsystem/qeffect.cpp
index 70810676c..7778b5621 100644
--- a/src/render/materialsystem/qeffect.cpp
+++ b/src/render/materialsystem/qeffect.cpp
@@ -58,12 +58,17 @@ QEffectPrivate::QEffectPrivate()
}
/*!
- \class Qt3DRender::QEffect
- \inmodule Qt3DRender
- \since 5.7
- \brief The base class for effects in a Qt 3D scene.
+ \class Qt3DRender::QEffect
+ \inmodule Qt3DRender
+ \inherits Qt3DCore::QNode
+ \since 5.7
+ \brief The base class for effects in a Qt 3D scene.
- */
+ The QEffect class combines a set of techniques and parameters used by those techniques to
+ produce a rendering effect for a material.
+
+ \sa QMaterial, QTechnique, QParameter
+*/
/*!
\qmltype Effect
@@ -72,18 +77,18 @@ QEffectPrivate::QEffectPrivate()
\inqmlmodule Qt3D.Render
\since 5.7
\brief The base class for effects in a Qt 3D scene.
+
+ The Effect type combines a set of techniques and parameters used by those techniques to
+ produce a rendering effect for a material.
+
+ \sa Material, Technique, Parameter
*/
-/*!
- \fn Qt3DRender::QEffect::QEffect(Qt3DCore::QNode *parent)
- Constructs a new QEffect with the specified \a parent.
- */
QEffect::QEffect(QNode *parent)
: QNode(*new QEffectPrivate, parent)
{
}
-/*! \internal */
QEffect::~QEffect()
{
}
@@ -95,8 +100,21 @@ QEffect::QEffect(QEffectPrivate &dd, QNode *parent)
}
/*!
+ \qmlproperty list<Technique> Effect::techniques
+
+ Holds the list of techniques used by this effect.
+*/
+/*!
+ \qmlproperty list<Parameter> Effect::parameters
+
+ Holds the list of parameters used by this effect.
+ A parameter is used to set a corresponding uniform value in the shader used by this effect.
+*/
+
+/*!
* Adds \a parameter to the effect. It sends a QPropertyNodeAddedChange to the backend.
- * The \a parameter will be used to set a corresponding uniform value in the shader used by this effect.
+ * The \a parameter will be used to set a corresponding uniform value in the shader used
+ * by this effect.
*/
void QEffect::addParameter(QParameter *parameter)
{
diff --git a/src/render/materialsystem/qfilterkey.cpp b/src/render/materialsystem/qfilterkey.cpp
index d4bc26515..547c56d26 100644
--- a/src/render/materialsystem/qfilterkey.cpp
+++ b/src/render/materialsystem/qfilterkey.cpp
@@ -55,8 +55,12 @@ QFilterKeyPrivate::QFilterKeyPrivate()
/*!
\class Qt3DRender::QFilterKey
\inmodule Qt3DRender
+ \inherits Qt3DCore::QNode
\since 5.5
- \brief The QFilterKey class provides storage for filter keys and their values
+ \brief The QFilterKey class provides storage for filter keys and their values.
+
+ Filter keys are used by QTechnique and QRenderPass to specify at which stage of rendering the
+ technique or the render pass is used.
*/
/*!
@@ -65,18 +69,18 @@ QFilterKeyPrivate::QFilterKeyPrivate()
\inherits Node
\inqmlmodule Qt3D.Render
\since 5.5
- \brief For storing filter keys and their value
+ \brief Stores filter keys and their values.
+
+ A FilterKey is a storage type for filter key and value pair.
+ Filter keys are used by Technique and RenderPass to specify at which stage of rendering the
+ technique or the render pass is used.
*/
-/*!
- The constructor creates a new QFilterKey under \a parent.
- */
QFilterKey::QFilterKey(QNode *parent)
: QNode(*new QFilterKeyPrivate, parent)
{
}
-/*! \internal */
QFilterKey::~QFilterKey()
{
}
@@ -100,13 +104,15 @@ void QFilterKey::setName(const QString &name)
}
/*!
- \property QFilterKey::value
- Specifies the value of the filter key
+ \property QFilterKey::value
+
+ Holds the value of the filter key.
*/
/*!
- \qmlproperty variant Qt3D.Render::Annotation::value
- Specifies the value of the filter key
+ \qmlproperty variant FilterKey::value
+
+ Holds the value of the filter key.
*/
QVariant QFilterKey::value() const
@@ -116,14 +122,16 @@ QVariant QFilterKey::value() const
}
/*!
- \property QFilterKey::name
- Specifies the name of the filter key
- */
+ \property QFilterKey::name
+
+ Holds the name of the filter key.
+*/
/*!
- \qmlproperty string Qt3D.Render::Annotation::name
- Specifies the name of the filter key
- */
+ \qmlproperty string FilterKey::name
+
+ Holds the name of the filter key.
+*/
QString QFilterKey::name() const
{
diff --git a/src/render/materialsystem/qmaterial.cpp b/src/render/materialsystem/qmaterial.cpp
index 5b3fe63af..ca0f86463 100644
--- a/src/render/materialsystem/qmaterial.cpp
+++ b/src/render/materialsystem/qmaterial.cpp
@@ -48,29 +48,37 @@
#include <Qt3DCore/qpropertynoderemovedchange.h>
/*!
- * \qmltype Material
- * \instantiates Qt3DRender::QMaterial
- * \inqmlmodule Qt3D.Render
- * \brief Non-creatable abstract base for materials.
- * \inherits Component
- */
+ \qmltype Material
+ \instantiates Qt3DRender::QMaterial
+ \inqmlmodule Qt3D.Render
+ \brief Non-creatable abstract base for materials.
+ \since 5.5
+
+ Material provides a way to specify the rendering of an \l{Qt3D.Core::Entity}{entity}.
+ Any aspect can define its own subtype of Material so that a
+ Material can be used to describe a visual element; for example, the way
+ sound should reflect off an element, the temperature of a surface,
+ and so on.
+
+ \sa Effect
+*/
/*!
- * \class Qt3DRender::QMaterial
- * \inmodule Qt3DRender
- *
- *
- * \brief Provides an abstract class that should be the base of all
- * Material component classes in a scene.
- *
- * QMaterial provides a way to specify the rendering of an Entity.
- * Any aspect can define its own subclass of QMaterial so that a
- * Material can be used to describe a visual element; for example, the way
- * sound should reflect off an element, the temperature of a surface,
- * and so on.
- *
- * \sa QEffect, QMesh, {Qt3DCore::}{QComponent}
- */
+ \class Qt3DRender::QMaterial
+ \inmodule Qt3DRender
+ \inherits Qt3DCore::QComponent
+ \brief Provides an abstract class that should be the base of all material component classes
+ in a scene.
+ \since 5.5
+
+ QMaterial provides a way to specify the rendering of an \l{Qt3DCore::QEntity}{entity}.
+ Any aspect can define its own subclass of QMaterial so that a
+ Material can be used to describe a visual element; for example, the way
+ sound should reflect off an element, the temperature of a surface,
+ and so on.
+
+ \sa QEffect
+*/
QT_BEGIN_NAMESPACE
@@ -88,16 +96,11 @@ QMaterialPrivate::~QMaterialPrivate()
{
}
-/*!
- \fn Qt3DRender::QMaterial::QMaterial(Qt3DCore::QNode *parent)
- Constructs a new QMaterial with the specified \a parent.
- */
QMaterial::QMaterial(QNode *parent)
: QComponent(*new QMaterialPrivate, parent)
{
}
-/*! \internal */
QMaterial::~QMaterial()
{
}
@@ -109,16 +112,20 @@ QMaterial::QMaterial(QMaterialPrivate &dd, QNode *parent)
}
/*!
- \qmlproperty QEffect Qt3D.Render::Material::effect
- Specifies the effect to be used with the material
+ \qmlproperty list<Parameter> Material::parameters
+
+ Holds the list of parameters used by the material.
*/
/*!
- \property Qt3DRender::QMaterial::effect
- Specifies the effect to be used with the material
- */
+ \qmlproperty Effect Material::effect
+
+ Specifies the effect to be used with the material.
+*/
/*!
- * Sets the \a effect to be used with the Material.
+ \property QMaterial::effect
+
+ Specifies the effect to be used with the material.
*/
void QMaterial::setEffect(QEffect *effect)
{
@@ -144,9 +151,6 @@ void QMaterial::setEffect(QEffect *effect)
}
}
-/*!
- * Returns the effect used by the Material.
- */
QEffect *QMaterial::effect() const
{
Q_D(const QMaterial);
@@ -154,7 +158,7 @@ QEffect *QMaterial::effect() const
}
/*!
- * Add \a parameter to the Materials parameter.
+ * Add a \a parameter to the material's parameters.
*/
void QMaterial::addParameter(QParameter *parameter)
{
@@ -182,7 +186,7 @@ void QMaterial::addParameter(QParameter *parameter)
}
/*!
- * Remove \a parameter from the Material parameters.
+ * Remove a \a parameter from the material's parameters.
*/
void QMaterial::removeParameter(QParameter *parameter)
{
@@ -197,7 +201,7 @@ void QMaterial::removeParameter(QParameter *parameter)
}
/*!
- * Returns a vector of the materials current parameters
+ * Returns a vector of the material's current parameters
*/
QVector<QParameter *> QMaterial::parameters() const
{
diff --git a/src/render/materialsystem/qrenderpass.cpp b/src/render/materialsystem/qrenderpass.cpp
index b10660730..dd6363816 100644
--- a/src/render/materialsystem/qrenderpass.cpp
+++ b/src/render/materialsystem/qrenderpass.cpp
@@ -60,19 +60,65 @@ QRenderPassPrivate::QRenderPassPrivate()
{
}
/*!
- * \qmltype RenderPass
- * \instantiates Qt3DRender::QRenderPass
- * \inqmlmodule Qt3D.Render
- * \brief Encapsulates a Render Pass.
+ \qmltype RenderPass
+ \instantiates Qt3DRender::QRenderPass
+ \inqmlmodule Qt3D.Render
+ \inherits Node
+ \since 5.7
+ \brief Encapsulates a Render Pass.
+
+ A RenderPass specifies a single rendering pass - an instance of shader program
+ execution - used by Technique. A Render pass consists of a ShaderProgram and
+ a list of FilterKey objects, a list of RenderState objects and a list
+ of \l Parameter objects.
+
+ RenderPass executes the ShaderProgram using the given render states and parameters
+ when its filter keys match the filter keys in RenderPassFilter or when no filter
+ keys are specified and no RenderPassFilter is present in the FrameGraph.
*/
/*!
- * \class Qt3DRender::QRenderPass
- * \inmodule Qt3DRender
- *
- * \inherits Node
- *
- * \brief Encapsulates a Render Pass.
+ \class Qt3DRender::QRenderPass
+ \inmodule Qt3DRender
+ \since 5.7
+ \brief Encapsulates a Render Pass.
+
+ A Qt3DRender::QRenderPass specifies a single rendering pass - an instance of shader
+ program execution - used by Qt3DRender::QTechnique. Render pass consists
+ of a Qt3DRender::QShaderProgram and a list of Qt3DRender::QFilterKey objects,
+ a list of Qt3DRender::QRenderState objects and a list of Qt3DRender::QParameter objects.
+
+ QRenderPass executes the QShaderProgram using the given render states and parameters
+ when its filter keys match the filter keys in Qt3DRender::QRenderPassFilter or
+ when no filter keys are specified and no QRenderPassFilter is present
+ in the FrameGraph.
+ */
+/*!
+ \typedef ParameterList
+ \relates Qt3DRender::QRenderPass
+
+ A list of Qt3DRender::QParameter parameters.
+*/
+/*!
+ \qmlproperty ShaderProgram Qt3D.Render::RenderPass::shaderProgram
+ Holds the shader program to be used for this render pass.
+*/
+/*!
+ \qmlproperty list<FilterKey> Qt3D.Render::RenderPass::filterKeys
+ Holds the filter keys enabling the use of this render pass.
+*/
+/*!
+ \qmlproperty list<RenderState> Qt3D.Render::RenderPass::renderStates
+ Holds the render states used by the render pass.
+*/
+/*!
+ \qmlproperty list<Parameter> Qt3D.Render::RenderPass::parameters
+ Holds the shader parameter values used by the render pass.
+*/
+
+/*!
+ \property Qt3DRender::QRenderPass::shaderProgram
+ Specifies the shader program to be used for this render pass.
*/
/*!
@@ -95,18 +141,6 @@ QRenderPass::QRenderPass(QRenderPassPrivate &dd, QNode *parent)
{
}
-/*!
- \qmlproperty ShaderProgram Qt3D.Render::RenderPass::shaderProgram
- Specifies the shader program to be used for this render pass
-*/
-
-/*!
- \property Qt3DRender::QRenderPass::shaderProgram
- Specifies the shader program to be used for this render pass
- */
-/*!
- * Sets the pass' \a shaderProgram.
- */
void QRenderPass::setShaderProgram(QShaderProgram *shaderProgram)
{
Q_D(QRenderPass);
@@ -145,7 +179,7 @@ QShaderProgram *QRenderPass::shaderProgram() const
}
/*!
- * Adds \a filterKey from to the Qt3DRender::QRenderPass local filter keys.
+ Adds \a filterKey to the Qt3DRender::QRenderPass local filter keys.
*/
void QRenderPass::addFilterKey(QFilterKey *filterKey)
{
@@ -173,7 +207,7 @@ void QRenderPass::addFilterKey(QFilterKey *filterKey)
}
/*!
- * Removes \a filterKey from the Qt3DRender::QRenderPass local filter keys.
+ Removes \a filterKey from the Qt3DRender::QRenderPass local filter keys.
*/
void QRenderPass::removeFilterKey(QFilterKey *filterKey)
{
@@ -190,8 +224,8 @@ void QRenderPass::removeFilterKey(QFilterKey *filterKey)
}
/*!
- * Returns the list of Qt3DCore::QFilterKey key objects making up the filter keys
- * of the Qt3DRender::QRenderPass.
+ Returns the list of Qt3DRender::QFilterKey key objects making up the filter keys
+ of the Qt3DRender::QRenderPass.
*/
QVector<QFilterKey *> QRenderPass::filterKeys() const
{
@@ -200,12 +234,12 @@ QVector<QFilterKey *> QRenderPass::filterKeys() const
}
/*!
- * Adds a Qt3DCore::QRenderState \a state to the rendering pass. That implies that
- * when the pass is executed at render time, the globally set render state will
- * be modifed by the states defined locally by the Qt3DRender::QRenderPass.
- *
- * \note not defining any Qt3DCore::QRenderState in a pass will result in the pass using
- * the globally set render state for a given FrameGraph branch execution path.
+ Adds a render \a state to the rendering pass. That implies that
+ when the pass is executed at render time, the globally set render state will
+ be modifed by the states defined locally by the Qt3DRender::QRenderPass.
+
+ \note not defining any Qt3DRender::QRenderState in a pass will result in the pass using
+ the globally set render state for a given FrameGraph branch execution path.
*/
void QRenderPass::addRenderState(QRenderState *state)
{
@@ -229,7 +263,7 @@ void QRenderPass::addRenderState(QRenderState *state)
}
/*!
- * Removes \a state from the Qt3DRender::QRenderPass local render state.
+ Removes \a state from the Qt3DRender::QRenderPass local render state.
*/
void QRenderPass::removeRenderState(QRenderState *state)
{
@@ -246,8 +280,8 @@ void QRenderPass::removeRenderState(QRenderState *state)
}
/*!
- * Returns the list of Qt3DCore::QRenderState state objects making up the render
- * state of the Qt3DRender::QRenderPass.
+ Returns the list of Qt3DRender::QRenderState state objects making up the render
+ state of the Qt3DRender::QRenderPass.
*/
QVector<QRenderState *> QRenderPass::renderStates() const
{
@@ -256,7 +290,7 @@ QVector<QRenderState *> QRenderPass::renderStates() const
}
/*!
- * Add \a parameter to the render pass' parameters.
+ Add \a parameter to the render pass' parameters.
*/
void QRenderPass::addParameter(QParameter *parameter)
{
@@ -284,7 +318,7 @@ void QRenderPass::addParameter(QParameter *parameter)
}
/*!
- * Remove \a parameter from the render pass' parameters.
+ Remove \a parameter from the render pass' parameters.
*/
void QRenderPass::removeParameter(QParameter *parameter)
{
@@ -301,9 +335,9 @@ void QRenderPass::removeParameter(QParameter *parameter)
}
/*!
- * Returns a vector of the render pass' current parameters
+ Returns a vector of the render pass' current parameters
*/
-QVector<QParameter *> QRenderPass::parameters() const
+ParameterList QRenderPass::parameters() const
{
Q_D(const QRenderPass);
return d->m_parameters;
diff --git a/src/render/materialsystem/qrenderpass.h b/src/render/materialsystem/qrenderpass.h
index e2eb96a9a..9c608d0c4 100644
--- a/src/render/materialsystem/qrenderpass.h
+++ b/src/render/materialsystem/qrenderpass.h
@@ -70,8 +70,8 @@ public:
QShaderProgram *shaderProgram() const;
- void addFilterKey(QFilterKey*filterKey);
- void removeFilterKey(QFilterKey*filterKey);
+ void addFilterKey(QFilterKey *filterKey);
+ void removeFilterKey(QFilterKey *filterKey);
QVector<QFilterKey*> filterKeys() const;
void addRenderState(QRenderState *state);
diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp
index da954210b..522f021aa 100644
--- a/src/render/materialsystem/qshaderprogram.cpp
+++ b/src/render/materialsystem/qshaderprogram.cpp
@@ -47,29 +47,37 @@
#include <QUrl>
/*!
- * \qmltype ShaderProgram
- * \instantiates Qt3DRender::QShaderProgram
- * \inqmlmodule Qt3D.Render
- * \brief Encapsulates a Shader Program.
- */
+ \class Qt3DRender::QShaderProgram
+ \inmodule Qt3DRender
+ \brief Encapsulates a Shader Program.
+ \inherits Qt3DCore::QNode
+ \since 5.5
+
+ A shader program consists of several different shaders, such as vertex and fragment shaders.
+*/
/*!
- * \class Qt3DRender::QShaderProgram
- * \inmodule Qt3DRender
- *
- * \brief Encapsulates a Shader Program.
- */
+ \qmltype ShaderProgram
+ \instantiates Qt3DRender::QShaderProgram
+ \inqmlmodule Qt3D.Render
+ \brief Encapsulates a Shader Program.
+ \since 5.5
+
+ ShaderProgram class encapsulates a shader program. A shader program consists of several
+ different shaders, such as vertex and fragment shaders.
+*/
/*!
\enum QShaderProgram::ShaderType
- This enum identifies the type of shader used
- \value Vertex
- \value Fragment
- \value TessellationControl
- \value TessellationEvaluation
- \value Geometry
- \value Compute
+ This enum identifies the type of shader used.
+
+ \value Vertex Vertex shader
+ \value Fragment Fragment shader
+ \value TessellationControl Tesselation control shader
+ \value TessellationEvaluation Tesselation evaluation shader
+ \value Geometry Geometry shader
+ \value Compute Compute shader
*/
QT_BEGIN_NAMESPACE
@@ -81,16 +89,11 @@ QShaderProgramPrivate::QShaderProgramPrivate()
{
}
-/*!
- \fn Qt3DRender::QShaderProgram::QShaderProgram(Qt3DCore::QNode *parent)
- Constructs a new QShaderProgram with the specified \a parent.
- */
QShaderProgram::QShaderProgram(QNode *parent)
: QNode(*new QShaderProgramPrivate, parent)
{
}
-/*! \internal */
QShaderProgram::~QShaderProgram()
{
}
@@ -102,14 +105,15 @@ QShaderProgram::QShaderProgram(QShaderProgramPrivate &dd, QNode *parent)
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::vertexShaderCode
- Specifies the vertex shader code to be used
-*/
+ \qmlproperty string ShaderProgram::vertexShaderCode
+ Holds the vertex shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::vertexShaderCode
- Specifies the vertex shader code to be used
- */
+ \property QShaderProgram::vertexShaderCode
+
+ Holds the vertex shader code used by this shader program.
+*/
void QShaderProgram::setVertexShaderCode(const QByteArray &vertexShaderCode)
{
Q_D(QShaderProgram);
@@ -126,14 +130,15 @@ QByteArray QShaderProgram::vertexShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::tessellationControlShaderCode
- Specifies the tessellation control shader code to be used
-*/
+ \qmlproperty string ShaderProgram::tessellationControlShaderCode
+ Holds the tesselation control shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::tessellationControlShaderCode
- Specifies the tessellation control shader code to be used
- */
+ \property QShaderProgram::tessellationControlShaderCode
+
+ Holds the tesselation control shader code used by this shader program.
+*/
void QShaderProgram::setTessellationControlShaderCode(const QByteArray &tessellationControlShaderCode)
{
Q_D(QShaderProgram);
@@ -150,14 +155,15 @@ QByteArray QShaderProgram::tessellationControlShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::tessellationEvaluationShaderCode
- Specifies the tessellation evaluation shader code to be used
-*/
+ \qmlproperty string ShaderProgram::tessellationEvaluationShaderCode
+ Holds the tesselation evaluation shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::tessellationEvaluationShaderCode
- Specifies the tessellation evaluation shader code to be used
- */
+ \property QShaderProgram::tessellationEvaluationShaderCode
+
+ Holds the tesselation evaluation shader code used by this shader program.
+*/
void QShaderProgram::setTessellationEvaluationShaderCode(const QByteArray &tessellationEvaluationShaderCode)
{
Q_D(QShaderProgram);
@@ -174,14 +180,15 @@ QByteArray QShaderProgram::tessellationEvaluationShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::geometryShaderCode
- Specifies the geometry shader code to be used
-*/
+ \qmlproperty string ShaderProgram::geometryShaderCode
+ Holds the geometry shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::geometryShaderCode
- Specifies the geometry shader code to be used
- */
+ \property QShaderProgram::geometryShaderCode
+
+ Holds the geometry shader code used by this shader program.
+*/
void QShaderProgram::setGeometryShaderCode(const QByteArray &geometryShaderCode)
{
Q_D(QShaderProgram);
@@ -198,14 +205,15 @@ QByteArray QShaderProgram::geometryShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::fragmentShaderCode
- Specifies the fragment shader code to be used
-*/
+ \qmlproperty string ShaderProgram::fragmentShaderCode
+ Holds the fragment shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::fragmentShaderCode
- Specifies the fragment shader code to be used
- */
+ \property QShaderProgram::fragmentShaderCode
+
+ Holds the fragment shader code used by this shader program.
+*/
void QShaderProgram::setFragmentShaderCode(const QByteArray &fragmentShaderCode)
{
Q_D(QShaderProgram);
@@ -222,14 +230,15 @@ QByteArray QShaderProgram::fragmentShaderCode() const
}
/*!
- \qmlproperty QByteArray Qt3D.Render::ShaderProgram::computeShaderCode
- Specifies the compute shader code to be used
-*/
+ \qmlproperty string ShaderProgram::computeShaderCode
+ Holds the compute shader code used by this shader program.
+*/
/*!
- \property Qt3DRender::QShaderProgram::computeShaderCode
- Specifies the compute shader code to be used
- */
+ \property QShaderProgram::computeShaderCode
+
+ Holds the compute shader code used by this shader program.
+*/
void QShaderProgram::setComputeShaderCode(const QByteArray &computeShaderCode)
{
Q_D(QShaderProgram);
@@ -247,8 +256,8 @@ QByteArray QShaderProgram::computeShaderCode() const
/*!
- * Sets the \a type shader from raw data in \a shaderCode.
- */
+ Sets the shader code for \a type of shader to the \a shaderCode.
+*/
void QShaderProgram::setShaderCode(ShaderType type, const QByteArray &shaderCode)
{
switch (type) {
@@ -276,8 +285,8 @@ void QShaderProgram::setShaderCode(ShaderType type, const QByteArray &shaderCode
}
/*!
- * Returns the \a type shader code.
- */
+ Returns the shader code for \a type.
+*/
QByteArray QShaderProgram::shaderCode(ShaderType type) const
{
Q_D(const QShaderProgram);
@@ -332,13 +341,13 @@ static QByteArray deincludify(const QString &filePath)
}
/*!
- \qmlmethod QByteArray ShaderProgram::loadSource(const QUrl &sourceUrl)
+ \qmlmethod string ShaderProgram::loadSource(url sourceUrl)
Returns the shader code loaded from \a sourceUrl.
*/
/*!
- * Returns the shader code loaded from \a sourceUrl.
- */
+ Returns the shader code loaded from \a sourceUrl.
+*/
QByteArray QShaderProgram::loadSource(const QUrl &sourceUrl)
{
// TO DO: Handle remote path
diff --git a/src/render/materialsystem/qtechnique.cpp b/src/render/materialsystem/qtechnique.cpp
index f114e2754..74505bfbd 100644
--- a/src/render/materialsystem/qtechnique.cpp
+++ b/src/render/materialsystem/qtechnique.cpp
@@ -61,25 +61,62 @@ QTechniquePrivate::~QTechniquePrivate()
}
/*!
- * \qmltype Technique
- * \instantiates Qt3DRender::QTechnique
- * \inqmlmodule Qt3D.Render
- * \brief Encapsulates a Technique.
+ \qmltype Technique
+ \instantiates Qt3DRender::QTechnique
+ \inqmlmodule Qt3D.Render
+ \inherits Qt3DCore::QNode
+ \since 5.7
+ \brief Encapsulates a Technique.
+
+ A Technique specifies a set of RenderPass objects, FilterKey objects, Parameter objects
+ and a GraphicsApiFilter, which together define a rendering technique the given
+ graphics API can render. The filter keys are used by TechniqueFilter
+ to select specific techinques at specific parts of the FrameGraph.
+ If the same parameter is specified both in Technique and RenderPass, the one
+ in Technique overrides the one used in the RenderPass.
+
+ \sa Qt3D.Render::Effect
*/
/*!
- * \class Qt3DRender::QTechnique
- * \inmodule Qt3DRender
- *
- * \inherits Node
- *
- * \brief Encapsulates a Technique.
+ \class Qt3DRender::QTechnique
+ \inmodule Qt3DRender
+ \inherits Node
+ \since 5.7
+ \brief Encapsulates a Technique.
+
+ A Qt3DRender::QTechnique specifies a set of Qt3DRender::QRenderPass objects,
+ Qt3DRender::QFilterKey objects, Qt3DRender::QParameter objects and
+ a Qt3DRender::QGraphicsApiFilter, which together define a rendering technique the given
+ graphics API can render. The filter keys are used by Qt3DRender::QTechniqueFilter
+ to select specific techinques at specific parts of the FrameGraph.
+ If the same parameter is specified both in QTechnique and QRenderPass, the one
+ in QTechnique overrides the one used in the QRenderPass.
+
+ \sa Qt3DRender::QEffect
*/
/*!
- \fn Qt3DRender::QTechnique::QTechnique(Qt3DCore::QNode *parent)
- Constructs a new QTechnique with the specified \a parent.
+ \qmlproperty GraphicsApiFilter Qt3D.Render::Technique::graphicsApiFilter
+ Specifies the graphics API filter being used
+*/
+/*!
+ \qmlproperty list<FilterKey> Qt3D.Render::Technique::filterKeys
+ Specifies the list of filter keys enabling this technique
+*/
+/*!
+ \qmlproperty list<RenderPass> Qt3D.Render::Technique::renderPasses
+ Specifies the render passes used by the tehcnique
+*/
+/*!
+ \qmlproperty list<Parameter> Qt3D.Render::Technique::parameters
+ Specifies the parameters used by the technique
+*/
+/*!
+ \property Qt3DRender::QTechnique::graphicsApiFilter
+ Specifies the graphics API filter being used
*/
+
QTechnique::QTechnique(QNode *parent)
: QNode(*new QTechniquePrivate, parent)
{
@@ -112,7 +149,7 @@ void QTechniquePrivate::_q_graphicsApiFilterChanged()
}
/*!
- * Add \a filterKey to the Qt3DRender::QTechnique local filter keys.
+ Add \a filterKey to the Qt3DRender::QTechnique local filter keys.
*/
void QTechnique::addFilterKey(QFilterKey *filterKey)
{
@@ -140,7 +177,7 @@ void QTechnique::addFilterKey(QFilterKey *filterKey)
}
/*!
- * Removes \a filterKey from the Qt3DRender::QTechnique local filter keys.
+ Removes \a filterKey from the Qt3DRender::QTechnique local filter keys.
*/
void QTechnique::removeFilterKey(QFilterKey *filterKey)
{
@@ -157,8 +194,8 @@ void QTechnique::removeFilterKey(QFilterKey *filterKey)
}
/*!
- * Returns the list of Qt3DCore::QFilterKey key objects making up the filter keys
- * of the Qt3DRender::QTechnique.
+ Returns the list of Qt3DCore::QFilterKey key objects making up the filter keys
+ of the Qt3DRender::QTechnique.
*/
QVector<QFilterKey *> QTechnique::filterKeys() const
{
@@ -167,7 +204,7 @@ QVector<QFilterKey *> QTechnique::filterKeys() const
}
/*!
- * Add \a parameter to the techniques parameters.
+ Add \a parameter to the technique's parameters.
*/
void QTechnique::addParameter(QParameter *parameter)
{
@@ -195,7 +232,7 @@ void QTechnique::addParameter(QParameter *parameter)
}
/*!
- * Remove \a parameter from the techniques parameters.
+ Remove \a parameter from the technique's parameters.
*/
void QTechnique::removeParameter(QParameter *parameter)
{
@@ -212,7 +249,7 @@ void QTechnique::removeParameter(QParameter *parameter)
}
/*!
- * Appends a \a pass to the technique.
+ Appends a \a pass to the technique.
*/
void QTechnique::addRenderPass(QRenderPass *pass)
{
@@ -240,14 +277,14 @@ void QTechnique::addRenderPass(QRenderPass *pass)
}
/*!
- * Removes a \a pass from the technique.
+ Removes a \a pass from the technique.
*/
void QTechnique::removeRenderPass(QRenderPass *pass)
{
Q_ASSERT(pass);
Q_D(QTechnique);
if (d->m_changeArbiter) {
- const auto change = QPropertyNodeAddedChangePtr::create(id(), pass);
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), pass);
change->setPropertyName("pass");
d->notifyObservers(change);
}
@@ -257,7 +294,7 @@ void QTechnique::removeRenderPass(QRenderPass *pass)
}
/*!
- * Returns the list of render passes contained in the technique.
+ Returns the list of render passes contained in the technique.
*/
QVector<QRenderPass *> QTechnique::renderPasses() const
{
@@ -266,7 +303,7 @@ QVector<QRenderPass *> QTechnique::renderPasses() const
}
/*!
- * Returns a vector of the techniques current parameters
+ Returns a vector of the techniques current parameters
*/
QVector<QParameter *> QTechnique::parameters() const
{
@@ -274,15 +311,6 @@ QVector<QParameter *> QTechnique::parameters() const
return d->m_parameters;
}
-/*!
- \qmlproperty QByteArray Qt3D.Render::Technique::graphicsApiFilter
- Specifies the graphics API filter being used
-*/
-
-/*!
- \property Qt3DRender::QTechnique::graphicsApiFilter
- Specifies the graphics API filter being used
- */
QGraphicsApiFilter *QTechnique::graphicsApiFilter()
{
Q_D(QTechnique);
diff --git a/src/render/materialsystem/shader_p.h b/src/render/materialsystem/shader_p.h
index 1382e287e..283e5a94c 100644
--- a/src/render/materialsystem/shader_p.h
+++ b/src/render/materialsystem/shader_p.h
@@ -52,7 +52,7 @@
//
#include <Qt3DRender/private/backendnode_p.h>
-#include <Qt3DRender/private/quniformvalue_p.h>
+#include <Qt3DRender/private/shaderparameterpack_p.h>
#include <Qt3DRender/private/shadervariables_p.h>
#include <QMutex>
#include <QVector>
diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp
index 1f68bed13..e7c8a1c37 100644
--- a/src/render/materialsystem/shaderdata.cpp
+++ b/src/render/materialsystem/shaderdata.cpp
@@ -94,7 +94,6 @@ void ShaderData::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
const QVariant &propertyValue = entry.second;
const QString propertyName = QString::fromLatin1(entry.first);
- m_properties.insert(propertyName, propertyValue);
m_originalProperties.insert(propertyName, propertyValue);
// We check if the property is a QNodeId or QVector<QNodeId> so that we can
@@ -108,14 +107,15 @@ void ShaderData::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
}
}
- // We look for transformed properties
- QHash<QString, QVariant>::iterator it = m_properties.begin();
- const QHash<QString, QVariant>::iterator end = m_properties.end();
+ // We look for transformed properties once the complete hash of
+ // originalProperties is available
+ QHash<QString, QVariant>::iterator it = m_originalProperties.begin();
+ const QHash<QString, QVariant>::iterator end = m_originalProperties.end();
while (it != end) {
if (static_cast<QMetaType::Type>(it.value().type()) == QMetaType::QVector3D) {
// if there is a matching QShaderData::TransformType propertyTransformed
- QVariant value = m_properties.value(it.key() + QLatin1String("Transformed"));
+ QVariant value = m_originalProperties.value(it.key() + QLatin1String("Transformed"));
// if that's the case, we apply a space transformation to the property
if (value.isValid() && value.type() == QVariant::Int)
m_transformedProperties.insert(it.key(), static_cast<TransformType>(value.toInt()));
@@ -138,135 +138,67 @@ ShaderData *ShaderData::lookupResource(QNodeId id)
// Call by cleanup job (single thread)
void ShaderData::clearUpdatedProperties()
{
- m_updatedProperties.clear();
- const QHash<QString, QVariant>::const_iterator end = m_nestedShaderDataProperties.end();
- QHash<QString, QVariant>::const_iterator it = m_nestedShaderDataProperties.begin();
-
- while (it != end) {
- if (it.value().userType() == QMetaType::QVariantList) {
- const auto values = it.value().value<QVariantList>();
- for (const QVariant &v : values) {
- ShaderData *nested = lookupResource(v.value<QNodeId>());
- if (nested != nullptr)
- nested->clearUpdatedProperties();
- }
- } else {
- ShaderData *nested = lookupResource(it.value().value<QNodeId>());
- if (nested != nullptr)
- nested->clearUpdatedProperties();
- }
- ++it;
- }
+ // DISABLED: Is only useful when building UBO from a ShaderData, which is disable since 5.7
+ // const QHash<QString, QVariant>::const_iterator end = m_nestedShaderDataProperties.end();
+ // QHash<QString, QVariant>::const_iterator it = m_nestedShaderDataProperties.begin();
+
+ // while (it != end) {
+ // if (it.value().userType() == QMetaType::QVariantList) {
+ // const auto values = it.value().value<QVariantList>();
+ // for (const QVariant &v : values) {
+ // ShaderData *nested = lookupResource(v.value<QNodeId>());
+ // if (nested != nullptr)
+ // nested->clearUpdatedProperties();
+ // }
+ // } else {
+ // ShaderData *nested = lookupResource(it.value().value<QNodeId>());
+ // if (nested != nullptr)
+ // nested->clearUpdatedProperties();
+ // }
+ // ++it;
+ // }
}
void ShaderData::cleanup(NodeManagers *managers)
{
- for (Qt3DCore::QNodeId id : qAsConst(m_updatedShaderData)) {
- ShaderData *shaderData = ShaderData::lookupResource(managers, id);
- if (shaderData)
- shaderData->clearUpdatedProperties();
- }
+ Q_UNUSED(managers)
+ // DISABLED: Is only useful when building UBO from a ShaderData, which is disable since 5.7
+ // for (Qt3DCore::QNodeId id : qAsConst(m_updatedShaderData)) {
+ // ShaderData *shaderData = ShaderData::lookupResource(managers, id);
+ // if (shaderData)
+ // shaderData->clearUpdatedProperties();
+ // }
m_updatedShaderData.clear();
}
-// Called by renderview jobs (several concurrent threads)
-/*!
- \internal
- Lookup if the current ShaderData or a nested ShaderData has updated properties.
- UpdateProperties contains either the value of the propertie of a QNodeId if it's another ShaderData.
- Transformed properties are updated for all of ShaderData that have ones at the point.
-
- \note This needs to be performed for every top level ShaderData every time it is used.
- As we don't know if the transformed properties use the same viewMatrix for all RenderViews.
- */
-bool ShaderData::updateViewTransform(const QMatrix4x4 &viewMatrix)
+QVariant ShaderData::getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix)
{
- // We can't perform this only once as we don't know if we would be call as the root or a
- // nested ShaderData
- QMutexLocker lock(&m_mutex);
-
- // Update transformed properties
- // We check the matrices and decide if the transform has changed since the previous call to needsUpdate
- if (m_viewMatrix != viewMatrix) {
- m_viewMatrix = viewMatrix;
- const QHash<QString, TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
- QHash<QString, TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
-
- while (transformedIt != transformedEnd) {
- if (transformedIt.value() == ModelToEye) {
- m_updatedProperties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- m_properties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- }
- ++transformedIt;
+ // Note protecting m_worldMatrix at this point as we assume all world updates
+ // have been performed when reaching this point
+ auto it = m_transformedProperties.find(name);
+ if (it != m_transformedProperties.end()) {
+ const TransformType transformType = it.value();
+ switch (transformType) {
+ case ModelToEye:
+ return QVariant::fromValue(viewMatrix * m_worldMatrix * m_originalProperties.value(name).value<QVector3D>());
+ case ModelToWorld:
+ return QVariant::fromValue(m_worldMatrix * m_originalProperties.value(it.key()).value<QVector3D>());
+ case ModelToWorldDirection:
+ return QVariant::fromValue((m_worldMatrix * QVector4D(m_originalProperties.value(it.key()).value<QVector3D>(), 0.0f)).toVector3D());
+ case NoTransform:
+ break;
}
}
- const QHash<QString, QVariant>::const_iterator end = m_nestedShaderDataProperties.end();
- QHash<QString, QVariant>::const_iterator it = m_nestedShaderDataProperties.begin();
-
- while (it != end) {
- const int userType = it.value().userType();
-
- if (userType == QMetaType::QVariantList) {
- QVariantList updatedNodes;
- bool nestedNeedsUpdate = false;
- const QVariantList values = variant_value<QVariantList>(it.value());
- for (const QVariant &v : values) {
- if (v.userType() != qNodeIdTypeId)
- continue;
-
- const Qt3DCore::QNodeId nestedId = variant_value<Qt3DCore::QNodeId>(v);
- ShaderData *nested = lookupResource(nestedId);
- if (nested != nullptr) {
- // We need to add the nested nodes to the updated property list
- // as we need to maintain order
- // if node[0] doesn't need update but node[1] does,
- // if we only have a single element, the renderer would update element [0]
- nestedNeedsUpdate |= nested->updateViewTransform(viewMatrix);
- updatedNodes << v;
- }
- }
- // Of course we only add all the nodes if at least one of the nested nodes required and update
- if (nestedNeedsUpdate && !updatedNodes.empty())
- m_updatedProperties.insert(it.key(), updatedNodes);
- } else if (userType == qNodeIdTypeId) {
- const Qt3DCore::QNodeId nestedId = variant_value<Qt3DCore::QNodeId>(it.value());
- ShaderData *nested = lookupResource(nestedId);
- if (nested != nullptr && nested->updateViewTransform(viewMatrix))
- m_updatedProperties.insert(it.key(), it.value());
- }
- ++it;
- }
- return m_updatedProperties.size() > 0;
+ return QVariant();
}
-bool ShaderData::updateWorldTransform(const QMatrix4x4 &worldMatrix)
+// Called by FramePreparationJob or by RenderView when dealing with lights
+void ShaderData::updateWorldTransform(const QMatrix4x4 &worldMatrix)
{
- // TODO: Factor this out into a job that populates data in the corresponding
- // renderview or other intermediate data structure. See QTBUG-54818
QMutexLocker lock(&m_mutex);
if (m_worldMatrix != worldMatrix) {
m_worldMatrix = worldMatrix;
-
- const QHash<QString, TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
- QHash<QString, TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
-
- while (transformedIt != transformedEnd) {
- if (transformedIt.value() == ModelToEye) {
- m_updatedProperties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- m_properties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- } else if (transformedIt.value() == ModelToWorldDirection) {
- auto localDirection = QVector4D(m_originalProperties.value(transformedIt.key()).value<QVector3D>(), 0.0f);
- auto worldDirection = (m_worldMatrix * localDirection).toVector3D();
- m_updatedProperties.insert(transformedIt.key(), worldDirection);
- m_properties.insert(transformedIt.key(), worldDirection);
- } else {
- m_updatedProperties.insert(transformedIt.key(), m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- m_properties.insert(transformedIt.key(), m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
- }
- ++transformedIt;
- }
}
- return m_updatedProperties.size() > 0;
}
// This will add the ShaderData to be cleared from updates at the end of the frame
@@ -279,6 +211,21 @@ void ShaderData::markDirty()
ShaderData::m_updatedShaderData.append(peerId());
}
+/*!
+ \internal
+ Lookup if the current ShaderData or a nested ShaderData has updated properties.
+ UpdateProperties contains either the value of the propertie of a QNodeId if it's another ShaderData.
+ Transformed properties are updated for all of ShaderData that have ones at the point.
+
+ \note This needs to be performed for every top level ShaderData every time it is used.
+ As we don't know if the transformed properties use the same viewMatrix for all RenderViews.
+ */
+
+ShaderData::TransformType ShaderData::propertyTransformType(const QString &name) const
+{
+ return m_transformedProperties.value(name, TransformType::NoTransform);
+}
+
void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
if (!m_propertyReader.isNull() && e->type() == PropertyUpdated) {
@@ -297,19 +244,7 @@ void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
// Note we aren't notified about nested QShaderData in this call
// only scalar / vec properties
- if (m_properties.contains(propertyName)) {
- // If this is a Transformed property, we need to multiply against the correct
- // matrices
- m_originalProperties.insert(propertyName, propertyValue);
- if (m_transformedProperties.contains(propertyName)) {
- if (m_transformedProperties[propertyName] == ModelToEye)
- propertyValue = m_viewMatrix * m_worldMatrix * propertyValue.value<QVector3D>();
- else
- propertyValue = m_worldMatrix * propertyValue.value<QVector3D>();
- }
- m_properties.insert(propertyName, propertyValue);
- m_updatedProperties.insert(propertyName, propertyValue);
- }
+ m_originalProperties.insert(propertyName, propertyValue);
BackendNode::markDirty(AbstractRenderer::AllDirty);
}
diff --git a/src/render/materialsystem/shaderdata_p.h b/src/render/materialsystem/shaderdata_p.h
index 46dd26faf..6ce0c734c 100644
--- a/src/render/materialsystem/shaderdata_p.h
+++ b/src/render/materialsystem/shaderdata_p.h
@@ -71,6 +71,7 @@ class Q_AUTOTEST_EXPORT ShaderData : public BackendNode
{
public:
enum TransformType {
+ NoTransform = -1,
ModelToEye = 0,
ModelToWorld,
ModelToWorldDirection
@@ -79,15 +80,16 @@ public:
ShaderData();
~ShaderData();
- QHash<QString, QVariant> properties() const { return m_properties; }
- QHash<QString, QVariant> updatedProperties() const { return m_updatedProperties; }
+ QHash<QString, QVariant> properties() const { return m_originalProperties; }
// Called by FramePreparationJob
- bool updateWorldTransform(const QMatrix4x4 &worldMatrix);
+ void updateWorldTransform(const QMatrix4x4 &worldMatrix);
// Call by RenderViewJob
void markDirty();
- bool updateViewTransform(const QMatrix4x4 &viewMatrix);
+
+ TransformType propertyTransformType(const QString &name) const;
+ QVariant getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix);
// Called by FrameCleanupJob
static void cleanup(NodeManagers *managers);
@@ -98,17 +100,18 @@ protected:
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ PropertyReaderInterfacePtr m_propertyReader;
+
// 1 to 1 match with frontend properties, modified only by sceneChangeEvent
QHash<QString, QVariant> m_originalProperties;
- // 1 to 1 match with frontend properties apart from Transformed
- // properties which contain the matrices product
- QHash<QString, QVariant> m_properties;
- // only updated properties, Transformed properties have the same
- // value as in m_properties
- QHash<QString, QVariant> m_updatedProperties;
- PropertyReaderInterfacePtr m_propertyReader;
+
+ // Contains properties thar are of type ShaderData
QHash<QString, QVariant> m_nestedShaderDataProperties;
+
+ // Contains property that are defined like: postionTransformed: ModelToEye
QHash<QString, TransformType> m_transformedProperties;
+
+
QMutex m_mutex;
static QVector<Qt3DCore::QNodeId> m_updatedShaderData;
QMatrix4x4 m_worldMatrix;
diff --git a/src/render/renderstates/qblendequation.cpp b/src/render/renderstates/qblendequation.cpp
index de999a19f..e48e83883 100644
--- a/src/render/renderstates/qblendequation.cpp
+++ b/src/render/renderstates/qblendequation.cpp
@@ -39,9 +39,10 @@
****************************************************************************/
/*!
- * \class QBlendEquation
+ * \class Qt3DRender::QBlendEquation
* \brief The QBlendEquation class specifies the equation used for both the RGB
* blend equation and the Alpha blend equation
+ * \inmodule Qt3DRender
* \since 5.7
* \ingroup renderstates
*
@@ -49,6 +50,19 @@
* already in the framebuffer.
*/
+/*!
+ \qmltype BlendEquation
+ \instantiates Qt3DRender::QBlendEquation
+ \inherits RenderState
+ \inqmlmodule Qt3D.Render
+ \since 5.5
+ \brief The BlendEquation class specifies the equation used for both the RGB
+ blend equation and the Alpha blend equation
+
+ The blend equation is used to determine how a new pixel is combined with a pixel
+ already in the framebuffer.
+*/
+
#include "qblendequation.h"
#include "qblendequation_p.h"
#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
@@ -70,17 +84,34 @@ QBlendEquation::~QBlendEquation()
{
}
+/*!
+ \enum Qt3DRender::QBlendEquation::BlendFunction
+
+ \value Add GL_FUNC_ADD
+ \value Subtract GL_FUNC_SUBTRACT
+ \value ReverseSubtract GL_FUNC_REVERSE_SUBTRACT
+ \value Min GL_MIN
+ \value Max GL_MAX
+*/
+
+/*!
+ \qmlproperty enumeration BlendEquation::blendFunction
+
+ Holds the blend function, which determines how source and destination colors are combined.
+ */
+
+/*!
+ \property QBlendEquation::blendFunction
+
+ Holds the blend function, which determines how source and destination colors are combined.
+ */
+
QBlendEquation::BlendFunction QBlendEquation::blendFunction() const
{
Q_D(const QBlendEquation);
return d->m_blendFunction;
}
-/*!
- * Sets the function used to decide how the source and destination colors are combined,
- * to \a blendFunction.
- * \param blendFunction
- */
void QBlendEquation::setBlendFunction(QBlendEquation::BlendFunction blendFunction)
{
Q_D(QBlendEquation);
diff --git a/src/render/renderstates/qblendequationarguments.cpp b/src/render/renderstates/qblendequationarguments.cpp
index cbb3ff886..58c048138 100644
--- a/src/render/renderstates/qblendequationarguments.cpp
+++ b/src/render/renderstates/qblendequationarguments.cpp
@@ -125,12 +125,12 @@ QBlendEquationArguments::QBlendEquationArguments(QBlendEquationArgumentsPrivate
*/
/*!
- \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::sourceRgb
+ \qmlproperty enumeration BlendEquationArguments::sourceRgb
*/
/*!
- \property Qt3DRender::QBlendEquationArguments::sourceRgb
+ \property QBlendEquationArguments::sourceRgb
*/
QBlendEquationArguments::Blending QBlendEquationArguments::sourceRgb() const
@@ -152,12 +152,12 @@ void QBlendEquationArguments::setSourceRgb(QBlendEquationArguments::Blending sou
}
/*!
- \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::destinationRgb
+ \qmlproperty enumeration BlendEquationArguments::destinationRgb
*/
/*!
- \property Qt3DRender::QBlendEquationArguments::destinationRgb
+ \property QBlendEquationArguments::destinationRgb
*/
QBlendEquationArguments::Blending QBlendEquationArguments::destinationRgb() const
@@ -179,12 +179,12 @@ void QBlendEquationArguments::setDestinationRgb(QBlendEquationArguments::Blendin
}
/*!
- \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::sourceAlpha
+ \qmlproperty enumeration BlendEquationArguments::sourceAlpha
*/
/*!
- \property Qt3DRender::QBlendEquationArguments::sourceAlpha
+ \property QBlendEquationArguments::sourceAlpha
*/
QBlendEquationArguments::Blending QBlendEquationArguments::sourceAlpha() const
@@ -206,12 +206,12 @@ void QBlendEquationArguments::setSourceAlpha(QBlendEquationArguments::Blending s
}
/*!
- \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::DestinationAlpha
+ \qmlproperty enumeration BlendEquationArguments::DestinationAlpha
*/
/*!
- \property Qt3DRender::QBlendEquationArguments::destinationAlpha
+ \property QBlendEquationArguments::destinationAlpha
*/
QBlendEquationArguments::Blending QBlendEquationArguments::destinationAlpha() const
@@ -232,12 +232,30 @@ void QBlendEquationArguments::setDestinationAlpha(QBlendEquationArguments::Blend
}
}
+/*!
+ \fn QBlendEquationArguments::sourceRgbaChanged(Blending sourceRgba)
+
+ Notify that both sourceRgb and sourceAlpha properties have changed to \a sourceRgba.
+*/
+/*!
+ \fn QBlendEquationArguments::destinationRgbaChanged(Blending destinationRgba)
+
+ Notify that both destinationRgb and destinationAlpha properties have changed to
+ \a destinationRgba.
+*/
+
+/*!
+ Change both sourceRgb and sourceAlpha properties to \a sourceRgba.
+*/
void QBlendEquationArguments::setSourceRgba(Blending sourceRgba)
{
setSourceRgb(sourceRgba);
setSourceAlpha(sourceRgba);
}
+/*!
+ Change both destinationRgb and destinationAlpha properties to \a destinationRgba.
+*/
void QBlendEquationArguments::setDestinationRgba(Blending destinationRgba)
{
setDestinationRgb(destinationRgba);
@@ -245,14 +263,14 @@ void QBlendEquationArguments::setDestinationRgba(Blending destinationRgba)
}
/*!
- \qmlproperty int Qt3D.Render::BlendEquationArguments::bufferIndex
+ \qmlproperty int BlendEquationArguments::bufferIndex
Specifies the index of the Draw Buffer that this BlendEquationArguments applies to.
If negative, this will apply to all Draw Buffers.
*/
/*!
- \property Qt3DRender::QBlendEquationArguments::bufferIndex
+ \property QBlendEquationArguments::bufferIndex
Specifies the index of the Draw Buffer that this BlendEquationArguments applies to.
If negative, this will apply to all Draw Buffers.
diff --git a/src/render/renderstates/qblendequationarguments.h b/src/render/renderstates/qblendequationarguments.h
index 8e2f86f6c..2f844b8cf 100644
--- a/src/render/renderstates/qblendequationarguments.h
+++ b/src/render/renderstates/qblendequationarguments.h
@@ -92,7 +92,6 @@ public:
Blending sourceAlpha() const;
Blending destinationAlpha() const;
int bufferIndex() const;
- bool specifiesAllDrawBuffers() const;
public Q_SLOTS:
void setSourceRgb(Blending sourceRgb);
diff --git a/src/render/renderstates/qpointsize.cpp b/src/render/renderstates/qpointsize.cpp
index 8aa2d7e0c..03c37bc4b 100644
--- a/src/render/renderstates/qpointsize.cpp
+++ b/src/render/renderstates/qpointsize.cpp
@@ -51,11 +51,36 @@ namespace Qt3DRender {
\brief Specifies the size of rasterized points. May either be set statically
or by shader programs.
- When using StaticValue, the value is set using glPointSize(), if available.
- When using Programmable, gl_PointSize must be set within shader programs,
- the value provided to this RenderState is ignored in that case.
+ When the sizeMode property is set to SizeMode::Fixed, the value is set
+ using glPointSize(), if available. When using SizeMode::Programmable,
+ gl_PointSize must be set within shader programs, the value provided to this
+ RenderState is ignored in that case.
*/
+/*!
+ \qmltype PointSize
+ \instantiates Qt3DRender::QPointSize
+ \inqmlmodule Qt3D.Render
+
+ \brief Specifies the size of rasterized points. May either be set statically
+ or by shader programs.
+
+ When the sizeMode property is set to SizeMode::Fixed, the value is set
+ using glPointSize(), if available. When using SizeMode::Programmable,
+ gl_PointSize must be set within shader programs, the value provided to this
+ RenderState is ignored in that case.
+ */
+
+/*!
+ \qmlproperty float Qt3D.Render::QPointSize::value
+ Specifies the point size value to be used.
+*/
+
+/*!
+ \qmlproperty QPointSize::SizeMode Qt3D.Render::QPointSize::sizeMode
+ Specifies the sizeMode to be used.
+*/
+
QPointSize::QPointSize(Qt3DCore::QNode *parent)
: QRenderState(*new QPointSizePrivate(SizeMode::Programmable, 0.f), parent)
{
diff --git a/src/render/texture/qabstracttextureimage.cpp b/src/render/texture/qabstracttextureimage.cpp
index d3694efc9..42e78ced6 100644
--- a/src/render/texture/qabstracttextureimage.cpp
+++ b/src/render/texture/qabstracttextureimage.cpp
@@ -48,6 +48,40 @@ using namespace Qt3DCore;
namespace Qt3DRender {
+/*!
+ \class Qt3DRender::QTextureImageDataGenerator
+ \inmodule Qt3DRender
+ \since 5.7
+ \brief Provides texture image data for QAbstractTextureImage
+
+ QTextureImageDataGenerator is a data provider for QAbstractTexture.
+ QTextureImageDataGenerator can be used to expand Qt3D with more ways to load
+ texture image data as well as support user-defined formats and formats Qt3D
+ does not natively support. The data is returned by the QTextureImageDataPtr
+ which contains the data that will be loaded to the texture.
+ QTextureImageDataGenerator is executed by Aspect jobs in the backend.
+ */
+/*!
+ \typedef Qt3DRender::QTextureImageDataPtr
+ \relates Qt3DRender::QTextureImageDataGenerator
+
+ Shared pointer to \l QTextureImageData.
+*/
+
+/*!
+ \fn QTextureImageDataPtr QTextureImageDataGenerator::operator()()
+
+ Implement the method to return the texture image data.
+*/
+
+/*!
+ \fn bool QTextureImageDataGenerator::operator ==(const QTextureImageDataGenerator &other) const
+
+ Implement the method to compare this texture data generator to \a other.
+ The operator is used to check if the \l QAbstractTextureImage needs to reload
+ the \l QTextureImageData.
+*/
+
QAbstractTextureImagePrivate::QAbstractTextureImagePrivate()
: QNodePrivate(),
m_mipLevel(0),
@@ -90,6 +124,13 @@ QAbstractTextureImagePrivate::~QAbstractTextureImagePrivate()
*/
/*!
+ \fn QTextureImageDataGeneratorPtr QAbstractTextureImage::dataGenerator() const
+
+ Implement this method to return the \l QTextureImageDataGeneratorPtr, which will
+ provide the data for the texture image.
+*/
+
+/*!
Constructs a new QAbstractTextureImage instance with \a parent as parent.
*/
QAbstractTextureImage::QAbstractTextureImage(QNode *parent)
diff --git a/src/render/texture/qtextureimage.cpp b/src/render/texture/qtextureimage.cpp
index dab92082a..dbe0ff05c 100644
--- a/src/render/texture/qtextureimage.cpp
+++ b/src/render/texture/qtextureimage.cpp
@@ -71,6 +71,59 @@ namespace Qt3DRender {
*/
/*!
+ \enum QTextureImage::Status
+
+ This enumeration specifies the status values for texture image loading.
+
+ \value None The texture image loading has not been started yet.
+ \value Loading The texture image loading has started, but not finised.
+ \value Ready The texture image loading has finished.
+ \value Error The texture image loading confronted an error.
+*/
+
+/*!
+ \qmlproperty url TextureImage::source
+
+ This property holds the source url from which data for the texture
+ image will be loaded.
+*/
+
+/*!
+ \qmlproperty enumeration TextureImage::status
+
+ This property holds the status of the texture image loading.
+
+ \list
+ \li TextureImage.None
+ \li TextureImage.Loading
+ \li TextureImage.Ready
+ \li TextureImage.Error
+ \endlist
+ \readonly
+*/
+
+/*!
+ \property QTextureImage::source
+
+ This property holds the source url from which data for the texture
+ image will be loaded.
+*/
+
+/*!
+ \property QTextureImage::status
+
+ This property holds the status of the texture image loading.
+
+ \list
+ \li TextureImage.None
+ \li TextureImage.Loading
+ \li TextureImage.Ready
+ \li TextureImage.Error
+ \endlist
+ \readonly
+*/
+
+/*!
Constructs a new Qt3DRender::QTextureImage instance with \a parent as parent.
*/
QTextureImage::QTextureImage(QNode *parent)
@@ -93,7 +146,7 @@ QUrl QTextureImage::source() const
}
/*!
- * \return the current status.
+ \return the current status.
*/
QTextureImage::Status QTextureImage::status() const
{
@@ -102,20 +155,6 @@ QTextureImage::Status QTextureImage::status() const
}
/*!
- \property Qt3DRender::QTextureImage::source
-
- This property holds the source url from which data for the texture
- image will be loaded.
-*/
-
-/*!
- \qmlproperty url Qt3D.Render::TextureImage::source
-
- This property holds the source url from which data for the texture
- image will be loaded.
-*/
-
-/*!
Sets the source url of the texture image to \a source.
\note This triggers a call to update()
*/
@@ -130,8 +169,8 @@ void QTextureImage::setSource(const QUrl &source)
}
/*!
- * Sets the status to \a status.
- * \param status
+ Sets the status to \a status.
+ \param status
*/
void QTextureImage::setStatus(Status status)
{
@@ -152,8 +191,8 @@ QTextureImageDataGeneratorPtr QTextureImage::dataGenerator() const
}
/*!
- * Sets the scene change event to \a change.
- * \param change
+ Sets the scene change event to \a change.
+ \param change
*/
void QTextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
@@ -164,8 +203,8 @@ void QTextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
}
/*!
- * The constructor creats a new QImageTextureDataFunctor::QImageTextureDataFunctor
- * instance with the specified \a url.
+ The constructor creates a new QImageTextureDataFunctor::QImageTextureDataFunctor
+ instance with the specified \a url.
*/
QImageTextureDataFunctor::QImageTextureDataFunctor(const QUrl &url)
: QTextureImageDataGenerator()