Esempio n. 1
0
void frustum_plane_corners(Vec3f out[4], float fov, float aspect, float plane)
{
	const Vec2f wh = frustum_plane_wh(fov, aspect, plane);
	const Vec3f up = Vec3f_Y();
	const Vec3f right = Vec3f_X();
	const Vec3f fc {0, 0, plane};
	out[FPC_TOP_LEFT]     = fc + (up * Vec3f(wh.y/2)) - (right * Vec3f(wh.x/2));
	out[FPC_TOP_RIGHT]    = fc + (up * Vec3f(wh.y/2)) + (right * Vec3f(wh.x/2));
	out[FPC_BOTTOM_LEFT]  = fc - (up * Vec3f(wh.y/2)) - (right * Vec3f(wh.x/2));
	out[FPC_BOTTOM_RIGHT] = fc - (up * Vec3f(wh.y/2)) + (right * Vec3f(wh.x/2));
}
Esempio n. 2
0
File: MC.cpp Progetto: angjminer/mc
static Quat mouse_rotate(const Quat &in, float x, float y, float sensitivity)
{
	const Quat xq(Vec3f_Y(), -x * sensitivity);
	const Quat yq(Vec3f_X(), -y * sensitivity);
	return xq * (in * yq);
}