Jump to content
  • Advertisement
Sign in to follow this  
adt7

Creating a Bounding Volume for a Spotlight

This topic is 3352 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

I currently draw my spotlights as full screen quads, which isn't the best way of doing things, so I've been trying to create a bounding volume (a box, not the traditional cone) however I'm having trouble with one of the matrix transforms required. The translation and the scaling are easy to do in DirectX, however the one that is stumping me is the rotation. I have got it working by creating the matrix elements manually, but surely there is a built-in function that can do this for me? Given that I'm using a cube created with the D3DX functions, how can I apply a rotation to it that points an axis of my choice (or any axis, it doesn't matter so long as I know which axis it's pointing in the direction) in a direction I specify?

Share this post


Link to post
Share on other sites
Advertisement
You could use D3DXMatrixLookAtLH and invert the result, if you want. Otherwise there's no D3DX function that can create a world matrix from a position, forward, and up vector (although it's pretty easy to make that yourself by manually setting the matrix elements, but I'd imagine that's what you're doing right now).

Share this post


Link to post
Share on other sites
Thanks MJP, inverting the LookAt matrix did the trick. I thought the LookAt function was the answer, but I hadn't realised I had to invert it.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!