diff options
| author | Ray <[email protected]> | 2021-04-07 12:24:43 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-04-07 12:24:43 +0200 |
| commit | ed96bc64412e01392026230d817d6fb316cd4035 (patch) | |
| tree | 52bbdf8c25aee2a18a3bfc8666f1f8dab3894f3c /examples/core/core_vr_simulator.c | |
| parent | 6719c3a1cd7c4cfd4f52d43857131e3c7f97cb4b (diff) | |
| download | raylib-ed96bc64412e01392026230d817d6fb316cd4035.tar.gz raylib-ed96bc64412e01392026230d817d6fb316cd4035.zip | |
Update core_vr_simulator.c
Diffstat (limited to 'examples/core/core_vr_simulator.c')
| -rw-r--r-- | examples/core/core_vr_simulator.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c index 091b2fc9..2f69f7c1 100644 --- a/examples/core/core_vr_simulator.c +++ b/examples/core/core_vr_simulator.c @@ -2,7 +2,7 @@ * * raylib [core] example - VR Simulator (Oculus Rift CV1 parameters) * -* This example has been created using raylib 3.6-dev (www.raylib.com) +* This example has been created using raylib 3.7 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * * Copyright (c) 2017-2021 Ramon Santamaria (@raysan5) @@ -40,7 +40,8 @@ int main(void) .interpupillaryDistance = 0.07f, // 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 + // Following parameters are an approximation to distortion stereo rendering + // but results differ from actual device .lensDistortionValues[0] = 1.0f, // Lens distortion constant parameter 0 .lensDistortionValues[1] = 0.22f, // Lens distortion constant parameter 1 .lensDistortionValues[2] = 0.24f, // Lens distortion constant parameter 2 @@ -58,15 +59,23 @@ int main(void) Shader distortion = LoadShader(0, TextFormat("resources/distortion%i.fs", GLSL_VERSION)); // Update distortion shader with lens and distortion-scale parameters - SetShaderValue(distortion, GetShaderLocation(distortion, "leftLensCenter"), config.leftLensCenter, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "rightLensCenter"), config.rightLensCenter, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "leftScreenCenter"), config.leftScreenCenter, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "rightScreenCenter"), config.rightScreenCenter, SHADER_UNIFORM_VEC2); - - SetShaderValue(distortion, GetShaderLocation(distortion, "scale"), config.scale, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "scaleIn"), config.scaleIn, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "deviceWarpParam"), device.lensDistortionValues, SHADER_UNIFORM_VEC4); - SetShaderValue(distortion, GetShaderLocation(distortion, "chromaAbParam"), device.chromaAbCorrection, SHADER_UNIFORM_VEC4); + SetShaderValue(distortion, GetShaderLocation(distortion, "leftLensCenter"), + config.leftLensCenter, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "rightLensCenter"), + config.rightLensCenter, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "leftScreenCenter"), + config.leftScreenCenter, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "rightScreenCenter"), + config.rightScreenCenter, SHADER_UNIFORM_VEC2); + + SetShaderValue(distortion, GetShaderLocation(distortion, "scale"), + config.scale, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "scaleIn"), + config.scaleIn, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "deviceWarpParam"), + device.lensDistortionValues, SHADER_UNIFORM_VEC4); + SetShaderValue(distortion, GetShaderLocation(distortion, "chromaAbParam"), + device.chromaAbCorrection, SHADER_UNIFORM_VEC4); // Initialize framebuffer for stereo rendering // NOTE: Screen size should match HMD aspect ratio @@ -108,7 +117,6 @@ int main(void) DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED); DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON); - DrawGrid(40, 1.0f); EndMode3D(); @@ -116,7 +124,8 @@ int main(void) EndTextureMode(); BeginShaderMode(distortion); - DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); + DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, + (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); EndShaderMode(); DrawFPS(10, 10); |
