ADD effet sous marin et correction d'un bug de couleur sur le terrain.

This commit is contained in:
osquallo 2020-03-27 13:07:44 +01:00
parent 0f22aaa2ff
commit 0edfbd21c0
5 changed files with 34 additions and 63 deletions

View file

@ -10,48 +10,12 @@ config_version=4
_global_script_classes=[ { _global_script_classes=[ {
"base": "Spatial", "base": "Spatial",
"class": "CameraRig",
"language": "GDScript",
"path": "res://ressources/scripts/player/camera/camera_rig.gd"
}, {
"base": "State",
"class": "CameraState",
"language": "GDScript",
"path": "res://ressources/scripts/player/camera/camera_state.gd"
}, {
"base": "Spatial",
"class": "Mannequiny", "class": "Mannequiny",
"language": "GDScript", "language": "GDScript",
"path": "res://scenes/creatures/ra/ra_model.gd" "path": "res://scenes/creatures/ra/ra_model.gd"
}, {
"base": "KinematicBody",
"class": "Player",
"language": "GDScript",
"path": "res://ressources/scripts/player/player.gd"
}, {
"base": "State",
"class": "PlayerState",
"language": "GDScript",
"path": "res://ressources/scripts/player/player_state.gd"
}, {
"base": "Node",
"class": "State",
"language": "GDScript",
"path": "res://ressources/scripts/state_machine/state.gd"
}, {
"base": "Node",
"class": "StateMachine",
"language": "GDScript",
"path": "res://ressources/scripts/state_machine/state_machine.gd"
} ] } ]
_global_script_class_icons={ _global_script_class_icons={
"CameraRig": "", "Mannequiny": ""
"CameraState": "",
"Mannequiny": "",
"Player": "",
"PlayerState": "",
"State": "",
"StateMachine": ""
} }
[application] [application]

View file

@ -18,7 +18,7 @@
[sub_resource type="ShaderMaterial" id=1] [sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 15 ) shader = ExtResource( 15 )
shader_param/wave_speed = 0.12 shader_param/wave_speed = 0.0
shader_param/wave_a = Plane( 1, 1, 0.35, 3 ) shader_param/wave_a = Plane( 1, 1, 0.35, 3 )
shader_param/wave_b = Plane( 1, 0.6, 0.3, 1.55 ) shader_param/wave_b = Plane( 1, 0.6, 0.3, 1.55 )
shader_param/wave_c = Plane( 1, 1.3, 0.25, 0.9 ) shader_param/wave_c = Plane( 1, 1.3, 0.25, 0.9 )

File diff suppressed because one or more lines are too long

View file

@ -56,22 +56,20 @@ func _input( event ):
func _process( delta ): func _process( delta ):
# $camera_base.translate( camera_translation )
# camera_translation = Vector3()
# $camera_base.rotate( Vector3( 0.0, 1.0, 0.0 ), deg2rad( camera_rotation ) )
$creatures/player.rotate_camera_arm( Vector3( 0.0, 1.0, 0.0 ), deg2rad( self.mouse_delta.x ) ) $creatures/player.rotate_camera_arm( Vector3( 0.0, 1.0, 0.0 ), deg2rad( self.mouse_delta.x ) )
$creatures/player.move_camera( Vector3( 0.0, 0.0, camera_zoom ) ) $creatures/player.move_camera( Vector3( 0.0, 0.0, camera_zoom ) )
$creatures/player.rotate_camera( Vector3( 1.0, 0.0, 0.0 ), deg2rad( self.mouse_delta.y ) ) $creatures/player.rotate_camera( Vector3( 1.0, 0.0, 0.0 ), deg2rad( self.mouse_delta.y ) )
# camera_rotation = 0.0
self.camera_zoom = 0.0 self.camera_zoom = 0.0
self.mouse_delta = Vector2( 0.0, 0.0 ) self.mouse_delta = Vector2( 0.0, 0.0 )
# Water fx.
if $creatures/player/model/ra.translation.y <= ($level/demo/water.translation.y-2.5):
$water_fx.get_surface_material( 0 ).set_shader_param( "mist_level", 1.0 )
else:
$water_fx.get_surface_material( 0 ).set_shader_param( "mist_level", 0.0 )
func load_player( filename ): func load_player( filename ):
$creatures/player.load_creature( filename ) $creatures/player.load_creature( filename )

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=19 format=2] [gd_scene load_steps=21 format=2]
[ext_resource path="res://scenes/player/player.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/player/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/decors/terrains/demo/demo.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/decors/terrains/demo/demo.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/game/game.gd" type="Script" id=3] [ext_resource path="res://scenes/game/game.gd" type="Script" id=3]
[ext_resource path="res://assets/decors/terrains/demo/water/water_fx.shader" type="Shader" id=4]
[ext_resource path="res://assets/sky/sky.shader" type="Shader" id=5] [ext_resource path="res://assets/sky/sky.shader" type="Shader" id=5]
[ext_resource path="res://scenes/game/sky.gd" type="Script" id=6] [ext_resource path="res://scenes/game/sky.gd" type="Script" id=6]
[ext_resource path="res://assets/mist/mist.shader" type="Shader" id=7] [ext_resource path="res://assets/mist/mist.shader" type="Shader" id=7]
@ -23,8 +24,8 @@ noise = SubResource( 1 )
[sub_resource type="ShaderMaterial" id=3] [sub_resource type="ShaderMaterial" id=3]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource( 5 ) shader = ExtResource( 5 )
shader_param/iTime = 1.16881 shader_param/iTime = 60.0352
shader_param/iFrame = 78 shader_param/iFrame = 1402
shader_param/COVERAGE = 0.5 shader_param/COVERAGE = 0.5
shader_param/THICKNESS = 25.0 shader_param/THICKNESS = 25.0
shader_param/ABSORPTION = 1.031 shader_param/ABSORPTION = 1.031
@ -74,6 +75,13 @@ shader_param/mist_color = Color( 1, 0, 1, 1 )
shader_param/mist_height = 0.0 shader_param/mist_height = 0.0
shader_param/mist_distance = 25.0 shader_param/mist_distance = 25.0
[sub_resource type="ShaderMaterial" id=10]
shader = ExtResource( 4 )
shader_param/mist_level = 0.0
shader_param/mist_color = Color( 0.0156863, 0.411765, 0.545098, 1 )
shader_param/mist_height = 0.0
shader_param/mist_distance = 5.0
[node name="game" type="Spatial"] [node name="game" type="Spatial"]
script = ExtResource( 3 ) script = ExtResource( 3 )
@ -107,7 +115,6 @@ transform = Transform( 10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0 )
[node name="creatures" type="Spatial" parent="."] [node name="creatures" type="Spatial" parent="."]
[node name="player" parent="creatures" instance=ExtResource( 1 )] [node name="player" parent="creatures" instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.07161, 14.4696 )
[node name="mist_fx" type="MeshInstance" parent="."] [node name="mist_fx" type="MeshInstance" parent="."]
cast_shadow = 0 cast_shadow = 0
@ -115,6 +122,12 @@ extra_cull_margin = 16384.0
mesh = SubResource( 8 ) mesh = SubResource( 8 )
material/0 = SubResource( 9 ) material/0 = SubResource( 9 )
[node name="water_fx" type="MeshInstance" parent="."]
cast_shadow = 0
extra_cull_margin = 16384.0
mesh = SubResource( 8 )
material/0 = SubResource( 10 )
[node name="game_ui" parent="." instance=ExtResource( 11 )] [node name="game_ui" parent="." instance=ExtResource( 11 )]
[node name="debug_window" parent="." instance=ExtResource( 8 )] [node name="debug_window" parent="." instance=ExtResource( 8 )]