NAME

cgD3D9SetUniformMatrixArray - set the elements for an array of uniform matrix parameters

SYNOPSIS

  #include <Cg/cgD3D9.h>

  HRESULT cgD3D9SetUniformMatrixArray( CGparameter param,
                                       DWORD offset,
                                       DWORD numItems,
                                       const D3DMATRIX * matrices );

PARAMETERS

param

The parameter whose array elements are to be set. It must be a uniform matrix parameter.

offset

Indicates the offset to start setting array elements.

numItems

Indicates the number of array elements to set.

matrices

An array of matrices to set for param. The upper-left portion of each matrix is extracted to fit the size of the input parameter. numItems matrices are expected to be passed to the function.

RETURN VALUES

cgD3D9SetUniformMatrixArray returns D3D_OK if the function succeeds.

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

DESCRIPTION

cgD3D9SetUniformMatrixArray sets the elements for an array of uniform matrix parameters.

EXAMPLES

The following example code illustrates the use of cgD3D9SetUniformMatrixArray:

  // matrixParam is a CGparameter handle of type float3x2
  // arrayParam is a CGparameter handle of type float4x4[4]
  ...
  // intialize the data for each parameter
  D3DXMATRIX matTexTransform(
      0.5f,0,      0,0,
      0   ,0.5f,   0,0,
      0.5f,0.5f,   0,0,
      0   ,0,      0,0
  );
  D3DXMATRIX matRot[2];
  D3DXMatrixRotationAxis(&matRot[0], &D3DXVECTOR3(0,0,1), D3DX_PI*0.5f);
  D3DXMatrixRotationAxis(&matRot[1], &D3DXVECTOR3(0,1,0), D3DX_PI*0.5f);
  ...
  // only use the upper-left portion. 
  // non-arrays can be set, but only when offset=0 and numItems=1.
  cgD3D9SetUniformArray(matrixParam, &matTexTransform, 0, 1);
  // set the 3rd and 4th elements of the array
  cgD3D9SetUniformArray(arrayParam, matRot, 2, 2);

ERRORS

CGD3D9ERR_INVALIDPARAM to-be-written

CGD3D9ERR_NODEVICE to-be-written

CGD3D9ERR_NOTLOADED to-be-written

CGD3D9ERR_NOTMATRIX to-be-written

CGD3D9ERR_NOTUNIFORM to-be-written

CGD3D9ERR_NULLVALUE to-be-written

CGD3D9ERR_OUTOFRANGE to-be-written

HISTORY

cgD3D9SetUniformMatrixArray was introduced in Cg to-be-written.

SEE ALSO

cgD3D9SetUniform, cgD3D9SetUniformArray, cgD3D9SetUniformMatrix, cgD3D9TypeToSize