diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/Makefile | 2 | ||||
| -rw-r--r-- | examples/oculus_glfw_sample/distortion.fs | 21 | ||||
| -rw-r--r-- | examples/oculus_glfw_sample/rlgl_standalone.c (renamed from examples/oculus_glfw_sample/raylib_rlgl_standalone.c) | 0 | ||||
| -rw-r--r-- | examples/shaders_standard_lighting.c | 4 |
4 files changed, 11 insertions, 16 deletions
diff --git a/examples/Makefile b/examples/Makefile index 534adee8..2d2344af 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -2,7 +2,7 @@ # # 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 # will the authors be held liable for any damages arising from the use of this software. diff --git a/examples/oculus_glfw_sample/distortion.fs b/examples/oculus_glfw_sample/distortion.fs index a9932651..cd5951fe 100644 --- a/examples/oculus_glfw_sample/distortion.fs +++ b/examples/oculus_glfw_sample/distortion.fs @@ -33,11 +33,11 @@ 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); + 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; + return LensCenter + Scale*rvector; } void main() @@ -48,17 +48,12 @@ void main() vec2 LensCenter = gl_FragCoord.x < 540 ? LeftLensCenter : RightLensCenter; vec2 ScreenCenter = gl_FragCoord.x < 540 ? LeftScreenCenter : RightScreenCenter; - //vec2 oTexCoord = (gl_FragCoord.xy + vec2(0.5, 0.5)) / vec2(1280, 800); //Uncomment if using BGE's built-in stereo rendering - vec2 tc = HmdWarp(fragTexCoord, LensCenter); - if (any(bvec2(clamp(tc,ScreenCenter-vec2(0.25,0.5), ScreenCenter+vec2(0.25,0.5)) - tc))) - { - gl_FragColor = vec4(vec3(0.0), 1.0); - } + 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)); //Uncomment if using BGE's built-in stereo rendering - gl_FragColor = texture2D(texture0, tc); + //tc.x = gl_FragCoord.x < 640 ? (2.0 * tc.x) : (2.0 * (tc.x - 0.5)); + finalColor = texture2D(texture0, tc); } -}
\ No newline at end of file +} diff --git a/examples/oculus_glfw_sample/raylib_rlgl_standalone.c b/examples/oculus_glfw_sample/rlgl_standalone.c index 4728160a..4728160a 100644 --- a/examples/oculus_glfw_sample/raylib_rlgl_standalone.c +++ b/examples/oculus_glfw_sample/rlgl_standalone.c diff --git a/examples/shaders_standard_lighting.c b/examples/shaders_standard_lighting.c index ccbe74ca..f2b35171 100644 --- a/examples/shaders_standard_lighting.c +++ b/examples/shaders_standard_lighting.c @@ -22,8 +22,8 @@ int main() { // Initialization //-------------------------------------------------------------------------------------- - int screenWidth = 1280; - int screenHeight = 720; + int screenWidth = 800; + int screenHeight = 450; SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available) |
