add 'graphics.clouds-quality' setting

This commit is contained in:
MihailRis 2026-02-12 18:34:32 +03:00
parent 8153ddde89
commit 1194379f99
7 changed files with 18 additions and 7 deletions

View file

@ -229,7 +229,8 @@ void CloudsRenderer::draw(
const Weather& weather,
float timer,
float fogFactor,
const Camera& camera
const Camera& camera,
int quality
) {
float clouds = weather.clouds();
shader.uniform4f(
@ -247,7 +248,7 @@ void CloudsRenderer::draw(
int cellZ = glm::floor(camera.position.z / totalDepth + 0.5f);
float speed = 4.0f;
for (int i = 0; i < 2; i++) {
for (int i = 0; i < std::min<int>(quality, testMeshes.size()); i++) {
float speedX = glm::sin(i * 0.3f + 0.4f) * speed / (i + 1);
float speedZ = -glm::cos(i * 0.3f + 0.4f) * speed / (i + 1);
for (int x = -2; x <= 2; x++) {

View file

@ -18,7 +18,8 @@ public:
const Weather& weather,
float timer,
float fogFactor,
const Camera& camera
const Camera& camera,
int quality
);
private:
std::array<std::unique_ptr<Mesh<ChunkVertex>>, 2> testMeshes;

View file

@ -215,8 +215,13 @@ void WorldRenderer::renderOpaque(
chunksRenderer->drawChunks(camera, shader);
blockWraps->draw(ctx, player);
setupWorldShader(cloudsShader, camera, settings, fogFactor);
cloudsRenderer->draw(cloudsShader, weather, timer, fogFactor, camera);
int cloudsQuality = settings.graphics.cloudsQuality.get();
if (cloudsQuality > 0) {
setupWorldShader(cloudsShader, camera, settings, fogFactor);
cloudsRenderer->draw(
cloudsShader, weather, timer, fogFactor, camera, cloudsQuality
);
}
if (hudVisible) {
renderLines(camera, linesShader, ctx);