diff options
| author | raysan5 <[email protected]> | 2021-10-17 21:02:18 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2021-10-17 21:02:18 +0200 |
| commit | 35e67da08e3d214589968c19b4b2fb31d8e566cc (patch) | |
| tree | 5054bcea5f6df754f467590101789b17dd9d9944 /examples/web/core/resources | |
| parent | b2228039039afc05c41edd12103123f2a36c8080 (diff) | |
| download | raylib.com-35e67da08e3d214589968c19b4b2fb31d8e566cc.tar.gz raylib.com-35e67da08e3d214589968c19b4b2fb31d8e566cc.zip | |
UPDATED: examples to raylib 4.0
Some new examples added
Diffstat (limited to 'examples/web/core/resources')
| -rw-r--r-- | examples/web/core/resources/LICENSE | 4 | ||||
| -rw-r--r-- | examples/web/core/resources/distortion100.fs | 52 | ||||
| -rw-r--r-- | examples/web/core/resources/distortion330.fs | 53 | ||||
| -rw-r--r-- | examples/web/core/resources/ps3.png | bin | 19280 -> 0 bytes | |||
| -rw-r--r-- | examples/web/core/resources/xbox.png | bin | 16112 -> 0 bytes |
5 files changed, 0 insertions, 109 deletions
diff --git a/examples/web/core/resources/LICENSE b/examples/web/core/resources/LICENSE deleted file mode 100644 index d7d797a..0000000 --- a/examples/web/core/resources/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -| resource | author | licence | notes | -| :------------ | :---------: | :------ | :---- | -| ps3.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | -| xbox.png | [@raysan5](https://github.com/raysan5) | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) | - | diff --git a/examples/web/core/resources/distortion100.fs b/examples/web/core/resources/distortion100.fs deleted file mode 100644 index 112cbcb..0000000 --- a/examples/web/core/resources/distortion100.fs +++ /dev/null @@ -1,52 +0,0 @@ -#version 100 - -precision mediump float; - -// Input vertex attributes (from vertex shader) -varying vec2 fragTexCoord; -varying vec4 fragColor; - -// Input uniform values -uniform sampler2D texture0; -uniform vec4 colDiffuse; - -// NOTE: Add here your custom variables -uniform vec2 leftLensCenter; -uniform vec2 rightLensCenter; -uniform vec2 leftScreenCenter; -uniform vec2 rightScreenCenter; -uniform vec2 scale; -uniform vec2 scaleIn; -uniform vec4 hmdWarpParam; -uniform vec4 chromaAbParam; - -void main() -{ - // Compute lens distortion - vec2 lensCenter = fragTexCoord.x < 0.5? leftLensCenter : rightLensCenter; - vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter; - vec2 theta = (fragTexCoord - lensCenter)*scaleIn; - float rSq = theta.x*theta.x + theta.y*theta.y; - vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq); - vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq); - vec2 tcBlue = lensCenter + scale*thetaBlue; - - if (any(bvec2(clamp(tcBlue, screenCenter - vec2(0.25, 0.5), screenCenter + vec2(0.25, 0.5)) - tcBlue))) - { - // Set black fragment for everything outside the lens border - gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); - } - else - { - // Compute color chroma aberration - float blue = texture2D(texture0, tcBlue).b; - vec2 tcGreen = lensCenter + scale*theta1; - float green = texture2D(texture0, tcGreen).g; - - vec2 thetaRed = theta1*(chromaAbParam.x + chromaAbParam.y*rSq); - vec2 tcRed = lensCenter + scale*thetaRed; - - float red = texture2D(texture0, tcRed).r; - gl_FragColor = vec4(red, green, blue, 1.0); - } -} diff --git a/examples/web/core/resources/distortion330.fs b/examples/web/core/resources/distortion330.fs deleted file mode 100644 index 15d03cc..0000000 --- a/examples/web/core/resources/distortion330.fs +++ /dev/null @@ -1,53 +0,0 @@ -#version 330 - -// Input vertex attributes (from vertex shader) -in vec2 fragTexCoord; -in vec4 fragColor; - -// Input uniform values -uniform sampler2D texture0; -uniform vec4 colDiffuse; - -// Output fragment color -out vec4 finalColor; - -// NOTE: Add here your custom variables -uniform vec2 leftLensCenter = vec2(0.288, 0.5); -uniform vec2 rightLensCenter = vec2(0.712, 0.5); -uniform vec2 leftScreenCenter = vec2(0.25, 0.5); -uniform vec2 rightScreenCenter = vec2(0.75, 0.5); -uniform vec2 scale = vec2(0.25, 0.45); -uniform vec2 scaleIn = vec2(4, 2.2222); -uniform vec4 hmdWarpParam = vec4(1, 0.22, 0.24, 0); -uniform vec4 chromaAbParam = vec4(0.996, -0.004, 1.014, 0.0); - -void main() -{ - // Compute lens distortion - vec2 lensCenter = fragTexCoord.x < 0.5? leftLensCenter : rightLensCenter; - vec2 screenCenter = fragTexCoord.x < 0.5? leftScreenCenter : rightScreenCenter; - vec2 theta = (fragTexCoord - lensCenter)*scaleIn; - float rSq = theta.x*theta.x + theta.y*theta.y; - vec2 theta1 = theta*(hmdWarpParam.x + hmdWarpParam.y*rSq + hmdWarpParam.z*rSq*rSq + hmdWarpParam.w*rSq*rSq*rSq); - vec2 thetaBlue = theta1*(chromaAbParam.z + chromaAbParam.w*rSq); - vec2 tcBlue = lensCenter + scale*thetaBlue; - - if (any(bvec2(clamp(tcBlue, screenCenter - vec2(0.25, 0.5), screenCenter + vec2(0.25, 0.5)) - tcBlue))) - { - // Set black fragment for everything outside the lens border - finalColor = vec4(0.0, 0.0, 0.0, 1.0); - } - else - { - // Compute color chroma aberration - float blue = texture(texture0, tcBlue).b; - vec2 tcGreen = lensCenter + scale*theta1; - float green = texture(texture0, tcGreen).g; - - vec2 thetaRed = theta1*(chromaAbParam.x + chromaAbParam.y*rSq); - vec2 tcRed = lensCenter + scale*thetaRed; - - float red = texture(texture0, tcRed).r; - finalColor = vec4(red, green, blue, 1.0); - } -} diff --git a/examples/web/core/resources/ps3.png b/examples/web/core/resources/ps3.png Binary files differdeleted file mode 100644 index 59c0b35..0000000 --- a/examples/web/core/resources/ps3.png +++ /dev/null diff --git a/examples/web/core/resources/xbox.png b/examples/web/core/resources/xbox.png Binary files differdeleted file mode 100644 index 1a57058..0000000 --- a/examples/web/core/resources/xbox.png +++ /dev/null |
