Divers changement cote creation/selection de personnnage dont l'ajout de lumiere.

This commit is contained in:
osquallo 2018-08-24 11:17:57 +02:00
parent 29de0913d6
commit 5db82314fc
4 changed files with 169 additions and 51 deletions

View file

@ -76,9 +76,12 @@ func update_character_slots():
func _ready():
$viewport/character/face_camera.make_current()
self.character_preview = $viewport/character
self.character_mesh = $viewport/character.get_node("MeshInstance")
self.character_face_camera = $viewport/character/Camera_rotation_helper/face_camera
# self.character_face_camera = $viewport/character/Camera_rotation_helper/face_camera
self.character_box = $margin_container/character_box
self.name_input = self.character_box.get_node( "character_creation_box/margin_container/v_box_container/name_box/line_edit" )
self.character_preview.update()
@ -200,9 +203,9 @@ func _process( delta ):
# self.character_mesh.translation.z -= delta
if zoom_direction == "front":
self.character_face_camera.size += delta
$viewport/character/face_camera.size += delta
elif zoom_direction == "back":
self.character_face_camera.size -= delta
$viewport/character/face_camera.size -= delta
func _on_turn_left_button_down():
turn_direction = "left"
@ -223,3 +226,17 @@ func _on_zoom_in_button_down():
zoom_direction = "back"
func _on_zoom_in_button_up():
zoom_direction = null
func _on_lights_button_up():
$viewport/character/face_lights.hide()
func _on_lights_button_down():
$viewport/character/face_lights.show()
func _on_lights_toggled(button_pressed):
if button_pressed:
$viewport/character/face_lights.show()
else:
$viewport/character/face_lights.hide()

View file

@ -29,7 +29,7 @@ script = ExtResource( 1 )
[node name="viewport" type="Viewport" parent="." index="0"]
arvr = false
size = Vector2( 512, 512 )
size = Vector2( 1024, 1024 )
own_world = false
world = null
transparent_bg = true
@ -55,6 +55,74 @@ _sections_unfolded = [ "Render Target", "Rendering" ]
[node name="character" parent="viewport" index="0" instance=ExtResource( 2 )]
transform = Transform( 0.371345, 0, 0, 0, 0.218854, 0, 0, 0, 0.371345, 0.000610344, -0.475751, 6.02408 )
visible = true
[node name="face_lights" type="Spatial" parent="viewport/character" index="4"]
editor/display_folded = true
[node name="face_light_right" type="OmniLight" parent="viewport/character/face_lights" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.37718, 6.37492, -2.74363 )
layers = 1
light_color = Color( 1, 1, 1, 1 )
light_energy = 1.0
light_indirect_energy = 1.0
light_negative = false
light_specular = 0.5
light_bake_mode = 1
light_cull_mask = -1
shadow_enabled = false
shadow_color = Color( 0, 0, 0, 1 )
shadow_bias = 0.15
shadow_contact = 0.0
shadow_reverse_cull_face = false
editor_only = false
omni_range = 5.0
omni_attenuation = 1.0
omni_shadow_mode = 1
omni_shadow_detail = 1
[node name="face_light_left" type="OmniLight" parent="viewport/character/face_lights" index="1"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.69919, 6.37492, -2.74363 )
layers = 1
light_color = Color( 1, 1, 1, 1 )
light_energy = 1.0
light_indirect_energy = 1.0
light_negative = false
light_specular = 0.5
light_bake_mode = 1
light_cull_mask = -1
shadow_enabled = false
shadow_color = Color( 0, 0, 0, 1 )
shadow_bias = 0.15
shadow_contact = 0.0
shadow_reverse_cull_face = false
editor_only = false
omni_range = 5.0
omni_attenuation = 1.0
omni_shadow_mode = 1
omni_shadow_detail = 1
[node name="face_camera" type="Camera" parent="viewport/character" index="5"]
transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 0, 4.35, -2.44418 )
keep_aspect = 1
cull_mask = 1048575
environment = null
h_offset = 0.0
v_offset = 0.0
doppler_tracking = 0
projection = 1
current = false
fov = 70.0
size = 2.0
near = 0.05
far = 100.0
_sections_unfolded = [ "Transform" ]
[node name="texture_rect" type="TextureRect" parent="." index="1"]
anchor_left = 0.0
@ -98,7 +166,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 8.0
margin_top = 8.0
margin_right = 1016.0
margin_right = 1124.0
margin_bottom = 592.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -117,22 +185,14 @@ size_flags_vertical = 6
custom_constants/separation = 8
_sections_unfolded = [ "Size Flags", "custom_constants" ]
[node name="character_creation_box" parent="margin_container/character_box" index="1" instance=ExtResource( 5 )]
visible = false
margin_left = 58.0
margin_top = 191.0
margin_right = 600.0
margin_bottom = 409.0
[node name="v_box_container" type="VBoxContainer" parent="margin_container/character_box" index="2"]
[node name="v_box_container" type="VBoxContainer" parent="margin_container/character_box" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 58.0
margin_right = 1008.0
margin_right = 1116.0
margin_bottom = 584.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -143,24 +203,24 @@ size_flags_vertical = 3
alignment = 0
_sections_unfolded = [ "Size Flags" ]
[node name="nine_patch_rect" type="NinePatchRect" parent="margin_container/character_box/v_box_container" index="0"]
[node name="texture_rect" type="TextureRect" parent="margin_container/character_box/v_box_container" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 219.0
margin_top = 24.0
margin_right = 731.0
margin_bottom = 536.0
margin_right = 1058.0
margin_bottom = 560.0
rect_min_size = Vector2( 512, 512 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 6
size_flags_vertical = 6
size_flags_horizontal = 7
size_flags_vertical = 7
texture = SubResource( 1 )
expand = true
stretch_mode = 6
_sections_unfolded = [ "Axis Stretch", "Grow Direction", "Margin", "Rect", "Size Flags" ]
[node name="h_box_container" type="HBoxContainer" parent="margin_container/character_box/v_box_container" index="1"]
@ -169,9 +229,9 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 425.0
margin_left = 468.0
margin_top = 564.0
margin_right = 524.0
margin_right = 590.0
margin_bottom = 584.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -192,6 +252,7 @@ margin_right = 25.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
hint_tooltip = "Tourner le modele vers la gauche."
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
@ -205,6 +266,7 @@ group = null
text = "<-"
flat = false
align = 1
_sections_unfolded = [ "Hint" ]
[node name="zoom_out" type="Button" parent="margin_container/character_box/v_box_container/h_box_container" index="1"]
@ -217,6 +279,7 @@ margin_right = 46.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
hint_tooltip = "Zoom arrière."
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
@ -229,6 +292,7 @@ group = null
text = "-"
flat = false
align = 1
_sections_unfolded = [ "Hint" ]
[node name="zoom_in" type="Button" parent="margin_container/character_box/v_box_container/h_box_container" index="2"]
@ -241,6 +305,7 @@ margin_right = 70.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
hint_tooltip = "Zoom avant."
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
@ -253,6 +318,7 @@ group = null
text = "+"
flat = false
align = 1
_sections_unfolded = [ "Hint" ]
[node name="turn_right" type="Button" parent="margin_container/character_box/v_box_container/h_box_container" index="3"]
@ -265,6 +331,7 @@ margin_right = 99.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
hint_tooltip = "Tourner le modele vers la droite."
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
@ -278,17 +345,45 @@ group = null
text = "->"
flat = false
align = 1
_sections_unfolded = [ "Hint" ]
[node name="lights" type="Button" parent="margin_container/character_box/v_box_container/h_box_container" index="4"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 103.0
margin_right = 122.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
hint_tooltip = "Lumières ON/OFF"
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = true
pressed = true
enabled_focus_mode = 2
shortcut = null
group = null
text = "L"
flat = false
align = 1
_sections_unfolded = [ "Hint" ]
[node name="character_creation_box" parent="margin_container/character_box" index="2" instance=ExtResource( 5 )]
visible = false
margin_left = 58.0
margin_top = 183.0
margin_right = 600.0
margin_bottom = 401.0
[connection signal="return_button_pressed" from="margin_container/character_box/character_slots" to="." method="_on_character_slots_return_button_pressed"]
[connection signal="creation_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_creation_button_pressed"]
[connection signal="return_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_return_button_pressed"]
[connection signal="sex_bar_changed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_sex_bar_changed"]
[connection signal="size_bar_changed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_size_bar_changed"]
[connection signal="button_down" from="margin_container/character_box/v_box_container/h_box_container/turn_left" to="." method="_on_turn_left_button_down"]
[connection signal="button_up" from="margin_container/character_box/v_box_container/h_box_container/turn_left" to="." method="_on_turn_left_button_up"]
@ -305,4 +400,14 @@ align = 1
[connection signal="button_up" from="margin_container/character_box/v_box_container/h_box_container/turn_right" to="." method="_on_turn_right_button_up"]
[connection signal="toggled" from="margin_container/character_box/v_box_container/h_box_container/lights" to="." method="_on_lights_toggled"]
[connection signal="creation_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_creation_button_pressed"]
[connection signal="return_button_pressed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_return_button_pressed"]
[connection signal="sex_bar_changed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_sex_bar_changed"]
[connection signal="size_bar_changed" from="margin_container/character_box/character_creation_box" to="." method="_on_character_creation_box_size_bar_changed"]

View file

@ -39,9 +39,8 @@ func set_info_billboard_position():
player_infos_billboard.rect_position = (unprojected_translation + offset)
func _ready():
# camera.make_current()
show_face_camera()
set_info_billboard_position()
self.show_third_person_camera()
self.set_info_billboard_position()
self.update()
#func _enter_tree():
@ -58,6 +57,7 @@ func update( start_position = null ):
print( "size: "+ str(size) )
print( "scale: "+ str(self.player_mesh.scale) )
self.player_mesh.get_surface_material(0).set_shader_param( "albedo", self.color )
# self.player_mesh.get_surface_material(0).albedo_color = self.color
func _process(delta):
process_input(delta)
@ -189,8 +189,6 @@ func show_infos():
########
#### Cameras
func show_face_camera():
$Camera_rotation_helper/face_camera.make_current()
func show_third_person_camera():
$Camera_rotation_helper/Camera.make_current()

View file

@ -1,12 +1,11 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://scenes/Game/Character/Character.gd" type="Script" id=1]
[ext_resource path="res://scenes/Game/Character/infos_spatial.gd" type="Script" id=2]
[ext_resource path="res://game_scene/character_infos_billboard.tscn" type="PackedScene" id=3]
[ext_resource path="res://game_scene/suzanne/suzanne.obj" type="ArrayMesh" id=4]
[ext_resource path="res://game_scene/suzanne/suzanne_albedo.png" type="Texture" id=5]
[sub_resource type="Shader" id=1]
[sub_resource type="Shader" id=4]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
@ -45,10 +44,10 @@ void fragment() {
}
"
[sub_resource type="ShaderMaterial" id=2]
[sub_resource type="ShaderMaterial" id=5]
render_priority = 0
shader = SubResource( 1 )
shader = SubResource( 4 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/specular = 0.5
shader_param/metallic = 0.0
@ -60,8 +59,6 @@ shader_param/uv1_scale = Vector3( 1, 1, 1 )
shader_param/uv1_offset = Vector3( 0, 0, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 )
shader_param/texture_albedo = ExtResource( 5 )
_sections_unfolded = [ "shader_param" ]
[sub_resource type="SphereShape" id=3]
@ -71,7 +68,7 @@ radius = 0.520354
transform = Transform( 0.371345, 0, 0, 0, 0.218854, 0, 0, 0, 0.371345, -0.00167466, -0.475751, 6.02408 )
visible = false
input_ray_pickable = true
input_ray_pickable = false
input_capture_on_drag = false
collision_layer = 1
collision_mask = 1
@ -115,9 +112,10 @@ near = 0.05
far = 10000.0
_sections_unfolded = [ "Transform" ]
[node name="face_camera" type="Camera" parent="Camera_rotation_helper" index="1"]
[node name="face_camera_bak" type="Camera" parent="Camera_rotation_helper" index="1"]
transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, 0, 4.27532, -2.96733 )
visible = false
keep_aspect = 1
cull_mask = 1048575
environment = null
@ -134,7 +132,7 @@ _sections_unfolded = [ "Transform" ]
[node name="MeshInstance" type="MeshInstance" parent="." index="2"]
transform = Transform( -0.281766, 0, -2.3459e-008, 0, 0.491282, 0, 2.46328e-008, 0, -0.26834, 0.0433697, 4.3256, 4.76837e-007 )
transform = Transform( -0.281766, 0, -2.3459e-008, 0, 0.491282, 0, 2.46328e-008, 0, -0.26834, 0.00342001, 4.32337, -0.0753574 )
layers = 1
material_override = null
cast_shadow = 1
@ -146,12 +144,12 @@ lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = ExtResource( 4 )
skeleton = NodePath("..")
material/0 = SubResource( 2 )
material/0 = SubResource( 5 )
_sections_unfolded = [ "Transform", "material" ]
[node name="Flashlight" type="SpotLight" parent="MeshInstance" index="0"]
transform = Transform( -2.54929, -1.60184e-009, 3.70147e-007, 0, 2.42833, 0.0302507, -2.34015e-007, 0.0192396, -4.44583, 0.391783, -0.0857301, 1.36415 )
transform = Transform( -2.54929, -1.60184e-009, 3.70147e-007, 0, 2.42833, 0.0302507, -2.34015e-007, 0.0192396, -4.44583, -0.0164189, -0.0857301, 1.36415 )
layers = 1
light_color = Color( 1, 1, 1, 1 )
light_energy = 2.0
@ -174,7 +172,7 @@ _sections_unfolded = [ "Light", "Shadow" ]
[node name="collision_shape" type="CollisionShape" parent="." index="3"]
transform = Transform( 0.754381, 0, 0, 0, 0.927224, 0, 0, 0, 0.540596, 0.0499596, 4.35001, -0.0363884 )
transform = Transform( 0.754381, 0, 0, 0, 0.927224, 0, 0, 0, 0.540596, 0.0063323, 4.35001, -0.0641537 )
shape = SubResource( 3 )
disabled = false