aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-05-31 17:11:02 +0200
committerraysan5 <raysan5@gmail.com>2016-05-31 17:11:02 +0200
commitcac2a66debd0f2d3ef8195940f8e2744d539d19a (patch)
tree423a8c52e5eda51008580f9c919a78034766204c /src
parentcaa7bc366b949310fbb9c7eafbb9fa7050e1514a (diff)
downloadraylib-cac2a66debd0f2d3ef8195940f8e2744d539d19a.tar.gz
raylib-cac2a66debd0f2d3ef8195940f8e2744d539d19a.zip
Improved library consistency
Functions renamed to improve library consistency
Diffstat (limited to 'src')
-rw-r--r--src/raylib.h8
-rw-r--r--src/rlgl.c18
-rw-r--r--src/rlgl.h9
3 files changed, 23 insertions, 12 deletions
diff --git a/src/raylib.h b/src/raylib.h
index cba73e52..5bef3698 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -860,8 +860,7 @@ Vector3 ResolveCollisionCubicmap(Image cubicmap, Vector3 mapPosition, Vector3 *p
//------------------------------------------------------------------------------------
Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations
void UnloadShader(Shader shader); // Unload a custom shader from memory
-void SetDefaultShader(void); // Set default shader to be used in batch draw
-void SetCustomShader(Shader shader); // Set custom shader to be used in batch draw
+
Shader GetDefaultShader(void); // Get default shader
Shader GetStandardShader(void); // Get default shader
Texture2D GetDefaultTexture(void); // Get default texture
@@ -871,7 +870,10 @@ void SetShaderValue(Shader shader, int uniformLoc, float *value, int size); // S
void SetShaderValuei(Shader shader, int uniformLoc, int *value, int size); // Set shader uniform value (int)
void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
-void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied)
+void BeginShaderMode(Shader shader); // Begin custom shader drawing
+void EndShaderMode(void); // End custom shader drawing (use default shader)
+void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
+void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
Light CreateLight(int type, Vector3 position, Color diffuse); // Create a new light, initialize it and add to pool
void DestroyLight(Light light); // Destroy a light and take it out of the list
diff --git a/src/rlgl.c b/src/rlgl.c
index 97a92a4d..5c4c9c01 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -2157,7 +2157,7 @@ void UnloadShader(Shader shader)
}
// Set custom shader to be used on batch draw
-void SetCustomShader(Shader shader)
+void BeginShaderMode(Shader shader)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if (currentShader.id != shader.id)
@@ -2169,10 +2169,10 @@ void SetCustomShader(Shader shader)
}
// Set default shader to be used in batch draw
-void SetDefaultShader(void)
+void EndShaderMode(void)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- SetCustomShader(defaultShader);
+ BeginShaderMode(defaultShader);
#endif
}
@@ -2254,9 +2254,9 @@ void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat)
#endif
}
-// Set blending mode (alpha, additive, multiplied)
-// NOTE: Only 3 blending modes predefined
-void SetBlendMode(int mode)
+// Begin blending mode (alpha, additive, multiplied)
+// NOTE: Only 3 blending modes supported, default blend mode is alpha
+void BeginBlendMode(int mode)
{
if ((blendMode != mode) && (mode < 3))
{
@@ -2274,6 +2274,12 @@ void SetBlendMode(int mode)
}
}
+// End blending mode (reset to default: alpha blending)
+void EndBlendMode(void)
+{
+ BeginBlendMode(BLEND_ALPHA);
+}
+
// Create a new light, initialize it and add to pool
Light CreateLight(int type, Vector3 position, Color diffuse)
{
diff --git a/src/rlgl.h b/src/rlgl.h
index 23ad29fb..ccf2b36a 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -317,9 +317,9 @@ void *rlglReadTexturePixels(Texture2D texture); // Read text
//------------------------------------------------------------------------------------
Shader LoadShader(char *vsFileName, char *fsFileName); // Load a custom shader and bind default locations
void UnloadShader(Shader shader); // Unload a custom shader from memory
-void SetCustomShader(Shader shader); // Set custom shader to be used in batch draw
-void SetDefaultShader(void); // Set default shader to be used in batch draw
+
Shader GetDefaultShader(void); // Get default shader
+Shader GetStandardShader(void); // Get default shader
Texture2D GetDefaultTexture(void); // Get default texture
int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
@@ -327,7 +327,10 @@ void SetShaderValue(Shader shader, int uniformLoc, float *value, int size); // S
void SetShaderValuei(Shader shader, int uniformLoc, int *value, int size); // Set shader uniform value (int)
void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
-void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied)
+void BeginShaderMode(Shader shader); // Begin custom shader drawing
+void EndShaderMode(void); // End custom shader drawing (use default shader)
+void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
+void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
Light CreateLight(int type, Vector3 position, Color diffuse); // Create a new light, initialize it and add to pool
void DestroyLight(Light light); // Destroy a light and take it out of the list