mirror of
https://github.com/raysan5/raylib.git
synced 2026-08-25 13:48:27 -04:00
Compare commits
7 Commits
f00317bead
...
4640c84920
| Author | SHA1 | Date | |
|---|---|---|---|
| 4640c84920 | |||
| af98e3126e | |||
| e063385c47 | |||
| 7a247ff40f | |||
| 5de8c3521f | |||
| b631fb3d05 | |||
| fb4649a3fe |
@ -99,7 +99,7 @@ vec3 ComputePBR()
|
|||||||
vec3 N = normalize(fragNormal);
|
vec3 N = normalize(fragNormal);
|
||||||
if (useTexNormal == 1)
|
if (useTexNormal == 1)
|
||||||
{
|
{
|
||||||
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
||||||
N = normalize(N*2.0 - 1.0);
|
N = normalize(N*2.0 - 1.0);
|
||||||
N = normalize(N*TBN);
|
N = normalize(N*TBN);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,7 @@ vec3 ComputePBR()
|
|||||||
vec3 N = normalize(fragNormal);
|
vec3 N = normalize(fragNormal);
|
||||||
if (useTexNormal == 1)
|
if (useTexNormal == 1)
|
||||||
{
|
{
|
||||||
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
||||||
N = normalize(N*2.0 - 1.0);
|
N = normalize(N*2.0 - 1.0);
|
||||||
N = normalize(N*TBN);
|
N = normalize(N*TBN);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,7 +100,7 @@ vec3 ComputePBR()
|
|||||||
vec3 N = normalize(fragNormal);
|
vec3 N = normalize(fragNormal);
|
||||||
if (useTexNormal == 1)
|
if (useTexNormal == 1)
|
||||||
{
|
{
|
||||||
N = texture(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
N = texture(normalMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
||||||
N = normalize(N*2.0 - 1.0);
|
N = normalize(N*2.0 - 1.0);
|
||||||
N = normalize(N*TBN);
|
N = normalize(N*TBN);
|
||||||
}
|
}
|
||||||
|
|||||||
4
src/external/rlsw.h
vendored
4
src/external/rlsw.h
vendored
@ -4307,8 +4307,8 @@ void swScissor(int x, int y, int width, int height)
|
|||||||
|
|
||||||
RLSW.scClipMin[0] = (2.0f*(float)RLSW.scMin[0]/(float)RLSW.vpSize[0]) - 1.0f;
|
RLSW.scClipMin[0] = (2.0f*(float)RLSW.scMin[0]/(float)RLSW.vpSize[0]) - 1.0f;
|
||||||
RLSW.scClipMax[0] = (2.0f*(float)RLSW.scMax[0]/(float)RLSW.vpSize[0]) - 1.0f;
|
RLSW.scClipMax[0] = (2.0f*(float)RLSW.scMax[0]/(float)RLSW.vpSize[0]) - 1.0f;
|
||||||
RLSW.scClipMax[1] = 1.0f - (2.0f*(float)RLSW.scMin[1]/(float)RLSW.vpSize[1]);
|
RLSW.scClipMin[1] = (2.0f*(float)RLSW.scMin[1]/(float)RLSW.vpSize[1]) - 1.0f;
|
||||||
RLSW.scClipMin[1] = 1.0f - (2.0f*(float)RLSW.scMax[1]/(float)RLSW.vpSize[1]);
|
RLSW.scClipMax[1] = (2.0f*(float)RLSW.scMax[1]/(float)RLSW.vpSize[1]) - 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swClearColor(float r, float g, float b, float a)
|
void swClearColor(float r, float g, float b, float a)
|
||||||
|
|||||||
@ -726,7 +726,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
|
|||||||
void SetMousePosition(int x, int y)
|
void SetMousePosition(int x, int y)
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse cursor
|
// Set mouse cursor
|
||||||
|
|||||||
@ -1237,7 +1237,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
|
|||||||
void SetMousePosition(int x, int y)
|
void SetMousePosition(int x, int y)
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
|
|
||||||
// NOTE: emscripten not implemented
|
// NOTE: emscripten not implemented
|
||||||
glfwSetCursorPos(platform.handle, CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y);
|
glfwSetCursorPos(platform.handle, CORE.Input.Mouse.currentPosition.x, CORE.Input.Mouse.currentPosition.y);
|
||||||
|
|||||||
@ -1526,7 +1526,6 @@ void SetMousePosition(int x, int y)
|
|||||||
{
|
{
|
||||||
RGFW_window_moveMouse(platform.window, x, y);
|
RGFW_window_moveMouse(platform.window, x, y);
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse cursor
|
// Set mouse cursor
|
||||||
|
|||||||
@ -1255,12 +1255,14 @@ Image GetClipboardImage(void)
|
|||||||
|
|
||||||
for (int i = 0; i < SDL_arraysize(imageFormats); i++)
|
for (int i = 0; i < SDL_arraysize(imageFormats); i++)
|
||||||
{
|
{
|
||||||
// NOTE: This pointer should be free with SDL_free() at some point
|
|
||||||
fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
|
fileData = SDL_GetClipboardData(imageFormats[i], &dataSize);
|
||||||
|
|
||||||
if (fileData)
|
if (fileData)
|
||||||
{
|
{
|
||||||
image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize);
|
image = LoadImageFromMemory(imageExtensions[i], fileData, (int)dataSize);
|
||||||
|
|
||||||
|
SDL_free(fileData);
|
||||||
|
|
||||||
if (IsImageValid(image))
|
if (IsImageValid(image))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]);
|
TRACELOG(LOG_INFO, "Clipboard: Got image from clipboard successfully: %s", imageExtensions[i]);
|
||||||
@ -1409,7 +1411,6 @@ void SetMousePosition(int x, int y)
|
|||||||
SDL_WarpMouseInWindow(platform.window, x, y);
|
SDL_WarpMouseInWindow(platform.window, x, y);
|
||||||
|
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse cursor
|
// Set mouse cursor
|
||||||
|
|||||||
@ -1299,8 +1299,8 @@ void SetMousePosition(int x, int y)
|
|||||||
if (!CORE.Input.Mouse.cursorLocked)
|
if (!CORE.Input.Mouse.cursorLocked)
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
TRACELOG(LOG_WARNING, "SetMousePosition not implemented");
|
TRACELOG(LOG_WARNING, "SetMousePosition not implemented at platform level");
|
||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "INPUT: MOUSE: Cursor not enabled");
|
else TRACELOG(LOG_WARNING, "INPUT: MOUSE: Cursor not enabled");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1042,7 +1042,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
|
|||||||
void SetMousePosition(int x, int y)
|
void SetMousePosition(int x, int y)
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse cursor
|
// Set mouse cursor
|
||||||
|
|||||||
@ -420,7 +420,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
|
|||||||
void SetMousePosition(int x, int y)
|
void SetMousePosition(int x, int y)
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse cursor
|
// Set mouse cursor
|
||||||
|
|||||||
@ -395,7 +395,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
|
|||||||
void SetMousePosition(int x, int y)
|
void SetMousePosition(int x, int y)
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set mouse cursor
|
// Set mouse cursor
|
||||||
|
|||||||
@ -1047,7 +1047,6 @@ void SetGamepadVibration(int gamepad, float leftMotor, float rightMotor, float d
|
|||||||
void SetMousePosition(int x, int y)
|
void SetMousePosition(int x, int y)
|
||||||
{
|
{
|
||||||
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
CORE.Input.Mouse.currentPosition = (Vector2){ (float)x, (float)y };
|
||||||
CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
|
|
||||||
|
|
||||||
if (CORE.Input.Mouse.cursorLocked) CORE.Input.Mouse.lockedPosition = CORE.Input.Mouse.currentPosition;
|
if (CORE.Input.Mouse.cursorLocked) CORE.Input.Mouse.lockedPosition = CORE.Input.Mouse.currentPosition;
|
||||||
|
|
||||||
|
|||||||
@ -1699,7 +1699,7 @@ const char *TextSubtext(const char *text, int position, int length)
|
|||||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
||||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||||
|
|
||||||
if ((text != NULL) && (position > 0) && (length > 0))
|
if ((text != NULL) && (position >= 0) && (length > 0))
|
||||||
{
|
{
|
||||||
int textLength = TextLength(text);
|
int textLength = TextLength(text);
|
||||||
|
|
||||||
|
|||||||
@ -1231,9 +1231,9 @@ Image ImageFromImage(Image image, Rectangle rec)
|
|||||||
Image result = { 0 };
|
Image result = { 0 };
|
||||||
|
|
||||||
// Basic rectangle validation: size smaller than image size
|
// Basic rectangle validation: size smaller than image size
|
||||||
if ((rec.x > 0) && (rec.y > 0) && (rec.width > 0) && (rec.height > 0) &&
|
if ((rec.x >= 0) && (rec.y >= 0) && (rec.width > 0) && (rec.height > 0) &&
|
||||||
(((int)rec.x + (int)rec.width) < image.width) &&
|
(((int)rec.x + (int)rec.width) <= image.width) &&
|
||||||
(((int)rec.y + (int)rec.height) < image.height))
|
(((int)rec.y + (int)rec.height) <= image.height))
|
||||||
{
|
{
|
||||||
int bytesPerPixel = GetPixelDataSize(1, 1, image.format);
|
int bytesPerPixel = GetPixelDataSize(1, 1, image.format);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user