Esempio n. 1
0
void Camera::roll_right(double elapsed_seconds) {
	cam_roll += cam_heading_speed * elapsed_seconds;
	cam_moved = true;
	float q_roll[16];
	create_versor (q_roll, cam_roll, fwd.v[0], fwd.v[1], fwd.v[2]);
	mult_quat_quat (quaternion, q_roll, quaternion);

	// recalc axes to suit new orientation
	recalc_axes();
}
Esempio n. 2
0
void Camera::yaw_right(double elapsed_seconds) {
	cam_yaw -= cam_heading_speed * elapsed_seconds;
	cam_moved = true;
	float q_yaw[16];
	create_versor (q_yaw, cam_yaw, up.v[0], up.v[1], up.v[2]);
	mult_quat_quat (quaternion, q_yaw, quaternion);

	// recalc axes to suit new orientation
	recalc_axes();
}
Esempio n. 3
0
void Camera::pitch_up(double elapsed_seconds) {
	cam_pitch += cam_heading_speed * elapsed_seconds;
	cam_moved = true;
	float q_pitch[16];
	create_versor (
		q_pitch, cam_pitch, rgt.v[0], rgt.v[1], rgt.v[2]
	);
	mult_quat_quat (quaternion, q_pitch, quaternion);

	// recalc axes to suit new orientation
	recalc_axes();
}
Esempio n. 4
0
void GLCamera::movePitchDown(double elapsed_seconds)
{
	cam_pitch -= cam_heading_speed * elapsed_seconds;
	float q_pitch[16];
	create_versor(q_pitch, cam_pitch, rgt.v[0], rgt.v[1], rgt.v[2]);
	mult_quat_quat(quaternion, q_pitch, quaternion);

	// recalc axes to suit new orientation
	quat_to_mat4(R.m, quaternion);
	fwd = R * vector4(0.0, 0.0, -1.0, 0.0);
	rgt = R * vector4(1.0, 0.0, 0.0, 0.0);
	up = R * vector4(0.0, 1.0, 0.0, 0.0);
}
Esempio n. 5
0
void Camera::yaw_left(double elapsed_seconds) {
	cam_yaw += cam_heading_speed * elapsed_seconds;
	cam_moved = true;

	// create a quaternion representing change in heading (the yaw)
	float q_yaw[16];
	create_versor (q_yaw, cam_yaw, up.v[0], up.v[1], up.v[2]);
	// add yaw rotation to the camera's current orientation
	mult_quat_quat (quaternion, q_yaw, quaternion);

	// recalc axes to suit new orientation
	recalc_axes();
}
Esempio n. 6
0
void GLCamera::rollRight(double elapsed_seconds)
{
	cam_roll += cam_heading_speed * elapsed_seconds;
	float q_roll[16];
	create_versor(q_roll, cam_roll, fwd.v[0], fwd.v[1], fwd.v[2]);
	mult_quat_quat(quaternion, q_roll, quaternion);

	// recalc axes to suit new orientation
	quat_to_mat4(R.m, quaternion);
	fwd = R * vector4(0.0, 0.0, -1.0, 0.0);
	rgt = R * vector4(1.0, 0.0, 0.0, 0.0);
	up = R * vector4(0.0, 1.0, 0.0, 0.0);

}
Esempio n. 7
0
void GLCamera::moveYawLeft(double elapsed_seconds)
{
	cam_yaw += getHeadingSpeed() * elapsed_seconds;

	// create a quaternion representing change in heading (the yaw)
	float q_yaw[16];
	create_versor(q_yaw, cam_yaw, up.v[0], up.v[1], up.v[2]);
	// add yaw rotation to the camera's current orientation
	mult_quat_quat(quaternion, q_yaw, quaternion);

	// recalc axes to suit new orientation
	quat_to_mat4(R.m, quaternion);
	fwd = R * vector4(0.0, 0.0, -1.0, 0.0);
	rgt = R * vector4(1.0, 0.0, 0.0, 0.0);
	up  = R * vector4(0.0, 1.0, 0.0, 0.0);

}