summaryrefslogtreecommitdiff
path: root/src/shaders/world.vert
blob: 0e6747a0d322258e798fb4ff44e85a720d9231bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
precision highp float;
attribute vec3 world; // position
attribute vec2 texuv;
varying vec2 textureuv;
varying mat3 light1;
uniform vec4 color;
varying vec4 v_color;
uniform float world_x;
uniform float world_y;
uniform mat4 MV;
uniform mat4 P;
void main() {
	v_color = vec4(world.xyz,1.);
	vec2 vxy = vec2(world.x - world_x, world.y - world_y);
	float z_scale = 0.5;
	float xoff = world.z * vxy.x * z_scale;
	float yoff = world.z * vxy.y * z_scale;
	textureuv=texuv;
	// if z > 0 then
	// xoff = ceil(xoff, 0)
	gl_Position = P * MV * vec4(vxy.x + xoff, vxy.y + yoff, 0., 1.0);
}