Replace TraceLog() function by TRACELOG macro
Added SUPPORT_TRACELOG_DEBUG config
This commit is contained in:
parent
40b73a8a91
commit
cde26c743c
@ -143,9 +143,10 @@
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: utils - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Show TraceLog() output messages
|
||||
// Show TRACELOG() output messages
|
||||
// NOTE: By default LOG_DEBUG traces not shown
|
||||
#define SUPPORT_TRACELOG 1
|
||||
#define SUPPORT_TRACELOG 1
|
||||
//#define SUPPORT_TRACELOG_DEBUG 1
|
||||
|
||||
|
||||
#endif //defined(RAYLIB_CMAKE)
|
||||
|
178
src/core.c
178
src/core.c
@ -119,6 +119,8 @@
|
||||
#define RAYLIB_VERSION "3.0"
|
||||
#endif
|
||||
|
||||
#include "utils.h" // Required for: TRACELOG macros and fopen() Android mapping
|
||||
|
||||
#if (defined(__linux__) || defined(PLATFORM_WEB)) && _POSIX_C_SOURCE < 199309L
|
||||
#undef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext.
|
||||
@ -130,8 +132,6 @@
|
||||
#define RLGL_IMPLEMENTATION
|
||||
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
|
||||
|
||||
#include "utils.h" // Required for: fopen() Android mapping
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
#define GESTURES_IMPLEMENTATION
|
||||
#include "gestures.h" // Gestures detection functionality
|
||||
@ -559,7 +559,7 @@ struct android_app *GetAndroidApp(void)
|
||||
// Init terminal (block echo and signal short cuts)
|
||||
static void InitTerminal(void)
|
||||
{
|
||||
TraceLog(LOG_INFO, "Reconfigure Terminal ...");
|
||||
TRACELOG(LOG_INFO, "Reconfigure Terminal ...");
|
||||
// Save terminal keyboard settings and reconfigure terminal with new settings
|
||||
struct termios keyboardNewSettings;
|
||||
tcgetattr(STDIN_FILENO, &CORE.Input.Keyboard.defaultSettings); // Get current keyboard settings
|
||||
@ -578,7 +578,7 @@ static void InitTerminal(void)
|
||||
if (ioctl(STDIN_FILENO, KDGKBMODE, &CORE.Input.Keyboard.defaultMode) < 0)
|
||||
{
|
||||
// NOTE: It could mean we are using a remote keyboard through ssh or from the desktop
|
||||
TraceLog(LOG_WARNING, "Could not change keyboard mode (Not a local Terminal)");
|
||||
TRACELOG(LOG_WARNING, "Could not change keyboard mode (Not a local Terminal)");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -592,7 +592,7 @@ static void InitTerminal(void)
|
||||
// Restore terminal
|
||||
static void RestoreTerminal(void)
|
||||
{
|
||||
TraceLog(LOG_INFO, "Restore Terminal ...");
|
||||
TRACELOG(LOG_INFO, "Restore Terminal ...");
|
||||
|
||||
// Reset to default keyboard settings
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &CORE.Input.Keyboard.defaultSettings);
|
||||
@ -605,7 +605,7 @@ static void RestoreTerminal(void)
|
||||
// NOTE: data parameter could be used to pass any kind of required data to the initialization
|
||||
void InitWindow(int width, int height, const char *title)
|
||||
{
|
||||
TraceLog(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION);
|
||||
TRACELOG(LOG_INFO, "Initializing raylib %s", RAYLIB_VERSION);
|
||||
|
||||
CORE.Window.title = title;
|
||||
|
||||
@ -628,19 +628,19 @@ void InitWindow(int width, int height, const char *title)
|
||||
|
||||
int orientation = AConfiguration_getOrientation(CORE.Android.app->config);
|
||||
|
||||
if (orientation == ACONFIGURATION_ORIENTATION_PORT) TraceLog(LOG_INFO, "PORTRAIT window orientation");
|
||||
else if (orientation == ACONFIGURATION_ORIENTATION_LAND) TraceLog(LOG_INFO, "LANDSCAPE window orientation");
|
||||
if (orientation == ACONFIGURATION_ORIENTATION_PORT) TRACELOG(LOG_INFO, "PORTRAIT window orientation");
|
||||
else if (orientation == ACONFIGURATION_ORIENTATION_LAND) TRACELOG(LOG_INFO, "LANDSCAPE window orientation");
|
||||
|
||||
// TODO: Automatic orientation doesn't seem to work
|
||||
if (width <= height)
|
||||
{
|
||||
AConfiguration_setOrientation(CORE.Android.app->config, ACONFIGURATION_ORIENTATION_PORT);
|
||||
TraceLog(LOG_WARNING, "Window set to portraid mode");
|
||||
TRACELOG(LOG_WARNING, "Window set to portraid mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
AConfiguration_setOrientation(CORE.Android.app->config, ACONFIGURATION_ORIENTATION_LAND);
|
||||
TraceLog(LOG_WARNING, "Window set to landscape mode");
|
||||
TRACELOG(LOG_WARNING, "Window set to landscape mode");
|
||||
}
|
||||
|
||||
//AConfiguration_getDensity(CORE.Android.app->config);
|
||||
@ -653,7 +653,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
|
||||
InitAssetManager(CORE.Android.app->activity->assetManager);
|
||||
|
||||
TraceLog(LOG_INFO, "Android app initialized successfully");
|
||||
TRACELOG(LOG_INFO, "Android app initialized successfully");
|
||||
|
||||
// Android ALooper_pollAll() variables
|
||||
int pollResult = 0;
|
||||
@ -795,7 +795,7 @@ void CloseWindow(void)
|
||||
if (CORE.Input.Gamepad.threadId) pthread_join(CORE.Input.Gamepad.threadId, NULL);
|
||||
#endif
|
||||
|
||||
TraceLog(LOG_INFO, "Window closed successfully");
|
||||
TRACELOG(LOG_INFO, "Window closed successfully");
|
||||
}
|
||||
|
||||
// Check if window has been initialized successfully
|
||||
@ -880,7 +880,7 @@ void ToggleFullscreen(void)
|
||||
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
||||
if (!monitor)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to get monitor");
|
||||
TRACELOG(LOG_WARNING, "Failed to get monitor");
|
||||
glfwSetWindowMonitor(CORE.Window.handle, glfwGetPrimaryMonitor(), 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
|
||||
return;
|
||||
}
|
||||
@ -896,7 +896,7 @@ void ToggleFullscreen(void)
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI)
|
||||
TraceLog(LOG_WARNING, "Could not toggle to windowed mode");
|
||||
TRACELOG(LOG_WARNING, "Could not toggle to windowed mode");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -917,7 +917,7 @@ void SetWindowIcon(Image image)
|
||||
// NOTE 2: The specified image data is copied before this function returns
|
||||
glfwSetWindowIcon(CORE.Window.handle, 1, icon);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Window icon image must be in R8G8B8A8 pixel format");
|
||||
else TRACELOG(LOG_WARNING, "Window icon image must be in R8G8B8A8 pixel format");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -947,12 +947,12 @@ void SetWindowMonitor(int monitor)
|
||||
|
||||
if ((monitor >= 0) && (monitor < monitorCount))
|
||||
{
|
||||
TraceLog(LOG_INFO, "Selected fullscreen monitor: [%i] %s", monitor, glfwGetMonitorName(monitors[monitor]));
|
||||
TRACELOG(LOG_INFO, "Selected fullscreen monitor: [%i] %s", monitor, glfwGetMonitorName(monitors[monitor]));
|
||||
|
||||
const GLFWvidmode *mode = glfwGetVideoMode(monitors[monitor]);
|
||||
glfwSetWindowMonitor(CORE.Window.handle, monitors[monitor], 0, 0, mode->width, mode->height, mode->refreshRate);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
else TRACELOG(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1046,7 +1046,7 @@ int GetMonitorWidth(int monitor)
|
||||
const GLFWvidmode *mode = glfwGetVideoMode(monitors[monitor]);
|
||||
return mode->width;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
else TRACELOG(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -1063,7 +1063,7 @@ int GetMonitorHeight(int monitor)
|
||||
const GLFWvidmode *mode = glfwGetVideoMode(monitors[monitor]);
|
||||
return mode->height;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
else TRACELOG(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -1081,7 +1081,7 @@ int GetMonitorPhysicalWidth(int monitor)
|
||||
glfwGetMonitorPhysicalSize(monitors[monitor], &physicalWidth, NULL);
|
||||
return physicalWidth;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
else TRACELOG(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -1099,7 +1099,7 @@ int GetMonitorPhysicalHeight(int monitor)
|
||||
glfwGetMonitorPhysicalSize(monitors[monitor], NULL, &physicalHeight);
|
||||
return physicalHeight;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
else TRACELOG(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -1126,7 +1126,7 @@ const char *GetMonitorName(int monitor)
|
||||
{
|
||||
return glfwGetMonitorName(monitors[monitor]);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||
else TRACELOG(LOG_WARNING, "Selected monitor not found");
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
@ -1608,7 +1608,7 @@ void SetTargetFPS(int fps)
|
||||
if (fps < 1) CORE.Time.target = 0.0;
|
||||
else CORE.Time.target = 1.0/(double)fps;
|
||||
|
||||
TraceLog(LOG_INFO, "Target time per frame: %02.03f milliseconds", (float)CORE.Time.target*1000);
|
||||
TRACELOG(LOG_INFO, "Target time per frame: %02.03f milliseconds", (float)CORE.Time.target*1000);
|
||||
}
|
||||
|
||||
// Returns current FPS
|
||||
@ -1809,7 +1809,7 @@ void SetConfigFlags(unsigned int flags)
|
||||
if (CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) CORE.Window.alwaysRun = true;
|
||||
}
|
||||
|
||||
// NOTE TraceLog() function is located in [utils.h]
|
||||
// NOTE TRACELOG() function is located in [utils.h]
|
||||
|
||||
// Takes a screenshot of current screen (saved a .png)
|
||||
// NOTE: This function could work in any platform but some platforms: PLATFORM_ANDROID and PLATFORM_WEB
|
||||
@ -1837,7 +1837,7 @@ void TakeScreenshot(const char *fileName)
|
||||
emscripten_run_script(TextFormat("saveFileFromMEMFSToDisk('%s','%s')", GetFileName(path), GetFileName(path)));
|
||||
#endif
|
||||
|
||||
TraceLog(LOG_INFO, "Screenshot taken: %s", path);
|
||||
TRACELOG(LOG_INFO, "Screenshot taken: %s", path);
|
||||
}
|
||||
|
||||
// Check if the file exists
|
||||
@ -2046,7 +2046,7 @@ char **GetDirectoryFiles(const char *dirPath, int *fileCount)
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Can not open directory...\n"); // Maybe it's a file...
|
||||
else TRACELOG(LOG_WARNING, "Can not open directory...\n"); // Maybe it's a file...
|
||||
|
||||
dirFilesCount = counter;
|
||||
*fileCount = dirFilesCount;
|
||||
@ -2162,7 +2162,7 @@ void StorageSaveValue(int position, int value)
|
||||
// If file doesn't exist, create a new storage data file
|
||||
if (!storageFile) storageFile = fopen(path, "wb");
|
||||
|
||||
if (!storageFile) TraceLog(LOG_WARNING, "Storage data file could not be created");
|
||||
if (!storageFile) TRACELOG(LOG_WARNING, "Storage data file could not be created");
|
||||
else
|
||||
{
|
||||
// Get file size
|
||||
@ -2170,7 +2170,7 @@ void StorageSaveValue(int position, int value)
|
||||
int fileSize = ftell(storageFile); // Size in bytes
|
||||
fseek(storageFile, 0, SEEK_SET);
|
||||
|
||||
if (fileSize < (position*sizeof(int))) TraceLog(LOG_WARNING, "Storage position could not be found");
|
||||
if (fileSize < (position*sizeof(int))) TRACELOG(LOG_WARNING, "Storage position could not be found");
|
||||
else
|
||||
{
|
||||
fseek(storageFile, (position*sizeof(int)), SEEK_SET);
|
||||
@ -2199,7 +2199,7 @@ int StorageLoadValue(int position)
|
||||
// Try open existing file to append data
|
||||
FILE *storageFile = fopen(path, "rb");
|
||||
|
||||
if (!storageFile) TraceLog(LOG_WARNING, "Storage data file could not be found");
|
||||
if (!storageFile) TRACELOG(LOG_WARNING, "Storage data file could not be found");
|
||||
else
|
||||
{
|
||||
// Get file size
|
||||
@ -2207,7 +2207,7 @@ int StorageLoadValue(int position)
|
||||
int fileSize = ftell(storageFile); // Size in bytes
|
||||
rewind(storageFile);
|
||||
|
||||
if (fileSize < (position*4)) TraceLog(LOG_WARNING, "Storage position could not be found");
|
||||
if (fileSize < (position*4)) TRACELOG(LOG_WARNING, "Storage position could not be found");
|
||||
else
|
||||
{
|
||||
fseek(storageFile, (position*4), SEEK_SET);
|
||||
@ -2231,7 +2231,7 @@ void OpenURL(const char *url)
|
||||
// sorry for the inconvenience when you hit this point...
|
||||
if (strchr(url, '\'') != NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Provided URL does not seem to be valid.");
|
||||
TRACELOG(LOG_WARNING, "Provided URL does not seem to be valid.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2606,7 +2606,7 @@ Vector2 GetTouchPosition(int index)
|
||||
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
|
||||
if (index < MAX_TOUCH_POINTS) position = CORE.Input.Touch.position[index];
|
||||
else TraceLog(LOG_WARNING, "Required touch point out of range (Max touch points: %i)", MAX_TOUCH_POINTS);
|
||||
else TRACELOG(LOG_WARNING, "Required touch point out of range (Max touch points: %i)", MAX_TOUCH_POINTS);
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
if ((CORE.Window.screen.width > CORE.Window.display.width) || (CORE.Window.screen.height > CORE.Window.display.height))
|
||||
@ -2662,7 +2662,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to initialize GLFW");
|
||||
TRACELOG(LOG_WARNING, "Failed to initialize GLFW");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2672,7 +2672,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
|
||||
if (!monitor)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to get monitor");
|
||||
TRACELOG(LOG_WARNING, "Failed to get monitor");
|
||||
return false;
|
||||
}
|
||||
const GLFWvidmode *mode = glfwGetVideoMode(monitor);
|
||||
@ -2793,7 +2793,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
}
|
||||
#endif
|
||||
|
||||
TraceLog(LOG_WARNING, "Closest fullscreen videomode: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_WARNING, "Closest fullscreen videomode: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
|
||||
// NOTE: ISSUE: Closest videomode could not match monitor aspect-ratio, for example,
|
||||
// for a desired screen size of 800x450 (16:9), closest supported videomode is 800x600 (4:3),
|
||||
@ -2837,18 +2837,18 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
if (!CORE.Window.handle)
|
||||
{
|
||||
glfwTerminate();
|
||||
TraceLog(LOG_WARNING, "GLFW Failed to initialize Window");
|
||||
TRACELOG(LOG_WARNING, "GLFW Failed to initialize Window");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_INFO, "Display device initialized successfully");
|
||||
TRACELOG(LOG_INFO, "Display device initialized successfully");
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
TraceLog(LOG_INFO, "Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, "Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
#endif
|
||||
TraceLog(LOG_INFO, "Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TraceLog(LOG_INFO, "Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TraceLog(LOG_INFO, "Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
TRACELOG(LOG_INFO, "Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TRACELOG(LOG_INFO, "Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, "Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
}
|
||||
|
||||
glfwSetWindowSizeCallback(CORE.Window.handle, WindowSizeCallback); // NOTE: Resizing not allowed by default!
|
||||
@ -2879,7 +2879,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
{
|
||||
// WARNING: It seems to hits a critical render path in Intel HD Graphics
|
||||
glfwSwapInterval(1);
|
||||
TraceLog(LOG_INFO, "Trying to enable VSYNC");
|
||||
TRACELOG(LOG_INFO, "Trying to enable VSYNC");
|
||||
}
|
||||
#endif // PLATFORM_DESKTOP || PLATFORM_WEB
|
||||
|
||||
@ -2907,7 +2907,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
{
|
||||
samples = 4;
|
||||
sampleBuffer = 1;
|
||||
TraceLog(LOG_INFO, "Trying to enable MSAA x4");
|
||||
TRACELOG(LOG_INFO, "Trying to enable MSAA x4");
|
||||
}
|
||||
|
||||
const EGLint framebufferAttribs[] =
|
||||
@ -2985,7 +2985,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)(eglGetProcAddress("eglGetPlatformDisplayEXT"));
|
||||
if (!eglGetPlatformDisplayEXT)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to get function eglGetPlatformDisplayEXT");
|
||||
TRACELOG(LOG_WARNING, "Failed to get function eglGetPlatformDisplayEXT");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3003,7 +3003,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.device = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes);
|
||||
if (CORE.Window.device == EGL_NO_DISPLAY)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to initialize EGL device");
|
||||
TRACELOG(LOG_WARNING, "Failed to initialize EGL device");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3013,7 +3013,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.device = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes);
|
||||
if (CORE.Window.device == EGL_NO_DISPLAY)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to initialize EGL device");
|
||||
TRACELOG(LOG_WARNING, "Failed to initialize EGL device");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3023,14 +3023,14 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.device = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes);
|
||||
if (CORE.Window.device == EGL_NO_DISPLAY)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to initialize EGL device");
|
||||
TRACELOG(LOG_WARNING, "Failed to initialize EGL device");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (eglInitialize(CORE.Window.device, NULL, NULL) == EGL_FALSE)
|
||||
{
|
||||
// If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred.
|
||||
TraceLog(LOG_WARNING, "Failed to initialize EGL");
|
||||
TRACELOG(LOG_WARNING, "Failed to initialize EGL");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3039,7 +3039,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
EGLint numConfigs = 0;
|
||||
if ((eglChooseConfig(CORE.Window.device, framebufferAttribs, &CORE.Window.config, 1, &numConfigs) == EGL_FALSE) || (numConfigs == 0))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to choose first EGLConfig");
|
||||
TRACELOG(LOG_WARNING, "Failed to choose first EGLConfig");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3077,14 +3077,14 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.surface = eglCreateWindowSurface(CORE.Window.device, CORE.Window.config, handle, surfaceAttributes);
|
||||
if (CORE.Window.surface == EGL_NO_SURFACE)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to create EGL fullscreen surface");
|
||||
TRACELOG(LOG_WARNING, "Failed to create EGL fullscreen surface");
|
||||
return false;
|
||||
}
|
||||
|
||||
CORE.Window.context = eglCreateContext(CORE.Window.device, CORE.Window.config, EGL_NO_CONTEXT, contextAttribs);
|
||||
if (CORE.Window.context == EGL_NO_CONTEXT)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to create EGL context");
|
||||
TRACELOG(LOG_WARNING, "Failed to create EGL context");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3099,7 +3099,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.device = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if (CORE.Window.device == EGL_NO_DISPLAY)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to initialize EGL device");
|
||||
TRACELOG(LOG_WARNING, "Failed to initialize EGL device");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3107,7 +3107,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
if (eglInitialize(CORE.Window.device, NULL, NULL) == EGL_FALSE)
|
||||
{
|
||||
// If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred.
|
||||
TraceLog(LOG_WARNING, "Failed to initialize EGL");
|
||||
TRACELOG(LOG_WARNING, "Failed to initialize EGL");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3121,7 +3121,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
CORE.Window.context = eglCreateContext(CORE.Window.device, CORE.Window.config, EGL_NO_CONTEXT, contextAttribs);
|
||||
if (CORE.Window.context == EGL_NO_CONTEXT)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Failed to create EGL context");
|
||||
TRACELOG(LOG_WARNING, "Failed to create EGL context");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -3193,7 +3193,7 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
|
||||
if (eglMakeCurrent(CORE.Window.device, CORE.Window.surface, CORE.Window.surface, CORE.Window.context) == EGL_FALSE)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Unable to attach EGL rendering context to EGL surface");
|
||||
TRACELOG(LOG_WARNING, "Unable to attach EGL rendering context to EGL surface");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -3202,11 +3202,11 @@ static bool InitGraphicsDevice(int width, int height)
|
||||
//eglQuerySurface(CORE.Window.device, CORE.Window.surface, EGL_WIDTH, &CORE.Window.render.width);
|
||||
//eglQuerySurface(CORE.Window.device, CORE.Window.surface, EGL_HEIGHT, &CORE.Window.render.height);
|
||||
|
||||
TraceLog(LOG_INFO, "Display device initialized successfully");
|
||||
TraceLog(LOG_INFO, "Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TraceLog(LOG_INFO, "Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TraceLog(LOG_INFO, "Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TraceLog(LOG_INFO, "Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
TRACELOG(LOG_INFO, "Display device initialized successfully");
|
||||
TRACELOG(LOG_INFO, "Display size: %i x %i", CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, "Render size: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TRACELOG(LOG_INFO, "Screen size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
TRACELOG(LOG_INFO, "Viewport offsets: %i, %i", CORE.Window.renderOffset.x, CORE.Window.renderOffset.y);
|
||||
}
|
||||
#endif // PLATFORM_ANDROID || PLATFORM_RPI
|
||||
|
||||
@ -3270,7 +3270,7 @@ static void SetupFramebuffer(int width, int height)
|
||||
// Calculate CORE.Window.render.width and CORE.Window.render.height, we have the display size (input params) and the desired screen size (global var)
|
||||
if ((CORE.Window.screen.width > CORE.Window.display.width) || (CORE.Window.screen.height > CORE.Window.display.height))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "DOWNSCALING: Required screen size (%ix%i) is bigger than display size (%ix%i)", CORE.Window.screen.width, CORE.Window.screen.height, CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_WARNING, "DOWNSCALING: Required screen size (%ix%i) is bigger than display size (%ix%i)", CORE.Window.screen.width, CORE.Window.screen.height, CORE.Window.display.width, CORE.Window.display.height);
|
||||
|
||||
// Downscaling to fit display with border-bars
|
||||
float widthRatio = (float)CORE.Window.display.width/(float)CORE.Window.screen.width;
|
||||
@ -3300,12 +3300,12 @@ static void SetupFramebuffer(int width, int height)
|
||||
CORE.Window.render.width = CORE.Window.display.width;
|
||||
CORE.Window.render.height = CORE.Window.display.height;
|
||||
|
||||
TraceLog(LOG_WARNING, "Downscale matrix generated, content will be rendered at: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
TRACELOG(LOG_WARNING, "Downscale matrix generated, content will be rendered at: %i x %i", CORE.Window.render.width, CORE.Window.render.height);
|
||||
}
|
||||
else if ((CORE.Window.screen.width < CORE.Window.display.width) || (CORE.Window.screen.height < CORE.Window.display.height))
|
||||
{
|
||||
// Required screen size is smaller than display size
|
||||
TraceLog(LOG_INFO, "UPSCALING: Required screen size: %i x %i -> Display size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height, CORE.Window.display.width, CORE.Window.display.height);
|
||||
TRACELOG(LOG_INFO, "UPSCALING: Required screen size: %i x %i -> Display size: %i x %i", CORE.Window.screen.width, CORE.Window.screen.height, CORE.Window.display.width, CORE.Window.display.height);
|
||||
|
||||
// Upscaling to fit display with border-bars
|
||||
float displayRatio = (float)CORE.Window.display.width/(float)CORE.Window.display.height;
|
||||
@ -3351,7 +3351,7 @@ static void InitTimer(void)
|
||||
{
|
||||
CORE.Time.base = (uint64_t)now.tv_sec*1000000000LLU + (uint64_t)now.tv_nsec;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "No hi-resolution timer available");
|
||||
else TRACELOG(LOG_WARNING, "No hi-resolution timer available");
|
||||
#endif
|
||||
|
||||
CORE.Time.previous = GetTime(); // Get time as double
|
||||
@ -3829,7 +3829,7 @@ static void PollInputEvents(void)
|
||||
}
|
||||
else CORE.Input.Gamepad.currentState[i][button] = 0;
|
||||
|
||||
//TraceLog(LOG_DEBUG, "Gamepad %d, button %d: Digital: %d, Analog: %g", gamepadState.index, j, gamepadState.digitalButton[j], gamepadState.analogButton[j]);
|
||||
//TRACELOGD("Gamepad %d, button %d: Digital: %d, Analog: %g", gamepadState.index, j, gamepadState.digitalButton[j], gamepadState.analogButton[j]);
|
||||
}
|
||||
|
||||
// Register axis data for every connected gamepad
|
||||
@ -3895,7 +3895,7 @@ static void SwapBuffers(void)
|
||||
// GLFW3 Error Callback, runs on GLFW3 error
|
||||
static void ErrorCallback(int error, const char *description)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[GLFW3 Error] Code: %i Decription: %s", error, description);
|
||||
TRACELOG(LOG_WARNING, "[GLFW3 Error] Code: %i Decription: %s", error, description);
|
||||
}
|
||||
|
||||
// GLFW3 Srolling Callback, runs on mouse wheel
|
||||
@ -3929,7 +3929,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||
emscripten_run_script(TextFormat("saveFileFromMEMFSToDisk('%s','%s')", TextFormat("screenrec%03i.gif", screenshotCounter - 1), TextFormat("screenrec%03i.gif", screenshotCounter - 1)));
|
||||
#endif
|
||||
|
||||
TraceLog(LOG_INFO, "End animated GIF recording");
|
||||
TRACELOG(LOG_INFO, "End animated GIF recording");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3949,7 +3949,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||
GifBegin(path, CORE.Window.screen.width, CORE.Window.screen.height, (int)(GetFrameTime()*10.0f), 8, false);
|
||||
screenshotCounter++;
|
||||
|
||||
TraceLog(LOG_INFO, "Begin animated GIF recording: %s", TextFormat("screenrec%03i.gif", screenshotCounter));
|
||||
TRACELOG(LOG_INFO, "Begin animated GIF recording: %s", TextFormat("screenrec%03i.gif", screenshotCounter));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -4336,11 +4336,11 @@ static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const Emscripte
|
||||
|
||||
if (event->isFullscreen)
|
||||
{
|
||||
TraceLog(LOG_INFO, "Canvas scaled to fullscreen. ElementSize: (%ix%i), ScreenSize(%ix%i)", event->elementWidth, event->elementHeight, event->screenWidth, event->screenHeight);
|
||||
TRACELOG(LOG_INFO, "Canvas scaled to fullscreen. ElementSize: (%ix%i), ScreenSize(%ix%i)", event->elementWidth, event->elementHeight, event->screenWidth, event->screenHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_INFO, "Canvas scaled to windowed. ElementSize: (%ix%i), ScreenSize(%ix%i)", event->elementWidth, event->elementHeight, event->screenWidth, event->screenHeight);
|
||||
TRACELOG(LOG_INFO, "Canvas scaled to windowed. ElementSize: (%ix%i), ScreenSize(%ix%i)", event->elementWidth, event->elementHeight, event->screenWidth, event->screenHeight);
|
||||
}
|
||||
|
||||
// TODO: Depending on scaling factor (screen vs element), calculate factor to scale mouse/touch input
|
||||
@ -4373,7 +4373,7 @@ static EM_BOOL EmscriptenMouseCallback(int eventType, const EmscriptenMouseEvent
|
||||
{
|
||||
emscripten_exit_pointerlock();
|
||||
emscripten_get_pointerlock_status(&plce);
|
||||
//if (plce.isActive) TraceLog(LOG_WARNING, "Pointer lock exit did not work!");
|
||||
//if (plce.isActive) TRACELOG(LOG_WARNING, "Pointer lock exit did not work!");
|
||||
}
|
||||
|
||||
CORE.Input.Mouse.cursorLockRequired = false;
|
||||
@ -4446,12 +4446,12 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
|
||||
static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData)
|
||||
{
|
||||
/*
|
||||
TraceLog(LOG_DEBUG, "%s: timeStamp: %g, connected: %d, index: %ld, numAxes: %d, numButtons: %d, id: \"%s\", mapping: \"%s\"",
|
||||
TRACELOGD("%s: timeStamp: %g, connected: %d, index: %ld, numAxes: %d, numButtons: %d, id: \"%s\", mapping: \"%s\"",
|
||||
eventType != 0? emscripten_event_type_to_string(eventType) : "Gamepad state",
|
||||
gamepadEvent->timestamp, gamepadEvent->connected, gamepadEvent->index, gamepadEvent->numAxes, gamepadEvent->numButtons, gamepadEvent->id, gamepadEvent->mapping);
|
||||
|
||||
for (int i = 0; i < gamepadEvent->numAxes; ++i) TraceLog(LOG_DEBUG, "Axis %d: %g", i, gamepadEvent->axis[i]);
|
||||
for (int i = 0; i < gamepadEvent->numButtons; ++i) TraceLog(LOG_DEBUG, "Button %d: Digital: %d, Analog: %g", i, gamepadEvent->digitalButton[i], gamepadEvent->analogButton[i]);
|
||||
for (int i = 0; i < gamepadEvent->numAxes; ++i) TRACELOGD("Axis %d: %g", i, gamepadEvent->axis[i]);
|
||||
for (int i = 0; i < gamepadEvent->numButtons; ++i) TRACELOGD("Button %d: Digital: %d, Analog: %g", i, gamepadEvent->digitalButton[i], gamepadEvent->analogButton[i]);
|
||||
*/
|
||||
|
||||
if ((gamepadEvent->connected) && (gamepadEvent->index < MAX_GAMEPADS)) CORE.Input.Gamepad.ready[gamepadEvent->index] = true;
|
||||
@ -4496,7 +4496,7 @@ static void InitKeyboard(void)
|
||||
if (ioctl(STDIN_FILENO, KDGKBMODE, &CORE.Input.Keyboard.defaultMode) < 0)
|
||||
{
|
||||
// NOTE: It could mean we are using a remote keyboard through ssh!
|
||||
TraceLog(LOG_WARNING, "Could not change keyboard mode (SSH keyboard?)");
|
||||
TRACELOG(LOG_WARNING, "Could not change keyboard mode (SSH keyboard?)");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4534,7 +4534,7 @@ static void ProcessKeyboard(void)
|
||||
// Fill all read bytes (looking for keys)
|
||||
for (int i = 0; i < bufferByteCount; i++)
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Bytes on keysBuffer: %i", bufferByteCount);
|
||||
TRACELOGD("Bytes on keysBuffer: %i", bufferByteCount);
|
||||
|
||||
// NOTE: If (key == 0x1b), depending on next key, it could be a special keymap code!
|
||||
// Up -> 1b 5b 41 / Left -> 1b 5b 44 / Right -> 1b 5b 43 / Down -> 1b 5b 42
|
||||
@ -4603,7 +4603,7 @@ static void ProcessKeyboard(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Pressed key (ASCII): 0x%02x", keysBuffer[i]);
|
||||
TRACELOGD("Pressed key (ASCII): 0x%02x", keysBuffer[i]);
|
||||
|
||||
// Translate lowercase a-z letters to A-Z
|
||||
if ((keysBuffer[i] >= 97) && (keysBuffer[i] <= 122))
|
||||
@ -4676,7 +4676,7 @@ static void InitEvdevInput(void)
|
||||
|
||||
closedir(directory);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Unable to open linux event directory: %s", DEFAULT_EVDEV_PATH);
|
||||
else TRACELOG(LOG_WARNING, "Unable to open linux event directory: %s", DEFAULT_EVDEV_PATH);
|
||||
}
|
||||
|
||||
// Identifies a input device and spawns a thread to handle it if needed
|
||||
@ -4722,7 +4722,7 @@ static void EventThreadSpawn(char *device)
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Error creating input device thread for [%s]: Out of worker slots", device);
|
||||
TRACELOG(LOG_WARNING, "Error creating input device thread for [%s]: Out of worker slots", device);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4730,7 +4730,7 @@ static void EventThreadSpawn(char *device)
|
||||
fd = open(device, O_RDONLY | O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Error creating input device thread for [%s]: Can't open device (Error: %d)", device, worker->fd);
|
||||
TRACELOG(LOG_WARNING, "Error creating input device thread for [%s]: Can't open device (Error: %d)", device, worker->fd);
|
||||
return;
|
||||
}
|
||||
worker->fd = fd;
|
||||
@ -4831,7 +4831,7 @@ static void EventThreadSpawn(char *device)
|
||||
if (worker->isTouch || worker->isMouse || worker->isKeyboard)
|
||||
{
|
||||
// Looks like a interesting device
|
||||
TraceLog(LOG_INFO, "Opening input device [%s] (%s%s%s%s%s)", device,
|
||||
TRACELOG(LOG_INFO, "Opening input device [%s] (%s%s%s%s%s)", device,
|
||||
worker->isMouse? "mouse " : "",
|
||||
worker->isMultitouch? "multitouch " : "",
|
||||
worker->isTouch? "touchscreen " : "",
|
||||
@ -4842,7 +4842,7 @@ static void EventThreadSpawn(char *device)
|
||||
int error = pthread_create(&worker->threadId, NULL, &EventThread, (void *)worker);
|
||||
if (error != 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Error creating input device thread for [%s]: Can't create thread (Error: %d)", device, error);
|
||||
TRACELOG(LOG_WARNING, "Error creating input device thread for [%s]: Can't create thread (Error: %d)", device, error);
|
||||
worker->threadId = 0;
|
||||
close(fd);
|
||||
}
|
||||
@ -4863,7 +4863,7 @@ static void EventThreadSpawn(char *device)
|
||||
{
|
||||
if (CORE.Input.eventWorker[i].threadId != 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Duplicate touchscreen found, killing touchscreen on event: %d", i);
|
||||
TRACELOG(LOG_WARNING, "Duplicate touchscreen found, killing touchscreen on event: %d", i);
|
||||
pthread_cancel(CORE.Input.eventWorker[i].threadId);
|
||||
close(CORE.Input.eventWorker[i].fd);
|
||||
}
|
||||
@ -5043,7 +5043,7 @@ static void *EventThread(void *arg)
|
||||
|
||||
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey] == 1) CORE.Window.shouldClose = true;
|
||||
|
||||
TraceLog(LOG_DEBUG, "KEY%s ScanCode: %4i KeyCode: %4i",event.value == 0 ? "UP":"DOWN", event.code, keycode);
|
||||
TRACELOGD("KEY%s ScanCode: %4i KeyCode: %4i",event.value == 0 ? "UP":"DOWN", event.code, keycode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5106,7 +5106,7 @@ static void InitGamepad(void)
|
||||
if ((CORE.Input.Gamepad.streamId[i] = open(gamepadDev, O_RDONLY|O_NONBLOCK)) < 0)
|
||||
{
|
||||
// NOTE: Only show message for first gamepad
|
||||
if (i == 0) TraceLog(LOG_WARNING, "Gamepad device could not be opened, no gamepad available");
|
||||
if (i == 0) TRACELOG(LOG_WARNING, "Gamepad device could not be opened, no gamepad available");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5117,8 +5117,8 @@ static void InitGamepad(void)
|
||||
{
|
||||
int error = pthread_create(&CORE.Input.Gamepad.threadId, NULL, &GamepadThread, NULL);
|
||||
|
||||
if (error != 0) TraceLog(LOG_WARNING, "Error creating gamepad input event thread");
|
||||
else TraceLog(LOG_INFO, "Gamepad device initialized successfully");
|
||||
if (error != 0) TRACELOG(LOG_WARNING, "Error creating gamepad input event thread");
|
||||
else TRACELOG(LOG_INFO, "Gamepad device initialized successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5152,7 +5152,7 @@ static void *GamepadThread(void *arg)
|
||||
// Process gamepad events by type
|
||||
if (gamepadEvent.type == JS_EVENT_BUTTON)
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Gamepad button: %i, value: %i", gamepadEvent.number, gamepadEvent.value);
|
||||
TRACELOGD("Gamepad button: %i, value: %i", gamepadEvent.number, gamepadEvent.value);
|
||||
|
||||
if (gamepadEvent.number < MAX_GAMEPAD_BUTTONS)
|
||||
{
|
||||
@ -5165,7 +5165,7 @@ static void *GamepadThread(void *arg)
|
||||
}
|
||||
else if (gamepadEvent.type == JS_EVENT_AXIS)
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Gamepad axis: %i, value: %i", gamepadEvent.number, gamepadEvent.value);
|
||||
TRACELOGD("Gamepad axis: %i, value: %i", gamepadEvent.number, gamepadEvent.value);
|
||||
|
||||
if (gamepadEvent.number < MAX_GAMEPAD_AXIS)
|
||||
{
|
||||
|
58
src/models.c
58
src/models.c
@ -667,10 +667,10 @@ Model LoadModel(const char *fileName)
|
||||
model.meshCount = 1;
|
||||
model.meshes = (Mesh *)RL_CALLOC(model.meshCount, sizeof(Mesh));
|
||||
#if defined(SUPPORT_MESH_GENERATION)
|
||||
TraceLog(LOG_WARNING, "[%s] No meshes can be loaded, default to cube mesh", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] No meshes can be loaded, default to cube mesh", fileName);
|
||||
model.meshes[0] = GenMeshCube(1.0f, 1.0f, 1.0f);
|
||||
#else
|
||||
TraceLog(LOG_WARNING, "[%s] No meshes can be loaded, and can't create a default mesh. The raylib mesh generation is not supported (SUPPORT_MESH_GENERATION).", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] No meshes can be loaded, and can't create a default mesh. The raylib mesh generation is not supported (SUPPORT_MESH_GENERATION).", fileName);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -681,7 +681,7 @@ Model LoadModel(const char *fileName)
|
||||
|
||||
if (model.materialCount == 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] No materials can be loaded, default to white material", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] No materials can be loaded, default to white material", fileName);
|
||||
|
||||
model.materialCount = 1;
|
||||
model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material));
|
||||
@ -735,7 +735,7 @@ void UnloadModel(Model model)
|
||||
RL_FREE(model.bones);
|
||||
RL_FREE(model.bindPose);
|
||||
|
||||
TraceLog(LOG_INFO, "Unloaded model data from RAM and VRAM");
|
||||
TRACELOG(LOG_INFO, "Unloaded model data from RAM and VRAM");
|
||||
}
|
||||
|
||||
// Load meshes from model file
|
||||
@ -809,8 +809,8 @@ void ExportMesh(Mesh mesh, const char *fileName)
|
||||
}
|
||||
else if (IsFileExtension(fileName, ".raw")) { } // TODO: Support additional file formats to export mesh vertex data
|
||||
|
||||
if (success) TraceLog(LOG_INFO, "Mesh exported successfully: %s", fileName);
|
||||
else TraceLog(LOG_WARNING, "Mesh could not be exported.");
|
||||
if (success) TRACELOG(LOG_INFO, "Mesh exported successfully: %s", fileName);
|
||||
else TRACELOG(LOG_WARNING, "Mesh could not be exported.");
|
||||
}
|
||||
|
||||
// Load materials from model file
|
||||
@ -828,7 +828,7 @@ Material *LoadMaterials(const char *fileName, int *materialCount)
|
||||
|
||||
int result = tinyobj_parse_mtl_file(&mats, &count, fileName);
|
||||
if (result != TINYOBJ_SUCCESS) {
|
||||
TraceLog(LOG_WARNING, "[%s] Could not parse Materials file", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Could not parse Materials file", fileName);
|
||||
}
|
||||
|
||||
// TODO: Process materials to return
|
||||
@ -836,7 +836,7 @@ Material *LoadMaterials(const char *fileName, int *materialCount)
|
||||
tinyobj_materials_free(mats, count);
|
||||
}
|
||||
#else
|
||||
TraceLog(LOG_WARNING, "[%s] Materials file not supported", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Materials file not supported", fileName);
|
||||
#endif
|
||||
|
||||
// Set materials shader to default (DIFFUSE, SPECULAR, NORMAL)
|
||||
@ -888,8 +888,8 @@ void SetMaterialTexture(Material *material, int mapType, Texture2D texture)
|
||||
// Set the material for a mesh
|
||||
void SetModelMeshMaterial(Model *model, int meshId, int materialId)
|
||||
{
|
||||
if (meshId >= model->meshCount) TraceLog(LOG_WARNING, "Mesh id greater than mesh count");
|
||||
else if (materialId >= model->materialCount) TraceLog(LOG_WARNING,"Material id greater than material count");
|
||||
if (meshId >= model->meshCount) TRACELOG(LOG_WARNING, "Mesh id greater than mesh count");
|
||||
else if (materialId >= model->materialCount) TRACELOG(LOG_WARNING,"Material id greater than material count");
|
||||
else model->meshMaterial[meshId] = materialId;
|
||||
}
|
||||
|
||||
@ -937,7 +937,7 @@ ModelAnimation *LoadModelAnimations(const char *filename, int *animCount)
|
||||
|
||||
if (!iqmFile)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "[%s] Unable to open file", filename);
|
||||
TRACELOG(LOG_ERROR, "[%s] Unable to open file", filename);
|
||||
}
|
||||
|
||||
// Read IQM header
|
||||
@ -945,7 +945,7 @@ ModelAnimation *LoadModelAnimations(const char *filename, int *animCount)
|
||||
|
||||
if (strncmp(iqm.magic, IQM_MAGIC, sizeof(IQM_MAGIC)))
|
||||
{
|
||||
TraceLog(LOG_ERROR, "Magic Number \"%s\"does not match.", iqm.magic);
|
||||
TRACELOG(LOG_ERROR, "Magic Number \"%s\"does not match.", iqm.magic);
|
||||
fclose(iqmFile);
|
||||
|
||||
return NULL;
|
||||
@ -953,7 +953,7 @@ ModelAnimation *LoadModelAnimations(const char *filename, int *animCount)
|
||||
|
||||
if (iqm.version != IQM_VERSION)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "IQM version %i is incorrect.", iqm.version);
|
||||
TRACELOG(LOG_ERROR, "IQM version %i is incorrect.", iqm.version);
|
||||
fclose(iqmFile);
|
||||
|
||||
return NULL;
|
||||
@ -2292,7 +2292,7 @@ BoundingBox MeshBoundingBox(Mesh mesh)
|
||||
void MeshTangents(Mesh *mesh)
|
||||
{
|
||||
if (mesh->tangents == NULL) mesh->tangents = (float *)RL_MALLOC(mesh->vertexCount*4*sizeof(float));
|
||||
else TraceLog(LOG_WARNING, "Mesh tangents already exist");
|
||||
else TRACELOG(LOG_WARNING, "Mesh tangents already exist");
|
||||
|
||||
Vector3 *tan1 = (Vector3 *)RL_MALLOC(mesh->vertexCount*sizeof(Vector3));
|
||||
Vector3 *tan2 = (Vector3 *)RL_MALLOC(mesh->vertexCount*sizeof(Vector3));
|
||||
@ -2365,7 +2365,7 @@ void MeshTangents(Mesh *mesh)
|
||||
// Load a new tangent attributes buffer
|
||||
mesh->vboId[LOC_VERTEX_TANGENT] = rlLoadAttribBuffer(mesh->vaoId, LOC_VERTEX_TANGENT, mesh->tangents, mesh->vertexCount*4*sizeof(float), false);
|
||||
|
||||
TraceLog(LOG_INFO, "Tangents computed for mesh");
|
||||
TRACELOG(LOG_INFO, "Tangents computed for mesh");
|
||||
}
|
||||
|
||||
// Compute mesh binormals (aka bitangent)
|
||||
@ -2817,8 +2817,8 @@ static Model LoadOBJ(const char *fileName)
|
||||
unsigned int flags = TINYOBJ_FLAG_TRIANGULATE;
|
||||
int ret = tinyobj_parse_obj(&attrib, &meshes, &meshCount, &materials, &materialCount, data, dataLength, flags);
|
||||
|
||||
if (ret != TINYOBJ_SUCCESS) TraceLog(LOG_WARNING, "[%s] Model data could not be loaded", fileName);
|
||||
else TraceLog(LOG_INFO, "[%s] Model data loaded successfully: %i meshes / %i materials", fileName, meshCount, materialCount);
|
||||
if (ret != TINYOBJ_SUCCESS) TRACELOG(LOG_WARNING, "[%s] Model data could not be loaded", fileName);
|
||||
else TRACELOG(LOG_INFO, "[%s] Model data loaded successfully: %i meshes / %i materials", fileName, meshCount, materialCount);
|
||||
|
||||
// Init model meshes array
|
||||
// TODO: Support multiple meshes... in the meantime, only one mesh is returned
|
||||
@ -2868,7 +2868,7 @@ static Model LoadOBJ(const char *fileName)
|
||||
tinyobj_vertex_index_t idx1 = attrib.faces[3*f + 1];
|
||||
tinyobj_vertex_index_t idx2 = attrib.faces[3*f + 2];
|
||||
|
||||
// TraceLog(LOG_DEBUG, "Face %i index: v %i/%i/%i . vt %i/%i/%i . vn %i/%i/%i\n", f, idx0.v_idx, idx1.v_idx, idx2.v_idx, idx0.vt_idx, idx1.vt_idx, idx2.vt_idx, idx0.vn_idx, idx1.vn_idx, idx2.vn_idx);
|
||||
// TRACELOGD("Face %i index: v %i/%i/%i . vt %i/%i/%i . vn %i/%i/%i\n", f, idx0.v_idx, idx1.v_idx, idx2.v_idx, idx0.vt_idx, idx1.vt_idx, idx2.vt_idx, idx0.vn_idx, idx1.vn_idx, idx2.vn_idx);
|
||||
|
||||
// Fill vertices buffer (float) using vertex index of the face
|
||||
for (int v = 0; v < 3; v++) { mesh.vertices[vCount + v] = attrib.vertices[idx0.v_idx*3 + v]; } vCount +=3;
|
||||
@ -2960,7 +2960,7 @@ static Model LoadOBJ(const char *fileName)
|
||||
}
|
||||
|
||||
// NOTE: At this point we have all model data loaded
|
||||
TraceLog(LOG_INFO, "[%s] Model loaded successfully in RAM (CPU)", fileName);
|
||||
TRACELOG(LOG_INFO, "[%s] Model loaded successfully in RAM (CPU)", fileName);
|
||||
|
||||
return model;
|
||||
}
|
||||
@ -3079,7 +3079,7 @@ static Model LoadIQM(const char *fileName)
|
||||
|
||||
if (iqmFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] IQM file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] IQM file could not be opened", fileName);
|
||||
return model;
|
||||
}
|
||||
|
||||
@ -3087,14 +3087,14 @@ static Model LoadIQM(const char *fileName)
|
||||
|
||||
if (strncmp(iqm.magic, IQM_MAGIC, sizeof(IQM_MAGIC)))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] IQM file does not seem to be valid", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] IQM file does not seem to be valid", fileName);
|
||||
fclose(iqmFile);
|
||||
return model;
|
||||
}
|
||||
|
||||
if (iqm.version != IQM_VERSION)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] IQM file version is not supported (%i).", fileName, iqm.version);
|
||||
TRACELOG(LOG_WARNING, "[%s] IQM file version is not supported (%i).", fileName, iqm.version);
|
||||
fclose(iqmFile);
|
||||
return model;
|
||||
}
|
||||
@ -3396,7 +3396,7 @@ static Texture LoadTextureFromCgltfImage(cgltf_image *image, const char *texPath
|
||||
int i = 0;
|
||||
while ((image->uri[i] != ',') && (image->uri[i] != 0)) i++;
|
||||
|
||||
if (image->uri[i] == 0) TraceLog(LOG_WARNING, "CGLTF Image: Invalid data URI");
|
||||
if (image->uri[i] == 0) TRACELOG(LOG_WARNING, "CGLTF Image: Invalid data URI");
|
||||
else
|
||||
{
|
||||
int size;
|
||||
@ -3498,7 +3498,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
|
||||
if (gltfFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] glTF file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] glTF file could not be opened", fileName);
|
||||
return model;
|
||||
}
|
||||
|
||||
@ -3518,11 +3518,11 @@ static Model LoadGLTF(const char *fileName)
|
||||
|
||||
if (result == cgltf_result_success)
|
||||
{
|
||||
TraceLog(LOG_INFO, "[%s][%s] Model meshes/materials: %i/%i", fileName, (data->file_type == 2)? "glb" : "gltf", data->meshes_count, data->materials_count);
|
||||
TRACELOG(LOG_INFO, "[%s][%s] Model meshes/materials: %i/%i", fileName, (data->file_type == 2)? "glb" : "gltf", data->meshes_count, data->materials_count);
|
||||
|
||||
// Read data buffers
|
||||
result = cgltf_load_buffers(&options, data, fileName);
|
||||
if (result != cgltf_result_success) TraceLog(LOG_INFO, "[%s][%s] Error loading mesh/material buffers", fileName, (data->file_type == 2)? "glb" : "gltf");
|
||||
if (result != cgltf_result_success) TRACELOG(LOG_INFO, "[%s][%s] Error loading mesh/material buffers", fileName, (data->file_type == 2)? "glb" : "gltf");
|
||||
|
||||
int primitivesCount = 0;
|
||||
|
||||
@ -3625,7 +3625,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
else
|
||||
{
|
||||
// TODO: Support normalized unsigned byte/unsigned short texture coordinates
|
||||
TraceLog(LOG_WARNING, "[%s] Texture coordinates must be float", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Texture coordinates must be float", fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3643,7 +3643,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
else
|
||||
{
|
||||
// TODO: Support unsigned byte/unsigned int
|
||||
TraceLog(LOG_WARNING, "[%s] Indices must be unsigned short", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Indices must be unsigned short", fileName);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3668,7 +3668,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
|
||||
cgltf_free(data);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[%s] glTF data could not be loaded", fileName);
|
||||
else TRACELOG(LOG_WARNING, "[%s] glTF data could not be loaded", fileName);
|
||||
|
||||
RL_FREE(buffer);
|
||||
|
||||
|
148
src/raudio.c
148
src/raudio.c
@ -247,7 +247,7 @@ static Wave LoadMP3(const char *fileName); // Load MP3 file
|
||||
|
||||
#if defined(RAUDIO_STANDALONE)
|
||||
bool IsFileExtension(const char *fileName, const char *ext);// Check file extension
|
||||
void TraceLog(int msgType, const char *text, ...); // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
void TRACELOG(int msgType, const char *text, ...); // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -282,7 +282,7 @@ void InitAudioDevice(void)
|
||||
ma_result result = ma_context_init(NULL, 0, &ctxConfig, &AUDIO.System.context);
|
||||
if (result != MA_SUCCESS)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "Failed to initialize audio context");
|
||||
TRACELOG(LOG_ERROR, "Failed to initialize audio context");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ void InitAudioDevice(void)
|
||||
result = ma_device_init(&AUDIO.System.context, &config, &AUDIO.System.device);
|
||||
if (result != MA_SUCCESS)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "Failed to initialize audio playback AUDIO.System.device");
|
||||
TRACELOG(LOG_ERROR, "Failed to initialize audio playback AUDIO.System.device");
|
||||
ma_context_uninit(&AUDIO.System.context);
|
||||
return;
|
||||
}
|
||||
@ -312,7 +312,7 @@ void InitAudioDevice(void)
|
||||
result = ma_device_start(&AUDIO.System.device);
|
||||
if (result != MA_SUCCESS)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "Failed to start audio playback AUDIO.System.device");
|
||||
TRACELOG(LOG_ERROR, "Failed to start audio playback AUDIO.System.device");
|
||||
ma_device_uninit(&AUDIO.System.device);
|
||||
ma_context_uninit(&AUDIO.System.context);
|
||||
return;
|
||||
@ -322,21 +322,21 @@ void InitAudioDevice(void)
|
||||
// want to look at something a bit smarter later on to keep everything real-time, if that's necessary.
|
||||
if (ma_mutex_init(&AUDIO.System.context, &AUDIO.System.lock) != MA_SUCCESS)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "Failed to create mutex for audio mixing");
|
||||
TRACELOG(LOG_ERROR, "Failed to create mutex for audio mixing");
|
||||
ma_device_uninit(&AUDIO.System.device);
|
||||
ma_context_uninit(&AUDIO.System.context);
|
||||
return;
|
||||
}
|
||||
|
||||
TraceLog(LOG_INFO, "Audio device initialized successfully");
|
||||
TraceLog(LOG_INFO, "Audio backend: miniaudio / %s", ma_get_backend_name(AUDIO.System.context.backend));
|
||||
TraceLog(LOG_INFO, "Audio format: %s -> %s", ma_get_format_name(AUDIO.System.device.playback.format), ma_get_format_name(AUDIO.System.device.playback.internalFormat));
|
||||
TraceLog(LOG_INFO, "Audio channels: %d -> %d", AUDIO.System.device.playback.channels, AUDIO.System.device.playback.internalChannels);
|
||||
TraceLog(LOG_INFO, "Audio sample rate: %d -> %d", AUDIO.System.device.sampleRate, AUDIO.System.device.playback.internalSampleRate);
|
||||
TraceLog(LOG_INFO, "Audio buffer size: %d", AUDIO.System.device.playback.internalBufferSizeInFrames);
|
||||
TRACELOG(LOG_INFO, "Audio device initialized successfully");
|
||||
TRACELOG(LOG_INFO, "Audio backend: miniaudio / %s", ma_get_backend_name(AUDIO.System.context.backend));
|
||||
TRACELOG(LOG_INFO, "Audio format: %s -> %s", ma_get_format_name(AUDIO.System.device.playback.format), ma_get_format_name(AUDIO.System.device.playback.internalFormat));
|
||||
TRACELOG(LOG_INFO, "Audio channels: %d -> %d", AUDIO.System.device.playback.channels, AUDIO.System.device.playback.internalChannels);
|
||||
TRACELOG(LOG_INFO, "Audio sample rate: %d -> %d", AUDIO.System.device.sampleRate, AUDIO.System.device.playback.internalSampleRate);
|
||||
TRACELOG(LOG_INFO, "Audio buffer size: %d", AUDIO.System.device.playback.internalBufferSizeInFrames);
|
||||
|
||||
InitAudioBufferPool();
|
||||
TraceLog(LOG_INFO, "Audio multichannel pool size: %i", MAX_AUDIO_BUFFER_POOL_CHANNELS);
|
||||
TRACELOG(LOG_INFO, "Audio multichannel pool size: %i", MAX_AUDIO_BUFFER_POOL_CHANNELS);
|
||||
|
||||
AUDIO.System.isReady = true;
|
||||
}
|
||||
@ -352,9 +352,9 @@ void CloseAudioDevice(void)
|
||||
|
||||
CloseAudioBufferPool();
|
||||
|
||||
TraceLog(LOG_INFO, "Audio AUDIO.System.device closed successfully");
|
||||
TRACELOG(LOG_INFO, "Audio AUDIO.System.device closed successfully");
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Could not close audio AUDIO.System.device because it is not currently initialized");
|
||||
else TRACELOG(LOG_WARNING, "Could not close audio AUDIO.System.device because it is not currently initialized");
|
||||
}
|
||||
|
||||
// Check if device has been initialized successfully
|
||||
@ -383,7 +383,7 @@ AudioBuffer *InitAudioBuffer(ma_format format, ma_uint32 channels, ma_uint32 sam
|
||||
|
||||
if (audioBuffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "InitAudioBuffer() : Failed to allocate memory for audio buffer");
|
||||
TRACELOG(LOG_ERROR, "InitAudioBuffer() : Failed to allocate memory for audio buffer");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ AudioBuffer *InitAudioBuffer(ma_format format, ma_uint32 channels, ma_uint32 sam
|
||||
|
||||
if (result != MA_SUCCESS)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "InitAudioBuffer() : Failed to create data conversion pipeline");
|
||||
TRACELOG(LOG_ERROR, "InitAudioBuffer() : Failed to create data conversion pipeline");
|
||||
RL_FREE(audioBuffer);
|
||||
return NULL;
|
||||
}
|
||||
@ -441,7 +441,7 @@ void CloseAudioBuffer(AudioBuffer *buffer)
|
||||
RL_FREE(buffer->data);
|
||||
RL_FREE(buffer);
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "CloseAudioBuffer() : No audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "CloseAudioBuffer() : No audio buffer");
|
||||
}
|
||||
|
||||
// Check if an audio buffer is playing
|
||||
@ -450,7 +450,7 @@ bool IsAudioBufferPlaying(AudioBuffer *buffer)
|
||||
bool result = false;
|
||||
|
||||
if (buffer != NULL) result = (buffer->playing && !buffer->paused);
|
||||
else TraceLog(LOG_WARNING, "IsAudioBufferPlaying() : No audio buffer");
|
||||
else TRACELOG(LOG_WARNING, "IsAudioBufferPlaying() : No audio buffer");
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -466,7 +466,7 @@ void PlayAudioBuffer(AudioBuffer *buffer)
|
||||
buffer->paused = false;
|
||||
buffer->frameCursorPos = 0;
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "PlayAudioBuffer() : No audio buffer");
|
||||
}
|
||||
|
||||
// Stop an audio buffer
|
||||
@ -484,28 +484,28 @@ void StopAudioBuffer(AudioBuffer *buffer)
|
||||
buffer->isSubBufferProcessed[1] = true;
|
||||
}
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "StopAudioBuffer() : No audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "StopAudioBuffer() : No audio buffer");
|
||||
}
|
||||
|
||||
// Pause an audio buffer
|
||||
void PauseAudioBuffer(AudioBuffer *buffer)
|
||||
{
|
||||
if (buffer != NULL) buffer->paused = true;
|
||||
else TraceLog(LOG_ERROR, "PauseAudioBuffer() : No audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "PauseAudioBuffer() : No audio buffer");
|
||||
}
|
||||
|
||||
// Resume an audio buffer
|
||||
void ResumeAudioBuffer(AudioBuffer *buffer)
|
||||
{
|
||||
if (buffer != NULL) buffer->paused = false;
|
||||
else TraceLog(LOG_ERROR, "ResumeAudioBuffer() : No audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "ResumeAudioBuffer() : No audio buffer");
|
||||
}
|
||||
|
||||
// Set volume for an audio buffer
|
||||
void SetAudioBufferVolume(AudioBuffer *buffer, float volume)
|
||||
{
|
||||
if (buffer != NULL) buffer->volume = volume;
|
||||
else TraceLog(LOG_WARNING, "SetAudioBufferVolume() : No audio buffer");
|
||||
else TRACELOG(LOG_WARNING, "SetAudioBufferVolume() : No audio buffer");
|
||||
}
|
||||
|
||||
// Set pitch for an audio buffer
|
||||
@ -524,7 +524,7 @@ void SetAudioBufferPitch(AudioBuffer *buffer, float pitch)
|
||||
|
||||
ma_pcm_converter_set_output_sample_rate(&buffer->dsp, newOutputSampleRate);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "SetAudioBufferPitch() : No audio buffer");
|
||||
else TRACELOG(LOG_WARNING, "SetAudioBufferPitch() : No audio buffer");
|
||||
}
|
||||
|
||||
// Track audio buffer to linked list next position
|
||||
@ -583,7 +583,7 @@ Wave LoadWave(const char *fileName)
|
||||
#if defined(SUPPORT_FILEFORMAT_MP3)
|
||||
else if (IsFileExtension(fileName, ".mp3")) wave = LoadMP3(fileName);
|
||||
#endif
|
||||
else TraceLog(LOG_WARNING, "[%s] Audio fileformat not supported, it can't be loaded", fileName);
|
||||
else TRACELOG(LOG_WARNING, "[%s] Audio fileformat not supported, it can't be loaded", fileName);
|
||||
|
||||
return wave;
|
||||
}
|
||||
@ -622,13 +622,13 @@ Sound LoadSoundFromWave(Wave wave)
|
||||
ma_uint32 frameCountIn = wave.sampleCount/wave.channels;
|
||||
|
||||
ma_uint32 frameCount = (ma_uint32)ma_convert_frames(NULL, DEVICE_FORMAT, DEVICE_CHANNELS, DEVICE_SAMPLE_RATE, NULL, formatIn, wave.channels, wave.sampleRate, frameCountIn);
|
||||
if (frameCount == 0) TraceLog(LOG_WARNING, "LoadSoundFromWave() : Failed to get frame count for format conversion");
|
||||
if (frameCount == 0) TRACELOG(LOG_WARNING, "LoadSoundFromWave() : Failed to get frame count for format conversion");
|
||||
|
||||
AudioBuffer *audioBuffer = InitAudioBuffer(DEVICE_FORMAT, DEVICE_CHANNELS, DEVICE_SAMPLE_RATE, frameCount, AUDIO_BUFFER_USAGE_STATIC);
|
||||
if (audioBuffer == NULL) TraceLog(LOG_WARNING, "LoadSoundFromWave() : Failed to create audio buffer");
|
||||
if (audioBuffer == NULL) TRACELOG(LOG_WARNING, "LoadSoundFromWave() : Failed to create audio buffer");
|
||||
|
||||
frameCount = (ma_uint32)ma_convert_frames(audioBuffer->data, audioBuffer->dsp.formatConverterIn.config.formatIn, audioBuffer->dsp.formatConverterIn.config.channels, audioBuffer->dsp.src.config.sampleRateIn, wave.data, formatIn, wave.channels, wave.sampleRate, frameCountIn);
|
||||
if (frameCount == 0) TraceLog(LOG_WARNING, "LoadSoundFromWave() : Format conversion failed");
|
||||
if (frameCount == 0) TRACELOG(LOG_WARNING, "LoadSoundFromWave() : Format conversion failed");
|
||||
|
||||
sound.sampleCount = frameCount*DEVICE_CHANNELS;
|
||||
sound.stream.sampleRate = DEVICE_SAMPLE_RATE;
|
||||
@ -645,7 +645,7 @@ void UnloadWave(Wave wave)
|
||||
{
|
||||
if (wave.data != NULL) RL_FREE(wave.data);
|
||||
|
||||
TraceLog(LOG_INFO, "Unloaded wave data from RAM");
|
||||
TRACELOG(LOG_INFO, "Unloaded wave data from RAM");
|
||||
}
|
||||
|
||||
// Unload sound
|
||||
@ -653,7 +653,7 @@ void UnloadSound(Sound sound)
|
||||
{
|
||||
CloseAudioBuffer(sound.stream.buffer);
|
||||
|
||||
TraceLog(LOG_INFO, "Unloaded sound data from RAM");
|
||||
TRACELOG(LOG_INFO, "Unloaded sound data from RAM");
|
||||
}
|
||||
|
||||
// Update sound buffer with new data
|
||||
@ -668,7 +668,7 @@ void UpdateSound(Sound sound, const void *data, int samplesCount)
|
||||
// TODO: May want to lock/unlock this since this data buffer is read at mixing time
|
||||
memcpy(audioBuffer->data, data, samplesCount*audioBuffer->dsp.formatConverterIn.config.channels*ma_get_bytes_per_sample(audioBuffer->dsp.formatConverterIn.config.formatIn));
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "UpdateSound() : Invalid sound - no audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "UpdateSound() : Invalid sound - no audio buffer");
|
||||
}
|
||||
|
||||
// Export wave data to file
|
||||
@ -689,8 +689,8 @@ void ExportWave(Wave wave, const char *fileName)
|
||||
fclose(rawFile);
|
||||
}
|
||||
|
||||
if (success) TraceLog(LOG_INFO, "Wave exported successfully: %s", fileName);
|
||||
else TraceLog(LOG_WARNING, "Wave could not be exported.");
|
||||
if (success) TRACELOG(LOG_INFO, "Wave exported successfully: %s", fileName);
|
||||
else TRACELOG(LOG_WARNING, "Wave could not be exported.");
|
||||
}
|
||||
|
||||
// Export wave sample data to code (.h)
|
||||
@ -771,12 +771,12 @@ void PlaySoundMulti(Sound sound)
|
||||
// If no none playing pool members can be index choose the oldest
|
||||
if (index == -1)
|
||||
{
|
||||
TraceLog(LOG_WARNING,"pool age %i ended a sound early no room in buffer pool", AUDIO.MultiChannel.poolCounter);
|
||||
TRACELOG(LOG_WARNING,"pool age %i ended a sound early no room in buffer pool", AUDIO.MultiChannel.poolCounter);
|
||||
|
||||
if (oldIndex == -1)
|
||||
{
|
||||
// Shouldn't be able to get here... but just in case something odd happens!
|
||||
TraceLog(LOG_ERROR,"sound buffer pool couldn't determine oldest buffer not playing sound");
|
||||
TRACELOG(LOG_ERROR,"sound buffer pool couldn't determine oldest buffer not playing sound");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -872,7 +872,7 @@ void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels)
|
||||
ma_uint32 frameCount = (ma_uint32)ma_convert_frames(NULL, formatOut, channels, sampleRate, NULL, formatIn, wave->channels, wave->sampleRate, frameCountIn);
|
||||
if (frameCount == 0)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "WaveFormat() : Failed to get frame count for format conversion.");
|
||||
TRACELOG(LOG_ERROR, "WaveFormat() : Failed to get frame count for format conversion.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -881,7 +881,7 @@ void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels)
|
||||
frameCount = (ma_uint32)ma_convert_frames(data, formatOut, channels, sampleRate, wave->data, formatIn, wave->channels, wave->sampleRate, frameCountIn);
|
||||
if (frameCount == 0)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "WaveFormat() : Format conversion failed.");
|
||||
TRACELOG(LOG_ERROR, "WaveFormat() : Format conversion failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -930,7 +930,7 @@ void WaveCrop(Wave *wave, int initSample, int finalSample)
|
||||
RL_FREE(wave->data);
|
||||
wave->data = data;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Wave crop range out of bounds");
|
||||
else TRACELOG(LOG_WARNING, "Wave crop range out of bounds");
|
||||
}
|
||||
|
||||
// Get samples data from wave as a floats array
|
||||
@ -1082,16 +1082,16 @@ Music LoadMusicStream(const char *fileName)
|
||||
else if (music.ctxType == MUSIC_MODULE_MOD) { jar_mod_unload((jar_mod_context_t *)music.ctxData); RL_FREE(music.ctxData); }
|
||||
#endif
|
||||
|
||||
TraceLog(LOG_WARNING, "[%s] Music file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Music file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show some music stream info
|
||||
TraceLog(LOG_INFO, "[%s] Music file successfully loaded:", fileName);
|
||||
TraceLog(LOG_INFO, " Total samples: %i", music.sampleCount);
|
||||
TraceLog(LOG_INFO, " Sample rate: %i Hz", music.stream.sampleRate);
|
||||
TraceLog(LOG_INFO, " Sample size: %i bits", music.stream.sampleSize);
|
||||
TraceLog(LOG_INFO, " Channels: %i (%s)", music.stream.channels, (music.stream.channels == 1)? "Mono" : (music.stream.channels == 2)? "Stereo" : "Multi");
|
||||
TRACELOG(LOG_INFO, "[%s] Music file successfully loaded:", fileName);
|
||||
TRACELOG(LOG_INFO, " Total samples: %i", music.sampleCount);
|
||||
TRACELOG(LOG_INFO, " Sample rate: %i Hz", music.stream.sampleRate);
|
||||
TRACELOG(LOG_INFO, " Sample size: %i bits", music.stream.sampleSize);
|
||||
TRACELOG(LOG_INFO, " Channels: %i (%s)", music.stream.channels, (music.stream.channels == 1)? "Mono" : (music.stream.channels == 2)? "Stereo" : "Multi");
|
||||
}
|
||||
|
||||
return music;
|
||||
@ -1135,7 +1135,7 @@ void PlayMusicStream(Music music)
|
||||
PlayAudioStream(music.stream); // WARNING: This resets the cursor position.
|
||||
audioBuffer->frameCursorPos = frameCursorPos;
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "PlayMusicStream() : No audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "PlayMusicStream() : No audio buffer");
|
||||
|
||||
}
|
||||
|
||||
@ -1350,9 +1350,9 @@ AudioStream InitAudioStream(unsigned int sampleRate, unsigned int sampleSize, un
|
||||
if (stream.buffer != NULL)
|
||||
{
|
||||
stream.buffer->looping = true; // Always loop for streaming buffers
|
||||
TraceLog(LOG_INFO, "Audio stream loaded successfully (%i Hz, %i bit, %s)", stream.sampleRate, stream.sampleSize, (stream.channels == 1)? "Mono" : "Stereo");
|
||||
TRACELOG(LOG_INFO, "Audio stream loaded successfully (%i Hz, %i bit, %s)", stream.sampleRate, stream.sampleSize, (stream.channels == 1)? "Mono" : "Stereo");
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "InitAudioStream() : Failed to create audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "InitAudioStream() : Failed to create audio buffer");
|
||||
|
||||
return stream;
|
||||
}
|
||||
@ -1362,7 +1362,7 @@ void CloseAudioStream(AudioStream stream)
|
||||
{
|
||||
CloseAudioBuffer(stream.buffer);
|
||||
|
||||
TraceLog(LOG_INFO, "Unloaded audio stream data");
|
||||
TRACELOG(LOG_INFO, "Unloaded audio stream data");
|
||||
}
|
||||
|
||||
// Update audio stream buffers with data
|
||||
@ -1415,11 +1415,11 @@ void UpdateAudioStream(AudioStream stream, const void *data, int samplesCount)
|
||||
|
||||
audioBuffer->isSubBufferProcessed[subBufferToUpdate] = false;
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "UpdateAudioStream() : Attempting to write too many frames to buffer");
|
||||
else TRACELOG(LOG_ERROR, "UpdateAudioStream() : Attempting to write too many frames to buffer");
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "UpdateAudioStream() : Audio buffer not available for updating");
|
||||
else TRACELOG(LOG_ERROR, "UpdateAudioStream() : Audio buffer not available for updating");
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "UpdateAudioStream() : No audio buffer");
|
||||
else TRACELOG(LOG_ERROR, "UpdateAudioStream() : No audio buffer");
|
||||
}
|
||||
|
||||
// Check if any audio stream buffers requires refill
|
||||
@ -1427,7 +1427,7 @@ bool IsAudioStreamProcessed(AudioStream stream)
|
||||
{
|
||||
if (stream.buffer == NULL)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "IsAudioStreamProcessed() : No audio buffer");
|
||||
TRACELOG(LOG_ERROR, "IsAudioStreamProcessed() : No audio buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1484,7 +1484,7 @@ static void OnLog(ma_context *pContext, ma_device *pDevice, ma_uint32 logLevel,
|
||||
(void)pContext;
|
||||
(void)pDevice;
|
||||
|
||||
TraceLog(LOG_ERROR, message); // All log messages from miniaudio are errors
|
||||
TRACELOG(LOG_ERROR, message); // All log messages from miniaudio are errors
|
||||
}
|
||||
|
||||
// Sending audio data to device callback function
|
||||
@ -1511,7 +1511,7 @@ static void OnSendAudioDataToDevice(ma_device *pDevice, void *pFramesOut, const
|
||||
{
|
||||
if (framesRead > frameCount)
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Mixed too many frames from audio buffer");
|
||||
TRACELOGD("Mixed too many frames from audio buffer");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1586,7 +1586,7 @@ static ma_uint32 OnAudioBufferDSPRead(ma_pcm_converter *pDSP, void *pFramesOut,
|
||||
|
||||
if (currentSubBufferIndex > 1)
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Frame cursor position moved too far forward in audio stream");
|
||||
TRACELOGD("Frame cursor position moved too far forward in audio stream");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1742,7 +1742,7 @@ static Wave LoadWAV(const char *fileName)
|
||||
|
||||
if (wavFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] WAV file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] WAV file could not be opened", fileName);
|
||||
wave.data = NULL;
|
||||
}
|
||||
else
|
||||
@ -1754,7 +1754,7 @@ static Wave LoadWAV(const char *fileName)
|
||||
if (strncmp(wavRiffHeader.chunkID, "RIFF", 4) ||
|
||||
strncmp(wavRiffHeader.format, "WAVE", 4))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] Invalid RIFF or WAVE Header", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Invalid RIFF or WAVE Header", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1765,7 +1765,7 @@ static Wave LoadWAV(const char *fileName)
|
||||
if ((wavFormat.subChunkID[0] != 'f') || (wavFormat.subChunkID[1] != 'm') ||
|
||||
(wavFormat.subChunkID[2] != 't') || (wavFormat.subChunkID[3] != ' '))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] Invalid Wave format", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Invalid Wave format", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1779,7 +1779,7 @@ static Wave LoadWAV(const char *fileName)
|
||||
if ((wavData.subChunkID[0] != 'd') || (wavData.subChunkID[1] != 'a') ||
|
||||
(wavData.subChunkID[2] != 't') || (wavData.subChunkID[3] != 'a'))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] Invalid data header", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Invalid data header", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1797,7 +1797,7 @@ static Wave LoadWAV(const char *fileName)
|
||||
// NOTE: Only support 8 bit, 16 bit and 32 bit sample sizes
|
||||
if ((wave.sampleSize != 8) && (wave.sampleSize != 16) && (wave.sampleSize != 32))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] WAV sample size (%ibit) not supported, converted to 16bit", fileName, wave.sampleSize);
|
||||
TRACELOG(LOG_WARNING, "[%s] WAV sample size (%ibit) not supported, converted to 16bit", fileName, wave.sampleSize);
|
||||
WaveFormat(&wave, wave.sampleRate, 16, wave.channels);
|
||||
}
|
||||
|
||||
@ -1805,13 +1805,13 @@ static Wave LoadWAV(const char *fileName)
|
||||
if (wave.channels > 2)
|
||||
{
|
||||
WaveFormat(&wave, wave.sampleRate, wave.sampleSize, 2);
|
||||
TraceLog(LOG_WARNING, "[%s] WAV channels number (%i) not supported, converted to 2 channels", fileName, wave.channels);
|
||||
TRACELOG(LOG_WARNING, "[%s] WAV channels number (%i) not supported, converted to 2 channels", fileName, wave.channels);
|
||||
}
|
||||
|
||||
// NOTE: subChunkSize comes in bytes, we need to translate it to number of samples
|
||||
wave.sampleCount = (wavData.subChunkSize/(wave.sampleSize/8))/wave.channels;
|
||||
|
||||
TraceLog(LOG_INFO, "[%s] WAV file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
|
||||
TRACELOG(LOG_INFO, "[%s] WAV file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1853,7 +1853,7 @@ static int SaveWAV(Wave wave, const char *fileName)
|
||||
|
||||
FILE *wavFile = fopen(fileName, "wb");
|
||||
|
||||
if (wavFile == NULL) TraceLog(LOG_WARNING, "[%s] WAV audio file could not be created", fileName);
|
||||
if (wavFile == NULL) TRACELOG(LOG_WARNING, "[%s] WAV audio file could not be created", fileName);
|
||||
else
|
||||
{
|
||||
RiffHeader riffHeader;
|
||||
@ -1912,7 +1912,7 @@ static Wave LoadOGG(const char *fileName)
|
||||
|
||||
stb_vorbis *oggFile = stb_vorbis_open_filename(fileName, NULL, NULL);
|
||||
|
||||
if (oggFile == NULL) TraceLog(LOG_WARNING, "[%s] OGG file could not be opened", fileName);
|
||||
if (oggFile == NULL) TRACELOG(LOG_WARNING, "[%s] OGG file could not be opened", fileName);
|
||||
else
|
||||
{
|
||||
stb_vorbis_info info = stb_vorbis_get_info(oggFile);
|
||||
@ -1923,16 +1923,16 @@ static Wave LoadOGG(const char *fileName)
|
||||
wave.sampleCount = (unsigned int)stb_vorbis_stream_length_in_samples(oggFile)*info.channels; // Independent by channel
|
||||
|
||||
float totalSeconds = stb_vorbis_stream_length_in_seconds(oggFile);
|
||||
if (totalSeconds > 10) TraceLog(LOG_WARNING, "[%s] Ogg audio length is larger than 10 seconds (%f), that's a big file in memory, consider music streaming", fileName, totalSeconds);
|
||||
if (totalSeconds > 10) TRACELOG(LOG_WARNING, "[%s] Ogg audio length is larger than 10 seconds (%f), that's a big file in memory, consider music streaming", fileName, totalSeconds);
|
||||
|
||||
wave.data = (short *)RL_MALLOC(wave.sampleCount*wave.channels*sizeof(short));
|
||||
|
||||
// NOTE: Returns the number of samples to process (be careful! we ask for number of shorts!)
|
||||
int numSamplesOgg = stb_vorbis_get_samples_short_interleaved(oggFile, info.channels, (short *)wave.data, wave.sampleCount*wave.channels);
|
||||
|
||||
TraceLog(LOG_DEBUG, "[%s] Samples obtained: %i", fileName, numSamplesOgg);
|
||||
TRACELOGD("[%s] Samples obtained: %i", fileName, numSamplesOgg);
|
||||
|
||||
TraceLog(LOG_INFO, "[%s] OGG file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
|
||||
TRACELOG(LOG_INFO, "[%s] OGG file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
|
||||
|
||||
stb_vorbis_close(oggFile);
|
||||
}
|
||||
@ -1956,10 +1956,10 @@ static Wave LoadFLAC(const char *fileName)
|
||||
wave.sampleSize = 16;
|
||||
|
||||
// NOTE: Only support up to 2 channels (mono, stereo)
|
||||
if (wave.channels > 2) TraceLog(LOG_WARNING, "[%s] FLAC channels number (%i) not supported", fileName, wave.channels);
|
||||
if (wave.channels > 2) TRACELOG(LOG_WARNING, "[%s] FLAC channels number (%i) not supported", fileName, wave.channels);
|
||||
|
||||
if (wave.data == NULL) TraceLog(LOG_WARNING, "[%s] FLAC data could not be loaded", fileName);
|
||||
else TraceLog(LOG_INFO, "[%s] FLAC file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
|
||||
if (wave.data == NULL) TRACELOG(LOG_WARNING, "[%s] FLAC data could not be loaded", fileName);
|
||||
else TRACELOG(LOG_INFO, "[%s] FLAC file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
|
||||
|
||||
return wave;
|
||||
}
|
||||
@ -1983,10 +1983,10 @@ static Wave LoadMP3(const char *fileName)
|
||||
wave.sampleSize = 32;
|
||||
|
||||
// NOTE: Only support up to 2 channels (mono, stereo)
|
||||
if (wave.channels > 2) TraceLog(LOG_WARNING, "[%s] MP3 channels number (%i) not supported", fileName, wave.channels);
|
||||
if (wave.channels > 2) TRACELOG(LOG_WARNING, "[%s] MP3 channels number (%i) not supported", fileName, wave.channels);
|
||||
|
||||
if (wave.data == NULL) TraceLog(LOG_WARNING, "[%s] MP3 data could not be loaded", fileName);
|
||||
else TraceLog(LOG_INFO, "[%s] MP3 file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
|
||||
if (wave.data == NULL) TRACELOG(LOG_WARNING, "[%s] MP3 data could not be loaded", fileName);
|
||||
else TRACELOG(LOG_INFO, "[%s] MP3 file loaded successfully (%i Hz, %i bit, %s)", fileName, wave.sampleRate, wave.sampleSize, (wave.channels == 1)? "Mono" : "Stereo");
|
||||
|
||||
return wave;
|
||||
}
|
||||
@ -2009,7 +2009,7 @@ bool IsFileExtension(const char *fileName, const char *ext)
|
||||
}
|
||||
|
||||
// Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
void TraceLog(int msgType, const char *text, ...)
|
||||
void TRACELOG(int msgType, const char *text, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, text);
|
||||
|
211
src/rlgl.h
211
src/rlgl.h
@ -74,6 +74,20 @@
|
||||
#define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Support TRACELOG macros
|
||||
#if defined(SUPPORT_TRACELOG)
|
||||
#define TRACELOG(level, ...) TraceLog(level, __VA_ARGS__)
|
||||
|
||||
#if defined(SUPPORT_TRACELOG_DEBUG)
|
||||
#define TRACELOGD(...) TraceLog(LOG_DEBUG, __VA_ARGS__)
|
||||
#else
|
||||
#define TRACELOGD(...) void(0)
|
||||
#endif
|
||||
#else
|
||||
#define TRACELOG(level, ...) void(0)
|
||||
#define TRACELOGD(...) void(0)
|
||||
#endif
|
||||
|
||||
// Allow custom memory allocators
|
||||
#ifndef RL_MALLOC
|
||||
@ -89,7 +103,7 @@
|
||||
#define RL_FREE(p) free(p)
|
||||
#endif
|
||||
#else
|
||||
#include "raylib.h" // Required for: Model, Shader, Texture2D, TraceLog()
|
||||
#include "raylib.h" // Required for: Model, Shader, Texture2D, TRACELOG()
|
||||
#endif
|
||||
|
||||
#include "raymath.h" // Required for: Vector3, Matrix
|
||||
@ -582,7 +596,7 @@ RLAPI void ToggleVrMode(void); // Enable/Disable VR exp
|
||||
RLAPI void BeginVrDrawing(void); // Begin VR simulator stereo rendering
|
||||
RLAPI void EndVrDrawing(void); // End VR simulator stereo rendering
|
||||
|
||||
RLAPI void TraceLog(int msgType, const char *text, ...); // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
RLAPI void TRACELOG(int msgType, const char *text, ...); // Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
RLAPI int GetPixelDataSize(int width, int height, int format);// Get pixel data size in bytes (image or texture)
|
||||
#endif
|
||||
|
||||
@ -663,7 +677,7 @@ RLAPI int GetPixelDataSize(int width, int height, int format);// Get pixel data
|
||||
#endif
|
||||
|
||||
#if defined(RLGL_STANDALONE)
|
||||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() [Used only on TraceLog()]
|
||||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() [Used only on TRACELOG()]
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -941,7 +955,7 @@ void rlMatrixMode(int mode)
|
||||
// Push the current matrix into RLGL.State.stack
|
||||
void rlPushMatrix(void)
|
||||
{
|
||||
if (RLGL.State.stackCounter >= MAX_MATRIX_STACK_SIZE) TraceLog(LOG_ERROR, "Matrix RLGL.State.stack overflow");
|
||||
if (RLGL.State.stackCounter >= MAX_MATRIX_STACK_SIZE) TRACELOG(LOG_ERROR, "Matrix RLGL.State.stack overflow");
|
||||
|
||||
if (RLGL.State.currentMatrixMode == RL_MODELVIEW)
|
||||
{
|
||||
@ -1183,7 +1197,7 @@ void rlVertex3f(float x, float y, float z)
|
||||
|
||||
RLGL.State.draws[RLGL.State.drawsCounter - 1].vertexCount++;
|
||||
}
|
||||
else TraceLog(LOG_ERROR, "MAX_BATCH_ELEMENTS overflow");
|
||||
else TRACELOG(LOG_ERROR, "MAX_BATCH_ELEMENTS overflow");
|
||||
}
|
||||
|
||||
// Define one vertex (position)
|
||||
@ -1311,7 +1325,7 @@ void rlTextureParameters(unsigned int id, int param, int value)
|
||||
{
|
||||
#if !defined(GRAPHICS_API_OPENGL_11)
|
||||
if (RLGL.ExtSupported.texMirrorClamp) glTexParameteri(GL_TEXTURE_2D, param, value);
|
||||
else TraceLog(LOG_WARNING, "Clamp mirror wrap mode not supported");
|
||||
else TRACELOG(LOG_WARNING, "Clamp mirror wrap mode not supported");
|
||||
#endif
|
||||
}
|
||||
else glTexParameteri(GL_TEXTURE_2D, param, value);
|
||||
@ -1325,10 +1339,10 @@ void rlTextureParameters(unsigned int id, int param, int value)
|
||||
if (value <= RLGL.ExtSupported.maxAnisotropicLevel) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value);
|
||||
else if (RLGL.ExtSupported.maxAnisotropicLevel > 0.0f)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[TEX ID %i] Maximum anisotropic filter level supported is %iX", id, RLGL.ExtSupported.maxAnisotropicLevel);
|
||||
TRACELOG(LOG_WARNING, "[TEX ID %i] Maximum anisotropic filter level supported is %iX", id, RLGL.ExtSupported.maxAnisotropicLevel);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)value);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Anisotropic filtering not supported");
|
||||
else TRACELOG(LOG_WARNING, "Anisotropic filtering not supported");
|
||||
#endif
|
||||
} break;
|
||||
default: break;
|
||||
@ -1417,7 +1431,7 @@ void rlDeleteRenderTextures(RenderTexture2D target)
|
||||
|
||||
if (target.id > 0) glDeleteFramebuffers(1, &target.id);
|
||||
|
||||
TraceLog(LOG_INFO, "[FBO ID %i] Unloaded render texture data from VRAM (GPU)", target.id);
|
||||
TRACELOG(LOG_INFO, "[FBO ID %i] Unloaded render texture data from VRAM (GPU)", target.id);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1436,7 +1450,7 @@ void rlDeleteVertexArrays(unsigned int id)
|
||||
if (RLGL.ExtSupported.vao)
|
||||
{
|
||||
if (id != 0) glDeleteVertexArrays(1, &id);
|
||||
TraceLog(LOG_INFO, "[VAO ID %i] Unloaded model data from VRAM (GPU)", id);
|
||||
TRACELOG(LOG_INFO, "[VAO ID %i] Unloaded model data from VRAM (GPU)", id);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1448,7 +1462,7 @@ void rlDeleteBuffers(unsigned int id)
|
||||
if (id != 0)
|
||||
{
|
||||
glDeleteBuffers(1, &id);
|
||||
if (!RLGL.ExtSupported.vao) TraceLog(LOG_INFO, "[VBO ID %i] Unloaded model vertex data from VRAM (GPU)", id);
|
||||
if (!RLGL.ExtSupported.vao) TRACELOG(LOG_INFO, "[VBO ID %i] Unloaded model vertex data from VRAM (GPU)", id);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1492,28 +1506,28 @@ void rlglInit(int width, int height)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Print current OpenGL and GLSL version
|
||||
TraceLog(LOG_INFO, "GPU: Vendor: %s", glGetString(GL_VENDOR));
|
||||
TraceLog(LOG_INFO, "GPU: Renderer: %s", glGetString(GL_RENDERER));
|
||||
TraceLog(LOG_INFO, "GPU: Version: %s", glGetString(GL_VERSION));
|
||||
TraceLog(LOG_INFO, "GPU: GLSL: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
TRACELOG(LOG_INFO, "GPU: Vendor: %s", glGetString(GL_VENDOR));
|
||||
TRACELOG(LOG_INFO, "GPU: Renderer: %s", glGetString(GL_RENDERER));
|
||||
TRACELOG(LOG_INFO, "GPU: Version: %s", glGetString(GL_VERSION));
|
||||
TRACELOG(LOG_INFO, "GPU: GLSL: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
|
||||
// NOTE: We can get a bunch of extra information about GPU capabilities (glGet*)
|
||||
//int maxTexSize;
|
||||
//glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
|
||||
//TraceLog(LOG_INFO, "GL_MAX_TEXTURE_SIZE: %i", maxTexSize);
|
||||
//TRACELOG(LOG_INFO, "GL_MAX_TEXTURE_SIZE: %i", maxTexSize);
|
||||
|
||||
//GL_MAX_TEXTURE_IMAGE_UNITS
|
||||
//GL_MAX_VIEWPORT_DIMS
|
||||
|
||||
//int numAuxBuffers;
|
||||
//glGetIntegerv(GL_AUX_BUFFERS, &numAuxBuffers);
|
||||
//TraceLog(LOG_INFO, "GL_AUX_BUFFERS: %i", numAuxBuffers);
|
||||
//TRACELOG(LOG_INFO, "GL_AUX_BUFFERS: %i", numAuxBuffers);
|
||||
|
||||
//GLint numComp = 0;
|
||||
//GLint format[32] = { 0 };
|
||||
//glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numComp);
|
||||
//glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, format);
|
||||
//for (int i = 0; i < numComp; i++) TraceLog(LOG_INFO, "Supported compressed format: 0x%x", format[i]);
|
||||
//for (int i = 0; i < numComp; i++) TRACELOG(LOG_INFO, "Supported compressed format: 0x%x", format[i]);
|
||||
|
||||
// NOTE: We don't need that much data on screen... right now...
|
||||
|
||||
@ -1571,10 +1585,10 @@ void rlglInit(int width, int height)
|
||||
// NOTE: Duplicated string (extensionsDup) must be deallocated
|
||||
#endif
|
||||
|
||||
TraceLog(LOG_INFO, "Number of supported extensions: %i", numExt);
|
||||
TRACELOG(LOG_INFO, "Number of supported extensions: %i", numExt);
|
||||
|
||||
// Show supported extensions
|
||||
//for (int i = 0; i < numExt; i++) TraceLog(LOG_INFO, "Supported extension: %s", extList[i]);
|
||||
//for (int i = 0; i < numExt; i++) TRACELOG(LOG_INFO, "Supported extension: %s", extList[i]);
|
||||
|
||||
// Check required extensions
|
||||
for (int i = 0; i < numExt; i++)
|
||||
@ -1646,23 +1660,23 @@ void rlglInit(int width, int height)
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
RL_FREE(extensionsDup); // Duplicated string must be deallocated
|
||||
|
||||
if (RLGL.ExtSupported.vao) TraceLog(LOG_INFO, "[EXTENSION] VAO extension detected, VAO functions initialized successfully");
|
||||
else TraceLog(LOG_WARNING, "[EXTENSION] VAO extension not found, VAO usage not supported");
|
||||
if (RLGL.ExtSupported.vao) TRACELOG(LOG_INFO, "[EXTENSION] VAO extension detected, VAO functions initialized successfully");
|
||||
else TRACELOG(LOG_WARNING, "[EXTENSION] VAO extension not found, VAO usage not supported");
|
||||
|
||||
if (RLGL.ExtSupported.texNPOT) TraceLog(LOG_INFO, "[EXTENSION] NPOT textures extension detected, full NPOT textures supported");
|
||||
else TraceLog(LOG_WARNING, "[EXTENSION] NPOT textures extension not found, limited NPOT support (no-mipmaps, no-repeat)");
|
||||
if (RLGL.ExtSupported.texNPOT) TRACELOG(LOG_INFO, "[EXTENSION] NPOT textures extension detected, full NPOT textures supported");
|
||||
else TRACELOG(LOG_WARNING, "[EXTENSION] NPOT textures extension not found, limited NPOT support (no-mipmaps, no-repeat)");
|
||||
#endif
|
||||
|
||||
if (RLGL.ExtSupported.texCompDXT) TraceLog(LOG_INFO, "[EXTENSION] DXT compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompETC1) TraceLog(LOG_INFO, "[EXTENSION] ETC1 compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompETC2) TraceLog(LOG_INFO, "[EXTENSION] ETC2/EAC compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompPVRT) TraceLog(LOG_INFO, "[EXTENSION] PVRT compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompASTC) TraceLog(LOG_INFO, "[EXTENSION] ASTC compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompDXT) TRACELOG(LOG_INFO, "[EXTENSION] DXT compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompETC1) TRACELOG(LOG_INFO, "[EXTENSION] ETC1 compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompETC2) TRACELOG(LOG_INFO, "[EXTENSION] ETC2/EAC compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompPVRT) TRACELOG(LOG_INFO, "[EXTENSION] PVRT compressed textures supported");
|
||||
if (RLGL.ExtSupported.texCompASTC) TRACELOG(LOG_INFO, "[EXTENSION] ASTC compressed textures supported");
|
||||
|
||||
if (RLGL.ExtSupported.texAnisoFilter) TraceLog(LOG_INFO, "[EXTENSION] Anisotropic textures filtering supported (max: %.0fX)", RLGL.ExtSupported.maxAnisotropicLevel);
|
||||
if (RLGL.ExtSupported.texMirrorClamp) TraceLog(LOG_INFO, "[EXTENSION] Mirror clamp wrap texture mode supported");
|
||||
if (RLGL.ExtSupported.texAnisoFilter) TRACELOG(LOG_INFO, "[EXTENSION] Anisotropic textures filtering supported (max: %.0fX)", RLGL.ExtSupported.maxAnisotropicLevel);
|
||||
if (RLGL.ExtSupported.texMirrorClamp) TRACELOG(LOG_INFO, "[EXTENSION] Mirror clamp wrap texture mode supported");
|
||||
|
||||
if (RLGL.ExtSupported.debugMarker) TraceLog(LOG_INFO, "[EXTENSION] Debug Marker supported");
|
||||
if (RLGL.ExtSupported.debugMarker) TRACELOG(LOG_INFO, "[EXTENSION] Debug Marker supported");
|
||||
|
||||
// Initialize buffers, default shaders and default textures
|
||||
//----------------------------------------------------------
|
||||
@ -1670,8 +1684,8 @@ void rlglInit(int width, int height)
|
||||
unsigned char pixels[4] = { 255, 255, 255, 255 }; // 1 pixel RGBA (4 bytes)
|
||||
RLGL.State.defaultTextureId = rlLoadTexture(pixels, 1, 1, UNCOMPRESSED_R8G8B8A8, 1);
|
||||
|
||||
if (RLGL.State.defaultTextureId != 0) TraceLog(LOG_INFO, "[TEX ID %i] Base white texture loaded successfully", RLGL.State.defaultTextureId);
|
||||
else TraceLog(LOG_WARNING, "Base white texture could not be loaded");
|
||||
if (RLGL.State.defaultTextureId != 0) TRACELOG(LOG_INFO, "[TEX ID %i] Base white texture loaded successfully", RLGL.State.defaultTextureId);
|
||||
else TRACELOG(LOG_WARNING, "Base white texture could not be loaded");
|
||||
|
||||
// Init default Shader (customized for GL 3.3 and ES2)
|
||||
RLGL.State.defaultShader = LoadShaderDefault();
|
||||
@ -1744,7 +1758,7 @@ void rlglInit(int width, int height)
|
||||
RLGL.State.shapesTexture = GetTextureDefault();
|
||||
RLGL.State.shapesTextureRec = (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f };
|
||||
|
||||
TraceLog(LOG_INFO, "OpenGL default states initialized successfully");
|
||||
TRACELOG(LOG_INFO, "OpenGL default states initialized successfully");
|
||||
}
|
||||
|
||||
// Vertex Buffer Object deinitialization (memory free)
|
||||
@ -1755,7 +1769,7 @@ void rlglClose(void)
|
||||
UnloadBuffersDefault(); // Unload default buffers
|
||||
glDeleteTextures(1, &RLGL.State.defaultTextureId); // Unload default texture
|
||||
|
||||
TraceLog(LOG_INFO, "[TEX ID %i] Unloaded texture data (base white texture) from VRAM", RLGL.State.defaultTextureId);
|
||||
TRACELOG(LOG_INFO, "[TEX ID %i] Unloaded texture data (base white texture) from VRAM", RLGL.State.defaultTextureId);
|
||||
|
||||
RL_FREE(RLGL.State.draws);
|
||||
#endif
|
||||
@ -1817,14 +1831,14 @@ void rlLoadExtensions(void *loader)
|
||||
#if defined(GRAPHICS_API_OPENGL_33)
|
||||
// NOTE: glad is generated and contains only required OpenGL 3.3 Core extensions (and lower versions)
|
||||
#if !defined(__APPLE__)
|
||||
if (!gladLoadGLLoader((GLADloadproc)loader)) TraceLog(LOG_WARNING, "GLAD: Cannot load OpenGL extensions");
|
||||
else TraceLog(LOG_INFO, "GLAD: OpenGL extensions loaded successfully");
|
||||
if (!gladLoadGLLoader((GLADloadproc)loader)) TRACELOG(LOG_WARNING, "GLAD: Cannot load OpenGL extensions");
|
||||
else TRACELOG(LOG_INFO, "GLAD: OpenGL extensions loaded successfully");
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_21)
|
||||
if (GLAD_GL_VERSION_2_1) TraceLog(LOG_INFO, "OpenGL 2.1 profile supported");
|
||||
if (GLAD_GL_VERSION_2_1) TRACELOG(LOG_INFO, "OpenGL 2.1 profile supported");
|
||||
#elif defined(GRAPHICS_API_OPENGL_33)
|
||||
if (GLAD_GL_VERSION_3_3) TraceLog(LOG_INFO, "OpenGL 3.3 Core profile supported");
|
||||
else TraceLog(LOG_ERROR, "OpenGL 3.3 Core profile not supported");
|
||||
if (GLAD_GL_VERSION_3_3) TRACELOG(LOG_INFO, "OpenGL 3.3 Core profile supported");
|
||||
else TRACELOG(LOG_ERROR, "OpenGL 3.3 Core profile not supported");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1867,38 +1881,38 @@ unsigned int rlLoadTexture(void *data, int width, int height, int format, int mi
|
||||
#if defined(GRAPHICS_API_OPENGL_11)
|
||||
if (format >= COMPRESSED_DXT1_RGB)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "OpenGL 1.1 does not support GPU compressed texture formats");
|
||||
TRACELOG(LOG_WARNING, "OpenGL 1.1 does not support GPU compressed texture formats");
|
||||
return id;
|
||||
}
|
||||
#else
|
||||
if ((!RLGL.ExtSupported.texCompDXT) && ((format == COMPRESSED_DXT1_RGB) || (format == COMPRESSED_DXT1_RGBA) ||
|
||||
(format == COMPRESSED_DXT3_RGBA) || (format == COMPRESSED_DXT5_RGBA)))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "DXT compressed texture format not supported");
|
||||
TRACELOG(LOG_WARNING, "DXT compressed texture format not supported");
|
||||
return id;
|
||||
}
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
if ((!RLGL.ExtSupported.texCompETC1) && (format == COMPRESSED_ETC1_RGB))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "ETC1 compressed texture format not supported");
|
||||
TRACELOG(LOG_WARNING, "ETC1 compressed texture format not supported");
|
||||
return id;
|
||||
}
|
||||
|
||||
if ((!RLGL.ExtSupported.texCompETC2) && ((format == COMPRESSED_ETC2_RGB) || (format == COMPRESSED_ETC2_EAC_RGBA)))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "ETC2 compressed texture format not supported");
|
||||
TRACELOG(LOG_WARNING, "ETC2 compressed texture format not supported");
|
||||
return id;
|
||||
}
|
||||
|
||||
if ((!RLGL.ExtSupported.texCompPVRT) && ((format == COMPRESSED_PVRT_RGB) || (format == COMPRESSED_PVRT_RGBA)))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "PVRT compressed texture format not supported");
|
||||
TRACELOG(LOG_WARNING, "PVRT compressed texture format not supported");
|
||||
return id;
|
||||
}
|
||||
|
||||
if ((!RLGL.ExtSupported.texCompASTC) && ((format == COMPRESSED_ASTC_4x4_RGBA) || (format == COMPRESSED_ASTC_8x8_RGBA)))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "ASTC compressed texture format not supported");
|
||||
TRACELOG(LOG_WARNING, "ASTC compressed texture format not supported");
|
||||
return id;
|
||||
}
|
||||
#endif
|
||||
@ -1918,7 +1932,7 @@ unsigned int rlLoadTexture(void *data, int width, int height, int format, int mi
|
||||
int mipHeight = height;
|
||||
int mipOffset = 0; // Mipmap data offset
|
||||
|
||||
TraceLog(LOG_DEBUG, "Load texture from data memory address: 0x%x", data);
|
||||
TRACELOGD("Load texture from data memory address: 0x%x", data);
|
||||
|
||||
// Load the different mipmap levels
|
||||
for (int i = 0; i < mipmapCount; i++)
|
||||
@ -1928,7 +1942,7 @@ unsigned int rlLoadTexture(void *data, int width, int height, int format, int mi
|
||||
unsigned int glInternalFormat, glFormat, glType;
|
||||
rlGetGlTextureFormats(format, &glInternalFormat, &glFormat, &glType);
|
||||
|
||||
TraceLog(LOG_DEBUG, "Load mipmap level %i (%i x %i), size: %i, offset: %i", i, mipWidth, mipHeight, mipSize, mipOffset);
|
||||
TRACELOGD("Load mipmap level %i (%i x %i), size: %i, offset: %i", i, mipWidth, mipHeight, mipSize, mipOffset);
|
||||
|
||||
if (glInternalFormat != -1)
|
||||
{
|
||||
@ -2004,8 +2018,8 @@ unsigned int rlLoadTexture(void *data, int width, int height, int format, int mi
|
||||
// Unbind current texture
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
if (id > 0) TraceLog(LOG_INFO, "[TEX ID %i] Texture created successfully (%ix%i - %i mipmaps)", id, width, height, mipmapCount);
|
||||
else TraceLog(LOG_WARNING, "Texture could not be created");
|
||||
if (id > 0) TRACELOG(LOG_INFO, "[TEX ID %i] Texture created successfully (%ix%i - %i mipmaps)", id, width, height, mipmapCount);
|
||||
else TRACELOG(LOG_WARNING, "Texture could not be created");
|
||||
|
||||
return id;
|
||||
}
|
||||
@ -2138,7 +2152,7 @@ void rlUpdateTexture(unsigned int id, int width, int height, int format, const v
|
||||
{
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, glFormat, glType, (unsigned char *)data);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Texture format updating not supported");
|
||||
else TRACELOG(LOG_WARNING, "Texture format updating not supported");
|
||||
}
|
||||
|
||||
// Get OpenGL internal formats and data type from raylib PixelFormat
|
||||
@ -2189,7 +2203,7 @@ void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned
|
||||
case COMPRESSED_ASTC_4x4_RGBA: if (RLGL.ExtSupported.texCompASTC) *glInternalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR; break; // NOTE: Requires OpenGL ES 3.1 or OpenGL 4.3
|
||||
case COMPRESSED_ASTC_8x8_RGBA: if (RLGL.ExtSupported.texCompASTC) *glInternalFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR; break; // NOTE: Requires OpenGL ES 3.1 or OpenGL 4.3
|
||||
#endif
|
||||
default: TraceLog(LOG_WARNING, "Texture format not supported"); break;
|
||||
default: TRACELOG(LOG_WARNING, "Texture format not supported"); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2245,7 +2259,7 @@ RenderTexture2D rlLoadRenderTexture(int width, int height, int format, int depth
|
||||
|
||||
// Check if fbo is complete with attachments (valid)
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
if (rlRenderTextureComplete(target)) TraceLog(LOG_INFO, "[FBO ID %i] Framebuffer object created successfully", target.id);
|
||||
if (rlRenderTextureComplete(target)) TRACELOG(LOG_INFO, "[FBO ID %i] Framebuffer object created successfully", target.id);
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
@ -2286,12 +2300,12 @@ bool rlRenderTextureComplete(RenderTexture target)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED: TraceLog(LOG_WARNING, "Framebuffer is unsupported"); break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: TraceLog(LOG_WARNING, "Framebuffer has incomplete attachment"); break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED: TRACELOG(LOG_WARNING, "Framebuffer is unsupported"); break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: TRACELOG(LOG_WARNING, "Framebuffer has incomplete attachment"); break;
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: TraceLog(LOG_WARNING, "Framebuffer has incomplete dimensions"); break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: TRACELOG(LOG_WARNING, "Framebuffer has incomplete dimensions"); break;
|
||||
#endif
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: TraceLog(LOG_WARNING, "Framebuffer has a missing attachment"); break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: TRACELOG(LOG_WARNING, "Framebuffer has a missing attachment"); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@ -2349,16 +2363,16 @@ void rlGenerateMipmaps(Texture2D *texture)
|
||||
texture->mipmaps = mipmapCount + 1;
|
||||
RL_FREE(data); // Once mipmaps have been generated and data has been uploaded to GPU VRAM, we can discard RAM data
|
||||
|
||||
TraceLog(LOG_WARNING, "[TEX ID %i] Mipmaps [%i] generated manually on CPU side", texture->id, texture->mipmaps);
|
||||
TRACELOG(LOG_WARNING, "[TEX ID %i] Mipmaps [%i] generated manually on CPU side", texture->id, texture->mipmaps);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[TEX ID %i] Mipmaps could not be generated for texture format", texture->id);
|
||||
else TRACELOG(LOG_WARNING, "[TEX ID %i] Mipmaps could not be generated for texture format", texture->id);
|
||||
}
|
||||
#elif defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
if ((texIsPOT) || (RLGL.ExtSupported.texNPOT))
|
||||
{
|
||||
//glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE); // Hint for mipmaps generation algorythm: GL_FASTEST, GL_NICEST, GL_DONT_CARE
|
||||
glGenerateMipmap(GL_TEXTURE_2D); // Generate mipmaps automatically
|
||||
TraceLog(LOG_INFO, "[TEX ID %i] Mipmaps generated automatically", texture->id);
|
||||
TRACELOG(LOG_INFO, "[TEX ID %i] Mipmaps generated automatically", texture->id);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // Activate Trilinear filtering for mipmaps
|
||||
@ -2369,7 +2383,7 @@ void rlGenerateMipmaps(Texture2D *texture)
|
||||
texture->mipmaps = 1 + (int)floor(log(MAX(texture->width, texture->height))/log(2));
|
||||
}
|
||||
#endif
|
||||
else TraceLog(LOG_WARNING, "[TEX ID %i] Mipmaps can not be generated", texture->id);
|
||||
else TRACELOG(LOG_WARNING, "[TEX ID %i] Mipmaps can not be generated", texture->id);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
}
|
||||
@ -2380,7 +2394,7 @@ void rlLoadMesh(Mesh *mesh, bool dynamic)
|
||||
if (mesh->vaoId > 0)
|
||||
{
|
||||
// Check if mesh has already been loaded in GPU
|
||||
TraceLog(LOG_WARNING, "Trying to re-load an already loaded mesh");
|
||||
TRACELOG(LOG_WARNING, "Trying to re-load an already loaded mesh");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2493,12 +2507,12 @@ void rlLoadMesh(Mesh *mesh, bool dynamic)
|
||||
|
||||
if (RLGL.ExtSupported.vao)
|
||||
{
|
||||
if (mesh->vaoId > 0) TraceLog(LOG_INFO, "[VAO ID %i] Mesh uploaded successfully to VRAM (GPU)", mesh->vaoId);
|
||||
else TraceLog(LOG_WARNING, "Mesh could not be uploaded to VRAM (GPU)");
|
||||
if (mesh->vaoId > 0) TRACELOG(LOG_INFO, "[VAO ID %i] Mesh uploaded successfully to VRAM (GPU)", mesh->vaoId);
|
||||
else TRACELOG(LOG_WARNING, "Mesh could not be uploaded to VRAM (GPU)");
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_INFO, "[VBOs] Mesh uploaded successfully to VRAM (GPU)");
|
||||
TRACELOG(LOG_INFO, "[VBOs] Mesh uploaded successfully to VRAM (GPU)");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -2896,7 +2910,7 @@ void *rlReadTexturePixels(Texture2D texture)
|
||||
pixels = (unsigned char *)RL_MALLOC(size);
|
||||
glGetTexImage(GL_TEXTURE_2D, 0, glFormat, glType, pixels);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Texture data retrieval not suported for pixel format");
|
||||
else TRACELOG(LOG_WARNING, "Texture data retrieval not suported for pixel format");
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
#endif
|
||||
@ -3009,7 +3023,7 @@ char *LoadText(const char *fileName)
|
||||
|
||||
fclose(textFile);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[%s] Text file could not be opened", fileName);
|
||||
else TRACELOG(LOG_WARNING, "[%s] Text file could not be opened", fileName);
|
||||
}
|
||||
|
||||
return text;
|
||||
@ -3064,7 +3078,7 @@ Shader LoadShaderCode(const char *vsCode, const char *fsCode)
|
||||
|
||||
if (shader.id == 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Custom shader could not be loaded");
|
||||
TRACELOG(LOG_WARNING, "Custom shader could not be loaded");
|
||||
shader = RLGL.State.defaultShader;
|
||||
}
|
||||
|
||||
@ -3090,10 +3104,7 @@ Shader LoadShaderCode(const char *vsCode, const char *fsCode)
|
||||
|
||||
name[namelen] = 0;
|
||||
|
||||
// Get the location of the named uniform
|
||||
unsigned int location = glGetUniformLocation(shader.id, name);
|
||||
|
||||
TraceLog(LOG_DEBUG, "[SHDR ID %i] Active uniform [%s] set at location: %i", shader.id, name, location);
|
||||
TRACELOGD("[SHDR ID %i] Active uniform [%s] set at location: %i", shader.id, name, glGetUniformLocation(shader.id, name));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -3106,7 +3117,7 @@ void UnloadShader(Shader shader)
|
||||
if (shader.id > 0)
|
||||
{
|
||||
rlDeleteShader(shader.id);
|
||||
TraceLog(LOG_INFO, "[SHDR ID %i] Unloaded shader program data", shader.id);
|
||||
TRACELOG(LOG_INFO, "[SHDR ID %i] Unloaded shader program data", shader.id);
|
||||
}
|
||||
|
||||
RL_FREE(shader.locs);
|
||||
@ -3139,8 +3150,8 @@ int GetShaderLocation(Shader shader, const char *uniformName)
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
location = glGetUniformLocation(shader.id, uniformName);
|
||||
|
||||
if (location == -1) TraceLog(LOG_WARNING, "[SHDR ID %i][%s] Shader uniform could not be found", shader.id, uniformName);
|
||||
else TraceLog(LOG_INFO, "[SHDR ID %i][%s] Shader uniform set at location: %i", shader.id, uniformName, location);
|
||||
if (location == -1) TRACELOG(LOG_WARNING, "[SHDR ID %i][%s] Shader uniform could not be found", shader.id, uniformName);
|
||||
else TRACELOG(LOG_INFO, "[SHDR ID %i][%s] Shader uniform set at location: %i", shader.id, uniformName, location);
|
||||
#endif
|
||||
return location;
|
||||
}
|
||||
@ -3168,7 +3179,7 @@ void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int unifo
|
||||
case UNIFORM_IVEC3: glUniform3iv(uniformLoc, count, (int *)value); break;
|
||||
case UNIFORM_IVEC4: glUniform4iv(uniformLoc, count, (int *)value); break;
|
||||
case UNIFORM_SAMPLER2D: glUniform1iv(uniformLoc, count, (int *)value); break;
|
||||
default: TraceLog(LOG_WARNING, "Shader uniform could not be set data type not recognized");
|
||||
default: TRACELOG(LOG_WARNING, "Shader uniform could not be set data type not recognized");
|
||||
}
|
||||
|
||||
//glUseProgram(0); // Avoid reseting current shader program, in case other uniforms are set
|
||||
@ -3612,7 +3623,7 @@ void InitVrSimulator(void)
|
||||
|
||||
RLGL.Vr.simulatorReady = true;
|
||||
#else
|
||||
TraceLog(LOG_WARNING, "VR Simulator not supported on OpenGL 1.1");
|
||||
TRACELOG(LOG_WARNING, "VR Simulator not supported on OpenGL 1.1");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3660,17 +3671,17 @@ void SetVrConfiguration(VrDeviceInfo hmd, Shader distortion)
|
||||
hmd.lensDistortionValues[2]*lensRadiusSq*lensRadiusSq +
|
||||
hmd.lensDistortionValues[3]*lensRadiusSq*lensRadiusSq*lensRadiusSq;
|
||||
|
||||
TraceLog(LOG_DEBUG, "VR: Distortion Scale: %f", distortionScale);
|
||||
TRACELOGD("VR: Distortion Scale: %f", distortionScale);
|
||||
|
||||
float normScreenWidth = 0.5f;
|
||||
float normScreenHeight = 1.0f;
|
||||
float scaleIn[2] = { 2.0f/normScreenWidth, 2.0f/normScreenHeight/aspect };
|
||||
float scale[2] = { normScreenWidth*0.5f/distortionScale, normScreenHeight*0.5f*aspect/distortionScale };
|
||||
|
||||
TraceLog(LOG_DEBUG, "VR: Distortion Shader: LeftLensCenter = { %f, %f }", leftLensCenter[0], leftLensCenter[1]);
|
||||
TraceLog(LOG_DEBUG, "VR: Distortion Shader: RightLensCenter = { %f, %f }", rightLensCenter[0], rightLensCenter[1]);
|
||||
TraceLog(LOG_DEBUG, "VR: Distortion Shader: Scale = { %f, %f }", scale[0], scale[1]);
|
||||
TraceLog(LOG_DEBUG, "VR: Distortion Shader: ScaleIn = { %f, %f }", scaleIn[0], scaleIn[1]);
|
||||
TRACELOGD("VR: Distortion Shader: LeftLensCenter = { %f, %f }", leftLensCenter[0], leftLensCenter[1]);
|
||||
TRACELOGD("VR: Distortion Shader: RightLensCenter = { %f, %f }", rightLensCenter[0], rightLensCenter[1]);
|
||||
TRACELOGD("VR: Distortion Shader: Scale = { %f, %f }", scale[0], scale[1]);
|
||||
TRACELOGD("VR: Distortion Shader: ScaleIn = { %f, %f }", scaleIn[0], scaleIn[1]);
|
||||
|
||||
// Fovy is normally computed with: 2*atan2(hmd.vScreenSize, 2*hmd.eyeToScreenDistance)
|
||||
// ...but with lens distortion it is increased (see Oculus SDK Documentation)
|
||||
@ -3849,7 +3860,7 @@ static unsigned int CompileShader(const char *shaderStr, int type)
|
||||
|
||||
if (success != GL_TRUE)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[SHDR ID %i] Failed to compile shader...", shader);
|
||||
TRACELOG(LOG_WARNING, "[SHDR ID %i] Failed to compile shader...", shader);
|
||||
int maxLength = 0;
|
||||
int length;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
|
||||
@ -3861,13 +3872,13 @@ static unsigned int CompileShader(const char *shaderStr, int type)
|
||||
#endif
|
||||
glGetShaderInfoLog(shader, maxLength, &length, log);
|
||||
|
||||
TraceLog(LOG_INFO, "%s", log);
|
||||
TRACELOG(LOG_INFO, "%s", log);
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
RL_FREE(log);
|
||||
#endif
|
||||
}
|
||||
else TraceLog(LOG_INFO, "[SHDR ID %i] Shader compiled successfully", shader);
|
||||
else TRACELOG(LOG_INFO, "[SHDR ID %i] Shader compiled successfully", shader);
|
||||
|
||||
return shader;
|
||||
}
|
||||
@ -3903,7 +3914,7 @@ static unsigned int LoadShaderProgram(unsigned int vShaderId, unsigned int fShad
|
||||
|
||||
if (success == GL_FALSE)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[SHDR ID %i] Failed to link shader program...", program);
|
||||
TRACELOG(LOG_WARNING, "[SHDR ID %i] Failed to link shader program...", program);
|
||||
|
||||
int maxLength = 0;
|
||||
int length;
|
||||
@ -3917,7 +3928,7 @@ static unsigned int LoadShaderProgram(unsigned int vShaderId, unsigned int fShad
|
||||
#endif
|
||||
glGetProgramInfoLog(program, maxLength, &length, log);
|
||||
|
||||
TraceLog(LOG_INFO, "%s", log);
|
||||
TRACELOG(LOG_INFO, "%s", log);
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
RL_FREE(log);
|
||||
@ -3926,7 +3937,7 @@ static unsigned int LoadShaderProgram(unsigned int vShaderId, unsigned int fShad
|
||||
|
||||
program = 0;
|
||||
}
|
||||
else TraceLog(LOG_INFO, "[SHDR ID %i] Shader program loaded successfully", program);
|
||||
else TRACELOG(LOG_INFO, "[SHDR ID %i] Shader program loaded successfully", program);
|
||||
#endif
|
||||
return program;
|
||||
}
|
||||
@ -4009,7 +4020,7 @@ static Shader LoadShaderDefault(void)
|
||||
|
||||
if (shader.id > 0)
|
||||
{
|
||||
TraceLog(LOG_INFO, "[SHDR ID %i] Default shader loaded successfully", shader.id);
|
||||
TRACELOG(LOG_INFO, "[SHDR ID %i] Default shader loaded successfully", shader.id);
|
||||
|
||||
// Set default shader locations: attributes locations
|
||||
shader.locs[LOC_VERTEX_POSITION] = glGetAttribLocation(shader.id, "vertexPosition");
|
||||
@ -4025,7 +4036,7 @@ static Shader LoadShaderDefault(void)
|
||||
// changed for external custom shaders, we just use direct bindings above
|
||||
//SetShaderDefaultLocations(&shader);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[SHDR ID %i] Default shader could not be loaded", shader.id);
|
||||
else TRACELOG(LOG_WARNING, "[SHDR ID %i] Default shader could not be loaded", shader.id);
|
||||
|
||||
return shader;
|
||||
}
|
||||
@ -4115,7 +4126,7 @@ static void LoadBuffersDefault(void)
|
||||
RLGL.State.vertexData[i].cCounter = 0;
|
||||
}
|
||||
|
||||
TraceLog(LOG_INFO, "Internal buffers initialized successfully (CPU)");
|
||||
TRACELOG(LOG_INFO, "Internal buffers initialized successfully (CPU)");
|
||||
//--------------------------------------------------------------------------------------------
|
||||
|
||||
// Upload to GPU (VRAM) vertex data and initialize VAOs/VBOs
|
||||
@ -4161,7 +4172,7 @@ static void LoadBuffersDefault(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
TraceLog(LOG_INFO, "Internal buffers uploaded successfully (GPU)");
|
||||
TRACELOG(LOG_INFO, "Internal buffers uploaded successfully (GPU)");
|
||||
|
||||
// Unbind the current VAO
|
||||
if (RLGL.ExtSupported.vao) glBindVertexArray(0);
|
||||
@ -4521,20 +4532,20 @@ static int GenerateMipmaps(unsigned char *data, int baseWidth, int baseHeight)
|
||||
if (width != 1) width /= 2;
|
||||
if (height != 1) height /= 2;
|
||||
|
||||
TraceLog(LOG_DEBUG, "Next mipmap size: %i x %i", width, height);
|
||||
TRACELOGD("Next mipmap size: %i x %i", width, height);
|
||||
|
||||
mipmapCount++;
|
||||
|
||||
size += (width*height*4); // Add mipmap size (in bytes)
|
||||
}
|
||||
|
||||
TraceLog(LOG_DEBUG, "Total mipmaps required: %i", mipmapCount);
|
||||
TraceLog(LOG_DEBUG, "Total size of data required: %i", size);
|
||||
TRACELOGD("Total mipmaps required: %i", mipmapCount);
|
||||
TRACELOGD("Total size of data required: %i", size);
|
||||
|
||||
unsigned char *temp = RL_REALLOC(data, size);
|
||||
|
||||
if (temp != NULL) data = temp;
|
||||
else TraceLog(LOG_WARNING, "Mipmaps required memory could not be allocated");
|
||||
else TRACELOG(LOG_WARNING, "Mipmaps required memory could not be allocated");
|
||||
|
||||
width = baseWidth;
|
||||
height = baseHeight;
|
||||
@ -4556,7 +4567,7 @@ static int GenerateMipmaps(unsigned char *data, int baseWidth, int baseHeight)
|
||||
j++;
|
||||
}
|
||||
|
||||
TraceLog(LOG_DEBUG, "Mipmap base (%ix%i)", width, height);
|
||||
TRACELOGD("Mipmap base (%ix%i)", width, height);
|
||||
|
||||
for (int mip = 1; mip < mipmapCount; mip++)
|
||||
{
|
||||
@ -4627,7 +4638,7 @@ static Color *GenNextMipmap(Color *srcData, int srcWidth, int srcHeight)
|
||||
}
|
||||
}
|
||||
|
||||
TraceLog(LOG_DEBUG, "Mipmap generated successfully (%ix%i)", width, height);
|
||||
TRACELOGD("Mipmap generated successfully (%ix%i)", width, height);
|
||||
|
||||
return mipmap;
|
||||
}
|
||||
@ -4635,7 +4646,7 @@ static Color *GenNextMipmap(Color *srcData, int srcWidth, int srcHeight)
|
||||
|
||||
#if defined(RLGL_STANDALONE)
|
||||
// Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
void TraceLog(int msgType, const char *text, ...)
|
||||
void TRACELOG(int msgType, const char *text, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, text);
|
||||
|
38
src/text.c
38
src/text.c
@ -268,7 +268,7 @@ extern void LoadFontDefault(void)
|
||||
|
||||
defaultFont.baseSize = (int)defaultFont.recs[0].height;
|
||||
|
||||
TraceLog(LOG_INFO, "[TEX ID %i] Default font loaded successfully", defaultFont.texture.id);
|
||||
TRACELOG(LOG_INFO, "[TEX ID %i] Default font loaded successfully", defaultFont.texture.id);
|
||||
}
|
||||
|
||||
// Unload raylib default font
|
||||
@ -318,7 +318,7 @@ Font LoadFont(const char *fileName)
|
||||
|
||||
if (font.texture.id == 0)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] Font could not be loaded, using default font", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Font could not be loaded, using default font", fileName);
|
||||
font = GetFontDefault();
|
||||
}
|
||||
else SetTextureFilter(font.texture, FILTER_POINT); // By default we set point filter (best performance)
|
||||
@ -435,7 +435,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
|
||||
xPosToRead = charSpacing;
|
||||
}
|
||||
|
||||
TraceLog(LOG_DEBUG, "Font data parsed correctly from image");
|
||||
TRACELOGD("Font data parsed correctly from image");
|
||||
|
||||
// NOTE: We need to remove key color borders from image to avoid weird
|
||||
// artifacts on texture scaling when using FILTER_BILINEAR or FILTER_TRILINEAR
|
||||
@ -477,7 +477,7 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
|
||||
|
||||
font.baseSize = (int)font.recs[0].height;
|
||||
|
||||
TraceLog(LOG_INFO, "Image file loaded correctly as Font");
|
||||
TRACELOG(LOG_INFO, "Image file loaded correctly as Font");
|
||||
|
||||
return font;
|
||||
}
|
||||
@ -515,7 +515,7 @@ CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int c
|
||||
|
||||
// Init font for data reading
|
||||
stbtt_fontinfo fontInfo;
|
||||
if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) TraceLog(LOG_WARNING, "Failed to init font!");
|
||||
if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) TRACELOG(LOG_WARNING, "Failed to init font!");
|
||||
|
||||
// Calculate font scale factor
|
||||
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float)fontSize);
|
||||
@ -590,17 +590,17 @@ CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int c
|
||||
int chX1, chY1, chX2, chY2;
|
||||
stbtt_GetCodepointBitmapBox(&fontInfo, ch, scaleFactor, scaleFactor, &chX1, &chY1, &chX2, &chY2);
|
||||
|
||||
TraceLog(LOG_DEBUG, "Character box measures: %i, %i, %i, %i", chX1, chY1, chX2 - chX1, chY2 - chY1);
|
||||
TraceLog(LOG_DEBUG, "Character offsetY: %i", (int)((float)ascent*scaleFactor) + chY1);
|
||||
TRACELOGD("Character box measures: %i, %i, %i, %i", chX1, chY1, chX2 - chX1, chY2 - chY1);
|
||||
TRACELOGD("Character offsetY: %i", (int)((float)ascent*scaleFactor) + chY1);
|
||||
*/
|
||||
}
|
||||
|
||||
RL_FREE(fontBuffer);
|
||||
if (genFontChars) RL_FREE(fontChars);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[%s] TTF file could not be opened", fileName);
|
||||
else TRACELOG(LOG_WARNING, "[%s] TTF file could not be opened", fileName);
|
||||
#else
|
||||
TraceLog(LOG_WARNING, "[%s] TTF support is disabled", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] TTF support is disabled", fileName);
|
||||
#endif
|
||||
|
||||
return chars;
|
||||
@ -680,7 +680,7 @@ Image GenImageFontAtlas(const CharInfo *chars, Rectangle **charRecs, int charsCo
|
||||
}
|
||||
else if (packMethod == 1) // Use Skyline rect packing algorythm (stb_pack_rect)
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Using Skyline packing algorythm!");
|
||||
TRACELOGD("Using Skyline packing algorythm!");
|
||||
|
||||
stbrp_context *context = (stbrp_context *)RL_MALLOC(sizeof(*context));
|
||||
stbrp_node *nodes = (stbrp_node *)RL_MALLOC(charsCount*sizeof(*nodes));
|
||||
@ -718,7 +718,7 @@ Image GenImageFontAtlas(const CharInfo *chars, Rectangle **charRecs, int charsCo
|
||||
}
|
||||
}
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Character could not be packed: %i", i);
|
||||
else TRACELOG(LOG_WARNING, "Character could not be packed: %i", i);
|
||||
}
|
||||
|
||||
RL_FREE(rects);
|
||||
@ -760,7 +760,7 @@ void UnloadFont(Font font)
|
||||
RL_FREE(font.chars);
|
||||
RL_FREE(font.recs);
|
||||
|
||||
TraceLog(LOG_DEBUG, "Unloaded sprite font data");
|
||||
TRACELOGD("Unloaded sprite font data");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1682,7 +1682,7 @@ static Font LoadBMFont(const char *fileName)
|
||||
|
||||
if (fntFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] FNT file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] FNT file could not be opened", fileName);
|
||||
return font;
|
||||
}
|
||||
|
||||
@ -1695,20 +1695,20 @@ static Font LoadBMFont(const char *fileName)
|
||||
searchPoint = strstr(buffer, "lineHeight");
|
||||
sscanf(searchPoint, "lineHeight=%i base=%i scaleW=%i scaleH=%i", &fontSize, &base, &texWidth, &texHeight);
|
||||
|
||||
TraceLog(LOG_DEBUG, "[%s] Font size: %i", fileName, fontSize);
|
||||
TraceLog(LOG_DEBUG, "[%s] Font texture scale: %ix%i", fileName, texWidth, texHeight);
|
||||
TRACELOGD("[%s] Font size: %i", fileName, fontSize);
|
||||
TRACELOGD("[%s] Font texture scale: %ix%i", fileName, texWidth, texHeight);
|
||||
|
||||
fgets(buffer, MAX_BUFFER_SIZE, fntFile);
|
||||
searchPoint = strstr(buffer, "file");
|
||||
sscanf(searchPoint, "file=\"%128[^\"]\"", texFileName);
|
||||
|
||||
TraceLog(LOG_DEBUG, "[%s] Font texture filename: %s", fileName, texFileName);
|
||||
TRACELOGD("[%s] Font texture filename: %s", fileName, texFileName);
|
||||
|
||||
fgets(buffer, MAX_BUFFER_SIZE, fntFile);
|
||||
searchPoint = strstr(buffer, "count");
|
||||
sscanf(searchPoint, "count=%i", &charsCount);
|
||||
|
||||
TraceLog(LOG_DEBUG, "[%s] Font num chars: %i", fileName, charsCount);
|
||||
TRACELOGD("[%s] Font num chars: %i", fileName, charsCount);
|
||||
|
||||
// Compose correct path using route of .fnt file (fileName) and texFileName
|
||||
char *texPath = NULL;
|
||||
@ -1728,7 +1728,7 @@ static Font LoadBMFont(const char *fileName)
|
||||
strncat(texPath, fileName, strlen(fileName) - strlen(lastSlash) + 1);
|
||||
strncat(texPath, texFileName, strlen(texFileName));
|
||||
|
||||
TraceLog(LOG_DEBUG, "[%s] Font texture loading path: %s", fileName, texPath);
|
||||
TRACELOGD("[%s] Font texture loading path: %s", fileName, texPath);
|
||||
|
||||
Image imFont = LoadImage(texPath);
|
||||
|
||||
@ -1779,7 +1779,7 @@ static Font LoadBMFont(const char *fileName)
|
||||
UnloadFont(font);
|
||||
font = GetFontDefault();
|
||||
}
|
||||
else TraceLog(LOG_INFO, "[%s] Font loaded successfully", fileName);
|
||||
else TRACELOG(LOG_INFO, "[%s] Font loaded successfully", fileName);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
142
src/textures.c
142
src/textures.c
@ -269,7 +269,7 @@ Image LoadImage(const char *fileName)
|
||||
else if (imgBpp == 4) image.format = UNCOMPRESSED_R32G32B32A32;
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] Image fileformat not supported", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Image fileformat not supported", fileName);
|
||||
UnloadImage(image);
|
||||
}
|
||||
}
|
||||
@ -289,10 +289,10 @@ Image LoadImage(const char *fileName)
|
||||
#if defined(SUPPORT_FILEFORMAT_ASTC)
|
||||
else if (IsFileExtension(fileName, ".astc")) image = LoadASTC(fileName);
|
||||
#endif
|
||||
else TraceLog(LOG_WARNING, "[%s] Image fileformat not supported", fileName);
|
||||
else TRACELOG(LOG_WARNING, "[%s] Image fileformat not supported", fileName);
|
||||
|
||||
if (image.data != NULL) TraceLog(LOG_INFO, "[%s] Image loaded successfully (%ix%i)", fileName, image.width, image.height);
|
||||
else TraceLog(LOG_WARNING, "[%s] Image could not be loaded", fileName);
|
||||
if (image.data != NULL) TRACELOG(LOG_INFO, "[%s] Image loaded successfully (%ix%i)", fileName, image.width, image.height);
|
||||
else TRACELOG(LOG_WARNING, "[%s] Image could not be loaded", fileName);
|
||||
|
||||
return image;
|
||||
}
|
||||
@ -350,7 +350,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
|
||||
|
||||
if (rawFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] RAW image file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] RAW image file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -367,7 +367,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
|
||||
// Check if data has been read successfully
|
||||
if (bytes < size)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] RAW image data can not be read, wrong requested format or size", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] RAW image data can not be read, wrong requested format or size", fileName);
|
||||
|
||||
RL_FREE(image.data);
|
||||
}
|
||||
@ -397,7 +397,7 @@ Texture2D LoadTexture(const char *fileName)
|
||||
texture = LoadTextureFromImage(image);
|
||||
UnloadImage(image);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Texture could not be created");
|
||||
else TRACELOG(LOG_WARNING, "Texture could not be created");
|
||||
|
||||
return texture;
|
||||
}
|
||||
@ -412,7 +412,7 @@ Texture2D LoadTextureFromImage(Image image)
|
||||
{
|
||||
texture.id = rlLoadTexture(image.data, image.width, image.height, image.format, image.mipmaps);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Texture could not be loaded from Image");
|
||||
else TRACELOG(LOG_WARNING, "Texture could not be loaded from Image");
|
||||
|
||||
texture.width = image.width;
|
||||
texture.height = image.height;
|
||||
@ -444,7 +444,7 @@ void UnloadTexture(Texture2D texture)
|
||||
{
|
||||
rlDeleteTextures(texture.id);
|
||||
|
||||
TraceLog(LOG_INFO, "[TEX ID %i] Unloaded texture data from VRAM (GPU)", texture.id);
|
||||
TRACELOG(LOG_INFO, "[TEX ID %i] Unloaded texture data from VRAM (GPU)", texture.id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,12 +461,12 @@ Color *GetImageData(Image image)
|
||||
|
||||
Color *pixels = (Color *)RL_MALLOC(image.width*image.height*sizeof(Color));
|
||||
|
||||
if (image.format >= COMPRESSED_DXT1_RGB) TraceLog(LOG_WARNING, "Pixel data retrieval not supported for compressed image formats");
|
||||
if (image.format >= COMPRESSED_DXT1_RGB) TRACELOG(LOG_WARNING, "Pixel data retrieval not supported for compressed image formats");
|
||||
else
|
||||
{
|
||||
if ((image.format == UNCOMPRESSED_R32) ||
|
||||
(image.format == UNCOMPRESSED_R32G32B32) ||
|
||||
(image.format == UNCOMPRESSED_R32G32B32A32)) TraceLog(LOG_WARNING, "32bit pixel format converted to 8bit per channel");
|
||||
(image.format == UNCOMPRESSED_R32G32B32A32)) TRACELOG(LOG_WARNING, "32bit pixel format converted to 8bit per channel");
|
||||
|
||||
for (int i = 0, k = 0; i < image.width*image.height; i++)
|
||||
{
|
||||
@ -576,7 +576,7 @@ Vector4 *GetImageDataNormalized(Image image)
|
||||
{
|
||||
Vector4 *pixels = (Vector4 *)RL_MALLOC(image.width*image.height*sizeof(Vector4));
|
||||
|
||||
if (image.format >= COMPRESSED_DXT1_RGB) TraceLog(LOG_WARNING, "Pixel data retrieval not supported for compressed image formats");
|
||||
if (image.format >= COMPRESSED_DXT1_RGB) TRACELOG(LOG_WARNING, "Pixel data retrieval not supported for compressed image formats");
|
||||
else
|
||||
{
|
||||
for (int i = 0, k = 0; i < image.width*image.height; i++)
|
||||
@ -783,11 +783,11 @@ Image GetTextureData(Texture2D texture)
|
||||
// original texture format is retrieved on RPI...
|
||||
image.format = UNCOMPRESSED_R8G8B8A8;
|
||||
#endif
|
||||
TraceLog(LOG_INFO, "Texture pixel data obtained successfully");
|
||||
TRACELOG(LOG_INFO, "Texture pixel data obtained successfully");
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Texture pixel data could not be obtained");
|
||||
else TRACELOG(LOG_WARNING, "Texture pixel data could not be obtained");
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Compressed texture data could not be obtained");
|
||||
else TRACELOG(LOG_WARNING, "Compressed texture data could not be obtained");
|
||||
|
||||
return image;
|
||||
}
|
||||
@ -852,8 +852,8 @@ void ExportImage(Image image, const char *fileName)
|
||||
RL_FREE(imgData);
|
||||
#endif
|
||||
|
||||
if (success != 0) TraceLog(LOG_INFO, "Image exported successfully: %s", fileName);
|
||||
else TraceLog(LOG_WARNING, "Image could not be exported.");
|
||||
if (success != 0) TRACELOG(LOG_INFO, "Image exported successfully: %s", fileName);
|
||||
else TRACELOG(LOG_WARNING, "Image could not be exported.");
|
||||
}
|
||||
|
||||
// Export image as code file (.h) defining an array of bytes
|
||||
@ -977,7 +977,7 @@ void ImageToPOT(Image *image, Color fillColor)
|
||||
}
|
||||
}
|
||||
|
||||
TraceLog(LOG_WARNING, "Image converted to POT: (%ix%i) -> (%ix%i)", image->width, image->height, potWidth, potHeight);
|
||||
TRACELOG(LOG_WARNING, "Image converted to POT: (%ix%i) -> (%ix%i)", image->width, image->height, potWidth, potHeight);
|
||||
|
||||
RL_FREE(pixels); // Free pixels data
|
||||
RL_FREE(image->data); // Free old image data
|
||||
@ -1167,7 +1167,7 @@ void ImageFormat(Image *image, int newFormat)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Image data format is compressed, can not be converted");
|
||||
else TRACELOG(LOG_WARNING, "Image data format is compressed, can not be converted");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1178,11 +1178,11 @@ void ImageAlphaMask(Image *image, Image alphaMask)
|
||||
{
|
||||
if ((image->width != alphaMask.width) || (image->height != alphaMask.height))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Alpha mask must be same size as image");
|
||||
TRACELOG(LOG_WARNING, "Alpha mask must be same size as image");
|
||||
}
|
||||
else if (image->format >= COMPRESSED_DXT1_RGB)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Alpha mask can not be applied to compressed data formats");
|
||||
TRACELOG(LOG_WARNING, "Alpha mask can not be applied to compressed data formats");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1340,11 +1340,11 @@ TextureCubemap LoadTextureCubemap(Image image, int layoutType)
|
||||
for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, size*i, size, size }, WHITE);
|
||||
|
||||
cubemap.id = rlLoadTextureCubemap(faces.data, size, faces.format);
|
||||
if (cubemap.id == 0) TraceLog(LOG_WARNING, "Cubemap image could not be loaded.");
|
||||
if (cubemap.id == 0) TRACELOG(LOG_WARNING, "Cubemap image could not be loaded.");
|
||||
|
||||
UnloadImage(faces);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Cubemap image layout can not be detected.");
|
||||
else TRACELOG(LOG_WARNING, "Cubemap image layout can not be detected.");
|
||||
|
||||
return cubemap;
|
||||
}
|
||||
@ -1389,7 +1389,7 @@ void ImageCrop(Image *image, Rectangle crop)
|
||||
// Reformat 32bit RGBA image to original format
|
||||
ImageFormat(image, format);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Image can not be cropped, crop rectangle out of bounds");
|
||||
else TRACELOG(LOG_WARNING, "Image can not be cropped, crop rectangle out of bounds");
|
||||
}
|
||||
|
||||
// Crop image depending on alpha value
|
||||
@ -1592,15 +1592,15 @@ void ImageMipmaps(Image *image)
|
||||
if (mipWidth < 1) mipWidth = 1;
|
||||
if (mipHeight < 1) mipHeight = 1;
|
||||
|
||||
TraceLog(LOG_DEBUG, "Next mipmap level: %i x %i - current size %i", mipWidth, mipHeight, mipSize);
|
||||
TRACELOGD("Next mipmap level: %i x %i - current size %i", mipWidth, mipHeight, mipSize);
|
||||
|
||||
mipCount++;
|
||||
mipSize += GetPixelDataSize(mipWidth, mipHeight, image->format); // Add mipmap size (in bytes)
|
||||
}
|
||||
|
||||
TraceLog(LOG_DEBUG, "Mipmaps available: %i - Mipmaps required: %i", image->mipmaps, mipCount);
|
||||
TraceLog(LOG_DEBUG, "Mipmaps total size required: %i", mipSize);
|
||||
TraceLog(LOG_DEBUG, "Image data memory start address: 0x%x", image->data);
|
||||
TRACELOGD("Mipmaps available: %i - Mipmaps required: %i", image->mipmaps, mipCount);
|
||||
TRACELOGD("Mipmaps total size required: %i", mipSize);
|
||||
TRACELOGD("Image data memory start address: 0x%x", image->data);
|
||||
|
||||
if (image->mipmaps < mipCount)
|
||||
{
|
||||
@ -1609,9 +1609,9 @@ void ImageMipmaps(Image *image)
|
||||
if (temp != NULL)
|
||||
{
|
||||
image->data = temp; // Assign new pointer (new size) to store mipmaps data
|
||||
TraceLog(LOG_DEBUG, "Image data memory point reallocated: 0x%x", temp);
|
||||
TRACELOGD("Image data memory point reallocated: 0x%x", temp);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Mipmaps required memory could not be allocated");
|
||||
else TRACELOG(LOG_WARNING, "Mipmaps required memory could not be allocated");
|
||||
|
||||
// Pointer to allocated memory point where store next mipmap level data
|
||||
unsigned char *nextmip = (unsigned char *)image->data + GetPixelDataSize(image->width, image->height, image->format);
|
||||
@ -1623,7 +1623,7 @@ void ImageMipmaps(Image *image)
|
||||
|
||||
for (int i = 1; i < mipCount; i++)
|
||||
{
|
||||
TraceLog(LOG_DEBUG, "Gen mipmap level: %i (%i x %i) - size: %i - offset: 0x%x", i, mipWidth, mipHeight, mipSize, nextmip);
|
||||
TRACELOGD("Gen mipmap level: %i (%i x %i) - size: %i - offset: 0x%x", i, mipWidth, mipHeight, mipSize, nextmip);
|
||||
|
||||
ImageResize(&imCopy, mipWidth, mipHeight); // Uses internally Mitchell cubic downscale filter
|
||||
|
||||
@ -1643,7 +1643,7 @@ void ImageMipmaps(Image *image)
|
||||
|
||||
UnloadImage(imCopy);
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "Image mipmaps already available");
|
||||
else TRACELOG(LOG_WARNING, "Image mipmaps already available");
|
||||
}
|
||||
|
||||
// Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
@ -1656,13 +1656,13 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
||||
|
||||
if (image->format >= COMPRESSED_DXT1_RGB)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Compressed data formats can not be dithered");
|
||||
TRACELOG(LOG_WARNING, "Compressed data formats can not be dithered");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((rBpp + gBpp + bBpp + aBpp) > 16)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Unsupported dithering bpps (%ibpp), only 16bpp or lower modes supported", (rBpp+gBpp+bBpp+aBpp));
|
||||
TRACELOG(LOG_WARNING, "Unsupported dithering bpps (%ibpp), only 16bpp or lower modes supported", (rBpp+gBpp+bBpp+aBpp));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1672,7 +1672,7 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
||||
|
||||
if ((image->format != UNCOMPRESSED_R8G8B8) && (image->format != UNCOMPRESSED_R8G8B8A8))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "Image format is already 16bpp or lower, dithering could have no effect");
|
||||
TRACELOG(LOG_WARNING, "Image format is already 16bpp or lower, dithering could have no effect");
|
||||
}
|
||||
|
||||
// Define new image format, check if desired bpp match internal known format
|
||||
@ -1682,7 +1682,7 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
|
||||
else
|
||||
{
|
||||
image->format = 0;
|
||||
TraceLog(LOG_WARNING, "Unsupported dithered OpenGL internal format: %ibpp (R%iG%iB%iA%i)", (rBpp+gBpp+bBpp+aBpp), rBpp, gBpp, bBpp, aBpp);
|
||||
TRACELOG(LOG_WARNING, "Unsupported dithered OpenGL internal format: %ibpp (R%iG%iB%iA%i)", (rBpp+gBpp+bBpp+aBpp), rBpp, gBpp, bBpp, aBpp);
|
||||
}
|
||||
|
||||
// NOTE: We will store the dithered data as unsigned short (16bpp)
|
||||
@ -1796,7 +1796,7 @@ Color *ImageExtractPalette(Image image, int maxPaletteSize, int *extractCount)
|
||||
if (palCount >= maxPaletteSize)
|
||||
{
|
||||
i = image.width*image.height; // Finish palette get
|
||||
TraceLog(LOG_WARNING, "Image palette is greater than %i colors!", maxPaletteSize);
|
||||
TRACELOG(LOG_WARNING, "Image palette is greater than %i colors!", maxPaletteSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1825,13 +1825,13 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color
|
||||
if ((srcRec.x + srcRec.width) > src.width)
|
||||
{
|
||||
srcRec.width = src.width - srcRec.x;
|
||||
TraceLog(LOG_WARNING, "Source rectangle width out of bounds, rescaled width: %i", srcRec.width);
|
||||
TRACELOG(LOG_WARNING, "Source rectangle width out of bounds, rescaled width: %i", srcRec.width);
|
||||
}
|
||||
|
||||
if ((srcRec.y + srcRec.height) > src.height)
|
||||
{
|
||||
srcRec.height = src.height - srcRec.y;
|
||||
TraceLog(LOG_WARNING, "Source rectangle height out of bounds, rescaled height: %i", srcRec.height);
|
||||
TRACELOG(LOG_WARNING, "Source rectangle height out of bounds, rescaled height: %i", srcRec.height);
|
||||
}
|
||||
|
||||
Image srcCopy = ImageCopy(src); // Make a copy of source image to work with it
|
||||
@ -1987,7 +1987,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
|
||||
if (fontSize > imSize.y)
|
||||
{
|
||||
float scaleFactor = fontSize/imSize.y;
|
||||
TraceLog(LOG_INFO, "Image text scaled by factor: %f", scaleFactor);
|
||||
TRACELOG(LOG_INFO, "Image text scaled by factor: %f", scaleFactor);
|
||||
|
||||
// Using nearest-neighbor scaling algorithm for default font
|
||||
if (font.texture.id == GetFontDefault().texture.id) ImageResizeNN(&imText, (int)(imSize.x*scaleFactor), (int)(imSize.y*scaleFactor));
|
||||
@ -2635,7 +2635,7 @@ void SetTextureFilter(Texture2D texture, int filterMode)
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[TEX ID %i] No mipmaps available for TRILINEAR texture filtering", texture.id);
|
||||
TRACELOG(LOG_WARNING, "[TEX ID %i] No mipmaps available for TRILINEAR texture filtering", texture.id);
|
||||
|
||||
// RL_FILTER_LINEAR - tex filter: BILINEAR, no mipmaps
|
||||
rlTextureParameters(texture.id, RL_TEXTURE_MIN_FILTER, RL_FILTER_LINEAR);
|
||||
@ -2986,7 +2986,7 @@ static Image LoadAnimatedGIF(const char *fileName, int *frames, int **delays)
|
||||
|
||||
if (gifFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] Animated GIF file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] Animated GIF file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3065,7 +3065,7 @@ static Image LoadDDS(const char *fileName)
|
||||
|
||||
if (ddsFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] DDS file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] DDS file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3076,7 +3076,7 @@ static Image LoadDDS(const char *fileName)
|
||||
|
||||
if ((ddsHeaderId[0] != 'D') || (ddsHeaderId[1] != 'D') || (ddsHeaderId[2] != 'S') || (ddsHeaderId[3] != ' '))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] DDS file does not seem to be a valid image", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] DDS file does not seem to be a valid image", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3085,11 +3085,11 @@ static Image LoadDDS(const char *fileName)
|
||||
// Get the image header
|
||||
fread(&ddsHeader, sizeof(DDSHeader), 1, ddsFile);
|
||||
|
||||
TraceLog(LOG_DEBUG, "[%s] DDS file header size: %i", fileName, sizeof(DDSHeader));
|
||||
TraceLog(LOG_DEBUG, "[%s] DDS file pixel format size: %i", fileName, ddsHeader.ddspf.size);
|
||||
TraceLog(LOG_DEBUG, "[%s] DDS file pixel format flags: 0x%x", fileName, ddsHeader.ddspf.flags);
|
||||
TraceLog(LOG_DEBUG, "[%s] DDS file format: 0x%x", fileName, ddsHeader.ddspf.fourCC);
|
||||
TraceLog(LOG_DEBUG, "[%s] DDS file bit count: 0x%x", fileName, ddsHeader.ddspf.rgbBitCount);
|
||||
TRACELOGD("[%s] DDS file header size: %i", fileName, sizeof(DDSHeader));
|
||||
TRACELOGD("[%s] DDS file pixel format size: %i", fileName, ddsHeader.ddspf.size);
|
||||
TRACELOGD("[%s] DDS file pixel format flags: 0x%x", fileName, ddsHeader.ddspf.flags);
|
||||
TRACELOGD("[%s] DDS file format: 0x%x", fileName, ddsHeader.ddspf.fourCC);
|
||||
TRACELOGD("[%s] DDS file bit count: 0x%x", fileName, ddsHeader.ddspf.rgbBitCount);
|
||||
|
||||
image.width = ddsHeader.width;
|
||||
image.height = ddsHeader.height;
|
||||
@ -3179,7 +3179,7 @@ static Image LoadDDS(const char *fileName)
|
||||
if (ddsHeader.mipmapCount > 1) size = ddsHeader.pitchOrLinearSize*2;
|
||||
else size = ddsHeader.pitchOrLinearSize;
|
||||
|
||||
TraceLog(LOG_DEBUG, "Pitch or linear size: %i", ddsHeader.pitchOrLinearSize);
|
||||
TRACELOGD("Pitch or linear size: %i", ddsHeader.pitchOrLinearSize);
|
||||
|
||||
image.data = (unsigned char *)RL_MALLOC(size*sizeof(unsigned char));
|
||||
|
||||
@ -3245,7 +3245,7 @@ static Image LoadPKM(const char *fileName)
|
||||
|
||||
if (pkmFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] PKM file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] PKM file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3256,7 +3256,7 @@ static Image LoadPKM(const char *fileName)
|
||||
|
||||
if ((pkmHeader.id[0] != 'P') || (pkmHeader.id[1] != 'K') || (pkmHeader.id[2] != 'M') || (pkmHeader.id[3] != ' '))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] PKM file does not seem to be a valid image", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] PKM file does not seem to be a valid image", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3265,9 +3265,9 @@ static Image LoadPKM(const char *fileName)
|
||||
pkmHeader.width = ((pkmHeader.width & 0x00FF) << 8) | ((pkmHeader.width & 0xFF00) >> 8);
|
||||
pkmHeader.height = ((pkmHeader.height & 0x00FF) << 8) | ((pkmHeader.height & 0xFF00) >> 8);
|
||||
|
||||
TraceLog(LOG_DEBUG, "PKM (ETC) image width: %i", pkmHeader.width);
|
||||
TraceLog(LOG_DEBUG, "PKM (ETC) image height: %i", pkmHeader.height);
|
||||
TraceLog(LOG_DEBUG, "PKM (ETC) image format: %i", pkmHeader.format);
|
||||
TRACELOGD("PKM (ETC) image width: %i", pkmHeader.width);
|
||||
TRACELOGD("PKM (ETC) image height: %i", pkmHeader.height);
|
||||
TRACELOGD("PKM (ETC) image format: %i", pkmHeader.format);
|
||||
|
||||
image.width = pkmHeader.width;
|
||||
image.height = pkmHeader.height;
|
||||
@ -3338,7 +3338,7 @@ static Image LoadKTX(const char *fileName)
|
||||
|
||||
if (ktxFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] KTX image file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] KTX image file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3350,7 +3350,7 @@ static Image LoadKTX(const char *fileName)
|
||||
if ((ktxHeader.id[1] != 'K') || (ktxHeader.id[2] != 'T') || (ktxHeader.id[3] != 'X') ||
|
||||
(ktxHeader.id[4] != ' ') || (ktxHeader.id[5] != '1') || (ktxHeader.id[6] != '1'))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] KTX file does not seem to be a valid file", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] KTX file does not seem to be a valid file", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3358,9 +3358,9 @@ static Image LoadKTX(const char *fileName)
|
||||
image.height = ktxHeader.height;
|
||||
image.mipmaps = ktxHeader.mipmapLevels;
|
||||
|
||||
TraceLog(LOG_DEBUG, "KTX (ETC) image width: %i", ktxHeader.width);
|
||||
TraceLog(LOG_DEBUG, "KTX (ETC) image height: %i", ktxHeader.height);
|
||||
TraceLog(LOG_DEBUG, "KTX (ETC) image format: 0x%x", ktxHeader.glInternalFormat);
|
||||
TRACELOGD("KTX (ETC) image width: %i", ktxHeader.width);
|
||||
TRACELOGD("KTX (ETC) image height: %i", ktxHeader.height);
|
||||
TRACELOGD("KTX (ETC) image format: 0x%x", ktxHeader.glInternalFormat);
|
||||
|
||||
unsigned char unused;
|
||||
|
||||
@ -3420,7 +3420,7 @@ static int SaveKTX(Image image, const char *fileName)
|
||||
|
||||
FILE *ktxFile = fopen(fileName, "wb");
|
||||
|
||||
if (ktxFile == NULL) TraceLog(LOG_WARNING, "[%s] KTX image file could not be created", fileName);
|
||||
if (ktxFile == NULL) TRACELOG(LOG_WARNING, "[%s] KTX image file could not be created", fileName);
|
||||
else
|
||||
{
|
||||
KTXHeader ktxHeader;
|
||||
@ -3452,7 +3452,7 @@ static int SaveKTX(Image image, const char *fileName)
|
||||
|
||||
// NOTE: We can save into a .ktx all PixelFormats supported by raylib, including compressed formats like DXT, ETC or ASTC
|
||||
|
||||
if (ktxHeader.glFormat == -1) TraceLog(LOG_WARNING, "Image format not supported for KTX export.");
|
||||
if (ktxHeader.glFormat == -1) TRACELOG(LOG_WARNING, "Image format not supported for KTX export.");
|
||||
else
|
||||
{
|
||||
success = fwrite(&ktxHeader, sizeof(KTXHeader), 1, ktxFile);
|
||||
@ -3547,7 +3547,7 @@ static Image LoadPVR(const char *fileName)
|
||||
|
||||
if (pvrFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] PVR file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] PVR file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3566,7 +3566,7 @@ static Image LoadPVR(const char *fileName)
|
||||
|
||||
if ((pvrHeader.id[0] != 'P') || (pvrHeader.id[1] != 'V') || (pvrHeader.id[2] != 'R') || (pvrHeader.id[3] != 3))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] PVR file does not seem to be a valid image", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] PVR file does not seem to be a valid image", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3627,7 +3627,7 @@ static Image LoadPVR(const char *fileName)
|
||||
fread(image.data, dataSize, 1, pvrFile);
|
||||
}
|
||||
}
|
||||
else if (pvrVersion == 52) TraceLog(LOG_INFO, "PVR v2 not supported, update your files to PVR v3");
|
||||
else if (pvrVersion == 52) TRACELOG(LOG_INFO, "PVR v2 not supported, update your files to PVR v3");
|
||||
|
||||
fclose(pvrFile); // Close file pointer
|
||||
}
|
||||
@ -3665,7 +3665,7 @@ static Image LoadASTC(const char *fileName)
|
||||
|
||||
if (astcFile == NULL)
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] ASTC file could not be opened", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] ASTC file could not be opened", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3676,7 +3676,7 @@ static Image LoadASTC(const char *fileName)
|
||||
|
||||
if ((astcHeader.id[3] != 0x5c) || (astcHeader.id[2] != 0xa1) || (astcHeader.id[1] != 0xab) || (astcHeader.id[0] != 0x13))
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[%s] ASTC file does not seem to be a valid image", fileName);
|
||||
TRACELOG(LOG_WARNING, "[%s] ASTC file does not seem to be a valid image", fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3684,9 +3684,9 @@ static Image LoadASTC(const char *fileName)
|
||||
image.width = 0x00000000 | ((int)astcHeader.width[2] << 16) | ((int)astcHeader.width[1] << 8) | ((int)astcHeader.width[0]);
|
||||
image.height = 0x00000000 | ((int)astcHeader.height[2] << 16) | ((int)astcHeader.height[1] << 8) | ((int)astcHeader.height[0]);
|
||||
|
||||
TraceLog(LOG_DEBUG, "ASTC image width: %i", image.width);
|
||||
TraceLog(LOG_DEBUG, "ASTC image height: %i", image.height);
|
||||
TraceLog(LOG_DEBUG, "ASTC image blocks: %ix%i", astcHeader.blockX, astcHeader.blockY);
|
||||
TRACELOGD("ASTC image width: %i", image.width);
|
||||
TRACELOGD("ASTC image height: %i", image.height);
|
||||
TRACELOGD("ASTC image blocks: %ix%i", astcHeader.blockX, astcHeader.blockY);
|
||||
|
||||
image.mipmaps = 1; // NOTE: ASTC format only contains one mipmap level
|
||||
|
||||
@ -3704,7 +3704,7 @@ static Image LoadASTC(const char *fileName)
|
||||
if (bpp == 8) image.format = COMPRESSED_ASTC_4x4_RGBA;
|
||||
else if (bpp == 2) image.format = COMPRESSED_ASTC_8x8_RGBA;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[%s] ASTC block size configuration not supported", fileName);
|
||||
else TRACELOG(LOG_WARNING, "[%s] ASTC block size configuration not supported", fileName);
|
||||
}
|
||||
|
||||
fclose(astcFile);
|
||||
|
@ -195,7 +195,7 @@ static int android_read(void *cookie, char *buf, int size)
|
||||
|
||||
static int android_write(void *cookie, const char *buf, int size)
|
||||
{
|
||||
TraceLog(LOG_ERROR, "Can't provide write access to the APK");
|
||||
TRACELOG(LOG_ERROR, "Can't provide write access to the APK");
|
||||
|
||||
return EACCES;
|
||||
}
|
||||
@ -252,7 +252,7 @@ void UWPSendMessage(UWPMessage *msg)
|
||||
UWPInMessageId++;
|
||||
UWPInMessages[UWPInMessageId] = msg;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[UWP Messaging] Not enough array space to register new UWP inbound Message.");
|
||||
else TRACELOG(LOG_WARNING, "[UWP Messaging] Not enough array space to register new UWP inbound Message.");
|
||||
}
|
||||
|
||||
void SendMessageToUWP(UWPMessage *msg)
|
||||
@ -262,7 +262,7 @@ void SendMessageToUWP(UWPMessage *msg)
|
||||
UWPOutMessageId++;
|
||||
UWPOutMessages[UWPOutMessageId] = msg;
|
||||
}
|
||||
else TraceLog(LOG_WARNING, "[UWP Messaging] Not enough array space to register new UWP outward Message.");
|
||||
else TRACELOG(LOG_WARNING, "[UWP Messaging] Not enough array space to register new UWP outward Message.");
|
||||
}
|
||||
|
||||
bool HasMessageFromUWP(void)
|
||||
|
@ -38,10 +38,11 @@
|
||||
#if defined(SUPPORT_TRACELOG_DEBUG)
|
||||
#define TRACELOGD(...) TraceLog(LOG_DEBUG, __VA_ARGS__)
|
||||
#else
|
||||
#define TRACELOGD(...) void(0)
|
||||
#define TRACELOGD(...) (void)0
|
||||
#endif
|
||||
#else
|
||||
#define TRACELOG(level, ...) void(0)
|
||||
#define TRACELOG(level, ...) (void)0
|
||||
#define TRACELOGD(...) (void)0
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user