Sign in to follow this  

VertexDeclaration's

This topic is 4728 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

Hey! Currently I'm using my own wrapper for the DX9 VertexDeclaration, so that I'm not tied to the DX9 device. So my RenderDevice has a function: SetVertexDeclaration(IVertexDeclaration decl); It works ok, but the thing is that the code looks so ugly when interpreting my own implementation of a VertexDeclaration to the DirectX version: for eg. The VertexDeclaration has a list of IVertexElement elements. Each of them having a DeclarationType, DeclarationMethod, DeclarationUsage. And interpreting this to the DirectX VertexElement is a plain ugly switch: D3D.VertexElement = DX9Types.Translate(vertexDeclaration.Elements[i]); D3D.VertexElement DX9Types.Translate(IVertexElement element) { switch(element.DeclarationType) { .... } switch(element.DeclarationMethod) { .... } return new D3D.VertexElement(...); } I guess that this will be kinda hard to maintain, so I would really appreciate any thoughts on how to design a better system, mainly how to get ridd of the ugly switches. Thx!

Share this post


Link to post
Share on other sites

This topic is 4728 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