diff options
Diffstat (limited to 'src/shader/code/vertex.glsl')
-rw-r--r-- | src/shader/code/vertex.glsl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/shader/code/vertex.glsl b/src/shader/code/vertex.glsl index 453b6fa..516f2c6 100644 --- a/src/shader/code/vertex.glsl +++ b/src/shader/code/vertex.glsl @@ -7,8 +7,16 @@ out VS_OUT { vec3 color; } vs_out; +float unit(float x) { + return 1.0/(1.0+exp(-x)); +} + +vec3 getColor(float x) { + return x*vec3(1.0,0.0,0.0) + (1-x)*vec3(-0.5,0.0,1.0); +} + void main() { gl_Position = vec4(VertexPosition.xy, 0., 1.); - vs_out.color = vec3(VertexPosition.z, 0., 0.); + vs_out.color = getColor(unit(VertexPosition.z)); } )"; |