From 6e4fdd3b3ae4e4656e151f098c40cfe551a36e8c Mon Sep 17 00:00:00 2001 From: jussi Date: Fri, 18 Feb 2022 18:27:10 +0200 Subject: Added initial files. --- examples/resources/images/LICENCE | 5 ++++ examples/resources/images/apple.png | Bin 0 -> 239 bytes examples/resources/images/cat.png | Bin 0 -> 388467 bytes examples/resources/images/grass.png | Bin 0 -> 1065 bytes examples/resources/images/snake.png | Bin 0 -> 1933 bytes examples/resources/images/tiles.png | Bin 0 -> 32917 bytes examples/resources/shaders/glsl100/wave.fs | 36 ++++++++++++++++++++++++++++ examples/resources/shaders/glsl330/wave.fs | 37 +++++++++++++++++++++++++++++ 8 files changed, 78 insertions(+) create mode 100644 examples/resources/images/LICENCE create mode 100644 examples/resources/images/apple.png create mode 100644 examples/resources/images/cat.png create mode 100644 examples/resources/images/grass.png create mode 100644 examples/resources/images/snake.png create mode 100644 examples/resources/images/tiles.png create mode 100644 examples/resources/shaders/glsl100/wave.fs create mode 100644 examples/resources/shaders/glsl330/wave.fs (limited to 'examples/resources') diff --git a/examples/resources/images/LICENCE b/examples/resources/images/LICENCE new file mode 100644 index 0000000..fca0d39 --- /dev/null +++ b/examples/resources/images/LICENCE @@ -0,0 +1,5 @@ +Resource Author Licence Source +tiles.png Chris Hamons (maintainer) CC0 https://opengameart.org/content/dungeon-crawl-32x32-tiles +apple.png Jussi Viitala CC0 +grass.png Jussi Viitala CC0 +snake.png Jussi Viitala CC0 \ No newline at end of file diff --git a/examples/resources/images/apple.png b/examples/resources/images/apple.png new file mode 100644 index 0000000..9526aa6 Binary files /dev/null and b/examples/resources/images/apple.png differ diff --git a/examples/resources/images/cat.png b/examples/resources/images/cat.png new file mode 100644 index 0000000..db56b9e Binary files /dev/null and b/examples/resources/images/cat.png differ diff --git a/examples/resources/images/grass.png b/examples/resources/images/grass.png new file mode 100644 index 0000000..4ba7263 Binary files /dev/null and b/examples/resources/images/grass.png differ diff --git a/examples/resources/images/snake.png b/examples/resources/images/snake.png new file mode 100644 index 0000000..e1b0091 Binary files /dev/null and b/examples/resources/images/snake.png differ diff --git a/examples/resources/images/tiles.png b/examples/resources/images/tiles.png new file mode 100644 index 0000000..4e3e9cc Binary files /dev/null and b/examples/resources/images/tiles.png differ diff --git a/examples/resources/shaders/glsl100/wave.fs b/examples/resources/shaders/glsl100/wave.fs new file mode 100644 index 0000000..50c4e02 --- /dev/null +++ b/examples/resources/shaders/glsl100/wave.fs @@ -0,0 +1,36 @@ +#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; + +uniform float secondes; + +uniform vec2 size; + +uniform float freqX; +uniform float freqY; +uniform float ampX; +uniform float ampY; +uniform float speedX; +uniform float speedY; + +void main() { + float pixelWidth = 1.0 / size.x; + float pixelHeight = 1.0 / size.y; + float aspect = pixelHeight / pixelWidth; + float boxLeft = 0.0; + float boxTop = 0.0; + + vec2 p = fragTexCoord; + p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth; + p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight; + + gl_FragColor = texture2D(texture0, p)*colDiffuse*fragColor; +} diff --git a/examples/resources/shaders/glsl330/wave.fs b/examples/resources/shaders/glsl330/wave.fs new file mode 100644 index 0000000..43efee2 --- /dev/null +++ b/examples/resources/shaders/glsl330/wave.fs @@ -0,0 +1,37 @@ +#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; + +uniform float secondes; + +uniform vec2 size; + +uniform float freqX; +uniform float freqY; +uniform float ampX; +uniform float ampY; +uniform float speedX; +uniform float speedY; + +void main() { + float pixelWidth = 1.0 / size.x; + float pixelHeight = 1.0 / size.y; + float aspect = pixelHeight / pixelWidth; + float boxLeft = 0.0; + float boxTop = 0.0; + + vec2 p = fragTexCoord; + p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth; + p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight; + + finalColor = texture(texture0, p)*colDiffuse*fragColor; +} -- cgit v1.2.3