Obtaining a unit directional Vector3f from a Matrix3f

Started by Maykin53, October 22, 2011, 06:56:49

Previous topic - Next topic

Maykin53

Hello all.
In my program, my light sources are defined by:

Vector3f location
Vector3f direction (unit directional vector. ie. 0,0,1 for looking down the Z axis away from the screen)
Vector4f color

my third person camera is defined by a set of vectors for view, distance, rotation, and orbit - all from which a Perspective Matrix (Matrix4f) is obtained and passed to the shader.

Both my lights and my camera work fine.

However, the problem I have is that I want to create a light source that's direction is always the same as the camera's (ie. the camera's Orbit Vector3f).
I'm not sure how to convert from a rotation vector or matrix4f to a unit directional vector. Does anyone know how this is done?

Basically I want to have my light's direction the same as my camera's orbit.