1
0
Fork 0

Follow the new shader guide style

This commit is contained in:
Erik Hofman 2023-04-13 08:25:07 +02:00
parent e77e5bad9c
commit 9e0211312e
4 changed files with 17 additions and 14 deletions

View file

@ -1,9 +1,10 @@
// -*-C++-*-
#version 330
#version 330 core
in vec4 interpolateColor;
out vec4 fragColor;
in vec4 interpolateColor;
void main()
{
fragColor = interpolateColor;

View file

@ -1,10 +1,11 @@
// -*-C++-*-
#version 330
#version 330 core
in vec2 step;
in vec4 stepColor;
out vec4 interpolateColor;
in vec2 step;
in vec4 stepColor;
void main()
{
gl_Position = vec4(step.xy, 0, 1);

View file

@ -16,16 +16,16 @@ in vec2 texImageCoord;
in vec2 paintCoord;
uniform int drawMode;
uniform sampler2D imageSampler;
uniform int imageMode;
uniform int paintType;
uniform vec4 paintColor;
uniform vec2 paintParams[3];
uniform vec4 scaleFactorBias[2];
uniform sampler2D imageSampler;
uniform sampler2D rampSampler;
uniform sampler2D patternSampler;
uniform vec4 scaleFactorBias[2];
float linearGradient(vec2 fragCoord, vec2 p0, vec2 p1){
float linear_gradient(vec2 fragCoord, vec2 p0, vec2 p1){
float x = fragCoord.x;
float y = fragCoord.y;
@ -41,7 +41,7 @@ float linearGradient(vec2 fragCoord, vec2 p0, vec2 p1){
/ ( dx*dx + dy*dy );
}
float radialGradient(vec2 fragCoord, vec2 centerCoord, vec2 focalCoord, float r){
float radial_gradient(vec2 fragCoord, vec2 centerCoord, vec2 focalCoord, float r){
float x = fragCoord.x;
float y = fragCoord.y;
@ -68,7 +68,7 @@ void main()
{
vec2 x0 = paintParams[0];
vec2 x1 = paintParams[1];
float factor = linearGradient(paintCoord, x0, x1);
float factor = linear_gradient(paintCoord, x0, x1);
col = texture(rampSampler, vec2(factor, 0.5));
}
break;
@ -77,7 +77,7 @@ void main()
vec2 center = paintParams[0];
vec2 focal = paintParams[1];
float radius = paintParams[2].x;
float factor = radialGradient(paintCoord, center, focal, radius);
float factor = radial_gradient(paintCoord, center, focal, radius);
col = texture(rampSampler, vec2(factor, 0.5));
}
break;

View file

@ -1,15 +1,16 @@
// -*-C++-*-
#version 330 core
out vec2 texImageCoord;
out vec2 paintCoord;
in vec2 pos;
in vec2 textureUV;
uniform mat4 sh_Model;
uniform mat4 sh_Ortho;
uniform mat3 paintInverted;
out vec2 texImageCoord;
out vec2 paintCoord;
void main()
{
gl_Position = vec4(pos, 0, 1);