Sign in to follow this  

where to create effects?

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

What is a good way of creating and organizing ID3DXEffects? It seems natural to put an effect in the class where it will be used. But sometimes an effect could be used by different classes. Is it good to create all effects in one place (like an effect manager class), and other classes can just query the effects they need?

Share this post


Link to post
Share on other sites
In my code base i have a renderer class that manages all the rendering. It stores resources such as textures it has loaded with d3d and effects it is uses to draw. This has it's good and bad points, but i like it because it keeps all of the D3D resources in a single place.

The D3D resources that are stored in the renderer might not be loaded from disk there (textures for example are loaded with my own TGA loader and then loaded from system memory into D3D), but it does give a single point of reference. The game identifies textures and effects by handles.

Share this post


Link to post
Share on other sites
I use a class that you could call an Effects Manager to load all of my effects. Like my other resource managers, it's spawned by the renderer and is responsible for loading resources off disk and providing a handle or interface to all entities that need a particular resource. You'll probably want some sort of facility like this in your engine, whethere it's in a separate class or built into your renderer. Without it, it may be difficult to avoid loading redundant resources which can result in wasted memory or reduced performance.

Share this post


Link to post
Share on other sites

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