Archived

This topic is now archived and is closed to further replies.

Gammastrahler

Performance Question...

Recommended Posts

hi, i have a question: is it a bad idea to hold everything needed in one triangle? for example, my triangle data struct consists of the three vertices, texure and lightmap coords, the triangle plane, precalculated right and up vectors, precalculated perpendicular planes, the texture and lightmap IDs, the texture name, as well as the image data for the lightmap itself. if i use pointers to my triangles, everything is very fast, but i think there would be a better method (splitting this data, since collision detection routines don´t need lightmap image data and the texture´s name). the advantage of organizining all this data in one triangle was for me, that this is all preprocessed from a level editor and i can read in this data very fast from the map file... but i want to hear your opinion.... how would you do that? thanks Gammastrahler

Share this post


Link to post
Share on other sites
Very good question i too store everything in a surface , you call it triangle , structure, normally when i render in my engine i use a pointer array so i dereferr it with a pointer and normal pointer arithmetich , the only overhead is that when you want to access to some member the compiler uses base address +offset to reach the data, when you split the information into more arrays the compiler uses the same method only in the first case the ''header'' is bigger , so i think you won''t notice any speed changhe , i would like to get some feedback about this too, this was my 2 cent...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
biggest problem here is that you aren''t going to be able to easily use triangle strips and fans, which means that you''re losing some performance by not working with those techniques.

Share this post


Link to post
Share on other sites
triangle strips with which API?

in opengl you can say how much extra data needs to be skipped over between the vertex part of your data structure.

i guess you''re using C and not C++

Share this post


Link to post
Share on other sites