NAME

cgD3D9SetUniformMatrix - set the values of a uniform matrix parameter

SYNOPSIS

  #include <Cg/cgD3D9.h>

  HRESULT cgD3D9SetUniformMatrix( CGparameter param,
                                  const D3DMATRIX * matrix );

PARAMETERS

param

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

matrix

The matrix to set for the parameter. The upper-left portion of the matrix is extracted to fit the size of param.

RETURN VALUES

cgD3D9SetUniformMatrix returns D3D_OK if the function succeeds.

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

DESCRIPTION

cgD3D9SetUniformMatrix sets the values of a given uniform matrix parameter.

EXAMPLES

The following example code illustrates the use of cgD3D9SetUniformMatrix:

  // matrixParam is a CGparameter handle of type float3x2
  // arrayParam is a CGparameter handle of type float4x4[2]
  ...
  // 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
  cgD3D9SetUniform(matrixParam, &matTexTransform);
  // you can use arrays, but you must set the entire array
  cgD3D9SetUniform(arrayParam, matRot);

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

HISTORY

cgD3D9SetUniformMatrix was introduced in Cg to-be-written.

SEE ALSO

cgD3D9SetUniform, cgD3D9SetUniformMatrix, cgD3D9SetUniformMatrixArray, cgD3D9TypeToSize