To billboard a quad in D3D it is simple - just set the billboard's world transform matrix to {-U,V,-N} of the camera...
Billboard D3D Quad
Hi,
m_cCoords is the array with the coordinates of the quad in local space.
code:SetIdentityMatrix( mat );SetIdentityMatrix( mat1);lpD3Ddevice->GetTransform( D3DTRANSFORMSTATE_VIEW, &mat ); mat._14 = 0; mat._24 = 0; mat._34 = 0; mat._44 = 1;MatrixInvert( mat1, mat ); mat1._41 = position.x; mat1._42 = position.y; mat1._43 = position.z;for(k = 0; k < 4; k++) m_cCoords[ k ].MultiplyWithMatrix( mat1 );
m_cCoords is the array with the coordinates of the quad in local space.
HTH
Greets Tobias
December 08, 1999 12:31 AM
Can anyone give me an example of using the view matrix and drawing billboard'd quad's in D3D ? I can cheat it by just transforming the location of the object and then extending edges in screen space, but I would rather have the quad in local space and transform it to the inverse of the view matrix.
I am mainly getting confused at how I incorporate the Inverse View matrix and the translation and scale of the object.
Any help is greatly appreciated!
December 08, 1999 12:31 AM
Lance:
"wrong board for this post, but anyway" ?
No, this is the right board for this question. It's specific to D3D.
Tobias:
Thanks !
It's sorta working, but I have a few things that aren't working right. If I can't figure it out, I'll be back
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement