Ejemplo n.º 1
0
Plane Frustum::GetPlane(int faceIndex) const
{
    assume(0 <= faceIndex && faceIndex <= 5);
    switch(faceIndex)
    {
        default: // For release builds where assume() is disabled, return always the first option if out-of-bounds.
        case 0: return NearPlane();
        case 1: return FarPlane();
        case 2: return LeftPlane();
        case 3: return RightPlane();
        case 4: return TopPlane();
        case 5: return BottomPlane();
    }
}
Ejemplo n.º 2
0
int Frustum::UniqueFaceNormals(vec *out) const
{
	if (type == PerspectiveFrustum)
	{
		out[0] = front;
		out[1] = LeftPlane().normal;
		out[2] = RightPlane().normal;
		out[3] = TopPlane().normal;
		out[4] = BottomPlane().normal;
		return 5;
	}
	else
	{
		out[0] = front;
		out[1] = up;
		out[2] = Cross(front, up);
		return 3;
	}
}