Jump to content
  • Advertisement
Sign in to follow this  
neeker

D3DXMatrixLookAtLH internally

This topic is 1786 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I have a project that to remove all dependency on d3dx9, so I have to manually implement the functionality of D3DXMatrixLookAtLH.  I found some great resources for implementing D3DXMatrixPerspectiveFovLH, but I can seem to find anything D3DXMatrixLookAtLH.  I've tried looking at the return values and it's not making much sense right now.  Does anyone have an idea how the final matrix is built?

Edited by neeker

Share this post


Link to post
Share on other sites
Advertisement

What nonoptimalrobot said, but if you want to see an implementation example:

		Matrix MatLookAt(const Vector3& vEye, const Vector3& vAt, const Vector3& vUp)
		{
			Vector3 vZ = (vAt - vEye).normal();
			Vector3 vX = (vUp.Cross(vZ)).normal();
			Vector3 vY = vZ.Cross(vX);

			return Matrix(	vX.x,			vY.x,			vZ.x,			0.0f,
							vX.y,			vY.y,			vZ.y,			0.0f,
							vX.z,			vY.z,			vZ.z,			0.0f,
							-vX.Dot(vEye), -vY.Dot(vEye),	-vZ.Dot(vEye),	1.0f);
		}

Share this post


Link to post
Share on other sites

I hate to downvote, Kubera, but with XNA dead in the water, that is about as useful a suggestion as using d3dx math. I would recommend DirectXMath as a current, and more future proof library.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!