aboutsummaryrefslogtreecommitdiff
path: root/src/shader/code/vertex.glsl
blob: 516f2c67d36f8f7bb74c4b9783288a469a0fd63f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
static const std::string VERTEX_SHADER_CODE = R"(
#version 430

layout (location=0) in vec3 VertexPosition;

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 = getColor(unit(VertexPosition.z));
}
)";