Made the camera go dark if in a filled block and not moderator

This commit is contained in:
Joshua Barretto 2021-09-08 12:37:15 +01:00
parent aaaa5a9ae9
commit c3a0a1b8b5
3 changed files with 15 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include <anti-aliasing.glsl>
#include <srgb.glsl>
#include <cloud.glsl>
#include <random.glsl>
layout(set = 1, binding = 0)
uniform texture2D t_src_color;
@ -184,6 +185,11 @@ void main() {
// float bright_color = (bright_color0 + bright_color1 + bright_color2 + bright_color3 + bright_color4) / 5.0;
if (medium.x == 2u) {
tgt_color = vec4(0, 0.005, 0.01, 1) * (1 + hash_fast(uvec3(vec3(uv * screen_res.xy / 32.0, 0))));
return;
}
vec4 aa_color = aa_apply(t_src_color, s_src_color, uv * screen_res.xy, screen_res.xy);
// Bloom

View File

@ -137,7 +137,13 @@ impl Globals {
0.0,
0.0,
],
medium: [if medium.is_liquid() { 1 } else { 0 }; 4],
medium: [if medium.is_liquid() {
1
} else if medium.is_filled() {
2
} else {
0
}; 4],
select_pos: select_pos
.map(|sp| Vec4::from(sp) + Vec4::unit_w())
.unwrap_or_else(Vec4::zero)

View File

@ -644,6 +644,8 @@ impl Scene {
.terrain()
.get((cam_pos + focus_off).map(|e| e.floor() as i32))
.map(|b| b.kind())
// Don't block the camera's view in solid blocks if the player is a moderator
.filter(|b| !(b.is_filled() && self.client.is_moderator()))
.unwrap_or(BlockKind::Air),
self.select_pos.map(|e| e - focus_off.map(|e| e as i32)),
scene_data.gamma,