Jump to content
  • Advertisement
Sign in to follow this  
FxMazter

VertexDeclaration's

This topic is 4921 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); 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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!