Merge pull request #132 from raysan5/develop
Develop branch integration
This commit is contained in:
commit
a2794379a0
91 changed files with 18501 additions and 22929 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -63,10 +63,14 @@ xcuserdata/
|
||||||
DerivedData/
|
DerivedData/
|
||||||
*.dll
|
*.dll
|
||||||
src/libraylib.a
|
src/libraylib.a
|
||||||
|
src/libraylib.bc
|
||||||
|
|
||||||
# oculus example
|
# oculus example
|
||||||
!examples/oculus_glfw_sample/LibOVRRT32_1.dll
|
!examples/oculus_glfw_sample/
|
||||||
|
|
||||||
|
|
||||||
# external libraries DLLs
|
# external libraries DLLs
|
||||||
!src/external/glfw3/lib/win32/glfw3.dll
|
!src/external/glfw3/lib/win32/glfw3.dll
|
||||||
!src/external/openal_soft/lib/win32/OpenAL32.dll
|
!src/external/openal_soft/lib/win32/OpenAL32.dll
|
||||||
|
!src/external/OculusSDK/LibOVR/LibOVRRT32_1.dll
|
||||||
|
!src/external/pthread/pthreadGC2.dll
|
||||||
95
CHANGELOG
95
CHANGELOG
|
|
@ -1,16 +1,107 @@
|
||||||
changelog
|
changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Current Release: raylib 1.4.0 (22 February 2016)
|
Current Release: raylib 1.5.0 (18 July 2016)
|
||||||
|
|
||||||
NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source.
|
NOTE: Only versions marked as 'Release' are available in installer, updates are only available as source.
|
||||||
NOTE: Current Release includes all previous updates.
|
NOTE: Current Release includes all previous updates.
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 1.5.0 (18 July 2016)
|
||||||
|
-----------------------------------------------
|
||||||
|
NOTE:
|
||||||
|
Probably this new version is the biggest boost of the library ever, lots of parts of the library have been redesigned,
|
||||||
|
lots of bugs have been solved and some **AMAZING** new features have been added.
|
||||||
|
|
||||||
|
HUGE changes:
|
||||||
|
[rlgl] OCULUS RIFT CV1: Added support for VR, not oly Oculus Rift CV1 but also stereo rendering simulator (multiplatform).
|
||||||
|
[rlgl] MATERIALS SYSTEM: Added support for Materials (.mtl) and multiple material properties: diffuse, specular, normal.
|
||||||
|
[rlgl] LIGHTING SYSTEM: Added support for up to 8 lights of 3 different types: Omni, Directional and Spot.
|
||||||
|
[physac] REDESIGNED: Improved performance and simplified usage, physic objects now are managed internally in a second thread!
|
||||||
|
[audio] CHIPTUNES: Added support for module audio music (.xm, .mod) loading and playing. Multiple mixing channels supported.
|
||||||
|
|
||||||
|
other changes:
|
||||||
|
|
||||||
|
[core] Review Android button inputs
|
||||||
|
[core] Support Android internal data storage
|
||||||
|
[core] Renamed WorldToScreen() to GetWorldToScreen()
|
||||||
|
[core] Removed function SetCustomCursor()
|
||||||
|
[core] Removed functions BeginDrawingEx(), BeginDrawingPro()
|
||||||
|
[core] Replaced functions InitDisplay() + InitGraphics() with: InitGraphicsDevice()
|
||||||
|
[core] Added support for field-of-view Y (fovy) on 3d Camera
|
||||||
|
[core] Added 2D camera mode functions: Begin2dMode() - End2dMode()
|
||||||
|
[core] Translate mouse inputs to Android touch/gestures internally
|
||||||
|
[core] Translate mouse inputs as touch inputs in HTML5
|
||||||
|
[core] Improved function GetKeyPressed() to support multiple keys (including function keys)
|
||||||
|
[core] Improved gamepad support, specially for RaspberryPi (including multiple gamepads support)
|
||||||
|
[rlgl] Support stereo rendering simulation (duplicate draw calls by viewport, optimized)
|
||||||
|
[rlgl] Added distortion shader (embeded) to support custom VR simulator: shader_distortion.h
|
||||||
|
[rlgl] Added support for OpenGL 2.1 on desktop
|
||||||
|
[rlgl] Improved 2D vs 3D drawing system (lines, triangles, quads)
|
||||||
|
[rlgl] Improved DXT-ETC1 support on HTML5
|
||||||
|
[rlgl] Review function: rlglUnproject()
|
||||||
|
[rlgl] Removed function: rlglInitGraphics(), integrated into rlglInit()
|
||||||
|
[rlgl] Updated Mesh and Shader structs
|
||||||
|
[rlgl] Simplified internal (default) dynamic buffers
|
||||||
|
[rlgl] Added support for indexed and dynamic mesh data
|
||||||
|
[rlgl] Set fixed vertex attribs location points
|
||||||
|
[rlgl] Improved mesh data loading support
|
||||||
|
[rlgl] Added standard shader (embeded) to support materials and lighting: shader_standard.h
|
||||||
|
[rlgl] Added light functions: CreateLight(), DestroyLight()
|
||||||
|
[rlgl] Added wire mode functions: rlDisableWireMode(), rlEnableWireMode()
|
||||||
|
[rlgl] Review function consistency, added: rlglLoadMesh(), rlglUpdateMesh(), rlglDrawMesh(), rlglUnloadMesh()
|
||||||
|
[rlgl] Replaced SetCustomShader() by: BeginShaderMode() - EndShaderMode()
|
||||||
|
[rlgl] Replaced SetBlendMode() by: BeginBlendMode() - EndBlendMode()
|
||||||
|
[rlgl] Added functions to customize internal matrices: SetMatrixProjection(), SetMatrixModelview()
|
||||||
|
[rlgl] Unified internal shaders to only one default shader
|
||||||
|
[rlgl] Added support for render to texture (RenderTexture2D):
|
||||||
|
LoadRenderTexture() - UnloadRenderTexture()
|
||||||
|
BeginTextureMode() - EndTextureMode()
|
||||||
|
[rlgl] Removed SetShaderMap*() functions
|
||||||
|
[rlgl] Redesigned default buffers usage functions:
|
||||||
|
LoadDefaultBuffers() - UnloadDefaultBuffers()
|
||||||
|
UpdateDefaultBuffers() - DrawDefaultBuffers()
|
||||||
|
[shapes] Corrected bug on GetCollisionRec()
|
||||||
|
[textures] Added support for Nearest-Neighbor image scaling
|
||||||
|
[textures] Added functions to draw text on image: ImageDrawText(), ImageDrawTextEx()
|
||||||
|
[text] Reorganized internal functions: Added LoadImageFont()
|
||||||
|
[text] Security check for unsupported BMFonts
|
||||||
|
[models] Split mesh creation from model loading on heightmap and cubicmap
|
||||||
|
[models] Updated BoundingBox collision detections
|
||||||
|
[models] Added color parameter to DrawBoundigBox()
|
||||||
|
[models] Removed function: DrawQuad()
|
||||||
|
[models] Removed function: SetModelTexture()
|
||||||
|
[models] Redesigned DrawPlane() to use RL_TRIANGLES
|
||||||
|
[models] Redesigned DrawRectangleV() to use RL_TRIANGLES
|
||||||
|
[models] Redesign to accomodate new materials system: LoadMaterial()
|
||||||
|
[models] Added material functions: LoadDefaultMaterial(), LoadStandardMaterial()
|
||||||
|
[models] Added MTL material loading support: LoadMTL()
|
||||||
|
[models] Added function: DrawLight()
|
||||||
|
[audio] Renamed SoundIsPlaying() to IsSoundPlaying()
|
||||||
|
[audio] Renamed MusicIsPlaying() to IsMusicPlaying()
|
||||||
|
[audio] Support multiple Music streams (indexed)
|
||||||
|
[audio] Support multiple mixing channels
|
||||||
|
[gestures] Improved and reviewed gestures system
|
||||||
|
[raymath] Added QuaternionInvert()
|
||||||
|
[raymath] Removed function: PrintMatrix()
|
||||||
|
[raygui] Ported to header-only library (https://github.com/raysan5/raygui)
|
||||||
|
[shaders] Added depth drawing shader (requires a depth texture)
|
||||||
|
[shaders] Reviewed included shaders and added comments
|
||||||
|
[OpenAL Soft] Updated to latest version (1.17.2)
|
||||||
|
[GLFW3] Updated to latest version (3.2)
|
||||||
|
[stb] Updated to latest headers versions
|
||||||
|
[GLAD] Converted to header only library and simplified to only used extensions
|
||||||
|
[*] Reorganize library folders: external libs moved to src/external folder
|
||||||
|
[*] Reorganize src folder for Android library
|
||||||
|
[*] Review external dependencies usage
|
||||||
|
[*] Improved Linux and OSX build systems
|
||||||
|
[*] Lots of tweaks and bugs corrected all around
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Release: raylib 1.4.0 (22 February 2016)
|
Release: raylib 1.4.0 (22 February 2016)
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
NOTE:
|
NOTE:
|
||||||
This version supposed another big improvement for raylib, inlcuding new modules and new features.
|
This version supposed another big improvement for raylib, including new modules and new features.
|
||||||
More than 30 new functions have been added to previous raylib version.
|
More than 30 new functions have been added to previous raylib version.
|
||||||
Around 8 new examples and +10 new game samples have been added.
|
Around 8 new examples and +10 new game samples have been added.
|
||||||
|
|
||||||
|
|
|
||||||
12
HELPME.md
12
HELPME.md
|
|
@ -7,23 +7,21 @@ please, [let me know][raysan5].
|
||||||
The following help is highly appreciated:
|
The following help is highly appreciated:
|
||||||
|
|
||||||
- C programming - Can you write / review / test / improve the code?
|
- C programming - Can you write / review / test / improve the code?
|
||||||
- Translators / Localizators - Can you translate raylib to another language?
|
|
||||||
- Documentation / Tutorials / Example writters - Can you write some tutorial / example?
|
- Documentation / Tutorials / Example writters - Can you write some tutorial / example?
|
||||||
- Web Development - Can you help with the web? Can you setup a forum?
|
- Web Development - Can you help with the web? Can you setup a forum?
|
||||||
- Porting to Linux, OSX... - Can you compile and test raylib on another OS?
|
- Porting to Linux, OSX, RaspberryPi, consoles... - Can you compile and test raylib on another systems?
|
||||||
- Testers of current features and multiple systems - Can you find some bug on raylib?
|
- Testers of current features and multiple systems - Can you find some bug on raylib?
|
||||||
|
|
||||||
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping
|
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping
|
||||||
with a small [donation](http://www.raylib.com/helpme.htm) (just some euros...). It will really motivate to continue improving this project (and pay some bills… or some coffee).
|
with a small [donation](http://www.raylib.com/helpme.htm) or contributing with [raylib patreon](https://www.patreon.com/raysan5). It will really motivate to continue improving this project (and pay some bills… or some coffee).
|
||||||
|
|
||||||
raylib philosophy
|
raylib philosophy
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
* raylib is a tool to LEARN videogames programming, every single function in raylib should be a tutorial on itself (clear code).
|
* raylib is a tool to LEARN videogames programming, every single function in raylib should be a tutorial on itself.
|
||||||
* raylib is SIMPLE and EASY-TO-USE, I tried to keep it compact with a small set of functions, if a function is too complex or
|
* raylib is SIMPLE and EASY-TO-USE, I tried to keep it compact with a small set of functions, if a function is too complex or has not a clear usefulness, better not to include it.
|
||||||
has not a clear usefulness, better not to include it.
|
|
||||||
* raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
|
* raylib is open source and free; educators and institutions can use this tool to TEACH videogames programming completely by free.
|
||||||
* raylib is, hopefully, collaborative; contribution of tutorials / code-examples / bugs-solving / code-comments are highly appreciated.
|
* raylib is collaborative; contribution of tutorials / code-examples / bugs-solving / code-comments are highly appreciated.
|
||||||
* raylib's license (and its external libs respective licenses) allow using it for commercial products.
|
* raylib's license (and its external libs respective licenses) allow using it for commercial products.
|
||||||
|
|
||||||
contact
|
contact
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ source code
|
||||||
raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
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:
|
BSD-like license that allows static linking with closed source software:
|
||||||
|
|
||||||
Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
This software is provided "as-is", without any express or implied warranty. In no event
|
This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
will the authors be held liable for any damages arising from the use of this software.
|
will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
|
|
||||||
85
README.md
85
README.md
|
|
@ -1,4 +1,4 @@
|
||||||
<img src="http://www.raylib.com/img/fb_raylib_logo.png" width=256>
|
<img src="https://github.com/raysan5/raylib/blob/master/logo/logo256x256.png" width=256>
|
||||||
|
|
||||||
about
|
about
|
||||||
-----
|
-----
|
||||||
|
|
@ -43,7 +43,7 @@ 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
|
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.
|
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 translate raylib-OpenGL-style
|
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.
|
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
|
[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
|
||||||
|
|
@ -83,9 +83,7 @@ Shaders support is the biggest addition to raylib 1.3, with support for easy sha
|
||||||
attached to 3d models or used as fullscreen postrocessing effects. A bunch of postprocessing shaders are also included
|
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.
|
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.),
|
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.
|
||||||
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).
|
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).
|
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).
|
||||||
|
|
||||||
|
|
@ -101,40 +99,74 @@ Lots of code changes and lot of testing have concluded in this amazing new rayli
|
||||||
notes on raylib 1.4
|
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.
|
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.
|
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.
|
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.
|
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.
|
[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.
|
[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).
|
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.
|
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.
|
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.
|
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. Probably this new version is the biggest boost of the library ever, 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: **Oculus Rift CV1**. 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, supported light types are **point light**, **directional light** and **spot light**. Just create a light, configure it 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 used and configured and gamepad data is read and processed in raw mode in a second thread.
|
||||||
|
|
||||||
|
Redesigned physics module: physac module has been converted to header only and usage has been simplified. Performance has also been singnificantly improved, now physic objects now 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 @kd7tck amazing work.
|
||||||
|
|
||||||
|
This new version is so massie 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 and lighting systems. 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]() and [audio]() raylib modules as standalone libraries.
|
||||||
|
|
||||||
|
Lots of code changes (more than 300 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
|
||||||
|
|
||||||
features
|
features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
* Written in plain C code (C99)
|
* Written in plain C code (C99)
|
||||||
* Uses C# PascalCase/camelCase notation
|
* Uses C# PascalCase/camelCase notation
|
||||||
* Hardware accelerated with OpenGL (1.1, 3.3 or ES2)
|
* Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2)
|
||||||
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
|
* Unique OpenGL abstraction layer (usable as standalone module): [rlgl](https://github.com/raysan5/raylib/blob/master/src/rlgl.c)
|
||||||
* Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF)
|
* Powerful fonts module with multiple SpriteFonts formats support (XNA bitmap fonts, AngelCode fonts, TTF)
|
||||||
* Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
|
* Outstanding texture formats support, including compressed formats (DXT, ETC, PVRT, ASTC)
|
||||||
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps
|
||||||
|
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
||||||
* Powerful math module for Vector and Matrix operations: [raymath](https://github.com/raysan5/raylib/blob/master/src/raymath.c)
|
* 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 (WAV and OGG)
|
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, XM, MOD)
|
||||||
* Custom color palette for fancy visuals on raywhite background
|
* Custom color palette for fancy visuals on raywhite background
|
||||||
* 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**
|
||||||
|
|
||||||
raylib uses on its core module the outstanding [GLFW3](http://www.glfw.org/) library. The best option by far I found for
|
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, ...).
|
multiplatform (Windows, Linux, Mac) window/context and input management (clean, focused, great license, well documented, modern, ...).
|
||||||
|
|
@ -142,7 +174,7 @@ multiplatform (Windows, Linux, Mac) window/context and input management (clean,
|
||||||
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,
|
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.
|
to accomodate to Android, Raspberry Pi and HTML5.
|
||||||
|
|
||||||
On Android, raylib uses `native_app_glue module` (provided on 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 cycle.
|
||||||
|
|
||||||
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
|
On Raspberry Pi, raylib uses Videocore API and EGL for window/context management and raw inputs reading.
|
||||||
|
|
||||||
|
|
@ -167,12 +199,12 @@ Since raylib v1.1, you can download a Windows Installer package for easy install
|
||||||
building source (generate libraylib.a)
|
building source (generate libraylib.a)
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
Check raylib wiki page: [Building source](https://github.com/raysan5/raylib/wiki/Building-source)
|
Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki)
|
||||||
|
|
||||||
building examples
|
building examples
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Check raylib wiki page: [Building examples](https://github.com/raysan5/raylib/wiki/Building-examples)
|
Check raylib wiki page: [Compile for...](https://github.com/raysan5/raylib/wiki)
|
||||||
|
|
||||||
contact
|
contact
|
||||||
-------
|
-------
|
||||||
|
|
@ -191,21 +223,26 @@ If you feel you can help, then, [helpme!](http://www.raylib.com/helpme.htm)
|
||||||
acknowledgements
|
acknowledgements
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
The following people have contributed in some way to make raylib project a reality. Big thanks to them!
|
I believe that time is the most valuable resource and the following people have invested part of their time
|
||||||
|
contributing (in some way or another) to make raylib project better. Huge thanks!
|
||||||
|
|
||||||
- [Zopokx](https://github.com/Zopokx) for testing the web.
|
- [Zopokx](https://github.com/Zopokx) for testing the web.
|
||||||
- [Elendow](http://www.elendow.com) for testing and helping on web development.
|
- [Elendow](http://www.elendow.com) for testing and helping on web development.
|
||||||
- Victor Dual for implementating and testing of 3D shapes functions.
|
- Victor Dual for implementing and testing 3D shapes functions.
|
||||||
- Marc Palau for implementating and testing of 3D shapes functions and helping on development of camera and getures modules.
|
- Marc Palau for implementing and testing 3D shapes functions and contribute on camera and gestures modules.
|
||||||
- Kevin Gato for improving texture internal formats support and helping on raygui development.
|
- Kevin Gato for improving texture internal formats support and helping on raygui development.
|
||||||
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
|
- Daniel Nicolas for improving texture internal formats support and helping on raygui development.
|
||||||
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
- Marc Agüera for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
- Daniel Moreno for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
- Daniel Gomez for testing and using raylib on a real product ([Koala Seasons](http://www.koalaseasons.com))
|
||||||
- Sergio Martinez for helping on raygui development and tools development.
|
- Sergio Martinez for helping on raygui development and tools development (raygui_styler).
|
||||||
- Victor Fisac for developing physics raylib module (physac) and implementing light shaders and raycast system... and multiple tools and games.
|
- [Victor Fisac](https://github.com/victorfisac) for developing physics raylib module (physac) and implementing materials and lighting systems... among multiple other improvements and multiple tools and games.
|
||||||
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
|
- Albert Martos for helping on raygui and porting examples and game-templates to Android and HTML5.
|
||||||
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
|
- Ian Eito for helping on raygui and porting examples and game-templates to Android and HTML5.
|
||||||
|
- [procedural](https://github.com/procedural) for testing raylib on Linux, correcting some bugs and adding several mouse functions.
|
||||||
|
- [Chris Hemingway](https://github.com/cHemingway) for improving raylib on OSX build system.
|
||||||
|
- [Emanuele Petriglia](https://github.com/LelixSuper) for working on multiple GNU/Linux improvements and developing [TicTacToe](https://github.com/LelixSuper/TicTacToe) raylib game.
|
||||||
|
- [Joshua Reisenauer](https://github.com/kd7tck) for adding audio modules support (XM, MOD) and reviewing audio system.
|
||||||
|
|
||||||
|
|
||||||
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
|
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
|
||||||
|
|
|
||||||
14
ROADMAP.md
14
ROADMAP.md
|
|
@ -6,16 +6,22 @@ Here it is a wish list of features I would like to add and functions to improve.
|
||||||
|
|
||||||
Note that around the raylib source code there are multiple TODO points with pending revisions/bugs. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
Note that around the raylib source code there are multiple TODO points with pending revisions/bugs. Check [GitHub Issues](https://github.com/raysan5/raylib/issues) for further details!
|
||||||
|
|
||||||
raylib 1.5
|
raylib 1.x
|
||||||
|
|
||||||
Redesign Shaders/Textures system, use Materials
|
[IN PROGRESS] LUA scripting support (wrapper to lua lib)
|
||||||
Redesign physics module (physac)
|
|
||||||
Basic GPU stats sytem (memory, draws, time...)
|
Basic GPU stats sytem (memory, draws, time...)
|
||||||
Procedural image generation functions (spot, gradient, noise...)
|
Procedural image generation functions (spot, gradient, noise...)
|
||||||
Procedural mesh generation functions (cube, cone, sphere...)
|
Procedural mesh generation functions (cube, cone, sphere...)
|
||||||
Touch-based camera controls for Android
|
Touch-based camera controls for Android
|
||||||
Skybox and Fog support
|
Skybox and Fog support
|
||||||
[IN PROGRESS] LUA scripting support (wrapper to lua lib)
|
|
||||||
|
raylib 1.5
|
||||||
|
|
||||||
|
[DONE] Support Oculus Rift CV1 and VR stereo rendering (simulator)
|
||||||
|
[DONE] Redesign Shaders/Textures system -> New Materials system
|
||||||
|
[DONE] Support lighting: Omni, Directional and Spot lights
|
||||||
|
[DONE] Redesign physics module (physac)
|
||||||
|
[DONE] Chiptunes audio modules support
|
||||||
|
|
||||||
raylib 1.4
|
raylib 1.4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
|
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
# Copyright (c) 2013-2016 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||||
# will the authors be held liable for any damages arising from the use of this software.
|
# will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
|
@ -78,44 +78,38 @@ endif
|
||||||
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
|
||||||
|
|
||||||
# define any directories containing required header files
|
# define any directories containing required header files
|
||||||
|
INCLUDES = -I. -I../src -I../src/external
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
|
INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
# add standard directories for GNU/Linux
|
# add standard directories for GNU/Linux
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
INCLUDES = -I. -I../src -I/usr/local/include/raylib/
|
INCLUDES += -I/usr/local/include/raylib/
|
||||||
else ifeq ($(PLATFORM_OS),OSX)
|
else ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
INCLUDES = -I. -I../src
|
|
||||||
else
|
|
||||||
INCLUDES = -I. -I../../src -IC:/raylib/raylib/src
|
|
||||||
# external libraries headers
|
# external libraries headers
|
||||||
# GLFW3
|
# GLFW3
|
||||||
INCLUDES += -I../../external/glfw3/include
|
INCLUDES += -I../src/external/glfw3/include
|
||||||
# OpenAL Soft
|
# OpenAL Soft
|
||||||
INCLUDES += -I../../external/openal_soft/include
|
INCLUDES += -I../src/external/openal_soft/include
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# define library paths containing required libs
|
# define library paths containing required libs
|
||||||
|
LFLAGS = -L. -L../src
|
||||||
|
|
||||||
ifeq ($(PLATFORM),PLATFORM_RPI)
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
LFLAGS = -L. -L../../src -L/opt/vc/lib
|
LFLAGS += -L/opt/vc/lib
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
# add standard directories for GNU/Linux
|
# add standard directories for GNU/Linux
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
LFLAGS = -L. -L../../src
|
|
||||||
else ifeq ($(PLATFORM_OS),OSX)
|
|
||||||
LFLAGS = -L. -L../src
|
|
||||||
else
|
|
||||||
LFLAGS = -L. -L../../src -LC:/raylib/raylib/src
|
|
||||||
# external libraries to link with
|
# external libraries to link with
|
||||||
# GLFW3
|
# GLFW3
|
||||||
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH)
|
LFLAGS += -L../src/external/glfw3/lib/$(LIBPATH)
|
||||||
ifneq ($(PLATFORM_OS),OSX)
|
|
||||||
# OpenAL Soft
|
# OpenAL Soft
|
||||||
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH)
|
LFLAGS += -L../src/external/openal_soft/lib/$(LIBPATH)
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -126,8 +120,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
# libraries for Debian GNU/Linux desktop compiling
|
# libraries for Debian GNU/Linux desktop compiling
|
||||||
# requires the following packages:
|
# requires the following packages:
|
||||||
# libglfw3-dev libopenal-dev libegl1-mesa-dev
|
# libglfw3-dev libopenal-dev libegl1-mesa-dev
|
||||||
LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -pthread -ldl -lX11 \
|
LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -pthread -ldl
|
||||||
-lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
# on XWindow could require also below libraries, just uncomment
|
||||||
|
#LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
|
||||||
else
|
else
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
# libraries for OS X 10.9 desktop compiling
|
# libraries for OS X 10.9 desktop compiling
|
||||||
|
|
@ -148,7 +143,7 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
# just adjust the correct path to libraylib.bc
|
# just adjust the correct path to libraylib.bc
|
||||||
LIBS = ../src/libraylib.bc
|
LIBS = ../release/html5/libraylib.bc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# define additional parameters and flags for windows
|
# define additional parameters and flags for windows
|
||||||
|
|
@ -178,6 +173,9 @@ EXAMPLES = \
|
||||||
core_3d_picking \
|
core_3d_picking \
|
||||||
core_3d_camera_free \
|
core_3d_camera_free \
|
||||||
core_3d_camera_first_person \
|
core_3d_camera_first_person \
|
||||||
|
core_2d_camera \
|
||||||
|
core_world_screen \
|
||||||
|
core_oculus_rift \
|
||||||
shapes_logo_raylib \
|
shapes_logo_raylib \
|
||||||
shapes_basic_shapes \
|
shapes_basic_shapes \
|
||||||
shapes_colors_palette \
|
shapes_colors_palette \
|
||||||
|
|
@ -208,6 +206,7 @@ EXAMPLES = \
|
||||||
shaders_shapes_textures \
|
shaders_shapes_textures \
|
||||||
shaders_custom_uniform \
|
shaders_custom_uniform \
|
||||||
shaders_postprocessing \
|
shaders_postprocessing \
|
||||||
|
shaders_standard_lighting \
|
||||||
audio_sound_loading \
|
audio_sound_loading \
|
||||||
audio_music_stream \
|
audio_music_stream \
|
||||||
fix_dylib \
|
fix_dylib \
|
||||||
|
|
@ -288,6 +287,18 @@ core_3d_camera_free: core_3d_camera_free.c
|
||||||
core_3d_camera_first_person: core_3d_camera_first_person.c
|
core_3d_camera_first_person: core_3d_camera_first_person.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - 2d camera
|
||||||
|
core_2d_camera: core_2d_camera.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - world screen
|
||||||
|
core_world_screen: core_world_screen.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [core] example - oculus rift
|
||||||
|
core_oculus_rift: core_oculus_rift.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [shapes] example - raylib logo (with basic shapes)
|
# compile [shapes] example - raylib logo (with basic shapes)
|
||||||
shapes_logo_raylib: shapes_logo_raylib.c
|
shapes_logo_raylib: shapes_logo_raylib.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
@ -412,6 +423,10 @@ shaders_custom_uniform: shaders_custom_uniform.c
|
||||||
shaders_postprocessing: shaders_postprocessing.c
|
shaders_postprocessing: shaders_postprocessing.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [shaders] example - standard lighting
|
||||||
|
shaders_standard_lighting: shaders_standard_lighting.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# compile [audio] example - sound loading and playing (WAV and OGG)
|
# compile [audio] example - sound loading and playing (WAV and OGG)
|
||||||
audio_sound_loading: audio_sound_loading.c
|
audio_sound_loading: audio_sound_loading.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ int main()
|
||||||
|
|
||||||
InitAudioDevice(); // Initialize audio device
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
PlayMusicStream("resources/audio/guitar_noodling.ogg"); // Play music stream
|
PlayMusicStream(0, "resources/audio/guitar_noodling.ogg"); // Play music stream
|
||||||
|
|
||||||
int framesCounter = 0;
|
int framesCounter = 0;
|
||||||
float timePlayed = 0.0f;
|
float timePlayed = 0.0f;
|
||||||
|
|
@ -52,18 +52,18 @@ int main()
|
||||||
{
|
{
|
||||||
volume = 1.0;
|
volume = 1.0;
|
||||||
framesCounter = 0;
|
framesCounter = 0;
|
||||||
PlayMusicStream("resources/audio/another_file.ogg");
|
PlayMusicStream(1, "resources/audio/another_file.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMusicVolume(volume);
|
SetMusicVolume(volume);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (IsWindowMinimized()) PauseMusicStream();
|
if (IsWindowMinimized()) PauseMusicStream(0);
|
||||||
else ResumeMusicStream();
|
else ResumeMusicStream(0);
|
||||||
|
|
||||||
timePlayed = GetMusicTimePlayed()/GetMusicTimeLength()*100*4; // We scale by 4 to fit 400 pixels
|
timePlayed = GetMusicTimePlayed(0)/GetMusicTimeLength(0)*100*4; // We scale by 4 to fit 400 pixels
|
||||||
|
|
||||||
UpdateMusicStream(); // Update music buffer with new stream data
|
UpdateMusicStream(0); // Update music buffer with new stream data
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@ int main()
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
|
||||||
|
|
||||||
Rectangle player = { 400, 280, 40, 40 };
|
Rectangle player = { 400, 280, 40, 40 };
|
||||||
Rectangle buildings[MAX_BUILDINGS] = { 0, 0, 0, 0 };
|
Rectangle buildings[MAX_BUILDINGS];
|
||||||
Color buildColors[MAX_BUILDINGS] = { 80, 80, 80, 255 };
|
Color buildColors[MAX_BUILDINGS];
|
||||||
|
|
||||||
int spacing = 0;
|
int spacing = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ int main()
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 400;
|
int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - color selection (collision detection)");
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ int main()
|
||||||
for (int i = 0; i < 21; i++)
|
for (int i = 0; i < 21; i++)
|
||||||
{
|
{
|
||||||
colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
|
colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
|
||||||
colorsRecs[i].y = 40 + 100*(i/7) + 10*(i/7);
|
colorsRecs[i].y = 60 + 100*(i/7) + 10*(i/7);
|
||||||
colorsRecs[i].width = 100;
|
colorsRecs[i].width = 100;
|
||||||
colorsRecs[i].height = 100;
|
colorsRecs[i].height = 100;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
*
|
*
|
||||||
* raylib [core] example - Oculus Rift CV1
|
* raylib [core] example - Oculus Rift CV1
|
||||||
*
|
*
|
||||||
|
* Compile example using:
|
||||||
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) -L. -L..\src\external\OculusSDK\LibOVR -lLibOVRRT32_1 -lraylib -lglfw3 -lopengl32 -lgdi32 -std=c99
|
||||||
|
*
|
||||||
* This example has been created using raylib 1.5 (www.raylib.com)
|
* This example has been created using raylib 1.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)
|
||||||
*
|
*
|
||||||
|
|
@ -18,16 +21,19 @@ int main()
|
||||||
int screenWidth = 1080;
|
int screenWidth = 1080;
|
||||||
int screenHeight = 600;
|
int screenHeight = 600;
|
||||||
|
|
||||||
|
// NOTE: screenWidth/screenHeight should match VR device aspect ratio
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
|
||||||
|
|
||||||
InitOculusDevice();
|
// NOTE: If device is not available, it fallbacks to default device (simulator)
|
||||||
|
InitVrDevice(HMD_OCULUS_RIFT_CV1); // Init VR device (Oculus Rift CV1)
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera;
|
Camera camera;
|
||||||
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
|
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
|
||||||
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 = 60.0f; // Camera field-of-view Y
|
||||||
|
|
||||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
|
@ -39,7 +45,9 @@ int main()
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateOculusTracking();
|
UpdateVrTracking();
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_SPACE)) ToggleVrMode();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
|
@ -57,13 +65,15 @@ int main()
|
||||||
|
|
||||||
End3dMode();
|
End3dMode();
|
||||||
|
|
||||||
|
DrawFPS(10, 10);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
CloseOculusdevice(); // Close Oculus Rift device
|
CloseVrDevice(); // Close VR device
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
BIN
examples/core_oculus_rift.png
Normal file
BIN
examples/core_oculus_rift.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
|
|
@ -64,7 +64,6 @@ int main()
|
||||||
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, cubeScreenPosition.y, 20, BLACK);
|
DrawText("Enemy: 100 / 100", cubeScreenPosition.x - MeasureText("Enemy: 100 / 100", 20) / 2, cubeScreenPosition.y, 20, BLACK);
|
||||||
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2, 25, 20, GRAY);
|
DrawText("Text is always on top of the cube", (screenWidth - MeasureText("Text is always on top of the cube", 20)) / 2, 25, 20, GRAY);
|
||||||
|
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ int main()
|
||||||
|
|
||||||
// NOTE: By default each cube is mapped to one part of texture atlas
|
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||||
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||||
SetModelTexture(&map, texture); // Bind texture to map model
|
map.material.texDiffuse = texture; // Set map diffuse texture
|
||||||
|
|
||||||
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ int main()
|
||||||
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
||||||
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
||||||
Model map = LoadHeightmap(image, (Vector3){ 16, 8, 16 }); // Load heightmap model with defined size
|
Model map = LoadHeightmap(image, (Vector3){ 16, 8, 16 }); // Load heightmap model with defined size
|
||||||
SetModelTexture(&map, texture); // Bind texture to model
|
map.material.texDiffuse = texture; // Set map diffuse texture
|
||||||
Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Set model position (depends on model scaling!)
|
Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Set model position (depends on model scaling!)
|
||||||
|
|
||||||
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
|
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ int main()
|
||||||
|
|
||||||
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
|
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
|
||||||
Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
|
Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
|
||||||
SetModelTexture(&dwarf, texture); // Bind texture to model
|
dwarf.material.texDiffuse = texture; // Set dwarf model diffuse texture
|
||||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
|
|
||||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
|
@ -49,7 +49,7 @@ int main()
|
||||||
|
|
||||||
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
|
||||||
|
|
||||||
DrawGrid(10, 1.0f); // Draw a grid
|
DrawGrid(10, 1.0f); // Draw a grid
|
||||||
|
|
||||||
DrawGizmo(position); // Draw gizmo
|
DrawGizmo(position); // Draw gizmo
|
||||||
|
|
||||||
|
|
|
||||||
26
examples/oculus_glfw_sample/base.vs
Normal file
26
examples/oculus_glfw_sample/base.vs
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#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);
|
||||||
|
}
|
||||||
59
examples/oculus_glfw_sample/distortion.fs
Normal file
59
examples/oculus_glfw_sample/distortion.fs
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
|
||||||
|
// Input uniform values
|
||||||
|
uniform sampler2D texture0;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
// NOTE: Add here your custom variables
|
||||||
|
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); //vec2(0.1469278, 0.2350845);
|
||||||
|
const vec2 ScaleIn = vec2(4, 2.2222);
|
||||||
|
const vec4 HmdWarpParam = vec4(1, 0.22, 0.24, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Another set of default values
|
||||||
|
ChromaAbCorrection = {1.0, 0.0, 1.0, 0}
|
||||||
|
DistortionK = {1.0, 0.22, 0.24, 0}
|
||||||
|
Scale = {0.25, 0.5*AspectRatio, 0, 0}
|
||||||
|
ScaleIn = {4.0, 2/AspectRatio, 0, 0}
|
||||||
|
Left Screen Center = {0.25, 0.5, 0, 0}
|
||||||
|
Left Lens Center = {0.287994117, 0.5, 0, 0}
|
||||||
|
Right Screen Center = {0.75, 0.5, 0, 0}
|
||||||
|
Right Lens Center = {0.712005913, 0.5, 0, 0}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Scales input texture coordinates for distortion.
|
||||||
|
vec2 HmdWarp(vec2 in01, vec2 LensCenter)
|
||||||
|
{
|
||||||
|
vec2 theta = (in01 - LensCenter)*ScaleIn; // Scales to [-1, 1]
|
||||||
|
float rSq = theta.x*theta.x + theta.y*theta.y;
|
||||||
|
vec2 rvector = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq);
|
||||||
|
|
||||||
|
return LensCenter + Scale*rvector;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// SOURCE: http://www.mtbs3d.com/phpbb/viewtopic.php?f=140&t=17081
|
||||||
|
|
||||||
|
// The following two variables need to be set per eye
|
||||||
|
vec2 LensCenter = gl_FragCoord.x < 540 ? LeftLensCenter : RightLensCenter;
|
||||||
|
vec2 ScreenCenter = gl_FragCoord.x < 540 ? LeftScreenCenter : RightScreenCenter;
|
||||||
|
|
||||||
|
vec2 tc = HmdWarp(fragTexCoord, LensCenter);
|
||||||
|
|
||||||
|
if (any(bvec2(clamp(tc,ScreenCenter-vec2(0.25,0.5), ScreenCenter+vec2(0.25,0.5)) - tc))) finalColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//tc.x = gl_FragCoord.x < 640 ? (2.0 * tc.x) : (2.0 * (tc.x - 0.5));
|
||||||
|
finalColor = texture2D(texture0, tc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,12 +23,11 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define GLAD_IMPLEMENTATION
|
#include "glad.h"
|
||||||
#include "glad.h" // Extensions loading library
|
|
||||||
#include <GLFW/glfw3.h> // Windows/Context and inputs management
|
#include <GLFW/glfw3.h> // Windows/Context and inputs management
|
||||||
|
|
||||||
#define RLGL_STANDALONE
|
#define RLGL_STANDALONE
|
||||||
#include "rlgl.h"
|
#include "rlgl.h" // rlgl library: OpenGL 1.1 immediate-mode style coding
|
||||||
|
|
||||||
#define PLATFORM_OCULUS
|
#define PLATFORM_OCULUS
|
||||||
|
|
||||||
|
|
@ -79,14 +78,11 @@ typedef struct OculusLayer {
|
||||||
} OculusLayer;
|
} OculusLayer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum { LOG_INFO = 0, LOG_ERROR, LOG_WARNING, LOG_DEBUG, LOG_OTHER } TraceLogType;
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
static void ErrorCallback(int error, const char* description);
|
static void ErrorCallback(int error, const char* description);
|
||||||
static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||||
static void TraceLog(int msgType, const char *text, ...);
|
|
||||||
|
|
||||||
// Drawing functions (uses rlgl functionality)
|
// Drawing functions (uses rlgl functionality)
|
||||||
static void DrawGrid(int slices, float spacing);
|
static void DrawGrid(int slices, float spacing);
|
||||||
|
|
@ -114,32 +110,10 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
int screenWidth = 1080;
|
int screenWidth = 1080; // Mirror screen width (set to hmdDesc.Resolution.w/2)
|
||||||
int screenHeight = 600;
|
int screenHeight = 600; // Mirror screen height (set to hmdDesc.Resolution.h/2)
|
||||||
|
|
||||||
#if defined(PLATFORM_OCULUS)
|
// NOTE: Mirror screen size can be set to any desired resolution!
|
||||||
ovrResult result = ovr_Initialize(NULL);
|
|
||||||
if (OVR_FAILURE(result)) TraceLog(LOG_ERROR, "OVR: Could not initialize Oculus device");
|
|
||||||
|
|
||||||
result = ovr_Create(&session, &luid);
|
|
||||||
if (OVR_FAILURE(result))
|
|
||||||
{
|
|
||||||
TraceLog(LOG_WARNING, "OVR: Could not create Oculus session");
|
|
||||||
ovr_Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
hmdDesc = ovr_GetHmdDesc(session);
|
|
||||||
|
|
||||||
TraceLog(LOG_INFO, "OVR: Product Name: %s", hmdDesc.ProductName);
|
|
||||||
TraceLog(LOG_INFO, "OVR: Manufacturer: %s", hmdDesc.Manufacturer);
|
|
||||||
TraceLog(LOG_INFO, "OVR: Product ID: %i", hmdDesc.ProductId);
|
|
||||||
TraceLog(LOG_INFO, "OVR: Product Type: %i", hmdDesc.Type);
|
|
||||||
TraceLog(LOG_INFO, "OVR: Serian Number: %s", hmdDesc.SerialNumber);
|
|
||||||
TraceLog(LOG_INFO, "OVR: Resolution: %ix%i", hmdDesc.Resolution.w, hmdDesc.Resolution.h);
|
|
||||||
|
|
||||||
screenWidth = hmdDesc.Resolution.w/2;
|
|
||||||
screenHeight = hmdDesc.Resolution.h/2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// GLFW3 Initialization + OpenGL 3.3 Context + Extensions
|
// GLFW3 Initialization + OpenGL 3.3 Context + Extensions
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
@ -147,10 +121,10 @@ int main(void)
|
||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
{
|
{
|
||||||
TraceLog(LOG_WARNING, "GLFW3: Can not initialize GLFW");
|
TraceLog(WARNING, "GLFW3: Can not initialize GLFW");
|
||||||
exit(EXIT_FAILURE);
|
return 1;
|
||||||
}
|
}
|
||||||
else TraceLog(LOG_INFO, "GLFW3: GLFW initialized successfully");
|
else TraceLog(INFO, "GLFW3: GLFW initialized successfully");
|
||||||
|
|
||||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
|
|
@ -163,9 +137,9 @@ int main(void)
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
exit(EXIT_FAILURE);
|
return 2;
|
||||||
}
|
}
|
||||||
else TraceLog(LOG_INFO, "GLFW3: Window created successfully");
|
else TraceLog(INFO, "GLFW3: Window created successfully");
|
||||||
|
|
||||||
glfwSetKeyCallback(window, KeyCallback);
|
glfwSetKeyCallback(window, KeyCallback);
|
||||||
|
|
||||||
|
|
@ -173,39 +147,55 @@ int main(void)
|
||||||
glfwSwapInterval(0);
|
glfwSwapInterval(0);
|
||||||
|
|
||||||
// Load OpenGL 3.3 extensions
|
// Load OpenGL 3.3 extensions
|
||||||
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
|
rlglLoadExtensions(glfwGetProcAddress);
|
||||||
{
|
|
||||||
TraceLog(LOG_WARNING, "GLAD: Cannot load OpenGL extensions");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
else TraceLog(LOG_INFO, "GLAD: OpenGL extensions loaded successfully");
|
|
||||||
//--------------------------------------------------------
|
|
||||||
|
|
||||||
#if defined(PLATFORM_OCULUS)
|
|
||||||
// Initialize Oculus Buffers
|
|
||||||
OculusLayer layer = InitOculusLayer(session);
|
|
||||||
OculusBuffer buffer = LoadOculusBuffer(session, layer.width, layer.height);
|
|
||||||
OculusMirror mirror = LoadOculusMirror(session, hmdDesc.Resolution.w/2, hmdDesc.Resolution.h/2);
|
|
||||||
layer.eyeLayer.ColorTexture[0] = buffer.textureChain; //SetOculusLayerTexture(eyeLayer, buffer.textureChain);
|
|
||||||
|
|
||||||
// Recenter OVR tracking origin
|
|
||||||
ovr_RecenterTrackingOrigin(session);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Initialize rlgl internal buffers and OpenGL state
|
// Initialize rlgl internal buffers and OpenGL state
|
||||||
rlglInit();
|
rlglInit();
|
||||||
rlglInitGraphics(0, 0, screenWidth, screenHeight);
|
rlglInitGraphics(0, 0, screenWidth, screenHeight);
|
||||||
rlClearColor(245, 245, 245, 255); // Define clear color
|
rlClearColor(245, 245, 245, 255); // Define clear color
|
||||||
rlEnableDepthTest(); // Enable DEPTH_TEST for 3D
|
rlEnableDepthTest(); // Enable DEPTH_TEST for 3D
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
Vector2 size = { 200, 200 };
|
#if defined(PLATFORM_OCULUS)
|
||||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
ovrResult result = ovr_Initialize(NULL);
|
||||||
|
if (OVR_FAILURE(result)) TraceLog(ERROR, "OVR: Could not initialize Oculus device");
|
||||||
|
|
||||||
|
result = ovr_Create(&session, &luid);
|
||||||
|
if (OVR_FAILURE(result))
|
||||||
|
{
|
||||||
|
TraceLog(WARNING, "OVR: Could not create Oculus session");
|
||||||
|
ovr_Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
hmdDesc = ovr_GetHmdDesc(session);
|
||||||
|
|
||||||
|
TraceLog(INFO, "OVR: Product Name: %s", hmdDesc.ProductName);
|
||||||
|
TraceLog(INFO, "OVR: Manufacturer: %s", hmdDesc.Manufacturer);
|
||||||
|
TraceLog(INFO, "OVR: Product ID: %i", hmdDesc.ProductId);
|
||||||
|
TraceLog(INFO, "OVR: Product Type: %i", hmdDesc.Type);
|
||||||
|
TraceLog(INFO, "OVR: Serian Number: %s", hmdDesc.SerialNumber);
|
||||||
|
TraceLog(INFO, "OVR: Resolution: %ix%i", hmdDesc.Resolution.w, hmdDesc.Resolution.h);
|
||||||
|
|
||||||
|
//screenWidth = hmdDesc.Resolution.w/2;
|
||||||
|
//screenHeight = hmdDesc.Resolution.h/2;
|
||||||
|
|
||||||
|
// Initialize Oculus Buffers
|
||||||
|
OculusLayer layer = InitOculusLayer(session);
|
||||||
|
OculusBuffer buffer = LoadOculusBuffer(session, layer.width, layer.height);
|
||||||
|
OculusMirror mirror = LoadOculusMirror(session, screenWidth, screenHeight);
|
||||||
|
layer.eyeLayer.ColorTexture[0] = buffer.textureChain; //SetOculusLayerTexture(eyeLayer, buffer.textureChain);
|
||||||
|
|
||||||
|
// Recenter OVR tracking origin
|
||||||
|
ovr_RecenterTrackingOrigin(session);
|
||||||
|
#endif
|
||||||
|
|
||||||
Camera camera;
|
Camera camera;
|
||||||
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
|
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
|
||||||
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
|
||||||
|
|
||||||
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Main game loop
|
// Main game loop
|
||||||
|
|
@ -257,8 +247,8 @@ int main(void)
|
||||||
Matrix matProj = MatrixPerspective(camera.fovy, (double)screenWidth/(double)screenHeight, 0.01, 1000.0);
|
Matrix matProj = MatrixPerspective(camera.fovy, (double)screenWidth/(double)screenHeight, 0.01, 1000.0);
|
||||||
MatrixTranspose(&matProj);
|
MatrixTranspose(&matProj);
|
||||||
|
|
||||||
SetMatrixModelview(matView); // Replace internal modelview matrix by a custom one
|
SetMatrixModelview(matView); // Replace internal modelview matrix by a custom one
|
||||||
SetMatrixProjection(matProj); // Replace internal projection matrix by a custom one
|
SetMatrixProjection(matProj); // Replace internal projection matrix by a custom one
|
||||||
#endif
|
#endif
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RAYWHITE);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, RAYWHITE);
|
||||||
|
|
@ -297,7 +287,7 @@ int main(void)
|
||||||
// Get session status information
|
// Get session status information
|
||||||
ovrSessionStatus sessionStatus;
|
ovrSessionStatus sessionStatus;
|
||||||
ovr_GetSessionStatus(session, &sessionStatus);
|
ovr_GetSessionStatus(session, &sessionStatus);
|
||||||
if (sessionStatus.ShouldQuit) TraceLog(LOG_WARNING, "OVR: Session should quit...");
|
if (sessionStatus.ShouldQuit) TraceLog(WARNING, "OVR: Session should quit...");
|
||||||
if (sessionStatus.ShouldRecenter) ovr_RecenterTrackingOrigin(session);
|
if (sessionStatus.ShouldRecenter) ovr_RecenterTrackingOrigin(session);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -311,17 +301,15 @@ int main(void)
|
||||||
#if defined(PLATFORM_OCULUS)
|
#if defined(PLATFORM_OCULUS)
|
||||||
UnloadOculusMirror(session, mirror); // Unload Oculus mirror buffer
|
UnloadOculusMirror(session, mirror); // Unload Oculus mirror buffer
|
||||||
UnloadOculusBuffer(session, buffer); // Unload Oculus texture buffers
|
UnloadOculusBuffer(session, buffer); // Unload Oculus texture buffers
|
||||||
|
|
||||||
|
ovr_Destroy(session); // Must be called after glfwTerminate() --> no
|
||||||
|
ovr_Shutdown();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rlglClose(); // Unload rlgl internal buffers and default shader/texture
|
rlglClose(); // Unload rlgl internal buffers and default shader/texture
|
||||||
|
|
||||||
glfwDestroyWindow(window);
|
glfwDestroyWindow(window);
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
|
||||||
#if defined(PLATFORM_OCULUS)
|
|
||||||
ovr_Destroy(session); // Must be called after glfwTerminate()
|
|
||||||
ovr_Shutdown();
|
|
||||||
#endif
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -334,7 +322,7 @@ int main(void)
|
||||||
// GLFW3: Error callback
|
// GLFW3: Error callback
|
||||||
static void ErrorCallback(int error, const char* description)
|
static void ErrorCallback(int error, const char* description)
|
||||||
{
|
{
|
||||||
TraceLog(LOG_ERROR, description);
|
TraceLog(ERROR, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3: Keyboard callback
|
// GLFW3: Keyboard callback
|
||||||
|
|
@ -346,29 +334,6 @@ static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output a trace log message
|
|
||||||
static void TraceLog(int msgType, const char *text, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start(args, text);
|
|
||||||
|
|
||||||
switch(msgType)
|
|
||||||
{
|
|
||||||
case LOG_INFO: fprintf(stdout, "INFO: "); break;
|
|
||||||
case LOG_ERROR: fprintf(stdout, "ERROR: "); break;
|
|
||||||
case LOG_WARNING: fprintf(stdout, "WARNING: "); break;
|
|
||||||
case LOG_DEBUG: fprintf(stdout, "DEBUG: "); break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
vfprintf(stdout, text, args);
|
|
||||||
fprintf(stdout, "\n");
|
|
||||||
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
//if (msgType == LOG_ERROR) exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw rectangle using rlgl OpenGL 1.1 style coding (translated to OpenGL 3.3 internally)
|
// Draw rectangle using rlgl OpenGL 1.1 style coding (translated to OpenGL 3.3 internally)
|
||||||
static void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
static void DrawRectangleV(Vector2 position, Vector2 size, Color color)
|
||||||
{
|
{
|
||||||
|
|
@ -610,12 +575,12 @@ static OculusBuffer LoadOculusBuffer(ovrSession session, int width, int height)
|
||||||
|
|
||||||
ovrResult result = ovr_CreateTextureSwapChainGL(session, &desc, &buffer.textureChain);
|
ovrResult result = ovr_CreateTextureSwapChainGL(session, &desc, &buffer.textureChain);
|
||||||
|
|
||||||
if (!OVR_SUCCESS(result)) TraceLog(LOG_WARNING, "OVR: Failed to create swap textures buffer");
|
if (!OVR_SUCCESS(result)) TraceLog(WARNING, "OVR: Failed to create swap textures buffer");
|
||||||
|
|
||||||
int textureCount = 0;
|
int textureCount = 0;
|
||||||
ovr_GetTextureSwapChainLength(session, buffer.textureChain, &textureCount);
|
ovr_GetTextureSwapChainLength(session, buffer.textureChain, &textureCount);
|
||||||
|
|
||||||
if (!OVR_SUCCESS(result) || !textureCount) TraceLog(LOG_WARNING, "OVR: Unable to count swap chain textures");
|
if (!OVR_SUCCESS(result) || !textureCount) TraceLog(WARNING, "OVR: Unable to count swap chain textures");
|
||||||
|
|
||||||
for (int i = 0; i < textureCount; ++i)
|
for (int i = 0; i < textureCount; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -682,10 +647,13 @@ static void SetOculusBuffer(ovrSession session, OculusBuffer buffer)
|
||||||
//glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, buffer.depthId, 0); // Already binded
|
//glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, buffer.depthId, 0); // Already binded
|
||||||
|
|
||||||
//glViewport(0, 0, buffer.width, buffer.height); // Useful if rendering to separate framebuffers (every eye)
|
//glViewport(0, 0, buffer.width, buffer.height); // Useful if rendering to separate framebuffers (every eye)
|
||||||
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Same as rlClearScreenBuffers()
|
||||||
|
|
||||||
// Required if OculusBuffer format is OVR_FORMAT_R8G8B8A8_UNORM_SRGB
|
// NOTE: If your application is configured to treat the texture as a linear format (e.g. GL_RGBA)
|
||||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
// and performs linear-to-gamma conversion in GLSL or does not care about gamma-correction, then:
|
||||||
|
// - Require OculusBuffer format to be OVR_FORMAT_R8G8B8A8_UNORM_SRGB
|
||||||
|
// - Do NOT enable GL_FRAMEBUFFER_SRGB
|
||||||
|
//glEnable(GL_FRAMEBUFFER_SRGB);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unset Oculus buffer
|
// Unset Oculus buffer
|
||||||
|
|
@ -708,7 +676,7 @@ static OculusMirror LoadOculusMirror(ovrSession session, int width, int height)
|
||||||
mirrorDesc.Width = mirror.width;
|
mirrorDesc.Width = mirror.width;
|
||||||
mirrorDesc.Height = mirror.height;
|
mirrorDesc.Height = mirror.height;
|
||||||
|
|
||||||
if (!OVR_SUCCESS(ovr_CreateMirrorTextureGL(session, &mirrorDesc, &mirror.texture))) TraceLog(LOG_WARNING, "Could not create mirror texture");
|
if (!OVR_SUCCESS(ovr_CreateMirrorTextureGL(session, &mirrorDesc, &mirror.texture))) TraceLog(WARNING, "Could not create mirror texture");
|
||||||
|
|
||||||
glGenFramebuffers(1, &mirror.fboId);
|
glGenFramebuffers(1, &mirror.fboId);
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 167 KiB |
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue