Merge branch 'master' into overridable_config
This commit is contained in:
commit
2beb15b7b4
|
|
@ -95,11 +95,19 @@ int main(void)
|
||||||
|
|
||||||
rlEnableFramebuffer(gBuffer.framebuffer);
|
rlEnableFramebuffer(gBuffer.framebuffer);
|
||||||
|
|
||||||
// Since we are storing position and normal data in these textures,
|
// NOTE: Vertex positions are stored in a texture for simplicity. A better approach would use a depth texture
|
||||||
// we need to use a floating point format.
|
// (instead of a detph renderbuffer) to reconstruct world positions in the final render shader via clip-space position,
|
||||||
gBuffer.positionTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32, 1);
|
// depth, and the inverse view/projection matrices.
|
||||||
|
|
||||||
|
// 16-bit precision ensures OpenGL ES 3 compatibility, though it may lack precision for real scenarios.
|
||||||
|
// But as mentioned above, the positions could be reconstructed instead of stored. If not targeting OpenGL ES
|
||||||
|
// and you wish to maintain this approach, consider using `RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32`.
|
||||||
|
gBuffer.positionTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, 1);
|
||||||
|
|
||||||
|
// Similarly, 16-bit precision is used for normals ensures OpenGL ES 3 compatibility.
|
||||||
|
// This is generally sufficient, but a 16-bit fixed-point format offer a better uniform precision in all orientations.
|
||||||
|
gBuffer.normalTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, 1);
|
||||||
|
|
||||||
gBuffer.normalTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32, 1);
|
|
||||||
// Albedo (diffuse color) and specular strength can be combined into one texture.
|
// Albedo (diffuse color) and specular strength can be combined into one texture.
|
||||||
// The color in RGB, and the specular strength in the alpha channel.
|
// The color in RGB, and the specular strength in the alpha channel.
|
||||||
gBuffer.albedoSpecTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1);
|
gBuffer.albedoSpecTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,6 @@
|
||||||
#------------------------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------------------------
|
||||||
# Define target platform
|
# Define target platform
|
||||||
PLATFORM ?= PLATFORM_DESKTOP
|
PLATFORM ?= PLATFORM_DESKTOP
|
||||||
|
|
||||||
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM), PLATFORM_DESKTOP)
|
||||||
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
|
TARGET_PLATFORM = PLATFORM_DESKTOP_GLFW
|
||||||
else
|
else
|
||||||
|
|
@ -122,7 +121,6 @@ SDL_INCLUDE_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/include
|
||||||
SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/lib
|
SDL_LIBRARY_PATH ?= $(RAYLIB_SRC_PATH)/external/SDL2/lib
|
||||||
SDL_LIBRARIES ?= -lSDL2 -lSDL2main
|
SDL_LIBRARIES ?= -lSDL2 -lSDL2main
|
||||||
|
|
||||||
|
|
||||||
# Determine if the file has root access (only required to install raylib)
|
# Determine if the file has root access (only required to install raylib)
|
||||||
# "whoami" prints the name of the user that calls him (so, if it is the root user, "whoami" prints "root")
|
# "whoami" prints the name of the user that calls him (so, if it is the root user, "whoami" prints "root")
|
||||||
ROOT = $(shell whoami)
|
ROOT = $(shell whoami)
|
||||||
|
|
|
||||||
|
|
@ -627,7 +627,7 @@ int SetGamepadMappings(const char *mappings)
|
||||||
// Set gamepad vibration
|
// Set gamepad vibration
|
||||||
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GamepadSetVibration() not implemented on target platform");
|
TRACELOG(LOG_WARNING, "SetGamepadVibration() not implemented on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse position XY
|
// Set mouse position XY
|
||||||
|
|
|
||||||
|
|
@ -1088,7 +1088,7 @@ int SetGamepadMappings(const char *mappings)
|
||||||
// Set gamepad vibration
|
// Set gamepad vibration
|
||||||
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GamepadSetVibration() not available on target platform");
|
TRACELOG(LOG_WARNING, "SetGamepadVibration() not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse position XY
|
// Set mouse position XY
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,6 @@ static const unsigned short keyMappingRGFW[] = {
|
||||||
[RGFW_SuperL] = KEY_LEFT_SUPER,
|
[RGFW_SuperL] = KEY_LEFT_SUPER,
|
||||||
#ifndef RGFW_MACOS
|
#ifndef RGFW_MACOS
|
||||||
[RGFW_ShiftR] = KEY_RIGHT_SHIFT,
|
[RGFW_ShiftR] = KEY_RIGHT_SHIFT,
|
||||||
|
|
||||||
[RGFW_AltR] = KEY_RIGHT_ALT,
|
[RGFW_AltR] = KEY_RIGHT_ALT,
|
||||||
#endif
|
#endif
|
||||||
[RGFW_Space] = KEY_SPACE,
|
[RGFW_Space] = KEY_SPACE,
|
||||||
|
|
@ -675,7 +674,7 @@ const char *GetClipboardText(void)
|
||||||
return RGFW_readClipboard(NULL);
|
return RGFW_readClipboard(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SUPPORT_CLIPBOARD_IMAGE
|
#if defined(SUPPORT_CLIPBOARD_IMAGE)
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define WIN32_CLIPBOARD_IMPLEMENTATION
|
#define WIN32_CLIPBOARD_IMPLEMENTATION
|
||||||
#define WINUSER_ALREADY_INCLUDED
|
#define WINUSER_ALREADY_INCLUDED
|
||||||
|
|
@ -692,10 +691,10 @@ Image GetClipboardImage(void)
|
||||||
|
|
||||||
#if SUPPORT_CLIPBOARD_IMAGE
|
#if SUPPORT_CLIPBOARD_IMAGE
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
int width = 0;
|
||||||
|
int height = 0;
|
||||||
unsigned long long int dataSize = 0;
|
unsigned long long int dataSize = 0;
|
||||||
void *fileData = NULL;
|
void *fileData = (void *)Win32GetClipboardImageData(&width, &height, &dataSize);
|
||||||
int width, height;
|
|
||||||
fileData = (void *)Win32GetClipboardImageData(&width, &height, &dataSize);
|
|
||||||
|
|
||||||
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
|
if (fileData == NULL) TRACELOG(LOG_WARNING, "Clipboard image: Couldn't get clipboard data.");
|
||||||
else image = LoadImageFromMemory(".bmp", fileData, dataSize);
|
else image = LoadImageFromMemory(".bmp", fileData, dataSize);
|
||||||
|
|
@ -737,9 +736,7 @@ void EnableCursor(void)
|
||||||
void DisableCursor(void)
|
void DisableCursor(void)
|
||||||
{
|
{
|
||||||
RGFW_disableCursor = true;
|
RGFW_disableCursor = true;
|
||||||
|
|
||||||
RGFW_window_mouseHold(platform.window, RGFW_AREA(0, 0));
|
RGFW_window_mouseHold(platform.window, RGFW_AREA(0, 0));
|
||||||
|
|
||||||
HideCursor();
|
HideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -792,7 +789,7 @@ int SetGamepadMappings(const char *mappings)
|
||||||
// Set gamepad vibration
|
// Set gamepad vibration
|
||||||
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GamepadSetVibration() not available on target platform");
|
TRACELOG(LOG_WARNING, "SetGamepadVibration() not available on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse position XY
|
// Set mouse position XY
|
||||||
|
|
@ -870,6 +867,7 @@ char RSGL_keystrToChar(const char *str)
|
||||||
return '\0';
|
return '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gamepad buttons conversion table
|
||||||
int RGFW_gpConvTable[18] = {
|
int RGFW_gpConvTable[18] = {
|
||||||
[RGFW_GP_Y] = GAMEPAD_BUTTON_RIGHT_FACE_UP,
|
[RGFW_GP_Y] = GAMEPAD_BUTTON_RIGHT_FACE_UP,
|
||||||
[RGFW_GP_B] = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT,
|
[RGFW_GP_B] = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT,
|
||||||
|
|
@ -890,8 +888,6 @@ int RGFW_gpConvTable[18] = {
|
||||||
[RGFW_GP_R3] = GAMEPAD_BUTTON_RIGHT_THUMB,
|
[RGFW_GP_R3] = GAMEPAD_BUTTON_RIGHT_THUMB,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Register all input events
|
// Register all input events
|
||||||
void PollInputEvents(void)
|
void PollInputEvents(void)
|
||||||
{
|
{
|
||||||
|
|
@ -912,7 +908,6 @@ void PollInputEvents(void)
|
||||||
// Register previous mouse position
|
// Register previous mouse position
|
||||||
|
|
||||||
// Reset last gamepad button/axis registered state
|
// Reset last gamepad button/axis registered state
|
||||||
|
|
||||||
for (int i = 0; (i < 4) && (i < MAX_GAMEPADS); i++)
|
for (int i = 0; (i < 4) && (i < MAX_GAMEPADS); i++)
|
||||||
{
|
{
|
||||||
// Check if gamepad is available
|
// Check if gamepad is available
|
||||||
|
|
@ -1219,35 +1214,20 @@ int InitPlatform(void)
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) flags |= RGFW_NO_BORDER;
|
if ((CORE.Window.flags & FLAG_WINDOW_UNDECORATED) > 0) flags |= RGFW_NO_BORDER;
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) flags |= RGFW_NO_RESIZE;
|
if ((CORE.Window.flags & FLAG_WINDOW_RESIZABLE) == 0) flags |= RGFW_NO_RESIZE;
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) flags |= RGFW_TRANSPARENT_WINDOW;
|
if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) flags |= RGFW_TRANSPARENT_WINDOW;
|
||||||
|
|
||||||
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) flags |= RGFW_FULLSCREEN;
|
if ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0) flags |= RGFW_FULLSCREEN;
|
||||||
|
|
||||||
// NOTE: Some OpenGL context attributes must be set before window creation
|
// NOTE: Some OpenGL context attributes must be set before window creation
|
||||||
|
|
||||||
// Check selection OpenGL version
|
// Check selection OpenGL version
|
||||||
if (rlGetVersion() == RL_OPENGL_21)
|
if (rlGetVersion() == RL_OPENGL_21) RGFW_setGLVersion(RGFW_GL_CORE, 2, 1);
|
||||||
{
|
else if (rlGetVersion() == RL_OPENGL_33) RGFW_setGLVersion(RGFW_GL_CORE, 3, 3);
|
||||||
RGFW_setGLVersion(RGFW_GL_CORE, 2, 1);
|
else if (rlGetVersion() == RL_OPENGL_43) RGFW_setGLVersion(RGFW_GL_CORE, 4, 1);
|
||||||
}
|
|
||||||
else if (rlGetVersion() == RL_OPENGL_33)
|
|
||||||
{
|
|
||||||
RGFW_setGLVersion(RGFW_GL_CORE, 3, 3);
|
|
||||||
}
|
|
||||||
else if (rlGetVersion() == RL_OPENGL_43)
|
|
||||||
{
|
|
||||||
RGFW_setGLVersion(RGFW_GL_CORE, 4, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
if (CORE.Window.flags & FLAG_MSAA_4X_HINT) RGFW_setGLSamples(4);
|
||||||
{
|
|
||||||
RGFW_setGLSamples(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags);
|
platform.window = RGFW_createWindow(CORE.Window.title, RGFW_RECT(0, 0, CORE.Window.screen.width, CORE.Window.screen.height), flags);
|
||||||
|
|
||||||
|
|
||||||
#ifndef PLATFORM_WEB_RGFW
|
#ifndef PLATFORM_WEB_RGFW
|
||||||
RGFW_area screenSize = RGFW_getScreenSize();
|
RGFW_area screenSize = RGFW_getScreenSize();
|
||||||
CORE.Window.display.width = screenSize.w;
|
CORE.Window.display.width = screenSize.w;
|
||||||
|
|
@ -1256,10 +1236,8 @@ int InitPlatform(void)
|
||||||
CORE.Window.display.width = CORE.Window.screen.width;
|
CORE.Window.display.width = CORE.Window.screen.width;
|
||||||
CORE.Window.display.height = CORE.Window.screen.height;
|
CORE.Window.display.height = CORE.Window.screen.height;
|
||||||
#endif
|
#endif
|
||||||
/*
|
// TODO: Is this needed by raylib now?
|
||||||
I think this is needed by Raylib now ?
|
// If so, rcore_desktop_sdl should be updated too
|
||||||
If so, rcore_destkop_sdl should be updated too
|
|
||||||
*/
|
|
||||||
//SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
//SetupFramebuffer(CORE.Window.display.width, CORE.Window.display.height);
|
||||||
|
|
||||||
if (CORE.Window.flags & FLAG_VSYNC_HINT) RGFW_window_swapInterval(platform.window, 1);
|
if (CORE.Window.flags & FLAG_VSYNC_HINT) RGFW_window_swapInterval(platform.window, 1);
|
||||||
|
|
|
||||||
|
|
@ -622,7 +622,7 @@ int SetGamepadMappings(const char *mappings)
|
||||||
// Set gamepad vibration
|
// Set gamepad vibration
|
||||||
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GamepadSetVibration() not implemented on target platform");
|
TRACELOG(LOG_WARNING, "SetGamepadVibration() not implemented on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse position XY
|
// Set mouse position XY
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,7 @@ int SetGamepadMappings(const char *mappings)
|
||||||
// Set gamepad vibration
|
// Set gamepad vibration
|
||||||
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float duration)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GamepadSetVibration() not implemented on target platform");
|
TRACELOG(LOG_WARNING, "SetGamepadVibration() not implemented on target platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse position XY
|
// Set mouse position XY
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user