Game ENGINE vertex TYPES??

Started by
2 comments, last by WOsborn 14 years, 1 month ago
Hi! Ive been working on a 3D game engine using DirectX10 for the past couple of weeks and ive. Its going to be a pretty basic engine, but i want to develop it as far as it can go for the next year or 2. And i was wondering, when developing an engine, is it good to have different vertex types and vertex layouts? For example... Having a vertex type called ColorVertex - for vertices that only have position and color. LitVertex - for vertices that contain normals and diffuse colors for lighting. texVertex - for vertices that will be textured. Im hoping that dealing with this now, might make the development process later a little bit easier! Thanks!
Advertisement
Definately yes.

But also allow for new vertex types to be added later - I'm sure you'll need them.

EG.

TexLitVertex1 - a lit vertex with a single texture

TexLitVertex2 - a lit vertex with 2 textures

Even "lit" is a bit vague - just diffuse, ambient ?, specular ? etc.

So it is good to have different vertex formats - even better if you can just plug in new ones as your needs change which I'm sure they will over time.

HTH
I may be wrong, but I recall reading an nvidia or ATI presentation where vertex formats should be multiples of 32 bytes. Thus you could potentially overload a 64 byte vertex structure and store different stuff in it based on context. Although this can be error prone because you get data member names like Misc1, Misc2, which could be used differently in different contexts, it does help prevent getting a large number of vertex format structures.
-----Quat
I'm mobile right now so I can't post any code but what I did was make it dynamic.
I read the format that the mesh file needs, build a 'fake' shader using a stringstream and then ask dx10 to create that input.
Then store it for lookup later on.

This topic is closed to new replies.

Advertisement