diff options
-rw-r--r-- | Float.gd | 2 | ||||
-rw-r--r-- | Main.tscn | 51 | ||||
-rw-r--r-- | character/fps_controller/fps_controller.tscn | 1 | ||||
-rw-r--r-- | project.godot | 2 | ||||
-rw-r--r-- | water/Water.gd (renamed from Water.gd) | 0 | ||||
-rw-r--r-- | water/Water.tscn | 62 | ||||
-rw-r--r-- | water/Wave.gd (renamed from Wave.gd) | 0 | ||||
-rw-r--r-- | water/Wave.gdshader (renamed from Wave.gdshader) | 0 |
8 files changed, 71 insertions, 47 deletions
@@ -5,7 +5,7 @@ var angular_drag = 0.5 func _physics_process(_delta): var parent = get_parent() - var water = get_node("/root/Main/Water") + var water = get_node("/root/Main/Water/MeshInstance") #self.global_transform.origin.y = water.height(self.global_transform.origin) var height = self.global_transform.origin.y var wave_height = water.height(self.global_transform.origin) @@ -1,10 +1,9 @@ -[gd_scene load_steps=19 format=2] +[gd_scene load_steps=14 format=2] [ext_resource path="res://character/fps_controller/fps_controller.tscn" type="PackedScene" id=1] [ext_resource path="res://icon.png" type="Texture" id=2] +[ext_resource path="res://water/Water.tscn" type="PackedScene" id=3] [ext_resource path="res://Float.tscn" type="PackedScene" id=4] -[ext_resource path="res://Water.gd" type="Script" id=5] -[ext_resource path="res://Wave.gdshader" type="Shader" id=7] [sub_resource type="BoxShape" id=1] extents = Vector3( 5, 0.5, 5 ) @@ -16,37 +15,11 @@ size = Vector3( 10, 1, 10 ) albedo_texture = ExtResource( 2 ) uv1_triplanar = true -[sub_resource type="PlaneMesh" id=9] -size = Vector2( 500, 500 ) -subdivide_width = 500 -subdivide_depth = 500 - -[sub_resource type="OpenSimplexNoise" id=17] - -[sub_resource type="NoiseTexture" id=18] -seamless = true -as_normalmap = true -noise = SubResource( 17 ) - -[sub_resource type="ShaderMaterial" id=11] -shader = ExtResource( 7 ) -shader_param/wave1 = Quat( 0.25, 0.10472, 2.38732, 509.65 ) -shader_param/wave1_dir = Vector2( 1, 1 ) -shader_param/wave2 = Quat( 0.25, 0.202683, 1.23345, 366.334 ) -shader_param/wave2_dir = Vector2( 1, 0.6 ) -shader_param/wave3 = Quat( 0.25, 0.349066, 0.716197, 279.147 ) -shader_param/wave3_dir = Vector2( 1, 1.3 ) -shader_param/water_colour = Color( 0.694118, 0.945098, 0.941176, 0.368627 ) -shader_param/deep_water_colour = Color( 0.25098, 0.623529, 0.788235, 0.54902 ) -shader_param/foam_amount = 0.6 -shader_param/murkiness = 4.0 -shader_param/noise = SubResource( 18 ) - [sub_resource type="BoxShape" id=19] -extents = Vector3( 250, 1, 250 ) +extents = Vector3( 1000, 0.1, 1000 ) [sub_resource type="PlaneMesh" id=20] -size = Vector2( 500, 500 ) +size = Vector2( 2000, 2000 ) [sub_resource type="SpatialMaterial" id=21] albedo_color = Color( 0.941176, 0.658824, 0.215686, 1 ) @@ -96,20 +69,8 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.0045, 0, 5.02626 ) [node name="DirectionalLight" type="DirectionalLight" parent="."] transform = Transform( 0.863334, 0.0994421, -0.494738, 0, 0.980392, 0.197058, 0.504633, -0.170127, 0.846406, -12.2908, 5.96757, 0 ) -[node name="Water" type="MeshInstance" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00538254, -1.02502, 0.0534515 ) -mesh = SubResource( 9 ) -material/0 = SubResource( 11 ) -script = ExtResource( 5 ) -wave1_steepness = 0.25 -wave1_wavelength = 60.0 -wave1_direction = Vector2( 1, 1 ) -wave2_steepness = 0.25 -wave2_wavelength = 31.0 -wave2_direction = Vector2( 1, 0.6 ) -wave3_steepness = 0.25 -wave3_wavelength = 18.0 -wave3_direction = Vector2( 1, 1.3 ) +[node name="Water" parent="." instance=ExtResource( 3 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) [node name="Ground" type="StaticBody" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -10, 0 ) diff --git a/character/fps_controller/fps_controller.tscn b/character/fps_controller/fps_controller.tscn index c0009d5..d187121 100644 --- a/character/fps_controller/fps_controller.tscn +++ b/character/fps_controller/fps_controller.tscn @@ -14,6 +14,7 @@ shape = SubResource( 1 ) [node name="Camera" type="Camera" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.796127, 0 ) +far = 5000.0 [node name="RayCast" type="RayCast" parent="Camera"] cast_to = Vector3( 0, 0, -3 ) diff --git a/project.godot b/project.godot index 75d4b3d..fea7a33 100644 --- a/project.godot +++ b/project.godot @@ -12,7 +12,7 @@ _global_script_classes=[ { "base": "Resource", "class": "Wave", "language": "GDScript", -"path": "res://Wave.gd" +"path": "res://water/Wave.gd" } ] _global_script_class_icons={ "Wave": "" diff --git a/Water.gd b/water/Water.gd index da7666c..da7666c 100644 --- a/Water.gd +++ b/water/Water.gd diff --git a/water/Water.tscn b/water/Water.tscn new file mode 100644 index 0000000..3724e82 --- /dev/null +++ b/water/Water.tscn @@ -0,0 +1,62 @@ +[gd_scene load_steps=9 format=2] + +[ext_resource path="res://water/Wave.gdshader" type="Shader" id=1] +[ext_resource path="res://water/Water.gd" type="Script" id=2] + +[sub_resource type="PlaneMesh" id=9] +size = Vector2( 2000, 2000 ) +subdivide_width = 500 +subdivide_depth = 500 + +[sub_resource type="OpenSimplexNoise" id=17] + +[sub_resource type="NoiseTexture" id=18] +seamless = true +as_normalmap = true +noise = SubResource( 17 ) + +[sub_resource type="ShaderMaterial" id=11] +shader = ExtResource( 1 ) +shader_param/wave1 = Quat( 0.25, 0.10472, 2.38732, 2652.57 ) +shader_param/wave1_dir = Vector2( 1, 1 ) +shader_param/wave2 = Quat( 0.25, 0.202683, 1.23345, 1906.65 ) +shader_param/wave2_dir = Vector2( 1, 0.6 ) +shader_param/wave3 = Quat( 0.25, 0.349066, 0.716197, 1452.87 ) +shader_param/wave3_dir = Vector2( 1, 1.3 ) +shader_param/water_colour = Color( 0.694118, 0.945098, 0.941176, 0.368627 ) +shader_param/deep_water_colour = Color( 0.25098, 0.623529, 0.788235, 0.54902 ) +shader_param/foam_amount = 0.6 +shader_param/murkiness = 4.0 +shader_param/noise = SubResource( 18 ) + +[sub_resource type="PlaneMesh" id=19] +size = Vector2( 10000, 10000 ) +subdivide_width = 100 +subdivide_depth = 100 + +[sub_resource type="PlaneMesh" id=20] +size = Vector2( 2000, 2000 ) + +[node name="Water" type="Spatial"] + +[node name="MeshInstance" type="MeshInstance" parent="."] +mesh = SubResource( 9 ) +material/0 = SubResource( 11 ) +script = ExtResource( 2 ) +wave1_steepness = 0.25 +wave1_wavelength = 60.0 +wave1_direction = Vector2( 1, 1 ) +wave2_steepness = 0.25 +wave2_wavelength = 31.0 +wave2_direction = Vector2( 1, 0.6 ) +wave3_steepness = 0.25 +wave3_wavelength = 18.0 +wave3_direction = Vector2( 1, 1.3 ) + +[node name="CSGMesh" type="CSGMesh" parent="."] +mesh = SubResource( 19 ) +material = SubResource( 11 ) + +[node name="CSGMesh" type="CSGMesh" parent="CSGMesh"] +operation = 2 +mesh = SubResource( 20 ) diff --git a/Wave.gdshader b/water/Wave.gdshader index 9e4aff3..9e4aff3 100644 --- a/Wave.gdshader +++ b/water/Wave.gdshader |