3 layout(std140, binding = 0) uniform matrix_state {
10 const float half_height = 0.855;
12 layout(location = 0) out vec3 pos;
13 layout(location = 1) out vec2 tex_coord;
14 layout(location = 2) out vec3 world_normal;
17 layout(location = 1) in vec3 attr_pos;
18 layout(location = 2) in vec3 attr_normal;
19 layout(location = 3) in vec2 attr_tex;
23 vec3 sph_pos = normalize(vec3(attr_pos.x, attr_pos.y - half_height, attr_pos.z));
25 vec3 sph_normal = sph_pos;
26 sph_pos.y += half_height;
28 vec3 p = mix(attr_pos, sph_pos, m.t);
29 vec3 n = mix(attr_normal, sph_normal, m.t);
31 gl_Position = m.mmviewproj * vec4(p, 1.0);
33 pos = (m.mview * vec4(p, 1.0)).xyz;
34 // ldir = (mview * vec4(lpos, 1.0)).xyz;
36 // mat3 normal_matrix = mat3(mview);
37 // normal = normal_matrix * n;
40 world_normal = (m.mmod * vec4(attr_normal, 1.0)).xyz;