transfered from codeberg

This commit is contained in:
2026-03-26 14:46:39 -05:00
parent 630f28bb7e
commit 5ed2173793
136 changed files with 14932 additions and 0 deletions

View 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