Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't Direct3D have it's own vertex structure?

I've always wondered the reasoning behind why we must always define D3DVERTEX. Is it because Microsoft wants to allow the opportunity to put this in a class and overload operators, or is there another reason?

Thanks

like image 597
jmasterx Avatar asked Jul 09 '10 03:07

jmasterx


1 Answers

It's so you can use whatever is convenient for your application. If you need a normal as part of your vertex, you can have that. If you don't need a normal then you save 12 bytes per vertex. If you need colour information, texture coordinates, specular parameters and so on then you choose to define them or not depending on your specific needs.

If Microsoft were to provide a "D3DVERTEX" structure you'd either have 500 different versions, with different combinations of fields, or you'd have one enormous one that included every possible value, killing your bandwidth.

like image 116
Dean Harding Avatar answered Sep 23 '22 15:09

Dean Harding