mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 09:29:44 +00:00
fix lighting settings based chunk meshes rebuilding
This commit is contained in:
parent
482f6d4a18
commit
c641a18d32
2 changed files with 19 additions and 2 deletions
|
|
@ -89,9 +89,25 @@ LevelScreen::LevelScreen(
|
|||
resetChunks(false);
|
||||
frontend->getContentGfxCache().refresh();
|
||||
}));
|
||||
keepAlive(settings.graphics.shadowsQuality.observe([=](int quality) {
|
||||
auto graphics = &settings.graphics;
|
||||
auto shadowsMeshing = std::make_shared<bool>(
|
||||
graphics->shadowsQuality.get() > 0 && graphics->advancedRender.get()
|
||||
);
|
||||
auto updateShadowsMeshing = [=]() {
|
||||
bool enabled =
|
||||
graphics->shadowsQuality.get() > 0 && graphics->advancedRender.get();
|
||||
if (enabled == *shadowsMeshing) {
|
||||
return;
|
||||
}
|
||||
*shadowsMeshing = enabled;
|
||||
resetChunks(false);
|
||||
frontend->getContentGfxCache().refresh();
|
||||
};
|
||||
keepAlive(settings.graphics.shadowsQuality.observe([=](int) {
|
||||
updateShadowsMeshing();
|
||||
}));
|
||||
keepAlive(settings.graphics.advancedRender.observe([=](bool) {
|
||||
updateShadowsMeshing();
|
||||
}));
|
||||
keepAlive(settings.camera.fov.observe([=](double value) {
|
||||
player->fpCamera->setFov(glm::radians(value));
|
||||
|
|
|
|||
|
|
@ -696,7 +696,8 @@ SortingMeshData BlocksRenderer::renderTranslucent(
|
|||
void BlocksRenderer::build(
|
||||
const Chunk* chunk, const VoxelsRenderVolume& volume
|
||||
) {
|
||||
directionalLightFactor = settings.graphics.shadowsQuality.get() > 0.0f
|
||||
directionalLightFactor = settings.graphics.shadowsQuality.get() > 0 &&
|
||||
settings.graphics.advancedRender.get()
|
||||
? 0.0f
|
||||
: DEFAULT_DIRECTIONAL_LIGHT_FACTOR;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue