#version 450 uniform mat4 mview; uniform mat4 mmviewproj; uniform mat4 mmod; uniform float t; const float half_height = 0.855; varying vec3 pos; // varying vec3 normal; // varying vec3 ldir; varying vec2 tex_coord; varying vec3 world_normal; // const vec3 lpos = vec3(0.0, 100.0, -10.0); /* attributes */ layout(location = 1) in vec3 attr_pos; layout(location = 2) in vec3 attr_normal; layout(location = 3) in vec2 attr_tex; void main() { vec3 sph_pos = normalize(vec3(attr_pos.x, attr_pos.y - half_height, attr_pos.z)); vec3 sph_normal = sph_pos; sph_pos.y += half_height; vec3 p = mix(attr_pos, sph_pos, t); vec3 n = mix(attr_normal, sph_normal, t); gl_Position = mmviewproj * vec4(p, 1.0); pos = (mview * vec4(p, 1.0)).xyz; // ldir = (mview * vec4(lpos, 1.0)).xyz; // mat3 normal_matrix = mat3(mview); // normal = normal_matrix * n; tex_coord = attr_tex; world_normal = (mmod * vec4(attr_normal, 1.0)).xyz; }