summaryrefslogtreecommitdiff
path: root/assets/vertex.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'assets/vertex.glsl')
-rw-r--r--assets/vertex.glsl26
1 files changed, 23 insertions, 3 deletions
diff --git a/assets/vertex.glsl b/assets/vertex.glsl
index ec8c0b6..b9a5162 100644
--- a/assets/vertex.glsl
+++ b/assets/vertex.glsl
@@ -6,7 +6,9 @@ layout(location = 1) in vec2 vTexCoord;
//out vec3 fPos;
//out vec3 fNormal;
-out vec2 fTexCoords;
+out vec2 fTexCoord;
+out vec3 fPos;
+out noperspective vec2 fDepthTexCoord;
uniform mat4 model;
uniform mat4 viewProj;
@@ -15,13 +17,31 @@ uniform mat4 viewProj;
uniform mat4 viewProj;
uniform mat3 normalTransform;*/
+vec3 CMYKtoRGB (vec4 cmyk) {
+ float c = cmyk.x;
+ float m = cmyk.y;
+ float y = cmyk.z;
+ float k = cmyk.w;
+
+ float invK = 1.0 - k;
+ float r = 1.0 - min(1.0, c * invK + k);
+ float g = 1.0 - min(1.0, m * invK + k);
+ float b = 1.0 - min(1.0, y * invK + k);
+ return clamp(vec3(r, g, b), 0.0, 1.0);
+}
+
void main()
{
vec4 pos = vPos;
pos = model * pos;
- pos.w = pos.w + 2.0;
+
+ pos.w = pos.w * 0.5 + 1.5;
gl_Position = viewProj * (pos / pos.w);
+ fDepthTexCoord = (gl_Position.xy / gl_Position.w) * 0.5 + 0.5; // NDC to tex coords
+
+ fPos = CMYKtoRGB(vPos * 0.4 + vec4(0.4));
+
//gl_Position = viewProj * model * vec4(vPos.xyz, 1.0);
- fTexCoords = vTexCoord;
+ fTexCoord = vTexCoord;
}