commit
f8a4498a24
165
HISTORY.md
Normal file
165
HISTORY.md
Normal file
@ -0,0 +1,165 @@
|
||||
<img src="https://github.com/raysan5/raylib/blob/master/logo/logo256x256.png" width=256>
|
||||
|
||||
history
|
||||
-------
|
||||
|
||||
I've developed videogames for some years and 4 years ago I started teaching videogames development
|
||||
to young people with artistic profile, most of them had never written a single line of code.
|
||||
|
||||
I started with C language basis and, after searching for the most simple and easy-to-use library to teach
|
||||
videogames programming, I found WinBGI; it was great and it worked very well with students, in just a
|
||||
couple of weeks that people that had never written a single line of code were able to program (and understand)
|
||||
a simple PONG and some of them even a BREAKOUT!
|
||||
|
||||
But WinBGI was not the clearer and most organized lib. There were a lot of things I found useless and
|
||||
confusing and some function names were not clear enough for most of the students; not to mention points
|
||||
like no transparencies support or no hardware acceleration.
|
||||
|
||||
So, I decided to create my own lib, hardware accelerated, clear function names, quite organized, well structured,
|
||||
plain C coding and, the most important, primarily intended to LEARN videogames programming.
|
||||
|
||||
I've coded quite a lot in C# and XNA and I really love it (in fact, my students learn C# after C),
|
||||
so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from
|
||||
raylib to XNA, MonoGame or similar libs extremely easily.
|
||||
|
||||
raylib started as a weekend project and after three months of hard work, raylib 1.0 was published on November 2013.
|
||||
|
||||
Enjoy it.
|
||||
|
||||
notes on raylib 1.1
|
||||
-------------------
|
||||
|
||||
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a
|
||||
complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
||||
|
||||
A new module named [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translates raylib-OpenGL-style
|
||||
immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
||||
|
||||
[rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes
|
||||
a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
||||
|
||||
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
|
||||
support of DDS texture files (compressed and uncompressed) along with mipmaps support.
|
||||
|
||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1.
|
||||
|
||||
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/).
|
||||
|
||||
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
|
||||
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.
|
||||
|
||||
A new display initialization system has been created to support multiple resolutions, adding black bars if required;
|
||||
user only defines desired screen size and it gets properly displayed.
|
||||
|
||||
Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
|
||||
|
||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
|
||||
|
||||
In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
|
||||
|
||||
notes on raylib 1.3
|
||||
-------------------
|
||||
|
||||
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality,
|
||||
improves tremendously textures module and also provides some new modules (camera system, gestures system, IMGUI).
|
||||
|
||||
Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be
|
||||
attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
|
||||
in this release, check raylib/shaders folder.
|
||||
|
||||
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/develop/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/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c).
|
||||
|
||||
New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||
|
||||
[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (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.
|
||||
|
||||
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
|
||||
|
||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.3.
|
||||
|
||||
notes on raylib 1.4
|
||||
-------------------
|
||||
|
||||
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version,
|
||||
lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
|
||||
|
||||
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
|
||||
Now a basic image processing can be done before converting the image to texture for usage.
|
||||
|
||||
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library).
|
||||
Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
|
||||
|
||||
New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional.
|
||||
Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
|
||||
|
||||
[raymath](https://github.com/raysan5/raylib/blob/develop/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/develop/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.
|
||||
|
||||
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).
|
||||
|
||||
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
|
||||
and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported).
|
||||
A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
|
||||
|
||||
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
|
||||
how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
|
||||
|
||||
Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
|
||||
|
||||
notes on raylib 1.5
|
||||
-------------------
|
||||
|
||||
On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
|
||||
|
||||
VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/develop/examples/core_oculus_rift.c).
|
||||
|
||||
New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
|
||||
|
||||
New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages render internally for every 3d object using standard material.
|
||||
|
||||
Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
|
||||
|
||||
Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/develop/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
|
||||
|
||||
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/develop/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/develop/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/develop/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/develop/CHANGELOG) file for a more detailed list of changes.
|
||||
|
||||
Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/develop/examples/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/develop/examples/audio_standalone.c) raylib modules as standalone libraries.
|
||||
|
||||
Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
|
||||
|
||||
notes on raylib 1.6
|
||||
-------------------
|
||||
|
||||
On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version conmmemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
|
||||
|
||||
Complete raylib Lua binding. All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality.
|
||||
|
||||
Completely redesigned audio module. Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. FLAC file format support has also been added. In the same line, OpenAL Soft backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
|
||||
|
||||
Physac module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by @victorfisac, multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
|
||||
|
||||
Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
|
||||
|
||||
Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
|
||||
|
||||
Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
|
||||
|
||||
Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advance users, it has been added pre-configured Visual Studio C++ 2015 solution with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
|
||||
|
||||
New examples, new functions, complete code-base review, multiple bugs corrected... this is raylib 1.6. Enjoy making games.
|
||||
|
181
README.md
181
README.md
@ -11,170 +11,6 @@ NOTE for ADVENTURERS: raylib is a programming library to learn videogames progra
|
||||
no fancy interface, no visual helpers, no auto-debugging... just coding in the most
|
||||
pure spartan-programmers way. Are you ready to learn? Jump to [code examples!](http://www.raylib.com/examples.html)
|
||||
|
||||
history
|
||||
-------
|
||||
|
||||
I've developed videogames for some years and 4 years ago I started teaching videogames development
|
||||
to young people with artistic profile, most of them had never written a single line of code.
|
||||
|
||||
I started with C language basis and, after searching for the most simple and easy-to-use library to teach
|
||||
videogames programming, I found WinBGI; it was great and it worked very well with students, in just a
|
||||
couple of weeks that people that had never written a single line of code were able to program (and understand)
|
||||
a simple PONG and some of them even a BREAKOUT!
|
||||
|
||||
But WinBGI was not the clearer and most organized lib. There were a lot of things I found useless and
|
||||
confusing and some function names were not clear enough for most of the students; not to mention points
|
||||
like no transparencies support or no hardware acceleration.
|
||||
|
||||
So, I decided to create my own lib, hardware accelerated, clear function names, quite organized, well structured,
|
||||
plain C coding and, the most important, primarily intended to LEARN videogames programming.
|
||||
|
||||
I've coded quite a lot in C# and XNA and I really love it (in fact, my students learn C# after C),
|
||||
so, I decided to use C# language notation and XNA naming conventions. That way, students can jump from
|
||||
raylib to XNA, MonoGame or similar libs extremely easily.
|
||||
|
||||
raylib started as a weekend project and after three months of hard work, raylib 1.0 was published on November 2013.
|
||||
|
||||
Enjoy it.
|
||||
|
||||
notes on raylib 1.1
|
||||
-------------------
|
||||
|
||||
On April 2014, after 6 month of first raylib release, raylib 1.1 has been released. This new version presents a
|
||||
complete internal redesign of the library to support OpenGL 1.1, OpenGL 3.3+ and OpenGL ES 2.0.
|
||||
|
||||
A new module named [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) has been added to the library. This new module translates raylib-OpenGL-style
|
||||
immediate mode functions (i.e. rlVertex3f(), rlBegin(), ...) to different versions of OpenGL (1.1, 3.3+, ES2), selectable by one define.
|
||||
|
||||
[rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.h) also comes with a second new module named [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.h), which includes
|
||||
a bunch of useful functions for 3d-math with vectors, matrices and quaternions.
|
||||
|
||||
Some other big changes of this new version have been the support for OGG files loading and stream playing, and the
|
||||
support of DDS texture files (compressed and uncompressed) along with mipmaps support.
|
||||
|
||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.1.
|
||||
|
||||
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/).
|
||||
|
||||
It's been some month of really hard work to accomodate raylib to those new platforms while keeping it easy for the user.
|
||||
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.
|
||||
|
||||
A new display initialization system has been created to support multiple resolutions, adding black bars if required;
|
||||
user only defines desired screen size and it gets properly displayed.
|
||||
|
||||
Now raylib can easily deploy games to Android devices and Raspberry Pi (console mode).
|
||||
|
||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.2.
|
||||
|
||||
In December 2014, new raylib 1.2.2 was published with support to compile directly for web (html5) using [emscripten](http://kripken.github.io/emscripten-site/) and [asm.js](http://asmjs.org/).
|
||||
|
||||
notes on raylib 1.3
|
||||
-------------------
|
||||
|
||||
On September 2015, after 1 year of raylib 1.2 release, arrives raylib 1.3. This version adds shaders functionality,
|
||||
improves tremendously textures module and also provides some new modules (camera system, gestures system, IMGUI).
|
||||
|
||||
Shaders support is the biggest addition to raylib 1.3, with support for easy shaders loading and use. Loaded shaders can be
|
||||
attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
|
||||
in this release, check raylib/shaders folder.
|
||||
|
||||
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/develop/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/develop/examples/core_3d_camera_free.c) and [core_3d_camera_first_person.c](https://github.com/raysan5/raylib/blob/develop/examples/core_3d_camera_first_person.c).
|
||||
|
||||
New [gestures](https://github.com/raysan5/raylib/blob/develop/src/gestures.h) module simplifies gestures detection on Android and HTML5 programs.
|
||||
|
||||
[raygui](https://github.com/raysan5/raylib/blob/develop/src/raygui.h), the new IMGUI (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.
|
||||
|
||||
Most of the examples have been completely rewritten and +10 new examples have been added to show the new raylib features.
|
||||
|
||||
Lots of code changes and lot of testing have concluded in this amazing new raylib 1.3.
|
||||
|
||||
notes on raylib 1.4
|
||||
-------------------
|
||||
|
||||
On February 2016, after 4 months of raylib 1.3 release, it comes raylib 1.4. For this new version,
|
||||
lots of parts of the library have been reviewed, lots of bugs have been solved and some interesting features have been added.
|
||||
|
||||
First big addition is a set of [Image manipulation functions](https://github.com/raysan5/raylib/blob/develop/src/raylib.h#L673) have been added to crop, resize, colorize, flip, dither and even draw image-to-image or text-to-image.
|
||||
Now a basic image processing can be done before converting the image to texture for usage.
|
||||
|
||||
SpriteFonts system has been improved, adding support for AngelCode fonts (.fnt) and TrueType Fonts (using [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) helper library).
|
||||
Now raylib can read standard .fnt font data and also generate at loading a SpriteFont from a TTF file.
|
||||
|
||||
New [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) physics module for basic 2D physics support. Still in development but already functional.
|
||||
Module comes with some usage examples for basic jump and level interaction and also force-based physic movements.
|
||||
|
||||
[raymath](https://github.com/raysan5/raylib/blob/develop/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/develop/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.
|
||||
|
||||
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).
|
||||
|
||||
Other important improvements are the functional raycast system for 3D picking, including some ray collision-detection functions,
|
||||
and the addition of two simple functions for persistent data storage. Now raylib user can save and load game data in a file (only some platforms supported).
|
||||
A simple [easings](https://github.com/raysan5/raylib/blob/develop/src/easings.h) module has also been added for values animation.
|
||||
|
||||
Up to 8 new code examples have been added to show the new raylib features and +10 complete game samples have been provided to learn
|
||||
how to create some classic games like Arkanoid, Asteroids, Missile Commander, Snake or Tetris.
|
||||
|
||||
Lots of code changes and lots of hours of hard work have concluded in this amazing new raylib 1.4.
|
||||
|
||||
notes on raylib 1.5
|
||||
-------------------
|
||||
|
||||
On July 2016, after 5 months of raylib 1.4 release, arrives raylib 1.5. This new version is the biggest boost of the library until now, lots of parts of the library have been redesigned, lots of bugs have been solved and some **AMAZING** new features have been added.
|
||||
|
||||
VR support: raylib supports **Oculus Rift CV1**, one of the most anticipated VR devices in the market. Additionally, raylib supports simulated VR stereo rendering, independent of the VR device; it means, raylib can generate stereo renders with custom head-mounted-display device parameteres, that way, any VR device in the market can be **simulated in any platform** just configuring device parameters (and consequently, lens distortion). To enable VR is [extremely easy](https://github.com/raysan5/raylib/blob/develop/examples/core_oculus_rift.c).
|
||||
|
||||
New materials system: now raylib supports standard material properties for 3D models, including diffuse-ambient-specular colors and diffuse-normal-specular textures. Just assign values to standard material and everything is processed internally.
|
||||
|
||||
New lighting system: added support for up to 8 configurable lights and 3 light types: **point**, **directional** and **spot** lights. Just create a light, configure its parameters and raylib manages render internally for every 3d object using standard material.
|
||||
|
||||
Complete gamepad support on Raspberry Pi: Gamepad system has been completely redesigned. Now multiple gamepads can be easily configured and used; gamepad data is read and processed in raw mode in a second thread.
|
||||
|
||||
Redesigned physics module: [physac](https://github.com/raysan5/raylib/blob/develop/src/physac.h) module has been converted to header only and usage [has been simplified](https://github.com/raysan5/raylib/blob/develop/examples/physics_basic_rigidbody.c). Performance has also been singnificantly improved, now physic objects are managed internally in a second thread.
|
||||
|
||||
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/develop/examples/core_2d_camera.c), render textures for offline render (and most comprehensive [postprocessing](https://github.com/raysan5/raylib/blob/develop/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/develop/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/develop/CHANGELOG) file for a more detailed list of changes.
|
||||
|
||||
Up to 8 new code examples have been added to show the new raylib features and also some samples to show the usage of [rlgl](https://github.com/raysan5/raylib/blob/develop/examples/rlgl_standalone.c) and [audio](https://github.com/raysan5/raylib/blob/develop/examples/audio_standalone.c) raylib modules as standalone libraries.
|
||||
|
||||
Lots of code changes (+400 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
|
||||
|
||||
notes on raylib 1.6
|
||||
-------------------
|
||||
|
||||
On November 2016, only 4 months after raylib 1.5, arrives raylib 1.6. This new version represents another big review of the library and includes some interesting additions. This version conmmemorates raylib 3rd anniversary (raylib 1.0 was published on November 2013) and it is a stepping stone for raylib future. raylib roadmap has been reviewed and redefined to focus on its primary objective: create a simple and easy-to-use library to learn videogames programming. Some of the new features:
|
||||
|
||||
Complete raylib Lua binding. All raylib functions plus the +60 code examples have been ported to Lua, now Lua users can enjoy coding videogames in Lua while using all the internal power of raylib. This addition also open the doors to Lua scripting support for a future raylib-based engine, being able to move game logic (Init, Update, Draw, De-Init) to Lua scripts while keep using raylib functionality.
|
||||
|
||||
Completely redesigned audio module. Based on the new direction taken in raylib 1.5, it has been further improved and more functionality added (+20 new functions) to allow raw audio processing and streaming. FLAC file format support has also been added. In the same line, OpenAL Soft backend is now provided as a static library in Windows to allow static linking and get ride of OpenAL32.dll. Now raylib Windows games are completey self-contained, no external libraries required any more!
|
||||
|
||||
Physac module has been moved to its own repository and it has been improved A LOT, actually, library has been completely rewritten from scratch by @victorfisac, multiple samples have been added together with countless new features to match current standard 2D physic libraries. Results are amazing!
|
||||
|
||||
Camera and gestures modules have been reviewed, highly simplified and ported to single-file header-only libraries for easier portability and usage flexibility. Consequently, camera system usage has been simplified in all examples.
|
||||
|
||||
Improved Gamepad support on Windows and Raspberry Pi with the addition of new functions for custom gamepad configurations but supporting by default PS3 and Xbox-based gamepads.
|
||||
|
||||
Improved textures and text functionality, adding new functions for texture filtering control and better TTF/AngelCode fonts loading and generation support.
|
||||
|
||||
Build system improvement. Added support for raylib dynamic library generation (raylib.dll) for users that prefer dynamic library linking. Also thinking on advance users, it has been added pre-configured Visual Studio C++ 2015 solution with raylib project and C/C++ examples for users that prefer that professional IDE and compiler.
|
||||
|
||||
New examples, new functions, complete code-base review, multiple bugs corrected... this is raylib 1.6. Enjoy making games.
|
||||
|
||||
|
||||
features
|
||||
--------
|
||||
|
||||
@ -189,24 +25,22 @@ features
|
||||
* Shaders support, including Model shaders and Postprocessing shaders
|
||||
* Powerful math module for Vector and Matrix operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
|
||||
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, FLAC, XM, MOD)
|
||||
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi** and **HTML5**
|
||||
* VR stereo rendering support with configurable HMD device parameters
|
||||
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi**, **HTML5** and **Oculus Rift CV1**
|
||||
* Custom color palette for fancy visuals on raywhite background
|
||||
* Minimal external dependencies (GLFW3, OpenGL, OpenAL)
|
||||
* Complete binding to LUA
|
||||
* Complete binding to LUA: [raylib-lua](https://github.com/raysan5/raylib-lua)
|
||||
|
||||
raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option by far I found for
|
||||
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
|
||||
raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option I found for
|
||||
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, maintained, ...).
|
||||
|
||||
raylib uses on its [audio](https://github.com/raysan5/raylib/blob/master/src/audio.c) module, [OpenAL Soft](http://kcat.strangesoft.net/openal.html) audio library, in multiple flavours,
|
||||
to accomodate to Android, Raspberry Pi and HTML5.
|
||||
|
||||
On Android, raylib uses `native_app_glue module` (provided by Android NDK) and native Android libraries to manage window/context, inputs and activity cycle.
|
||||
On Android, raylib uses `native_app_glue module` (provided by Android NDK) and native Android libraries to manage window/context, inputs and activity life cycle.
|
||||
|
||||
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
|
||||
|
||||
On Oculus Rift CV1, raylib uses Oculus PC SDK libraries but only the core C library ([LibOVR](https://github.com/raysan5/raylib/tree/develop/src/external/OculusSDK/LibOVR)); runtime library (LibOVRRT32_1.dll) must be linked at compilation time.
|
||||
|
||||
raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md).
|
||||
|
||||
tools requirements
|
||||
@ -279,3 +113,8 @@ contributing (in some way or another) to make raylib project better. Huge thanks
|
||||
Please, if I forget someone in this list, excuse me and write me an email to remind me to add you!
|
||||
|
||||
[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
|
||||
|
||||
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.md) for further details.
|
||||
|
@ -34,7 +34,6 @@ Color colors[MAX_COLUMNS];
|
||||
//Vector3 playerPosition;
|
||||
Vector3 playerPosition = { 4.0f, 2.0f, 4.0f }; // Define player position
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -85,6 +85,9 @@ void UpdateDrawFrame(void)
|
||||
UpdateCamera(&camera); // Update camera (simulator mode)
|
||||
|
||||
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode(); // Toggle VR mode
|
||||
|
||||
// Lock mouse cursor if mouse click on canvas
|
||||
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) DisableCursor();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
File diff suppressed because one or more lines are too long
@ -563,8 +563,7 @@ shaders/shaders_postprocessing: shaders/shaders_postprocessing.c
|
||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL) -s TOTAL_MEMORY=67108864 \
|
||||
--preload-file shaders/resources/model/dwarf.obj@resources/model/dwarf.obj \
|
||||
--preload-file shaders/resources/model/dwarf_diffuse.png@resources/model/dwarf_diffuse.png \
|
||||
--preload-file shaders/resources/shaders/glsl100/base.vs@resources/shaders/glsl100/base.vs \
|
||||
--preload-file shaders/resources/shaders/glsl100/bloom.fs@resources/shaders/glsl100/bloom.fs
|
||||
--preload-file shaders/resources/shaders/glsl100@resources/shaders/glsl100
|
||||
|
||||
# compile [audio] example - sound loading and playing (WAV and OGG)
|
||||
audio/audio_sound_loading: audio/audio_sound_loading.c
|
||||
|
@ -11,6 +11,7 @@ uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
uniform vec2 resolution = vec2(800, 450);
|
||||
|
||||
void main()
|
||||
{
|
34
docs/examples/web/shaders/resources/shaders/glsl100/blur.fs
Normal file
34
docs/examples/web/shaders/resources/shaders/glsl100/blur.fs
Normal file
@ -0,0 +1,34 @@
|
||||
#version 100
|
||||
|
||||
precision mediump float;
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
varying vec2 fragTexCoord;
|
||||
varying vec4 fragColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
// NOTE: Render size values must be passed from code
|
||||
const float renderWidth = 800.0;
|
||||
const float renderHeight = 450.0;
|
||||
|
||||
vec3 offset = vec3(0.0, 1.3846153846, 3.2307692308);
|
||||
vec3 weight = vec3(0.2270270270, 0.3162162162, 0.0702702703);
|
||||
|
||||
void main()
|
||||
{
|
||||
// Texel color fetching from texture sampler
|
||||
vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight.x;
|
||||
|
||||
tc += texture2D(texture0, fragTexCoord + vec2(offset.y)/renderWidth, 0.0).rgb*weight.y;
|
||||
tc += texture2D(texture0, fragTexCoord - vec2(offset.y)/renderWidth, 0.0).rgb*weight.y;
|
||||
|
||||
tc += texture2D(texture0, fragTexCoord + vec2(offset.z)/renderWidth, 0.0).rgb*weight.z;
|
||||
tc += texture2D(texture0, fragTexCoord - vec2(offset.z)/renderWidth, 0.0).rgb*weight.z;
|
||||
|
||||
gl_FragColor = vec4(tc, 1.0);
|
||||
}
|
@ -12,11 +12,11 @@ uniform vec4 colDiffuse;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
float hatchOffsetY = 5.0f;
|
||||
float lumThreshold01 = 0.9f;
|
||||
float lumThreshold02 = 0.7f;
|
||||
float lumThreshold03 = 0.5f;
|
||||
float lumThreshold04 = 0.3f;
|
||||
float hatchOffsetY = 5.0;
|
||||
float lumThreshold01 = 0.9;
|
||||
float lumThreshold02 = 0.7;
|
||||
float lumThreshold03 = 0.5;
|
||||
float lumThreshold04 = 0.3;
|
||||
|
||||
void main()
|
||||
{
|
@ -13,12 +13,11 @@ uniform vec4 colDiffuse;
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
// NOTE: Render size values must be passed from code
|
||||
const float renderWidth = 800;
|
||||
const float renderHeight = 450;
|
||||
const float renderWidth = 800.0;
|
||||
const float renderHeight = 450.0;
|
||||
|
||||
float stitchingSize = 6.0f;
|
||||
|
||||
uniform int invert = 0;
|
||||
float stitchingSize = 6.0;
|
||||
int invert = 0;
|
||||
|
||||
vec4 PostFX(sampler2D tex, vec2 uv)
|
||||
{
|
@ -16,11 +16,11 @@ const float PI = 3.1415926535;
|
||||
|
||||
void main()
|
||||
{
|
||||
float aperture = 178.0f;
|
||||
float aperture = 178.0;
|
||||
float apertureHalf = 0.5 * aperture * (PI / 180.0);
|
||||
float maxFactor = sin(apertureHalf);
|
||||
|
||||
vec2 uv = vec2(0);
|
||||
vec2 uv = vec2(0.0);
|
||||
vec2 xy = 2.0 * fragTexCoord.xy - 1.0;
|
||||
float d = length(xy);
|
||||
|
@ -13,11 +13,11 @@ uniform vec4 colDiffuse;
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
// NOTE: Render size values must be passed from code
|
||||
const float renderWidth = 800;
|
||||
const float renderHeight = 450;
|
||||
const float renderWidth = 800.0;
|
||||
const float renderHeight = 450.0;
|
||||
|
||||
uniform float pixelWidth = 5.0f;
|
||||
uniform float pixelHeight = 5.0f;
|
||||
float pixelWidth = 5.0;
|
||||
float pixelHeight = 5.0;
|
||||
|
||||
void main()
|
||||
{
|
@ -13,7 +13,7 @@ uniform vec4 colDiffuse;
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
void main()
|
||||
{
|
||||
{
|
||||
vec3 color = texture2D(texture0, fragTexCoord).rgb;
|
||||
vec3 colors[3];
|
||||
colors[0] = vec3(0.0, 0.0, 1.0);
|
||||
@ -21,10 +21,11 @@ void main()
|
||||
colors[2] = vec3(1.0, 0.0, 0.0);
|
||||
|
||||
float lum = (color.r + color.g + color.b)/3.0;
|
||||
|
||||
vec3 tc = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
int ix = (lum < 0.5)? 0:1;
|
||||
|
||||
vec3 tc = mix(colors[ix], colors[ix+1], (lum-float(ix)*0.5)/0.5);
|
||||
|
||||
if (lum < 0.5) tc = mix(colors[0], colors[1], lum/0.5);
|
||||
else tc = mix(colors[1], colors[2], (lum - 0.5)/0.5);
|
||||
|
||||
gl_FragColor = vec4(tc, 1.0);
|
||||
}
|
@ -12,8 +12,8 @@ uniform vec4 colDiffuse;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
float offset = 0;
|
||||
float frequency = 720/3.0;
|
||||
float offset = 0.0;
|
||||
float frequency = 450.0/3.0;
|
||||
|
||||
uniform float time;
|
||||
|
||||
@ -40,5 +40,5 @@ void main()
|
||||
|
||||
vec4 color = texture2D(texture0, fragTexCoord);
|
||||
|
||||
gl_FragColor = mix(vec4(0, 0.3, 0, 0), color, wavePos);
|
||||
gl_FragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos);
|
||||
}
|
40
docs/examples/web/shaders/resources/shaders/glsl100/sobel.fs
Normal file
40
docs/examples/web/shaders/resources/shaders/glsl100/sobel.fs
Normal file
@ -0,0 +1,40 @@
|
||||
#version 100
|
||||
|
||||
precision mediump float;
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
varying vec2 fragTexCoord;
|
||||
varying vec4 fragColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
vec2 resolution = vec2(800.0, 450.0);
|
||||
|
||||
void main()
|
||||
{
|
||||
float x = 1.0/resolution.x;
|
||||
float y = 1.0/resolution.y;
|
||||
|
||||
vec4 horizEdge = vec4(0.0);
|
||||
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
|
||||
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0;
|
||||
horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
|
||||
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
|
||||
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0;
|
||||
horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
|
||||
|
||||
vec4 vertEdge = vec4(0.0);
|
||||
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0;
|
||||
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0;
|
||||
vertEdge -= texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0;
|
||||
vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0;
|
||||
vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0;
|
||||
vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0;
|
||||
|
||||
vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb));
|
||||
|
||||
gl_FragColor = vec4(edge, texture2D(texture0, fragTexCoord).a);
|
||||
}
|
@ -12,8 +12,9 @@ uniform vec4 colDiffuse;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
const float renderWidth = 800.0; // HARDCODED for example!
|
||||
const float renderHeight = 480.0; // Use uniforms instead...
|
||||
// NOTE: Render size values should be passed from code
|
||||
const float renderWidth = 800;
|
||||
const float renderHeight = 450;
|
||||
|
||||
float radius = 250.0;
|
||||
float angle = 0.8;
|
||||
|
@ -1,26 +0,0 @@
|
||||
#version 330
|
||||
|
||||
// Input vertex attributes
|
||||
in vec3 vertexPosition;
|
||||
in vec2 vertexTexCoord;
|
||||
in vec3 vertexNormal;
|
||||
in vec4 vertexColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform mat4 mvpMatrix;
|
||||
|
||||
// Output vertex attributes (to fragment shader)
|
||||
out vec2 fragTexCoord;
|
||||
out vec4 fragColor;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
void main()
|
||||
{
|
||||
// Send vertex attributes to fragment shader
|
||||
fragTexCoord = vertexTexCoord;
|
||||
fragColor = vertexColor;
|
||||
|
||||
// Calculate final vertex position
|
||||
gl_Position = mvpMatrix*vec4(vertexPosition, 1.0);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
const vec2 size = vec2(800, 450); // render size
|
||||
const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance
|
||||
const float quality = 2.5; // lower = smaller glow, better quality
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 sum = vec4(0);
|
||||
vec2 sizeFactor = vec2(1)/size*quality;
|
||||
|
||||
// Texel color fetching from texture sampler
|
||||
vec4 source = texture(texture0, fragTexCoord);
|
||||
|
||||
const int range = 2; // should be = (samples - 1)/2;
|
||||
|
||||
for (int x = -range; x <= range; x++)
|
||||
{
|
||||
for (int y = -range; y <= range; y++)
|
||||
{
|
||||
sum += texture(texture0, fragTexCoord + vec2(x, y)*sizeFactor);
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate final fragment color
|
||||
finalColor = ((sum/(samples*samples)) + source)*colDiffuse;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0; // Depth texture
|
||||
uniform vec4 fragTintColor;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
void main()
|
||||
{
|
||||
float zNear = 0.01; // camera z near
|
||||
float zFar = 10.0; // camera z far
|
||||
float z = texture(texture0, fragTexCoord).x;
|
||||
|
||||
// Linearize depth value
|
||||
float depth = (2.0*zNear)/(zFar + zNear - z*(zFar - zNear));
|
||||
|
||||
// Calculate final fragment color
|
||||
finalColor = vec4(depth, depth, depth, 1.0f);
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
// NOTE: Default parameters for Oculus Rift DK2 device
|
||||
const vec2 LeftLensCenter = vec2(0.2863248, 0.5);
|
||||
const vec2 RightLensCenter = vec2(0.7136753, 0.5);
|
||||
const vec2 LeftScreenCenter = vec2(0.25, 0.5);
|
||||
const vec2 RightScreenCenter = vec2(0.75, 0.5);
|
||||
const vec2 Scale = vec2(0.25, 0.45);
|
||||
const vec2 ScaleIn = vec2(4.0, 2.5);
|
||||
const vec4 HmdWarpParam = vec4(1.0, 0.22, 0.24, 0.0);
|
||||
const vec4 ChromaAbParam = vec4(0.996, -0.004, 1.014, 0.0);
|
||||
|
||||
void main()
|
||||
{
|
||||
// The following two variables need to be set per eye
|
||||
vec2 LensCenter = fragTexCoord.x < 0.5 ? LeftLensCenter : RightLensCenter;
|
||||
vec2 ScreenCenter = fragTexCoord.x < 0.5 ? LeftScreenCenter : RightScreenCenter;
|
||||
|
||||
// Scales input texture coordinates for distortion: vec2 HmdWarp(vec2 fragTexCoord, vec2 LensCenter)
|
||||
vec2 theta = (fragTexCoord - LensCenter)*ScaleIn; // Scales to [-1, 1]
|
||||
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 tc = LensCenter + Scale*theta1;
|
||||
|
||||
// Detect whether blue texture coordinates are out of range since these will scaled out the furthest
|
||||
vec2 thetaBlue = theta1*(ChromaAbParam.z + ChromaAbParam.w*rSq);
|
||||
vec2 tcBlue = LensCenter + Scale*thetaBlue;
|
||||
|
||||
if (any(bvec2(clamp(tcBlue, ScreenCenter - vec2(0.25, 0.5), ScreenCenter + vec2(0.25, 0.5)) - tcBlue))) finalColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
else
|
||||
{
|
||||
// Do blue texture lookup
|
||||
float blue = texture(texture0, tcBlue).b;
|
||||
|
||||
// Do green lookup (no scaling)
|
||||
vec2 tcGreen = LensCenter + Scale*theta1;
|
||||
float green = texture(texture0, tcGreen).g;
|
||||
|
||||
// Do red scale and lookup
|
||||
vec2 thetaRed = theta1*(ChromaAbParam.x + ChromaAbParam.y*rSq);
|
||||
vec2 tcRed = LensCenter + Scale*thetaRed;
|
||||
float red = texture(texture0, tcRed).r;
|
||||
|
||||
finalColor = vec4(red, green, blue, 1.0);
|
||||
}
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
void main()
|
||||
{
|
||||
// Texel color fetching from texture sampler
|
||||
vec4 texelColor = texture(texture0, fragTexCoord)*colDiffuse*fragColor;
|
||||
|
||||
// Convert texel color to grayscale using NTSC conversion weights
|
||||
float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114));
|
||||
|
||||
// Calculate final fragment color
|
||||
finalColor = vec4(gray, gray, gray, texelColor.a);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
// NOTE: Add here your custom variables
|
||||
|
||||
const float renderWidth = 800.0; // HARDCODED for example!
|
||||
const float renderHeight = 480.0; // Use uniforms instead...
|
||||
|
||||
float radius = 250.0;
|
||||
float angle = 0.8;
|
||||
|
||||
uniform vec2 center = vec2(200.0, 200.0);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texSize = vec2(renderWidth, renderHeight);
|
||||
vec2 tc = fragTexCoord*texSize;
|
||||
tc -= center;
|
||||
|
||||
float dist = length(tc);
|
||||
|
||||
if (dist < radius)
|
||||
{
|
||||
float percent = (radius - dist)/radius;
|
||||
float theta = percent*percent*angle*8.0;
|
||||
float s = sin(theta);
|
||||
float c = cos(theta);
|
||||
|
||||
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
|
||||
}
|
||||
|
||||
tc += center;
|
||||
vec4 color = texture2D(texture0, tc/texSize)*colDiffuse*fragColor;;
|
||||
|
||||
finalColor = vec4(color.rgb, 1.0);;
|
||||
}
|
@ -22,6 +22,48 @@
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
#define GLSL_VERSION 330
|
||||
#define DEFAULT_VERTEX_SHADER "resources/shaders/glsl330/base.vs"
|
||||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
#define GLSL_VERSION 100
|
||||
#define DEFAULT_VERTEX_SHADER "resources/shaders/glsl100/base.vs"
|
||||
#endif
|
||||
|
||||
#define MAX_POSTPRO_SHADERS 12
|
||||
|
||||
typedef enum {
|
||||
FX_GRAYSCALE = 0,
|
||||
FX_POSTERIZATION,
|
||||
FX_DREAM_VISION,
|
||||
FX_PIXELIZER,
|
||||
FX_CROSS_HATCHING,
|
||||
FX_CROSS_STITCHING,
|
||||
FX_PREDATOR_VIEW,
|
||||
FX_SCANLINES,
|
||||
FX_FISHEYE,
|
||||
FX_SOBEL,
|
||||
FX_BLOOM,
|
||||
FX_BLUR,
|
||||
//FX_FXAA
|
||||
} PostproShader;
|
||||
|
||||
static const char *postproShaderText[] = {
|
||||
"GRAYSCALE",
|
||||
"POSTERIZATION",
|
||||
"DREAM_VISION",
|
||||
"PIXELIZER",
|
||||
"CROSS_HATCHING",
|
||||
"CROSS_STITCHING",
|
||||
"PREDATOR_VIEW",
|
||||
"SCANLINES",
|
||||
"FISHEYE",
|
||||
"SOBEL",
|
||||
"BLOOM",
|
||||
"BLUR",
|
||||
//"FXAA"
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -33,9 +75,11 @@ Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f
|
||||
|
||||
Model dwarf; // OBJ model
|
||||
Texture2D texture; // Model texture
|
||||
Shader shader; // Postpro shader
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
Shader shaders[MAX_POSTPRO_SHADERS]; // Postpro shaders
|
||||
int currentShader = FX_GRAYSCALE; // Current shader selected
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
RenderTexture2D target;
|
||||
|
||||
@ -58,8 +102,21 @@ int main()
|
||||
texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
|
||||
dwarf.material.texDiffuse = texture; // Set dwarf model diffuse texture
|
||||
|
||||
shader = LoadShader("resources/shaders/glsl100/base.vs",
|
||||
"resources/shaders/glsl100/bloom.fs"); // Load postpro shader
|
||||
// Load all postpro shaders
|
||||
// NOTE 1: All postpro shader use the base vertex shader (DEFAULT_VERTEX_SHADER)
|
||||
// NOTE 2: We load the correct shader depending on GLSL version
|
||||
shaders[FX_GRAYSCALE] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
|
||||
shaders[FX_POSTERIZATION] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/posterization.fs", GLSL_VERSION));
|
||||
shaders[FX_DREAM_VISION] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/dream_vision.fs", GLSL_VERSION));
|
||||
shaders[FX_PIXELIZER] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/pixelizer.fs", GLSL_VERSION));
|
||||
shaders[FX_CROSS_HATCHING] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/cross_hatching.fs", GLSL_VERSION));
|
||||
shaders[FX_CROSS_STITCHING] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/cross_stitching.fs", GLSL_VERSION));
|
||||
shaders[FX_PREDATOR_VIEW] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/predator.fs", GLSL_VERSION));
|
||||
shaders[FX_SCANLINES] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/scanlines.fs", GLSL_VERSION));
|
||||
shaders[FX_FISHEYE] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/fisheye.fs", GLSL_VERSION));
|
||||
shaders[FX_SOBEL] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/sobel.fs", GLSL_VERSION));
|
||||
shaders[FX_BLOOM] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/bloom.fs", GLSL_VERSION));
|
||||
shaders[FX_BLUR] = LoadShader(DEFAULT_VERTEX_SHADER, FormatText("resources/shaders/glsl%i/blur.fs", GLSL_VERSION));
|
||||
|
||||
// Create a RenderTexture2D to be used for render to texture
|
||||
target = LoadRenderTexture(screenWidth, screenHeight);
|
||||
@ -82,7 +139,10 @@ int main()
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadShader(shader); // Unload shader
|
||||
|
||||
// Unload all postpro shaders
|
||||
for (int i = 0; i < MAX_POSTPRO_SHADERS; i++) UnloadShader(shaders[i]);
|
||||
|
||||
UnloadTexture(texture); // Unload texture
|
||||
UnloadModel(dwarf); // Unload model
|
||||
|
||||
@ -100,6 +160,12 @@ void UpdateDrawFrame(void)
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update internal camera and our camera
|
||||
|
||||
if (IsKeyPressed(KEY_RIGHT)) currentShader++;
|
||||
else if (IsKeyPressed(KEY_LEFT)) currentShader--;
|
||||
|
||||
if (currentShader >= MAX_POSTPRO_SHADERS) currentShader = 0;
|
||||
else if (currentShader < 0) currentShader = MAX_POSTPRO_SHADERS - 1;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
@ -117,21 +183,26 @@ void UpdateDrawFrame(void)
|
||||
DrawGrid(10, 1.0f); // Draw a grid
|
||||
|
||||
End3dMode();
|
||||
|
||||
DrawText("HELLO POSTPROCESSING!", 70, 190, 50, RED);
|
||||
|
||||
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
||||
|
||||
BeginShaderMode(shader);
|
||||
// Render previously generated texture using selected postpro shader
|
||||
BeginShaderMode(shaders[currentShader]);
|
||||
|
||||
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
|
||||
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
|
||||
|
||||
EndShaderMode();
|
||||
|
||||
DrawRectangle(0, 9, 580, 30, Fade(LIGHTGRAY, 0.7f));
|
||||
|
||||
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, DARKGRAY);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
DrawText("CURRENT POSTPRO SHADER:", 10, 15, 20, BLACK);
|
||||
DrawText(postproShaderText[currentShader], 330, 15, 20, RED);
|
||||
DrawText("< >", 540, 10, 30, DARKBLUE);
|
||||
|
||||
DrawFPS(700, 15);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -60389,6 +60389,29 @@ _
|
||||
€Å®ü3€ÓV |