transfered from codeberg
This commit is contained in:
38
source_code/frustum_module/frustum/frustum.h
Normal file
38
source_code/frustum_module/frustum/frustum.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef frustum_h
|
||||
#define frustum_h
|
||||
|
||||
#include "raylib.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define number_of_planes 6
|
||||
|
||||
typedef struct frustum_plane_struct
|
||||
{
|
||||
Vector3 normal;
|
||||
float distance;
|
||||
} frustum_plane_struct;
|
||||
|
||||
/**
|
||||
* Extracts the six clipping planes from a combined View-Projection matrix.
|
||||
* * This function utilizes the Gribb-Hartmann method to derive plane equations
|
||||
* directly from the matrix rows. The resulting planes are normalized to ensure
|
||||
* that the distance calculations in visibility tests are accurate.
|
||||
*/
|
||||
void extract_frustum_planes(frustum_plane_struct planes[number_of_planes],
|
||||
Matrix view_projection);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if an Axis-Aligned Bounding Box (AABB) is within the view frustum.
|
||||
* * This function performs a fast visibility test by finding the "positive vertex"
|
||||
* of the box (the corner most aligned with the plane normal). If this vertex
|
||||
* is outside any of the six planes, the entire box is considered culled.
|
||||
*/
|
||||
bool is_axis_aligned_bounding_box_in_frustum( const frustum_plane_struct planes
|
||||
[
|
||||
number_of_planes
|
||||
],
|
||||
BoundingBox bounds);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user