New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary model format #2643
Binary model format #2643
Conversation
The real question is: given that |
This is a great idea. Would it be possible to put some other data into the binary blob as well? That would make loading a lot faster. |
Should be quite easy to load from FileSystem without going through a
|
I'm starting to think a standalone tool that incorporates all the dev stuff is probably the way to go, so this, ModelViewer, maybe ObjectViewerView, a distance field font generator (partly written on a branch somewhere) and so on. @johnbartholomew rightly pointed out to me that this could be bit of a pain for modellers during development, as it adds an extra step. It also occurs to me that it needs to be possible to extend the format without breaking old models, otherwise we break mods that are distributing binary models (I've not read the code in full yet, so maybe you already do this). @nozmajner, opinion? If you had to run a program after saving your model to convert it to something Pioneer can use, would that be a pain? |
There are already a number of extra steps to getting things like ships ingame, perhaps this could even help alleviate that. Open your model in ModelViewer, we can parse the nodes looking for tags to decide if it's a ship, station, etc or the user can choose to create an ingame object. An If anything that extra step then makes things easier. |
I should add that I'm not suggesting we do that for this PR :) Just another way of looking at it. |
I don't mind the extra step if that means better performance. |
@Luomu I've brought your |
Oh hey, missed some discussion.
Agreed, but things are hard to separate from the game so it's a long way away. If you can add a new command line option to the game (pioneer --dump-model foobar) it's easier.
Would be nice, but I need more specs for that. If someone implements a custom node then that's already supported, they have to implement the save function and register a loader function.
will check! Going to merge this soonish to keep bitrot away. But I don't think this is going to be used in pioneer binary distributions quite yet. |
Done, but obviously need to keep working on this for the same reason |
Adds the ability to save and load models in a binary format. This is good because:
This is not really plugged into the game yet, we need to first decide how it should work. For testing purposes, modelviewer dumps a binary version (.sgm) of every model it loads into userfiles/ModelBinTest/. Pressing B attempts to load a binary model from data/models/whatever/. A .sgm must be located where the .model file is, because textures and patterns are not part of the .sgm file.
Doing binary conversions automatically is probably not a good idea, the model cache was a bit of a headache in the LMR days. Binarizing models should be some kind of a built-time process (or don't enable it at all, it's still a nice tool to have).
A FileSystem question: How to create a Serializer::Reader with FS? I had to use straight fopen, but that won't work if the .sgm file is in a zip or something.