Class WireFrustum

java.lang.Object
com.jme3.scene.Mesh
com.jme3.scene.debug.WireFrustum
All Implemented Interfaces:
Savable, JmeCloneable, Cloneable

public class WireFrustum extends Mesh
A specialized Mesh that renders a camera frustum as a wireframe. This class extends jME3's Mesh and is designed to visually represent the viewing volume of a camera, which can be useful for debugging or visualization purposes.

The frustum is defined by eight points: four for the near plane and four for the far plane. These points are connected by lines to form a wireframe cube-like structure.

  • Constructor Details

    • WireFrustum

      protected WireFrustum()
      For Serialization only. Do not use.
    • WireFrustum

      public WireFrustum(Vector3f[] points)
      Constructs a new `WireFrustum` mesh using the specified frustum corner points. The points should represent the 8 corners of the frustum. The expected order of points is typically: 0-3: Near plane (e.g., bottom-left, bottom-right, top-right, top-left) 4-7: Far plane (e.g., bottom-left, bottom-right, top-right, top-left)
      Parameters:
      points - An array of 8 `Vector3f` objects representing the frustum's corners. If the array is null or does not contain 8 points, an `IllegalArgumentException` will be thrown.
  • Method Details

    • update

      public void update(Vector3f[] points)
      Updates the vertex positions of the existing `WireFrustum` mesh. This is more efficient than creating a new `WireFrustum` instance if only the frustum's position or orientation changes.
      Parameters:
      points - An array of 8 `Vector3f` objects representing the new frustum's corners. If the array is null or does not contain 8 points, an `IllegalArgumentException` will be thrown.
    • makeFrustum

      public static Mesh makeFrustum(Vector3f[] points)
      A static factory method to create a new `WireFrustum` mesh. This method provides a cleaner way to instantiate a `WireFrustum`.
      Parameters:
      points - An array of 8 `Vector3f` objects representing the frustum's corners.
      Returns:
      A new `WireFrustum` instance.
    • makeGeometry

      public static Geometry makeGeometry(Camera camera)
      Creates a `Geometry` object representing the wireframe frustum of a given camera. The frustum points are calculated based on the camera's current view settings. The returned `Geometry` can be directly attached to a scene graph.
      Parameters:
      camera - The `Camera` whose frustum is to be visualized.
      Returns:
      A `Geometry` object containing the `WireFrustum` mesh.