diff --git a/gui/shaders/canvas-pipeline.frag b/gui/shaders/canvas-pipeline.frag index 9fdb9ff4f..7bc229eac 100644 --- a/gui/shaders/canvas-pipeline.frag +++ b/gui/shaders/canvas-pipeline.frag @@ -1,7 +1,5 @@ // -*-C++-*- -#version 330 - -/*** Enum constans ************************************/ +#version 330 core #define PAINT_TYPE_COLOR 0x1B00 #define PAINT_TYPE_LINEAR_GRADIENT 0x1B01 @@ -14,40 +12,19 @@ #define DRAW_MODE_PATH 0 #define DRAW_MODE_IMAGE 1 -/*** Interpolated *************************************/ - in vec2 texImageCoord; in vec2 paintCoord; -/*** Input ********************************************/ - -// Basic rendering Mode uniform int drawMode; -// Image uniform sampler2D imageSampler; uniform int imageMode; -// Paint uniform int paintType; uniform vec4 paintColor; uniform vec2 paintParams[3]; -// Gradient uniform sampler2D rampSampler; -// Pattern uniform sampler2D patternSampler; -// Color transform uniform vec4 scaleFactorBias[2]; -/*** Output *******************************************/ - -//out vec4 fragColor; - -/*** Built-in variables for shMain *******************************************/ - -vec4 sh_Color; - -/*** Functions ****************************************/ - -// 9.3.1 Linear Gradients float linearGradient(vec2 fragCoord, vec2 p0, vec2 p1){ float x = fragCoord.x; @@ -64,7 +41,6 @@ float linearGradient(vec2 fragCoord, vec2 p0, vec2 p1){ / ( dx*dx + dy*dy ); } -// 9.3.2 Radial Gradients float radialGradient(vec2 fragCoord, vec2 centerCoord, vec2 focalCoord, float r){ float x = fragCoord.x; @@ -83,16 +59,10 @@ float radialGradient(vec2 fragCoord, vec2 centerCoord, vec2 focalCoord, float r) / ( r*r - (dfx*dfx + dfy*dfy) ); } -// User defined shader -void shMain(void); - -/*** Main thread *************************************/ - void main() { vec4 col; - /* Stage 6: Paint Generation */ switch(paintType){ case PAINT_TYPE_LINEAR_GRADIENT: { @@ -125,15 +95,10 @@ void main() break; } - /* Stage 7: Image Interpolation */ if(drawMode == DRAW_MODE_IMAGE) { col = texture(imageSampler, texImageCoord) * (imageMode == DRAW_IMAGE_MULTIPLY ? col : vec4(1.0, 1.0, 1.0, 1.0)); } - /* Stage 8: Color Transformation, Blending, and Antialiasing */ - sh_Color = col * scaleFactorBias[0] + scaleFactorBias[1] ; - - /* Extended Stage: User defined shader that affects gl_FragColor */ - shMain(); + gl_FragColor = col * scaleFactorBias[0] + scaleFactorBias[1]; } diff --git a/gui/shaders/canvas-pipeline.vert b/gui/shaders/canvas-pipeline.vert index 4ee82bee2..d8293622b 100644 --- a/gui/shaders/canvas-pipeline.vert +++ b/gui/shaders/canvas-pipeline.vert @@ -1,39 +1,16 @@ // -*-C++-*- -#version 330 +#version 330 core -/*** Input *******************/ in vec2 pos; in vec2 textureUV; -uniform mat4 sh_View; -uniform mat4 sh_Model; -uniform mat4 sh_Ortho; uniform mat3 paintInverted; -/*** Output ******************/ out vec2 texImageCoord; out vec2 paintCoord; -/*** Grobal variables ********************/ -vec4 sh_Vertex; - -/*** Functions ****************************************/ - -// User defined shader -void shMain(void); - -/*** Main thread **************************************************/ -void main() { - - /* Stage 3: Transformation */ - sh_Vertex = vec4(pos, 0, 1); - - /* Extended Stage: User defined shader that affects gl_Position */ - shMain(); - - /* 2D pos in texture space */ +void main() +{ +// gl_Position = vec4(pos, 0, 1); texImageCoord = textureUV; - - /* 2D pos in paint space (Back to paint space) */ paintCoord = (paintInverted * vec3(pos, 1)).xy; - } diff --git a/gui/shaders/canvas-user-default.frag b/gui/shaders/canvas-user-default.frag deleted file mode 100644 index 84eb554c9..000000000 --- a/gui/shaders/canvas-user-default.frag +++ /dev/null @@ -1,6 +0,0 @@ -// -*-C++-*- -void shMain() { - - gl_FragColor = sh_Color; - -} diff --git a/gui/shaders/canvas-user-default.vert b/gui/shaders/canvas-user-default.vert deleted file mode 100644 index 03c2d6d98..000000000 --- a/gui/shaders/canvas-user-default.vert +++ /dev/null @@ -1,6 +0,0 @@ -// -*-C++-*- -void shMain() { - - gl_Position = sh_Ortho * sh_View * sh_Model * sh_Vertex; - -}