Bump engine submodule and move texlevels from instance params to texcoords.

This commit is contained in:
2022-12-05 05:53:23 +01:00
parent a145a4bea3
commit e361a68b7c
9 changed files with 360 additions and 246 deletions

View File

@ -18,13 +18,11 @@ precision highp float;
layout(location = 0) in vec3 a_position; // model space
layout(location = 1) in vec3 a_normal; // model space
layout(location = 2) in vec2 a_texcoord; // texture space
layout(location = 2) in vec3 a_texcoord; // texture space
layout(location = 3) in vec4 i_translation; // per mesh, model space -> world space (x, y, z, texlevel)
layout(location = 3) in vec3 i_translation; // per mesh, model space -> world space
layout(location = 4) in vec3 i_orientation; // per mesh, model space -> world space
#define i_texlevel i_translation.w
uniform mat4 u_view; // world space -> view space
uniform mat4 u_projection; // view space -> screen space
@ -33,6 +31,7 @@ uniform highp sampler2D u_normal_sampler;
const vec3 c_normal_scale = vec3(2.0, 2.0, 1.0);
const vec3 c_normal_shift = vec3(-1.0, -1.0, 0.0);
const vec2 c_st_scale = vec2(1.0 / 1023.0, 1.0 / 1023.0);
const vec2 c_terrain_scale = vec2(1.0 / 2048.0, -1.0 / 2048.0);
const vec2 c_terrain_shift = vec2(0.5, 0.5);
const float c_weight_scale = 1.0 / 64.f;
@ -58,6 +57,6 @@ void main(void) {
v_position = view_position.xyz;
v_normal = (u_view * vec4(world_normal, 0.0)).xyz;
v_terrain_normal = vec4((u_view * vec4(terrain_normal, 0.0)).xyz, weight);
v_texcoord = vec4(a_texcoord, i_texlevel, i_texlevel + 1.0);
v_texcoord = vec4(a_texcoord.st * c_st_scale, a_texcoord.p, a_texcoord.p + 1.0);
gl_Position = u_projection * view_position;
}