summaryrefslogtreecommitdiffhomepage
path: root/examples/core/core_vr_simulator.c
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-20 16:36:42 +0200
committerRay <[email protected]>2019-05-20 16:36:42 +0200
commitb525039e0ab8bcaa2fd6bde34c72a6405f88ae49 (patch)
tree08f1c79bfe693643564ed78202c9474b7eb83a79 /examples/core/core_vr_simulator.c
parenta43a7980a30a52462956b23f2473e8ef8f38d1fb (diff)
downloadraylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz
raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip
Review ALL examples
Diffstat (limited to 'examples/core/core_vr_simulator.c')
-rw-r--r--examples/core/core_vr_simulator.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c
index b79ed90e..134a36f0 100644
--- a/examples/core/core_vr_simulator.c
+++ b/examples/core/core_vr_simulator.c
@@ -17,22 +17,22 @@
#define GLSL_VERSION 100
#endif
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 1080;
- int screenHeight = 600;
-
+ const int screenWidth = 1080;
+ const int screenHeight = 600;
+
// NOTE: screenWidth/screenHeight should match VR device aspect ratio
-
+
InitWindow(screenWidth, screenHeight, "raylib [core] example - vr simulator");
// Init VR simulator (Oculus Rift CV1 parameters)
InitVrSimulator();
VrDeviceInfo hmd = { 0 }; // VR device parameters (head-mounted-device)
-
+
// Oculus Rift CV1 parameters for simulator
hmd.hResolution = 2160; // HMD horizontal resolution in pixels
hmd.vResolution = 1200; // HMD vertical resolution in pixels
@@ -42,7 +42,7 @@ int main()
hmd.eyeToScreenDistance = 0.041f; // HMD distance between eye and display in meters
hmd.lensSeparationDistance = 0.07f; // HMD lens separation distance in meters
hmd.interpupillaryDistance = 0.07f; // HMD IPD (distance between pupils) in meters
-
+
// NOTE: CV1 uses a Fresnel-hybrid-asymmetric lenses with specific distortion compute shaders.
// Following parameters are an approximation to distortion stereo rendering but results differ from actual device.
hmd.lensDistortionValues[0] = 1.0f; // HMD lens distortion constant parameter 0
@@ -53,12 +53,12 @@ int main()
hmd.chromaAbCorrection[1] = -0.004f; // HMD chromatic aberration correction parameter 1
hmd.chromaAbCorrection[2] = 1.014f; // HMD chromatic aberration correction parameter 2
hmd.chromaAbCorrection[3] = 0.0f; // HMD chromatic aberration correction parameter 3
-
+
// Distortion shader (uses device lens distortion and chroma)
Shader distortion = LoadShader(0, FormatText("resources/distortion%i.fs", GLSL_VERSION));
-
+
SetVrConfiguration(hmd, distortion); // Set Vr device parameters for stereo rendering
-
+
// Define the camera to look into our 3d world
Camera camera;
camera.position = (Vector3){ 5.0f, 2.0f, 5.0f }; // Camera position
@@ -66,11 +66,11 @@ int main()
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 60.0f; // Camera field-of-view Y
camera.type = CAMERA_PERSPECTIVE; // Camera type
-
+
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
-
+
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set first person camera mode
-
+
SetTargetFPS(90); // Set our game to run at 90 frames-per-second
//--------------------------------------------------------------------------------------
@@ -89,7 +89,7 @@ int main()
BeginDrawing();
ClearBackground(RAYWHITE);
-
+
BeginVrDrawing();
BeginMode3D(camera);
@@ -100,7 +100,7 @@ int main()
DrawGrid(40, 1.0f);
EndMode3D();
-
+
EndVrDrawing();
DrawFPS(10, 10);