Title says it all basically.
Can anyone give me some code/ explain how to use a user-defined effect (i.e. not BasicEffect) that uses an EffectPool to share varaibles between drawing calls?
Title says it all basically.
Can anyone give me some code/ explain how to use a user-defined effect (i.e. not BasicEffect) that uses an EffectPool to share varaibles between drawing calls?
You can take a look at the Shader Series 1: Vertex Lighting sample over at Creators Club.
Basically what you want to do is mark your parameters in your effect file with the shared keyword and with the same parameter name across your effect files, e.g.:
shared float4x4 world;
In LoadContent() You get the effect parameter just like you would any other parameter:
worldParameter = myEffect.Parameters["world"];
Now in your Draw() call you set the value of the parameter:
worldParameter.SetValue(world);
And the value will be reused for all parameters in the same effectpool sharing the same name and marked with the shared keyword.