示例#1
0
float3x4 Frustum::WorldMatrix() const
{
	assume(up.IsNormalized());
	assume(front.IsNormalized());
	float3x4 m;
	m.SetCol(0, DIR_TO_FLOAT3(WorldRight().Normalized()));
	m.SetCol(1, DIR_TO_FLOAT3(up));
	if (handedness == FrustumRightHanded)
		m.SetCol(2, DIR_TO_FLOAT3(-front)); // In right-handed convention, the -Z axis must map towards the front vector. (so +Z maps to -front)
	else
		m.SetCol(2, DIR_TO_FLOAT3(front)); // In left-handed convention, the +Z axis must map towards the front vector.
	m.SetCol(3, POINT_TO_FLOAT3(pos));
	assume(!m.HasNegativeScale());
	return m;
}
示例#2
0
void AABB::Scale(const vec &centerPoint, const vec &scaleFactor)
{
	float3x4 transform = float3x4::Scale(DIR_TO_FLOAT3(scaleFactor), POINT_TO_FLOAT3(centerPoint)); ///\todo mat
	minPoint = POINT_VEC(transform.MulPos(POINT_TO_FLOAT3(minPoint))); ///\todo mat
	maxPoint = POINT_VEC(transform.MulPos(POINT_TO_FLOAT3(maxPoint))); ///\todo mat
}