Name

cgGetStateAssignmentIndex - get the array index of a state assignment for array-valued state

Synopsis

#include <Cg/cg.h>

int cgGetStateAssignmentIndex( CGstateassignment sa );

Parameters

sa
The state assignment.

Return Values

Returns an integer index value.

Returns 0 if the CGstate for this state assignment is not an array type.

Description

cgGetStateAssignmentIndex returns the array index of a state assignment if the state it is based on is an array type.

Examples

Given a "LightPosition" state defined as an array of eight float3 values and an effect file with the following state assignment:

  pass { LightPosition[3] = float3(10,0,0); }

cgGetStateAssignmentIndex will return 3 when passed a handle to this state assignment.

Errors

CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR is generated if sa is not a valid state assignment.

History

cgGetStateAssignmentIndex was introduced in Cg 1.4.

See Also

cgIsStateAssignment, cgCreateStateAssignmentIndex