mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
move BlocksRenderer voxels buffer fill to main thread
This commit is contained in:
parent
0c62951062
commit
c46a6ad3bd
4 changed files with 81 additions and 45 deletions
|
|
@ -21,6 +21,7 @@ class Chunks;
|
|||
class Frustum;
|
||||
class BlocksRenderer;
|
||||
class ContentGfxCache;
|
||||
class VoxelsVolume;
|
||||
struct EngineSettings;
|
||||
|
||||
struct ChunksSortEntry {
|
||||
|
|
@ -38,6 +39,11 @@ struct RendererResult {
|
|||
ChunkMeshData meshData;
|
||||
};
|
||||
|
||||
struct RendererJob {
|
||||
std::shared_ptr<Chunk> chunk;
|
||||
std::shared_ptr<VoxelsVolume> volume;
|
||||
};
|
||||
|
||||
class ChunksRenderer {
|
||||
const Chunks& chunks;
|
||||
const Assets& assets;
|
||||
|
|
@ -48,10 +54,11 @@ class ChunksRenderer {
|
|||
std::unordered_map<glm::ivec2, ChunkMesh> meshes;
|
||||
std::unordered_map<glm::ivec2, bool> inwork;
|
||||
std::vector<ChunksSortEntry> indices;
|
||||
util::ThreadPool<std::shared_ptr<Chunk>, RendererResult> threadPool;
|
||||
util::ThreadPool<RendererJob, RendererResult> threadPool;
|
||||
const Mesh<ChunkVertex>* retrieveChunk(
|
||||
size_t index, const Camera& camera, bool culling
|
||||
);
|
||||
std::shared_ptr<VoxelsVolume> prepareVoxelsVolume(const Chunk& chunk);
|
||||
public:
|
||||
ChunksRenderer(
|
||||
const Level* level,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue