diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2015-06-05 15:48:38 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-06-05 15:48:38 +0100 |
commit | 8f58119cd18d69fac28528f0a7536cb9fccc15e3 (patch) | |
tree | 844835179ebeca6724c62e47c2cd22650025ef1f /src/render/defaults | |
parent | 2e778e83cb12c830dbbf4887d107e1788a0ce605 (diff) | |
parent | ca2ae5592d4a2eb01f0254c712159657c79c9449 (diff) |
Merge branch '5.5' into dev
Change-Id: I8b3235703b7ceeb23de0b07753bed5f29436da31
Diffstat (limited to 'src/render/defaults')
20 files changed, 678 insertions, 149 deletions
diff --git a/src/render/defaults/defaults.pri b/src/render/defaults/defaults.pri index 9657f3a88..fb2c04a08 100644 --- a/src/render/defaults/defaults.pri +++ b/src/render/defaults/defaults.pri @@ -16,7 +16,9 @@ HEADERS += \ $$PWD/qforwardrenderer.h \ $$PWD/qforwardrenderer_p.h \ $$PWD/qpervertexcolormaterial.h \ - $$PWD/qpervertexcolormaterial_p.h + $$PWD/qpervertexcolormaterial_p.h \ + $$PWD/qskyboxentity.h \ + $$PWD/qskyboxentity_p.h SOURCES += \ $$PWD/qphongmaterial.cpp \ @@ -26,4 +28,5 @@ SOURCES += \ $$PWD/qnormaldiffusemapalphamaterial.cpp \ $$PWD/qdiffusespecularmapmaterial.cpp \ $$PWD/qforwardrenderer.cpp \ - $$PWD/qpervertexcolormaterial.cpp + $$PWD/qpervertexcolormaterial.cpp \ + $$PWD/qskyboxentity.cpp diff --git a/src/render/defaults/qdiffusemapmaterial.cpp b/src/render/defaults/qdiffusemapmaterial.cpp index 431cf88d4..3cdbfacf7 100644 --- a/src/render/defaults/qdiffusemapmaterial.cpp +++ b/src/render/defaults/qdiffusemapmaterial.cpp @@ -52,8 +52,12 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -QDiffuseMapMaterialPrivate::QDiffuseMapMaterialPrivate(QDiffuseMapMaterial *qq) - : QMaterialPrivate(qq) +/*! + \class Qt3D::QDiffuseMapMaterialPrivate + \internal +*/ +QDiffuseMapMaterialPrivate::QDiffuseMapMaterialPrivate() + : QMaterialPrivate() , m_diffuseMapEffect(new QEffect()) , m_diffuseTexture(new QTexture2D()) , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f))) @@ -149,7 +153,7 @@ void QDiffuseMapMaterialPrivate::init() Constructs a new Qt3D::QDiffuseMapMaterial instance with parent object \a parent. */ QDiffuseMapMaterial::QDiffuseMapMaterial(QNode *parent) - : QMaterial(*new QDiffuseMapMaterialPrivate(this), parent) + : QMaterial(*new QDiffuseMapMaterialPrivate, parent) { Q_D(QDiffuseMapMaterial); QObject::connect(d->m_ambientParameter, SIGNAL(valueChanged()), this, SIGNAL(ambientChanged())); @@ -160,6 +164,9 @@ QDiffuseMapMaterial::QDiffuseMapMaterial(QNode *parent) d->init(); } +/*! + Destroys the QDiffuseMapMaterial instance. +*/ QDiffuseMapMaterial::~QDiffuseMapMaterial() { } @@ -167,8 +174,8 @@ QDiffuseMapMaterial::~QDiffuseMapMaterial() /*! \property Qt3D::QDiffuseMapMaterial::ambient - Holds the current QColor ambient value. - */ + Holds the current ambient color. +*/ QColor QDiffuseMapMaterial::ambient() const { @@ -177,10 +184,10 @@ QColor QDiffuseMapMaterial::ambient() const } /*! - \property QDiffuseMapMaterial::specular + \property Qt3D::QDiffuseMapMaterial::specular - Holds the current QColor specular value. - */ + Holds the current specular color. +*/ QColor QDiffuseMapMaterial::specular() const { Q_D(const QDiffuseMapMaterial); @@ -188,10 +195,10 @@ QColor QDiffuseMapMaterial::specular() const } /*! - \property QDiffuseMapMaterial::shininess + \property Qt3D::QDiffuseMapMaterial::shininess Holds the current shininess as a float value. - */ +*/ float QDiffuseMapMaterial::shininess() const { Q_D(const QDiffuseMapMaterial); @@ -199,15 +206,19 @@ float QDiffuseMapMaterial::shininess() const } /*! - \property QAbstractTextureProvider *QDiffuseMapMaterial::diffuse + \property Qt3D::QDiffuseMapMaterial::diffuse Holds the current QTexture used as the diffuse map. - \note By default, the diffuse texture has a linear - magnification filter, a linear mipmap linear minification filter, - the wrap mode is repeat, the maximum anisotropy is set to 16.0 - and mipmapping is enabled. - */ + 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 +*/ QAbstractTextureProvider *QDiffuseMapMaterial::diffuse() const { Q_D(const QDiffuseMapMaterial); @@ -215,10 +226,11 @@ QAbstractTextureProvider *QDiffuseMapMaterial::diffuse() const } /*! - \property QDiffuseMapMaterial::textureScale + \property Qt3D::QDiffuseMapMaterial::textureScale - Holds the current texture scale. - */ + Holds the current texture scale as a float value. + +*/ float QDiffuseMapMaterial::textureScale() const { Q_D(const QDiffuseMapMaterial); diff --git a/src/render/defaults/qdiffusemapmaterial_p.h b/src/render/defaults/qdiffusemapmaterial_p.h index d3005e201..7bda02b57 100644 --- a/src/render/defaults/qdiffusemapmaterial_p.h +++ b/src/render/defaults/qdiffusemapmaterial_p.h @@ -55,7 +55,7 @@ class QDiffuseMapMaterial; class QDiffuseMapMaterialPrivate : public QMaterialPrivate { - QDiffuseMapMaterialPrivate(QDiffuseMapMaterial *qq); + QDiffuseMapMaterialPrivate(); void init(); diff --git a/src/render/defaults/qdiffusespecularmapmaterial.cpp b/src/render/defaults/qdiffusespecularmapmaterial.cpp index 109057740..55786f692 100644 --- a/src/render/defaults/qdiffusespecularmapmaterial.cpp +++ b/src/render/defaults/qdiffusespecularmapmaterial.cpp @@ -53,8 +53,12 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -QDiffuseSpecularMapMaterialPrivate::QDiffuseSpecularMapMaterialPrivate(QDiffuseSpecularMapMaterial *qq) - : QMaterialPrivate(qq) +/*! + \class Qt3D::QDiffuseSpecularMapMaterialPrivate + \internal +*/ +QDiffuseSpecularMapMaterialPrivate::QDiffuseSpecularMapMaterialPrivate() + : QMaterialPrivate() , m_diffuseSpecularMapEffect(new QEffect()) , m_diffuseTexture(new QTexture2D()) , m_specularTexture(new QTexture2D()) @@ -154,10 +158,10 @@ void QDiffuseSpecularMapMaterialPrivate::init() */ /*! - Constructs a new Qt3D::QDiffuseSpecularMapMaterial instance with parent object \a parent. + Constructs a new Qt3D::QDiffuseSpecularMapMaterial instance with parent object \a parent. */ QDiffuseSpecularMapMaterial::QDiffuseSpecularMapMaterial(QNode *parent) - : QMaterial(*new QDiffuseSpecularMapMaterialPrivate(this), parent) + : QMaterial(*new QDiffuseSpecularMapMaterialPrivate, parent) { Q_D(QDiffuseSpecularMapMaterial); QObject::connect(d->m_ambientParameter, SIGNAL(valueChanged()), this, SIGNAL(ambientChanged())); @@ -168,6 +172,9 @@ QDiffuseSpecularMapMaterial::QDiffuseSpecularMapMaterial(QNode *parent) d->init(); } +/*! + Destroys the QDiffuseSpecularMapMaterial instance. +*/ QDiffuseSpecularMapMaterial::~QDiffuseSpecularMapMaterial() { } @@ -175,7 +182,7 @@ QDiffuseSpecularMapMaterial::~QDiffuseSpecularMapMaterial() /*! \property Qt3D::QDiffuseSpecularMapMaterial::ambient - Holds the current QColor ambient value. + Holds the current ambient color. */ QColor QDiffuseSpecularMapMaterial::ambient() const { @@ -184,15 +191,19 @@ QColor QDiffuseSpecularMapMaterial::ambient() const } /*! - \property *QDiffuseSpecularMapMaterial::diffuse + \property Qt3D::QDiffuseSpecularMapMaterial::diffuse Holds the current diffuse map texture. - \note By default the diffuse texture has a linear - magnification filter, a linear mipmap linear minification filter, - the wrap mode is repeat, the maximum anisotropy is set to 16.0 - and mipmapping is enabled. - */ + 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 +*/ QAbstractTextureProvider *QDiffuseSpecularMapMaterial::diffuse() const { Q_D(const QDiffuseSpecularMapMaterial); @@ -204,11 +215,15 @@ QAbstractTextureProvider *QDiffuseSpecularMapMaterial::diffuse() const Holds the current specular map texture. - \note By default the specular texture has a linear - magnification filter, a linear mipmap linear minification filter, - the wrap mode is repeat, the maximum anisotropy is set to 16.0 - and mipmapping is enabled. - */ + 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 +*/ QAbstractTextureProvider *QDiffuseSpecularMapMaterial::specular() const { Q_D(const QDiffuseSpecularMapMaterial); @@ -219,8 +234,7 @@ QAbstractTextureProvider *QDiffuseSpecularMapMaterial::specular() const \property Qt3D::QDiffuseSpecularMapMaterial::shininess Holds the current shininess as a float value. - - */ +*/ float QDiffuseSpecularMapMaterial::shininess() const { Q_D(const QDiffuseSpecularMapMaterial); @@ -230,8 +244,8 @@ float QDiffuseSpecularMapMaterial::shininess() const /*! \property Qt3D::QDiffuseSpecularMapMaterial::textureScale - Holds the current texture scale. - */ + Holds the current texture scale as a float value. +*/ float QDiffuseSpecularMapMaterial::textureScale() const { Q_D(const QDiffuseSpecularMapMaterial); diff --git a/src/render/defaults/qdiffusespecularmapmaterial_p.h b/src/render/defaults/qdiffusespecularmapmaterial_p.h index 00d8edc1d..72ab20e83 100644 --- a/src/render/defaults/qdiffusespecularmapmaterial_p.h +++ b/src/render/defaults/qdiffusespecularmapmaterial_p.h @@ -56,7 +56,7 @@ class QDiffuseSpecularMapMaterial; class QDiffuseSpecularMapMaterialPrivate : public QMaterialPrivate { public: - QDiffuseSpecularMapMaterialPrivate(QDiffuseSpecularMapMaterial *qq); + QDiffuseSpecularMapMaterialPrivate(); void init(); diff --git a/src/render/defaults/qforwardrenderer.cpp b/src/render/defaults/qforwardrenderer.cpp index feb8af0ad..a7167ca5d 100644 --- a/src/render/defaults/qforwardrenderer.cpp +++ b/src/render/defaults/qforwardrenderer.cpp @@ -46,8 +46,12 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -QForwardRendererPrivate::QForwardRendererPrivate(QForwardRenderer *qq) - : QTechniqueFilterPrivate(qq) +/*! + \class Qt3D::QForwardRendererPrivate + \internal +*/ +QForwardRendererPrivate::QForwardRendererPrivate() + : QTechniqueFilterPrivate() , m_viewport(new QViewport()) , m_cameraSelector(new QCameraSelector()) , m_clearBuffer(new QClearBuffer()) @@ -91,11 +95,10 @@ void QForwardRendererPrivate::init() */ /*! - \fn Qt3D::QForwardRenderer::QForwardRenderer(QNode *parent) Constructs a new Qt3D::QForwardRenderer instance with parent object \a parent. */ QForwardRenderer::QForwardRenderer(QNode *parent) - : QTechniqueFilter(*new QForwardRendererPrivate(this), parent) + : QTechniqueFilter(*new QForwardRendererPrivate, parent) { Q_D(QForwardRenderer); QObject::connect(d->m_viewport, SIGNAL(clearColorChanged()), this, SIGNAL(clearColorChanged())); @@ -104,6 +107,9 @@ QForwardRenderer::QForwardRenderer(QNode *parent) d->init(); } +/*! + Destroys the QForwardRenderer instance. +*/ QForwardRenderer::~QForwardRenderer() { } @@ -124,7 +130,7 @@ void QForwardRenderer::setClearColor(const QColor &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(QEntity *camera) { Q_D(QForwardRenderer); @@ -146,7 +152,7 @@ QRectF QForwardRenderer::viewportRect() const \property Qt3D::QForwardRenderer::clearColor Holds the current clearColor. - */ +*/ QColor QForwardRenderer::clearColor() const { Q_D(const QForwardRenderer); @@ -157,7 +163,9 @@ QColor QForwardRenderer::clearColor() const \property Qt3D::QForwardRenderer::camera Holds the current QEntity camera used to render the scene. - */ + + \note A camera is a QEntity that has a QCameraLens as one of its components. +*/ QEntity *QForwardRenderer::camera() const { Q_D(const QForwardRenderer); diff --git a/src/render/defaults/qforwardrenderer_p.h b/src/render/defaults/qforwardrenderer_p.h index d9566fa5c..e0762e9c8 100644 --- a/src/render/defaults/qforwardrenderer_p.h +++ b/src/render/defaults/qforwardrenderer_p.h @@ -51,7 +51,7 @@ class QCameraSelector; class QForwardRendererPrivate: public QTechniqueFilterPrivate { public: - QForwardRendererPrivate(QForwardRenderer *qq); + QForwardRendererPrivate(); QViewport *m_viewport; QCameraSelector *m_cameraSelector; diff --git a/src/render/defaults/qnormaldiffusemapalphamaterial.cpp b/src/render/defaults/qnormaldiffusemapalphamaterial.cpp index 30ee3684d..6854e7f1d 100644 --- a/src/render/defaults/qnormaldiffusemapalphamaterial.cpp +++ b/src/render/defaults/qnormaldiffusemapalphamaterial.cpp @@ -56,8 +56,12 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -QNormalDiffuseMapAlphaMaterialPrivate::QNormalDiffuseMapAlphaMaterialPrivate(QNormalDiffuseMapAlphaMaterial *qq) - : QNormalDiffuseMapMaterialPrivate(qq) +/*! + \class Qt3D::QNormalDiffuseMapAlphaMaterialPrivate + \internal +*/ +QNormalDiffuseMapAlphaMaterialPrivate::QNormalDiffuseMapAlphaMaterialPrivate() + : QNormalDiffuseMapMaterialPrivate() , m_alphaCoverage(new QAlphaCoverage()) , m_depthTest(new QDepthTest()) { @@ -145,10 +149,13 @@ void QNormalDiffuseMapAlphaMaterialPrivate::init() Constructs a new Qt3D::QNormalDiffuseMapAlphaMaterial instance with parent object \a parent. */ QNormalDiffuseMapAlphaMaterial::QNormalDiffuseMapAlphaMaterial(QNode *parent) - : QNormalDiffuseMapMaterial(*new QNormalDiffuseMapAlphaMaterialPrivate(this), parent) + : QNormalDiffuseMapMaterial(*new QNormalDiffuseMapAlphaMaterialPrivate, parent) { } +/*! + Destroys the QNormalDiffuseMapAlphaMaterial instance. +*/ QNormalDiffuseMapAlphaMaterial::~QNormalDiffuseMapAlphaMaterial() { } diff --git a/src/render/defaults/qnormaldiffusemapalphamaterial_p.h b/src/render/defaults/qnormaldiffusemapalphamaterial_p.h index fb5fb5c73..bc3444fc6 100644 --- a/src/render/defaults/qnormaldiffusemapalphamaterial_p.h +++ b/src/render/defaults/qnormaldiffusemapalphamaterial_p.h @@ -51,7 +51,7 @@ class QDepthTest; class QNormalDiffuseMapAlphaMaterialPrivate: public QNormalDiffuseMapMaterialPrivate { public: - QNormalDiffuseMapAlphaMaterialPrivate(QNormalDiffuseMapAlphaMaterial *qq); + QNormalDiffuseMapAlphaMaterialPrivate(); void init() Q_DECL_OVERRIDE; diff --git a/src/render/defaults/qnormaldiffusemapmaterial.cpp b/src/render/defaults/qnormaldiffusemapmaterial.cpp index 314916198..136e3d94a 100644 --- a/src/render/defaults/qnormaldiffusemapmaterial.cpp +++ b/src/render/defaults/qnormaldiffusemapmaterial.cpp @@ -53,8 +53,12 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -QNormalDiffuseMapMaterialPrivate::QNormalDiffuseMapMaterialPrivate(QNormalDiffuseMapMaterial *qq) - : QMaterialPrivate(qq) +/*! + \class Qt3D::QNormalDiffuseMapMaterialPrivate + \internal +*/ +QNormalDiffuseMapMaterialPrivate::QNormalDiffuseMapMaterialPrivate() + : QMaterialPrivate() , m_normalDiffuseEffect(new QEffect()) , m_diffuseTexture(new QTexture2D()) , m_normalTexture(new QTexture2D()) @@ -158,7 +162,7 @@ void QNormalDiffuseMapMaterialPrivate::init() Constructs a new Qt3D::QNormalDiffuseMapMaterial instance with parent object \a parent. */ QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNode *parent) - : QMaterial(*new QNormalDiffuseMapMaterialPrivate(this), parent) + : QMaterial(*new QNormalDiffuseMapMaterialPrivate, parent) { Q_D(QNormalDiffuseMapMaterial); QObject::connect(d->m_ambientParameter, SIGNAL(valueChanged()), this, SIGNAL(ambientChanged())); @@ -170,6 +174,7 @@ QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNode *parent) d->init(); } +/*! \internal */ QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNormalDiffuseMapMaterialPrivate &dd, QNode *parent) : QMaterial(dd, parent) { @@ -183,15 +188,18 @@ QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNormalDiffuseMapMaterialPr d->init(); } +/*! + Destroys the QNormalDiffuseMapMaterial instance. +*/ QNormalDiffuseMapMaterial::~QNormalDiffuseMapMaterial() { } /*! - \property QNormalDiffuseMapMaterial::ambient + \property Qt3D::QNormalDiffuseMapMaterial::ambient - Holds the current QColor ambient value. - */ + Holds the current ambient color. +*/ QColor QNormalDiffuseMapMaterial::ambient() const { Q_D(const QNormalDiffuseMapMaterial); @@ -199,10 +207,10 @@ QColor QNormalDiffuseMapMaterial::ambient() const } /*! - \property QNormalDiffuseMapMaterial::specular + \property Qt3D::QNormalDiffuseMapMaterial::specular - Holds the current QColor specular value. - */ + Holds the current specular color. +*/ QColor QNormalDiffuseMapMaterial::specular() const { Q_D(const QNormalDiffuseMapMaterial); @@ -210,15 +218,19 @@ QColor QNormalDiffuseMapMaterial::specular() const } /*! - \property *QNormalDiffuseMapMaterial::diffuse + \property Qt3D::QNormalDiffuseMapMaterial::diffuse Holds the current diffuse map texture. - \note By default the diffuse texture has a linear - magnification filter, a linear mipmap linear minification filter, - the wrap mode is repeat, the maximum anisotropy is set to 16.0 - and mipmapping is enabled. - */ + By default, the diffuse texture has these properties: + + \list + \li Linear minification and magnification filters + \li Linear mipmap with mipmapping enabled + \li Repeat wrap modeM + \li Maximum anisotropy of 16.0 + \endlist +*/ QAbstractTextureProvider *QNormalDiffuseMapMaterial::diffuse() const { Q_D(const QNormalDiffuseMapMaterial); @@ -226,14 +238,18 @@ QAbstractTextureProvider *QNormalDiffuseMapMaterial::diffuse() const } /*! - \property *QNormalDiffuseMapMaterial::normal + \property Qt3D::QNormalDiffuseMapMaterial::normal Holds the current normal map texture. - \note By default the normal texture has linear minification - and magnification filters, the wrap mode is repeat and maximum anisotropy - is set to 16.0. - */ + 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 +*/ QAbstractTextureProvider *QNormalDiffuseMapMaterial::normal() const { Q_D(const QNormalDiffuseMapMaterial); @@ -241,10 +257,10 @@ QAbstractTextureProvider *QNormalDiffuseMapMaterial::normal() const } /*! - \property QNormalDiffuseMapMaterial::shininess + \property Qt3D::QNormalDiffuseMapMaterial::shininess Holds the current shininess as a float value. - */ +*/ float QNormalDiffuseMapMaterial::shininess() const { Q_D(const QNormalDiffuseMapMaterial); @@ -252,10 +268,10 @@ float QNormalDiffuseMapMaterial::shininess() const } /*! - \property QNormalDiffuseMapMaterial::textureScale + \property Qt3D::QNormalDiffuseMapMaterial::textureScale - Holds the current texture scale. - */ + Holds the current texture scale as a float value. +*/ float QNormalDiffuseMapMaterial::textureScale() const { Q_D(const QNormalDiffuseMapMaterial); diff --git a/src/render/defaults/qnormaldiffusemapmaterial_p.h b/src/render/defaults/qnormaldiffusemapmaterial_p.h index 2b92a3158..ccf986074 100644 --- a/src/render/defaults/qnormaldiffusemapmaterial_p.h +++ b/src/render/defaults/qnormaldiffusemapmaterial_p.h @@ -56,7 +56,7 @@ class QNormalDiffuseMapMaterial; class QNormalDiffuseMapMaterialPrivate: public QMaterialPrivate { public: - QNormalDiffuseMapMaterialPrivate(QNormalDiffuseMapMaterial *qq); + QNormalDiffuseMapMaterialPrivate(); virtual void init(); diff --git a/src/render/defaults/qnormaldiffusespecularmapmaterial.cpp b/src/render/defaults/qnormaldiffusespecularmapmaterial.cpp index 57b422cff..3e30bee27 100644 --- a/src/render/defaults/qnormaldiffusespecularmapmaterial.cpp +++ b/src/render/defaults/qnormaldiffusespecularmapmaterial.cpp @@ -52,8 +52,12 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -QNormalDiffuseSpecularMapMaterialPrivate::QNormalDiffuseSpecularMapMaterialPrivate(QNormalDiffuseSpecularMapMaterial *qq) - : QMaterialPrivate(qq) +/*! + \class Qt3D::QNormalDiffuseSpecularMapMaterialPrivate + \internal +*/ +QNormalDiffuseSpecularMapMaterialPrivate::QNormalDiffuseSpecularMapMaterialPrivate() + : QMaterialPrivate() , m_normalDiffuseSpecularEffect(new QEffect()) , m_diffuseTexture(new QTexture2D()) , m_normalTexture(new QTexture2D()) @@ -164,7 +168,7 @@ void QNormalDiffuseSpecularMapMaterialPrivate::init() Constructs a new Qt3D::QNormalDiffuseSpecularMapMaterial instance with parent object \a parent. */ QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNode *parent) - : QMaterial(*new QNormalDiffuseSpecularMapMaterialPrivate(this), parent) + : QMaterial(*new QNormalDiffuseSpecularMapMaterialPrivate, parent) { Q_D(QNormalDiffuseSpecularMapMaterial); QObject::connect(d->m_ambientParameter, SIGNAL(valueChanged()), this, SIGNAL(ambientChanged())); @@ -176,7 +180,7 @@ QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNode *pare d->init(); } - +/*! \internal */ QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNormalDiffuseSpecularMapMaterialPrivate &dd, QNode *parent) : QMaterial(dd, parent) { @@ -190,15 +194,18 @@ QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNormalDiff d->init(); } +/*! + Destroys the Qt3D::QNormalDiffuseSpecularMapMaterial instance. +*/ QNormalDiffuseSpecularMapMaterial::~QNormalDiffuseSpecularMapMaterial() { } /*! - \property NormalDiffuseSpecularMapMaterial::ambient + \property Qt3D::QNormalDiffuseSpecularMapMaterial::ambient - Holds the current QColor ambient value. - */ + Holds the current ambient color. +*/ QColor QNormalDiffuseSpecularMapMaterial::ambient() const { Q_D(const QNormalDiffuseSpecularMapMaterial); @@ -206,15 +213,19 @@ QColor QNormalDiffuseSpecularMapMaterial::ambient() const } /*! - \property *QNormalDiffuseSpecularMapMaterial::diffuse + \property Qt3D::QNormalDiffuseSpecularMapMaterial::diffuse Holds the current diffuse map texture. - \note By default the diffuse texture has a linear - magnification filter, a linear mipmap linear minification filter, - the wrap mode is repeat, the maximum anisotropy is set to 16.0 - and mipmapping is enabled. - */ + 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 +*/ QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::diffuse() const { Q_D(const QNormalDiffuseSpecularMapMaterial); @@ -222,14 +233,18 @@ QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::diffuse() const } /*! - \property QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::normal + \property Qt3D::QNormalDiffuseSpecularMapMaterial::normal Holds the current normal map texture. - \note By default the normal texture has linear minification - and magnification filters, the wrap mode is repeat and maximum anisotropy - is set to 16.0. - */ + 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 +*/ QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::normal() const { Q_D(const QNormalDiffuseSpecularMapMaterial); @@ -237,15 +252,19 @@ QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::normal() const } /*! - \property *QNormalDiffuseSpecularMapMaterial::specular + \property Qt3D::QNormalDiffuseSpecularMapMaterial::specular Holds the current specular map texture. - \note By default the specular texture has a linear - magnification filter, a linear mipmap linear minification filter, - the wrap mode is repeat, the maximum anisotropy is set to 16.0 - and mipmapping is enabled. - */ + 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 +*/ QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::specular() const { Q_D(const QNormalDiffuseSpecularMapMaterial); @@ -253,10 +272,10 @@ QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::specular() const } /*! - \property QNormalDiffuseSpecularMapMaterial::shininess + \property Qt3D::QNormalDiffuseSpecularMapMaterial::shininess Holds the current shininess as a float value. - */ +*/ float QNormalDiffuseSpecularMapMaterial::shininess() const { Q_D(const QNormalDiffuseSpecularMapMaterial); @@ -264,10 +283,10 @@ float QNormalDiffuseSpecularMapMaterial::shininess() const } /*! - \property QNormalDiffuseSpecularMapMaterial::textureScale + \property Qt3D::QNormalDiffuseSpecularMapMaterial::textureScale - Holds the current texture scale. - */ + Holds the current texture scale as a float value. +*/ float QNormalDiffuseSpecularMapMaterial::textureScale() const { Q_D(const QNormalDiffuseSpecularMapMaterial); diff --git a/src/render/defaults/qnormaldiffusespecularmapmaterial_p.h b/src/render/defaults/qnormaldiffusespecularmapmaterial_p.h index b18401078..82187eabc 100644 --- a/src/render/defaults/qnormaldiffusespecularmapmaterial_p.h +++ b/src/render/defaults/qnormaldiffusespecularmapmaterial_p.h @@ -56,7 +56,7 @@ class QNormalDiffuseSpecularMapMaterial; class QNormalDiffuseSpecularMapMaterialPrivate : public QMaterialPrivate { public: - QNormalDiffuseSpecularMapMaterialPrivate(QNormalDiffuseSpecularMapMaterial *qq); + QNormalDiffuseSpecularMapMaterialPrivate(); void init(); diff --git a/src/render/defaults/qpervertexcolormaterial.cpp b/src/render/defaults/qpervertexcolormaterial.cpp index e2bc66f86..c1c68ce0e 100644 --- a/src/render/defaults/qpervertexcolormaterial.cpp +++ b/src/render/defaults/qpervertexcolormaterial.cpp @@ -51,8 +51,12 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate(QPerVertexColorMaterial *qq) - : QMaterialPrivate(qq) +/*! + \class Qt3D::QPerVertexColorMaterialPrivate + \internal +*/ +QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate() + : QMaterialPrivate() , m_vertexEffect(new QEffect()) , m_lightPositionParameter(new QParameter(QStringLiteral("lightPosition"), QVector4D(1.0f, 1.0f, 0.0f, 1.0f))) , m_lightIntensityParameter(new QParameter(QStringLiteral("lightIntensity"), QVector3D(1.0f, 1.0f, 1.0f))) @@ -91,7 +95,7 @@ QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate(QPerVertexColorMa Constructs a new QPerVertexColorMaterial instance with parent object \a parent. */ QPerVertexColorMaterial::QPerVertexColorMaterial(QNode *parent) - : QMaterial(*new QPerVertexColorMaterialPrivate(this), parent) + : QMaterial(*new QPerVertexColorMaterialPrivate, parent) { Q_D(QPerVertexColorMaterial); d->init(); diff --git a/src/render/defaults/qpervertexcolormaterial_p.h b/src/render/defaults/qpervertexcolormaterial_p.h index 72a5d5b22..8fdd4ce95 100644 --- a/src/render/defaults/qpervertexcolormaterial_p.h +++ b/src/render/defaults/qpervertexcolormaterial_p.h @@ -55,7 +55,7 @@ class QPerVertexColorMaterial; class QPerVertexColorMaterialPrivate : public QMaterialPrivate { public: - QPerVertexColorMaterialPrivate(QPerVertexColorMaterial *qq); + QPerVertexColorMaterialPrivate(); void init(); diff --git a/src/render/defaults/qphongmaterial.cpp b/src/render/defaults/qphongmaterial.cpp index a6e336776..43e9f298c 100644 --- a/src/render/defaults/qphongmaterial.cpp +++ b/src/render/defaults/qphongmaterial.cpp @@ -51,8 +51,12 @@ QT_BEGIN_NAMESPACE namespace Qt3D { -QPhongMaterialPrivate::QPhongMaterialPrivate(QPhongMaterial *qq) - : QMaterialPrivate(qq) +/*! + \class Qt3D::QPhongMaterialPrivate + \internal +*/ +QPhongMaterialPrivate::QPhongMaterialPrivate() + : QMaterialPrivate() , m_phongEffect(new QEffect()) , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f))) , m_diffuseParameter(new QParameter(QStringLiteral("kd"), QColor::fromRgbF(0.7f, 0.7f, 0.7f, 1.0f))) @@ -97,7 +101,7 @@ QPhongMaterialPrivate::QPhongMaterialPrivate(QPhongMaterial *qq) Constructs a new QPhongMaterial instance with parent object \a parent. */ QPhongMaterial::QPhongMaterial(QNode *parent) - : QMaterial(*new QPhongMaterialPrivate(this), parent) + : QMaterial(*new QPhongMaterialPrivate, parent) { Q_D(QPhongMaterial); QObject::connect(d->m_ambientParameter, SIGNAL(valueChanged()), this, SIGNAL(ambientChanged())); @@ -110,16 +114,16 @@ QPhongMaterial::QPhongMaterial(QNode *parent) /*! \fn Qt3D::QPhongMaterial::~QPhongMaterial() - Destroys the QPhongMaterial + Destroys the QPhongMaterial. */ QPhongMaterial::~QPhongMaterial() { } /*! - \fn QColor Qt3D::QPhongMaterial::ambient() const + \property Qt3D::QPhongMaterial::ambient - Returns the ambient color. + Holds the ambient color. */ QColor QPhongMaterial::ambient() const { @@ -128,9 +132,9 @@ QColor QPhongMaterial::ambient() const } /*! - \fn QColor Qt3D::QPhongMaterial::diffuse() const + \property Qt3D::QPhongMaterial::diffuse - Returns the diffuse color. + Holds the diffuse color. */ QColor QPhongMaterial::diffuse() const { @@ -139,9 +143,9 @@ QColor QPhongMaterial::diffuse() const } /*! - \fn QColor Qt3D::QPhongMaterial::specular() const + \property QColor Qt3D::QPhongMaterial::specular - Returns the specular color. + Holds the specular color. */ QColor QPhongMaterial::specular() const { @@ -150,9 +154,9 @@ QColor QPhongMaterial::specular() const } /*! - \fn Qt3D::QPhongMaterial::shininess() const + \property Qt3D::QPhongMaterial::shininess - Returns the shininess exponent. + Holds the shininess exponent. */ float QPhongMaterial::shininess() const { @@ -160,44 +164,24 @@ float QPhongMaterial::shininess() const return d->m_shininessParameter->value().toFloat(); } -/*! - \fn Qt3D::QPhongMaterial::setAmbient(const QColor &ambient) - - Sets the current ambient color to \a ambient. -*/ void QPhongMaterial::setAmbient(const QColor &ambient) { Q_D(QPhongMaterial); - d->m_shininessParameter->setValue(ambient); + d->m_ambientParameter->setValue(ambient); } -/*! - \fn Qt3D::QPhongMaterial::setDiffuse(const QColor &diffuse) - - Sets the current diffuse color to \a diffuse. -*/ void QPhongMaterial::setDiffuse(const QColor &diffuse) { Q_D(QPhongMaterial); d->m_diffuseParameter->setValue(diffuse); } -/*! - \fn Qt3D::QPhongMaterial::setSpecular(const QColor &specular) - - Sets the current specular color to \a specular. -*/ void QPhongMaterial::setSpecular(const QColor &specular) { Q_D(QPhongMaterial); d->m_specularParameter->setValue(specular); } -/*! - \fn Qt3D::QPhongMaterial::setShininess(float shininess) - - Sets the current shininess exponent to \a shininess. -*/ void QPhongMaterial::setShininess(float shininess) { Q_D(QPhongMaterial); diff --git a/src/render/defaults/qphongmaterial_p.h b/src/render/defaults/qphongmaterial_p.h index b59f6c229..be6af94cd 100644 --- a/src/render/defaults/qphongmaterial_p.h +++ b/src/render/defaults/qphongmaterial_p.h @@ -55,7 +55,7 @@ class QPhongMaterial; class QPhongMaterialPrivate : public QMaterialPrivate { public: - QPhongMaterialPrivate(QPhongMaterial *qq); + QPhongMaterialPrivate(); void init(); diff --git a/src/render/defaults/qskyboxentity.cpp b/src/render/defaults/qskyboxentity.cpp new file mode 100644 index 000000000..457fa746a --- /dev/null +++ b/src/render/defaults/qskyboxentity.cpp @@ -0,0 +1,284 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qskyboxentity.h" +#include "qskyboxentity_p.h" + +#include <Qt3DCore/qtransform.h> +#include <Qt3DRenderer/qeffect.h> +#include <Qt3DRenderer/qtexture.h> +#include <Qt3DRenderer/qmaterial.h> +#include <Qt3DRenderer/qcullface.h> +#include <Qt3DRenderer/qdepthtest.h> +#include <Qt3DRenderer/qparameter.h> +#include <Qt3DRenderer/qtechnique.h> +#include <Qt3DRenderer/qcuboidmesh.h> +#include <Qt3DRenderer/qrenderpass.h> +#include <Qt3DRenderer/qopenglfilter.h> +#include <Qt3DRenderer/qshaderprogram.h> +#include <Qt3DCore/qtranslatetransform.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + + +/*! + * \class Qt3D::QSkyboxEntityPrivate + * \internal + */ +QSkyboxEntityPrivate::QSkyboxEntityPrivate() + : QEntityPrivate() + , m_effect(new QEffect()) + , m_material(new QMaterial()) + , m_skyboxTexture(new QTextureCubeMap()) + , m_gl3Shader(new QShaderProgram()) + , m_gl2es2Shader(new QShaderProgram()) + , m_gl2Technique(new QTechnique()) + , m_es2Technique(new QTechnique()) + , m_gl3Technique(new QTechnique()) + , m_gl2RenderPass(new QRenderPass()) + , m_es2RenderPass(new QRenderPass()) + , m_gl3RenderPass(new QRenderPass()) + , m_mesh(new QCuboidMesh()) + , m_transform(new QTransform()) + , m_translate(new QTranslateTransform()) + , m_textureParameter(new QParameter(QStringLiteral("skyboxTexture"), m_skyboxTexture)) + , m_posXImage(new QTextureImage()) + , m_posYImage(new QTextureImage()) + , m_posZImage(new QTextureImage()) + , m_negXImage(new QTextureImage()) + , m_negYImage(new QTextureImage()) + , m_negZImage(new QTextureImage()) + , m_extension(QStringLiteral(".png")) +{ +} + +/*! + * \internal + */ +void QSkyboxEntityPrivate::init() +{ + m_gl3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/skybox.vert")))); + m_gl3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/skybox.frag")))); + m_gl2es2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/skybox.vert")))); + m_gl2es2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/skybox.frag")))); + + m_gl3Technique->openGLFilter()->setApi(QOpenGLFilter::Desktop); + m_gl3Technique->openGLFilter()->setMajorVersion(3); + m_gl3Technique->openGLFilter()->setMajorVersion(1); + m_gl3Technique->openGLFilter()->setProfile(QOpenGLFilter::Core); + + m_gl2Technique->openGLFilter()->setApi(QOpenGLFilter::Desktop); + m_gl2Technique->openGLFilter()->setMajorVersion(2); + m_gl2Technique->openGLFilter()->setMajorVersion(0); + m_gl2Technique->openGLFilter()->setProfile(QOpenGLFilter::None); + + m_es2Technique->openGLFilter()->setApi(QOpenGLFilter::ES); + m_es2Technique->openGLFilter()->setMajorVersion(2); + m_es2Technique->openGLFilter()->setMajorVersion(0); + m_es2Technique->openGLFilter()->setProfile(QOpenGLFilter::None); + + m_gl3RenderPass->setShaderProgram(m_gl3Shader); + m_gl2RenderPass->setShaderProgram(m_gl2es2Shader); + m_es2RenderPass->setShaderProgram(m_gl2es2Shader); + + QCullFace *cullFront = new QCullFace(); + cullFront->setMode(QCullFace::Front); + QDepthTest *depthTest = new QDepthTest(); + depthTest->setFunc(QDepthTest::LessOrEqual); + + m_gl3RenderPass->addRenderState(cullFront); + m_gl3RenderPass->addRenderState(depthTest); + m_gl2RenderPass->addRenderState(cullFront); + m_gl2RenderPass->addRenderState(depthTest); + m_es2RenderPass->addRenderState(cullFront); + m_es2RenderPass->addRenderState(depthTest); + + m_gl3Technique->addPass(m_gl3RenderPass); + m_gl2Technique->addPass(m_gl2RenderPass); + m_es2Technique->addPass(m_es2RenderPass); + + m_effect->addTechnique(m_gl3Technique); + m_effect->addTechnique(m_gl2Technique); + m_effect->addTechnique(m_es2Technique); + + m_material->setEffect(m_effect); + m_material->addParameter(m_textureParameter); + + m_transform->addTransform(m_translate); + + m_mesh->setXYMeshResolution(QSize(2, 2)); + m_mesh->setXZMeshResolution(QSize(2, 2)); + m_mesh->setYZMeshResolution(QSize(2, 2)); + + m_posXImage->setCubeMapFace(QTextureCubeMap::CubeMapPositiveX); + m_posYImage->setCubeMapFace(QTextureCubeMap::CubeMapPositiveY); + m_posZImage->setCubeMapFace(QTextureCubeMap::CubeMapPositiveZ); + m_negXImage->setCubeMapFace(QTextureCubeMap::CubeMapNegativeX); + m_negYImage->setCubeMapFace(QTextureCubeMap::CubeMapNegativeY); + m_negZImage->setCubeMapFace(QTextureCubeMap::CubeMapNegativeZ); + + m_skyboxTexture->setMagnificationFilter(QTextureCubeMap::Linear); + m_skyboxTexture->setMinificationFilter(QTextureCubeMap::Linear); + m_skyboxTexture->setGenerateMipMaps(false); + m_skyboxTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::ClampToEdge)); + + m_skyboxTexture->addTextureImage(m_posXImage); + m_skyboxTexture->addTextureImage(m_posYImage); + m_skyboxTexture->addTextureImage(m_posZImage); + m_skyboxTexture->addTextureImage(m_negXImage); + m_skyboxTexture->addTextureImage(m_negYImage); + m_skyboxTexture->addTextureImage(m_negZImage); + + q_func()->addComponent(m_mesh); + q_func()->addComponent(m_material); + q_func()->addComponent(m_transform); +} + +/*! + * \internal + */ +void QSkyboxEntityPrivate::reloadTexture() +{ + m_posXImage->setSource(QUrl(m_baseName + QStringLiteral("_posx") + m_extension)); + m_posYImage->setSource(QUrl(m_baseName + QStringLiteral("_posy") + m_extension)); + m_posZImage->setSource(QUrl(m_baseName + QStringLiteral("_posz") + m_extension)); + m_negXImage->setSource(QUrl(m_baseName + QStringLiteral("_negx") + m_extension)); + m_negYImage->setSource(QUrl(m_baseName + QStringLiteral("_negy") + m_extension)); + m_negZImage->setSource(QUrl(m_baseName + QStringLiteral("_negz") + m_extension)); +} + +/*! + * \class Qt3D::QSkyboxEntity + * + * \brief Qt3D::QSkyboxEntity is a convenience Qt3D::QEntity subclass that can + * be used to insert a skybox in a 3D scene. + * + * By specifying a base name and an extension, Qt3D::QSkyboxEntity + * will take care of building a TextureCubeMap to be rendered at runtime. The + * images in the source directory should match the pattern: + * \b base name + * "_posx|_posy|_posz|_negx|_negy|_negz" + extension + * + * By default the extension defaults to .png. + * + * \note Please note that you shouldn't try to render skybox with an + * orthographic projection. + * + * \since 5.5 + */ + +/*! + * Constructs a new Qt3D::QSkyboxEntity object with \a parent as parent. + */ +QSkyboxEntity::QSkyboxEntity(QNode *parent) + : QEntity(*new QSkyboxEntityPrivate, parent) +{ + d_func()->init(); +} + +QSkyboxEntity::~QSkyboxEntity() +{ +} + +/*! + * Sets the base name to \a baseName. + */ +void QSkyboxEntity::setBaseName(const QString &baseName) +{ + Q_D(QSkyboxEntity); + if (baseName != d->m_baseName) { + d->m_baseName = baseName; + emit sourceDirectoryChanged(); + d->reloadTexture(); + } +} +/*! + * Returns the base name. + */ +QString QSkyboxEntity::baseName() const +{ + Q_D(const QSkyboxEntity); + return d->m_baseName; +} + +/*! + * Sets the extension to \a extension. + */ +void QSkyboxEntity::setExtension(const QString &extension) +{ + Q_D(QSkyboxEntity); + if (extension != d->m_extension) { + d->m_extension = extension; + emit extensionChanged(); + d->reloadTexture(); + } +} + +/*! + * Returns the extension + */ +QString QSkyboxEntity::extension() const +{ + Q_D(const QSkyboxEntity); + return d->m_extension; +} + +/*! + * Sets the camera position to \a cameraPosition. + */ +void QSkyboxEntity::setCameraPosition(const QVector3D &cameraPosition) +{ + Q_D(QSkyboxEntity); + if (cameraPosition != d->m_position) { + d->m_position = cameraPosition; + d->m_translate->setTranslation(d->m_position); + emit cameraPositionChanged(); + } +} + +/*! + * Returns the camera postion. + */ +QVector3D QSkyboxEntity::cameraPosition() const +{ + Q_D(const QSkyboxEntity); + return d->m_position; +} + +} // Qt3D + +QT_END_NAMESPACE diff --git a/src/render/defaults/qskyboxentity.h b/src/render/defaults/qskyboxentity.h new file mode 100644 index 000000000..f2e7a76cb --- /dev/null +++ b/src/render/defaults/qskyboxentity.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_RENDER_QSKYBOXENTITY_H +#define QT3D_RENDER_QSKYBOXENTITY_H + +#include <Qt3DCore/qentity.h> +#include <Qt3DRenderer/qt3drenderer_global.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QSkyboxEntityPrivate; + +class QT3DRENDERERSHARED_EXPORT QSkyboxEntity : public QEntity +{ + Q_OBJECT +public: + explicit QSkyboxEntity(QNode *parent = 0); + ~QSkyboxEntity(); + + void setBaseName(const QString &path); + QString baseName() const; + + void setExtension(const QString &extension); + QString extension() const; + + void setCameraPosition(const QVector3D &cameraPosition); + QVector3D cameraPosition() const; + +Q_SIGNALS: + void sourceDirectoryChanged(); + void extensionChanged(); + void cameraPositionChanged(); + +private: + Q_DECLARE_PRIVATE(QSkyboxEntity) +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_RENDER_QSKYBOXENTITY_H diff --git a/src/render/defaults/qskyboxentity_p.h b/src/render/defaults/qskyboxentity_p.h new file mode 100644 index 000000000..a377dd520 --- /dev/null +++ b/src/render/defaults/qskyboxentity_p.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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.LGPLv3 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.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 later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_RENDER_QSKYBOXENTITY_P_H +#define QT3D_RENDER_QSKYBOXENTITY_P_H + +#include <Qt3DCore/private/qentity_p.h> +#include <QVector3D> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +class QTranslateTransform; +class QTextureCubeMap; +class QShaderProgram; +class QSkyboxEntity; +class QTextureImage; +class QCuboidMesh; +class QRenderPass; +class QTechnique; +class QTransform; +class QParameter; +class QMaterial; +class QEffect; + +class QSkyboxEntityPrivate : public QEntityPrivate +{ + QSkyboxEntityPrivate(); + + void init(); + void reloadTexture(); + + Q_DECLARE_PUBLIC(QSkyboxEntity) + + QEffect *m_effect; + QMaterial *m_material; + QTextureCubeMap *m_skyboxTexture; + QShaderProgram *m_gl3Shader; + QShaderProgram *m_gl2es2Shader; + QTechnique *m_gl2Technique; + QTechnique *m_es2Technique; + QTechnique *m_gl3Technique; + QRenderPass *m_gl2RenderPass; + QRenderPass *m_es2RenderPass; + QRenderPass *m_gl3RenderPass; + QCuboidMesh *m_mesh; + QTransform *m_transform; + QTranslateTransform *m_translate; + QParameter *m_textureParameter; + QTextureImage *m_posXImage; + QTextureImage *m_posYImage; + QTextureImage *m_posZImage; + QTextureImage *m_negXImage; + QTextureImage *m_negYImage; + QTextureImage *m_negZImage; + QString m_extension; + QString m_baseName; + QVector3D m_position; +}; + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_RENDER_QSKYBOXENTITY_P_H + |