Added void rlClearDepthBuffer(void) to clear the depth buffer. Very useful for making FPS games.

This commit is contained in:
8bitprodigy 2025-10-15 01:18:42 -07:00
parent aaf4c1d3ae
commit 797e0ac940

View File

@ -2108,6 +2108,13 @@ void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned ch
glClearColor(cr, cg, cb, ca); glClearColor(cr, cg, cb, ca);
} }
// Clears the depth buffer. Useful for drawing first person weapons over the
// rendered scene without them clipping through world geometry.
void rlClearDepthBuffer(void)
{
glClear(GL_DEPTH_BUFFER_BIT); // Beats having to #import <GL/gl.h> just to call this one function.
}
// Clear used screen buffers (color and depth) // Clear used screen buffers (color and depth)
void rlClearScreenBuffers(void) void rlClearScreenBuffers(void)
{ {
@ -5364,4 +5371,4 @@ static Matrix rlMatrixInvert(Matrix mat)
} }
#endif #endif
#endif // RLGL_IMPLEMENTATION #endif // RLGL_IMPLEMENTATION