Jump to content
  • Advertisement
Sign in to follow this  
mcguile25

DX9 Class Design?

This topic is 4674 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 there, I am beginning to write a DirectX 9 graphics engine and want to know how other people are designing all the Direct3D functionality(ie-primitives, textures, lighting, models, etc.) in their game engine. Can anyone give me an overview of what classes you have in your graphics engine and a brief functionality of each? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Thats quite a tall order, and I'm sure most people here would agree that their engines look very different and are quite different in design. I think figuring out how to make it all fit together and work is half of the fun anyway :)

Share this post


Link to post
Share on other sites
you have to make those classes that you need for your projects. Most of the engines out there are quite different than each other, and is made for different game styles.

Share this post


Link to post
Share on other sites
As far as the basic primitive objects go (like VertexBuffer, Texture, ect...), I usually just wrap the useful functionality from the native D3D interfaces. I try to take any annoying aspects of the API out, as to make it much more developer-friendly. For example, VertexBuffer would have Fill() and Read() methods to suplement the standard Lock() function.

Also, it's really nice to have an object manager that automatically releases objects at engine shutdown. It should also destroy them on a device loss, and reset them on a device reset.

Share this post


Link to post
Share on other sites
It's a puzzle in which you define the shape of all the pieces and then try and put it together. =P

Everybody's implementation is different. The design is a reflection of your thought process.

My suggestion:

Start from a high-level point-of-view. Ask youself, "How would I like to use this framework/class/interface?"

"Sketch" the design of your code. I like to create empty classes with empty methods, and hook them up. It's an iterative process, filling in more detail, refactoring design, etc.

Don't have large classes with tons of methods. The best interface is minimal and compact. Strive for the simplest function signatures you can achieve.

Good luck.

Share this post


Link to post
Share on other sites
I recommend having a look at Ogre -- and specifically the DX9 renderer module within Ogre.

As far as automatic release goes, you will need that for more cases than shutdown. Re-setting devices come to mind. Usually, it's a good idea to use CComPtr<> (from atlbase.h) for holding on to all your interfaces; it makes the reference counting pretty painless.

Share this post


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