Sign in to follow this  

Game ENGINE vertex TYPES??

This topic is 2830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 2830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this