To load models such as characters and buildings into memory, I placed the model file in certain format such as .dae and had the program parse it before entering the main loop. I think it might be not the fastest way. What's the most efficient way to do that generally?
What would be the most efficient way to load 3d models?
What's the most efficient way to do that generally?
The most efficient way is to store the model is a file format, which more or less represents your internal structure which holds your model data. One way is to write a converter from a common model format (dae,fbx) to your internal format.
Ninja'd
If you are interested I am working on a desktop app that can let you do that quite easily - at least that is the idea.
It uses assimp under the hood and will allow the user to customize the export to hook in to their engines using as3.
You can of course do the same thing yourself, it only took me a few hours to get it up and running.
The idea being you can just write the raw data into a bytearray so you can just copy it right into your own data structures with no need to process it or create anything... very compact and very fast.
What's the most efficient way to do that generally?
A custom format which is a literal byte dump of your in-memory representation. This of course requires that you architect your in-memory representation to be flat chunks of memory, with no pointers (which would need to be fixed up on load).
Then you load your file full of chunks into memory (likely via mmap), and transfer any relevant chunks to the GPU as needed.