First working panel with samauyn scaling possible during runtime - using global uniforms for shaders and singleton

This commit is contained in:
yannk 2022-04-22 18:35:29 +02:00
parent ed7a0b6f2c
commit 5dbe1be6c9
15 changed files with 310 additions and 246 deletions

View file

@ -1,5 +1,6 @@
extends Node3D extends Node3D
signal celestial_move(parameters)
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
@ -9,16 +10,9 @@ func _ready():
func _process(delta): func _process(delta):
pass pass
func get_celestial_coordinates(): func set_celestial_parameters(parameters):
var stigi_pos = get_node("WorldEnvironment").environment.sky.sky_material.get_shader_param("stigi_position") $WorldEnvironment.environment.sky.sky_material.set_shader_param("samayun_arc", parameters["samayun_arc"])
var stigi_arc = get_node("WorldEnvironment").environment.sky.sky_material.get_shader_param("stigi_arc")
var samayun_pos = get_node("WorldEnvironment").environment.sky.sky_material.get_shader_param("samayun_position")
var samayun_arc = get_node("WorldEnvironment").environment.sky.sky_material.get_shader_param("samayun_arc")
var zabr_pos = get_node("WorldEnvironment").environment.sky.sky_material.get_shader_param("zabr_position") func _on_basic_setup_celestial_move(parameters):
var zabr_arc = get_node("WorldEnvironment").environment.sky.sky_material.get_shader_param("zabr_arc") set_celestial_parameters(parameters)
var positions = {"stigi_pos":stigi_pos, "stigi_arc":stigi_arc, "samayun_pos":samayun_pos, "samayun_arc":samayun_arc, "zabr_pos":zabr_pos, "zabr_arc":zabr_arc}
return positions

View file

@ -1,13 +1,10 @@
[gd_scene load_steps=25 format=3 uid="uid://b8p2h0rmwy7qn"] [gd_scene load_steps=19 format=3 uid="uid://cul5wj3ouq8u4"]
[ext_resource type="Material" uid="uid://dpegsmygxcfmv" path="res://maps/materials/basic_ground.material" id="1_lodye"] [ext_resource type="Material" uid="uid://dpegsmygxcfmv" path="res://maps/materials/basic_ground.material" id="1_lodye"]
[ext_resource type="Shader" path="res://maps/shaders/khanat_sky.gdshader" id="1_mheqi"]
[ext_resource type="Script" path="res://maps/basic_setup.gd" id="1_narkk"] [ext_resource type="Script" path="res://maps/basic_setup.gd" id="1_narkk"]
[ext_resource type="Texture2D" uid="uid://b5jer2nm17ld" path="res://maps/textures/samayun_tex_001.png" id="1_thm7k"]
[ext_resource type="PackedScene" uid="uid://cveshwnu272vf" path="res://maps/objects/ramp-complex.tscn" id="2_4eueh"] [ext_resource type="PackedScene" uid="uid://cveshwnu272vf" path="res://maps/objects/ramp-complex.tscn" id="2_4eueh"]
[ext_resource type="Texture2D" uid="uid://y0ka7tysfp6b" path="res://maps/textures/zabr_tex_001.png" id="3_bgghj"] [ext_resource type="Environment" uid="uid://bev0tkmkd4wpt" path="res://maps/environments/khanat.tres" id="2_5npi8"]
[ext_resource type="PackedScene" uid="uid://omess6wwwwcq" path="res://maps/objects/ramp-moving.tscn" id="3_bvbgo"] [ext_resource type="PackedScene" uid="uid://omess6wwwwcq" path="res://maps/objects/ramp-moving.tscn" id="3_bvbgo"]
[ext_resource type="Texture2D" uid="uid://dlxp52r0wnwlq" path="res://maps/textures/stigi_tex_001.png" id="3_jqgsm"]
[ext_resource type="PackedScene" uid="uid://dvsl8x3lb1h4e" path="res://maps/objects/moutain.tscn" id="3_rbp35"] [ext_resource type="PackedScene" uid="uid://dvsl8x3lb1h4e" path="res://maps/objects/moutain.tscn" id="3_rbp35"]
[ext_resource type="PackedScene" path="res://maps/objects/cave.tscn" id="4_pc85h"] [ext_resource type="PackedScene" path="res://maps/objects/cave.tscn" id="4_pc85h"]
[ext_resource type="PackedScene" uid="uid://b61edh0bre65c" path="res://maps/objects/ramp.tscn" id="5_dfm8h"] [ext_resource type="PackedScene" uid="uid://b61edh0bre65c" path="res://maps/objects/ramp.tscn" id="5_dfm8h"]
@ -20,39 +17,6 @@
[ext_resource type="PackedScene" uid="uid://bfo13c5k8xu0x" path="res://maps/natural_ground.tscn" id="12_r7x73"] [ext_resource type="PackedScene" uid="uid://bfo13c5k8xu0x" path="res://maps/natural_ground.tscn" id="12_r7x73"]
[ext_resource type="PackedScene" uid="uid://mdsxnqsijdqv" path="res://maps/dispensaire_01.tscn" id="13_ald41"] [ext_resource type="PackedScene" uid="uid://mdsxnqsijdqv" path="res://maps/dispensaire_01.tscn" id="13_ald41"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_s2q0l"]
shader = ExtResource( "1_mheqi" )
shader_param/rayleigh = 2.0
shader_param/rayleigh_color = Color(0.3, 0.405, 0.6, 1)
shader_param/mie = 0.005
shader_param/mie_eccentricity = 0.8
shader_param/mie_color = Color(0.69, 0.729, 0.812, 1)
shader_param/turbidity = 10.0
shader_param/sun_disk_scale = 1.0
shader_param/ground_color = Color(0.1, 0.07, 0.034, 1)
shader_param/exposure = 0.1
shader_param/dither_strength = 1.0
shader_param/samayun_arc = 45.681
shader_param/samayun_position = Vector3(2.038, 0.695, -0.237)
shader_param/zabr_arc = 8.0
shader_param/zabr_position = Vector3(1.755, 0.599, 0.613)
shader_param/stigi_arc = 8.381
shader_param/stigi_position = Vector3(1.209, 0.444, 0.332)
shader_param/samayun = ExtResource( "1_thm7k" )
shader_param/zabr = ExtResource( "3_bgghj" )
shader_param/stigi = ExtResource( "3_jqgsm" )
[sub_resource type="Sky" id="Sky_fa16p"]
sky_material = SubResource( "ShaderMaterial_s2q0l" )
[sub_resource type="Environment" id="Environment_n5kgx"]
background_mode = 2
sky = SubResource( "Sky_fa16p" )
volumetric_fog_enabled = true
volumetric_fog_density = 0.0
volumetric_fog_emission = Color(0.407843, 0.415686, 0.439216, 1)
volumetric_fog_detail_spread = 1.60766
[sub_resource type="BoxMesh" id="BoxMesh_k23th"] [sub_resource type="BoxMesh" id="BoxMesh_k23th"]
material = ExtResource( "1_lodye" ) material = ExtResource( "1_lodye" )
@ -63,13 +27,13 @@ data = PackedVector3Array(-0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0
script = ExtResource( "1_narkk" ) script = ExtResource( "1_narkk" )
[node name="sunlight" type="DirectionalLight3D" parent="."] [node name="sunlight" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.278991, 0.960294, 0, -0.960294, 0.278991, -1.75049, 15.9707, 4.39927) transform = Transform3D(1, 0, 0, 0, 0.258819, 0.965926, 0, -0.965926, 0.258819, -1.75049, 15.9707, 4.39927)
light_color = Color(0.988235, 0.960784, 1, 1) light_color = Color(0.988235, 0.960784, 1, 1)
light_energy = 0.75 light_energy = 0.75
shadow_enabled = true shadow_enabled = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( "Environment_n5kgx" ) environment = ExtResource( "2_5npi8" )
[node name="floor" type="MeshInstance3D" parent="."] [node name="floor" type="MeshInstance3D" parent="."]
transform = Transform3D(80, 0, 0, 0, 0.1, 0, 0, 0, 80, 0, 0, 0) transform = Transform3D(80, 0, 0, 0, 0.1, 0, 0, 0, 80, 0, 0, 0)
@ -161,3 +125,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 65, 0.05, -15)
[node name="dispensaire_01" parent="." instance=ExtResource( "13_ald41" )] [node name="dispensaire_01" parent="." instance=ExtResource( "13_ald41" )]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -7.073, -89.152) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -7.073, -89.152)
[connection signal="celestial_move" from="." to="." method="_on_basic_setup_celestial_move"]

View file

@ -0,0 +1,39 @@
[gd_resource type="Environment" load_steps=7 format=3 uid="uid://46s305coxmt5"]
[ext_resource type="Shader" path="res://maps/shaders/khanat_sky.gdshader" id="1_3tymq"]
[ext_resource type="Texture2D" uid="uid://b5jer2nm17ld" path="res://maps/textures/samayun_tex_001.png" id="2_nof6j"]
[ext_resource type="Texture2D" uid="uid://dlxp52r0wnwlq" path="res://maps/textures/stigi_tex_001.png" id="3_nkgw7"]
[ext_resource type="Texture2D" uid="uid://y0ka7tysfp6b" path="res://maps/textures/zabr_tex_001.png" id="4_ha8xu"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_qtcwg"]
shader = ExtResource( "1_3tymq" )
shader_param/rayleigh = null
shader_param/rayleigh_color = null
shader_param/mie = null
shader_param/mie_eccentricity = null
shader_param/mie_color = null
shader_param/turbidity = null
shader_param/sun_disk_scale = null
shader_param/ground_color = null
shader_param/exposure = null
shader_param/dither_strength = null
shader_param/samayun_arc = 25.0
shader_param/samayun_position = Vector3(0.054, 0.124, 0.057)
shader_param/zabr_arc = 10.0
shader_param/zabr_position = Vector3(0.076, 0.098, 0.052)
shader_param/stigi_arc = 15.0
shader_param/stigi_position = Vector3(0.085, 0.104, 0.088)
shader_param/samayun = ExtResource( "2_nof6j" )
shader_param/zabr = ExtResource( "4_ha8xu" )
shader_param/stigi = ExtResource( "3_nkgw7" )
[sub_resource type="Sky" id="Sky_0olra"]
sky_material = SubResource( "ShaderMaterial_qtcwg" )
[resource]
background_mode = 2
sky = SubResource( "Sky_0olra" )
volumetric_fog_enabled = true
volumetric_fog_density = 0.0
volumetric_fog_emission = Color(0.407843, 0.415686, 0.439216, 1)
volumetric_fog_detail_spread = 1.60766

View file

@ -0,0 +1,11 @@
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://bev0tkmkd4wpt"]
[ext_resource type="Script" path="res://maps/environments/khanat_environment.gd" id="1_8awxb"]
[ext_resource type="Sky" uid="uid://djtef650v38ws" path="res://maps/skies/khanat_sky.tres" id="2_wgjdj"]
[resource]
background_mode = 2
sky = ExtResource( "2_wgjdj" )
ambient_light_source = 3
script = ExtResource( "1_8awxb" )
celestial_positions = {}

View file

@ -0,0 +1,22 @@
extends Environment
class_name khanat_environment
@export var celestial_positions: Dictionary
func _ready():
celestial_positions = get_celestial_coordinates()
print("Celestial positions : %s" %celestial_positions)
func get_celestial_coordinates():
var stigi_pos = sky.sky_material.get_shader_param("stigi_position")
var stigi_arc = sky.sky_material.get_shader_param("stigi_arc")
var samayun_pos = sky.sky_material.get_shader_param("samayun_position")
var samayun_arc = sky.sky_material.get_shader_param("samayun_arc")
var zabr_pos = sky.sky_material.get_shader_param("zabr_position")
var zabr_arc = sky.sky_material.get_shader_param("zabr_arc")
var positions = {"stigi_pos":stigi_pos, "stigi_arc":stigi_arc, "samayun_pos":samayun_pos, "samayun_arc":samayun_arc, "zabr_pos":zabr_pos, "zabr_arc":zabr_arc}
return positions

View file

@ -19,16 +19,16 @@ uniform float dither_strength : hint_range(0, 10) = 1.0;
uniform sampler2D night_sky : hint_black_albedo; uniform sampler2D night_sky : hint_black_albedo;
uniform sampler2D samayun : hint_albedo; uniform sampler2D samayun : hint_albedo;
uniform float samayun_arc = 45 ; global uniform float samayun_arc;
uniform vec3 samayun_position = vec3( 0.0, 0.5, 0.0 ); global uniform vec3 samayun_pos;
uniform sampler2D zabr : hint_albedo; uniform sampler2D zabr : hint_albedo;
uniform float zabr_arc = 15 ; global uniform float zabr_arc;
uniform vec3 zabr_position = vec3( 0.0, 0.7, 0.0 ); global uniform vec3 zabr_pos;
uniform sampler2D stigi : hint_albedo; uniform sampler2D stigi : hint_albedo;
uniform float stigi_arc = 8 ; global uniform float stigi_arc;
uniform vec3 stigi_position = vec3( 0.0, 0.8, 0.0 ); global uniform vec3 stigi_pos;
const vec3 UP = vec3( 0.0, 1.0, 0.0 ); const vec3 UP = vec3( 0.0, 1.0, 0.0 );
@ -123,29 +123,29 @@ void sky() {
float stigi_scale = radians(stigi_arc) ; float stigi_scale = radians(stigi_arc) ;
// Calculate respective plane with UV to place celestial object textures // Calculate respective plane with UV to place celestial object textures
vec2 samayun_uv = place_object(samayun_position, EYEDIR) ; vec2 samayun_uv = place_object(samayun_pos, EYEDIR) ;
vec2 zabr_uv = place_object(zabr_position, EYEDIR) ; vec2 zabr_uv = place_object(zabr_pos, EYEDIR) ;
vec2 stigi_uv = place_object(stigi_position, EYEDIR) ; vec2 stigi_uv = place_object(stigi_pos, EYEDIR) ;
// Adding the celestial objects from the nearest to the farest // Adding the celestial objects from the nearest to the farest
// Adding stigi // Adding stigi
if (length(EYEDIR - normalize(stigi_position)) < stigi_scale / 2.0){ // we are in the area of the sky where stigi is placed if (length(EYEDIR - normalize(stigi_pos)) < stigi_scale / 2.0){ // we are in the area of the sky where stigi is placed
COLOR += texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).rgb * texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).a; COLOR += texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).rgb * texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).a;
} }
// Adding samayun // Adding samayun
if (length(EYEDIR - normalize(samayun_position)) < samayun_scale / 2.0) { // we are in the area of the sky where samayun is placed if (length(EYEDIR - normalize(samayun_pos)) < samayun_scale / 2.0) { // we are in the area of the sky where samayun is placed
if (length(EYEDIR - normalize(stigi_position)) < stigi_scale / 2.0){ // if stigi is in front of samayun, dont draw where stigi alpha is > 0 if (length(EYEDIR - normalize(stigi_pos)) < stigi_scale / 2.0){ // if stigi is in front of samayun, dont draw where stigi alpha is > 0
COLOR += texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).rgb * max((texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).a - texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).a), 0.0) ; COLOR += texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).rgb * max((texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).a - texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).a), 0.0) ;
} else { } else {
COLOR += texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).rgb * texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).a; COLOR += texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).rgb * texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).a;
} }
} }
// Adding zabr // Adding zabr
if (length(EYEDIR - normalize(zabr_position)) < zabr_scale / 2.0) { // we are in the area of the sky where zabr is placed if (length(EYEDIR - normalize(zabr_pos)) < zabr_scale / 2.0) { // we are in the area of the sky where zabr is placed
if (length(EYEDIR - normalize(samayun_position)) < samayun_scale / 2.0){ // if samayun is in front of zabr, dont draw where samayun alpha is > 0 if (length(EYEDIR - normalize(samayun_pos)) < samayun_scale / 2.0){ // if samayun is in front of zabr, dont draw where samayun alpha is > 0
COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * max((texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a - texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).a), 0.0) ; COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * max((texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a - texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).a), 0.0) ;
} else { } else {
if (length(EYEDIR - normalize(stigi_position)) < stigi_scale / 2.0){ // if stigi is in front of zabr, dont draw where its alpha is > 0 if (length(EYEDIR - normalize(stigi_pos)) < stigi_scale / 2.0){ // if stigi is in front of zabr, dont draw where its alpha is > 0
COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * max((texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a - texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).a), 0.0) ; COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * max((texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a - texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).a), 0.0) ;
} else { } else {
COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a; COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a;

View file

@ -0,0 +1,25 @@
[gd_resource type="Sky" load_steps=6 format=3 uid="uid://djtef650v38ws"]
[ext_resource type="Shader" path="res://maps/shaders/khanat_sky.gdshader" id="1_e4w87"]
[ext_resource type="Texture2D" uid="uid://b5jer2nm17ld" path="res://maps/textures/samayun_tex_001.png" id="2_takrn"]
[ext_resource type="Texture2D" uid="uid://dlxp52r0wnwlq" path="res://maps/textures/stigi_tex_001.png" id="3_yhaf2"]
[ext_resource type="Texture2D" uid="uid://y0ka7tysfp6b" path="res://maps/textures/zabr_tex_001.png" id="4_t7f5q"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_10g43"]
shader = ExtResource( "1_e4w87" )
shader_param/rayleigh = 2.0
shader_param/rayleigh_color = Color(0.3, 0.405, 0.6, 1)
shader_param/mie = 0.005
shader_param/mie_eccentricity = 0.8
shader_param/mie_color = Color(0.69, 0.729, 0.812, 1)
shader_param/turbidity = 10.0
shader_param/sun_disk_scale = 1.0
shader_param/ground_color = Color(0.1, 0.07, 0.034, 1)
shader_param/exposure = 0.1
shader_param/dither_strength = 1.0
shader_param/samayun = ExtResource( "2_takrn" )
shader_param/zabr = ExtResource( "4_t7f5q" )
shader_param/stigi = ExtResource( "3_yhaf2" )
[resource]
sky_material = SubResource( "ShaderMaterial_10g43" )

View file

@ -8,6 +8,16 @@
config_version=5 config_version=5
_global_script_classes=[{
"base": "Environment",
"class": &"khanat_environment",
"language": &"GDScript",
"path": "res://maps/environments/khanat_environment.gd"
}]
_global_script_class_icons={
"khanat_environment": ""
}
[application] [application]
config/name="Third Person basic scene" config/name="Third Person basic scene"
@ -20,6 +30,7 @@ config/features=PackedStringArray("4.0", "Vulkan Clustered")
Themes="*res://scripts/themes.gd" Themes="*res://scripts/themes.gd"
Common="*res://scripts/common.gd" Common="*res://scripts/common.gd"
Screenshot="*res://scripts/screenshot.gd" Screenshot="*res://scripts/screenshot.gd"
khanat_world="*res://scripts/khanat_world.gd"
[debug] [debug]
@ -310,3 +321,30 @@ locale/translations=PackedStringArray("res://locales/en.po", "res://locales/fr.p
3d_render/layer_2="Walls" 3d_render/layer_2="Walls"
3d_render/layer_3="Enemies" 3d_render/layer_3="Enemies"
3d_render/layer_4="Boat" 3d_render/layer_4="Boat"
[shader_globals]
samayun_arc={
"type": "float",
"value": 45.0
}
samayun_pos={
"type": "vec3",
"value": Vector3(1, 1, 1)
}
stigi_pos={
"type": "vec3",
"value": Vector3(0.75, 0.75, 0.75)
}
zabr_pos={
"type": "vec3",
"value": Vector3(0.095, 0.5, 0.5)
}
zabr_arc={
"type": "float",
"value": 15.0
}
stigi_arc={
"type": "float",
"value": 5.0
}

View file

@ -1,17 +1,7 @@
# Panel to include all developpment tools for testing / debugging etc.
extends Control extends Control
# Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass $Window/VBoxContainer/MarginContainer/sky_panel/samayun_panel/data_panel/samayun_arc_value.value = khanat_world.celestial_positions["samayun_arc"]
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
# Signals calls
# Quit button
func _on_quit_pressed(): func _on_quit_pressed():
queue_free() $Window.visible = false

View file

@ -1,198 +1,119 @@
[gd_scene load_steps=5 format=3 uid="uid://cua4782cbjhla"] [gd_scene load_steps=3 format=3 uid="uid://bw4pethe0hrey"]
[ext_resource type="Script" path="res://scenes/developper/developper.gd" id="1_qf0rd"] [ext_resource type="Script" path="res://scenes/developper/developper.gd" id="1_qf0rd"]
[ext_resource type="Texture2D" uid="uid://se0t5xwdxyq7" path="res://scenes/themes/textures/base_panel.png" id="2_fmcto"]
[ext_resource type="Theme" uid="uid://bi1js53ni6ehd" path="res://UI/themes/zbasu/zbasu.theme" id="3_ols6l"]
[ext_resource type="Script" path="res://scenes/developper/sky_panel.gd" id="4_b4n1m"] [ext_resource type="Script" path="res://scenes/developper/sky_panel.gd" id="4_b4n1m"]
[node name="developper_panel" type="Control"] [node name="Control" type="Control"]
minimum_size = Vector2(350, 450)
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -175.0
offset_top = -125.0
offset_right = 175.0
offset_bottom = 125.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource( "1_qf0rd" ) script = ExtResource( "1_qf0rd" )
metadata/_edit_use_custom_anchors = false
[node name="NinePatchRect" type="NinePatchRect" parent="."] [node name="Window" type="Window" parent="."]
title = "win_developper"
visible = false
[node name="VBoxContainer" type="VBoxContainer" parent="Window"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
texture = ExtResource( "2_fmcto" )
patch_margin_left = 50
patch_margin_top = 25
patch_margin_right = 25
patch_margin_bottom = 25
axis_stretch_horizontal = 2
axis_stretch_vertical = 2
metadata/_edit_layout_mode = 1
metadata/_edit_use_custom_anchors = false
[node name="header" type="VBoxContainer" parent="."]
offset_left = 50.0
offset_top = 4.0
offset_right = 347.0
offset_bottom = 31.0
metadata/_edit_layout_mode = 0
metadata/_edit_use_custom_anchors = false
[node name="Label" type="Label" parent="header"]
offset_top = -1.0
offset_right = 297.0
offset_bottom = 26.4
theme = ExtResource( "3_ols6l" )
text = "win_developper"
[node name="main" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 12.0
offset_top = 33.0
offset_right = -10.0
offset_bottom = -37.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
metadata/_edit_use_custom_anchors = false metadata/_edit_use_custom_anchors = false
metadata/_edit_layout_mode = 1
[node name="sky_panel" type="VBoxContainer" parent="main"] [node name="MarginContainer" type="MarginContainer" parent="Window/VBoxContainer"]
offset_right = 328.0 offset_right = 40.0
offset_bottom = 206.0 offset_bottom = 40.0
size_flags_vertical = 3
theme_override_constants/margin_right = 5
theme_override_constants/margin_top = 5
theme_override_constants/margin_left = 5
theme_override_constants/margin_bottom = 5
[node name="sky_panel" type="VBoxContainer" parent="Window/VBoxContainer/MarginContainer"]
offset_left = 5.0
offset_top = 5.0
offset_right = 127.0
offset_bottom = 273.0
script = ExtResource( "4_b4n1m" ) script = ExtResource( "4_b4n1m" )
[node name="sky_panel" type="Label" parent="main/sky_panel"] [node name="samayun_panel" type="VBoxContainer" parent="Window/VBoxContainer/MarginContainer/sky_panel"]
offset_right = 328.0 offset_right = 40.0
offset_bottom = 26.0 offset_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
text = "lab_sky_panel"
[node name="samayun_panel" type="VBoxContainer" parent="main/sky_panel"] [node name="Label" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/samayun_panel"]
offset_top = 30.0 offset_right = 40.0
offset_right = 328.0 offset_bottom = 23.0
offset_bottom = 86.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="samayun_name" type="Label" parent="main/sky_panel/samayun_panel"]
offset_right = 328.0
offset_bottom = 26.0
text = "samayun_name" text = "samayun_name"
horizontal_alignment = 1 horizontal_alignment = 1
[node name="data_panel" type="HBoxContainer" parent="main/sky_panel/samayun_panel"] [node name="data_panel" type="VBoxContainer" parent="Window/VBoxContainer/MarginContainer/sky_panel/samayun_panel"]
offset_top = 30.0 offset_right = 40.0
offset_right = 328.0 offset_bottom = 40.0
offset_bottom = 56.0
[node name="samayun_pos" type="Label" parent="main/sky_panel/samayun_panel/data_panel"] [node name="samayun_pos" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/samayun_panel/data_panel"]
offset_right = 162.0 offset_right = 40.0
offset_bottom = 26.0 offset_bottom = 23.0
size_flags_horizontal = 3
text = "samayun_pos"
[node name="samayun_arc" type="Label" parent="main/sky_panel/samayun_panel/data_panel"] [node name="samayun_arc" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/samayun_panel/data_panel"]
offset_left = 166.0 offset_right = 40.0
offset_right = 328.0 offset_bottom = 23.0
offset_bottom = 26.0
size_flags_horizontal = 3
size_flags_vertical = 0
text = "samayun_arc"
[node name="zabr_panel" type="VBoxContainer" parent="main/sky_panel"] [node name="samayun_arc_value" type="HSlider" parent="Window/VBoxContainer/MarginContainer/sky_panel/samayun_panel/data_panel"]
offset_top = 90.0 offset_right = 8.0
offset_right = 328.0 offset_bottom = 16.0
offset_bottom = 146.0
size_flags_vertical = 3
[node name="zabr_name" type="Label" parent="main/sky_panel/zabr_panel"] [node name="stigi_panel" type="VBoxContainer" parent="Window/VBoxContainer/MarginContainer/sky_panel"]
offset_right = 328.0 offset_right = 40.0
offset_bottom = 26.0 offset_bottom = 40.0
text = "zabr_name"
horizontal_alignment = 1
[node name="data_panel" type="HBoxContainer" parent="main/sky_panel/zabr_panel"] [node name="Label" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/stigi_panel"]
offset_top = 30.0 offset_right = 40.0
offset_right = 328.0
offset_bottom = 56.0
[node name="zabr_pos" type="Label" parent="main/sky_panel/zabr_panel/data_panel"]
offset_right = 162.0
offset_bottom = 26.0
size_flags_horizontal = 3
text = "zabr_pos
"
[node name="zabr_arc" type="Label" parent="main/sky_panel/zabr_panel/data_panel"]
offset_left = 166.0
offset_right = 328.0
offset_bottom = 26.0
size_flags_horizontal = 3
size_flags_vertical = 0
text = "zabr_arc"
[node name="stigi_panel" type="VBoxContainer" parent="main/sky_panel"]
offset_top = 150.0
offset_right = 328.0
offset_bottom = 206.0
size_flags_vertical = 3
[node name="stigi_name" type="Label" parent="main/sky_panel/stigi_panel"]
offset_right = 328.0
offset_bottom = 26.0 offset_bottom = 26.0
text = "stigi_name" text = "stigi_name"
horizontal_alignment = 1 horizontal_alignment = 1
[node name="data_panel" type="HBoxContainer" parent="main/sky_panel/stigi_panel"] [node name="data_panel" type="VBoxContainer" parent="Window/VBoxContainer/MarginContainer/sky_panel/stigi_panel"]
offset_top = 30.0 offset_right = 40.0
offset_right = 328.0 offset_bottom = 40.0
offset_bottom = 56.0
[node name="stigi_pos" type="Label" parent="main/sky_panel/stigi_panel/data_panel"] [node name="stigi_pos" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/stigi_panel/data_panel"]
offset_right = 162.0 offset_right = 40.0
offset_bottom = 23.0
[node name="stigi_arc" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/stigi_panel/data_panel"]
offset_right = 40.0
offset_bottom = 23.0
[node name="zabr_panel" type="VBoxContainer" parent="Window/VBoxContainer/MarginContainer/sky_panel"]
offset_right = 40.0
offset_bottom = 40.0
[node name="Label" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/zabr_panel"]
offset_right = 40.0
offset_bottom = 26.0 offset_bottom = 26.0
size_flags_horizontal = 3 text = "zabr_name"
text = "stigi_pos" horizontal_alignment = 1
[node name="stigi_arc" type="Label" parent="main/sky_panel/stigi_panel/data_panel"] [node name="data_panel" type="VBoxContainer" parent="Window/VBoxContainer/MarginContainer/sky_panel/zabr_panel"]
offset_left = 166.0 offset_right = 40.0
offset_right = 328.0 offset_bottom = 40.0
offset_bottom = 26.0
size_flags_horizontal = 3
size_flags_vertical = 0
text = "stigi_arc"
[node name="footer" type="VBoxContainer" parent="."] [node name="zabr_pos" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/zabr_panel/data_panel"]
minimum_size = Vector2(0, 30) offset_right = 40.0
anchor_left = 0.5 offset_bottom = 23.0
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -172.0
offset_top = -34.0
offset_right = 172.0
size_flags_vertical = 10
metadata/_edit_layout_mode = 0
metadata/_edit_use_custom_anchors = false
[node name="Quit" type="Button" parent="footer"] [node name="zabr_arc" type="Label" parent="Window/VBoxContainer/MarginContainer/sky_panel/zabr_panel/data_panel"]
minimum_size = Vector2(75, 0) offset_right = 40.0
offset_left = 134.0 offset_bottom = 23.0
offset_top = 7.0
offset_right = 209.0 [node name="Quit" type="Button" parent="Window/VBoxContainer"]
offset_bottom = 26.0 offset_left = 491.0
offset_top = 569.0
offset_right = 533.0
offset_bottom = 600.0
size_flags_horizontal = 4 size_flags_horizontal = 4
size_flags_vertical = 6 size_flags_vertical = 8
theme = ExtResource( "3_ols6l" )
text = "Quit" text = "Quit"
[connection signal="pressed" from="footer/Quit" to="." method="_on_quit_pressed"] [connection signal="close_requested" from="Window" to="." method="_on_quit_pressed"]
[connection signal="value_changed" from="Window/VBoxContainer/MarginContainer/sky_panel/samayun_panel/data_panel/samayun_arc_value" to="Window/VBoxContainer/MarginContainer/sky_panel" method="_on_samayun_arc_value_value_changed"]
[connection signal="pressed" from="Window/VBoxContainer/Quit" to="." method="_on_quit_pressed"]

View file

@ -1,12 +1,24 @@
extends VBoxContainer extends VBoxContainer
signal celestial_manual_moved(parameters)
func _ready(): func _ready():
# Get the initial positions of celestial objects from shader paramaters # Get the initial positions of celestial objects from shader paramaters
# to display them in proper panel # to display them in proper panel
var positions = get_parent().get_parent().get_parent().get_parent().get_node("terrain_basic_setup").get_celestial_coordinates() # var positions = get_node("/root/maine_scene/terrain_basic_setup/WorldEnvironment").Environment.get_celestial_coordinates()
for planet in ["stigi", "zabr","samayun"]: var positions = khanat_world.celestial_positions
get_node("%s_panel/data_panel/%s_pos" %[planet, planet]).text = "%s :\n - X %2f\n - Y %2f\n - Z %2f" % [tr("lab_position"), positions["%s_pos" %[planet]][0], positions["%s_pos" %[planet]][1], positions["%s_pos" %[planet]][2]] print("Positions : %s" %positions)
for planet in ["samayun", "stigi", "zabr"]:
get_node("%s_panel/data_panel/%s_pos" %[planet, planet]).text = "%s :\n - X %2f\n - Y %2f\n - Z %2f" % [tr("lab_position"), positions["%s_position" %[planet]][0], positions["%s_position" %[planet]][1], positions["%s_position" %[planet]][2]]
get_node("%s_panel/data_panel/%s_arc" %[planet, planet]).text = "%s : %s" % [tr("lab_size"), positions["%s_arc" %[planet]]] get_node("%s_panel/data_panel/%s_arc" %[planet, planet]).text = "%s : %s" % [tr("lab_size"), positions["%s_arc" %[planet]]]
func _process(delta): func _process(delta):
pass pass
func _on_samayun_arc_value_value_changed(value):
khanat_world.celestial_positions["samayun_arc"] = value
$samayun_panel/data_panel/samayun_arc_value.value = value
$samayun_panel/data_panel/samayun_arc.text = "%s : %s" % [tr("lab_size"), str(value)]
emit_signal("celestial_manual_moved", khanat_world.celestial_positions)

View file

@ -67,8 +67,8 @@ func _on_themes_pressed():
$MenuTheme/Window.visible = true $MenuTheme/Window.visible = true
func _on_dev_pressed(): func _on_dev_pressed():
var developper_panel = preload("res://scenes/developper/developper.tscn").instantiate() $MenuDev/Window.popup_centered()
add_child(developper_panel) $MenuDev/Window.visible = true
func _on_about_pressed(): func _on_about_pressed():
var aboutmessage:String var aboutmessage:String

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://cdyi1a858p7em"] [gd_scene load_steps=8 format=3 uid="uid://cdyi1a858p7em"]
[ext_resource type="Theme" uid="uid://bi1js53ni6ehd" path="res://UI/themes/zbasu/zbasu.theme" id="1_iq3fo"] [ext_resource type="Theme" uid="uid://bi1js53ni6ehd" path="res://UI/themes/zbasu/zbasu.theme" id="1_iq3fo"]
[ext_resource type="Script" path="res://scenes/hud/hud.gd" id="1_s6f6d"] [ext_resource type="Script" path="res://scenes/hud/hud.gd" id="1_s6f6d"]
@ -6,6 +6,7 @@
[ext_resource type="PackedScene" uid="uid://cl8xk8w3jmta0" path="res://scenes/controls/controls.tscn" id="3_08xl7"] [ext_resource type="PackedScene" uid="uid://cl8xk8w3jmta0" path="res://scenes/controls/controls.tscn" id="3_08xl7"]
[ext_resource type="PackedScene" uid="uid://cb0gfweooxdsl" path="res://scenes/themes/themes.tscn" id="4_1poje"] [ext_resource type="PackedScene" uid="uid://cb0gfweooxdsl" path="res://scenes/themes/themes.tscn" id="4_1poje"]
[ext_resource type="PackedScene" uid="uid://ebfrhgrluixd" path="res://scenes/music/music_manager.tscn" id="6_0ivsi"] [ext_resource type="PackedScene" uid="uid://ebfrhgrluixd" path="res://scenes/music/music_manager.tscn" id="6_0ivsi"]
[ext_resource type="PackedScene" uid="uid://bw4pethe0hrey" path="res://scenes/developper/developper.tscn" id="7_ix5xc"]
[node name="Control" type="Control"] [node name="Control" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -95,9 +96,30 @@ visible = false
[node name="MenuTheme" parent="." instance=ExtResource( "4_1poje" )] [node name="MenuTheme" parent="." instance=ExtResource( "4_1poje" )]
visible = false visible = false
anchor_right = 0.0
anchor_bottom = 0.0
metadata/_edit_layout_mode = 1
metadata/_edit_use_custom_anchors = false
[node name="MusicManager" parent="." instance=ExtResource( "6_0ivsi" )] [node name="MusicManager" parent="." instance=ExtResource( "6_0ivsi" )]
visible = false visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_layout_mode = 1
metadata/_edit_use_custom_anchors = false
[node name="MenuDev" parent="." instance=ExtResource( "7_ix5xc" )]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_layout_mode = 1
metadata/_edit_use_custom_anchors = false
[connection signal="pressed" from="Menu/Keys" to="." method="_on_keys_pressed"] [connection signal="pressed" from="Menu/Keys" to="." method="_on_keys_pressed"]
[connection signal="pressed" from="Menu/Themes" to="." method="_on_themes_pressed"] [connection signal="pressed" from="Menu/Themes" to="." method="_on_themes_pressed"]

View file

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://dwxrvijqyym70" path="res://player/player.tscn" id="1_btdsd"] [ext_resource type="PackedScene" uid="uid://dwxrvijqyym70" path="res://player/player.tscn" id="1_btdsd"]
[ext_resource type="Script" path="res://scenes/main/main.gd" id="1_ld2xt"] [ext_resource type="Script" path="res://scenes/main/main.gd" id="1_ld2xt"]
[ext_resource type="PackedScene" uid="uid://b8p2h0rmwy7qn" path="res://maps/basic_setup.tscn" id="2_jj4oa"] [ext_resource type="PackedScene" uid="uid://cul5wj3ouq8u4" path="res://maps/basic_setup.tscn" id="2_jj4oa"]
[ext_resource type="PackedScene" uid="uid://cdyi1a858p7em" path="res://scenes/hud/hud.tscn" id="3_5vcj4"] [ext_resource type="PackedScene" uid="uid://cdyi1a858p7em" path="res://scenes/hud/hud.tscn" id="3_5vcj4"]
[node name="main_scene" type="Node3D"] [node name="main_scene" type="Node3D"]

24
scripts/khanat_world.gd Normal file
View file

@ -0,0 +1,24 @@
extends Node
var celestial_positions = {
"samayun_position":Vector3( 0.0, 0.5, 0.0 ),
"samayun_arc":45,
"stigi_position":Vector3( 0.0, 0.8, 0.0 ),
"stigi_arc":8,
"zabr_position":Vector3( 0.0, 0.7, 0.0 ),
"zabr_arc":15,
}
func _ready():
khanat_world.celestial_positions = celestial_positions
var sky_panel = get_node("/root/main_scene/Control/MenuDev/Window/VBoxContainer/MarginContainer/sky_panel")
sky_panel.celestial_manual_moved.connect(self._set_celestial)
func _process(delta):
pass
func _set_celestial(parameters):
for key in parameters:
RenderingServer.global_variable_set(key, parameters[key])
celestial_positions[key] = parameters[key]
Common.msg_debug("New celestial parameter : %s with value %s" % [key, parameters[key]])