Compare commits

..

2 Commits

Author SHA1 Message Date
Dean Herbert
5151418446 Merge pull request #229 from EVAST9919/triangles-fix
Remove dFdx/dFdy usage in TriangleBorder shader
2022-11-27 02:32:26 +09:00
Andrei Zavatski
1eca186493 Remove dFdx/dFdy usage in TriangleBorder shader 2022-11-26 20:05:07 +03:00

View File

@@ -7,6 +7,7 @@ varying highp vec2 v_TexCoord;
uniform lowp sampler2D m_Sampler; uniform lowp sampler2D m_Sampler;
uniform mediump float thickness; uniform mediump float thickness;
uniform highp float texelSize;
highp float dstToLine(highp vec2 start, highp vec2 end, highp vec2 pixelPos) highp float dstToLine(highp vec2 start, highp vec2 end, highp vec2 pixelPos)
{ {
@@ -33,8 +34,6 @@ void main(void)
highp vec2 resolution = v_TexRect.zw - v_TexRect.xy; highp vec2 resolution = v_TexRect.zw - v_TexRect.xy;
highp vec2 pixelPos = (v_TexCoord - v_TexRect.xy) / resolution; highp vec2 pixelPos = (v_TexCoord - v_TexRect.xy) / resolution;
highp float texelSize = max(abs(dFdx(pixelPos.x)), abs(dFdy(pixelPos.y))) * 1.5;
if (!insideTriangle(pixelPos)) if (!insideTriangle(pixelPos))
{ {
gl_FragColor = vec4(0.0); gl_FragColor = vec4(0.0);