fix: backlight setting not applying on change
This commit is contained in:
@@ -45,12 +45,14 @@ LevelScreen::LevelScreen(Engine* engine, std::unique_ptr<Level> level)
|
|||||||
|
|
||||||
keepAlive(settings.graphics.backlight.observe([=](bool) {
|
keepAlive(settings.graphics.backlight.observe([=](bool) {
|
||||||
controller->getLevel()->chunks->saveAndClear();
|
controller->getLevel()->chunks->saveAndClear();
|
||||||
|
worldRenderer->clear();
|
||||||
}));
|
}));
|
||||||
keepAlive(settings.camera.fov.observe([=](double value) {
|
keepAlive(settings.camera.fov.observe([=](double value) {
|
||||||
controller->getPlayer()->camera->setFov(glm::radians(value));
|
controller->getPlayer()->camera->setFov(glm::radians(value));
|
||||||
}));
|
}));
|
||||||
keepAlive(Events::getBinding(BIND_CHUNKS_RELOAD).onactived.add([=](){
|
keepAlive(Events::getBinding(BIND_CHUNKS_RELOAD).onactived.add([=](){
|
||||||
controller->getLevel()->chunks->saveAndClear();
|
controller->getLevel()->chunks->saveAndClear();
|
||||||
|
worldRenderer->clear();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
animator = std::make_unique<TextureAnimator>();
|
animator = std::make_unique<TextureAnimator>();
|
||||||
|
|||||||
@@ -79,6 +79,12 @@ void ChunksRenderer::unload(const Chunk* chunk) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChunksRenderer::clear() {
|
||||||
|
meshes.clear();
|
||||||
|
inwork.clear();
|
||||||
|
threadPool.clearQueue();
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<Mesh> ChunksRenderer::getOrRender(const std::shared_ptr<Chunk>& chunk, bool important) {
|
std::shared_ptr<Mesh> ChunksRenderer::getOrRender(const std::shared_ptr<Chunk>& chunk, bool important) {
|
||||||
auto found = meshes.find(glm::ivec2(chunk->x, chunk->z));
|
auto found = meshes.find(glm::ivec2(chunk->x, chunk->z));
|
||||||
if (found == meshes.end()) {
|
if (found == meshes.end()) {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public:
|
|||||||
|
|
||||||
std::shared_ptr<Mesh> render(const std::shared_ptr<Chunk>& chunk, bool important);
|
std::shared_ptr<Mesh> render(const std::shared_ptr<Chunk>& chunk, bool important);
|
||||||
void unload(const Chunk* chunk);
|
void unload(const Chunk* chunk);
|
||||||
|
void clear();
|
||||||
|
|
||||||
std::shared_ptr<Mesh> getOrRender(const std::shared_ptr<Chunk>& chunk, bool important);
|
std::shared_ptr<Mesh> getOrRender(const std::shared_ptr<Chunk>& chunk, bool important);
|
||||||
std::shared_ptr<Mesh> get(Chunk* chunk);
|
std::shared_ptr<Mesh> get(Chunk* chunk);
|
||||||
|
|||||||
@@ -410,3 +410,7 @@ void WorldRenderer::drawBorders(
|
|||||||
}
|
}
|
||||||
lineBatch->flush();
|
lineBatch->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldRenderer::clear() {
|
||||||
|
renderer->clear();
|
||||||
|
}
|
||||||
|
|||||||
@@ -96,4 +96,6 @@ public:
|
|||||||
float delta,
|
float delta,
|
||||||
bool pause
|
bool pause
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void clear();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -237,6 +237,11 @@ namespace util {
|
|||||||
jobsMutexCondition.notify_one();
|
jobsMutexCondition.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearQueue() {
|
||||||
|
std::lock_guard<std::mutex> lock(jobsMutex);
|
||||||
|
jobs = {};
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief If false: worker will be blocked until it's result performed
|
/// @brief If false: worker will be blocked until it's result performed
|
||||||
void setStandaloneResults(bool flag) {
|
void setStandaloneResults(bool flag) {
|
||||||
standaloneResults = flag;
|
standaloneResults = flag;
|
||||||
|
|||||||
Reference in New Issue
Block a user