move getVoxels from ChunksStorage to Chunks

This commit is contained in:
MihailRis
2024-11-11 22:30:42 +03:00
parent 79693580e0
commit c5ca9128e9
8 changed files with 107 additions and 107 deletions
+3 -3
View File
@@ -5,7 +5,7 @@
#include "maths/UVRegion.hpp"
#include "constants.hpp"
#include "content/Content.hpp"
#include "voxels/ChunksStorage.hpp"
#include "voxels/Chunks.hpp"
#include "lighting/Lightmap.hpp"
#include "frontend/ContentGfxCache.hpp"
#include "settings.hpp"
@@ -486,7 +486,7 @@ void BlocksRenderer::render(const voxel* voxels) {
}
}
void BlocksRenderer::build(const Chunk* chunk, const ChunksStorage* chunks) {
void BlocksRenderer::build(const Chunk* chunk, const Chunks* chunks) {
this->chunk = chunk;
voxelsBuffer->setPosition(
chunk->x * CHUNK_W - voxelBufferPadding, 0,
@@ -515,7 +515,7 @@ MeshData BlocksRenderer::createMesh() {
);
}
std::shared_ptr<Mesh> BlocksRenderer::render(const Chunk* chunk, const ChunksStorage* chunks) {
std::shared_ptr<Mesh> BlocksRenderer::render(const Chunk* chunk, const Chunks* chunks) {
build(chunk, chunks);
const vattr attrs[]{ {3}, {2}, {1}, {0} };
+3 -3
View File
@@ -19,7 +19,7 @@ class Block;
class Chunk;
class Chunks;
class VoxelsVolume;
class ChunksStorage;
class Chunks;
class ContentGfxCache;
struct EngineSettings;
struct UVRegion;
@@ -140,8 +140,8 @@ public:
BlocksRenderer(size_t capacity, const Content* content, const ContentGfxCache* cache, const EngineSettings* settings);
virtual ~BlocksRenderer();
void build(const Chunk* chunk, const ChunksStorage* chunks);
std::shared_ptr<Mesh> render(const Chunk* chunk, const ChunksStorage* chunks);
void build(const Chunk* chunk, const Chunks* chunks);
std::shared_ptr<Mesh> render(const Chunk* chunk, const Chunks* chunks);
MeshData createMesh();
VoxelsVolume* getVoxelsBuffer() const;
+2 -2
View File
@@ -26,7 +26,7 @@ public:
{}
RendererResult operator()(const std::shared_ptr<Chunk>& chunk) override {
renderer.build(chunk.get(), level->chunksStorage.get());
renderer.build(chunk.get(), level->chunks.get());
if (renderer.isCancelled()) {
return RendererResult {
glm::ivec2(chunk->x, chunk->z), true, MeshData()};
@@ -66,7 +66,7 @@ ChunksRenderer::~ChunksRenderer() {
std::shared_ptr<Mesh> ChunksRenderer::render(const std::shared_ptr<Chunk>& chunk, bool important) {
chunk->flags.modified = false;
if (important) {
auto mesh = renderer->render(chunk.get(), level->chunksStorage.get());
auto mesh = renderer->render(chunk.get(), level->chunks.get());
meshes[glm::ivec2(chunk->x, chunk->z)] = mesh;
return mesh;
}