update shader water, update animation

This commit is contained in:
AleaJactaEst 2023-04-11 00:12:51 +02:00
parent 37a765601c
commit 4b91fee1be
10 changed files with 154 additions and 141 deletions

View file

@ -136,6 +136,7 @@ node_connections = [&"output", 0, &"FB", &"FB", 0, &"Forward", &"FB", 1, &"Backw
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_wnbtw"]
xfade_time = 0.2
switch_mode = 2
advance_mode = 2
advance_condition = &"idle"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rvsaa"]
@ -209,10 +210,10 @@ states/Stopping/position = Vector2(505, 327)
states/Walk/node = SubResource("AnimationNodeBlendTree_8bvke")
states/Walk/position = Vector2(216.227, 134)
transitions = ["Stopping", "Idle", SubResource("AnimationNodeStateMachineTransition_wnbtw"), "Run", "Stopping", SubResource("AnimationNodeStateMachineTransition_rvsaa"), "Idle", "Run", SubResource("AnimationNodeStateMachineTransition_s0egl"), "Start", "Idle", SubResource("AnimationNodeStateMachineTransition_xf5i1"), "Idle", "Walk", SubResource("AnimationNodeStateMachineTransition_nbs2g"), "Walk", "Stopping", SubResource("AnimationNodeStateMachineTransition_rs3n0"), "Walk", "Jog", SubResource("AnimationNodeStateMachineTransition_6gab4"), "Jog", "Walk", SubResource("AnimationNodeStateMachineTransition_6m5a2"), "Run", "Jog", SubResource("AnimationNodeStateMachineTransition_hy2h2"), "Jog", "Run", SubResource("AnimationNodeStateMachineTransition_2tyel"), "Jog", "Stopping", SubResource("AnimationNodeStateMachineTransition_7h1qf"), "Idle", "Jog", SubResource("AnimationNodeStateMachineTransition_4twgu")]
graph_offset = Vector2(-96.7391, 96.49)
graph_offset = Vector2(-96.7391, 35.1602)
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_512i8"]
graph_offset = Vector2(-407.883, 86.6913)
graph_offset = Vector2(-419.985, 66.7194)
nodes/crouch/node = SubResource("AnimationNodeTransition_ap4r3")
nodes/crouch/position = Vector2(100, 180)
nodes/crouching/node = SubResource("AnimationNodeStateMachine_w0g24")
@ -223,7 +224,7 @@ node_connections = [&"output", 0, &"crouch", &"crouch", 0, &"standing", &"crouch
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_j336j"]
resource_local_to_scene = true
graph_offset = Vector2(239.774, 470)
graph_offset = Vector2(488.435, 1346.72)
nodes/AnimTurnLeft/node = SubResource("AnimationNodeAnimation_twcy5")
nodes/AnimTurnLeft/position = Vector2(500, 1540)
nodes/AnimTurnRight/node = SubResource("AnimationNodeAnimation_a2hmg")
@ -267,6 +268,12 @@ parameters/VelocityDirection/crouch/current_state = "crouch"
parameters/VelocityDirection/crouch/current_index = 1
parameters/VelocityDirection/crouching/playback = SubResource("AnimationNodeStateMachinePlayback_tgni3")
parameters/VelocityDirection/standing/playback = SubResource("AnimationNodeStateMachinePlayback_44upy")
parameters/VelocityDirection/standing/Jog/FB/current_state = "Forward"
parameters/VelocityDirection/standing/Jog/FB/transition_request = ""
parameters/VelocityDirection/standing/Jog/FB/current_index = 0
parameters/VelocityDirection/standing/Walk/FB/current_state = "Forward"
parameters/VelocityDirection/standing/Walk/FB/transition_request = ""
parameters/VelocityDirection/standing/Walk/FB/current_index = 0
[node name="CameraComponent" parent="." index="3"]
networking_path = NodePath("../Networking")
@ -278,59 +285,59 @@ character_movement_component = NodePath("../CharacterMovementComponent")
shape = SubResource("CapsuleShape3D_ied37")
[node name="Skeleton3D" parent="Armature" index="0"]
bones/0/position = Vector3(-0.000172998, 0.901879, -0.00179914)
bones/0/rotation = Quaternion(0.0129103, -0.477019, 0.0128396, 0.878704)
bones/1/rotation = Quaternion(-0.034878, 0.0121777, 0.00603897, 0.999299)
bones/2/rotation = Quaternion(0.00771038, 0.00387442, 0.0077534, 0.999933)
bones/3/rotation = Quaternion(0.0679804, 0.00466348, 0.00750769, 0.997648)
bones/4/rotation = Quaternion(0.259049, 0.120367, -0.0335045, 0.957749)
bones/5/rotation = Quaternion(-0.00246286, 0.223138, -0.172693, 0.959365)
bones/9/rotation = Quaternion(-0.465919, -0.528453, 0.588414, -0.396769)
bones/10/rotation = Quaternion(0.520746, -0.203354, 0.188978, 0.807315)
bones/11/rotation = Quaternion(9.19054e-05, 0.0274316, 0.655564, 0.754641)
bones/12/rotation = Quaternion(-0.0908578, 0.331043, 0.131266, 0.930013)
bones/13/rotation = Quaternion(0.68532, -6.03681e-05, -0.0820378, 0.723606)
bones/14/rotation = Quaternion(0.816783, -0.000611766, -0.0982718, 0.568513)
bones/15/rotation = Quaternion(0.818243, 0.00110579, -0.0972425, 0.566587)
bones/17/rotation = Quaternion(0.217917, 0.0898311, 0.175515, 0.955844)
bones/18/rotation = Quaternion(0.111987, -0.158249, -0.280048, 0.940207)
bones/19/rotation = Quaternion(-0.0215223, -0.07977, -0.565562, 0.820556)
bones/21/rotation = Quaternion(0.680469, 0.00849827, -0.0898124, 0.727203)
bones/22/rotation = Quaternion(0.845186, -0.00222601, -0.10257, 0.524533)
bones/23/rotation = Quaternion(0.811299, 0.00123152, -0.096296, 0.576645)
bones/25/rotation = Quaternion(0.70653, -0.0227113, -0.0611423, 0.704671)
bones/26/rotation = Quaternion(0.796127, -0.00109192, -0.096178, 0.597436)
bones/27/rotation = Quaternion(0.787005, 0.00064355, -0.0937785, 0.609778)
bones/29/rotation = Quaternion(0.734984, -0.0394802, -0.050487, 0.675049)
bones/30/rotation = Quaternion(0.753528, 0.0265116, -0.0681514, 0.653336)
bones/31/rotation = Quaternion(0.882855, 0.000936385, -0.105273, 0.457695)
bones/33/rotation = Quaternion(0.502236, -0.498063, 0.599458, 0.374623)
bones/34/rotation = Quaternion(0.370554, -0.0482472, -0.469022, 0.800238)
bones/35/rotation = Quaternion(0.000238858, -0.0366692, -0.862701, 0.504384)
bones/36/rotation = Quaternion(-0.113264, 0.1314, -0.0768276, 0.981836)
bones/37/rotation = Quaternion(0.685333, 6.17094e-05, 0.0827409, 0.723514)
bones/38/rotation = Quaternion(0.81459, 0.000966602, 0.0990885, 0.571511)
bones/39/rotation = Quaternion(0.821818, -0.0017916, 0.0979961, 0.561256)
bones/41/rotation = Quaternion(0.258103, -0.0464722, -0.166247, 0.950571)
bones/42/rotation = Quaternion(0.0971873, -0.0337892, 0.319316, 0.942046)
bones/43/rotation = Quaternion(0.102353, 0.051128, 0.496662, 0.86037)
bones/45/rotation = Quaternion(0.68078, -0.0190739, 0.101264, 0.725204)
bones/46/rotation = Quaternion(0.853091, 0.000644792, 0.103455, 0.511402)
bones/47/rotation = Quaternion(0.803307, 7.36886e-05, 0.0971108, 0.587595)
bones/49/rotation = Quaternion(0.723188, 0.0327217, 0.0549051, 0.687687)
bones/50/rotation = Quaternion(0.758867, 0.00171341, 0.0930925, 0.644555)
bones/51/rotation = Quaternion(0.799428, -0.002656, 0.0944829, 0.59328)
bones/53/rotation = Quaternion(0.738816, 0.0655906, 0.0273769, 0.670149)
bones/54/rotation = Quaternion(0.747741, 0.00140453, 0.0915433, 0.657648)
bones/55/rotation = Quaternion(0.885414, -0.00156687, 0.10615, 0.452518)
bones/57/rotation = Quaternion(-0.126738, 0.140515, 0.969622, 0.155006)
bones/58/rotation = Quaternion(-0.378447, -0.0320807, -0.00808686, 0.925032)
bones/59/rotation = Quaternion(0.629739, 0.0424758, 0.115003, 0.767072)
bones/60/rotation = Quaternion(0.340454, 0.0167316, 0.00602515, 0.940093)
bones/62/rotation = Quaternion(0.156635, 0.280779, 0.931659, -0.169234)
bones/63/rotation = Quaternion(-0.307456, 0.043324, -0.0155887, 0.950448)
bones/64/rotation = Quaternion(0.442158, -0.046071, -0.0947431, 0.890729)
bones/65/rotation = Quaternion(0.352065, -0.016805, -0.00581727, 0.935807)
bones/0/position = Vector3(0.00286752, 0.931133, 0.0021665)
bones/0/rotation = Quaternion(-0.0407676, -0.37142, -0.0154171, 0.927441)
bones/1/rotation = Quaternion(-0.0132617, 0.0404789, -0.00542303, 0.999078)
bones/2/rotation = Quaternion(0.0943702, 0.0821296, -0.0072563, 0.992117)
bones/3/rotation = Quaternion(0.154061, 0.0815378, -0.012218, 0.984615)
bones/4/rotation = Quaternion(0.129425, -0.00964817, 0.00331386, 0.991536)
bones/5/rotation = Quaternion(-0.0487468, 0.170424, -0.0568101, 0.982523)
bones/9/rotation = Quaternion(0.475678, 0.533875, -0.570408, 0.404157)
bones/10/rotation = Quaternion(0.532933, -0.0741989, 0.14547, 0.83025)
bones/11/rotation = Quaternion(-0.00751253, 0.0998335, 0.451269, 0.886754)
bones/12/rotation = Quaternion(-0.153289, 0.123277, -0.00593906, 0.980444)
bones/13/rotation = Quaternion(0.136229, 0.00290555, -0.0698596, 0.988207)
bones/14/rotation = Quaternion(0.201943, -0.00139866, 0.0156955, 0.97927)
bones/15/rotation = Quaternion(-2.23524e-08, -1.54721e-07, 7.9803e-06, 1)
bones/17/rotation = Quaternion(0.284136, 0.115516, 0.18164, 0.934307)
bones/18/rotation = Quaternion(-0.00754712, 0.00079939, -0.000678675, 0.999971)
bones/19/rotation = Quaternion(-6.10946e-07, -5.2211e-06, -9.82261e-06, 1)
bones/21/rotation = Quaternion(0.0385101, -0.00503401, 0.0620579, 0.997316)
bones/22/rotation = Quaternion(0.152149, -0.000944763, -0.00571419, 0.98834)
bones/23/rotation = Quaternion(1.94206e-06, -1.96826e-06, -1.6247e-07, 1)
bones/25/rotation = Quaternion(0.276139, -0.0192624, -0.115281, 0.953984)
bones/26/rotation = Quaternion(0.287932, 0.00177289, 0.0251145, 0.95732)
bones/27/rotation = Quaternion(-5.58815e-09, -1.08033e-07, 3.06809e-06, 1)
bones/29/rotation = Quaternion(0.302339, -0.0207995, -0.148822, 0.941281)
bones/30/rotation = Quaternion(0.348689, 0.0117877, 0.0500265, 0.935828)
bones/31/rotation = Quaternion(1.99945e-06, -2.02538e-06, 9.9316e-06, 1)
bones/33/rotation = Quaternion(0.52653, -0.494906, 0.538598, 0.433297)
bones/34/rotation = Quaternion(0.514478, 0.0830848, 0.0769871, 0.84999)
bones/35/rotation = Quaternion(0.0622515, -0.0620934, -0.431416, 0.897858)
bones/36/rotation = Quaternion(0.110966, -0.00639391, -0.0504766, 0.992521)
bones/37/rotation = Quaternion(0.111086, 0.00854173, 0.0245615, 0.993471)
bones/38/rotation = Quaternion(0.309928, 0.00171618, -0.021322, 0.950519)
bones/39/rotation = Quaternion(-2.79586e-09, 3.36491e-08, -7.53691e-06, 1)
bones/41/rotation = Quaternion(0.203046, 0.0246648, -0.228941, 0.951709)
bones/42/rotation = Quaternion(0.00561814, 0.00161676, 0.180932, 0.983478)
bones/43/rotation = Quaternion(1.68663e-06, 4.45363e-06, 1.01891e-05, 1)
bones/45/rotation = Quaternion(0.0385272, 0.00975336, 0.0105134, 0.999155)
bones/46/rotation = Quaternion(0.147211, 0.000197627, 0.00967613, 0.989058)
bones/47/rotation = Quaternion(-1.92115e-07, -1.9491e-07, 2.67951e-07, 1)
bones/49/rotation = Quaternion(0.211278, -0.0064634, 0.0649752, 0.975243)
bones/50/rotation = Quaternion(0.343467, -0.00251803, -0.036149, 0.938465)
bones/51/rotation = Quaternion(-3.51451e-06, -3.27981e-06, -3.25159e-06, 1)
bones/53/rotation = Quaternion(0.207037, -0.0111315, 0.0919152, 0.973942)
bones/54/rotation = Quaternion(0.372181, -0.0132523, -0.070539, 0.925381)
bones/55/rotation = Quaternion(-5.59105e-09, -1.15109e-14, -1.09178e-05, 1)
bones/57/rotation = Quaternion(-0.12559, 0.00681877, 0.983203, 0.13226)
bones/58/rotation = Quaternion(-0.285334, 0.069074, -0.0173783, 0.955778)
bones/59/rotation = Quaternion(0.591416, 0.0619472, 0.11457, 0.795779)
bones/60/rotation = Quaternion(0.353628, 0.0202899, 0.0040719, 0.935157)
bones/62/rotation = Quaternion(-0.0793266, -0.207014, -0.9696, 0.103574)
bones/63/rotation = Quaternion(-0.310959, 0.117688, -0.0372882, 0.942371)
bones/64/rotation = Quaternion(0.491708, -0.0209777, -0.0377644, 0.869687)
bones/65/rotation = Quaternion(0.35992, -0.000617787, -0.0302186, 0.932493)
[node name="flashlight" parent="Armature" index="1" instance=ExtResource("5_euvsl")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.12407, 0.156779)

View file

@ -2,6 +2,8 @@ extends AnimationTree
class_name AnimBlend
@onready @export var movement_script : CharacterMovementComponent # I use this to get variables from main movement script
var count:int=0
func _physics_process(_delta):
if !movement_script:
return
@ -25,6 +27,13 @@ func _physics_process(_delta):
set("parameters/VelocityDirection/crouch/transition_request" , "crouch")
#standing
print("-------")
print(movement_script.gait == Global.gait.walking)
print(movement_script.input_is_moving)
if movement_script.gait == Global.gait.walking and movement_script.input_is_moving:
count +=1
if count > 100:
print("Debug")
set("parameters/VelocityDirection/standing/conditions/idle",!movement_script.input_is_moving)
set("parameters/VelocityDirection/standing/conditions/walking",movement_script.gait == Global.gait.walking and movement_script.input_is_moving)
set("parameters/VelocityDirection/standing/conditions/running",movement_script.gait == Global.gait.running and movement_script.input_is_moving)

View file

@ -606,10 +606,13 @@ func ik_look_at(position: Vector3):
var PrevVelocity :Vector3
func add_movement_input(direction: Vector3, Speed: float , Acceleration: float) -> void:
print("add_movement_input")
if is_flying == false:
print("add_movement_input no is_flying")
character_node.velocity.x = lerp(character_node.velocity.x, direction.x * Speed, Acceleration * get_physics_process_delta_time())
character_node.velocity.z = lerp(character_node.velocity.z, direction.z * Speed, Acceleration * get_physics_process_delta_time())
else:
print("add_movement_input is_flying")
character_node.set_velocity(character_node.get_velocity().lerp(direction * Speed, Acceleration * get_physics_process_delta_time()))
character_node.move_and_slide()
input_velocity = Speed * direction
@ -623,6 +626,7 @@ func add_movement_input(direction: Vector3, Speed: float , Acceleration: float)
actual_velocity = character_node.velocity
#tiltCharacterMesh
if tilt == true:
print("add_movement_input tilt")
var MovementDirectionRelativeToCamera = input_velocity.normalized().rotated(Vector3.UP,-camera_root.HObject.transform.basis.get_euler().y)
var IsMovingBackwardRelativeToCamera = false if input_velocity.rotated(Vector3.UP,-camera_root.HObject.transform.basis.get_euler().y).z >= -0.1 else true
if IsMovingBackwardRelativeToCamera:

File diff suppressed because one or more lines are too long

View file

@ -1,27 +1,22 @@
/*
Shader from https://godotshaders.com/shader/realistic-water/
Modified to work with Godot 3.4
Realistic Water Shader for Godot 4
Realistic Water Shader for GODOT 3.1.1
Modified to work with Godot 3.4 with thanks to jmarceno.
Copyright (c) 2019 UnionBytes, Achim Menzel (alias AiYori)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-- UnionBytes
-- YouTube: www.youtube.com/user/UnionBytes
*/
// For this shader min. GODOT 3.1.1 is required, because 3.1 has a depth buffer bug!
shader_type spatial;
render_mode cull_back,diffuse_burley,specular_schlick_ggx, blend_mix;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
// Wave settings:
uniform float wave_speed = 0.5; // Speed scale for the waves
@ -30,30 +25,30 @@ uniform vec4 wave_b = vec4(1.0, 0.6, 0.30, 1.55); // xy = Direction, z = Stee
uniform vec4 wave_c = vec4(1.0, 1.3, 0.25, 0.9); // xy = Direction, z = Steepness, w = Length
// Surface settings:
uniform vec2 sampler_scale = vec2(0.25, 0.25); // Scale for the sampler
uniform vec2 sampler_direction= vec2(0.05, 0.04); // Direction and speed for the sampler offset
uniform vec2 sampler_scale = vec2(0.25, 0.25); // Scale for the sampler
uniform vec2 sampler_direction= vec2(0.05, 0.04); // Direction and speed for the sampler offset
uniform sampler2D uv_sampler : hint_anisotropy; // UV motion sampler for shifting the normalmap
uniform vec2 uv_sampler_scale = vec2(0.25, 0.25); // UV sampler scale
uniform float uv_sampler_strength = 0.04; // UV shifting strength
uniform sampler2D uv_sampler : hint_anisotropy; // UV motion sampler for shifting the normalmap
uniform vec2 uv_sampler_scale = vec2(0.25, 0.25); // UV sampler scale
uniform float uv_sampler_strength = 0.04; // UV shifting strength
uniform sampler2D normalmap_a_sampler : hint_normal; // Normalmap sampler A
uniform sampler2D normalmap_b_sampler : hint_normal; // Normalmap sampler B
uniform sampler2D normalmap_a_sampler : hint_normal; // Normalmap sampler A
uniform sampler2D normalmap_b_sampler : hint_normal; // Normalmap sampler B
uniform sampler2D foam_sampler : hint_default_black; // Foam sampler
uniform float foam_level = 0.5; // Foam level -> distance from the object (0.0 - 0.5)
uniform sampler2D foam_sampler : hint_default_black; // Foam sampler
uniform float foam_level = 0.5; // Foam level -> distance from the object (0.0 - 0.5)
// Volume settings:
uniform float refraction = 0.075; // Refraction of the water
uniform float refraction = 0.075; // Refraction of the water
uniform vec4 color_deep : source_color; // Color for deep places in the water, medium to dark blue
uniform vec4 color_shallow : source_color; // Color for lower places in the water, bright blue - green
uniform float beers_law = 2.0; // Beers law value, regulates the blending size to the deep water level
uniform float depth_offset = -0.75; // Offset for the blending
uniform vec4 color_deep : source_color; // Color for deep places in the water, medium to dark blue
uniform vec4 color_shallow : source_color; // Color for lower places in the water, bright blue - green
uniform float beers_law = 2.0; // Beers law value, regulates the blending size to the deep water level
uniform float depth_offset = -0.75; // Offset for the blending
// Projector for the water caustics:
uniform mat4 projector; // Projector matrix, mostly the matric of the sun / directlight
uniform sampler2DArray caustic_sampler : hint_default_black; // Caustic sampler, (Texture array with 16 Textures for the animation)
uniform mat4 projector; // Projector matrix, mostly the matric of the sun / directlight
uniform sampler2DArray caustic_sampler : hint_default_black; // Caustic sampler, (Texture array with 16 Textures for the animation)
// Vertex -> Fragment:
@ -64,9 +59,6 @@ varying vec3 vertex_tangent; // Vertex tangent -> Needed for refraction
varying mat4 inv_mvp; // Inverse ModelViewProjection matrix -> Needed for caustic projection
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
uniform sampler2D depth_texture : hint_depth_texture, repeat_disable, filter_nearest;
// Wave function:
vec4 wave(vec4 parameter, vec2 position, float time, inout vec3 tangent, inout vec3 binormal)
@ -93,7 +85,7 @@ void vertex()
float time = TIME * wave_speed;
vec4 vertex = vec4(VERTEX, 1.0);
vec3 vertex_position = (MODEL_MATRIX * vertex).xyz;
vec3 vertex_position = (INV_VIEW_MATRIX * vertex).xyz;
vec3 tang = vec3(0.0, 0.0, 0.0);
vec3 bin = vec3(0.0, 0.0, 0.0);
@ -141,7 +133,7 @@ void fragment()
vec2 ref_uv = SCREEN_UV + (ref_normalmap.xy * refraction) / vertex_height;
// Ground depth:
float depth_raw = texture(depth_texture, ref_uv).r * 2.0 - 1.0;
float depth_raw = texture(DEPTH_TEXTURE, ref_uv).r;
float depth = PROJECTION_MATRIX[3][2] / (depth_raw + PROJECTION_MATRIX[2][2]);
float depth_blend = exp((depth+VERTEX.z + depth_offset) * -beers_law);
@ -149,7 +141,7 @@ void fragment()
float depth_blend_pow = clamp(pow(depth_blend, 2.5), 0.0, 1.0);
// Ground color:
vec3 screen_color = textureLod(screen_texture, ref_uv, depth_blend_pow * 2.5).rgb;
vec3 screen_color = textureLod(SCREEN_TEXTURE, ref_uv, depth_blend_pow * 2.5).rgb;
vec3 dye_color = mix(color_shallow.rgb, color_deep.rgb, depth_blend_pow);
vec3 color = mix(screen_color*dye_color, dye_color*0.25, depth_blend_pow*0.5);
@ -165,12 +157,12 @@ void fragment()
color *= 1.0 + pow(caustic_color.r, 1.50) * (1.0-depth_blend) * 6.0;
// Foam:
if(depth + VERTEX.z < vertex_height-0.1)
{
float foam_noise = clamp(pow(texture(foam_sampler, (uv*4.0) - uv_offset).r, 10.0)*40.0, 0.0, 0.2);
float foam_mix = clamp(pow((1.0-(depth + VERTEX.z) + foam_noise), 8.0) * foam_noise * 0.4, 0.0, 1.0);
color = mix(color, vec3(1.0), foam_mix);
}
if (depth + VERTEX.z < vertex_height-0.1)
{
float foam_noise = clamp(pow(texture(foam_sampler, (uv*4.0) - uv_offset).r, 10.0)*40.0, 0.0, 0.2);
float foam_mix = clamp(pow((1.0-(depth + VERTEX.z) + foam_noise), 8.0) * foam_noise * 0.4, 0.0, 1.0);
color = mix(color, vec3(1.0), foam_mix);
}
// Set all values:
ALBEDO = color;
@ -179,4 +171,4 @@ void fragment()
SPECULAR = 0.2 + depth_blend_pow * 0.4;
NORMAL_MAP = normalmap;
NORMAL_MAP_DEPTH = 1.25;
}
}

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://clmlpy36ghsio"]
[gd_scene load_steps=15 format=3 uid="uid://clmlpy36ghsio"]
[ext_resource type="Shader" path="res://maps/shaders/water.gdshader" id="1_j5guc"]
[ext_resource type="Script" path="res://maps/water-zone.gd" id="1_s4mf8"]
@ -9,27 +9,24 @@
[sub_resource type="SphereShape3D" id="SphereShape3D_08c7l"]
radius = 2.0
[sub_resource type="Texture2DArray" id="Texture2DArray_543vo"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bm6uj"]
render_priority = 0
shader = ExtResource("1_j5guc")
wave_speed = null
wave_c = null
wave_b = null
wave_a = null
uv_sampler_strength = null
uv_sampler_scale = null
sampler_scale = null
sampler_direction = null
refraction = null
projector = null
foam_level = null
depth_offset = null
color_shallow = Color(0.0117647, 0.380392, 0.564706, 1)
color_deep = Color(0, 0.486275, 0.564706, 1)
caustic_sampler = SubResource("Texture2DArray_543vo")
beers_law = null
shader_parameter/wave_speed = 0.5
shader_parameter/wave_a = Quaternion(1, 1, 0.35, 3)
shader_parameter/wave_b = Quaternion(1, 0.6, 0.3, 1.55)
shader_parameter/wave_c = Quaternion(1, 1.3, 0.25, 0.9)
shader_parameter/sampler_scale = Vector2(0.25, 0.25)
shader_parameter/sampler_direction = Vector2(0.05, 0.04)
shader_parameter/uv_sampler_scale = Vector2(0.25, 0.25)
shader_parameter/uv_sampler_strength = 0.04
shader_parameter/foam_level = 0.5
shader_parameter/refraction = 0.075
shader_parameter/color_deep = Color(0, 0.396078, 0.627451, 0.615686)
shader_parameter/color_shallow = Color(0.513726, 1, 0.894118, 0.596078)
shader_parameter/beers_law = 2.0
shader_parameter/depth_offset = -0.75
shader_parameter/projector = null
[sub_resource type="PlaneMesh" id="PlaneMesh_uh76x"]
material = SubResource("ShaderMaterial_bm6uj")
@ -49,21 +46,21 @@ albedo_color = Color(0.14902, 0.372549, 1, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bmkr3"]
render_priority = 0
shader = ExtResource("1_j5guc")
wave_speed = null
wave_c = null
wave_b = null
wave_a = null
uv_sampler_strength = null
uv_sampler_scale = null
sampler_scale = null
sampler_direction = null
refraction = null
projector = null
foam_level = null
depth_offset = null
color_shallow = null
color_deep = null
beers_law = null
shader_parameter/wave_speed = 0.5
shader_parameter/wave_a = Quaternion(1, 1, 0.35, 3)
shader_parameter/wave_b = Quaternion(1, 0.6, 0.3, 1.55)
shader_parameter/wave_c = Quaternion(1, 1.3, 0.25, 0.9)
shader_parameter/sampler_scale = Vector2(0.25, 0.25)
shader_parameter/sampler_direction = Vector2(0.05, 0.04)
shader_parameter/uv_sampler_scale = Vector2(0.25, 0.25)
shader_parameter/uv_sampler_strength = 0.04
shader_parameter/foam_level = 0.5
shader_parameter/refraction = 0.075
shader_parameter/color_deep = null
shader_parameter/color_shallow = null
shader_parameter/beers_law = 2.0
shader_parameter/depth_offset = -0.75
shader_parameter/projector = null
[sub_resource type="BoxMesh" id="BoxMesh_1ovik"]
material = SubResource("ShaderMaterial_bmkr3")

View file

@ -369,23 +369,23 @@ func _on_sort_by_input_pressed():
configure_control()
func _on_input_box_del_pressed(command, control, inputevent):
func _on_input_box_del_pressed(command, _control, inputevent):
InputMap.action_erase_event(command, inputevent)
configure_control()
func _on_control_box_add_pressed(action, command):
func _on_control_box_add_pressed(action, _command):
$Window.hide()
$SelectType.set_param(action, "signal_refresh" )
$SelectType/Window.popup_centered()
$SelectType/Window.visible = true
func _on_option_button_item_selected(index):
func _on_option_button_item_selected(_index):
configure_control()
func _on_tree_button_pressed(item:TreeItem, column, id):
func _on_tree_button_pressed(item:TreeItem, _column, _id):
if item.has_meta("action") and item.has_meta("group"):
var action = item.get_meta("group")
if item.get_meta("action") == 0:

View file

@ -17,7 +17,9 @@ func _ready():
var content = file.get_as_text().strip_escapes()
git_branch = content.split(' ')[1]
file.open("res://.git/" + git_branch, FileAccess.READ)
#file.open("res://.git/" + git_branch, FileAccess.READ)
file = null # File is closed.
file = FileAccess.open("res://.git/" + git_branch, FileAccess.READ)
git_commit = file.get_as_text().strip_escapes()
file = null # File is closed.
Common.msg_debug("Commit: " + git_commit)

View file

@ -20,7 +20,7 @@ var action:StateAction = StateAction.None
func resize_windows():
pass
func _process(delta):
func _process(_delta):
match action:
StateAction.Move:
var currentMousePos:Vector2 = get_global_mouse_position()
@ -43,7 +43,7 @@ func _process(delta):
StateAction.ResizeBottom:
Common.msg_debug("")
var currentMousePos:Vector2 = get_global_mouse_position()
var currentPos:Vector2 = mouseFollowerRect.get_position()
#var currentPos:Vector2 = mouseFollowerRect.get_position()
var t:Vector2 = self.get_size()
var n:Vector2 = t + currentMousePos - lastMousePos
n.x = t.x

View file

@ -19,7 +19,9 @@ func _ready() -> void:
if not directory.dir_exists( "res://music/" ):
Common.msg_info("No Music")
return
directory.open( "res://music/" )
#directory.open( "res://music/" )
directory = null
directory = DirAccess.open( "res://music/" )
for dir in directory.get_directories():
var fullpath: String = "res://music/" + dir
var dir2:DirAccess = DirAccess.open(fullpath)
@ -81,7 +83,7 @@ func select_domain(new_domain:String) -> void:
func reinitialize_jukebox() -> void:
list_music.clear()
if select_rand:
var temp:Array
var temp:Array = []
for i in range(0, official_music[current_domain].size()):
temp.append(i)
for i in range(0, official_music[current_domain].size()):
@ -94,7 +96,7 @@ func reinitialize_jukebox() -> void:
func next_music() -> void:
var pos:float
#var pos:float
current_music += 1
if current_music >= list_music.size():
reinitialize_jukebox()
@ -173,7 +175,7 @@ func play_music(pos: int) -> void:
show_list_music()
func _process(delta) -> void:
func _process(_delta) -> void:
if ! music_play and $Window/VBox/Tab/Music/HBox/Play.is_pressed():
next_music()