diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-12-30 19:32:19 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2024-07-24 21:54:32 -0400 |
commit | 76dc3f0af36775d2fdaab61134dd0f875ee48292 (patch) | |
tree | 33fe349038005f7e5f733856895903257a448b54 /data | |
parent | 41e7e7152a66f40f3a23439fb0ea4b2b03acbf1c (diff) |
WIP graphics engine rewrite.
Diffstat (limited to 'data')
-rw-r--r-- | data/shaders/path-fill-frag.glsl | 14 | ||||
-rw-r--r-- | data/shaders/path-fill-vert.glsl | 13 | ||||
-rw-r--r-- | data/shaders/path-stroke-frag.glsl | 18 | ||||
-rw-r--r-- | data/shaders/path-stroke-vert.glsl | 14 |
4 files changed, 57 insertions, 2 deletions
diff --git a/data/shaders/path-fill-frag.glsl b/data/shaders/path-fill-frag.glsl index e839318..3e10bf0 100644 --- a/data/shaders/path-fill-frag.glsl +++ b/data/shaders/path-fill-frag.glsl @@ -12,11 +12,25 @@ varying vec2 fragPosition; in vec2 fragPosition; #endif +#ifdef GLSL120 uniform int mode; uniform vec4 color; uniform vec4 endColor; +uniform mat3 gradientMatrix; uniform vec2 gradientRange; uniform float radialGradientRatio; +#else +layout (std140) uniform Fill +{ + mat4 mvp; + vec4 color; + int mode; + vec4 endColor; + mat3 gradientMatrix; + vec2 gradientRange; + float radialGradientRatio; +}; +#endif vec4 gradientMix(float x) { float start = gradientRange.x; diff --git a/data/shaders/path-fill-vert.glsl b/data/shaders/path-fill-vert.glsl index d66bb14..f8bcace 100644 --- a/data/shaders/path-fill-vert.glsl +++ b/data/shaders/path-fill-vert.glsl @@ -14,9 +14,22 @@ varying vec2 fragPosition; out vec2 fragPosition; #endif +#ifdef GLSL120 uniform mat4 mvp; uniform vec4 color; uniform mat3 gradientMatrix; +#else +layout (std140) uniform Fill +{ + mat4 mvp; + vec4 color; + int mode; + vec4 endColor; + mat3 gradientMatrix; + vec2 gradientRange; + float radialGradientRatio; +}; +#endif void main(void) { // Short-circuit because the fragments will just be discarded diff --git a/data/shaders/path-stroke-frag.glsl b/data/shaders/path-stroke-frag.glsl index 9682c8f..324e3cf 100644 --- a/data/shaders/path-stroke-frag.glsl +++ b/data/shaders/path-stroke-frag.glsl @@ -14,6 +14,7 @@ in vec2 fragTex; in float fragStrokeLength; #endif +#ifdef GLSL120 uniform vec4 color; uniform float feather; uniform int strokeClosed; @@ -21,6 +22,19 @@ uniform float strokeWidth; uniform int strokeCap; uniform int strokeMiterStyle; uniform float strokeMiterLimit; +#else +layout (std140) uniform Stroke +{ + mat4 mvp; + vec4 color; + float feather; + float strokeWidth; + float strokeMiterLimit; + int strokeClosed; + int strokeCap; + int strokeMiterStyle; +}; +#endif float infinity = 1.0 / 0.0; @@ -47,7 +61,7 @@ void main(void) { if (strokeCap == 0) { // none d = infinity; - } else if (strokeCap == 1) { // butt + } else if (strokeCap == 1) { // butt (huh huh) d = max(dx + hw - 2 * feather, dy); } else if (strokeCap == 2) { // square d = max(dx, dy); @@ -58,7 +72,7 @@ void main(void) { } else if (strokeCap == 5) { // triangle in d = max(dy, hw - feather + dx - dy); } - // Stroke inner/join + // Stroke inner/join } else { d = abs(v); } diff --git a/data/shaders/path-stroke-vert.glsl b/data/shaders/path-stroke-vert.glsl index 5915010..f1c7e3a 100644 --- a/data/shaders/path-stroke-vert.glsl +++ b/data/shaders/path-stroke-vert.glsl @@ -22,10 +22,24 @@ out vec2 fragTex; out float fragStrokeLength; #endif +#ifdef GLSL120 uniform mat4 mvp; uniform vec4 color; uniform int mode; uniform int strokeClosed; +#else +layout (std140) uniform Stroke +{ + mat4 mvp; + vec4 color; + float feather; + float strokeWidth; + float strokeMiterLimit; + int strokeClosed; + int strokeCap; + int strokeMiterStyle; +}; +#endif void main(void) { // Short-circuit because the fragments will just be discarded anyway. |