Bump engine submodule and move projection/view code to game.

This commit is contained in:
2022-11-29 03:19:57 +01:00
parent 97bd087a75
commit 8a33228dff
5 changed files with 81 additions and 28 deletions

View File

@ -18,7 +18,7 @@ precision highp float;
in vec3 v_position;
uniform mat4 u_view_km; // world space -> view space, unit = km
uniform mat4 u_view; // world space -> view space, unit = km
uniform vec3 u_light_direction; // view space (-direction_x, -direction_y, -direction_z)
uniform vec3 u_light_color;
uniform vec3 u_horizon_color;
@ -26,10 +26,10 @@ uniform vec3 u_sky_color;
uniform vec3 u_sun_color;
uniform float u_sea_phase;
#define u_right u_view_km[0].xyz
#define u_forward u_view_km[1].xyz
#define u_up u_view_km[2].xyz
#define u_origin u_view_km[3].xyz
#define u_right u_view[0].xyz
#define u_forward u_view[1].xyz
#define u_up u_view[2].xyz
#define u_origin u_view[3].xyz
uniform highp sampler2DArray u_sea_polar_sampler;
uniform highp sampler2D u_sea_detail_sampler;
@ -79,7 +79,7 @@ void main(void) {
t = (u_sea_phase + dot(sea_position, u_forward)) * c_detail_scale;
vec3 sea_detail = normalize(c_normal_shift + texture(u_sea_detail_sampler, vec2(s, t)).xyz * c_normal_scale);
//TODO: better blending, with earth normal
vec4 normal = u_view_km * vec4(normalize(sea_polar1 + sea_polar2 + sea_detail), 0.0);
vec4 normal = u_view * vec4(normalize(sea_polar1 + sea_polar2 + sea_detail), 0.0);
float d = max(0.0, dot(normal.xyz, u_light_direction));
s = pow(max(0.0, dot(normal.xyz, normalize(u_light_direction - direction))), 500.0) * step(0.0, d);
o_color = vec4(