Sign in to follow this  
ChenA

How to automatic set the parameters of the effect?

Recommended Posts

I want to create a effect form a fx file,then the application automatic set the parameters of the fx. Someone can give me some sample?Thanks.

Share this post


Link to post
Share on other sites
You can assign default values to your parameters in the effect file itself.
If you need to change the values at runtime, you need to somehow feed the values to the parameters from your host program (by using ID3DXEffect::Set* functions).

Share this post


Link to post
Share on other sites
i use a singleton class called constantManager for this. i assign some values to it with manager.addMatrix/Float/Texture and set those values for every effect with .setMatrix/Float/Texture. My material class tests on init which of the constants that are registered in the constantmanager are also available in the shader and stores those in vectors.


regards,
m4gnus

Share this post


Link to post
Share on other sites
Thanks for reply.
Quote:

You can assign default values to your parameters in the effect file itself.
If you need to change the values at runtime, you need to somehow feed the values to the parameters from your host program (by using ID3DXEffect::Set* functions).

Maybe I don't describe clearly,my meaning is "automatic",for example you create a effect from a file,and then you get the parameters the effect need,and then the host program automatic set the parameters(by a function like GetParameters(ParametersType) of the render object class),so I don't need to write any code for set parameters.
Somebody can give me some example or suggestion or articles?Thanks.

Quote:

My material class tests on init which of the constants that are registered in the constantmanager are also available in the shader and stores those in vectors.


regards,
m4gnus

I interested in this,can you detailed explain this?

Share this post


Link to post
Share on other sites

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