Beispiel #1
0
void Camera::Pitch( float angle )
{
	Vec3 dir = _at - _pos;
	Vec3 axis = dir.cross(Vec3(0, 1, 0));
	axis.normalize();
	Quat q;
	q.FromAxisAngle(axis, angle * QUAT_PI / 360.f);
	q.ToMatrix().TransformVec3(dir.x, dir.y, dir.z);
	_at = _pos + dir;

	UpdateViewProj();
}
Beispiel #2
0
void Camera::Yaw(float angle) {
	Vec3 dir = _at - _pos;
	Quat q;
	q.FromAxisAngle(Vec3(0.f, 1.0f, 0.f), angle * QUAT_PI / 360.f);
	q.ToMatrix().TransformVec3(dir.x, dir.y, dir.z);
	_at = _pos + dir;

	//Sys_Printf("%f %f %f \n", _dir.x, _dir.y, _dir.z);

	//_at.rotatexzBy(angle, vec3(_pos.x, _pos.y, _pos.z));
	//Sys_Printf("%f %f %f \n", dir.x, dir.y, dir.z);
	UpdateViewProj();
}
Beispiel #3
0
void Camera::RotateByAxis( Vec3 axis, float angle ) {
	Quat q;
	q.FromAxisAngle(axis, angle * QUAT_PI / 360.f);
	q.ToMatrix().TransformVec3(_pos.x, _pos.y, _pos.z);
	UpdateViewProj();
}