Matr4::Matr4(const Vect4& xAxis, const Vect4& yAxis, const Vect4& zAxis, const Vect4& translate)
{
   memset(_elems, 0, sizeof(_elems));
   setAxisX(xAxis);
   setAxisY(yAxis);
   setAxisZ(zAxis);
   setTranslate(translate);
}
Example #2
0
void mat4::lookAt(const vec3 &eye, const vec3 &center, const vec3 &up)
{
	vec3 z = vec3(eye-center).getNormal();
	vec3 y = up;
	vec3 x = up.cross(z);

	identity();
	setAxisX(x);
	setAxisY(y);
	setAxisZ(z);
	setPos(eye);
}
Example #3
0
void mat3::lookAt(const vec3 &eye, const vec3 &center, const vec3 &up) {
	vec3 delta = center - eye;
	
	ASSERT(delta.getMagnitude() > FLT_EPSILON, "eye and center are too close together");
	
	const vec3 x = delta.getNormal();
	const vec3 y = up.cross(x);
	const vec3 z = up;
	
	setAxisX(x);
	setAxisY(y);
	setAxisZ(z);
}