But, if I use twice as many bits, then it means I'm using twice as much memory - which, if I'm also using the fancy lighting methods described here: https://0fps.net/2018/02/21/voxel-lighting/, means using a whole long per cube I want to track lighting for. I can probably save space by not tracking lighting for the insides of solid blocks, but that might still be a lot of memory? :/
Anyway, I added model matrices so I can translate my models around and the like. They work fine as long as I stick to using the identity matrix, but if I set it to so much as translate by 0.01, the models disappear as I move my camera away. :/
Okay, it seems my matrix multiplication is being done in the wrong order or something? I currently go 'projection * view * model * pos' which I think is exactly backwards. So, maybe that's the issue? When I try changing it though things break worse. So, clearly I got some other stuff backwards as well or something. :/
Okay, I figured out I wasn't taking my model matrix into account for the view_pos variable, which is why the entity model was disappearing. Still have all my Matrics in exactly the wrong order, but it works now, so, I guess it's fine? :/
Yup, got it working fairly well. Players being able to see each other in multiplayer is a little unreliable? Like, later players can see earlier ones, but not vice versa, except earlier players can sometimes see the later ones shadows? Not sure what the deal is. Anyway, time for some refactoring now, I think. :/
Okay, fixed players not being able to see each other - it was only sending entity updates to the first player, instead of all of them. Also fixed up my ambient lighting, so it should work better with direction lights that change position. Not sure what to do next. :/
I could implement server side light propagation? Or textures for blocks and sides, instead of putting that data into vertices? Or, maybe make my direction lights change direction? Or some refactoring, or, or...
Hmm. Trying to figure out how to put blocks and sides in a texture - trouble is, I need an array of 3d textures to really do it the way I want to... :/
Okay, just used three textures. Got block and side data moved into 3d textures instead of vertices. Not trivial, but I figured it out eventually. Means my greedy meshing can be even greedier, now that I can have multiple kinds of blocks and sides sharing a vertex.
Did a bunch of refactoring today. Nothing crazy, just pulling out lots of old odds and ends. Massively shrunk my Gbuffer textures, removed some unnecessary data from it and from my vertices, so on and so forth. Thinking I might stop loading core packages with OSGI, and just save that for mods? Not sure yet. :/
Of course, now I want to do ambient lighting in a different way. I had a really pain in the ass bug, but with some help I eventually managed to find the problem. So, now I have far more interesting bugs to fix. XD
Okay, lol, that was easy. Game no longer loads core modules via OSGI. Architecture still reflects when it did this a lot, but I want to put a lot more thought in before I start refactoring all of that. For the moment, I'm looking at abstracting block and side rendering data into some kind of 'render surface' object? So I could put all these on one texture, and have multiple blocks and/or sides point to the same render surface, if they render their surfaces the same way... XD
Theeeere we go. Back to working about as well as the previous implementation did, except it's way faster, and arguably has more room for improvement. XD
Okay, did that. Not too difficult. Now...? Not sure what to do next. I could go back and take another crack at doing nice ambient lighting that takes material properties into account? Or, implement a new feature? Or just go looking for more refactoring to do? :/
Next is either working on an ambient light propagation algorithm, or rewriting world loading & generation to support multithreading. The latter is technically a bit of a detour, but if I do the former first, I'll probably have to redo it all anyway when I do the latter. :/
Also thinking about making my renderdata more complicated - right now it's just a list of colors. I could add pattern indexes and the like, though. For example, I made my debug texture be black and pink... But, it's random, instead of a proper checkerboard. I could add that pattern index, and then allow describing it as a checkerboard. :/