08-03-2016, 05:44 PM
I had an idea that instead of generating the tree images on the fly, we would actually use .cubeset files with tree images in them. Unfortunately, I didn't do the math then, and when I did, I found out it was pretty much impossible, the cubesets would be really, really large to contain all the tree variants already in the code (I counted the number of trees to be on the order of thousands)
The problem with dual checking is that while the trees are being generated, there is no cChunk for the generated chunk yet (and there cannot be - it is created only after the data for it is known). And also, there needn't be cChunk instances for the neighboring chunks. The easiest idea for refactoring would be to use an interface, ChunkDataProvider, that would have the virtual methods to access individual blocks and query neighboring chunks; and the generator and the world both would provide a descendant with this interface, implemented on the underlying data.
The problem with dual checking is that while the trees are being generated, there is no cChunk for the generated chunk yet (and there cannot be - it is created only after the data for it is known). And also, there needn't be cChunk instances for the neighboring chunks. The easiest idea for refactoring would be to use an interface, ChunkDataProvider, that would have the virtual methods to access individual blocks and query neighboring chunks; and the generator and the world both would provide a descendant with this interface, implemented on the underlying data.