Skip to content

Commit

Permalink
Merge branch 'master' into render-points
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 authored Aug 24, 2024
2 parents 3ee8d5c + b0c3013 commit f40a04f
Show file tree
Hide file tree
Showing 60 changed files with 3,685 additions and 1,374 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
1 change: 1 addition & 0 deletions BINDINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
| [raylib-raku](https://github.com/vushu/raylib-raku) | **auto** | [Raku](https://www.raku.org) | Artistic License 2.0 |
| [Raylib.lean](https://github.com/KislyjKisel/Raylib.lean) | 4.5 | [Lean4](https://lean-lang.org) | BSD-3-Clause |
| [raylib-cobol](https://codeberg.org/glowiak/raylib-cobol) | **auto** | [COBOL](https://gnucobol.sourceforge.io) | Public domain |
| [raylib-apl](https://github.com/Brian-ED/raylib-apl) | **5.0** | [Dyalog APL](https://www.dyalog.com/) | MIT |

### Utility Wrapers

Expand Down
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ include(CompilerFlags)
# Registers build options that are exposed to cmake
include(CMakeOptions.txt)

# Enforces a few environment and compiler configurations
include(BuildOptions)

if (UNIX AND NOT APPLE)
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11")
Expand Down
1 change: 0 additions & 1 deletion CMakeOptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
option(WITH_PIC "Compile static library as position-independent code" OFF)
option(BUILD_SHARED_LIBS "Build raylib as a shared library" OFF)
option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" OFF)
cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON)

enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
Expand Down
18 changes: 0 additions & 18 deletions cmake/BuildOptions.cmake

This file was deleted.

7 changes: 6 additions & 1 deletion examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ CORE = \
core/core_automation_events \
core/core_basic_screen_manager \
core/core_basic_window \
core/core_basic_window_web \
core/core_custom_frame_control \
core/core_custom_logging \
core/core_drop_files \
Expand Down Expand Up @@ -528,6 +529,7 @@ TEXTURES = \
textures/textures_draw_tiled \
textures/textures_fog_of_war \
textures/textures_gif_player \
textures/textures_image_channel \
textures/textures_image_drawing \
textures/textures_image_generation \
textures/textures_image_kernel \
Expand Down Expand Up @@ -566,6 +568,7 @@ TEXT = \
MODELS = \
models/models_animation \
models/models_billboard \
models/models_bone_socket \
models/models_box_collisions \
models/models_cubicmap \
models/models_draw_cube_texture \
Expand All @@ -587,6 +590,7 @@ MODELS = \

SHADERS = \
shaders/shaders_basic_lighting \
shaders/shaders_basic_pbr \
shaders/shaders_custom_uniform \
shaders/shaders_deferred_render \
shaders/shaders_eratosthenes \
Expand All @@ -609,7 +613,8 @@ SHADERS = \
shaders/shaders_texture_outline \
shaders/shaders_texture_tiling \
shaders/shaders_texture_waves \
shaders/shaders_write_depth
shaders/shaders_write_depth \
shaders/shaders_vertex_displacement

AUDIO = \
audio/audio_mixed_processor \
Expand Down
3 changes: 2 additions & 1 deletion examples/Makefile.Web
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ SHADERS = \
shaders/shaders_texture_outline \
shaders/shaders_texture_tiling \
shaders/shaders_texture_waves \
shaders/shaders_write_depth
shaders/shaders_write_depth \
shaders/shaders_vertex_displacement

AUDIO = \
audio/audio_mixed_processor \
Expand Down
2 changes: 1 addition & 1 deletion examples/audio/audio_mixed_processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ int main(void)
DrawRectangle(199, 199, 402, 34, LIGHTGRAY);
for (int i = 0; i < 400; i++)
{
DrawLine(201 + i, 232 - (int)averageVolume[i] * 32, 201 + i, 232, MAROON);
DrawLine(201 + i, 232 - (int)(averageVolume[i] * 32), 201 + i, 232, MAROON);
}
DrawRectangleLines(199, 199, 402, 34, GRAY);

Expand Down
70 changes: 36 additions & 34 deletions examples/core/core_automation_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int main(void)
// Update
//----------------------------------------------------------------------------------
float deltaTime = 0.015f;//GetFrameTime();

// Dropped files logic
//----------------------------------------------------------------------------------
if (IsFileDropped())
Expand Down Expand Up @@ -157,11 +157,6 @@ int main(void)
}
else player.canJump = true;

camera.zoom += ((float)GetMouseWheelMove()*0.05f);

if (camera.zoom > 3.0f) camera.zoom = 3.0f;
else if (camera.zoom < 0.25f) camera.zoom = 0.25f;

if (IsKeyPressed(KEY_R))
{
// Reset game state
Expand All @@ -176,12 +171,44 @@ int main(void)
}
//----------------------------------------------------------------------------------

// Events playing
// NOTE: Logic must be before Camera update because it depends on mouse-wheel value,
// that can be set by the played event... but some other inputs could be affected
//----------------------------------------------------------------------------------
if (eventPlaying)
{
// NOTE: Multiple events could be executed in a single frame
while (playFrameCounter == aelist.events[currentPlayFrame].frame)
{
PlayAutomationEvent(aelist.events[currentPlayFrame]);
currentPlayFrame++;

if (currentPlayFrame == aelist.count)
{
eventPlaying = false;
currentPlayFrame = 0;
playFrameCounter = 0;

TraceLog(LOG_INFO, "FINISH PLAYING!");
break;
}
}

playFrameCounter++;
}
//----------------------------------------------------------------------------------

// Update camera
//----------------------------------------------------------------------------------
camera.target = player.position;
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
float minX = 1000, minY = 1000, maxX = -1000, maxY = -1000;

// WARNING: On event replay, mouse-wheel internal value is set
camera.zoom += ((float)GetMouseWheelMove()*0.05f);
if (camera.zoom > 3.0f) camera.zoom = 3.0f;
else if (camera.zoom < 0.25f) camera.zoom = 0.25f;

for (int i = 0; i < MAX_ENVIRONMENT_ELEMENTS; i++)
{
EnvElement *element = &envElements[i];
Expand All @@ -200,8 +227,8 @@ int main(void)
if (min.y > 0) camera.offset.y = screenHeight/2 - min.y;
//----------------------------------------------------------------------------------

// Toggle events recording
if (IsKeyPressed(KEY_S))
// Events management
if (IsKeyPressed(KEY_S)) // Toggle events recording
{
if (!eventPlaying)
{
Expand All @@ -222,7 +249,7 @@ int main(void)
}
}
}
else if (IsKeyPressed(KEY_A))
else if (IsKeyPressed(KEY_A)) // Toggle events playing (WARNING: Starts next frame)
{
if (!eventRecording && (aelist.count > 0))
{
Expand All @@ -241,32 +268,7 @@ int main(void)
camera.zoom = 1.0f;
}
}

if (eventPlaying)
{
// NOTE: Multiple events could be executed in a single frame
while (playFrameCounter == aelist.events[currentPlayFrame].frame)
{
TraceLog(LOG_INFO, "PLAYING: PlayFrameCount: %i | currentPlayFrame: %i | Event Frame: %i, param: %i",
playFrameCounter, currentPlayFrame, aelist.events[currentPlayFrame].frame, aelist.events[currentPlayFrame].params[0]);

PlayAutomationEvent(aelist.events[currentPlayFrame]);
currentPlayFrame++;

if (currentPlayFrame == aelist.count)
{
eventPlaying = false;
currentPlayFrame = 0;
playFrameCounter = 0;

TraceLog(LOG_INFO, "FINISH PLAYING!");
break;
}
}

playFrameCounter++;
}

if (eventRecording || eventPlaying) frameCounter++;
else frameCounter = 0;
//----------------------------------------------------------------------------------
Expand Down
20 changes: 10 additions & 10 deletions examples/core/core_input_gamepad_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,25 @@ int main(void)

ClearBackground(RAYWHITE);

for (int i = 0, y = 10; i < 4; i++) // MAX_GAMEPADS = 4
for (int i = 0, y = 5; i < 4; i++) // MAX_GAMEPADS = 4
{
if (IsGamepadAvailable(i))
{
DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 20, BLACK);
y += 30;
DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 20, BLACK);
y += 30;
DrawText(TextFormat("Gamepad name: %s", GetGamepadName(i)), 10, y, 10, BLACK);
y += 11;
DrawText(TextFormat("\tAxis count: %d", GetGamepadAxisCount(i)), 10, y, 10, BLACK);
y += 11;

for (int axis = 0; axis < GetGamepadAxisCount(i); axis++)
{
DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 20, BLACK);
y += 30;
DrawText(TextFormat("\tAxis %d = %f", axis, GetGamepadAxisMovement(i, axis)), 10, y, 10, BLACK);
y += 11;
}

for (int button = 0; button < 32; button++)
{
DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 20, BLACK);
y += 30;
DrawText(TextFormat("\tButton %d = %d", button, IsGamepadButtonDown(i, button)), 10, y, 10, BLACK);
y += 11;
}
}
}
Expand All @@ -80,4 +80,4 @@ int main(void)
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
}
}
2 changes: 1 addition & 1 deletion examples/core/core_vr_simulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int main(void)

DisableCursor(); // Limit cursor to relative movement inside the window

SetTargetFPS(90); // Set our game to run at 90 frames-per-second
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------

// Main game loop
Expand Down
2 changes: 1 addition & 1 deletion examples/models/models_box_collisions.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int main(void)

EndMode3D();

DrawText("Move player with cursors to collide", 220, 40, 20, GRAY);
DrawText("Move player with arrow keys to collide", 220, 40, 20, GRAY);

DrawFPS(10, 10);

Expand Down
1 change: 1 addition & 0 deletions examples/models/models_yaw_pitch_roll.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadModel(model); // Unload model data
UnloadTexture(texture); // Unload texture data

CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples/shaders/resources/shaders/glsl100/raymarching.fs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ uniform vec2 resolution;
//
// More info here: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

#define AA 1 // make this 1 is your machine is too slow
#define AA 1 // make this 1 if your machine is too slow

//------------------------------------------------------------------

Expand Down
18 changes: 18 additions & 0 deletions examples/shaders/resources/shaders/glsl100/vertex_displacement.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#version 100

precision mediump float;

// Input vertex attributes (from fragment shader)
varying vec2 fragTexCoord;
varying float height;


void main()
{
vec4 darkblue = vec4(0.0, 0.13, 0.18, 1.0);
vec4 lightblue = vec4(1.0, 1.0, 1.0, 1.0);
// Interpolate between two colors based on height
vec4 finalColor = mix(darkblue, lightblue, height);

gl_FragColor = finalColor;
}
45 changes: 45 additions & 0 deletions examples/shaders/resources/shaders/glsl100/vertex_displacement.vs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#version 100

precision mediump float;

attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord;
attribute vec3 vertexNormal;
attribute vec4 vertexColor;

uniform mat4 mvp;
uniform mat4 matModel;
uniform mat4 matNormal;

uniform float time;

uniform sampler2D perlinNoiseMap;

varying vec3 fragPosition;
varying vec2 fragTexCoord;
varying vec3 fragNormal;
varying float height;

void main()
{
// Calculate animated texture coordinates based on time and vertex position
vec2 animatedTexCoord = sin(vertexTexCoord + vec2(sin(time + vertexPosition.x * 0.1), cos(time + vertexPosition.z * 0.1)) * 0.3);

// Normalize animated texture coordinates to range [0, 1]
animatedTexCoord = animatedTexCoord * 0.5 + 0.5;

// Fetch displacement from the perlin noise map
float displacement = texture2D(perlinNoiseMap, animatedTexCoord).r * 7.0; // Amplified displacement

// Displace vertex position
vec3 displacedPosition = vertexPosition + vec3(0.0, displacement, 0.0);

// Send vertex attributes to fragment shader
fragPosition = vec3(matModel * vec4(displacedPosition, 1.0));
fragTexCoord = vertexTexCoord;
fragNormal = normalize(vec3(matNormal * vec4(vertexNormal, 1.0)));
height = displacedPosition.y * 0.2; // send height to fragment shader for coloring

// Calculate final vertex position
gl_Position = mvp * vec4(displacedPosition, 1.0);
}
Loading

0 comments on commit f40a04f

Please sign in to comment.