Open EmiOnGit opened 1 year ago
Instead of only serializing with the paths to the data, i think it would be very nice to have the struct be serializeable in a way where the data is also included [and you can serialize it in binary with bincode. ] this is how i handle serializing xpbd colliders for my terrain: this is a lot cleaner
Naturally this would mean that a serialized file would be tens of kb potentially but then you wouldnt need to go fetch the heightmap and everything later its a monolithic serialized file w everything you need for that chunk
That's a great idea. Seeing how the crate changed, I don't think that my previous idea is very great. Currently, the heightmap is used in the shader directly and interpolate the height of the blades. I like this idea because it let the user 1) Change the height of a region very dynamically 2) Decide how large the heightmap texture should be. If there are not many changes in heights, a very small heightmap is totally fine
In fact, in the current Pipeline the grass blades are only stored as a x,z coordinate relative to one corner of the chunk and everything else is calculated on the gpu side.
The extraction of the x,z coords from the density texture happens to be rather cpu expensive and a bit unnecessary. Therefore it would be nice if this could be skipped and instead be loaded directly from a file.
Instead of only serializing with the paths to the data, i think it would be very nice to have the struct be serializeable in a way where the data is also included [and you can serialize it in binary with bincode. ]
While this wouldn't be completely solved, I believe you could also store the heightmap in the binary without much problem.
Using Image::from_buffer(include_bytes!("assets/heightmap.png"))
this shouldn't be to bad, right?
Feel free to tell me I'm wrong here, I'm still trying to figure everything out :D
What problem does this solve or what need does it fill?
It would be nice if we could serialize chunks completely This would especially benefit the editor as this would be the base for proper saving
Describe the solution you'd like
Save the chunk in a ron file with following format:
Describe what is for debate
The format can differ and is mostly up to the person implementing. Also json is for fine, though I like ron a bit more since it's easily readable
Additional context
This is ultimately needed by #49