fix: skybox is not visible behind translucent blocks
This commit is contained in:
parent
705e398bc3
commit
7cf073f079
@ -5,6 +5,7 @@
|
|||||||
"main",
|
"main",
|
||||||
"lines",
|
"lines",
|
||||||
"entity",
|
"entity",
|
||||||
|
"translucent",
|
||||||
"background",
|
"background",
|
||||||
"skybox_gen",
|
"skybox_gen",
|
||||||
"shadows"
|
"shadows"
|
||||||
|
|||||||
@ -3,27 +3,18 @@ layout (location = 1) out vec4 f_position;
|
|||||||
layout (location = 2) out vec4 f_normal;
|
layout (location = 2) out vec4 f_normal;
|
||||||
layout (location = 3) out vec4 f_emission;
|
layout (location = 3) out vec4 f_emission;
|
||||||
|
|
||||||
in float a_distance;
|
#include <world_fragment_header>
|
||||||
in float a_fog;
|
|
||||||
in vec2 a_texCoord;
|
|
||||||
in vec3 a_dir;
|
|
||||||
in vec3 a_normal;
|
|
||||||
in vec3 a_position;
|
|
||||||
in vec3 a_realnormal;
|
|
||||||
in vec4 a_color;
|
in vec4 a_color;
|
||||||
in vec4 a_modelpos;
|
|
||||||
in float a_emission;
|
|
||||||
|
|
||||||
uniform sampler2D u_texture0;
|
uniform sampler2D u_texture0;
|
||||||
uniform samplerCube u_skybox;
|
|
||||||
uniform vec3 u_fogColor;
|
uniform vec3 u_fogColor;
|
||||||
uniform float u_fogFactor;
|
uniform float u_fogFactor;
|
||||||
uniform float u_fogCurve;
|
uniform float u_fogCurve;
|
||||||
uniform bool u_alphaClip;
|
uniform bool u_alphaClip;
|
||||||
uniform vec3 u_sunDir;
|
uniform vec3 u_sunDir;
|
||||||
|
|
||||||
#include <shadows>
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 texColor = texture(u_texture0, a_texCoord);
|
vec4 texColor = texture(u_texture0, a_texCoord);
|
||||||
float alpha = a_color.a * texColor.a;
|
float alpha = a_color.a * texColor.a;
|
||||||
|
|||||||
@ -6,44 +6,23 @@ layout (location = 2) in vec3 v_color;
|
|||||||
layout (location = 3) in vec4 v_light;
|
layout (location = 3) in vec4 v_light;
|
||||||
layout (location = 4) in vec4 v_normal;
|
layout (location = 4) in vec4 v_normal;
|
||||||
|
|
||||||
out float a_distance;
|
#include <world_vertex_header>
|
||||||
out float a_fog;
|
|
||||||
out vec2 a_texCoord;
|
|
||||||
out vec3 a_dir;
|
|
||||||
out vec3 a_normal;
|
|
||||||
out vec3 a_position;
|
|
||||||
out vec3 a_realnormal;
|
|
||||||
out vec4 a_color;
|
|
||||||
out vec4 a_modelpos;
|
|
||||||
out float a_emission;
|
|
||||||
|
|
||||||
uniform mat4 u_model;
|
|
||||||
uniform mat4 u_proj;
|
|
||||||
uniform mat4 u_view;
|
|
||||||
uniform vec3 u_cameraPos;
|
|
||||||
uniform float u_gamma;
|
|
||||||
uniform float u_opacity;
|
|
||||||
uniform float u_timer;
|
|
||||||
uniform samplerCube u_skybox;
|
|
||||||
|
|
||||||
uniform vec3 u_torchlightColor;
|
|
||||||
uniform float u_torchlightDistance;
|
|
||||||
|
|
||||||
#include <lighting>
|
#include <lighting>
|
||||||
#include <fog>
|
#include <fog>
|
||||||
|
#include <sky>
|
||||||
|
|
||||||
|
out vec4 a_color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
a_modelpos = u_model * vec4(v_position, 1.0);
|
a_modelpos = u_model * vec4(v_position, 1.0);
|
||||||
vec3 pos3d = a_modelpos.xyz - u_cameraPos;
|
vec3 pos3d = a_modelpos.xyz - u_cameraPos;
|
||||||
a_modelpos.xyz = apply_planet_curvature(a_modelpos.xyz, pos3d);
|
|
||||||
|
|
||||||
a_realnormal = v_normal.xyz * 2.0 - 1.0;
|
a_realnormal = v_normal.xyz * 2.0 - 1.0;
|
||||||
a_normal = calc_screen_normal(a_realnormal);
|
a_normal = calc_screen_normal(a_realnormal);
|
||||||
|
|
||||||
vec3 light = v_light.rgb;
|
a_color = vec4(calc_torch_light(
|
||||||
float torchlight = calc_torch_light(a_realnormal, a_modelpos.xyz);
|
v_light.rgb, a_realnormal, a_modelpos.xyz, u_torchlightColor, u_gamma
|
||||||
light += torchlight * u_torchlightColor;
|
), 1.0);
|
||||||
a_color = vec4(pow(light, vec3(u_gamma)), 1.0f);
|
|
||||||
a_texCoord = v_texCoord;
|
a_texCoord = v_texCoord;
|
||||||
|
|
||||||
a_dir = a_modelpos.xyz - u_cameraPos;
|
a_dir = a_modelpos.xyz - u_cameraPos;
|
||||||
|
|||||||
@ -1,14 +1,7 @@
|
|||||||
#ifndef COMMONS_GLSL_
|
#ifndef COMMONS_GLSL_
|
||||||
#define COMMONS_GLSL_
|
#define COMMONS_GLSL_
|
||||||
#include <constants>
|
|
||||||
|
|
||||||
vec3 pick_sky_color(samplerCube cubemap) {
|
#include <constants>
|
||||||
vec3 skyLightColor = texture(cubemap, vec3(0.4f, 0.0f, 0.4f)).rgb;
|
|
||||||
skyLightColor *= SKY_LIGHT_TINT;
|
|
||||||
skyLightColor = min(vec3(1.0f), skyLightColor * SKY_LIGHT_MUL);
|
|
||||||
skyLightColor = max(MIN_SKY_LIGHT, skyLightColor);
|
|
||||||
return skyLightColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 apply_planet_curvature(vec3 modelPos, vec3 pos3d) {
|
vec3 apply_planet_curvature(vec3 modelPos, vec3 pos3d) {
|
||||||
modelPos.y -= pow(length(pos3d.xz) * CURVATURE_FACTOR, 3.0f);
|
modelPos.y -= pow(length(pos3d.xz) * CURVATURE_FACTOR, 3.0f);
|
||||||
|
|||||||
@ -6,6 +6,11 @@ float calc_torch_light(vec3 normal, vec3 modelpos) {
|
|||||||
* max(0.0, -dot(normal, normalize(modelpos - u_cameraPos)));
|
* max(0.0, -dot(normal, normalize(modelpos - u_cameraPos)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec3 calc_torch_light(vec3 light, vec3 normal, vec3 modelpos, vec3 torchLightColor, float gamma) {
|
||||||
|
float torchlight = calc_torch_light(normal, modelpos);
|
||||||
|
return pow(light + torchlight * torchLightColor, vec3(gamma));
|
||||||
|
}
|
||||||
|
|
||||||
vec3 calc_screen_normal(vec3 normal) {
|
vec3 calc_screen_normal(vec3 normal) {
|
||||||
return transpose(inverse(mat3(u_view * u_model))) * normal;
|
return transpose(inverse(mat3(u_view * u_model))) * normal;
|
||||||
}
|
}
|
||||||
|
|||||||
14
res/shaders/lib/sky.glsl
Normal file
14
res/shaders/lib/sky.glsl
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef COMMONS_SKY_
|
||||||
|
#define COMMONS_SKY_
|
||||||
|
|
||||||
|
#include <constants>
|
||||||
|
|
||||||
|
vec3 pick_sky_color(samplerCube cubemap) {
|
||||||
|
vec3 skyLightColor = texture(cubemap, vec3(0.4f, 0.0f, 0.4f)).rgb;
|
||||||
|
skyLightColor *= SKY_LIGHT_TINT;
|
||||||
|
skyLightColor = min(vec3(1.0f), skyLightColor * SKY_LIGHT_MUL);
|
||||||
|
skyLightColor = max(MIN_SKY_LIGHT, skyLightColor);
|
||||||
|
return skyLightColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // COMMONS_SKY_
|
||||||
17
res/shaders/lib/world_fragment_header.glsl
Normal file
17
res/shaders/lib/world_fragment_header.glsl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef GLSL_WORLD_FRAGMENT_HEADER_
|
||||||
|
#define GLSL_WORLD_FRAGMENT_HEADER_
|
||||||
|
|
||||||
|
in float a_distance;
|
||||||
|
in float a_fog;
|
||||||
|
in vec2 a_texCoord;
|
||||||
|
in vec3 a_dir;
|
||||||
|
in vec3 a_normal;
|
||||||
|
in vec3 a_position;
|
||||||
|
in vec3 a_realnormal;
|
||||||
|
in vec3 a_skyLight;
|
||||||
|
in vec4 a_modelpos;
|
||||||
|
in float a_emission;
|
||||||
|
|
||||||
|
#include <world_uniforms>
|
||||||
|
|
||||||
|
#endif // GLSL_WORLD_FRAGMENT_HEADER_
|
||||||
15
res/shaders/lib/world_uniforms.glsl
Normal file
15
res/shaders/lib/world_uniforms.glsl
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef GLSL_WORLD_UNIFORMS_
|
||||||
|
#define GLSL_WORLD_UNIFORMS_
|
||||||
|
|
||||||
|
uniform mat4 u_model;
|
||||||
|
uniform mat4 u_proj;
|
||||||
|
uniform mat4 u_view;
|
||||||
|
uniform vec3 u_cameraPos;
|
||||||
|
uniform float u_gamma;
|
||||||
|
uniform float u_opacity;
|
||||||
|
uniform float u_timer;
|
||||||
|
uniform samplerCube u_skybox;
|
||||||
|
uniform vec3 u_torchlightColor;
|
||||||
|
uniform float u_torchlightDistance;
|
||||||
|
|
||||||
|
#endif // GLSL_WORLD_UNIFORMS_
|
||||||
17
res/shaders/lib/world_vertex_header.glsl
Normal file
17
res/shaders/lib/world_vertex_header.glsl
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef GLSL_WORLD_VERTEX_HEADER_
|
||||||
|
#define GLSL_WORLD_VERTEX_HEADER_
|
||||||
|
|
||||||
|
out float a_distance;
|
||||||
|
out float a_fog;
|
||||||
|
out vec2 a_texCoord;
|
||||||
|
out vec3 a_dir;
|
||||||
|
out vec3 a_normal;
|
||||||
|
out vec3 a_position;
|
||||||
|
out vec3 a_realnormal;
|
||||||
|
out vec3 a_skyLight;
|
||||||
|
out vec4 a_modelpos;
|
||||||
|
out float a_emission;
|
||||||
|
|
||||||
|
#include <world_uniforms>
|
||||||
|
|
||||||
|
#endif // GLSL_WORLD_VERTEX_HEADER_
|
||||||
@ -3,20 +3,11 @@ layout (location = 1) out vec4 f_position;
|
|||||||
layout (location = 2) out vec4 f_normal;
|
layout (location = 2) out vec4 f_normal;
|
||||||
layout (location = 3) out vec4 f_emission;
|
layout (location = 3) out vec4 f_emission;
|
||||||
|
|
||||||
in float a_distance;
|
#include <world_fragment_header>
|
||||||
in float a_fog;
|
|
||||||
in vec2 a_texCoord;
|
|
||||||
in vec3 a_dir;
|
|
||||||
in vec3 a_normal;
|
|
||||||
in vec3 a_position;
|
|
||||||
in vec3 a_realnormal;
|
|
||||||
in vec3 a_skyLight;
|
|
||||||
in vec4 a_modelpos;
|
|
||||||
in vec4 a_torchLight;
|
in vec4 a_torchLight;
|
||||||
in float a_emission;
|
|
||||||
|
|
||||||
uniform sampler2D u_texture0;
|
uniform sampler2D u_texture0;
|
||||||
uniform samplerCube u_skybox;
|
|
||||||
uniform vec3 u_sunDir;
|
uniform vec3 u_sunDir;
|
||||||
|
|
||||||
// flags
|
// flags
|
||||||
@ -24,8 +15,6 @@ uniform bool u_alphaClip;
|
|||||||
uniform bool u_debugLights;
|
uniform bool u_debugLights;
|
||||||
uniform bool u_debugNormals;
|
uniform bool u_debugNormals;
|
||||||
|
|
||||||
#include <shadows>
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 texColor = texture(u_texture0, a_texCoord);
|
vec4 texColor = texture(u_texture0, a_texCoord);
|
||||||
float alpha = texColor.a;
|
float alpha = texColor.a;
|
||||||
@ -39,9 +28,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
if (u_debugLights)
|
if (u_debugLights)
|
||||||
texColor.rgb = u_debugNormals ? (a_normal * 0.5 + 0.5) : vec3(1.0);
|
texColor.rgb = u_debugNormals ? (a_normal * 0.5 + 0.5) : vec3(1.0);
|
||||||
else if (u_debugNormals) {
|
|
||||||
texColor.rgb *= a_normal * 0.5 + 0.5;
|
|
||||||
}
|
|
||||||
f_color = texColor;
|
f_color = texColor;
|
||||||
f_color.rgb *= min(vec3(1.0), a_torchLight.rgb + a_skyLight);
|
f_color.rgb *= min(vec3(1.0), a_torchLight.rgb + a_skyLight);
|
||||||
|
|
||||||
|
|||||||
@ -5,44 +5,23 @@ layout (location = 1) in vec2 v_texCoord;
|
|||||||
layout (location = 2) in vec4 v_light;
|
layout (location = 2) in vec4 v_light;
|
||||||
layout (location = 3) in vec4 v_normal;
|
layout (location = 3) in vec4 v_normal;
|
||||||
|
|
||||||
out float a_distance;
|
#include <world_vertex_header>
|
||||||
out float a_fog;
|
|
||||||
out vec2 a_texCoord;
|
|
||||||
out vec3 a_dir;
|
|
||||||
out vec3 a_normal;
|
|
||||||
out vec3 a_position;
|
|
||||||
out vec3 a_realnormal;
|
|
||||||
out vec4 a_torchLight;
|
|
||||||
out vec3 a_skyLight;
|
|
||||||
out vec4 a_modelpos;
|
|
||||||
out float a_emission;
|
|
||||||
|
|
||||||
uniform mat4 u_model;
|
|
||||||
uniform mat4 u_proj;
|
|
||||||
uniform mat4 u_view;
|
|
||||||
uniform vec3 u_cameraPos;
|
|
||||||
uniform float u_gamma;
|
|
||||||
uniform float u_timer;
|
|
||||||
uniform samplerCube u_skybox;
|
|
||||||
|
|
||||||
uniform vec3 u_torchlightColor;
|
|
||||||
uniform float u_torchlightDistance;
|
|
||||||
|
|
||||||
#include <lighting>
|
#include <lighting>
|
||||||
#include <fog>
|
#include <fog>
|
||||||
|
#include <sky>
|
||||||
|
|
||||||
|
out vec4 a_torchLight;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
a_modelpos = u_model * vec4(v_position, 1.0f);
|
a_modelpos = u_model * vec4(v_position, 1.0f);
|
||||||
vec3 pos3d = a_modelpos.xyz - u_cameraPos;
|
vec3 pos3d = a_modelpos.xyz - u_cameraPos;
|
||||||
a_modelpos.xyz = apply_planet_curvature(a_modelpos.xyz, pos3d);
|
|
||||||
|
|
||||||
a_realnormal = v_normal.xyz * 2.0 - 1.0;
|
a_realnormal = v_normal.xyz * 2.0 - 1.0;
|
||||||
a_normal = calc_screen_normal(a_realnormal);
|
a_normal = calc_screen_normal(a_realnormal);
|
||||||
|
|
||||||
vec3 light = v_light.rgb;
|
a_torchLight = vec4(calc_torch_light(
|
||||||
float torchlight = calc_torch_light(a_realnormal, a_modelpos.xyz);
|
v_light.rgb, a_realnormal, a_modelpos.xyz, u_torchlightColor, u_gamma
|
||||||
a_torchLight = vec4(pow(light + torchlight * u_torchlightColor, vec3(u_gamma)), 1.0f);
|
), 1.0);
|
||||||
|
|
||||||
a_texCoord = v_texCoord;
|
a_texCoord = v_texCoord;
|
||||||
|
|
||||||
a_dir = a_modelpos.xyz - u_cameraPos;
|
a_dir = a_modelpos.xyz - u_cameraPos;
|
||||||
@ -51,9 +30,11 @@ void main() {
|
|||||||
|
|
||||||
mat4 viewmodel = u_view * u_model;
|
mat4 viewmodel = u_view * u_model;
|
||||||
a_distance = length(viewmodel * vec4(pos3d, 0.0));
|
a_distance = length(viewmodel * vec4(pos3d, 0.0));
|
||||||
|
|
||||||
#ifndef ADVANCED_RENDER
|
#ifndef ADVANCED_RENDER
|
||||||
a_fog = calc_fog(length(viewmodel * vec4(pos3d * FOG_POS_SCALE, 0.0)) / 256.0);
|
a_fog = calc_fog(length(viewmodel * vec4(pos3d * FOG_POS_SCALE, 0.0)) / 256.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
a_emission = v_normal.w;
|
a_emission = v_normal.w;
|
||||||
|
|
||||||
vec4 viewmodelpos = u_view * a_modelpos;
|
vec4 viewmodelpos = u_view * a_modelpos;
|
||||||
|
|||||||
38
res/shaders/translucent.glslf
Normal file
38
res/shaders/translucent.glslf
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
layout (location = 0) out vec4 f_color;
|
||||||
|
|
||||||
|
#include <world_fragment_header>
|
||||||
|
|
||||||
|
in vec4 a_torchLight;
|
||||||
|
|
||||||
|
uniform sampler2D u_texture0;
|
||||||
|
uniform vec3 u_sunDir;
|
||||||
|
|
||||||
|
// flags
|
||||||
|
uniform bool u_alphaClip;
|
||||||
|
uniform bool u_debugLights;
|
||||||
|
uniform bool u_debugNormals;
|
||||||
|
|
||||||
|
#include <shadows>
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec4 texColor = texture(u_texture0, a_texCoord);
|
||||||
|
float alpha = texColor.a;
|
||||||
|
if (u_alphaClip) {
|
||||||
|
if (alpha < 0.2f)
|
||||||
|
discard;
|
||||||
|
alpha = 1.0;
|
||||||
|
} else {
|
||||||
|
if (alpha < 0.002f)
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
if (u_debugLights)
|
||||||
|
texColor.rgb = u_debugNormals ? (a_normal * 0.5 + 0.5) : vec3(1.0);
|
||||||
|
|
||||||
|
f_color = texColor;
|
||||||
|
f_color.rgb *= min(vec3(1.0), a_torchLight.rgb + a_skyLight
|
||||||
|
* calc_shadow(a_modelpos, a_realnormal, length(a_position)));
|
||||||
|
|
||||||
|
vec3 fogColor = texture(u_skybox, a_dir).rgb;
|
||||||
|
f_color = mix(f_color, vec4(fogColor, 1.0), a_fog);
|
||||||
|
f_color.a = alpha;
|
||||||
|
}
|
||||||
39
res/shaders/translucent.glslv
Normal file
39
res/shaders/translucent.glslv
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include <commons>
|
||||||
|
|
||||||
|
layout (location = 0) in vec3 v_position;
|
||||||
|
layout (location = 1) in vec2 v_texCoord;
|
||||||
|
layout (location = 2) in vec4 v_light;
|
||||||
|
layout (location = 3) in vec4 v_normal;
|
||||||
|
|
||||||
|
#include <world_vertex_header>
|
||||||
|
#include <lighting>
|
||||||
|
#include <fog>
|
||||||
|
#include <sky>
|
||||||
|
|
||||||
|
out vec4 a_torchLight;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
a_modelpos = u_model * vec4(v_position, 1.0f);
|
||||||
|
vec3 pos3d = a_modelpos.xyz - u_cameraPos;
|
||||||
|
|
||||||
|
a_realnormal = v_normal.xyz * 2.0 - 1.0;
|
||||||
|
a_normal = calc_screen_normal(a_realnormal);
|
||||||
|
|
||||||
|
a_torchLight = vec4(calc_torch_light(
|
||||||
|
v_light.rgb, a_realnormal, a_modelpos.xyz, u_torchlightColor, u_gamma
|
||||||
|
), 1.0);
|
||||||
|
a_texCoord = v_texCoord;
|
||||||
|
|
||||||
|
a_dir = a_modelpos.xyz - u_cameraPos;
|
||||||
|
vec3 skyLightColor = pick_sky_color(u_skybox);
|
||||||
|
a_skyLight = skyLightColor.rgb*v_light.a;
|
||||||
|
|
||||||
|
mat4 viewmodel = u_view * u_model;
|
||||||
|
a_distance = length(viewmodel * vec4(pos3d, 0.0));
|
||||||
|
a_fog = calc_fog(length(viewmodel * vec4(pos3d * FOG_POS_SCALE, 0.0)) / 256.0);
|
||||||
|
a_emission = v_normal.w;
|
||||||
|
|
||||||
|
vec4 viewmodelpos = u_view * a_modelpos;
|
||||||
|
a_position = viewmodelpos.xyz;
|
||||||
|
gl_Position = u_proj * viewmodelpos;
|
||||||
|
}
|
||||||
@ -220,8 +220,6 @@ void WorldRenderer::renderLevel(
|
|||||||
if (hudVisible) {
|
if (hudVisible) {
|
||||||
renderLines(camera, linesShader, ctx);
|
renderLines(camera, linesShader, ctx);
|
||||||
}
|
}
|
||||||
shader.use();
|
|
||||||
chunks->drawSortedMeshes(camera, shader);
|
|
||||||
|
|
||||||
if (!pause) {
|
if (!pause) {
|
||||||
scripting::on_frontend_render();
|
scripting::on_frontend_render();
|
||||||
@ -431,6 +429,7 @@ void WorldRenderer::draw(
|
|||||||
|
|
||||||
auto& mainShader = assets.require<Shader>("main");
|
auto& mainShader = assets.require<Shader>("main");
|
||||||
auto& entityShader = assets.require<Shader>("entity");
|
auto& entityShader = assets.require<Shader>("entity");
|
||||||
|
auto& translucentShader = assets.require<Shader>("translucent");
|
||||||
auto& deferredShader = assets.require<PostEffect>("deferred_lighting").getShader();
|
auto& deferredShader = assets.require<PostEffect>("deferred_lighting").getShader();
|
||||||
const auto& settings = engine.getSettings();
|
const auto& settings = engine.getSettings();
|
||||||
|
|
||||||
@ -463,6 +462,7 @@ void WorldRenderer::draw(
|
|||||||
mainShader.recompile();
|
mainShader.recompile();
|
||||||
entityShader.recompile();
|
entityShader.recompile();
|
||||||
deferredShader.recompile();
|
deferredShader.recompile();
|
||||||
|
translucentShader.recompile();
|
||||||
prevCTShaderSettings = currentSettings;
|
prevCTShaderSettings = currentSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,6 +525,7 @@ void WorldRenderer::draw(
|
|||||||
{
|
{
|
||||||
DrawContext ctx = pctx.sub();
|
DrawContext ctx = pctx.sub();
|
||||||
ctx.setDepthTest(true);
|
ctx.setDepthTest(true);
|
||||||
|
|
||||||
if (gbufferPipeline) {
|
if (gbufferPipeline) {
|
||||||
postProcessing.bindDepthBuffer();
|
postProcessing.bindDepthBuffer();
|
||||||
} else {
|
} else {
|
||||||
@ -533,6 +534,16 @@ void WorldRenderer::draw(
|
|||||||
// Drawing background sky plane
|
// Drawing background sky plane
|
||||||
skybox->draw(ctx, camera, assets, worldInfo.daytime, clouds);
|
skybox->draw(ctx, camera, assets, worldInfo.daytime, clouds);
|
||||||
|
|
||||||
|
{
|
||||||
|
auto sctx = ctx.sub();
|
||||||
|
sctx.setCullFace(true);
|
||||||
|
skybox->bind();
|
||||||
|
translucentShader.use();
|
||||||
|
setupWorldShader(translucentShader, camera, settings, fogFactor);
|
||||||
|
chunks->drawSortedMeshes(camera, translucentShader);
|
||||||
|
skybox->unbind();
|
||||||
|
}
|
||||||
|
|
||||||
entityShader.use();
|
entityShader.use();
|
||||||
setupWorldShader(entityShader, camera, settings, fogFactor);
|
setupWorldShader(entityShader, camera, settings, fogFactor);
|
||||||
|
|
||||||
@ -553,7 +564,6 @@ void WorldRenderer::draw(
|
|||||||
}
|
}
|
||||||
postProcessing.render(pctx, assets, timer, camera);
|
postProcessing.render(pctx, assets, timer, camera);
|
||||||
|
|
||||||
skybox->unbind();
|
|
||||||
if (player.currentCamera == player.fpCamera) {
|
if (player.currentCamera == player.fpCamera) {
|
||||||
DrawContext ctx = pctx.sub();
|
DrawContext ctx = pctx.sub();
|
||||||
ctx.setDepthTest(true);
|
ctx.setDepthTest(true);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user