diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 222e2b289..d31acc854 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -30,17 +30,17 @@ jobs: - bits: 32 ARCH: "i386" ARCH_NAME: "i386" - COMPILER_PATH: "/user/bin" + COMPILER_PATH: "/usr/bin" runner: "ubuntu-latest" - bits: 64 ARCH: "x86_64" ARCH_NAME: "amd64" - COMPILER_PATH: "/user/bin" + COMPILER_PATH: "/usr/bin" runner: "ubuntu-latest" - bits: 64 ARCH: "aarch64" ARCH_NAME: "arm64" - COMPILER_PATH: "/user/bin" + COMPILER_PATH: "/usr/bin" runner: "ubuntu-24.04-arm" runs-on: ${{ matrix.runner }} diff --git a/BINDINGS.md b/BINDINGS.md index 719a902a0..e60638ac1 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -145,7 +145,6 @@ These are older raylib bindings that are more than 2 versions old or have not be | [clj-raylib](https://github.com/lsevero/clj-raylib) | 3.0 | [Clojure](https://clojure.org) | | [QuickJS-raylib](https://github.com/sntg-p/QuickJS-raylib) | 3.0 | [QuickJS](https://bellard.org/quickjs) | | [raylib-duktape](https://github.com/RobLoach/raylib-duktape) | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) | -| [raylib-v7](https://github.com/Rabios/raylib-v7) | 3.5 | [JavaScript (v7)](https://en.wikipedia.org/wiki/JavaScript) | | [raylib-chaiscript](https://github.com/RobLoach/raylib-chaiscript) | 2.6 | [ChaiScript](http://chaiscript.com) | | [raylib-squirrel](https://github.com/RobLoach/raylib-squirrel) | 2.5 | [Squirrel](http://www.squirrel-lang.org) | | [racket-raylib-2d](https://github.com/arvyy/racket-raylib-2d) | 2.5 | [Racket](https://racket-lang.org) | diff --git a/CONVENTIONS.md b/CONVENTIONS.md index b7ace0275..17c02e216 100644 --- a/CONVENTIONS.md +++ b/CONVENTIONS.md @@ -28,6 +28,10 @@ Some other conventions to follow: - **ALWAYS** initialize all defined variables. - **Do not use TABS**, use 4 spaces instead. - Avoid trailing spaces, please, avoid them + - Comments always start with space + capital letter and never end with a '.', place them **before** the line(s) they refer to +```c +// This is a comment in raylib or raylib examples +``` - Control flow statements always are followed **by a space**: ```c if (condition) value = 0; diff --git a/examples/Makefile b/examples/Makefile index 39638d371..b838ffb9a 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -639,6 +639,7 @@ SHADERS = \ shaders/shaders_mesh_instancing \ shaders/shaders_model_shader \ shaders/shaders_multi_sample2d \ + shaders/shaders_normalmap \ shaders/shaders_palette_switch \ shaders/shaders_postprocessing \ shaders/shaders_raymarching \ diff --git a/examples/Makefile.Web b/examples/Makefile.Web index dc8c886dd..ef10840ee 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -639,6 +639,7 @@ SHADERS = \ shaders/shaders_mesh_instancing \ shaders/shaders_model_shader \ shaders/shaders_multi_sample2d \ + shaders/shaders_normalmap \ shaders/shaders_palette_switch \ shaders/shaders_postprocessing \ shaders/shaders_raymarching \ @@ -1201,6 +1202,14 @@ shaders/shaders_multi_sample2d: shaders/shaders_multi_sample2d.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ --preload-file shaders/resources/shaders/glsl100/color_mix.fs@resources/shaders/glsl100/color_mix.fs +shaders/shaders_normalmap: shaders/shaders_normalmap.c + $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ + --preload-file shaders/resources/shaders/glsl100/normalmap.vs@resources/shaders/glsl100/normalmap.vs \ + --preload-file shaders/resources/shaders/glsl100/normalmap.fs@resources/shaders/glsl100/normalmap.fs \ + --preload-file shaders/resources/models/plane.glb@resources/models/plane.glb \ + --preload-file shaders/resources/tiles_diffuse.png@resources/tiles_diffuse.png \ + --preload-file shaders/resources/tiles_normal.png@resources/tiles_normal.png + shaders/shaders_palette_switch: shaders/shaders_palette_switch.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \ --preload-file shaders/resources/shaders/glsl100/palette_switch.fs@resources/shaders/glsl100/palette_switch.fs diff --git a/examples/README.md b/examples/README.md index 59e2f3d34..cb17f8e84 100644 --- a/examples/README.md +++ b/examples/README.md @@ -16,8 +16,7 @@ You may find it easier to use than other toolchains, especially when it comes to - `zig build [module]` to compile all examples for a module (e.g. `zig build core`) - `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`) -## EXAMPLES COLLECTION [TOTAL: 159] - +## EXAMPLES COLLECTION [TOTAL: 160] ### category: core [36] @@ -171,7 +170,7 @@ Examples using raylib models functionality, including models loading/generation | [models_bone_socket](models/models_bone_socket.c) | models_bone_socket | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) | | [models_tesseract_view](models/models_tesseract_view.c) | models_tesseract_view | ⭐⭐☆☆ | 5.6 | 5.6 | [Timothy van der Valk](https://github.com/arceryz) | -### category: shaders [28] +### category: shaders [29] Examples using raylib shaders functionality, including shaders loading, parameters configuration and drawing using them (model shaders and postprocessing shaders). This functionality is directly provided by raylib [rlgl](../src/rlgl.c) module. @@ -194,6 +193,7 @@ Examples using raylib shaders functionality, including shaders loading, paramete | [shaders_hot_reloading](shaders/shaders_hot_reloading.c) | shaders_hot_reloading | ⭐⭐⭐☆ | 3.0 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) | | [shaders_mesh_instancing](shaders/shaders_mesh_instancing.c) | shaders_mesh_instancing | ⭐⭐⭐⭐️ | 3.7 | 4.2 | [seanpringle](https://github.com/seanpringle) | | [shaders_multi_sample2d](shaders/shaders_multi_sample2d.c) | shaders_multi_sample2d | ⭐⭐☆☆ | 3.5 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) | +| [shaders_normalmap](shaders/shaders_normalmap.c) | shaders_normalmap | ⭐⭐⭐⭐️ | 5.6 | 5.6 | [Jeremy Montgomery](https://github.com/Sir_Irk) | | [shaders_spotlight](shaders/shaders_spotlight.c) | shaders_spotlight | ⭐⭐☆☆ | 2.5 | 3.7 | [Chris Camacho](https://github.com/chriscamacho) | | [shaders_deferred_render](shaders/shaders_deferred_render.c) | shaders_deferred_render | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [Justin Andreas Lacoste](https://github.com/27justin) | | [shaders_hybrid_render](shaders/shaders_hybrid_render.c) | shaders_hybrid_render | ⭐⭐⭐⭐️ | 4.2 | 4.2 | [Buğra Alptekin Sarı](https://github.com/BugraAlptekinSari) | diff --git a/examples/audio/audio_mixed_processor.c b/examples/audio/audio_mixed_processor.c index fc9785bc8..e761993ff 100644 --- a/examples/audio/audio_mixed_processor.c +++ b/examples/audio/audio_mixed_processor.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [audio] example - Mixed audio processing +* raylib [audio] example - mixed audio processing * * Example complexity rating: [★★★★] 4/4 * diff --git a/examples/audio/audio_music_stream.c b/examples/audio/audio_music_stream.c index 609b12333..b6efb3d2e 100644 --- a/examples/audio/audio_music_stream.c +++ b/examples/audio/audio_music_stream.c @@ -45,7 +45,7 @@ int main(void) // Update //---------------------------------------------------------------------------------- UpdateMusicStream(music); // Update music buffer with new stream data - + // Restart music playing (stop and play) if (IsKeyPressed(KEY_SPACE)) { diff --git a/examples/audio/audio_raw_stream.c b/examples/audio/audio_raw_stream.c index fb36830ce..84c8963e3 100644 --- a/examples/audio/audio_raw_stream.c +++ b/examples/audio/audio_raw_stream.c @@ -108,8 +108,6 @@ int main(void) { // Update //---------------------------------------------------------------------------------- - - // Sample mouse input. mousePosition = GetMousePosition(); if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) @@ -125,7 +123,7 @@ int main(void) // Compute two cycles to allow the buffer padding, simplifying any modulation, resampling, etc. if (frequency != oldFrequency) { - // Compute wavelength. Limit size in both directions. + // Compute wavelength. Limit size in both directions //int oldWavelength = waveLength; waveLength = (int)(22050/frequency); if (waveLength > MAX_SAMPLES/2) waveLength = MAX_SAMPLES/2; diff --git a/examples/audio/audio_sound_multi.c b/examples/audio/audio_sound_multi.c index 243ca7bd8..6f9aea3f9 100644 --- a/examples/audio/audio_sound_multi.c +++ b/examples/audio/audio_sound_multi.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [audio] example - Playing sound multiple times +* raylib [audio] example - sound alias * * Example complexity rating: [★★☆☆] 2/4 * @@ -31,18 +31,18 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [audio] example - playing sound multiple times"); + InitWindow(screenWidth, screenHeight, "raylib [audio] example - sound alias"); InitAudioDevice(); // Initialize audio device - // load the sound list - soundArray[0] = LoadSound("resources/sound.wav"); // Load WAV audio file into the first slot as the 'source' sound - // this sound owns the sample data - for (int i = 1; i < MAX_SOUNDS; i++) - { - soundArray[i] = LoadSoundAlias(soundArray[0]); // Load an alias of the sound into slots 1-9. These do not own the sound data, but can be played - } - currentSound = 0; // set the sound list to the start + // Load audio file into the first slot as the 'source' sound, + // this sound owns the sample data + soundArray[0] = LoadSound("resources/sound.wav"); + + // Load an alias of the sound into slots 1-9. These do not own the sound data, but can be played + for (int i = 1; i < MAX_SOUNDS; i++) soundArray[i] = LoadSoundAlias(soundArray[0]); + + currentSound = 0; // Set the sound list to the start SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -54,14 +54,15 @@ int main(void) //---------------------------------------------------------------------------------- if (IsKeyPressed(KEY_SPACE)) { - PlaySound(soundArray[currentSound]); // play the next open sound slot - currentSound++; // increment the sound slot - if (currentSound >= MAX_SOUNDS) // if the sound slot is out of bounds, go back to 0 - currentSound = 0; + PlaySound(soundArray[currentSound]); // Play the next open sound slot + currentSound++; // Increment the sound slot - // Note: a better way would be to look at the list for the first sound that is not playing and use that slot + // If the sound slot is out of bounds, go back to 0 + if (currentSound >= MAX_SOUNDS) currentSound = 0; + + // NOTE: Another approach would be to look at the list for the first sound + // that is not playing and use that slot } - //---------------------------------------------------------------------------------- // Draw @@ -78,9 +79,8 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- - for (int i = 1; i < MAX_SOUNDS; i++) - UnloadSoundAlias(soundArray[i]); // Unload sound aliases - UnloadSound(soundArray[0]); // Unload source sound data + for (int i = 1; i < MAX_SOUNDS; i++) UnloadSoundAlias(soundArray[i]); // Unload sound aliases + UnloadSound(soundArray[0]); // Unload source sound data CloseAudioDevice(); // Close audio device diff --git a/examples/audio/audio_sound_positioning.c b/examples/audio/audio_sound_positioning.c index aad558672..4102a97f6 100644 --- a/examples/audio/audio_sound_positioning.c +++ b/examples/audio/audio_sound_positioning.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [audio] example - Playing spatialized 3D sound +* raylib [audio] example - spatialized 3D sound * * Example complexity rating: [★★☆☆] 2/4 * @@ -31,9 +31,9 @@ int main(void) //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [audio] example - Playing spatialized 3D sound"); - + + InitWindow(screenWidth, screenHeight, "raylib [audio] example - spatialized 3D sound"); + InitAudioDevice(); Sound sound = LoadSound("resources/coin.wav"); @@ -45,9 +45,9 @@ int main(void) .fovy = 60, .projection = CAMERA_PERSPECTIVE }; - + DisableCursor(); - + SetTargetFPS(60); //-------------------------------------------------------------------------------------- @@ -89,7 +89,7 @@ int main(void) //-------------------------------------------------------------------------------------- UnloadSound(sound); CloseAudioDevice(); // Close audio device - + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- } @@ -100,23 +100,23 @@ static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, flo // Calculate direction vector and distance between listener and sound source Vector3 direction = Vector3Subtract(position, listener.position); float distance = Vector3Length(direction); - + // Apply logarithmic distance attenuation and clamp between 0-1 float attenuation = 1.0f/(1.0f + (distance/maxDist)); attenuation = Clamp(attenuation, 0.0f, 1.0f); - + // Calculate normalized vectors for spatial positioning Vector3 normalizedDirection = Vector3Normalize(direction); Vector3 forward = Vector3Normalize(Vector3Subtract(listener.target, listener.position)); Vector3 right = Vector3Normalize(Vector3CrossProduct(listener.up, forward)); - + // Reduce volume for sounds behind the listener float dotProduct = Vector3DotProduct(forward, normalizedDirection); if (dotProduct < 0.0f) attenuation *= (1.0f + dotProduct*0.5f); - + // Set stereo panning based on sound position relative to listener float pan = 0.5f + 0.5f*Vector3DotProduct(normalizedDirection, right); - + // Apply final sound properties SetSoundVolume(sound, attenuation); SetSoundPan(sound, pan); diff --git a/examples/audio/audio_stream_effects.c b/examples/audio/audio_stream_effects.c index 4a34d3030..435e7b878 100644 --- a/examples/audio/audio_stream_effects.c +++ b/examples/audio/audio_stream_effects.c @@ -53,7 +53,7 @@ int main(void) float timePlayed = 0.0f; // Time played normalized [0.0f..1.0f] bool pause = false; // Music playing paused - + bool enableEffectLPF = false; // Enable effect low-pass-filter bool enableEffectDelay = false; // Enable effect delay (1 second) @@ -98,7 +98,7 @@ int main(void) if (enableEffectDelay) AttachAudioStreamProcessor(music.stream, AudioProcessEffectDelay); else DetachAudioStreamProcessor(music.stream, AudioProcessEffectDelay); } - + // Get normalized time played for current music stream timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music); @@ -119,7 +119,7 @@ int main(void) DrawText("PRESS SPACE TO RESTART MUSIC", 215, 230, 20, LIGHTGRAY); DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 260, 20, LIGHTGRAY); - + DrawText(TextFormat("PRESS F TO TOGGLE LPF EFFECT: %s", enableEffectLPF? "ON" : "OFF"), 200, 320, 20, GRAY); DrawText(TextFormat("PRESS D TO TOGGLE DELAY EFFECT: %s", enableEffectDelay? "ON" : "OFF"), 180, 350, 20, GRAY); diff --git a/examples/core/core_2d_camera_mouse_zoom.c b/examples/core/core_2d_camera_mouse_zoom.c index 31aa7bc6b..6cb6dcfa2 100644 --- a/examples/core/core_2d_camera_mouse_zoom.c +++ b/examples/core/core_2d_camera_mouse_zoom.c @@ -47,7 +47,7 @@ int main () //---------------------------------------------------------------------------------- if (IsKeyPressed(KEY_ONE)) zoomMode = 0; else if (IsKeyPressed(KEY_TWO)) zoomMode = 1; - + // Translate based on mouse right click if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) { @@ -68,7 +68,7 @@ int main () // Set the offset to where the mouse is camera.offset = GetMousePosition(); - // Set the target to match, so that the camera maps the world space point + // Set the target to match, so that the camera maps the world space point // under the cursor to the screen space point under the cursor at any zoom camera.target = mouseWorldPos; @@ -89,7 +89,7 @@ int main () // Set the offset to where the mouse is camera.offset = GetMousePosition(); - // Set the target to match, so that the camera maps the world space point + // Set the target to match, so that the camera maps the world space point // under the cursor to the screen space point under the cursor at any zoom camera.target = mouseWorldPos; } @@ -111,7 +111,7 @@ int main () BeginMode2D(camera); - // Draw the 3d grid, rotated 90 degrees and centered around 0,0 + // Draw the 3d grid, rotated 90 degrees and centered around 0,0 // just so we have something in the XY plane rlPushMatrix(); rlTranslatef(0, 25*50, 0); @@ -121,19 +121,19 @@ int main () // Draw a reference circle DrawCircle(GetScreenWidth()/2, GetScreenHeight()/2, 50, MAROON); - + EndMode2D(); - + // Draw mouse reference //Vector2 mousePos = GetWorldToScreen2D(GetMousePosition(), camera) DrawCircleV(GetMousePosition(), 4, DARKGRAY); - DrawTextEx(GetFontDefault(), TextFormat("[%i, %i]", GetMouseX(), GetMouseY()), + DrawTextEx(GetFontDefault(), TextFormat("[%i, %i]", GetMouseX(), GetMouseY()), Vector2Add(GetMousePosition(), (Vector2){ -44, -24 }), 20, 2, BLACK); DrawText("[1][2] Select mouse zoom mode (Wheel or Move)", 20, 20, 20, DARKGRAY); if (zoomMode == 0) DrawText("Mouse left button drag to move, mouse wheel to zoom", 20, 50, 20, DARKGRAY); else DrawText("Mouse left button drag to move, mouse press and move to zoom", 20, 50, 20, DARKGRAY); - + EndDrawing(); //---------------------------------------------------------------------------------- } diff --git a/examples/core/core_2d_camera_platformer.c b/examples/core/core_2d_camera_platformer.c index 1ccb35167..d4d46e295 100644 --- a/examples/core/core_2d_camera_platformer.c +++ b/examples/core/core_2d_camera_platformer.c @@ -137,7 +137,7 @@ int main(void) Rectangle playerRect = { player.position.x - 20, player.position.y - 40, 40.0f, 40.0f }; DrawRectangleRec(playerRect, RED); - + DrawCircleV(player.position, 5.0f, GOLD); EndMode2D(); diff --git a/examples/core/core_2d_camera_split_screen.c b/examples/core/core_2d_camera_split_screen.c index 900db450e..169465f9d 100644 --- a/examples/core/core_2d_camera_split_screen.c +++ b/examples/core/core_2d_camera_split_screen.c @@ -4,7 +4,7 @@ * * Example complexity rating: [★★★★] 4/4 * -* Addapted from the core_3d_camera_split_screen example: +* Addapted from the core_3d_camera_split_screen example: * https://github.com/raysan5/raylib/blob/master/examples/core/core_3d_camera_split_screen.c * * Example originally created with raylib 4.5, last time updated with raylib 4.5 @@ -81,9 +81,9 @@ int main(void) //---------------------------------------------------------------------------------- BeginTextureMode(screenCamera1); ClearBackground(RAYWHITE); - + BeginMode2D(camera1); - + // Draw full scene with first camera for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++) { @@ -106,17 +106,17 @@ int main(void) DrawRectangleRec(player1, RED); DrawRectangleRec(player2, BLUE); EndMode2D(); - + DrawRectangle(0, 0, GetScreenWidth()/2, 30, Fade(RAYWHITE, 0.6f)); DrawText("PLAYER1: W/S/A/D to move", 10, 10, 10, MAROON); - + EndTextureMode(); BeginTextureMode(screenCamera2); ClearBackground(RAYWHITE); - + BeginMode2D(camera2); - + // Draw full scene with second camera for (int i = 0; i < screenWidth/PLAYER_SIZE + 1; i++) { @@ -138,21 +138,21 @@ int main(void) DrawRectangleRec(player1, RED); DrawRectangleRec(player2, BLUE); - + EndMode2D(); - + DrawRectangle(0, 0, GetScreenWidth()/2, 30, Fade(RAYWHITE, 0.6f)); DrawText("PLAYER2: UP/DOWN/LEFT/RIGHT to move", 10, 10, 10, DARKBLUE); - + EndTextureMode(); // Draw both views render textures to the screen side by side BeginDrawing(); ClearBackground(BLACK); - + DrawTextureRec(screenCamera1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE); DrawTextureRec(screenCamera2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE); - + DrawRectangle(GetScreenWidth()/2 - 2, 0, 4, GetScreenHeight(), LIGHTGRAY); EndDrawing(); } diff --git a/examples/core/core_3d_camera_first_person.c b/examples/core/core_3d_camera_first_person.c index c26fe827c..42e85d0d8 100644 --- a/examples/core/core_3d_camera_first_person.c +++ b/examples/core/core_3d_camera_first_person.c @@ -127,7 +127,7 @@ int main(void) UpdateCameraPro(&camera, (Vector3){ (IsKeyDown(KEY_W) || IsKeyDown(KEY_UP))*0.1f - // Move forward-backward - (IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN))*0.1f, + (IsKeyDown(KEY_S) || IsKeyDown(KEY_DOWN))*0.1f, (IsKeyDown(KEY_D) || IsKeyDown(KEY_RIGHT))*0.1f - // Move right-left (IsKeyDown(KEY_A) || IsKeyDown(KEY_LEFT))*0.1f, 0.0f // Move up-down diff --git a/examples/core/core_3d_camera_split_screen.c b/examples/core/core_3d_camera_split_screen.c index f825a52f9..b0cb0a18d 100644 --- a/examples/core/core_3d_camera_split_screen.c +++ b/examples/core/core_3d_camera_split_screen.c @@ -51,7 +51,7 @@ int main(void) // Build a flipped rectangle the size of the split view to use for drawing later Rectangle splitScreenRect = { 0.0f, 0.0f, (float)screenPlayer1.texture.width, (float)-screenPlayer1.texture.height }; - + // Grid data int count = 5; float spacing = 4; @@ -98,9 +98,9 @@ int main(void) // Draw Player1 view to the render texture BeginTextureMode(screenPlayer1); ClearBackground(SKYBLUE); - + BeginMode3D(cameraPlayer1); - + // Draw scene: grid of cube trees on a plane to make a "world" DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane @@ -116,20 +116,20 @@ int main(void) // Draw a cube at each player's position DrawCube(cameraPlayer1.position, 1, 1, 1, RED); DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE); - + EndMode3D(); - + DrawRectangle(0, 0, GetScreenWidth()/2, 40, Fade(RAYWHITE, 0.8f)); DrawText("PLAYER1: W/S to move", 10, 10, 20, MAROON); - + EndTextureMode(); // Draw Player2 view to the render texture BeginTextureMode(screenPlayer2); ClearBackground(SKYBLUE); - + BeginMode3D(cameraPlayer2); - + // Draw scene: grid of cube trees on a plane to make a "world" DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane @@ -145,21 +145,21 @@ int main(void) // Draw a cube at each player's position DrawCube(cameraPlayer1.position, 1, 1, 1, RED); DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE); - + EndMode3D(); - + DrawRectangle(0, 0, GetScreenWidth()/2, 40, Fade(RAYWHITE, 0.8f)); DrawText("PLAYER2: UP/DOWN to move", 10, 10, 20, DARKBLUE); - + EndTextureMode(); // Draw both views render textures to the screen side by side BeginDrawing(); ClearBackground(BLACK); - + DrawTextureRec(screenPlayer1.texture, splitScreenRect, (Vector2){ 0, 0 }, WHITE); DrawTextureRec(screenPlayer2.texture, splitScreenRect, (Vector2){ screenWidth/2.0f, 0 }, WHITE); - + DrawRectangle(GetScreenWidth()/2 - 2, 0, 4, GetScreenHeight(), LIGHTGRAY); EndDrawing(); } diff --git a/examples/core/core_automation_events.c b/examples/core/core_automation_events.c index fab363d58..6ae0a4336 100644 --- a/examples/core/core_automation_events.c +++ b/examples/core/core_automation_events.c @@ -54,7 +54,7 @@ int main(void) player.position = (Vector2){ 400, 280 }; player.speed = 0; player.canJump = false; - + // Define environment elements (platforms) EnvElement envElements[MAX_ENVIRONMENT_ELEMENTS] = { {{ 0, 0, 1000, 400 }, 0, LIGHTGRAY }, @@ -70,13 +70,13 @@ int main(void) camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f }; camera.rotation = 0.0f; camera.zoom = 1.0f; - + // Automation events AutomationEventList aelist = LoadAutomationEventList(0); // Initialize list of automation events to record new events SetAutomationEventList(&aelist); bool eventRecording = false; bool eventPlaying = false; - + unsigned int frameCounter = 0; unsigned int playFrameCounter = 0; unsigned int currentPlayFrame = 0; @@ -90,7 +90,7 @@ int main(void) // Update //---------------------------------------------------------------------------------- float deltaTime = 0.015f;//GetFrameTime(); - + // Dropped files logic //---------------------------------------------------------------------------------- if (IsFileDropped()) @@ -102,14 +102,14 @@ int main(void) { UnloadAutomationEventList(aelist); aelist = LoadAutomationEventList(droppedFiles.paths[0]); - + eventRecording = false; - + // Reset scene state to play eventPlaying = true; playFrameCounter = 0; currentPlayFrame = 0; - + player.position = (Vector2){ 400, 280 }; player.speed = 0; player.canJump = false; @@ -174,7 +174,7 @@ int main(void) //---------------------------------------------------------------------------------- // Events playing - // NOTE: Logic must be before Camera update because it depends on mouse-wheel value, + // 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) @@ -228,7 +228,7 @@ int main(void) if (min.x > 0) camera.offset.x = screenWidth/2 - min.x; if (min.y > 0) camera.offset.y = screenHeight/2 - min.y; //---------------------------------------------------------------------------------- - + // Events management if (IsKeyPressed(KEY_S)) // Toggle events recording { @@ -238,12 +238,12 @@ int main(void) { StopAutomationEventRecording(); eventRecording = false; - + ExportAutomationEventList(aelist, "automation.rae"); - + TraceLog(LOG_INFO, "RECORDED FRAMES: %i", aelist.count); } - else + else { SetAutomationEventBaseFrame(180); StartAutomationEventRecording(); @@ -293,7 +293,7 @@ int main(void) DrawRectangleRec((Rectangle){ player.position.x - 20, player.position.y - 40, 40, 40 }, RED); EndMode2D(); - + // Draw game controls DrawRectangle(10, 10, 290, 145, Fade(SKYBLUE, 0.5f)); DrawRectangleLines(10, 10, 290, 145, Fade(BLUE, 0.8f)); @@ -323,7 +323,7 @@ int main(void) if (((frameCounter/15)%2) == 1) DrawText(TextFormat("PLAYING RECORDED EVENTS... [%i]", currentPlayFrame), 50, 170, 10, DARKGREEN); } - + EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/core/core_custom_frame_control.c b/examples/core/core_custom_frame_control.c index 2e9595e98..40af52f41 100644 --- a/examples/core/core_custom_frame_control.c +++ b/examples/core/core_custom_frame_control.c @@ -12,7 +12,7 @@ * 4. PollInputEvents() * * To avoid steps 2, 3 and 4, flag SUPPORT_CUSTOM_FRAME_CONTROL can be enabled in -* config.h (it requires recompiling raylib). This way those steps are up to the user. +* config.h (it requires recompiling raylib). This way those steps are up to the user * * Note that enabling this flag invalidates some functions: * - GetFrameTime() @@ -39,7 +39,7 @@ int main(void) //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; - + InitWindow(screenWidth, screenHeight, "raylib [core] example - custom frame control"); // Custom timming variables @@ -48,11 +48,11 @@ int main(void) double updateDrawTime = 0.0; // Update + Draw time double waitTime = 0.0; // Wait time (if target fps required) float deltaTime = 0.0f; // Frame time (Update + Draw + Wait time) - + float timeCounter = 0.0f; // Accumulative time counter (seconds) float position = 0.0f; // Circle position bool pause = false; // Pause control flag - + int targetFPS = 60; // Our initial target fps //-------------------------------------------------------------------------------------- @@ -64,12 +64,12 @@ int main(void) #ifndef PLATFORM_WEB // NOTE: On non web platforms the PollInputEvents just works before the inputs checks PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL) #endif - + if (IsKeyPressed(KEY_SPACE)) pause = !pause; - + if (IsKeyPressed(KEY_UP)) targetFPS += 20; else if (IsKeyPressed(KEY_DOWN)) targetFPS -= 20; - + if (targetFPS < 0) targetFPS = 0; if (!pause) @@ -91,12 +91,12 @@ int main(void) ClearBackground(RAYWHITE); for (int i = 0; i < GetScreenWidth()/200; i++) DrawRectangle(200*i, 0, 1, GetScreenHeight(), SKYBLUE); - + DrawCircle((int)position, GetScreenHeight()/2 - 25, 50, RED); - + DrawText(TextFormat("%03.0f ms", timeCounter*1000.0f), (int)position - 40, GetScreenHeight()/2 - 100, 20, MAROON); DrawText(TextFormat("PosX: %03.0f", position), (int)position - 50, GetScreenHeight()/2 + 40, 20, BLACK); - + DrawText("Circle is moving at a constant 200 pixels/sec,\nindependently of the frame rate.", 10, 10, 20, DARKGRAY); DrawText("PRESS SPACE to PAUSE MOVEMENT", 10, GetScreenHeight() - 60, 20, GRAY); DrawText("PRESS UP | DOWN to CHANGE TARGET FPS", 10, GetScreenHeight() - 30, 20, GRAY); @@ -108,18 +108,18 @@ int main(void) EndDrawing(); - // NOTE: In case raylib is configured to SUPPORT_CUSTOM_FRAME_CONTROL, + // NOTE: In case raylib is configured to SUPPORT_CUSTOM_FRAME_CONTROL, // Events polling, screen buffer swap and frame time control must be managed by the user SwapScreenBuffer(); // Flip the back buffer to screen (front buffer) - + currentTime = GetTime(); updateDrawTime = currentTime - previousTime; - + if (targetFPS > 0) // We want a fixed frame rate { waitTime = (1.0f/(float)targetFPS) - updateDrawTime; - if (waitTime > 0.0) + if (waitTime > 0.0) { WaitTime((float)waitTime); currentTime = GetTime(); diff --git a/examples/core/core_high_dpi.c b/examples/core/core_high_dpi.c index b9417bd63..05661f50e 100644 --- a/examples/core/core_high_dpi.c +++ b/examples/core/core_high_dpi.c @@ -13,12 +13,10 @@ #include "raylib.h" -static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color) -{ - Vector2 size = MeasureTextEx(GetFontDefault(), text, (float)fontSize, 3); - Vector2 pos = (Vector2){x - size.x/2, y - size.y/2 }; - DrawTextEx(GetFontDefault(), text, pos, (float)fontSize, 3, color); -} +//------------------------------------------------------------------------------------ +// Module functions declaration +//------------------------------------------------------------------------------------ +static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color); //------------------------------------------------------------------------------------ // Program main entry point @@ -31,10 +29,20 @@ int main(void) const int screenHeight = 450; SetConfigFlags(FLAG_WINDOW_HIGHDPI | FLAG_WINDOW_RESIZABLE); - InitWindow(screenWidth, screenHeight, "raylib [core] example - highdpi"); SetWindowMinSize(450, 450); + int logicalGridDescY = 120; + int logicalGridLabelY = logicalGridDescY + 30; + int logicalGridTop = logicalGridLabelY + 30; + int logicalGridBottom = logicalGridTop + 80; + int pixelGridTop = logicalGridBottom - 20; + int pixelGridBottom = pixelGridTop + 80; + int pixelGridLabelY = pixelGridBottom + 30; + int pixelGridDescY = pixelGridLabelY + 30; + int cellSize = 50; + float cellSizePx = (float)cellSize; + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -44,67 +52,60 @@ int main(void) // Update //---------------------------------------------------------------------------------- int monitorCount = GetMonitorCount(); - if (monitorCount > 1 && IsKeyPressed(KEY_N)) { - SetWindowMonitor((GetCurrentMonitor() + 1) % monitorCount); + + if ((monitorCount > 1) && IsKeyPressed(KEY_N)) + { + SetWindowMonitor((GetCurrentMonitor() + 1)%monitorCount); } + int currentMonitor = GetCurrentMonitor(); + Vector2 dpiScale = GetWindowScaleDPI(); + cellSizePx = ((float)cellSize)/dpiScale.x; + //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- BeginDrawing(); - Vector2 dpiScale = GetWindowScaleDPI(); ClearBackground(RAYWHITE); - int windowCenter = GetScreenWidth() / 2; + int windowCenter = GetScreenWidth()/2; DrawTextCenter(TextFormat("Dpi Scale: %f", dpiScale.x), windowCenter, 30, 40, DARKGRAY); - DrawTextCenter(TextFormat("Monitor: %d/%d ([N] next monitor)", currentMonitor+1, monitorCount), windowCenter, 70, 16, LIGHTGRAY); - - const int logicalGridDescY = 120; - const int logicalGridLabelY = logicalGridDescY + 30; - const int logicalGridTop = logicalGridLabelY + 30; - const int logicalGridBottom = logicalGridTop + 80; - const int pixelGridTop = logicalGridBottom - 20; - const int pixelGridBottom = pixelGridTop + 80; - const int pixelGridLabelY = pixelGridBottom + 30; - const int pixelGridDescY = pixelGridLabelY + 30; - - const int cellSize = 50; - const float cellSizePx = ((float)cellSize) / dpiScale.x; - + DrawTextCenter(TextFormat("Monitor: %d/%d ([N] next monitor)", currentMonitor+1, monitorCount), windowCenter, 70, 20, LIGHTGRAY); DrawTextCenter(TextFormat("Window is %d \"logical points\" wide", GetScreenWidth()), windowCenter, logicalGridDescY, 20, ORANGE); + bool odd = true; - for (int i = cellSize; i < GetScreenWidth(); i += cellSize, odd = !odd) { - if (odd) { - DrawRectangle(i, logicalGridTop, cellSize, logicalGridBottom-logicalGridTop, ORANGE); - } - DrawTextCenter(TextFormat("%d", i), i, logicalGridLabelY, 12, LIGHTGRAY); + for (int i = cellSize; i < GetScreenWidth(); i += cellSize, odd = !odd) + { + if (odd) DrawRectangle(i, logicalGridTop, cellSize, logicalGridBottom-logicalGridTop, ORANGE); + + DrawTextCenter(TextFormat("%d", i), i, logicalGridLabelY, 10, LIGHTGRAY); DrawLine(i, logicalGridLabelY + 10, i, logicalGridBottom, GRAY); } odd = true; const int minTextSpace = 30; - int last_text_x = -minTextSpace; - for (int i = cellSize; i < GetRenderWidth(); i += cellSize, odd = !odd) { - int x = (int)(((float)i) / dpiScale.x); - if (odd) { - DrawRectangle(x, pixelGridTop, (int)cellSizePx, pixelGridBottom-pixelGridTop, CLITERAL(Color){ 0, 121, 241, 100 }); - } + int lastTextX = -minTextSpace; + for (int i = cellSize; i < GetRenderWidth(); i += cellSize, odd = !odd) + { + int x = (int)(((float)i)/dpiScale.x); + if (odd) DrawRectangle(x, pixelGridTop, (int)cellSizePx, pixelGridBottom - pixelGridTop, CLITERAL(Color){ 0, 121, 241, 100 }); + DrawLine(x, pixelGridTop, (int)(((float)i) / dpiScale.x), pixelGridLabelY - 10, GRAY); - if (x - last_text_x >= minTextSpace) { - DrawTextCenter(TextFormat("%d", i), x, pixelGridLabelY, 12, LIGHTGRAY); - last_text_x = x; + + if ((x - lastTextX) >= minTextSpace) + { + DrawTextCenter(TextFormat("%d", i), x, pixelGridLabelY, 10, LIGHTGRAY); + lastTextX = x; } } DrawTextCenter(TextFormat("Window is %d \"physical pixels\" wide", GetRenderWidth()), windowCenter, pixelGridDescY, 20, BLUE); - { - const char *text = "Can you see this?"; - Vector2 size = MeasureTextEx(GetFontDefault(), text, 16, 3); - Vector2 pos = (Vector2){GetScreenWidth() - size.x - 5, GetScreenHeight() - size.y - 5}; - DrawTextEx(GetFontDefault(), text, pos, 16, 3, LIGHTGRAY); - } + const char *text = "Can you see this?"; + Vector2 size = MeasureTextEx(GetFontDefault(), text, 20, 3); + Vector2 pos = (Vector2){ GetScreenWidth() - size.x - 5, GetScreenHeight() - size.y - 5 }; + DrawTextEx(GetFontDefault(), text, pos, 20, 3, LIGHTGRAY); EndDrawing(); //---------------------------------------------------------------------------------- @@ -117,3 +118,13 @@ int main(void) return 0; } + +//------------------------------------------------------------------------------------ +// Module functions definition +//------------------------------------------------------------------------------------ +static void DrawTextCenter(const char *text, int x, int y, int fontSize, Color color) +{ + Vector2 size = MeasureTextEx(GetFontDefault(), text, (float)fontSize, 3); + Vector2 pos = (Vector2){ x - size.x/2, y - size.y/2 }; + DrawTextEx(GetFontDefault(), text, pos, (float)fontSize, 3, color); +} diff --git a/examples/core/core_input_mouse.c b/examples/core/core_input_mouse.c index 6091ded45..58c1c4035 100644 --- a/examples/core/core_input_mouse.c +++ b/examples/core/core_input_mouse.c @@ -52,7 +52,7 @@ int main(void) isCursorHidden = 0; } } - + ballPosition = GetMousePosition(); if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) ballColor = MAROON; diff --git a/examples/core/core_input_multitouch.c b/examples/core/core_input_multitouch.c index 55015235c..136c603cc 100644 --- a/examples/core/core_input_multitouch.c +++ b/examples/core/core_input_multitouch.c @@ -54,7 +54,7 @@ int main(void) BeginDrawing(); ClearBackground(RAYWHITE); - + for (int i = 0; i < tCount; ++i) { // Make sure point is not (0, 0) as this means there is no touch for it diff --git a/examples/core/core_input_virtual_controls.c b/examples/core/core_input_virtual_controls.c index 80d9f0b3b..6a4946655 100644 --- a/examples/core/core_input_virtual_controls.c +++ b/examples/core/core_input_virtual_controls.c @@ -7,7 +7,7 @@ * Example originally created with raylib 5.0, last time updated with raylib 5.0 * * Example create by GreenSnakeLinux (@GreenSnakeLinux), -* lighter by oblerion (@oblerion) and +* lighter by oblerion (@oblerion) and * reviewed by Ramon Santamaria (@raysan5) and * improved by danilwhale (@danilwhale) * diff --git a/examples/core/core_loading_thread.c b/examples/core/core_loading_thread.c index cd3d5a744..1fa84640d 100644 --- a/examples/core/core_loading_thread.c +++ b/examples/core/core_loading_thread.c @@ -4,7 +4,7 @@ * * Example complexity rating: [★★★☆] 3/4 * -* NOTE: This example requires linking with pthreads library on MinGW, +* NOTE: This example requires linking with pthreads library on MinGW, * it can be accomplished passing -static parameter to compiler * * Example originally created with raylib 2.5, last time updated with raylib 3.0 diff --git a/examples/core/core_random_sequence.c b/examples/core/core_random_sequence.c index 1aa0a068c..b92eaba88 100644 --- a/examples/core/core_random_sequence.c +++ b/examples/core/core_random_sequence.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [core] example - Generates a random sequence +* raylib [core] example - generate random sequence * * Example complexity rating: [★☆☆☆] 1/4 * @@ -43,7 +43,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [core] example - Generates a random sequence"); + InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random sequence"); int rectCount = 20; float rectSize = (float)screenWidth/rectCount; @@ -118,8 +118,8 @@ int main(void) //------------------------------------------------------------------------------------ static Color GenerateRandomColor() { - Color color = { - GetRandomValue(0, 255), + Color color = { + GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 @@ -138,20 +138,20 @@ static ColorRect *GenerateRandomColorRectSequence(float rectCount, float rectWid for (int i = 0; i < rectCount; i++) { int rectHeight = (int)Remap((float)seq[i], 0, rectCount - 1, 0, screenHeight); - + rectangles[i].c = GenerateRandomColor(); rectangles[i].r = CLITERAL(Rectangle){ startX + i*rectWidth, screenHeight - rectHeight, rectWidth, (float)rectHeight }; } - + UnloadRandomSequence(seq); - + return rectangles; } static void ShuffleColorRectSequence(ColorRect *rectangles, int rectCount) { int *seq = LoadRandomSequence(rectCount, 0, rectCount - 1); - + for (int i1 = 0; i1 < rectCount; i1++) { ColorRect *r1 = &rectangles[i1]; @@ -166,16 +166,16 @@ static void ShuffleColorRectSequence(ColorRect *rectangles, int rectCount) r2->r.height = tmp.r.height; r2->r.y = tmp.r.y; } - + UnloadRandomSequence(seq); } static void DrawTextCenterKeyHelp(const char *key, const char *text, int posX, int posY, int fontSize, Color color) { - int spaceSize = MeasureText(" ", fontSize); - int pressSize = MeasureText("Press", fontSize); - int keySize = MeasureText(key, fontSize); - int textSize = MeasureText(text, fontSize); + int spaceSize = MeasureText(" ", fontSize); + int pressSize = MeasureText("Press", fontSize); + int keySize = MeasureText(key, fontSize); + int textSize = MeasureText(text, fontSize); int textSizeCurrent = 0; DrawText("Press", posX, posY, fontSize, color); diff --git a/examples/core/core_random_values.c b/examples/core/core_random_values.c index 4abc87694..16b89e700 100644 --- a/examples/core/core_random_values.c +++ b/examples/core/core_random_values.c @@ -30,9 +30,9 @@ int main(void) // SetRandomSeed(0xaabbccff); // Set a custom random seed if desired, by default: "time(NULL)" int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included) - + unsigned int framesCounter = 0; // Variable used to count frames - + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- diff --git a/examples/core/core_smooth_pixelperfect.c b/examples/core/core_smooth_pixelperfect.c index 964bacdb3..697b2ff09 100644 --- a/examples/core/core_smooth_pixelperfect.c +++ b/examples/core/core_smooth_pixelperfect.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★★☆] 3/4 * * Example originally created with raylib 3.7, last time updated with raylib 4.0 -* +* * Example contributed by Giancamillo Alessandroni (@NotManyIdeasDev) and * reviewed by Ramon Santamaria (@raysan5) * @@ -43,7 +43,8 @@ int main(void) Camera2D screenSpaceCamera = { 0 }; // Smoothing camera screenSpaceCamera.zoom = 1.0f; - RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight); // This is where we'll draw all our objects. + // Load render texture to draw all our objects + RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight); Rectangle rec01 = { 70.0f, 35.0f, 20.0f, 20.0f }; Rectangle rec02 = { 90.0f, 55.0f, 30.0f, 10.0f }; diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c index 43b1ec471..34b556e99 100644 --- a/examples/core/core_vr_simulator.c +++ b/examples/core/core_vr_simulator.c @@ -127,7 +127,7 @@ int main(void) EndMode3D(); EndVrStereoMode(); EndTextureMode(); - + BeginDrawing(); ClearBackground(RAYWHITE); BeginShaderMode(distortion); diff --git a/examples/core/core_window_letterbox.c b/examples/core/core_window_letterbox.c index b3622c8b9..a46e9eec6 100644 --- a/examples/core/core_window_letterbox.c +++ b/examples/core/core_window_letterbox.c @@ -86,7 +86,7 @@ int main(void) DrawText(TextFormat("Default Mouse: [%i , %i]", (int)mouse.x, (int)mouse.y), 350, 25, 20, GREEN); DrawText(TextFormat("Virtual Mouse: [%i , %i]", (int)virtualMouse.x, (int)virtualMouse.y), 350, 55, 20, YELLOW); EndTextureMode(); - + BeginDrawing(); ClearBackground(BLACK); // Clear screen background diff --git a/examples/core/core_window_should_close.c b/examples/core/core_window_should_close.c index 56561795d..274891ef3 100644 --- a/examples/core/core_window_should_close.c +++ b/examples/core/core_window_should_close.c @@ -26,9 +26,9 @@ int main() const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [core] example - window should close"); - + SetExitKey(KEY_NULL); // Disable KEY_ESCAPE to close window, X-button still works - + bool exitWindowRequested = false; // Flag to request window to exit bool exitWindow = false; // Flag to set window to exit @@ -42,12 +42,12 @@ int main() //---------------------------------------------------------------------------------- // Detect if X-button or KEY_ESCAPE have been pressed to close window if (WindowShouldClose() || IsKeyPressed(KEY_ESCAPE)) exitWindowRequested = true; - + if (exitWindowRequested) { // A request for close window has been issued, we can save data before closing // or just show a message asking for confirmation - + if (IsKeyPressed(KEY_Y)) exitWindow = true; else if (IsKeyPressed(KEY_N)) exitWindowRequested = false; } diff --git a/examples/core/core_world_screen.c b/examples/core/core_world_screen.c index f302c3b27..6e065ca34 100644 --- a/examples/core/core_world_screen.c +++ b/examples/core/core_world_screen.c @@ -70,7 +70,7 @@ int main(void) EndMode3D(); DrawText("Enemy: 100 / 100", (int)cubeScreenPosition.x - MeasureText("Enemy: 100/100", 20)/2, (int)cubeScreenPosition.y, 20, BLACK); - + DrawText(TextFormat("Cube position in screen space coordinates: [%i, %i]", (int)cubeScreenPosition.x, (int)cubeScreenPosition.y), 10, 10, 20, LIME); DrawText("Text 2d should be always on top of the cube", 10, 40, 20, GRAY); diff --git a/examples/core/resources/shaders/glsl120/distortion.fs b/examples/core/resources/shaders/glsl120/distortion.fs new file mode 100644 index 000000000..496557b07 --- /dev/null +++ b/examples/core/resources/shaders/glsl120/distortion.fs @@ -0,0 +1,50 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +// NOTE: Add your custom variables here +uniform vec2 leftLensCenter; +uniform vec2 rightLensCenter; +uniform vec2 leftScreenCenter; +uniform vec2 rightScreenCenter; +uniform vec2 scale; +uniform vec2 scaleIn; +uniform vec4 deviceWarpParam; +uniform vec4 chromaAbParam; + +void main() +{ + // Compute lens distortion + vec2 lensCenter = fragTexCoord.x < 0.5? leftLensCenter : rightLensCenter; + vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter; + vec2 theta = (fragTexCoord - lensCenter)*scaleIn; + float rSq = theta.x*theta.x + theta.y*theta.y; + vec2 theta1 = theta*(deviceWarpParam.x + deviceWarpParam.y*rSq + deviceWarpParam.z*rSq*rSq + deviceWarpParam.w*rSq*rSq*rSq); + vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq); + vec2 tcBlue = lensCenter + scale*thetaBlue; + + if (any(bvec2(clamp(tcBlue, screenCenter - vec2(0.25, 0.5), screenCenter + vec2(0.25, 0.5)) - tcBlue))) + { + // Set black fragment for everything outside the lens border + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + else + { + // Compute color chroma aberration + float blue = texture2D(texture0, tcBlue).b; + vec2 tcGreen = lensCenter + scale*theta1; + float green = texture2D(texture0, tcGreen).g; + + vec2 thetaRed = theta1*(chromaAbParam.x + chromaAbParam.y*rSq); + vec2 tcRed = lensCenter + scale*thetaRed; + + float red = texture2D(texture0, tcRed).r; + gl_FragColor = vec4(red, green, blue, 1.0); + } +} diff --git a/examples/examples_list.txt b/examples/examples_list.txt index 964bae667..230656000 100644 --- a/examples/examples_list.txt +++ b/examples/examples_list.txt @@ -141,6 +141,7 @@ shaders;shaders_simple_mask;⭐️⭐️☆☆;2.5;3.7;"Chris Camacho";@chriscam shaders;shaders_hot_reloading;⭐️⭐️⭐️☆;3.0;3.5;"Ramon Santamaria";@raysan5 shaders;shaders_mesh_instancing;⭐️⭐️⭐️⭐️;3.7;4.2;"seanpringle";@seanpringle shaders;shaders_multi_sample2d;⭐️⭐️☆☆;3.5;3.5;"Ramon Santamaria";@raysan5 +shaders;shaders_normalmap;⭐️⭐️⭐️⭐️;5.6;5.6;"Jeremy Montgomery";@Sir_Irk shaders;shaders_spotlight;⭐️⭐️☆☆;2.5;3.7;"Chris Camacho";@chriscamacho shaders;shaders_deferred_render;⭐️⭐️⭐️⭐️;4.5;4.5;"Justin Andreas Lacoste";@27justin shaders;shaders_hybrid_render;⭐️⭐️⭐️⭐️;4.2;4.2;"Buğra Alptekin Sarı";@BugraAlptekinSari diff --git a/examples/examples_template.c b/examples/examples_template.c index e82bed065..2bb223a9c 100644 --- a/examples/examples_template.c +++ b/examples/examples_template.c @@ -6,30 +6,30 @@ 1. File naming: _ - Lower case filename, words separated by underscore, no more than 3-4 words in total to describe the example. referes to the primary - raylib module the example is more related with (code, shapes, textures, models, shaders, raudio). + raylib module the example is more related with (code, shapes, textures, models, shaders, raudio) i.e: core_input_multitouch, shapes_lines_bezier, shaders_palette_switch 2. Follow below template structure, example info should list the module, the short description - and the author of the example, twitter or github info could be also provided for the author. - Short description should also be used on the title of the window. + and the author of the example, twitter or github info could be also provided for the author + Short description should also be used on the title of the window 3. Code should be organized by sections:[Initialization]- [Update] - [Draw] - [De-Initialization] Place your code between the dotted lines for every section, please don't mix update logic with drawing - and remember to unload all loaded resources. + and remember to unload all loaded resources 4. Code should follow raylib conventions: https://github.com/raysan5/raylib/wiki/raylib-coding-conventions - Try to be very organized, using line-breaks appropiately. + Try to be very organized, using line-breaks appropiately - 5. Add comments to the specific parts of code the example is focus on. - Don't abuse with comments, try to be clear and impersonal on the comments. + 5. Add comments to the specific parts of code the example is focus on + Don't abuse with comments, try to be clear and impersonal on the comments - 6. Try to keep the example simple, under 300 code lines if possible. Try to avoid external dependencies. - Try to avoid defining functions outside the main(). Example should be as self-contained as possible. + 6. Try to keep the example simple, under 300 code lines if possible. Try to avoid external dependencies + Try to avoid defining functions outside the main(). Example should be as self-contained as possible 7. About external resources, they should be placed in a [resources] folder and those resources - should be open and free for use and distribution. Avoid propietary content. + should be open and free for use and distribution. Avoid propietary content - 8. Try to keep the example simple but with a creative touch. + 8. Try to keep the example simple but with a creative touch Simple but beautiful examples are more appealing to users! 9. In case of additional information is required, just come to raylib Discord channel: example-contributions @@ -37,7 +37,7 @@ 10. Have fun! The following files should be updated when adding a new example, it's planned to create some - script to automatize this process but not available yet. + script to automatize this process but not available yet - raylib/examples//_example_name.c - raylib/examples//_example_name.png @@ -56,7 +56,7 @@ /******************************************************************************************* * -* raylib [] example - +* raylib [] example - * * Example complexity rating: [★☆☆☆] 1/4 * diff --git a/examples/models/models_animation.c b/examples/models/models_animation.c index bf53c77cf..b02172dd7 100644 --- a/examples/models/models_animation.c +++ b/examples/models/models_animation.c @@ -15,9 +15,9 @@ * ******************************************************************************************** * -* NOTE: To export a model from blender, make sure it is not posed, the vertices need to be -* in the same position as they would be in edit mode and the scale of your models is -* set to 0. Scaling can be done from the export menu. +* NOTE: To export a model from blender, make sure it is not posed, the vertices need to be +* in the same position as they would be in edit mode and the scale of your models is +* set to 0. Scaling can be done from the export menu * ********************************************************************************************/ diff --git a/examples/models/models_billboard.c b/examples/models/models_billboard.c index 1d49ab89e..82610a4df 100644 --- a/examples/models/models_billboard.c +++ b/examples/models/models_billboard.c @@ -40,7 +40,7 @@ int main(void) Vector3 billPositionStatic = { 0.0f, 2.0f, 0.0f }; // Position of static billboard Vector3 billPositionRotating = { 1.0f, 2.0f, 1.0f }; // Position of rotating billboard - // Entire billboard texture, source is used to take a segment from a larger texture. + // Entire billboard texture, source is used to take a segment from a larger texture Rectangle source = { 0.0f, 0.0f, (float)bill.width, (float)bill.height }; // NOTE: Billboard locked on axis-Y @@ -54,7 +54,7 @@ int main(void) Vector2 origin = Vector2Scale(size, 0.5f); // Distance is needed for the correct billboard draw order - // Larger distance (further away from the camera) should be drawn prior to smaller distance. + // Larger distance (further away from the camera) should be drawn prior to smaller distance float distanceStatic; float distanceRotating; float rotation = 0.0f; @@ -85,17 +85,17 @@ int main(void) DrawGrid(10, 1.0f); // Draw a grid // Draw order matters! - if (distanceStatic > distanceRotating) + if (distanceStatic > distanceRotating) { DrawBillboard(camera, bill, billPositionStatic, 2.0f, WHITE); DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, size, origin, rotation, WHITE); - } + } else { DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, size, origin, rotation, WHITE); DrawBillboard(camera, bill, billPositionStatic, 2.0f, WHITE); } - + EndMode3D(); DrawFPS(10, 10); diff --git a/examples/models/models_bone_socket.c b/examples/models/models_bone_socket.c index ceea21b8c..cdad46738 100644 --- a/examples/models/models_bone_socket.c +++ b/examples/models/models_bone_socket.c @@ -3,7 +3,7 @@ * raylib [core] example - Using bones as socket for calculating the positioning of something * * Example complexity rating: [★★★★] 4/4 -* +* * Example originally created with raylib 4.5, last time updated with raylib 4.5 * * Example contributed by iP (@ipzaur) and reviewed by Ramon Santamaria (@raysan5) @@ -51,7 +51,7 @@ int main(void) LoadModel("resources/models/gltf/greenman_sword.glb"), // Index for the sword model is the same as BONE_SOCKET_HAND_R LoadModel("resources/models/gltf/greenman_shield.glb") // Index for the shield model is the same as BONE_SOCKET_HAND_L }; - + bool showEquip[3] = { true, true, true }; // Toggle on/off equip // Load gltf model animations @@ -63,7 +63,7 @@ int main(void) // indices of bones for sockets int boneSocketIndex[BONE_SOCKETS] = { -1, -1, -1 }; - // search bones for sockets + // search bones for sockets for (int i = 0; i < characterModel.boneCount; i++) { if (TextIsEqual(characterModel.bones[i].name, "socket_hat")) @@ -71,13 +71,13 @@ int main(void) boneSocketIndex[BONE_SOCKET_HAT] = i; continue; } - + if (TextIsEqual(characterModel.bones[i].name, "socket_hand_R")) { boneSocketIndex[BONE_SOCKET_HAND_R] = i; continue; } - + if (TextIsEqual(characterModel.bones[i].name, "socket_hand_L")) { boneSocketIndex[BONE_SOCKET_HAND_L] = i; @@ -99,7 +99,7 @@ int main(void) // Update //---------------------------------------------------------------------------------- UpdateCamera(&camera, CAMERA_THIRD_PERSON); - + // Rotate character if (IsKeyDown(KEY_F)) angle = (angle + 1)%360; else if (IsKeyDown(KEY_H)) angle = (360 + angle - 1)%360; @@ -112,7 +112,7 @@ int main(void) if (IsKeyPressed(KEY_ONE)) showEquip[BONE_SOCKET_HAT] = !showEquip[BONE_SOCKET_HAT]; if (IsKeyPressed(KEY_TWO)) showEquip[BONE_SOCKET_HAND_R] = !showEquip[BONE_SOCKET_HAND_R]; if (IsKeyPressed(KEY_THREE)) showEquip[BONE_SOCKET_HAND_L] = !showEquip[BONE_SOCKET_HAND_L]; - + // Update model animation ModelAnimation anim = modelAnimations[animIndex]; animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount; @@ -140,7 +140,7 @@ int main(void) Transform *transform = &anim.framePoses[animCurrentFrame][boneSocketIndex[i]]; Quaternion inRotation = characterModel.bindPose[boneSocketIndex[i]].rotation; Quaternion outRotation = transform->rotation; - + // Calculate socket rotation (angle between bone in initial pose and same bone in current animation frame) Quaternion rotate = QuaternionMultiply(outRotation, QuaternionInvert(inRotation)); Matrix matrixTransform = QuaternionToMatrix(rotate); @@ -148,7 +148,7 @@ int main(void) matrixTransform = MatrixMultiply(matrixTransform, MatrixTranslate(transform->translation.x, transform->translation.y, transform->translation.z)); // Transform the socket using the transform of the character (angle and translate) matrixTransform = MatrixMultiply(matrixTransform, characterModel.transform); - + // Draw mesh at socket position with socket angle rotation DrawMesh(equipModel[i].meshes[0], equipModel[i].materials[1], matrixTransform); } @@ -168,7 +168,7 @@ int main(void) //-------------------------------------------------------------------------------------- UnloadModelAnimations(modelAnimations, animsCount); UnloadModel(characterModel); // Unload character model and meshes/material - + // Unload equipment model and meshes/material for (int i = 0; i < BONE_SOCKETS; i++) UnloadModel(equipModel[i]); diff --git a/examples/models/models_draw_cube_texture.c b/examples/models/models_draw_cube_texture.c index 172a50394..650f80aee 100644 --- a/examples/models/models_draw_cube_texture.c +++ b/examples/models/models_draw_cube_texture.c @@ -42,7 +42,7 @@ int main(void) camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; camera.fovy = 45.0f; camera.projection = CAMERA_PERSPECTIVE; - + // Load texture to be applied to the cubes sides Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); @@ -69,7 +69,7 @@ int main(void) DrawCubeTexture(texture, (Vector3){ -2.0f, 2.0f, 0.0f }, 2.0f, 4.0f, 2.0f, WHITE); // Draw cube with an applied texture, but only a defined rectangle piece of the texture - DrawCubeTextureRec(texture, (Rectangle){ 0.0f, texture.height/2.0f, texture.width/2.0f, texture.height/2.0f }, + DrawCubeTextureRec(texture, (Rectangle){ 0.0f, texture.height/2.0f, texture.width/2.0f, texture.height/2.0f }, (Vector3){ 2.0f, 1.0f, 0.0f }, 2.0f, 2.0f, 2.0f, WHITE); DrawGrid(10, 1.0f); // Draw a grid @@ -85,7 +85,7 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- UnloadTexture(texture); // Unload texture - + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- @@ -171,7 +171,7 @@ void DrawCubeTextureRec(Texture2D texture, Rectangle source, Vector3 position, f rlSetTexture(texture.id); // We calculate the normalized texture coordinates for the desired texture-source-rectangle - // It means converting from (tex.width, tex.height) coordinates to [0.0f, 1.0f] equivalent + // It means converting from (tex.width, tex.height) coordinates to [0.0f, 1.0f] equivalent rlBegin(RL_QUADS); rlColor4ub(color.r, color.g, color.b, color.a); diff --git a/examples/models/models_gpu_skinning.c b/examples/models/models_gpu_skinning.c index c268d25d1..d1b8c097a 100644 --- a/examples/models/models_gpu_skinning.c +++ b/examples/models/models_gpu_skinning.c @@ -3,7 +3,7 @@ * raylib [core] example - Doing skinning on the gpu using a vertex shader * * Example complexity rating: [★★★☆] 3/4 -* +* * Example originally created with raylib 4.5, last time updated with raylib 4.5 * * Example contributed by Daniel Holden (@orangeduck) and reviewed by Ramon Santamaria (@raysan5) @@ -12,7 +12,7 @@ * BSD-like license that allows static linking with closed source software * * Copyright (c) 2024-2025 Daniel Holden (@orangeduck) -* +* * Note: Due to limitations in the Apple OpenGL driver, this feature does not work on MacOS * ********************************************************************************************/ @@ -49,13 +49,13 @@ int main(void) // Load gltf model Model characterModel = LoadModel("resources/models/gltf/greenman.glb"); // Load character model - + // Load skinning shader Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION), TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION)); - + characterModel.materials[1].shader = skinningShader; - + // Load gltf model animations int animsCount = 0; unsigned int animIndex = 0; @@ -75,7 +75,7 @@ int main(void) // Update //---------------------------------------------------------------------------------- UpdateCamera(&camera, CAMERA_THIRD_PERSON); - + // Select current animation if (IsKeyPressed(KEY_T)) animIndex = (animIndex + 1)%animsCount; else if (IsKeyPressed(KEY_G)) animIndex = (animIndex + animsCount - 1)%animsCount; @@ -94,12 +94,12 @@ int main(void) ClearBackground(RAYWHITE); BeginMode3D(camera); - + // Draw character mesh, pose calculation is done in shader (GPU skinning) DrawMesh(characterModel.meshes[0], characterModel.materials[1], characterModel.transform); DrawGrid(10, 1.0f); - + EndMode3D(); DrawText("Use the T/G to switch animation", 10, 10, 20, GRAY); @@ -113,7 +113,7 @@ int main(void) UnloadModelAnimations(modelAnimations, animsCount); // Unload model animation UnloadModel(characterModel); // Unload model and meshes/material UnloadShader(skinningShader); // Unload GPU skinning shader - + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/models/models_loading.c b/examples/models/models_loading.c index 52732d864..fd1849a82 100644 --- a/examples/models/models_loading.c +++ b/examples/models/models_loading.c @@ -7,11 +7,11 @@ * NOTE: raylib supports multiple models file formats: * * - OBJ > Text file format. Must include vertex position-texcoords-normals information, -* if files references some .mtl materials file, it will be loaded (or try to). +* if files references some .mtl materials file, it will be loaded (or try to) * - GLTF > Text/binary file format. Includes lot of information and it could -* also reference external files, raylib will try loading mesh and materials data. +* also reference external files, raylib will try loading mesh and materials data * - IQM > Binary file format. Includes mesh vertex data but also animation data, -* raylib can load .iqm animations. +* raylib can load .iqm animations * - VOX > Binary file format. MagikaVoxel mesh format: * https://github.com/ephtracy/voxel-model/blob/master/MagicaVoxel-file-format-vox.txt * - M3D > Binary file format. Model 3D format: diff --git a/examples/models/models_loading_gltf.c b/examples/models/models_loading_gltf.c index 6309af84c..e3a5b5bcb 100644 --- a/examples/models/models_loading_gltf.c +++ b/examples/models/models_loading_gltf.c @@ -45,7 +45,7 @@ int main(void) // Load gltf model Model model = LoadModel("resources/models/gltf/robot.glb"); Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position - + // Load gltf model animations int animsCount = 0; unsigned int animIndex = 0; diff --git a/examples/models/models_loading_m3d.c b/examples/models/models_loading_m3d.c index 38dfbd51e..871bb54dd 100644 --- a/examples/models/models_loading_m3d.c +++ b/examples/models/models_loading_m3d.c @@ -119,7 +119,7 @@ int main(void) // without a -1, we would always draw a cube at the origin for (int i = 0; i < model.boneCount - 1; i++) { - // By default the model is loaded in bind-pose by LoadModel(). + // By default the model is loaded in bind-pose by LoadModel() // But if UpdateModelAnimation() has been called at least once // then the model is already in animation pose, so we need the animated skeleton if (!animPlaying || !animsCount) diff --git a/examples/models/models_loading_vox.c b/examples/models/models_loading_vox.c index 806d47868..19002170d 100644 --- a/examples/models/models_loading_vox.c +++ b/examples/models/models_loading_vox.c @@ -40,7 +40,7 @@ int main(void) int screenWidth = 800; int screenHeight = 450; - const char* voxFileNames[] = { + const char *voxFileNames[] = { "resources/models/vox/chr_knight.vox", "resources/models/vox/chr_sword.vox", "resources/models/vox/monu9.vox", @@ -57,24 +57,23 @@ int main(void) camera.fovy = 45.0f; // Camera field-of-view Y camera.projection = CAMERA_PERSPECTIVE; // Camera projection type - //-------------------------------------------------------------------------------------- // Load MagicaVoxel files Model models[MAX_VOX_FILES] = { 0 }; for (int i = 0; i < MAX_VOX_FILES; i++) { // Load VOX file and measure time - double t0 = GetTime() * 1000.0; + double t0 = GetTime()*1000.0; models[i] = LoadModel(voxFileNames[i]); - double t1 = GetTime() * 1000.0; + double t1 = GetTime()*1000.0; TraceLog(LOG_WARNING, TextFormat("[%s] File loaded in %.3f ms", voxFileNames[i], t1 - t0)); // Compute model translation matrix to center model on draw position (0, 0 , 0) BoundingBox bb = GetModelBoundingBox(models[i]); Vector3 center = { 0 }; - center.x = bb.min.x + (((bb.max.x - bb.min.x) / 2)); - center.z = bb.min.z + (((bb.max.z - bb.min.z) / 2)); + center.x = bb.min.x + (((bb.max.x - bb.min.x)/2)); + center.z = bb.min.z + (((bb.max.z - bb.min.z)/2)); Matrix matTranslate = MatrixTranslate(-center.x, 0, -center.z); models[i].transform = matTranslate; @@ -82,14 +81,13 @@ int main(void) int currentModel = 0; - //-------------------------------------------------------------------------------------- // Load voxel shader Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/voxel_lighting.vs", GLSL_VERSION), TextFormat("resources/shaders/glsl%i/voxel_lighting.fs", GLSL_VERSION)); // Get some required shader locations shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); - // NOTE: "matModel" location name is automatically assigned on shader loading, + // NOTE: "matModel" location name is automatically assigned on shader loading, // no need to get the location again if using that uniform name //shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); diff --git a/examples/models/models_mesh_generation.c b/examples/models/models_mesh_generation.c index b06675db4..770846c16 100644 --- a/examples/models/models_mesh_generation.c +++ b/examples/models/models_mesh_generation.c @@ -47,7 +47,7 @@ int main(void) models[6] = LoadModelFromMesh(GenMeshKnot(1.0f, 2.0f, 16, 128)); models[7] = LoadModelFromMesh(GenMeshPoly(5, 2.0f)); models[8] = LoadModelFromMesh(GenMeshCustom()); - + // NOTE: Generated meshes could be exported using ExportMesh() // Set checked texture as default diffuse component for all models material diff --git a/examples/models/models_mesh_picking.c b/examples/models/models_mesh_picking.c index dbfafec4c..141bfd504 100644 --- a/examples/models/models_mesh_picking.c +++ b/examples/models/models_mesh_picking.c @@ -142,7 +142,7 @@ int main(void) RayCollision meshHitInfo = { 0 }; for (int m = 0; m < tower.meshCount; m++) { - // NOTE: We consider the model.transform for the collision check but + // NOTE: We consider the model.transform for the collision check but // it can be checked against any transform Matrix, used when checking against same // model drawn multiple times with multiple transforms meshHitInfo = GetRayCollisionMesh(ray, tower.meshes[m], tower.transform); @@ -150,7 +150,7 @@ int main(void) { // Save the closest hit mesh if ((!collision.hit) || (collision.distance > meshHitInfo.distance)) collision = meshHitInfo; - + break; // Stop once one mesh collision is detected, the colliding mesh is m } } diff --git a/examples/models/models_point_rendering.c b/examples/models/models_point_rendering.c index 47d349e59..748e72524 100644 --- a/examples/models/models_point_rendering.c +++ b/examples/models/models_point_rendering.c @@ -50,10 +50,10 @@ int main() bool useDrawModelPoints = true; bool numPointsChanged = false; int numPoints = 1000; - + Mesh mesh = GenMeshPoints(numPoints); Model model = LoadModelFromMesh(mesh); - + //SetTargetFPS(60); //-------------------------------------------------------------------------------------- @@ -119,14 +119,14 @@ int main() .b = mesh.colors[i*4 + 2], .a = mesh.colors[i*4 + 3], }; - + DrawPoint3D(pos, color); } } // Draw a unit sphere for reference DrawSphereWires(position, 1.0f, 10, 10, YELLOW); - + EndMode3D(); // Draw UI text @@ -134,12 +134,12 @@ int main() DrawText("Up - increase points", 20, 70, 20, WHITE); DrawText("Down - decrease points", 20, 100, 20, WHITE); DrawText("Space - drawing function", 20, 130, 20, WHITE); - + if (useDrawModelPoints) DrawText("Using: DrawModelPoints()", 20, 160, 20, GREEN); else DrawText("Using: DrawPoint3D()", 20, 160, 20, RED); - + DrawFPS(10, 10); - + EndDrawing(); //---------------------------------------------------------------------------------- } @@ -156,7 +156,7 @@ int main() // Generate a spherical point cloud static Mesh GenMeshPoints(int numPoints) { - Mesh mesh = { + Mesh mesh = { .triangleCount = 1, .vertexCount = numPoints, .vertices = (float *)MemAlloc(numPoints*3*sizeof(float)), @@ -169,13 +169,13 @@ static Mesh GenMeshPoints(int numPoints) float theta = ((float)PI*rand())/RAND_MAX; float phi = (2.0f*PI*rand())/RAND_MAX; float r = (10.0f*rand())/RAND_MAX; - + mesh.vertices[i*3 + 0] = r*sinf(theta)*cosf(phi); mesh.vertices[i*3 + 1] = r*sinf(theta)*sinf(phi); mesh.vertices[i*3 + 2] = r*cosf(theta); - + Color color = ColorFromHSV(r*360.0f, 1.0f, 1.0f); - + mesh.colors[i*4 + 0] = color.r; mesh.colors[i*4 + 1] = color.g; mesh.colors[i*4 + 2] = color.b; @@ -184,6 +184,6 @@ static Mesh GenMeshPoints(int numPoints) // Upload mesh data from CPU (RAM) to GPU (VRAM) memory UploadMesh(&mesh, false); - + return mesh; } diff --git a/examples/models/models_rlgl_solar_system.c b/examples/models/models_rlgl_solar_system.c index 1f7a3ab54..ad712cb71 100644 --- a/examples/models/models_rlgl_solar_system.c +++ b/examples/models/models_rlgl_solar_system.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [models] example - rlgl module usage with push/pop matrix transformations +* raylib [models] example - rlgl solar system * * Example complexity rating: [★★★★] 4/4 * @@ -41,7 +41,7 @@ int main(void) const float moonRadius = 0.16f; const float moonOrbitRadius = 1.5f; - InitWindow(screenWidth, screenHeight, "raylib [models] example - rlgl module usage with push/pop matrix transformations"); + InitWindow(screenWidth, screenHeight, "raylib [models] example - rlgl solar system"); // Define the camera to look into our 3d world Camera camera = { 0 }; diff --git a/examples/models/models_skybox.c b/examples/models/models_skybox.c index e816b27e1..a5304a93d 100644 --- a/examples/models/models_skybox.c +++ b/examples/models/models_skybox.c @@ -70,7 +70,7 @@ int main(void) SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT); char skyboxFileName[256] = { 0 }; - + if (useHDR) { TextCopy(skyboxFileName, "resources/dresden_square_2k.hdr"); @@ -116,7 +116,7 @@ int main(void) { // Unload current cubemap texture to load new one UnloadTexture(skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture); - + if (useHDR) { // Load HDR panorama (sphere) texture @@ -124,7 +124,7 @@ int main(void) // Generate cubemap from panorama texture skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8); - + UnloadTexture(panorama); // Texture not required anymore, cubemap already generated } else @@ -223,7 +223,7 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s }; rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions - + // Activate and enable texture for drawing to cubemap faces rlActiveTextureSlot(0); rlEnableTexture(panorama.id); @@ -232,7 +232,7 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s { // Set the view matrix for the current cube face rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]); - + // Select the current cubemap face attachment for the fbo // WARNING: This function by default enables->attach->disables fbo!!! rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0); diff --git a/examples/models/models_tesseract_view.c b/examples/models/models_tesseract_view.c index 44484ca5b..661d078b4 100644 --- a/examples/models/models_tesseract_view.c +++ b/examples/models/models_tesseract_view.c @@ -32,7 +32,7 @@ int main(void) const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [models] example - tesseract view"); - + // Define the camera to look into our 3d world Camera camera = { 0 }; camera.position = (Vector3){ 4.0f, 4.0f, 4.0f }; // Camera position @@ -43,16 +43,16 @@ int main(void) // Find the coordinates by setting XYZW to +-1 Vector4 tesseract[16] = { - { 1, 1, 1, 1 }, { 1, 1, 1, -1 }, + { 1, 1, 1, 1 }, { 1, 1, 1, -1 }, { 1, 1, -1, 1 }, { 1, 1, -1, -1 }, - { 1, -1, 1, 1 }, { 1, -1, 1, -1 }, + { 1, -1, 1, 1 }, { 1, -1, 1, -1 }, { 1, -1, -1, 1 }, { 1, -1, -1, -1 }, - { -1, 1, 1, 1 }, { -1, 1, 1, -1 }, + { -1, 1, 1, 1 }, { -1, 1, 1, -1 }, { -1, 1, -1, 1 }, { -1, 1, -1, -1 }, - { -1, -1, 1, 1 }, { -1, -1, 1, -1 }, + { -1, -1, 1, 1 }, { -1, -1, 1, -1 }, { -1, -1, -1, 1 }, { -1, -1, -1, -1 }, }; - + float rotation = 0.0f; Vector3 transformed[16] = { 0 }; float wValues[16] = { 0 }; @@ -66,7 +66,7 @@ int main(void) // Update //---------------------------------------------------------------------------------- rotation = DEG2RAD*45.0f*GetTime(); - + for (int i = 0; i < 16; i++) { Vector4 p = tesseract[i]; @@ -92,9 +92,9 @@ int main(void) // Draw //---------------------------------------------------------------------------------- BeginDrawing(); - + ClearBackground(RAYWHITE); - + BeginMode3D(camera); for (int i = 0; i < 16; i++) { @@ -114,7 +114,7 @@ int main(void) } } EndMode3D(); - + EndDrawing(); //---------------------------------------------------------------------------------- } diff --git a/examples/models/models_waving_cubes.c b/examples/models/models_waving_cubes.c index 6608eba48..455d85e18 100644 --- a/examples/models/models_waving_cubes.c +++ b/examples/models/models_waving_cubes.c @@ -91,7 +91,7 @@ int main() }; // Pick a color with a hue depending on cube position for the rainbow color effect - // NOTE: This function is quite costly to be done per cube and frame, + // NOTE: This function is quite costly to be done per cube and frame, // pre-catching the results into a separate array could improve performance Color cubeColor = ColorFromHSV((float)(((x + y + z)*18)%360), 0.75f, 0.9f); diff --git a/examples/models/resources/shaders/glsl120/cubemap.fs b/examples/models/resources/shaders/glsl120/cubemap.fs new file mode 100644 index 000000000..529ee4ab9 --- /dev/null +++ b/examples/models/resources/shaders/glsl120/cubemap.fs @@ -0,0 +1,27 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec3 fragPosition; + +// Input uniform values +uniform sampler2D equirectangularMap; + +vec2 SampleSphericalMap(vec3 v) +{ + vec2 uv = vec2(atan(v.z, v.x), asin(v.y)); + uv *= vec2(0.1591, 0.3183); + uv += 0.5; + return uv; +} + +void main() +{ + // Normalize local position + vec2 uv = SampleSphericalMap(normalize(fragPosition)); + + // Fetch color from texture map + vec3 color = texture2D(equirectangularMap, uv).rgb; + + // Calculate final fragment color + gl_FragColor = vec4(color, 1.0); +} diff --git a/examples/models/resources/shaders/glsl120/cubemap.vs b/examples/models/resources/shaders/glsl120/cubemap.vs new file mode 100644 index 000000000..8ce230503 --- /dev/null +++ b/examples/models/resources/shaders/glsl120/cubemap.vs @@ -0,0 +1,20 @@ +#version 120 + +// Input vertex attributes +attribute vec3 vertexPosition; + +// Input uniform values +uniform mat4 matProjection; +uniform mat4 matView; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; + +void main() +{ + // Calculate fragment position based on model transformations + fragPosition = vertexPosition; + + // Calculate final vertex position + gl_Position = matProjection*matView*vec4(vertexPosition, 1.0); +} diff --git a/examples/models/resources/shaders/glsl120/skinning.fs b/examples/models/resources/shaders/glsl120/skinning.fs new file mode 100644 index 000000000..44c6314d1 --- /dev/null +++ b/examples/models/resources/shaders/glsl120/skinning.fs @@ -0,0 +1,18 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +void main() +{ + // Fetch color from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + + // Calculate final fragment color + gl_FragColor = texelColor*colDiffuse*fragColor; +} diff --git a/examples/models/resources/shaders/glsl120/skinning.vs b/examples/models/resources/shaders/glsl120/skinning.vs new file mode 100644 index 000000000..c08840b54 --- /dev/null +++ b/examples/models/resources/shaders/glsl120/skinning.vs @@ -0,0 +1,59 @@ +#version 120 + +#define MAX_BONE_NUM 64 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec4 vertexColor; +attribute vec4 vertexBoneIds; +attribute vec4 vertexBoneWeights; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 boneMatrices[MAX_BONE_NUM]; + +// Output vertex attributes (to fragment shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +void main() +{ + int boneIndex0 = int(vertexBoneIds.x); + int boneIndex1 = int(vertexBoneIds.y); + int boneIndex2 = int(vertexBoneIds.z); + int boneIndex3 = int(vertexBoneIds.w); + + // WARNING: OpenGL ES 2.0 does not support automatic matrix transposing, neither transpose() function + mat4 boneMatrixTransposed0 = mat4( + vec4(boneMatrices[boneIndex0][0].x, boneMatrices[boneIndex0][1].x, boneMatrices[boneIndex0][2].x, boneMatrices[boneIndex0][3].x), + vec4(boneMatrices[boneIndex0][0].y, boneMatrices[boneIndex0][1].y, boneMatrices[boneIndex0][2].y, boneMatrices[boneIndex0][3].y), + vec4(boneMatrices[boneIndex0][0].z, boneMatrices[boneIndex0][1].z, boneMatrices[boneIndex0][2].z, boneMatrices[boneIndex0][3].z), + vec4(boneMatrices[boneIndex0][0].w, boneMatrices[boneIndex0][1].w, boneMatrices[boneIndex0][2].w, boneMatrices[boneIndex0][3].w)); + mat4 boneMatrixTransposed1 = mat4( + vec4(boneMatrices[boneIndex1][0].x, boneMatrices[boneIndex1][1].x, boneMatrices[boneIndex1][2].x, boneMatrices[boneIndex1][3].x), + vec4(boneMatrices[boneIndex1][0].y, boneMatrices[boneIndex1][1].y, boneMatrices[boneIndex1][2].y, boneMatrices[boneIndex1][3].y), + vec4(boneMatrices[boneIndex1][0].z, boneMatrices[boneIndex1][1].z, boneMatrices[boneIndex1][2].z, boneMatrices[boneIndex1][3].z), + vec4(boneMatrices[boneIndex1][0].w, boneMatrices[boneIndex1][1].w, boneMatrices[boneIndex1][2].w, boneMatrices[boneIndex1][3].w)); + mat4 boneMatrixTransposed2 = mat4( + vec4(boneMatrices[boneIndex2][0].x, boneMatrices[boneIndex2][1].x, boneMatrices[boneIndex2][2].x, boneMatrices[boneIndex2][3].x), + vec4(boneMatrices[boneIndex2][0].y, boneMatrices[boneIndex2][1].y, boneMatrices[boneIndex2][2].y, boneMatrices[boneIndex2][3].y), + vec4(boneMatrices[boneIndex2][0].z, boneMatrices[boneIndex2][1].z, boneMatrices[boneIndex2][2].z, boneMatrices[boneIndex2][3].z), + vec4(boneMatrices[boneIndex2][0].w, boneMatrices[boneIndex2][1].w, boneMatrices[boneIndex2][2].w, boneMatrices[boneIndex2][3].w)); + mat4 boneMatrixTransposed3 = mat4( + vec4(boneMatrices[boneIndex3][0].x, boneMatrices[boneIndex3][1].x, boneMatrices[boneIndex3][2].x, boneMatrices[boneIndex3][3].x), + vec4(boneMatrices[boneIndex3][0].y, boneMatrices[boneIndex3][1].y, boneMatrices[boneIndex3][2].y, boneMatrices[boneIndex3][3].y), + vec4(boneMatrices[boneIndex3][0].z, boneMatrices[boneIndex3][1].z, boneMatrices[boneIndex3][2].z, boneMatrices[boneIndex3][3].z), + vec4(boneMatrices[boneIndex3][0].w, boneMatrices[boneIndex3][1].w, boneMatrices[boneIndex3][2].w, boneMatrices[boneIndex3][3].w)); + + vec4 skinnedPosition = + vertexBoneWeights.x*(boneMatrixTransposed0*vec4(vertexPosition, 1.0)) + + vertexBoneWeights.y*(boneMatrixTransposed1*vec4(vertexPosition, 1.0)) + + vertexBoneWeights.z*(boneMatrixTransposed2*vec4(vertexPosition, 1.0)) + + vertexBoneWeights.w*(boneMatrixTransposed3*vec4(vertexPosition, 1.0)); + + fragTexCoord = vertexTexCoord; + fragColor = vertexColor; + + gl_Position = mvp*skinnedPosition; +} \ No newline at end of file diff --git a/examples/models/resources/shaders/glsl120/skybox.fs b/examples/models/resources/shaders/glsl120/skybox.fs new file mode 100644 index 000000000..ec9a3c274 --- /dev/null +++ b/examples/models/resources/shaders/glsl120/skybox.fs @@ -0,0 +1,29 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec3 fragPosition; + +// Input uniform values +uniform samplerCube environmentMap; +uniform bool vflipped; +uniform bool doGamma; + +void main() +{ + // Fetch color from texture map + vec4 texelColor = vec4(0.0); + + if (vflipped) texelColor = textureCube(environmentMap, vec3(fragPosition.x, -fragPosition.y, fragPosition.z)); + else texelColor = textureCube(environmentMap, fragPosition); + + vec3 color = vec3(texelColor.x, texelColor.y, texelColor.z); + + if (doGamma) // Apply gamma correction + { + color = color/(color + vec3(1.0)); + color = pow(color, vec3(1.0/2.2)); + } + + // Calculate final fragment color + gl_FragColor = vec4(color, 1.0); +} diff --git a/examples/models/resources/shaders/glsl120/skybox.vs b/examples/models/resources/shaders/glsl120/skybox.vs new file mode 100644 index 000000000..71c933ea5 --- /dev/null +++ b/examples/models/resources/shaders/glsl120/skybox.vs @@ -0,0 +1,24 @@ +#version 120 + +// Input vertex attributes +attribute vec3 vertexPosition; + +// Input uniform values +uniform mat4 matProjection; +uniform mat4 matView; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; + +void main() +{ + // Calculate fragment position based on model transformations + fragPosition = vertexPosition; + + // Remove translation from the view matrix + mat4 rotView = mat4(mat3(matView)); + vec4 clipPos = matProjection*rotView*vec4(vertexPosition, 1.0); + + // Calculate final vertex position + gl_Position = clipPos; +} diff --git a/examples/others/easings_testbed.c b/examples/others/easings_testbed.c index e3fa0e84b..31daeecee 100644 --- a/examples/others/easings_testbed.c +++ b/examples/others/easings_testbed.c @@ -221,10 +221,12 @@ int main(void) } -// NoEase function, used when "no easing" is selected for any axis. It just ignores all parameters besides b. +// NoEase function, used when "no easing" is selected for any axis +// It just ignores all parameters besides b static float NoEase(float t, float b, float c, float d) { - float burn = t + b + c + d; // Hack to avoid compiler warning (about unused variables) + // Hack to avoid compiler warning (about unused variables) + float burn = t + b + c + d; d += burn; return b; diff --git a/examples/others/raylib_opengl_interop.c b/examples/others/raylib_opengl_interop.c index 9ab2bb220..4dc534d12 100644 --- a/examples/others/raylib_opengl_interop.c +++ b/examples/others/raylib_opengl_interop.c @@ -16,13 +16,13 @@ ******************************************************************************************** * * Mixes raylib and plain OpenGL code to draw a GL_POINTS based particle system. The -* primary point is to demonstrate raylib and OpenGL interop. +* primary point is to demonstrate raylib and OpenGL interop * * rlgl batched draw operations internally so we have to flush the current batch before -* doing our own OpenGL work (rlDrawRenderBatchActive()). +* doing our own OpenGL work (rlDrawRenderBatchActive()) * * The example also demonstrates how to get the current model view projection matrix of -* raylib. That way raylib cameras and so on work as expected. +* raylib. That way raylib cameras and so on work as expected * ********************************************************************************************/ @@ -30,18 +30,18 @@ #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_DESKTOP_SDL) #if defined(GRAPHICS_API_OPENGL_ES2) - #include "glad_gles2.h" // Required for: OpenGL functionality + #include "glad_gles2.h" // Required for: OpenGL functionality #define glGenVertexArrays glGenVertexArraysOES #define glBindVertexArray glBindVertexArrayOES #define glDeleteVertexArrays glDeleteVertexArraysOES #define GLSL_VERSION 100 #else #if defined(__APPLE__) - #define GL_SILENCE_DEPRECATION // Silence Opengl API deprecation warnings + #define GL_SILENCE_DEPRECATION // Silence Opengl API deprecation warnings #include // OpenGL 3 library for OSX #include // OpenGL 3 extensions library for OSX #else - #include "glad.h" // Required for: OpenGL functionality + #include "glad.h" // Required for: OpenGL functionality #endif #define GLSL_VERSION 330 #endif @@ -71,7 +71,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib - point particles"); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - point particles"); Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/point_particle.vs", GLSL_VERSION), TextFormat("resources/shaders/glsl%i/point_particle.fs", GLSL_VERSION)); @@ -86,14 +86,14 @@ int main(void) { particles[i].x = (float)GetRandomValue(20, screenWidth - 20); particles[i].y = (float)GetRandomValue(50, screenHeight - 20); - - // Give each particle a slightly different period. But don't spread it to much. - // This way the particles line up every so often and you get a glimps of what is going on. + + // Give each particle a slightly different period. But don't spread it to much + // This way the particles line up every so often and you get a glimps of what is going on particles[i].period = (float)GetRandomValue(10, 30)/10.0f; } - // Create a plain OpenGL vertex buffer with the data and an vertex array object - // that feeds the data from the buffer into the vertexPosition shader attribute. + // Create a plain OpenGL vertex buffer with the data and an vertex array object + // that feeds the data from the buffer into the vertexPosition shader attribute GLuint vao = 0; GLuint vbo = 0; glGenVertexArrays(1, &vao); @@ -125,13 +125,13 @@ int main(void) DrawRectangle(10, 10, 210, 30, MAROON); DrawText(TextFormat("%zu particles in one vertex buffer", MAX_PARTICLES), 20, 20, 10, RAYWHITE); - + rlDrawRenderBatchActive(); // Draw iternal buffers data (previous draw calls) // Switch to plain OpenGL //------------------------------------------------------------------------------ glUseProgram(shader.id); - + glUniform1f(currentTimeLoc, GetTime()); Vector4 color = ColorNormalize((Color){ 255, 0, 0, 128 }); @@ -139,18 +139,18 @@ int main(void) // Get the current modelview and projection matrix so the particle system is displayed and transformed Matrix modelViewProjection = MatrixMultiply(rlGetMatrixModelview(), rlGetMatrixProjection()); - + glUniformMatrix4fv(shader.locs[SHADER_LOC_MATRIX_MVP], 1, false, MatrixToFloat(modelViewProjection)); glBindVertexArray(vao); glDrawArrays(GL_POINTS, 0, MAX_PARTICLES); glBindVertexArray(0); - + glUseProgram(0); //------------------------------------------------------------------------------ - + DrawFPS(screenWidth - 100, 10); - + EndDrawing(); //---------------------------------------------------------------------------------- } diff --git a/examples/others/raymath_vector_angle.c b/examples/others/raymath_vector_angle.c index 414546ac6..1d49cec66 100644 --- a/examples/others/raymath_vector_angle.c +++ b/examples/others/raymath_vector_angle.c @@ -12,7 +12,7 @@ * Copyright (c) 2023-2025 Ramon Santamaria (@raysan5) * ********************************************************************************************/ - + #include "raylib.h" #include "raymath.h" @@ -32,7 +32,7 @@ int main(void) Vector2 v0 = { screenWidth/2, screenHeight/2 }; Vector2 v1 = Vector2Add(v0, (Vector2){ 100.0f, 80.0f }); Vector2 v2 = { 0 }; // Updated with mouse position - + float angle = 0.0f; // Angle in degrees int angleMode = 0; // 0-Vector2Angle(), 1-Vector2LineAngle() @@ -47,12 +47,12 @@ int main(void) float startangle = 0.0f; if (angleMode == 0) startangle = -Vector2LineAngle(v0, v1)*RAD2DEG; - if (angleMode == 1) startangle = 0.0f; + if (angleMode == 1) startangle = 0.0f; v2 = GetMousePosition(); if (IsKeyPressed(KEY_SPACE)) angleMode = !angleMode; - + if ((angleMode == 0) && IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) v1 = GetMousePosition(); if (angleMode == 0) @@ -75,12 +75,12 @@ int main(void) BeginDrawing(); ClearBackground(RAYWHITE); - + if (angleMode == 0) { DrawText("MODE 0: Angle between V1 and V2", 10, 10, 20, BLACK); DrawText("Right Click to Move V2", 10, 30, 20, DARKGRAY); - + DrawLineEx(v0, v1, 2.0f, BLACK); DrawLineEx(v0, v2, 2.0f, RED); @@ -89,13 +89,13 @@ int main(void) else if (angleMode == 1) { DrawText("MODE 1: Angle formed by line V1 to V2", 10, 10, 20, BLACK); - + DrawLine(0, screenHeight/2, screenWidth, screenHeight/2, LIGHTGRAY); DrawLineEx(v0, v2, 2.0f, RED); DrawCircleSector(v0, 40.0f, startangle, startangle - angle, 32, Fade(GREEN, 0.6f)); } - + DrawText("v0", v0.x, v0.y, 10, DARKGRAY); // If the line from v0 to v1 would overlap the text, move it's position up 10 @@ -110,7 +110,7 @@ int main(void) DrawText("Press SPACE to change MODE", 460, 10, 20, DARKGRAY); DrawText(TextFormat("ANGLE: %2.2f", angle), 10, 70, 20, LIME); - + EndDrawing(); //---------------------------------------------------------------------------------- } diff --git a/examples/others/rlgl_compute_shader.c b/examples/others/rlgl_compute_shader.c index b17ba711a..07a10b1d5 100644 --- a/examples/others/rlgl_compute_shader.c +++ b/examples/others/rlgl_compute_shader.c @@ -23,11 +23,11 @@ #include -// IMPORTANT: This must match gol*.glsl GOL_WIDTH constant. -// This must be a multiple of 16 (check golLogic compute dispatch). +// IMPORTANT: This must match gol*.glsl GOL_WIDTH constant +// This must be a multiple of 16 (check golLogic compute dispatch) #define GOL_WIDTH 768 -// Maximum amount of queued draw commands (squares draw from mouse down events). +// Maximum amount of queued draw commands (squares draw from mouse down events) #define MAX_BUFFERED_TRANSFERTS 48 // Game Of Life Update Command @@ -51,9 +51,12 @@ int main(void) { // Initialization //-------------------------------------------------------------------------------------- - InitWindow(GOL_WIDTH, GOL_WIDTH, "raylib [rlgl] example - compute shader - game of life"); + const int screenWidth = GOL_WIDTH; + const int screenHeight = GOL_WIDTH; - const Vector2 resolution = { GOL_WIDTH, GOL_WIDTH }; + InitWindow(screenWidth, screenHeight, "raylib [rlgl] example - compute shader - game of life"); + + const Vector2 resolution = { screenWidth, screenHeight }; unsigned int brushSize = 8; // Game of Life logic compute shader @@ -157,7 +160,7 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- - // Unload shader buffers objects. + // Unload shader buffers objects rlUnloadShaderBuffer(ssboA); rlUnloadShaderBuffer(ssboB); rlUnloadShaderBuffer(ssboTransfert); diff --git a/examples/others/rlgl_standalone.c b/examples/others/rlgl_standalone.c index 713d1b908..631699a5d 100644 --- a/examples/others/rlgl_standalone.c +++ b/examples/others/rlgl_standalone.c @@ -9,7 +9,7 @@ * * Example originally created with raylib 1.6, last time updated with raylib 4.0 * -* WARNING: This example is intended only for PLATFORM_DESKTOP and OpenGL 3.3 Core profile. +* WARNING: This example is intended only for PLATFORM_DESKTOP and OpenGL 3.3 Core profile * It could work on other platforms if redesigned for those platforms (out-of-scope) * * DEPENDENCIES: @@ -48,7 +48,7 @@ * 2. Altered source versions must be plainly marked as such, and must not be misrepresented * as being the original software. * -* 3. This notice may not be removed or altered from any source distribution. +* 3. This notice may not be removed or altered from any source distribution * ********************************************************************************************/ @@ -137,7 +137,7 @@ int main(void) glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_DEPTH_BITS, 16); - + // WARNING: OpenGL 3.3 Core profile only glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); diff --git a/examples/shaders/resources/shaders/glsl100/normalmap.fs b/examples/shaders/resources/shaders/glsl100/normalmap.fs new file mode 100644 index 000000000..02902a61f --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/normalmap.fs @@ -0,0 +1,64 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec3 fragNormal; //used for when normal mapping is toggled off +varying vec4 fragColor; +varying mat3 TBN; + +// Input uniform values +uniform sampler2D texture0; +uniform sampler2D normalMap; +uniform vec4 colDiffuse; +uniform vec3 viewPos; + +// NOTE: Add your custom variables here + +uniform vec3 lightPos; +uniform bool useNormalMap; +uniform float specularExponent; + +void main() +{ + vec4 texelColor = texture(texture0, vec2(fragTexCoord.x, fragTexCoord.y)); + vec3 specular = vec3(0.0); + vec3 viewDir = normalize(viewPos - fragPosition); + vec3 lightDir = normalize(lightPos - fragPosition); + + vec3 normal; + if (useNormalMap) + { + normal = texture(normalMap, vec2(fragTexCoord.x, fragTexCoord.y)).rgb; + + //Transform normal values to the range -1.0 ... 1.0 + normal = normalize(normal * 2.0 - 1.0); + + //Transform the normal from tangent-space to world-space for lighting calculation + normal = normalize(normal * TBN); + } + else + { + normal = normalize(fragNormal); + } + + vec4 tint = colDiffuse * fragColor; + + vec3 lightColor = vec3(1.0, 1.0, 1.0); + float NdotL = max(dot(normal, lightDir), 0.0); + vec3 lightDot = lightColor * NdotL; + + float specCo = 0.0; + + if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent); // 16 refers to shine + + specular += specCo; + + finalColor = (texelColor * ((tint + vec4(specular, 1.0)) * vec4(lightDot, 1.0))); + finalColor += texelColor * (vec4(1.0, 1.0, 1.0, 1.0) / 40.0) * tint; + + // Gamma correction + gl_FragColor = pow(finalColor, vec4(1.0 / 2.2)); +} diff --git a/examples/shaders/resources/shaders/glsl100/normalmap.vs b/examples/shaders/resources/shaders/glsl100/normalmap.vs new file mode 100644 index 000000000..072e0a6c2 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/normalmap.vs @@ -0,0 +1,76 @@ +#version 100 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec3 vertexNormal; +attribute vec4 vertexTangent; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec3 fragNormal; //used for when normal mapping is toggled off +varying vec4 fragColor; +varying mat3 TBN; + +// NOTE: Add your custom variables here + +// https://github.com/glslify/glsl-inverse +mat3 inverse(mat3 m) +{ + float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2]; + float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2]; + float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2]; + + float b01 = a22 * a11 - a12 * a21; + float b11 = -a22 * a10 + a12 * a20; + float b21 = a21 * a10 - a11 * a20; + + float det = a00 * b01 + a01 * b11 + a02 * b21; + + return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11), + b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10), + b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det; +} + +// https://github.com/glslify/glsl-transpose +mat3 transpose(mat3 m) +{ + return mat3(m[0][0], m[1][0], m[2][0], + m[0][1], m[1][1], m[2][1], + m[0][2], m[1][2], m[2][2]); +} + +void main() +{ + // Compute binormal from vertex normal and tangent. W component is the tangent handedness + vec3 vertexBinormal = cross(vertexNormal, vertexTangent.xyz) * vertexTangent.w; + + // Compute fragment normal based on normal transformations + mat3 normalMatrix = transpose(inverse(mat3(matModel))); + + // Compute fragment position based on model transformations + fragPosition = vec3(matModel * vec4(vertexPosition, 1.0)); + + //Create TBN matrix for transforming the normal map values from tangent-space to world-space + fragNormal = normalize(normalMatrix * vertexNormal); + + vec3 fragTangent = normalize(normalMatrix * vertexTangent.xyz); + fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal) * fragNormal); + + vec3 fragBinormal = normalize(normalMatrix * vertexBinormal); + fragBinormal = cross(fragNormal, fragTangent); + + TBN = transpose(mat3(fragTangent, fragBinormal, fragNormal)); + + fragColor = vertexColor; + + fragTexCoord = vertexTexCoord; + + gl_Position = mvp * vec4(vertexPosition, 1.0); +} diff --git a/examples/shaders/resources/shaders/glsl120/depth.fs b/examples/shaders/resources/shaders/glsl120/depth.fs new file mode 100644 index 000000000..5cf6ef71b --- /dev/null +++ b/examples/shaders/resources/shaders/glsl120/depth.fs @@ -0,0 +1,28 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; + +// Input uniform values +uniform sampler2D depthTexture; +uniform bool flipY; + +float nearPlane = 0.1; +float farPlane = 100.0; + +void main() +{ + // Handle potential Y-flipping + vec2 texCoord = fragTexCoord; + if (flipY) + texCoord.y = 1.0 - texCoord.y; + + // Sample depth texture + float depth = texture2D(depthTexture, texCoord).r; + + // Linearize depth + float linearDepth = (2.0*nearPlane)/(farPlane + nearPlane - depth*(farPlane - nearPlane)); + + // Output final color + gl_FragColor = vec4(vec3(linearDepth), 1.0); +} \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl120/normalmap.fs b/examples/shaders/resources/shaders/glsl120/normalmap.fs new file mode 100644 index 000000000..caeb4d5c1 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl120/normalmap.fs @@ -0,0 +1,62 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec3 fragNormal; //used for when normal mapping is toggled off +varying vec4 fragColor; +varying mat3 TBN; + +// Input uniform values +uniform sampler2D texture0; +uniform sampler2D normalMap; +uniform vec4 colDiffuse; +uniform vec3 viewPos; + +// NOTE: Add your custom variables here + +uniform vec3 lightPos; +uniform bool useNormalMap; +uniform float specularExponent; + +void main() +{ + vec4 texelColor = texture(texture0, vec2(fragTexCoord.x, fragTexCoord.y)); + vec3 specular = vec3(0.0); + vec3 viewDir = normalize(viewPos - fragPosition); + vec3 lightDir = normalize(lightPos - fragPosition); + + vec3 normal; + if (useNormalMap) + { + normal = texture(normalMap, vec2(fragTexCoord.x, fragTexCoord.y)).rgb; + + //Transform normal values to the range -1.0 ... 1.0 + normal = normalize(normal * 2.0 - 1.0); + + //Transform the normal from tangent-space to world-space for lighting calculation + normal = normalize(normal * TBN); + } + else + { + normal = normalize(fragNormal); + } + + vec4 tint = colDiffuse * fragColor; + + vec3 lightColor = vec3(1.0, 1.0, 1.0); + float NdotL = max(dot(normal, lightDir), 0.0); + vec3 lightDot = lightColor * NdotL; + + float specCo = 0.0; + + if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent); // 16 refers to shine + + specular += specCo; + + finalColor = (texelColor * ((tint + vec4(specular, 1.0)) * vec4(lightDot, 1.0))); + finalColor += texelColor * (vec4(1.0, 1.0, 1.0, 1.0) / 40.0) * tint; + + // Gamma correction + gl_FragColor = pow(finalColor, vec4(1.0 / 2.2)); +} diff --git a/examples/shaders/resources/shaders/glsl120/normalmap.vs b/examples/shaders/resources/shaders/glsl120/normalmap.vs new file mode 100644 index 000000000..d8921a68f --- /dev/null +++ b/examples/shaders/resources/shaders/glsl120/normalmap.vs @@ -0,0 +1,76 @@ +#version 120 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec3 vertexNormal; +attribute vec4 vertexTangent; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec3 fragNormal; //used for when normal mapping is toggled off +varying vec4 fragColor; +varying mat3 TBN; + +// NOTE: Add your custom variables here + +// https://github.com/glslify/glsl-inverse +mat3 inverse(mat3 m) +{ + float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2]; + float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2]; + float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2]; + + float b01 = a22 * a11 - a12 * a21; + float b11 = -a22 * a10 + a12 * a20; + float b21 = a21 * a10 - a11 * a20; + + float det = a00 * b01 + a01 * b11 + a02 * b21; + + return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11), + b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10), + b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det; +} + +// https://github.com/glslify/glsl-transpose +mat3 transpose(mat3 m) +{ + return mat3(m[0][0], m[1][0], m[2][0], + m[0][1], m[1][1], m[2][1], + m[0][2], m[1][2], m[2][2]); +} + +void main() +{ + // Compute binormal from vertex normal and tangent. W component is the tangent handedness + vec3 vertexBinormal = cross(vertexNormal, vertexTangent.xyz) * vertexTangent.w; + + // Compute fragment normal based on normal transformations + mat3 normalMatrix = transpose(inverse(mat3(matModel))); + + // Compute fragment position based on model transformations + fragPosition = vec3(matModel * vec4(vertexPosition, 1.0)); + + //Create TBN matrix for transforming the normal map values from tangent-space to world-space + fragNormal = normalize(normalMatrix * vertexNormal); + + vec3 fragTangent = normalize(normalMatrix * vertexTangent.xyz); + fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal) * fragNormal); + + vec3 fragBinormal = normalize(normalMatrix * vertexBinormal); + fragBinormal = cross(fragNormal, fragTangent); + + TBN = transpose(mat3(fragTangent, fragBinormal, fragNormal)); + + fragColor = vertexColor; + + fragTexCoord = vertexTexCoord; + + gl_Position = mvp * vec4(vertexPosition, 1.0); +} diff --git a/examples/shaders/resources/shaders/glsl330/normalmap.fs b/examples/shaders/resources/shaders/glsl330/normalmap.fs new file mode 100644 index 000000000..644130ab6 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl330/normalmap.fs @@ -0,0 +1,67 @@ +#version 330 + +// Input vertex attributes (from vertex shader) +in vec3 fragPosition; +in vec2 fragTexCoord; +in vec3 fragNormal; //used for when normal mapping is toggled off +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform sampler2D normalMap; +uniform vec4 colDiffuse; + +uniform vec3 viewPos; +uniform vec4 tintColor; + +uniform vec3 lightPos; +uniform bool useNormalMap; +uniform float specularExponent; + +// Output fragment color +out vec4 finalColor; + +in mat3 TBN; + +void main() +{ + vec4 texelColor = texture(texture0, vec2(fragTexCoord.x, fragTexCoord.y)); + vec3 specular = vec3(0.0); + vec3 viewDir = normalize(viewPos - fragPosition); + vec3 lightDir = normalize(lightPos - fragPosition); + + vec3 normal; + if (useNormalMap) + { + normal = texture(normalMap, vec2(fragTexCoord.x, fragTexCoord.y)).rgb; + + //Transform normal values to the range -1.0 ... 1.0 + normal = normalize(normal * 2.0 - 1.0); + + //Transform the normal from tangent-space to world-space for lighting calculation + normal = normalize(normal * TBN); + } + else + { + normal = normalize(fragNormal); + } + + vec4 tint = colDiffuse * fragColor; + + vec3 lightColor = vec3(1.0, 1.0, 1.0); + float NdotL = max(dot(normal, lightDir), 0.0); + vec3 lightDot = lightColor * NdotL; + + float specCo = 0.0; + + if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewDir, reflect(-lightDir, normal))), specularExponent); // 16 refers to shine + + specular += specCo; + + finalColor = (texelColor * ((tint + vec4(specular, 1.0)) * vec4(lightDot, 1.0))); + finalColor += texelColor * (vec4(1.0, 1.0, 1.0, 1.0) / 40.0) * tint; + + // Gamma correction + finalColor = pow(finalColor, vec4(1.0 / 2.2)); + //finalColor = vec4(normal, 1.0); +} diff --git a/examples/shaders/resources/shaders/glsl330/normalmap.vs b/examples/shaders/resources/shaders/glsl330/normalmap.vs new file mode 100644 index 000000000..1e0a161b8 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl330/normalmap.vs @@ -0,0 +1,48 @@ +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; +in vec2 vertexTexCoord; +in vec3 vertexNormal; +in vec4 vertexTangent; +in vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +out vec3 fragPosition; +out vec2 fragTexCoord; +out vec3 fragNormal; //used for when normal mapping is toggled off +out vec4 fragColor; +out mat3 TBN; + +void main() +{ + // Compute binormal from vertex normal and tangent. W component is the tangent handedness + vec3 vertexBinormal = cross(vertexNormal, vertexTangent.xyz) * vertexTangent.w; + + // Compute fragment normal based on normal transformations + mat3 normalMatrix = transpose(inverse(mat3(matModel))); + + // Compute fragment position based on model transformations + fragPosition = vec3(matModel * vec4(vertexPosition, 1.0)); + + //Create TBN matrix for transforming the normal map values from tangent-space to world-space + fragNormal = normalize(normalMatrix * vertexNormal); + + vec3 fragTangent = normalize(normalMatrix * vertexTangent.xyz); + fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal) * fragNormal); + + vec3 fragBinormal = normalize(normalMatrix * vertexBinormal); + fragBinormal = cross(fragNormal, fragTangent); + + TBN = transpose(mat3(fragTangent, fragBinormal, fragNormal)); + + fragColor = vertexColor; + + fragTexCoord = vertexTexCoord; + + gl_Position = mvp * vec4(vertexPosition, 1.0); +} diff --git a/examples/shaders/resources/tiles_diffuse.png b/examples/shaders/resources/tiles_diffuse.png new file mode 100644 index 000000000..1c7b84035 Binary files /dev/null and b/examples/shaders/resources/tiles_diffuse.png differ diff --git a/examples/shaders/resources/tiles_normal.png b/examples/shaders/resources/tiles_normal.png new file mode 100644 index 000000000..719cb2e0d Binary files /dev/null and b/examples/shaders/resources/tiles_normal.png differ diff --git a/examples/shaders/shaders_basic_lighting.c b/examples/shaders/shaders_basic_lighting.c index f115338a5..a2a392126 100644 --- a/examples/shaders/shaders_basic_lighting.c +++ b/examples/shaders/shaders_basic_lighting.c @@ -5,9 +5,9 @@ * Example complexity rating: [★★★★] 4/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * -* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3). +* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3) * * Example originally created with raylib 3.0, last time updated with raylib 4.2 * @@ -59,10 +59,10 @@ int main(void) TextFormat("resources/shaders/glsl%i/lighting.fs", GLSL_VERSION)); // Get some required shader locations shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); - // NOTE: "matModel" location name is automatically assigned on shader loading, + // NOTE: "matModel" location name is automatically assigned on shader loading, // no need to get the location again if using that uniform name //shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); - + // Ambient light level (some basic lighting) int ambientLoc = GetShaderLocation(shader, "ambient"); SetShaderValue(shader, ambientLoc, (float[4]){ 0.1f, 0.1f, 0.1f, 1.0f }, SHADER_UNIFORM_VEC4); @@ -87,13 +87,13 @@ int main(void) // Update the shader with the camera view vector (points towards { 0.0f, 0.0f, 0.0f }) float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z }; SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, SHADER_UNIFORM_VEC3); - + // Check key inputs to enable/disable lights if (IsKeyPressed(KEY_Y)) { lights[0].enabled = !lights[0].enabled; } if (IsKeyPressed(KEY_R)) { lights[1].enabled = !lights[1].enabled; } if (IsKeyPressed(KEY_G)) { lights[2].enabled = !lights[2].enabled; } if (IsKeyPressed(KEY_B)) { lights[3].enabled = !lights[3].enabled; } - + // Update light values (actually, only enable/disable them) for (int i = 0; i < MAX_LIGHTS; i++) UpdateLightValues(shader, lights[i]); //---------------------------------------------------------------------------------- diff --git a/examples/shaders/shaders_basic_pbr.c b/examples/shaders/shaders_basic_pbr.c index ffd95da64..2dff5d562 100644 --- a/examples/shaders/shaders_basic_pbr.c +++ b/examples/shaders/shaders_basic_pbr.c @@ -13,8 +13,8 @@ * * Copyright (c) 2023-2025 Afan OLOVCIC (@_DevDad) * -* Model: "Old Rusty Car" (https://skfb.ly/LxRy) by Renafox, -* licensed under Creative Commons Attribution-NonCommercial +* Model: "Old Rusty Car" (https://skfb.ly/LxRy) by Renafox, +* licensed under Creative Commons Attribution-NonCommercial * (http://creativecommons.org/licenses/by-nc/4.0/) * ********************************************************************************************/ @@ -105,7 +105,7 @@ int main() // shader already takes care of it accordingly shader.locs[SHADER_LOC_MAP_METALNESS] = GetShaderLocation(shader, "mraMap"); shader.locs[SHADER_LOC_MAP_NORMAL] = GetShaderLocation(shader, "normalMap"); - // WARNING: Similar to the MRA map, the emissive map packs different information + // WARNING: Similar to the MRA map, the emissive map packs different information // into a single texture: it stores height and emission data // It is binded to SHADER_LOC_MAP_EMISSION location an properly processed on shader shader.locs[SHADER_LOC_MAP_EMISSION] = GetShaderLocation(shader, "emissiveMap"); @@ -153,7 +153,7 @@ int main() car.materials[0].maps[MATERIAL_MAP_METALNESS].texture = LoadTexture("resources/old_car_mra.png"); car.materials[0].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("resources/old_car_n.png"); car.materials[0].maps[MATERIAL_MAP_EMISSION].texture = LoadTexture("resources/old_car_e.png"); - + // Load floor model mesh and assign material parameters // NOTE: A basic plane shape can be generated instead of being loaded from a model file Model floor = LoadModel("resources/models/plane.glb"); @@ -161,9 +161,9 @@ int main() //GenMeshTangents(&floorMesh); // TODO: Review tangents generation //Model floor = LoadModelFromMesh(floorMesh); - // Assign material shader for our floor model, same PBR shader + // Assign material shader for our floor model, same PBR shader floor.materials[0].shader = shader; - + floor.materials[0].maps[MATERIAL_MAP_ALBEDO].color = WHITE; floor.materials[0].maps[MATERIAL_MAP_METALNESS].value = 0.8f; floor.materials[0].maps[MATERIAL_MAP_ROUGHNESS].value = 0.1f; @@ -193,7 +193,7 @@ int main() SetShaderValue(shader, GetShaderLocation(shader, "useTexNormal"), &usage, SHADER_UNIFORM_INT); SetShaderValue(shader, GetShaderLocation(shader, "useTexMRA"), &usage, SHADER_UNIFORM_INT); SetShaderValue(shader, GetShaderLocation(shader, "useTexEmissive"), &usage, SHADER_UNIFORM_INT); - + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //--------------------------------------------------------------------------------------- @@ -227,11 +227,11 @@ int main() // Draw //---------------------------------------------------------------------------------- BeginDrawing(); - + ClearBackground(BLACK); - + BeginMode3D(camera); - + // Set floor model texture tiling and emissive color parameters on shader SetShaderValue(shader, textureTilingLoc, &floorTextureTiling, SHADER_UNIFORM_VEC2); Vector4 floorEmissiveColor = ColorNormalize(floor.materials[0].maps[MATERIAL_MAP_EMISSION].color); @@ -240,7 +240,7 @@ int main() // Set floor metallic and roughness values SetShaderValue(shader, metallicValueLoc, &floor.materials[0].maps[MATERIAL_MAP_METALNESS].value, SHADER_UNIFORM_FLOAT); SetShaderValue(shader, roughnessValueLoc, &floor.materials[0].maps[MATERIAL_MAP_ROUGHNESS].value, SHADER_UNIFORM_FLOAT); - + DrawModel(floor, (Vector3){ 0.0f, 0.0f, 0.0f }, 5.0f, WHITE); // Draw floor model // Set old car model texture tiling, emissive color and emissive intensity parameters on shader @@ -253,24 +253,24 @@ int main() // Set old car metallic and roughness values SetShaderValue(shader, metallicValueLoc, &car.materials[0].maps[MATERIAL_MAP_METALNESS].value, SHADER_UNIFORM_FLOAT); SetShaderValue(shader, roughnessValueLoc, &car.materials[0].maps[MATERIAL_MAP_ROUGHNESS].value, SHADER_UNIFORM_FLOAT); - + DrawModel(car, (Vector3){ 0.0f, 0.0f, 0.0f }, 0.25f, WHITE); // Draw car model // Draw spheres to show the lights positions for (int i = 0; i < MAX_LIGHTS; i++) { Color lightColor = (Color){ lights[i].color[0]*255, lights[i].color[1]*255, lights[i].color[2]*255, lights[i].color[3]*255 }; - + if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, lightColor); else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(lightColor, 0.3f)); } - + EndMode3D(); - + DrawText("Toggle lights: [1][2][3][4]", 10, 40, 20, LIGHTGRAY); DrawText("(c) Old Rusty Car model by Renafox (https://skfb.ly/LxRy)", screenWidth - 320, screenHeight - 20, 10, LIGHTGRAY); - + DrawFPS(10, 10); EndDrawing(); @@ -279,20 +279,20 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- - // Unbind (disconnect) shader from car.material[0] + // Unbind (disconnect) shader from car.material[0] // to avoid UnloadMaterial() trying to unload it automatically car.materials[0].shader = (Shader){ 0 }; UnloadMaterial(car.materials[0]); car.materials[0].maps = NULL; UnloadModel(car); - + floor.materials[0].shader = (Shader){ 0 }; UnloadMaterial(floor.materials[0]); floor.materials[0].maps = NULL; UnloadModel(floor); - + UnloadShader(shader); // Unload Shader - + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- @@ -316,7 +316,7 @@ static Light CreateLight(int type, Vector3 position, Vector3 target, Color color light.color[2] = (float)color.b/255.0f; light.color[3] = (float)color.a/255.0f; light.intensity = intensity; - + // NOTE: Shader parameters names for lights must match the requested ones light.enabledLoc = GetShaderLocation(shader, TextFormat("lights[%i].enabled", lightCount)); light.typeLoc = GetShaderLocation(shader, TextFormat("lights[%i].type", lightCount)); @@ -324,7 +324,7 @@ static Light CreateLight(int type, Vector3 position, Vector3 target, Color color light.targetLoc = GetShaderLocation(shader, TextFormat("lights[%i].target", lightCount)); light.colorLoc = GetShaderLocation(shader, TextFormat("lights[%i].color", lightCount)); light.intensityLoc = GetShaderLocation(shader, TextFormat("lights[%i].intensity", lightCount)); - + UpdateLight(shader, light); lightCount++; @@ -339,7 +339,7 @@ static void UpdateLight(Shader shader, Light light) { SetShaderValue(shader, light.enabledLoc, &light.enabled, SHADER_UNIFORM_INT); SetShaderValue(shader, light.typeLoc, &light.type, SHADER_UNIFORM_INT); - + // Send to shader light position values float position[3] = { light.position.x, light.position.y, light.position.z }; SetShaderValue(shader, light.positionLoc, position, SHADER_UNIFORM_VEC3); diff --git a/examples/shaders/shaders_custom_uniform.c b/examples/shaders/shaders_custom_uniform.c index 19a0cb2df..f73c5e901 100644 --- a/examples/shaders/shaders_custom_uniform.c +++ b/examples/shaders/shaders_custom_uniform.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★☆☆] 2/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * * NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example * on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders @@ -87,7 +87,7 @@ int main(void) // Update //---------------------------------------------------------------------------------- UpdateCamera(&camera, CAMERA_ORBITAL); - + Vector2 mousePosition = GetMousePosition(); swirlSize[0] = screenWidth; diff --git a/examples/shaders/shaders_deferred_render.c b/examples/shaders/shaders_deferred_render.c index 879f9a68b..96c118c61 100644 --- a/examples/shaders/shaders_deferred_render.c +++ b/examples/shaders/shaders_deferred_render.c @@ -42,7 +42,7 @@ typedef struct GBuffer { unsigned int positionTexture; unsigned int normalTexture; unsigned int albedoSpecTexture; - + unsigned int depthRenderbuffer; } GBuffer; @@ -94,49 +94,49 @@ int main(void) TraceLog(LOG_WARNING, "Failed to create framebuffer"); exit(1); } - + rlEnableFramebuffer(gBuffer.framebuffer); // NOTE: Vertex positions are stored in a texture for simplicity. A better approach would use a depth texture - // (instead of a detph renderbuffer) to reconstruct world positions in the final render shader via clip-space position, - // depth, and the inverse view/projection matrices. + // (instead of a detph renderbuffer) to reconstruct world positions in the final render shader via clip-space position, + // depth, and the inverse view/projection matrices - // 16-bit precision ensures OpenGL ES 3 compatibility, though it may lack precision for real scenarios. + // 16-bit precision ensures OpenGL ES 3 compatibility, though it may lack precision for real scenarios // But as mentioned above, the positions could be reconstructed instead of stored. If not targeting OpenGL ES - // and you wish to maintain this approach, consider using `RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32`. + // and you wish to maintain this approach, consider using `RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32` gBuffer.positionTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, 1); - // Similarly, 16-bit precision is used for normals ensures OpenGL ES 3 compatibility. - // This is generally sufficient, but a 16-bit fixed-point format offer a better uniform precision in all orientations. + // Similarly, 16-bit precision is used for normals ensures OpenGL ES 3 compatibility + // This is generally sufficient, but a 16-bit fixed-point format offer a better uniform precision in all orientations gBuffer.normalTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R16G16B16, 1); - // Albedo (diffuse color) and specular strength can be combined into one texture. - // The color in RGB, and the specular strength in the alpha channel. + // Albedo (diffuse color) and specular strength can be combined into one texture + // The color in RGB, and the specular strength in the alpha channel gBuffer.albedoSpecTexture = rlLoadTexture(NULL, screenWidth, screenHeight, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1); // Activate the draw buffers for our framebuffer rlActiveDrawBuffers(3); - // Now we attach our textures to the framebuffer. + // Now we attach our textures to the framebuffer rlFramebufferAttach(gBuffer.framebuffer, gBuffer.positionTexture, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_TEXTURE2D, 0); rlFramebufferAttach(gBuffer.framebuffer, gBuffer.normalTexture, RL_ATTACHMENT_COLOR_CHANNEL1, RL_ATTACHMENT_TEXTURE2D, 0); rlFramebufferAttach(gBuffer.framebuffer, gBuffer.albedoSpecTexture, RL_ATTACHMENT_COLOR_CHANNEL2, RL_ATTACHMENT_TEXTURE2D, 0); - // Finally we attach the depth buffer. + // Finally we attach the depth buffer gBuffer.depthRenderbuffer = rlLoadTextureDepth(screenWidth, screenHeight, true); rlFramebufferAttach(gBuffer.framebuffer, gBuffer.depthRenderbuffer, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0); - // Make sure our framebuffer is complete. + // Make sure our framebuffer is complete // NOTE: rlFramebufferComplete() automatically unbinds the framebuffer, so we don't have - // to rlDisableFramebuffer() here. + // to rlDisableFramebuffer() here if (!rlFramebufferComplete(gBuffer.framebuffer)) { TraceLog(LOG_WARNING, "Framebuffer is not complete"); } - // Now we initialize the sampler2D uniform's in the deferred shader. + // Now we initialize the sampler2D uniform's in the deferred shader // We do this by setting the uniform's values to the texture units that - // we later bind our g-buffer textures to. + // we later bind our g-buffer textures to rlEnableShader(deferredShader.id); int texUnitPosition = 0; int texUnitNormal = 1; @@ -161,7 +161,7 @@ int main(void) const float CUBE_SCALE = 0.25; Vector3 cubePositions[MAX_CUBES] = { 0 }; float cubeRotations[MAX_CUBES] = { 0 }; - + for (int i = 0; i < MAX_CUBES; i++) { cubePositions[i] = (Vector3){ @@ -169,7 +169,7 @@ int main(void) .y = (float)(rand()%5), .z = (float)(rand()%10) - 5, }; - + cubeRotations[i] = (float)(rand()%360); } @@ -190,7 +190,7 @@ int main(void) // Update the shader with the camera view vector (points towards { 0.0f, 0.0f, 0.0f }) float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z }; SetShaderValue(deferredShader, deferredShader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, SHADER_UNIFORM_VEC3); - + // Check key inputs to enable/disable lights if (IsKeyPressed(KEY_Y)) { lights[0].enabled = !lights[0].enabled; } if (IsKeyPressed(KEY_R)) { lights[1].enabled = !lights[1].enabled; } @@ -215,11 +215,11 @@ int main(void) rlEnableFramebuffer(gBuffer.framebuffer); rlClearColor(0, 0, 0, 0); rlClearScreenBuffers(); // Clear color and depth buffer - + rlDisableColorBlend(); BeginMode3D(camera); // NOTE: We have to use rlEnableShader here. `BeginShaderMode` or thus `rlSetShader` - // will not work, as they won't immediately load the shader program. + // will not work, as they won't immediately load the shader program rlEnableShader(gbufferShader.id); // When drawing a model here, make sure that the material's shaders // are set to the gbuffer shader! @@ -236,7 +236,7 @@ int main(void) EndMode3D(); rlEnableColorBlend(); - // Go back to the default framebuffer (0) and draw our deferred shading. + // Go back to the default framebuffer (0) and draw our deferred shading rlDisableFramebuffer(); rlClearScreenBuffers(); // Clear color & depth buffer @@ -264,10 +264,10 @@ int main(void) rlEnableColorBlend(); EndMode3D(); - // As a last step, we now copy over the depth buffer from our g-buffer to the default framebuffer. + // As a last step, we now copy over the depth buffer from our g-buffer to the default framebuffer rlBindFramebuffer(RL_READ_FRAMEBUFFER, gBuffer.framebuffer); rlBindFramebuffer(RL_DRAW_FRAMEBUFFER, 0); - rlBlitFramebuffer(0, 0, screenWidth, screenHeight, 0, 0, screenWidth, screenHeight, 0x00000100); // GL_DEPTH_BUFFER_BIT + rlBlitFramebuffer(0, 0, screenWidth, screenHeight, 0, 0, screenWidth, screenHeight, 0x00000100); // GL_DEPTH_BUFFER_BIT rlDisableFramebuffer(); // Since our shader is now done and disabled, we can draw spheres @@ -281,7 +281,7 @@ int main(void) } rlDisableShader(); EndMode3D(); - + DrawText("FINAL RESULT", 10, screenHeight - 30, 20, DARKGREEN); } break; case DEFERRED_POSITION: @@ -291,7 +291,7 @@ int main(void) .width = screenWidth, .height = screenHeight, }, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, Vector2Zero(), RAYWHITE); - + DrawText("POSITION TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); } break; case DEFERRED_NORMAL: @@ -301,7 +301,7 @@ int main(void) .width = screenWidth, .height = screenHeight, }, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, Vector2Zero(), RAYWHITE); - + DrawText("NORMAL TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); } break; case DEFERRED_ALBEDO: @@ -311,7 +311,7 @@ int main(void) .width = screenWidth, .height = screenHeight, }, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, Vector2Zero(), RAYWHITE); - + DrawText("ALBEDO TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); } break; default: break; @@ -321,7 +321,7 @@ int main(void) DrawText("Switch G-buffer textures: [1][2][3][4]", 10, 70, 20, DARKGRAY); DrawFPS(10, 10); - + EndDrawing(); // ----------------------------------------------------------------------------- } diff --git a/examples/shaders/shaders_eratosthenes.c b/examples/shaders/shaders_eratosthenes.c index 26075706e..4a974c9c8 100644 --- a/examples/shaders/shaders_eratosthenes.c +++ b/examples/shaders/shaders_eratosthenes.c @@ -1,10 +1,10 @@ /******************************************************************************************* * -* raylib [shaders] example - Sieve of Eratosthenes +* raylib [shaders] example - sieve of Eratosthenes * * Example complexity rating: [★★★☆] 3/4 * -* NOTE: Sieve of Eratosthenes, the earliest known (ancient Greek) prime number sieve. +* NOTE: Sieve of Eratosthenes, the earliest known (ancient Greek) prime number sieve * * "Sift the twos and sift the threes, * The Sieve of Eratosthenes. @@ -12,9 +12,9 @@ * the numbers that are left are prime." * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * -* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3). +* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3) * * Example originally created with raylib 2.5, last time updated with raylib 4.0 * @@ -45,7 +45,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Sieve of Eratosthenes"); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - sieve of Eratosthenes"); RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight); diff --git a/examples/shaders/shaders_fog.c b/examples/shaders/shaders_fog.c index 2e589eec4..3307f88f4 100644 --- a/examples/shaders/shaders_fog.c +++ b/examples/shaders/shaders_fog.c @@ -5,9 +5,9 @@ * Example complexity rating: [★★★☆] 3/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * -* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3). +* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3) * * Example originally created with raylib 2.5, last time updated with raylib 3.7 * diff --git a/examples/shaders/shaders_hot_reloading.c b/examples/shaders/shaders_hot_reloading.c index 0b3c2b7cf..1c616a1d0 100644 --- a/examples/shaders/shaders_hot_reloading.c +++ b/examples/shaders/shaders_hot_reloading.c @@ -1,11 +1,11 @@ /******************************************************************************************* * -* raylib [shaders] example - Hot reloading +* raylib [shaders] example - hot reloading * * Example complexity rating: [★★★☆] 3/4 * * NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330 -* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment. +* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment * * Example originally created with raylib 3.0, last time updated with raylib 3.5 * diff --git a/examples/shaders/shaders_hybrid_render.c b/examples/shaders/shaders_hybrid_render.c index fb44552ef..63ae1e16b 100644 --- a/examples/shaders/shaders_hybrid_render.c +++ b/examples/shaders/shaders_hybrid_render.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [shaders] example - Hybrid Rendering +* raylib [shaders] example - hybrid rendering * * Example complexity rating: [★★★★] 4/4 * @@ -62,14 +62,20 @@ int main(void) // You are required to write depth for all shaders if one shader does it Shader shdrRaster = LoadShader(0, TextFormat("resources/shaders/glsl%i/hybrid_raster.fs", GLSL_VERSION)); - // Declare Struct used to store camera locs. + // Declare Struct used to store camera locs RayLocs marchLocs = {0}; - // Fill the struct with shader locs. + // Fill the struct with shader locs marchLocs.camPos = GetShaderLocation(shdrRaymarch, "camPos"); marchLocs.camDir = GetShaderLocation(shdrRaymarch, "camDir"); marchLocs.screenCenter = GetShaderLocation(shdrRaymarch, "screenCenter"); + // Transfer screenCenter position to shader. Which is used to calculate ray direction + Vector2 screenCenter = {.x = screenWidth/2.0f, .y = screenHeight/2.0f}; + SetShaderValue(shdrRaymarch, marchLocs.screenCenter , &screenCenter , SHADER_UNIFORM_VEC2); + + // Use Customized function to create writable depth texture buffer + RenderTexture2D target = LoadRenderTextureDepthTex(screenWidth, screenHeight); // Define the camera to look into our 3d world Camera camera = { @@ -79,11 +85,10 @@ int main(void) .fovy = 45.0f, // Camera field-of-view Y .projection = CAMERA_PERSPECTIVE // Camera projection type }; - - // Camera FOV is pre-calculated in the camera Distance. + + // Camera FOV is pre-calculated in the camera distance float camDist = 1.0f/(tanf(camera.fovy*0.5f*DEG2RAD)); - RenderTexture2D target = LoadRenderTextureDepthTex(screenWidth, screenHeight); - + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -106,14 +111,14 @@ int main(void) SetShaderValue(shdrRaymarch, marchLocs.screenCenter , &screenCenter , SHADER_UNIFORM_VEC2); UpdateCamera(&camera, CAMERA_ORBITAL); - // Update Camera Postion in the ray march shader. + // Update Camera Postion in the ray march shader SetShaderValue(shdrRaymarch, marchLocs.camPos, &(camera.position), RL_SHADER_UNIFORM_VEC3); - - // Update Camera Looking Vector. Vector length determines FOV. + + // Update Camera Looking Vector. Vector length determines FOV Vector3 camDir = Vector3Scale( Vector3Normalize( Vector3Subtract(camera.target, camera.position)) , camDist); SetShaderValue(shdrRaymarch, marchLocs.camDir, &(camDir), RL_SHADER_UNIFORM_VEC3); //---------------------------------------------------------------------------------- - + // Draw //---------------------------------------------------------------------------------- // Draw into our custom render texture (framebuffer) @@ -121,11 +126,11 @@ int main(void) ClearBackground(WHITE); // Raymarch Scene - rlEnableDepthTest(); //Manually enable Depth Test to handle multiple rendering methods. + rlEnableDepthTest(); // Manually enable Depth Test to handle multiple rendering methods BeginShaderMode(shdrRaymarch); DrawRectangleRec((Rectangle){0,0, (float)screenWidth, (float)screenHeight},WHITE); EndShaderMode(); - + // Rasterize Scene BeginMode3D(camera); BeginShaderMode(shdrRaster); @@ -138,7 +143,7 @@ int main(void) EndMode3D(); EndTextureMode(); - // Draw into screen our custom render texture + // Draw into screen our custom render texture BeginDrawing(); ClearBackground(RAYWHITE); DrawTextureRec(target.texture, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, (Vector2) { 0, 0 }, WHITE); diff --git a/examples/shaders/shaders_julia_set.c b/examples/shaders/shaders_julia_set.c index c1be3f325..da5564321 100644 --- a/examples/shaders/shaders_julia_set.c +++ b/examples/shaders/shaders_julia_set.c @@ -5,9 +5,9 @@ * Example complexity rating: [★★★☆] 3/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * -* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3). +* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3) * * Example originally created with raylib 2.5, last time updated with raylib 4.0 * @@ -109,7 +109,7 @@ int main(void) SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2); } - // If "R" is pressed, reset zoom and offset. + // If "R" is pressed, reset zoom and offset if (IsKeyPressed(KEY_R)) { zoom = startingZoom; @@ -125,17 +125,16 @@ int main(void) if (IsKeyPressed(KEY_RIGHT)) incrementSpeed++; else if (IsKeyPressed(KEY_LEFT)) incrementSpeed--; - // If either left or right button is pressed, zoom in/out. + // If either left or right button is pressed, zoom in/out if (IsMouseButtonDown(MOUSE_BUTTON_LEFT) || IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) { - // Change zoom. If Mouse left -> zoom in. Mouse right -> zoom out. + // Change zoom. If Mouse left -> zoom in. Mouse right -> zoom out zoom *= IsMouseButtonDown(MOUSE_BUTTON_LEFT)? zoomSpeed : 1.0f/zoomSpeed; const Vector2 mousePos = GetMousePosition(); Vector2 offsetVelocity; // Find the velocity at which to change the camera. Take the distance of the mouse - // from the center of the screen as the direction, and adjust magnitude based on - // the current zoom. + // from the center of the screen as the direction, and adjust magnitude based on the current zoom offsetVelocity.x = (mousePos.x/(float)screenWidth - 0.5f)*offsetSpeedMul/zoom; offsetVelocity.y = (mousePos.y/(float)screenHeight - 0.5f)*offsetSpeedMul/zoom; @@ -167,7 +166,7 @@ int main(void) // do not represent full screen coordinates (space where want to apply shader) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK); EndTextureMode(); - + BeginDrawing(); ClearBackground(BLACK); // Clear screen background diff --git a/examples/shaders/shaders_lightmap.c b/examples/shaders/shaders_lightmap.c index 0d26e54c8..3da900921 100644 --- a/examples/shaders/shaders_lightmap.c +++ b/examples/shaders/shaders_lightmap.c @@ -5,9 +5,9 @@ * Example complexity rating: [★★★☆] 3/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * -* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3). +* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3) * * Example originally created with raylib 4.5, last time updated with raylib 4.5 * @@ -70,7 +70,7 @@ int main(void) // Load a new texcoords2 attributes buffer mesh.vboId[SHADER_LOC_VERTEX_TEXCOORD02] = rlLoadVertexBuffer(mesh.texcoords2, mesh.vertexCount*2*sizeof(float), false); rlEnableVertexArray(mesh.vaoId); - + // Index 5 is for texcoords2 rlSetVertexAttribute(5, 2, RL_FLOAT, 0, 0, 0); rlEnableVertexAttribute(5); @@ -156,10 +156,10 @@ int main(void) (Vector2){ 0.0, 0.0 }, 0.0, WHITE); - + DrawText("lightmap", GetRenderWidth() - 66, 16 + MAP_SIZE*8, 10, GRAY); DrawText("10x10 pixels", GetRenderWidth() - 76, 30 + MAP_SIZE*8, 10, GRAY); - + EndDrawing(); //---------------------------------------------------------------------------------- } diff --git a/examples/shaders/shaders_mesh_instancing.c b/examples/shaders/shaders_mesh_instancing.c index 17b2da33d..6142a825e 100644 --- a/examples/shaders/shaders_mesh_instancing.c +++ b/examples/shaders/shaders_mesh_instancing.c @@ -64,7 +64,7 @@ int main(void) Vector3 axis = Vector3Normalize((Vector3){ (float)GetRandomValue(0, 360), (float)GetRandomValue(0, 360), (float)GetRandomValue(0, 360) }); float angle = (float)GetRandomValue(0, 180)*DEG2RAD; Matrix rotation = MatrixRotate(axis, angle); - + transforms[i] = MatrixMultiply(rotation, translation); } diff --git a/examples/shaders/shaders_model_shader.c b/examples/shaders/shaders_model_shader.c index 3d23ddb14..75cfec4d5 100644 --- a/examples/shaders/shaders_model_shader.c +++ b/examples/shaders/shaders_model_shader.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★☆☆] 2/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * * NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example * on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders diff --git a/examples/shaders/shaders_multi_sample2d.c b/examples/shaders/shaders_multi_sample2d.c index c13864607..4e732ce1a 100644 --- a/examples/shaders/shaders_multi_sample2d.c +++ b/examples/shaders/shaders_multi_sample2d.c @@ -1,11 +1,11 @@ /******************************************************************************************* * -* raylib [shaders] example - Multiple sample2D with default batch system +* raylib [shaders] example - multi sample2D * * Example complexity rating: [★★☆☆] 2/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * * NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example * on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders @@ -38,7 +38,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib - multiple sample2D"); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - multi sample2D"); Image imRed = GenImageColor(800, 450, (Color){ 255, 0, 0, 255 }); Texture texRed = LoadTextureFromImage(imRed); @@ -93,7 +93,7 @@ int main(void) // an additional texture units is enabled for texBlue [sampler2D texture1] DrawTexture(texRed, 0, 0, WHITE); - EndShaderMode(); // Texture sampler2D is reseted, needs to be set again for next frame + EndShaderMode(); // Texture sampler2D is reseted, needs to be set again for next frame DrawText("Use KEY_LEFT/KEY_RIGHT to move texture mixing in shader!", 80, GetScreenHeight() - 40, 20, RAYWHITE); diff --git a/examples/shaders/shaders_normalmap.c b/examples/shaders/shaders_normalmap.c new file mode 100644 index 000000000..656c8597e --- /dev/null +++ b/examples/shaders/shaders_normalmap.c @@ -0,0 +1,173 @@ +/******************************************************************************************* + * + * raylib [shaders] example - normalmap + * + * Example complexity rating: [★★★★] 4/4 + * + * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, + * OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version + * + * Example originally created with raylib 5.6, last time updated with raylib 5.6 + * + * Example contributed by Jeremy Montgomery (@Sir_Irk) and reviewed by Ramon Santamaria (@raysan5) + * + * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, + * BSD-like license that allows static linking with closed source software + * + * Copyright (c) 2025-2025 Jeremy Montgomery (@Sir_Irk) and Ramon Santamaria (@raysan5) + *k + ********************************************************************************************/ + +#include + +#include + +#if defined(PLATFORM_DESKTOP) + #define GLSL_VERSION 330 +#else // PLATFORM_ANDROID, PLATFORM_WEB + #define GLSL_VERSION 100 +#endif + +//------------------------------------------------------------------------------------ +// Program main entry point +//------------------------------------------------------------------------------------ +int main(void) +{ + // Initialization + //-------------------------------------------------------------------------------------- + const int screenWidth = 800; + const int screenHeight = 450; + + SetConfigFlags(FLAG_MSAA_4X_HINT); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - normal map"); + + Camera camera = { 0 }; + camera.position = (Vector3){ 0.0f, 2.0f, -4.0f }; + camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; + camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; + camera.fovy = 45.0f; + camera.projection = CAMERA_PERSPECTIVE; + + // Load basic normal map lighting shader + Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/normalmap.vs", GLSL_VERSION), + TextFormat("resources/shaders/glsl%i/normalmap.fs", GLSL_VERSION)); + + // Get some required shader locations + shader.locs[SHADER_LOC_MAP_NORMAL] = GetShaderLocation(shader, "normalMap"); + shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(shader, "viewPos"); + + // NOTE: "matModel" location name is automatically assigned on shader loading, + // no need to get the location again if using that uniform name + // shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(shader, "matModel"); + + // This example uses just 1 point light + Vector3 lightPosition = { 0.0f, 1.0f, 0.0f }; + int lightPosLoc = GetShaderLocation(shader, "lightPos"); + + // Load a plane model that has proper normals and tangents + Model plane = LoadModel("resources/models/plane.glb"); + + // Set the plane model's shader and texture maps + plane.materials[0].shader = shader; + plane.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = LoadTexture("resources/tiles_diffuse.png"); + plane.materials[0].maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("resources/tiles_normal.png"); + + // Generate Mipmaps and use TRILINEAR filtering to help with texture aliasing + GenTextureMipmaps(&plane.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture); + GenTextureMipmaps(&plane.materials[0].maps[MATERIAL_MAP_NORMAL].texture); + + SetTextureFilter(plane.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture, TEXTURE_FILTER_TRILINEAR); + SetTextureFilter(plane.materials[0].maps[MATERIAL_MAP_NORMAL].texture, TEXTURE_FILTER_TRILINEAR); + + // Specular exponent AKA shininess of the material + float specularExponent = 8.0f; + int specularExponentLoc = GetShaderLocation(shader, "specularExponent"); + + // Allow toggling the normal map on and off for comparison purposes + int useNormalMap = 1; + int useNormalMapLoc = GetShaderLocation(shader, "useNormalMap"); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second + //-------------------------------------------------------------------------------------- + + // Main game loop + while (!WindowShouldClose()) // Detect window close button or ESC key + { + // Update + //---------------------------------------------------------------------------------- + // Move the light around on the X and Z axis using WASD keys + Vector3 direction = { 0 }; + if (IsKeyDown(KEY_W)) direction = Vector3Add(direction, (Vector3){ 0.0f, 0.0f, 1.0f }); + if (IsKeyDown(KEY_S)) direction = Vector3Add(direction, (Vector3){ 0.0f, 0.0f, -1.0f }); + if (IsKeyDown(KEY_D)) direction = Vector3Add(direction, (Vector3){ -1.0f, 0.0f, 0.0f }); + if (IsKeyDown(KEY_A)) direction = Vector3Add(direction, (Vector3){ 1.0f, 0.0f, 0.0f }); + + direction = Vector3Normalize(direction); + lightPosition = Vector3Add(lightPosition, Vector3Scale(direction, GetFrameTime()*3.0f)); + + // Increase/Decrease the specular exponent(shininess) + if (IsKeyDown(KEY_UP)) specularExponent = Clamp(specularExponent + 40.0f*GetFrameTime(), 2.0f, 128.0f); + if (IsKeyDown(KEY_DOWN)) specularExponent = Clamp(specularExponent - 40.0f*GetFrameTime(), 2.0f, 128.0f); + + // Toggle normal map on and off + if (IsKeyPressed(KEY_N)) useNormalMap = !useNormalMap; + + // Spin plane model at a constant rate + plane.transform = MatrixRotateY(GetTime()*0.5f); + + // Update shader values + float lightPos[3] = {lightPosition.x, lightPosition.y, lightPosition.z}; + SetShaderValue(shader, lightPosLoc, lightPos, SHADER_UNIFORM_VEC3); + + float camPos[3] = {camera.position.x, camera.position.y, camera.position.z}; + SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], camPos, SHADER_UNIFORM_VEC3); + + SetShaderValue(shader, specularExponentLoc, &specularExponent, SHADER_UNIFORM_FLOAT); + + SetShaderValue(shader, useNormalMapLoc, &useNormalMap, SHADER_UNIFORM_INT); + //-------------------------------------------------------------------------------------- + + // Draw + //---------------------------------------------------------------------------------- + BeginDrawing(); + + ClearBackground(RAYWHITE); + + BeginMode3D(camera); + + BeginShaderMode(shader); + + DrawModel(plane, Vector3Zero(), 2.0f, WHITE); + + EndShaderMode(); + + // Draw sphere to show light position + DrawSphereWires(lightPosition, 0.2f, 8, 8, ORANGE); + + EndMode3D(); + + Color textColor = (useNormalMap) ? DARKGREEN : RED; + const char *toggleStr = (useNormalMap) ? "On" : "Off"; + DrawText(TextFormat("Use key [N] to toggle normal map: %s", toggleStr), 10, 10, 10, textColor); + + int yOffset = 24; + DrawText("Use keys [W][A][S][D] to move the light", 10, 10 + yOffset*1, 10, BLACK); + DrawText("Use keys [Up][Down] to change specular exponent", 10, 10 + yOffset*2, 10, BLACK); + DrawText(TextFormat("Specular Exponent: %.2f", specularExponent), 10, 10 + yOffset*3, 10, BLUE); + + DrawFPS(screenWidth - 80, 10); + + EndDrawing(); + //-------------------------------------------------------------------------------------- + } + + // De-Initialization + //-------------------------------------------------------------------------------------- + UnloadShader(shader); + UnloadModel(plane); + + CloseWindow(); // Close window and OpenGL context + //-------------------------------------------------------------------------------------- + + return 0; +} diff --git a/examples/shaders/shaders_normalmap.png b/examples/shaders/shaders_normalmap.png new file mode 100644 index 000000000..f6057479d Binary files /dev/null and b/examples/shaders/shaders_normalmap.png differ diff --git a/examples/shaders/shaders_palette_switch.c b/examples/shaders/shaders_palette_switch.c index 50f80b8f0..df35db447 100644 --- a/examples/shaders/shaders_palette_switch.c +++ b/examples/shaders/shaders_palette_switch.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★★☆] 3/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * * NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example * on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders diff --git a/examples/shaders/shaders_postprocessing.c b/examples/shaders/shaders_postprocessing.c index c7cc70705..623152bae 100644 --- a/examples/shaders/shaders_postprocessing.c +++ b/examples/shaders/shaders_postprocessing.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★★☆] 3/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * * NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example * on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders @@ -148,7 +148,7 @@ int main(void) DrawGrid(10, 1.0f); // Draw a grid EndMode3D(); // End 3d mode drawing, returns to orthographic 2d mode EndTextureMode(); // End drawing to texture (now we have a texture available for next passes) - + BeginDrawing(); ClearBackground(RAYWHITE); // Clear screen background diff --git a/examples/shaders/shaders_raymarching.c b/examples/shaders/shaders_raymarching.c index ab69fe69a..cc1badb9f 100644 --- a/examples/shaders/shaders_raymarching.c +++ b/examples/shaders/shaders_raymarching.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★★★] 4/4 * * NOTE: This example requires raylib OpenGL 3.3 for shaders support and only #version 330 -* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment. +* is currently supported. OpenGL ES 2.0 platforms are not supported at the moment * * Example originally created with raylib 2.0, last time updated with raylib 4.2 * diff --git a/examples/shaders/shaders_rounded_rectangle.c b/examples/shaders/shaders_rounded_rectangle.c index 942b890a3..fd6433fc8 100644 --- a/examples/shaders/shaders_rounded_rectangle.c +++ b/examples/shaders/shaders_rounded_rectangle.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [shaders] example - Rounded Rectangle +* raylib [shaders] example - rounded rectangle * * Example complexity rating: [★★★☆] 3/4 * @@ -24,9 +24,8 @@ #endif //------------------------------------------------------------------------------------ -// Declare custom Structs +// Structs definition //------------------------------------------------------------------------------------ - // Rounded rectangle data typedef struct { Vector4 cornerRadius; // Individual corner radius (top-left, top-right, bottom-left, bottom-right) @@ -54,7 +53,6 @@ typedef struct { //------------------------------------------------------------------------------------ // Module Functions Declaration //------------------------------------------------------------------------------------ - // Create a rounded rectangle and set uniform locations static RoundedRectangle CreateRoundedRectangle(Vector4 cornerRadius, float shadowRadius, Vector2 shadowOffset, float shadowScale, float borderThickness, Shader shader); @@ -71,11 +69,7 @@ int main(void) int screenWidth = 800; int screenHeight = 450; - const Color rectangleColor = BLUE; - const Color shadowColor = DARKBLUE; - const Color borderColor = SKYBLUE; - - InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Rounded Rectangle"); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - rounded rectangle"); // Load the shader Shader shader = LoadShader(TextFormat("resources/shaders/glsl%i/base.vs", GLSL_VERSION), @@ -94,6 +88,10 @@ int main(void) // Update shader uniforms UpdateRoundedRectangle(roundedRectangle, shader); + const Color rectangleColor = BLUE; + const Color shadowColor = DARKBLUE; + const Color borderColor = SKYBLUE; + SetTargetFPS(60); //-------------------------------------------------------------------------------------- @@ -131,8 +129,6 @@ int main(void) DrawRectangle(0, 0, screenWidth, screenHeight, WHITE); EndShaderMode(); - - // Draw rectangle shadow using shader rec = (Rectangle){ 50, 200, 110, 60 }; DrawRectangleLines((int)rec.x - 20, (int)rec.y - 20, (int)rec.width + 40, (int)rec.height + 40, DARKGRAY); @@ -150,8 +146,6 @@ int main(void) DrawRectangle(0, 0, screenWidth, screenHeight, WHITE); EndShaderMode(); - - // Draw rectangle's border using shader rec = (Rectangle){ 50, 330, 110, 60 }; DrawRectangleLines((int)rec.x - 20, (int)rec.y - 20, (int)rec.width + 40, (int)rec.height + 40, DARKGRAY); diff --git a/examples/shaders/shaders_shadowmap.c b/examples/shaders/shaders_shadowmap.c index fca9b468b..ec06dee42 100644 --- a/examples/shaders/shaders_shadowmap.c +++ b/examples/shaders/shaders_shadowmap.c @@ -44,7 +44,7 @@ int main(void) SetConfigFlags(FLAG_MSAA_4X_HINT); // Shadows are a HUGE topic, and this example shows an extremely simple implementation of the shadowmapping algorithm, // which is the industry standard for shadows. This algorithm can be extended in a ridiculous number of ways to improve - // realism and also adapt it for different scenes. This is pretty much the simplest possible implementation. + // realism and also adapt it for different scenes. This is pretty much the simplest possible implementation InitWindow(screenWidth, screenHeight, "raylib [shaders] example - shadowmap"); Camera3D cam = (Camera3D){ 0 }; @@ -178,7 +178,7 @@ int main(void) // Draw the same exact things as we drew in the shadowmap! DrawScene(cube, robot); - + EndMode3D(); DrawText("Shadows in raylib using the shadowmapping algorithm!", screenWidth - 320, screenHeight - 20, 10, GRAY); diff --git a/examples/shaders/shaders_shapes_textures.c b/examples/shaders/shaders_shapes_textures.c index 107b09c03..b0f7752ac 100644 --- a/examples/shaders/shaders_shapes_textures.c +++ b/examples/shaders/shaders_shapes_textures.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★☆☆] 2/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * * NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example * on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders diff --git a/examples/shaders/shaders_simple_mask.c b/examples/shaders/shaders_simple_mask.c index f12230373..2e6e83a61 100644 --- a/examples/shaders/shaders_simple_mask.c +++ b/examples/shaders/shaders_simple_mask.c @@ -97,7 +97,7 @@ int main(void) // Update //---------------------------------------------------------------------------------- UpdateCamera(&camera, CAMERA_FIRST_PERSON); - + framesCounter++; rotation.x += 0.01f; rotation.y += 0.005f; diff --git a/examples/shaders/shaders_spotlight.c b/examples/shaders/shaders_spotlight.c index 508333503..3df7ceda8 100644 --- a/examples/shaders/shaders_spotlight.c +++ b/examples/shaders/shaders_spotlight.c @@ -20,13 +20,13 @@ * * The right hand side of the screen there is just enough light to see whats * going on without the spot light, great for a stealth type game where you -* have to avoid the spotlights. +* have to avoid the spotlights * -* The left hand side of the screen is in pitch dark except for where the spotlights are. +* The left hand side of the screen is in pitch dark except for where the spotlights are * * Although this example doesn't scale like the letterbox example, you could integrate * the two techniques, but by scaling the actual colour of the render texture rather -* than using alpha as a mask. +* than using alpha as a mask * ********************************************************************************************/ @@ -113,7 +113,7 @@ int main(void) } // Tell the shader how wide the screen is so we can have - // a pitch black half and a dimly lit half. + // a pitch black half and a dimly lit half unsigned int wLoc = GetShaderLocation(shdrSpot, "screenWidth"); float sw = (float)screenWidth; SetShaderValue(shdrSpot, wLoc, &sw, SHADER_UNIFORM_FLOAT); diff --git a/examples/shaders/shaders_texture_outline.c b/examples/shaders/shaders_texture_outline.c index b2172aef9..d7a3a1a07 100644 --- a/examples/shaders/shaders_texture_outline.c +++ b/examples/shaders/shaders_texture_outline.c @@ -1,11 +1,11 @@ /******************************************************************************************* * -* raylib [shaders] example - Apply an shdrOutline to a texture +* raylib [shaders] example - texture outline * * Example complexity rating: [★★★☆] 3/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * * Example originally created with raylib 4.0, last time updated with raylib 4.0 * @@ -36,7 +36,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [shaders] example - Apply an outline to a texture"); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - texture outline"); Texture2D texture = LoadTexture("resources/fudesumi.png"); diff --git a/examples/shaders/shaders_texture_tiling.c b/examples/shaders/shaders_texture_tiling.c index d811e30ec..14e15b8b2 100644 --- a/examples/shaders/shaders_texture_tiling.c +++ b/examples/shaders/shaders_texture_tiling.c @@ -4,7 +4,7 @@ * * Example complexity rating: [★★☆☆] 2/4 * -* Example demonstrates how to tile a texture on a 3D model using raylib. +* Example demonstrates how to tile a texture on a 3D model using raylib * * Example originally created with raylib 4.5, last time updated with raylib 4.5 * @@ -48,7 +48,7 @@ int main(void) // Load a cube model Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f); Model model = LoadModelFromMesh(cube); - + // Load a texture and assign to cube model Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; @@ -77,17 +77,17 @@ int main(void) // Draw //---------------------------------------------------------------------------------- BeginDrawing(); - + ClearBackground(RAYWHITE); BeginMode3D(camera); - + BeginShaderMode(shader); DrawModel(model, (Vector3){ 0.0f, 0.0f, 0.0f }, 2.0f, WHITE); EndShaderMode(); DrawGrid(10, 1.0f); - + EndMode3D(); DrawText("Use mouse to rotate the camera", 10, 10, 20, DARKGRAY); @@ -104,6 +104,6 @@ int main(void) CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- - + return 0; } diff --git a/examples/shaders/shaders_texture_waves.c b/examples/shaders/shaders_texture_waves.c index 73ba738c6..c957635c4 100644 --- a/examples/shaders/shaders_texture_waves.c +++ b/examples/shaders/shaders_texture_waves.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★☆☆] 2/4 * * NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, -* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. +* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version * * NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example * on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders diff --git a/examples/shaders/shaders_vertex_displacement.c b/examples/shaders/shaders_vertex_displacement.c index 8008bc004..1a163f9b7 100644 --- a/examples/shaders/shaders_vertex_displacement.c +++ b/examples/shaders/shaders_vertex_displacement.c @@ -52,7 +52,7 @@ int main(void) Shader shader = LoadShader( TextFormat("resources/shaders/glsl%i/vertex_displacement.vs", GLSL_VERSION), TextFormat("resources/shaders/glsl%i/vertex_displacement.fs", GLSL_VERSION)); - + // Load perlin noise texture Image perlinNoiseImage = GenImagePerlinNoise(512, 512, 0, 0, 1.0f); Texture perlinNoiseMap = LoadTextureFromImage(perlinNoiseImage); @@ -64,7 +64,7 @@ int main(void) rlActiveTextureSlot(1); rlEnableTexture(perlinNoiseMap.id); rlSetUniformSampler(perlinNoiseMapLoc, 1); - + // Create a plane mesh and model Mesh planeMesh = GenMeshPlane(50, 50, 50, 50); Model planeModel = LoadModelFromMesh(planeMesh); diff --git a/examples/shaders/shaders_view_depth.c b/examples/shaders/shaders_view_depth.c index 4f141acb9..f4eecf7e2 100644 --- a/examples/shaders/shaders_view_depth.c +++ b/examples/shaders/shaders_view_depth.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [shader] example - render depth texture +* raylib [shaders] example - render depth texture * * Example complexity rating: [★★★☆] 3/4 * @@ -36,7 +36,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [shader] example - render depth texture"); + InitWindow(screenWidth, screenHeight, "raylib [shaders] example - render depth texture"); // Init camera Camera camera = { 0 }; @@ -76,7 +76,7 @@ int main(void) //---------------------------------------------------------------------------------- BeginTextureMode(target); ClearBackground(WHITE); - + BeginMode3D(camera); DrawModel(cube, (Vector3){ 0.0f, 0.0f, 0.0f }, 3.0f, YELLOW); DrawModel(floor, (Vector3){ 10.0f, 0.0f, 2.0f }, 2.0f, RED); diff --git a/examples/shaders/shaders_write_depth.c b/examples/shaders/shaders_write_depth.c index 50b180eeb..96016521b 100644 --- a/examples/shaders/shaders_write_depth.c +++ b/examples/shaders/shaders_write_depth.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [shaders] example - Depth buffer writing +* raylib [shaders] example - depth buffer writing * * Example complexity rating: [★★☆☆] 2/4 * @@ -60,7 +60,7 @@ int main(void) .fovy = 45.0f, // Camera field-of-view Y .projection = CAMERA_PERSPECTIVE // Camera projection type }; - + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -76,7 +76,7 @@ int main(void) } UpdateCamera(&camera, CAMERA_ORBITAL); //---------------------------------------------------------------------------------- - + // Draw //---------------------------------------------------------------------------------- UnloadRenderTexture(target); @@ -84,7 +84,7 @@ int main(void) // Draw into our custom render texture (framebuffer) BeginTextureMode(target); ClearBackground(WHITE); - + BeginMode3D(camera); BeginShaderMode(shader); DrawCubeWiresV((Vector3){ 0.0f, 0.5f, 1.0f }, (Vector3){ 1.0f, 1.0f, 1.0f }, RED); @@ -96,7 +96,7 @@ int main(void) EndMode3D(); EndTextureMode(); - // Draw into screen our custom render texture + // Draw into screen our custom render texture BeginDrawing(); ClearBackground(RAYWHITE); DrawTextureRec(target.texture, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, (Vector2) { 0, 0 }, WHITE); diff --git a/examples/shapes/shapes_double_pendulum.c b/examples/shapes/shapes_double_pendulum.c index ffc632644..fd486db84 100644 --- a/examples/shapes/shapes_double_pendulum.c +++ b/examples/shapes/shapes_double_pendulum.c @@ -25,6 +25,9 @@ #define SCREEN_WIDTH 800 #define SCREEN_HEIGHT 450 +Vector2 screenSize = { SCREEN_WIDTH, SCREEN_HEIGHT }; +Vector2 screenCenter = CalculateCenter(screenSize); + // Constant for Simulation #define SIMULATION_STEPS 30 #define G 9.81 @@ -42,19 +45,19 @@ int main(void) { // Initialization //-------------------------------------------------------------------------------------- - SetConfigFlags(FLAG_WINDOW_HIGHDPI); - InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [shapes] example - Double Pendulum"); - Vector2 screenSize = { GetScreenWidth(), GetScreenHeight() }; - Vector2 screenCenter = CalculateCenter(screenSize); + SetConfigFlags(FLAG_WINDOW_HIGHDPI); + + InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [shapes] example - Double Pendulum"); + // Simulation Paramters - //-------------------------------------------------------------------------------------- float l1 = 15, m1 = 0.2, theta1 = DEG2RAD * 170, w1 = 0; float l2 = 15, m2 = 0.1, theta2 = DEG2RAD * 0, w2 = 0; float lengthScaler = 0.1; float totalM = m1 + m2; Vector2 previousPosition = CalculateDoublePendulumEndPoint(l1, theta1, l2, theta2); + previousPosition.x += screenCenter.x; previousPosition.y += screenCenter.y; @@ -62,11 +65,10 @@ int main(void) float L1 = l1 * lengthScaler; float L2 = l2 * lengthScaler; - // Draw Parameters - //-------------------------------------------------------------------------------------- + // Draw parameters int lineThick = 20, trailThick = 2; float fateAlpha = 0.01; - + // Create Framebuffer //-------------------------------------------------------------------------------------- RenderTexture2D target = LoadRenderTexture(screenSize.x, screenSize.y); @@ -79,6 +81,7 @@ int main(void) while (!WindowShouldClose()) // Detect window close button or ESC key { // Update + //---------------------------------------------------------------------------------- float dt = GetFrameTime(); float step = dt / SIMULATION_STEPS, step2 = step * step; if(IsWindowResized()) @@ -93,56 +96,51 @@ int main(void) } // Update Physics - larger steps = better approximation - //---------------------------------------------------------------------------------- for (int i = 0; i < SIMULATION_STEPS; ++i) { float delta = theta1 - theta2; - float sinD = sin(delta), cosD = cos(delta), cos2D = cos(2 * delta); + float sinD = sinf(delta), cosD = cosf(delta), cos2D = cosf(2*delta); float ww1 = w1 * w1, ww2 = w2 * w2; // Calculate a1 - float a1 = (-G * (2 * m1 + m2) * sin(theta1) - - m2 * G * sin(theta1 - 2 * theta2) - - 2 * sinD * m2 * (ww2 * L2 + ww1 * L1 * cosD)) - / (L1 * (2 * m1 + m2 - m2 * cos2D)); + float a1 = (-G*(2*m1 + m2)*sinf(theta1) + - m2*G*sinf(theta1 - 2*theta2) + - 2*sinD*m2*(ww2*L2 + ww1*L1*cosD)) + / (L1*(2*m1 + m2 - m2*cos2D)); // Calculate a2 - float a2 = (2 * sinD * (ww1 * L1 * totalM - + G * totalM * cos(theta1) - + ww2 * L2 * m2 * cosD)) - / (L2 * (2 * m1 + m2 - m2 * cos2D)); + float a2 = (2*sinD*(ww1*L1*totalM + + G*totalM*cosf(theta1) + + ww2*L2*m2*cosD)) + / (L2*(2*m1 + m2 - m2*cos2D)); // Update thetas - theta1 += w1 * step + 0.5 * a1 * step2; - theta2 += w2 * step + 0.5 * a2 * step2; + theta1 += w1*step + 0.5f*a1*step2; + theta2 += w2*step + 0.5f*a2*step2; // Update omegas - w1 += a1 * step; - w2 += a2 * step; + w1 += a1*step; + w2 += a2*step; } - //---------------------------------------------------------------------------------- // Calculate position Vector2 currentPosition = CalculateDoublePendulumEndPoint(l1, theta1, l2, theta2); currentPosition.x += screenCenter.x; currentPosition.y += screenCenter.y; - // Draw to framebuffer - //---------------------------------------------------------------------------------- + // Draw to render texture BeginTextureMode(target); - // Draw a transparent rectangle - smaller alpha = longer trails - DrawRectangle(0, 0, screenSize.x, screenSize.y, Fade(BLACK, fateAlpha)); - + DrawRectangle(0, 0, screenSize.x, screenSize.y, Fade(BLACK, fateAlpha)); + // Draw trail DrawCircleV(previousPosition, trailThick, RED); DrawLineEx(previousPosition, currentPosition, trailThick * 2, RED); - EndTextureMode(); - //---------------------------------------------------------------------------------- // Update previous position previousPosition = currentPosition; + //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- @@ -150,9 +148,8 @@ int main(void) ClearBackground(BLACK); - // Draw Trails Texture - DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, - (Vector2){ 0, 0 }, WHITE); + // Draw trails texture + DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE); // Draw Double Pendulum DrawRectanglePro((Rectangle){ screenCenter.x, screenCenter.y, 10 * l1, lineThick }, @@ -162,6 +159,14 @@ int main(void) DrawRectanglePro((Rectangle){ screenCenter.x + endpoint1.x, screenCenter.y + endpoint1.y, 10 * l2, lineThick }, (Vector2){0, lineThick * 0.5}, 90 - RAD2DEG * theta2, RAYWHITE); + // Draw double pendulum + DrawRectanglePro((Rectangle){ screenWidth/2, screenHeight/2 - 100, 10 * l1, lineThick }, + (Vector2){0, lineThick * 0.5}, 90 - RAD2DEG * theta1, RAYWHITE); + + Vector2 endpoint1 = CalculatePendulumEndPoint(l1, theta1); + DrawRectanglePro((Rectangle){ screenWidth/2 + endpoint1.x, screenHeight/2 - 100 + endpoint1.y, 10 * l2, lineThick }, + (Vector2){0, lineThick * 0.5}, 90 - RAD2DEG * theta2, RAYWHITE); + EndDrawing(); //---------------------------------------------------------------------------------- } diff --git a/examples/shapes/shapes_easings_rectangle_array.c b/examples/shapes/shapes_easings_rectangle_array.c index 912926ea4..c55c07979 100644 --- a/examples/shapes/shapes_easings_rectangle_array.c +++ b/examples/shapes/shapes_easings_rectangle_array.c @@ -5,7 +5,7 @@ * Example complexity rating: [★★★☆] 3/4 * * NOTE: This example requires 'easings.h' library, provided on raylib/src. Just copy -* the library to same directory as example or make sure it's available on include path. +* the library to same directory as example or make sure it's available on include path * * Example originally created with raylib 2.0, last time updated with raylib 2.5 * diff --git a/examples/shapes/shapes_lines_bezier.c b/examples/shapes/shapes_lines_bezier.c index f963cd4de..3e8f68a7f 100644 --- a/examples/shapes/shapes_lines_bezier.c +++ b/examples/shapes/shapes_lines_bezier.c @@ -69,7 +69,7 @@ int main(void) // Draw line Cubic Bezier, in-out interpolation (easing), no control points DrawLineBezier(startPoint, endPoint, 4.0f, BLUE); - + // Draw start-end spline circles with some details DrawCircleV(startPoint, CheckCollisionPointCircle(mouse, startPoint, 10.0f)? 14.0f : 8.0f, moveStartPoint? RED : BLUE); DrawCircleV(endPoint, CheckCollisionPointCircle(mouse, endPoint, 10.0f)? 14.0f : 8.0f, moveEndPoint? RED : BLUE); diff --git a/examples/shapes/shapes_logo_raylib.c b/examples/shapes/shapes_logo_raylib.c index 437d84115..e7977e580 100644 --- a/examples/shapes/shapes_logo_raylib.c +++ b/examples/shapes/shapes_logo_raylib.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [shapes] example - Draw raylib logo using basic shapes +* raylib [shapes] example - draw raylib logo using basic shapes * * Example complexity rating: [★☆☆☆] 1/4 * diff --git a/examples/shapes/shapes_rectangle_advanced.c b/examples/shapes/shapes_rectangle_advanced.c index 0c20c9e8b..a3f8adf84 100644 --- a/examples/shapes/shapes_rectangle_advanced.c +++ b/examples/shapes/shapes_rectangle_advanced.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [shapes] example - Rectangle advanced +* raylib [shapes] example - advanced rectangle drawing * * Example complexity rating: [★★★★] 4/4 * @@ -33,9 +33,9 @@ int main(void) //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; - + InitWindow(screenWidth, screenHeight, "raylib [shapes] example - rectangle avanced"); - + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -195,7 +195,7 @@ static void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, fl } // Here we use the 'Diagram' to guide ourselves to which point receives what color - // By choosing the color correctly associated with a pointe the gradient effect + // By choosing the color correctly associated with a pointe the gradient effect // will naturally come from OpenGL interpolation // [2] Upper Rectangle @@ -265,10 +265,10 @@ static void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, fl rlSetTexture(0); #else - // Here we use the 'Diagram' to guide ourselves to which point receives what color. - // By choosing the color correctly associated with a pointe the gradient effect - // will naturally come from OpenGL interpolation. - // But this time instead of Quad, we think in triangles. + // Here we use the 'Diagram' to guide ourselves to which point receives what color + // By choosing the color correctly associated with a pointe the gradient effect + // will naturally come from OpenGL interpolation + // But this time instead of Quad, we think in triangles rlBegin(RL_TRIANGLES); // Draw all of the 4 corners: [1] Upper Left Corner, [3] Upper Right Corner, [5] Lower Right Corner, [7] Lower Left Corner @@ -280,10 +280,10 @@ static void DrawRectangleRoundedGradientH(Rectangle rec, float roundnessLeft, fl if (k == 1) color = right, radius = radiusRight; // [3] Upper Right Corner if (k == 2) color = right, radius = radiusRight; // [5] Lower Right Corner if (k == 3) color = left, radius = radiusLeft; // [7] Lower Left Corner - + float angle = angles[k]; const Vector2 center = centers[k]; - + for (int i = 0; i < segments; i++) { rlColor4ub(color.r, color.g, color.b, color.a); diff --git a/examples/shapes/shapes_rectangle_scaling.c b/examples/shapes/shapes_rectangle_scaling.c index b5c778317..7426e54d5 100644 --- a/examples/shapes/shapes_rectangle_scaling.c +++ b/examples/shapes/shapes_rectangle_scaling.c @@ -65,7 +65,7 @@ int main(void) // Check minimum rec size if (rec.width < MOUSE_SCALE_MARK_SIZE) rec.width = MOUSE_SCALE_MARK_SIZE; if (rec.height < MOUSE_SCALE_MARK_SIZE) rec.height = MOUSE_SCALE_MARK_SIZE; - + // Check maximum rec size if (rec.width > (GetScreenWidth() - rec.x)) rec.width = GetScreenWidth() - rec.x; if (rec.height > (GetScreenHeight() - rec.y)) rec.height = GetScreenHeight() - rec.y; diff --git a/examples/shapes/shapes_splines_drawing.c b/examples/shapes/shapes_splines_drawing.c index 3b4c9c284..88cfe688b 100644 --- a/examples/shapes/shapes_splines_drawing.c +++ b/examples/shapes/shapes_splines_drawing.c @@ -23,7 +23,7 @@ #define MAX_SPLINE_POINTS 32 // Cubic Bezier spline control points -// NOTE: Every segment has two control points +// NOTE: Every segment has two control points typedef struct { Vector2 start; Vector2 end; @@ -57,17 +57,17 @@ int main(void) { 520.0f, 60.0f }, { 710.0f, 260.0f }, }; - - // Array required for spline bezier-cubic, + + // Array required for spline bezier-cubic, // including control points interleaved with start-end segment points Vector2 pointsInterleaved[3*(MAX_SPLINE_POINTS - 1) + 1] = { 0 }; - + int pointCount = 5; int selectedPoint = -1; int focusedPoint = -1; Vector2 *selectedControlPoint = NULL; Vector2 *focusedControlPoint = NULL; - + // Cubic Bezier control points initialization ControlPoint control[MAX_SPLINE_POINTS-1] = { 0 }; for (int i = 0; i < pointCount - 1; i++) @@ -79,9 +79,9 @@ int main(void) // Spline config variables float splineThickness = 8.0f; int splineTypeActive = SPLINE_LINEAR; // 0-Linear, 1-BSpline, 2-CatmullRom, 3-Bezier - bool splineTypeEditMode = false; + bool splineTypeEditMode = false; bool splineHelpersActive = true; - + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -114,14 +114,14 @@ int main(void) } if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selectedPoint = focusedPoint; } - + // Spline point movement logic if (selectedPoint >= 0) { points[selectedPoint] = GetMousePosition(); if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) selectedPoint = -1; } - + // Cubic Bezier spline control points logic if ((splineTypeActive == SPLINE_BEZIER) && (focusedPoint == -1)) { @@ -144,7 +144,7 @@ int main(void) } if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) selectedControlPoint = focusedControlPoint; } - + // Spline control point movement logic if (selectedControlPoint != NULL) { @@ -152,7 +152,7 @@ int main(void) if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) selectedControlPoint = NULL; } } - + // Spline selection logic if (IsKeyPressed(KEY_ONE)) splineTypeActive = 0; else if (IsKeyPressed(KEY_TWO)) splineTypeActive = 1; @@ -168,7 +168,7 @@ int main(void) BeginDrawing(); ClearBackground(RAYWHITE); - + if (splineTypeActive == SPLINE_LINEAR) { // Draw spline: linear @@ -191,7 +191,7 @@ int main(void) { // Draw spline: catmull-rom DrawSplineCatmullRom(points, pointCount, splineThickness, RED); // Provide connected points array - + /* for (int i = 0; i < (pointCount - 3); i++) { @@ -202,20 +202,20 @@ int main(void) } else if (splineTypeActive == SPLINE_BEZIER) { - // NOTE: Cubic-bezier spline requires the 2 control points of each segnment to be + // NOTE: Cubic-bezier spline requires the 2 control points of each segnment to be // provided interleaved with the start and end point of every segment - for (int i = 0; i < (pointCount - 1); i++) + for (int i = 0; i < (pointCount - 1); i++) { pointsInterleaved[3*i] = points[i]; pointsInterleaved[3*i + 1] = control[i].start; pointsInterleaved[3*i + 2] = control[i].end; } - + pointsInterleaved[3*(pointCount - 1)] = points[pointCount - 1]; // Draw spline: cubic-bezier (with control points) DrawSplineBezierCubic(pointsInterleaved, 3*(pointCount - 1) + 1, splineThickness, RED); - + /* for (int i = 0; i < 3*(pointCount - 1); i += 3) { @@ -234,7 +234,7 @@ int main(void) else if (focusedControlPoint == &control[i].end) DrawCircleV(control[i].end, 8, GREEN); DrawLineEx(points[i], control[i].start, 1.0f, LIGHTGRAY); DrawLineEx(points[i + 1], control[i].end, 1.0f, LIGHTGRAY); - + // Draw spline control lines DrawLineV(points[i], control[i].start, GRAY); //DrawLineV(control[i].start, control[i].end, LIGHTGRAY); @@ -258,7 +258,7 @@ int main(void) // Check all possible UI states that require controls lock if (splineTypeEditMode || (selectedPoint != -1) || (selectedControlPoint != NULL)) GuiLock(); - + // Draw spline config GuiLabel((Rectangle){ 12, 62, 140, 24 }, TextFormat("Spline thickness: %i", (int)splineThickness)); GuiSliderBar((Rectangle){ 12, 60 + 24, 140, 16 }, NULL, NULL, &splineThickness, 1.0f, 40.0f); @@ -269,7 +269,7 @@ int main(void) GuiLabel((Rectangle){ 12, 10, 140, 24 }, "Spline type:"); if (GuiDropdownBox((Rectangle){ 12, 8 + 24, 140, 28 }, "LINEAR;BSPLINE;CATMULLROM;BEZIER", &splineTypeActive, splineTypeEditMode)) splineTypeEditMode = !splineTypeEditMode; - + GuiUnlock(); EndDrawing(); diff --git a/examples/shapes/shapes_top_down_lights.c b/examples/shapes/shapes_top_down_lights.c index 7e2640117..3c62b602a 100644 --- a/examples/shapes/shapes_top_down_lights.c +++ b/examples/shapes/shapes_top_down_lights.c @@ -55,7 +55,7 @@ LightInfo lights[MAX_LIGHTS] = { 0 }; void MoveLight(int slot, float x, float y) { lights[slot].dirty = true; - lights[slot].position.x = x; + lights[slot].position.x = x; lights[slot].position.y = y; // update the cached bounds @@ -99,7 +99,7 @@ void DrawLightMask(int slot) // If we are valid, then draw the light radius to the alpha mask if (lights[slot].valid) DrawCircleGradient((int)lights[slot].position.x, (int)lights[slot].position.y, lights[slot].outerRadius, ColorAlpha(WHITE, 0), WHITE); - + rlDrawRenderBatchActive(); // Cut out the shadows from the light radius by forcing the alpha to maximum @@ -114,7 +114,7 @@ void DrawLightMask(int slot) } rlDrawRenderBatchActive(); - + // Go back to normal blend mode rlSetBlendMode(BLEND_ALPHA); @@ -156,7 +156,7 @@ bool UpdateLight(int slot, Rectangle* boxes, int count) if (!CheckCollisionRecs(lights[slot].bounds, boxes[i])) continue; // Check the edges that are on the same side we are, and cast shadow volumes out from them - + // Top Vector2 sp = (Vector2){ boxes[i].x, boxes[i].y }; Vector2 ep = (Vector2){ boxes[i].x + boxes[i].width, boxes[i].y }; @@ -219,7 +219,7 @@ int main(void) //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; - + InitWindow(screenWidth, screenHeight, "raylib [shapes] example - top down lights"); // Initialize our 'world' of boxes @@ -274,7 +274,7 @@ int main(void) { // Build up the light mask BeginTextureMode(lightMask); - + ClearBackground(BLACK); // Force the blend mode to only set the alpha of the destination @@ -300,10 +300,10 @@ int main(void) BeginDrawing(); ClearBackground(BLACK); - + // Draw the tile background DrawTextureRec(backgroundTexture, (Rectangle){ 0, 0, (float)GetScreenWidth(), (float)GetScreenHeight() }, Vector2Zero(), WHITE); - + // Overlay the shadows from all the lights DrawTextureRec(lightMask.texture, (Rectangle){ 0, 0, (float)GetScreenWidth(), -(float)GetScreenHeight() }, Vector2Zero(), ColorAlpha(WHITE, showLines? 0.75f : 1.0f)); diff --git a/examples/text/text_codepoints_loading.c b/examples/text/text_codepoints_loading.c index a176148ea..28d15c33f 100644 --- a/examples/text/text_codepoints_loading.c +++ b/examples/text/text_codepoints_loading.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Codepoints loading +* raylib [text] example - text codepoints loading * * Example complexity rating: [★★★☆] 3/4 * @@ -39,7 +39,7 @@ int main(void) InitWindow(screenWidth, screenHeight, "raylib [text] example - codepoints loading"); // Convert each utf-8 character into its - // corresponding codepoint in the font file. + // corresponding codepoint in the font file int codepointCount = 0; int *codepoints = LoadCodepoints(text, &codepointCount); diff --git a/examples/text/text_draw_3d.c b/examples/text/text_draw_3d.c index ec80190bf..ce76c885e 100644 --- a/examples/text/text_draw_3d.c +++ b/examples/text/text_draw_3d.c @@ -1,18 +1,18 @@ /******************************************************************************************* * -* raylib [text] example - Draw 3d +* raylib [text] example - drawing 3d text * * Example complexity rating: [★★★★] 4/4 * * NOTE: Draw a 2D text in 3D space, each letter is drawn in a quad (or 2 quads if backface is set) * where the texture coodinates of each quad map to the texture coordinates of the glyphs -* inside the font texture. +* inside the font texture * * A more efficient approach, i believe, would be to render the text in a render texture and * map that texture to a plane and render that, or maybe a shader but my method allows more * flexibility...for example to change position of each letter individually to make somethink -* like a wavy text effect. -* +* like a wavy text effect +* * Special thanks to: * @Nighten for the DrawTextStyle() code https://github.com/NightenDushi/Raylib_DrawTextStyle * Chris Camacho (codifies - http://bedroomcoders.co.uk/) for the alpha discard shader @@ -71,7 +71,7 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font // Draw a 2D text in 3D space and wave the parts that start with '~~' and end with '~~' // This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig *config, float time, Color tint); -// Measure a text in 3D ignoring the `~~` chars. +// Measure a text in 3D ignoring the `~~` chars static Vector3 MeasureTextWave3D(Font font, const char *text, float fontSize, float fontSpacing, float lineSpacing); // Generates a nice color with a random hue static Color GenerateRandomColor(float s, float v); @@ -151,7 +151,7 @@ int main(void) screenHeight = GetScreenHeight(); } UpdateCamera(&camera, camera_mode); - + // Handle font files dropped if (IsFileDropped()) { @@ -169,7 +169,7 @@ int main(void) font = LoadFont(droppedFiles.paths[0]); fontSize = (float)font.baseSize; } - + UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory } @@ -567,7 +567,7 @@ static void DrawText3D(Font font, const char *text, Vector3 position, float font } } -// Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~`. +// Draw a 2D text in 3D space and wave the parts that start with `~~` and end with `~~` // This is a modified version of the original code by @Nighten found here https://github.com/NightenDushi/Raylib_DrawTextStyle static void DrawTextWave3D(Font font, const char *text, Vector3 position, float fontSize, float fontSpacing, float lineSpacing, bool backface, WaveTextConfig* config, float time, Color tint) { @@ -630,7 +630,7 @@ static void DrawTextWave3D(Font font, const char *text, Vector3 position, float } } -// Measure a text in 3D ignoring the `~~` chars. +// Measure a text in 3D ignoring the `~~` chars static Vector3 MeasureTextWave3D(Font font, const char* text, float fontSize, float fontSpacing, float lineSpacing) { int len = TextLength(text); diff --git a/examples/text/text_font_filters.c b/examples/text/text_font_filters.c index f3293e6be..f75ae26b2 100644 --- a/examples/text/text_font_filters.c +++ b/examples/text/text_font_filters.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Font filters +* raylib [text] example - font texture filters * * Example complexity rating: [★★☆☆] 2/4 * @@ -94,7 +94,7 @@ int main(void) UnloadFont(font); font = LoadFontEx(droppedFiles.paths[0], (int)fontSize, 0, 0); } - + UnloadDroppedFiles(droppedFiles); // Unload filepaths from memory } //---------------------------------------------------------------------------------- diff --git a/examples/text/text_font_sdf.c b/examples/text/text_font_sdf.c index 7a051710b..fd3b2f776 100644 --- a/examples/text/text_font_sdf.c +++ b/examples/text/text_font_sdf.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Font SDF loading +* raylib [text] example - font SDF loading * * Example complexity rating: [★★★☆] 3/4 * diff --git a/examples/text/text_font_spritefont.c b/examples/text/text_font_spritefont.c index 95b5cfee5..8c1a3b102 100644 --- a/examples/text/text_font_spritefont.c +++ b/examples/text/text_font_spritefont.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Sprite font loading +* raylib [text] example - sprite font loading * * Example complexity rating: [★☆☆☆] 1/4 * @@ -12,7 +12,7 @@ * - Rectangles must be defined by a MAGENTA color background * * Following those constraints, a font can be provided just by an image, -* this is quite handy to avoid additional font descriptor files (like BMFonts use). +* this is quite handy to avoid additional font descriptor files (like BMFonts use) * * Example originally created with raylib 1.0, last time updated with raylib 1.0 * diff --git a/examples/text/text_format_text.c b/examples/text/text_format_text.c index eca6500e3..a5c2a2331 100644 --- a/examples/text/text_format_text.c +++ b/examples/text/text_format_text.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Text formatting +* raylib [text] example - text formating * * Example complexity rating: [★☆☆☆] 1/4 * diff --git a/examples/text/text_input_box.c b/examples/text/text_input_box.c index 24672b2ad..77c04d55a 100644 --- a/examples/text/text_input_box.c +++ b/examples/text/text_input_box.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Input Box +* raylib [text] example - text input box * * Example complexity rating: [★★☆☆] 2/4 * @@ -63,7 +63,7 @@ int main(void) if ((key >= 32) && (key <= 125) && (letterCount < MAX_INPUT_CHARS)) { name[letterCount] = (char)key; - name[letterCount+1] = '\0'; // Add null terminator at the end of the string. + name[letterCount+1] = '\0'; // Add null terminator at the end of the string letterCount++; } diff --git a/examples/text/text_rectangle_bounds.c b/examples/text/text_rectangle_bounds.c index c9dad5f9e..75ac65b49 100644 --- a/examples/text/text_rectangle_bounds.c +++ b/examples/text/text_rectangle_bounds.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Rectangle bounds +* raylib [text] example - rectangle bounds * * Example complexity rating: [★★★★] 4/4 * @@ -179,9 +179,9 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, // NOTE: When wordWrap is ON we first measure how much of the text we can draw before going outside of the rec container // We store this info in startLine and endLine, then we change states, draw the text between those two variables - // and change states again and again recursively until the end of the text (or until we get outside of the container). + // and change states again and again recursively until the end of the text (or until we get outside of the container) // When wordWrap is OFF we don't need the measure state so we go to the drawing state immediately - // and begin drawing on the next line before we can get outside the container. + // and begin drawing on the next line before we can get outside the container if (state == MEASURE_STATE) { // TODO: There are multiple types of spaces in UNICODE, maybe it's a good idea to add support for more diff --git a/examples/text/text_unicode.c b/examples/text/text_unicode.c index 31faafade..fbf579772 100644 --- a/examples/text/text_unicode.c +++ b/examples/text/text_unicode.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Unicode +* raylib [text] example - unicode text drawing * * Example complexity rating: [★★★★] 4/4 * @@ -284,7 +284,7 @@ int main(void) int length = GetCodepointCount(messages[message].text); const char *info = TextFormat("%s %u characters %i bytes", messages[message].language, length, size); sz = MeasureTextEx(GetFontDefault(), info, 10, 1.0f); - + DrawText(info, (int)(textRect.x + textRect.width - sz.x), (int)(msgRect.y + msgRect.height - sz.y - 2), 10, RAYWHITE); } //------------------------------------------------------------------------------ @@ -378,9 +378,9 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, // NOTE: When wordWrap is ON we first measure how much of the text we can draw before going outside of the rec container // We store this info in startLine and endLine, then we change states, draw the text between those two variables - // and change states again and again recursively until the end of the text (or until we get outside of the container). + // and change states again and again recursively until the end of the text (or until we get outside of the container) // When wordWrap is OFF we don't need the measure state so we go to the drawing state immediately - // and begin drawing on the next line before we can get outside the container. + // and begin drawing on the next line before we can get outside the container if (state == MEASURE_STATE) { // TODO: There are multiple types of spaces in UNICODE, maybe it's a good idea to add support for more diff --git a/examples/text/text_writing_anim.c b/examples/text/text_writing_anim.c index 3455cec33..5d5b8ea7d 100644 --- a/examples/text/text_writing_anim.c +++ b/examples/text/text_writing_anim.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [text] example - Text Writing Animation +* raylib [text] example - text writing animation * * Example complexity rating: [★★☆☆] 2/4 * diff --git a/examples/textures/textures_background_scrolling.c b/examples/textures/textures_background_scrolling.c index 48ba314d4..d942caa54 100644 --- a/examples/textures/textures_background_scrolling.c +++ b/examples/textures/textures_background_scrolling.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Background scrolling +* raylib [textures] example - background scrolling * * Example complexity rating: [★☆☆☆] 1/4 * diff --git a/examples/textures/textures_bunnymark.c b/examples/textures/textures_bunnymark.c index 6f58e8281..a26f175ca 100644 --- a/examples/textures/textures_bunnymark.c +++ b/examples/textures/textures_bunnymark.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Bunnymark +* raylib [textures] example - bunnymark * * Example complexity rating: [★★★☆] 3/4 * diff --git a/examples/textures/textures_draw_tiled.c b/examples/textures/textures_draw_tiled.c index 801a7c15a..c6bf3f835 100644 --- a/examples/textures/textures_draw_tiled.c +++ b/examples/textures/textures_draw_tiled.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Draw part of the texture tiled +* raylib [textures] example - draw texture tiled * * Example complexity rating: [★★★☆] 3/4 * @@ -22,7 +22,7 @@ #define MARGIN_SIZE 8 // Size for the margins #define COLOR_SIZE 16 // Size of the color select buttons -// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest. +// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint); //------------------------------------------------------------------------------------ @@ -36,7 +36,7 @@ int main(void) const int screenHeight = 450; SetConfigFlags(FLAG_WINDOW_RESIZABLE); // Make the window resizable - InitWindow(screenWidth, screenHeight, "raylib [textures] example - Draw part of a texture tiled"); + InitWindow(screenWidth, screenHeight, "raylib [textures] example - draw texture tiled"); // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) Texture texPattern = LoadTexture("resources/patterns.png"); @@ -173,7 +173,7 @@ int main(void) return 0; } -// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest. +// Draw part of a texture (defined by a rectangle) with rotation and scale tiled into dest void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint) { if ((texture.id <= 0) || (scale <= 0.0f)) return; // Wanna see a infinite loop?!...just delete this line! diff --git a/examples/textures/textures_fog_of_war.c b/examples/textures/textures_fog_of_war.c index e9296f3f4..41a332272 100644 --- a/examples/textures/textures_fog_of_war.c +++ b/examples/textures/textures_fog_of_war.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Fog of war +* raylib [textures] example - fog of war * * Example complexity rating: [★★★☆] 3/4 * diff --git a/examples/textures/textures_image_channel.c b/examples/textures/textures_image_channel.c index 5e159b984..b11fb5cd6 100644 --- a/examples/textures/textures_image_channel.c +++ b/examples/textures/textures_image_channel.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Retrive image channel (mask) +* raylib [textures] example - extract image channel * * NOTE: Images are loaded in CPU memory (RAM); textures are loaded in GPU memory (VRAM) * @@ -75,11 +75,11 @@ int main(void) // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { - // Draw + // Update //---------------------------------------------------------------------------------- - // TODO... + // Nothing to update... //---------------------------------------------------------------------------------- - + // Draw //---------------------------------------------------------------------------------- BeginDrawing(); @@ -104,6 +104,7 @@ int main(void) UnloadTexture(textureGreen); UnloadTexture(textureBlue); UnloadTexture(textureAlpha); + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/textures/textures_image_drawing.c b/examples/textures/textures_image_drawing.c index 05f40df9b..cc2340d82 100644 --- a/examples/textures/textures_image_drawing.c +++ b/examples/textures/textures_image_drawing.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Image loading and drawing on it +* raylib [textures] example - image loading and drawing * * Example complexity rating: [★★☆☆] 2/4 * diff --git a/examples/textures/textures_image_generation.c b/examples/textures/textures_image_generation.c index 2372af9c3..f616c6bfe 100644 --- a/examples/textures/textures_image_generation.c +++ b/examples/textures/textures_image_generation.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Procedural images generation +* raylib [textures] example - procedural images generation * * Example complexity rating: [★★☆☆] 2/4 * diff --git a/examples/textures/textures_image_kernel.c b/examples/textures/textures_image_kernel.c index 456cd1c18..cfd05092a 100644 --- a/examples/textures/textures_image_kernel.c +++ b/examples/textures/textures_image_kernel.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Image loading and texture creation +* raylib [textures] example - image kernel convolution * * Example complexity rating: [★★★★] 4/4 * @@ -19,20 +19,14 @@ #include "raylib.h" +//------------------------------------------------------------------------------------ +// Module functions declaration +//------------------------------------------------------------------------------------ +static void NormalizeKernel(float *kernel, int size); + //------------------------------------------------------------------------------------ // Program main entry point //------------------------------------------------------------------------------------ -void NormalizeKernel(float *kernel, int size) -{ - float sum = 0.0f; - for (int i = 0; i < size; i++) sum += kernel[i]; - - if (sum != 0.0f) - { - for (int i = 0; i < size; i++) kernel[i] /= sum; - } -} - int main(void) { // Initialization @@ -41,23 +35,26 @@ int main(void) const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [textures] example - image convolution"); - - Image image = LoadImage("resources/cat.png"); // Loaded in CPU memory (RAM) - float gaussiankernel[] = { + Image image = LoadImage("resources/cat.png"); // Loaded in CPU memory (RAM) + + float gaussiankernel[] = { 1.0f, 2.0f, 1.0f, 2.0f, 4.0f, 2.0f, - 1.0f, 2.0f, 1.0f }; + 1.0f, 2.0f, 1.0f + }; float sobelkernel[] = { 1.0f, 0.0f, -1.0f, 2.0f, 0.0f, -2.0f, - 1.0f, 0.0f, -1.0f }; + 1.0f, 0.0f, -1.0f + }; float sharpenkernel[] = { 0.0f, -1.0f, 0.0f, -1.0f, 5.0f, -1.0f, - 0.0f, -1.0f, 0.0f }; + 0.0f, -1.0f, 0.0f + }; NormalizeKernel(gaussiankernel, 9); NormalizeKernel(sharpenkernel, 9); @@ -65,12 +62,12 @@ int main(void) Image catSharpend = ImageCopy(image); ImageKernelConvolution(&catSharpend, sharpenkernel, 9); - + Image catSobel = ImageCopy(image); ImageKernelConvolution(&catSobel, sobelkernel, 9); Image catGaussian = ImageCopy(image); - + for (int i = 0; i < 6; i++) { ImageKernelConvolution(&catGaussian, gaussiankernel, 9); @@ -80,14 +77,14 @@ int main(void) ImageCrop(&catGaussian, (Rectangle){ 0, 0, (float)200, (float)450 }); ImageCrop(&catSobel, (Rectangle){ 0, 0, (float)200, (float)450 }); ImageCrop(&catSharpend, (Rectangle){ 0, 0, (float)200, (float)450 }); - + // Images converted to texture, GPU memory (VRAM) Texture2D texture = LoadTextureFromImage(image); Texture2D catSharpendTexture = LoadTextureFromImage(catSharpend); Texture2D catSobelTexture = LoadTextureFromImage(catSobel); Texture2D catGaussianTexture = LoadTextureFromImage(catGaussian); - - // Once images have been converted to texture and uploaded to VRAM, + + // Once images have been converted to texture and uploaded to VRAM, // they can be unloaded from RAM UnloadImage(image); UnloadImage(catGaussian); @@ -132,3 +129,17 @@ int main(void) return 0; } + +//------------------------------------------------------------------------------------ +// Module functions definition +//------------------------------------------------------------------------------------ +static void NormalizeKernel(float *kernel, int size) +{ + float sum = 0.0f; + for (int i = 0; i < size; i++) sum += kernel[i]; + + if (sum != 0.0f) + { + for (int i = 0; i < size; i++) kernel[i] /= sum; + } +} diff --git a/examples/textures/textures_image_loading.c b/examples/textures/textures_image_loading.c index 267216332..9ed864db5 100644 --- a/examples/textures/textures_image_loading.c +++ b/examples/textures/textures_image_loading.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Image loading and texture creation +* raylib [textures] example - image loading and texture creation * * Example complexity rating: [★☆☆☆] 1/4 * diff --git a/examples/textures/textures_image_rotate.c b/examples/textures/textures_image_rotate.c index 4921dc8ac..cf3278d22 100644 --- a/examples/textures/textures_image_rotate.c +++ b/examples/textures/textures_image_rotate.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Image Rotation +* raylib [textures] example - image rotation * * Example complexity rating: [★★☆☆] 2/4 * @@ -27,7 +27,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture rotation"); + InitWindow(screenWidth, screenHeight, "raylib [textures] example - image rotation"); // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) Image image45 = LoadImage("resources/raylib_logo.png"); diff --git a/examples/textures/textures_image_text.c b/examples/textures/textures_image_text.c index a0a41404a..6c8720315 100644 --- a/examples/textures/textures_image_text.c +++ b/examples/textures/textures_image_text.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Image text drawing using TTF generated font +* raylib [textures] example - image text drawing using TTF generated font * * Example complexity rating: [★★☆☆] 2/4 * diff --git a/examples/textures/textures_logo_raylib.c b/examples/textures/textures_logo_raylib.c index bd402baec..4fb176217 100644 --- a/examples/textures/textures_logo_raylib.c +++ b/examples/textures/textures_logo_raylib.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Texture loading and drawing +* raylib [textures] example - texture loading and drawing * * Example complexity rating: [★☆☆☆] 1/4 * diff --git a/examples/textures/textures_mouse_painting.c b/examples/textures/textures_mouse_painting.c index e2a2b6081..2575c4450 100644 --- a/examples/textures/textures_mouse_painting.c +++ b/examples/textures/textures_mouse_painting.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Mouse painting +* raylib [textures] example - mouse painting * * Example complexity rating: [★★★☆] 3/4 * diff --git a/examples/textures/textures_particles_blending.c b/examples/textures/textures_particles_blending.c index 65a55f30a..537d7f312 100644 --- a/examples/textures/textures_particles_blending.c +++ b/examples/textures/textures_particles_blending.c @@ -71,7 +71,7 @@ int main(void) // Activate one particle every frame and Update active particles // NOTE: Particles initial position should be mouse position when activated // NOTE: Particles fall down with gravity and rotation... and disappear after 2 seconds (alpha = 0) - // NOTE: When a particle disappears, active = false and it can be reused. + // NOTE: When a particle disappears, active = false and it can be reused for (int i = 0; i < MAX_PARTICLES; i++) { if (!mouseTail[i].active) diff --git a/examples/textures/textures_polygon.c b/examples/textures/textures_polygon.c index 1cde29a4b..414b91350 100644 --- a/examples/textures/textures_polygon.c +++ b/examples/textures/textures_polygon.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Draw Textured Polygon +* raylib [textures] example - draw textured polygon * * Example complexity rating: [★☆☆☆] 1/4 * @@ -34,7 +34,7 @@ int main(void) //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; - + InitWindow(screenWidth, screenHeight, "raylib [textures] example - textured polygon"); // Define texture coordinates to map our texture to poly @@ -60,7 +60,7 @@ int main(void) points[i].x = (texcoords[i].x - 0.5f)*256.0f; points[i].y = (texcoords[i].y - 0.5f)*256.0f; } - + // Define the vertices drawing position // NOTE: Initially same as points but updated every frame Vector2 positions[MAX_POINTS] = { 0 }; @@ -116,7 +116,7 @@ int main(void) void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint) { rlBegin(RL_TRIANGLES); - + rlSetTexture(texture.id); rlColor4ub(tint.r, tint.g, tint.b, tint.a); diff --git a/examples/textures/textures_raw_data.c b/examples/textures/textures_raw_data.c index 01248e979..76be8593a 100644 --- a/examples/textures/textures_raw_data.c +++ b/examples/textures/textures_raw_data.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Load textures from raw data +* raylib [textures] example - load textures from raw data * * Example complexity rating: [★★★☆] 3/4 * diff --git a/examples/textures/textures_sprite_anim.c b/examples/textures/textures_sprite_anim.c index c8b401522..032b1f621 100644 --- a/examples/textures/textures_sprite_anim.c +++ b/examples/textures/textures_sprite_anim.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Sprite animation +* raylib [textures] example - sprite animation * * Example complexity rating: [★★☆☆] 2/4 * diff --git a/examples/textures/textures_srcrec_dstrec.c b/examples/textures/textures_srcrec_dstrec.c index cf3686d15..6c5ba1b36 100644 --- a/examples/textures/textures_srcrec_dstrec.c +++ b/examples/textures/textures_srcrec_dstrec.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Texture source and destination rectangles +* raylib [textures] example - texture source and destination rectangles * * Example complexity rating: [★★★☆] 3/4 * diff --git a/examples/textures/textures_textured_curve.c b/examples/textures/textures_textured_curve.c index 00417b038..0102e8d5c 100644 --- a/examples/textures/textures_textured_curve.c +++ b/examples/textures/textures_textured_curve.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Draw a texture along a segmented curve +* raylib [textures] example - draw texture along segmented curve * * Example complexity rating: [★★★☆] 3/4 * @@ -112,7 +112,7 @@ int main() ClearBackground(RAYWHITE); DrawTexturedCurve(); // Draw a textured Spline Cubic Bezier - + // Draw spline for reference if (showCurve) DrawSplineSegmentBezierCubic(curveStartPosition, curveEndPosition, curveStartPositionTangent, curveEndPositionTangent, 2, BLUE); @@ -120,7 +120,7 @@ int main() DrawLineV(curveStartPosition, curveStartPositionTangent, SKYBLUE); DrawLineV(curveStartPositionTangent, curveEndPositionTangent, Fade(LIGHTGRAY, 0.4f)); DrawLineV(curveEndPosition, curveEndPositionTangent, PURPLE); - + if (CheckCollisionPointCircle(mouse, curveStartPosition, 6)) DrawCircleV(curveStartPosition, 7, YELLOW); DrawCircleV(curveStartPosition, 5, RED); @@ -137,7 +137,7 @@ int main() DrawText("Drag points to move curve, press SPACE to show/hide base curve", 10, 10, 10, DARKGRAY); DrawText(TextFormat("Curve width: %2.0f (Use + and - to adjust)", curveWidth), 10, 30, 10, DARKGRAY); DrawText(TextFormat("Curve segments: %d (Use LEFT and RIGHT to adjust)", curveSegments), 10, 50, 10, DARKGRAY); - + EndDrawing(); //---------------------------------------------------------------------------------- } @@ -145,7 +145,7 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- UnloadTexture(texRoad); - + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/textures/textures_to_image.c b/examples/textures/textures_to_image.c index 84b4a72be..16d55f84c 100644 --- a/examples/textures/textures_to_image.c +++ b/examples/textures/textures_to_image.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [textures] example - Retrieve image data from texture: LoadImageFromTexture() +* raylib [textures] example - texture to image * * Example complexity rating: [★☆☆☆] 1/4 * diff --git a/projects/VS2022/examples/audio_sound_positioning.vcxproj b/projects/VS2022/examples/audio_sound_positioning.vcxproj index 96c8fef5e..7a241ea30 100644 --- a/projects/VS2022/examples/audio_sound_positioning.vcxproj +++ b/projects/VS2022/examples/audio_sound_positioning.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {9CD8BCAD-F212-4BCC-BA98-899743CE3279} Win32Proj audio_sound_positioning 10.0 diff --git a/projects/VS2022/examples/models_point_rendering.vcxproj b/projects/VS2022/examples/models_point_rendering.vcxproj index ba66e9baa..ce32a3415 100644 --- a/projects/VS2022/examples/models_point_rendering.vcxproj +++ b/projects/VS2022/examples/models_point_rendering.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {921391C6-7626-4212-9928-BC82BC785461} Win32Proj models_point_rendering 10.0 diff --git a/projects/VS2022/examples/models_tesseract_view.vcxproj b/projects/VS2022/examples/models_tesseract_view.vcxproj index b49094ac7..f64344044 100644 --- a/projects/VS2022/examples/models_tesseract_view.vcxproj +++ b/projects/VS2022/examples/models_tesseract_view.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F} Win32Proj models_tesseract_view 10.0 diff --git a/projects/VS2022/examples/shaders_basic_pbr.vcxproj b/projects/VS2022/examples/shaders_basic_pbr.vcxproj index 49744ed0e..a17b0de3b 100644 --- a/projects/VS2022/examples/shaders_basic_pbr.vcxproj +++ b/projects/VS2022/examples/shaders_basic_pbr.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8} Win32Proj shaders_basic_pbr 10.0 diff --git a/projects/VS2022/examples/shaders_lightmap.vcxproj b/projects/VS2022/examples/shaders_lightmap.vcxproj index 392f35b71..d1be94f1c 100644 --- a/projects/VS2022/examples/shaders_lightmap.vcxproj +++ b/projects/VS2022/examples/shaders_lightmap.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {C54703BF-D68A-480D-BE27-49B62E45D582} Win32Proj shaders_lightmap 10.0 diff --git a/projects/VS2022/examples/shaders_normalmap.vcxproj b/projects/VS2022/examples/shaders_normalmap.vcxproj new file mode 100644 index 000000000..79f976102 --- /dev/null +++ b/projects/VS2022/examples/shaders_normalmap.vcxproj @@ -0,0 +1,569 @@ + + + + + Debug.DLL + ARM64 + + + Debug.DLL + Win32 + + + Debug.DLL + x64 + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release.DLL + ARM64 + + + Release.DLL + Win32 + + + Release.DLL + x64 + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + Win32Proj + shaders_normalmap + 10.0 + shaders_normalmap + + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + true + $(DefaultPlatformToolset) + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + Application + false + $(DefaultPlatformToolset) + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + true + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + false + $(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)\build\$(ProjectName)\obj\$(Platform)\$(Configuration)\ + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + $(SolutionDir)..\..\examples\shaders + WindowsLocalDebugger + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + /FS %(AdditionalOptions) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + Copy Debug DLL to output directory + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + Copy Debug DLL to output directory + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;PLATFORM_DESKTOP;%(PreprocessorDefinitions) + CompileAsC + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + Copy Debug DLL to output directory + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + + + Copy Release DLL to output directory + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + + + Copy Release DLL to output directory + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);PLATFORM_DESKTOP + $(SolutionDir)..\..\src;%(AdditionalIncludeDirectories) + CompileAsC + true + + + Console + true + true + true + raylib.lib;opengl32.lib;kernel32.lib;user32.lib;gdi32.lib;winmm.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + $(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\ + + + xcopy /y /d "$(SolutionDir)\build\raylib\bin\$(Platform)\$(Configuration)\raylib.dll" "$(SolutionDir)\build\$(ProjectName)\bin\$(Platform)\$(Configuration)" + + + Copy Release DLL to output directory + + + + + + + + + + + {e89d61ac-55de-4482-afd4-df7242ebc859} + + + + + + \ No newline at end of file diff --git a/projects/VS2022/examples/shapes_digital_clock.vcxproj b/projects/VS2022/examples/shapes_digital_clock.vcxproj index d14448393..e361eb190 100644 --- a/projects/VS2022/examples/shapes_digital_clock.vcxproj +++ b/projects/VS2022/examples/shapes_digital_clock.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {3384C257-3CFE-4A8F-838C-19DAC5C955DA} Win32Proj shapes_digital_clock 10.0 diff --git a/projects/VS2022/examples/shapes_double_pendulum.vcxproj b/projects/VS2022/examples/shapes_double_pendulum.vcxproj index 57f7d458b..775b25335 100644 --- a/projects/VS2022/examples/shapes_double_pendulum.vcxproj +++ b/projects/VS2022/examples/shapes_double_pendulum.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {2B140378-125F-4DE9-AC37-2CC1B73D7254} Win32Proj shapes_double_pendulum 10.0 diff --git a/projects/VS2022/examples/textures_image_channel.vcxproj b/projects/VS2022/examples/textures_image_channel.vcxproj index c480f869d..90c09fc54 100644 --- a/projects/VS2022/examples/textures_image_channel.vcxproj +++ b/projects/VS2022/examples/textures_image_channel.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F} Win32Proj textures_image_channel 10.0 diff --git a/projects/VS2022/examples/textures_image_kernel.vcxproj b/projects/VS2022/examples/textures_image_kernel.vcxproj index 20cb60d6a..b0012e4d6 100644 --- a/projects/VS2022/examples/textures_image_kernel.vcxproj +++ b/projects/VS2022/examples/textures_image_kernel.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6} Win32Proj textures_image_kernel 10.0 diff --git a/projects/VS2022/examples/textures_image_rotate.vcxproj b/projects/VS2022/examples/textures_image_rotate.vcxproj index 98179299a..8345b42a7 100644 --- a/projects/VS2022/examples/textures_image_rotate.vcxproj +++ b/projects/VS2022/examples/textures_image_rotate.vcxproj @@ -51,7 +51,7 @@ - {0981CA98-E4A5-4DF1-987F-A41D09131EFC} + {2AA91EED-2D32-4B09-84A3-53D41EED1005} Win32Proj textures_image_rotate 10.0 diff --git a/projects/VS2022/raylib.sln b/projects/VS2022/raylib.sln index 4f8c3beea..452ba39c5 100644 --- a/projects/VS2022/raylib.sln +++ b/projects/VS2022/raylib.sln @@ -7,6 +7,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raylib", "raylib\raylib.vcx EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{6C82BAAE-BDDF-457D-8FA8-7E2490B07035}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shapes", "shapes", "{278D8859-20B1-428F-8448-064F46E1F021}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "textures", "textures", "{DA049009-21FF-4AC0-84E4-830DD1BCD0CE}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "text", "text", "{8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "models", "models", "{AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shaders", "shaders", "{5317807F-61D4-4E0F-B6DC-2D9F12621ED9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "audio", "audio", "{CC132A4D-D081-4C26-BFB9-AB11984054F8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "other", "other", "{E9D708A5-9C1F-4B84-A795-C5F191801762}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_basic_window", "examples\core_basic_window.vcxproj", "{0981CA98-E4A5-4DF1-987F-A41D09131EFC}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_sprite_anim", "examples\textures_sprite_anim.vcxproj", "{C25D2CC6-80CA-4C8A-BE3B-2E0F4EA5D0CC}" @@ -79,18 +95,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_box_collisions", "ex EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_cubicmap", "examples\models_cubicmap.vcxproj", "{82F3D34B-8DB2-4C6A-98B1-132245DD9D99}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{6C82BAAE-BDDF-457D-8FA8-7E2490B07035}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "audio", "audio", "{CC132A4D-D081-4C26-BFB9-AB11984054F8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "models", "models", "{AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "textures", "textures", "{DA049009-21FF-4AC0-84E4-830DD1BCD0CE}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shapes", "shapes", "{278D8859-20B1-428F-8448-064F46E1F021}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shaders", "shaders", "{5317807F-61D4-4E0F-B6DC-2D9F12621ED9}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_first_person_maze", "examples\models_first_person_maze.vcxproj", "{CBD6C0F8-8200-4E9A-9D7C-6505A2AA4A62}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_geometric_shapes", "examples\models_geometric_shapes.vcxproj", "{14BA7F98-02CC-4648-9236-676BFF9458AF}" @@ -145,10 +149,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_blend_modes", "exa EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_background_scrolling", "examples\textures_background_scrolling.vcxproj", "{8DD0EB7E-668E-452D-91D7-906C64A9C8AC}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "text", "text", "{8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "other", "other", "{E9D708A5-9C1F-4B84-A795-C5F191801762}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "text_writing_anim", "examples\text_writing_anim.vcxproj", "{F6FD9C75-AAA7-48C9-B19D-FD37C8FB9B7E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "text_unicode", "examples\text_unicode.vcxproj", "{1FE8758D-7E8A-41F3-9B6D-FD50E9A2A03D}" @@ -313,6 +313,26 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_vertex_displacement EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_rounded_rectangle", "examples\shaders_rounded_rectangle.vcxproj", "{D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_digital_clock", "examples\shapes_digital_clock.vcxproj", "{3384C257-3CFE-4A8F-838C-19DAC5C955DA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_double_pendulum", "examples\shapes_double_pendulum.vcxproj", "{2B140378-125F-4DE9-AC37-2CC1B73D7254}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_image_kernel", "examples\textures_image_kernel.vcxproj", "{F4C55B99-E1C5-496A-8AC2-40188C38F4F6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_image_rotate", "examples\textures_image_rotate.vcxproj", "{2AA91EED-2D32-4B09-84A3-53D41EED1005}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textures_image_channel", "examples\textures_image_channel.vcxproj", "{EC0910F6-8D66-4509-BF57-A5EE7AE9485F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_point_rendering", "examples\models_point_rendering.vcxproj", "{921391C6-7626-4212-9928-BC82BC785461}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_tesseract_view", "examples\models_tesseract_view.vcxproj", "{6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_basic_pbr", "examples\shaders_basic_pbr.vcxproj", "{4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_lightmap", "examples\shaders_lightmap.vcxproj", "{C54703BF-D68A-480D-BE27-49B62E45D582}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audio_sound_positioning", "examples\audio_sound_positioning.vcxproj", "{9CD8BCAD-F212-4BCC-BA98-899743CE3279}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug.DLL|ARM64 = Debug.DLL|ARM64 @@ -3821,11 +3841,259 @@ Global {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x64.Build.0 = Release|x64 {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x86.ActiveCfg = Release|Win32 {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x86.Build.0 = Release|Win32 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug|ARM64.Build.0 = Debug|ARM64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug|x64.ActiveCfg = Debug|x64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug|x64.Build.0 = Debug|x64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug|x86.ActiveCfg = Debug|Win32 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Debug|x86.Build.0 = Debug|Win32 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release|ARM64.ActiveCfg = Release|ARM64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release|ARM64.Build.0 = Release|ARM64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release|x64.ActiveCfg = Release|x64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release|x64.Build.0 = Release|x64 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release|x86.ActiveCfg = Release|Win32 + {3384C257-3CFE-4A8F-838C-19DAC5C955DA}.Release|x86.Build.0 = Release|Win32 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug|ARM64.Build.0 = Debug|ARM64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug|x64.ActiveCfg = Debug|x64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug|x64.Build.0 = Debug|x64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug|x86.ActiveCfg = Debug|Win32 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Debug|x86.Build.0 = Debug|Win32 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release|ARM64.ActiveCfg = Release|ARM64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release|ARM64.Build.0 = Release|ARM64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release|x64.ActiveCfg = Release|x64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release|x64.Build.0 = Release|x64 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release|x86.ActiveCfg = Release|Win32 + {2B140378-125F-4DE9-AC37-2CC1B73D7254}.Release|x86.Build.0 = Release|Win32 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug|ARM64.Build.0 = Debug|ARM64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug|x64.ActiveCfg = Debug|x64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug|x64.Build.0 = Debug|x64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug|x86.ActiveCfg = Debug|Win32 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Debug|x86.Build.0 = Debug|Win32 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release|ARM64.ActiveCfg = Release|ARM64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release|ARM64.Build.0 = Release|ARM64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release|x64.ActiveCfg = Release|x64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release|x64.Build.0 = Release|x64 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release|x86.ActiveCfg = Release|Win32 + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6}.Release|x86.Build.0 = Release|Win32 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug|ARM64.Build.0 = Debug|ARM64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug|x64.ActiveCfg = Debug|x64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug|x64.Build.0 = Debug|x64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug|x86.ActiveCfg = Debug|Win32 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Debug|x86.Build.0 = Debug|Win32 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release|ARM64.ActiveCfg = Release|ARM64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release|ARM64.Build.0 = Release|ARM64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release|x64.ActiveCfg = Release|x64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release|x64.Build.0 = Release|x64 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release|x86.ActiveCfg = Release|Win32 + {2AA91EED-2D32-4B09-84A3-53D41EED1005}.Release|x86.Build.0 = Release|Win32 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug|ARM64.Build.0 = Debug|ARM64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug|x64.ActiveCfg = Debug|x64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug|x64.Build.0 = Debug|x64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug|x86.ActiveCfg = Debug|Win32 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Debug|x86.Build.0 = Debug|Win32 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release|ARM64.ActiveCfg = Release|ARM64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release|ARM64.Build.0 = Release|ARM64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release|x64.ActiveCfg = Release|x64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release|x64.Build.0 = Release|x64 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release|x86.ActiveCfg = Release|Win32 + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F}.Release|x86.Build.0 = Release|Win32 + {921391C6-7626-4212-9928-BC82BC785461}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {921391C6-7626-4212-9928-BC82BC785461}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {921391C6-7626-4212-9928-BC82BC785461}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {921391C6-7626-4212-9928-BC82BC785461}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {921391C6-7626-4212-9928-BC82BC785461}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {921391C6-7626-4212-9928-BC82BC785461}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {921391C6-7626-4212-9928-BC82BC785461}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {921391C6-7626-4212-9928-BC82BC785461}.Debug|ARM64.Build.0 = Debug|ARM64 + {921391C6-7626-4212-9928-BC82BC785461}.Debug|x64.ActiveCfg = Debug|x64 + {921391C6-7626-4212-9928-BC82BC785461}.Debug|x64.Build.0 = Debug|x64 + {921391C6-7626-4212-9928-BC82BC785461}.Debug|x86.ActiveCfg = Debug|Win32 + {921391C6-7626-4212-9928-BC82BC785461}.Debug|x86.Build.0 = Debug|Win32 + {921391C6-7626-4212-9928-BC82BC785461}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {921391C6-7626-4212-9928-BC82BC785461}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {921391C6-7626-4212-9928-BC82BC785461}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {921391C6-7626-4212-9928-BC82BC785461}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {921391C6-7626-4212-9928-BC82BC785461}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {921391C6-7626-4212-9928-BC82BC785461}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {921391C6-7626-4212-9928-BC82BC785461}.Release|ARM64.ActiveCfg = Release|ARM64 + {921391C6-7626-4212-9928-BC82BC785461}.Release|ARM64.Build.0 = Release|ARM64 + {921391C6-7626-4212-9928-BC82BC785461}.Release|x64.ActiveCfg = Release|x64 + {921391C6-7626-4212-9928-BC82BC785461}.Release|x64.Build.0 = Release|x64 + {921391C6-7626-4212-9928-BC82BC785461}.Release|x86.ActiveCfg = Release|Win32 + {921391C6-7626-4212-9928-BC82BC785461}.Release|x86.Build.0 = Release|Win32 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug|ARM64.Build.0 = Debug|ARM64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug|x64.ActiveCfg = Debug|x64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug|x64.Build.0 = Debug|x64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug|x86.ActiveCfg = Debug|Win32 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Debug|x86.Build.0 = Debug|Win32 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release|ARM64.ActiveCfg = Release|ARM64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release|ARM64.Build.0 = Release|ARM64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release|x64.ActiveCfg = Release|x64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release|x64.Build.0 = Release|x64 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release|x86.ActiveCfg = Release|Win32 + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F}.Release|x86.Build.0 = Release|Win32 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug|ARM64.Build.0 = Debug|ARM64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug|x64.ActiveCfg = Debug|x64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug|x64.Build.0 = Debug|x64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug|x86.ActiveCfg = Debug|Win32 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Debug|x86.Build.0 = Debug|Win32 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release|ARM64.ActiveCfg = Release|ARM64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release|ARM64.Build.0 = Release|ARM64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release|x64.ActiveCfg = Release|x64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release|x64.Build.0 = Release|x64 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release|x86.ActiveCfg = Release|Win32 + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8}.Release|x86.Build.0 = Release|Win32 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug|ARM64.Build.0 = Debug|ARM64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug|x64.ActiveCfg = Debug|x64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug|x64.Build.0 = Debug|x64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug|x86.ActiveCfg = Debug|Win32 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Debug|x86.Build.0 = Debug|Win32 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release|ARM64.ActiveCfg = Release|ARM64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release|ARM64.Build.0 = Release|ARM64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release|x64.ActiveCfg = Release|x64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release|x64.Build.0 = Release|x64 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release|x86.ActiveCfg = Release|Win32 + {C54703BF-D68A-480D-BE27-49B62E45D582}.Release|x86.Build.0 = Release|Win32 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug|ARM64.Build.0 = Debug|ARM64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug|x64.ActiveCfg = Debug|x64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug|x64.Build.0 = Debug|x64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug|x86.ActiveCfg = Debug|Win32 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Debug|x86.Build.0 = Debug|Win32 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release|ARM64.ActiveCfg = Release|ARM64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release|ARM64.Build.0 = Release|ARM64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release|x64.ActiveCfg = Release|x64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release|x64.Build.0 = Release|x64 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release|x86.ActiveCfg = Release|Win32 + {9CD8BCAD-F212-4BCC-BA98-899743CE3279}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} + {278D8859-20B1-428F-8448-064F46E1F021} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} + {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} + {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} + {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} + {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} + {CC132A4D-D081-4C26-BFB9-AB11984054F8} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} + {E9D708A5-9C1F-4B84-A795-C5F191801762} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} {0981CA98-E4A5-4DF1-987F-A41D09131EFC} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {C25D2CC6-80CA-4C8A-BE3B-2E0F4EA5D0CC} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} {103B292B-049B-4B15-85A1-9F902840DB2C} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} @@ -3843,6 +4111,7 @@ Global {FD193822-3D5C-4161-A147-884C2ABDE483} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {20AD0AC9-9159-4744-99CC-6AC5779D6B87} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {0199E349-0701-40BC-8A7F-06A54FFA3E7C} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} + {BCB71111-8505-4B35-8CEF-EC6115DC9D4D} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {8F19E3DA-8929-4000-87B5-3CA6929636CC} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {51A00565-5787-4911-9CC0-28403AA4909D} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} {92B64AE7-D773-4F05-89F1-CE59BBF4F053} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} @@ -3861,12 +4130,6 @@ Global {B7812167-50FB-4934-996F-DF6FE4CBBFDF} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} {39DB56C7-05F8-492C-A8D4-F19E40FECB59} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} {82F3D34B-8DB2-4C6A-98B1-132245DD9D99} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} - {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} - {CC132A4D-D081-4C26-BFB9-AB11984054F8} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} - {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} - {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} - {278D8859-20B1-428F-8448-064F46E1F021} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} - {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} {CBD6C0F8-8200-4E9A-9D7C-6505A2AA4A62} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} {14BA7F98-02CC-4648-9236-676BFF9458AF} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} {0859A973-E4FE-4688-8D16-0253163FDE24} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} @@ -3894,8 +4157,6 @@ Global {4E863E5B-0B95-43BE-8D4F-B9EB6C394FEC} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} {6D75CD88-1A03-4955-B8C7-ACFC3742154F} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} {8DD0EB7E-668E-452D-91D7-906C64A9C8AC} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} - {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} - {E9D708A5-9C1F-4B84-A795-C5F191801762} = {8716DC0F-4FDE-4F57-8E25-5F78DFB80FE1} {F6FD9C75-AAA7-48C9-B19D-FD37C8FB9B7E} = {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A} {1FE8758D-7E8A-41F3-9B6D-FD50E9A2A03D} = {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A} {25BCB876-B60A-499B-9046-E9801CFD7780} = {8D3C83B7-F1E0-4C2E-9E34-EE5F6AB2502A} @@ -3957,6 +4218,7 @@ Global {769FF0C1-4424-4FA3-BC44-D7A7DA312A06} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} {6D9E00D8-2893-45E4-9363-3F7F61D416BD} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} {70B35F59-AFC2-4D8F-8833-5314D2047A81} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} + {DFDE29A7-4F54-455D-B20B-D2BF79D3B3F7} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} {3755E9F4-CB48-4EC3-B561-3B85964EBDEF} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} {F81C5819-85B4-4D2E-B6DC-104A7634461B} = {CC132A4D-D081-4C26-BFB9-AB11984054F8} {CC62F7DB-D089-4677-8575-CAB7A7815C43} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} @@ -3977,6 +4239,16 @@ Global {3A7FE53D-35F7-49DC-9C9A-A5204A53523F} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} {CCA63A76-D9FC-4130-9F67-4D97F9770D53} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} + {3384C257-3CFE-4A8F-838C-19DAC5C955DA} = {278D8859-20B1-428F-8448-064F46E1F021} + {2B140378-125F-4DE9-AC37-2CC1B73D7254} = {278D8859-20B1-428F-8448-064F46E1F021} + {F4C55B99-E1C5-496A-8AC2-40188C38F4F6} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} + {2AA91EED-2D32-4B09-84A3-53D41EED1005} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} + {EC0910F6-8D66-4509-BF57-A5EE7AE9485F} = {DA049009-21FF-4AC0-84E4-830DD1BCD0CE} + {921391C6-7626-4212-9928-BC82BC785461} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} + {6B8C5711-6AB4-4023-9FDD-E9D976E8D18F} = {AF5BEC5C-1F2B-4DA8-B12D-D09FE569237C} + {4DF6D5E4-6796-4257-B466-BCD62DEBBCF8} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} + {C54703BF-D68A-480D-BE27-49B62E45D582} = {5317807F-61D4-4E0F-B6DC-2D9F12621ED9} + {9CD8BCAD-F212-4BCC-BA98-899743CE3279} = {CC132A4D-D081-4C26-BFB9-AB11984054F8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E926C768-6307-4423-A1EC-57E95B1FAB29} diff --git a/src/external/jar_mod.h b/src/external/jar_mod.h index eacd3b7d6..2a220f8af 100644 --- a/src/external/jar_mod.h +++ b/src/external/jar_mod.h @@ -1130,7 +1130,7 @@ static bool jar_mod_load( jar_mod_context_t * modctx, void * mod_data, int mod_d { if( modctx ) { - memcopy(&(modctx->song.title),modmemory,1084); + memcopy(&(modctx->song), modmemory, 1084); i = 0; modctx->number_of_channels = 0; @@ -1593,4 +1593,4 @@ void jar_mod_seek_start(jar_mod_context_t * ctx) //------------------------------------------------------------------------------- -#endif //end of header file \ No newline at end of file +#endif //end of header file diff --git a/src/external/rl_gputex.h b/src/external/rl_gputex.h index 906a863b1..9773268f5 100644 --- a/src/external/rl_gputex.h +++ b/src/external/rl_gputex.h @@ -5,10 +5,10 @@ * DESCRIPTION: * * Load GPU compressed image data from image files provided as memory data arrays, -* data is loaded compressed, ready to be loaded into GPU. +* data is loaded compressed, ready to be loaded into GPU * * Note that some file formats (DDS, PVR, KTX) also support uncompressed data storage. -* In those cases data is loaded uncompressed and format is returned. +* In those cases data is loaded uncompressed and format is returned * * FIXME: This library still depends on Raylib due to the following reasons: * - rl_save_ktx_to_memory() requires rlGetGlTextureFormats() from rlgl.h @@ -436,7 +436,7 @@ void *rl_load_pkm_from_memory(const unsigned char *file_data, unsigned int file_ // version 10: format: 0=ETC1_RGB, [1=ETC1_RGBA, 2=ETC1_RGB_MIP, 3=ETC1_RGBA_MIP] (not used) // version 20: format: 0=ETC1_RGB, 1=ETC2_RGB, 2=ETC2_RGBA_OLD, 3=ETC2_RGBA, 4=ETC2_RGBA1, 5=ETC2_R, 6=ETC2_RG, 7=ETC2_SIGNED_R, 8=ETC2_SIGNED_R - // NOTE: The extended width and height are the widths rounded up to a multiple of 4. + // NOTE: The extended width and height are the widths rounded up to a multiple of 4 // NOTE: ETC is always 4bit per pixel (64 bit for each 4x4 block of pixels) if (file_data_ptr != RL_GPUTEX_NULL) diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index d701691a1..c23b570d3 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -724,7 +724,7 @@ void *GetWindowHandle(void) return glfwGetWin32Window(platform.handle); #endif #if defined(__linux__) - // Store the window handle localy and return a pointer to the variable instead. + // Store the window handle localy and return a pointer to the variable instead // Reasoning detailed in the declaration of X11WindowHandle X11WindowHandle = glfwGetX11Window(platform.handle); return &X11WindowHandle; @@ -1066,9 +1066,9 @@ double GetTime(void) } // Open URL with default system browser (if available) -// NOTE: This function is only safe to use if you control the URL given. -// A user could craft a malicious string performing another action. -// Only call this function yourself not with user input or make sure to check the string yourself. +// NOTE: This function is only safe to use if you control the URL given +// A user could craft a malicious string performing another action +// Only call this function yourself not with user input or make sure to check the string yourself // Ref: https://github.com/raysan5/raylib/issues/686 void OpenURL(const char *url) { @@ -1130,7 +1130,7 @@ void SetMouseCursor(int cursor) } } -// Get physical key name. +// Get physical key name const char *GetKeyName(int key) { return glfwGetKeyName(key, glfwGetKeyScancode(key)); @@ -1306,8 +1306,8 @@ static void SetDimensionsFromMonitor(GLFWmonitor *monitor) } // Function wrappers around RL_*alloc macros, used by glfwInitAllocator() inside of InitPlatform() -// We need to provide these because GLFWallocator expects function pointers with specific signatures. -// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch. +// We need to provide these because GLFWallocator expects function pointers with specific signatures +// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch // https://www.glfw.org/docs/latest/intro_guide.html#init_allocator static void *AllocateWrapper(size_t size, void *user) { @@ -1394,15 +1394,15 @@ int InitPlatform(void) // HACK: Most of this was written before GLFW_SCALE_FRAMEBUFFER existed and // was enabled by default. Disabling it gets back the old behavior. A // complete fix will require removing a lot of CORE.Window.render - // manipulation code. + // manipulation code glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE); if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) { - // Resize window content area based on the monitor content scale. - // NOTE: This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11. - // On platforms like macOS the resolution of the framebuffer is changed independently of the window size. - glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); // Scale content area based on the monitor content scale where window is placed on + // Resize window content area based on the monitor content scale + // NOTE: This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11 + // On platforms like macOS the resolution of the framebuffer is changed independently of the window size + glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); // Scale content area based on the monitor content scale where window is placed on #if defined(__APPLE__) glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE); #endif @@ -1421,8 +1421,8 @@ int InitPlatform(void) } // NOTE: When asking for an OpenGL context version, most drivers provide the highest supported version - // with backward compatibility to older OpenGL versions. - // For example, if using OpenGL 1.1, driver can provide a 4.3 backwards compatible context. + // with backward compatibility to older OpenGL versions + // For example, if using OpenGL 1.1, driver can provide a 4.3 backwards compatible context // Check selection OpenGL version if (rlGetVersion() == RL_OPENGL_21) @@ -1468,9 +1468,9 @@ int InitPlatform(void) glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); } - // NOTE: GLFW 3.4+ defers initialization of the Joystick subsystem on the first call to any Joystick related functions. - // Forcing this initialization here avoids doing it on PollInputEvents() called by EndDrawing() after first frame has been just drawn. - // The initialization will still happen and possible delays still occur, but before the window is shown, which is a nicer experience. + // NOTE: GLFW 3.4+ defers initialization of the Joystick subsystem on the first call to any Joystick related functions + // Forcing this initialization here avoids doing it on PollInputEvents() called by EndDrawing() after first frame has been just drawn + // The initialization will still happen and possible delays still occur, but before the window is shown, which is a nicer experience // REF: https://github.com/raysan5/raylib/issues/1554 glfwSetJoystickCallback(NULL); @@ -1478,7 +1478,7 @@ int InitPlatform(void) if (CORE.Window.fullscreen) { // According to glfwCreateWindow(), if the user does not have a choice, fullscreen applications - // should default to the primary monitor. + // should default to the primary monitor monitor = glfwGetPrimaryMonitor(); if (!monitor) @@ -1492,8 +1492,8 @@ int InitPlatform(void) // Remember center for switching from fullscreen to window if ((CORE.Window.screen.height == CORE.Window.display.height) && (CORE.Window.screen.width == CORE.Window.display.width)) { - // If screen width/height equal to the display, we can't calculate the window pos for toggling full-screened/windowed. - // Toggling full-screened/windowed with pos(0, 0) can cause problems in some platforms, such as X11. + // If screen width/height equal to the display, we can't calculate the window pos for toggling full-screened/windowed + // Toggling full-screened/windowed with pos(0, 0) can cause problems in some platforms, such as X11 CORE.Window.position.x = CORE.Window.display.width/4; CORE.Window.position.y = CORE.Window.display.height/4; } @@ -1554,7 +1554,7 @@ int InitPlatform(void) // No-fullscreen window creation bool requestWindowedFullscreen = (CORE.Window.screen.height == 0) && (CORE.Window.screen.width == 0); - // Default to at least one pixel in size, as creation with a zero dimension is not allowed. + // Default to at least one pixel in size, as creation with a zero dimension is not allowed int creationWidth = CORE.Window.screen.width != 0 ? CORE.Window.screen.width : 1; int creationHeight = CORE.Window.screen.height != 0 ? CORE.Window.screen.height : 1; @@ -1566,8 +1566,8 @@ int InitPlatform(void) return -1; } - // After the window was created, determine the monitor that the window manager assigned. - // Derive display sizes, and, if possible, window size in case it was zero at beginning. + // After the window was created, determine the monitor that the window manager assigned + // Derive display sizes, and, if possible, window size in case it was zero at beginning int monitorCount = 0; int monitorIndex = GetCurrentMonitor(); @@ -1582,7 +1582,7 @@ int InitPlatform(void) } else { - // The monitor for the window-manager-created window can not be determined, so it can not be centered. + // The monitor for the window-manager-created window can not be determined, so it can not be centered glfwTerminate(); TRACELOG(LOG_WARNING, "GLFW: Failed to determine Monitor to center Window"); return -1; @@ -1604,7 +1604,7 @@ int InitPlatform(void) // Try to enable GPU V-Sync, so frames are limited to screen refresh rate (60Hz -> 60 FPS) // NOTE: V-Sync can be enabled by graphic driver configuration, it doesn't need - // to be activated on web platforms since VSync is enforced there. + // to be activated on web platforms since VSync is enforced there if (CORE.Window.flags & FLAG_VSYNC_HINT) { // WARNING: It seems to hit a critical render path in Intel HD Graphics @@ -1617,7 +1617,7 @@ int InitPlatform(void) if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0) { - // NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling. + // NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling // Framebuffer scaling should be activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE); #if !defined(__APPLE__) glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight); @@ -1660,7 +1660,8 @@ int InitPlatform(void) int monitorHeight = 0; glfwGetMonitorWorkarea(monitor, &monitorX, &monitorY, &monitorWidth, &monitorHeight); - // Here CORE.Window.render.width/height should be used instead of CORE.Window.screen.width/height to center the window correctly when the high dpi flag is enabled. + // Here CORE.Window.render.width/height should be used instead of + // CORE.Window.screen.width/height to center the window correctly when the high dpi flag is enabled int posX = monitorX + (monitorWidth - (int)CORE.Window.render.width)/2; int posY = monitorY + (monitorHeight - (int)CORE.Window.render.height)/2; if (posX < monitorX) posX = monitorX; diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c index bc7889140..5a62fa629 100644 --- a/src/platforms/rcore_desktop_sdl.c +++ b/src/platforms/rcore_desktop_sdl.c @@ -252,7 +252,7 @@ static const int CursorsLUT[] = { //SDL_SYSTEM_CURSOR_WAITARROW, // No equivalent implemented on MouseCursor enum on raylib.h }; -// SDL3 Migration Layer made to avoid 'ifdefs' inside functions when we can. +// SDL3 Migration Layer made to avoid 'ifdefs' inside functions when we can #if defined(PLATFORM_DESKTOP_SDL3) // SDL3 Migration: @@ -269,7 +269,7 @@ static const int CursorsLUT[] = { // SDL3 Migration: SDL_INIT_TIMER - no longer needed before calling SDL_AddTimer() #define SDL_INIT_TIMER 0x0 // It's a flag, so no problem in setting it to zero if we use in a bitor (|) -// SDL3 Migration: The SDL_WINDOW_SHOWN flag has been removed. Windows are shown by default and can be created hidden by using the SDL_WINDOW_HIDDEN flag. +// SDL3 Migration: The SDL_WINDOW_SHOWN flag has been removed. Windows are shown by default and can be created hidden by using the SDL_WINDOW_HIDDEN flag #define SDL_WINDOW_SHOWN 0x0 // It's a flag, so no problem in setting it to zero if we use in a bitor (|) // SDL3 Migration: Renamed @@ -344,7 +344,7 @@ SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth // SDL3 Migration: // SDL_GetDisplayDPI() - // not reliable across platforms, approximately replaced by multiplying -// SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms. +// SDL_GetWindowDisplayScale() times 160 on iPhone and Android, and 96 on other platforms // returns 0 on success or a negative error code on failure int SDL_GetDisplayDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi) { @@ -382,7 +382,7 @@ int SDL_NumJoysticks(void) // SDL_SetRelativeMouseMode // returns 0 on success or a negative error code on failure -// If relative mode is not supported, this returns -1. +// If relative mode is not supported, this returns -1 int SDL_SetRelativeMouseMode_Adapter(SDL_bool enabled) { // SDL_SetWindowRelativeMouseMode(SDL_Window *window, bool enabled) @@ -841,7 +841,7 @@ void SetWindowMonitor(int monitor) // NOTE: // 1. SDL started supporting moving exclusive fullscreen windows between displays on SDL3, // see commit https://github.com/libsdl-org/SDL/commit/3f5ef7dd422057edbcf3e736107e34be4b75d9ba - // 2. A workaround for SDL2 is leaving fullscreen, moving the window, then entering full screen again. + // 2. A workaround for SDL2 is leaving fullscreen, moving the window, then entering full screen again const bool wasFullscreen = ((CORE.Window.flags & FLAG_FULLSCREEN_MODE) > 0)? true : false; const int screenWidth = CORE.Window.screen.width; @@ -854,7 +854,7 @@ void SetWindowMonitor(int monitor) if (SDL_GetDisplayUsableBounds(monitor, &usableBounds) == 0) #endif { - if (wasFullscreen == 1) ToggleFullscreen(); // Leave fullscreen. + if (wasFullscreen == 1) ToggleFullscreen(); // Leave fullscreen // If the screen size is larger than the monitor usable area, anchor it on the top left corner, otherwise, center it if ((screenWidth >= usableBounds.w) || (screenHeight >= usableBounds.h)) @@ -862,11 +862,11 @@ void SetWindowMonitor(int monitor) // NOTE: // 1. There's a known issue where if the window larger than the target display bounds, // when moving the windows to that display, the window could be clipped back - // ending up positioned partly outside the target display. + // ending up positioned partly outside the target display // 2. The workaround for that is, previously to moving the window, - // setting the window size to the target display size, so they match. + // setting the window size to the target display size, so they match // 3. It wasn't done here because we can't assume changing the window size automatically - // is acceptable behavior by the user. + // is acceptable behavior by the user SDL_SetWindowPosition(platform.window, usableBounds.x, usableBounds.y); CORE.Window.position.x = usableBounds.x; CORE.Window.position.y = usableBounds.y; @@ -1099,7 +1099,7 @@ Vector2 GetWindowScaleDPI(void) #ifndef PLATFORM_DESKTOP_SDL3 // NOTE: SDL_GetWindowDisplayScale was only added on SDL3 // see https://wiki.libsdl.org/SDL3/SDL_GetWindowDisplayScale - // TODO: Implement the window scale factor calculation manually. + // TODO: Implement the window scale factor calculation manually TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform"); #else scale.x = SDL_GetWindowDisplayScale(platform.window); @@ -1245,9 +1245,9 @@ double GetTime(void) } // Open URL with default system browser (if available) -// NOTE: This function is only safe to use if you control the URL given. -// A user could craft a malicious string performing another action. -// Only call this function yourself not with user input or make sure to check the string yourself. +// NOTE: This function is only safe to use if you control the URL given +// A user could craft a malicious string performing another action +// Only call this function yourself not with user input or make sure to check the string yourself // Ref: https://github.com/raysan5/raylib/issues/686 void OpenURL(const char *url) { @@ -1299,7 +1299,7 @@ void SetMouseCursor(int cursor) CORE.Input.Mouse.cursor = cursor; } -// Get physical key name. +// Get physical key name const char *GetKeyName(int key) { return SDL_GetKeyName(key); @@ -1466,10 +1466,9 @@ void PollInputEvents(void) #ifndef PLATFORM_DESKTOP_SDL3 // SDL3 states: - // The SDL_WINDOWEVENT_* events have been moved to top level events, - // and SDL_WINDOWEVENT has been removed. - // In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT - // and then checking for window events. You can compare the event >= SDL_EVENT_WINDOW_FIRST and <= SDL_EVENT_WINDOW_LAST if you need to see whether it's a window event. + // The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed + // In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT + // and then checking for window events. You can compare the event >= SDL_EVENT_WINDOW_FIRST and <= SDL_EVENT_WINDOW_LAST if you need to see whether it's a window event. case SDL_WINDOWEVENT: { switch (event.window.event) diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index a3051f485..79769eee7 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -18,9 +18,9 @@ * * CONFIGURATION: * #define SUPPORT_SSH_KEYBOARD_RPI (Raspberry Pi only) -* Reconfigure standard input to receive key inputs, works with SSH connection. +* Reconfigure standard input to receive key inputs, works with SSH connection * WARNING: Reconfiguring standard input could lead to undesired effects, like breaking other -* running processes orblocking the device if not restored properly. Use with care. +* running processes orblocking the device if not restored properly. Use with care * * DEPENDENCIES: * - DRM and GLM: System libraries for display initialization and configuration @@ -744,11 +744,11 @@ void SwapScreenBuffer() } // Attempt page flip - // NOTE: rmModePageFlip() schedules a buffer-flip for the next vblank and then notifies us about it. - // It takes a CRTC-id, fb-id and an arbitrary data-pointer and then schedules the page-flip. - // This is fully asynchronous and when the page-flip happens, the DRM-fd will become readable and we can call drmHandleEvent(). - // This will read all vblank/page-flip events and call our modeset_page_flip_event() callback with the data-pointer that we passed to drmModePageFlip(). - // We simply call modeset_draw_dev() then so the next frame is rendered... returns immediately. + // NOTE: rmModePageFlip() schedules a buffer-flip for the next vblank and then notifies us about it + // It takes a CRTC-id, fb-id and an arbitrary data-pointer and then schedules the page-flip + // This is fully asynchronous and when the page-flip happens, the DRM-fd will become readable and we can call drmHandleEvent() + // This will read all vblank/page-flip events and call our modeset_page_flip_event() callback with the data-pointer that we passed to drmModePageFlip() + // We simply call modeset_draw_dev() then so the next frame is rendered... returns immediately if (drmModePageFlip(platform.fd, platform.crtc->crtc_id, fbId, DRM_MODE_PAGE_FLIP_EVENT, platform.prevBO)) { if (errno == EBUSY) errCnt[3]++; // Display busy - skip flip @@ -824,9 +824,9 @@ double GetTime(void) } // Open URL with default system browser (if available) -// NOTE: This function is only safe to use if you control the URL given. -// A user could craft a malicious string performing another action. -// Only call this function yourself not with user input or make sure to check the string yourself. +// NOTE: This function is only safe to use if you control the URL given +// A user could craft a malicious string performing another action +// Only call this function yourself not with user input or make sure to check the string yourself // Ref: https://github.com/raysan5/raylib/issues/686 void OpenURL(const char *url) { @@ -863,7 +863,7 @@ void SetMouseCursor(int cursor) TRACELOG(LOG_WARNING, "SetMouseCursor() not implemented on target platform"); } -// Get physical key name. +// Get physical key name const char *GetKeyName(int key) { TRACELOG(LOG_WARNING, "GetKeyName() not implemented on target platform"); @@ -897,7 +897,7 @@ void PollInputEvents(void) PollKeyboardEvents(); #if defined(SUPPORT_SSH_KEYBOARD_RPI) - // NOTE: Keyboard reading could be done using input_event(s) or just read from stdin, both methods are used here. + // NOTE: Keyboard reading could be done using input_event(s) or just read from stdin, both methods are used here // stdin reading is still used for legacy purposes, it allows keyboard input trough SSH console if (!platform.eventKeyboardMode) ProcessKeyboard(); #endif @@ -1003,8 +1003,8 @@ int InitPlatform(void) drmModeConnector *con = drmModeGetConnector(platform.fd, res->connectors[i]); TRACELOG(LOG_TRACE, "DISPLAY: Connector modes detected: %i", con->count_modes); - // In certain cases the status of the conneciton is reported as UKNOWN, but it is still connected. - // This might be a hardware or software limitation like on Raspberry Pi Zero with composite output. + // In certain cases the status of the conneciton is reported as UKNOWN, but it is still connected + // This might be a hardware or software limitation like on Raspberry Pi Zero with composite output if (((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION)) && (con->encoder_id)) { TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected"); @@ -1160,7 +1160,7 @@ int InitPlatform(void) // Initialize the EGL device connection if (eglInitialize(platform.device, NULL, NULL) == EGL_FALSE) { - // If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred. + // If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred TRACELOG(LOG_WARNING, "DISPLAY: Failed to initialize EGL device"); return -1; } @@ -1644,7 +1644,7 @@ static void ConfigureEvdevDevice(char *device) return; } - // At this point we have a connection to the device, but we don't yet know what the device is. + // At this point we have a connection to the device, but we don't yet know what the device is // It could be many things, even as simple as a power button... //------------------------------------------------------------------------------------------------------- diff --git a/src/raudio.c b/src/raudio.c index 93024722f..76fee2333 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -15,8 +15,8 @@ * raudio module is included in the build * * #define RAUDIO_STANDALONE -* Define to use the module as standalone library (independently of raylib). -* Required types and functions are defined in the same module. +* Define to use the module as standalone library (independently of raylib) +* Required types and functions are defined in the same module * * #define SUPPORT_FILEFORMAT_WAV * #define SUPPORT_FILEFORMAT_OGG @@ -89,7 +89,7 @@ // by user at some point and won't be included... //------------------------------------------------------------------------------------- -// If defined, the following flags inhibit definition of the indicated items. +// If defined, the following flags inhibit definition of the indicated items #define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_ #define NOVIRTUALKEYCODES // VK_* #define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_* @@ -124,9 +124,9 @@ #define NOWH // SetWindowsHook and WH_* #define NOWINOFFSETS // GWL_*, GCL_*, associated routines #define NOCOMM // COMM driver routines -#define NOKANJI // Kanji support stuff. -#define NOHELP // Help engine interface. -#define NOPROFILER // Profiler interface. +#define NOKANJI // Kanji support stuff +#define NOHELP // Help engine interface +#define NOPROFILER // Profiler interface #define NODEFERWINDOWPOS // DeferWindowPos routines #define NOMCX // Modem Configuration Extensions @@ -1118,7 +1118,7 @@ bool ExportWaveAsCode(Wave wave, const char *fileName) // NOTE: Text data buffer size is estimated considering wave data size in bytes // and requiring 12 char bytes for every byte; the actual size varies, but - // the longest possible char being appended is "%.4ff,\n ", which is 12 bytes. + // the longest possible char being appended is "%.4ff,\n ", which is 12 bytes char *txtData = (char *)RL_CALLOC(waveDataSize*12 + 2000, sizeof(char)); int byteCount = 0; diff --git a/src/raylib.h b/src/raylib.h index 4517cbcac..0851905c1 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -5,7 +5,7 @@ * FEATURES: * - NO external dependencies, all required libraries included with raylib * - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly, -* MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5. +* MacOS, Haiku, Android, Raspberry Pi, DRM native, HTML5 * - Written in plain C code (C99) in PascalCase/camelCase notation * - Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3, ES2, ES3 - choose at compile) * - Unique OpenGL abstraction layer (usable as standalone module): [rlgl] diff --git a/src/raymath.h b/src/raymath.h index a531b3a14..f246f26d9 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -329,7 +329,7 @@ RMAPI float Vector2DistanceSqr(Vector2 v1, Vector2 v2) } // Calculate the signed angle from v1 to v2, relative to the origin (0, 0) -// NOTE: Coordinate system convention: positive X right, positive Y down, +// NOTE: Coordinate system convention: positive X right, positive Y down // positive angles appear clockwise, and negative angles appear counterclockwise RMAPI float Vector2Angle(Vector2 v1, Vector2 v2) { diff --git a/src/rmodels.c b/src/rmodels.c index 1a181c843..c1a32058a 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -12,7 +12,7 @@ * #define SUPPORT_FILEFORMAT_GLTF * #define SUPPORT_FILEFORMAT_VOX * #define SUPPORT_FILEFORMAT_M3D -* Selected desired fileformats to be supported for model data loading. +* Selected desired fileformats to be supported for model data loading * * #define SUPPORT_MESH_GENERATION * Support procedural mesh generation functions, uses external par_shapes.h library @@ -2298,7 +2298,7 @@ void UpdateModelAnimationBones(Model model, ModelAnimation anim, int frame) if (firstMeshWithBones != -1) { - // Update all bones and boneMatrices of first mesh with bones. + // Update all bones and boneMatrices of first mesh with bones for (int boneId = 0; boneId < anim.boneCount; boneId++) { Transform *bindTransform = &model.bindPose[boneId]; @@ -5291,8 +5291,7 @@ static Model LoadGLTF(const char *fileName) > Texcoords: vec2: float > Colors: vec4: u8, u16, f32 (normalized) > Indices: u16, u32 (truncated to u16) - - Scenes defined in the glTF file are ignored. All nodes in the file - are used. + - Scenes defined in the glTF file are ignored. All nodes in the file are used ***********************************************************************************************/ @@ -5347,8 +5346,8 @@ static Model LoadGLTF(const char *fileName) int primitivesCount = 0; - // NOTE: We will load every primitive in the glTF as a separate raylib Mesh. - // Determine total number of meshes needed from the node hierarchy. + // NOTE: We will load every primitive in the glTF as a separate raylib Mesh + // Determine total number of meshes needed from the node hierarchy for (unsigned int i = 0; i < data->nodes_count; i++) { cgltf_node *node = &(data->nodes[i]); @@ -5490,14 +5489,13 @@ static Model LoadGLTF(const char *fileName) // has_clearcoat, has_transmission, has_volume, has_ior, has specular, has_sheen } - // Visit each node in the hierarchy and process any mesh linked from it. - // Each primitive within a glTF node becomes a Raylib Mesh. + // Visit each node in the hierarchy and process any mesh linked from it + // Each primitive within a glTF node becomes a Raylib Mesh // The local-to-world transform of each node is used to transform the - // points/normals/tangents of the created Mesh(es). + // points/normals/tangents of the created Mesh(es) // Any glTF mesh linked from more than one Node (i.e. instancing) - // is turned into multiple Mesh's, as each Node will have its own - // transform applied. - // NOTE: The code below disregards the scenes defined in the file, all nodes are used. + // is turned into multiple Mesh's, as each Node will have its own transform applied + // NOTE: The code below disregards the scenes defined in the file, all nodes are used //---------------------------------------------------------------------------------------------------- int meshIndex = 0; for (unsigned int i = 0; i < data->nodes_count; i++) diff --git a/src/rshapes.c b/src/rshapes.c index be28e6cad..38ad75c7d 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -3,17 +3,17 @@ * rshapes - Basic functions to draw 2d shapes and check collisions * * ADDITIONAL NOTES: -* Shapes can be draw using 3 types of primitives: LINES, TRIANGLES and QUADS. +* Shapes can be draw using 3 types of primitives: LINES, TRIANGLES and QUADS * Some functions implement two drawing options: TRIANGLES and QUADS, by default TRIANGLES * are used but QUADS implementation can be selected with SUPPORT_QUADS_DRAW_MODE define * * Some functions define texture coordinates (rlTexCoord2f()) for the shapes and use a * user-provided texture with SetShapesTexture(), the pourpouse of this implementation -* is allowing to reduce draw calls when combined with a texture-atlas. +* is allowing to reduce draw calls when combined with a texture-atlas * * By default, raylib sets the default texture and rectangle at InitWindow()[rcore] to one * white character of default font [rtext], this way, raylib text and shapes can be draw with -* a single draw call and it also allows users to configure it the same way with their own fonts. +* a single draw call and it also allows users to configure it the same way with their own fonts * * CONFIGURATION: * #define SUPPORT_MODULE_RSHAPES diff --git a/src/rtext.c b/src/rtext.c index 1330c5906..50ea6c883 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -7,8 +7,8 @@ * rtext module is included in the build * * #define SUPPORT_DEFAULT_FONT -* Load default raylib font on initialization to be used by DrawText() and MeasureText(). -* If no default font loaded, DrawTextEx() and MeasureTextEx() are required. +* Load default raylib font on initialization to be used by DrawText() and MeasureText() +* If no default font loaded, DrawTextEx() and MeasureTextEx() are required * * #define SUPPORT_FILEFORMAT_FNT * #define SUPPORT_FILEFORMAT_TTF @@ -19,7 +19,7 @@ * #define SUPPORT_FONT_ATLAS_WHITE_REC * On font atlas image generation [GenImageFontAtlas()], add a 3x3 pixels white rectangle * at the bottom-right corner of the atlas. It can be useful to for shapes drawing, to allow -* drawing text and shapes with a single draw call [SetShapesTexture()]. +* drawing text and shapes with a single draw call [SetShapesTexture()] * * #define TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH * TextSplit() function static buffer max size diff --git a/src/rtextures.c b/src/rtextures.c index b798caed6..81d615c38 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -36,7 +36,7 @@ * * DEPENDENCIES: * stb_image - Multiple image formats loading (JPEG, PNG, BMP, TGA, PSD, GIF, PIC) -* NOTE: stb_image has been slightly modified to support Android platform. +* NOTE: stb_image has been slightly modified to support Android platform * stb_image_resize - Multiple image resize algorithms * * diff --git a/tools/rexm/examples_report.md b/tools/rexm/examples_report.md index 97bc7c52a..6fa79bd50 100644 --- a/tools/rexm/examples_report.md +++ b/tools/rexm/examples_report.md @@ -44,7 +44,7 @@ Example elements validated: | core_drop_files | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | core_random_values | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | core_storage_values | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| core_vr_simulator | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| core_vr_simulator | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | core_loading_thread | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | core_scissor_test | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | core_basic_screen_manager | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | @@ -73,8 +73,8 @@ Example elements validated: | shapes_top_down_lights | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shapes_rectangle_advanced | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shapes_splines_drawing | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| shapes_digital_clock | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ❌ | -| shapes_double_pendulum | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ❌ | +| shapes_digital_clock | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | +| shapes_double_pendulum | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | | textures_logo_raylib | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | textures_srcrec_dstrec | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | textures_image_drawing | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | @@ -97,9 +97,9 @@ Example elements validated: | textures_polygon | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | textures_fog_of_war | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | textures_gif_player | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| textures_image_kernel | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | -| textures_image_channel | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | -| textures_image_rotate | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | +| textures_image_kernel | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| textures_image_channel | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| textures_image_rotate | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | textures_textured_curve | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_raylib_fonts | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | text_font_spritefont | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | @@ -126,16 +126,16 @@ Example elements validated: | models_loading_vox | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_loading_m3d | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_orthographic_projection | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| models_point_rendering | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | +| models_point_rendering | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_rlgl_solar_system | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_yaw_pitch_roll | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_waving_cubes | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_heightmap | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| models_skybox | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| models_skybox | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_draw_cube_texture | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| models_gpu_skinning | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| models_gpu_skinning | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | models_bone_socket | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| models_tesseract_view | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | +| models_tesseract_view | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_basic_lighting | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_model_shader | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_shapes_textures | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | @@ -153,6 +153,7 @@ Example elements validated: | shaders_hot_reloading | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_mesh_instancing | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_multi_sample2d | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| shaders_normalmap | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ❌ | ❌ | ❌ | ❌ | | shaders_spotlight | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_deferred_render | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_hybrid_render | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | @@ -160,10 +161,10 @@ Example elements validated: | shaders_shadowmap | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_vertex_displacement | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_write_depth | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| shaders_basic_pbr | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | -| shaders_lightmap | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | +| shaders_basic_pbr | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| shaders_lightmap | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | shaders_rounded_rectangle | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | -| shaders_view_depth | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | +| shaders_view_depth | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | | audio_module_playing | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | audio_music_stream | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | audio_raw_stream | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | @@ -171,7 +172,7 @@ Example elements validated: | audio_mixed_processor | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | audio_stream_effects | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | audio_sound_multi | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | -| audio_sound_positioning | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ❌ | +| audio_sound_positioning | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ❌ | | rlgl_standalone | ✔ | ❌ | ❌ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ❌ | ❌ | | rlgl_compute_shader | ✔ | ❌ | ❌ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ❌ | ❌ | | easings_testbed | ✔ | ❌ | ❌ | ✔ | ✔ | ✔ | ✔ | ❌ | ✔ | ✔ | ✔ | ❌ | ❌ | diff --git a/tools/rexm/rexm.c b/tools/rexm/rexm.c index a7facdaf9..7cdd6175e 100644 --- a/tools/rexm/rexm.c +++ b/tools/rexm/rexm.c @@ -165,6 +165,9 @@ static char **ScanExampleResources(const char *filePath, int *resPathCount); // Clear resource paths scanned static void ClearExampleResources(char **resPaths); +// Add VS project (.vcxproj) to existing VS solution (.sol) +static int AddVSProjectToSolution(const char *projFile, const char *solFile); + //------------------------------------------------------------------------------------ // Program main entry point //------------------------------------------------------------------------------------ @@ -275,6 +278,7 @@ int main(int argc, char *argv[]) else if (strcmp(argv[1], "rename") == 0) { if (argc == 2) LOG("WARNING: No filename provided to be renamed\n"); + else if (argc == 3) LOG("WARNING: No new filename provided to be renamed\n"); else if (argc > 4) LOG("WARNING: Too many arguments provided\n"); else { @@ -282,11 +286,29 @@ int main(int argc, char *argv[]) char *exColInfo = LoadFileText(exCollectionFilePath); if (TextFindIndex(exColInfo, argv[2]) != -1) // Example in the collection { - strcpy(exName, argv[2]); // Register example name - strncpy(exCategory, exName, TextFindIndex(exName, "_")); - strcpy(exRename, argv[3]); - strncpy(exRecategory, exRename, TextFindIndex(exRename, "_")); - opCode = OP_RENAME; + // Security checks for new file name to verify category is included + int newCatIndex = TextFindIndex(argv[3], "_"); + if (newCatIndex > 3) + { + char cat[12] = { 0 }; + strncpy(cat, argv[3], newCatIndex); + bool newCatFound = false; + for (int i = 0; i < REXM_MAX_EXAMPLE_CATEGORIES; i++) + { + if (TextIsEqual(cat, exCategories[i])) { newCatFound = true; break; } + } + + if (newCatFound) + { + strcpy(exName, argv[2]); // Register example name + strncpy(exCategory, exName, TextFindIndex(exName, "_")); + strcpy(exRename, argv[3]); + strncpy(exRecategory, exRename, TextFindIndex(exRename, "_")); + opCode = OP_RENAME; + } + else LOG("WARNING: Example new category is not valid\n"); + } + else LOG("WARNING: Example new name does not include category\n"); } else LOG("WARNING: RENAME: Example not available in the collection\n"); UnloadFileText(exColInfo); @@ -487,6 +509,7 @@ int main(int argc, char *argv[]) // Create: raylib/projects/VS2022/examples/_example_name.vcxproj //------------------------------------------------------------------------------------------------ + // WARNING: When adding new project a unique UUID should be assigned! FileCopy(TextFormat("%s/../projects/VS2022/examples/core_basic_window.vcxproj", exBasePath), TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName)); FileTextReplace(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName), @@ -495,7 +518,8 @@ int main(int argc, char *argv[]) "..\\..\\examples\\core", TextFormat("..\\..\\examples\\%s", exCategory)); // Edit: raylib/projects/VS2022/raylib.sln --> Add new example project - system(TextFormat("dotnet solution %s/../projects/VS2022/raylib.sln add %s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exBasePath, exName)); + AddVSProjectToSolution(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName), + TextFormat("%s/../projects/VS2022/raylib.sln", exBasePath)); //------------------------------------------------------------------------------------------------ // Recompile example (on raylib side) @@ -680,10 +704,10 @@ int main(int argc, char *argv[]) // Remove: raylib/projects/VS2022/examples/_example_name.vcxproj remove(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName)); - // Edit: raylib/projects/VS2022/raylib.sln --> Remove example project + // TODO: Edit: raylib/projects/VS2022/raylib.sln --> Remove example project //--------------------------------------------------------------------------- - system(TextFormat("dotnet solution %s/../projects/VS2022/raylib.sln remove %s/../projects/VS2022/examples/%s.vcxproj", - exBasePath, exBasePath, exName)); + //RemoveVSProjectFromSolution(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName), + // TextFormat("%s/../projects/VS2022/raylib.sln", exBasePath)); //--------------------------------------------------------------------------- // Remove: raylib.com/examples//_example_name.html @@ -932,16 +956,23 @@ int main(int argc, char *argv[]) "..\\..\\examples\\core", TextFormat("..\\..\\examples\\%s", exInfo->category)); } + // WARNING: Adding a .vcxproj to .sln can not be automated with + // "dotnet" tool (C# projects only) + // "devenv" tool (no adding support, only building) + // It must be done manually editing the .sln file if (exInfo->status & VALID_NOT_IN_VCXSOL) - system(TextFormat("dotnet solution %s/../projects/VS2022/raylib.sln add %s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exBasePath, exInfo->name)); - + { + AddVSProjectToSolution(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exName), + TextFormat("%s/../projects/VS2022/raylib.sln", exBasePath)); + } + // Review: Add/Remove: raylib.com/examples//_example_name.html // Review: Add/Remove: raylib.com/examples//_example_name.data // Review: Add/Remove: raylib.com/examples//_example_name.wasm // Review: Add/Remove: raylib.com/examples//_example_name.js // Solves: VALID_MISSING_WEB_OUTPUT - if (exInfo->status & VALID_MISSING_WEB_OUTPUT) - system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exInfo->category, exInfo->name)); + //if (exInfo->status & VALID_MISSING_WEB_OUTPUT) + // system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exInfo->category, exInfo->name)); } } @@ -1727,3 +1758,57 @@ static void ClearExampleResources(char **resPaths) RL_FREE(resPaths); } + +// TODO: Add VS project (.vcxproj) to existing VS solution (.sol) +static int AddVSProjectToSolution(const char *projFile, const char *solFile) +{ + int result = 0; + + // Generate unique UUID: + // C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\uuidgen.exe > saved_uuid.txt + + // Add project to the list: + // Format: Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "", "examples\.vcxproj", "{}" + /* + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core_basic_window", "examples\core_basic_window.vcxproj", "{0981CA98-E4A5-4DF1-987F-A41D09131EFC}" + EndProject + */ + + // Update project config: + /* + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|ARM64.ActiveCfg = Debug.DLL|ARM64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|ARM64.Build.0 = Debug.DLL|ARM64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|x64.ActiveCfg = Debug.DLL|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|x64.Build.0 = Debug.DLL|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|x86.ActiveCfg = Debug.DLL|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug.DLL|x86.Build.0 = Debug.DLL|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|ARM64.Build.0 = Debug|ARM64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|x64.ActiveCfg = Debug|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|x64.Build.0 = Debug|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|x86.ActiveCfg = Debug|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Debug|x86.Build.0 = Debug|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|ARM64.ActiveCfg = Release.DLL|ARM64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|ARM64.Build.0 = Release.DLL|ARM64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|x64.ActiveCfg = Release.DLL|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|x64.Build.0 = Release.DLL|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|x86.ActiveCfg = Release.DLL|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release.DLL|x86.Build.0 = Release.DLL|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|ARM64.ActiveCfg = Release|ARM64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|ARM64.Build.0 = Release|ARM64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x64.ActiveCfg = Release|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x64.Build.0 = Release|x64 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x86.ActiveCfg = Release|Win32 + {D3493FFE-8873-4C53-8F6C-74DEF78EA3C4}.Release|x86.Build.0 = Release|Win32 + */ + + // Update projects to folders: + // {project_uuid} = {solution_folder_uuid} + /* + GlobalSection(NestedProjects) = preSolution + {0981CA98-E4A5-4DF1-987F-A41D09131EFC} = {6C82BAAE-BDDF-457D-8FA8-7E2490B07035} + */ + + return result; +}