mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Merge branch 'master' of https://github.com/raysan5/raylib
This commit is contained in:
2
src/external/fix_win32_compatibility.h
vendored
2
src/external/fix_win32_compatibility.h
vendored
@ -42,7 +42,7 @@
|
||||
#define DrawTextW DrawTextWin32
|
||||
#define DrawTextExA DrawTextExAWin32
|
||||
#define DrawTextExW DrawTextExWin32
|
||||
#define PlaySoundA PlaySoundAWin32\
|
||||
#define PlaySoundA PlaySoundAWin32
|
||||
// include windows
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
14
src/external/rl_gputex.h
vendored
14
src/external/rl_gputex.h
vendored
@ -288,7 +288,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
|
||||
if (header->ddspf.flags == 0x40) // No alpha channel
|
||||
{
|
||||
int data_size = image_pixel_size*sizeof(unsigned short);
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
|
||||
image_data = RL_GPUTEX_MALLOC(data_size);
|
||||
|
||||
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
|
||||
@ -300,7 +300,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
|
||||
if (header->ddspf.a_bit_mask == 0x8000) // 1bit alpha
|
||||
{
|
||||
int data_size = image_pixel_size*sizeof(unsigned short);
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
|
||||
image_data = RL_GPUTEX_MALLOC(data_size);
|
||||
|
||||
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
|
||||
@ -320,7 +320,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
|
||||
else if (header->ddspf.a_bit_mask == 0xf000) // 4bit alpha
|
||||
{
|
||||
int data_size = image_pixel_size*sizeof(unsigned short);
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
|
||||
image_data = RL_GPUTEX_MALLOC(data_size);
|
||||
|
||||
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
|
||||
@ -342,7 +342,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
|
||||
else if ((header->ddspf.flags == 0x40) && (header->ddspf.rgb_bit_count == 24)) // DDS_RGB, no compressed
|
||||
{
|
||||
int data_size = image_pixel_size*3*sizeof(unsigned char);
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
|
||||
image_data = RL_GPUTEX_MALLOC(data_size);
|
||||
|
||||
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
|
||||
@ -352,7 +352,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
|
||||
else if ((header->ddspf.flags == 0x41) && (header->ddspf.rgb_bit_count == 32)) // DDS_RGBA, no compressed
|
||||
{
|
||||
int data_size = image_pixel_size*4*sizeof(unsigned char);
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size / 3;
|
||||
if (header->mipmap_count > 1) data_size = data_size + data_size/3;
|
||||
image_data = RL_GPUTEX_MALLOC(data_size);
|
||||
|
||||
RL_GPUTEX_MEMCPY(image_data, file_data_ptr, data_size);
|
||||
@ -376,7 +376,7 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
|
||||
int data_size = 0;
|
||||
|
||||
// Calculate data size, including all mipmaps
|
||||
if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size + header->pitch_or_linear_size / 3;
|
||||
if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size + header->pitch_or_linear_size/3;
|
||||
else data_size = header->pitch_or_linear_size;
|
||||
|
||||
image_data = RL_GPUTEX_MALLOC(data_size*sizeof(unsigned char));
|
||||
@ -1547,4 +1547,4 @@ typedef enum VkFormat {
|
||||
// Provided by VK_KHR_maintenance5
|
||||
VK_FORMAT_A8_UNORM_KHR = VK_FORMAT_A8_UNORM,
|
||||
} VkFormat;
|
||||
*/
|
||||
*/
|
||||
|
||||
@ -1041,8 +1041,8 @@ void PollInputEvents(void)
|
||||
// if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
|
||||
if (IsWindowState(FLAG_WINDOW_HIGHDPI))
|
||||
{
|
||||
CORE.Window.screen.width = (int)(platform.window->r.w / GetWindowScaleDPI().x);
|
||||
CORE.Window.screen.height = (int)(platform.window->r.h / GetWindowScaleDPI().y);
|
||||
CORE.Window.screen.width = (int)(platform.window->r.w/GetWindowScaleDPI().x);
|
||||
CORE.Window.screen.height = (int)(platform.window->r.h/GetWindowScaleDPI().y);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1207,13 +1207,13 @@ void PollInputEvents(void)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_X] = event->axis[0].x / 100.0f;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_Y] = event->axis[0].y / 100.0f;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_X] = event->axis[0].x/100.0f;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_LEFT_Y] = event->axis[0].y/100.0f;
|
||||
} break;
|
||||
case 1:
|
||||
{
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_X] = event->axis[1].x / 100.0f;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y / 100.0f;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_X] = event->axis[1].x/100.0f;
|
||||
CORE.Input.Gamepad.axisState[event->gamepad][GAMEPAD_AXIS_RIGHT_Y] = event->axis[1].y/100.0f;
|
||||
} break;
|
||||
case 2: axis = GAMEPAD_AXIS_LEFT_TRIGGER;
|
||||
case 3:
|
||||
|
||||
@ -1485,8 +1485,8 @@ void PollInputEvents(void)
|
||||
// if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
|
||||
if (IsWindowState(FLAG_WINDOW_HIGHDPI))
|
||||
{
|
||||
CORE.Window.screen.width = (int)(width / GetWindowScaleDPI().x);
|
||||
CORE.Window.screen.height = (int)(height / GetWindowScaleDPI().y);
|
||||
CORE.Window.screen.width = (int)(width/GetWindowScaleDPI().x);
|
||||
CORE.Window.screen.height = (int)(height/GetWindowScaleDPI().y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -3243,6 +3243,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
|
||||
int mipWidth = width;
|
||||
int mipHeight = height;
|
||||
int mipOffset = 0; // Mipmap data offset, only used for tracelog
|
||||
(void)mipOffset; // Used to avoid gcc warnings about unused variable
|
||||
|
||||
// NOTE: Added pointer math separately from function to avoid UBSAN complaining
|
||||
unsigned char *dataPtr = NULL;
|
||||
|
||||
@ -3722,7 +3722,7 @@ void GenMeshTangents(Mesh *mesh)
|
||||
}
|
||||
|
||||
// Gram-Schmidt orthogonalization to make tangent orthogonal to normal
|
||||
// T_prime = T - N * dot(N, T)
|
||||
// T_prime = T - N*dot(N, T)
|
||||
Vector3 orthogonalized = Vector3Subtract(tangent, Vector3Scale(normal, Vector3DotProduct(normal, tangent)));
|
||||
|
||||
// Handle cases where orthogonalized vector is too small
|
||||
|
||||
Reference in New Issue
Block a user