Update test shaders

This commit is contained in:
Andrei Zavatski 2023-05-02 11:51:05 +03:00
parent 4a97c2c105
commit 8160d56264
2 changed files with 27 additions and 30 deletions

View File

@ -1,11 +1,14 @@
#include "sh_Utils.h" #define HIGH_PRECISION_VERTEX
varying mediump vec2 v_TexCoord; #include "sh_Utils.h"
varying mediump vec4 v_TexRect; #include "sh_Masking.h"
layout(location = 2) in highp vec2 v_TexCoord;
layout(location = 0) out vec4 o_Colour;
void main(void) void main(void)
{ {
float hueValue = v_TexCoord.x / (v_TexRect[2] - v_TexRect[0]); highp float hueValue = v_TexCoord.x / (v_TexRect[2] - v_TexRect[0]);
gl_FragColor = hsv2rgb(vec4(hueValue, 1, 1, 1)); o_Colour = getRoundedColor(hsv2rgb(vec4(hueValue, 1, 1, 1)), v_TexCoord);
} }

View File

@ -1,31 +1,25 @@
#include "sh_Utils.h" layout(location = 0) in highp vec2 m_Position;
layout(location = 1) in lowp vec4 m_Colour;
layout(location = 2) in highp vec2 m_TexCoord;
layout(location = 3) in highp vec4 m_TexRect;
layout(location = 4) in mediump vec2 m_BlendRange;
attribute highp vec2 m_Position; layout(location = 0) out highp vec2 v_MaskingPosition;
attribute lowp vec4 m_Colour; layout(location = 1) out lowp vec4 v_Colour;
attribute mediump vec2 m_TexCoord; layout(location = 2) out highp vec2 v_TexCoord;
attribute mediump vec4 m_TexRect; layout(location = 3) out highp vec4 v_TexRect;
attribute mediump vec2 m_BlendRange; layout(location = 4) out mediump vec2 v_BlendRange;
varying highp vec2 v_MaskingPosition;
varying lowp vec4 v_Colour;
varying mediump vec2 v_TexCoord;
varying mediump vec4 v_TexRect;
varying mediump vec2 v_BlendRange;
uniform highp mat4 g_ProjMatrix;
uniform highp mat3 g_ToMaskingSpace;
void main(void) void main(void)
{ {
// Transform from screen space to masking space. // Transform from screen space to masking space.
highp vec3 maskingPos = g_ToMaskingSpace * vec3(m_Position, 1.0); highp vec3 maskingPos = g_ToMaskingSpace * vec3(m_Position, 1.0);
v_MaskingPosition = maskingPos.xy / maskingPos.z; v_MaskingPosition = maskingPos.xy / maskingPos.z;
v_Colour = m_Colour; v_Colour = m_Colour;
v_TexCoord = m_TexCoord; v_TexCoord = m_TexCoord;
v_TexRect = m_TexRect; v_TexRect = m_TexRect;
v_BlendRange = m_BlendRange; v_BlendRange = m_BlendRange;
gl_Position = gProjMatrix * vec4(m_Position, 1.0, 1.0); gl_Position = g_ProjMatrix * vec4(m_Position, 1.0, 1.0);
} }