Skip to content

Commit

Permalink
Merge branch 'raysan5:master' into pure
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley authored Aug 17, 2024
2 parents 13b7916 + 308b77c commit fbc6575
Show file tree
Hide file tree
Showing 47 changed files with 1,348 additions and 357 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
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 @@ -586,6 +589,7 @@ MODELS = \

SHADERS = \
shaders/shaders_basic_lighting \
shaders/shaders_basic_pbr \
shaders/shaders_custom_uniform \
shaders/shaders_deferred_render \
shaders/shaders_eratosthenes \
Expand All @@ -608,7 +612,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 @@ -476,7 +476,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
19 changes: 10 additions & 9 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,29 +178,30 @@ Examples using raylib shaders functionality, including shaders loading, paramete
| 115 | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | <img src="shaders/shaders_multi_sample2d.png" alt="shaders_multi_sample2d" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 116 | [shaders_spotlight](shaders/shaders_spotlight.c) | <img src="shaders/shaders_spotlight.png" alt="shaders_spotlight" width="80"> | ⭐️⭐️☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/codifies) |
| 117 | [shaders_deferred_render](shaders/shaders_deferred_render.c) | <img src="shaders/shaders_deferred_render.png" alt="shaders_deferred_render" width="80"> | ⭐️⭐️⭐️⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) |
| 118 | [shaders_vertex_displacement](shaders/shaders_vertex_displacement.c) | <img src="shaders/shaders_vertex_displacement.png" alt="shaders_deferred_render" width="80"> | ⭐️☆☆☆ | 1.5 | 1.5 | [Alex ZH](https://github.com/ZzzhHe) |

### category: audio

Examples using raylib audio functionality, including sound/music loading and playing. This functionality is provided by raylib [raudio](../src/raudio.c) module. Note this module can be used standalone independently of raylib, check [raudio_standalone](others/raudio_standalone.c) example.

| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 118 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 119 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 120 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | **4.2** | [Ray](https://github.com/raysan5) |
| 121 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |
| 119 | [audio_module_playing](audio/audio_module_playing.c) | <img src="audio/audio_module_playing.png" alt="audio_module_playing" width="80"> | ⭐️☆☆☆ | 1.5 | 3.5 | [Ray](https://github.com/raysan5) |
| 120 | [audio_music_stream](audio/audio_music_stream.c) | <img src="audio/audio_music_stream.png" alt="audio_music_stream" width="80"> | ⭐️☆☆☆ | 1.3 | **4.2** | [Ray](https://github.com/raysan5) |
| 121 | [audio_raw_stream](audio/audio_raw_stream.c) | <img src="audio/audio_raw_stream.png" alt="audio_raw_stream" width="80"> | ⭐️⭐️⭐️☆ | 1.6 | **4.2** | [Ray](https://github.com/raysan5) |
| 122 | [audio_sound_loading](audio/audio_sound_loading.c) | <img src="audio/audio_sound_loading.png" alt="audio_sound_loading" width="80"> | ⭐️☆☆☆ | 1.1 | 3.5 | [Ray](https://github.com/raysan5) |

### category: others

Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.

| ## | example | image | difficulty<br>level | version<br>created | last version<br>updated | original<br>developer |
|----|----------|--------|:-------------------:|:------------------:|:------------------:|:----------|
| 122 | [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐️⭐️⭐️⭐️ | 1.6 | **4.0** | [Ray](https://github.com/raysan5) |
| 123 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Teddy Astie](https://github.com/tsnake41) |
| 124 | [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
| 125 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Stephan Soller](https://github.com/arkanis) |
| 126 | [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |
| 123 | [rlgl_standalone](others/rlgl_standalone.c) | <img src="others/rlgl_standalone.png" alt="rlgl_standalone" width="80"> | ⭐️⭐️⭐️⭐️ | 1.6 | **4.0** | [Ray](https://github.com/raysan5) |
| 124 | [rlgl_compute_shader](others/rlgl_compute_shader.c) | <img src="others/rlgl_compute_shader.png" alt="rlgl_compute_shader" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Teddy Astie](https://github.com/tsnake41) |
| 125 | [easings_testbed](others/easings_testbed.c) | <img src="others/easings_testbed.png" alt="easings_testbed" width="80"> | ⭐️⭐️⭐️☆ | 3.0 | 3.0 | [Juan Miguel López](https://github.com/flashback-fx) |
| 126 | [raylib_opengl_interop](others/raylib_opengl_interop.c) | <img src="others/raylib_opengl_interop.png" alt="raylib_opengl_interop" width="80"> | ⭐️⭐️⭐️⭐️ | **4.0** | **4.0** | [Stephan Soller](https://github.com/arkanis) |
| 127 | [embedded_files_loading](others/embedded_files_loading.c) | <img src="others/embedded_files_loading.png" alt="embedded_files_loading" width="80"> | ⭐️⭐️☆☆ | 3.5 | 3.5 | [Kristian Holmgren](https://github.com/defutura) |

As always contributions are welcome, feel free to send new examples! Here is an [examples template](examples_template.c) to start with!

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
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 fbc6575

Please sign in to comment.