You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 lines
2.0 KiB

[gd_scene load_steps=5 format=2]
[ext_resource path="res://Root.tscn" type="PackedScene" id=1]
[ext_resource path="res://scripts/gui/ViewportContainer.gd" type="Script" id=2]
[sub_resource type="Shader" id=1]
code = "shader_type canvas_item;
uniform bool player_is_swimming;
uniform float blur_amount : hint_range(0, 2);
void fragment() {
if (player_is_swimming){
vec3 col = texture(TEXTURE, UV).xyz * 0.15;
col += texture(TEXTURE, UV + vec2(SCREEN_PIXEL_SIZE.x, 0.0)).xyz * 0.15;
col += texture(TEXTURE, UV + vec2(-SCREEN_PIXEL_SIZE.x, 0.0)).xyz * 0.15;
col += texture(TEXTURE, UV + vec2(2.0 * SCREEN_PIXEL_SIZE.x * blur_amount, 0.0)).xyz * 0.12;
col += texture(TEXTURE, UV + vec2(2.0 * -SCREEN_PIXEL_SIZE.x * blur_amount, 0.0)).xyz * 0.12;
col += texture(TEXTURE, UV + vec2(3.0 * SCREEN_PIXEL_SIZE.x * blur_amount, 0.0)).xyz * 0.09;
col += texture(TEXTURE, UV + vec2(3.0 * -SCREEN_PIXEL_SIZE.x * blur_amount, 0.0)).xyz * 0.09;
col += texture(TEXTURE, UV + vec2(4.0 * SCREEN_PIXEL_SIZE.x * blur_amount, 0.0)).xyz * 0.05;
col += texture(TEXTURE, UV + vec2(4.0 * -SCREEN_PIXEL_SIZE.x * blur_amount, 0.0)).xyz * 0.05;
COLOR.xyz = col;
}
else {
COLOR.xyz = texture(TEXTURE, UV).xyz;
}
}
"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/player_is_swimming = null
shader_param/blur_amount = 5.0
[node name="Node2D" type="Node2D"]
[node name="ViewportContainer" type="ViewportContainer" parent="."]
material = SubResource( 2 )
margin_right = 1080.0
margin_bottom = 720.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
player_path = NodePath("Viewport/Root")
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
size = Vector2( 1080, 720 )
handle_input_locally = false
render_target_update_mode = 3
[node name="Root" parent="ViewportContainer/Viewport" instance=ExtResource( 1 )]