Browse Source

Shaders: name the textureCoordinates attribute consistently in GLSL.

Interestingly enough, on Phong it was named textureCoords while on the
C++ side it was asking for textureCoordinates, and I don't remember this
being an issue *ever*, on any driver.
pull/430/head
Vladimír Vondruš 6 years ago
parent
commit
a35d53118b
  1. 4
      src/Magnum/Shaders/AbstractVector2D.vert
  2. 4
      src/Magnum/Shaders/AbstractVector3D.vert
  3. 4
      src/Magnum/Shaders/DistanceFieldVector.frag
  4. 10
      src/Magnum/Shaders/Phong.frag
  5. 6
      src/Magnum/Shaders/Phong.vert
  6. 4
      src/Magnum/Shaders/Vector.frag

4
src/Magnum/Shaders/AbstractVector2D.vert

@ -47,9 +47,9 @@ layout(location = TEXTURECOORDINATES_ATTRIBUTE_LOCATION)
#endif
in mediump vec2 textureCoordinates;
out mediump vec2 fragmentTextureCoordinates;
out mediump vec2 interpolatedTextureCoordinates;
void main() {
gl_Position.xywz = vec4(transformationProjectionMatrix*vec3(position, 1.0), 0.0);
fragmentTextureCoordinates = textureCoordinates;
interpolatedTextureCoordinates = textureCoordinates;
}

4
src/Magnum/Shaders/AbstractVector3D.vert

@ -47,9 +47,9 @@ layout(location = TEXTURECOORDINATES_ATTRIBUTE_LOCATION)
#endif
in mediump vec2 textureCoordinates;
out mediump vec2 fragmentTextureCoordinates;
out mediump vec2 interpolatedTextureCoordinates;
void main() {
gl_Position = transformationProjectionMatrix*position;
fragmentTextureCoordinates = textureCoordinates;
interpolatedTextureCoordinates = textureCoordinates;
}

4
src/Magnum/Shaders/DistanceFieldVector.frag

@ -67,7 +67,7 @@ layout(binding = 6)
#endif
uniform lowp sampler2D vectorTexture;
in mediump vec2 fragmentTextureCoordinates;
in mediump vec2 interpolatedTextureCoordinates;
#ifdef NEW_GLSL
#ifdef EXPLICIT_ATTRIB_LOCATION
@ -77,7 +77,7 @@ out lowp vec4 fragmentColor;
#endif
void main() {
lowp float intensity = texture(vectorTexture, fragmentTextureCoordinates).r;
lowp float intensity = texture(vectorTexture, interpolatedTextureCoordinates).r;
/* Fill color */
fragmentColor = smoothstep(outlineRange.x-smoothness, outlineRange.x+smoothness, intensity)*color;

10
src/Magnum/Shaders/Phong.frag

@ -146,7 +146,7 @@ in highp vec3 cameraDirection;
#endif
#if defined(AMBIENT_TEXTURE) || defined(DIFFUSE_TEXTURE) || defined(SPECULAR_TEXTURE) || defined(NORMAL_TEXTURE)
in mediump vec2 interpolatedTextureCoords;
in mediump vec2 interpolatedTextureCoordinates;
#endif
#ifdef VERTEX_COLOR
@ -170,13 +170,13 @@ out highp uint fragmentObjectId;
void main() {
lowp const vec4 finalAmbientColor =
#ifdef AMBIENT_TEXTURE
texture(ambientTexture, interpolatedTextureCoords)*
texture(ambientTexture, interpolatedTextureCoordinates)*
#endif
ambientColor;
#if LIGHT_COUNT
lowp const vec4 finalDiffuseColor =
#ifdef DIFFUSE_TEXTURE
texture(diffuseTexture, interpolatedTextureCoords)*
texture(diffuseTexture, interpolatedTextureCoordinates)*
#endif
#ifdef VERTEX_COLOR
interpolatedVertexColor*
@ -184,7 +184,7 @@ void main() {
diffuseColor;
lowp const vec4 finalSpecularColor =
#ifdef SPECULAR_TEXTURE
texture(specularTexture, interpolatedTextureCoords)*
texture(specularTexture, interpolatedTextureCoordinates)*
#endif
specularColor;
#endif
@ -203,7 +203,7 @@ void main() {
normalizedTransformedTangent)),
normalizedTransformedNormal
);
normalizedTransformedNormal = tbn*(texture(normalTexture, interpolatedTextureCoords).rgb*2.0 - vec3(1.0));
normalizedTransformedNormal = tbn*(texture(normalTexture, interpolatedTextureCoordinates).rgb*2.0 - vec3(1.0));
#endif
/* Add diffuse color for each light */

6
src/Magnum/Shaders/Phong.vert

@ -88,9 +88,9 @@ in mediump vec3 tangent;
#ifdef EXPLICIT_ATTRIB_LOCATION
layout(location = TEXTURECOORDINATES_ATTRIBUTE_LOCATION)
#endif
in mediump vec2 textureCoords;
in mediump vec2 textureCoordinates;
out mediump vec2 interpolatedTextureCoords;
out mediump vec2 interpolatedTextureCoordinates;
#endif
#ifdef VERTEX_COLOR
@ -136,7 +136,7 @@ void main() {
#ifdef TEXTURED
/* Texture coordinates, if needed */
interpolatedTextureCoords = textureCoords;
interpolatedTextureCoordinates = textureCoordinates;
#endif
#ifdef VERTEX_COLOR

4
src/Magnum/Shaders/Vector.frag

@ -49,7 +49,7 @@ layout(binding = 6)
#endif
uniform lowp sampler2D vectorTexture;
in mediump vec2 fragmentTextureCoordinates;
in mediump vec2 interpolatedTextureCoordinates;
#ifdef NEW_GLSL
#ifdef EXPLICIT_ATTRIB_LOCATION
@ -59,6 +59,6 @@ out lowp vec4 fragmentColor;
#endif
void main() {
lowp float intensity = texture(vectorTexture, fragmentTextureCoordinates).r;
lowp float intensity = texture(vectorTexture, interpolatedTextureCoordinates).r;
fragmentColor = mix(backgroundColor, color, intensity);
}

Loading…
Cancel
Save