575 Commits
3.7.0 ... 4.0.0

Author SHA1 Message Date
Ray
0851960397 Update android.yml 2021-11-04 20:08:45 +01:00
Ray
a31784759d Update linux.yml 2021-11-04 20:08:25 +01:00
Ray
453a5b49a0 Update webassembly.yml 2021-11-04 20:07:59 +01:00
Ray
e7f24ade0b Update macos.yml 2021-11-04 20:07:32 +01:00
Ray
e14c6441ce Add some extra libraries to release packages 2021-11-04 19:46:17 +01:00
Ray
d18f3fca30 Reviewed broken link 2021-11-03 14:12:48 +01:00
raysan5
7f4ae653f3 Review display output order 2021-11-03 13:24:56 +01:00
raysan5
703df42586 Avoid duplicate output info on PLATFORM_RPI 2021-11-03 12:55:46 +01:00
Ray
13376de059 Reviewed scripts 2021-11-02 20:58:15 +01:00
Ray
677f5b0795 Review Notepad++ scripts for the supported compilers 2021-11-02 20:40:33 +01:00
Ray
d32bbabe0e Update SPONSORS.md 2021-11-02 19:16:46 +01:00
Ray
c3d32c156c REMOVED: Network examples
They were not working
2021-11-02 18:59:52 +01:00
Ray
1aaa55c38e Update Makefile 2021-11-02 18:54:01 +01:00
Ray
de0fca51a8 Updated scripts 2021-11-02 18:49:53 +01:00
Ray
5e3db0aa83 Updated some scripts paths
NOTE: New raylib release installer uses `w64devkit`, smaller and more updated than regular `mingw64-w64` default project. Paths are updated properly.
2021-11-02 18:40:45 +01:00
Ray
fadef24b62 Update ROADMAP.md 2021-11-02 16:46:49 +01:00
Ray
689a534c66 Update ROADMAP.md 2021-11-02 16:45:21 +01:00
Ray
9d93ca6fc8 Update ROADMAP.md 2021-11-02 16:42:00 +01:00
Ray
86d3e68d55 Add proper license to raylib-parser 2021-11-02 12:03:42 +01:00
Ray
9e17134949 Update HISTORY.md 2021-11-02 12:01:08 +01:00
Ray
290d68c11e Update README.md 2021-11-02 12:00:23 +01:00
Ray
2c8bc8ad47 Updated for the upcoming release! 2021-11-02 11:52:04 +01:00
AKDev
de070ba25f added another odin binding (#2094)
You can change the name to whatever you want to because the binding doesn't have a name.
2021-11-02 11:25:14 +01:00
Ray
e930ad3102 Reviewed spelling mistake 2021-11-01 23:06:26 +01:00
Ray
2fe488a71c Update version in CMake 2021-11-01 23:05:23 +01:00
Ray
0af2c139e2 Update CHANGELOG 2021-11-01 21:02:47 +01:00
Ray
191e8cf02b Update HISTORY.md 2021-11-01 21:02:23 +01:00
Ray
8737d697dc Update HISTORY.md 2021-11-01 21:00:52 +01:00
Ray
765a31597a Update CHANGELOG 2021-11-01 20:20:12 +01:00
raysan5
70a2118c49 REMOVED: rnet.h
It was not working properly... recommended to use `nbnet` instead.
2021-11-01 20:08:14 +01:00
raysan5
b02e737074 Update raygui.h 2021-11-01 20:07:22 +01:00
Ray
fdb7cd0587 Update HISTORY.md 2021-11-01 19:45:05 +01:00
raysan5
bba035c20c Minor type tweak 2021-11-01 19:14:55 +01:00
Ray
be361ed3dc Update README.md 2021-11-01 11:52:15 +01:00
Ray
8c0f9c7f5a Update miniaudio.h 2021-11-01 11:37:47 +01:00
Ray
8abba960c7 Review comments 2021-11-01 11:26:13 +01:00
Ray
8649032428 Update comment 2021-11-01 01:08:55 +01:00
Ray
6e8387468f Update CHANGELOG 2021-10-31 23:56:15 +01:00
Ray
27987f3fe6 Update README.md 2021-10-31 22:59:34 +01:00
Ray
ef32377336 Updated Notepad++ raylib intellisense functions 2021-10-31 18:12:50 +01:00
AKDev
a2b69c0905 removed raylib-d (#2091)
Because the repository and the author's GitHub profile doesn't exist anymore
2021-10-31 18:09:53 +01:00
Ray
1fac09d0f4 REVIEWED: example: Compute shader Game-of-life 2021-10-31 12:28:04 +01:00
Astie Teddy
f090f5444c Add Conway's Game of Life compute shader example. (#2088)
* Add Conway's Game of Life compute shader example.

* Fix various shaders problems, and tune command buffer size.

* Various coding convention changes.
2021-10-31 11:46:38 +01:00
Peter0x44
2bb4d36c43 Add missing file extensions for drag-and-drop support (#2090) 2021-10-30 23:43:07 +02:00
Ray
b7240d6a36 Update raygui.h 2021-10-27 11:25:24 +02:00
Ray
65076464d5 REVIEWED: KeyCallback()
Register keys independently of the actions
2021-10-26 22:27:18 +02:00
Ray
72758de6ea Reviewed warnings 2021-10-26 22:26:28 +02:00
Ray
25642cff36 Update comments for OpenGL 4.3 2021-10-26 22:23:16 +02:00
Ray
cd61463d23 Update README.md 2021-10-26 09:19:17 +02:00
Ray
0171bdfb9c Update raylib.pc.in 2021-10-26 09:13:30 +02:00
Jeffery Myers
daeccd03ac Fix VC warnings for examples (#2085) 2021-10-25 10:21:16 +02:00
Jeffery Myers
086f76ba7a Fix warnings in raylib build (#2084) 2021-10-25 10:18:42 +02:00
mandar1jn
e5cdfab97d made it so the cmake workflow runs on cmake related changes (#2083) 2021-10-25 02:05:11 +02:00
mandar1jn
affb707dd9 fixing the library so the workflows compile (#2082) 2021-10-24 18:24:01 +02:00
mandar1jn
4c497779a2 Updated workflow files (#2079)
* Updated workflow files

* added the manual trigger to the android workflow
2021-10-24 17:33:21 +02:00
TheSergey496
08441e8b2d When one of the colliding lines is vertical or horizontal, not all collisions were correctly detected due to floating point error. (#2081) 2021-10-24 17:31:13 +02:00
Ray
d02310e8ce Update README.md 2021-10-23 20:23:16 +02:00
raysan5
62965aa6d7 Comments tweaks 2021-10-23 14:17:26 +02:00
raysan5
04a4efb591 Added some comments on LoadGLTF() 2021-10-23 14:00:05 +02:00
raysan5
c4f0e80895 REVIEWED: Size of bones id supported, max 255 bones per mesh 2021-10-23 13:59:20 +02:00
raysan5
ebee8ba3bb REVIEWED: LoadGLTF() #2075 2021-10-23 11:42:02 +02:00
mausimus
8f5bd3e185 web: clear resizedLastFrame (#2077) 2021-10-23 10:52:36 +02:00
Richard Smith
fcc6a61d9e replace hardcoded number of mouse buttons with MAX_MOUSE_BUTTONS (#2076) 2021-10-23 10:52:04 +02:00
Ray
ae13f438ba Update Makefile.Web 2021-10-22 23:08:42 +02:00
raysan5
18db2c4f01 REVIEWED: LoadGLTF()
Reorganized code and added some feature and listed restrictions. Some gltf models do not work yet.
2021-10-22 21:27:11 +02:00
raysan5
1fd8052527 Update raylib.vcxproj 2021-10-22 21:24:39 +02:00
raysan5
6ce38e599a Remove big asset 2021-10-22 21:24:26 +02:00
raysan5
83b6cd00c6 Reviewed VS2019 projects 2021-10-22 15:41:28 +02:00
raysan5
1883343944 Update core_input_gamepad.c 2021-10-22 15:04:31 +02:00
raysan5
ebad28d831 REVIEWED: gltf models loading, reverted to a previous version (with some tweaks) 2021-10-22 14:53:11 +02:00
raysan5
befdb5963e REMOVED: IsGamepadName()
This function is not required, users can check it with `GetGamepadName()`
2021-10-22 12:21:31 +02:00
raysan5
83cd22ee5a Minor tweaks 2021-10-22 12:20:42 +02:00
raysan5
dd6e006d78 Reviewed multitouch example #1988 2021-10-22 11:53:47 +02:00
Ray
cbeb29d9d1 Update webassembly.yml 2021-10-21 22:40:13 +02:00
Ray
317db34059 Reviewed to support raygui and physac on building 2021-10-21 21:17:25 +02:00
Ray
1d61be5804 Merge branch 'master' of https://github.com/raysan5/raylib 2021-10-21 21:09:49 +02:00
Ray
13bb656a91 Update Makefile 2021-10-21 21:09:40 +02:00
Ray
16f5a04983 Update webassembly.yml 2021-10-21 21:08:28 +02:00
Ray
9afda9359b Reviewed physac building 2021-10-21 21:04:28 +02:00
Ray
2d82788e42 Reviewed uniform name 2021-10-20 11:55:00 +02:00
Ray
5761bf7e19 Merge branch 'master' of https://github.com/raysan5/raylib 2021-10-20 11:40:59 +02:00
Ray
fba117478d Update Makefile.Web 2021-10-20 11:40:46 +02:00
Richard Smith
8e599908d9 Re-write Code::Blocks template to work on Linux and Macos (#2073)
* update code::blocks example to support linux

* add macos support

* update screenshot

* update templates readme
2021-10-19 19:50:21 +02:00
Raffaele
ae7127232d Add D bindings to Raylib (#2072)
* Added the bindings for Scheme48.

* Add D bindings to Raylib
2021-10-19 15:41:49 +02:00
raysan5
2e151408bb REVIEWED: models_yaw_pitch_roll 2021-10-19 14:58:04 +02:00
raysan5
fec0ce34c5 Remove trailing spaces 2021-10-19 14:57:12 +02:00
raysan5
719c1551cc Reviewed latest PR formatting and details 2021-10-19 13:30:23 +02:00
warzes
9f2ff3e4d6 Support create OpenGL debug context in OpenGL 4.3 (#2068)
* - support create OpenGL debug context in OpenGL 4.3

* - additional events in debug message
- fixed glEnable(GL_DEBUG_OUTPUT)

* Reviewed OpenGL Debug Context
2021-10-19 12:43:27 +02:00
procfxgen
963021d393 VS2019 solution update (#2071)
* new models_magicavoxel_loading example

* Portable header-only file "magicavoxel_loader.h" for MagicaVoxel loader example.

* models_magicavoxel_loading example added to CMakeLists.txt and Makefile

* fix models_magicavoxel_loading example for linux.

* * vox_loader into "src/external/vox_loader.h"
 * vox file support for "models.c"
 * updated example "models/models_magicavoxel_loading.c"

* * Fix Vox_FreeArrays (removed memory leak)

* * removed magicavoxel_loader.h

* * Revert vs2019 solution

* * vox_loader.h -> Support custom memory allocators
* vox_loader.h -> Reverse Y<>Z for left to right handed system
* models/models_magicavoxel_loading.c -> fix model center

* * vox_loader.h -> Removed Raylib dependencies

* * Changed Vox_LoadFileName to Vox_LoadFromMemory

* VS2019 models_mesh_magicavoxel_loading.vcxproj added

* vs2019 project rename models_loading_vox
2021-10-19 10:50:14 +02:00
Ray
7763ccd8ad Resync .obj models! gitignore was ignoring them! 2021-10-18 23:17:37 +02:00
Jarosław Jaros
d8e0b2e27c Allow to run any file (#2069) 2021-10-18 22:00:54 +02:00
raysan5
6ac3043e88 WARNING: REMOVED: glTF loading
Actually, it was broken and it that code has no maintainer.
2021-10-18 14:11:56 +02:00
raysan5
2ec8ce649a ADDED: EncodeDataBase64() and DecodeDataBase64() 2021-10-18 14:10:51 +02:00
raysan5
bc47d36e90 Merge branch 'master' of https://github.com/raysan5/raylib 2021-10-18 13:26:07 +02:00
raysan5
1c9093fd24 Avoid GRAPHICS_API_OPENGL_* defines
Those defines are only used inside `rlgl` module
2021-10-18 13:25:59 +02:00
Ray
0543f897a9 Update README.md 2021-10-18 13:24:44 +02:00
raysan5
b28e353626 Reviewed glDisableVertexAttribArray() issue #2068 2021-10-18 13:22:52 +02:00
raysan5
a3f9ba8704 Removed useless GL calls #2068 2021-10-18 13:16:07 +02:00
Ray
ccf4329792 Review comments 2021-10-18 00:23:26 +02:00
Uneven Prankster
a6fb2dafc6 Fix rlLoadComputeShaderProgram define (#2067)
Now uses correct version.
2021-10-17 23:11:42 +02:00
raysan5
7a16834124 UPDATE: Officially support OpenGL 4.3 2021-10-17 21:41:19 +02:00
raysan5
628e6e52f3 Update examples screenshots 2021-10-17 21:39:52 +02:00
raysan5
f437f7b405 Reviewed makefile and examples building 2021-10-17 21:00:52 +02:00
raysan5
cf12992b6a Remove trailing spaces 2021-10-17 21:00:20 +02:00
raysan5
67a1e84859 Merge branch 'master' of https://github.com/raysan5/raylib 2021-10-17 19:10:48 +02:00
raysan5
6243466770 Create Makefile.Web 2021-10-17 19:10:33 +02:00
raysan5
0f8caeb186 Added new examples to Makefile 2021-10-17 19:10:28 +02:00
raysan5
c20df9aa47 Reviewed examples 2021-10-17 19:10:09 +02:00
Ray
c41e0f0c45 Update CHANGELOG 2021-10-17 19:07:29 +02:00
Sage Hane
16d015d81e build.zig: Use addCSourceFiles (#2066) 2021-10-17 19:04:08 +02:00
warzes
d47d7c0001 Fixing the error of loading VOX models. (#2065)
* - Fixing the error of loading VOX models.

* - fixed spaces
2021-10-17 10:22:58 +02:00
michaelfiber
c87e91d27a Update SetupViewport so that it doesn't subtract offset from render dimensions when calling rlViewport (#2064)
Co-authored-by: Michael <michael@cubeofb.org>
2021-10-17 10:21:51 +02:00
Ray
99f6707e2c Support OpenGL 4.3
- Support Compute Shaders by rlgl API
 - Support SSBO by rlgl API
2021-10-16 23:49:31 +02:00
Ray
e36dc01b91 Support GRAPHICS_API_OPENGL_43 2021-10-16 23:39:21 +02:00
Ray
8523d13683 Update rlgl.h 2021-10-16 23:30:30 +02:00
Astie Teddy
dba29e4405 Compute shaders support (#2061)
* Add basic compute shader and ssbo support in rlgl.

* Add rlBindImageTexture (untested), now requires SUPPORT_COMPILE_SHADERS

* Delete glad.c

* Delete glad.h

* Delete khrplatform.h

* Revert to previous glad.h

* Remove "glad.c"

Co-authored-by: Ray <raysan5@gmail.com>
2021-10-16 23:26:25 +02:00
Ray
0aefe256d0 REVIEWED: rlLoadDrawQuad() description #2058 2021-10-16 22:39:22 +02:00
Ray
1b793e76dc Reviewed memory usage 2021-10-16 22:36:47 +02:00
Ray
226c0e362c Merge branch 'master' of https://github.com/raysan5/raylib 2021-10-15 11:25:28 +02:00
Ray
84edd22612 Reviewed unsigned int issue (discussion #2054) 2021-10-15 11:25:17 +02:00
raysan5
2a6bd973bd Review some comments 2021-10-14 15:38:50 +02:00
raysan5
d7266ea8f3 Merge branch 'master' of https://github.com/raysan5/raylib 2021-10-14 13:41:55 +02:00
raysan5
ef858b0dbb Review examples 2021-10-14 13:37:22 +02:00
Ryan Roden-Corrent
588131c9d5 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.
2021-10-14 13:24:00 +02:00
Ray
52c1a4e7d0 Update SPONSORS.md 2021-10-14 12:45:41 +02:00
Ray
f9c8e31ed7 Update SPONSORS.md 2021-10-14 12:30:46 +02:00
Ray
9ac5a96408 Update rmodels.c 2021-10-14 10:52:24 +02:00
Ray
8a5bc933de Starting to review glTF loading -WIP- 2021-10-14 10:43:29 +02:00
Ray
3e604a8645 Remove trailing spaces 2021-10-14 00:11:37 +02:00
Ray
83b3478fe4 Reviewed some TODO 2021-10-13 23:45:57 +02:00
raysan5
51b147cd32 Update models_loading_vox.c 2021-10-13 21:08:58 +02:00
raysan5
4390d3a122 Avoid raylib dependency 2021-10-13 20:47:57 +02:00
raysan5
a77afd5c8f Reviewed some MSVC warnings 2021-10-13 20:47:42 +02:00
raysan5
32c9d411b2 REVIEWED LoadVOX() -WIP-
It seems vox loader is not working properly...
2021-10-13 20:28:58 +02:00
raysan5
1350361f58 Reviewed formatting 2021-10-13 19:34:37 +02:00
Horrowind
e545286369 Fix issue with empty cylinder (#2050)
* Add DrawCylinderEx and DrawCylinderWiresEx

* Modify examples/models/models_geometric_shapes.c to show the
usage of DrawCylinder(Wires)Ex

* Simplified DrawCylinder and DrawCylinderWires to use the -Ex versions.

* This reverts commits f49b2598dd and
4542b32e4e.

* Fixed formatting.
Renamed base_angle to baseAngle.
Remove most of the raymath.h calls.

* Added check for empty cylinder.

* Added check for empty cylinder.

* Fix bug.

Co-authored-by: Horrowind <you@example.com>
2021-10-13 19:32:30 +02:00
raysan5
942731cc22 REVIEWED: macOS does not require GLAD library #2052
It directly uses the libraries provided by the system
2021-10-13 19:29:29 +02:00
raysan5
4e88160e78 Update raylib.h 2021-10-13 19:22:47 +02:00
Ray
a1db0220a1 REVIEWED: LoadFontFromImage()
Avoid crash on wrong sprite font
2021-10-12 23:00:00 +02:00
raysan5
f9d4601057 Create LICENSE 2021-10-12 21:26:41 +02:00
raysan5
f1659d78d3 Reviewed models examples paths 2021-10-12 21:01:49 +02:00
raysan5
007e840be1 Remove VS2019 solution projects 2021-10-12 20:27:03 +02:00
raysan5
d92531b81d Rename examples for consistency 2021-10-12 20:23:59 +02:00
raysan5
670eab8b17 Review comments 2021-10-12 20:23:46 +02:00
raysan5
252bd22738 Merge branch 'master' of https://github.com/raysan5/raylib 2021-10-12 20:22:12 +02:00
raysan5
0b0711027a Remove unimplemented function 2021-10-12 20:21:56 +02:00
Ray
e168c6dd81 Update CHANGELOG 2021-10-12 19:50:51 +02:00
Horrowind
526e68afa8 Add DrawCylinder(Wires)Ex (#2049)
* Add DrawCylinderEx and DrawCylinderWiresEx

* Modify examples/models/models_geometric_shapes.c to show the
usage of DrawCylinder(Wires)Ex

* Simplified DrawCylinder and DrawCylinderWires to use the -Ex versions.

* This reverts commits f49b2598dd and
4542b32e4e.

* Fixed formatting.
Renamed base_angle to baseAngle.
Remove most of the raymath.h calls.

Co-authored-by: Horrowind <you@example.com>
2021-10-12 19:36:06 +02:00
raysan5
1b91ac0b0d REVIEWED: EXAMPLE: shaders_shapes_outline
Removed unneeded resources to use raylib ones.
2021-10-12 13:36:31 +02:00
raysan5
599d6e810f REVIEWED: models resources structure 2021-10-12 12:47:50 +02:00
raysan5
75b5cc0084 REMOVED: EXAMPLE: models_gltf_animation 2021-10-12 12:47:10 +02:00
raysan5
9a568654be REMOVED: EXAMPLE: models_material_pbr 2021-10-12 12:46:41 +02:00
raysan5
4a1bd12e2d REVIEWED: DrawCubeTextureRec() formatting 2021-10-12 12:08:12 +02:00
Ray
282ec9bb76 Formatting tweak 2021-10-10 23:48:16 +02:00
Ray
a91f61262e Review RLAPI to avoid warnings 2021-10-10 23:24:05 +02:00
Ray
f8719e7ec3 Reviewed latest PR formatting 2021-10-10 22:38:58 +02:00
Arnaud Valensi
7c36f3f6b8 Fix dpi issues (#1987) 2021-10-10 22:34:56 +02:00
Jeffery Myers
3d6d5558c9 Add CheckCollisionPointLine to the header, it appears to have been missed (#2042) 2021-10-10 17:06:15 +02:00
Raffaele
a39a44c12f Added the bindings for Scheme48. (#2043) 2021-10-10 17:05:26 +02:00
Jeffery Myers
60bedb4f87 [Documentation] Move older and abandoned bindings to new section at the end of the file (#2040)
* Move older and abandoned bindings to new section at the end of the file

* cleanup

* raylib forever is auto
2021-10-10 00:26:15 +02:00
Jeffery Myers
62554db48d Add missing #endif to windows API defines (#2038) 2021-10-08 19:12:21 +02:00
Ray
94650f0def Simplified RLAPI preprocessor branching 2021-10-08 17:22:58 +02:00
Jeffery Myers
33ed452439 Fix dll exports so that raylib builds in visual studio again. (#2037) 2021-10-07 20:17:45 +02:00
Ray
bb2763cc1f Update models_rlgl_solar_system.c 2021-10-07 16:08:39 +02:00
raysan5
3e71232a04 WARNING: BREAKING: REMOVED: GenImagePerlinNoise()
raylib was using `stb_perlin.h` library to generate perlin noise, it seems that recently this library has been flagged as it could be infringing some algorythm patent. For security, it has been removed from raylib.
2021-10-06 21:20:36 +02:00
raysan5
700d448d75 Updated external libraries 2021-10-06 21:13:17 +02:00
raysan5
8722ff7043 REVIEWED: RLGL.State.vertexCounter (See detailed comment)
`RLGL.State.vertexCounter` is a generic counter and it's reused for all `rlRenderBatch`, actually, once render batch is filled, required vertex count is provided through the draw calls, so, the total accumulated count of vertices is not directly registered inside the rlRenderBatch.

`RLGL.State.vertexCounter` keeps that count but one possible improvement(?) could be moving the `vertexCounter` inside `rlRenderBatch` to always keep a register of the total accumulated vertices in that batch (despite that info is provided by the accumulated `draws[i].vertexCount`.

Simplifying, `RLGL.State.vertexCounter = SUM(draws[i].vertexCount)`

The decision to move the counter out of `rlVertexBuffer` is to keep only the data that I think should belong to `rlVertexBuffer` and make it more generic, aligned with raylib `Mesh` structure.

The decision to not add it to `rlRenderBatch` is because it could contain multiple `rlVertexBuffer` and it would be confusing (because it would only register the count of the last filled one).
2021-10-06 11:44:57 +02:00
Ray
8d7f97ee04 Remove trailing spaces 2021-10-06 01:20:46 +02:00
Ray
9a4fb25285 REDESIGNED: Simplify vertex data recording
Instead of registering vertex texcoords and colors on every call, we keep the last defined value and we record everything on `glVertex*()`. Actually that behavior is aligned with OpenGL 1.1 standard.
2021-10-06 01:17:20 +02:00
raysan5
7439c7547b Review functions specifiers 2021-10-05 19:20:21 +02:00
raysan5
c8b16d72e2 Merge branch 'master' of https://github.com/raysan5/raylib 2021-10-05 18:33:53 +02:00
raysan5
b972b8d324 REVIEWED: API functions specifiers 2021-10-05 18:33:41 +02:00
AKDev
67de7c4483 added nelua-raylib and removed raylib-nelua (#2033)
removed raylib-nelua because it's the same as nelua-raylib but with some significant improvements 😸
2021-10-05 16:44:33 +02:00
Ray
9f4a839853 Update CHANGELOG 2021-10-04 10:44:32 +02:00
mausimus
6541895901 Revert "reset resizedLastFrame on web platform (#2020)" (#2032) 2021-10-04 09:47:41 +02:00
tomarigr
5d8c477d12 [rcore] fix rpi4 Failed to get DRM resources (#2031)
* [rcore] fix rpi4 Failed to get DRM resources

card1 is not always the the correct card to use on rpi4
rpi os finds the correct card and links it to /dev/dri/by-path/platform-gpu-card during boot.
this fix makes sure that we always point to the correct card on rpi4

* Update rcore.c
2021-10-04 01:59:59 +02:00
Ray
79f36799e7 REVIEWED: Avoid raymath dependency
Still, it depends on Matrix type... rcamera module should be completely reviewed...
2021-10-03 14:08:21 +02:00
Ray
369cb0a3c5 Format tweak 2021-10-03 13:51:53 +02:00
Ray
9b3d74db6b ADDED: GetImageColor() #2024 2021-10-03 12:55:52 +02:00
Ray
92417c4485 Update raylib.h 2021-10-03 12:33:40 +02:00
Ray
22345ff62a Minor format tweak 2021-10-03 12:17:15 +02:00
SAOMDVN
3fc4a4c974 Added DrawLineBezierCubic() (#2021)
Co-authored-by: SAOMDVN <saomdvn@users.noreply.github.com>
2021-10-03 12:15:56 +02:00
Ray
03a88678da Update core_basic_window.c 2021-10-03 12:14:31 +02:00
Dennis E. Hamilton
f60e0e6c94 Tidying the core_basic_window.c in projects/scripts (#2025)
* Match build-windows.bat changes

The location for manual setting of the vcvarsall.bat location moved to line 38 in the latest change.

* Update flags for clean x64/x86 building

std:c11 is required for initialization features used in raylib.  UTF-8 for consistency in contemporary systems.  /W3 gets rid of puzzling slack byte and linker in-lining warnings.  /sdl for some insecure library usages in the user code that beginners should learn about early.

* 2021-10-01 core_basic_windows.c adjustment

 1. The press F6 message and the placement of the compiled executable statement are incorrect for the scripts case.
 2. <raylib.h> because "raylib.h" is meaningful only when compiling inside raylib/src/ folder.
 3. main(void) to get rid of a novice-confusing warning.
2021-10-03 12:13:46 +02:00
Laurentino Luna
9fce26bb06 Supress most warnings on rmodels.c (#2029)
* Supress most warnings on rmodels.c

NOTE: unused symbols have been deleted and the following report will show in what location they were previously.

Unused symbols:
- ArrayInt - vox_loader.h: line 84
- initArrayInt - vox_loader.h: line 168
- insertArrayInt - vox_loader.h: line 175
- freeArrayInt - vox_loader.h: line 186
- offsetX, offsetY, offsetZ - vox_loader.h: line 610
- chunkTotalChildSize - vox_loader.h: line 623

Other warnings:
- initialization discards 'const' qualifier - vox_loader.h: line 572
- incompatible types for VoxVector3 and Vector3 - rmodels.c: line 5748
- incompatible types for VoxColor and Color - rmodels: line 5749

* Remove ToVector3 and ToColor functions and assign values directly
2021-10-03 12:11:20 +02:00
Ray
f869229b7f Minor format tweaks 2021-10-03 12:09:59 +02:00
Ray
239c37246a WARNING: REVIEWED: Follow a set of conventions
CONVENTIONS:
  - Functions are always self-contained, no function use another raymath function inside, required code is directly re-implemented inside
  - Functions input parameters are always received by value
  - Functions use always a "result" variable for return
  - Functions are always defined inline
  - Angles are always in radians (DEG2RAD/RAD2DEG macros provided for convenience)
2021-10-03 11:44:59 +02:00
Chris
9882796df0 Rename BRDG typo to BDRF (#2028) 2021-10-02 14:07:42 +02:00
Dennis E. Hamilton
e34c0911f9 Cleanup x64/x86 options in scripts/build-windows.bat (#2023)
* Match build-windows.bat changes

The location for manual setting of the vcvarsall.bat location moved to line 38 in the latest change.

* Update flags for clean x64/x86 building

std:c11 is required for initialization features used in raylib.  UTF-8 for consistency in contemporary systems.  /W3 gets rid of puzzling slack byte and linker in-lining warnings.  /sdl for some insecure library usages in the user code that beginners should learn about early.
2021-09-30 22:29:35 +02:00
mausimus
93efa565f9 reset resizedLastFrame on web platform (#2020) 2021-09-29 23:27:10 +02:00
mausimus
dfbb134bfe RLGL: restore draw batch state after limit check (#2018) 2021-09-29 23:26:29 +02:00
Vadim Boev
92f6290dbb Build Android App with Visual Studio 2019 (#2013)
* Add support Android build for Visual Studio

* Delete projects/VS2019-Android/raylib_android/ARM64/Debug directory

* Delete projects/VS2019-Android/raylib_android/raylib_android/raylib_android.NativeActivity/ARM64/Debug directory

* Delete projects/VS2019-Android/raylib_android/raylib_android/raylib_android.Packaging/ARM64/Debug directory

* Delete projects/VS2019-Android/raylib_android/raylib_android/raylib_android.Packaging/ARM/Debug directory

* Delete projects/VS2019-Android directory

* Build Android App with Visual Studio 2019
2021-09-27 17:57:06 +02:00
Ray
2474d50dba Update raylib.h 2021-09-27 17:52:15 +02:00
Ray
e40ece55d5 Update raylib.h 2021-09-27 17:51:57 +02:00
raysan5
18c92b3104 ADDED: Vector3Angle() 2021-09-27 13:57:06 +02:00
raysan5
dd7d65a6b4 Remove tabs 2021-09-27 13:55:45 +02:00
Tommi Sinivuo
206e1def6f Add Zig build file (#2014)
The build file builds Raylib as a static library for either
Windows or Linux.
2021-09-25 19:24:48 +02:00
Tristan Schulz
b7063ab879 [models] Animation System Fix Part 1 (#2009)
* Fixed gltf missing transforms on load

mend

* extracted Matrix calculation in to static method and added skinning check

* fixed formatting

* Fixed write to access to nullptr when animation has no normals

* Refactored UpdateModelAnimation to only update changed vertices when needed (allows for multi animation playing)

* add check for models that were missed during BindGLTFPrimitiveToBones to not segfault the program

* fixed id mismatch between animation and model

* draft on fixing the mesh to skin mapping

* dont look at this

* removing debug info
2021-09-23 21:06:51 +02:00
raysan5
10d7718011 UPDATED: raylib resource files 2021-09-23 20:53:31 +02:00
raysan5
ddc1fdf6d5 REVIEWED: SeekMusicStream() formating 2021-09-23 18:11:24 +02:00
Uneven Prankster
7fa521fae4 Fix + Return if attempting to seek on a module format (#2008) 2021-09-23 17:38:37 +02:00
Ray
08ea5e419e REVIEWED: LoadImageAnim() #2005 2021-09-23 00:23:57 +02:00
Ray
00a763ea44 Reviewed some TODO comments 2021-09-23 00:18:47 +02:00
Laurentino Luna
dcd289d931 Modify TODO to NOTE on Makefile (#2007)
'# TODO: see 'install' target.' should be a note rather than something
to do.
2021-09-22 23:49:11 +02:00
Timon de Groot
025246620f Add function DrawCubeTextureRec (#2001)
* Add function DrawCubeTextureRec

* Add EOF newline

* Remove unneeded example
2021-09-22 21:56:38 +02:00
Uneven Prankster
19ef765382 SeekMusicStream initial implementation (#2006) 2021-09-22 21:55:13 +02:00
Ryan Roden-Corrent
9607ea5c0a Use unsigned int for animation count. (#2002)
LoadModelAnimations takes an `int` for the animation count parameter.
The animation count should never be negative, so it makes sense to
specify it as unsigned in the API. This matches the API for
UnloadModelAnimations, which expects an unsigned int. Both GLTF and IQMM
also store the animation count internally as unsigned, and we were
casting to a signed int for no reason.

GLTF actually uses `size_t` internally, so we're technically risking
overflow, but having 2^32 animations seems unlikely.
2021-09-22 13:04:10 +02:00
Ray
8a434b4fd4 Update rmodels.c 2021-09-22 13:02:44 +02:00
Ray
0e037555fe Update raylib.h 2021-09-22 12:59:40 +02:00
Ray
de173a93c8 Update rmodels.c 2021-09-22 12:19:25 +02:00
Ray
37c047eabc Update rmodels.c 2021-09-22 11:28:52 +02:00
Ray
c1432386a5 Update Makefile 2021-09-22 11:13:10 +02:00
Conifer
b5f281bacd Update BINDINGS.md (#2003)
Update the link to new and better Swift binding to Raylib by STREGAsGate
2021-09-22 10:11:44 +02:00
Ray
23b827b66c Update macos.yml 2021-09-22 00:57:42 +02:00
Ray
d851208413 Update linux.yml 2021-09-22 00:56:58 +02:00
Ray
3caa15e696 Update webassembly.yml 2021-09-22 00:55:46 +02:00
Ray
99ab4d6cb8 WARNING: MODULES RENAMING!!!
raylib modules have been slightly renamed to add some identity and note that they are independent modules that can be used as standalone separate parts of raylib if required.

The renamed modules are:
 - `core` -> `rcore`
 - `shapes` -> `rshapes`
 - `textures` -> `rtextures`
 - `text` -> `rtext`
 - `models` -> `rmodels`
 - `camera` -> `rcamera`
 - `gestures` -> `rgestures`
 - `core` -> `rcore`

All the build systems has been adapted to this change.
2021-09-22 00:15:06 +02:00
Ray
8b3d054408 Minor reviews 2021-09-21 23:49:42 +02:00
raysan5
7d995d95eb Merge branch 'master' of https://github.com/raysan5/raylib 2021-09-21 15:31:35 +02:00
raysan5
a09311a8fc Tweaks 2021-09-21 15:31:26 +02:00
Uneven Prankster
339fdf4c31 Add up argument to DrawBillboardPro (#1941)
* Add `up` argument to `DrawBillboardPro`

* Replace tab with proper spaces
2021-09-21 15:22:30 +02:00
raysan5
c96de3a23a ADDED: GetTouchPointId(index) #1972 2021-09-21 15:11:33 +02:00
raysan5
1627f34032 Reviewed some compilation issues #1997 2021-09-21 15:06:06 +02:00
Richard Smith
59cabc7d11 Update BINDINGS.md (#2000) 2021-09-21 14:54:52 +02:00
Chris
89f031673b Fix mappings.h issue from glfw update (#1995)
- Ran GenerateMappings.cmake to restore mapping changes
2021-09-19 20:33:18 +02:00
Tommi Sinivuo
3c55f067a8 Add SetRandomSeed(unsigned int seed) function (#1994)
Specifying a fixed seed for the random number generator is often
used in games for various reasons.

By adding an api function for seeding the random number generator
we solve two different problems regarding the seeding:

1) The underlying RNG implementation does not leak to client code
   (as would be the case if we called srand directly from the
   client code)
2) Seeding the RNG would be simple from other programming languages
   (especially in cases where calling libc functions is non-trivial)
2021-09-17 21:26:21 +02:00
MrSwedish
23fabb1d67 Prevent INVALID_SOCKET to be defined twice on linux (#1993)
i got an error because of this lol
2021-09-17 01:05:38 +02:00
Neil Barkhina
e9d3d4fa1f Implemented GetGamepadName() for emscripten (#1986)
* implemented GetGamepadName for emscripten

* updated gamepad to use existing name as arary

* removed unnecessary platform_web check
2021-09-12 18:02:54 +02:00
Hristo Stamenov
024adc2538 Add find opengl for widnows too. (#1985)
* Add find opengl for widnows too.

* Also fix set LIBS_PRIVATE to bi similar to linux and apple targets
2021-09-10 20:31:36 +02:00
raysan5
72983d4e20 Typo 2021-09-10 19:01:24 +02:00
raysan5
b63c2619e3 Update Makefile for web compilation
Some flags are only for the linker, not the compiler
2021-09-10 19:01:09 +02:00
Ray
40ec7a6236 Update core.c 2021-09-10 17:23:48 +02:00
Ray
352ea80a1f REVIEWED: Vox loader 2021-09-10 15:37:31 +02:00
procfxgen
a422d2fc8b Vox loaded (#1981)
* new models_magicavoxel_loading example

* Portable header-only file "magicavoxel_loader.h" for MagicaVoxel loader example.

* models_magicavoxel_loading example added to CMakeLists.txt and Makefile

* fix models_magicavoxel_loading example for linux.

* * vox_loader into "src/external/vox_loader.h"
 * vox file support for "models.c"
 * updated example "models/models_magicavoxel_loading.c"

* * Fix Vox_FreeArrays (removed memory leak)

* * removed magicavoxel_loader.h

* * Revert vs2019 solution

* * vox_loader.h -> Support custom memory allocators
* vox_loader.h -> Reverse Y<>Z for left to right handed system
* models/models_magicavoxel_loading.c -> fix model center

* * vox_loader.h -> Removed Raylib dependencies

* * Changed Vox_LoadFileName to Vox_LoadFromMemory
2021-09-10 15:24:01 +02:00
Ray
803094f41f REVIEWED: Touch input system #1975 #1960
- ADDED: `GetTouchPointCount()` to core module, removed from gestures module.
 - Support multiple touch points: `MAX_TOUCH_POINTS`.
2021-09-10 15:19:12 +02:00
Ray
2c13e43c32 Review font loading log info 2021-09-10 15:16:34 +02:00
Nikolay Krasheninnikov
18d73eef19 Fixes target direction for first person camera mode. (#1977)
Co-authored-by: Nikolai Krasheninnikov <nikolai.krasheninnikov@kronshtadt.ru>
2021-09-10 11:51:59 +02:00
Tristan Schulz
7bf31dd468 Fixed loading obj models with no materials (#1984) 2021-09-09 18:14:15 +02:00
Steven Schveighoffer
1a6adc5f74 Fix dynamic library issues on Macos (#1978) 2021-09-06 23:17:12 +02:00
raysan5
b15715ca80 Merge branch 'master' of https://github.com/raysan5/raylib 2021-09-05 21:49:49 +02:00
raysan5
8d3ff3fda8 Updated Makefile for latest Android NDK r32 LTS
It seems now it's required to use archiver `llvm-ar`
2021-09-05 21:49:47 +02:00
Tristan Schulz
24a38dbd3f [models] LoadGLTF fixed missing transformations and nonroot skinning problem (#1964)
* Fixed gltf missing transforms on load

mend

* extracted Matrix calculation in to static method and added skinning check

* fixed formatting
2021-09-05 21:15:40 +02:00
raysan5
4120f12375 REVIEWED: Vox loading, mostly formating 2021-09-05 20:39:34 +02:00
procfxgen
dfc465ca6d new models_magicavoxel_loading example (#1940)
* new models_magicavoxel_loading example

* Portable header-only file "magicavoxel_loader.h" for MagicaVoxel loader example.

* models_magicavoxel_loading example added to CMakeLists.txt and Makefile

* fix models_magicavoxel_loading example for linux.

* * vox_loader into "src/external/vox_loader.h"
 * vox file support for "models.c"
 * updated example "models/models_magicavoxel_loading.c"

* * Fix Vox_FreeArrays (removed memory leak)

* * removed magicavoxel_loader.h

* * Revert vs2019 solution
2021-09-04 19:55:09 +02:00
raysan5
93168304cd Update shell.html 2021-09-03 15:24:05 +02:00
Ray
9ff8ad853c Update raygui.h 2021-09-02 00:39:47 +02:00
Ray
59e7275464 REVIEWED: Glyphs 2021-09-02 00:35:55 +02:00
Ray
fa79ae8a3d Merge branch 'master' of https://github.com/raysan5/raylib 2021-09-01 23:41:00 +02:00
Ray
9362eaf9c6 REVIEWED: Naming: length vs size 2021-09-01 23:40:51 +02:00
atticus
dfadb3ee37 fix various memory leaks (#1969) 2021-09-01 23:15:32 +02:00
Ray
6e76baa6a9 WARNING: BREAKING: RENAMED: Font struct variables
RENAMED: GetCodepointsCount() -> GetCodepointCount()
RENAMED: GetTouchPointsCount() -> GetTouchPointCount()
2021-09-01 23:11:31 +02:00
Ray
a0f8682905 REVIEWED: <name>Count for consistency
Following english rules, it should be singular name before Count.
2021-09-01 23:09:30 +02:00
Tristan Schulz
e8fa7ceb79 [models] Fixed counting loop for face amount per material (#1967) 2021-09-01 21:29:20 +02:00
Ray
68bcfa1192 Minor tweak 2021-08-28 22:54:47 +02:00
raysan5
d98e61c6eb Minor format tweaks 2021-08-28 12:01:16 +02:00
Hussein Sarea
66c6ec4465 Add pyraylib (#1961) 2021-08-28 09:57:13 +02:00
Ray
936199d8de Review dates 2021-08-27 18:50:02 +02:00
Ray
18af18479f REVIEWED: ExportWaveAsCode() 2021-08-27 18:49:03 +02:00
Ray
b7ae0df3d9 REVIEWED: Decouple DrawMesh() and DrawMeshInstanced() #1958 2021-08-27 12:13:44 +02:00
Richard Smith
cac856119c Change GetColor to take unsigned int (#1954) 2021-08-26 17:31:01 +02:00
irishgreencitrus
1286bc076f Add raylib.v binding (#1955)
Added raylib.v binding for Vlang
2021-08-26 17:27:31 +02:00
Ray
3d33c559e7 REVIEWED: Examples compilation 2021-08-26 00:14:34 +02:00
Ray
14e443afba REVIEWED: OpenGL 1.1 compilation issue 2021-08-25 23:41:33 +02:00
Ray
7749a2805c UPDATED: raygui to latest version -WIP-
Note this new raygui version embeds ricons and `GuiTextBoxMulti()` is not working properly
2021-08-25 00:51:37 +02:00
Ray
a04dbe7ffd Update shaders_shapes_outline.c 2021-08-25 00:41:48 +02:00
Ray
913f185f82 Renamed some static functions for more consistent naming 2021-08-25 00:22:16 +02:00
Laurentino Luna
6575d31379 Fix tcc not finding emmintrin.h (#1947)
* Fix tcc not finding emmintrin.h

This allows to compile raylib with tcc with no errors.

* Remove __TINYC__ check from stb_image.h

This will be placed under textures.c

* Move tcc check to textures.c

Avoiding to change stb_image.h
2021-08-24 16:34:52 +02:00
raysan5
7c1889c282 REVIEWED: Support mouse wheel on x-axis #1948 2021-08-24 15:26:59 +02:00
Luiz Pestana
45fd75952d Revert "Ignore generated example binaries (#1884)" (#1946)
This reverts commit 4a01139c8d.
2021-08-23 20:05:34 +02:00
Ray
51fbde178f Update shaders_shapes_outline.c 2021-08-22 01:08:27 +02:00
Ray
b154bc33f5 Added note on GLFW custom allocators for the future 2021-08-22 01:08:11 +02:00
Ray
d98779abef Minor tweak to avoid false error logs 2021-08-22 01:07:37 +02:00
Ray
aefdb9f9cf REMOVED: Old function names defines
As far as next raylib version will be 4.0, no backward compatibility hacks will be maintained.
2021-08-21 23:57:41 +02:00
Ray
ff523d55ac Updated raygui #1939 2021-08-20 11:56:25 +02:00
atticus
6d20430ccc add NULL check (#1925) 2021-08-20 11:47:51 +02:00
Ray
a5beb940f8 Remove trailing spaces 2021-08-16 23:23:16 +02:00
Ray
f3385b6ad2 Update rlgl.h 2021-08-16 19:52:57 +02:00
Ray
ef8526ae36 Update rlgl.h 2021-08-16 19:26:10 +02:00
Ray
92a13878dc Add some comments 2021-08-16 19:23:06 +02:00
Ray
1b4c58b66f WARNING: BREAKING: Use frameCount on audio
This is a big change for optimization and a more professional understanding of audio. Instead of dealing with samples, now we deal with frames, like miniaudio does, so, avoiding continuous conversions from samples to frames.
2021-08-16 11:06:31 +02:00
Dennis E. Hamilton
e203fb58c6 Match build-windows.bat changes (#1923)
The location for manual setting of the vcvarsall.bat location moved to line 38 in the latest change.
2021-08-16 09:53:14 +02:00
raysan5
462e7aec52 Updated RAYLIB_VERSION to 4.0-dev
Several breaking changes have been done lately so I think it's better to mark raylib for next release as 4.0.
2021-08-15 13:25:14 +02:00
raysan5
aae60e1e44 REVIEWED: extern "C" definition position for consistency
Note that `extern "C"` calling convention only affects objects that need to be seen by the linker, in our case only functions... but it would also be required by global variables exposed, if any.
2021-08-15 13:02:53 +02:00
raysan5
848cdb267a Support C++ usage as standalone library 2021-08-15 12:58:34 +02:00
raysan5
760cfd361e REVIEWED: PHYSACDEF definition and C++ issues #1918 2021-08-15 12:52:12 +02:00
630Studios
092435d51c [Models] Fix for issue #1809 (#1917)
* GenMeshTangents Fix

* GenMeshTangents Fix - Comment Update

* GenMeshTangents Fix - Comment Update final

* Code Style Changes

* Code Style Changes Final

* Code Style Changes Final 2

* GenMeshTangents better handling for issue #1876

* GenMeshTangents better handling for issue #1876

* GenMeshTangents: Better fix for issue #1876

* vboId location fix

* rlUpdateVertexBuffer - bufferId is an unsigned int

* Fix for issue#1809 - Obj with more materials then mesh caused crash

* Fix for issue#1809 - Formatting Update
2021-08-12 21:01:40 +02:00
raysan5
1dff5814be ADDED: rlUpdateVertexBufferElements() #1915 2021-08-12 21:01:09 +02:00
raysan5
26db391576 ADDED: rlActiveDrawBuffers() #1911
- ADDED: rlEnableColorBlend()/rlDisableColorBlend()
2021-08-12 20:38:57 +02:00
630Studios
ce3214b82d [rlgl] rlUpdateVertexBuffer (#1914)
* GenMeshTangents Fix

* GenMeshTangents Fix - Comment Update

* GenMeshTangents Fix - Comment Update final

* Code Style Changes

* Code Style Changes Final

* Code Style Changes Final 2

* GenMeshTangents better handling for issue #1876

* GenMeshTangents better handling for issue #1876

* GenMeshTangents: Better fix for issue #1876

* vboId location fix

* rlUpdateVertexBuffer - bufferId is an unsigned int
2021-08-12 09:47:00 +02:00
raysan5
621a8766a8 WARNING: BREAKING: Renamed CharInfo to GlyphInfo and more...
This commit introduces some breaking changes for library consistency, hopefully not too dramatic... Here the full list:
 - RENAMED: struct `CharInfo` to `GlyphInfo`, actually that's the correct naming for the data contained. It contains the character glyph metrics and the glyph image; in the past it also contained rectangle within the font atlas but that data has been moved to `Font` struct directly, so, `GlyphInfo` is a more correct name.
 - RENAMED: `CodepointToUtf8()` to `CodepointToUTF8()`, capitalization of UTF-8 is the correct form, it would also require de hyphen but it can be omitted in this case.
 - RENAMED: `TextToUtf8()` to `TextCodepointsToUTF8` for consistency and more detail on the functionality.
 - ADDED: `GetGlyphInfo()` to get glyph info for a specific codepoint
 - ADDED: `GetGlyphAtlasRec()` to get glyph rectangle within the generated font atlas
 - Some additional tweaks for consistency
2021-08-11 21:16:39 +02:00
raysan5
b6541b7a55 REVIEWED: DrawTextPro()
WARNING: DrawTextPro() requires including `rlgl.h`, before it was only dependant on `textures` module.
2021-08-11 19:02:15 +02:00
raysan5
7e27c2ffa8 TODO: DrawTextPro() rotation not working? 2021-08-11 18:53:06 +02:00
raysan5
b55418effd ADDED: DrawTextPro() with text rotation support 2021-08-11 18:31:56 +02:00
raysan5
5a259fa10f WARNING: REMOVED: DrawTextRec() and DrawTextRecEx()
- DrawTextRec() and DrawTextRecEx() have been moved to example, those functions could be very specific depending on user needs so it's better to give the user the full source in case of special requirements instead of allowing a function with +10 input parameters.
2021-08-11 18:31:32 +02:00
Tommi Sinivuo
0ba49cce45 Add *.so.* to .gitignore to ignore build artifacts (#1912)
When building a shared Raylib library on Linux, the build process
produces 3 files: libraylib.so (symlink), libraylib.so.381 (symlink)
and libraylib.so.3.8.1 (the library).

Only the first one of these (.so) is currently ignored by Git.
Adding *.so.* to .gitinore makes Git ignore the rest of them as
well.
2021-08-11 11:56:05 +02:00
raysan5
b54422c970 Merge branch 'master' of https://github.com/raysan5/raylib 2021-08-10 21:32:29 +02:00
Ryan Roden-Corrent
ef9fdd0fa5 Document Get{Key,Char}Pressed return value. (#1909)
I think it is useful to know what the empty behavior is in cases where
you are enumerating key presses (e.g. implementing "press any key to
continue").
2021-08-10 18:38:32 +02:00
raysan5
e3f0a11053 Update CHANGELOG 2021-08-10 17:48:31 +02:00
raysan5
311fe8f35b Replaced TABS by spaces 2021-08-08 21:09:11 +02:00
raysan5
a135d9c25d REVIEWED: Avoid conflict with bool 2021-08-08 13:23:04 +02:00
raysan5
ee72497eef REVIEWED: Some warnings... 2021-08-08 13:02:51 +02:00
raysan5
5e63cd3c97 ADDED: GenMeshCone() #1903 2021-08-08 11:29:24 +02:00
Ryan Roden-Corrent
e6fe8169c2 Fix Makefile to build WASM examples. (#1906)
* Fix Makefile to build WASM examples.

- Add --preload-file flag before specifying the resource dir
- Add empty resource dir to `shapes/` (otherwise wasm-ld will fail)
- Add wasm outputs to .gitigore

* Delete .gitignore

Co-authored-by: Ray <raysan5@gmail.com>
2021-08-07 23:30:48 +02:00
raysan5
7ca9131fd4 Update rlgl_standalone.c 2021-08-07 11:58:39 +02:00
Ray
07e0b10515 Added rayex, elixir binding 2021-08-07 11:28:35 +02:00
raysan5
aa67903f96 Improve rlgl description 2021-07-31 19:58:30 +02:00
raysan5
5b6d83b533 REVIEWED: rlgl defines for consistency 2021-07-31 19:46:44 +02:00
raysan5
3e75a2109d REVIEWED: rlgl module header info 2021-07-31 19:08:13 +02:00
raysan5
7013e60926 Update models_rlgl_solar_system.c 2021-07-31 18:44:07 +02:00
raysan5
559f1919c6 REVIEWED: Improved font loading info 2021-07-31 18:41:44 +02:00
raysan5
73c8ddc8bf REVIEWED: raylib_opengl_interop 2021-07-31 18:36:06 +02:00
raysan5
b805754aa1 REVIEWED: Avoid bool type collisions 2021-07-31 18:10:26 +02:00
raysan5
0f8cfd6031 Update rlgl_standalone.c 2021-07-30 13:52:00 +02:00
raysan5
dffd1435e9 Revert "REVIEWED: Avoid UBSAN warnings #1891"
This reverts commit a8e9e1387f.
2021-07-30 13:50:33 +02:00
raysan5
a8e9e1387f REVIEWED: Avoid UBSAN warnings #1891 2021-07-30 13:47:21 +02:00
raysan5
1613057881 Update raudio.c 2021-07-30 13:45:01 +02:00
raysan5
b4fddf146b REVIEWED: Added new mechanism to avoid data types collision between modules that share same data types and can be used in standalone mode 2021-07-30 13:44:52 +02:00
raysan5
aeb1a0da84 REVERTED: Removed the need for rlMatrix
Now rlgl uses the `Matrix` type, just make sure it has been previously defined somewhere... I don't like this approach but it's probably the easier one for the users... still looking for a better solution... maybe using something like
`#define MATRIX_TYPE`, so it can be checked in other modules.
2021-07-30 12:54:54 +02:00
raysan5
71373ee524 Update Makefile 2021-07-30 12:48:09 +02:00
raysan5
1cc25d1a2d Review include path that was breaking the build 2021-07-30 12:14:31 +02:00
raysan5
bd70a22412 Review some issues 2021-07-30 11:56:14 +02:00
raysan5
8b7f43f89b WARNING: BREAKING CHANGE: rlgl complete decoupling from raylib -WIP-
rlgl has been redesigned to avoid any dependency to `raylib` or `raymath`, all functions using some of those libs have been reviewed.
 - REMOVED: `Texture2D`, `Shader` structs dependency
 - REMOVED: `Vector3`, `Matrix` structs dependency
 - REMOVED: raymath functions dependency, all required math is implemented in rlgl
 - ADDED: `rlMatrix` custom rlgl type
 - ADDED: `utils.c`: `rlMatrixFromMatrix()` and `rlMatrixToMatrix()` for a safe conversion between raylib<->rlgl matrix types
 - ADDED: `rl` prefix to all `rlgl` structs
 - Other small tweaks here and there
2021-07-29 21:57:50 +02:00
raysan5
58e9a0894f Reviewed some functions to avoid calling other functions 2021-07-29 21:50:50 +02:00
iskolbin
6ef3ab3d3a impoves raylib_parser: makes it generic, adds -d key for functions define (RLAPI for raylib.h), increases maxiumum number of fields in structs and values in enums, doubles max length of struct field names; split float3/float16 struct typedefs in raymath to allow parser to process the file (#1901) 2021-07-29 20:37:44 +02:00
raysan5
a9f6ff6fe3 Add external folder to build (just in case) 2021-07-29 20:32:30 +02:00
Ray
cd1464390c Update CONVENTIONS.md 2021-07-29 12:11:12 +02:00
Kyle Appelgate
d8ca13f4c6 fixed DisableCursor() on web by registering an empty mouse click event function in emscripten (#1900) 2021-07-28 21:38:31 +02:00
raysan5
8fecf45f4c REVIEWED: rnet include from extras 2021-07-28 19:48:20 +02:00
raysan5
96aadec503 REVIEWED: Info on image loading failure 2021-07-28 19:47:53 +02:00
raysan5
c219fc02cd Review includes to use extras libraries 2021-07-28 17:29:49 +02:00
raysan5
75d675ab4d Review physac.h path 2021-07-28 17:21:34 +02:00
raysan5
69a82c7a0d ADDED: raygui to extras libraries for convenience 2021-07-28 13:15:43 +02:00
raysan5
0c3902b543 ADDED: GetModelBoundingBox()
Reorganized models functionality, it still needs some review...
2021-07-28 13:15:10 +02:00
raysan5
7c7ee1cdc8 REVERTED: Mesh indices issue #1891 2021-07-28 13:12:16 +02:00
raysan5
0c17d1e14f Minor formatting tweak 2021-07-28 12:58:43 +02:00
raysan5
0352aa2094 Replace TABS by 4 spaces 2021-07-28 12:55:38 +02:00
raysan5
a9230a6c07 Update shapes_logo_raylib_anim.c 2021-07-28 12:50:18 +02:00
Jeffery Myers
c706b33b30 Don't normalize zero length vectors. (#1896) 2021-07-28 08:59:39 +02:00
raysan5
e9c7ab925f REVIEWED: rlDrawVertexArrayElements() #1891 2021-07-27 23:35:54 +02:00
raysan5
70ed52dd5d REVIEWED: QuaternionFromAxisAngle() #1892 2021-07-27 23:30:08 +02:00
Uneven Prankster
4e363b5479 Remove unused UWP defines (#1894)
* Unused UWP define removal

* Further removal of unusued UWP defines
2021-07-26 17:40:10 +02:00
AKDev
9839ea6667 Added another raylib binding for nelua (#1890) 2021-07-25 19:45:04 +02:00
Níckolas Daniel da Silva
87b542085b Update SPONSORS.md (#1886) 2021-07-24 19:55:21 +02:00
Ray
647b54a2dc Update BINDINGS.md 2021-07-23 23:38:44 +02:00
Jeffery Myers
548961aea1 State that raylib works with both C and C++ and move raylib-cpp to a wrapper section instead of a language binding, for less confusion. (#1885)
Co-authored-by: Jeffery Myers <JefMyers@blizzard.com>
2021-07-23 23:33:32 +02:00
Ray
00911b0842 Reviewed ImageDrawLine() formating 2021-07-23 23:32:20 +02:00
Alexander Buhl
ff2b8d6db1 Fixes #1873 Implemented remaining 7/8 of ImageDrawLine (#1874)
* Implemented remaining 7/8 of ImageDrawLine

The existing code was correct for one octant, it now works for all 8
Added two internal functions, _ImageDrawLineHorizontal and _ImageDrawLineVertical, whithout which it would've been 4 times as much code.

* ImageDrawLine: Replaced 3 functions with 1

Removed both freshly added internal functions
Crammed it all into one

* ImageDrawLine shortened significantly using maths

Substituted X and Y, then wrote one abstract loop instead of 4 specific loops.
Lots of comments to explain what I'm doing for future maintainers.

* Now conforms with style conventions

Also reworded a comment to sound more... fomal.
2021-07-23 23:17:04 +02:00
Ray
0fa295c72d Review formating to follow raylib style conventions 2021-07-23 18:16:08 +02:00
Luiz Pestana
4a01139c8d Ignore generated example binaries (#1884) 2021-07-23 18:04:09 +02:00
GoldenThumbs
64e786fe28 Add example shaders_shapes_outline.c (#1883) 2021-07-18 23:45:13 +02:00
Luiz Pestana
5c76c33d7d Raspberry RPI/DRM keyboard fix (#1879)
Legacy keyboard support was blocking the render loop, also it was keeping the last key status until the next key.
2021-07-17 20:27:48 +02:00
630Studios
53bb87c8fb [Models] Better Fix for GenMeshTangents issue #1876 (#1878)
* GenMeshTangents Fix

* GenMeshTangents Fix - Comment Update

* GenMeshTangents Fix - Comment Update final

* Code Style Changes

* Code Style Changes Final

* Code Style Changes Final 2

* GenMeshTangents better handling for issue #1876

* GenMeshTangents better handling for issue #1876

* GenMeshTangents: Better fix for issue #1876

* vboId location fix
2021-07-17 01:33:49 +02:00
630Studios
9aaf7a8057 GenMeshTangents Fix (#1877)
* GenMeshTangents Fix

* GenMeshTangents Fix - Comment Update

* GenMeshTangents Fix - Comment Update final

* Code Style Changes

* Code Style Changes Final
2021-07-16 22:14:13 +02:00
raysan5
56cab4b6a9 REVIEWED: shaders_basic_lighting #1865
Simplified the example
2021-07-16 17:18:32 +02:00
raysan5
c4804c4c0c REVIEWED: Wrong normal matrix calculation #1870 2021-07-16 17:12:22 +02:00
raysan5
8809ae66c6 REVIEWED: Possible memory leak 2021-07-16 16:11:22 +02:00
raysan5
85dc2cc03a Minor format tweaks 2021-07-16 16:10:53 +02:00
raysan5
db4cfc9fbd Reviewed resources licenses 2021-07-16 16:10:35 +02:00
raysan5
7d2845a661 Improve assets license information 2021-07-16 14:29:20 +02:00
raysan5
30a3dae8a6 Update texel_checker.png 2021-07-16 14:27:56 +02:00
GoldenThumbs
59acb6dbea Updated models.c (#1871)
- fixed issue where vertex positions being passed in place of vertex normals.
2021-07-13 12:18:52 +02:00
Humberto Yeverino Jr
8277597bcf Fix Android multi-touch (#1869) 2021-07-13 12:17:47 +02:00
Daniel Nagy
8a46b5e6c0 Use 60 FPS for textures_image_loading example (#1867) 2021-07-11 18:47:31 +02:00
raysan5
ae230dae46 Update Makefile 2021-07-09 18:49:36 +02:00
raysan5
7062415aec WARNING on emscripten_set_fullscreenchange_callback() 2021-07-09 18:49:29 +02:00
raysan5
5ed814e950 Minor tweaks and comments 2021-07-09 17:36:20 +02:00
Tobias Mock
2156cd4a84 Update raylib-ocaml to 3.7 (#1864) 2021-07-09 00:00:53 +02:00
Ray
3a74534c39 Added a note 2021-07-07 21:41:45 +02:00
raysan5
4d438ed68d REVIEWED: RPI: Keyboard stdin input #1769 2021-07-06 18:25:00 +02:00
raysan5
bfff2c432c Minor tweaks on DRM system 2021-07-06 17:16:50 +02:00
raysan5
bcf3ad87e8 Update raylib.vcxproj 2021-07-05 20:00:53 +02:00
raysan5
a958cebdd9 Update audio_raw_stream.c 2021-07-05 19:47:50 +02:00
raysan5
e6aa713a37 REVIEWED: Need to set default buffer size for raw data #1770
This design should probably be changed...
2021-07-05 19:45:57 +02:00
Richard Smith
e18aad0653 Update BINDINGS.md (#1862) 2021-07-05 19:03:53 +02:00
raysan5
9aedfbec69 Review formatting 2021-07-05 18:45:17 +02:00
raysan5
c0ca8a74bc WARNING: BREAKING: REMOVED PLATFORM_UWP support
After lot of investigation, I'm afraid I'm removing official UWP support from raylib, I'll keep the current implementation in a separate branch (UWP), just in case. It seems Microsoft is trying to replace UWP in the long term, they announced lack of support for the new WinUI 3 and they seem to be moving to Windows App SDK.

Also, on current implementation, the code is divided between raylib and the example, requiring multiple callback hooks, making it difficult to follow and maintain.

And realistically speaking, raylib is probably not the best option for anyone willing to target UWP, neither Xbox consoles.
2021-07-05 12:34:23 +02:00
Ray
63b1860010 Update README.md 2021-07-05 11:52:50 +02:00
Ray
0c78b8d182 Update README.md 2021-07-05 11:52:31 +02:00
Ray
4e79e23a20 Update README.md 2021-07-05 11:52:13 +02:00
raysan5
dbb2bbf207 REMOVED: VS2017 project, outdated
This project has been superseded by VS2019 with a better configuration and more complete solution, including more examples
2021-07-04 20:58:18 +02:00
raysan5
64916ba232 REMOVED: Old VSCode project
It would be nice that TCC option was integrated in main VSCode project
2021-07-04 20:55:39 +02:00
Ray
8a7812f1f5 Update README.md 2021-07-04 20:51:57 +02:00
raysan5
d432d03aea REVIEWED: Infinite loop on closing #1861 2021-07-04 20:29:20 +02:00
raysan5
c15d08d6ec Review some comments 2021-07-03 21:48:35 +02:00
raysan5
f8753bda01 Update core.c 2021-07-03 21:31:52 +02:00
raysan5
652b17d68d Review variables initialization 2021-07-03 21:25:30 +02:00
raysan5
efba81442a Update link address for miniaudio 2021-07-03 21:25:05 +02:00
raysan5
1aec0a90bc Merge branch 'master' of https://github.com/raysan5/raylib 2021-07-01 21:43:24 +02:00
raysan5
f81dfce19f Minor tweaks 2021-07-01 21:43:13 +02:00
Calvin Day
2a70638e26 Added Raylib-J (#1860) 2021-07-01 20:30:22 +02:00
raysan5
1fe137db44 Create core_basic_screen_manager.png 2021-06-30 18:54:36 +02:00
raysan5
fe8dad48e2 ADDED: EXAMPLE: core_basic_screen_manager 2021-06-30 18:53:55 +02:00
raysan5
2cda1502a3 WARNING: REMOVED: Game templates
It's seems noone has ever used them
2021-06-30 18:38:39 +02:00
raysan5
a6728a2203 REVIEWED: emscripten versions 2021-06-30 17:12:58 +02:00
raysan5
9e7ca41f58 Remove trailing spaces 2021-06-30 16:39:07 +02:00
raysan5
0776f1e106 Merge branch 'master' of https://github.com/raysan5/raylib 2021-06-30 16:38:39 +02:00
raysan5
de4611ecf6 REVIEWED: Advance template 2021-06-30 16:38:23 +02:00
masterex1000
ee24d17895 Fix DecompressData() pointer issue (#1856) 2021-06-29 23:06:09 +02:00
raysan5
da8d76d826 Review issue with pointer #1854 2021-06-29 11:26:34 +02:00
raysan5
6f30a19dd7 Update uwp_events.h 2021-06-28 14:23:55 +02:00
raysan5
2911cf2a48 Reviewed comments 2021-06-28 14:23:45 +02:00
Ray
e5cf3f9555 WARNING: BREAKING: Functions renamed for consistency
RENAMED: GetTextureData() -> LoadImageFromTexture()
RENAMED: GetScreenData() -> LoadImageFromScreen()
2021-06-28 09:39:31 +02:00
raysan5
5f03201616 Minor tweaks 2021-06-26 22:43:20 +02:00
raysan5
8eb7cf1fee REVIEWED: Enum values descriptions 2021-06-26 22:13:45 +02:00
raysan5
0624af09fd Update raygui.h 2021-06-26 21:11:34 +02:00
raysan5
2f75657350 WARNING: REMOVED: Some deprecated function names mapping
Some functions/values have been deprecated for long time but some mapping was kept for convenience. Some of those mappings have been removed...
2021-06-26 21:07:00 +02:00
Ray
00c8795385 Minor tweaks to follow code conventions 2021-06-26 13:45:39 +02:00
Ray
89708edf7f REVIEWED: Latest PR to follow raylib code conventions 2021-06-26 13:45:15 +02:00
Hristo Stamenov
71700254b4 Major revamp gltf (#1849)
* Added my own model and license to Raylib exclusively created by me and provided for use in the examples (and other projects if anyone decides to)

* Use animation vertices on initial load if possible.

* Added girl model to model example

* Revamped GLTF model loading as it was wrong by default. Also updated some comments.

GLTF models were loaded only by mesh but they should be loaded recursively by hierarchical nodes because tehre are some static node transformations that are to be applied to the vertices. It also resulted in more meshes being included in some models.

It is the correct way of loading GLTF and what is suggested in the official examples.

Currenlty limiting to only one scene but more can be included later.

* Refactored the new names and structure of extracted functions.

* Safer and easier read value.

* Made reading easier for accessor->bufferView->buffer in GLTF.

Now there is no need to check for supported types or anything.

* Correct inclusion of limits.h in the cases of MSVC based compilers vs the world

* Removed weird example file
2021-06-26 13:22:00 +02:00
Ray
aa86e9d399 REVIEWED: Minor tweaks on log messages 2021-06-26 13:18:39 +02:00
Ray
4b6e6ce20e REVIEWED: Improved log info on image/textures laoding
ADDED: rlGetPixelFormatName()
2021-06-26 13:07:14 +02:00
Ray
7cbfca8bd1 REVIEWED: Simplified code to avoid extra functions calls 2021-06-26 13:06:22 +02:00
Ray
e0720a0a55 WARNING: REVIEWED: Default shader uniform names
When a shader is loaded, by default, several locations are tried to be set automatically.
2021-06-25 13:35:43 +02:00
Ray
d4c03b47ec REVIEWED: LoadShader() and default locations
Reviewed locations descriptions
2021-06-25 00:46:14 +02:00
Ray
a226e11aac Update CONVENTIONS.md 2021-06-24 19:03:05 +02:00
Ray
d3d362090c Update CONVENTIONS.md 2021-06-24 18:59:09 +02:00
Ruminant
f3eff740ce fix to LoadShaderFromMemory (#1851)
- the shader.locs now match the LoadShader function

Without this change, the lighting sample looks incorrect when
using LoadShaderFromMemory

Co-authored-by: Ruminant <psp5150+git@gmail.com>
2021-06-24 18:48:48 +02:00
Ray
f4c171aa45 Create CONVENTIONS.md 2021-06-24 18:48:08 +02:00
Ray
953882e86f REVIEWED: CORE.Storage.basePath
Simplified some code
2021-06-24 18:13:25 +02:00
Ray
46ad7b87e8 Update text.c 2021-06-24 18:11:48 +02:00
Ray
4e9afac2a5 REVIEWED: WaitTime() #1841
Avoid global variables dependency, now the function is self-contained.
2021-06-24 11:01:44 +02:00
Ray
2cce5a24c9 Merge branch 'master' of https://github.com/raysan5/raylib 2021-06-24 10:39:56 +02:00
Ray
43efe92e21 Update core_basic_window.c 2021-06-24 10:39:43 +02:00
Nikhilesh S
f7a6b94f46 Allow SetWindowSize() on web (#1847) 2021-06-23 10:02:18 +02:00
Ray
7203acdef9 Minor format tweaks 2021-06-23 09:59:11 +02:00
Ray
3db26f82ea WARNING: BREAKING: Functions renamed!
RENAMED: GetCodepoints() -> LoadCodepoints(), now codepoint array data is loaded dynamically instead of reusing a limited static buffer.
ADDED: UnloadCodepoints() to safely free loaded codepoints
RENAMED: GetNextCodepoint() -> GetCodepoint()
2021-06-23 09:58:49 +02:00
Ray
716e26aa37 Review BeginTextureMode() usage
Moved outside BeginDrawing()/EndDrawing() to illustrate drawing is happening to an external texture (not screen)
2021-06-23 01:25:09 +02:00
Ray
f989048bda Reviewed example 2021-06-23 01:16:21 +02:00
Ray
49d2897b24 Update core_custom_frame_control.c 2021-06-22 21:24:15 +02:00
Ray
6f60622619 ADDED: Example: core_custom_frame_control 2021-06-22 21:20:14 +02:00
Ray
429c5a9a9a Review and un-expose InitTimer()
Actually it's not required for SUPPORT_CUSTOM_FRAME_CONTROL
2021-06-22 20:26:59 +02:00
Ray
7f2a071c51 Formatting review 2021-06-22 20:14:44 +02:00
Ray
2efb50cc63 Update .gitignore 2021-06-22 20:01:57 +02:00
Sky
9095dd9e82 Add support for resizing Emscripten canvas (#1840) 2021-06-22 18:25:52 +02:00
Diesirae
30a0f6f292 Fix DrawTextRec (#1843)
* fix text wrapping

* fix indent

* fix indent

* fix indent

* fix DrawTextRec
2021-06-22 18:16:04 +02:00
Guillaume DEVOILLE
52f1c7df6d Fix missing fclose in tinyobj loader (#1842)
Missing fclose in tinyobj loader.
2021-06-22 18:12:42 +02:00
FSasquatch
906c7f591e Added hxRaylib (#1846) 2021-06-22 18:07:47 +02:00
Ray
115cc7dede Review GetFPS() 2021-06-21 00:46:30 +02:00
Adrian Guerrero Vera
96d5dd24aa core: added GetMouseDelta() (#1832)
* core: added `GetMouseDelta()`

Thanks to previousPosition added by raysan it is now possible to create the GetMouseDelta() function.

Returns a Vector2 with the difference between the current and previous position of the mouse in a frame.

Useful for creating camera scrolling, among others.

* Added changes noted by raysan
2021-06-21 00:11:27 +02:00
raysan5
28093c46a8 Disable SUPPORT_EVENTS_AUTOMATION by default 2021-06-19 19:54:36 +02:00
PtitLuca
c37f776e87 fix: change relevant occurences of MeshBoundingBox to GetMeshBoundingBox (#1836) 2021-06-18 13:11:10 +02:00
Ray
1dd9fbae94 Merge branch 'master' of https://github.com/raysan5/raylib 2021-06-17 18:18:26 +02:00
Ray
8be5ec2288 Avoid SUPPORT_MOUSE_CURSOR_POINT 2021-06-17 18:18:16 +02:00
Sirvoid
1a420b77e3 Fixed: Binding vertex position twice (#1835) 2021-06-17 15:42:37 +02:00
Ray
0e65e5877f Update rlgl_standalone.c 2021-06-17 12:54:05 +02:00
Ray
e07054d0d4 RENAMED: SwapBuffers() -> SwapScreenBuffer()
Avoid possible symbol collisions
2021-06-17 12:47:03 +02:00
Ray
b733e76c86 Update physac.h 2021-06-17 12:26:33 +02:00
Ray
19b71f5f13 WARNING: Exposed SUPPORT_CUSTOM_FRAME_CONTROL #1729 2021-06-17 12:17:50 +02:00
Ray
ab032919df RENAMED: Wait() -> WaitTime() 2021-06-17 11:47:05 +02:00
Ray
68e408474d Renamed SUPPORT_MOUSE_CURSOR_NATIVE -> SUPPORT_MOUSE_CURSOR_POINT 2021-06-17 11:17:39 +02:00
Ray
942657fc7c Remove Color struct requirement 2021-06-17 00:28:51 +02:00
Ray
4decbb2586 RENAMED: MeshTangents() -> GenMeshTangents()
RENAMED: MeshBinormals() -> GenMeshBinormals()
2021-06-17 00:04:24 +02:00
Ray
f3d38018cd Comment tweak 2021-06-17 00:03:24 +02:00
Ray
3ae40c35e6 Update examples_template.c 2021-06-16 14:09:28 +02:00
Ray
4b93feb172 Remove trail spaces 2021-06-13 17:08:30 +02:00
Ray
d875891a3c Improved raylib parser to export data as XML
- Improved command-line
 - Added XML support
 - Added sample outputs: DEFAULT, JSON, XML
 - Reviewed LoadFileText() bug
 - Removed trailing spaces
2021-06-13 16:34:51 +02:00
Ray
3e68059556 Merge branch 'master' of https://github.com/raysan5/raylib 2021-06-13 12:08:44 +02:00
Ray
213c990eda Reviewed issue 2021-06-13 12:08:32 +02:00
Tobias Mock
929fa5780d Add nullptr check before passing arg (#1825) 2021-06-13 11:52:24 +02:00
Richard Smith
7d03048f1d updating raylib python cffi version (#1826)
* Update BINDINGS.md

* Update BINDINGS.md
2021-06-12 23:46:21 +02:00
FSasquatch
ae9cea03f0 Changed windows-build to build-windows (#1822) 2021-06-12 18:23:56 +02:00
Ray
de7b8ad551 NEW CRAZY FEATURE: EVENTS AUTOMATION!
https://youtu.be/3dZenkpmRzM
2021-06-11 12:27:46 +02:00
Francisco Javier Andrés Casas Barrientos
4dd5643402 Added missing null terminator (#1820)
Added missing null terminator when adding characters to the string, otherwise garbage values are read (often zeros which are equal to '\0', but not every time).

This error results in random characters appearing in the text box every one in a while:
```
asdfg??? ll??
```
It is corrected with the proposed fix.

This problem was observed by my student, Gonzalo Rivera Lazo.
2021-06-10 20:24:08 +02:00
Ray
0b8e0f05a7 Register mouse previous position 2021-06-10 18:03:25 +02:00
Ray
b188008a1c Review code formatting 2021-06-10 18:00:44 +02:00
Ray
7bc2e922c9 Review some comments 2021-06-10 17:49:55 +02:00
Ray
b0dcdf688f Reviewed functions description
Replaced: Returns -> Get
2021-06-10 17:43:58 +02:00
Ray
d3387c952a Reviewed Input variables and comments 2021-06-10 17:11:31 +02:00
Ray
3643974949 Corrected bug on enum 2021-06-10 11:38:02 +02:00
Ray
8980bcfe4b Added some enum comments 2021-06-10 11:31:34 +02:00
Hristo Stamenov
e1babab3cc There no longer is a library glfw_objlib and now it is only glfw. (#1818) 2021-06-09 09:49:13 +02:00
Ray
97b074ac26 Update GLFW to latest version #1817 2021-06-08 21:02:24 +02:00
Ray
76a907bb79 Remove tabs 2021-06-08 21:01:17 +02:00
Deathbat2190
9681a072d0 Fix parsing multiple struct fields defined in one line (#1813) 2021-06-06 13:22:42 +02:00
Rob Loach
32f3f53718 parser: Add JSON support with --json (#1812) 2021-06-06 10:21:56 +02:00
raysan5
246798a0ba Update Makefile 2021-06-05 20:15:03 +02:00
Ray
88a8395b8e Added raylib_oding_bindings 2021-06-05 14:02:06 +02:00
raysan5
e95d8bc655 Minor format tweaks 2021-06-05 12:33:05 +02:00
raysan5
6445200a93 Removed GetAudioStreamBufferSizeDefault() 2021-06-05 12:32:52 +02:00
Ray
e00d2439b9 WARNING: BREAKING: Consistency renamings
RENAMED: InitAudioStream() -> LoadAudioStream()
RENAMED: CloseAudioStream() -> UnloadAudioStream()
2021-06-03 23:36:47 +02:00
Ray
7e68e733f5 Update models_material_pbr.c 2021-06-03 21:04:23 +02:00
Ray
0565fb9fb6 Update models_mesh_picking.c 2021-06-03 20:58:04 +02:00
Ray
121c689b78 Review code formatting 2021-06-03 20:25:28 +02:00
Crydsch
edeaff4bd4 Better collisions (#1803)
* review collisions ray-box and ray-sphere

* Applied raysan's refactor
Improved GetRayCollisionBox

* Replace GetRayCollisionGround with GetCollisionQuad

* Update example core_3d_picking

* Update example models_loading

* Fixed issues after merge

* remove debug stuff

Co-authored-by: Cry dsch <chris.obo@gmx.net>
2021-06-03 20:15:27 +02:00
Ray
2370af598e Reviewed example: core_split_screen 2021-06-03 19:35:36 +02:00
Jeffery Myers
deaa84d28d Add a split screen example showing render texture use and multiple cameras. (#1806)
Co-authored-by: Jeffery Myers <JefMyers@blizzard.com>
2021-06-03 19:09:43 +02:00
Deathbat2190
2efb5a36ca Small parser bugfix (#1805) 2021-06-02 20:47:37 +02:00
isaac553876299
d1ac38171c Update raymath.h (#1802) 2021-06-01 17:00:40 +02:00
Marco G. Maia
1a7dace57e Update docs for supported blend modes (#1801) 2021-06-01 15:00:19 +02:00
Ray
0870295a7c RENAMED: enum Gestures -> Gesture
Consistency tweak
2021-05-31 20:40:27 +02:00
Ray
5e3cf28642 Update raudio.c 2021-05-31 19:32:48 +02:00
Ray
23398f0198 Update Makefile 2021-05-31 19:02:26 +02:00
Ray
e991fefb89 Update Makefile 2021-05-31 18:51:56 +02:00
Ray
d39d26f275 Update models_loading.c 2021-05-31 18:36:03 +02:00
Ray
9cc2cee936 Update text_draw_3d.c 2021-05-31 18:32:35 +02:00
Ray
b359a1575e Update core_3d_picking.c 2021-05-31 18:27:53 +02:00
Ray
8f4261e9d4 Remove unused declarations 2021-05-31 12:58:49 +02:00
Ray
565319184c Reviewed struct field name 2021-05-31 12:37:03 +02:00
Ray
2760304d66 Update CMakeLists.txt 2021-05-31 12:27:26 +02:00
Ray
9bd3d78374 WARNING: Moved some **extra** raylib libraries to /extras/ directory 2021-05-31 11:43:56 +02:00
Ray
1c5de9721a WARNING: BREAKING: RENAMED: RayHitInfo to RayCollision #1781
- RENAMED: RayHitInfo to RayCollision
- RENAMED/REDESIGNED: Multiple Ray collision functions to be more consistent and return RayCollision data -WIP-
2021-05-31 11:41:56 +02:00
Ray
7bcb2ad4f1 Update uwp_events.h 2021-05-31 11:39:20 +02:00
Ray
89e734de6b Review config flags #1784 2021-05-30 22:31:14 +02:00
Julianiolo
cc4de1d1f9 note (#1797) 2021-05-30 18:33:38 +02:00
Ray
71995d52b3 REVIEWED: exit() on LOG_FATAL instead of LOG_ERROR #1796 2021-05-30 18:02:06 +02:00
Ray
a178a2170b Structs tweaks for consistency 2021-05-30 13:34:02 +02:00
Ray
3c1c13b660 ADDED: raylib header parser 2021-05-30 11:51:15 +02:00
Ray
0369ec9adf Some code tweaks 2021-05-30 11:50:32 +02:00
Ray
c828e481fb Review code format 2021-05-29 13:56:08 +02:00
Ray
e3ba11bead Review some comments 2021-05-29 13:54:05 +02:00
Hristo Stamenov
beeac18eb1 Fix QuaternionToMatrix returning transposed result. (#1793) 2021-05-29 13:53:00 +02:00
Hristo Stamenov
470574517a Implement vertex color attribute for GLTF and IQM (#1790)
Added a simple cube with vertex colors for testing both.
2021-05-26 20:23:13 +02:00
Ray
c5ef96272f Merge branch 'master' of https://github.com/raysan5/raylib 2021-05-26 20:21:40 +02:00
Ray
1c7c8c682c REVIEWED: models_skybox #1792 #1778 2021-05-26 20:21:37 +02:00
Milan Nikolic
ded6754de4 Update raylib-go bindings (#1791) 2021-05-26 15:07:42 +02:00
Ray
05aff1e097 Merge branch 'master' of https://github.com/raysan5/raylib 2021-05-25 23:19:06 +02:00
Ray
7959d95db0 Review raylib structs comments 2021-05-25 23:19:03 +02:00
Ben Beshara
6fe0a229e2 Bumped minimum GLFW vers in cmake (#1788) 2021-05-25 12:19:36 +02:00
Ray
9f45fea31e Remove line break in DrawTextRecEx() 2021-05-25 11:59:34 +02:00
DanielG
e5e401c640 Fixed CMake linking on MacOS (#1783)
Added links to IOKit, Cocoa, and OpenGL to the CMake build file for MacOS platforms
2021-05-24 11:05:08 +02:00
Chris
6c874feb7b Update BINDINGS.md (#1782) 2021-05-23 17:52:17 +02:00
Ray
03710c9d8e Some code tweaks for consistency 2021-05-22 16:54:04 +02:00
Ray
cb698dd37d Update Makefile 2021-05-22 16:51:51 +02:00
Ray
b36422083e Remove headers from shaders 2021-05-22 16:09:34 +02:00
Ray
5765b7895c Minor comments tweaks 2021-05-22 14:35:10 +02:00
raysan5
4aa680d6d3 Merge branch 'master' of https://github.com/raysan5/raylib 2021-05-21 22:59:38 +02:00
raysan5
60ca8acd0a Update version to 3.8-dev to note breaking changes
Some breaking changes were introduced lately, it's better to note that current version is not 3.7 anymore...
2021-05-21 22:59:00 +02:00
Bxil
352db3a183 Removes debug information from release builds (#1780) 2021-05-21 21:59:21 +02:00
Ray
4a099c3658 Review ExportImage() to use SaveFileData() #1779 2021-05-20 20:37:46 +02:00
Ray
23a08a483e WARNING: RENAMED: IsMusicPlaying() -> IsMusicStreamPlaying() 2021-05-20 19:27:04 +02:00
Ray
f33cec64aa Use output->boneCount instead of nodes_count 2021-05-20 19:25:09 +02:00
Ray
e401d5c48e WARNING: RENAMED: MeshBoundingBox() -> GetMeshBoundingBox()
Renamed for consistency with other function in raylib.
2021-05-20 19:24:28 +02:00
Ray
9360e4e2c1 Comment minor tweak 2021-05-20 19:14:42 +02:00
Ray
7b6b87ec5b Update VS2019 project: rlgl_standalone 2021-05-20 19:14:20 +02:00
Guillaume DEVOILLE
b90ac7bd31 Fixed over-allocation of buffer (#1772)
output->framePoses[frame] is over-allocated.
framePoses is a 2D array:
- first dimension: frames (allocated l. 4717)
- second dimension: nodes (allocated l. 4731)
Second dimension should be allocated of nodes_count transformations only.
2021-05-15 00:41:33 +02:00
Gianni Alessandroni
a84e98ba6c Hotfix for smooth pixel-perfect camera example [core_2d_camera_smooth_pixelperfect.c] (#1771)
* Hotfix for glitchy camera

Super small fix that was causing the camera to glitch every x amount of seconds/pixels. Works much better now, 3/4 lines changed.

* fixed dumb visual studio formatting problems
2021-05-14 18:06:47 +02:00
Ray
232378ed2d Merge branch 'master' of https://github.com/raysan5/raylib 2021-05-14 14:01:51 +02:00
Ray
3baba7ffe8 Review some VS warnings and messages 2021-05-14 14:01:42 +02:00
Guillaume DEVOILLE
45b0dc63cd Fixed GLTF boneWeights uint32 loading (#1768)
boneWeights uint32 were loaded in normals instead of boneWeights.
2021-05-13 13:58:51 +02:00
Ray
fff06d24da Merge branch 'master' of https://github.com/raysan5/raylib 2021-05-12 19:51:39 +02:00
Ray
6c56fe2670 Update shell.html 2021-05-12 19:51:29 +02:00
Bxil
dbe1c9c6e6 Removes Whole Program Optimization (#1767) 2021-05-12 19:20:27 +02:00
Astie Teddy
d8e1a77da5 Update raylib-lua and raylib-wren binding versions (#1766) 2021-05-12 19:02:13 +02:00
Ray
6bd63de8d0 Reviewed latest PR
REMOVED: DrawBillboardEx()
2021-05-11 01:02:53 +02:00
nobytesgiven
ac204a11f7 Redesigned billboards - added rotation/pro functions (#1759)
* Redesigned billboards - added rotation/pro functions

* updated parameters

Co-authored-by: nobytesgiven <nobytesigiven@github.com>
2021-05-11 00:55:43 +02:00
Gianni Alessandroni
4ab28fffb4 Added smooth pixel-perfect camera example + Small typo fix in examples_template.c (#1760)
* Typo fix

Changed "bsasic" to "basic" in the comments.

* Added pixel-perfect camera example

Added pixel-perfect camera example, both the .c file and the cover .png image. The example works with any resolution you want, as long as the ratio stays the same
(ex. 16:9, 4:3) ecc.

* Fixed Typecasts

Fixed compiler errors (implicit conversions)

* Precomputed rectangles, time-based movement and whitespace fix

Moved the source and destination rectangles for the renderTexture into their own variables, modified the animation to be time-based instead of frame-based, fixed the bug with whitespaces.

* Fixed spacing and added more consistency with sinf() and cosf()

* Fixed *= operator spacing
2021-05-10 20:16:12 +02:00
Lambert Wang
e39e45824d Add RenderPolyLinesEx routine (#1758)
Co-authored-by: Lambert Wang <lambert.ww@gmail.com>
2021-05-10 20:08:58 +02:00
Dmitry Matveyev
5d831f3f18 Update NimraylibNow! - Nim language bindings version to 3.7 (#1764) 2021-05-10 19:43:17 +02:00
ProphesorIks
1d0767022d ~Updated project version (#1761)
Updated to fix versioning and linking issues.
Old version would cause examples to not be linked on fresh raylib install or linked with an old library version on updated raylib install.
2021-05-10 00:51:37 +02:00
Lambert Wang
2545f62565 Added support for additional mouse buttons (#1753)
* Added support for additional mouse buttons

* Renamed mouse button enum

Co-authored-by: Lambert Wang <lambert.ww@gmail.com>
2021-05-08 18:26:24 +02:00
Antonio Jose Ramos Marquez
2565c01158 check for vao extension (#1757) 2021-05-08 18:24:14 +02:00
Jeffery Myers
133e6f097d Convert the half sleep to a sleep that is a fraction of the target FPS (Default 95%) to reduce CPU use. (#1756)
Co-authored-by: Jeffery Myers <JefMyers@blizzard.com>
2021-05-07 19:49:44 +02:00
Ray
b62c86572e REVIEWED: raudio_standalone #1752 2021-05-07 15:38:13 +02:00
Astie Teddy
c82d9cb89a Unset CORE.Window.ready on CloseWindow (#1749)
Window shouldn't be considered ready when CloseWindow has been called.
2021-05-05 19:08:15 +02:00
Rudolf Kemmler
1269ce8a6f modified Makefile.Android.linux in templates/simple_game (#1748)
switched out @echo for @printf to make it actually print newlines instead of literal \n's

Co-authored-by: Rudolf Kemmler <admin@rudolf-kemmler.de>
2021-05-04 22:53:59 +02:00
Ray
a41ed986bd Expose RAYLIB_VERSION in raylib.h #1747 2021-05-04 11:20:47 +02:00
Ray
c4eaf0076d Update raylib version 2021-05-04 11:19:28 +02:00
Ray
e5708a8f36 Comment tweak 2021-05-03 19:05:53 +02:00
Ray
2015828fc6 Security check in case of not valid font 2021-05-03 19:05:43 +02:00
Ray
4c1af4cc90 Update BINDINGS.md 2021-04-30 13:01:25 +02:00
Théo Cavignac
ecc00357b4 Update BINDINGS.md (#1744)
Bump version supported version by raylib-ocaml.
2021-04-29 12:13:28 +02:00
Ray
a3e7664dcf Fixed bug that overrides other flags
This issue prevented enabling MSAA on several platforms
2021-04-29 00:07:28 +02:00
Ray
ffadeeeb84 Decoupling rlgl from platform layer
Now rlgl only depends on OpenGL and it's completely decoupled from platform layer libraries (EGL)
2021-04-28 23:57:46 +02:00
Ray
f516f4099b Corrected issue #1742 2021-04-28 19:27:50 +02:00
Ray
d6708de7b0 Update README.md 2021-04-27 23:55:05 +02:00
Ray
a113d3326b Disable raylib code 2021-04-27 23:12:04 +02:00
Ray
fe607323aa Updated projects 2021-04-27 23:00:49 +02:00
Ray
131672f199 Updated linkage libraries #1732 2021-04-27 22:58:49 +02:00
Rabia Alhaffar
9b6a005819 Updated raylua and raylib-boo to raylib 3.7! (#1741) 2021-04-27 21:08:31 +02:00
Rabia Alhaffar
399894ac90 Fixed definition of UNCOMPRESSED_R8G8B8A8 (#1740) 2021-04-27 20:17:47 +02:00
Ray
89d5b3df44 ADDED: raylib-swift binding 2021-04-27 11:27:31 +02:00
Ray
6ebe76cba7 Minor tweaks 2021-04-27 11:05:05 +02:00
Ray
1aa8a4ff90 REVIEWED: rlLoadExtensions()
On PLATFORM_ANDROID, PLATFORM_RPI, PLATFORM_DRM and PLATFORM_UWP glfwGetProcAddress() is not defines, actually those platforms use egl platform windowing system.
2021-04-27 11:04:48 +02:00
Rob Loach
fcf3a04825 BINDINGS: raylib-cpp targets raylib 3.7.0 (#1739)
https://github.com/RobLoach/raylib-cpp/releases/tag/v3.7.0
2021-04-27 10:31:15 +02:00
Gunko Vadim
5751776a73 Update BINDINGS.md (#1738) 2021-04-26 21:59:34 +02:00
579 changed files with 63918 additions and 54231 deletions

View File

@@ -1,8 +1,18 @@
name: Android name: Android
on: on:
workflow_dispatch:
push: push:
workflow_dispatch:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/android.yml'
pull_request: pull_request:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/android.yml'
release: release:
types: [published] types: [published]
@@ -50,6 +60,9 @@ jobs:
- name: Generate Artifacts - name: Generate Artifacts
run: | run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build cd build

View File

@@ -1,8 +1,23 @@
name: CMakeBuilds name: CMakeBuilds
on: on:
workflow_dispatch:
push: push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/cmake.yml'
- 'CMakeList.txt'
- 'CMakeOptions.txt'
- 'cmake/**'
pull_request: pull_request:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/cmake.yml'
- 'CMakeList.txt'
- 'CMakeOptions.txt'
- 'cmake/**'
env: env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)

View File

@@ -1,8 +1,17 @@
name: Linux name: Linux
on: on:
workflow_dispatch:
push: push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/linux.yml'
pull_request: pull_request:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/linux.yml'
release: release:
types: [published] types: [published]
@@ -55,7 +64,7 @@ jobs:
- name: Build Library - name: Build Library
run: | run: |
cd src cd src
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-m32" make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-m32" -B
# make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B # make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd .. cd ..
if: matrix.bits == 32 if: matrix.bits == 32
@@ -63,7 +72,7 @@ jobs:
- name: Build Library - name: Build Library
run: | run: |
cd src cd src
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd .. cd ..
if: matrix.bits == 64 if: matrix.bits == 64
@@ -71,6 +80,9 @@ jobs:
- name: Generate Artifacts - name: Generate Artifacts
run: | run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build cd build

View File

@@ -1,11 +1,18 @@
name: Linux Examples name: Linux Examples
on: on:
workflow_dispatch:
push: push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/linux_examples.yml'
pull_request: pull_request:
branches: [ master ] branches: [ master ]
paths: paths:
- 'examples/**' - 'src/**'
- 'examples/**'
- '.github/workflows/linux_examples.yml'
jobs: jobs:
build: build:

View File

@@ -1,8 +1,17 @@
name: macOS name: macOS
on: on:
workflow_dispatch:
push: push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/macos.yml'
pull_request: pull_request:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/macos.yml'
release: release:
types: [published] types: [published]
@@ -40,12 +49,12 @@ jobs:
run: | run: |
cd src cd src
clang --version clang --version
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
# lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a libraylib_x86_64.a libraylib_arm64.a # lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a libraylib_x86_64.a libraylib_arm64.a
make clean make clean
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_x86_64 CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
# make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target i686-apple-macos -DGL_SILENCE_DEPRECATION" -B # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_arm64 CFLAGS="-target i686-apple-macos -DGL_SILENCE_DEPRECATION" -B
# lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.3.1.0.dylib libraylib_x86_64.3.1.0.dylib libraylib_arm64.3.1.0.dylib # lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.3.1.0.dylib libraylib_x86_64.3.1.0.dylib libraylib_arm64.3.1.0.dylib
@@ -56,6 +65,9 @@ jobs:
- name: Generate Artifacts - name: Generate Artifacts
run: | run: |
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/extras/raygui.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
cd build cd build

View File

@@ -1,8 +1,17 @@
name: WebAssembly name: WebAssembly
on: on:
workflow_dispatch:
push: push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/webassembly.yml'
pull_request: pull_request:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/webassembly.yml'
release: release:
types: [published] types: [published]
@@ -18,7 +27,7 @@ jobs:
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup emsdk - name: Setup emsdk
uses: mymindstorm/setup-emsdk@v7 uses: mymindstorm/setup-emsdk@v9
with: with:
version: 2.0.0 version: 2.0.0
actions-cache-folder: 'emsdk-cache' actions-cache-folder: 'emsdk-cache'
@@ -43,12 +52,15 @@ jobs:
run: | run: |
cd src cd src
emcc -v emcc -v
make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-master" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" make PLATFORM=PLATFORM_WEB EMSDK_PATH="D:/a/raylib/raylib/emsdk-cache/emsdk-master" RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd .. cd ..
- name: Generate Artifacts - name: Generate Artifacts
run: | run: |
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
copy /Y .\src\extras\raygui.h .\build\${{ env.RELEASE_NAME }}\include\raygui.h
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
cd build cd build

View File

@@ -1,8 +1,17 @@
name: Windows name: Windows
on: on:
workflow_dispatch:
push: push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/windows.yml'
pull_request: pull_request:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/windows.yml'
release: release:
types: [published] types: [published]
@@ -93,6 +102,9 @@ jobs:
- name: Generate Artifacts - name: Generate Artifacts
run: | run: |
copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
copy /Y .\src\extras\raygui.h .\build\${{ env.RELEASE_NAME }}\include\raygui.h
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
cd build cd build

View File

@@ -1,11 +1,18 @@
name: Windows Examples name: Windows Examples
on: on:
workflow_dispatch:
push: push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/windows_examples.yml'
pull_request: pull_request:
branches: [ master ] branches: [ master ]
paths: paths:
- 'examples/**' - 'src/**'
- 'examples/**'
- '.github/workflows/windows_examples.yml'
jobs: jobs:
build: build:

29
.gitignore vendored
View File

@@ -45,6 +45,7 @@ ipch/
*.db *.db
*.opendb *.opendb
packages/ packages/
!examples/models/resources/models/obj/
# Ignore compiled binaries # Ignore compiled binaries
*.o *.o
@@ -52,19 +53,13 @@ packages/
*.a *.a
*.bc *.bc
*.so *.so
*.so.*
# Ignore all examples files # Ignore wasm data in examples/
examples/* examples/**/*.wasm
# Unignore all examples dirs examples/**/*.data
!examples/*/ examples/**/*.js
# Unignore all examples files with extension examples/**/*.html
!examples/*.c
!examples/*.png
# Unignore examples Makefile
!examples/Makefile
!examples/Makefile.Android
!examples/raylib_compile_execute.bat
!examples/raylib_makefile_example.bat
# Ignore files build by xcode # Ignore files build by xcode
*.mode*v* *.mode*v*
@@ -95,10 +90,14 @@ compile_commands.json
CTestTestfile.cmake CTestTestfile.cmake
build build
# Unignore These makefiles...
!examples/CMakeLists.txt
# Ignore GNU global tags # Ignore GNU global tags
GPATH GPATH
GRTAGS GRTAGS
GTAGS GTAGS
# Zig programming language
zig-cache/
zig-out/
build/
build-*/
docgen_tmp/

View File

@@ -1,68 +1,92 @@
## raylib bindings # raylib bindings and wrappers
Some people ported raylib to other languages in form of bindings or wrappers to the library. Some people ported raylib to other languages in form of bindings or wrappers to the library. Here it is alist with all the ports available. Feel free to send a PR if you know of any binding/wrapper not in this list.
Here it is a list with the ones I'm aware of: ### Language Bindings
| name | raylib version | language | repo | | name | raylib version | language | repo |
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------| |:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
| raylib | **3.5** | [C](https://en.wikipedia.org/wiki/C_(programming_language)) | https://github.com/raysan5/raylib | | raylib | **3.7** | [C/C++](https://en.wikipedia.org/wiki/C_(programming_language)) | https://github.com/raysan5/raylib |
| raylib-cpp | 3.5 | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | https://github.com/robloach/raylib-cpp | | Raylib-cs | 3.7 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/ChrisDill/Raylib-cs |
| Raylib-cs | 3.5 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/ChrisDill/Raylib-cs | | raylib-boo | 3.7 | [Boo](http://boo-language.github.io/) | https://github.com/Rabios/raylib-boo |
| raylib-cppsharp | 2.5 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/phxvyper/raylib-cppsharp |
| raylib-boo | 3.5 | [Boo](http://boo-language.github.io/) | https://github.com/Rabios/raylib-boo |
| RaylibFS | 2.5 | [F#](https://fsharp.org/) | https://github.com/dallinbeutler/RaylibFS |
| raylib_d | 2.5 | [D](https://dlang.org/) | https://github.com/Sepheus/raylib_d |
| raylib-d | 3.0 | [D](https://dlang.org/) | https://github.com/onroundit/raylib-d |
| bindbc-raylib | 3.0 | [D](https://dlang.org/) | https://github.com/o3o/bindbc-raylib |
| dray | 3.5 | [D](https://dlang.org/) | https://github.com/xdrie/dray | | dray | 3.5 | [D](https://dlang.org/) | https://github.com/xdrie/dray |
| raylib-go | 3.0 | [Go](https://golang.org/) | https://github.com/gen2brain/raylib-go | | raylib-go | 4.0-dev | [Go](https://golang.org/) | https://github.com/gen2brain/raylib-go |
| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus |
| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go |
| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
| raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs | | raylib-rs | 3.5 | [Rust](https://www.rust-lang.org/) | https://github.com/deltaphc/raylib-rs |
| raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua | | raylib-lua | 3.7 | [Lua](http://www.lua.org/) | https://github.com/TSnake41/raylib-lua |
| raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 | | raylua | 3.7 | [Lua](http://www.lua.org/) | https://github.com/Rabios/raylua |
| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol | | nelua-raylib | 3.7 | [nelua](https://nelua.io/) | https://github.com/AKDev21/nelua-raylib |
| raylib-lua | 3.5 | [Lua](http://www.lua.org/) | https://github.com/TSnake41/raylib-lua | | NimraylibNow! | 3.7 | [Nim](https://nim-lang.org/) | https://github.com/greenfork/nimraylib_now |
| raylib-luamore | 3.0 | [Lua](http://www.lua.org/) | https://github.com/HDPLocust/raylib-luamore | | raylib-Forever | auto | [Nim](https://nim-lang.org/) | https://github.com/Guevara-chan/Raylib-Forever |
| raylua | 3.5 | [Lua](http://www.lua.org/) | https://github.com/Rabios/raylua | | Ray4Laz | 3.7 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/GuvaCode/Ray4Laz |
| LuaJIT-Raylib | 2.6 | [Lua](http://www.lua.org/) | https://github.com/Bambofy/LuaJIT-Raylib | | pyraylib | 3.7 | [Python](https://www.python.org/) | https://github.com/Ho011/pyraylib |
| raylib-nelua | 3.0 | [Nelua](https://nelua.io/) | https://github.com/Andre-LA/raylib-nelua | | raylib-python-cffi | 3.7 | [Python](https://www.python.org/) | https://github.com/electronstudio/raylib-python-cffi |
| raylib-Nim | 1.7 | [Nim](https://nim-lang.org/) | https://gitlab.com/define-private-public/raylib-Nim | | jaylib | 3.7 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/electronstudio/jaylib/ |
| raylib-nim | 2.0 | [Nim](https://nim-lang.org/) | https://github.com/Skrylar/raylib-nim |
| raylib-Forever | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/Guevara-chan/Raylib-Forever |
| nim-raylib | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/tomc1998/nim-raylib |
| NimraylibNow! | 3.5-dev | [Nim](https://nim-lang.org/) | https://github.com/greenfork/nimraylib_now |
| raylib-haskell | 2.0 | [Haskell](https://www.haskell.org/) | https://github.com/DevJac/raylib-haskell |
| raylib-cr | 2.5-dev | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr |
| cray | 1.8 | [Crystal](https://crystal-lang.org/) | https://gitlab.com/Zatherz/cray |
| raylib.cr | 2.0 | [Crystal](https://crystal-lang.org/) | https://github.com/sam0x17/raylib.cr |
| raylib-pascal | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/drezgames/raylib-pascal |
| raylib-pas | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/tazdij/raylib-pas |
| Ray4Laz | 3.5 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/GuvaCode/Ray4Laz |
| Graphics-Raylib | 1.4 | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib |
| raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi |
| raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby |
| raylib-mruby | 2.5-dev | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby |
| raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py |
| raylib-python-cffi | 3.5 | [Python](https://www.python.org/) | https://github.com/electronstudio/raylib-python-cffi |
| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg |
| jaylib | 3.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/electronstudio/jaylib/ |
| raylib-java | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java |
| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
| node-raylib | 3.5 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib | | node-raylib | 3.5 | [Node.js](https://nodejs.org/en/) | https://github.com/RobLoach/node-raylib |
| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |
| raylib-duktape | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-duktape |
| raylib-v7 | 3.5 | [JavaScript (v7)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/Rabios/raylib-v7 | | raylib-v7 | 3.5 | [JavaScript (v7)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/Rabios/raylib-v7 |
| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript |
| raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel |
| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d |
| raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/joseph-montanez/raylib-php | | raylib-php | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/joseph-montanez/raylib-php |
| raylib-php-ffi | 2.4-dev | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-php-ffi |
| raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-phpcpp | | raylib-phpcpp | 3.5 | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-phpcpp |
| raylib-factor | 3.5 | [Factor](https://factorcode.org/) | https://github.com/ArnautDaniel/raylib-factor | | raylib-factor | 3.5 | [Factor](https://factorcode.org/) | https://github.com/ArnautDaniel/raylib-factor |
| gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | https://github.com/ArnautDaniel/gforth-raylib | | gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | https://github.com/ArnautDaniel/gforth-raylib |
| hxRaylib | 3.7 | [Haxe](https://haxe.org/) | https://github.com/ForeignSasquatch/hxRaylib |
| raylib-wren | 3.7 | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren |
| raylib_odin_bindings | 4.0-dev | [Odin](https://odin-lang.org/) | https://github.com/Deathbat2190/raylib_odin_bindings |
| raylib-odin | 3.7| [Odin](https://odin-lang.org/) | https://github.com/odin-lang/Odin/tree/master/vendor/raylib |
| raylib.v | 3.7 | [V](https://vlang.io/) | https://github.com/irishgreencitrus/raylib.v |
| raylib-ocaml | 3.7 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
| raylib-swift | 3.7 | [Swift](https://swift.org/) | https://github.com/STREGAsGate/Raylib |
| hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | https://github.com/RedCubeDev-ByteSpace/Relib |
| rayex | 3.7 | [elixir](https://elixir-lang.org/) | https://github.com/shiryel/rayex |
| kaylib | 3.7 | [Kotlin/native](https://kotlinlang.org) | https://github.com/electronstudio/kaylib |
| dlang_raylib | 3.7 | [D](https://dlang.org) | https://github.com/rc-05/dlang_raylib |
### Utility Wrapers
These are utility wrappers for specific languages, they are not required to use raylib in the language but may adapt the raylib API to be more inline with the language's pardigm.
| name | raylib version | language | repo |
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
| raylib-cpp | 3.7 | [C++](https://en.wikipedia.org/wiki/C%2B%2B) | https://github.com/robloach/raylib-cpp |
### Older or Unmaintained Language Bindings
These are older raylib bindings that are more than 2 versions old or have not been maintained.
| name | raylib version | language | repo |
|:------------------:|:-------------: | :--------:|----------------------------------------------------------------------|
| raylib-cppsharp | 2.5 | [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)) | https://github.com/phxvyper/raylib-cppsharp |
| RaylibFS | 2.5 | [F#](https://fsharp.org/) | https://github.com/dallinbeutler/RaylibFS |
| raylib_d | 2.5 | [D](https://dlang.org/) | https://github.com/Sepheus/raylib_d |
| bindbc-raylib | 3.0 | [D](https://dlang.org/) | https://github.com/o3o/bindbc-raylib |
| go-raylib | 3.5 | [Go](https://golang.org/) | https://github.com/chunqian/go-raylib |
| raylib-goplus | 2.6-dev | [Go](https://golang.org/) | https://github.com/Lachee/raylib-goplus |
| ray-go | 2.6-dev | [Go](https://golang.org/) | https://github.com/hecate-tech/ray-go |
| raylib-luamore | 3.0 | [Lua](http://www.lua.org/) | https://github.com/HDPLocust/raylib-luamore |
| LuaJIT-Raylib | 2.6 | [Lua](http://www.lua.org/) | https://github.com/Bambofy/LuaJIT-Raylib |
| raylib-lua-sol | 2.5 | [Lua](http://www.lua.org/) | https://github.com/RobLoach/raylib-lua-sol |
| raylib-lua-ffi | 2.0 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib/issues/693 |
| raylib-lua | 1.7 | [Lua](http://www.lua.org/) | https://github.com/raysan5/raylib-lua |
| raylib-nelua | 3.0 | [Nelua](https://nelua.io/) | https://github.com/Andre-LA/raylib-nelua |
| raylib-nim | 2.0 | [Nim](https://nim-lang.org/) | https://github.com/Skrylar/raylib-nim |
| raylib-Nim | 1.7 | [Nim](https://nim-lang.org/) | https://gitlab.com/define-private-public/raylib-Nim |
| nim-raylib | 3.1-dev | [Nim](https://nim-lang.org/) | https://github.com/tomc1998/nim-raylib |
| raylib-haskell | 2.0 | [Haskell](https://www.haskell.org/) | https://github.com/DevJac/raylib-haskell |
| raylib-cr | 2.5-dev | [Crystal](https://crystal-lang.org/) | https://github.com/AregevDev/raylib-cr |
| raylib.cr | 2.0 | [Crystal](https://crystal-lang.org/) | https://github.com/sam0x17/raylib.cr |
| cray | 1.8 | [Crystal](https://crystal-lang.org/) | https://gitlab.com/Zatherz/cray |
| raylib-pas | 3.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/tazdij/raylib-pas |
| raylib-pascal | 2.0 | [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) | https://github.com/drezgames/raylib-pascal |
| Graphics-Raylib | 1.4 | [Perl](https://www.perl.org/) | https://github.com/athreef/Graphics-Raylib |
| raylib-ruby | 2.6 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/a0/raylib-ruby |
| raylib-ruby-ffi | 2.0 | [Ruby](https://www.ruby-lang.org/en/) | https://github.com/D3nX/raylib-ruby-ffi |
| raylib-mruby | 2.5-dev | [mruby](https://github.com/mruby/mruby) | https://github.com/lihaochen910/raylib-mruby |
| raylib-py-ctbg | 2.6 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py-ctbg |
| raylib-py | 2.0 | [Python](https://www.python.org/) | https://github.com/overdev/raylib-py |
| raylib-java | 2.0 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/XoanaIO/raylib-java |
| raylib-j | 3.5 | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | https://github.com/CreedVI/Raylib-J |
| clj-raylib | 3.0 | [Clojure](https://clojure.org/) | https://github.com/lsevero/clj-raylib |
| QuickJS-raylib | 3.0 | [QuickJS](https://bellard.org/quickjs/) | https://github.com/sntg-p/QuickJS-raylib |
| raylib-duktape | 2.6 | [JavaScript (Duktape)](https://en.wikipedia.org/wiki/JavaScript) | https://github.com/RobLoach/raylib-duktape |
| raylib-chaiscript | 2.6 | [ChaiScript](http://chaiscript.com/) | https://github.com/RobLoach/raylib-chaiscript |
| raylib-squirrel | 2.5 | [Squirrel](http://www.squirrel-lang.org/) | https://github.com/RobLoach/raylib-squirrel |
| racket-raylib-2d | 2.5 | [Racket](https://racket-lang.org/) | https://github.com/arvyy/racket-raylib-2d |
| raylib-php-ffi | 2.4-dev | [PHP](https://en.wikipedia.org/wiki/PHP) | https://github.com/oraoto/raylib-php-ffi |
| raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe | | raylib-haxe | 2.4 | [Haxe](https://haxe.org/) | https://github.com/ibilon/raylib-haxe |
| ringraylib | 2.6 | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib | | ringraylib | 2.6 | [Ring](http://ring-lang.sourceforge.net/) | https://github.com/ringpackages/ringraylib |
| cl-raylib | 3.0 | [Common Lisp](https://common-lisp.net/) | https://github.com/longlene/cl-raylib | | cl-raylib | 3.0 | [Common Lisp](https://common-lisp.net/) | https://github.com/longlene/cl-raylib |
@@ -70,17 +94,15 @@ Here it is a list with the ones I'm aware of:
| raylib-chibi | 2.5 | [Chibi-Scheme](https://github.com/ashinn/chibi-scheme) | https://github.com/VincentToups/raylib-chibi | | raylib-chibi | 2.5 | [Chibi-Scheme](https://github.com/ashinn/chibi-scheme) | https://github.com/VincentToups/raylib-chibi |
| raylib-gambit-scheme | 3.1-dev | [Gambit Scheme](https://github.com/gambit/gambit) | https://github.com/georgjz/raylib-gambit-scheme | | raylib-gambit-scheme | 3.1-dev | [Gambit Scheme](https://github.com/gambit/gambit) | https://github.com/georgjz/raylib-gambit-scheme |
| Euraylib | 3.0 | [Euphoria](https://openeuphoria.org/) | https://github.com/gAndy50/Euraylib | | Euraylib | 3.0 | [Euphoria](https://openeuphoria.org/) | https://github.com/gAndy50/Euraylib |
| raylib-wren | 3.0 | [Wren](http://wren.io/) | https://github.com/TSnake41/raylib-wren |
| raylib-odin | 3.0 | [Odin](https://odin-lang.org/) | https://github.com/kevinw/raylib-odin | | raylib-odin | 3.0 | [Odin](https://odin-lang.org/) | https://github.com/kevinw/raylib-odin |
| vraylib | 3.5 | [V](https://vlang.io/) | https://github.com/waotzi/vraylib |
| raylib-zig | 3.0 | [Zig](https://ziglang.org/) | https://github.com/Not-Nik/raylib-zig | | raylib-zig | 3.0 | [Zig](https://ziglang.org/) | https://github.com/Not-Nik/raylib-zig |
| raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kevinw/raylib-jai | | raylib-jai | 3.1-dev | [Jai](https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md) | https://github.com/kevinw/raylib-jai |
| ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments | | ray.zig | 2.5 | [Zig](https://ziglang.org/) | https://github.com/BitPuffin/zig-raylib-experiments |
| raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada | | raylib-Ada | 3.0 | [Ada](https://www.adacore.com/about-ada) | https://github.com/mimo/raylib-Ada |
| jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib | | jaylib | 3.0 | [Janet](https://janet-lang.org/) | https://github.com/janet-lang/jaylib |
| raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit | | raykit | ? | [Kit](https://www.kitlang.org/) | https://github.com/Gamerfiend/raykit |
| vraylib | 3.5 | [V](https://vlang.io/) | https://github.com/waotzi/vraylib |
| ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod | | ray.mod | 3.0 | [BlitzMax](https://blitzmax.org/) | https://github.com/bmx-ng/ray.mod |
| ray-ocaml | 3.0 | [OCaml](https://ocaml.org/) | https://github.com/tjammer/raylib-ocaml |
| raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic | | raylib-mosaic | 3.0 | [Mosaic](https://github.com/sal55/langs/tree/master/Mosaic) | https://github.com/pluckyporcupine/raylib-mosaic |
| raylib-xdpw | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) | https://github.com/vtereshkov/raylib-xdpw | | raylib-xdpw | 2.6 | [XD Pascal](https://github.com/vtereshkov/xdpw) | https://github.com/vtereshkov/raylib-xdpw |
| raylib-carp | 3.0 | [Carp](https://github.com/carp-lang/Carp) | https://github.com/pluckyporcupine/raylib-carp | | raylib-carp | 3.0 | [Carp](https://github.com/carp-lang/Carp) | https://github.com/pluckyporcupine/raylib-carp |
@@ -91,11 +113,10 @@ Here it is a list with the ones I'm aware of:
| raylib-beef | 3.0 | [Beef](https://www.beeflang.org/) | https://github.com/M0n7y5/raylib-beef | | raylib-beef | 3.0 | [Beef](https://www.beeflang.org/) | https://github.com/M0n7y5/raylib-beef |
| raylib-never | 3.0 | [Never](https://github.com/never-lang/never) | https://github.com/never-lang/raylib-never | | raylib-never | 3.0 | [Never](https://github.com/never-lang/never) | https://github.com/never-lang/raylib-never |
| raylib.cbl | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* | | raylib.cbl | 2.0 | [COBOL](https://en.wikipedia.org/wiki/COBOL) | *[code examples](https://github.com/Martinfx/Cobol/tree/master/OpenCobol/Games/raylib)* |
| Relib | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | https://github.com/RedCubeDev-ByteSpace/Relib |
| Harbour | 3.5 | [Harbour](https://harbour.github.io) | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib |
Missing some language? Feel free to create a new binding! :)
Missing some language or wrapper? Feel free to create a new one! :)
Usually, raylib bindings follow the convention: `raylib-{language}` Usually, raylib bindings follow the convention: `raylib-{language}`

146
CHANGELOG
View File

@@ -1,7 +1,151 @@
changelog changelog
--------- ---------
Current Release: raylib 3.7.0 (26 April 2021) Current Release: raylib 4.0.0 (05 November 2021)
-------------------------------------------------------------------------
Release: raylib 4.0 - 8th Anniversary Edition (05 November 2021)
-------------------------------------------------------------------------
KEY CHANGES:
- Naming consistency and coherency: Complete review of the library: sintax, naming, comments, decriptions, logs...
- Event Automation System: Support for input events recording and automatic re-playing, useful for automated testing and more!
- Custom game-loop control: Intended for advance users that want to control the events polling and the timming mechanisms
- rlgl 4.0: Completely decoupling from platform layer and raylib, intended for standalone usage as single-file header-only
- raymath 1.5: Complete review following new conventions, to make it more portable and self-contained
- raygui 3.0: Complete review and official new release, more portable and self-contained, intended for tools development
- raylib_parser: New tool to parse raylib.h and extract all required info into custom output formats (TXT, XML, JSON...)
- Zig and Odin official support
Detailed changes:
[core] ADDED: Support canvas resizing on web (#1840) by @skylersaleh
[core] ADDED: GetMouseDelta() (#1832) by @adricoin2010
[core] ADDED: Support additional mouse buttons (#1753) by @lambertwang
[core] ADDED: SetRandomSeed() (#1994) by @TommiSinivuo
[core] ADDED: GetTouchPointId() #1972
[core] ADDED: EncodeDataBase64() and DecodeDataBase64()
[core] REMOVED: PLATFORM_UWP, difficult to maintain
[core] REMOVED: IsGamepadName()
[core] RENAMED: SwapBuffers() to SwapScreenBuffer()
[core] RENAMED: Wait() to WaitTime()
[core] RENAMED: RayHitInfo to RayCollision (#1781)
[core] RENAMED: GetRayCollisionGround() to GetRayCollisionQuad() (#1781)
[core] REVIEWED: Support mouse wheel on x-axis (#1948)
[core] REVIEWED: DisableCursor() on web by registering an empty mouse click event function in emscripten (#1900) by @grenappels
[core] REVIEWED: LoadShader() and default locations and descriptions
[core] REVIEWED: LoadShaderFromMemory() (#1851) by @Ruminant
[core] REVIEWED: WaitTime(), avoid global variables dependency to make the function is self-contained (#1841)
[core] REVIEWED: SetWindowSize() to work on web (#1847) by @nikki93
[core] REVIEWED: Raspberry RPI/DRM keyboard blocking render loop (#1879) @luizpestana
[core] REVIEWED: Android multi-touch (#1869) by @humbe
[core] REVIEWED: Implemented GetGamepadName() for emscripten by @nbarkhina
[core] REVIEWED: HighDPI support (#1987) by @ArnaudValensi
[core] REVIEWED: KeyCallback(), register keys independently of the actions
[rlgl] ADDED: GRAPHIC_API_OPENGL_43
[rlgl] ADDED: rlUpdateVertexBufferElements() (#1915)
[rlgl] ADDED: rlActiveDrawBuffers() (#1911)
[rlgl] ADDED: rlEnableColorBlend()/rlDisableColorBlend()
[rlgl] ADDED: rlGetPixelFormatName()
[rlgl] REVIEWED: rlUpdateVertexBuffer (#1914) by @630Studios
[rlgl] REVIEWED: rlDrawVertexArrayElements() (#1891)
[rlgl] REVIEWED: Wrong normal matrix calculation (#1870)
[raymath] ADDED: Vector3Angle()
[raymath] REVIEWED: QuaternionFromAxisAngle() (#1892)
[raymath] REVIEWED: QuaternionToMatrix() returning transposed result. (#1793) by @object71
[shapes] ADDED: RenderPolyLinesEx() (#1758) by @lambertwang
[shapes] ADDED: DrawLineBezierCubic() (#2021) by @SAOMDVN
[textures] ADDED: GetImageColor() #2024
[textures] REMOVED: GenImagePerlinNoise()
[textures] RENAMED: GetTextureData() to LoadImageFromTexture()
[textures] RENAMED: GetScreenData() to LoadImageFromScreen()
[textures] REVIEWED: ExportImage() to use SaveFileData() (#1779)
[textures] REVIEWED: LoadImageAnim() #2005
[text] ADDED: Security check in case of not valid font
[text] ADDED: `GetGlyphInfo()` to get glyph info for a specific codepoint
[text] ADDED: `GetGlyphAtlasRec()` to get glyph rectangle within the generated font atlas
[text] ADDED: DrawTextPro() with text rotation support, WARNING: DrawTextPro() requires including `rlgl.h`, before it was only dependant on `textures` module.
[text] ADDED: UnloadCodepoints() to safely free loaded codepoints
[text] REMOVED: DrawTextRec() and DrawTextRecEx(), moved to example, those functions could be very specific depending on user needs so it's better to give the user the full source in case of special requirements instead of allowing a function with +10 input parameters.
[text] RENAMED: struct `CharInfo` to `GlyphInfo`, actually that's the correct naming for the data contained. It contains the character glyph metrics and the glyph image; in the past it also contained rectangle within the font atlas but that data has been moved to `Font` struct directly, so, `GlyphInfo` is a more correct name.
[text] RENAMED: `CodepointToUtf8()` to `CodepointToUTF8()`, capitalization of UTF-8 is the correct form, it would also require de hyphen but it can be omitted in this case.
[text] RENAMED: `TextToUtf8()` to `TextCodepointsToUTF8` for consistency and more detail on the functionality.
[text] RENAMED: GetCodepoints() to LoadCodepoints(), now codepoint array data is loaded dynamically instead of reusing a limited static buffer.
[text] RENAMED: GetNextCodepoint() to GetCodepoint()
[models] ADDED: MagikaVoxel VOX models loading
[models] ADDED: GenMeshCone() (#1903)
[models] ADDED: GetModelBoundingBox()
[models] ADDED: DrawBillboardPro() (#1759) by @nobytesgiven
[models] ADDED: DrawCubeTextureRec() (#2001) by @tdgroot
[models] ADDED: DrawCylinderEx() and DrawCylinderWiresEx() (#2049) by @Horrowind
[models] REMOVED: DrawBillboardEx()
[models] RENAMED: MeshBoundingBox() to GetMeshBoundingBox()
[models] RENAMED: MeshTangents() to GenMeshTangents()
[models] RENAMED: MeshBinormals() to GenMeshBinormals()
[models] REVIEWED: GenMeshTangents() (#1877) by @630Studios
[models] REVIEWED: CheckCollisionBoxSphere() by @Crydsch
[models] REVIEWED: GetRayCollisionQuad() by @Crydsch
[models] REVIEWED: LoadGLTF(), fixed missing transformations and nonroot skinning by @MrDiver
[models] REVIEWED: LoadGLTF(), rewriten from scratch, removed animations support (broken)
[models] REVIEWED: Decouple DrawMesh() and DrawMeshInstanced() (#1958)
[models] REVIEWED: Support vertex color attribute for GLTF and IQM (#1790) by @object71
[models] REVIEWED: DrawBillboardPro() (#1941) by @GithubPrankster
[models] REDESIGNED: Major review of glTF loading functionality (#1849) by @object71
[audio] ADDED: SeekMusicStream() (#2006) by @GithubPrankster
[audio] REMOVED: GetAudioStreamBufferSizeDefault()
[audio] RENAMED: InitAudioStream() to LoadAudioStream()
[audio] RENAMED: CloseAudioStream() to UnloadAudioStream()
[audio] RENAMED: IsMusicPlaying() to IsMusicStreamPlaying()
[audio] REVIEWED: ExportWaveAsCode()
[audio] REDESIGNED: Use frameCount on audio instead of sampleCount
[utils] REVIEWED: exit() on LOG_FATAL instead of LOG_ERROR (#1796)
[examples] ADDED: core_custom_frame_control
[examples] ADDED: core_basic_screen_manager
[examples] ADDED: core_split_screen (#1806) by @JeffM2501
[examples] ADDED: core_smooth_pixelperfect (#1771) by @NotManyIdeasDev
[examples] ADDED: shaders_texture_outline (#1883) by @GoldenThumbs
[examples] ADDED: models_loading_vox (#1940) by @procfxgen
[examples] ADDED: rlgl_compute_shader by @TSnake41 (#2088)
[examples] REMOVED: models_material_pbr
[examples] REMOVED: models_gltf_animation
[examples] REVIEWED: core_3d_picking
[examples] REVIEWED: core_input_mouse
[examples] REVIEWED: core_vr_simulator, RenderTexture usage
[examples] REVIEWED: core_window_letterbox, RenderTexture usage
[examples] REVIEWED: shapes_basic_shapes
[examples] REVIEWED: shapes_logo_raylib_anim
[examples] REVIEWED: textures_to_image
[examples] REVIEWED: text_rectangle_bounds
[examples] REVIEWED: text_unicode
[examples] REVIEWED: text_draw_3d
[examples] REVIEWED: models_loading
[examples] REVIEWED: models_skybox (#1792) (#1778)
[examples] REVIEWED: models_mesh_picking
[examples] REVIEWED: models_yaw_pitch_roll
[examples] REVIEWED: models_rlgl_solar_system
[examples] REVIEWED: shaders_custom_uniform, RenderTexture usage
[examples] REVIEWED: shaders_eratosthenes, RenderTexture usage
[examples] REVIEWED: shaders_julia_set, RenderTexture usage
[examples] REVIEWED: shaders_postprocessing, RenderTexture usage
[examples] REVIEWED: shaders_basic_lighting, simplified (#1865)
[examples] REVIEWED: audio_raw_stream.c
[examples] REVIEWED: raudio_standalone
[examples] REVIEWED: raylib_opengl_interop
[examples] REVIEWED: rlgl_standalone.c
[examples] REVIEWED: Resources licenses
[examples] REVIEWED: models resources reorganization
[templates] REMOVED: Moved to a separate repo: https://github.com/raysan5/raylib-game-template
[build] ADDED: Zig build file (#2014) by @TommiSinivuo
[build] ADDED: Android VS2019 solution (#2013) by @Kronka
[build] REMOVED: VS2017 project, outdated
[build] RENAMED: All raylib modules prefixed with 'r' (core -> rcore)
[build] RENAMED: SUPPORT_MOUSE_CURSOR_NATIVE to SUPPORT_MOUSE_CURSOR_POINT
[build] REVIEWED: examples/examples_template.c
[build] REVIEWED: Makefile to latest Emscripten SDK r23
[build] REVIEWED: Makefile for latest Android NDK r32 LTS
[build] REVIEWED: raylib resource files
[build] Moved some extra raylib libraries to /extras/ directory
[*] UPDATED: Multiple bindings to latest version
[*] UPDATED: Most external libraries to latest versions (except GLFW)
[*] Multiple code improvements and fixes by multiple contributors!
------------------------------------------------------------------------- -------------------------------------------------------------------------
Release: raylib 3.7 (26 April 2021) Release: raylib 3.7 (26 April 2021)

View File

@@ -4,7 +4,7 @@ include(EnumOption)
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.") enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM" "Platform to build for.")
enum_option(OPENGL_VERSION "OFF;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?") enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0" "Force a specific OpenGL Version?")
# Configuration options # Configuration options
option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN}) option(BUILD_EXAMPLES "Build the examples." ${RAYLIB_IS_MAIN})
@@ -27,9 +27,9 @@ endif()
option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF) option(INCLUDE_EVERYTHING "Include everything disabled by default (for CI usage" OFF)
set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option") set(OFF ${INCLUDE_EVERYTHING} CACHE INTERNAL "Replace any OFF by default with \${OFF} to have it covered by this option")
# core.c # rcore.c
cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (camera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_CAMERA_SYSTEM "Provide camera module (rcamera.h) with multiple predefined cameras: free, 1st/3rd person, orbital" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (gestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_GESTURES_SYSTEM "Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_MOUSE_GESTURES "Mouse gestures are directly mapped like touches and processed by gestures system" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" OFF CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_SSH_KEYBOARD_RPI "Reconfigure standard input to receive key inputs, works with SSH connection" OFF CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_DEFAULT_FONT "Default font is loaded on window initialization to be available for the user to render simple text. If enabled, uses external module functions to load default raylib font (module: text)" ON CUSTOMIZE_BUILD ON)
@@ -41,10 +41,10 @@ cmake_dependent_option(SUPPORT_WINMM_HIGHRES_TIMER "Setting a higher resolution
cmake_dependent_option(SUPPORT_DATA_STORAGE "Support for persistent data storage" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_DATA_STORAGE "Support for persistent data storage" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_COMPRESSION_API "Support for compression API" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_COMPRESSION_API "Support for compression API" ON CUSTOMIZE_BUILD ON)
# shapes.c # rshapes.c
cmake_dependent_option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_QUADS_DRAW_MODE "Use QUADS instead of TRIANGLES for drawing when possible. Some lines-based shapes could still use lines" ON CUSTOMIZE_BUILD ON)
# textures.c # rtextures.c
cmake_dependent_option(SUPPORT_IMAGE_EXPORT "Support image exporting to file" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_IMAGE_EXPORT "Support image exporting to file" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_IMAGE_GENERATION "Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_IMAGE_GENERATION "Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_IMAGE_MANIPULATION "Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop... If not defined only three image editing functions supported: ImageFormat(), ImageAlphaMask(), ImageToPOT()" ON CUSTOMIZE_BUILD ON)
@@ -61,17 +61,18 @@ cmake_dependent_option(SUPPORT_FILEFORMAT_PSD "Support loading PSD as textures"
cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_FILEFORMAT_PKM "Support loading PKM as textures" ${OFF} CUSTOMIZE_BUILD OFF)
cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF) cmake_dependent_option(SUPPORT_FILEFORMAT_PVR "Support loading PVR as textures" ${OFF} CUSTOMIZE_BUILD OFF)
# text.c # rtext.c
cmake_dependent_option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_FNT "Support loading fonts in FNT format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_TTF "Support loading font in TTF/OTF format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_TEXT_MANIPULATION "Support text manipulation functions" ON CUSTOMIZE_BUILD ON)
# models.c # rmodels.c
cmake_dependent_option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_MESH_GENERATION "Support procedural mesh generation functions, uses external par_shapes.h library. NOTE: Some generated meshes DO NOT include generated texture coordinates" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_OBJ "Support loading OBJ file format" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_OBJ "Support loading OBJ file format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_MTL "Support loading MTL file format" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_MTL "Support loading MTL file format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_IQM "Support loading IQM file format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_GLTF "Support loading GLTF file format" ON CUSTOMIZE_BUILD ON)
cmake_dependent_option(SUPPORT_FILEFORMAT_VOX "Support loading VOX file format" ON CUSTOMIZE_BUILD ON)
# raudio.c # raudio.c
cmake_dependent_option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON CUSTOMIZE_BUILD ON) cmake_dependent_option(SUPPORT_FILEFORMAT_WAV "Support loading WAV for sound" ON CUSTOMIZE_BUILD ON)

95
CONVENTIONS.md Normal file
View File

@@ -0,0 +1,95 @@
## C Coding Style Conventions
Here it is a list with some of the code conventions used by raylib:
Code element | Convention | Example
--- | :---: | ---
Defines | ALL_CAPS | `#define PLATFORM_DESKTOP`
Macros | ALL_CAPS | `#define MIN(a,b) (((a)<(b))?(a):(b))`
Variables | lowerCase | `int screenWidth = 0;`, `float targetFrameTime = 0.016f;`
Local variables | lowerCase | `Vector2 playerPosition = { 0 };`
Global variables | lowerCase | `bool windowReady = false;`
Constants | lowerCase | `const int maxValue = 8;`
Pointers | MyType *pointer | `Texture2D *array = NULL;`
float values | always x.xf | `float gravity = 10.0f`
Operators | value1*value2 | `int product = value*6;`
Operators | value1/value2 | `int division = value/4;`
Operators | value1 + value2 | `int sum = value + 10;`
Operators | value1 - value2 | `int res = value - 5;`
Enum | TitleCase | `enum TextureFormat`
Enum members | ALL_CAPS | `PIXELFORMAT_UNCOMPRESSED_R8G8B8`
Struct | TitleCase | `struct Texture2D`, `struct Material`
Struct members |lowerCase | `texture.width`, `color.r`
Functions | TitleCase | `InitWindow()`, `LoadImageFromMemory()`
Functions params | lowerCase | `width`, `height`
Ternary Operator | (condition)? result1 : result2 | `printf("Value is 0: %s", (value == 0)? "yes" : "no");`
Some other conventions to follow:
- **ALWAYS** initialize all defined variables.
- **Do not use TABS**, use 4 spaces instead.
- Avoid trailing spaces, please, avoid them
- Control flow statements always are followed **by a space**:
```c
if (condition) value = 0;
while (!WindowShouldClose())
{
}
for (int i = 0; i < NUM_VALUES; i++) printf("%i", i);
// Be careful with the switch formatting!
switch (value)
{
case 0:
{
} break;
case 2: break;
default: break;
}
```
- All conditions checks are **always between parenthesis** but not boolean values:
```c
if ((value > 1) && (value < 50) && valueActive))
{
}
```
- When dealing with braces or curly brackets, open-close them in aligned mode:
```c
void SomeFunction()
{
// TODO: Do something here!
}
```
**If proposing new functions, please try to use a clear naming for function-name and functions-parameters, in case of doubt, open an issue for discussion.**
## Files and Directories Naming Conventions
- Directories will be named using `snake_case`: `resources/models`, `resources/fonts`
- Files will be named using `snake_case`: `main_title.png`, `cubicmap.png`, `sound.wav`
_NOTE: Avoid any space or special character in the files/dir naming!_
## Games/Examples Directories Organization Conventions
- Data files should be organized by context and usage in the game, think about the loading requirements for data and put all the resources that need to be loaded at the same time together.
- Use descriptive names for the files, it would be perfect if just reading the name of the file, it was possible to know what is that file and where fits in the game.
- Here it is an example, note that some resources require to be loaded all at once while other require to be loaded only at initialization (gui, font).
```
resources/audio/fx/long_jump.wav
resources/audio/music/main_theme.ogg
resources/screens/logo/logo.png
resources/screens/title/title.png
resources/screens/gameplay/background.png
resources/characters/player.png
resources/characters/enemy_slime.png
resources/common/font_arial.ttf
resources/common/gui.png
```

View File

@@ -33,7 +33,7 @@ Lots of code changes and lot of testing have concluded in this amazing new rayli
notes on raylib 1.2 notes on raylib 1.2
------------------- -------------------
On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/core.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/). On September 2014, after 5 month of raylib 1.1 release, it comes raylib 1.2. Again, this version presents a complete internal redesign of [core](https://github.com/raysan5/raylib/blob/master/src/rcore.c) module to support two new platforms: [Android](http://www.android.com/) and [Raspberry Pi](http://www.raspberrypi.org/).
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the users. On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input system has been written from scratch. It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the users. On Android, raylib manages internally the activity cicle, as well as the inputs; on Raspberry Pi, a complete raw input system has been written from scratch.
@@ -54,9 +54,9 @@ On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This
- Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files. - Textures module has grown to support most of the internal texture formats available in OpenGL (RGB565, RGB888, RGBA5551, RGBA4444, etc.), including compressed texture formats (DXT, ETC1, ETC2, ASTC, PVRT); raylib 1.3 can load .dds, .pkm, .ktx, .astc and .pvr files.
- A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/camera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c). - A brand new [camera](https://github.com/raysan5/raylib/blob/master/src/rcamera.c) module offers to the user multiple preconfigured ready-to-use camera systems (free camera, 1st person, 3rd person). Camera modes are very easy to use, just check examples: [core_3d_camera_free.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/master/examples/core_3d_camera_first_person.c).
- New [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs. - New [gestures](https://github.com/raysan5/raylib/blob/master/src/rgestures.h) module simplifies gestures detection on Android and HTML5 programs.
- [raygui](https://github.com/raysan5/raylib/blob/master/src/raygui.h), the new immediate-mode GUI module offers a set of functions to create simple user interfaces, primary intended for tools development. It's still in experimental state but already fully functional. - [raygui](https://github.com/raysan5/raylib/blob/master/src/raygui.h), the new immediate-mode GUI module offers a set of functions to create simple user interfaces, primary intended for tools development. It's still in experimental state but already fully functional.
@@ -77,7 +77,7 @@ On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For
- [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline. - [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) module has been reviewed; some bugs have been solved and the module has been converted to a header-only file for easier portability, optionally, functions can also be used as inline.
- [gestures](https://github.com/raysan5/raylib/blob/master/src/gestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code. - [gestures](https://github.com/raysan5/raylib/blob/master/src/rgestures.c) module has redesigned and simplified, now it can process touch events from any source, including mouse. This way, gestures system can be used on any platform providing an unified way to work with inputs and allowing the user to create multiplatform games with only one source code.
- Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental). - Raspberry Pi input system has been redesigned to better read raw inputs using generic Linux event handlers (keyboard:`stdin`, mouse:`/dev/input/mouse0`, gamepad:`/dev/input/js0`). Gamepad support has also been added (experimental).
@@ -106,7 +106,7 @@ On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new
- Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck. - Audio chiptunese support and mixing channels: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels are now also supported. All this features thanks to the amazing work of @kd7tck.
Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms. Other additions include a [2D camera system](https://github.com/raysan5/raylib/blob/master/examples/core_2d_rcamera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/master/examples/shaders_postprocessing.c)) or support for legacy OpenGL 2.1 on desktop platforms.
This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) file for a more detailed list of changes. This new version is so massive that is difficult to list all the improvements, most of raylib modules have been reviewed and [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c) module has been completely redesigned to accomodate to new material-lighting systems and stereo rendering. You can check [CHANGELOG](https://github.com/raysan5/raylib/blob/master/CHANGELOG) file for a more detailed list of changes.
@@ -255,8 +255,8 @@ It has been **10 months of improvements** to create the best raylib ever.
Welcome to **raylib 3.0**. Welcome to **raylib 3.0**.
notes on raylib 3.5 notes on raylib 3.5 - 7th Anniversary Edition
------------------- ---------------------------------------------
It's December 25th... this crazy 2020 is about to finish and finally the holidays gave me some time to put a new version of raylib. It's been **9 months since last release** and last November raylib become 7 years old... I was not able to release this new version back then but here it is. Many changes and improvements have happened in those months and, even, last August, raylib was awarded with an [Epic Megagrant](https://www.unrealengine.com/en-US/blog/epic-megagrants-fall-2020-update)! Bindings list kept growing to [+50 programming languages](BINDINGS.md) and some new platforms have been supported. Let's see this new version details: It's December 25th... this crazy 2020 is about to finish and finally the holidays gave me some time to put a new version of raylib. It's been **9 months since last release** and last November raylib become 7 years old... I was not able to release this new version back then but here it is. Many changes and improvements have happened in those months and, even, last August, raylib was awarded with an [Epic Megagrant](https://www.unrealengine.com/en-US/blog/epic-megagrants-fall-2020-update)! Bindings list kept growing to [+50 programming languages](BINDINGS.md) and some new platforms have been supported. Let's see this new version details:
@@ -322,3 +322,43 @@ Highlights for `raylib 3.7`:
Beside those key changes, many functions have been reviewed with improvements and bug fixes, many of them contributed by the community! Thanks! And again, this release sets a **new milestone for raylib library**. Make sure to check [CHANGELOG](CHANGELOG) for detailed list of changes! Hope you enjoy this new raylib installment! Beside those key changes, many functions have been reviewed with improvements and bug fixes, many of them contributed by the community! Thanks! And again, this release sets a **new milestone for raylib library**. Make sure to check [CHANGELOG](CHANGELOG) for detailed list of changes! Hope you enjoy this new raylib installment!
Happy **gamedev/tools/graphics** programming! :) Happy **gamedev/tools/graphics** programming! :)
notes on raylib 4.0 - 8th Anniversary Edition
---------------------------------------------
It's been about 6 months since last raylib release and it's been **8 years since I started with this project**, what an adventure! It's time for a new release: `raylib 4.0`, **the biggest release ever** and an inflexion point for the library. Many hours have been put in this release to make it special, **many library details have been polished**: syntax, naming conventions, code comments, functions descriptions, log outputs... Almost all the issues have been closed (only 3 remain open at the moment of this writing) and some amazing new features have been added. I expect this **`raylib 4.0`** to be a long term version (LTS), stable and complete enough for any new graphic/game/tool application development.
Let's start with some numbers:
- **+130** closed issues (for a TOTAL of **+1030**!)
- **+550** commits since previous RELEASE
- **+20** functions ADDED to raylib API
- **+60** functions ADDED to rlgl API
- **+40** functions RENAMED/REVIEWED/REDESIGNED
- **+60** new contributors (for a TOTAL of **+275**!)
Highlights for `raylib 4.0`:
- **Naming consistency and coherency**: `raylib` API has been completely reviewed to be consistent on naming conventions for data structures and functions, comments and descriptions have been reviewed, also the sintax of many symbols for consistency; some functions and structs have been renamed (i.e. `struct CharInfo` to `struct GlyphInfo`). Output log messages have been also improved to show more info to the users. Several articles have been writen in this process: [raylib_syntax analysis](https://github.com/raysan5/raylib/wiki/raylib-syntax-analysis) and [raylib API usage analysis](https://gist.github.com/raysan5/7c0c9fff1b6c19af24bb4a51b7383f1e). In general, a big polishment of the library to make it more consistent and coherent.
- **Event Automation System**: This new _experimental_ feature has been added for future usage, it allows to **record input events and re-play them automatically**. This feature could be very useful to automatize examples testing but also for tutorials with assited game playing, in-game cinematics, speedruns, AI playing and more! Note this feature is still experimental.
- **Custom game-loop control**: As requested by some advance users, **the game-loop control can be exposed** compiling raylib with the config flag: `SUPPORT_CUSTOM_FRAME_CONTROL`. It's intended for advance users that want to control the events polling and also the timming mechanisms of their games.
- [**`rlgl 4.0`**](https://github.com/raysan5/raylib/blob/master/src/rlgl.h): This module has been completely **decoupled from platform layer** and raylib, now `rlgl` single-file header-only library only depends on the multiple OpenGL backends supported, even the dependency on `raymath` has been removed. Additionally, **support for OpenGL 4.3** has been added, supporting compute shaders and Shader Storage Buffer Objects (SSBO). Now `rlgl` can be used as a complete standalone portable library to wrap several OpenGL version and providing **a simple and easy-to-use pseudo-OpenGL immediate-mode API**.
- [**`raymath 1.5`**](https://github.com/raysan5/raylib/blob/master/src/raymath.h): This module has been reviewed and some new conventions have been adopted to make it **more portable and self-contained**:
- Functions are self-contained, no function use other raymath function inside, required code is directly re-implemented
- Functions input parameters are always received by value
- Functions use always a "result" variable for return
- Angles are always in radians (`DEG2RAD`/`RAD2DEG` macros provided for convenience)
- [**`raygui 3.0`**](https://github.com/raysan5/raygui): The **official raylib immediate-mode gui library** (included in `raylib/src/extras`) has been updated to a new version, embedding the icons collection and adding mulstiple improvements. It has been simplified and constrained for a better focus on its task: provide a simple and easy-to-use immediate-mode-gui library for small tools development.
- [**`raylib_parser`**](https://github.com/raysan5/raylib/tree/master/parser): Added **new tool to parse `raylib.h`** and tokenize its enums, structs and functions, extracting all required info (name, params, descriptions...) into custom output formats (TXT, XML, JSON...) for further processing. This tool is specially useful to **automatize bindings generation**. Hopefully, this tool will make life easier to binding creators to update their bindings for raylib 4.0 or adding new ones!
- **Zig and Odin official support for raylib**: Those two new amazing programming languages are officially supporting raylib, `Zig` lists raylib as an [official example for C interoperatibility](https://ziglang.org/learn/samples/#c-interoperability) and Odin [officially supports raylib as a vendor library](https://github.com/odin-lang/Odin/tree/master/vendor/raylib). Both languages also have several bingings to raylib. Additionally, Zig build system supported has been added to compile raylib library and examples.
Those are some of the key features for this new release but actually there is way more! **Support for `VOX` ([MagikaVoxel](https://ephtracy.github.io/)) 3d model format** has been added, **new [raylib_game_template](https://github.com/raysan5/raylib-game-template)** repo shared, **new `EncodeDataBase64()` and `DecodeDataBase64()` functions** added, **improved HiDPI support**, new `DrawTextPro()` with support for text rotations, completely **reviewed `glTF` models loading**, added **`SeekMusicStream()` for music seeking**, many new examples and +20 examples reviewed... **hundreds of improvements and bug fixes**! Make sure to check [CHANGELOG](CHANGELOG) for a detailed list of changes!
Undoubtely, **this is the best raylib ever**. Enjoy gamedev/tools/graphics programming! :)

View File

@@ -4,7 +4,7 @@
raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education. raylib is highly inspired by Borland BGI graphics lib and by XNA framework and it's specially well suited for prototyping, tooling, graphical applications, embedded systems and education.
*NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no auto-debugging... just coding in the most pure spartan-programmers way.* *NOTE for ADVENTURERS: raylib is a programming library to enjoy videogames programming; no fancy interface, no visual helpers, no debug button... just coding in the most pure spartan-programmers way.*
Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html) Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
@@ -14,7 +14,7 @@ Ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
[![GitHub contributors](https://img.shields.io/github/contributors/raysan5/raylib)](https://github.com/raysan5/raylib/graphs/contributors) [![GitHub contributors](https://img.shields.io/github/contributors/raysan5/raylib)](https://github.com/raysan5/raylib/graphs/contributors)
[![GitHub All Releases](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases) [![GitHub All Releases](https://img.shields.io/github/downloads/raysan5/raylib/total)](https://github.com/raysan5/raylib/releases)
[![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/3.5.0)](https://github.com/raysan5/raylib/commits/master) [![GitHub commits since tagged version](https://img.shields.io/github/commits-since/raysan5/raylib/3.7.0)](https://github.com/raysan5/raylib/commits/master)
[![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE) [![License](https://img.shields.io/badge/license-zlib%2Flibpng-blue.svg)](LICENSE)
[![Chat on Discord](https://img.shields.io/discord/426912293134270465.svg?logo=discord)](https://discord.gg/raylib) [![Chat on Discord](https://img.shields.io/discord/426912293134270465.svg?logo=discord)](https://discord.gg/raylib)
@@ -37,13 +37,13 @@ features
- **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external) - **NO external dependencies**, all required libraries are [bundled into raylib](https://github.com/raysan5/raylib/tree/master/src/external)
- Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!** - Multiple platforms supported: **Windows, Linux, MacOS, RPI, Android, HTML5... and more!**
- Written in plain C code (C99) in PascalCase/camelCase notation - Written in plain C code (C99) in PascalCase/camelCase notation
- Hardware accelerated with OpenGL (**1.1, 2.1, 3.3 or ES 2.0**) - Hardware accelerated with OpenGL (**1.1, 2.1, 3.3, 4.3 or ES 2.0**)
- **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) - **Unique OpenGL abstraction layer** (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h)
- Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts) - Multiple **Fonts** formats supported (TTF, XNA fonts, AngelCode fonts)
- Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC) - Multiple texture formats supported, including **compressed formats** (DXT, ETC, ASTC)
- **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more! - **Full 3D support**, including 3D Shapes, Models, Billboards, Heightmaps and more!
- Flexible Materials system, supporting classic maps and **PBR maps** - Flexible Materials system, supporting classic maps and **PBR maps**
- **Animated 3D models** supported (skeletal bones animation) (IQM, glTF) - **Animated 3D models** supported (skeletal bones animation) (IQM)
- Shaders support, including model and **postprocessing** shaders. - Shaders support, including model and **postprocessing** shaders.
- **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h) - **Powerful math module** for Vector, Matrix and Quaternion operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h)
- Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD) - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
@@ -52,11 +52,9 @@ features
- Bindings to [+50 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)! - Bindings to [+50 programming languages](https://github.com/raysan5/raylib/blob/master/BINDINGS.md)!
- **Free and open source**. - **Free and open source**.
raylib uses internally some libraries for window/graphics/inputs management and also to support different fileformats loading, all those libraries are embedded with raylib and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on [raylib Wiki](https://github.com/raysan5/raylib/wiki) for a detailed list.
basic example basic example
-------------- --------------
This is a basic raylib example, it creates a window and it draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/web/core/loader.html?name=core_basic_window). This is a basic raylib example, it creates a window and it draws the text `"Congrats! You created your first window!"` in the middle of the screen. Check this example [running live on web here](https://www.raylib.com/examples/core/loader.html?name=core_basic_window).
```c ```c
#include "raylib.h" #include "raylib.h"
@@ -81,30 +79,10 @@ int main(void)
build and installation build and installation
---------------------- ----------------------
raylib binary releases for Windows, Linux and macOS are available at the [Github Releases page](https://github.com/raysan5/raylib/releases). raylib binary releases for Windows, Linux, macOS, Android and HTML5 are available at the [Github Releases page](https://github.com/raysan5/raylib/releases).
raylib is also available via multiple [package managers](https://github.com/raysan5/raylib/issues/613) on multiple OS distributions. raylib is also available via multiple [package managers](https://github.com/raysan5/raylib/issues/613) on multiple OS distributions.
#### Installing and building raylib via vcpkg
You can download and install raylib using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
vcpkg install raylib
*The raylib port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.*
#### Installing and building raylib via conan
You can download and install raylib using the [conan](https://conan.io) dependency manager:
https://docs.conan.io/en/latest/getting_started.html
*The raylib recipe in conan is kept up to date by conan team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/conan-io/conan-center-index) on the conan-center-index repository.*
#### Installing and building raylib on multiple platforms #### Installing and building raylib on multiple platforms
[raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms. [raylib Wiki](https://github.com/raysan5/raylib/wiki#development-platforms) contains detailed instructions on building and usage on multiple platforms.
@@ -159,3 +137,5 @@ license
------- -------
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details. raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.
raylib uses internally some libraries for window/graphics/inputs management and also to support different fileformats loading, all those libraries are embedded with and are available in [src/external](https://github.com/raysan5/raylib/tree/master/src/external) directory. Check [raylib dependencies LICENSES](https://github.com/raysan5/raylib/wiki/raylib-dependencies) on raylib Wiki for details.

View File

@@ -1,19 +1,27 @@
roadmap # raylib roadmap
-------
Here it is a wish-list with features and ideas to improve the library. Note that features listed here are usually long term additions for the library. Current version of raylib is complete and functional but there is a lot of room for improvement. Here it is a wish-list with features and ideas to improve the library. Note that features listed here are usually long term improvements or just describe a route to follow for the library. There are also some additional places to look for raylib improvements of ideas:
Also note that [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve. Check also [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details! - [GitHub Issues](https://github.com/raysan5/raylib/issues) has several open issues for possible improvements or bugs to fix.
- [raylib source code](https://github.com/raysan5/raylib/tree/master/src) has multiple *TODO* comments around code with pending things to review or improve.
- [raylib wishlist](https://github.com/raysan5/raylib/discussions/1502) is open to everyone to ask for improvements, feel free to check and comment.
There is also a [Discussions Wishlist](https://github.com/raysan5/raylib/discussions/1502) open to everyone, feel free to check and comment. _Current version of raylib is complete and functional but, as always, there is lot of room for improvement._
**raylib 4.x**
- [ ] Redesign camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143))
- [ ] Redesign gestures system, improve touch inputs management
- [ ] Better documentation and improved examples
- [ ] Focus on HTML5 and embedded platforms
- [ ] Additional support libraries: [raygui](https://github.com/raysan5/raygui), [rres](https://github.com/raysan5/rres)...
**raylib 4.0** **raylib 4.0**
- [ ] Network module (UDP): `rnet` ([#753](https://github.com/raysan5/raylib/issues/753)) - [x] Improved consistency and coherency in raylib API
- [ ] Custom raylib resource packer: `rres` ([link](https://github.com/raysan5/rres))
- [ ] Basic CPU/GPU stats system (memory, draws, time...) ([#1295](https://github.com/raysan5/raylib/issues/1295))
- [ ] Software rendering backend (avoiding OpenGL) ([#1370](https://github.com/raysan5/raylib/issues/1370))
- [ ] Redesigned camera module (more flexible) ([#1143](https://github.com/raysan5/raylib/issues/1143))
- [x] Continuous Deployment using GitHub Actions - [x] Continuous Deployment using GitHub Actions
- [x] rlgl improvements for standalone usage (avoid raylib coupling)
- Basic CPU/GPU stats system (memory, draws, time...) ([#1295](https://github.com/raysan5/raylib/issues/1295)) - _DISCARDED_
- Software rendering backend (avoiding OpenGL) ([#1370](https://github.com/raysan5/raylib/issues/1370)) - _DISCARDED_
- Network module (UDP): `rnet` ([#753](https://github.com/raysan5/raylib/issues/753)) - _DISCARDED_ - Use [nbnet](https://github.com/nathhB/nbnet).
**raylib 3.0** **raylib 3.0**
- [x] Custom memory allocators support - [x] Custom memory allocators support

View File

@@ -1,21 +1,14 @@
## raylib GitHub Sponsors ## raylib GitHub Sponsors
### Current raylib GitHub Sponsors ### Current raylib GitHub Sponsors (raylib 4.0 release)
The following people is currently [**sponsoring raylib**](https://github.com/sponsors/raysan5) with a generous donation to allow improving and growing the project! The following people are 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)) - Eric J. ([@ProfJski](https://github.com/ProfJski))
- devdad ([@devdad](https://github.com/devdad))
- Zach Geis ([@zacgeis](https://github.com/zacgeis)) - Zach Geis ([@zacgeis](https://github.com/zacgeis))
- minirop ([@minirop](https://github.com/minirop)) - minirop ([@minirop](https://github.com/minirop))
- Daniel Gómez ([@Koocachookies](https://github.com/Koocachookies)) - Daniel Gómez ([@Koocachookies](https://github.com/Koocachookies))
- Sergio ([@anidealgift](https://github.com/anidealgift))
- Marc Agüera ([@maguera93](https://github.com/maguera93)) - 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)) - Robin Mattheussen ([@romatthe](https://github.com/romatthe))
- Grant Haywood ([@cinterloper](https://github.com/cinterloper)) - Grant Haywood ([@cinterloper](https://github.com/cinterloper))
- Terry Nguyen ([@terrehbyte](https://github.com/terrehbyte)) - Terry Nguyen ([@terrehbyte](https://github.com/terrehbyte))
@@ -25,9 +18,17 @@ Note that Sponsors donations vary between sponsors, I just decided not to make a
- cob ([@majorcob](https://github.com/majorcob)) - cob ([@majorcob](https://github.com/majorcob))
- Samuel Batista ([@gamedevsam](https://github.com/gamedevsam)) - Samuel Batista ([@gamedevsam](https://github.com/gamedevsam))
- Merlyn Morgan-Graham ([@kavika13](https://github.com/kavika13)) - Merlyn Morgan-Graham ([@kavika13](https://github.com/kavika13))
- Toby4213 ([@Toby4213](https://github.com/Toby4213))
- linus ([@hochbaum](https://github.com/hochbaum)) - linus ([@hochbaum](https://github.com/hochbaum))
- Níckolas Daniel da Silva ([@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 ### Past raylib GitHub Sponsors
@@ -48,10 +49,20 @@ The following people has **sponsored raylib** in the past, allowing the project
- James Ghawaly ([@jghawaly](https://github.com/jghawaly)) - James Ghawaly ([@jghawaly](https://github.com/jghawaly))
- jack ([@Jack-Ji](https://github.com/Jack-Ji)) - jack ([@Jack-Ji](https://github.com/Jack-Ji))
- Guido Offermans ([@jghawaly](https://github.com/GuidoOffermans)) - 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 ### 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 are not on the list, feel free to send a PR to be added (if desired).
- **If you want your personal webpage listed along your GitHub account, feel free to send a PR to add it.** - If you want your personal webpage or project listed, feel free to send a PR to be added.
- **If you prefer not to listed in this list, feel free to send a PR to remove it.** - If you prefer not to be in this list, feel free to send a PR to be remove.

View File

@@ -1,8 +1,8 @@
if(USE_EXTERNAL_GLFW STREQUAL "ON") if(USE_EXTERNAL_GLFW STREQUAL "ON")
find_package(glfw3 3.2.1 REQUIRED) find_package(glfw3 3.3.3 REQUIRED)
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE") elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
find_package(glfw3 3.2.1 QUIET) find_package(glfw3 3.3.3 QUIET)
endif() endif()
if (glfw3_FOUND) if (glfw3_FOUND)
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw) set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
@@ -26,7 +26,7 @@ if(NOT glfw3_FOUND AND NOT USE_EXTERNAL_GLFW STREQUAL "ON" AND "${PLATFORM}" MAT
set(BUILD_SHARED_LIBS ${WAS_SHARED} CACHE BOOL " " FORCE) set(BUILD_SHARED_LIBS ${WAS_SHARED} CACHE BOOL " " FORCE)
unset(WAS_SHARED) unset(WAS_SHARED)
list(APPEND raylib_sources $<TARGET_OBJECTS:glfw_objlib>) list(APPEND raylib_sources $<TARGET_OBJECTS:glfw>)
include_directories(BEFORE SYSTEM external/glfw/include) include_directories(BEFORE SYSTEM external/glfw/include)
else() else()
MESSAGE(STATUS "Using external GLFW") MESSAGE(STATUS "Using external GLFW")

View File

@@ -14,7 +14,8 @@ if (${PLATFORM} MATCHES "Desktop")
endif () endif ()
elseif (WIN32) elseif (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
set(LIBS_PRIVATE ${LIBS_PRIVATE} winmm) find_package(OpenGL QUIET)
set(LIBS_PRIVATE ${OPENGL_LIBRARIES} winmm)
else () else ()
find_library(pthread NAMES pthread) find_library(pthread NAMES pthread)
find_package(OpenGL QUIET) find_package(OpenGL QUIET)

View File

@@ -73,7 +73,6 @@ if (${PLATFORM} MATCHES "Android")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_world_screen.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_world_screen.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_material_pbr.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_cubicmap.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_cubicmap.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_skybox.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_skybox.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
@@ -86,7 +85,9 @@ if (${PLATFORM} MATCHES "Android")
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_magicavoxel_loading.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)

View File

@@ -25,7 +25,7 @@
# Define required raylib variables # Define required raylib variables
PROJECT_NAME ?= raylib_examples PROJECT_NAME ?= raylib_examples
RAYLIB_VERSION ?= 3.5.0 RAYLIB_VERSION ?= 4.0.0
RAYLIB_PATH ?= .. RAYLIB_PATH ?= ..
# Define default options # Define default options
@@ -126,8 +126,8 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
EMSDK_PATH ?= C:/emsdk EMSDK_PATH ?= C:/emsdk
EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten EMSCRIPTEN_PATH ?= $(EMSDK_PATH)/upstream/emscripten
CLANG_PATH = $(EMSDK_PATH)/upstream/bin CLANG_PATH = $(EMSDK_PATH)/upstream/bin
PYTHON_PATH = $(EMSDK_PATH)/python/3.7.4-pywin32_64bit PYTHON_PATH = $(EMSDK_PATH)/python/3.9.2-1_64bit
NODE_PATH = $(EMSDK_PATH)/node/12.18.1_64bit/bin NODE_PATH = $(EMSDK_PATH)/node/14.15.5_64bit/bin
export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH) export PATH = $(EMSDK_PATH);$(EMSCRIPTEN_PATH);$(CLANG_PATH);$(NODE_PATH);$(PYTHON_PATH);C:\raylib\MinGW\bin:$$(PATH)
endif endif
@@ -185,6 +185,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
MAKE = mingw32-make MAKE = mingw32-make
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID)
MAKE = mingw32-make
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
MAKE = mingw32-make
endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
@@ -195,7 +201,7 @@ endif
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces CFLAGS += -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wunused-result
ifeq ($(BUILD_MODE),DEBUG) ifeq ($(BUILD_MODE),DEBUG)
CFLAGS += -g CFLAGS += -g
@@ -229,36 +235,10 @@ endif
ifeq ($(PLATFORM),PLATFORM_DRM) ifeq ($(PLATFORM),PLATFORM_DRM)
CFLAGS += -std=gnu99 -DEGL_NO_X11 CFLAGS += -std=gnu99 -DEGL_NO_X11
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# -Os # size optimization
# -O2 # optimization level 2, if used, also set --memory-init-file 0
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -s USE_PTHREADS=1 # multithreading support
# -s WASM=0 # disable Web Assembly, emitted by default
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
# --profiling # include information for code profiling
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --preload-file resources # specify a resources folder for data compilation
# --source-map-base # allow debugging in browser with source map
CFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 $(dir $<)resources@resources
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
# we can compile same code for ALL platforms with no change required, but, working on bigger
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
# Define a custom shell .html and output extension
CFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html
endif
# Define include paths for required headers # Define include paths for required headers
# NOTE: Several external required libraries (stb and others) # NOTE: Some external/extras libraries could be required (stb, physac, easings...)
INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external INCLUDE_PATHS = -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external -I$(RAYLIB_PATH)/src/extras
# Define additional directories containing required header files # Define additional directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
@@ -277,7 +257,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
INCLUDE_PATHS += -I/usr/local/include INCLUDE_PATHS += -I/usr/local/include
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
INCLUDE_PATHS = -I$(RAYLIB_H_INSTALL_PATH) -I. -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external INCLUDE_PATHS += -I$(RAYLIB_H_INSTALL_PATH)
endif endif
endif endif
@@ -303,7 +283,32 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH) LDFLAGS = -L. -L$(RAYLIB_INSTALL_PATH) -L$(RAYLIB_RELEASE_PATH) -L$(RAYLIB_PATH)
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# -Os # size optimization
# -O2 # optimization level 2, if used, also set --memory-init-file 0
# -s USE_GLFW=3 # Use glfw3 library (context/input management)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing -> WARNING: Audio buffers could FAIL!
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) (67108864 = 64MB)
# -s USE_PTHREADS=1 # multithreading support
# -s WASM=0 # disable Web Assembly, emitted by default
# -s ASYNCIFY # lets synchronous C/C++ code interact with asynchronous JS
# -s FORCE_FILESYSTEM=1 # force filesystem to load/save files data
# -s ASSERTIONS=1 # enable runtime checks for common memory allocation errors (-O1 and above turn it off)
# --profiling # include information for code profiling
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# --preload-file resources # specify a resources folder for data compilation
# --source-map-base # allow debugging in browser with source map
LDFLAGS += -s USE_GLFW=3 -s ASYNCIFY -s TOTAL_MEMORY=67108864 -s FORCE_FILESYSTEM=1 --preload-file $(dir $<)resources@resources
# NOTE: Simple raylib examples are compiled to be interpreter with asyncify, that way,
# we can compile same code for ALL platforms with no change required, but, working on bigger
# projects, code needs to be refactored to avoid a blocking while() loop, moving Update and Draw
# logic to a self contained function: UpdateDrawFrame(), check core_basic_window_web.c for reference.
# Define a custom shell .html and output extension
LDFLAGS += --shell-file $(RAYLIB_PATH)/src/shell.html
EXT = .html
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib LDFLAGS += -L/opt/vc/lib
endif endif
@@ -373,6 +378,7 @@ endif
# Define all object files required # Define all object files required
CORE = \ CORE = \
core/core_basic_window \ core/core_basic_window \
core/core_basic_screen_manager \
core/core_input_keys \ core/core_input_keys \
core/core_input_mouse \ core/core_input_mouse \
core/core_input_mouse_wheel \ core/core_input_mouse_wheel \
@@ -395,7 +401,10 @@ CORE = \
core/core_vr_simulator \ core/core_vr_simulator \
core/core_loading_thread \ core/core_loading_thread \
core/core_quat_conversion \ core/core_quat_conversion \
core/core_window_flags core/core_window_flags \
core/core_split_screen \
core/core_smooth_pixelperfect \
core/core_custom_frame_control
SHAPES = \ SHAPES = \
shapes/shapes_basic_shapes \ shapes/shapes_basic_shapes \
@@ -434,7 +443,7 @@ TEXTURES = \
textures/textures_bunnymark \ textures/textures_bunnymark \
textures/textures_blend_modes \ textures/textures_blend_modes \
textures/textures_draw_tiled \ textures/textures_draw_tiled \
textures/textures_poly textures/textures_polygon
TEXT = \ TEXT = \
text/text_raylib_fonts \ text/text_raylib_fonts \
@@ -456,10 +465,11 @@ MODELS = \
models/models_cubicmap \ models/models_cubicmap \
models/models_first_person_maze \ models/models_first_person_maze \
models/models_geometric_shapes \ models/models_geometric_shapes \
models/models_material_pbr \
models/models_mesh_generation \ models/models_mesh_generation \
models/models_mesh_picking \ models/models_mesh_picking \
models/models_loading \ models/models_loading \
models/models_loading_vox \
models/models_loading_gltf \
models/models_orthographic_projection \ models/models_orthographic_projection \
models/models_rlgl_solar_system \ models/models_rlgl_solar_system \
models/models_skybox \ models/models_skybox \
@@ -476,6 +486,7 @@ SHADERS = \
shaders/shaders_raymarching \ shaders/shaders_raymarching \
shaders/shaders_texture_drawing \ shaders/shaders_texture_drawing \
shaders/shaders_texture_waves \ shaders/shaders_texture_waves \
shaders/shaders_texture_outline \
shaders/shaders_julia_set \ shaders/shaders_julia_set \
shaders/shaders_eratosthenes \ shaders/shaders_eratosthenes \
shaders/shaders_basic_lighting \ shaders/shaders_basic_lighting \

1053
examples/Makefile.Web Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -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 ## EXAMPLES LIST
### category: core ### category: core
@@ -110,7 +128,7 @@ Examples using raylib models functionality, including models loading/generation
| 72 | [models_cubicmap](models/models_cubicmap.c) | <img src="models/models_cubicmap.png" alt="models_cubicmap" width="200"> | ray | | | 72 | [models_cubicmap](models/models_cubicmap.c) | <img src="models/models_cubicmap.png" alt="models_cubicmap" width="200"> | ray | |
| 73 | [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="200"> | ray | | | 73 | [models_first_person_maze](models/models_first_person_maze.c) | <img src="models/models_first_person_maze.png" alt="models_first_person_maze" width="200"> | ray | |
| 74 | [models_geometric_shapes](models/models_geometric_shapes.c) | <img src="models/models_geometric_shapes.png" alt="models_geometric_shapes" width="200"> | ray | | | 74 | [models_geometric_shapes](models/models_geometric_shapes.c) | <img src="models/models_geometric_shapes.png" alt="models_geometric_shapes" width="200"> | ray | |
| 75 | [models_material_pbr](models/models_material_pbr.c) | <img src="models/models_material_pbr.png" alt="models_material_pbr" width="200"> | ray | | | 75 | [...]() | | ray | |
| 76 | [models_mesh_generation](models/models_mesh_generation.c) | <img src="models/models_mesh_generation.png" alt="models_mesh_generation" width="200"> | ray | | | 76 | [models_mesh_generation](models/models_mesh_generation.c) | <img src="models/models_mesh_generation.png" alt="models_mesh_generation" width="200"> | ray | |
| 77 | [models_mesh_picking](models/models_mesh_picking.c) | <img src="models/models_mesh_picking.png" alt="models_mesh_picking" width="200"> | [Joel Davis](https://github.com/joeld42) | | | 77 | [models_mesh_picking](models/models_mesh_picking.c) | <img src="models/models_mesh_picking.png" alt="models_mesh_picking" width="200"> | [Joel Davis](https://github.com/joeld42) | |
| 78 | [models_loading](models/models_loading.c) | <img src="models/models_loading.png" alt="models_loading" width="200"> | ray | | | 78 | [models_loading](models/models_loading.c) | <img src="models/models_loading.png" alt="models_loading" width="200"> | ray | |
@@ -170,22 +188,6 @@ Examples showing physics functionality with raylib. This functionality is provid
| 110 | [physics_restitution](physics/physics_restitution.c) | <img src="physics/physics_restitution.png" alt="physics_restitution" width="200"> | [Victor Fisac](https://github.com/victorfisac) | | | 110 | [physics_restitution](physics/physics_restitution.c) | <img src="physics/physics_restitution.png" alt="physics_restitution" width="200"> | [Victor Fisac](https://github.com/victorfisac) | |
| 111 | [physics_shatter](physics/physics_shatter.c) | <img src="physics/physics_shatter.png" alt="physics_shatter" width="200"> | [Victor Fisac](https://github.com/victorfisac) | | | 111 | [physics_shatter](physics/physics_shatter.c) | <img src="physics/physics_shatter.png" alt="physics_shatter" width="200"> | [Victor Fisac](https://github.com/victorfisac) | |
### category: network
Examples showing raylib network functionality. This functionality is provided by [rnet](../src/rnet.h) module.
**Note that rnet module is under development and not ready yet.**
| ## | example | image | developer | new |
|----|----------|--------|:----------:|:---:|
| 112 | [network_ping_pong](network/network_ping_pong.c) | | [Jak Barnes](https://github.com/syphonx) | |
| 113 | [network_resolve_host](network/network_resolve_host.c) | | [Jak Barnes](https://github.com/syphonx) | |
| 114 | [network_tcp_client](network/network_tcp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
| 115 | [network_tcp_server](network/network_tcp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
| 116 | [network_test](network/network_test.c) | | [Jak Barnes](https://github.com/syphonx) | |
| 117 | [network_udp_client](network/network_udp_client.c) | | [Jak Barnes](https://github.com/syphonx) | |
| 118 | [network_udp_server](network/network_udp_server.c) | | [Jak Barnes](https://github.com/syphonx) | |
### category: others ### category: others
Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries. Examples showing raylib misc functionality that does not fit in other categories, like standalone modules usage or examples integrating external libraries.

View File

@@ -31,8 +31,10 @@ int main(void)
InitAudioDevice(); // Initialize audio device InitAudioDevice(); // Initialize audio device
SetAudioStreamBufferSizeDefault(MAX_SAMPLES_PER_UPDATE);
// Init raw audio stream (sample rate: 22050, sample size: 16bit-short, channels: 1-mono) // Init raw audio stream (sample rate: 22050, sample size: 16bit-short, channels: 1-mono)
AudioStream stream = InitAudioStream(22050, 16, 1); AudioStream stream = LoadAudioStream(44100, 16, 1);
// Buffer for the single cycle waveform we are synthesizing // Buffer for the single cycle waveform we are synthesizing
short *data = (short *)malloc(sizeof(short)*MAX_SAMPLES); short *data = (short *)malloc(sizeof(short)*MAX_SAMPLES);
@@ -71,7 +73,7 @@ int main(void)
// Sample mouse input. // Sample mouse input.
mousePosition = GetMousePosition(); mousePosition = GetMousePosition();
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) if (IsMouseButtonDown(MOUSE_BUTTON_LEFT))
{ {
float fp = (float)(mousePosition.y); float fp = (float)(mousePosition.y);
frequency = 40.0f + (float)(fp); frequency = 40.0f + (float)(fp);
@@ -155,7 +157,7 @@ int main(void)
free(data); // Unload sine wave data free(data); // Unload sine wave data
free(writeBuf); // Unload write buffer free(writeBuf); // Unload write buffer
CloseAudioStream(stream); // Close raw audio stream and delete buffers from RAM UnloadAudioStream(stream); // Close raw audio stream and delete buffers from RAM
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped) CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context

View File

@@ -3,8 +3,8 @@
| country.mp3 | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game | | country.mp3 | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
| target.ogg | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game | | target.ogg | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
| target.flac | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game | | target.flac | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Originally created for "DART that TARGET" game |
| coin.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) | | coin.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
| sound.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) | | sound.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
| spring.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) | | spring.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
| weird.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Created using [rFXGen](https://raylibtech.itch.io/rfxgen) | | weird.wav | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | Made with [rFXGen](https://raylibtech.itch.io/rfxgen) |
| mini1111.xm | [tPORt](https://modarchive.org/index.php?request=view_by_moduleid&query=51891) | [Mod Archive Distribution license](https://modarchive.org/index.php?terms-upload) | - | | mini1111.xm | [tPORt](https://modarchive.org/index.php?request=view_by_moduleid&query=51891) | [Mod Archive Distribution license](https://modarchive.org/index.php?terms-upload) | - |

86
examples/build.zig Normal file
View File

@@ -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));
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -33,7 +33,7 @@ int main(void)
Ray ray = { 0 }; // Picking line ray Ray ray = { 0 }; // Picking line ray
bool collision = false; RayCollision collision = { 0 };
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
@@ -47,18 +47,18 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera UpdateCamera(&camera); // Update camera
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
{ {
if (!collision) if (!collision.hit)
{ {
ray = GetMouseRay(GetMousePosition(), camera); ray = GetMouseRay(GetMousePosition(), camera);
// Check collision between ray and box // Check collision between ray and box
collision = CheckCollisionRayBox(ray, collision = GetRayCollisionBox(ray,
(BoundingBox){(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 }, (BoundingBox){(Vector3){ cubePosition.x - cubeSize.x/2, cubePosition.y - cubeSize.y/2, cubePosition.z - cubeSize.z/2 },
(Vector3){ cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2 }}); (Vector3){ cubePosition.x + cubeSize.x/2, cubePosition.y + cubeSize.y/2, cubePosition.z + cubeSize.z/2 }});
} }
else collision = false; else collision.hit = false;
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -70,7 +70,7 @@ int main(void)
BeginMode3D(camera); BeginMode3D(camera);
if (collision) if (collision.hit)
{ {
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED); DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON); DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
@@ -90,7 +90,7 @@ int main(void)
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY); DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
if (collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN); if (collision.hit) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN);
DrawFPS(10, 10); DrawFPS(10, 10);

View File

@@ -1,35 +1,34 @@
/******************************************************************************************* /*******************************************************************************************
* *
* raylib - Simple Game template * raylib [core] examples - basic screen manager
* *
* <Game title> * This example illustrates a very simple screen manager based on a states machines
* <Game description>
* *
* This game has been created using raylib (www.raylib.com) * This test has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014-2021 Ramon Santamaria (@raysan5) * Copyright (c) 2021 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
//---------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
//---------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------
typedef enum GameScreen { LOGO = 0, TITLE, GAMEPLAY, ENDING } GameScreen; typedef enum GameScreen { LOGO = 0, TITLE, GAMEPLAY, ENDING } GameScreen;
//---------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------
// Main entry point // Main entry point
//---------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------
int main(void) int main(void)
{ {
// Initialization (Note windowTitle is unused on Android) // Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
const int screenWidth = 800; const int screenWidth = 800;
const int screenHeight = 450; const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib template - simple game"); InitWindow(screenWidth, screenHeight, "raylib [core] example - basic screen manager");
GameScreen currentScreen = LOGO; GameScreen currentScreen = LOGO;
@@ -39,15 +38,15 @@ int main(void)
SetTargetFPS(60); // Set desired framerate (frames-per-second) SetTargetFPS(60); // Set desired framerate (frames-per-second)
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
switch(currentScreen) switch(currentScreen)
{ {
case LOGO: case LOGO:
{ {
// TODO: Update LOGO screen variables here! // TODO: Update LOGO screen variables here!
@@ -59,7 +58,7 @@ int main(void)
currentScreen = TITLE; currentScreen = TITLE;
} }
} break; } break;
case TITLE: case TITLE:
{ {
// TODO: Update TITLE screen variables here! // TODO: Update TITLE screen variables here!
@@ -70,16 +69,16 @@ int main(void)
} }
} break; } break;
case GAMEPLAY: case GAMEPLAY:
{ {
// TODO: Update GAMEPLAY screen variables here! // TODO: Update GAMEPLAY screen variables here!
// Press enter to change to ENDING screen // Press enter to change to ENDING screen
if (IsKeyPressed(KEY_ENTER) || IsGestureDetected(GESTURE_TAP)) if (IsKeyPressed(KEY_ENTER) || IsGestureDetected(GESTURE_TAP))
{ {
currentScreen = ENDING; currentScreen = ENDING;
} }
} break; } break;
case ENDING: case ENDING:
{ {
// TODO: Update ENDING screen variables here! // TODO: Update ENDING screen variables here!
@@ -87,63 +86,63 @@ int main(void)
if (IsKeyPressed(KEY_ENTER) || IsGestureDetected(GESTURE_TAP)) if (IsKeyPressed(KEY_ENTER) || IsGestureDetected(GESTURE_TAP))
{ {
currentScreen = TITLE; currentScreen = TITLE;
} }
} break; } break;
default: break; default: break;
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
switch(currentScreen) switch(currentScreen)
{ {
case LOGO: case LOGO:
{ {
// TODO: Draw LOGO screen here! // TODO: Draw LOGO screen here!
DrawText("LOGO SCREEN", 20, 20, 40, LIGHTGRAY); DrawText("LOGO SCREEN", 20, 20, 40, LIGHTGRAY);
DrawText("WAIT for 2 SECONDS...", 290, 220, 20, GRAY); DrawText("WAIT for 2 SECONDS...", 290, 220, 20, GRAY);
} break; } break;
case TITLE: case TITLE:
{ {
// TODO: Draw TITLE screen here! // TODO: Draw TITLE screen here!
DrawRectangle(0, 0, screenWidth, screenHeight, GREEN); DrawRectangle(0, 0, screenWidth, screenHeight, GREEN);
DrawText("TITLE SCREEN", 20, 20, 40, DARKGREEN); DrawText("TITLE SCREEN", 20, 20, 40, DARKGREEN);
DrawText("PRESS ENTER or TAP to JUMP to GAMEPLAY SCREEN", 120, 220, 20, DARKGREEN); DrawText("PRESS ENTER or TAP to JUMP to GAMEPLAY SCREEN", 120, 220, 20, DARKGREEN);
} break; } break;
case GAMEPLAY: case GAMEPLAY:
{ {
// TODO: Draw GAMEPLAY screen here! // TODO: Draw GAMEPLAY screen here!
DrawRectangle(0, 0, screenWidth, screenHeight, PURPLE); DrawRectangle(0, 0, screenWidth, screenHeight, PURPLE);
DrawText("GAMEPLAY SCREEN", 20, 20, 40, MAROON); DrawText("GAMEPLAY SCREEN", 20, 20, 40, MAROON);
DrawText("PRESS ENTER or TAP to JUMP to ENDING SCREEN", 130, 220, 20, MAROON); DrawText("PRESS ENTER or TAP to JUMP to ENDING SCREEN", 130, 220, 20, MAROON);
} break; } break;
case ENDING: case ENDING:
{ {
// TODO: Draw ENDING screen here! // TODO: Draw ENDING screen here!
DrawRectangle(0, 0, screenWidth, screenHeight, BLUE); DrawRectangle(0, 0, screenWidth, screenHeight, BLUE);
DrawText("ENDING SCREEN", 20, 20, 40, DARKBLUE); DrawText("ENDING SCREEN", 20, 20, 40, DARKBLUE);
DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, DARKBLUE); DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, DARKBLUE);
} break; } break;
default: break; default: break;
} }
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// TODO: Unload all loaded data (textures, fonts, audio) here! // TODO: Unload all loaded data (textures, fonts, audio) here!
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -45,9 +45,9 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -0,0 +1,125 @@
/*******************************************************************************************
*
* raylib [core] example - custom frame control
*
* WARNING: This is an example for advance users willing to have full control over
* the frame processes. By default, EndDrawing() calls the following processes:
* 1. Draw remaining batch data: rlDrawRenderBatchActive()
* 2. SwapScreenBuffer()
* 3. Frame time control: WaitTime()
* 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.
*
* Note that enabling this flag invalidates some functions:
* - GetFrameTime()
* - SetTargetFPS()
* - GetFPS()
*
* This example has been created using raylib 3.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2021 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - custom frame control");
// Custom timming variables
double previousTime = GetTime(); // Previous time measure
double currentTime = 0.0; // Current time measure
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
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
PollInputEvents(); // Poll input events (SUPPORT_CUSTOM_FRAME_CONTROL)
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)
{
position += 200*deltaTime; // We move at 200 pixels per second
if (position >= GetScreenWidth()) position = 0;
timeCounter += deltaTime; // We count time (seconds)
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
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), position - 40, GetScreenHeight()/2 - 100, 20, MAROON);
DrawText(TextFormat("PosX: %03.0f", position), 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);
DrawText(TextFormat("TARGET FPS: %i", targetFPS), GetScreenWidth() - 220, 10, 20, LIME);
DrawText(TextFormat("CURRENT FPS: %i", (int)(1.0f/deltaTime)), GetScreenWidth() - 220, 40, 20, GREEN);
EndDrawing();
// 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)
{
WaitTime((float)waitTime*1000.0f);
currentTime = GetTime();
deltaTime = (float)(currentTime - previousTime);
}
}
else deltaTime = updateDrawTime; // Framerate could be variable
previousTime = currentTime;
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -62,7 +62,7 @@ int main(void)
{ {
DrawText(TextFormat("GP1: %s", GetGamepadName(0)), 10, 10, 10, BLACK); DrawText(TextFormat("GP1: %s", GetGamepadName(0)), 10, 10, 10, BLACK);
if (IsGamepadName(0, XBOX360_NAME_ID) || IsGamepadName(0, XBOX360_LEGACY_NAME_ID)) if (TextIsEqual(GetGamepadName(0), XBOX360_NAME_ID) || TextIsEqual(GetGamepadName(0), XBOX360_LEGACY_NAME_ID))
{ {
DrawTexture(texXboxPad, 0, 0, DARKGRAY); DrawTexture(texXboxPad, 0, 0, DARKGRAY);
@@ -110,7 +110,7 @@ int main(void)
//DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK); //DrawText(TextFormat("Xbox axis LT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
//DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK); //DrawText(TextFormat("Xbox axis RT: %02.02f", GetGamepadAxisMovement(0, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
} }
else if (IsGamepadName(0, PS3_NAME_ID)) else if (TextIsEqual(GetGamepadName(0), PS3_NAME_ID))
{ {
DrawTexture(texPs3Pad, 0, 0, DARKGRAY); DrawTexture(texPs3Pad, 0, 0, DARKGRAY);

View File

@@ -33,9 +33,13 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
ballPosition = GetMousePosition(); ballPosition = GetMousePosition();
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) ballColor = MAROON; if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) ballColor = MAROON;
else if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) ballColor = LIME; else if (IsMouseButtonPressed(MOUSE_BUTTON_MIDDLE)) ballColor = LIME;
else if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE; else if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) ballColor = DARKBLUE;
else if (IsMouseButtonPressed(MOUSE_BUTTON_SIDE)) ballColor = PURPLE;
else if (IsMouseButtonPressed(MOUSE_BUTTON_EXTRA)) ballColor = YELLOW;
else if (IsMouseButtonPressed(MOUSE_BUTTON_FORWARD)) ballColor = ORANGE;
else if (IsMouseButtonPressed(MOUSE_BUTTON_BACK)) ballColor = BEIGE;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View File

@@ -24,11 +24,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - input multitouch"); InitWindow(screenWidth, screenHeight, "raylib [core] example - input multitouch");
Vector2 ballPosition = { -100.0f, -100.0f }; Vector2 touchPositions[MAX_TOUCH_POINTS] = { 0 };
Color ballColor = BEIGE;
int touchCounter = 0;
Vector2 touchPosition = { 0 };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
@@ -38,19 +34,8 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
ballPosition = GetMousePosition(); // Get multiple touchpoints
for (int i = 0; i < MAX_TOUCH_POINTS; ++i) touchPositions[i] = GetTouchPosition(i);
ballColor = BEIGE;
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) ballColor = MAROON;
if (IsMouseButtonDown(MOUSE_MIDDLE_BUTTON)) ballColor = LIME;
if (IsMouseButtonDown(MOUSE_RIGHT_BUTTON)) ballColor = DARKBLUE;
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) touchCounter = 10;
if (IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) touchCounter = 10;
if (IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) touchCounter = 10;
if (touchCounter > 0) touchCounter--;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -58,25 +43,19 @@ int main(void)
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
// Multitouch
for (int i = 0; i < MAX_TOUCH_POINTS; ++i) for (int i = 0; i < MAX_TOUCH_POINTS; ++i)
{ {
touchPosition = GetTouchPosition(i); // Get the touch point // Make sure point is not (0, 0) as this means there is no touch for it
if ((touchPositions[i].x > 0) && (touchPositions[i].y > 0))
if ((touchPosition.x >= 0) && (touchPosition.y >= 0)) // Make sure point is not (-1,-1) as this means there is no touch for it
{ {
// Draw circle and touch index number // Draw circle and touch index number
DrawCircleV(touchPosition, 34, ORANGE); DrawCircleV(touchPositions[i], 34, ORANGE);
DrawText(TextFormat("%d", i), (int)touchPosition.x - 10, (int)touchPosition.y - 70, 40, BLACK); DrawText(TextFormat("%d", i), (int)touchPositions[i].x - 10, (int)touchPositions[i].y - 70, 40, BLACK);
} }
} }
// Draw the normal mouse location DrawText("touch the screen at multiple locations to get multiple balls", 10, 10, 20, DARKGRAY);
DrawCircleV(ballPosition, 30 + (touchCounter*3.0f), ballColor);
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
DrawText("touch the screen at multiple locations to get multiple balls", 10, 30, 20, DARKGRAY);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -10,7 +10,7 @@
* *
* Example contributed by Chris Camacho (@chriscamacho) and reviewed by Ramon Santamaria (@raysan5) * Example contributed by Chris Camacho (@chriscamacho) and reviewed by Ramon Santamaria (@raysan5)
* *
* Copyright (c) 2020 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5) * Copyright (c) 2020-2021 Chris Camacho (@chriscamacho) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -32,15 +32,23 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point 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.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Mesh mesh = GenMeshCylinder(0.2f, 1.0f, 32); // Load a cylinder model for testing
Model model = LoadModelFromMesh(mesh); Model model = LoadModelFromMesh(GenMeshCylinder(0.2f, 1.0f, 32));
// Some required variables // Generic quaternion for operations
Quaternion q1 = { 0 }; Quaternion q1 = { 0 };
Matrix m1 = { 0 }, m2 = { 0 }, m3 = { 0 }, m4 = { 0 };
Vector3 v1 = { 0 }, v2 = { 0 }; // Transform matrices required to draw 4 cylinders
Matrix m1 = { 0 };
Matrix m2 = { 0 };
Matrix m3 = { 0 };
Matrix m4 = { 0 };
// Generic vectors for rotations
Vector3 v1 = { 0 };
Vector3 v2 = { 0 };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -50,6 +58,10 @@ int main(void)
{ {
// Update // Update
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
if (v2.x < 0) v2.x += PI*2;
if (v2.y < 0) v2.y += PI*2;
if (v2.z < 0) v2.z += PI*2;
if (!IsKeyDown(KEY_SPACE)) if (!IsKeyDown(KEY_SPACE))
{ {
v1.x += 0.01f; v1.x += 0.01f;
@@ -68,10 +80,7 @@ int main(void)
q1 = QuaternionFromMatrix(m1); q1 = QuaternionFromMatrix(m1);
m3 = QuaternionToMatrix(q1); m3 = QuaternionToMatrix(q1);
v2 = QuaternionToEuler(q1); v2 = QuaternionToEuler(q1); // Angles returned in radians
v2.x *= DEG2RAD;
v2.y *= DEG2RAD;
v2.z *= DEG2RAD;
m4 = MatrixRotateZYX(v2); m4 = MatrixRotateZYX(v2);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -86,10 +95,13 @@ int main(void)
model.transform = m1; model.transform = m1;
DrawModel(model, (Vector3){ -1, 0, 0 }, 1.0f, RED); DrawModel(model, (Vector3){ -1, 0, 0 }, 1.0f, RED);
model.transform = m2; model.transform = m2;
DrawModel(model, (Vector3){ 1, 0, 0 }, 1.0f, RED); DrawModel(model, (Vector3){ 1, 0, 0 }, 1.0f, RED);
model.transform = m3; model.transform = m3;
DrawModel(model, (Vector3){ 0, 0, 0 }, 1.0f, RED); DrawModel(model, (Vector3){ 0, 0, 0 }, 1.0f, RED);
model.transform = m4; model.transform = m4;
DrawModel(model, (Vector3){ 0, 0, -1 }, 1.0f, RED); DrawModel(model, (Vector3){ 0, 0, -1 }, 1.0f, RED);
@@ -97,23 +109,13 @@ int main(void)
EndMode3D(); EndMode3D();
if (v2.x < 0) v2.x += PI*2; DrawText(TextFormat("%2.3f", v1.x), 20, 20, 20, (v1.x == v2.x)? GREEN: BLACK);
if (v2.y < 0) v2.y += PI*2; DrawText(TextFormat("%2.3f", v1.y), 20, 40, 20, (v1.y == v2.y)? GREEN: BLACK);
if (v2.z < 0) v2.z += PI*2; DrawText(TextFormat("%2.3f", v1.z), 20, 60, 20, (v1.z == v2.z)? GREEN: BLACK);
Color cx,cy,cz; DrawText(TextFormat("%2.3f", v2.x), 200, 20, 20, (v1.x == v2.x)? GREEN: BLACK);
cx = cy = cz = BLACK; DrawText(TextFormat("%2.3f", v2.y), 200, 40, 20, (v1.y == v2.y)? GREEN: BLACK);
if (v1.x == v2.x) cx = GREEN; DrawText(TextFormat("%2.3f", v2.z), 200, 60, 20, (v1.z == v2.z)? GREEN: BLACK);
if (v1.y == v2.y) cy = GREEN;
if (v1.z == v2.z) cz = GREEN;
DrawText(TextFormat("%2.3f", v1.x), 20, 20, 20, cx);
DrawText(TextFormat("%2.3f", v1.y), 20, 40, 20, cy);
DrawText(TextFormat("%2.3f", v1.z), 20, 60, 20, cz);
DrawText(TextFormat("%2.3f", v2.x), 200, 20, 20, cx);
DrawText(TextFormat("%2.3f", v2.y), 200, 40, 20, cy);
DrawText(TextFormat("%2.3f", v2.z), 200, 60, 20, cz);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -20,10 +20,12 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values"); InitWindow(screenWidth, screenHeight, "raylib [core] example - generate random values");
int framesCounter = 0; // Variable used to count frames // 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) int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
int framesCounter = 0; // Variable used to count frames
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

@@ -0,0 +1,117 @@
/*******************************************************************************************
*
* raylib [core] example - smooth pixel-perfect camera
*
* This example has been created using raylib 3.7 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Example contributed by Giancamillo Alessandroni (@NotManyIdeasDev) and
* reviewed by Ramon Santamaria (@raysan5)
*
* Copyright (c) 2021 Giancamillo Alessandroni (@NotManyIdeasDev) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include <math.h> // Required for: sinf(), cosf()
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
const int virtualScreenWidth = 160;
const int virtualScreenHeight = 90;
const float virtualRatio = (float)screenWidth/(float)virtualScreenWidth;
InitWindow(screenWidth, screenHeight, "raylib [core] example - smooth pixel-perfect camera");
Camera2D worldSpaceCamera = { 0 }; // Game world camera
worldSpaceCamera.zoom = 1.0f;
Camera2D screenSpaceCamera = { 0 }; // Smoothing camera
screenSpaceCamera.zoom = 1.0f;
RenderTexture2D target = LoadRenderTexture(virtualScreenWidth, virtualScreenHeight); // This is where we'll draw all our objects.
Rectangle rec01 = { 70.0f, 35.0f, 20.0f, 20.0f };
Rectangle rec02 = { 90.0f, 55.0f, 30.0f, 10.0f };
Rectangle rec03 = { 80.0f, 65.0f, 15.0f, 25.0f };
// The target's height is flipped (in the source Rectangle), due to OpenGL reasons
Rectangle sourceRec = { 0.0f, 0.0f, (float)target.texture.width, -(float)target.texture.height };
Rectangle destRec = { -virtualRatio, -virtualRatio, screenWidth + (virtualRatio*2), screenHeight + (virtualRatio*2) };
Vector2 origin = { 0.0f, 0.0f };
float rotation = 0.0f;
float cameraX = 0.0f;
float cameraY = 0.0f;
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
rotation += 60.0f*GetFrameTime(); // Rotate the rectangles, 60 degrees per second
// Make the camera move to demonstrate the effect
cameraX = (sinf(GetTime())*50.0f) - 10.0f;
cameraY = cosf(GetTime())*30.0f;
// Set the camera's target to the values computed above
screenSpaceCamera.target = (Vector2){ cameraX, cameraY };
// Round worldSpace coordinates, keep decimals into screenSpace coordinates
worldSpaceCamera.target.x = (int)screenSpaceCamera.target.x;
screenSpaceCamera.target.x -= worldSpaceCamera.target.x;
screenSpaceCamera.target.x *= virtualRatio;
worldSpaceCamera.target.y = (int)screenSpaceCamera.target.y;
screenSpaceCamera.target.y -= worldSpaceCamera.target.y;
screenSpaceCamera.target.y *= virtualRatio;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginTextureMode(target);
ClearBackground(RAYWHITE);
BeginMode2D(worldSpaceCamera);
DrawRectanglePro(rec01, origin, rotation, BLACK);
DrawRectanglePro(rec02, origin, -rotation, RED);
DrawRectanglePro(rec03, origin, rotation + 45.0f, BLUE);
EndMode2D();
EndTextureMode();
BeginDrawing();
ClearBackground(RED);
BeginMode2D(screenSpaceCamera);
DrawTexturePro(target.texture, sourceRec, destRec, origin, 0.0f, WHITE);
EndMode2D();
DrawText(TextFormat("Screen resolution: %ix%i", screenWidth, screenHeight), 10, 10, 20, DARKBLUE);
DrawText(TextFormat("World resolution: %ix%i", virtualScreenWidth, virtualScreenHeight), 10, 40, 20, DARKGREEN);
DrawFPS(GetScreenWidth() - 95, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadRenderTexture(target); // Unload render texture
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,155 @@
/*******************************************************************************************
*
* raylib [core] example - split screen
*
* This example has been created using raylib 3.7 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Example contributed by Jeffery Myers (@JeffM2501) and reviewed by Ramon Santamaria (@raysan5)
*
* Copyright (c) 2021 Jeffery Myers (@JeffM2501)
*
********************************************************************************************/
#include "raylib.h"
Texture2D textureGrid = { 0 };
Camera cameraPlayer1 = { 0 };
Camera cameraPlayer2 = { 0 };
// Scene drawing
void DrawScene(void)
{
int count = 5;
float spacing = 4;
// Grid of cube trees on a plane to make a "world"
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 50, 50 }, BEIGE); // Simple world plane
for (float x = -count*spacing; x <= count*spacing; x += spacing)
{
for (float z = -count*spacing; z <= count*spacing; z += spacing)
{
DrawCubeTexture(textureGrid, (Vector3) { x, 1.5f, z }, 1, 1, 1, GREEN);
DrawCubeTexture(textureGrid, (Vector3) { x, 0.5f, z }, 0.25f, 1, 0.25f, BROWN);
}
}
// Draw a cube at each player's position
DrawCube(cameraPlayer1.position, 1, 1, 1, RED);
DrawCube(cameraPlayer2.position, 1, 1, 1, BLUE);
}
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - split screen");
// Generate a simple texture to use for trees
Image img = GenImageChecked(256, 256, 32, 32, DARKGRAY, WHITE);
textureGrid = LoadTextureFromImage(img);
UnloadImage(img);
SetTextureFilter(textureGrid, TEXTURE_FILTER_ANISOTROPIC_16X);
SetTextureWrap(textureGrid, TEXTURE_WRAP_CLAMP);
// Setup player 1 camera and screen
cameraPlayer1.fovy = 45.0f;
cameraPlayer1.up.y = 1.0f;
cameraPlayer1.target.y = 1.0f;
cameraPlayer1.position.z = -3.0f;
cameraPlayer1.position.y = 1.0f;
RenderTexture screenPlayer1 = LoadRenderTexture(screenWidth/2, screenHeight);
// Setup player two camera and screen
cameraPlayer2.fovy = 45.0f;
cameraPlayer2.up.y = 1.0f;
cameraPlayer2.target.y = 3.0f;
cameraPlayer2.position.x = -3.0f;
cameraPlayer2.position.y = 3.0f;
RenderTexture screenPlayer2 = LoadRenderTexture(screenWidth / 2, screenHeight);
// 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 };
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
//----------------------------------------------------------------------------------
// If anyone moves this frame, how far will they move based on the time since the last frame
// this moves thigns at 10 world units per second, regardless of the actual FPS
float offsetThisFrame = 10.0f*GetFrameTime();
// Move Player1 forward and backwards (no turning)
if (IsKeyDown(KEY_W))
{
cameraPlayer1.position.z += offsetThisFrame;
cameraPlayer1.target.z += offsetThisFrame;
}
else if (IsKeyDown(KEY_S))
{
cameraPlayer1.position.z -= offsetThisFrame;
cameraPlayer1.target.z -= offsetThisFrame;
}
// Move Player2 forward and backwards (no turning)
if (IsKeyDown(KEY_UP))
{
cameraPlayer2.position.x += offsetThisFrame;
cameraPlayer2.target.x += offsetThisFrame;
}
else if (IsKeyDown(KEY_DOWN))
{
cameraPlayer2.position.x -= offsetThisFrame;
cameraPlayer2.target.x -= offsetThisFrame;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
// Draw Player1 view to the render texture
BeginTextureMode(screenPlayer1);
ClearBackground(SKYBLUE);
BeginMode3D(cameraPlayer1);
DrawScene();
EndMode3D();
DrawText("PLAYER1 W/S to move", 10, 10, 20, RED);
EndTextureMode();
// Draw Player2 view to the render texture
BeginTextureMode(screenPlayer2);
ClearBackground(SKYBLUE);
BeginMode3D(cameraPlayer2);
DrawScene();
EndMode3D();
DrawText("PLAYER2 UP/DOWN to move", 10, 10, 20, BLUE);
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);
EndDrawing();
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadRenderTexture(screenPlayer1); // Unload render texture
UnloadRenderTexture(screenPlayer2); // Unload render texture
UnloadTexture(textureGrid); // Unload texture
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -105,30 +105,26 @@ int main(void)
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginTextureMode(target);
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
BeginVrStereoMode(config);
BeginMode3D(camera);
BeginTextureMode(target); DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
ClearBackground(RAYWHITE); DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
BeginVrStereoMode(config); DrawGrid(40, 1.0f);
BeginMode3D(camera);
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
DrawGrid(40, 1.0f);
EndMode3D();
EndVrStereoMode();
EndTextureMode();
EndMode3D();
EndVrStereoMode();
EndTextureMode();
BeginDrawing();
ClearBackground(RAYWHITE);
BeginShaderMode(distortion); BeginShaderMode(distortion);
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width,
(float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
EndShaderMode(); EndShaderMode();
DrawFPS(10, 10); DrawFPS(10, 10);
EndDrawing(); EndDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }

View File

@@ -43,16 +43,16 @@ int main(void)
// Render texture initialization, used to hold the rendering result so we can easily resize it // Render texture initialization, used to hold the rendering result so we can easily resize it
RenderTexture2D target = LoadRenderTexture(gameScreenWidth, gameScreenHeight); RenderTexture2D target = LoadRenderTexture(gameScreenWidth, gameScreenHeight);
SetTextureFilter(target.texture, FILTER_BILINEAR); // Texture scale filter to use SetTextureFilter(target.texture, TEXTURE_FILTER_BILINEAR); // Texture scale filter to use
Color colors[10] = { 0 }; Color colors[10] = { 0 };
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 }; for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key while (!WindowShouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -79,37 +79,33 @@ int main(void)
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw everything in the render texture, note this will not be rendered on screen, yet
BeginTextureMode(target);
ClearBackground(RAYWHITE); // Clear render texture background color
for (int i = 0; i < 10; i++) DrawRectangle(0, (gameScreenHeight/10)*i, gameScreenWidth, gameScreenHeight/10, colors[i]);
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
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(); BeginDrawing();
ClearBackground(BLACK); ClearBackground(BLACK); // Clear screen background
// Draw everything in the render texture, note this will not be rendered on screen, yet // Draw render texture to screen, properly scaled
BeginTextureMode(target);
ClearBackground(RAYWHITE); // Clear render texture background color
for (int i = 0; i < 10; i++) DrawRectangle(0, (gameScreenHeight/10)*i, gameScreenWidth, gameScreenHeight/10, colors[i]);
DrawText("If executed inside a window,\nyou can resize the window,\nand see the screen scaling!", 10, 25, 20, WHITE);
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();
// Draw RenderTexture2D to window, properly scaled
DrawTexturePro(target.texture, (Rectangle){ 0.0f, 0.0f, (float)target.texture.width, (float)-target.texture.height }, DrawTexturePro(target.texture, (Rectangle){ 0.0f, 0.0f, (float)target.texture.width, (float)-target.texture.height },
(Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5f, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5f, (Rectangle){ (GetScreenWidth() - ((float)gameScreenWidth*scale))*0.5f, (GetScreenHeight() - ((float)gameScreenHeight*scale))*0.5f,
(float)gameScreenWidth*scale, (float)gameScreenHeight*scale }, (Vector2){ 0, 0 }, 0.0f, WHITE); (float)gameScreenWidth*scale, (float)gameScreenHeight*scale }, (Vector2){ 0, 0 }, 0.0f, WHITE);
EndDrawing(); EndDrawing();
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
UnloadRenderTexture(target); // Unload render texture UnloadRenderTexture(target); // Unload render texture
CloseWindow(); // Close window and OpenGL context CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;

View File

@@ -17,7 +17,7 @@ uniform vec2 leftScreenCenter;
uniform vec2 rightScreenCenter; uniform vec2 rightScreenCenter;
uniform vec2 scale; uniform vec2 scale;
uniform vec2 scaleIn; uniform vec2 scaleIn;
uniform vec4 hmdWarpParam; uniform vec4 deviceWarpParam;
uniform vec4 chromaAbParam; uniform vec4 chromaAbParam;
void main() void main()
@@ -27,7 +27,7 @@ void main()
vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter; vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter;
vec2 theta = (fragTexCoord - lensCenter)*scaleIn; vec2 theta = (fragTexCoord - lensCenter)*scaleIn;
float rSq = theta.x*theta.x + theta.y*theta.y; float rSq = theta.x*theta.x + theta.y*theta.y;
vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq); 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 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq);
vec2 tcBlue = lensCenter + scale*thetaBlue; vec2 tcBlue = lensCenter + scale*thetaBlue;

View File

@@ -18,7 +18,7 @@ uniform vec2 leftScreenCenter = vec2(0.25, 0.5);
uniform vec2 rightScreenCenter = vec2(0.75, 0.5); uniform vec2 rightScreenCenter = vec2(0.75, 0.5);
uniform vec2 scale = vec2(0.25, 0.45); uniform vec2 scale = vec2(0.25, 0.45);
uniform vec2 scaleIn = vec2(4, 2.2222); uniform vec2 scaleIn = vec2(4, 2.2222);
uniform vec4 hmdWarpParam = vec4(1, 0.22, 0.24, 0); uniform vec4 deviceWarpParam = vec4(1, 0.22, 0.24, 0);
uniform vec4 chromaAbParam = vec4(0.996, -0.004, 1.014, 0.0); uniform vec4 chromaAbParam = vec4(0.996, -0.004, 1.014, 0.0);
void main() void main()
@@ -28,7 +28,7 @@ void main()
vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter; vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter;
vec2 theta = (fragTexCoord - lensCenter)*scaleIn; vec2 theta = (fragTexCoord - lensCenter)*scaleIn;
float rSq = theta.x*theta.x + theta.y*theta.y; float rSq = theta.x*theta.x + theta.y*theta.y;
vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq); 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 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq);
vec2 tcBlue = lensCenter + scale*thetaBlue; vec2 tcBlue = lensCenter + scale*thetaBlue;

View File

@@ -1,7 +1,7 @@
/* /*
WELCOME raylib EXAMPLES CONTRIBUTOR! WELCOME raylib EXAMPLES CONTRIBUTOR!
This is a bsasic template to anyone ready to contribute with some code example for the library, This is a basic template to anyone ready to contribute with some code example for the library,
here there are some guidelines on how to create an example to be included in raylib here there are some guidelines on how to create an example to be included in raylib
1. File naming: <module>_<description> - Lower case filename, words separated by underscore, 1. File naming: <module>_<description> - Lower case filename, words separated by underscore,
@@ -41,16 +41,18 @@
* *
* raylib [core] example - Basic window * raylib [core] example - Basic window
* *
* This example has been created using raylib 2.5 (www.raylib.com) * This example has been created using raylib 3.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2019 Ramon Santamaria (@raysan5) * Example contributed by <user_name> (@<user_github>) and reviewed by Ramon Santamaria (@raysan5)
*
* Copyright (c) 2021 <user_name> (@<user_github>)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
int main() int main(void)
{ {
// Initialization // Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@@ -95,4 +97,4 @@ int main()
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }

View File

@@ -37,17 +37,17 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point 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.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model = LoadModel("resources/guy/guy.iqm"); // Load the animated model mesh and basic data Model model = LoadModel("resources/models/iqm/guy.iqm"); // Load the animated model mesh and basic data
Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material Texture2D texture = LoadTexture("resources/models/iqm/guytex.png"); // Load model texture and set material
SetMaterialTexture(&model.materials[0], MAP_DIFFUSE, texture); // Set model material map texture SetMaterialTexture(&model.materials[0], MATERIAL_MAP_DIFFUSE, texture); // Set model material map texture
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
// Load animation data // Load animation data
int animsCount = 0; unsigned int animsCount = 0;
ModelAnimation *anims = LoadModelAnimations("resources/guy/guyanim.iqm", &animsCount); ModelAnimation *anims = LoadModelAnimations("resources/models/iqm/guyanim.iqm", &animsCount);
int animFrameCounter = 0; int animFrameCounter = 0;
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
@@ -102,7 +102,7 @@ int main(void)
UnloadTexture(texture); // Unload texture UnloadTexture(texture); // Unload texture
// Unload model animations data // Unload model animations data
for (int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]); for (unsigned int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
RL_FREE(anims); RL_FREE(anims);
UnloadModel(model); // Unload model UnloadModel(model); // Unload model

View File

@@ -1,122 +0,0 @@
/*******************************************************************************************
*
* raylib [models] example - Load 3d gltf model with animations and play them
*
* 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)
*
* 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 <stdlib.h>
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - model animation");
// 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
Model model = LoadModel("resources/gltf/rigged_figure.glb"); // Load the animated model mesh and
// basic data
// Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material
// SetMaterialTexture(&model.materials[0], MAP_DIFFUSE, texture); // Set model material map texture
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
// Load animation data
int animsCount = 0;
ModelAnimation *anims = LoadModelAnimations("resources/gltf/rigged_figure.glb", &animsCount);
int animFrameCounter = 0;
int animationDirection = 1;
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
SetTargetFPS(30); // 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);
// Play animation when spacebar is held down
if (IsKeyDown(KEY_SPACE))
{
animFrameCounter += animationDirection;
if (animFrameCounter >= anims[0].frameCount || animFrameCounter <= 0)
{
animationDirection *= -1;
animFrameCounter += animationDirection;
}
UpdateModelAnimation(model, anims[0], animFrameCounter);
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
DrawModelEx(model, position, (Vector3){ 1.0f, 0.0f, 0.0f }, -90.0f, (Vector3){ 1.0f, 1.0f, 1.0f }, WHITE);
for (int i = 0; i < model.boneCount; i++)
{
DrawSphere(anims[0].framePoses[animFrameCounter][i].translation, 0.01f, RED);
}
DrawGrid(10, 1.0f); // Draw a grid
EndMode3D();
DrawText("PRESS SPACE to PLAY MODEL ANIMATION", 10, 10, 20, MAROON);
DrawText("(cc4) Rigged Figure by @Cesium", screenWidth - 200, screenHeight - 20, 10, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
// UnloadTexture(texture); // Unload texture
// Unload model animations data
for (int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
RL_FREE(anims);
UnloadModel(model); // Unload model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View File

@@ -4,17 +4,19 @@
* *
* raylib supports multiple models file formats: * raylib supports multiple models file formats:
* *
* - OBJ > Text file, must include vertex position-texcoords-normals information, * - 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 > Modern text/binary file format, includes lot of information and it could * - 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 including mesh vertex data but also animation 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
* *
* This example has been created using raylib 2.6 (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) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2014-2019 Ramon Santamaria (@raysan5) * Copyright (c) 2014-2021 Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
@@ -37,13 +39,13 @@ int main(void)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model = LoadModel("resources/models/castle.obj"); // Load model Model model = LoadModel("resources/models/obj/castle.obj"); // Load model
Texture2D texture = LoadTexture("resources/models/castle_diffuse.png"); // Load model texture Texture2D texture = LoadTexture("resources/models/obj/castle_diffuse.png"); // Load model texture
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
BoundingBox bounds = MeshBoundingBox(model.meshes[0]); // Set model bounds BoundingBox bounds = GetMeshBoundingBox(model.meshes[0]); // Set model bounds
// NOTE: bounds are calculated from the original size of the model, // NOTE: bounds are calculated from the original size of the model,
// if model is scaled on drawing, bounds must be also scaled // if model is scaled on drawing, bounds must be also scaled
@@ -72,13 +74,15 @@ int main(void)
{ {
if (IsFileExtension(droppedFiles[0], ".obj") || if (IsFileExtension(droppedFiles[0], ".obj") ||
IsFileExtension(droppedFiles[0], ".gltf") || IsFileExtension(droppedFiles[0], ".gltf") ||
IsFileExtension(droppedFiles[0], ".glb") ||
IsFileExtension(droppedFiles[0], ".vox") ||
IsFileExtension(droppedFiles[0], ".iqm")) // Model file formats supported IsFileExtension(droppedFiles[0], ".iqm")) // Model file formats supported
{ {
UnloadModel(model); // Unload previous model UnloadModel(model); // Unload previous model
model = LoadModel(droppedFiles[0]); // Load new model model = LoadModel(droppedFiles[0]); // Load new model
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set current map diffuse texture model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
bounds = MeshBoundingBox(model.meshes[0]); bounds = GetMeshBoundingBox(model.meshes[0]);
// TODO: Move camera position from target enough distance to visualize model properly // TODO: Move camera position from target enough distance to visualize model properly
} }
@@ -95,10 +99,10 @@ int main(void)
} }
// Select model on mouse click // Select model on mouse click
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
{ {
// Check collision between ray and box // Check collision between ray and box
if (CheckCollisionRayBox(GetMouseRay(GetMousePosition(), camera), bounds)) selected = !selected; if (GetRayCollisionBox(GetMouseRay(GetMousePosition(), camera), bounds).hit) selected = !selected;
else selected = false; else selected = false;
} }
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View File

@@ -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) * 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) * 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) * Example contributed by Hristo Stamenov (@object71) and reviewed by Ramon Santamaria (@raysan5)
* *
* Copyright (c) 2021 Hristo Stamenov (@object71) and 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 "raylib.h"
#include <stdlib.h> #define MAX_GLTF_MODELS 8
#define MAX_MODELS 6
int main(void) int main(void)
{ {
@@ -30,7 +27,7 @@ int main(void)
const int screenWidth = 800; const int screenWidth = 800;
const int screenHeight = 450; const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - model animation"); InitWindow(screenWidth, screenHeight, "raylib [models] example - model");
// Define the camera to look into our 3d world // Define the camera to look into our 3d world
Camera camera = { 0 }; Camera camera = { 0 };
@@ -40,14 +37,16 @@ int main(void)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model[MAX_MODELS] = { 0 }; // Load some models
Model model[MAX_GLTF_MODELS] = { 0 };
model[0] = LoadModel("resources/gltf/raylib_32x32.glb"); model[0] = LoadModel("resources/models/gltf/raylib_32x32.glb");
model[1] = LoadModel("resources/gltf/rigged_figure.glb"); model[1] = LoadModel("resources/models/gltf/rigged_figure.glb");
model[2] = LoadModel("resources/gltf/GearboxAssy.glb"); model[2] = LoadModel("resources/models/gltf/GearboxAssy.glb");
model[3] = LoadModel("resources/gltf/BoxAnimated.glb"); model[3] = LoadModel("resources/models/gltf/BoxAnimated.glb");
model[4] = LoadModel("resources/gltf/AnimatedTriangle.gltf"); model[4] = LoadModel("resources/models/gltf/AnimatedTriangle.gltf");
model[5] = LoadModel("resources/gltf/AnimatedMorphCube.glb"); model[5] = LoadModel("resources/models/gltf/AnimatedMorphCube.glb");
model[6] = LoadModel("resources/models/gltf/vertex_colored_object.glb");
model[7] = LoadModel("resources/models/gltf/girl.glb");
int currentModel = 0; int currentModel = 0;
@@ -63,19 +62,20 @@ int main(void)
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); UpdateCamera(&camera); // Update our camera with inputs
if (IsKeyReleased(KEY_RIGHT)) if (IsKeyReleased(KEY_RIGHT))
{ {
currentModel++; currentModel++;
if (currentModel == MAX_MODELS) currentModel = 0; if (currentModel == MAX_GLTF_MODELS) currentModel = 0;
} }
if (IsKeyReleased(KEY_LEFT)) if (IsKeyReleased(KEY_LEFT))
{ {
currentModel--; currentModel--;
if (currentModel < 0) currentModel = MAX_MODELS - 1; if (currentModel < 0) currentModel = MAX_GLTF_MODELS - 1;
} }
//----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
@@ -85,8 +85,7 @@ int main(void)
BeginMode3D(camera); 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 DrawGrid(10, 1.0f); // Draw a grid
EndMode3D(); EndMode3D();
@@ -97,7 +96,7 @@ int main(void)
// De-Initialization // 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 CloseWindow(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,130 @@
/*******************************************************************************************
*
* raylib [models] example - Load models vox (MagicaVoxel)
*
* 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) and reviewed by Ramon Santamaria (@raysan5)
*
* Copyright (c) 2021 Johann Nadalutti (@procfxgen) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h" // Required for: MatrixTranslate()
#define MAX_VOX_FILES 3
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[MAX_VOX_FILES] = { 0 };
for (int i = 0; i < MAX_VOX_FILES; i++)
{
// 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;
}
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 our camera to orbit
// Cycle between models on mouse click
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) currentModel = (currentModel + 1)%MAX_VOX_FILES;
// Cycle between models on key pressed
if (IsKeyPressed(KEY_RIGHT))
{
currentModel++;
if (currentModel >= MAX_VOX_FILES) currentModel = 0;
}
else if (IsKeyPressed(KEY_LEFT))
{
currentModel--;
if (currentModel < 0) currentModel = MAX_VOX_FILES - 1;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// Draw 3D model
BeginMode3D(camera);
DrawModel(models[currentModel], (Vector3){ 0, 0, 0 }, 1.0f, WHITE);
DrawGrid(10, 1.0);
EndMode3D();
// 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();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
// Unload models data (GPU VRAM)
for (int i = 0; i < MAX_VOX_FILES; i++) UnloadModel(models[i]);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,529 +0,0 @@
/*******************************************************************************************
*
* raylib [models] example - PBR material
*
* 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.
*
* This example has been created using raylib 1.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
#include "rlgl.h"
#include <stdio.h>
#define RLIGHTS_IMPLEMENTATION
#include "rlights.h"
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
#define CUBEMAP_SIZE 1024 // Cubemap texture size
#define IRRADIANCE_SIZE 32 // Irradiance texture size
#define PREFILTERED_SIZE 256 // Prefiltered HDR environment texture size
#define BRDF_SIZE 512 // BRDF LUT texture size
#define LIGHT_DISTANCE 1000.0f
#define LIGHT_HEIGHT 1.0f
// PBR texture maps generation
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format); // Generate cubemap (6 faces) from equirectangular (panorama) texture
static TextureCubemap GenTextureIrradiance(Shader shader, TextureCubemap cubemap, int size); // Generate irradiance cubemap using cubemap texture
static TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int size); // Generate prefilter cubemap using cubemap texture
static Texture2D GenTextureBRDF(Shader shader, int size); // Generate a generic BRDF texture
// PBR material loading
static Material LoadMaterialPBR(Color albedo, float metalness, float roughness);
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
InitWindow(screenWidth, screenHeight, "raylib [models] example - pbr material");
// Define the camera to look into our 3d world
Camera camera = { 0 };
camera.position = (Vector3){ 4.0f, 4.0f, 4.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 0.5f, 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 model and PBR material
Model model = LoadModel("resources/pbr/trooper.obj");
// Mesh tangents are generated... and uploaded to GPU
// NOTE: New VBO for tangents is generated at default location and also binded to mesh VAO
//MeshTangents(&model.meshes[0]);
model.materials[0] = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f);
// Create lights
// NOTE: Lights are added to an internal lights pool automatically
CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.materials[0].shader);
CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.materials[0].shader);
CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.materials[0].shader);
CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 255, 255 }, model.materials[0].shader);
SetCameraMode(camera, CAMERA_ORBITAL); // Set an 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 camera
// Send to material PBR shader camera view position
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
SetShaderValue(model.materials[0].shader, model.materials[0].shader.locs[SHADER_LOC_VECTOR_VIEW], cameraPos, SHADER_UNIFORM_VEC3);
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
DrawModel(model, Vector3Zero(), 1.0f, WHITE);
DrawGrid(10, 1.0f);
EndMode3D();
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadMaterial(model.materials[0]); // Unload material: shader and textures
UnloadModel(model); // Unload model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
// Load PBR material (Supports: ALBEDO, NORMAL, METALNESS, ROUGHNESS, AO, EMMISIVE, HEIGHT maps)
// NOTE: PBR shader is loaded inside this function
static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
{
Material mat = LoadMaterialDefault(); // Initialize material to default
// Load PBR shader (requires several maps)
mat.shader = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/pbr.fs", GLSL_VERSION));
// Get required locations points for PBR material
// NOTE: Those location names must be available and used in the shader code
mat.shader.locs[SHADER_LOC_MAP_ALBEDO] = GetShaderLocation(mat.shader, "albedo.sampler");
mat.shader.locs[SHADER_LOC_MAP_METALNESS] = GetShaderLocation(mat.shader, "metalness.sampler");
mat.shader.locs[SHADER_LOC_MAP_NORMAL] = GetShaderLocation(mat.shader, "normals.sampler");
mat.shader.locs[SHADER_LOC_MAP_ROUGHNESS] = GetShaderLocation(mat.shader, "roughness.sampler");
mat.shader.locs[SHADER_LOC_MAP_OCCLUSION] = GetShaderLocation(mat.shader, "occlusion.sampler");
//mat.shader.locs[SHADER_LOC_MAP_EMISSION] = GetShaderLocation(mat.shader, "emission.sampler");
//mat.shader.locs[SHADER_LOC_MAP_HEIGHT] = GetShaderLocation(mat.shader, "height.sampler");
mat.shader.locs[SHADER_LOC_MAP_IRRADIANCE] = GetShaderLocation(mat.shader, "irradianceMap");
mat.shader.locs[SHADER_LOC_MAP_PREFILTER] = GetShaderLocation(mat.shader, "prefilterMap");
mat.shader.locs[SHADER_LOC_MAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
// Set view matrix location
mat.shader.locs[SHADER_LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "matModel");
//mat.shader.locs[SHADER_LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view");
mat.shader.locs[SHADER_LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos");
// Set PBR standard maps
mat.maps[MATERIAL_MAP_ALBEDO].texture = LoadTexture("resources/pbr/trooper_albedo.png");
mat.maps[MATERIAL_MAP_NORMAL].texture = LoadTexture("resources/pbr/trooper_normals.png");
mat.maps[MATERIAL_MAP_METALNESS].texture = LoadTexture("resources/pbr/trooper_metalness.png");
mat.maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("resources/pbr/trooper_roughness.png");
mat.maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("resources/pbr/trooper_ao.png");
// Set textures filtering for better quality
SetTextureFilter(mat.maps[MATERIAL_MAP_ALBEDO].texture, FILTER_BILINEAR);
SetTextureFilter(mat.maps[MATERIAL_MAP_NORMAL].texture, FILTER_BILINEAR);
SetTextureFilter(mat.maps[MATERIAL_MAP_METALNESS].texture, FILTER_BILINEAR);
SetTextureFilter(mat.maps[MATERIAL_MAP_ROUGHNESS].texture, FILTER_BILINEAR);
SetTextureFilter(mat.maps[MATERIAL_MAP_OCCLUSION].texture, FILTER_BILINEAR);
// Enable sample usage in shader for assigned textures
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "albedo.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "normals.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "metalness.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "roughness.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "occlusion.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
int renderModeLoc = GetShaderLocation(mat.shader, "renderMode");
SetShaderValue(mat.shader, renderModeLoc, (int[1]){ 0 }, SHADER_UNIFORM_INT);
// Set up material properties color
mat.maps[MATERIAL_MAP_ALBEDO].color = albedo;
mat.maps[MATERIAL_MAP_NORMAL].color = (Color){ 128, 128, 255, 255 };
mat.maps[MATERIAL_MAP_METALNESS].value = metalness;
mat.maps[MATERIAL_MAP_ROUGHNESS].value = roughness;
mat.maps[MATERIAL_MAP_OCCLUSION].value = 1.0f;
mat.maps[MATERIAL_MAP_EMISSION].value = 0.5f;
mat.maps[MATERIAL_MAP_HEIGHT].value = 0.5f;
// Generate cubemap from panorama texture
//--------------------------------------------------------------------------------------------------------
Texture2D panorama = LoadTexture("resources/dresden_square_2k.hdr");
// Load equirectangular to cubemap shader
Shader shdrCubemap = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/pbr.fs", GLSL_VERSION));
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
TextureCubemap cubemap = GenTextureCubemap(shdrCubemap, panorama, CUBEMAP_SIZE, PIXELFORMAT_UNCOMPRESSED_R32G32B32);
UnloadTexture(panorama);
UnloadShader(shdrCubemap);
//--------------------------------------------------------------------------------------------------------
// Generate irradiance map from cubemap texture
//--------------------------------------------------------------------------------------------------------
// Load irradiance (GI) calculation shader
Shader shdrIrradiance = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/irradiance.fs", GLSL_VERSION));
SetShaderValue(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
mat.maps[MATERIAL_MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
UnloadShader(shdrIrradiance);
//--------------------------------------------------------------------------------------------------------
// Generate prefilter map from cubemap texture
//--------------------------------------------------------------------------------------------------------
// Load reflection prefilter calculation shader
Shader shdrPrefilter = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/prefilter.fs", GLSL_VERSION));
SetShaderValue(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
mat.maps[MATERIAL_MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
UnloadTexture(cubemap);
UnloadShader(shdrPrefilter);
//--------------------------------------------------------------------------------------------------------
// Generate BRDF (bidirectional reflectance distribution function) texture (using shader)
//--------------------------------------------------------------------------------------------------------
Shader shdrBRDF = LoadShader(TextFormat("resources/shaders/glsl%i/brdf.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/brdf.fs", GLSL_VERSION));
mat.maps[MATERIAL_MAP_BRDG].texture = GenTextureBRDF(shdrBRDF, BRDF_SIZE);
UnloadShader(shdrBRDF);
//--------------------------------------------------------------------------------------------------------
return mat;
}
// Texture maps generation (PBR)
//-------------------------------------------------------------------------------------------
// Generate cubemap texture from HDR texture
static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format)
{
TextureCubemap cubemap = { 0 };
rlDisableBackfaceCulling(); // Disable backface culling to render inside the cube
// STEP 1: Setup framebuffer
//------------------------------------------------------------------------------------------
unsigned int rbo = rlLoadTextureDepth(size, size, true);
cubemap.id = rlLoadTextureCubemap(NULL, size, format);
unsigned int fbo = rlLoadFramebuffer(size, size);
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X, 0);
// Check if framebuffer is complete with attachments (valid)
if (rlFramebufferComplete(fbo)) TraceLog(LOG_INFO, "FBO: [ID %i] Framebuffer object created successfully", fbo);
//------------------------------------------------------------------------------------------
// STEP 2: Draw to framebuffer
//------------------------------------------------------------------------------------------
// NOTE: Shader is used to convert HDR equirectangular environment map to cubemap equivalent (6 faces)
rlEnableShader(shader.id);
// Define projection matrix and send it to shader
Matrix matFboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_PROJECTION], matFboProjection);
// Define view matrix for every side of the cubemap
Matrix fboViews[6] = {
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ -1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f })
};
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
for (int i = 0; i < 6; i++)
{
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
rlEnableFramebuffer(fbo);
rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
rlClearScreenBuffers();
DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
rlDrawRenderBatchActive();
}
//------------------------------------------------------------------------------------------
// STEP 3: Unload framebuffer and reset state
//------------------------------------------------------------------------------------------
rlDisableShader(); // Unbind shader
rlDisableTexture(); // Unbind texture
rlDisableFramebuffer(); // Unbind framebuffer
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
// Reset viewport dimensions to default
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
rlEnableBackfaceCulling();
//------------------------------------------------------------------------------------------
cubemap.width = size;
cubemap.height = size;
cubemap.mipmaps = 1;
cubemap.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
return cubemap;
}
// Generate irradiance texture using cubemap data
static TextureCubemap GenTextureIrradiance(Shader shader, TextureCubemap cubemap, int size)
{
TextureCubemap irradiance = { 0 };
rlDisableBackfaceCulling(); // Disable backface culling to render inside the cube
// STEP 1: Setup framebuffer
//------------------------------------------------------------------------------------------
unsigned int rbo = rlLoadTextureDepth(size, size, true);
irradiance.id = rlLoadTextureCubemap(NULL, size, PIXELFORMAT_UNCOMPRESSED_R32G32B32);
unsigned int fbo = rlLoadFramebuffer(size, size);
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X, 0);
//------------------------------------------------------------------------------------------
// STEP 2: Draw to framebuffer
//------------------------------------------------------------------------------------------
// NOTE: Shader is used to solve diffuse integral by convolution to create an irradiance cubemap
rlEnableShader(shader.id);
// Define projection matrix and send it to shader
Matrix matFboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_PROJECTION], matFboProjection);
// Define view matrix for every side of the cubemap
Matrix fboViews[6] = {
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ -1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f })
};
rlActiveTextureSlot(0);
rlEnableTextureCubemap(cubemap.id);
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions
for (int i = 0; i < 6; i++)
{
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
rlFramebufferAttach(fbo, irradiance.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
rlEnableFramebuffer(fbo);
rlClearScreenBuffers();
rlLoadDrawCube();
}
//------------------------------------------------------------------------------------------
// STEP 3: Unload framebuffer and reset state
//------------------------------------------------------------------------------------------
rlDisableShader(); // Unbind shader
rlDisableTexture(); // Unbind texture
rlDisableFramebuffer(); // Unbind framebuffer
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
// Reset viewport dimensions to default
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
rlEnableBackfaceCulling();
//------------------------------------------------------------------------------------------
irradiance.width = size;
irradiance.height = size;
irradiance.mipmaps = 1;
irradiance.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
return irradiance;
}
// Generate prefilter texture using cubemap data
static TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int size)
{
TextureCubemap prefilter = { 0 };
rlDisableBackfaceCulling(); // Disable backface culling to render inside the cube
// STEP 1: Setup framebuffer
//------------------------------------------------------------------------------------------
unsigned int rbo = rlLoadTextureDepth(size, size, true);
prefilter.id = rlLoadTextureCubemap(NULL, size, PIXELFORMAT_UNCOMPRESSED_R32G32B32);
rlTextureParameters(prefilter.id, RL_TEXTURE_MIN_FILTER, RL_TEXTURE_FILTER_MIP_LINEAR);
unsigned int fbo = rlLoadFramebuffer(size, size);
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X, 0);
//------------------------------------------------------------------------------------------
// Generate mipmaps for the prefiltered HDR texture
//glGenerateMipmap(GL_TEXTURE_CUBE_MAP); // TODO!
// STEP 2: Draw to framebuffer
//------------------------------------------------------------------------------------------
// NOTE: Shader is used to prefilter HDR and store data into mipmap levels
// Define projection matrix and send it to shader
Matrix fboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
rlEnableShader(shader.id);
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_PROJECTION], fboProjection);
// Define view matrix for every side of the cubemap
Matrix fboViews[6] = {
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ -1.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f }),
MatrixLookAt((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, -1.0f }, (Vector3){ 0.0f, -1.0f, 0.0f })
};
rlActiveTextureSlot(0);
rlEnableTextureCubemap(cubemap.id);
// TODO: Locations should be taken out of this function... too shader dependant...
int roughnessLoc = rlGetLocationUniform(shader.id, "roughness");
rlEnableFramebuffer(fbo);
#define MAX_MIPMAP_LEVELS 5 // Max number of prefilter texture mipmaps
for (int mip = 0; mip < MAX_MIPMAP_LEVELS; mip++)
{
// Resize framebuffer according to mip-level size.
unsigned int mipWidth = size*(int)powf(0.5f, (float)mip);
unsigned int mipHeight = size*(int)powf(0.5f, (float)mip);
rlViewport(0, 0, mipWidth, mipHeight);
//glBindRenderbuffer(GL_RENDERBUFFER, rbo);
//glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight);
float roughness = (float)mip/(float)(MAX_MIPMAP_LEVELS - 1);
rlSetUniform(roughnessLoc, &roughness, SHADER_UNIFORM_FLOAT, 1);
for (int i = 0; i < 6; i++)
{
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
rlFramebufferAttach(fbo, prefilter.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, mip);
rlClearScreenBuffers();
rlLoadDrawCube();
}
}
//------------------------------------------------------------------------------------------
// STEP 3: Unload framebuffer and reset state
//------------------------------------------------------------------------------------------
rlDisableShader(); // Unbind shader
rlDisableTexture(); // Unbind texture
rlDisableFramebuffer(); // Unbind framebuffer
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
// Reset viewport dimensions to default
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
rlEnableBackfaceCulling();
//------------------------------------------------------------------------------------------
prefilter.width = size;
prefilter.height = size;
prefilter.mipmaps = MAX_MIPMAP_LEVELS;
prefilter.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
return prefilter;
}
// Generate BRDF texture using cubemap data
// TODO: Review implementation: https://github.com/HectorMF/BRDFGenerator
static Texture2D GenTextureBRDF(Shader shader, int size)
{
Texture2D brdf = { 0 };
// STEP 1: Setup framebuffer
//------------------------------------------------------------------------------------------
unsigned int rbo = rlLoadTextureDepth(size, size, true);
brdf.id = rlLoadTexture(NULL, size, size, PIXELFORMAT_UNCOMPRESSED_R32G32B32, 1);
unsigned int fbo = rlLoadFramebuffer(size, size);
rlFramebufferAttach(fbo, rbo, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
rlFramebufferAttach(fbo, brdf.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_TEXTURE2D, 0);
//------------------------------------------------------------------------------------------
// STEP 2: Draw to framebuffer
//------------------------------------------------------------------------------------------
// NOTE: Render BRDF LUT into a quad using FBO
rlEnableShader(shader.id);
rlViewport(0, 0, size, size);
rlEnableFramebuffer(fbo);
rlClearScreenBuffers();
rlLoadDrawQuad();
//------------------------------------------------------------------------------------------
// STEP 3: Unload framebuffer and reset state
//------------------------------------------------------------------------------------------
rlDisableShader(); // Unbind shader
rlDisableTexture(); // Unbind texture
rlDisableFramebuffer(); // Unbind framebuffer
rlUnloadFramebuffer(fbo); // Unload framebuffer (and automatically attached depth texture/renderbuffer)
// Reset viewport dimensions to default
rlViewport(0, 0, rlGetFramebufferWidth(), rlGetFramebufferHeight());
//------------------------------------------------------------------------------------------
brdf.width = size;
brdf.height = size;
brdf.mipmaps = 1;
brdf.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32;
return brdf;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 KiB

View File

@@ -113,7 +113,7 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update internal camera and our camera UpdateCamera(&camera); // Update internal camera and our camera
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
{ {
currentModel = (currentModel + 1)%NUM_MODELS; // Cycle between the textures currentModel = (currentModel + 1)%NUM_MODELS; // Cycle between the textures
} }

View File

@@ -31,26 +31,34 @@ int main(void)
camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target) camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Ray ray = { 0 }; // Picking ray Ray ray = { 0 }; // Picking ray
Model tower = LoadModel("resources/models/turret.obj"); // Load OBJ model Model tower = LoadModel("resources/models/obj/turret.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/models/turret_diffuse.png"); // Load model texture Texture2D texture = LoadTexture("resources/models/obj/turret_diffuse.png"); // Load model texture
tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
BoundingBox towerBBox = MeshBoundingBox(tower.meshes[0]); // Get mesh bounding box BoundingBox towerBBox = GetMeshBoundingBox(tower.meshes[0]); // Get mesh bounding box
bool hitMeshBBox = false;
bool hitTriangle = false; // Ground quad
Vector3 g0 = (Vector3){ -50.0f, 0.0f, -50.0f };
Vector3 g1 = (Vector3){ -50.0f, 0.0f, 50.0f };
Vector3 g2 = (Vector3){ 50.0f, 0.0f, 50.0f };
Vector3 g3 = (Vector3){ 50.0f, 0.0f, -50.0f };
// Test triangle // Test triangle
Vector3 ta = (Vector3){ -25.0, 0.5, 0.0 }; Vector3 ta = (Vector3){ -25.0f, 0.5f, 0.0f };
Vector3 tb = (Vector3){ -4.0, 2.5, 1.0 }; Vector3 tb = (Vector3){ -4.0f, 2.5f, 1.0f };
Vector3 tc = (Vector3){ -8.0, 6.5, 0.0 }; Vector3 tc = (Vector3){ -8.0f, 6.5f, 0.0f };
Vector3 bary = { 0.0f, 0.0f, 0.0f }; Vector3 bary = { 0.0f, 0.0f, 0.0f };
// Test sphere
Vector3 sp = (Vector3){ -30.0f, 5.0f, 5.0f };
float sr = 4.0f;
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
@@ -63,59 +71,67 @@ int main(void)
UpdateCamera(&camera); // Update camera UpdateCamera(&camera); // Update camera
// Display information about closest hit // Display information about closest hit
RayHitInfo nearestHit = { 0 }; RayCollision collision = { 0 };
char *hitObjectName = "None"; char *hitObjectName = "None";
nearestHit.distance = FLT_MAX; collision.distance = FLT_MAX;
nearestHit.hit = false; collision.hit = false;
Color cursorColor = WHITE; Color cursorColor = WHITE;
// Get ray and test against ground, triangle, and mesh // Get ray and test against objects
ray = GetMouseRay(GetMousePosition(), camera); ray = GetMouseRay(GetMousePosition(), camera);
// Check ray collision aginst ground plane // Check ray collision against ground quad
RayHitInfo groundHitInfo = GetCollisionRayGround(ray, 0.0f); RayCollision groundHitInfo = GetRayCollisionQuad(ray, g0, g1, g2, g3);
if ((groundHitInfo.hit) && (groundHitInfo.distance < nearestHit.distance)) if ((groundHitInfo.hit) && (groundHitInfo.distance < collision.distance))
{ {
nearestHit = groundHitInfo; collision = groundHitInfo;
cursorColor = GREEN; cursorColor = GREEN;
hitObjectName = "Ground"; hitObjectName = "Ground";
} }
// Check ray collision against test triangle // Check ray collision against test triangle
RayHitInfo triHitInfo = GetCollisionRayTriangle(ray, ta, tb, tc); RayCollision triHitInfo = GetRayCollisionTriangle(ray, ta, tb, tc);
if ((triHitInfo.hit) && (triHitInfo.distance < nearestHit.distance)) if ((triHitInfo.hit) && (triHitInfo.distance < collision.distance))
{ {
nearestHit = triHitInfo; collision = triHitInfo;
cursorColor = PURPLE; cursorColor = PURPLE;
hitObjectName = "Triangle"; hitObjectName = "Triangle";
bary = Vector3Barycenter(nearestHit.position, ta, tb, tc); bary = Vector3Barycenter(collision.point, ta, tb, tc);
hitTriangle = true;
} }
else hitTriangle = false;
RayHitInfo meshHitInfo = { 0 }; // Check ray collision against test sphere
RayCollision sphereHitInfo = GetRayCollisionSphere(ray, sp, sr);
if ((sphereHitInfo.hit) && (sphereHitInfo.distance < collision.distance))
{
collision = sphereHitInfo;
cursorColor = ORANGE;
hitObjectName = "Sphere";
}
// Check ray collision against bounding box first, before trying the full ray-mesh test // Check ray collision against bounding box first, before trying the full ray-mesh test
if (CheckCollisionRayBox(ray, towerBBox)) RayCollision boxHitInfo = GetRayCollisionBox(ray, towerBBox);
if ((boxHitInfo.hit) && (boxHitInfo.distance < collision.distance))
{ {
hitMeshBBox = true; collision = boxHitInfo;
cursorColor = ORANGE;
hitObjectName = "Box";
// Check ray collision against model // Check ray collision against model
// NOTE: It considers model.transform matrix! // NOTE: It considers model.transform matrix!
meshHitInfo = GetCollisionRayModel(ray, tower); RayCollision meshHitInfo = GetRayCollisionModel(ray, tower);
if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance)) if (meshHitInfo.hit)
{ {
nearestHit = meshHitInfo; collision = meshHitInfo;
cursorColor = ORANGE; cursorColor = ORANGE;
hitObjectName = "Mesh"; hitObjectName = "Mesh";
} }
} }
hitMeshBBox = false;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@@ -128,7 +144,7 @@ int main(void)
// Draw the tower // Draw the tower
// WARNING: If scale is different than 1.0f, // WARNING: If scale is different than 1.0f,
// not considered by GetCollisionRayModel() // not considered by GetRayCollisionModel()
DrawModel(tower, towerPos, 1.0f, WHITE); DrawModel(tower, towerPos, 1.0f, WHITE);
// Draw the test triangle // Draw the test triangle
@@ -136,21 +152,24 @@ int main(void)
DrawLine3D(tb, tc, PURPLE); DrawLine3D(tb, tc, PURPLE);
DrawLine3D(tc, ta, PURPLE); DrawLine3D(tc, ta, PURPLE);
// Draw the test sphere
DrawSphereWires(sp, sr, 8, 8, PURPLE);
// Draw the mesh bbox if we hit it // Draw the mesh bbox if we hit it
if (hitMeshBBox) DrawBoundingBox(towerBBox, LIME); if (boxHitInfo.hit) DrawBoundingBox(towerBBox, LIME);
// If we hit something, draw the cursor at the hit point // If we hit something, draw the cursor at the hit point
if (nearestHit.hit) if (collision.hit)
{ {
DrawCube(nearestHit.position, 0.3f, 0.3f, 0.3f, cursorColor); DrawCube(collision.point, 0.3f, 0.3f, 0.3f, cursorColor);
DrawCubeWires(nearestHit.position, 0.3f, 0.3f, 0.3f, RED); DrawCubeWires(collision.point, 0.3f, 0.3f, 0.3f, RED);
Vector3 normalEnd; Vector3 normalEnd;
normalEnd.x = nearestHit.position.x + nearestHit.normal.x; normalEnd.x = collision.point.x + collision.normal.x;
normalEnd.y = nearestHit.position.y + nearestHit.normal.y; normalEnd.y = collision.point.y + collision.normal.y;
normalEnd.z = nearestHit.position.z + nearestHit.normal.z; normalEnd.z = collision.point.z + collision.normal.z;
DrawLine3D(nearestHit.position, normalEnd, RED); DrawLine3D(collision.point, normalEnd, RED);
} }
DrawRay(ray, MAROON); DrawRay(ray, MAROON);
@@ -162,23 +181,24 @@ int main(void)
// Draw some debug GUI text // Draw some debug GUI text
DrawText(TextFormat("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK); DrawText(TextFormat("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
if (nearestHit.hit) if (collision.hit)
{ {
int ypos = 70; int ypos = 70;
DrawText(TextFormat("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK); DrawText(TextFormat("Distance: %3.2f", collision.distance), 10, ypos, 10, BLACK);
DrawText(TextFormat("Hit Pos: %3.2f %3.2f %3.2f", DrawText(TextFormat("Hit Pos: %3.2f %3.2f %3.2f",
nearestHit.position.x, collision.point.x,
nearestHit.position.y, collision.point.y,
nearestHit.position.z), 10, ypos + 15, 10, BLACK); collision.point.z), 10, ypos + 15, 10, BLACK);
DrawText(TextFormat("Hit Norm: %3.2f %3.2f %3.2f", DrawText(TextFormat("Hit Norm: %3.2f %3.2f %3.2f",
nearestHit.normal.x, collision.normal.x,
nearestHit.normal.y, collision.normal.y,
nearestHit.normal.z), 10, ypos + 30, 10, BLACK); collision.normal.z), 10, ypos + 30, 10, BLACK);
if (hitTriangle) DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK); if (triHitInfo.hit && TextIsEqual(hitObjectName, "Triangle"))
DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
} }
DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY); DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY);

View File

@@ -14,6 +14,8 @@
#include "raylib.h" #include "raylib.h"
#include "rlgl.h" #include "rlgl.h"
#include <math.h> // Required for: cosf(), sinf()
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Module Functions Declaration // Module Functions Declaration
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@@ -86,7 +88,6 @@ int main(void)
rlPushMatrix(); rlPushMatrix();
rlRotatef(earthOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Earth orbit around Sun rlRotatef(earthOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Earth orbit around Sun
rlTranslatef(earthOrbitRadius, 0.0f, 0.0f); // Translation for Earth orbit rlTranslatef(earthOrbitRadius, 0.0f, 0.0f); // Translation for Earth orbit
rlRotatef(-earthOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Earth orbit around Sun inverted
rlPushMatrix(); rlPushMatrix();
rlRotatef(earthRotation, 0.25, 1.0, 0.0); // Rotation for Earth itself rlRotatef(earthRotation, 0.25, 1.0, 0.0); // Rotation for Earth itself
@@ -97,7 +98,6 @@ int main(void)
rlRotatef(moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth rlRotatef(moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth
rlTranslatef(moonOrbitRadius, 0.0f, 0.0f); // Translation for Moon orbit rlTranslatef(moonOrbitRadius, 0.0f, 0.0f); // Translation for Moon orbit
rlRotatef(-moonOrbitRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon orbit around Earth inverted
rlRotatef(moonRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon itself rlRotatef(moonRotation, 0.0f, 1.0f, 0.0f); // Rotation for Moon itself
rlScalef(moonRadius, moonRadius, moonRadius); // Scale Moon rlScalef(moonRadius, moonRadius, moonRadius); // Scale Moon

View File

@@ -10,7 +10,9 @@
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
#include "rlgl.h" #include "rlgl.h"
#include "raymath.h" // Required for: MatrixPerspective(), MatrixLookAt()
#if defined(PLATFORM_DESKTOP) #if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330 #define GLSL_VERSION 330
@@ -37,7 +39,7 @@ int main(void)
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f); Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
Model skybox = LoadModelFromMesh(cube); Model skybox = LoadModelFromMesh(cube);
bool useHDR = false; bool useHDR = true;
// Load skybox shader and set required locations // Load skybox shader and set required locations
// NOTE: Some locations are automatically set at shader loading // NOTE: Some locations are automatically set at shader loading
@@ -55,13 +57,15 @@ int main(void)
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT); SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
char skyboxFileName[256] = { 0 }; char skyboxFileName[256] = { 0 };
Texture2D panorama;
if (useHDR) if (useHDR)
{ {
TextCopy(skyboxFileName, "resources/dresden_square_2k.hdr"); TextCopy(skyboxFileName, "resources/dresden_square_2k.hdr");
// Load HDR panorama (sphere) texture // Load HDR panorama (sphere) texture
Texture2D panorama = panorama = LoadTexture(skyboxFileName); panorama = LoadTexture(skyboxFileName);
// Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture // Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
// NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping // NOTE 1: New texture is generated rendering to texture, shader calculates the sphere->cube coordinates mapping
@@ -69,7 +73,7 @@ int main(void)
// despite texture can be successfully created.. so using PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 instead of PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 // despite texture can be successfully created.. so using PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 instead of PIXELFORMAT_UNCOMPRESSED_R32G32B32A32
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8); skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
UnloadTexture(panorama); // Texture not required anymore, cubemap already generated //UnloadTexture(panorama); // Texture not required anymore, cubemap already generated
} }
else else
{ {
@@ -143,11 +147,11 @@ int main(void)
DrawGrid(10, 1.0f); DrawGrid(10, 1.0f);
EndMode3D(); EndMode3D();
//DrawTextureEx(panorama, (Vector2){ 0, 0 }, 0.0f, 0.5f, WHITE);
if (useHDR) if (useHDR) DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
DrawText(TextFormat("Panorama image from hdrihaven.com: %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK); else DrawText(TextFormat(": %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
else
DrawText(TextFormat(": %s", GetFileName(skyboxFileName)), 10, GetScreenHeight() - 20, 10, BLACK);
DrawFPS(10, 10); DrawFPS(10, 10);
@@ -208,18 +212,32 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s
}; };
rlViewport(0, 0, size, size); // Set viewport to current fbo dimensions 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);
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
// Set the view matrix for the current cube face
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]); 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); rlFramebufferAttach(fbo, cubemap.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, 0);
rlEnableFramebuffer(fbo); rlEnableFramebuffer(fbo);
rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
// Load and draw a cube, it uses the current enabled texture
rlClearScreenBuffers(); rlClearScreenBuffers();
DrawCubeV(Vector3Zero(), Vector3One(), WHITE); rlLoadDrawCube();
rlDrawRenderBatchActive();
// ALTERNATIVE: Try to use internal batch system to draw the cube instead of rlLoadDrawCube
// for some reason this method does not work, maybe due to cube triangles definition? normals pointing out?
// TODO: Investigate this issue...
//rlSetTexture(panorama.id); // WARNING: It must be called after enabling current framebuffer if using internal batch system!
//rlClearScreenBuffers();
//DrawCubeV(Vector3Zero(), Vector3One(), WHITE);
//rlDrawRenderBatchActive();
} }
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
@@ -238,7 +256,7 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s
cubemap.width = size; cubemap.width = size;
cubemap.height = size; cubemap.height = size;
cubemap.mipmaps = 1; cubemap.mipmaps = 1;
cubemap.format = PIXELFORMAT_UNCOMPRESSED_R32G32B32; cubemap.format = format;
return cubemap; return cubemap;
} }

View File

@@ -7,12 +7,13 @@
* *
* Example contributed by Berni (@Berni8k) and reviewed by Ramon Santamaria (@raysan5) * Example contributed by Berni (@Berni8k) and reviewed by Ramon Santamaria (@raysan5)
* *
* Copyright (c) 2017 Berni (@Berni8k) and Ramon Santamaria (@raysan5) * Copyright (c) 2017-2021 Berni (@Berni8k) and Ramon Santamaria (@raysan5)
* *
********************************************************************************************/ ********************************************************************************************/
#include "raylib.h" #include "raylib.h"
#include "raymath.h"
#include "raymath.h" // Required for: MatrixRotateXYZ()
int main(void) int main(void)
{ {
@@ -31,9 +32,9 @@ int main(void)
camera.fovy = 30.0f; // Camera field-of-view Y camera.fovy = 30.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera type camera.projection = CAMERA_PERSPECTIVE; // Camera type
// Model loading Model model = LoadModel("resources/models/obj/plane.obj"); // Load model
// NOTE: Diffuse map loaded automatically Texture2D texture = LoadTexture("resources/models/obj/plane_diffuse.png"); // Load model texture
Model model = LoadModel("resources/plane/plane.gltf"); model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
float pitch = 0.0f; float pitch = 0.0f;
float roll = 0.0f; float roll = 0.0f;
@@ -78,7 +79,6 @@ int main(void)
model.transform = MatrixRotateXYZ((Vector3){ DEG2RAD*pitch, DEG2RAD*yaw, DEG2RAD*roll }); model.transform = MatrixRotateXYZ((Vector3){ DEG2RAD*pitch, DEG2RAD*yaw, DEG2RAD*roll });
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
BeginDrawing(); BeginDrawing();
@@ -88,7 +88,7 @@ int main(void)
// Draw 3D model (recomended to draw 3D always before 2D) // Draw 3D model (recomended to draw 3D always before 2D)
BeginMode3D(camera); BeginMode3D(camera);
DrawModel(model, (Vector3){ 0.0f, 0.0f, 15.0f }, 0.25f, WHITE); // Draw 3d model with texture DrawModel(model, (Vector3){ 0.0f, -8.0f, 0.0f }, 1.0f, WHITE); // Draw 3d model with texture
DrawGrid(10, 10.0f); DrawGrid(10, 10.0f);
EndMode3D(); EndMode3D();

View File

@@ -0,0 +1,23 @@
| resource | author | licence | notes |
| :------------------- | :---------: | :------ | :---- |
| models/obj/castle.obj,<br>models/castle_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
| models/obj/bridge.obj,<br>models/bridge_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
| models/obj/house.obj,<br>models/house_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
| models/obj/market.obj,<br>models/market_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
| models/obj/turret.obj,<br>models/turret_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
| models/obj/well.obj,<br>models/well_diffuse.png | [Alberto Cano](https://www.artstation.com/albertocano) | [CC-BY-NC](https://creativecommons.org/licenses/by-nc/4.0/legalcode) | - |
| models/obj/cube.obj,<br>models/cube_diffuse.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| models/obj/plane.gltf,<br>models/gltf/plane/plane.bin,<br>models/gltf/plane/plane_diffuse.png | [GiaHanLam](https://sketchfab.com/GiaHanLam) | [CC-BY](https://creativecommons.org/licenses/by/4.0/) | Used by: [`models_yaw_pitch_roll.c`](https://github.com/raysan5/raylib/blob/master/examples/models/models_yaw_pitch_roll.c)
| models/iqm/guy.iqm,<br>models/iqm/guyanim.iqm,<br>models/iqm/guytex.png,<br>models/iqm/guy.blend | [@culacant](https://github.com/culacant) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| models/iqm/vertex_colored_object.iqm | ❔ | ❔ | - |
| models/gltf/... | _various_ | Check [LICENSE](https://github.com/raysan5/raylib/blob/master/examples/models/resources/models/gltf/LICENSE) | - |
| models/vox/chr_knight.vox | ❔ | ❔ | - |
| models/vox/chr_sword.vox | ❔ | ❔ | - |
| models/vox/monu9.vox | ❔ | ❔ | - |
| billboard.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| cubicmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| cubicmap_atlas.png | [@emegeme](https://github.com/emegeme) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| heightmap.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - |
| dresden_square_1k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - |
| dresden_square_2k.hdr | [HDRIHaven](https://hdrihaven.com/hdri/?h=dresden_square) | [CC0](https://hdrihaven.com/p/license.php) | - |
| skybox.png | ❔ | ❔ | - |

View File

@@ -1,4 +0,0 @@
Medieval City models and textures have been created by Alberto Cano,
and licensed as Creative Commons Attribution-NonCommercial 4.0.
Check for details: https://creativecommons.org/licenses/by-nc/4.0/legalcode

View File

@@ -15,6 +15,9 @@ Animated Triangle model is licensed as CC0 Universal Public Domain
Gearbox Assy model has been provided by Okino Computer Graphics, using Okino Polytrans Software. Gearbox Assy model has been provided by Okino Computer Graphics, using Okino Polytrans Software.
no license information was provided no license information was provided
Girl model has been provided by Hristo Stamenov (https://thatonegamedev.com/)
and licensed as CC0 Universal Public Domain
Check for details on CC0: https://creativecommons.org/publicdomain/zero/1.0/ Check for details on CC0: https://creativecommons.org/publicdomain/zero/1.0/
Check for details on CC4: http://creativecommons.org/licenses/by/4.0/ Check for details on CC4: http://creativecommons.org/licenses/by/4.0/
GLTF sample models for testing are taken from: https://github.com/KhronosGroup/glTF-Sample-Models/ GLTF sample models for testing are taken from: https://github.com/KhronosGroup/glTF-Sample-Models/

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 295 KiB

After

Width:  |  Height:  |  Size: 295 KiB

View File

Before

Width:  |  Height:  |  Size: 311 KiB

After

Width:  |  Height:  |  Size: 311 KiB

View File

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 434 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 383 KiB

After

Width:  |  Height:  |  Size: 383 KiB

View File

Before

Width:  |  Height:  |  Size: 380 KiB

After

Width:  |  Height:  |  Size: 380 KiB

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 804 KiB

After

Width:  |  Height:  |  Size: 804 KiB

View File

Before

Width:  |  Height:  |  Size: 371 KiB

After

Width:  |  Height:  |  Size: 371 KiB

View File

Before

Width:  |  Height:  |  Size: 334 KiB

After

Width:  |  Height:  |  Size: 334 KiB

View File

@@ -0,0 +1,9 @@
The following models are provided by the official github repo of voxel-model format by MagikaVoxel developer @ephtracy
GitHub official repo: https://github.com/ephtracy/voxel-model
- chr_knight.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/character/chr_knight.vox
- chr_sword.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/character/chr_sword.vox
- monu9.vox - https://github.com/ephtracy/voxel-model/blob/master/vox/monument/monu9.vox
Worth mentioning there is no license specified for the models yet: https://github.com/ephtracy/voxel-model/issues/22

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Some files were not shown because too many files have changed in this diff Show More