mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
pos_to_uv -> wpos_to_uv
This commit is contained in:
parent
121cf3becc
commit
7752696387
@ -118,8 +118,9 @@ vec2 textureBicubic16(texture2D tex, sampler sampl, vec2 texCoords) {
|
||||
, sy);
|
||||
}
|
||||
|
||||
// Gets the altitude at a position relative to focus_off.
|
||||
float alt_at(vec2 pos) {
|
||||
vec4 alt_sample = textureLod/*textureBicubic16*/(sampler2D(t_alt, s_alt), pos_to_uv(t_alt, s_alt, pos), 0);
|
||||
vec4 alt_sample = textureLod/*textureBicubic16*/(sampler2D(t_alt, s_alt), wpos_to_uv(t_alt, s_alt, focus_off.xy + pos), 0);
|
||||
return (/*round*/((alt_sample.r / 256.0 + alt_sample.g) * (/*1300.0*//*1278.7266845703125*/view_distance.w)) + /*140.0*/view_distance.z - focus_off.z);
|
||||
//+ (texture(t_noise, pos * 0.002).x - 0.5) * 64.0;
|
||||
|
||||
|
@ -101,10 +101,11 @@ float cloud_scale = view_distance.z / 150.0;
|
||||
layout(set = 0, binding = 5) uniform texture2D t_alt;
|
||||
layout(set = 0, binding = 6) uniform sampler s_alt;
|
||||
|
||||
vec2 pos_to_uv(texture2D tex, sampler s, vec2 pos) {
|
||||
// Transforms coordinate in the range 0..WORLD_SIZE to 0..1
|
||||
vec2 wpos_to_uv(texture2D tex, sampler s, vec2 wpos) {
|
||||
// Want: (pixel + 0.5) / W
|
||||
vec2 texSize = textureSize(sampler2D(tex, s), 0);
|
||||
vec2 uv_pos = (focus_off.xy + pos + 16) / (32.0 * texSize);
|
||||
vec2 uv_pos = (wpos + 16) / (32.0 * texSize);
|
||||
return vec2(uv_pos.x, /*1.0 - */uv_pos.y);
|
||||
}
|
||||
|
||||
@ -113,15 +114,15 @@ layout(set = 0, binding = 12) uniform texture2D t_weather;
|
||||
layout(set = 0, binding = 13) uniform sampler s_weather;
|
||||
|
||||
vec4 sample_weather(vec2 wpos) {
|
||||
return textureLod(sampler2D(t_weather, s_weather), pos_to_uv(t_alt, s_alt, wpos - focus_off.xy), 0);
|
||||
return textureLod(sampler2D(t_weather, s_weather), wpos_to_uv(t_alt, s_alt, wpos), 0);
|
||||
}
|
||||
|
||||
float cloud_tendency_at(vec2 pos) {
|
||||
return sample_weather(pos).r;
|
||||
float cloud_tendency_at(vec2 wpos) {
|
||||
return sample_weather(wpos).r;
|
||||
}
|
||||
|
||||
float rain_density_at(vec2 pos) {
|
||||
return sample_weather(pos).g;
|
||||
float rain_density_at(vec2 wpos) {
|
||||
return sample_weather(wpos).g;
|
||||
}
|
||||
|
||||
float cloud_shadow(vec3 pos, vec3 light_dir) {
|
||||
|
Loading…
Reference in New Issue
Block a user