6
.gitignore
vendored
|
|
@ -1,6 +1,9 @@
|
||||||
# Ignore generated files
|
# Ignore generated files
|
||||||
# ...
|
# ...
|
||||||
|
|
||||||
|
# Ignore VIM's backup generated files
|
||||||
|
*.swp
|
||||||
|
|
||||||
# Ignore Android generated files and folders
|
# Ignore Android generated files and folders
|
||||||
src_android/obj/
|
src_android/obj/
|
||||||
templates/android_project/bin/
|
templates/android_project/bin/
|
||||||
|
|
@ -68,9 +71,8 @@ src/libraylib.bc
|
||||||
# oculus example
|
# oculus example
|
||||||
!examples/oculus_glfw_sample/
|
!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/OculusSDK/LibOVR/LibOVRRT32_1.dll
|
||||||
!src/external/pthread/pthreadGC2.dll
|
!src/external/pthread/pthreadGC2.dll
|
||||||
|
|
|
||||||
26
README.md
|
|
@ -131,25 +131,27 @@ Lots of code changes and lots of hours of hard work have concluded in this amazi
|
||||||
notes on raylib 1.5
|
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.
|
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: **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).
|
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 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.
|
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 used and configured and gamepad data is read and processed in raw mode in a second thread.
|
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 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.
|
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 @kd7tck amazing work.
|
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.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
Lots of code changes (more than 300 commits) and lots of hours of hard work have concluded in this amazing new raylib 1.5.
|
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.
|
||||||
|
|
||||||
features
|
features
|
||||||
--------
|
--------
|
||||||
|
|
@ -162,11 +164,13 @@ features
|
||||||
* 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
|
* Materials (diffuse, normal, specular) and Lighting (point, directional, spot) support
|
||||||
|
* 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)
|
* 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, XM, MOD)
|
* Audio loading and playing with streaming support and mixing channels (WAV, OGG, XM, MOD)
|
||||||
* Custom color palette for fancy visuals on raywhite background
|
|
||||||
* VR stereo rendering support with configurable HMD device parameters
|
* VR stereo rendering support with configurable HMD device parameters
|
||||||
* Multiple platforms support: Windows, Linux, Mac, **Android**, **Raspberry Pi**, **HTML5** and **Oculus Rift CV1**
|
* 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)
|
||||||
|
|
||||||
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, ...).
|
||||||
|
|
@ -178,6 +182,8 @@ On Android, raylib uses `native_app_glue module` (provided by Android NDK) and n
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
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).
|
raylib is licensed under a zlib/libpng license. View [LICENSE](https://github.com/raysan5/raylib/blob/master/LICENSE.md).
|
||||||
|
|
||||||
tools requirements
|
tools requirements
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,7 @@ EXAMPLES = \
|
||||||
shaders_standard_lighting \
|
shaders_standard_lighting \
|
||||||
audio_sound_loading \
|
audio_sound_loading \
|
||||||
audio_music_stream \
|
audio_music_stream \
|
||||||
|
audio_module_playing \
|
||||||
fix_dylib \
|
fix_dylib \
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -435,6 +436,10 @@ audio_sound_loading: audio_sound_loading.c
|
||||||
audio_music_stream: audio_music_stream.c
|
audio_music_stream: audio_music_stream.c
|
||||||
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
|
# compile [audio] example - module playing (OGG)
|
||||||
|
audio_module_playing: audio_module_playing.c
|
||||||
|
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
|
||||||
|
|
||||||
# fix dylib install path name for each executable (MAC)
|
# fix dylib install path name for each executable (MAC)
|
||||||
fix_dylib:
|
fix_dylib:
|
||||||
ifeq ($(PLATFORM_OS),OSX)
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
|
|
||||||
138
examples/audio_module_playing.c
Normal file
|
|
@ -0,0 +1,138 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - Module playing (streaming)
|
||||||
|
*
|
||||||
|
* NOTE: This example requires OpenAL Soft library installed
|
||||||
|
*
|
||||||
|
* 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)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#define MAX_CIRCLES 64
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Vector2 position;
|
||||||
|
float radius;
|
||||||
|
float alpha;
|
||||||
|
float speed;
|
||||||
|
Color color;
|
||||||
|
} CircleWave;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
int screenWidth = 800;
|
||||||
|
int screenHeight = 450;
|
||||||
|
|
||||||
|
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)");
|
||||||
|
|
||||||
|
InitAudioDevice(); // Initialize audio device
|
||||||
|
|
||||||
|
Color colors[14] = { ORANGE, RED, GOLD, LIME, BLUE, VIOLET, BROWN, LIGHTGRAY, PINK,
|
||||||
|
YELLOW, GREEN, SKYBLUE, PURPLE, BEIGE };
|
||||||
|
|
||||||
|
// Creates ome circles for visual effect
|
||||||
|
CircleWave circles[MAX_CIRCLES];
|
||||||
|
|
||||||
|
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
circles[i].alpha = 0.0f;
|
||||||
|
circles[i].radius = GetRandomValue(10, 40);
|
||||||
|
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius);
|
||||||
|
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius);
|
||||||
|
circles[i].speed = (float)GetRandomValue(1, 100)/20000.0f;
|
||||||
|
circles[i].color = colors[GetRandomValue(0, 13)];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load postprocessing bloom shader
|
||||||
|
Shader shader = LoadShader("resources/shaders/glsl330/base.vs",
|
||||||
|
"resources/shaders/glsl330/bloom.fs");
|
||||||
|
|
||||||
|
// Create a RenderTexture2D to be used for render to texture
|
||||||
|
RenderTexture2D target = LoadRenderTexture(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
PlayMusicStream(0, "resources/audio/2t2m_spa.xm"); // Play module stream
|
||||||
|
|
||||||
|
float timePlayed = 0.0f;
|
||||||
|
|
||||||
|
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Main game loop
|
||||||
|
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||||
|
{
|
||||||
|
// Update
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
circles[i].alpha += circles[i].speed;
|
||||||
|
circles[i].radius += circles[i].speed*10.0f;
|
||||||
|
|
||||||
|
if (circles[i].alpha > 1.0f) circles[i].speed *= -1;
|
||||||
|
|
||||||
|
if (circles[i].alpha <= 0.0f)
|
||||||
|
{
|
||||||
|
circles[i].alpha = 0.0f;
|
||||||
|
circles[i].radius = GetRandomValue(10, 40);
|
||||||
|
circles[i].position.x = GetRandomValue(circles[i].radius, screenWidth - circles[i].radius);
|
||||||
|
circles[i].position.y = GetRandomValue(circles[i].radius, screenHeight - circles[i].radius);
|
||||||
|
circles[i].color = colors[GetRandomValue(0, 13)];
|
||||||
|
circles[i].speed = (float)GetRandomValue(1, 100)/20000.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get timePlayed scaled to bar dimensions
|
||||||
|
timePlayed = (GetMusicTimePlayed(0)/GetMusicTimeLength(0)*(screenWidth - 40))*2;
|
||||||
|
|
||||||
|
UpdateMusicStream(0); // Update music buffer with new stream data
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Draw
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
|
BeginTextureMode(target); // Enable drawing to texture
|
||||||
|
|
||||||
|
for (int i = MAX_CIRCLES - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
DrawCircleV(circles[i].position, circles[i].radius, Fade(circles[i].color, circles[i].alpha));
|
||||||
|
}
|
||||||
|
|
||||||
|
EndTextureMode(); // End drawing to texture (now we have a texture available for next passes)
|
||||||
|
|
||||||
|
BeginShaderMode(shader);
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
|
||||||
|
// Draw time bar
|
||||||
|
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, LIGHTGRAY);
|
||||||
|
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, MAROON);
|
||||||
|
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, WHITE);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadShader(shader); // Unload shader
|
||||||
|
UnloadRenderTexture(target); // Unload render texture
|
||||||
|
|
||||||
|
CloseAudioDevice(); // Close audio device (music streaming is automatically stopped)
|
||||||
|
|
||||||
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/audio_module_playing.png
Normal file
|
After Width: | Height: | Size: 210 KiB |
74
examples/audio_standalone.c
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*******************************************************************************************
|
||||||
|
*
|
||||||
|
* raylib [audio] example - Using audio module as standalone module
|
||||||
|
*
|
||||||
|
* NOTE: This example does not require any graphic device, it can run directly on console.
|
||||||
|
*
|
||||||
|
* [audio] module requires some external libs:
|
||||||
|
* OpenAL Soft - Audio device management lib (http://kcat.strangesoft.net/openal.html)
|
||||||
|
* stb_vorbis - Ogg audio files loading (http://www.nothings.org/stb_vorbis/)
|
||||||
|
* jar_xm - XM module file loading
|
||||||
|
* jar_mod - MOD audio file loading
|
||||||
|
*
|
||||||
|
* Compile audio module using:
|
||||||
|
* gcc -c audio.c stb_vorbis.c -Wall -std=c99 -DAUDIO_STANDALONE
|
||||||
|
*
|
||||||
|
* Compile example using:
|
||||||
|
* gcc -o $(NAME_PART).exe $(FILE_NAME) audio.o stb_vorbis.o -lopenal32 -std=c99
|
||||||
|
*
|
||||||
|
* 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)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
|
||||||
|
*
|
||||||
|
********************************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <conio.h> // Windows only, no stardard library
|
||||||
|
|
||||||
|
#include "audio.h"
|
||||||
|
|
||||||
|
#define KEY_ESCAPE 27
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
unsigned char key;
|
||||||
|
|
||||||
|
InitAudioDevice();
|
||||||
|
|
||||||
|
Sound fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
|
||||||
|
Sound fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
|
||||||
|
|
||||||
|
PlayMusicStream(0, "resources/audio/guitar_noodling.ogg");
|
||||||
|
|
||||||
|
printf("\nPress s or d to play sounds...\n");
|
||||||
|
|
||||||
|
while (key != KEY_ESCAPE)
|
||||||
|
{
|
||||||
|
if (kbhit()) key = getch();
|
||||||
|
|
||||||
|
if (key == 's')
|
||||||
|
{
|
||||||
|
PlaySound(fxWav);
|
||||||
|
key = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (key == 'd')
|
||||||
|
{
|
||||||
|
PlaySound(fxOgg);
|
||||||
|
key = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateMusicStream(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
UnloadSound(fxWav); // Unload sound data
|
||||||
|
UnloadSound(fxOgg); // Unload sound data
|
||||||
|
|
||||||
|
CloseAudioDevice();
|
||||||
|
|
||||||
|
printf("\n\nPress ENTER to close...");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
examples/core_2d_camera.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
|
@ -68,8 +68,18 @@ int main()
|
||||||
|
|
||||||
Begin3dMode(camera);
|
Begin3dMode(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY);
|
if (collision)
|
||||||
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY);
|
{
|
||||||
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, RED);
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, MAROON);
|
||||||
|
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x + 0.2f, cubeSize.y + 0.2f, cubeSize.z + 0.2f, GREEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawCube(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, GRAY);
|
||||||
|
DrawCubeWires(cubePosition, cubeSize.x, cubeSize.y, cubeSize.z, DARKGRAY);
|
||||||
|
}
|
||||||
|
|
||||||
DrawRay(ray, MAROON);
|
DrawRay(ray, MAROON);
|
||||||
|
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 173 KiB |
BIN
examples/core_world_screen.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
|
|
@ -1,196 +0,0 @@
|
||||||
/********************************************************************************//**
|
|
||||||
\file OVR_CAPI_Util.h
|
|
||||||
\brief This header provides LibOVR utility function declarations
|
|
||||||
\copyright Copyright 2015-2016 Oculus VR, LLC All Rights reserved.
|
|
||||||
*************************************************************************************/
|
|
||||||
|
|
||||||
#ifndef OVR_CAPI_Util_h
|
|
||||||
#define OVR_CAPI_Util_h
|
|
||||||
|
|
||||||
|
|
||||||
#include "../OVR_CAPI.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/// Enumerates modifications to the projection matrix based on the application's needs.
|
|
||||||
///
|
|
||||||
/// \see ovrMatrix4f_Projection
|
|
||||||
///
|
|
||||||
typedef enum ovrProjectionModifier_
|
|
||||||
{
|
|
||||||
/// Use for generating a default projection matrix that is:
|
|
||||||
/// * Right-handed.
|
|
||||||
/// * Near depth values stored in the depth buffer are smaller than far depth values.
|
|
||||||
/// * Both near and far are explicitly defined.
|
|
||||||
/// * With a clipping range that is (0 to w).
|
|
||||||
ovrProjection_None = 0x00,
|
|
||||||
|
|
||||||
/// Enable if using left-handed transformations in your application.
|
|
||||||
ovrProjection_LeftHanded = 0x01,
|
|
||||||
|
|
||||||
/// After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values.
|
|
||||||
/// NOTE: Enable only if the application is using a floating-point depth buffer for proper precision.
|
|
||||||
ovrProjection_FarLessThanNear = 0x02,
|
|
||||||
|
|
||||||
/// When this flag is used, the zfar value pushed into ovrMatrix4f_Projection() will be ignored
|
|
||||||
/// NOTE: Enable only if ovrProjection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity.
|
|
||||||
ovrProjection_FarClipAtInfinity = 0x04,
|
|
||||||
|
|
||||||
/// Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w).
|
|
||||||
/// Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL.
|
|
||||||
ovrProjection_ClipRangeOpenGL = 0x08,
|
|
||||||
} ovrProjectionModifier;
|
|
||||||
|
|
||||||
|
|
||||||
/// Return values for ovr_Detect.
|
|
||||||
///
|
|
||||||
/// \see ovr_Detect
|
|
||||||
///
|
|
||||||
typedef struct OVR_ALIGNAS(8) ovrDetectResult_
|
|
||||||
{
|
|
||||||
/// Is ovrFalse when the Oculus Service is not running.
|
|
||||||
/// This means that the Oculus Service is either uninstalled or stopped.
|
|
||||||
/// IsOculusHMDConnected will be ovrFalse in this case.
|
|
||||||
/// Is ovrTrue when the Oculus Service is running.
|
|
||||||
/// This means that the Oculus Service is installed and running.
|
|
||||||
/// IsOculusHMDConnected will reflect the state of the HMD.
|
|
||||||
ovrBool IsOculusServiceRunning;
|
|
||||||
|
|
||||||
/// Is ovrFalse when an Oculus HMD is not detected.
|
|
||||||
/// If the Oculus Service is not running, this will be ovrFalse.
|
|
||||||
/// Is ovrTrue when an Oculus HMD is detected.
|
|
||||||
/// This implies that the Oculus Service is also installed and running.
|
|
||||||
ovrBool IsOculusHMDConnected;
|
|
||||||
|
|
||||||
OVR_UNUSED_STRUCT_PAD(pad0, 6) ///< \internal struct padding
|
|
||||||
|
|
||||||
} ovrDetectResult;
|
|
||||||
|
|
||||||
OVR_STATIC_ASSERT(sizeof(ovrDetectResult) == 8, "ovrDetectResult size mismatch");
|
|
||||||
|
|
||||||
|
|
||||||
/// Detects Oculus Runtime and Device Status
|
|
||||||
///
|
|
||||||
/// Checks for Oculus Runtime and Oculus HMD device status without loading the LibOVRRT
|
|
||||||
/// shared library. This may be called before ovr_Initialize() to help decide whether or
|
|
||||||
/// not to initialize LibOVR.
|
|
||||||
///
|
|
||||||
/// \param[in] timeoutMilliseconds Specifies a timeout to wait for HMD to be attached or 0 to poll.
|
|
||||||
///
|
|
||||||
/// \return Returns an ovrDetectResult object indicating the result of detection.
|
|
||||||
///
|
|
||||||
/// \see ovrDetectResult
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrDetectResult) ovr_Detect(int timeoutMilliseconds);
|
|
||||||
|
|
||||||
// On the Windows platform,
|
|
||||||
#ifdef _WIN32
|
|
||||||
/// This is the Windows Named Event name that is used to check for HMD connected state.
|
|
||||||
#define OVR_HMD_CONNECTED_EVENT_NAME L"OculusHMDConnected"
|
|
||||||
#endif // _WIN32
|
|
||||||
|
|
||||||
|
|
||||||
/// Used to generate projection from ovrEyeDesc::Fov.
|
|
||||||
///
|
|
||||||
/// \param[in] fov Specifies the ovrFovPort to use.
|
|
||||||
/// \param[in] znear Distance to near Z limit.
|
|
||||||
/// \param[in] zfar Distance to far Z limit.
|
|
||||||
/// \param[in] projectionModFlags A combination of the ovrProjectionModifier flags.
|
|
||||||
///
|
|
||||||
/// \return Returns the calculated projection matrix.
|
|
||||||
///
|
|
||||||
/// \see ovrProjectionModifier
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrMatrix4f) ovrMatrix4f_Projection(ovrFovPort fov, float znear, float zfar, unsigned int projectionModFlags);
|
|
||||||
|
|
||||||
|
|
||||||
/// Extracts the required data from the result of ovrMatrix4f_Projection.
|
|
||||||
///
|
|
||||||
/// \param[in] projection Specifies the project matrix from which to extract ovrTimewarpProjectionDesc.
|
|
||||||
/// \param[in] projectionModFlags A combination of the ovrProjectionModifier flags.
|
|
||||||
/// \return Returns the extracted ovrTimewarpProjectionDesc.
|
|
||||||
/// \see ovrTimewarpProjectionDesc
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrTimewarpProjectionDesc) ovrTimewarpProjectionDesc_FromProjection(ovrMatrix4f projection, unsigned int projectionModFlags);
|
|
||||||
|
|
||||||
|
|
||||||
/// Generates an orthographic sub-projection.
|
|
||||||
///
|
|
||||||
/// Used for 2D rendering, Y is down.
|
|
||||||
///
|
|
||||||
/// \param[in] projection The perspective matrix that the orthographic matrix is derived from.
|
|
||||||
/// \param[in] orthoScale Equal to 1.0f / pixelsPerTanAngleAtCenter.
|
|
||||||
/// \param[in] orthoDistance Equal to the distance from the camera in meters, such as 0.8m.
|
|
||||||
/// \param[in] HmdToEyeOffsetX Specifies the offset of the eye from the center.
|
|
||||||
///
|
|
||||||
/// \return Returns the calculated projection matrix.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrMatrix4f) ovrMatrix4f_OrthoSubProjection(ovrMatrix4f projection, ovrVector2f orthoScale,
|
|
||||||
float orthoDistance, float HmdToEyeOffsetX);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Computes offset eye poses based on headPose returned by ovrTrackingState.
|
|
||||||
///
|
|
||||||
/// \param[in] headPose Indicates the HMD position and orientation to use for the calculation.
|
|
||||||
/// \param[in] hmdToEyeOffset Can be ovrEyeRenderDesc.HmdToEyeOffset returned from
|
|
||||||
/// ovr_GetRenderDesc. For monoscopic rendering, use a vector that is the average
|
|
||||||
/// of the two vectors for both eyes.
|
|
||||||
/// \param[out] outEyePoses If outEyePoses are used for rendering, they should be passed to
|
|
||||||
/// ovr_SubmitFrame in ovrLayerEyeFov::RenderPose or ovrLayerEyeFovDepth::RenderPose.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(void) ovr_CalcEyePoses(ovrPosef headPose,
|
|
||||||
const ovrVector3f hmdToEyeOffset[2],
|
|
||||||
ovrPosef outEyePoses[2]);
|
|
||||||
|
|
||||||
|
|
||||||
/// Returns the predicted head pose in outHmdTrackingState and offset eye poses in outEyePoses.
|
|
||||||
///
|
|
||||||
/// This is a thread-safe function where caller should increment frameIndex with every frame
|
|
||||||
/// and pass that index where applicable to functions called on the rendering thread.
|
|
||||||
/// Assuming outEyePoses are used for rendering, it should be passed as a part of ovrLayerEyeFov.
|
|
||||||
/// The caller does not need to worry about applying HmdToEyeOffset to the returned outEyePoses variables.
|
|
||||||
///
|
|
||||||
/// \param[in] hmd Specifies an ovrSession previously returned by ovr_Create.
|
|
||||||
/// \param[in] frameIndex Specifies the targeted frame index, or 0 to refer to one frame after
|
|
||||||
/// the last time ovr_SubmitFrame was called.
|
|
||||||
/// \param[in] latencyMarker Specifies that this call is the point in time where
|
|
||||||
/// the "App-to-Mid-Photon" latency timer starts from. If a given ovrLayer
|
|
||||||
/// provides "SensorSampleTimestamp", that will override the value stored here.
|
|
||||||
/// \param[in] hmdToEyeOffset Can be ovrEyeRenderDesc.HmdToEyeOffset returned from
|
|
||||||
/// ovr_GetRenderDesc. For monoscopic rendering, use a vector that is the average
|
|
||||||
/// of the two vectors for both eyes.
|
|
||||||
/// \param[out] outEyePoses The predicted eye poses.
|
|
||||||
/// \param[out] outSensorSampleTime The time when this function was called. May be NULL, in which case it is ignored.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(void) ovr_GetEyePoses(ovrSession session, long long frameIndex, ovrBool latencyMarker,
|
|
||||||
const ovrVector3f hmdToEyeOffset[2],
|
|
||||||
ovrPosef outEyePoses[2],
|
|
||||||
double* outSensorSampleTime);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Tracking poses provided by the SDK come in a right-handed coordinate system. If an application
|
|
||||||
/// is passing in ovrProjection_LeftHanded into ovrMatrix4f_Projection, then it should also use
|
|
||||||
/// this function to flip the HMD tracking poses to be left-handed.
|
|
||||||
///
|
|
||||||
/// While this utility function is intended to convert a left-handed ovrPosef into a right-handed
|
|
||||||
/// coordinate system, it will also work for converting right-handed to left-handed since the
|
|
||||||
/// flip operation is the same for both cases.
|
|
||||||
///
|
|
||||||
/// \param[in] inPose that is right-handed
|
|
||||||
/// \param[out] outPose that is requested to be left-handed (can be the same pointer to inPose)
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(void) ovrPosef_FlipHandedness(const ovrPosef* inPose, ovrPosef* outPose);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} /* extern "C" */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif // Header include guard
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
/************************************************************************************
|
|
||||||
|
|
||||||
Filename : OVR_StereoProjection.h
|
|
||||||
Content : Stereo projection functions
|
|
||||||
Created : November 30, 2013
|
|
||||||
Authors : Tom Fosyth
|
|
||||||
|
|
||||||
Copyright : Copyright 2014-2016 Oculus VR, LLC All Rights reserved.
|
|
||||||
|
|
||||||
Licensed under the Oculus VR Rift SDK License Version 3.3 (the "License");
|
|
||||||
you may not use the Oculus VR Rift SDK except in compliance with the License,
|
|
||||||
which is provided at the time of installation or download, or which
|
|
||||||
otherwise accompanies this software in either electronic or hard copy form.
|
|
||||||
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.oculusvr.com/licenses/LICENSE-3.3
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, the Oculus VR SDK
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
*************************************************************************************/
|
|
||||||
|
|
||||||
#ifndef OVR_StereoProjection_h
|
|
||||||
#define OVR_StereoProjection_h
|
|
||||||
|
|
||||||
|
|
||||||
#include "Extras/OVR_Math.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace OVR {
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
// ***** Stereo Enumerations
|
|
||||||
|
|
||||||
// StereoEye specifies which eye we are rendering for; it is used to
|
|
||||||
// retrieve StereoEyeParams.
|
|
||||||
enum StereoEye
|
|
||||||
{
|
|
||||||
StereoEye_Left,
|
|
||||||
StereoEye_Right,
|
|
||||||
StereoEye_Center
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
|
||||||
// ***** Propjection functions
|
|
||||||
|
|
||||||
Matrix4f CreateProjection ( bool rightHanded, bool isOpenGL, FovPort fov, StereoEye eye,
|
|
||||||
float zNear = 0.01f, float zFar = 10000.0f,
|
|
||||||
bool flipZ = false, bool farAtInfinity = false);
|
|
||||||
|
|
||||||
Matrix4f CreateOrthoSubProjection ( bool rightHanded, StereoEye eyeType,
|
|
||||||
float tanHalfFovX, float tanHalfFovY,
|
|
||||||
float unitsX, float unitsY, float distanceFromCamera,
|
|
||||||
float interpupillaryDistance, Matrix4f const &projection,
|
|
||||||
float zNear = 0.0f, float zFar = 0.0f,
|
|
||||||
bool flipZ = false, bool farAtInfinity = false);
|
|
||||||
|
|
||||||
ScaleAndOffset2D CreateNDCScaleAndOffsetFromFov ( FovPort fov );
|
|
||||||
|
|
||||||
|
|
||||||
} //namespace OVR
|
|
||||||
|
|
||||||
#endif // OVR_StereoProjection_h
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
/********************************************************************************//**
|
|
||||||
\file OVR_CAPI_Audio.h
|
|
||||||
\brief CAPI audio functions.
|
|
||||||
\copyright Copyright 2015 Oculus VR, LLC. All Rights reserved.
|
|
||||||
************************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef OVR_CAPI_Audio_h
|
|
||||||
#define OVR_CAPI_Audio_h
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#include "OVR_CAPI.h"
|
|
||||||
#define OVR_AUDIO_MAX_DEVICE_STR_SIZE 128
|
|
||||||
|
|
||||||
/// Gets the ID of the preferred VR audio output device.
|
|
||||||
///
|
|
||||||
/// \param[out] deviceOutId The ID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be WAVE_MAPPER.
|
|
||||||
///
|
|
||||||
/// \return Returns an ovrResult indicating success or failure. In the case of failure, use
|
|
||||||
/// ovr_GetLastErrorInfo to get more information.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutWaveId(UINT* deviceOutId);
|
|
||||||
|
|
||||||
/// Gets the ID of the preferred VR audio input device.
|
|
||||||
///
|
|
||||||
/// \param[out] deviceInId The ID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be WAVE_MAPPER.
|
|
||||||
///
|
|
||||||
/// \return Returns an ovrResult indicating success or failure. In the case of failure, use
|
|
||||||
/// ovr_GetLastErrorInfo to get more information.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInWaveId(UINT* deviceInId);
|
|
||||||
|
|
||||||
|
|
||||||
/// Gets the GUID of the preferred VR audio device as a string.
|
|
||||||
///
|
|
||||||
/// \param[out] deviceOutStrBuffer A buffer where the GUID string for the device will copied to.
|
|
||||||
///
|
|
||||||
/// \return Returns an ovrResult indicating success or failure. In the case of failure, use
|
|
||||||
/// ovr_GetLastErrorInfo to get more information.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuidStr(WCHAR deviceOutStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE]);
|
|
||||||
|
|
||||||
|
|
||||||
/// Gets the GUID of the preferred VR audio device.
|
|
||||||
///
|
|
||||||
/// \param[out] deviceOutGuid The GUID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be NULL.
|
|
||||||
///
|
|
||||||
/// \return Returns an ovrResult indicating success or failure. In the case of failure, use
|
|
||||||
/// ovr_GetLastErrorInfo to get more information.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuid(GUID* deviceOutGuid);
|
|
||||||
|
|
||||||
|
|
||||||
/// Gets the GUID of the preferred VR microphone device as a string.
|
|
||||||
///
|
|
||||||
/// \param[out] deviceInStrBuffer A buffer where the GUID string for the device will copied to.
|
|
||||||
///
|
|
||||||
/// \return Returns an ovrResult indicating success or failure. In the case of failure, use
|
|
||||||
/// ovr_GetLastErrorInfo to get more information.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInGuidStr(WCHAR deviceInStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE]);
|
|
||||||
|
|
||||||
|
|
||||||
/// Gets the GUID of the preferred VR microphone device.
|
|
||||||
///
|
|
||||||
/// \param[out] deviceInGuid The GUID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be NULL.
|
|
||||||
///
|
|
||||||
/// \return Returns an ovrResult indicating success or failure. In the case of failure, use
|
|
||||||
/// ovr_GetLastErrorInfo to get more information.
|
|
||||||
///
|
|
||||||
OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInGuid(GUID* deviceInGuid);
|
|
||||||
|
|
||||||
#endif //OVR_OS_MS
|
|
||||||
|
|
||||||
#endif // OVR_CAPI_Audio_h
|
|
||||||