I’ve been trying to parse a directx .x file without using the directX API to load only the geometry of the model. I first tried using C++ streams, but it took almost 3 seconds to parse a 800Kb file. So i tried to do the same with C I/O functions and now it takes about 120 milliseconds.
The problem is that loading the same file with the DX API takes the same or almost same time, but it also loads everything and not only the geometry. So i think that there’s something inefficient with my parser, that is only loading the geometry. With a profiler i noticed most of the time is spent on fscanf(), that i use to parse the vertices and indices. i also tried getting every line on a buffer and then using sscanf, but the time was the same. I’m not using STL.
Any suggestions for how to do a faster parsing avoiding the use of fscanf? Please don’t say “use another library like Assimp” because i’d like to do that myself.
Thanks in advance.
I’ve been trying to parse a directx .x file without using the directX API
Share
Separate reading from scanning, e.g. first read the whole file into memory (or use memory mapping), then scan with sscanf or whatever (boost::spirit, why not?)