diff --git a/handheld/gameboy/gameboy.slangp b/handheld/gameboy/gameboy.slangp index 31be805..81b2452 100644 --- a/handheld/gameboy/gameboy.slangp +++ b/handheld/gameboy/gameboy.slangp @@ -30,9 +30,9 @@ scale_type4 = source scale4 = 1.0 alias4 = "PASS4" -//LUTs commented out until added to the spec -//textures = COLOR_PALETTE;BACKGROUND -//COLOR_PALETTE = resources/palette.png -//COLOR_PALETTE_linear = false -//BACKGROUND = resources/background.png -//BACKGROUND_linear = true \ No newline at end of file + +textures = COLOR_PALETTE;BACKGROUND +COLOR_PALETTE = resources/palette.png +COLOR_PALETTE_linear = false +BACKGROUND = resources/background.png +BACKGROUND_linear = true \ No newline at end of file diff --git a/handheld/gameboy/resources/background.png b/handheld/gameboy/resources/background.png new file mode 100644 index 0000000..adc116c Binary files /dev/null and b/handheld/gameboy/resources/background.png differ diff --git a/handheld/gameboy/resources/palette.png b/handheld/gameboy/resources/palette.png new file mode 100644 index 0000000..5be5091 Binary files /dev/null and b/handheld/gameboy/resources/palette.png differ diff --git a/handheld/gameboy/resources/sample-bgs/dmg-bg.png b/handheld/gameboy/resources/sample-bgs/dmg-bg.png new file mode 100644 index 0000000..4b63ad9 Binary files /dev/null and b/handheld/gameboy/resources/sample-bgs/dmg-bg.png differ diff --git a/handheld/gameboy/resources/sample-bgs/grainy-bg.png b/handheld/gameboy/resources/sample-bgs/grainy-bg.png new file mode 100644 index 0000000..f56b777 Binary files /dev/null and b/handheld/gameboy/resources/sample-bgs/grainy-bg.png differ diff --git a/handheld/gameboy/resources/sample-bgs/paper-bg.png b/handheld/gameboy/resources/sample-bgs/paper-bg.png new file mode 100644 index 0000000..5d9217a Binary files /dev/null and b/handheld/gameboy/resources/sample-bgs/paper-bg.png differ diff --git a/handheld/gameboy/resources/sample-palettes/b-w-palette.png b/handheld/gameboy/resources/sample-palettes/b-w-palette.png new file mode 100644 index 0000000..f509b82 Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/b-w-palette.png differ diff --git a/handheld/gameboy/resources/sample-palettes/dmg-palette-0.png b/handheld/gameboy/resources/sample-palettes/dmg-palette-0.png new file mode 100644 index 0000000..5be5091 Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/dmg-palette-0.png differ diff --git a/handheld/gameboy/resources/sample-palettes/dmg-palette-1.png b/handheld/gameboy/resources/sample-palettes/dmg-palette-1.png new file mode 100644 index 0000000..f735e2c Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/dmg-palette-1.png differ diff --git a/handheld/gameboy/resources/sample-palettes/dmg-palette-2.png b/handheld/gameboy/resources/sample-palettes/dmg-palette-2.png new file mode 100644 index 0000000..90becf3 Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/dmg-palette-2.png differ diff --git a/handheld/gameboy/resources/sample-palettes/gblight-palette-1.png b/handheld/gameboy/resources/sample-palettes/gblight-palette-1.png new file mode 100644 index 0000000..8d4c06d Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/gblight-palette-1.png differ diff --git a/handheld/gameboy/resources/sample-palettes/gblight-palette-2.png b/handheld/gameboy/resources/sample-palettes/gblight-palette-2.png new file mode 100644 index 0000000..91b3e40 Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/gblight-palette-2.png differ diff --git a/handheld/gameboy/resources/sample-palettes/gblight-palette-3.png b/handheld/gameboy/resources/sample-palettes/gblight-palette-3.png new file mode 100644 index 0000000..5f7641c Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/gblight-palette-3.png differ diff --git a/handheld/gameboy/resources/sample-palettes/gblight-palette.png b/handheld/gameboy/resources/sample-palettes/gblight-palette.png new file mode 100644 index 0000000..6480bf5 Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/gblight-palette.png differ diff --git a/handheld/gameboy/resources/sample-palettes/gbp-palette.png b/handheld/gameboy/resources/sample-palettes/gbp-palette.png new file mode 100644 index 0000000..b9dddfc Binary files /dev/null and b/handheld/gameboy/resources/sample-palettes/gbp-palette.png differ diff --git a/handheld/gameboy/shader-files/gb-pass0.slang b/handheld/gameboy/shader-files/gb-pass0.slang index 7c6a9a6..d42aa7b 100644 --- a/handheld/gameboy/shader-files/gb-pass0.slang +++ b/handheld/gameboy/shader-files/gb-pass0.slang @@ -97,12 +97,13 @@ layout(set = 0, binding = 6) uniform sampler2D OriginalHistory4; layout(set = 0, binding = 7) uniform sampler2D OriginalHistory5; layout(set = 0, binding = 8) uniform sampler2D OriginalHistory6; layout(set = 0, binding = 9) uniform sampler2D OriginalHistory7; +layout(set = 0, binding = 10) uniform sampler2D COLOR_PALETTE; //////////////////////////////////////////////////////////////////////////////// //fragment definitions // //////////////////////////////////////////////////////////////////////////////// -#define foreground_color vec3(0.11, 0.4141, 0.41) //tex2D(COLOR_PALETTE, fixed2(0.75, 0.5)).rgb //hardcoded to look up the foreground color from the right half of the palette image +#define foreground_color texture(COLOR_PALETTE, vec2(0.75, 0.5)).rgb //hardcoded to look up the foreground color from the right half of the palette image //#define rgb_to_alpha(rgb) ( ((rgb.r + rgb.g + rgb.b) / 3.0) + (is_on_dot * vec2(baseline_alpha), 1.0) ) //averages rgb values (allows it to work with color games), modified for contrast and base alpha @@ -144,7 +145,7 @@ void main() // Overlay the matrix // If the fragment is not on a dot, set its alpha value to 0 - out_color.a *= is_on_dot; + out_color.a *= is_on_dot; FragColor = out_color; } diff --git a/handheld/gameboy/shader-files/gb-pass4.slang b/handheld/gameboy/shader-files/gb-pass4.slang index 2c2f485..24a4fd6 100644 --- a/handheld/gameboy/shader-files/gb-pass4.slang +++ b/handheld/gameboy/shader-files/gb-pass4.slang @@ -93,9 +93,10 @@ layout(location = 1) in vec2 texel; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 1) uniform sampler2D Source; layout(set = 0, binding = 2) uniform sampler2D PassOutput1; +layout(set = 0, binding = 3) uniform sampler2D BACKGROUND; +layout(set = 0, binding = 4) uniform sampler2D COLOR_PALETTE; -//#define bg_color tex2D(COLOR_PALETTE, vec2(0.25, 0.5)) -#define bg_color vec4(0.625, 0.664, 0.25, 0.5) +#define bg_color texture(COLOR_PALETTE, vec2(0.25, 0.5)) // Sample the background color from the palette #define shadow_alpha (contrast * shadow_opacity) @@ -117,7 +118,7 @@ void main() // Sample all the relevant textures vec4 foreground = texture(PassOutput1, tex - screen_offset); - vec4 background = vec4(0.5); // Hardcoded value rather than LUT + vec4 background = texture(BACKGROUND, vTexCoord); vec4 shadows = texture(Source, vTexCoord - (shadow_offset + screen_offset)); vec4 background_color = bg_color;