Microsoft DirectX 8.0 (C++) |
You set the transformation matrices between which the system blends by calling the IDirect3DDevice8::SetTransform method. Set the first parameter to a value defined by the D3DTS_WORLDMATRIX macro, and set the second parameter to the address of the matrix to be set.
The following C++ code example sets two world matrices, between which geometry is blended to create the illusion of a jointed arm.
// For this example, the d3dDevice variable is assumed to be a // valid pointer to an IDirect3DDevice8 interface for an initialized // 3-D scene. float BendAngle = 3.1415926f / 4.0f; // 45 degrees D3DMATRIX matUpperArm, matLowerArm; // The upper arm is immobile. Use the identity matrix. D3DXMatrixIdentity( matUpperArm ); d3dDevice->SetTransform( D3DTS_WORLDMATRIX(0), &matUpperArm ); // The lower arm rotates about the x-axis, attached to the upper arm. D3DXMatrixRotationX( matLowerArm, -BendAngle ); d3dDevice->SetTransform( D3DTS_WORLDMATRIX(1), &matLowerArm );
Setting a blending matrix merely causes the system to cache the matrix for later use; it doesn't instruct the system to begin blending vertices. For more information, see Enabling Geometry Blending.