summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2022-10-05 13:29:34 +0200
committerRay <[email protected]>2022-10-05 13:29:34 +0200
commit9017be32596c1ac3847e04e750fcd482d3b2d9fc (patch)
treed329ff569c52d925f8ce7a2ad44c1e762d21f42c /src
parent2d88958d35346ab35c6ad6f11c75f8a1fdc2f799 (diff)
downloadraylib-9017be32596c1ac3847e04e750fcd482d3b2d9fc.tar.gz
raylib-9017be32596c1ac3847e04e750fcd482d3b2d9fc.zip
Reviewed latest PR formating and variables naming #2741
Diffstat (limited to 'src')
-rw-r--r--src/rlgl.h48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 5f78cde0..32620487 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -596,7 +596,7 @@ RLAPI void rlClearScreenBuffers(void); // Clear used screen buf
RLAPI void rlCheckErrors(void); // Check and log OpenGL error codes
RLAPI void rlSetBlendMode(int mode); // Set blending mode
RLAPI void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation); // Set blending mode factor and equation (using OpenGL factors)
-RLAPI void rlSetBlendFactorsSeparate(int srgb, int drgb, int salpha, int dalpha, int ergb, int ealpha); // Set blending mode factors and equations separately (using OpenGL factors)
+RLAPI void rlSetBlendFactorsSeparate(int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha); // Set blending mode factors and equations separately (using OpenGL factors)
//------------------------------------------------------------------------------------
// Functions Declaration - rlgl functionality
@@ -928,6 +928,7 @@ typedef struct rlglData {
Matrix projectionStereo[2]; // VR stereo rendering eyes projection matrices
Matrix viewOffsetStereo[2]; // VR stereo rendering eyes view offset matrices
+ // Blending variables
int currentBlendMode; // Blending mode active
int glBlendSrcFactor; // Blending source factor
int glBlendDstFactor; // Blending destination factor
@@ -1813,14 +1814,15 @@ void rlSetBlendMode(int mode)
{
// NOTE: Using GL blend src/dst factors and GL equation configured with rlSetBlendFactors()
glBlendFunc(RLGL.State.glBlendSrcFactor, RLGL.State.glBlendDstFactor); glBlendEquation(RLGL.State.glBlendEquation);
+
} break;
case RL_BLEND_CUSTOM_SEPARATE:
{
// NOTE: Using GL blend src/dst factors and GL equation configured with rlSetBlendFactorsSeparate()
glBlendFuncSeparate(RLGL.State.glBlendSrcFactorRGB, RLGL.State.glBlendDestFactorRGB, RLGL.State.glBlendSrcFactorAlpha, RLGL.State.glBlendDestFactorAlpha);
glBlendEquationSeparate(RLGL.State.glBlendEquationRGB, RLGL.State.glBlendEquationAlpha);
- break;
- }
+
+ } break;
default: break;
}
@@ -1831,20 +1833,23 @@ void rlSetBlendMode(int mode)
}
// Set blending mode factor and equation used by glBlendFuncSeparate and glBlendEquationSeparate
-void rlSetBlendFactorsSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha, int modeRGB, int modeAlpha) {
+void rlSetBlendFactorsSeparate(int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha)
+{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- if (RLGL.State.glBlendSrcFactorRGB == srcRGB
- && RLGL.State.glBlendDestFactorRGB == dstRGB
- && RLGL.State.glBlendSrcFactorAlpha == srcAlpha
- && RLGL.State.glBlendDestFactorAlpha == destAlpha
- && RLGL.State.glBlendEquationRGB == modeRGB
- && RLGL.State.glBlendEquationAlpha == modeAlpha) return;
- RLGL.State.glBlendSrcFactorRGB = srcRGB;
- RLGL.State.glBlendDestFactorRGB = destRGB;
- RLGL.State.glBlendSrcFactorAlpha = srcAlpha;
- RLGL.State.glBlendDestFactorAlpha = dstAlpha;
- RLGL.State.glBlendEquationRGB = modeRGB;
- RLGL.State.glBlendEquationAlpha = modeAlpha;
+ if ((RLGL.State.glBlendSrcFactorRGB == glSrcRGB) &&
+ (RLGL.State.glBlendDestFactorRGB == glDstRGB) &&
+ (RLGL.State.glBlendSrcFactorAlpha == glSrcAlpha) &&
+ (RLGL.State.glBlendDestFactorAlpha == glDstAlpha) &&
+ (RLGL.State.glBlendEquationRGB == glEqRGB) &&
+ (RLGL.State.glBlendEquationAlpha == glEqAlpha)) return;
+
+ RLGL.State.glBlendSrcFactorRGB = glSrcRGB;
+ RLGL.State.glBlendDestFactorRGB = glDstRGB;
+ RLGL.State.glBlendSrcFactorAlpha = glSrcAlpha;
+ RLGL.State.glBlendDestFactorAlpha = glDstAlpha;
+ RLGL.State.glBlendEquationRGB = glEqRGB;
+ RLGL.State.glBlendEquationAlpha = glEqAlpha;
+
RLGL.State.glCustomBlendModeModified = true;
#endif
}
@@ -1853,12 +1858,14 @@ void rlSetBlendFactorsSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlph
void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- if (RLGL.State.glBlendSrcFactor == glSrcFactor
- && RLGL.State.glBlendDstFactor == glDstFactor
- && RLGL.State.glBlendEquation == glEquation) return;
+ if ((RLGL.State.glBlendSrcFactor == glSrcFactor) &&
+ (RLGL.State.glBlendDstFactor == glDstFactor) &&
+ (RLGL.State.glBlendEquation == glEquation)) return;
+
RLGL.State.glBlendSrcFactor = glSrcFactor;
RLGL.State.glBlendDstFactor = glDstFactor;
RLGL.State.glBlendEquation = glEquation;
+
RLGL.State.glCustomBlendModeModified = true;
#endif
}
@@ -2009,9 +2016,6 @@ void rlglInit(int width, int height)
//----------------------------------------------------------
#endif
- // Init state: custom blend factor and equation modification flag
- RLGL.State.glCustomBlendModeModified = false;
-
// Init state: Color/Depth buffers clear
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set clear color (black)
glClearDepth(1.0f); // Set clear depth value (default)