diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-02-02 14:03:09 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-02-02 15:33:35 +0000 |
commit | 43bb067fc3ec8217ba1064169d9ffdc7e21af7d5 (patch) | |
tree | aae78d3fc5845b3e0220c3a2f3e04dd8d3476e16 /src/render/defaults/qdiffusespecularmapmaterial.cpp | |
parent | 75832ffd01c64e30d43e5ff4d13a879750e00cbb (diff) |
Remove default uniform values for lightPosition and intensity
The ES2 variants of the shaders have a default uniform value of 0.
To be compatible with the other versions, start specifying the
values for lightPosition and Intensity from C++, just like we already
do from QML. This way the default values are coming from one single
unified place regardless of the shader version in use, and examples
like simple-cpp will work identically to simple-qml, even on ES2.
Change-Id: If60185d0d3039e4354da8cc6e6b21a0db0bae963
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/defaults/qdiffusespecularmapmaterial.cpp')
-rw-r--r-- | src/render/defaults/qdiffusespecularmapmaterial.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/render/defaults/qdiffusespecularmapmaterial.cpp b/src/render/defaults/qdiffusespecularmapmaterial.cpp index 1784250b4..864d1ed22 100644 --- a/src/render/defaults/qdiffusespecularmapmaterial.cpp +++ b/src/render/defaults/qdiffusespecularmapmaterial.cpp @@ -51,6 +51,8 @@ #include <Qt3DRenderer/qrenderpass.h> #include <Qt3DRenderer/qopenglfilter.h> #include <QUrl> +#include <QVector3D> +#include <QVector4D> QT_BEGIN_NAMESPACE @@ -65,6 +67,8 @@ QDiffuseSpecularMapMaterialPrivate::QDiffuseSpecularMapMaterialPrivate(QDiffuseS , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture)) , m_specularParameter(new QParameter(QStringLiteral("specularTexture"), m_specularTexture)) , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f)) + , 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))) , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f)) , m_diffuseSpecularMapGL3Technique(new QTechnique()) , m_diffuseSpecularMapGL2Technique(new QTechnique()) @@ -126,6 +130,8 @@ void QDiffuseSpecularMapMaterialPrivate::init() m_diffuseSpecularMapEffect->addParameter(m_diffuseParameter); m_diffuseSpecularMapEffect->addParameter(m_specularParameter); m_diffuseSpecularMapEffect->addParameter(m_shininessParameter); + m_diffuseSpecularMapEffect->addParameter(m_lightPositionParameter); + m_diffuseSpecularMapEffect->addParameter(m_lightIntensityParameter); m_diffuseSpecularMapEffect->addParameter(m_textureScaleParameter); static_cast<QMaterial *>(q_ptr)->setEffect(m_diffuseSpecularMapEffect); |