diff options
| author | Uneven Prankster <unevenprankster@protonmail.com> | 2023-11-16 21:12:27 -0300 |
|---|---|---|
| committer | Uneven Prankster <unevenprankster@protonmail.com> | 2023-11-16 21:12:27 -0300 |
| commit | 2bbf92ad5ae7708bf18ac7ef333e9a979d8d1bde (patch) | |
| tree | c9d22bb0d73d9cc0c8586e4d31c93a561ea8e910 /assets | |
| parent | 1c0cc775732201f4c4d3ee0d6772be786b3b4aa1 (diff) | |
Working so hard like a soldiermain
Can't afford a thing on TV
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/UP_Intro.ogg | bin | 0 -> 98070 bytes | |||
| -rw-r--r-- | assets/berry-rotunda.ttf | bin | 82904 -> 0 bytes | |||
| -rw-r--r-- | assets/fonts/berry-rotunda.fnt (renamed from assets/berry-rotunda.fnt) | 0 | ||||
| -rw-r--r-- | assets/fonts/berry-rotunda_0.png (renamed from assets/berry-rotunda_0.png) | bin | 6454 -> 6454 bytes | |||
| -rw-r--r-- | assets/fonts/cell-provider.fnt | 99 | ||||
| -rw-r--r-- | assets/fonts/cell-provider_0.png | bin | 0 -> 1181 bytes | |||
| -rw-r--r-- | assets/models/amanita.glb | bin | 0 -> 71376 bytes | |||
| -rw-r--r-- | assets/models/amanita.m3d | bin | 0 -> 17942 bytes | |||
| -rw-r--r-- | assets/models/amanita.png | bin | 0 -> 7342 bytes | |||
| -rw-r--r-- | assets/shaders/ntsc.fs | 99 | ||||
| -rw-r--r-- | assets/shaders/ps1frag.fs | 18 | ||||
| -rw-r--r-- | assets/shaders/ps1vert.vs | 26 | ||||
| -rw-r--r-- | assets/shaders/psx_filter.fs | 38 | ||||
| -rw-r--r-- | assets/shaders/rvm.fs | 208 | ||||
| -rw-r--r-- | assets/src/gunner.h | 223 | ||||
| -rw-r--r-- | assets/src/main.c | 41 |
16 files changed, 488 insertions, 264 deletions
diff --git a/assets/UP_Intro.ogg b/assets/UP_Intro.ogg Binary files differnew file mode 100644 index 0000000..4b0bc3c --- /dev/null +++ b/assets/UP_Intro.ogg diff --git a/assets/berry-rotunda.ttf b/assets/berry-rotunda.ttf Binary files differdeleted file mode 100644 index 679276e..0000000 --- a/assets/berry-rotunda.ttf +++ /dev/null diff --git a/assets/berry-rotunda.fnt b/assets/fonts/berry-rotunda.fnt index 624cde0..624cde0 100644 --- a/assets/berry-rotunda.fnt +++ b/assets/fonts/berry-rotunda.fnt diff --git a/assets/berry-rotunda_0.png b/assets/fonts/berry-rotunda_0.png Binary files differindex 3810d6e..3810d6e 100644 --- a/assets/berry-rotunda_0.png +++ b/assets/fonts/berry-rotunda_0.png diff --git a/assets/fonts/cell-provider.fnt b/assets/fonts/cell-provider.fnt new file mode 100644 index 0000000..ca400aa --- /dev/null +++ b/assets/fonts/cell-provider.fnt @@ -0,0 +1,99 @@ +info face="CellProvider" size=-16 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=0 aa=1 padding=0,0,0,0 spacing=1,1 outline=0 +common lineHeight=15 base=12 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4 +page id=0 file="cell-provider_0.png" +chars count=95 +char id=32 x=16 y=32 width=3 height=15 xoffset=-1 yoffset=0 xadvance=3 page=0 chnl=15 +char id=33 x=24 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=34 x=125 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=35 x=61 y=0 width=7 height=15 xoffset=0 yoffset=0 xadvance=8 page=0 chnl=15 +char id=36 x=91 y=0 width=6 height=15 xoffset=0 yoffset=0 xadvance=7 page=0 chnl=15 +char id=37 x=0 y=0 width=11 height=15 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 +char id=38 x=69 y=0 width=7 height=15 xoffset=0 yoffset=0 xadvance=8 page=0 chnl=15 +char id=39 x=27 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=40 x=0 y=32 width=3 height=15 xoffset=0 yoffset=0 xadvance=4 page=0 chnl=15 +char id=41 x=4 y=32 width=3 height=15 xoffset=0 yoffset=0 xadvance=4 page=0 chnl=15 +char id=42 x=149 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=43 x=77 y=0 width=6 height=15 xoffset=0 yoffset=0 xadvance=7 page=0 chnl=15 +char id=44 x=30 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=45 x=167 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=46 x=39 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=47 x=173 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=48 x=179 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=49 x=239 y=16 width=4 height=15 xoffset=0 yoffset=0 xadvance=5 page=0 chnl=15 +char id=50 x=185 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=51 x=191 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=52 x=197 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=53 x=203 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=54 x=155 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=55 x=209 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=56 x=215 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=57 x=221 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=58 x=48 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=59 x=33 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=60 x=227 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=61 x=233 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=62 x=239 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=63 x=245 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=64 x=12 y=0 width=11 height=15 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15 +char id=65 x=0 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=66 x=6 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=67 x=12 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=68 x=18 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=69 x=24 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=70 x=30 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=71 x=36 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=72 x=42 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=73 x=234 y=16 width=4 height=15 xoffset=0 yoffset=0 xadvance=5 page=0 chnl=15 +char id=74 x=48 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=75 x=54 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=76 x=60 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=77 x=24 y=0 width=9 height=15 xoffset=0 yoffset=0 xadvance=10 page=0 chnl=15 +char id=78 x=84 y=0 width=6 height=15 xoffset=0 yoffset=0 xadvance=7 page=0 chnl=15 +char id=79 x=66 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=80 x=72 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=81 x=78 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=82 x=84 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=83 x=90 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=84 x=98 y=0 width=6 height=15 xoffset=0 yoffset=0 xadvance=7 page=0 chnl=15 +char id=85 x=96 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=86 x=102 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=87 x=52 y=0 width=8 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=15 +char id=88 x=108 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=89 x=105 y=0 width=6 height=15 xoffset=0 yoffset=0 xadvance=7 page=0 chnl=15 +char id=90 x=114 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=91 x=12 y=32 width=3 height=15 xoffset=0 yoffset=0 xadvance=4 page=0 chnl=15 +char id=92 x=120 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=93 x=20 y=32 width=3 height=15 xoffset=0 yoffset=0 xadvance=4 page=0 chnl=15 +char id=94 x=126 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=95 x=132 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=96 x=8 y=32 width=3 height=15 xoffset=0 yoffset=0 xadvance=4 page=0 chnl=15 +char id=97 x=138 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=98 x=144 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=99 x=150 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=100 x=156 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=101 x=162 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=102 x=168 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=103 x=174 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=104 x=216 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=105 x=36 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=106 x=251 y=0 width=4 height=15 xoffset=-2 yoffset=0 xadvance=3 page=0 chnl=15 +char id=107 x=180 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=108 x=42 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=109 x=43 y=0 width=8 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=15 +char id=110 x=186 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=111 x=192 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=112 x=198 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=113 x=204 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=114 x=210 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=115 x=161 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=116 x=222 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=117 x=228 y=16 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=118 x=119 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=119 x=34 y=0 width=8 height=15 xoffset=0 yoffset=0 xadvance=9 page=0 chnl=15 +char id=120 x=131 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=121 x=137 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=122 x=143 y=0 width=5 height=15 xoffset=0 yoffset=0 xadvance=6 page=0 chnl=15 +char id=123 x=244 y=16 width=4 height=15 xoffset=0 yoffset=0 xadvance=5 page=0 chnl=15 +char id=124 x=45 y=32 width=2 height=15 xoffset=0 yoffset=0 xadvance=3 page=0 chnl=15 +char id=125 x=249 y=16 width=4 height=15 xoffset=0 yoffset=0 xadvance=5 page=0 chnl=15 +char id=126 x=112 y=0 width=6 height=15 xoffset=0 yoffset=0 xadvance=7 page=0 chnl=15 diff --git a/assets/fonts/cell-provider_0.png b/assets/fonts/cell-provider_0.png Binary files differnew file mode 100644 index 0000000..83d8e94 --- /dev/null +++ b/assets/fonts/cell-provider_0.png diff --git a/assets/models/amanita.glb b/assets/models/amanita.glb Binary files differnew file mode 100644 index 0000000..97d7f45 --- /dev/null +++ b/assets/models/amanita.glb diff --git a/assets/models/amanita.m3d b/assets/models/amanita.m3d Binary files differnew file mode 100644 index 0000000..15abfa9 --- /dev/null +++ b/assets/models/amanita.m3d diff --git a/assets/models/amanita.png b/assets/models/amanita.png Binary files differnew file mode 100644 index 0000000..e193d08 --- /dev/null +++ b/assets/models/amanita.png diff --git a/assets/shaders/ntsc.fs b/assets/shaders/ntsc.fs new file mode 100644 index 0000000..871565b --- /dev/null +++ b/assets/shaders/ntsc.fs @@ -0,0 +1,99 @@ +#version 330 + +in vec2 fragTexCoord; +uniform sampler2D texture0; + +vec3 rgb2yiq(vec3 c){ + return vec3( + (0.2989 * c.x + 0.5959 * c.y + 0.2115 * c.z), + (0.5870 * c.x - 0.2744 * c.y - 0.5229 * c.z), + (0.1140 * c.x - 0.3216 * c.y + 0.3114 * c.z) + ); +} +vec3 yiq2rgb(vec3 c){ + return vec3( + (1.0 * c.x + 1.0 * c.y + 1.0 * c.z), + (0.956 * c.x - 0.2720 * c.y - 1.1060 * c.z), + (0.6210 * c.x - 0.6474 * c.y + 1.7046 * c.z) + ); +} + +vec2 Circle(float Start, float Points, float Point){ + float Rad = (3.141592 * 2.0 * (1.0 / Points)) * (Point + Start); + return vec2(-(.3+Rad), cos(Rad)); +} + +vec3 Blur(vec2 uv, float f, float d, sampler2D iChannel0){ + vec2 PixelOffset = vec2(d, 0); + + float Start = 2.0 / 14.0; + vec2 Scale = 0.66 * 3.0 * 2.0 * PixelOffset.xy; + + vec3 N0 = texture(iChannel0, uv + Circle(Start, 14.0, 0.0) * Scale).rgb; + vec3 N1 = texture(iChannel0, uv + Circle(Start, 14.0, 1.0) * Scale).rgb; + vec3 N2 = texture(iChannel0, uv + Circle(Start, 14.0, 2.0) * Scale).rgb; + vec3 N3 = texture(iChannel0, uv + Circle(Start, 14.0, 3.0) * Scale).rgb; + vec3 N4 = texture(iChannel0, uv + Circle(Start, 14.0, 4.0) * Scale).rgb; + vec3 N5 = texture(iChannel0, uv + Circle(Start, 14.0, 5.0) * Scale).rgb; + vec3 N6 = texture(iChannel0, uv + Circle(Start, 14.0, 6.0) * Scale).rgb; + vec3 N7 = texture(iChannel0, uv + Circle(Start, 14.0, 7.0) * Scale).rgb; + vec3 N8 = texture(iChannel0, uv + Circle(Start, 14.0, 8.0) * Scale).rgb; + vec3 N9 = texture(iChannel0, uv + Circle(Start, 14.0, 9.0) * Scale).rgb; + vec3 N10 = texture(iChannel0, uv + Circle(Start, 14.0, 10.0) * Scale).rgb; + vec3 N11 = texture(iChannel0, uv + Circle(Start, 14.0, 11.0) * Scale).rgb; + vec3 N12 = texture(iChannel0, uv + Circle(Start, 14.0, 12.0) * Scale).rgb; + vec3 N13 = texture(iChannel0, uv + Circle(Start, 14.0, 13.0) * Scale).rgb; + vec3 N14 = texture(iChannel0, uv).rgb; + + vec3 clr = N14; + float W = 1.0 / 15.0; + + clr = + (N0 * W) + + (N1 * W) + + (N2 * W) + + (N3 * W) + + (N4 * W) + + (N5 * W) + + (N6 * W) + + (N7 * W) + + (N8 * W) + + (N9 * W) + + (N10 * W) + + (N11 * W) + + (N12 * W) + + (N13 * W) + + (N14 * W); + + return clr; +} + +out vec4 finalColor; + +void main(){ + vec2 uv = gl_FragCoord.xy / vec2(textureSize(texture0, 0)); + vec3 color; + + // Apply blur + float d = 0.051; + float c = 0.002 * d; + + color.xyz = Blur(uv, 0.0, c + c * (uv.x), texture0); + float y = rgb2yiq(color.xyz).r; + + uv.x += 0.01 * d; + c *= 6.0; + color.xyz = Blur(uv, 0.333, c, texture0); + float i = rgb2yiq(color.xyz).g; + + uv.x += 0.005 * d; + + c *= 2.50; + color.xyz = Blur(uv, 0.666, c + c * (-uv.x), texture0); + float q = rgb2yiq(color.xyz).b; + + color.xyz = yiq2rgb(vec3(y, i, q)); + color.xyz *= smoothstep(1.0, 0.999, uv.x - .1); + + finalColor = vec4(color, 1.0); +}
\ No newline at end of file diff --git a/assets/shaders/ps1frag.fs b/assets/shaders/ps1frag.fs new file mode 100644 index 0000000..efdb0b8 --- /dev/null +++ b/assets/shaders/ps1frag.fs @@ -0,0 +1,18 @@ +#version 330 + +noperspective in vec2 fragTexCoord; +noperspective in vec3 fragColor; + +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +out vec4 finalColor; + +void main() +{ + vec4 texelColor = texture(texture0, fragTexCoord); + if(texelColor.a < 0.8) + discard; + + finalColor = texelColor*colDiffuse*vec4(fragColor, 1.0); +}
\ No newline at end of file diff --git a/assets/shaders/ps1vert.vs b/assets/shaders/ps1vert.vs new file mode 100644 index 0000000..7d8d506 --- /dev/null +++ b/assets/shaders/ps1vert.vs @@ -0,0 +1,26 @@ +#version 330 + +in vec3 vertexPosition; +in vec2 vertexTexCoord; +in vec3 vertexNormal; +in vec4 vertexColor; + +uniform mat4 mvp; + +noperspective out vec2 fragTexCoord; +noperspective out vec3 fragColor; + +void main() +{ + vec2 res = vec2(160.0, 120.0); + fragTexCoord = vertexTexCoord; + fragColor = vertexColor.rgb; + + vec4 pop = mvp*vec4(vertexPosition, 1.0); + gl_Position = pop; + gl_Position.xyz = pop.xyz / pop.w; + gl_Position.xy = floor(res * gl_Position.xy) / res; + gl_Position.xyz *= pop.w; + + fragColor = mix(fragColor, vec3(0.0), clamp(smoothstep(20.0, 24.0, length(pop.xyz)), 0.0, 1.0)); +}
\ No newline at end of file diff --git a/assets/shaders/psx_filter.fs b/assets/shaders/psx_filter.fs new file mode 100644 index 0000000..21eaada --- /dev/null +++ b/assets/shaders/psx_filter.fs @@ -0,0 +1,38 @@ +#version 330 + +uniform sampler2D texture0; + +in vec2 fragTexCoord; + +out vec4 finalColor; + +const float neareight = 255.0; +vec3 dither(vec3 col, uvec2 fc) +{ + const int mat[16] = int[16] ( + -4, 0, -3, 1, + 2, -2, 3, -1, + -3, 1, -4, 0, + 3, -1, 2, -2 + ); + + ivec3 uncol = ivec3(col * neareight) + mat[(fc.y & uint(3)) * uint(4) + (fc.x & uint(3))]; + return vec3(uncol) / neareight; +} + +vec3 band_color(vec3 lol) +{ + ivec3 res = ivec3(clamp(lol, 0.0, 1.0) * neareight) & ivec3(0xFF); + ivec3 ires = res >> 3; + ivec3 dres = (ires >> 2) & ivec3(7); + res = (ires << 3) | dres; + return vec3(res) / neareight; +} + +void main() +{ + vec4 texelColor = texture(texture0, fragTexCoord); + texelColor.rgb = band_color(dither(texelColor.rgb, uvec2(gl_FragCoord.xy))); + + finalColor = texelColor; +}
\ No newline at end of file diff --git a/assets/shaders/rvm.fs b/assets/shaders/rvm.fs new file mode 100644 index 0000000..3f94c52 --- /dev/null +++ b/assets/shaders/rvm.fs @@ -0,0 +1,208 @@ +#version 330 + +in vec2 fragTexCoord; + +uniform sampler2D texture0; +uniform vec4 resolution; + +// Horizonal scan blur +// 0.50 := blurry +// 0.75 := default +// 1.00 := blocky +#define INPUT_BLUR 0.5 + +//-------------------------------------------------------------- +// Setup the function which returns gather4 results +// Have to emulate gather4 as ShaderToy doesn't support it +// Gather 4 ordering +// W Z +// X Y +vec4 RvmR4F(sampler2D tex, vec2 uv){ + vec2 px = vec2(1.0) / vec2(textureSize(tex, 0)); + px *= 0.5; + + vec4 sample; + sample.w = texture(tex, uv.xy + vec2(-px.x,-px.y)).r; + sample.z = texture(tex, uv.xy + vec2( px.x,-px.y)).r; + sample.x = texture(tex, uv.xy + vec2(-px.x, px.y)).r; + sample.y = texture(tex, uv.xy + vec2( px.x, px.y)).r; + + return sample; +} +// +vec4 RvmG4F(sampler2D tex, vec2 uv){ + vec2 px = vec2(1.0) / vec2(textureSize(tex, 0)); + px *= 0.5; + + vec4 sample; + sample.w = texture(tex, uv.xy + vec2(-px.x,-px.y)).g; + sample.z = texture(tex, uv.xy + vec2( px.x,-px.y)).g; + sample.x = texture(tex, uv.xy + vec2(-px.x, px.y)).g; + sample.y = texture(tex, uv.xy + vec2( px.x, px.y)).g; + + return sample; +} +// +vec4 RvmB4F(sampler2D tex, vec2 uv){ + vec2 px = vec2(1.0) / vec2(textureSize(tex, 0)); + px *= 0.5; + + vec4 sample; + sample.w = texture(tex, uv.xy + vec2(-px.x,-px.y)).b; + sample.z = texture(tex, uv.xy + vec2( px.x,-px.y)).b; + sample.x = texture(tex, uv.xy + vec2(-px.x, px.y)).b; + sample.y = texture(tex, uv.xy + vec2( px.x, px.y)).b; + + return sample; +} + +#define RVM_DARK 1 +#define RVM_SCAN_DIV 3.0 +#define RVM_SCAN_MAX (8.0/15.0) +#define RVM_SCAN_MIN (RVM_SCAN_DIV*RVM_SCAN_MAX) +#define RVM_SCAN_SIZ (RVM_SCAN_MAX-RVM_SCAN_MIN) + +vec2 RvmPolyF2(vec2 x){ + x=clamp(-x*x+vec2(1.0,1.0), 0.0, 1.0); + return x*x; +} + +vec3 rvm_func( +sampler2D tex, +//-------------------------------------------------------------- + // SV_POSITION, fragCoord.xy, etc + vec2 ipos, +//-------------------------------------------------------------- + // inputSize / outputSize (in pixels) + vec2 inputSizeDivOutputSize, +//-------------------------------------------------------------- + // 0.5 * inputSize (in pixels) + vec2 halfInputSize, +//-------------------------------------------------------------- + // 1.0 / inputSize (in pixels) + vec2 rcpInputSize, +//-------------------------------------------------------------- + // 2.0 / outputSize (in pixels) + vec2 twoDivOutputSize, +//-------------------------------------------------------------- + // inputSize.y + float inputHeight, +//-------------------------------------------------------------- + // Warp scanlines + // 0.0 = no warp + // 1.0/64.0 = light warping + // 1.0/32.0 = more warping + // Want x and y warping to be different (based on aspect) + vec2 warp, +//-------------------------------------------------------------- + // Control horizontal blur + // 0.50 := blurry + // 0.75 := default + // 1.00 := blocky + float blur, + // Derived constant {0.5*blur,-0.5*blur,-1.5*blur,-2.5*blur} + vec4 blur4){ + // Optional apply warp + vec2 pos; + pos=ipos*inputSizeDivOutputSize; + pos -= (halfInputSize * 2.0) / (resolution.zw / resolution.xy); + + // Get to center for first gather 4 + // W Z + // X Y + // W Z + // X Y + vec2 g=floor(pos+vec2(-0.5,-1.5))+vec2(1.0); + vec2 gp=g*rcpInputSize; + g.x-=float(0.5); + + // 2x4 sampled footprint + // W Z |s + // X Y |s + // W Z :t + // X Y :t + vec4 colRS=RvmR4F(tex, gp); + vec4 colGS=RvmG4F(tex, gp); + vec4 colBS=RvmB4F(tex, gp); + gp.y+=float(2.0*rcpInputSize.y); + vec4 colRT=RvmR4F(tex, gp); + vec4 colGT=RvmG4F(tex, gp); + vec4 colBT=RvmB4F(tex, gp); + + // Vertical + float offB=float(pos.y-g.y); + vec2 offS=vec2(offB,offB)*vec2(blur)+blur4.xy; + vec2 offT=vec2(offB,offB)*vec2(blur)+blur4.zw; + + vec2 horS=RvmPolyF2(offS); + vec2 horT=RvmPolyF2(offT); + + // Get kernel totals and then rcp + vec2 hor0=horS+horT; + float horD=1.0 / (hor0.x+hor0.y); + + //horD*=float(vin); + + // Apply vertical filter + vec2 colRL=colRS.wz*horS.xx+colRS.xy*horS.yy+ + colRT.wz*horT.xx+colRT.xy*horT.yy; + vec2 colGL=colGS.wz*horS.xx+colGS.xy*horS.yy+ + colGT.wz*horT.xx+colGT.xy*horT.yy; + vec2 colBL=colBS.wz*horS.xx+colBS.xy*horS.yy+ + colBT.wz*horT.xx+colBT.xy*horT.yy; + + // Normalize by kernel total + colRL*=vec2(horD); + colGL*=vec2(horD); + colBL*=vec2(horD); + + float offX=float(pos.x-g.x); + vec2 scnL=vec2(float(1.0)-offX,offX); + // Apply scan + colRL*=scnL; + colGL*=scnL; + colBL*=scnL; + // Merge contribution from both nearest lines + vec3 col; + col.r=colRL.x+colRL.y; + col.g=colGL.x+colGL.y; + col.b=colBL.x+colBL.y; + + // Slot mask + float lim=float(1.0/((3.0/12.0)+(9.0/12.0)*RVM_DARK)); + if(fract(ipos.x*float(1.0/6.0))>float(0.5)) + ipos.y+=float(2.0); + ipos.y=fract(ipos.y*float(1.0/4.0)); + + vec3 colD=col*col; + + colD*=RVM_DARK; + + vec3 amp= vec3(1.0) / vec3( + vec3(lim*3.0/12.0)+vec3(lim*9.0/12.0)*col); + ipos.x=fract(ipos.x*float(1.0/3.0)); + + col*=amp;colD*=amp; + if(ipos.y>float(1.0/4.0)){ + if( ipos.x<float(1.0/3.0)){colD.r=col.r;} + else if(ipos.x<float(2.0/3.0)){colD.g=col.g;} + else {colD.b=col.b;} + } + return colD; +//-------------------------------------------------------------- + return col; +} + +out vec4 finalColor; + +void main() { + vec2 input_size = vec2(textureSize(texture0, 0)); + vec2 out_size = resolution.zw; + + vec3 color = rvm_func(texture0, + gl_FragCoord.xy, input_size / out_size, + input_size * 0.5, 1.0 / input_size, 2.0 / out_size, input_size.y, vec2(1.0/48.0,1.0/24.0), INPUT_BLUR, + vec4(0.5*INPUT_BLUR,-0.5*INPUT_BLUR,-1.5*INPUT_BLUR,-2.5*INPUT_BLUR)); + + finalColor = vec4(color, 1.0); +} diff --git a/assets/src/gunner.h b/assets/src/gunner.h deleted file mode 100644 index be1b32e..0000000 --- a/assets/src/gunner.h +++ /dev/null @@ -1,223 +0,0 @@ -#pragma once - -// Defines // - -typedef struct{ - unsigned char r; - unsigned char g; - unsigned char b; - unsigned char a; -}Color; - -#define WHITE (Color){255, 255, 255, 255} -#define BLACK (Color){0, 0, 0, 255} - -typedef char i8; -typedef unsigned char u8; - -typedef short i16; -typedef unsigned short u16; - -typedef int i32; -typedef long long i64; - -typedef unsigned int u32; -typedef unsigned long long u64; - -typedef float f32; -typedef double f64; - -// 24.8 format -typedef i32 fx32; -#define FIXED_POINT_BITS 8 -#define FIXED_POINT_ONE (1 << FIXED_POINT_BITS) -#define TO_FIXED(x) ((fx32)(x) << FIXED_POINT_BITS) -#define FROM_FIXED(x) ((x) >> FIXED_POINT_BITS) -#define FP_TO_FIXED(x) (fx32)((x) * FIXED_POINT_ONE) - -typedef struct{ - fx32 x, y; -}vec2; - -typedef i8 b32; -#define false 0 -#define true 1 - -typedef enum { - KEY_NULL = 0, // Key: NULL, used for no key pressed - // Alphanumeric keys - KEY_APOSTROPHE = 39, // Key: ' - KEY_COMMA = 44, // Key: , - KEY_MINUS = 45, // Key: - - KEY_PERIOD = 46, // Key: . - KEY_SLASH = 47, // Key: / - KEY_ZERO = 48, // Key: 0 - KEY_ONE = 49, // Key: 1 - KEY_TWO = 50, // Key: 2 - KEY_THREE = 51, // Key: 3 - KEY_FOUR = 52, // Key: 4 - KEY_FIVE = 53, // Key: 5 - KEY_SIX = 54, // Key: 6 - KEY_SEVEN = 55, // Key: 7 - KEY_EIGHT = 56, // Key: 8 - KEY_NINE = 57, // Key: 9 - KEY_SEMICOLON = 59, // Key: ; - KEY_EQUAL = 61, // Key: = - KEY_A = 65, // Key: A | a - KEY_B = 66, // Key: B | b - KEY_C = 67, // Key: C | c - KEY_D = 68, // Key: D | d - KEY_E = 69, // Key: E | e - KEY_F = 70, // Key: F | f - KEY_G = 71, // Key: G | g - KEY_H = 72, // Key: H | h - KEY_I = 73, // Key: I | i - KEY_J = 74, // Key: J | j - KEY_K = 75, // Key: K | k - KEY_L = 76, // Key: L | l - KEY_M = 77, // Key: M | m - KEY_N = 78, // Key: N | n - KEY_O = 79, // Key: O | o - KEY_P = 80, // Key: P | p - KEY_Q = 81, // Key: Q | q - KEY_R = 82, // Key: R | r - KEY_S = 83, // Key: S | s - KEY_T = 84, // Key: T | t - KEY_U = 85, // Key: U | u - KEY_V = 86, // Key: V | v - KEY_W = 87, // Key: W | w - KEY_X = 88, // Key: X | x - KEY_Y = 89, // Key: Y | y - KEY_Z = 90, // Key: Z | z - KEY_LEFT_BRACKET = 91, // Key: [ - KEY_BACKSLASH = 92, // Key: '\' - KEY_RIGHT_BRACKET = 93, // Key: ] - KEY_GRAVE = 96, // Key: ` - // Function keys - KEY_SPACE = 32, // Key: Space - KEY_ESCAPE = 256, // Key: Esc - KEY_ENTER = 257, // Key: Enter - KEY_TAB = 258, // Key: Tab - KEY_BACKSPACE = 259, // Key: Backspace - KEY_INSERT = 260, // Key: Ins - KEY_DELETE = 261, // Key: Del - KEY_RIGHT = 262, // Key: Cursor right - KEY_LEFT = 263, // Key: Cursor left - KEY_DOWN = 264, // Key: Cursor down - KEY_UP = 265, // Key: Cursor up - KEY_PAGE_UP = 266, // Key: Page up - KEY_PAGE_DOWN = 267, // Key: Page down - KEY_HOME = 268, // Key: Home - KEY_END = 269, // Key: End - KEY_CAPS_LOCK = 280, // Key: Caps lock - KEY_SCROLL_LOCK = 281, // Key: Scroll down - KEY_NUM_LOCK = 282, // Key: Num lock - KEY_PRINT_SCREEN = 283, // Key: Print screen - KEY_PAUSE = 284, // Key: Pause - KEY_F1 = 290, // Key: F1 - KEY_F2 = 291, // Key: F2 - KEY_F3 = 292, // Key: F3 - KEY_F4 = 293, // Key: F4 - KEY_F5 = 294, // Key: F5 - KEY_F6 = 295, // Key: F6 - KEY_F7 = 296, // Key: F7 - KEY_F8 = 297, // Key: F8 - KEY_F9 = 298, // Key: F9 - KEY_F10 = 299, // Key: F10 - KEY_F11 = 300, // Key: F11 - KEY_F12 = 301, // Key: F12 - KEY_LEFT_SHIFT = 340, // Key: Shift left - KEY_LEFT_CONTROL = 341, // Key: Control left - KEY_LEFT_ALT = 342, // Key: Alt left - KEY_LEFT_SUPER = 343, // Key: Super left - KEY_RIGHT_SHIFT = 344, // Key: Shift right - KEY_RIGHT_CONTROL = 345, // Key: Control right - KEY_RIGHT_ALT = 346, // Key: Alt right - KEY_RIGHT_SUPER = 347, // Key: Super right - KEY_KB_MENU = 348, // Key: KB menu - // Keypad keys - KEY_KP_0 = 320, // Key: Keypad 0 - KEY_KP_1 = 321, // Key: Keypad 1 - KEY_KP_2 = 322, // Key: Keypad 2 - KEY_KP_3 = 323, // Key: Keypad 3 - KEY_KP_4 = 324, // Key: Keypad 4 - KEY_KP_5 = 325, // Key: Keypad 5 - KEY_KP_6 = 326, // Key: Keypad 6 - KEY_KP_7 = 327, // Key: Keypad 7 - KEY_KP_8 = 328, // Key: Keypad 8 - KEY_KP_9 = 329, // Key: Keypad 9 - KEY_KP_DECIMAL = 330, // Key: Keypad . - KEY_KP_DIVIDE = 331, // Key: Keypad / - KEY_KP_MULTIPLY = 332, // Key: Keypad * - KEY_KP_SUBTRACT = 333, // Key: Keypad - - KEY_KP_ADD = 334, // Key: Keypad + - KEY_KP_ENTER = 335, // Key: Keypad Enter - KEY_KP_EQUAL = 336, // Key: Keypad = - // Android key buttons - KEY_BACK = 4, // Key: Android back button - KEY_MENU = 82, // Key: Android menu button - KEY_VOLUME_UP = 24, // Key: Android volume up button - KEY_VOLUME_DOWN = 25 // Key: Android volume down button -} KeyboardKey; - -// Texture // - -int load_new_tex(const char* path); - -void draw_texture(int idx, int x, int y); - -void unload_tex(int idx); - -void unload_active_textures(void); - -// Shader // - -int load_new_shader(const char* path); - -void set_active_shader(int idx); - -void reset_active_shader(void); - -void unload_shader(int idx); - -void unload_active_shaders(void); - -// Text // - -void draw_text(const char* txt, int x, int y, int size, Color col); - -i32 load_font(const char* path); - -void draw_text_font(i32 idx, const char* text, vec2 pos, fx32 size, Color col); - -// Controller // - -b32 is_key_pressed(i32 btn); -b32 is_key_held(i32 btn); -b32 is_key_released(i32 btn); - -vec2 get_dir_input(void); - -void set_rumble(f32 duration, f32 strength); - -void stop_rumble(void); - -// Random // - -u32 rand_u32(void); - -int rand_range(i32 min, i32 max); - -// Audio // - -i32 load_audio(const char* path); - -void play_audio(i32 idx); - -void load_music(const char* path); - -void play_music(void); - -void set_music_loop(b32 loop); - -void set_music_loop_point(f32 point); diff --git a/assets/src/main.c b/assets/src/main.c deleted file mode 100644 index 0913641..0000000 --- a/assets/src/main.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "gunner.h" - -static int femme = -1; -static int grayscale = -1; -static int berry = -1; -static int night = -1; - -static vec2 position = (vec2){TO_FIXED(32), TO_FIXED(48)}; -static vec2 text_pos = (vec2){TO_FIXED(64), TO_FIXED(16)}; - -void init(void) -{ - femme = load_new_tex("assets/femme.png"); - grayscale = load_new_shader("assets/gs_full.glsl"); - berry = load_font("assets/berry-rotunda.fnt"); - - load_music("assets/wicked_glee.ogg"); - set_music_loop_point(15.73f); - - play_music(); -} - -void update(void) -{ - draw_text_font(berry, "Femme is a cute", text_pos, 24, BLACK); - - vec2 current_input = get_dir_input(); - if(current_input.x != 0 || current_input.y != 0){ - position.x += current_input.x; - position.y += current_input.y; - } - - set_active_shader(grayscale); - draw_texture(femme, FROM_FIXED(position.x), FROM_FIXED(position.y)); - reset_active_shader(); -} - -void exit(void) -{ - -}
\ No newline at end of file |
