예제 #1
0
파일: Frustum.cpp 프로젝트: nsf/sseculling
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));
}
예제 #2
0
파일: MC.cpp 프로젝트: 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);
}