NAME

cgD3D9SetUniformArray - set the elements of an array of uniform parameters

SYNOPSIS

  #include <Cg/cgD3D9.h>

  HRESULT cgD3D9SetUniformArray( CGparameter param,
                                 DWORD offset,
                                 DWORD numItems,
                                 const void * values );

PARAMETERS

param

The parameter whose array elements are to be set. It must be a uniform parameter that is not a sampler.

offset

Indicates the offset to start setting array elements.

numItems

Indicates the number of array elements to set.

values

An array of floats, the elements in the array to set for param. The amount of data required depends on the type of parameter, but is always specified as an array of one or more floating point values. The type is void* so a compatible user-defined structure can be passed in without type-casting. Use cgD3D9TypeToSize to determine how many values are required for a particular type. This size multiplied by numItems is the number of values this function expects.

RETURN VALUES

cgD3D9SetUniformArray returns D3D_OK if the function succeeds.

If the function fails due to a D3D call, that D3D failure code is returned.

DESCRIPTION

cgD3D9SetUniformArray sets the elements for an array of uniform parameters. All values should be of type float. There is assumed to be enough values to set all specified elements of the array.

EXAMPLES

The following example code illustrates the use of cgD3D9SetUniformArray:

  // param is a CGparameter handle of type float3
  // arrayParam is a CGparameter handle of type float2x2[3]
  ...
  // intialize the data for each parameter
  D3DXVECTOR3 paramData(1,2,3);
  float arrayData[2][2][2] = 
  {
      0,1,
      2,3,
      4,5,
      6,7
  };
  ...
  // non-arrays can be set, but only when offset=0 and numItems=1.
  cgD3D9SetUniformArray(param, paramData, 0, 1);
  // set the 2nd and 3rd elements of the array
  cgD3D9SetUniform(arrayParam, arrayData, 1, 2);

ERRORS

CGD3D9ERR_INVALIDPARAM to-be-written

CGD3D9ERR_NODEVICE to-be-written

CGD3D9ERR_NOTLOADED to-be-written

CGD3D9ERR_NOTUNIFORM to-be-written

CGD3D9ERR_NULLVALUE to-be-written

CGD3D9ERR_OUTOFRANGE to-be-written

HISTORY

cgD3D9SetUniformArray was introduced in Cg to-be-written.

SEE ALSO

cgD3D9SetUniform, cgD3D9SetUniformMatrix, cgD3D9SetUniformMatrixArray, cgD3D9TypeToSize