Performance Question...

Started by
4 comments, last by Gammastrahler 21 years, 10 months ago
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
Advertisement
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...

thanks, i will try it out with splitting my data, but this will take some days, since i need to alter at least 10 modules that rely on this data...

then i will report....
Punctuation, anyone?

/*=========================================*/
/* Chem0sh */
/* Lead Software Engineer & Tech Support */
/* http://www.eFaces.biz */
/*=========================================*/
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/
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.
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++

This topic is closed to new replies.

Advertisement