Reverted bad shader changes

This commit is contained in:
Joshua Barretto 2023-10-18 21:20:15 +01:00
parent cb2de226a2
commit cea7636e29
3 changed files with 24 additions and 8 deletions

View File

@ -78,12 +78,13 @@ vec4 textureBicubic(texture2D tex, sampler sampl, vec2 texCoords) {
}
vec4 textureMaybeBicubic(texture2D tex, sampler sampl, vec2 texCoords) {
#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
// TODO: Allow regular `texture` to be used when cause of light leaking issues is found
//#if (CLOUD_MODE >= CLOUD_MODE_HIGH)
return textureBicubic(tex, sampl, texCoords);
#else
vec2 offset = (texCoords + vec2(-1.0, 0.5)) / textureSize(sampler2D(tex, sampl), 0);
return texture(sampler2D(tex, sampl), offset);
#endif
//#else
// vec2 offset = (texCoords + vec2(-1.0, 0.5)) / textureSize(sampler2D(tex, sampl), 0);
// return texture(sampler2D(tex, sampl), offset);
//#endif
}
// 16 bit version (each of the 2 8-bit components are combined after bilinear sampling)

View File

@ -111,7 +111,13 @@ void main() {
uint v_atlas_pos = pos_atlas_pos_norm_ao.y;
// Expand the model vertex position bits into float values
vec3 v_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 8, 16)) & uvec3(0xFFu, 0xFFu, 0x0FFFu)) - ivec3(VERT_EXTRA_NEG_XY, VERT_EXTRA_NEG_XY, VERT_EXTRA_NEG_Z));
// TODO: Use this instead, see [https://gitlab.com/veloren/veloren/-/merge_requests/3091]
//vec3 v_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 8, 16)) & uvec3(0xFFu, 0xFFu, 0x0FFFu)) - ivec3(VERT_EXTRA_NEG_XY, VERT_EXTRA_NEG_XY, VERT_EXTRA_NEG_Z));
vec3 v_pos = vec3(
float(v_pos_norm & 0xFFu) - VERT_EXTRA_NEG_XY,
float((v_pos_norm >> 8) & 0xFFu) - VERT_EXTRA_NEG_XY,
float((v_pos_norm >> 16) & 0x0FFFu) - VERT_EXTRA_NEG_Z
);
// Position of the sprite block in the chunk
// Used for highlighting the selected sprite, and for opening doors
@ -188,7 +194,14 @@ void main() {
// Shader@0x000001AABD89BEE0(112,43-53): error X4576: Input array signature parameter cannot be indexed dynamically.
//vec3 norm = (inst_mat[(v_pos_norm >> 30u) & 3u].xyz);
uint index = v_pos_norm >> 30u & 3u;
vec3 norm = (inst_mat[index].xyz);
vec3 norm;
if (index == 0) {
norm = (inst_mat[0].xyz);
} else if (index == 1) {
norm = (inst_mat[1].xyz);
} else {
norm = (inst_mat[2].xyz);
}
f_norm = normalize(mix(-norm, norm, v_pos_norm >> 29u & 1u));

View File

@ -71,7 +71,9 @@ const float EXTRA_NEG_Z = 32768.0;
void main() {
// over it (if this vertex to see if it intersects.
vec3 f_chunk_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0xFFFFu)) - ivec3(0, 0, EXTRA_NEG_Z));
// TODO: Use the following, see [https://gitlab.com/veloren/veloren/-/merge_requests/3091]
//vec3 f_chunk_pos = vec3(ivec3((uvec3(v_pos_norm) >> uvec3(0, 6, 12)) & uvec3(0x3Fu, 0x3Fu, 0xFFFFu)) - ivec3(0, 0, EXTRA_NEG_Z));
vec3 f_chunk_pos = vec3(v_pos_norm & 0x3Fu, (v_pos_norm >> 6) & 0x3Fu, float((v_pos_norm >> 12) & 0xFFFFu) - EXTRA_NEG_Z);
f_pos = (model_mat * vec4(f_chunk_pos, 1.0)).xyz - focus_off.xyz;