Пример #1
0
//==============================================================================
void OrthographicFrustum::recalculate()
{
	// Planes
	m_planesL[(U)PlaneType::LEFT] = Plane(Vec4(1.0, 0.0, 0.0, 0.0), m_left);
	m_planesL[(U)PlaneType::RIGHT] = Plane(Vec4(-1.0, 0.0, 0.0, 0.0), -m_right);

	m_planesL[(U)PlaneType::NEAR] = Plane(Vec4(0.0, 0.0, -1.0, 0.0), m_near);
	m_planesL[(U)PlaneType::FAR] = Plane(Vec4(0.0, 0.0, 1.0, 0.0), -m_far);
	m_planesL[(U)PlaneType::TOP] = Plane(Vec4(0.0, -1.0, 0.0, 0.0), -m_top);
	m_planesL[(U)PlaneType::BOTTOM] = Plane(Vec4(0.0, 1.0, 0.0, 0.0), m_bottom);

	// OBB
	Vec4 c((m_right + m_left) * 0.5,
		(m_top + m_bottom) * 0.5,
		-(m_far + m_near) * 0.5,
		0.0);
	Vec4 e = Vec4(m_right, m_top, -m_far, 0.0) - c;
	m_obbL = Obb(c, Mat3x4::getIdentity(), e);
}
Пример #2
0
void Aabb::calculateObb()
{
	glm::vec4 center = (corners[0] + corners[1]) * 0.5f;

	asObb = Obb(glm::vec3(center), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(corners[1] - center));
}