ASE vs 3DS vs ?

So i wrote this ase loader, which extracts almost everything. But it is waaaaay to slow. And now wonder is this the best way to load model. Of course, it should be coverted in some appropriate binary file, but waiting it to load…
Afaik, 3ds format doesn’t have normals, and ase has (but normals could likely be faster to calculate then load). Is there some other differencies? Other suggestions?

Are you loading the entire file into a buffer and then using the data from the buffer? Or are you reading each byte/int/data element from the file one at a time?

Originally posted by shinpaughp:
Are you loading the entire file into a buffer and then using the data from the buffer? Or are you reading each byte/int/data element from the file one at a time?

First one. And then lots of strstr and scanf.
It’s ok if file is under 2Mb (on 1.4Mhz AMD processor), and with about 4k faces. You can check one version at www.geocities.com/darkosos/aseviewer

[This message has been edited by dare (edited 03-26-2003).]

[This message has been edited by dare (edited 03-26-2003).]

If you files are only 2 megs, I would just read the whole thing into a buffer, then parse it, instead of doing it as your going.

You can save your loaded data back to disk in binary format. Even if you do some optimization/calculation with them - you able to save calculations result and when load ase file - just check - whether binary copy of the data alredy present and use them. I use this technique once and found it extremely usefull to my project - when i develop application i load new ase files (if designers change them) and save binary copy. For example i do for normals (which is calculated in program, i don’t use max normals) something like this:

fwrite( &m_nNormCount, sizeof(long), 1, f );
fwrite( m_pNormals, sizeof(TNormal), m_nNormCount, f );

Then when load, i have read quantity first, then allocate buffer and load normals… Can’t imagine more quick loading scenario. And you’ll have “internal format” for your data - this may be another hint if you wan’t such behaviour.

I don’t really know what way you parse ASE files, but I suppose you do it similarly to how it’s done in some quite popular in internet ASE related tutorial…

What they do is to parse over and over the whole file multiple times resulting in a really poor performance.
However it’s possible to parse it once but good.

I had no problems parsing >50MB ASE’s in less than 5 sec on PII 300.

MickeyMouse, a 50MB++ ASE in 5 secs?
Can you tell us how you do that?