summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualization/utils')
-rw-r--r--src/datavisualization/utils/shaderhelper.cpp104
-rw-r--r--src/datavisualization/utils/shaderhelper_p.h136
2 files changed, 135 insertions, 105 deletions
diff --git a/src/datavisualization/utils/shaderhelper.cpp b/src/datavisualization/utils/shaderhelper.cpp
index aa43c2df..bbd7fe0e 100644
--- a/src/datavisualization/utils/shaderhelper.cpp
+++ b/src/datavisualization/utils/shaderhelper.cpp
@@ -40,7 +40,37 @@ ShaderHelper::ShaderHelper(QObject *parent,
m_vertexShaderFile(vertexShader),
m_fragmentShaderFile(fragmentShader),
m_textureFile(texture),
- m_depthTextureFile(depthTexture)
+ m_depthTextureFile(depthTexture),
+ m_positionAttr(0),
+ m_uvAttr(0),
+ m_normalAttr(0),
+ m_colorUniform(0),
+ m_viewMatrixUniform(0),
+ m_modelMatrixUniform(0),
+ m_invTransModelMatrixUniform(0),
+ m_depthMatrixUniform(0),
+ m_mvpMatrixUniform(0),
+ m_lightPositionUniform(0),
+ m_lightStrengthUniform(0),
+ m_ambientStrengthUniform(0),
+ m_shadowQualityUniform(0),
+ m_textureUniform(0),
+ m_shadowUniform(0),
+ m_gradientMinUniform(0),
+ m_gradientHeightUniform(0),
+ m_lightColorUniform(0),
+ m_volumeSliceIndicesUniform(0),
+ m_colorIndexUniform(0),
+ m_cameraPositionRelativeToModelUniform(0),
+ m_color8BitUniform(0),
+ m_textureDimensionsUniform(0),
+ m_sampleCountUniform(0),
+ m_alphaMultiplierUniform(0),
+ m_preserveOpacityUniform(0),
+ m_minBoundsUniform(0),
+ m_maxBoundsUniform(0),
+ m_sliceFrameWidthUniform(0),
+ m_initialized(false)
{
}
@@ -136,217 +166,217 @@ void ShaderHelper::release()
m_program->release();
}
-void ShaderHelper::setUniformValue(GLuint uniform, const QVector2D &value)
+void ShaderHelper::setUniformValue(GLint uniform, const QVector2D &value)
{
m_program->setUniformValue(uniform, value);
}
-void ShaderHelper::setUniformValue(GLuint uniform, const QVector3D &value)
+void ShaderHelper::setUniformValue(GLint uniform, const QVector3D &value)
{
m_program->setUniformValue(uniform, value);
}
-void ShaderHelper::setUniformValue(GLuint uniform, const QVector4D &value)
+void ShaderHelper::setUniformValue(GLint uniform, const QVector4D &value)
{
m_program->setUniformValue(uniform, value);
}
-void ShaderHelper::setUniformValue(GLuint uniform, const QMatrix4x4 &value)
+void ShaderHelper::setUniformValue(GLint uniform, const QMatrix4x4 &value)
{
m_program->setUniformValue(uniform, value);
}
-void ShaderHelper::setUniformValue(GLuint uniform, GLfloat value)
+void ShaderHelper::setUniformValue(GLint uniform, GLfloat value)
{
m_program->setUniformValue(uniform, value);
}
-void ShaderHelper::setUniformValue(GLuint uniform, GLint value)
+void ShaderHelper::setUniformValue(GLint uniform, GLint value)
{
m_program->setUniformValue(uniform, value);
}
-void ShaderHelper::setUniformValueArray(GLuint uniform, const QVector4D *values, int count)
+void ShaderHelper::setUniformValueArray(GLint uniform, const QVector4D *values, int count)
{
m_program->setUniformValueArray(uniform, values, count);
}
-GLuint ShaderHelper::MVP()
+GLint ShaderHelper::MVP()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_mvpMatrixUniform;
}
-GLuint ShaderHelper::view()
+GLint ShaderHelper::view()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_viewMatrixUniform;
}
-GLuint ShaderHelper::model()
+GLint ShaderHelper::model()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_modelMatrixUniform;
}
-GLuint ShaderHelper::nModel()
+GLint ShaderHelper::nModel()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_invTransModelMatrixUniform;
}
-GLuint ShaderHelper::depth()
+GLint ShaderHelper::depth()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_depthMatrixUniform;
}
-GLuint ShaderHelper::lightP()
+GLint ShaderHelper::lightP()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_lightPositionUniform;
}
-GLuint ShaderHelper::lightS()
+GLint ShaderHelper::lightS()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_lightStrengthUniform;
}
-GLuint ShaderHelper::ambientS()
+GLint ShaderHelper::ambientS()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_ambientStrengthUniform;
}
-GLuint ShaderHelper::shadowQ()
+GLint ShaderHelper::shadowQ()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_shadowQualityUniform;
}
-GLuint ShaderHelper::color()
+GLint ShaderHelper::color()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_colorUniform;
}
-GLuint ShaderHelper::texture()
+GLint ShaderHelper::texture()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_textureUniform;
}
-GLuint ShaderHelper::shadow()
+GLint ShaderHelper::shadow()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_shadowUniform;
}
-GLuint ShaderHelper::gradientMin()
+GLint ShaderHelper::gradientMin()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_gradientMinUniform;
}
-GLuint ShaderHelper::gradientHeight()
+GLint ShaderHelper::gradientHeight()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_gradientHeightUniform;
}
-GLuint ShaderHelper::lightColor()
+GLint ShaderHelper::lightColor()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_lightColorUniform;
}
-GLuint ShaderHelper::volumeSliceIndices()
+GLint ShaderHelper::volumeSliceIndices()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_volumeSliceIndicesUniform;
}
-GLuint ShaderHelper::colorIndex()
+GLint ShaderHelper::colorIndex()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_colorIndexUniform;
}
-GLuint ShaderHelper::cameraPositionRelativeToModel()
+GLint ShaderHelper::cameraPositionRelativeToModel()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_cameraPositionRelativeToModelUniform;
}
-GLuint ShaderHelper::color8Bit()
+GLint ShaderHelper::color8Bit()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_color8BitUniform;
}
-GLuint ShaderHelper::textureDimensions()
+GLint ShaderHelper::textureDimensions()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_textureDimensionsUniform;
}
-GLuint ShaderHelper::sampleCount()
+GLint ShaderHelper::sampleCount()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_sampleCountUniform;
}
-GLuint ShaderHelper::alphaMultiplier()
+GLint ShaderHelper::alphaMultiplier()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_alphaMultiplierUniform;
}
-GLuint ShaderHelper::preserveOpacity()
+GLint ShaderHelper::preserveOpacity()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_preserveOpacityUniform;
}
-GLuint ShaderHelper::maxBounds()
+GLint ShaderHelper::maxBounds()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_maxBoundsUniform;
}
-GLuint ShaderHelper::minBounds()
+GLint ShaderHelper::minBounds()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_minBoundsUniform;
}
-GLuint ShaderHelper::sliceFrameWidth()
+GLint ShaderHelper::sliceFrameWidth()
{
if (!m_initialized)
@@ -354,21 +384,21 @@ GLuint ShaderHelper::sliceFrameWidth()
return m_sliceFrameWidthUniform;
}
-GLuint ShaderHelper::posAtt()
+GLint ShaderHelper::posAtt()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_positionAttr;
}
-GLuint ShaderHelper::uvAtt()
+GLint ShaderHelper::uvAtt()
{
if (!m_initialized)
qFatal("Shader not initialized");
return m_uvAttr;
}
-GLuint ShaderHelper::normalAtt()
+GLint ShaderHelper::normalAtt()
{
if (!m_initialized)
qFatal("Shader not initialized");
diff --git a/src/datavisualization/utils/shaderhelper_p.h b/src/datavisualization/utils/shaderhelper_p.h
index da010cbd..812cba18 100644
--- a/src/datavisualization/utils/shaderhelper_p.h
+++ b/src/datavisualization/utils/shaderhelper_p.h
@@ -52,44 +52,44 @@ class ShaderHelper
bool testCompile();
void bind();
void release();
- void setUniformValue(GLuint uniform, const QVector2D &value);
- void setUniformValue(GLuint uniform, const QVector3D &value);
- void setUniformValue(GLuint uniform, const QVector4D &value);
- void setUniformValue(GLuint uniform, const QMatrix4x4 &value);
- void setUniformValue(GLuint uniform, GLfloat value);
- void setUniformValue(GLuint uniform, GLint value);
- void setUniformValueArray(GLuint uniform, const QVector4D *values, int count);
-
- GLuint MVP();
- GLuint view();
- GLuint model();
- GLuint nModel();
- GLuint depth();
- GLuint lightP();
- GLuint lightS();
- GLuint ambientS();
- GLuint shadowQ();
- GLuint color();
- GLuint texture();
- GLuint shadow();
- GLuint gradientMin();
- GLuint gradientHeight();
- GLuint lightColor();
- GLuint volumeSliceIndices();
- GLuint colorIndex();
- GLuint cameraPositionRelativeToModel();
- GLuint color8Bit();
- GLuint textureDimensions();
- GLuint sampleCount();
- GLuint alphaMultiplier();
- GLuint preserveOpacity();
- GLuint maxBounds();
- GLuint minBounds();
- GLuint sliceFrameWidth();
-
- GLuint posAtt();
- GLuint uvAtt();
- GLuint normalAtt();
+ void setUniformValue(GLint uniform, const QVector2D &value);
+ void setUniformValue(GLint uniform, const QVector3D &value);
+ void setUniformValue(GLint uniform, const QVector4D &value);
+ void setUniformValue(GLint uniform, const QMatrix4x4 &value);
+ void setUniformValue(GLint uniform, GLfloat value);
+ void setUniformValue(GLint uniform, GLint value);
+ void setUniformValueArray(GLint uniform, const QVector4D *values, int count);
+
+ GLint MVP();
+ GLint view();
+ GLint model();
+ GLint nModel();
+ GLint depth();
+ GLint lightP();
+ GLint lightS();
+ GLint ambientS();
+ GLint shadowQ();
+ GLint color();
+ GLint texture();
+ GLint shadow();
+ GLint gradientMin();
+ GLint gradientHeight();
+ GLint lightColor();
+ GLint volumeSliceIndices();
+ GLint colorIndex();
+ GLint cameraPositionRelativeToModel();
+ GLint color8Bit();
+ GLint textureDimensions();
+ GLint sampleCount();
+ GLint alphaMultiplier();
+ GLint preserveOpacity();
+ GLint maxBounds();
+ GLint minBounds();
+ GLint sliceFrameWidth();
+
+ GLint posAtt();
+ GLint uvAtt();
+ GLint normalAtt();
private:
QObject *m_caller;
@@ -101,36 +101,36 @@ class ShaderHelper
QString m_textureFile;
QString m_depthTextureFile;
- GLuint m_positionAttr;
- GLuint m_uvAttr;
- GLuint m_normalAttr;
-
- GLuint m_colorUniform;
- GLuint m_viewMatrixUniform;
- GLuint m_modelMatrixUniform;
- GLuint m_invTransModelMatrixUniform;
- GLuint m_depthMatrixUniform;
- GLuint m_mvpMatrixUniform;
- GLuint m_lightPositionUniform;
- GLuint m_lightStrengthUniform;
- GLuint m_ambientStrengthUniform;
- GLuint m_shadowQualityUniform;
- GLuint m_textureUniform;
- GLuint m_shadowUniform;
- GLuint m_gradientMinUniform;
- GLuint m_gradientHeightUniform;
- GLuint m_lightColorUniform;
- GLuint m_volumeSliceIndicesUniform;
- GLuint m_colorIndexUniform;
- GLuint m_cameraPositionRelativeToModelUniform;
- GLuint m_color8BitUniform;
- GLuint m_textureDimensionsUniform;
- GLuint m_sampleCountUniform;
- GLuint m_alphaMultiplierUniform;
- GLuint m_preserveOpacityUniform;
- GLuint m_minBoundsUniform;
- GLuint m_maxBoundsUniform;
- GLuint m_sliceFrameWidthUniform;
+ GLint m_positionAttr;
+ GLint m_uvAttr;
+ GLint m_normalAttr;
+
+ GLint m_colorUniform;
+ GLint m_viewMatrixUniform;
+ GLint m_modelMatrixUniform;
+ GLint m_invTransModelMatrixUniform;
+ GLint m_depthMatrixUniform;
+ GLint m_mvpMatrixUniform;
+ GLint m_lightPositionUniform;
+ GLint m_lightStrengthUniform;
+ GLint m_ambientStrengthUniform;
+ GLint m_shadowQualityUniform;
+ GLint m_textureUniform;
+ GLint m_shadowUniform;
+ GLint m_gradientMinUniform;
+ GLint m_gradientHeightUniform;
+ GLint m_lightColorUniform;
+ GLint m_volumeSliceIndicesUniform;
+ GLint m_colorIndexUniform;
+ GLint m_cameraPositionRelativeToModelUniform;
+ GLint m_color8BitUniform;
+ GLint m_textureDimensionsUniform;
+ GLint m_sampleCountUniform;
+ GLint m_alphaMultiplierUniform;
+ GLint m_preserveOpacityUniform;
+ GLint m_minBoundsUniform;
+ GLint m_maxBoundsUniform;
+ GLint m_sliceFrameWidthUniform;
GLboolean m_initialized;
};