mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-08 19:06:27 +00:00
Add rlCullDistance variables/getters and rlSetClipPlanes function (#3912)
The `RL_CULL_DISTANCE_` definition remains as the initial value of the variables. Basic usage can be: ```c #include <raylib.h> #include <rlgl.h> rlSetClipPlanes(RL_CULL_DISTANCE_NEAR, MY_CULL_DISTANCE_FAR); if (must_reset_clip_planes) rlSetClipPlanes(RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR); ```
This commit is contained in:
24
src/rlgl.h
24
src/rlgl.h
@@ -559,6 +559,10 @@ typedef enum {
|
||||
extern "C" { // Prevents name mangling of functions
|
||||
#endif
|
||||
|
||||
RLAPI void rlSetClipPlanes(double near, double far);
|
||||
RLAPI double rlGetCullDistanceNear();
|
||||
RLAPI double rlGetCullDistanceFar();
|
||||
|
||||
RLAPI void rlMatrixMode(int mode); // Choose the current matrix to be transformed
|
||||
RLAPI void rlPushMatrix(void); // Push the current matrix to stack
|
||||
RLAPI void rlPopMatrix(void); // Pop latest inserted matrix from stack
|
||||
@@ -1083,6 +1087,10 @@ typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
static double rlCullDistanceNear = RL_CULL_DISTANCE_NEAR;
|
||||
static double rlCullDistanceFar = RL_CULL_DISTANCE_FAR;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
static rlglData RLGL = { 0 };
|
||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
||||
@@ -1127,6 +1135,22 @@ static Matrix rlMatrixInvert(Matrix mat); // Invert provided m
|
||||
// Module Functions Definition - Matrix operations
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
void rlSetClipPlanes(double near, double far)
|
||||
{
|
||||
rlCullDistanceNear = near;
|
||||
rlCullDistanceFar = far;
|
||||
}
|
||||
|
||||
double rlGetCullDistanceFar()
|
||||
{
|
||||
return rlCullDistanceFar;
|
||||
}
|
||||
|
||||
double rlGetCullDistanceNear()
|
||||
{
|
||||
return rlCullDistanceNear;
|
||||
}
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_11)
|
||||
// Fallback to OpenGL 1.1 function calls
|
||||
//---------------------------------------
|
||||
|
Reference in New Issue
Block a user