86 lines
299 KiB
Plaintext
86 lines
299 KiB
Plaintext
|
[gd_scene load_steps=6 format=2]
|
||
|
|
||
|
[ext_resource path="res://BackgroundWater.gd" type="Script" id=1]
|
||
|
|
||
|
[sub_resource type="Shader" id=3]
|
||
|
code = "shader_type canvas_item;
|
||
|
|
||
|
uniform vec4 shadow_color : hint_color;
|
||
|
|
||
|
uniform vec2 uv_offset = vec2(0, 0.);
|
||
|
|
||
|
uniform float tile_factor = 1.0;
|
||
|
uniform float aspect_ratio = 1.0;
|
||
|
|
||
|
uniform sampler2D texture_offset_uv : hint_black;
|
||
|
uniform vec2 texture_offset_scale = vec2(0.2, 0.2);
|
||
|
uniform float texture_offset_height = 0.1;
|
||
|
|
||
|
uniform float texture_offset_time_scale = 0.5;
|
||
|
|
||
|
uniform float sine_time_scale = 0.8;
|
||
|
uniform vec2 sine_offset_scale = vec2(0.4, 0.4);
|
||
|
uniform float sine_wave_size = 0.09;
|
||
|
|
||
|
|
||
|
void fragment() {
|
||
|
vec2 base_uv_offset = (UV + uv_offset) * texture_offset_scale;
|
||
|
base_uv_offset += TIME * texture_offset_time_scale;
|
||
|
|
||
|
vec2 offset_texture_uv = texture(texture_offset_uv, base_uv_offset).rg;
|
||
|
vec2 offset_texture_uv_with_height = offset_texture_uv * texture_offset_height;
|
||
|
vec2 texture_based_offset = offset_texture_uv_with_height * 2.0 - 1.0;
|
||
|
|
||
|
vec2 adjusted_uv = (UV + uv_offset) * tile_factor;
|
||
|
adjusted_uv.y *= aspect_ratio;
|
||
|
adjusted_uv += texture_based_offset;
|
||
|
|
||
|
adjusted_uv.x += sin(TIME * sine_time_scale + (adjusted_uv.x + adjusted_uv.y) * sine_offset_scale.x) * sine_wave_size;
|
||
|
adjusted_uv.y += cos(TIME * sine_time_scale + (adjusted_uv.x + adjusted_uv.y) * sine_offset_scale.y) * sine_wave_size;
|
||
|
|
||
|
float sine_wave_height = sin(TIME * sine_time_scale + (adjusted_uv.x + adjusted_uv.y) * sine_offset_scale.y);
|
||
|
float water_height = ( sine_wave_height + offset_texture_uv.g ) * 0.5;
|
||
|
|
||
|
// COLOR = vec4(vec2(offset_texture_uv), 0.0, 1.0);
|
||
|
COLOR = mix(texture(TEXTURE, adjusted_uv), shadow_color, water_height * 0.4);
|
||
|
// COLOR = vec4(vec2(adjusted_uv), 0.0, 1.0);
|
||
|
NORMALMAP = texture(NORMAL_TEXTURE, adjusted_uv / 5.0).rgb;
|
||
|
// COLOR = texture(NORMAL_TEXTURE, adjusted_uv / 5.0);
|
||
|
}"
|
||
|
|
||
|
[sub_resource type="ShaderMaterial" id=4]
|
||
|
shader = SubResource( 3 )
|
||
|
shader_param/shadow_color = null
|
||
|
shader_param/uv_offset = Vector2( 0, 0 )
|
||
|
shader_param/tile_factor = 1.0
|
||
|
shader_param/aspect_ratio = 1.0
|
||
|
shader_param/texture_offset_scale = Vector2( 0.2, 0.2 )
|
||
|
shader_param/texture_offset_height = 0.1
|
||
|
shader_param/texture_offset_time_scale = 0.5
|
||
|
shader_param/sine_time_scale = 0.8
|
||
|
shader_param/sine_offset_scale = Vector2( 0.4, 0.4 )
|
||
|
shader_param/sine_wave_size = 0.09
|
||
|
|
||
|
[sub_resource type="Image" id=5]
|
||
|
data = {
|
||
|
"data": PoolByteArray( 15, 93, 203, 255, 14, 92, 201, 255, 13, 91, 200, 255, 12, 90, 199, 255, 11, 89, 198, 255, 11, 89, 198, 255, 11, 89, 197, 255, 11, 89, 197, 255, 17, 93, 199, 255, 106, 154, 221, 255, 156, 189, 237, 255, 152, 186, 232, 255, 153, 186, 233, 255, 146, 181, 229, 255, 100, 144, 209, 255, 82, 132, 202, 255, 46, 110, 199, 255, 19, 90, 190, 255, 32, 93, 180, 255, 38, 96, 177, 255, 42, 100, 181, 255, 46, 105, 187, 255, 53, 112, 195, 255, 60, 120, 205, 255, 68, 129, 215, 255, 76, 139, 225, 255, 84, 147, 234, 255, 89, 153, 241, 255, 92, 156, 245, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 94, 157, 245, 255, 94, 156, 243, 255, 96, 156, 240, 255, 97, 155, 236, 255, 99, 154, 231, 255, 98, 150, 222, 255, 93, 142, 210, 255, 82, 129, 195, 255, 69, 115, 181, 255, 55, 103, 170, 255, 46, 94, 162, 255, 41, 90, 159, 255, 41, 90, 158, 255, 42, 90, 157, 255, 42, 89, 157, 255, 42, 89, 156, 255, 42, 89, 156, 255, 42, 89, 156, 255, 42, 89, 156, 255, 42, 89, 156, 255, 42, 89, 156, 255, 42, 89, 156, 255, 42, 89, 156, 255, 42, 89, 155, 255, 40, 89, 158, 255, 25, 89, 177, 255, 13, 88, 193, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 56, 118, 205, 255, 130, 169, 225, 255, 152, 185, 232, 255, 156, 186, 229, 255, 157, 185, 227, 255, 160, 189, 231, 255, 108, 147, 203, 255, 38, 93, 170, 255, 36, 92, 171, 255, 36, 93, 173, 255, 40, 97, 178, 255, 48, 106, 189, 255, 59, 119, 204, 255, 72, 133, 219, 255, 83, 146, 233, 255, 90, 154, 243, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 92, 157, 246, 255, 84, 150, 242, 255, 62, 132, 230, 255, 36, 112, 217, 255, 22, 100, 210, 255, 20, 99, 209, 255, 20, 98, 208, 255, 19, 98, 207, 255, 18, 96, 206, 255, 16, 95, 204, 255, 13, 92, 201, 255, 12, 91, 199, 255, 11, 90, 198, 255, 11, 89, 198, 255, 11, 89, 197, 255, 11, 89, 197, 255, 11, 89, 197, 255, 11, 89, 197, 255, 11, 89, 197, 255, 39, 108, 204, 255, 135, 173, 228, 255, 155, 189, 235, 255, 152, 185, 232, 255, 154, 186, 233, 255, 125, 165, 220, 255, 86, 135, 205, 255, 73, 126, 200, 255, 24, 96, 195, 255, 23, 91, 185, 255, 34, 93, 176, 255, 37, 94, 175, 255, 40, 97, 179, 255, 45, 103, 185, 255, 51, 110, 193, 255, 59, 119, 204, 255, 68, 129, 215, 255, 77, 139, 226, 255, 85, 148, 235, 255, 90, 154, 242, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 93, 157, 246, 255, 94, 157, 244, 255, 95, 156, 242, 255, 96, 156, 240, 255, 97, 155, 236, 255, 99, 154, 231, 255, 98, 150, 224, 255, 92, 142, 211, 255, 81, 130, 197, 255, 69, 116, 183, 255, 56, 104, 172, 255, 46, 95, 164, 255, 41, 91, 161, 255, 41, 90, 160, 255, 41, 90, 159, 255, 41, 90, 159, 255, 41, 90, 159, 255, 41, 90, 159, 255, 41, 90, 159, 255, 41, 90, 160, 255, 41, 90, 160, 255, 41, 90, 160, 255, 41, 90, 159, 255, 41, 90, 159, 255, 41, 90, 159, 255, 38, 90, 162, 255, 23, 89, 180, 255, 13, 88, 194, 255, 12, 88, 195, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 194, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 12, 88, 193, 255, 104, 152, 219, 255, 158, 191, 238, 255, 154, 186, 231, 255, 156, 186
|
||
|
"format": "RGBA8",
|
||
|
"height": 128,
|
||
|
"mipmaps": false,
|
||
|
"width": 128
|
||
|
}
|
||
|
|
||
|
[sub_resource type="ImageTexture" id=2]
|
||
|
image = SubResource( 5 )
|
||
|
size = Vector2( 128, 128 )
|
||
|
|
||
|
[node name="BackgroundWater" type="Sprite"]
|
||
|
material = SubResource( 4 )
|
||
|
rotation = 0.00356766
|
||
|
z_index = -1
|
||
|
texture = SubResource( 2 )
|
||
|
region_enabled = true
|
||
|
region_rect = Rect2( 0, 0, 2048, 1024 )
|
||
|
script = ExtResource( 1 )
|
||
|
world_offset = Vector2( 40, 0 )
|