diff options
| author | Ray <[email protected]> | 2019-05-06 09:41:54 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2019-05-06 09:41:54 +0200 |
| commit | 2ddc4bacba8fc6809de924c3d6912d4812226231 (patch) | |
| tree | a352d0ad95c55f77c3442897920bfa150c4055ef /examples/shaders/resources | |
| parent | 3e0e91013fa9bd57349de2a95506953d5991ddcc (diff) | |
| download | raylib-2ddc4bacba8fc6809de924c3d6912d4812226231.tar.gz raylib-2ddc4bacba8fc6809de924c3d6912d4812226231.zip | |
Example review
Diffstat (limited to 'examples/shaders/resources')
| -rw-r--r-- | examples/shaders/resources/shaders/glsl100/palette_switch.fs (renamed from examples/shaders/resources/shaders/glsl100/palette-switch.fs) | 58 | ||||
| -rw-r--r-- | examples/shaders/resources/shaders/glsl120/palette_switch.fs (renamed from examples/shaders/resources/shaders/glsl120/palette-switch.fs) | 54 | ||||
| -rw-r--r-- | examples/shaders/resources/shaders/glsl330/palette_switch.fs (renamed from examples/shaders/resources/shaders/glsl330/palette-switch.fs) | 60 |
3 files changed, 86 insertions, 86 deletions
diff --git a/examples/shaders/resources/shaders/glsl100/palette-switch.fs b/examples/shaders/resources/shaders/glsl100/palette_switch.fs index 65a7bd29..7f09137e 100644 --- a/examples/shaders/resources/shaders/glsl100/palette-switch.fs +++ b/examples/shaders/resources/shaders/glsl100/palette_switch.fs @@ -1,29 +1,29 @@ -#version 100
-
-precision mediump float;
-
-const int colors = 8;
-
-// Input vertex attributes (from vertex shader)
-varying vec2 fragTexCoord;
-varying vec4 fragColor;
-
-// Input uniform values
-uniform sampler2D texture0;
-uniform ivec3 palette[colors];
-
-void main()
-{
- // Texel color fetching from texture sampler
- vec4 texelColor = texture(texture0, fragTexCoord) * fragColor;
-
- // Convert the (normalized) texel color RED component (GB would work, too)
- // to the palette index by scaling up from [0, 1] to [0, 255].
- int index = int(texelColor.r * 255.0);
- ivec3 color = palette[index];
-
- // Calculate final fragment color. Note that the palette color components
- // are defined in the range [0, 255] and need to be normalized to [0, 1]
- // for OpenGL to work.
- gl_FragColor = vec4(color / 255.0, texelColor.a);
-}
+#version 100 + +precision mediump float; + +const int colors = 8; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform ivec3 palette[colors]; + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture(texture0, fragTexCoord) * fragColor; + + // Convert the (normalized) texel color RED component (GB would work, too) + // to the palette index by scaling up from [0, 1] to [0, 255]. + int index = int(texelColor.r * 255.0); + ivec3 color = palette[index]; + + // Calculate final fragment color. Note that the palette color components + // are defined in the range [0, 255] and need to be normalized to [0, 1] + // for OpenGL to work. + gl_FragColor = vec4(color / 255.0, texelColor.a); +} diff --git a/examples/shaders/resources/shaders/glsl120/palette-switch.fs b/examples/shaders/resources/shaders/glsl120/palette_switch.fs index b4384502..ab3f79c7 100644 --- a/examples/shaders/resources/shaders/glsl120/palette-switch.fs +++ b/examples/shaders/resources/shaders/glsl120/palette_switch.fs @@ -1,27 +1,27 @@ -#version 120
-
-const int colors = 8;
-
-// Input fragment attributes (from fragment shader)
-varying vec2 fragTexCoord;
-varying vec4 fragColor;
-
-// Input uniform values
-uniform sampler2D texture0;
-uniform ivec3 palette[colors];
-
-void main()
-{
- // Texel color fetching from texture sampler
- vec4 texelColor = texture(texture0, fragTexCoord) * fragColor;
-
- // Convert the (normalized) texel color RED component (GB would work, too)
- // to the palette index by scaling up from [0, 1] to [0, 255].
- int index = int(texelColor.r * 255.0);
- ivec3 color = palette[index];
-
- // Calculate final fragment color. Note that the palette color components
- // are defined in the range [0, 255] and need to be normalized to [0, 1]
- // for OpenGL to work.
- gl_FragColor = vec4(color / 255.0, texelColor.a);
-}
+#version 120 + +const int colors = 8; + +// Input fragment attributes (from fragment shader) +varying vec2 fragTexCoord; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform ivec3 palette[colors]; + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture(texture0, fragTexCoord) * fragColor; + + // Convert the (normalized) texel color RED component (GB would work, too) + // to the palette index by scaling up from [0, 1] to [0, 255]. + int index = int(texelColor.r * 255.0); + ivec3 color = palette[index]; + + // Calculate final fragment color. Note that the palette color components + // are defined in the range [0, 255] and need to be normalized to [0, 1] + // for OpenGL to work. + gl_FragColor = vec4(color / 255.0, texelColor.a); +} diff --git a/examples/shaders/resources/shaders/glsl330/palette-switch.fs b/examples/shaders/resources/shaders/glsl330/palette_switch.fs index 61b532ed..7c8a488c 100644 --- a/examples/shaders/resources/shaders/glsl330/palette-switch.fs +++ b/examples/shaders/resources/shaders/glsl330/palette_switch.fs @@ -1,30 +1,30 @@ -#version 330
-
-const int colors = 8;
-
-// Input fragment attributes (from fragment shader)
-in vec2 fragTexCoord;
-in vec4 fragColor;
-
-// Input uniform values
-uniform sampler2D texture0;
-uniform ivec3 palette[colors];
-
-// Output fragment color
-out vec4 finalColor;
-
-void main()
-{
- // Texel color fetching from texture sampler
- vec4 texelColor = texture(texture0, fragTexCoord)*fragColor;
-
- // Convert the (normalized) texel color RED component (GB would work, too)
- // to the palette index by scaling up from [0, 1] to [0, 255].
- int index = int(texelColor.r * 255.0);
- ivec3 color = palette[index];
-
- // Calculate final fragment color. Note that the palette color components
- // are defined in the range [0, 255] and need to be normalized to [0, 1]
- // for OpenGL to work.
- finalColor = vec4(color / 255.0, texelColor.a);
-}
+#version 330 + +const int colors = 8; + +// Input fragment attributes (from fragment shader) +in vec2 fragTexCoord; +in vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform ivec3 palette[colors]; + +// Output fragment color +out vec4 finalColor; + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture(texture0, fragTexCoord)*fragColor; + + // Convert the (normalized) texel color RED component (GB would work, too) + // to the palette index by scaling up from [0, 1] to [0, 255]. + int index = int(texelColor.r*255.0); + ivec3 color = palette[index]; + + // Calculate final fragment color. Note that the palette color components + // are defined in the range [0, 255] and need to be normalized to [0, 1] + // for OpenGL to work. + finalColor = vec4(color/255.0, texelColor.a); +} |
