summaryrefslogtreecommitdiff
path: root/shaders/humus-celshading/4.shader_test
blob: 5aefdccf60465f9cf403f9865d43c1cd7f4e1784 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
[require]
GLSL >= 1.10

[fragment shader]
#define saturate(x) clamp(x,0.0,1.0)
#define lerp mix
#line 19


varying vec3 norm;

void main(){
	gl_FragColor = vec4(0.0);
}

[vertex shader]
#define saturate(x) clamp(x,0.0,1.0)
#define lerp mix
#line 0


uniform vec3 camPos;
uniform float outlineThreshold;
uniform float edgeThreshold;

varying vec3 norm;

void main(){
	vec4 pos = gl_Vertex;
    vec3 dir = camPos - gl_Vertex.xyz;

	pos.w = float(
		dot(dir, gl_MultiTexCoord0.xyz) * dot(dir, gl_MultiTexCoord1.xyz) < outlineThreshold ||
		dot(gl_MultiTexCoord0.xyz, gl_MultiTexCoord1.xyz) < edgeThreshold);

	gl_Position = gl_ModelViewProjectionMatrix * pos;
}