Package com.badlogic.gdx.math
Class Frustum
- java.lang.Object
-
- com.badlogic.gdx.math.Frustum
-
public class Frustum extends java.lang.ObjectA truncated rectangular pyramid. Used to define the viewable region and its projection onto the screen.- See Also:
Camera.frustum
-
-
Field Summary
Fields Modifier and Type Field Description protected static Vector3[]clipSpacePlanePointsprotected static float[]clipSpacePlanePointsArrayVector3[]planePointseight points making up the near and far clipping "rectangles".protected float[]planePointsArrayPlane[]planesthe six clipping planes, near, far, left, right, top, bottom
-
Constructor Summary
Constructors Constructor Description Frustum()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanboundsInFrustum(float x, float y, float z, float halfWidth, float halfHeight, float halfDepth)Returns whether the given bounding box is in the frustum.booleanboundsInFrustum(BoundingBox bounds)Returns whether the givenBoundingBoxis in the frustum.booleanboundsInFrustum(OrientedBoundingBox obb)Returns whether the givenOrientedBoundingBoxis in the frustum.booleanboundsInFrustum(Vector3 center, Vector3 dimensions)Returns whether the given bounding box is in the frustum.booleanpointInFrustum(float x, float y, float z)Returns whether the point is in the frustum.booleanpointInFrustum(Vector3 point)Returns whether the point is in the frustum.booleansphereInFrustum(float x, float y, float z, float radius)Returns whether the given sphere is in the frustum.booleansphereInFrustum(Vector3 center, float radius)Returns whether the given sphere is in the frustum.booleansphereInFrustumWithoutNearFar(float x, float y, float z, float radius)Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.booleansphereInFrustumWithoutNearFar(Vector3 center, float radius)Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.voidupdate(Matrix4 inverseProjectionView)Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g.
-
-
-
Field Detail
-
clipSpacePlanePoints
protected static final Vector3[] clipSpacePlanePoints
-
clipSpacePlanePointsArray
protected static final float[] clipSpacePlanePointsArray
-
planes
public final Plane[] planes
the six clipping planes, near, far, left, right, top, bottom
-
planePoints
public final Vector3[] planePoints
eight points making up the near and far clipping "rectangles". order is counter clockwise, starting at bottom left
-
planePointsArray
protected final float[] planePointsArray
-
-
Method Detail
-
update
public void update(Matrix4 inverseProjectionView)
Updates the clipping plane's based on the given inverse combined projection and view matrix, e.g. from anOrthographicCameraorPerspectiveCamera.- Parameters:
inverseProjectionView- the combined projection and view matrices.
-
pointInFrustum
public boolean pointInFrustum(Vector3 point)
Returns whether the point is in the frustum.- Parameters:
point- The point- Returns:
- Whether the point is in the frustum.
-
pointInFrustum
public boolean pointInFrustum(float x, float y, float z)Returns whether the point is in the frustum.- Parameters:
x- The X coordinate of the pointy- The Y coordinate of the pointz- The Z coordinate of the point- Returns:
- Whether the point is in the frustum.
-
sphereInFrustum
public boolean sphereInFrustum(Vector3 center, float radius)
Returns whether the given sphere is in the frustum.- Parameters:
center- The center of the sphereradius- The radius of the sphere- Returns:
- Whether the sphere is in the frustum
-
sphereInFrustum
public boolean sphereInFrustum(float x, float y, float z, float radius)Returns whether the given sphere is in the frustum.- Parameters:
x- The X coordinate of the center of the spherey- The Y coordinate of the center of the spherez- The Z coordinate of the center of the sphereradius- The radius of the sphere- Returns:
- Whether the sphere is in the frustum
-
sphereInFrustumWithoutNearFar
public boolean sphereInFrustumWithoutNearFar(Vector3 center, float radius)
Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.- Parameters:
center- The center of the sphereradius- The radius of the sphere- Returns:
- Whether the sphere is in the frustum
-
sphereInFrustumWithoutNearFar
public boolean sphereInFrustumWithoutNearFar(float x, float y, float z, float radius)Returns whether the given sphere is in the frustum not checking whether it is behind the near and far clipping plane.- Parameters:
x- The X coordinate of the center of the spherey- The Y coordinate of the center of the spherez- The Z coordinate of the center of the sphereradius- The radius of the sphere- Returns:
- Whether the sphere is in the frustum
-
boundsInFrustum
public boolean boundsInFrustum(BoundingBox bounds)
Returns whether the givenBoundingBoxis in the frustum.- Parameters:
bounds- The bounding box- Returns:
- Whether the bounding box is in the frustum
-
boundsInFrustum
public boolean boundsInFrustum(Vector3 center, Vector3 dimensions)
Returns whether the given bounding box is in the frustum.- Returns:
- Whether the bounding box is in the frustum
-
boundsInFrustum
public boolean boundsInFrustum(float x, float y, float z, float halfWidth, float halfHeight, float halfDepth)Returns whether the given bounding box is in the frustum.- Returns:
- Whether the bounding box is in the frustum
-
boundsInFrustum
public boolean boundsInFrustum(OrientedBoundingBox obb)
Returns whether the givenOrientedBoundingBoxis in the frustum.- Parameters:
obb- The oriented bounding box- Returns:
- Whether the oriented bounding box is in the frustum
-
-