Add render batch utility functions for depth control
Allows existing draw functions to be drawn out of order at different depths while still using batching. * Add rlGetRenderBatchActive to match rlSetRenderBatchActive * Add rlGetRenderBatchDepth to get the depth for the active render batch * Add rlSetRenderBatchDepth to set the depth for the active render batch
This commit is contained in:
parent
c15f3214d5
commit
d4f9123500
1 changed files with 22 additions and 0 deletions
22
src/rlgl.h
22
src/rlgl.h
|
|
@ -730,10 +730,14 @@ RLAPI int *rlGetShaderLocsDefault(void); // Get default shader lo
|
|||
RLAPI rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements); // Load a render batch system
|
||||
RLAPI void rlUnloadRenderBatch(rlRenderBatch batch); // Unload render batch system
|
||||
RLAPI void rlDrawRenderBatch(rlRenderBatch *batch); // Draw render batch data (Update->Draw->Reset)
|
||||
RLAPI rlRenderBatch* rlGetRenderBatchActive(void); // Get the active render batch
|
||||
RLAPI void rlSetRenderBatchActive(rlRenderBatch *batch); // Set the active render batch for rlgl (NULL for default internal)
|
||||
RLAPI void rlDrawRenderBatchActive(void); // Update and draw internal render batch
|
||||
RLAPI bool rlCheckRenderBatchLimit(int vCount); // Check internal buffer overflow for a given number of vertex
|
||||
|
||||
RLAPI float rlGetRenderBatchDepth(); // Get the depth for the active render batch
|
||||
RLAPI void rlSetRenderBatchDepth(float depth); // Set the depth for the active render batch
|
||||
|
||||
RLAPI void rlSetTexture(unsigned int id); // Set current texture for render batch and check buffers limits
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------
|
||||
|
|
@ -3179,6 +3183,12 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
|
|||
#endif
|
||||
}
|
||||
|
||||
// Get the active render batch for rlgl
|
||||
rlRenderBatch* rlGetRenderBatchActive()
|
||||
{
|
||||
return RLGL.currentBatch;
|
||||
}
|
||||
|
||||
// Set the active render batch for rlgl
|
||||
void rlSetRenderBatchActive(rlRenderBatch *batch)
|
||||
{
|
||||
|
|
@ -3225,6 +3235,18 @@ bool rlCheckRenderBatchLimit(int vCount)
|
|||
return overflow;
|
||||
}
|
||||
|
||||
// Get the depth for the active render batch
|
||||
float rlGetRenderBatchDepth()
|
||||
{
|
||||
return RLGL.currentBatch->currentDepth;
|
||||
}
|
||||
|
||||
// Set the depth for the active render batch
|
||||
void rlSetRenderBatchDepth(float depth)
|
||||
{
|
||||
RLGL.currentBatch->currentDepth = depth;
|
||||
}
|
||||
|
||||
// Textures data management
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// Convert image data to OpenGL texture (returns OpenGL valid Id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue