Compare commits

..

No commits in common. "master" and "detached" have entirely different histories.

10 changed files with 92 additions and 194 deletions

View file

@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
#this change avoid the warning that appear when we include raylib using Cmake fatch content #this change avoid the warning that appear when we include raylib using Cmake fatch content
project(raylib) project(raylib)
# Avoid excessive expansion of variables in conditionals. In particular, if # Avoid excessive expansion of variables in conditionals. In particular, if
# "PLATFORM" is "DRM" then: # "PLATFORM" is "DRM" then:
# #

View file

@ -8,7 +8,7 @@ cp src/rlgl.h include/
cp src/rcamera.h include/ cp src/rcamera.h include/
cd linux-64 cd linux-64
cmake -DPLATFORM=Desktop .. cmake -DPLATFORM=Desktop ..
cd raylib cd raylib
make RAYLIB_LIBTYPE=STATIC -j16 CFLAGS="-O3" make RAYLIB_LIBTYPE=STATIC -j16 CFLAGS="-O3"
cd ../.. cd ../..

View file

@ -176,7 +176,7 @@ endif
# Define default C compiler: CC # Define default C compiler: CC
#------------------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------------------
CC = clang CC = gcc
ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW)
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)

View file

@ -171,8 +171,33 @@
// Some Basic Colors // Some Basic Colors
// NOTE: Custom raylib color palette for amazing visuals on WHITE background // NOTE: Custom raylib color palette for amazing visuals on WHITE background
#define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray
#define GRAY CLITERAL(Color){ 130, 130, 130, 255 } // Gray
#define DARKGRAY CLITERAL(Color){ 80, 80, 80, 255 } // Dark Gray
#define YELLOW CLITERAL(Color){ 253, 249, 0, 255 } // Yellow
#define GOLD CLITERAL(Color){ 255, 203, 0, 255 } // Gold
#define ORANGE CLITERAL(Color){ 255, 161, 0, 255 } // Orange
#define PINK CLITERAL(Color){ 255, 109, 194, 255 } // Pink
#define RED CLITERAL(Color){ 230, 41, 55, 255 } // Red
#define MAROON CLITERAL(Color){ 190, 33, 55, 255 } // Maroon
#define GREEN CLITERAL(Color){ 0, 228, 48, 255 } // Green
#define LIME CLITERAL(Color){ 0, 158, 47, 255 } // Lime
#define DARKGREEN CLITERAL(Color){ 0, 117, 44, 255 } // Dark Green
#define SKYBLUE CLITERAL(Color){ 102, 191, 255, 255 } // Sky Blue
#define BLUE CLITERAL(Color){ 0, 121, 241, 255 } // Blue
#define DARKBLUE CLITERAL(Color){ 0, 82, 172, 255 } // Dark Blue
#define PURPLE CLITERAL(Color){ 200, 122, 255, 255 } // Purple
#define VIOLET CLITERAL(Color){ 135, 60, 190, 255 } // Violet
#define DARKPURPLE CLITERAL(Color){ 112, 31, 126, 255 } // Dark Purple
#define BEIGE CLITERAL(Color){ 211, 176, 131, 255 } // Beige
#define BROWN CLITERAL(Color){ 127, 106, 79, 255 } // Brown
#define DARKBROWN CLITERAL(Color){ 76, 63, 47, 255 } // Dark Brown
#define WHITE CLITERAL(Color){ 255, 255, 255, 255 } // White
#define BLACK CLITERAL(Color){ 0, 0, 0, 255 } // Black
#define BLANK CLITERAL(Color){ 0, 0, 0, 0 } // Blank (Transparent)
#define MAGENTA CLITERAL(Color){ 255, 0, 255, 255 } // Magenta
#define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 } // My own White (raylib logo)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
@ -224,67 +249,6 @@ typedef struct Color {
unsigned char b; // Color blue value unsigned char b; // Color blue value
unsigned char a; // Color alpha value unsigned char a; // Color alpha value
} Color; } Color;
#ifdef __cplusplus
namespace rl {
inline const Color LIGHTGRAY = (Color){ 200, 200, 200, 255 } ;// Light Gray
inline const Color GRAY = (Color){ 130, 130, 130, 255 } ;// Gray
inline const Color DARKGRAY = (Color){ 80, 80, 80, 255 } ;// Dark Gray
inline const Color YELLOW = (Color){ 253, 249, 0, 255 } ;// Yellow
inline const Color GOLD = (Color){ 255, 203, 0, 255 } ;// Gold
inline const Color ORANGE = (Color){ 255, 161, 0, 255 } ;// Orange
inline const Color PINK = (Color){ 255, 109, 194, 255 } ;// Pink
inline const Color RED = (Color){ 230, 41, 55, 255 } ;// Red
inline const Color MAROON = (Color){ 190, 33, 55, 255 } ;// Maroon
inline const Color GREEN = (Color){ 0, 228, 48, 255 } ;// Green
inline const Color LIME = (Color){ 0, 158, 47, 255 } ;// Lime
inline const Color DARKGREEN = (Color){ 0, 117, 44, 255 } ;// Dark Green
inline const Color SKYBLUE = (Color){ 102, 191, 255, 255 } ;// Sky Blue
inline const Color BLUE = (Color){ 0, 121, 241, 255 } ;// Blue
inline const Color DARKBLUE = (Color){ 0, 82, 172, 255 } ;// Dark Blue
inline const Color PURPLE = (Color){ 200, 122, 255, 255 } ;// Purple
inline const Color VIOLET = (Color){ 135, 60, 190, 255 } ;// Violet
inline const Color DARKPURPLE= (Color){ 112, 31, 126, 255 } ;// Dark Purple
inline const Color BEIGE = (Color){ 211, 176, 131, 255 } ;// Beige
inline const Color BROWN = (Color){ 127, 106, 79, 255 } ;// Brown
inline const Color DARKBROWN = (Color){ 76, 63, 47, 255 } ;// Dark Brown
inline const Color WHITE = (Color){ 255, 255, 255, 255 } ;// White
inline const Color BLACK = (Color){ 0, 0, 0, 255 } ;// Black
inline const Color BLANK = (Color){ 0, 0, 0, 0 } ;// Blank (Transparent)
inline const Color MAGENTA = (Color){ 255, 0, 255, 255 } ;// Magenta
inline const Color RAYWHITE = (Color){ 245, 245, 245, 255 } ;// My own White (raylib logo)
}
#else
struct raycolor {
const Color LIGHTGRAY ;// Light Gray
const Color GRAY ;// Gray
const Color DARKGRAY ;// Dark Gray
const Color YELLOW ;// Yellow
const Color GOLD ;// Gold
const Color ORANGE ;// Orange
const Color PINK ;// Pink
const Color RED ;// Red
const Color MAROON ;// Maroon
const Color GREEN ;// Green
const Color LIME ;// Lime
const Color DARKGREEN ;// Dark Green
const Color SKYBLUE ;// Sky Blue
const Color BLUE ;// Blue
const Color DARKBLUE ;// Dark Blue
const Color PURPLE ;// Purple
const Color VIOLET ;// Violet
const Color DARKPURPLE;// Dark Purple
const Color BEIGE ;// Beige
const Color BROWN ;// Brown
const Color DARKBROWN ;// Dark Brown
const Color WHITE ;// White
const Color BLACK ;// Black
const Color BLANK ;// Blank (Transparent)
const Color MAGENTA ;// Magenta
const Color RAYWHITE ;// My own White (raylib logo)
};
extern struct raycolor rl;
#endif
// Rectangle, 4 components // Rectangle, 4 components
typedef struct Rectangle { typedef struct Rectangle {
@ -502,7 +466,6 @@ typedef struct AudioStream {
unsigned int sampleRate; // Frequency (samples per second) unsigned int sampleRate; // Frequency (samples per second)
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
unsigned int channels; // Number of channels (1-mono, 2-stereo, ...) unsigned int channels; // Number of channels (1-mono, 2-stereo, ...)
} AudioStream; } AudioStream;

View file

@ -171,8 +171,33 @@
// Some Basic Colors // Some Basic Colors
// NOTE: Custom raylib color palette for amazing visuals on WHITE background // NOTE: Custom raylib color palette for amazing visuals on WHITE background
#define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray
#define GRAY CLITERAL(Color){ 130, 130, 130, 255 } // Gray
#define DARKGRAY CLITERAL(Color){ 80, 80, 80, 255 } // Dark Gray
#define YELLOW CLITERAL(Color){ 253, 249, 0, 255 } // Yellow
#define GOLD CLITERAL(Color){ 255, 203, 0, 255 } // Gold
#define ORANGE CLITERAL(Color){ 255, 161, 0, 255 } // Orange
#define PINK CLITERAL(Color){ 255, 109, 194, 255 } // Pink
#define RED CLITERAL(Color){ 230, 41, 55, 255 } // Red
#define MAROON CLITERAL(Color){ 190, 33, 55, 255 } // Maroon
#define GREEN CLITERAL(Color){ 0, 228, 48, 255 } // Green
#define LIME CLITERAL(Color){ 0, 158, 47, 255 } // Lime
#define DARKGREEN CLITERAL(Color){ 0, 117, 44, 255 } // Dark Green
#define SKYBLUE CLITERAL(Color){ 102, 191, 255, 255 } // Sky Blue
#define BLUE CLITERAL(Color){ 0, 121, 241, 255 } // Blue
#define DARKBLUE CLITERAL(Color){ 0, 82, 172, 255 } // Dark Blue
#define PURPLE CLITERAL(Color){ 200, 122, 255, 255 } // Purple
#define VIOLET CLITERAL(Color){ 135, 60, 190, 255 } // Violet
#define DARKPURPLE CLITERAL(Color){ 112, 31, 126, 255 } // Dark Purple
#define BEIGE CLITERAL(Color){ 211, 176, 131, 255 } // Beige
#define BROWN CLITERAL(Color){ 127, 106, 79, 255 } // Brown
#define DARKBROWN CLITERAL(Color){ 76, 63, 47, 255 } // Dark Brown
#define WHITE CLITERAL(Color){ 255, 255, 255, 255 } // White
#define BLACK CLITERAL(Color){ 0, 0, 0, 255 } // Black
#define BLANK CLITERAL(Color){ 0, 0, 0, 0 } // Blank (Transparent)
#define MAGENTA CLITERAL(Color){ 255, 0, 255, 255 } // Magenta
#define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 } // My own White (raylib logo)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
@ -224,67 +249,6 @@ typedef struct Color {
unsigned char b; // Color blue value unsigned char b; // Color blue value
unsigned char a; // Color alpha value unsigned char a; // Color alpha value
} Color; } Color;
#ifdef __cplusplus
namespace rl {
inline const Color LIGHTGRAY = (Color){ 200, 200, 200, 255 } ;// Light Gray
inline const Color GRAY = (Color){ 130, 130, 130, 255 } ;// Gray
inline const Color DARKGRAY = (Color){ 80, 80, 80, 255 } ;// Dark Gray
inline const Color YELLOW = (Color){ 253, 249, 0, 255 } ;// Yellow
inline const Color GOLD = (Color){ 255, 203, 0, 255 } ;// Gold
inline const Color ORANGE = (Color){ 255, 161, 0, 255 } ;// Orange
inline const Color PINK = (Color){ 255, 109, 194, 255 } ;// Pink
inline const Color RED = (Color){ 230, 41, 55, 255 } ;// Red
inline const Color MAROON = (Color){ 190, 33, 55, 255 } ;// Maroon
inline const Color GREEN = (Color){ 0, 228, 48, 255 } ;// Green
inline const Color LIME = (Color){ 0, 158, 47, 255 } ;// Lime
inline const Color DARKGREEN = (Color){ 0, 117, 44, 255 } ;// Dark Green
inline const Color SKYBLUE = (Color){ 102, 191, 255, 255 } ;// Sky Blue
inline const Color BLUE = (Color){ 0, 121, 241, 255 } ;// Blue
inline const Color DARKBLUE = (Color){ 0, 82, 172, 255 } ;// Dark Blue
inline const Color PURPLE = (Color){ 200, 122, 255, 255 } ;// Purple
inline const Color VIOLET = (Color){ 135, 60, 190, 255 } ;// Violet
inline const Color DARKPURPLE= (Color){ 112, 31, 126, 255 } ;// Dark Purple
inline const Color BEIGE = (Color){ 211, 176, 131, 255 } ;// Beige
inline const Color BROWN = (Color){ 127, 106, 79, 255 } ;// Brown
inline const Color DARKBROWN = (Color){ 76, 63, 47, 255 } ;// Dark Brown
inline const Color WHITE = (Color){ 255, 255, 255, 255 } ;// White
inline const Color BLACK = (Color){ 0, 0, 0, 255 } ;// Black
inline const Color BLANK = (Color){ 0, 0, 0, 0 } ;// Blank (Transparent)
inline const Color MAGENTA = (Color){ 255, 0, 255, 255 } ;// Magenta
inline const Color RAYWHITE = (Color){ 245, 245, 245, 255 } ;// My own White (raylib logo)
}
#else
struct raycolor {
const Color LIGHTGRAY ;// Light Gray
const Color GRAY ;// Gray
const Color DARKGRAY ;// Dark Gray
const Color YELLOW ;// Yellow
const Color GOLD ;// Gold
const Color ORANGE ;// Orange
const Color PINK ;// Pink
const Color RED ;// Red
const Color MAROON ;// Maroon
const Color GREEN ;// Green
const Color LIME ;// Lime
const Color DARKGREEN ;// Dark Green
const Color SKYBLUE ;// Sky Blue
const Color BLUE ;// Blue
const Color DARKBLUE ;// Dark Blue
const Color PURPLE ;// Purple
const Color VIOLET ;// Violet
const Color DARKPURPLE;// Dark Purple
const Color BEIGE ;// Beige
const Color BROWN ;// Brown
const Color DARKBROWN ;// Dark Brown
const Color WHITE ;// White
const Color BLACK ;// Black
const Color BLANK ;// Blank (Transparent)
const Color MAGENTA ;// Magenta
const Color RAYWHITE ;// My own White (raylib logo)
};
extern struct raycolor rl;
#endif
// Rectangle, 4 components // Rectangle, 4 components
typedef struct Rectangle { typedef struct Rectangle {

View file

@ -104,36 +104,6 @@
#include "raylib.h" // Declares module functions #include "raylib.h" // Declares module functions
struct raycolor rl = {
.LIGHTGRAY = (Color){ 200, 200, 200, 255 }, // Light Gray
.GRAY = (Color){ 130, 130, 130, 255 }, // Gray
.DARKGRAY = (Color){ 80, 80, 80, 255 }, // Dark Gray
.YELLOW = (Color){ 253, 249, 0, 255 }, // Yellow
.GOLD = (Color){ 255, 203, 0, 255 }, // Gold
.ORANGE = (Color){ 255, 161, 0, 255 }, // Orange
.PINK = (Color){ 255, 109, 194, 255 }, // Pink
.RED = (Color){ 230, 41, 55, 255 }, // Red
.MAROON = (Color){ 190, 33, 55, 255 }, // Maroon
.GREEN = (Color){ 0, 228, 48, 255 }, // Green
.LIME = (Color){ 0, 158, 47, 255 }, // Lime
.DARKGREEN = (Color){ 0, 117, 44, 255 }, // Dark Green
.SKYBLUE = (Color){ 102, 191, 255, 255 }, // Sky Blue
.BLUE = (Color){ 0, 121, 241, 255 }, // Blue
.DARKBLUE = (Color){ 0, 82, 172, 255 }, // Dark Blue
.PURPLE = (Color){ 200, 122, 255, 255 }, // Purple
.VIOLET = (Color){ 135, 60, 190, 255 }, // Violet
.DARKPURPLE= (Color){ 112, 31, 126, 255 }, // Dark Purple
.BEIGE = (Color){ 211, 176, 131, 255 }, // Beige
.BROWN = (Color){ 127, 106, 79, 255 }, // Brown
.DARKBROWN = (Color){ 76, 63, 47, 255 }, // Dark Brown
.WHITE = (Color){ 255, 255, 255, 255 }, // White
.BLACK = (Color){ 0, 0, 0, 255 }, // Black
.BLANK = (Color){ 0, 0, 0, 0 }, // Blank (Transparent)
.MAGENTA = (Color){ 255, 0, 255, 255 }, // Magenta
.RAYWHITE = (Color){ 245, 245, 245, 255 } // My own White (raylib logo)
};
// Check if config flags have been externally provided on compilation line // Check if config flags have been externally provided on compilation line
#if !defined(EXTERNAL_CONFIG_FLAGS) #if !defined(EXTERNAL_CONFIG_FLAGS)
#include "config.h" // Defines module configuration flags #include "config.h" // Defines module configuration flags

View file

@ -1342,7 +1342,7 @@ void UploadMesh(Mesh *mesh, bool dynamic)
{ {
// Default vertex attribute: color // Default vertex attribute: color
// WARNING: Default value provided to shader if location available // WARNING: Default value provided to shader if location available
float value[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // rl.WHITE float value[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; // WHITE
rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR, value, SHADER_ATTRIB_VEC4, 4); rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR, value, SHADER_ATTRIB_VEC4, 4);
rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR); rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR);
} }
@ -2164,7 +2164,7 @@ static void ProcessMaterialsOBJ(Material *materials, tinyobj_material_t *mats, i
materials[m].maps[MATERIAL_MAP_SPECULAR].value = 0.0f; materials[m].maps[MATERIAL_MAP_SPECULAR].value = 0.0f;
if (mats[m].bump_texname != NULL) materials[m].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture(mats[m].bump_texname); //char *bump_texname; // map_bump, bump if (mats[m].bump_texname != NULL) materials[m].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture(mats[m].bump_texname); //char *bump_texname; // map_bump, bump
materials[m].maps[MATERIAL_MAP_NORMAL].color = rl.WHITE; materials[m].maps[MATERIAL_MAP_NORMAL].color = WHITE;
materials[m].maps[MATERIAL_MAP_NORMAL].value = mats[m].shininess; materials[m].maps[MATERIAL_MAP_NORMAL].value = mats[m].shininess;
materials[m].maps[MATERIAL_MAP_EMISSION].color = (Color){ (unsigned char)(mats[m].emission[0]*255.0f), (unsigned char)(mats[m].emission[1]*255.0f), (unsigned char)(mats[m].emission[2]*255.0f), 255 }; //float emission[3]; materials[m].maps[MATERIAL_MAP_EMISSION].color = (Color){ (unsigned char)(mats[m].emission[0]*255.0f), (unsigned char)(mats[m].emission[1]*255.0f), (unsigned char)(mats[m].emission[2]*255.0f), 255 }; //float emission[3];
@ -2218,8 +2218,8 @@ Material LoadMaterialDefault(void)
//material.maps[MATERIAL_MAP_NORMAL].texture; // NOTE: By default, not set //material.maps[MATERIAL_MAP_NORMAL].texture; // NOTE: By default, not set
//material.maps[MATERIAL_MAP_SPECULAR].texture; // NOTE: By default, not set //material.maps[MATERIAL_MAP_SPECULAR].texture; // NOTE: By default, not set
material.maps[MATERIAL_MAP_DIFFUSE].color = rl.WHITE; // Diffuse color material.maps[MATERIAL_MAP_DIFFUSE].color = WHITE; // Diffuse color
material.maps[MATERIAL_MAP_SPECULAR].color = rl.WHITE; // Specular color material.maps[MATERIAL_MAP_SPECULAR].color = WHITE; // Specular color
return material; return material;
} }
@ -3308,14 +3308,14 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
Vector3 v7 = { w*(x - 0.5f), 0, h*(z + 0.5f) }; Vector3 v7 = { w*(x - 0.5f), 0, h*(z + 0.5f) };
Vector3 v8 = { w*(x + 0.5f), 0, h*(z + 0.5f) }; Vector3 v8 = { w*(x + 0.5f), 0, h*(z + 0.5f) };
// We check pixel color to be rl.WHITE -> draw full cube // We check pixel color to be WHITE -> draw full cube
if (COLOR_EQUAL(pixels[z*cubicmap.width + x], rl.WHITE)) if (COLOR_EQUAL(pixels[z*cubicmap.width + x], WHITE))
{ {
// Define triangles and checking collateral cubes // Define triangles and checking collateral cubes
//------------------------------------------------ //------------------------------------------------
// Define top triangles (2 tris, 6 vertex --> v1-v2-v3, v1-v3-v4) // Define top triangles (2 tris, 6 vertex --> v1-v2-v3, v1-v3-v4)
// WARNING: Not required for a rl.WHITE cubes, created to allow seeing the map from outside // WARNING: Not required for a WHITE cubes, created to allow seeing the map from outside
mapVertices[vCounter] = v1; mapVertices[vCounter] = v1;
mapVertices[vCounter + 1] = v2; mapVertices[vCounter + 1] = v2;
mapVertices[vCounter + 2] = v3; mapVertices[vCounter + 2] = v3;
@ -3366,7 +3366,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
tcCounter += 6; tcCounter += 6;
// Checking cube on bottom of current cube // Checking cube on bottom of current cube
if (((z < cubicmap.height - 1) && COLOR_EQUAL(pixels[(z + 1)*cubicmap.width + x], rl.BLACK)) || (z == cubicmap.height - 1)) if (((z < cubicmap.height - 1) && COLOR_EQUAL(pixels[(z + 1)*cubicmap.width + x], BLACK)) || (z == cubicmap.height - 1))
{ {
// Define front triangles (2 tris, 6 vertex) --> v2 v7 v3, v3 v7 v8 // Define front triangles (2 tris, 6 vertex) --> v2 v7 v3, v3 v7 v8
// NOTE: Collateral occluded faces are not generated // NOTE: Collateral occluded faces are not generated
@ -3396,7 +3396,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
} }
// Checking cube on top of current cube // Checking cube on top of current cube
if (((z > 0) && COLOR_EQUAL(pixels[(z - 1)*cubicmap.width + x], rl.BLACK)) || (z == 0)) if (((z > 0) && COLOR_EQUAL(pixels[(z - 1)*cubicmap.width + x], BLACK)) || (z == 0))
{ {
// Define back triangles (2 tris, 6 vertex) --> v1 v5 v6, v1 v4 v5 // Define back triangles (2 tris, 6 vertex) --> v1 v5 v6, v1 v4 v5
// NOTE: Collateral occluded faces are not generated // NOTE: Collateral occluded faces are not generated
@ -3426,7 +3426,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
} }
// Checking cube on right of current cube // Checking cube on right of current cube
if (((x < cubicmap.width - 1) && COLOR_EQUAL(pixels[z*cubicmap.width + (x + 1)], rl.BLACK)) || (x == cubicmap.width - 1)) if (((x < cubicmap.width - 1) && COLOR_EQUAL(pixels[z*cubicmap.width + (x + 1)], BLACK)) || (x == cubicmap.width - 1))
{ {
// Define right triangles (2 tris, 6 vertex) --> v3 v8 v4, v4 v8 v5 // Define right triangles (2 tris, 6 vertex) --> v3 v8 v4, v4 v8 v5
// NOTE: Collateral occluded faces are not generated // NOTE: Collateral occluded faces are not generated
@ -3456,7 +3456,7 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
} }
// Checking cube on left of current cube // Checking cube on left of current cube
if (((x > 0) && COLOR_EQUAL(pixels[z*cubicmap.width + (x - 1)], rl.BLACK)) || (x == 0)) if (((x > 0) && COLOR_EQUAL(pixels[z*cubicmap.width + (x - 1)], BLACK)) || (x == 0))
{ {
// Define left triangles (2 tris, 6 vertex) --> v1 v7 v2, v1 v6 v7 // Define left triangles (2 tris, 6 vertex) --> v1 v7 v2, v1 v6 v7
// NOTE: Collateral occluded faces are not generated // NOTE: Collateral occluded faces are not generated
@ -3485,8 +3485,8 @@ Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize)
tcCounter += 6; tcCounter += 6;
} }
} }
// We check pixel color to be rl.BLACK, we will only draw floor and roof // We check pixel color to be BLACK, we will only draw floor and roof
else if (COLOR_EQUAL(pixels[z*cubicmap.width + x], rl.BLACK)) else if (COLOR_EQUAL(pixels[z*cubicmap.width + x], BLACK))
{ {
// Define top triangles (2 tris, 6 vertex --> v1-v2-v3, v1-v3-v4) // Define top triangles (2 tris, 6 vertex --> v1-v2-v3, v1-v3-v4)
mapVertices[vCounter] = v1; mapVertices[vCounter] = v1;
@ -3818,7 +3818,7 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota
{ {
Color color = model.materials[model.meshMaterial[i]].maps[MATERIAL_MAP_DIFFUSE].color; Color color = model.materials[model.meshMaterial[i]].maps[MATERIAL_MAP_DIFFUSE].color;
Color colorTint = rl.WHITE; Color colorTint = WHITE;
colorTint.r = (unsigned char)(((int)color.r*(int)tint.r)/255); colorTint.r = (unsigned char)(((int)color.r*(int)tint.r)/255);
colorTint.g = (unsigned char)(((int)color.g*(int)tint.g)/255); colorTint.g = (unsigned char)(((int)color.g*(int)tint.g)/255);
colorTint.b = (unsigned char)(((int)color.b*(int)tint.b)/255); colorTint.b = (unsigned char)(((int)color.b*(int)tint.b)/255);
@ -6912,7 +6912,7 @@ static Model LoadM3D(const char *fileName)
} break; } break;
case m3dp_Ps: case m3dp_Ps:
{ {
model.materials[i + 1].maps[MATERIAL_MAP_NORMAL].color = rl.WHITE; model.materials[i + 1].maps[MATERIAL_MAP_NORMAL].color = WHITE;
model.materials[i + 1].maps[MATERIAL_MAP_NORMAL].value = prop->value.fnum; model.materials[i + 1].maps[MATERIAL_MAP_NORMAL].value = prop->value.fnum;
} break; } break;
default: default:

View file

@ -379,7 +379,7 @@ Font LoadFont(const char *fileName)
#endif #endif
{ {
Image image = LoadImage(fileName); Image image = LoadImage(fileName);
if (image.data != NULL) font = LoadFontFromImage(image, rl.MAGENTA, FONT_TTF_DEFAULT_FIRST_CHAR); if (image.data != NULL) font = LoadFontFromImage(image, MAGENTA, FONT_TTF_DEFAULT_FIRST_CHAR);
else font = GetFontDefault(); else font = GetFontDefault();
UnloadImage(image); UnloadImage(image);
} }
@ -497,7 +497,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
// NOTE: We need to remove key color borders from image to avoid weird // NOTE: We need to remove key color borders from image to avoid weird
// artifacts on texture scaling when using TEXTURE_FILTER_BILINEAR or TEXTURE_FILTER_TRILINEAR // artifacts on texture scaling when using TEXTURE_FILTER_BILINEAR or TEXTURE_FILTER_TRILINEAR
for (int i = 0; i < image.height*image.width; i++) if (COLOR_EQUAL(pixels[i], key)) pixels[i] = rl.BLANK; for (int i = 0; i < image.height*image.width; i++) if (COLOR_EQUAL(pixels[i], key)) pixels[i] = BLANK;
// Create a new image with the processed color data (key color replaced by BLANK) // Create a new image with the processed color data (key color replaced by BLANK)
Image fontClear = { Image fontClear = {
@ -1169,11 +1169,11 @@ bool ExportFontAsCode(Font font, const char *fileName)
// NOTE: Uses default font // NOTE: Uses default font
void DrawFPS(int posX, int posY) void DrawFPS(int posX, int posY)
{ {
Color color = rl.LIME; // Good FPS Color color = LIME; // Good FPS
int fps = GetFPS(); int fps = GetFPS();
if ((fps < 30) && (fps >= 15)) color = rl.ORANGE; // Warning FPS if ((fps < 30) && (fps >= 15)) color = ORANGE; // Warning FPS
else if (fps < 15) color = rl.RED; // Low FPS else if (fps < 15) color = RED; // Low FPS
DrawText(TextFormat("%2i FPS", fps), posX, posY, 20, color); DrawText(TextFormat("%2i FPS", fps), posX, posY, 20, color);
} }
@ -2464,13 +2464,13 @@ static Font LoadBMFont(const char *fileName)
if (pageCount > 1) if (pageCount > 1)
{ {
// Resize font atlas to draw additional images // Resize font atlas to draw additional images
ImageResizeCanvas(&fullFont, imWidth, imHeight*pageCount, 0, 0, rl.BLACK); ImageResizeCanvas(&fullFont, imWidth, imHeight*pageCount, 0, 0, BLACK);
for (int i = 1; i < pageCount; i++) for (int i = 1; i < pageCount; i++)
{ {
Rectangle srcRec = { 0.0f, 0.0f, (float)imWidth, (float)imHeight }; Rectangle srcRec = { 0.0f, 0.0f, (float)imWidth, (float)imHeight };
Rectangle destRec = { 0.0f, (float)imHeight*(float)i, (float)imWidth, (float)imHeight }; Rectangle destRec = { 0.0f, (float)imHeight*(float)i, (float)imWidth, (float)imHeight };
ImageDraw(&fullFont, imFonts[i], srcRec, destRec, rl.WHITE); ImageDraw(&fullFont, imFonts[i], srcRec, destRec, WHITE);
} }
} }
@ -2518,7 +2518,7 @@ static Font LoadBMFont(const char *fileName)
} }
else else
{ {
font.glyphs[i].image = GenImageColor((int)font.recs[i].width, (int)font.recs[i].height, rl.BLACK); font.glyphs[i].image = GenImageColor((int)font.recs[i].width, (int)font.recs[i].height, BLACK);
TRACELOG(LOG_WARNING, "FONT: [%s] Some characters data not correctly provided", fileName); TRACELOG(LOG_WARNING, "FONT: [%s] Some characters data not correctly provided", fileName);
} }
} }

View file

@ -989,8 +989,8 @@ Image GenImageWhiteNoise(int width, int height, float factor)
for (int i = 0; i < width*height; i++) for (int i = 0; i < width*height; i++)
{ {
if (GetRandomValue(0, 99) < (int)(factor*100.0f)) pixels[i] = rl.WHITE; if (GetRandomValue(0, 99) < (int)(factor*100.0f)) pixels[i] = WHITE;
else pixels[i] = rl.BLACK; else pixels[i] = BLACK;
} }
Image image = { Image image = {
@ -1474,7 +1474,7 @@ Image ImageText(const char *text, int fontSize, Color color)
int spacing = fontSize/defaultFontSize; int spacing = fontSize/defaultFontSize;
imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); // WARNING: Module required: rtext imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); // WARNING: Module required: rtext
#else #else
imText = GenImageColor(200, 60, rl.BLACK); // Generating placeholder black image rectangle imText = GenImageColor(200, 60, BLACK); // Generating placeholder black image rectangle
TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext"); TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext");
#endif #endif
return imText; return imText;
@ -1497,7 +1497,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
Vector2 textSize = MeasureTextEx(font, text, fontSize, spacing); Vector2 textSize = MeasureTextEx(font, text, fontSize, spacing);
// Create image to store text // Create image to store text
imText = GenImageColor((int)imSize.x, (int)imSize.y, rl.BLANK); imText = GenImageColor((int)imSize.x, (int)imSize.y, BLANK);
for (int i = 0; i < textLength;) for (int i = 0; i < textLength;)
{ {
@ -1540,7 +1540,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
else ImageResize(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor)); else ImageResize(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor));
} }
#else #else
imText = GenImageColor(200, 60, rl.BLACK); // Generating placeholder black image rectangle imText = GenImageColor(200, 60, BLACK); // Generating placeholder black image rectangle
TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext"); TRACELOG(LOG_WARNING, "IMAGE: ImageTextEx() requires module: rtext");
#endif #endif
return imText; return imText;
@ -2486,8 +2486,8 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
// NOTE: We will store the dithered data as unsigned short (16bpp) // NOTE: We will store the dithered data as unsigned short (16bpp)
image->data = (unsigned short *)RL_MALLOC(image->width*image->height*sizeof(unsigned short)); image->data = (unsigned short *)RL_MALLOC(image->width*image->height*sizeof(unsigned short));
Color oldPixel = rl.WHITE; Color oldPixel = WHITE;
Color newPixel = rl.WHITE; Color newPixel = WHITE;
int rError = 0; int rError = 0;
int gError = 0; int gError = 0;
@ -3114,7 +3114,7 @@ Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount)
{ {
palette = (Color *)RL_MALLOC(maxPaletteSize*sizeof(Color)); palette = (Color *)RL_MALLOC(maxPaletteSize*sizeof(Color));
for (int i = 0; i < maxPaletteSize; i++) palette[i] = rl.BLANK; // Set all colors to BLANK for (int i = 0; i < maxPaletteSize; i++) palette[i] = BLANK; // Set all colors to BLANK
for (int i = 0; i < image.width*image.height; i++) for (int i = 0; i < image.width*image.height; i++)
{ {
@ -4121,7 +4121,7 @@ void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position,
Rectangle srcRec = { 0.0f, 0.0f, (float)imText.width, (float)imText.height }; Rectangle srcRec = { 0.0f, 0.0f, (float)imText.width, (float)imText.height };
Rectangle dstRec = { position.x, position.y, (float)imText.width, (float)imText.height }; Rectangle dstRec = { position.x, position.y, (float)imText.width, (float)imText.height };
ImageDraw(dst, imText, srcRec, dstRec, rl.WHITE); ImageDraw(dst, imText, srcRec, dstRec, WHITE);
UnloadImage(imText); UnloadImage(imText);
} }
@ -4237,7 +4237,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
// Convert image data to 6 faces in a vertical column, that's the optimum layout for loading // Convert image data to 6 faces in a vertical column, that's the optimum layout for loading
// NOTE: Image formatting does not work with compressed textures // NOTE: Image formatting does not work with compressed textures
faces = GenImageColor(size, size*6, rl.MAGENTA); faces = GenImageColor(size, size*6, MAGENTA);
ImageFormat(&faces, image.format); ImageFormat(&faces, image.format);
Image mipmapped = ImageCopy(image); Image mipmapped = ImageCopy(image);
@ -4249,7 +4249,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
} }
#endif #endif
for (int i = 0; i < 6; i++) ImageDraw(&faces, mipmapped, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, rl.WHITE); for (int i = 0; i < 6; i++) ImageDraw(&faces, mipmapped, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE);
UnloadImage(mipmapped); UnloadImage(mipmapped);
} }
@ -5115,7 +5115,7 @@ Color ColorAlpha(Color color, float alpha)
// Get src alpha-blended into dst color with tint // Get src alpha-blended into dst color with tint
Color ColorAlphaBlend(Color dst, Color src, Color tint) Color ColorAlphaBlend(Color dst, Color src, Color tint)
{ {
Color out = rl.WHITE; Color out = WHITE;
// Apply color tint to source color // Apply color tint to source color
src.r = (unsigned char)(((unsigned int)src.r*((unsigned int)tint.r+1)) >> 8); src.r = (unsigned char)(((unsigned int)src.r*((unsigned int)tint.r+1)) >> 8);