Skip to content

Instantly share code, notes, and snippets.

@gyakoo
Last active August 29, 2015 14:25
Show Gist options
  • Save gyakoo/4c0f83001efbdbc0c517 to your computer and use it in GitHub Desktop.
Save gyakoo/4c0f83001efbdbc0c517 to your computer and use it in GitHub Desktop.
Set Surface shader parameter (all constant buffers) in Havok Anarchy
// Set a parameter value for a specific surface.
// It will set all parameters in all passes for all shader stages (vs, ps ...) of the surface technique
void SetSurfaceParameter(VisSurface_cl& surf, const char* param, const char* value)
{
VCompiledTechnique* technique = surf.GetTechnique();
if ( !technique )
return;
int count = technique->GetShaderCount();
for ( int s = 0; s < count; ++ s )
{
VCompiledShaderPass* pass = technique->GetShader(s);
if ( ! pass ) continue;
pass->UpdateShaderParam(param, value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment