added foreground tile outline shader, closes #11
This commit is contained in:
parent
9c9e6292f9
commit
aab5edd1ac
16 changed files with 141 additions and 646 deletions
26
src/foreground_outline.gdshader
Normal file
26
src/foreground_outline.gdshader
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform sampler2D screen_tex : hint_screen_texture, repeat_disable, filter_nearest;
|
||||||
|
uniform vec3 outline_color : source_color = vec3(1.0);
|
||||||
|
|
||||||
|
vec3 inv(vec3 x) {
|
||||||
|
return 1.0 - x;
|
||||||
|
}
|
||||||
|
vec3 screen(vec3 src, vec3 dst) {
|
||||||
|
return inv(inv(dst)*inv(src));
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
vec4 base = textureLod(screen_tex, SCREEN_UV, 0.0);
|
||||||
|
float alpha = base.a;
|
||||||
|
|
||||||
|
float min_alpha = 1.0;
|
||||||
|
min_alpha = min(min_alpha, texture(screen_tex, UV + vec2(1, 0) * SCREEN_PIXEL_SIZE).a);
|
||||||
|
min_alpha = min(min_alpha, texture(screen_tex, UV - vec2(1, 0) * SCREEN_PIXEL_SIZE).a);
|
||||||
|
min_alpha = min(min_alpha, texture(screen_tex, UV + vec2(0, 1) * SCREEN_PIXEL_SIZE).a);
|
||||||
|
min_alpha = min(min_alpha, texture(screen_tex, UV - vec2(0, 1) * SCREEN_PIXEL_SIZE).a);
|
||||||
|
|
||||||
|
float edge = clamp(alpha - min_alpha, 0.0, 1.0);
|
||||||
|
vec3 blended = screen(outline_color.rgb, base.rgb);
|
||||||
|
COLOR = mix(base, vec4(blended, 1.0), edge);
|
||||||
|
}
|
||||||
1
src/foreground_outline.gdshader.uid
Normal file
1
src/foreground_outline.gdshader.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cvuaiyxntwd88
|
||||||
593
src/game.tscn
593
src/game.tscn
File diff suppressed because one or more lines are too long
22
src/level/LayeredSubViewport.cs
Normal file
22
src/level/LayeredSubViewport.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
namespace Dancer;
|
||||||
|
|
||||||
|
[Meta(typeof(IAutoNode))]
|
||||||
|
public sealed partial class LayeredSubViewport : SubViewport
|
||||||
|
{
|
||||||
|
public override void _Notification(int what) => this.Notify(what);
|
||||||
|
|
||||||
|
[Export] public Camera2D Camera2D { get; set; } = null!;
|
||||||
|
|
||||||
|
public void OnReady()
|
||||||
|
{
|
||||||
|
World2D = GetTree().Root.GetViewport().World2D;
|
||||||
|
GetTree().Root.GetViewport().CanvasCullMask = 1;
|
||||||
|
SetProcess(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnProcess(double delta)
|
||||||
|
{
|
||||||
|
Camera2D.GlobalTransform = GetTree().Root.GetViewport().GetCamera2D().GlobalTransform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
1
src/level/LayeredSubViewport.cs.uid
Normal file
1
src/level/LayeredSubViewport.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://duwojyl38rkj0
|
||||||
BIN
src/level/background.aseprite
(Stored with Git LFS)
BIN
src/level/background.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
src/level/background.png
(Stored with Git LFS)
BIN
src/level/background.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,40 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://bmvc4miepnt6k"
|
|
||||||
path="res://.godot/imported/background.png-c41bc3daef360252b8a97f2a85cbe353.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://src/level/background.png"
|
|
||||||
dest_files=["res://.godot/imported/background.png-c41bc3daef360252b8a97f2a85cbe353.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
compress/hdr_compression=1
|
|
||||||
compress/normal_map=0
|
|
||||||
compress/channel_pack=0
|
|
||||||
mipmaps/generate=false
|
|
||||||
mipmaps/limit=-1
|
|
||||||
roughness/mode=0
|
|
||||||
roughness/src_normal=""
|
|
||||||
process/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
process/hdr_as_srgb=false
|
|
||||||
process/hdr_clamp_exposure=false
|
|
||||||
process/size_limit=0
|
|
||||||
detect_3d/compress_to=1
|
|
||||||
BIN
src/level/dirt.png
(Stored with Git LFS)
BIN
src/level/dirt.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,40 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://mkupo0sms46y"
|
|
||||||
path="res://.godot/imported/dirt.png-b64c717b8755d98a2d7af560a353c514.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://src/level/dirt.png"
|
|
||||||
dest_files=["res://.godot/imported/dirt.png-b64c717b8755d98a2d7af560a353c514.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
compress/hdr_compression=1
|
|
||||||
compress/normal_map=0
|
|
||||||
compress/channel_pack=0
|
|
||||||
mipmaps/generate=false
|
|
||||||
mipmaps/limit=-1
|
|
||||||
roughness/mode=0
|
|
||||||
roughness/src_normal=""
|
|
||||||
process/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
process/hdr_as_srgb=false
|
|
||||||
process/hdr_clamp_exposure=false
|
|
||||||
process/size_limit=0
|
|
||||||
detect_3d/compress_to=1
|
|
||||||
BIN
src/level/dirt_minitiles.aseprite
(Stored with Git LFS)
BIN
src/level/dirt_minitiles.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
src/level/dirt_minitiles.png
(Stored with Git LFS)
BIN
src/level/dirt_minitiles.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,40 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://bt6hgi1t1h0em"
|
|
||||||
path="res://.godot/imported/dirt_minitiles.png-43423e929cf074feea05d5c147e0e2a2.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://src/level/dirt_minitiles.png"
|
|
||||||
dest_files=["res://.godot/imported/dirt_minitiles.png-43423e929cf074feea05d5c147e0e2a2.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
compress/hdr_compression=1
|
|
||||||
compress/normal_map=0
|
|
||||||
compress/channel_pack=0
|
|
||||||
mipmaps/generate=false
|
|
||||||
mipmaps/limit=-1
|
|
||||||
roughness/mode=0
|
|
||||||
roughness/src_normal=""
|
|
||||||
process/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
process/fix_alpha_border=true
|
|
||||||
process/premult_alpha=false
|
|
||||||
process/normal_map_invert_y=false
|
|
||||||
process/hdr_as_srgb=false
|
|
||||||
process/hdr_clamp_exposure=false
|
|
||||||
process/size_limit=0
|
|
||||||
detect_3d/compress_to=1
|
|
||||||
BIN
src/level/tiles.aseprite
(Stored with Git LFS)
BIN
src/level/tiles.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
src/level/tiles.png
(Stored with Git LFS)
BIN
src/level/tiles.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -375,6 +375,7 @@ shape = SubResource("RectangleShape2D_jiejy")
|
||||||
position = Vector2(0, -16)
|
position = Vector2(0, -16)
|
||||||
process_callback = 0
|
process_callback = 0
|
||||||
limit_enabled = false
|
limit_enabled = false
|
||||||
|
editor_draw_screen = false
|
||||||
|
|
||||||
[node name="Body" type="Sprite2D" parent="." unique_id=567060128]
|
[node name="Body" type="Sprite2D" parent="." unique_id=567060128]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue