**
****************************************************************************/
-#include <private/qsgshadereffectnode_p.h>
+#include <private/qquickshadereffectnode_p.h>
-#include "qsgshadereffectmesh_p.h"
+#include "qquickshadereffectmesh_p.h"
#include <private/qsgtextureprovider_p.h>
#include <private/qsgrenderer_p.h>
QT_BEGIN_NAMESPACE
-class QSGCustomMaterialShader : public QSGMaterialShader
+class QQuickCustomMaterialShader : public QSGMaterialShader
{
public:
- QSGCustomMaterialShader(const QSGShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes);
+ QQuickCustomMaterialShader(const QQuickShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes);
virtual void deactivate();
virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect);
virtual char const *const *attributeNames() const;
protected:
- friend class QSGShaderEffectNode;
+ friend class QQuickShaderEffectNode;
virtual void initialize();
virtual const char *vertexShader() const;
virtual const char *fragmentShader() const;
- const QSGShaderEffectMaterialKey m_key;
+ const QQuickShaderEffectMaterialKey m_key;
QVector<const char *> m_attributeNames;
const QVector<QByteArray> m_attributes;
uint m_textureIndicesSet;
};
-QSGCustomMaterialShader::QSGCustomMaterialShader(const QSGShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes)
+QQuickCustomMaterialShader::QQuickCustomMaterialShader(const QQuickShaderEffectMaterialKey &key, const QVector<QByteArray> &attributes)
: m_key(key)
, m_attributes(attributes)
, m_textureIndicesSet(false)
m_attributeNames.append(0);
}
-void QSGCustomMaterialShader::deactivate()
+void QQuickCustomMaterialShader::deactivate()
{
QSGMaterialShader::deactivate();
glDisable(GL_CULL_FACE);
}
-void QSGCustomMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
+void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
Q_ASSERT(newEffect != 0);
- const QSGShaderEffectMaterial *material = static_cast<const QSGShaderEffectMaterial *>(newEffect);
+ const QQuickShaderEffectMaterial *material = static_cast<const QQuickShaderEffectMaterial *>(newEffect);
if (!m_textureIndicesSet) {
for (int i = 0; i < material->m_textures.size(); ++i)
}
}
- const QSGShaderEffectMaterial *oldMaterial = static_cast<const QSGShaderEffectMaterial *>(oldEffect);
+ const QQuickShaderEffectMaterial *oldMaterial = static_cast<const QQuickShaderEffectMaterial *>(oldEffect);
if (oldEffect == 0 || material->cullMode() != oldMaterial->cullMode()) {
switch (material->cullMode()) {
- case QSGShaderEffectMaterial::FrontFaceCulling:
+ case QQuickShaderEffectMaterial::FrontFaceCulling:
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
break;
- case QSGShaderEffectMaterial::BackFaceCulling:
+ case QQuickShaderEffectMaterial::BackFaceCulling:
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
break;
program()->setUniformValue(m_matrixLoc, state.combinedMatrix());
}
-char const *const *QSGCustomMaterialShader::attributeNames() const
+char const *const *QQuickCustomMaterialShader::attributeNames() const
{
return m_attributeNames.constData();
}
-void QSGCustomMaterialShader::initialize()
+void QQuickCustomMaterialShader::initialize()
{
m_opacityLoc = program()->uniformLocation("qt_Opacity");
m_matrixLoc = program()->uniformLocation("qt_Matrix");
m_matrixLoc = program()->uniformLocation("qt_ModelViewProjectionMatrix");
}
-const char *QSGCustomMaterialShader::vertexShader() const
+const char *QQuickCustomMaterialShader::vertexShader() const
{
return m_key.vertexCode.constData();
}
-const char *QSGCustomMaterialShader::fragmentShader() const
+const char *QQuickCustomMaterialShader::fragmentShader() const
{
return m_key.fragmentCode.constData();
}
-bool QSGShaderEffectMaterialKey::operator == (const QSGShaderEffectMaterialKey &other) const
+bool QQuickShaderEffectMaterialKey::operator == (const QQuickShaderEffectMaterialKey &other) const
{
return vertexCode == other.vertexCode && fragmentCode == other.fragmentCode && className == other.className;
}
-uint qHash(const QSGShaderEffectMaterialKey &key)
+uint qHash(const QQuickShaderEffectMaterialKey &key)
{
return qHash(qMakePair(qMakePair(key.vertexCode, key.fragmentCode), key.className));
}
-QHash<QSGShaderEffectMaterialKey, QSharedPointer<QSGMaterialType> > QSGShaderEffectMaterial::materialMap;
+QHash<QQuickShaderEffectMaterialKey, QSharedPointer<QSGMaterialType> > QQuickShaderEffectMaterial::materialMap;
-QSGShaderEffectMaterial::QSGShaderEffectMaterial()
+QQuickShaderEffectMaterial::QQuickShaderEffectMaterial()
: m_cullMode(NoCulling)
{
setFlag(Blending, true);
}
-QSGMaterialType *QSGShaderEffectMaterial::type() const
+QSGMaterialType *QQuickShaderEffectMaterial::type() const
{
return m_type.data();
}
-QSGMaterialShader *QSGShaderEffectMaterial::createShader() const
+QSGMaterialShader *QQuickShaderEffectMaterial::createShader() const
{
- return new QSGCustomMaterialShader(m_source, m_source.attributeNames);
+ return new QQuickCustomMaterialShader(m_source, m_source.attributeNames);
}
-int QSGShaderEffectMaterial::compare(const QSGMaterial *other) const
+int QQuickShaderEffectMaterial::compare(const QSGMaterial *other) const
{
- return this - static_cast<const QSGShaderEffectMaterial *>(other);
+ return this - static_cast<const QQuickShaderEffectMaterial *>(other);
}
-void QSGShaderEffectMaterial::setCullMode(QSGShaderEffectMaterial::CullMode face)
+void QQuickShaderEffectMaterial::setCullMode(QQuickShaderEffectMaterial::CullMode face)
{
m_cullMode = face;
}
-QSGShaderEffectMaterial::CullMode QSGShaderEffectMaterial::cullMode() const
+QQuickShaderEffectMaterial::CullMode QQuickShaderEffectMaterial::cullMode() const
{
return m_cullMode;
}
-void QSGShaderEffectMaterial::setProgramSource(const QSGShaderEffectProgram &source)
+void QQuickShaderEffectMaterial::setProgramSource(const QQuickShaderEffectProgram &source)
{
m_source = source;
m_type = materialMap.value(m_source);
}
}
-void QSGShaderEffectMaterial::setUniforms(const QVector<QPair<QByteArray, QVariant> > &uniformValues)
+void QQuickShaderEffectMaterial::setUniforms(const QVector<QPair<QByteArray, QVariant> > &uniformValues)
{
m_uniformValues = uniformValues;
}
-void QSGShaderEffectMaterial::setTextureProviders(const QVector<QPair<QByteArray, QSGTextureProvider *> > &textures)
+void QQuickShaderEffectMaterial::setTextureProviders(const QVector<QPair<QByteArray, QSGTextureProvider *> > &textures)
{
m_textures = textures;
}
-const QVector<QPair<QByteArray, QSGTextureProvider *> > &QSGShaderEffectMaterial::textureProviders() const
+const QVector<QPair<QByteArray, QSGTextureProvider *> > &QQuickShaderEffectMaterial::textureProviders() const
{
return m_textures;
}
-void QSGShaderEffectMaterial::updateTextures() const
+void QQuickShaderEffectMaterial::updateTextures() const
{
for (int i = 0; i < m_textures.size(); ++i) {
if (QSGTextureProvider *provider = m_textures.at(i).second) {
}
-QSGShaderEffectNode::QSGShaderEffectNode()
+QQuickShaderEffectNode::QQuickShaderEffectNode()
{
QSGNode::setFlag(UsePreprocess, true);
setMaterial(&m_material);
}
-QSGShaderEffectNode::~QSGShaderEffectNode()
+QQuickShaderEffectNode::~QQuickShaderEffectNode()
{
}
-void QSGShaderEffectNode::markDirtyTexture()
+void QQuickShaderEffectNode::markDirtyTexture()
{
markDirty(DirtyMaterial);
}
-void QSGShaderEffectNode::preprocess()
+void QQuickShaderEffectNode::preprocess()
{
Q_ASSERT(material());
- static_cast<QSGShaderEffectMaterial *>(material())->updateTextures();
+ static_cast<QQuickShaderEffectMaterial *>(material())->updateTextures();
}
QT_END_NAMESPACE