Вопрос

Hmm, hello. I am attempting to write an OpenGL game engine/game (a game engine specific for my wants :P). I am using .obj models, but it is rather inefficient it seems. All those atof operations combined with the inability to quickly reserve a vector size where to store the data I imagine make the whole thing slightly slower, so I concluded that I might want to try to use my own model format. How I achieve it without sacrificing flexibility aside, I wonder, would it be preferable to store normals in this custom binary object format, or to generate them upon loading? It would surely save space, but I am not yet sure the performance impact it might have, if any. Any suggestions?

Basic summary: To save normals, or to generate them upon loading?

Thank you ^.^

Это было полезно?

Решение

Premature optimization. You'll load the model exactly one time. And atof is not a very complex operation to begin with (it's basically just a loop of char const *c = instring; while(isdigit(*c)){ v *= 10; v += *c - '0'; c++;}

I wonder, would it be preferable to store normals in this custom binary object format, or to generate them upon loading?

Load them. Normals are something you want the modeling artist being able to fine tune.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top