helloz!
i was trying to calculate the world coordinates of the 4 corners of the camera view plane, so i thought of just storing the "directional vectors" from the viewpoint to each of the 4 corners of the viewplane.
firstly does this make sense to u? or am i missing something at this point?
if the above is the most logical way to do it, given that
near plane distance = 0.001f, fov y = 90.0f,
i would perform the algorithm in order:
1)calculate the initial 4 directional vectors to each corner using near plane distance, & fov y & initial camera position & initial camera rotation (assuming no rotation for now)
float near_dist = 0.001f;
float fovy = 90.0f;
float bias = near_dist * tan(fovy/2);
//vector->topleft
m_topleft.x[0] = m_camPosition.x[0] - bias;
m_topleft.x[1] = m_camPosition.x[1] + bias;
m_topleft.x[2] = m_camPosition.x[2] - near_dist;//RHS coord system
2)whenever i update the camera look at vector, i would take the difference of the updated look at vector.
Vector3D prev_view = m_camPosition + m_camLookAt;
//calculate new lookat vector
Vector3D view_diff = prev_view - (m_camPosition + m_camLookAt);
3)update each directional vector with the difference calculated in step 2.
//for directional vector(viewpoint to topleft of viewplane)
m_topleft = m_topleft + view_diff;
somehow i tried to printing the values out, guts tell me something somewhere is not so correct...sigh
thx!
Edwinz