X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FChunkRenderer.hpp;h=d45d0fd415f3f57f05ad209299fd0f0a7d256d4e;hb=13e676a6e49128ebc6c63b8dd08bef51d360e8e9;hp=fe4f6a66d0062a6a81fac5ed5fcee89a291d62f5;hpb=43820582217f7e4b707d98f2e69d969eb77fc7c3;p=blank.git diff --git a/src/world/ChunkRenderer.hpp b/src/world/ChunkRenderer.hpp index fe4f6a6..d45d0fd 100644 --- a/src/world/ChunkRenderer.hpp +++ b/src/world/ChunkRenderer.hpp @@ -12,51 +12,31 @@ namespace blank { class AssetLoader; +class BlockModel; +class ChunkIndex; class TextureIndex; class Viewport; -class World; class ChunkRenderer { public: - /// render_distance in chunks, excluding the base chunk which is always rendered - ChunkRenderer(World &, int render_distance); + explicit ChunkRenderer(ChunkIndex &); + ~ChunkRenderer(); void LoadTextures(const AssetLoader &, const TextureIndex &); void FogDensity(float d) noexcept { fog_density = d; } - bool InRange(const Chunk::Pos &) const noexcept; - int IndexOf(const Chunk::Pos &) const noexcept; + int MissingChunks() const noexcept; - int TotalChunks() const noexcept { return total_length; } - int IndexedChunks() const noexcept { return total_indexed; } - int MissingChunks() const noexcept { return total_length - total_indexed; } - - void Rebase(const Chunk::Pos &); - void Rescan(); - void Scan(); void Update(int dt); void Render(Viewport &); private: - int GetCol(int) const noexcept; - - void Shift(Block::Face); - -private: - World &world; - ArrayTexture block_tex; - - int render_dist; - int side_length; - int total_length; - int total_indexed; - glm::ivec3 stride; + ChunkIndex &index; std::vector models; - std::vector chunks; - Chunk::Pos base; + ArrayTexture block_tex; float fog_density;