diff options
Diffstat (limited to 'src/extras/defaults')
-rw-r--r-- | src/extras/defaults/qdiffusemapmaterial.cpp | 37 | ||||
-rw-r--r-- | src/extras/defaults/qdiffusespecularmapmaterial.cpp | 35 | ||||
-rw-r--r-- | src/extras/defaults/qfirstpersoncameracontroller.cpp | 54 | ||||
-rw-r--r-- | src/extras/defaults/qforwardrenderer.cpp | 99 | ||||
-rw-r--r-- | src/extras/defaults/qgoochmaterial.cpp | 21 | ||||
-rw-r--r-- | src/extras/defaults/qnormaldiffusemapalphamaterial.cpp | 23 | ||||
-rw-r--r-- | src/extras/defaults/qnormaldiffusemapmaterial.cpp | 40 | ||||
-rw-r--r-- | src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp | 42 | ||||
-rw-r--r-- | src/extras/defaults/qorbitcameracontroller.cpp | 68 | ||||
-rw-r--r-- | src/extras/defaults/qorbitcameracontroller.h | 1 | ||||
-rw-r--r-- | src/extras/defaults/qpervertexcolormaterial.cpp | 19 | ||||
-rw-r--r-- | src/extras/defaults/qphongalphamaterial.cpp | 65 | ||||
-rw-r--r-- | src/extras/defaults/qphongmaterial.cpp | 28 |
13 files changed, 365 insertions, 167 deletions
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. */ |