Skip to content

Commit

Permalink
Merge branch 'raysan5:master' into rm-DrawRecLines-offset
Browse files Browse the repository at this point in the history
  • Loading branch information
RadsammyT committed Aug 17, 2024
2 parents ce3e35d + 308b77c commit ceec5fe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/webassembly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v14
with:
version: 3.1.54
version: 3.1.64
actions-cache-folder: 'emsdk-cache'

- name: Setup Release Version
Expand Down
22 changes: 11 additions & 11 deletions src/platforms/rcore_web.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static void CursorEnterCallback(GLFWwindow *window, int enter);

// Emscripten window callback events
static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const EmscriptenFullscreenChangeEvent *event, void *userData);
static EM_BOOL EmscriptenWindowResizedCallback(int eventType, const EmscriptenUiEvent *event, void *userData);
// static EM_BOOL EmscriptenWindowResizedCallback(int eventType, const EmscriptenUiEvent *event, void *userData);
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *event, void *userData);

// Emscripten input callback events
Expand Down Expand Up @@ -981,7 +981,7 @@ void PollInputEvents(void)
default: break;
}

if (button != -1) // Check for valid button
if (button + 1 != 0) // Check for valid button
{
if (gamepadState.digitalButton[j] == 1)
{
Expand Down Expand Up @@ -1572,12 +1572,12 @@ static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const Emscripte
}

// Register window resize event
static EM_BOOL EmscriptenWindowResizedCallback(int eventType, const EmscriptenUiEvent *event, void *userData)
{
// TODO: Implement EmscriptenWindowResizedCallback()?
// static EM_BOOL EmscriptenWindowResizedCallback(int eventType, const EmscriptenUiEvent *event, void *userData)
// {
// // TODO: Implement EmscriptenWindowResizedCallback()?

return 1; // The event was consumed by the callback handler
}
// return 1; // The event was consumed by the callback handler
// }

EM_JS(int, GetWindowInnerWidth, (), { return window.innerWidth; });
EM_JS(int, GetWindowInnerHeight, (), { return window.innerHeight; });
Expand All @@ -1593,11 +1593,11 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *
int width = GetWindowInnerWidth();
int height = GetWindowInnerHeight();

if (width < CORE.Window.screenMin.width) width = CORE.Window.screenMin.width;
else if (width > CORE.Window.screenMax.width && CORE.Window.screenMax.width > 0) width = CORE.Window.screenMax.width;
if (width < (int)CORE.Window.screenMin.width) width = CORE.Window.screenMin.width;
else if (width > (int)CORE.Window.screenMax.width && CORE.Window.screenMax.width > 0) width = CORE.Window.screenMax.width;

if (height < CORE.Window.screenMin.height) height = CORE.Window.screenMin.height;
else if (height > CORE.Window.screenMax.height && CORE.Window.screenMax.height > 0) height = CORE.Window.screenMax.height;
if (height < (int)CORE.Window.screenMin.height) height = CORE.Window.screenMin.height;
else if (height > (int)CORE.Window.screenMax.height && CORE.Window.screenMax.height > 0) height = CORE.Window.screenMax.height;

emscripten_set_canvas_element_size("#canvas", width, height);

Expand Down
12 changes: 7 additions & 5 deletions src/rlgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3994,18 +3994,18 @@ unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
unsigned int fragmentShaderId = 0;

// Compile vertex shader (if provided)
// NOTE: If not vertex shader is provided, use default one
if (vsCode != NULL) vertexShaderId = rlCompileShader(vsCode, GL_VERTEX_SHADER);
// In case no vertex shader was provided or compilation failed, we use default vertex shader
if (vertexShaderId == 0) vertexShaderId = RLGL.State.defaultVShaderId;
else vertexShaderId = RLGL.State.defaultVShaderId;

// Compile fragment shader (if provided)
// NOTE: If not vertex shader is provided, use default one
if (fsCode != NULL) fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER);
// In case no fragment shader was provided or compilation failed, we use default fragment shader
if (fragmentShaderId == 0) fragmentShaderId = RLGL.State.defaultFShaderId;
else fragmentShaderId = RLGL.State.defaultFShaderId;

// In case vertex and fragment shader are the default ones, no need to recompile, we can just assign the default shader program id
if ((vertexShaderId == RLGL.State.defaultVShaderId) && (fragmentShaderId == RLGL.State.defaultFShaderId)) id = RLGL.State.defaultShaderId;
else
else if ((vertexShaderId > 0) && (fragmentShaderId > 0))
{
// One of or both shader are new, we need to compile a new shader program
id = rlLoadShaderProgram(vertexShaderId, fragmentShaderId);
Expand Down Expand Up @@ -4100,6 +4100,8 @@ unsigned int rlCompileShader(const char *shaderCode, int type)
TRACELOG(RL_LOG_WARNING, "SHADER: [ID %i] Compile error: %s", shader, log);
RL_FREE(log);
}

shader = 0;
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/rmodels.c
Original file line number Diff line number Diff line change
Expand Up @@ -5741,11 +5741,11 @@ static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_
cgltf_accessor_read_float(output, 3*keyframe+1, tmp, 4);
Vector4 v1 = {tmp[0], tmp[1], tmp[2], tmp[3]};
cgltf_accessor_read_float(output, 3*keyframe+2, tmp, 4);
Vector4 outTangent1 = {tmp[0], tmp[1], tmp[2]};
Vector4 outTangent1 = {tmp[0], tmp[1], tmp[2], 0.0f};
cgltf_accessor_read_float(output, 3*(keyframe+1)+1, tmp, 4);
Vector4 v2 = {tmp[0], tmp[1], tmp[2], tmp[3]};
cgltf_accessor_read_float(output, 3*(keyframe+1), tmp, 4);
Vector4 inTangent2 = {tmp[0], tmp[1], tmp[2]};
Vector4 inTangent2 = {tmp[0], tmp[1], tmp[2], 0.0f};
Vector4 *r = data;

v1 = QuaternionNormalize(v1);
Expand Down

0 comments on commit ceec5fe

Please sign in to comment.