Name
cgCreateStateAssignmentIndex - create a state assignment for a state array
Synopsis
#include <Cg/cg.h>
CGstateassignment cgCreateStateAssignmentIndex( CGpass pass,
CGstate state,
int index );
Parameters
- pass
-
The pass in which to create the state assignment.
- state
-
The state array used to create the state assignment.
- index
-
The index for the state array.
Return Values
Returns the new state assignment handle.
Returns NULL if an error occurs.
Description
cgCreateStateAssignmentIndex creates a state assignment for the specified
pass. The new state assignment is appended to the pass's existing list
of state assignments. The state assignment is for the given index of
for the specified array state.
Examples
This example shows how to create a state assignment for enabling light 5:
/* Procedurally create state assignment equivalent to */
/* "LightEnable[5] = 1;" */
CGstate lightEnableState = cgGetNamedState(context, "LightEnable");
CGstateassignment light5sa =
cgCreateStateAssignmentIndex(pass, lightEnableState , 5);
cgSetBoolStateAssignment(light5sa, CG_TRUE);
Errors
CG_INVALID_PASS_HANDLE_ERROR is generated if pass is not a valid pass.
CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.
If the index is negative or index is greater than or equal the number of
elements for the state array, no error is generated but NULL is returned.
History
cgCreateStateAssignmentIndex was introduced in Cg 1.5.
See Also
cgGetStateAssignmentIndex,
cgCreateTechnique,
cgCreateSamplerStateAssignment,
cgCreateState,
cgCreateStateAssignment
|