trackbar track-width semantic update + gamma setting trackbar

This commit is contained in:
MihailRis
2024-04-25 06:00:35 +03:00
parent b1a79e3a6e
commit 8be0d157c2
11 changed files with 30 additions and 26 deletions
+3 -2
View File
@@ -9,6 +9,7 @@
#include "../../voxels/ChunksStorage.h"
#include "../../lighting/Lightmap.h"
#include "../../frontend/ContentGfxCache.h"
#include "../../settings.h"
#include <glm/glm.hpp>
@@ -23,7 +24,7 @@ BlocksRenderer::BlocksRenderer(
size_t capacity,
const Content* content,
const ContentGfxCache* cache,
const EngineSettings& settings
const EngineSettings* settings
) : content(content),
vertexOffset(0),
indexOffset(0),
@@ -448,7 +449,7 @@ void BlocksRenderer::render(const voxel* voxels) {
void BlocksRenderer::build(const Chunk* chunk, const ChunksStorage* chunks) {
this->chunk = chunk;
voxelsBuffer->setPosition(chunk->x * CHUNK_W - 1, 0, chunk->z * CHUNK_D - 1);
chunks->getVoxels(voxelsBuffer, settings.graphics.backlight.get());
chunks->getVoxels(voxelsBuffer, settings->graphics.backlight.get());
overflow = false;
vertexOffset = 0;
indexOffset = indexSize = 0;
+3 -3
View File
@@ -6,7 +6,6 @@
#include <glm/glm.hpp>
#include "../../voxels/voxel.h"
#include "../../typedefs.h"
#include "../../settings.h"
class Content;
class Mesh;
@@ -16,6 +15,7 @@ class Chunks;
class VoxelsVolume;
class ChunksStorage;
class ContentGfxCache;
struct EngineSettings;
struct UVRegion;
class BlocksRenderer {
@@ -35,7 +35,7 @@ class BlocksRenderer {
const Block* const* blockDefsCache;
const ContentGfxCache* const cache;
const EngineSettings& settings;
const EngineSettings* settings;
void vertex(const glm::vec3& coord, float u, float v, const glm::vec4& light);
void index(int a, int b, int c, int d, int e, int f);
@@ -90,7 +90,7 @@ class BlocksRenderer {
glm::vec4 pickSoftLight(float x, float y, float z, const glm::ivec3& right, const glm::ivec3& up) const;
void render(const voxel* voxels);
public:
BlocksRenderer(size_t capacity, const Content* content, const ContentGfxCache* cache, const EngineSettings& settings);
BlocksRenderer(size_t capacity, const Content* content, const ContentGfxCache* cache, const EngineSettings* settings);
virtual ~BlocksRenderer();
void build(const Chunk* chunk, const ChunksStorage* chunks);
+3 -2
View File
@@ -4,6 +4,7 @@
#include "../../graphics/core/Mesh.hpp"
#include "../../voxels/Chunk.h"
#include "../../world/Level.h"
#include "../../settings.h"
#include <iostream>
#include <glm/glm.hpp>
@@ -20,7 +21,7 @@ public:
RendererWorker(
Level* level,
const ContentGfxCache* cache,
const EngineSettings& settings
const EngineSettings* settings
) : level(level),
renderer(RENDERER_CAPACITY, level->content, cache, settings)
{}
@@ -34,7 +35,7 @@ public:
ChunksRenderer::ChunksRenderer(
Level* level,
const ContentGfxCache* cache,
const EngineSettings& settings
const EngineSettings* settings
) : level(level),
threadPool(
"chunks-render-pool",
+2 -2
View File
@@ -10,13 +10,13 @@
#include "../../voxels/Block.h"
#include "../../voxels/ChunksStorage.h"
#include "../../util/ThreadPool.hpp"
#include "../../settings.h"
class Mesh;
class Chunk;
class Level;
class BlocksRenderer;
class ContentGfxCache;
struct EngineSettings;
struct RendererResult {
glm::ivec2 key;
@@ -34,7 +34,7 @@ public:
ChunksRenderer(
Level* level,
const ContentGfxCache* cache,
const EngineSettings& settings
const EngineSettings* settings
);
virtual ~ChunksRenderer();
+2 -2
View File
@@ -45,7 +45,7 @@ WorldRenderer::WorldRenderer(Engine* engine, LevelFrontend* frontend, Player* pl
renderer = std::make_unique<ChunksRenderer>(
level,
frontend->getContentGfxCache(),
engine->getSettings()
&engine->getSettings()
);
batch3d = std::make_unique<Batch3D>(4096);
@@ -154,7 +154,7 @@ void WorldRenderer::renderLevel(
shader->use();
shader->uniformMatrix("u_proj", camera->getProjection());
shader->uniformMatrix("u_view", camera->getView());
shader->uniform1f("u_gamma", settings.graphics.gamma);
shader->uniform1f("u_gamma", settings.graphics.gamma.get());
shader->uniform1f("u_fogFactor", fogFactor);
shader->uniform1f("u_fogCurve", settings.graphics.fogCurve.get());
shader->uniform1f("u_dayTime", level->getWorld()->daytime);