So I have a 3D Plane described by 2 Vectors:
P : a point which lies on the Plane
N : the surface normal for the Plane
And i ha
Not sure what method you are using to render, but borrowing from OpenSceneGraph's matrix:
void Matrix_implementation::makeLookAt(const Vec3d& eye,const Vec3d& center,const Vec3d& up)
{
Vec3d f(center-eye);
f.normalize();
Vec3d s(f^up);
s.normalize();
Vec3d u(s^f);
u.normalize();
set(
s[0], u[0], -f[0], 0.0,
s[1], u[1], -f[1], 0.0,
s[2], u[2], -f[2], 0.0,
0.0, 0.0, 0.0, 1.0);
preMultTranslate(-eye);
}
inline void Matrixd::preMultTranslate( const Vec3d& v )
{
for (unsigned i = 0; i < 3; ++i)
{
double tmp = v[i];
if (tmp == 0)
continue;
_mat[3][0] += tmp*_mat[i][0];
_mat[3][1] += tmp*_mat[i][1];
_mat[3][2] += tmp*_mat[i][2];
_mat[3][3] += tmp*_mat[i][3];
}
}
Hopefully this will give you an idea for your implementation. I'm not very good with quaternions which might have a simpler solution, but this method works well for me.