lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::scene::Frustum Class Reference

Frustum structure. More...

#include <frustum.hpp>

Public Types

enum  PlaneIndex {
  Left = 0 , Right , Bottom , Top ,
  Near , Far
}
 Enumeration for the frustum planes. More...
 

Public Member Functions

void update (const glm::mat4 &view_projection)
 Update the frustum planes from a view-projection matrix.
 
bool contains_point (const glm::vec3 &point) const
 Check if a point is inside the frustum.
 
bool contains_sphere (const BoundingSphere &sphere) const
 Check if a bounding sphere is inside the frustum.
 
bool contains_aabb (const AABB &aabb) const
 Check if an Axis-Aligned Bounding Box (AABB) is inside the frustum.
 
const Planeget_plane (PlaneIndex index) const
 Get a specific frustum plane.
 

Detailed Description

Frustum structure.

Represents a view frustum defined by six planes (left, right, bottom, top, near, far). Provides methods for updating the frustum from a view-projection matrix and for checking containment of points, spheres, and AABBs.

Member Enumeration Documentation

◆ PlaneIndex

Enumeration for the frustum planes.

Defines indices for accessing the six planes of the frustum.

  • Left: Left plane
  • Right: Right plane
  • Bottom: Bottom plane
  • Top: Top plane
  • Near: Near plane
  • Far: Far plane

Member Function Documentation

◆ contains_aabb()

bool lmgl::scene::Frustum::contains_aabb ( const AABB & aabb) const

Check if an Axis-Aligned Bounding Box (AABB) is inside the frustum.

Determines whether the specified AABB is contained within the frustum.

Parameters
aabbThe AABB to check.
Returns
True if the AABB is inside the frustum, false otherwise.

◆ contains_point()

bool lmgl::scene::Frustum::contains_point ( const glm::vec3 & point) const

Check if a point is inside the frustum.

Determines whether the specified point is contained within the frustum.

Parameters
pointThe point to check.
Returns
True if the point is inside the frustum, false otherwise.

◆ contains_sphere()

bool lmgl::scene::Frustum::contains_sphere ( const BoundingSphere & sphere) const

Check if a bounding sphere is inside the frustum.

Determines whether the specified bounding sphere is contained within the frustum.

Parameters
sphereThe bounding sphere to check.
Returns
True if the sphere is inside the frustum, false otherwise.

◆ get_plane()

const Plane & lmgl::scene::Frustum::get_plane ( PlaneIndex index) const
inline

Get a specific frustum plane.

Retrieves the plane corresponding to the given index.

Parameters
indexThe index of the plane to retrieve.
Returns
Reference to the requested Plane.

◆ update()

void lmgl::scene::Frustum::update ( const glm::mat4 & view_projection)

Update the frustum planes from a view-projection matrix.

Extracts the six frustum planes from the provided view-projection matrix.

Parameters
view_projectionThe combined view-projection matrix.

The documentation for this class was generated from the following files: