Browse Source

Shaders: cleanup of VectorShader.

Using this-> for accessing parent class members breaks KDevelop
autocompletion, using explicit class name instead (but the shorter one).
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
3c31519133
  1. 16
      src/Shaders/VectorShader.cpp
  2. 4
      src/Shaders/VectorShader.h

16
src/Shaders/VectorShader.cpp

@ -41,12 +41,12 @@ template<UnsignedInt dimensions> VectorShader<dimensions>::VectorShader(): trans
Shader vertexShader(v, Shader::Type::Vertex); Shader vertexShader(v, Shader::Type::Vertex);
vertexShader.addSource(rs.get("compatibility.glsl")); vertexShader.addSource(rs.get("compatibility.glsl"));
vertexShader.addSource(rs.get(vertexShaderName<dimensions>())); vertexShader.addSource(rs.get(vertexShaderName<dimensions>()));
AbstractVectorShader<dimensions>::attachShader(vertexShader); AbstractShaderProgram::attachShader(vertexShader);
Shader fragmentShader(v, Shader::Type::Fragment); Shader fragmentShader(v, Shader::Type::Fragment);
fragmentShader.addSource(rs.get("compatibility.glsl")); fragmentShader.addSource(rs.get("compatibility.glsl"));
fragmentShader.addSource(rs.get("VectorShader.frag")); fragmentShader.addSource(rs.get("VectorShader.frag"));
AbstractVectorShader<dimensions>::attachShader(fragmentShader); AbstractShaderProgram::attachShader(fragmentShader);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>() || if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>() ||
@ -54,24 +54,24 @@ template<UnsignedInt dimensions> VectorShader<dimensions>::VectorShader(): trans
#else #else
if(!Context::current()->isVersionSupported(Version::GLES300)) { if(!Context::current()->isVersionSupported(Version::GLES300)) {
#endif #endif
AbstractVectorShader<dimensions>::bindAttributeLocation(AbstractVectorShader<dimensions>::Position::Location, "position"); AbstractShaderProgram::bindAttributeLocation(AbstractVectorShader<dimensions>::Position::Location, "position");
AbstractVectorShader<dimensions>::bindAttributeLocation(AbstractVectorShader<dimensions>::TextureCoordinates::Location, "textureCoordinates"); AbstractShaderProgram::bindAttributeLocation(AbstractVectorShader<dimensions>::TextureCoordinates::Location, "textureCoordinates");
} }
AbstractVectorShader<dimensions>::link(); AbstractShaderProgram::link();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_uniform_location>()) { if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_uniform_location>()) {
#else #else
{ {
#endif #endif
transformationProjectionMatrixUniform = AbstractVectorShader<dimensions>::uniformLocation("transformationProjectionMatrix"); transformationProjectionMatrixUniform = AbstractShaderProgram::uniformLocation("transformationProjectionMatrix");
colorUniform = AbstractVectorShader<dimensions>::uniformLocation("color"); colorUniform = AbstractShaderProgram::uniformLocation("color");
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shading_language_420pack>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shading_language_420pack>())
AbstractVectorShader<dimensions>::setUniform(AbstractVectorShader<dimensions>::uniformLocation("vectorTexture"), AbstractVectorShader<dimensions>::VectorTextureLayer); AbstractShaderProgram::setUniform(AbstractShaderProgram::uniformLocation("vectorTexture"), AbstractVectorShader<dimensions>::VectorTextureLayer);
#endif #endif
} }

4
src/Shaders/VectorShader.h

@ -38,13 +38,13 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT VectorShader: publi
/** @brief Set transformation and projection matrix */ /** @brief Set transformation and projection matrix */
inline VectorShader* setTransformationProjectionMatrix(const typename DimensionTraits<dimensions>::MatrixType& matrix) { inline VectorShader* setTransformationProjectionMatrix(const typename DimensionTraits<dimensions>::MatrixType& matrix) {
AbstractVectorShader<dimensions>::setUniform(transformationProjectionMatrixUniform, matrix); AbstractShaderProgram::setUniform(transformationProjectionMatrixUniform, matrix);
return this; return this;
} }
/** @brief Set fill color */ /** @brief Set fill color */
inline VectorShader* setColor(const Color4<>& color) { inline VectorShader* setColor(const Color4<>& color) {
AbstractVectorShader<dimensions>::setUniform(colorUniform, color); AbstractShaderProgram::setUniform(colorUniform, color);
return this; return this;
} }

Loading…
Cancel
Save