Browse Source

Fix DistanceFieldVector on WebGL iOS

pull/374/head
Florian Goujeon 7 years ago
parent
commit
22cafcd7e0
  1. 2
      src/Magnum/Shaders/AbstractVector.h
  2. 6
      src/Magnum/Shaders/DistanceFieldVector.frag
  3. 2
      src/Magnum/Shaders/Vector.frag

2
src/Magnum/Shaders/AbstractVector.h

@ -91,7 +91,7 @@ template<UnsignedInt dimensions> class AbstractVector: public GL::AbstractShader
#else
private:
#endif
enum: Int { VectorTextureLayer = 15 };
enum: Int { VectorTextureLayer = 0 };
explicit AbstractVector(NoCreateT) noexcept: GL::AbstractShaderProgram{NoCreate} {}
explicit AbstractVector() = default;

6
src/Magnum/Shaders/DistanceFieldVector.frag

@ -62,7 +62,7 @@ uniform lowp float smoothness
;
#ifdef EXPLICIT_TEXTURE_LAYER
layout(binding = 15)
layout(binding = 0)
#endif
uniform lowp sampler2D vectorTexture;
@ -80,8 +80,8 @@ void main() {
/* Outline */
if(outlineRange.x > outlineRange.y) {
lowp float mid = (outlineRange.x + outlineRange.y)/2.0;
lowp float halfRange = (outlineRange.x - outlineRange.y)/2.0;
lowp float mid = (outlineRange.x + outlineRange.y)*0.5;
lowp float halfRange = (outlineRange.x - outlineRange.y)*0.5;
fragmentColor += smoothstep(halfRange+smoothness, halfRange-smoothness, distance(mid, intensity))*outlineColor;
}
}

2
src/Magnum/Shaders/Vector.frag

@ -44,7 +44,7 @@ uniform lowp vec4 color
;
#ifdef EXPLICIT_TEXTURE_LAYER
layout(binding = 15)
layout(binding = 0)
#endif
uniform lowp sampler2D vectorTexture;

Loading…
Cancel
Save