Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
mtxroll the resulting matrix returned the mtxrotat

Mtxroll the resulting matrix returned the mtxrotate variable

// Build rotation matrices
D3DXMatrixIdentity( &mtxRotate );
D3DXMatrixRotationY( &mtxYaw, RotationYaw); D3DXMatrixRotationX( &mtxPitch,RotationPitch); D3DXMatrixRotationZ( &mtxRoll, RotationRoll);

The next step is to use the D3DXMatrixMultiply (which multiplies two matrices) function to combine all of these rotations into a final matrix. This function is an alternative to using the overloaded * operator. We use D3DXMatrixMultiply to better see the multiplication order.

Object1 now has its world matrix updated to contain the new rotations. When this matrix is used to transform the mesh vertices later, the object will be rendered in its new orientation.

We repeat the same steps for Object2 and the function returns.

{

if ( m_bRotation1 )
{
RotationYaw = D3DXToRadian( 75.0f * m_Timer.GetTimeElapsed() ); RotationPitch = D3DXToRadian( 50.0f * m_Timer.GetTimeElapsed() ); RotationRoll = D3DXToRadian( 25.0f * m_Timer.GetTimeElapsed() );

// Build entire rotation matrix
D3DXMatrixRotationYawPitchRoll(&mtxRotate , RotationYaw , RotationPitch, RotationRoll);

if ( m_bRotation2 )

{

RotationYaw = D3DXToRadian( -25.0f * m_Timer.GetTimeElapsed() );

}

As you can see we have used D3DXMatrixRotationYawPitchRoll to build a matrix that contains all three rotations in one call. The resulting matrix is multiplied with the object world matrices using the overloaded * operator instead of the D3DXMatrixMultiply function.

CGameApp::DrawPrimitive

The object that this polygon belongs to has had its world matrix passed in so we can multiply each vertex with this matrix to transform it into world space:

// Multiply the vertex position by the World / object matrix D3DXVec3TransformCoord( &vtxCurrent, &vtxCurrent, pmtxWorld );

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Wayne Barnes

PageId: DOC0DBCFCF