Class Frustum

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class Frustum extends ProxyInstance

A 3D volume delimited by 2D clip planes.

The contents of the graphene_frustum_t are private, and should not be modified directly.

Since:
1.2
  • Constructor Details

    • Frustum

      public Frustum(MemorySegment address)
      Create a Frustum proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Frustum

      public Frustum(Arena arena)
      Allocate a new Frustum.
      Parameters:
      arena - to control the memory allocation scope
    • Frustum

      public Frustum()
      Allocate a new Frustum. The memory is allocated with Arena.ofAuto().
    • Frustum

      public Frustum(Plane[] planes, Arena arena)
      Allocate a new Frustum with the fields set to the provided values.
      Parameters:
      planes - value for the field planes
      arena - to control the memory allocation scope
    • Frustum

      public Frustum(Plane[] planes)
      Allocate a new Frustum with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      planes - value for the field planes
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Frustum class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readPlanes

      public @Nullable Plane @Nullable [] readPlanes()
      Read the value of the field planes.
      Returns:
      The value of the field planes
    • writePlanes

      public void writePlanes(@Nullable Plane @Nullable [] planes, Arena _arena)
      Write a value in the field planes.
      Parameters:
      planes - The new value for the field planes
    • alloc

      public static Frustum alloc()

      Allocates a new graphene_frustum_t structure.

      The contents of the returned structure are undefined.

      Returns:
      the newly allocated graphene_frustum_t structure. Use graphene_frustum_free() to free the resources allocated by this function.
      Since:
      1.2
    • containsPoint

      public boolean containsPoint(Point3D point)
      Checks whether a point is inside the volume defined by the given graphene_frustum_t.
      Parameters:
      point - a graphene_point3d_t
      Returns:
      true if the point is inside the frustum
      Since:
      1.2
    • equal

      public boolean equal(Frustum b)
      Checks whether the two given graphene_frustum_t are equal.
      Parameters:
      b - a graphene_frustum_t
      Returns:
      true if the given frustums are equal
      Since:
      1.6
    • free

      public void free()
      Frees the resources allocated by graphene_frustum_alloc().
      Since:
      1.2
    • getPlanes

      public void getPlanes(@Nullable Out<Plane[]> planes)
      Retrieves the planes that define the given graphene_frustum_t.
      Parameters:
      planes - return location for an array of 6 graphene_plane_t
      Since:
      1.2
    • init

      public Frustum init(Plane p0, Plane p1, Plane p2, Plane p3, Plane p4, Plane p5)
      Initializes the given graphene_frustum_t using the provided clipping planes.
      Parameters:
      p0 - a clipping plane
      p1 - a clipping plane
      p2 - a clipping plane
      p3 - a clipping plane
      p4 - a clipping plane
      p5 - a clipping plane
      Returns:
      the initialized frustum
      Since:
      1.2
    • initFromFrustum

      public Frustum initFromFrustum(Frustum src)
      Initializes the given graphene_frustum_t using the clipping planes of another graphene_frustum_t.
      Parameters:
      src - a graphene_frustum_t
      Returns:
      the initialized frustum
      Since:
      1.2
    • initFromMatrix

      public Frustum initFromMatrix(Matrix matrix)
      Initializes a graphene_frustum_t using the given matrix.
      Parameters:
      matrix - a graphene_matrix_t
      Returns:
      the initialized frustum
      Since:
      1.2
    • intersectsBox

      public boolean intersectsBox(Box box)
      Checks whether the given box intersects a plane of a graphene_frustum_t.
      Parameters:
      box - a graphene_box_t
      Returns:
      true if the box intersects the frustum
      Since:
      1.2
    • intersectsSphere

      public boolean intersectsSphere(Sphere sphere)
      Checks whether the given sphere intersects a plane of a graphene_frustum_t.
      Parameters:
      sphere - a graphene_sphere_t
      Returns:
      true if the sphere intersects the frustum
      Since:
      1.2