summaryrefslogtreecommitdiff
path: root/src/shaders/player.vert
blob: ce53bf5329bc474956e48300af4465750c052795 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
precision highp float;
attribute vec3 player;
attribute vec2 texuv;
varying vec2 textureuv;
attribute vec4 lamp1; //vec3 position, float strength
attribute vec4 lamp2;
attribute vec4 lamp3; // max 3 lamps per shaded player
uniform float time; //used for noise
uniform float world_x;
uniform float world_y;
uniform float dir;
uniform mat4 MV;
uniform mat4 P;
void main() {
	textureuv=texuv;
	mat2 rotate = mat2(
		cos(dir), -sin(dir),
		sin(dir), cos(dir)
	);
	vec2 world = vec2(world_x, world_y);
	vec2 local = (player.xy - world) * rotate;
	gl_Position = P * MV * vec4(local.xy, -2, 1.0);
}