Why doesn't Direct3D have it's own vertex structure?
I've always wondered the reasoning behind why we must always defin开发者_运维技巧e 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
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.
精彩评论