Cg Direct3D9 Runtime API cgD3D9SetUniformMatrixArray(3)
NAME
cgD3D9SetUniformatrixArray - set the elements for an array
of uniform matrix parameters
SYNOPSIS
#include
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 The offset at which to start setting array elements.
numItems
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
Returns D3DOK if the function succeeds.
Returns the D3D failure code if the function fails due to a
D3D call.
DESCRIPTION
cgD3D9SetUniformatrixArray sets the elements for an array
of uniform matrix parameters.
EXAMPLES
Cg Toolkit 2.1 Last change: 1
Cg Direct3D9 Runtime API cgD3D9SetUniformMatrixArray(3)
/ 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), D3DXPI*0.5f);
D3DXMatrixRotationAxis(&matRot[1], &D3DXVECTOR3(0,1,0), D3DXPI*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);
ERORS
cgD3D9Failed is generated if a D3D function returns an
error.
CGD3D9ERNODEVICE is returned if a required D3D device is
NUL. This usually occurs when an expanded interface
routine is called but a D3D device has not been set with
cgD3D9SetDevice.
CGD3D9ERNOTLOADED is returned if program was not loaded
with the cgD3D9LoadProgram.
CGD3D9ERNOTMATRIX is returned if param is not a matrix.
CGD3D9ERNOTUNIFORM is returned if param is not a uniform
parameter.
CGD3D9ERNULVALUE is returned if matrices is NUL.
CGD3D9EROUTOFRANGE is returned if offset plus numItems is
out of the range of param.
CGD3D9ERINVALIDPARAM is returned if the parameter fails to
set for any other reason.
HISTORY
cgD3D9SetUniformatrixArray was introduced in Cg 1.1.
SEE ALSO
cgD3D9SetUniform, cgD3D9SetUniformArray,
cgD3D9SetUniformMatrix, cgD3D9TypeToSize
Cg Toolkit 2.1 Last change: 2
|