From f9c8e31ed7e69ac1ba320f9b6c2e0634643d0ed0 Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 14 Oct 2021 12:30:46 +0200 Subject: [PATCH 1/5] Update SPONSORS.md --- SPONSORS.md | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/SPONSORS.md b/SPONSORS.md index c308a513c8e4..db05789c7ece 100644 --- a/SPONSORS.md +++ b/SPONSORS.md @@ -4,18 +4,11 @@ The following people is currently [**sponsoring raylib**](https://github.com/sponsors/raysan5) with a generous donation to allow improving and growing the project! -Note that Sponsors donations vary between sponsors, I just decided not to make any distinction while listing them. - - Eric J. ([@ProfJski](https://github.com/ProfJski)) - - devdad ([@devdad](https://github.com/devdad)) - Zach Geis ([@zacgeis](https://github.com/zacgeis)) - minirop ([@minirop](https://github.com/minirop)) - Daniel Gómez ([@Koocachookies](https://github.com/Koocachookies)) - - Sergio ([@anidealgift](https://github.com/anidealgift)) - Marc Agüera ([@maguera93](https://github.com/maguera93)) - - Pau Fernández ([@pauek](https://github.com/pauek)) - - Snowminx ([@Gamerfiend](https://github.com/Gamerfiend)) - - NimbusFox ([@NimbusFox](https://github.com/NimbusFox)) - Robin Mattheussen ([@romatthe](https://github.com/romatthe)) - Grant Haywood ([@cinterloper](https://github.com/cinterloper)) - Terry Nguyen ([@terrehbyte](https://github.com/terrehbyte)) @@ -25,10 +18,17 @@ Note that Sponsors donations vary between sponsors, I just decided not to make a - cob ([@majorcob](https://github.com/majorcob)) - Samuel Batista ([@gamedevsam](https://github.com/gamedevsam)) - Merlyn Morgan-Graham ([@kavika13](https://github.com/kavika13)) - - Toby4213 ([@Toby4213](https://github.com/Toby4213)) - linus ([@hochbaum](https://github.com/hochbaum)) - Nawarian ([@nawarian](https://github.com/nawarian) - [thephp.website](https://thephp.website/)) - + - kenzie ([@sme-ek](https://github.com/sme-ek)) + - Allan Regush ([@AllanRegush](https://github.com/AllanRegush)) + - Jeffery Myers ([@JeffM2501](https://github.com/ProfJski)) + - Ryan Roden-Corrent ([@rcorre](https://github.com/ProfJski)) + - michaelfiber ([@michaelfiber](https://github.com/ProfJski)) + - Nikhilesh S ([@nikki93](https://github.com/ProfJski)) + - kevinabraun ([@kevinabraun](https://github.com/ProfJski)) + - Matthew Owens ([@MatthewOwens](https://github.com/ProfJski)) + - Tim Eilers ([@eilerstim](https://github.com/ProfJski)) ### Past raylib GitHub Sponsors @@ -49,6 +49,16 @@ The following people has **sponsored raylib** in the past, allowing the project - James Ghawaly ([@jghawaly](https://github.com/jghawaly)) - jack ([@Jack-Ji](https://github.com/Jack-Ji)) - Guido Offermans ([@jghawaly](https://github.com/GuidoOffermans)) + - devdad ([@devdad](https://github.com/devdad)) + - Pau Fernández ([@pauek](https://github.com/pauek)) + - Sergio ([@anidealgift](https://github.com/anidealgift)) + - Snowminx ([@Gamerfiend](https://github.com/Gamerfiend)) + - NimbusFox ([@NimbusFox](https://github.com/NimbusFox)) + - Shylie ([@Shylie](https://github.com/Shylie)) + - Livio Dal Maso ([@Humeur](https://github.com/Humeur)) + - Diego Vaccher ([@denny0754](https://github.com/denny0754)) + - Ricardo Alcantara ([@ricardoalcantara](https://github.com/ricardoalcantara)) + - Toby4213 ([@Toby4213](https://github.com/Toby4213)) ### Notes for Current/Past raylib Sponsor From 52c1a4e7d003f0be64b2e2eec27307f03b0f0727 Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 14 Oct 2021 12:45:41 +0200 Subject: [PATCH 2/5] Update SPONSORS.md --- SPONSORS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SPONSORS.md b/SPONSORS.md index db05789c7ece..d128414ecb2b 100644 --- a/SPONSORS.md +++ b/SPONSORS.md @@ -62,7 +62,7 @@ The following people has **sponsored raylib** in the past, allowing the project ### Notes for Current/Past raylib Sponsor - - **If you are not on the list, feel free to send a PR to add you if desired.** - - **If you want your personal webpage listed along your GitHub account, feel free to send a PR to add it.** - - **If you prefer not to listed in this list, feel free to send a PR to remove it.** + - If you are not on the list, feel free to send a PR to be added (if desired). + - If you want your personal webpage or project listed, feel free to send a PR to be added. + - If you prefer not to be in this list, feel free to send a PR to be remove. From 588131c9d526d6bf63ced0c9a95a660801a3d711 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Thu, 14 Oct 2021 07:24:00 -0400 Subject: [PATCH 3/5] Add zig buildfile for examples. (#2051) * Add zig buildfile for examples. - `zig build` to compile all examples - `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`) You can use `-Dtarget=` to compile for a non-native platform, such as `zig build -Dtarget=x86_64-windows-gnu` to compile from Linux to Windows. * Skip pthread example on Windows. * Select appropriate lib file based on target. --- examples/README.md | 18 ++++++++++ examples/build.zig | 86 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 examples/build.zig diff --git a/examples/README.md b/examples/README.md index ddf69fe5cf15..14d566b23c6d 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,3 +1,21 @@ +## Building the Examples + +The examples assume you have already built the `raylib` library in `../src`. + +### With GNU make + +- `make` builds all examples +- `make [module]` builds all examples for a particular module (e.g `make core`) + +### With Zig + +The [Zig](https://ziglang.org/) toolchain can compile `C` and `C++` in addition to `Zig`. +You may find it easier to use than other toolchains, especially when it comes to cross-compiling. + +- `zig build` to compile all examples +- `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 LIST ### category: core diff --git a/examples/build.zig b/examples/build.zig new file mode 100644 index 000000000000..c05808bf7bd8 --- /dev/null +++ b/examples/build.zig @@ -0,0 +1,86 @@ +const std = @import("std"); +const builtin = @import("builtin"); + +fn add_module(comptime module: []const u8, b: *std.build.Builder, target: std.zig.CrossTarget) !*std.build.Step { + // Standard release options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. + const mode = b.standardReleaseOptions(); + + const all = b.step(module, "All " ++ module ++ " examples"); + const dir = try std.fs.cwd().openDir( + module, + .{ .iterate = true }, + ); + var iter = dir.iterate(); + while (try iter.next()) |entry| { + if (entry.kind != .File) continue; + const extension_idx = std.mem.lastIndexOf(u8, entry.name, ".c") orelse continue; + const name = entry.name[0..extension_idx]; + const path = try std.fs.path.join(b.allocator, &.{ module, entry.name }); + + // zig's mingw headers do not include pthread.h + if (std.mem.eql(u8, "core_loading_thread", name) and target.getOsTag() == .windows) continue; + + const exe = b.addExecutable(name, path); + exe.setTarget(target); + exe.setBuildMode(mode); + exe.linkLibC(); + exe.addObjectFile(switch (target.getOsTag()) { + .windows => "../src/raylib.lib", + .linux => "../src/libraylib.a", + else => @panic("Unsupported OS"), + }); + + exe.addIncludeDir("../src"); + exe.addIncludeDir("../src/external"); + exe.addIncludeDir("../src/external/glfw/include"); + + switch (exe.target.toTarget().os.tag) { + .windows => { + exe.linkSystemLibrary("winmm"); + exe.linkSystemLibrary("gdi32"); + exe.linkSystemLibrary("opengl32"); + exe.addIncludeDir("external/glfw/deps/mingw"); + }, + .linux => { + exe.linkSystemLibrary("GL"); + exe.linkSystemLibrary("rt"); + exe.linkSystemLibrary("dl"); + exe.linkSystemLibrary("m"); + exe.linkSystemLibrary("X11"); + }, + else => { + @panic("Unsupported OS"); + }, + } + + exe.setOutputDir(module); + + var run = exe.run(); + run.step.dependOn(&b.addInstallArtifact(exe).step); + run.cwd = module; + b.step(name, name).dependOn(&run.step); + all.dependOn(&exe.step); + } + return all; +} + +pub fn build(b: *std.build.Builder) !void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + const all = b.getInstallStep(); + + all.dependOn(try add_module("audio", b, target)); + all.dependOn(try add_module("core", b, target)); + all.dependOn(try add_module("models", b, target)); + all.dependOn(try add_module("others", b, target)); + all.dependOn(try add_module("physics", b, target)); + all.dependOn(try add_module("shaders", b, target)); + all.dependOn(try add_module("shapes", b, target)); + all.dependOn(try add_module("text", b, target)); + all.dependOn(try add_module("textures", b, target)); +} From ef858b0dbb1fd2bca84caf2eb8952829107a39de Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 14 Oct 2021 13:37:22 +0200 Subject: [PATCH 4/5] Review examples --- examples/models/models_loading_gltf.c | 8 +- examples/models/models_loading_vox.c | 115 ++++++++++-------------- examples/models/models_yaw_pitch_roll.c | 1 - 3 files changed, 52 insertions(+), 72 deletions(-) diff --git a/examples/models/models_loading_gltf.c b/examples/models/models_loading_gltf.c index 5ef5fc5aa9e6..ac72b9d15d6c 100644 --- a/examples/models/models_loading_gltf.c +++ b/examples/models/models_loading_gltf.c @@ -40,8 +40,8 @@ int main(void) camera.fovy = 45.0f; // Camera field-of-view Y camera.projection = CAMERA_PERSPECTIVE; // Camera mode type + // Load some models Model model[MAX_MODELS] = { 0 }; - model[0] = LoadModel("resources/models/gltf/raylib_32x32.glb"); model[1] = LoadModel("resources/models/gltf/rigged_figure.glb"); model[2] = LoadModel("resources/models/gltf/GearboxAssy.glb"); @@ -65,7 +65,7 @@ int main(void) { // Update //---------------------------------------------------------------------------------- - UpdateCamera(&camera); + UpdateCamera(&camera); // Update our camera with inputs if (IsKeyReleased(KEY_RIGHT)) { @@ -78,6 +78,7 @@ int main(void) currentModel--; if (currentModel < 0) currentModel = MAX_MODELS - 1; } + //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- @@ -87,8 +88,7 @@ int main(void) BeginMode3D(camera); - DrawModelEx(model[currentModel], position, (Vector3){ 0.0f, 1.0f, 0.0f }, 180.0f, (Vector3){ 2.0f, 2.0f, 2.0f }, WHITE); - + DrawModel(model[currentModel], position, 1.0f, WHITE); DrawGrid(10, 1.0f); // Draw a grid EndMode3D(); diff --git a/examples/models/models_loading_vox.c b/examples/models/models_loading_vox.c index 909ff4528c24..23d27f121e63 100644 --- a/examples/models/models_loading_vox.c +++ b/examples/models/models_loading_vox.c @@ -12,85 +12,74 @@ ********************************************************************************************/ #include "raylib.h" -#include "raymath.h" -#include - - -// VOX Files to load and view +#include "raymath.h" // Required for: MatrixTranslate() #define NUM_VOX_FILES 3 -const char* szVoxFiles[] = { - "resources/models/vox/chr_knight.vox", - "resources/models/vox/chr_sword.vox", - "resources/models/vox/monu9.vox" -}; - - int main(void) { // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800; const int screenHeight = 450; + + const char *voxFileNames[] = { + "resources/models/vox/chr_knight.vox", + "resources/models/vox/chr_sword.vox", + "resources/models/vox/monu9.vox" + }; InitWindow(screenWidth, screenHeight, "raylib [models] example - magicavoxel loading"); + + // Define the camera to look into our 3d world + Camera camera = { 0 }; + camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position + camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point + camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) + camera.fovy = 45.0f; // Camera field-of-view Y + camera.projection = CAMERA_PERSPECTIVE; // Camera mode type // Load MagicaVoxel files Model models[NUM_VOX_FILES] = { 0 }; for (int i = 0; i < NUM_VOX_FILES; i++) { - // Load MagicaVoxel File and build model - double t0, t1; - t0 = GetTime() * 1000.0; - - models[i] = LoadModel(szVoxFiles[i]); - - t1 = GetTime() * 1000.0; - //TraceLog(LOG_INFO, TextFormat("Vox <%s> loaded in %f ms", GetFileName(szVoxFiles[i]), t1 - t0)); - - // Compute model's center matrix - BoundingBox bb = GetModelBoundingBox(models[i]); - Vector3 center; - 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 matP = MatrixTranslate(-center.x, 0, -center.z); - models[i].transform = matP; + // Load VOX file and measure time + double t0 = GetTime()*1000.0; + models[i] = LoadModel(voxFileNames[i]); + 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)); + + Matrix matTranslate = MatrixTranslate(-center.x, 0, -center.z); + models[i].transform = matTranslate; } - - // Define the camera to look into our 3d world - Camera camera = { { 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 }; - - // Model drawing position - Vector3 position = { 0.0f, 0.0f, 0.0f }; - int currentModel = 0; - - SetCameraMode(camera, CAMERA_ORBITAL); // Set a orbital camera mode 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 //---------------------------------------------------------------------------------- - UpdateCamera(&camera); // Update internal camera and our camera + UpdateCamera(&camera); // Update our camera to orbit - if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) - { - currentModel = (currentModel + 1) % NUM_VOX_FILES; // Cycle between models - } + // Cycle between models on mouse click + if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%NUM_VOX_FILES; + // Cycle between models on key pressed if (IsKeyPressed(KEY_RIGHT)) { currentModel++; @@ -101,34 +90,27 @@ int main(void) currentModel--; if (currentModel < 0) currentModel = NUM_VOX_FILES - 1; } - //---------------------------------------------------------------------------------- + // Draw //---------------------------------------------------------------------------------- BeginDrawing(); - ClearBackground(RAYWHITE); + ClearBackground(RAYWHITE); + + // Draw 3D model + BeginMode3D(camera); - //Display model - BeginMode3D(camera); + DrawModel(models[currentModel], (Vector3){ 0, 0, 0 }, 1.0f, WHITE); + DrawGrid(10, 1.0); - Vector3 rotAxis = { 1,0,0 }; - Vector3 scale = { 1,1,1 }; + EndMode3D(); - - DrawModelEx(models[currentModel], position, rotAxis, 0, scale, WHITE); - //DrawModelWiresEx(models[currentModel], position, rotAxis, -90.0f, scale, BLACK); - - DrawGrid(10, 1.0); - - EndMode3D(); - - //Display debug infos - DrawRectangle(30, 400, 310, 30, Fade(SKYBLUE, 0.5f)); - DrawRectangleLines(30, 400, 310, 30, Fade(DARKBLUE, 0.5f)); - DrawText("MOUSE LEFT BUTTON to CYCLE VOX MODELS", 40, 410, 10, BLUE); - - DrawText(GetFileName(szVoxFiles[currentModel]), 100, 10, 20, DARKBLUE); + // Display info + DrawRectangle(10, 400, 310, 30, Fade(SKYBLUE, 0.5f)); + DrawRectangleLines(10, 400, 310, 30, Fade(DARKBLUE, 0.5f)); + DrawText("MOUSE LEFT BUTTON to CYCLE VOX MODELS", 40, 410, 10, BLUE); + DrawText(TextFormat("File: %s", GetFileName(voxFileNames[currentModel])), 10, 10, 20, GRAY); EndDrawing(); //---------------------------------------------------------------------------------- @@ -136,7 +118,6 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- - // Unload models data (GPU VRAM) for (int i = 0; i < NUM_VOX_FILES; i++) UnloadModel(models[i]); diff --git a/examples/models/models_yaw_pitch_roll.c b/examples/models/models_yaw_pitch_roll.c index 5731c4dfa203..19d5edc7435f 100644 --- a/examples/models/models_yaw_pitch_roll.c +++ b/examples/models/models_yaw_pitch_roll.c @@ -79,7 +79,6 @@ int main(void) model.transform = MatrixRotateXYZ((Vector3){ DEG2RAD*pitch, DEG2RAD*yaw, DEG2RAD*roll }); //---------------------------------------------------------------------------------- - // Draw //---------------------------------------------------------------------------------- BeginDrawing(); From 2a6bd973bdfe92e9f8506feb766d3351c0802d94 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 14 Oct 2021 15:38:50 +0200 Subject: [PATCH 5/5] Review some comments --- examples/models/models_loading_gltf.c | 25 +++++++++++-------------- examples/models/models_loading_vox.c | 22 +++++++++++----------- src/rmodels.c | 2 +- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/examples/models/models_loading_gltf.c b/examples/models/models_loading_gltf.c index ac72b9d15d6c..fe79afeccdc5 100644 --- a/examples/models/models_loading_gltf.c +++ b/examples/models/models_loading_gltf.c @@ -1,27 +1,24 @@ /******************************************************************************************* * -* raylib [models] example - Load 3d gltf model +* raylib [models] example - Load models gltf * * This example has been created using raylib 3.5 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * +* 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. +* Also make sure the scale parameter of your models is set to 0.0, +* scaling can be applied from the export menu. +* * Example contributed by Hristo Stamenov (@object71) and reviewed by Ramon Santamaria (@raysan5) * * Copyright (c) 2021 Hristo Stamenov (@object71) and Ramon Santamaria (@raysan5) * -******************************************************************************************** -* -* 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 that the scale of your models is set to 0. Scaling can be done from the export menu. -* ********************************************************************************************/ #include "raylib.h" -#include - -#define MAX_MODELS 8 +#define MAX_GLTF_MODELS 8 int main(void) { @@ -41,7 +38,7 @@ int main(void) camera.projection = CAMERA_PERSPECTIVE; // Camera mode type // Load some models - Model model[MAX_MODELS] = { 0 }; + Model model[MAX_GLTF_MODELS] = { 0 }; model[0] = LoadModel("resources/models/gltf/raylib_32x32.glb"); model[1] = LoadModel("resources/models/gltf/rigged_figure.glb"); model[2] = LoadModel("resources/models/gltf/GearboxAssy.glb"); @@ -70,13 +67,13 @@ int main(void) if (IsKeyReleased(KEY_RIGHT)) { currentModel++; - if (currentModel == MAX_MODELS) currentModel = 0; + if (currentModel == MAX_GLTF_MODELS) currentModel = 0; } if (IsKeyReleased(KEY_LEFT)) { currentModel--; - if (currentModel < 0) currentModel = MAX_MODELS - 1; + if (currentModel < 0) currentModel = MAX_GLTF_MODELS - 1; } //---------------------------------------------------------------------------------- @@ -99,7 +96,7 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- - for (int i = 0; i < MAX_MODELS; i++) UnloadModel(model[i]); // Unload models + for (int i = 0; i < MAX_GLTF_MODELS; i++) UnloadModel(model[i]); // Unload models CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/models/models_loading_vox.c b/examples/models/models_loading_vox.c index 23d27f121e63..c693861e6023 100644 --- a/examples/models/models_loading_vox.c +++ b/examples/models/models_loading_vox.c @@ -1,13 +1,13 @@ /******************************************************************************************* * -* raylib [models] example - magicavoxel loader and viewer +* raylib [models] example - Load models vox (MagicaVoxel) * -* This example has been created using raylib 3.8 (www.raylib.com) +* This example has been created using raylib 4.0 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * -* Example contributed by Johann Nadalutti (@procfxgen) +* Example contributed by Johann Nadalutti (@procfxgen) and reviewed by Ramon Santamaria (@raysan5) * -* Copyright (c) 2021 Johann Nadalutti (@procfxgen) +* Copyright (c) 2021 Johann Nadalutti (@procfxgen) and Ramon Santamaria (@raysan5) * ********************************************************************************************/ @@ -15,7 +15,7 @@ #include "raymath.h" // Required for: MatrixTranslate() -#define NUM_VOX_FILES 3 +#define MAX_VOX_FILES 3 int main(void) { @@ -41,9 +41,9 @@ int main(void) camera.projection = CAMERA_PERSPECTIVE; // Camera mode type // Load MagicaVoxel files - Model models[NUM_VOX_FILES] = { 0 }; + Model models[MAX_VOX_FILES] = { 0 }; - for (int i = 0; i < NUM_VOX_FILES; i++) + for (int i = 0; i < MAX_VOX_FILES; i++) { // Load VOX file and measure time double t0 = GetTime()*1000.0; @@ -77,18 +77,18 @@ int main(void) UpdateCamera(&camera); // Update our camera to orbit // Cycle between models on mouse click - if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%NUM_VOX_FILES; + if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%MAX_VOX_FILES; // Cycle between models on key pressed if (IsKeyPressed(KEY_RIGHT)) { currentModel++; - if (currentModel >= NUM_VOX_FILES) currentModel = 0; + if (currentModel >= MAX_VOX_FILES) currentModel = 0; } else if (IsKeyPressed(KEY_LEFT)) { currentModel--; - if (currentModel < 0) currentModel = NUM_VOX_FILES - 1; + if (currentModel < 0) currentModel = MAX_VOX_FILES - 1; } //---------------------------------------------------------------------------------- @@ -119,7 +119,7 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- // Unload models data (GPU VRAM) - for (int i = 0; i < NUM_VOX_FILES; i++) UnloadModel(models[i]); + for (int i = 0; i < MAX_VOX_FILES; i++) UnloadModel(models[i]); CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/src/rmodels.c b/src/rmodels.c index 1b6c659f1380..1536e53e4421 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -79,7 +79,7 @@ #define VOX_FREE RL_FREE #define VOX_LOADER_IMPLEMENTATION - #include "external/vox_loader.h" // vox file format loading (MagikaVoxel) + #include "external/vox_loader.h" // VOX file format loading (MagikaVoxel) #endif #if defined(SUPPORT_MESH_GENERATION)