Microsoft DirectX 8.0 (Visual Basic)

Setting Blending Matrices

You set the transformation matrices between which the system blends by calling the Direct3DDevice8.SetTransform method. Set the first parameter to a D3DTS_WORLD member from the CONST_D3DTRANSFORMSTATETYPE enumeration, and set the second parameter to the address of the matrix to be set.

The following Microsoft® Visual Basic® code example sets two world matrices between which geometry will be blended to create the illusion of a jointed arm.

' For this example, the d3dDevice variable is assumed to be a valid 
' reference to a Direct3DDevice8 object for an initialized 3-D scene.
' The dx variable is a valid reference to a DirectX7 object.
Dim BendAngle As Single
Dim matUpperArm As D3DMATRIX, _
    matLowerArm As D3DMATRIX

BendAngle = 3.1415926 / 4#  ' 45 degrees

' The upper arm is immobile. Use the identity matrix.
D3DXMatrixIdentity matUpperArm
Call d3dDevice.SetTransform(D3DTS_WORLD, matUpperArm)

' The lower arm rotates about the x-axis, attached to the upper arm.
D3DXMatrixRotationX matLowerArm, -nBendAngle
Call d3dDevice.SetTransform(D3DTS_WORLD1, matLowerArm)

Setting a blending matrix merely causes the system to cache the matrix for later use; it does not instruct the system to begin blending vertices. For more information, see Enabling Geometry Blending.