summaryrefslogtreecommitdiff
path: root/shaders/humus-dynamicbranching/11.vert
blob: 2e2030042c2d26d0af6584fa1ae2ccf7e23b5a24 (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
#version 120
#define saturate(x) clamp(x,0.0,1.0)
#define lerp mix
#define SHADOWS
#define BRANCHING
#line 2
uniform vec3 lightPos;
uniform vec3 camPos;
uniform float invRadius;

attribute vec2 textureCoord;
attribute vec3 tangent;
attribute vec3 binormal;
attribute vec3 normal;

varying vec2 texCoord;
varying vec3 lVec;
varying vec3 vVec;
varying vec3 shadowVec;

void main(){
	gl_Position = ftransform();

	texCoord = textureCoord;

	vec3 lightVec = invRadius * (lightPos - gl_Vertex.xyz);
	shadowVec = -lightVec;
	lVec.x = dot(lightVec, tangent);
	lVec.y = dot(lightVec, binormal);
	lVec.z = dot(lightVec, normal);

	vec3 viewVec = camPos - gl_Vertex.xyz;
	vVec.x = dot(viewVec, tangent);
	vVec.y = dot(viewVec, binormal);
	vVec.z = dot(viewVec, normal);
}