Clay Engine: Convert Lamp to use new instancing feature.

This commit is contained in:
2017-02-09 18:33:50 +01:00
parent 1976fd7af1
commit eb473143a8
3 changed files with 36 additions and 77 deletions

View File

@@ -5,9 +5,10 @@ uniform float size;
uniform float pixel_size;
in vec2 pos;
in mat4 InstanceModelMatrix;
in vec3 lamp_pos;
in vec3 color;
#define lamp_pos InstanceModelMatrix[3].xyz
flat out vec4 finalColor;
float mul_project_m4_v3_zfac(in vec3 co)
{
@@ -21,4 +22,5 @@ void main()
float pix_size = mul_project_m4_v3_zfac(lamp_pos) * pixel_size;
vec3 screen_pos = screen_vecs[0].xyz * pos.x + screen_vecs[1].xyz * pos.y;
gl_Position = ViewProjectionMatrix * vec4(lamp_pos + screen_pos * size * pix_size, 1.0);
finalColor = vec4(color, 1.0);
}