REVIEWED: <name>Count for consistency

Following english rules, it should be singular name before Count.
This commit is contained in:
Ray 2021-09-01 23:09:30 +02:00
parent e8fa7ceb79
commit a0f8682905
6 changed files with 178 additions and 179 deletions

View file

@ -385,7 +385,7 @@ typedef struct CoreData {
Matrix screenScale; // Matrix to scale screen (framebuffer rendering) Matrix screenScale; // Matrix to scale screen (framebuffer rendering)
char **dropFilesPath; // Store dropped files paths as strings char **dropFilesPath; // Store dropped files paths as strings
int dropFilesCount; // Count dropped files strings int dropFileCount; // Count dropped files strings
} Window; } Window;
#if defined(PLATFORM_ANDROID) #if defined(PLATFORM_ANDROID)
@ -411,7 +411,7 @@ typedef struct CoreData {
int keyPressedQueue[MAX_KEY_PRESSED_QUEUE]; // Input keys queue int keyPressedQueue[MAX_KEY_PRESSED_QUEUE]; // Input keys queue
int keyPressedQueueCount; // Input keys queue count int keyPressedQueueCount; // Input keys queue count
int charPressedQueue[MAX_CHAR_PRESSED_QUEUE]; // Input characters queue int charPressedQueue[MAX_CHAR_PRESSED_QUEUE]; // Input characters queue (unicode)
int charPressedQueueCount; // Input characters queue count int charPressedQueueCount; // Input characters queue count
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM) #if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
@ -481,14 +481,14 @@ typedef struct CoreData {
static CoreData CORE = { 0 }; // Global CORE state context static CoreData CORE = { 0 }; // Global CORE state context
static char **dirFilesPath = NULL; // Store directory files paths as strings static char **dirFilesPath = NULL; // Store directory files paths as strings
static int dirFilesCount = 0; // Count directory files strings static int dirFileCount = 0; // Count directory files strings
#if defined(SUPPORT_SCREEN_CAPTURE) #if defined(SUPPORT_SCREEN_CAPTURE)
static int screenshotCounter = 0; // Screenshots counter static int screenshotCounter = 0; // Screenshots counter
#endif #endif
#if defined(SUPPORT_GIF_RECORDING) #if defined(SUPPORT_GIF_RECORDING)
static int gifFramesCounter = 0; // GIF frames counter static int gifFrameCounter = 0; // GIF frames counter
static bool gifRecording = false; // GIF recording state static bool gifRecording = false; // GIF recording state
static MsfGifState gifState = { 0 }; // MSGIF context state static MsfGifState gifState = { 0 }; // MSGIF context state
#endif #endif
@ -1926,10 +1926,10 @@ void EndDrawing(void)
if (gifRecording) if (gifRecording)
{ {
#define GIF_RECORD_FRAMERATE 10 #define GIF_RECORD_FRAMERATE 10
gifFramesCounter++; gifFrameCounter++;
// NOTE: We record one gif frame every 10 game frames // NOTE: We record one gif frame every 10 game frames
if ((gifFramesCounter%GIF_RECORD_FRAMERATE) == 0) if ((gifFrameCounter%GIF_RECORD_FRAMERATE) == 0)
{ {
// Get image data for the current frame (from backbuffer) // Get image data for the current frame (from backbuffer)
// NOTE: This process is quite slow... :( // NOTE: This process is quite slow... :(
@ -1939,7 +1939,7 @@ void EndDrawing(void)
RL_FREE(screenData); // Free image data RL_FREE(screenData); // Free image data
} }
if (((gifFramesCounter/15)%2) == 1) if (((gifFrameCounter/15)%2) == 1)
{ {
DrawCircle(30, CORE.Window.screen.height - 20, 10, MAROON); DrawCircle(30, CORE.Window.screen.height - 20, 10, MAROON);
DrawText("GIF RECORDING", 50, CORE.Window.screen.height - 25, 10, RED); DrawText("GIF RECORDING", 50, CORE.Window.screen.height - 25, 10, RED);
@ -1953,9 +1953,9 @@ void EndDrawing(void)
// Draw record/play indicator // Draw record/play indicator
if (eventsRecording) if (eventsRecording)
{ {
gifFramesCounter++; gifFrameCounter++;
if (((gifFramesCounter/15)%2) == 1) if (((gifFrameCounter/15)%2) == 1)
{ {
DrawCircle(30, CORE.Window.screen.height - 20, 10, MAROON); DrawCircle(30, CORE.Window.screen.height - 20, 10, MAROON);
DrawText("EVENTS RECORDING", 50, CORE.Window.screen.height - 25, 10, RED); DrawText("EVENTS RECORDING", 50, CORE.Window.screen.height - 25, 10, RED);
@ -1965,9 +1965,9 @@ void EndDrawing(void)
} }
else if (eventsPlaying) else if (eventsPlaying)
{ {
gifFramesCounter++; gifFrameCounter++;
if (((gifFramesCounter/15)%2) == 1) if (((gifFrameCounter/15)%2) == 1)
{ {
DrawCircle(30, CORE.Window.screen.height - 20, 10, LIME); DrawCircle(30, CORE.Window.screen.height - 20, 10, LIME);
DrawText("EVENTS PLAYING", 50, CORE.Window.screen.height - 25, 10, GREEN); DrawText("EVENTS PLAYING", 50, CORE.Window.screen.height - 25, 10, GREEN);
@ -2895,8 +2895,8 @@ char **GetDirectoryFiles(const char *dirPath, int *fileCount)
} }
else TRACELOG(LOG_WARNING, "FILEIO: Failed to open requested directory"); // Maybe it's a file... else TRACELOG(LOG_WARNING, "FILEIO: Failed to open requested directory"); // Maybe it's a file...
dirFilesCount = counter; dirFileCount = counter;
*fileCount = dirFilesCount; *fileCount = dirFileCount;
return dirFilesPath; return dirFilesPath;
} }
@ -2904,14 +2904,14 @@ char **GetDirectoryFiles(const char *dirPath, int *fileCount)
// Clear directory files paths buffers // Clear directory files paths buffers
void ClearDirectoryFiles(void) void ClearDirectoryFiles(void)
{ {
if (dirFilesCount > 0) if (dirFileCount > 0)
{ {
for (int i = 0; i < MAX_DIRECTORY_FILES; i++) RL_FREE(dirFilesPath[i]); for (int i = 0; i < MAX_DIRECTORY_FILES; i++) RL_FREE(dirFilesPath[i]);
RL_FREE(dirFilesPath); RL_FREE(dirFilesPath);
} }
dirFilesCount = 0; dirFileCount = 0;
} }
// Change working directory, returns true on success // Change working directory, returns true on success
@ -2927,27 +2927,27 @@ bool ChangeDirectory(const char *dir)
// Check if a file has been dropped into window // Check if a file has been dropped into window
bool IsFileDropped(void) bool IsFileDropped(void)
{ {
if (CORE.Window.dropFilesCount > 0) return true; if (CORE.Window.dropFileCount > 0) return true;
else return false; else return false;
} }
// Get dropped files names // Get dropped files names
char **GetDroppedFiles(int *count) char **GetDroppedFiles(int *count)
{ {
*count = CORE.Window.dropFilesCount; *count = CORE.Window.dropFileCount;
return CORE.Window.dropFilesPath; return CORE.Window.dropFilesPath;
} }
// Clear dropped files paths buffer // Clear dropped files paths buffer
void ClearDroppedFiles(void) void ClearDroppedFiles(void)
{ {
if (CORE.Window.dropFilesCount > 0) if (CORE.Window.dropFileCount > 0)
{ {
for (int i = 0; i < CORE.Window.dropFilesCount; i++) RL_FREE(CORE.Window.dropFilesPath[i]); for (int i = 0; i < CORE.Window.dropFileCount; i++) RL_FREE(CORE.Window.dropFilesPath[i]);
RL_FREE(CORE.Window.dropFilesPath); RL_FREE(CORE.Window.dropFilesPath);
CORE.Window.dropFilesCount = 0; CORE.Window.dropFileCount = 0;
} }
} }
@ -4922,7 +4922,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
else else
{ {
gifRecording = true; gifRecording = true;
gifFramesCounter = 0; gifFrameCounter = 0;
msf_gif_begin(&gifState, CORE.Window.screen.width, CORE.Window.screen.height); msf_gif_begin(&gifState, CORE.Window.screen.width, CORE.Window.screen.height);
screenshotCounter++; screenshotCounter++;
@ -5085,7 +5085,7 @@ static void WindowDropCallback(GLFWwindow *window, int count, const char **paths
strcpy(CORE.Window.dropFilesPath[i], paths[i]); strcpy(CORE.Window.dropFilesPath[i], paths[i]);
} }
CORE.Window.dropFilesCount = count; CORE.Window.dropFileCount = count;
} }
#endif #endif
@ -5145,7 +5145,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
/* /*
if (assetsReloadRequired) if (assetsReloadRequired)
{ {
for (int i = 0; i < assetsCount; i++) for (int i = 0; i < assetCount; i++)
{ {
// TODO: Unload old asset if required // TODO: Unload old asset if required

View file

@ -201,16 +201,16 @@ void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color)
} }
// Draw a triangle strip defined by points // Draw a triangle strip defined by points
void DrawTriangleStrip3D(Vector3 *points, int pointsCount, Color color) void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color)
{ {
if (pointsCount >= 3) if (pointCount >= 3)
{ {
rlCheckRenderBatchLimit(3*(pointsCount - 2)); rlCheckRenderBatchLimit(3*(pointCount - 2));
rlBegin(RL_TRIANGLES); rlBegin(RL_TRIANGLES);
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);
for (int i = 2; i < pointsCount; i++) for (int i = 2; i < pointCount; i++)
{ {
if ((i%2) == 0) if ((i%2) == 0)
{ {
@ -1144,14 +1144,14 @@ void DrawMesh(Mesh mesh, Material material, Matrix transform)
if (mesh.indices != NULL) rlEnableVertexBufferElement(mesh.vboId[6]); if (mesh.indices != NULL) rlEnableVertexBufferElement(mesh.vboId[6]);
} }
int eyesCount = 1; int eyeCount = 1;
if (rlIsStereoRenderEnabled()) eyesCount = 2; if (rlIsStereoRenderEnabled()) eyeCount = 2;
for (int eye = 0; eye < eyesCount; eye++) for (int eye = 0; eye < eyeCount; eye++)
{ {
// Calculate model-view-projection matrix (MVP) // Calculate model-view-projection matrix (MVP)
Matrix matModelViewProjection = MatrixIdentity(); Matrix matModelViewProjection = MatrixIdentity();
if (eyesCount == 1) matModelViewProjection = MatrixMultiply(matModelView, matProjection); if (eyeCount == 1) matModelViewProjection = MatrixMultiply(matModelView, matProjection);
else else
{ {
// Setup current eye viewport (half screen width) // Setup current eye viewport (half screen width)
@ -1359,14 +1359,14 @@ void DrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int ins
if (mesh.indices != NULL) rlEnableVertexBufferElement(mesh.vboId[6]); if (mesh.indices != NULL) rlEnableVertexBufferElement(mesh.vboId[6]);
} }
int eyesCount = 1; int eyeCount = 1;
if (rlIsStereoRenderEnabled()) eyesCount = 2; if (rlIsStereoRenderEnabled()) eyeCount = 2;
for (int eye = 0; eye < eyesCount; eye++) for (int eye = 0; eye < eyeCount; eye++)
{ {
// Calculate model-view-projection matrix (MVP) // Calculate model-view-projection matrix (MVP)
Matrix matModelViewProjection = MatrixIdentity(); Matrix matModelViewProjection = MatrixIdentity();
if (eyesCount == 1) matModelViewProjection = MatrixMultiply(matModelView, matProjection); if (eyeCount == 1) matModelViewProjection = MatrixMultiply(matModelView, matProjection);
else else
{ {
// Setup current eye viewport (half screen width) // Setup current eye viewport (half screen width)
@ -1448,43 +1448,43 @@ bool ExportMesh(Mesh mesh, const char *fileName)
// NOTE: Text data buffer size is estimated considering mesh data size // NOTE: Text data buffer size is estimated considering mesh data size
char *txtData = (char *)RL_CALLOC(dataSize + 2000, sizeof(char)); char *txtData = (char *)RL_CALLOC(dataSize + 2000, sizeof(char));
int bytesCount = 0; int byteCount = 0;
bytesCount += sprintf(txtData + bytesCount, "# //////////////////////////////////////////////////////////////////////////////////\n"); byteCount += sprintf(txtData + byteCount, "# //////////////////////////////////////////////////////////////////////////////////\n");
bytesCount += sprintf(txtData + bytesCount, "# // //\n"); byteCount += sprintf(txtData + byteCount, "# // //\n");
bytesCount += sprintf(txtData + bytesCount, "# // rMeshOBJ exporter v1.0 - Mesh exported as triangle faces and not optimized //\n"); byteCount += sprintf(txtData + byteCount, "# // rMeshOBJ exporter v1.0 - Mesh exported as triangle faces and not optimized //\n");
bytesCount += sprintf(txtData + bytesCount, "# // //\n"); byteCount += sprintf(txtData + byteCount, "# // //\n");
bytesCount += sprintf(txtData + bytesCount, "# // more info and bugs-report: github.com/raysan5/raylib //\n"); byteCount += sprintf(txtData + byteCount, "# // more info and bugs-report: github.com/raysan5/raylib //\n");
bytesCount += sprintf(txtData + bytesCount, "# // feedback and support: ray[at]raylib.com //\n"); byteCount += sprintf(txtData + byteCount, "# // feedback and support: ray[at]raylib.com //\n");
bytesCount += sprintf(txtData + bytesCount, "# // //\n"); byteCount += sprintf(txtData + byteCount, "# // //\n");
bytesCount += sprintf(txtData + bytesCount, "# // Copyright (c) 2018 Ramon Santamaria (@raysan5) //\n"); byteCount += sprintf(txtData + byteCount, "# // Copyright (c) 2018 Ramon Santamaria (@raysan5) //\n");
bytesCount += sprintf(txtData + bytesCount, "# // //\n"); byteCount += sprintf(txtData + byteCount, "# // //\n");
bytesCount += sprintf(txtData + bytesCount, "# //////////////////////////////////////////////////////////////////////////////////\n\n"); byteCount += sprintf(txtData + byteCount, "# //////////////////////////////////////////////////////////////////////////////////\n\n");
bytesCount += sprintf(txtData + bytesCount, "# Vertex Count: %i\n", mesh.vertexCount); byteCount += sprintf(txtData + byteCount, "# Vertex Count: %i\n", mesh.vertexCount);
bytesCount += sprintf(txtData + bytesCount, "# Triangle Count: %i\n\n", mesh.triangleCount); byteCount += sprintf(txtData + byteCount, "# Triangle Count: %i\n\n", mesh.triangleCount);
bytesCount += sprintf(txtData + bytesCount, "g mesh\n"); byteCount += sprintf(txtData + byteCount, "g mesh\n");
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 3) for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 3)
{ {
bytesCount += sprintf(txtData + bytesCount, "v %.2f %.2f %.2f\n", mesh.vertices[v], mesh.vertices[v + 1], mesh.vertices[v + 2]); byteCount += sprintf(txtData + byteCount, "v %.2f %.2f %.2f\n", mesh.vertices[v], mesh.vertices[v + 1], mesh.vertices[v + 2]);
} }
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 2) for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 2)
{ {
bytesCount += sprintf(txtData + bytesCount, "vt %.3f %.3f\n", mesh.texcoords[v], mesh.texcoords[v + 1]); byteCount += sprintf(txtData + byteCount, "vt %.3f %.3f\n", mesh.texcoords[v], mesh.texcoords[v + 1]);
} }
for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 3) for (int i = 0, v = 0; i < mesh.vertexCount; i++, v += 3)
{ {
bytesCount += sprintf(txtData + bytesCount, "vn %.3f %.3f %.3f\n", mesh.normals[v], mesh.normals[v + 1], mesh.normals[v + 2]); byteCount += sprintf(txtData + byteCount, "vn %.3f %.3f %.3f\n", mesh.normals[v], mesh.normals[v + 1], mesh.normals[v + 2]);
} }
for (int i = 0; i < mesh.triangleCount; i += 3) for (int i = 0; i < mesh.triangleCount; i += 3)
{ {
bytesCount += sprintf(txtData + bytesCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", i, i, i, i + 1, i + 1, i + 1, i + 2, i + 2, i + 2); byteCount += sprintf(txtData + byteCount, "f %i/%i/%i %i/%i/%i %i/%i/%i\n", i, i, i, i + 1, i + 1, i + 1, i + 2, i + 2, i + 2);
} }
bytesCount += sprintf(txtData + bytesCount, "\n"); byteCount += sprintf(txtData + byteCount, "\n");
// NOTE: Text data length exported is determined by '\0' (NULL) character // NOTE: Text data length exported is determined by '\0' (NULL) character
success = SaveFileText(fileName, txtData); success = SaveFileText(fileName, txtData);
@ -3547,7 +3547,8 @@ static Model LoadOBJ(const char *fileName)
// Count the faces for each material // Count the faces for each material
int *matFaces = RL_CALLOC(materialCount, sizeof(int)); int *matFaces = RL_CALLOC(materialCount, sizeof(int));
for(int fi = 0; fi< attrib.num_faces; fi++){ for (int fi = 0; fi< attrib.num_faces; fi++)
{
tinyobj_vertex_index_t face = attrib.faces[fi]; tinyobj_vertex_index_t face = attrib.faces[fi];
int idx = attrib.material_ids[fi]; int idx = attrib.material_ids[fi];
matFaces[idx]++; matFaces[idx]++;
@ -4858,14 +4859,14 @@ static Model LoadGLTF(const char *fileName)
if (data->scenes_count > 1) TRACELOG(LOG_INFO, "MODEL: [%s] Has multiple scenes but only the first one will be loaded", fileName); if (data->scenes_count > 1) TRACELOG(LOG_INFO, "MODEL: [%s] Has multiple scenes but only the first one will be loaded", fileName);
int primitivesCount = 0; int primitiveCount = 0;
for (unsigned int i = 0; i < data->scene->nodes_count; i++) for (unsigned int i = 0; i < data->scene->nodes_count; i++)
{ {
GetGLTFPrimitiveCount(data->scene->nodes[i], &primitivesCount); GetGLTFPrimitiveCount(data->scene->nodes[i], &primitiveCount);
} }
// Process glTF data and map to model // Process glTF data and map to model
model.meshCount = primitivesCount; model.meshCount = primitiveCount;
model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh)); model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh));
model.materialCount = (int)data->materials_count + 1; model.materialCount = (int)data->materials_count + 1;
model.materials = RL_MALLOC(model.materialCount*sizeof(Material)); model.materials = RL_MALLOC(model.materialCount*sizeof(Material));

View file

@ -877,14 +877,14 @@ void UnloadSound(Sound sound)
} }
// Update sound buffer with new data // Update sound buffer with new data
void UpdateSound(Sound sound, const void *data, int samplesCount) void UpdateSound(Sound sound, const void *data, int sampleCount)
{ {
if (sound.stream.buffer != NULL) if (sound.stream.buffer != NULL)
{ {
StopAudioBuffer(sound.stream.buffer); StopAudioBuffer(sound.stream.buffer);
// TODO: May want to lock/unlock this since this data buffer is read at mixing time // TODO: May want to lock/unlock this since this data buffer is read at mixing time
memcpy(sound.stream.buffer->data, data, samplesCount*ma_get_bytes_per_frame(sound.stream.buffer->converter.config.formatIn, sound.stream.buffer->converter.config.channelsIn)); memcpy(sound.stream.buffer->data, data, sampleCount*ma_get_bytes_per_frame(sound.stream.buffer->converter.config.formatIn, sound.stream.buffer->converter.config.channelsIn));
} }
} }
@ -944,17 +944,17 @@ bool ExportWaveAsCode(Wave wave, const char *fileName)
// and requiring 6 char bytes for every byte: "0x00, " // and requiring 6 char bytes for every byte: "0x00, "
char *txtData = (char *)RL_CALLOC(waveDataSize*6 + 2000, sizeof(char)); char *txtData = (char *)RL_CALLOC(waveDataSize*6 + 2000, sizeof(char));
int bytesCount = 0; int byteCount = 0;
bytesCount += sprintf(txtData + bytesCount, "\n//////////////////////////////////////////////////////////////////////////////////\n"); byteCount += sprintf(txtData + byteCount, "\n//////////////////////////////////////////////////////////////////////////////////\n");
bytesCount += sprintf(txtData + bytesCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
bytesCount += sprintf(txtData + bytesCount, "// WaveAsCode exporter v1.0 - Wave data exported as an array of bytes //\n"); byteCount += sprintf(txtData + byteCount, "// WaveAsCode exporter v1.0 - Wave data exported as an array of bytes //\n");
bytesCount += sprintf(txtData + bytesCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
bytesCount += sprintf(txtData + bytesCount, "// more info and bugs-report: github.com/raysan5/raylib //\n"); byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
bytesCount += sprintf(txtData + bytesCount, "// feedback and support: ray[at]raylib.com //\n"); byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n");
bytesCount += sprintf(txtData + bytesCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
bytesCount += sprintf(txtData + bytesCount, "// Copyright (c) 2018-2021 Ramon Santamaria (@raysan5) //\n"); byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2021 Ramon Santamaria (@raysan5) //\n");
bytesCount += sprintf(txtData + bytesCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
bytesCount += sprintf(txtData + bytesCount, "//////////////////////////////////////////////////////////////////////////////////\n\n"); byteCount += sprintf(txtData + byteCount, "//////////////////////////////////////////////////////////////////////////////////\n\n");
char varFileName[256] = { 0 }; char varFileName[256] = { 0 };
#if !defined(RAUDIO_STANDALONE) #if !defined(RAUDIO_STANDALONE)
@ -965,18 +965,18 @@ bool ExportWaveAsCode(Wave wave, const char *fileName)
strcpy(varFileName, fileName); strcpy(varFileName, fileName);
#endif #endif
bytesCount += sprintf(txtData + bytesCount, "// Wave data information\n"); byteCount += sprintf(txtData + byteCount, "// Wave data information\n");
bytesCount += sprintf(txtData + bytesCount, "#define %s_FRAME_COUNT %u\n", varFileName, wave.frameCount); byteCount += sprintf(txtData + byteCount, "#define %s_FRAME_COUNT %u\n", varFileName, wave.frameCount);
bytesCount += sprintf(txtData + bytesCount, "#define %s_FRAME_COUNT %u\n", varFileName, wave.frameCount); byteCount += sprintf(txtData + byteCount, "#define %s_FRAME_COUNT %u\n", varFileName, wave.frameCount);
bytesCount += sprintf(txtData + bytesCount, "#define %s_SAMPLE_RATE %u\n", varFileName, wave.sampleRate); byteCount += sprintf(txtData + byteCount, "#define %s_SAMPLE_RATE %u\n", varFileName, wave.sampleRate);
bytesCount += sprintf(txtData + bytesCount, "#define %s_SAMPLE_SIZE %u\n", varFileName, wave.sampleSize); byteCount += sprintf(txtData + byteCount, "#define %s_SAMPLE_SIZE %u\n", varFileName, wave.sampleSize);
bytesCount += sprintf(txtData + bytesCount, "#define %s_CHANNELS %u\n\n", varFileName, wave.channels); byteCount += sprintf(txtData + byteCount, "#define %s_CHANNELS %u\n\n", varFileName, wave.channels);
// Write byte data as hexadecimal text // Write byte data as hexadecimal text
// NOTE: Frame data exported is interlaced: Frame01[Sample-Channel01, Sample-Channel02, ...], Frame02[], Frame03[] // NOTE: Frame data exported is interlaced: Frame01[Sample-Channel01, Sample-Channel02, ...], Frame02[], Frame03[]
bytesCount += sprintf(txtData + bytesCount, "static unsigned char %s_DATA[%i] = { ", varFileName, waveDataSize); byteCount += sprintf(txtData + byteCount, "static unsigned char %s_DATA[%i] = { ", varFileName, waveDataSize);
for (int i = 0; i < waveDataSize - 1; i++) bytesCount += sprintf(txtData + bytesCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), ((unsigned char *)wave.data)[i]); for (int i = 0; i < waveDataSize - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), ((unsigned char *)wave.data)[i]);
bytesCount += sprintf(txtData + bytesCount, "0x%x };\n", ((unsigned char *)wave.data)[waveDataSize - 1]); byteCount += sprintf(txtData + byteCount, "0x%x };\n", ((unsigned char *)wave.data)[waveDataSize - 1]);
// NOTE: Text data length exported is determined by '\0' (NULL) character // NOTE: Text data length exported is determined by '\0' (NULL) character
success = SaveFileText(fileName, txtData); success = SaveFileText(fileName, txtData);
@ -1505,9 +1505,7 @@ Music LoadMusicStreamFromMemory(const char *fileType, unsigned char *data, int d
// Copy data to allocated memory for default UnloadMusicStream // Copy data to allocated memory for default UnloadMusicStream
unsigned char *newData = (unsigned char *)RL_MALLOC(dataSize); unsigned char *newData = (unsigned char *)RL_MALLOC(dataSize);
int it = dataSize/sizeof(unsigned char); int it = dataSize/sizeof(unsigned char);
for (int i = 0; i < it; i++){ for (int i = 0; i < it; i++) newData[i] = data[i];
newData[i] = data[i];
}
// Memory loaded version for jar_mod_load_file() // Memory loaded version for jar_mod_load_file()
if (dataSize && dataSize < 32*1024*1024) if (dataSize && dataSize < 32*1024*1024)
@ -1716,7 +1714,7 @@ void UpdateMusicStream(Music music)
#if defined(SUPPORT_FILEFORMAT_XM) #if defined(SUPPORT_FILEFORMAT_XM)
case MUSIC_MODULE_XM: case MUSIC_MODULE_XM:
{ {
// NOTE: Internally we consider 2 channels generation, so samplesCount/2 // NOTE: Internally we consider 2 channels generation, so sampleCount/2
if (AUDIO_DEVICE_FORMAT == ma_format_f32) jar_xm_generate_samples((jar_xm_context_t *)music.ctxData, (float *)pcm, frameCountToStream); if (AUDIO_DEVICE_FORMAT == ma_format_f32) jar_xm_generate_samples((jar_xm_context_t *)music.ctxData, (float *)pcm, frameCountToStream);
else if (AUDIO_DEVICE_FORMAT == ma_format_s16) jar_xm_generate_samples_16bit((jar_xm_context_t *)music.ctxData, (short *)pcm, frameCountToStream); else if (AUDIO_DEVICE_FORMAT == ma_format_s16) jar_xm_generate_samples_16bit((jar_xm_context_t *)music.ctxData, (short *)pcm, frameCountToStream);
else if (AUDIO_DEVICE_FORMAT == ma_format_u8) jar_xm_generate_samples_8bit((jar_xm_context_t *)music.ctxData, (char *)pcm, frameCountToStream); else if (AUDIO_DEVICE_FORMAT == ma_format_u8) jar_xm_generate_samples_8bit((jar_xm_context_t *)music.ctxData, (char *)pcm, frameCountToStream);

View file

@ -279,7 +279,7 @@ typedef enum {
// Dynamic vertex buffers (position + texcoords + colors + indices arrays) // Dynamic vertex buffers (position + texcoords + colors + indices arrays)
typedef struct rlVertexBuffer { typedef struct rlVertexBuffer {
int elementsCount; // Number of elements in the buffer (QUADS) int elementCount; // Number of elements in the buffer (QUADS)
int vCounter; // Vertex position counter to process (and draw) from full buffer int vCounter; // Vertex position counter to process (and draw) from full buffer
int tcCounter; // Vertex texcoord counter to process (and draw) from full buffer int tcCounter; // Vertex texcoord counter to process (and draw) from full buffer
@ -316,12 +316,12 @@ typedef struct rlDrawCall {
// rlRenderBatch type // rlRenderBatch type
typedef struct rlRenderBatch { typedef struct rlRenderBatch {
int buffersCount; // Number of vertex buffers (multi-buffering support) int bufferCount; // Number of vertex buffers (multi-buffering support)
int currentBuffer; // Current buffer tracking in case of multi-buffering int currentBuffer; // Current buffer tracking in case of multi-buffering
rlVertexBuffer *vertexBuffer; // Dynamic buffer(s) for vertex data rlVertexBuffer *vertexBuffer; // Dynamic buffer(s) for vertex data
rlDrawCall *draws; // Draw calls array, depends on textureId rlDrawCall *draws; // Draw calls array, depends on textureId
int drawsCounter; // Draw calls counter int drawCounterer; // Draw calls counter
float currentDepth; // Current depth value for next draw float currentDepth; // Current depth value for next draw
} rlRenderBatch; } rlRenderBatch;
@ -1210,34 +1210,34 @@ void rlBegin(int mode)
{ {
// Draw mode can be RL_LINES, RL_TRIANGLES and RL_QUADS // Draw mode can be RL_LINES, RL_TRIANGLES and RL_QUADS
// NOTE: In all three cases, vertex are accumulated over default internal vertex buffer // NOTE: In all three cases, vertex are accumulated over default internal vertex buffer
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].mode != mode) if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].mode != mode)
{ {
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount > 0) if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount > 0)
{ {
// Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4, // Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4,
// that way, following QUADS drawing will keep aligned with index processing // that way, following QUADS drawing will keep aligned with index processing
// It implies adding some extra alignment vertex at the end of the draw, // It implies adding some extra alignment vertex at the end of the draw,
// those vertex are not processed but they are considered as an additional offset // those vertex are not processed but they are considered as an additional offset
// for the next set of vertex to be drawn // for the next set of vertex to be drawn
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount%4); if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount%4);
else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount%4))); else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount%4)));
else RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment = 0; else RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment = 0;
if (!rlCheckRenderBatchLimit(RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment)) if (!rlCheckRenderBatchLimit(RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment))
{ {
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment;
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].cCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].cCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment;
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].tcCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].tcCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment;
RLGL.currentBatch->drawsCounter++; RLGL.currentBatch->drawCounterer++;
} }
} }
if (RLGL.currentBatch->drawsCounter >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch); if (RLGL.currentBatch->drawCounterer >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch);
RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].mode = mode; RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].mode = mode;
RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount = 0; RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount = 0;
RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].textureId = RLGL.State.defaultTextureId; RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].textureId = RLGL.State.defaultTextureId;
} }
} }
@ -1285,7 +1285,7 @@ void rlEnd(void)
// Verify internal buffers limits // Verify internal buffers limits
// NOTE: This check is combined with usage of rlCheckRenderBatchLimit() // NOTE: This check is combined with usage of rlCheckRenderBatchLimit()
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter) >= if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter) >=
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4 - 4)) (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4 - 4))
{ {
// WARNING: If we are between rlPushMatrix() and rlPopMatrix() and we need to force a rlDrawRenderBatch(), // WARNING: If we are between rlPushMatrix() and rlPopMatrix() and we need to force a rlDrawRenderBatch(),
// we need to call rlPopMatrix() before to recover *RLGL.State.currentMatrix (RLGL.State.modelview) for the next forced draw call! // we need to call rlPopMatrix() before to recover *RLGL.State.currentMatrix (RLGL.State.modelview) for the next forced draw call!
@ -1312,14 +1312,14 @@ void rlVertex3f(float x, float y, float z)
} }
// Verify that current vertex buffer elements limit has not been reached // Verify that current vertex buffer elements limit has not been reached
if (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter < (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4)) if (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter < (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4))
{ {
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter] = tx; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter] = tx;
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + 1] = ty; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + 1] = ty;
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + 2] = tz; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vertices[3*RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + 2] = tz;
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter++; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter++;
RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount++; RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount++;
} }
else TRACELOG(RL_LOG_ERROR, "RLGL: Batch elements overflow"); else TRACELOG(RL_LOG_ERROR, "RLGL: Batch elements overflow");
} }
@ -1390,7 +1390,7 @@ void rlSetTexture(unsigned int id)
#else #else
// NOTE: If quads batch limit is reached, we force a draw call and next batch starts // NOTE: If quads batch limit is reached, we force a draw call and next batch starts
if (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter >= if (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter >=
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4) RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4)
{ {
rlDrawRenderBatch(RLGL.currentBatch); rlDrawRenderBatch(RLGL.currentBatch);
} }
@ -1401,33 +1401,33 @@ void rlSetTexture(unsigned int id)
#if defined(GRAPHICS_API_OPENGL_11) #if defined(GRAPHICS_API_OPENGL_11)
rlEnableTexture(id); rlEnableTexture(id);
#else #else
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].textureId != id) if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].textureId != id)
{ {
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount > 0) if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount > 0)
{ {
// Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4, // Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4,
// that way, following QUADS drawing will keep aligned with index processing // that way, following QUADS drawing will keep aligned with index processing
// It implies adding some extra alignment vertex at the end of the draw, // It implies adding some extra alignment vertex at the end of the draw,
// those vertex are not processed but they are considered as an additional offset // those vertex are not processed but they are considered as an additional offset
// for the next set of vertex to be drawn // for the next set of vertex to be drawn
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount%4); if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount%4);
else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount%4))); else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount%4)));
else RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment = 0; else RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment = 0;
if (!rlCheckRenderBatchLimit(RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment)) if (!rlCheckRenderBatchLimit(RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment))
{ {
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment;
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].cCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].cCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment;
RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].tcCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexAlignment; RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].tcCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexAlignment;
RLGL.currentBatch->drawsCounter++; RLGL.currentBatch->drawCounterer++;
} }
} }
if (RLGL.currentBatch->drawsCounter >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch); if (RLGL.currentBatch->drawCounterer >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch);
RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].textureId = id; RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].textureId = id;
RLGL.currentBatch->draws[RLGL.currentBatch->drawsCounter - 1].vertexCount = 0; RLGL.currentBatch->draws[RLGL.currentBatch->drawCounterer - 1].vertexCount = 0;
} }
#endif #endif
} }
@ -2169,7 +2169,7 @@ rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements)
for (int i = 0; i < numBuffers; i++) for (int i = 0; i < numBuffers; i++)
{ {
batch.vertexBuffer[i].elementsCount = bufferElements; batch.vertexBuffer[i].elementCount = bufferElements;
batch.vertexBuffer[i].vertices = (float *)RL_MALLOC(bufferElements*3*4*sizeof(float)); // 3 float by vertex, 4 vertex by quad batch.vertexBuffer[i].vertices = (float *)RL_MALLOC(bufferElements*3*4*sizeof(float)); // 3 float by vertex, 4 vertex by quad
batch.vertexBuffer[i].texcoords = (float *)RL_MALLOC(bufferElements*2*4*sizeof(float)); // 2 float by texcoord, 4 texcoord by quad batch.vertexBuffer[i].texcoords = (float *)RL_MALLOC(bufferElements*2*4*sizeof(float)); // 2 float by texcoord, 4 texcoord by quad
@ -2274,8 +2274,8 @@ rlRenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements)
//batch.draws[i].RLGL.State.modelview = rlMatrixIdentity(); //batch.draws[i].RLGL.State.modelview = rlMatrixIdentity();
} }
batch.buffersCount = numBuffers; // Record buffer count batch.bufferCount = numBuffers; // Record buffer count
batch.drawsCounter = 1; // Reset draws counter batch.drawCounterer = 1; // Reset draws counter
batch.currentDepth = -1.0f; // Reset depth value batch.currentDepth = -1.0f; // Reset depth value
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
#endif #endif
@ -2297,7 +2297,7 @@ void rlUnloadRenderBatch(rlRenderBatch batch)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
// Unload all vertex buffers data // Unload all vertex buffers data
for (int i = 0; i < batch.buffersCount; i++) for (int i = 0; i < batch.bufferCount; i++)
{ {
// Delete VBOs from GPU (VRAM) // Delete VBOs from GPU (VRAM)
glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[0]); glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[0]);
@ -2338,17 +2338,17 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
// Vertex positions buffer // Vertex positions buffer
glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[0]); glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[0]);
glBufferSubData(GL_ARRAY_BUFFER, 0, batch->vertexBuffer[batch->currentBuffer].vCounter*3*sizeof(float), batch->vertexBuffer[batch->currentBuffer].vertices); glBufferSubData(GL_ARRAY_BUFFER, 0, batch->vertexBuffer[batch->currentBuffer].vCounter*3*sizeof(float), batch->vertexBuffer[batch->currentBuffer].vertices);
//glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*4*batch->vertexBuffer[batch->currentBuffer].elementsCount, batch->vertexBuffer[batch->currentBuffer].vertices, GL_DYNAMIC_DRAW); // Update all buffer //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*3*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].vertices, GL_DYNAMIC_DRAW); // Update all buffer
// Texture coordinates buffer // Texture coordinates buffer
glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[1]); glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[1]);
glBufferSubData(GL_ARRAY_BUFFER, 0, batch->vertexBuffer[batch->currentBuffer].vCounter*2*sizeof(float), batch->vertexBuffer[batch->currentBuffer].texcoords); glBufferSubData(GL_ARRAY_BUFFER, 0, batch->vertexBuffer[batch->currentBuffer].vCounter*2*sizeof(float), batch->vertexBuffer[batch->currentBuffer].texcoords);
//glBufferData(GL_ARRAY_BUFFER, sizeof(float)*2*4*batch->vertexBuffer[batch->currentBuffer].elementsCount, batch->vertexBuffer[batch->currentBuffer].texcoords, GL_DYNAMIC_DRAW); // Update all buffer //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*2*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].texcoords, GL_DYNAMIC_DRAW); // Update all buffer
// Colors buffer // Colors buffer
glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[2]); glBindBuffer(GL_ARRAY_BUFFER, batch->vertexBuffer[batch->currentBuffer].vboId[2]);
glBufferSubData(GL_ARRAY_BUFFER, 0, batch->vertexBuffer[batch->currentBuffer].vCounter*4*sizeof(unsigned char), batch->vertexBuffer[batch->currentBuffer].colors); glBufferSubData(GL_ARRAY_BUFFER, 0, batch->vertexBuffer[batch->currentBuffer].vCounter*4*sizeof(unsigned char), batch->vertexBuffer[batch->currentBuffer].colors);
//glBufferData(GL_ARRAY_BUFFER, sizeof(float)*4*4*batch->vertexBuffer[batch->currentBuffer].elementsCount, batch->vertexBuffer[batch->currentBuffer].colors, GL_DYNAMIC_DRAW); // Update all buffer //glBufferData(GL_ARRAY_BUFFER, sizeof(float)*4*4*batch->vertexBuffer[batch->currentBuffer].elementCount, batch->vertexBuffer[batch->currentBuffer].colors, GL_DYNAMIC_DRAW); // Update all buffer
// NOTE: glMapBuffer() causes sync issue. // NOTE: glMapBuffer() causes sync issue.
// If GPU is working with this buffer, glMapBuffer() will wait(stall) until GPU to finish its job. // If GPU is working with this buffer, glMapBuffer() will wait(stall) until GPU to finish its job.
@ -2375,12 +2375,12 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
Matrix matProjection = RLGL.State.projection; Matrix matProjection = RLGL.State.projection;
Matrix matModelView = RLGL.State.modelview; Matrix matModelView = RLGL.State.modelview;
int eyesCount = 1; int eyeCount = 1;
if (RLGL.State.stereoRender) eyesCount = 2; if (RLGL.State.stereoRender) eyeCount = 2;
for (int eye = 0; eye < eyesCount; eye++) for (int eye = 0; eye < eyeCount; eye++)
{ {
if (eyesCount == 2) if (eyeCount == 2)
{ {
// Setup current eye viewport (half screen width) // Setup current eye viewport (half screen width)
rlViewport(eye*RLGL.State.framebufferWidth/2, 0, RLGL.State.framebufferWidth/2, RLGL.State.framebufferHeight); rlViewport(eye*RLGL.State.framebufferWidth/2, 0, RLGL.State.framebufferWidth/2, RLGL.State.framebufferHeight);
@ -2447,7 +2447,7 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
// NOTE: Batch system accumulates calls by texture0 changes, additional textures are enabled for all the draw calls // NOTE: Batch system accumulates calls by texture0 changes, additional textures are enabled for all the draw calls
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
for (int i = 0, vertexOffset = 0; i < batch->drawsCounter; i++) for (int i = 0, vertexOffset = 0; i < batch->drawCounterer; i++)
{ {
// Bind current draw call texture, activated as GL_TEXTURE0 and binded to sampler2D texture0 by default // Bind current draw call texture, activated as GL_TEXTURE0 and binded to sampler2D texture0 by default
glBindTexture(GL_TEXTURE_2D, batch->draws[i].textureId); glBindTexture(GL_TEXTURE_2D, batch->draws[i].textureId);
@ -2456,7 +2456,7 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
else else
{ {
#if defined(GRAPHICS_API_OPENGL_33) #if defined(GRAPHICS_API_OPENGL_33)
// We need to define the number of indices to be processed: quadsCount*6 // We need to define the number of indices to be processed: elementCount*6
// NOTE: The final parameter tells the GPU the offset in bytes from the // NOTE: The final parameter tells the GPU the offset in bytes from the
// start of the index buffer to the location of the first index to process // start of the index buffer to the location of the first index to process
glDrawElements(GL_TRIANGLES, batch->draws[i].vertexCount/4*6, GL_UNSIGNED_INT, (GLvoid *)(vertexOffset/4*6*sizeof(GLuint))); glDrawElements(GL_TRIANGLES, batch->draws[i].vertexCount/4*6, GL_UNSIGNED_INT, (GLvoid *)(vertexOffset/4*6*sizeof(GLuint)));
@ -2510,12 +2510,12 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) RLGL.State.activeTextureId[i] = 0; for (int i = 0; i < RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS; i++) RLGL.State.activeTextureId[i] = 0;
// Reset draws counter to one draw for the batch // Reset draws counter to one draw for the batch
batch->drawsCounter = 1; batch->drawCounterer = 1;
//------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------
// Change to next buffer in the list (in case of multi-buffering) // Change to next buffer in the list (in case of multi-buffering)
batch->currentBuffer++; batch->currentBuffer++;
if (batch->currentBuffer >= batch->buffersCount) batch->currentBuffer = 0; if (batch->currentBuffer >= batch->bufferCount) batch->currentBuffer = 0;
#endif #endif
} }
@ -2546,7 +2546,7 @@ bool rlCheckRenderBatchLimit(int vCount)
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + vCount) >= if ((RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].vCounter + vCount) >=
(RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementsCount*4)) (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4))
{ {
overflow = true; overflow = true;
rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside rlDrawRenderBatch(RLGL.currentBatch); // NOTE: Stereo rendering is checked inside

View file

@ -190,16 +190,16 @@ void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, fl
} }
// Draw lines sequence // Draw lines sequence
void DrawLineStrip(Vector2 *points, int pointsCount, Color color) void DrawLineStrip(Vector2 *points, int pointCount, Color color)
{ {
if (pointsCount >= 2) if (pointCount >= 2)
{ {
rlCheckRenderBatchLimit(pointsCount); rlCheckRenderBatchLimit(pointCount);
rlBegin(RL_LINES); rlBegin(RL_LINES);
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);
for (int i = 0; i < pointsCount - 1; i++) for (int i = 0; i < pointCount - 1; i++)
{ {
rlVertex2f(points[i].x, points[i].y); rlVertex2f(points[i].x, points[i].y);
rlVertex2f(points[i + 1].x, points[i + 1].y); rlVertex2f(points[i + 1].x, points[i + 1].y);
@ -1318,17 +1318,17 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color)
// Draw a triangle fan defined by points // Draw a triangle fan defined by points
// NOTE: First vertex provided is the center, shared by all triangles // NOTE: First vertex provided is the center, shared by all triangles
// By default, following vertex should be provided in counter-clockwise order // By default, following vertex should be provided in counter-clockwise order
void DrawTriangleFan(Vector2 *points, int pointsCount, Color color) void DrawTriangleFan(Vector2 *points, int pointCount, Color color)
{ {
if (pointsCount >= 3) if (pointCount >= 3)
{ {
rlCheckRenderBatchLimit((pointsCount - 2)*4); rlCheckRenderBatchLimit((pointCount - 2)*4);
rlSetTexture(texShapes.id); rlSetTexture(texShapes.id);
rlBegin(RL_QUADS); rlBegin(RL_QUADS);
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);
for (int i = 1; i < pointsCount - 1; i++) for (int i = 1; i < pointCount - 1; i++)
{ {
rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height);
rlVertex2f(points[0].x, points[0].y); rlVertex2f(points[0].x, points[0].y);
@ -1349,16 +1349,16 @@ void DrawTriangleFan(Vector2 *points, int pointsCount, Color color)
// Draw a triangle strip defined by points // Draw a triangle strip defined by points
// NOTE: Every new vertex connects with previous two // NOTE: Every new vertex connects with previous two
void DrawTriangleStrip(Vector2 *points, int pointsCount, Color color) void DrawTriangleStrip(Vector2 *points, int pointCount, Color color)
{ {
if (pointsCount >= 3) if (pointCount >= 3)
{ {
rlCheckRenderBatchLimit(3*(pointsCount - 2)); rlCheckRenderBatchLimit(3*(pointCount - 2));
rlBegin(RL_TRIANGLES); rlBegin(RL_TRIANGLES);
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);
for (int i = 2; i < pointsCount; i++) for (int i = 2; i < pointCount; i++)
{ {
if ((i%2) == 0) if ((i%2) == 0)
{ {

View file

@ -258,7 +258,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
Image LoadImageAnim(const char *fileName, int *frames) Image LoadImageAnim(const char *fileName, int *frames)
{ {
Image image = { 0 }; Image image = { 0 };
int framesCount = 1; int frameCount = 1;
#if defined(SUPPORT_FILEFORMAT_GIF) #if defined(SUPPORT_FILEFORMAT_GIF)
if (IsFileExtension(fileName, ".gif")) if (IsFileExtension(fileName, ".gif"))
@ -270,7 +270,7 @@ Image LoadImageAnim(const char *fileName, int *frames)
{ {
int comp = 0; int comp = 0;
int **delays = NULL; int **delays = NULL;
image.data = stbi_load_gif_from_memory(fileData, dataSize, delays, &image.width, &image.height, &framesCount, &comp, 4); image.data = stbi_load_gif_from_memory(fileData, dataSize, delays, &image.width, &image.height, &frameCount, &comp, 4);
image.mipmaps = 1; image.mipmaps = 1;
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8; image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
@ -286,7 +286,7 @@ Image LoadImageAnim(const char *fileName, int *frames)
// TODO: Support APNG animated images? // TODO: Support APNG animated images?
*frames = framesCount; *frames = frameCount;
return image; return image;
} }
@ -520,17 +520,17 @@ bool ExportImageAsCode(Image image, const char *fileName)
// and requiring 6 char bytes for every byte: "0x00, " // and requiring 6 char bytes for every byte: "0x00, "
char *txtData = (char *)RL_CALLOC(dataSize*6 + 2000, sizeof(char)); char *txtData = (char *)RL_CALLOC(dataSize*6 + 2000, sizeof(char));
int bytesCount = 0; int byteCount = 0;
bytesCount += sprintf(txtData + bytesCount, "////////////////////////////////////////////////////////////////////////////////////////\n"); byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n");
bytesCount += sprintf(txtData + bytesCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
bytesCount += sprintf(txtData + bytesCount, "// ImageAsCode exporter v1.0 - Image pixel data exported as an array of bytes //\n"); byteCount += sprintf(txtData + byteCount, "// ImageAsCode exporter v1.0 - Image pixel data exported as an array of bytes //\n");
bytesCount += sprintf(txtData + bytesCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
bytesCount += sprintf(txtData + bytesCount, "// more info and bugs-report: github.com/raysan5/raylib //\n"); byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
bytesCount += sprintf(txtData + bytesCount, "// feedback and support: ray[at]raylib.com //\n"); byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n");
bytesCount += sprintf(txtData + bytesCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
bytesCount += sprintf(txtData + bytesCount, "// Copyright (c) 2018-2021 Ramon Santamaria (@raysan5) //\n"); byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2021 Ramon Santamaria (@raysan5) //\n");
bytesCount += sprintf(txtData + bytesCount, "// //\n"); byteCount += sprintf(txtData + byteCount, "// //\n");
bytesCount += sprintf(txtData + bytesCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n"); byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n");
// Get file name from path and convert variable name to uppercase // Get file name from path and convert variable name to uppercase
char varFileName[256] = { 0 }; char varFileName[256] = { 0 };
@ -538,14 +538,14 @@ bool ExportImageAsCode(Image image, const char *fileName)
for (int i = 0; varFileName[i] != '\0'; i++) if ((varFileName[i] >= 'a') && (varFileName[i] <= 'z')) { varFileName[i] = varFileName[i] - 32; } for (int i = 0; varFileName[i] != '\0'; i++) if ((varFileName[i] >= 'a') && (varFileName[i] <= 'z')) { varFileName[i] = varFileName[i] - 32; }
// Add image information // Add image information
bytesCount += sprintf(txtData + bytesCount, "// Image data information\n"); byteCount += sprintf(txtData + byteCount, "// Image data information\n");
bytesCount += sprintf(txtData + bytesCount, "#define %s_WIDTH %i\n", varFileName, image.width); byteCount += sprintf(txtData + byteCount, "#define %s_WIDTH %i\n", varFileName, image.width);
bytesCount += sprintf(txtData + bytesCount, "#define %s_HEIGHT %i\n", varFileName, image.height); byteCount += sprintf(txtData + byteCount, "#define %s_HEIGHT %i\n", varFileName, image.height);
bytesCount += sprintf(txtData + bytesCount, "#define %s_FORMAT %i // raylib internal pixel format\n\n", varFileName, image.format); byteCount += sprintf(txtData + byteCount, "#define %s_FORMAT %i // raylib internal pixel format\n\n", varFileName, image.format);
bytesCount += sprintf(txtData + bytesCount, "static unsigned char %s_DATA[%i] = { ", varFileName, dataSize); byteCount += sprintf(txtData + byteCount, "static unsigned char %s_DATA[%i] = { ", varFileName, dataSize);
for (int i = 0; i < dataSize - 1; i++) bytesCount += sprintf(txtData + bytesCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), ((unsigned char *)image.data)[i]); for (int i = 0; i < dataSize - 1; i++) byteCount += sprintf(txtData + byteCount, ((i%TEXT_BYTES_PER_LINE == 0)? "0x%x,\n" : "0x%x, "), ((unsigned char *)image.data)[i]);
bytesCount += sprintf(txtData + bytesCount, "0x%x };\n", ((unsigned char *)image.data)[dataSize - 1]); byteCount += sprintf(txtData + byteCount, "0x%x };\n", ((unsigned char *)image.data)[dataSize - 1]);
// NOTE: Text data length exported is determined by '\0' (NULL) character // NOTE: Text data length exported is determined by '\0' (NULL) character
success = SaveFileText(fileName, txtData); success = SaveFileText(fileName, txtData);
@ -765,11 +765,11 @@ Image GenImageCellular(int width, int height, int tileSize)
int seedsPerRow = width/tileSize; int seedsPerRow = width/tileSize;
int seedsPerCol = height/tileSize; int seedsPerCol = height/tileSize;
int seedsCount = seedsPerRow*seedsPerCol; int seedCount = seedsPerRow*seedsPerCol;
Vector2 *seeds = (Vector2 *)RL_MALLOC(seedsCount*sizeof(Vector2)); Vector2 *seeds = (Vector2 *)RL_MALLOC(seedCount*sizeof(Vector2));
for (int i = 0; i < seedsCount; i++) for (int i = 0; i < seedCount; i++)
{ {
int y = (i/seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1); int y = (i/seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1);
int x = (i%seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1); int x = (i%seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1);
@ -1180,12 +1180,12 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
{ {
if ((codepoint != ' ') && (codepoint != '\t')) if ((codepoint != ' ') && (codepoint != '\t'))
{ {
Rectangle rec = { (float)(textOffsetX + font.chars[index].offsetX), (float)(textOffsetY + font.chars[index].offsetY), (float)font.recs[index].width, (float)font.recs[index].height }; Rectangle rec = { (float)(textOffsetX + font.glyphs[index].offsetX), (float)(textOffsetY + font.glyphs[index].offsetY), (float)font.recs[index].width, (float)font.recs[index].height };
ImageDraw(&imText, font.chars[index].image, (Rectangle){ 0, 0, (float)font.chars[index].image.width, (float)font.chars[index].image.height }, rec, tint); ImageDraw(&imText, font.glyphs[index].image, (Rectangle){ 0, 0, (float)font.glyphs[index].image.width, (float)font.glyphs[index].image.height }, rec, tint);
} }
if (font.chars[index].advanceX == 0) textOffsetX += (int)(font.recs[index].width + spacing); if (font.glyphs[index].advanceX == 0) textOffsetX += (int)(font.recs[index].width + spacing);
else textOffsetX += font.chars[index].advanceX + (int)spacing; else textOffsetX += font.glyphs[index].advanceX + (int)spacing;
} }
i += (codepointByteCount - 1); // Move text bytes counter to next codepoint i += (codepointByteCount - 1); // Move text bytes counter to next codepoint
@ -2185,7 +2185,7 @@ Color *LoadImageColors(Image image)
// Load colors palette from image as a Color array (RGBA - 32bit) // Load colors palette from image as a Color array (RGBA - 32bit)
// NOTE: Memory allocated should be freed using UnloadImagePalette() // NOTE: Memory allocated should be freed using UnloadImagePalette()
Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorsCount) Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorCount)
{ {
#define COLOR_EQUAL(col1, col2) ((col1.r == col2.r)&&(col1.g == col2.g)&&(col1.b == col2.b)&&(col1.a == col2.a)) #define COLOR_EQUAL(col1, col2) ((col1.r == col2.r)&&(col1.g == col2.g)&&(col1.b == col2.b)&&(col1.a == col2.a))
@ -2234,7 +2234,7 @@ Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorsCount)
UnloadImageColors(pixels); UnloadImageColors(pixels);
} }
*colorsCount = palCount; *colorCount = palCount;
return palette; return palette;
} }
@ -3487,9 +3487,9 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
// Draw textured polygon, defined by vertex and texturecoordinates // Draw textured polygon, defined by vertex and texturecoordinates
// NOTE: Polygon center must have straight line path to all points // NOTE: Polygon center must have straight line path to all points
// without crossing perimeter, points must be in anticlockwise order // without crossing perimeter, points must be in anticlockwise order
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointsCount, Color tint) void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint)
{ {
rlCheckRenderBatchLimit((pointsCount - 1)*4); rlCheckRenderBatchLimit((pointCount - 1)*4);
rlSetTexture(texture.id); rlSetTexture(texture.id);
@ -3498,7 +3498,7 @@ void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2
rlColor4ub(tint.r, tint.g, tint.b, tint.a); rlColor4ub(tint.r, tint.g, tint.b, tint.a);
for (int i = 0; i < pointsCount - 1; i++) for (int i = 0; i < pointCount - 1; i++)
{ {
rlTexCoord2f(0.5f, 0.5f); rlTexCoord2f(0.5f, 0.5f);
rlVertex2f(center.x, center.y); rlVertex2f(center.x, center.y);