You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question about architecure - Chunk vs ChunkLayer #142
Wondering if anyone can answer why in the code chunks are split up into the Chunk , ChunkSection, and Layer classes. The last one I think I get, it just keeps track of if the chunk contains any opaque blocks. Not too sure on the difference between the other two though, or why they were split apart.
Firstly Chunk contains member: std::vector<ChunkSection> m_chunks, I don't get why this is a std::vector, because ChunkSection contains an array of all the blocks in the chunk (i.e. std::array<CHUNK_VOLUME, blocks>), so why would a chunk need to contain multiple sections?
Secondly, why does ChunkSection inherit (match?) IChunk, again why not make it a Chunk? Code:
What are the first two if / else if conditions testing for exactly? Isn't the desired layer always contained within the relevant ChunkSection (it contains all blocks in a chunk, std::array<Layer, CHUNK_SIZE>? Why use the chunk manager here?
Any explanation, detail about these classes, or just suggestions for further reading around the architecture of chunks, voxel worlds etc. would be much appreciated!
Activity