From b8d780b2a24c078979ac163d3fba95674120d365 Mon Sep 17 00:00:00 2001 From: shurongsen <1799096798@qq.com> Date: Fri, 3 Jan 2025 14:02:17 +0800 Subject: [PATCH] =?UTF-8?q?3d=20=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/language_panel_horizontal.tscn | 7 +- Modules/language_panel_vertical.tscn | 6 +- Modules/tunnel_panel.tscn | 8 +- common/shader/curvature.gdshader | 52 +++++ common/shader/curvature_alpha.gdshader | 39 ++++ .../shader/curvature_alpha_scissor.gdshader | 43 ++++ common/shader/gaussian_blur.gdshader | 46 ++++ .../inc/adjustment_global_color.gdshaderinc | 6 + common/shader/inc/common.gdshaderinc | 26 +++ common/shader/inc/curvature.gdshaderinc | 20 ++ common/shader/mask.gdshader | 42 ++++ common/shader/round.gdshader | 101 +++++++++ common/shader/startup_guide_twinkle.gdshader | 14 ++ main.gd | 19 +- main.tscn | 191 +---------------- main_perspective.gd | 7 +- main_perspectiveinfo.gd | 18 +- main_perspectiveinfo.tscn | 200 ++++++++++++++++++ 18 files changed, 645 insertions(+), 200 deletions(-) create mode 100644 common/shader/curvature.gdshader create mode 100644 common/shader/curvature_alpha.gdshader create mode 100644 common/shader/curvature_alpha_scissor.gdshader create mode 100644 common/shader/gaussian_blur.gdshader create mode 100644 common/shader/inc/adjustment_global_color.gdshaderinc create mode 100644 common/shader/inc/common.gdshaderinc create mode 100644 common/shader/inc/curvature.gdshaderinc create mode 100644 common/shader/mask.gdshader create mode 100644 common/shader/round.gdshader create mode 100644 common/shader/startup_guide_twinkle.gdshader create mode 100644 main_perspectiveinfo.tscn diff --git a/Modules/language_panel_horizontal.tscn b/Modules/language_panel_horizontal.tscn index ed0f89f..6ab9ffe 100644 --- a/Modules/language_panel_horizontal.tscn +++ b/Modules/language_panel_horizontal.tscn @@ -21,7 +21,7 @@ script = ExtResource("1_ne44a") button_arr = [NodePath("HBoxContainer2/Button"), NodePath("HBoxContainer2/Button2"), NodePath("HBoxContainer2/Button3")] close_button = NodePath("CloseButton") -[node name="mask2" type="TextureRect" parent="."] +[node name="mask2" type="NinePatchRect" parent="."] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -29,6 +29,11 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_5ld7q") +region_rect = Rect2(0, 0, 1426, 803) +patch_margin_left = 48 +patch_margin_top = 48 +patch_margin_right = 48 +patch_margin_bottom = 48 [node name="HBoxContainer2" type="HBoxContainer" parent="."] layout_mode = 1 diff --git a/Modules/language_panel_vertical.tscn b/Modules/language_panel_vertical.tscn index fd41f65..8a13d82 100644 --- a/Modules/language_panel_vertical.tscn +++ b/Modules/language_panel_vertical.tscn @@ -21,7 +21,7 @@ script = ExtResource("1_y0e1v") button_arr = [NodePath("VBoxContainer2/Button"), NodePath("VBoxContainer2/Button2"), NodePath("VBoxContainer2/Button3")] close_button = NodePath("CloseButton") -[node name="mask2" type="TextureRect" parent="."] +[node name="mask2" type="NinePatchRect" parent="."] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -29,6 +29,10 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_5cktv") +patch_margin_left = 37 +patch_margin_top = 37 +patch_margin_right = 37 +patch_margin_bottom = 40 [node name="VBoxContainer2" type="VBoxContainer" parent="."] layout_mode = 1 diff --git a/Modules/tunnel_panel.tscn b/Modules/tunnel_panel.tscn index 7157323..be98510 100644 --- a/Modules/tunnel_panel.tscn +++ b/Modules/tunnel_panel.tscn @@ -22,7 +22,7 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_p8w8i") -[node name="mask3" type="TextureRect" parent="."] +[node name="mask3" type="NinePatchRect" parent="."] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -30,7 +30,11 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("1_n5cpy") -expand_mode = 1 +region_rect = Rect2(0, 0, 1426, 803) +patch_margin_left = 40 +patch_margin_top = 40 +patch_margin_right = 35 +patch_margin_bottom = 43 [node name="TextureRect2" type="TextureRect" parent="."] layout_mode = 1 diff --git a/common/shader/curvature.gdshader b/common/shader/curvature.gdshader new file mode 100644 index 0000000..da10da1 --- /dev/null +++ b/common/shader/curvature.gdshader @@ -0,0 +1,52 @@ +// NOTE: Shader automatically converted from Godot Engine 4.0.3.rc1's StandardMaterial3D. + +shader_type spatial; +render_mode blend_mix,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx; + + + + + + +#include "inc/common.gdshaderinc" +#include "inc/curvature.gdshaderinc" + +void vertex() { + UV=UV*uv1_scale.xy+uv1_offset.xy; + VERTEX = curvature_vertex(MODEL_MATRIX,VERTEX); +} + + + + + + +void fragment() { + vec2 base_uv = UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + albedo_tex *= COLOR; + ALBEDO = albedo.rgb * albedo_tex.rgb; + float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel); + METALLIC = metallic_tex * metallic; + vec4 roughness_texture_channel = vec4(1.0,0.0,0.0,0.0); + float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel); + ROUGHNESS = roughness_tex * roughness; + SPECULAR = specular; + if (emission_enabled) { + vec3 emission_tex = texture(texture_emission,base_uv).rgb; + EMISSION = (emission.rgb+emission_tex)*emission_energy; + } + + if (ao_enabled) { + AO = dot(texture(texture_ambient_occlusion,base_uv),ao_texture_channel); + AO_LIGHT_AFFECT = ao_light_affect; + } + + if (normal_enabled) { + NORMAL_MAP = texture(texture_normal,base_uv).rgb; + NORMAL_MAP_DEPTH = normal_scale; + } + + + +} diff --git a/common/shader/curvature_alpha.gdshader b/common/shader/curvature_alpha.gdshader new file mode 100644 index 0000000..4646fa5 --- /dev/null +++ b/common/shader/curvature_alpha.gdshader @@ -0,0 +1,39 @@ +// NOTE: Shader automatically converted from Godot Engine 4.0.3.rc1's StandardMaterial3D. + +shader_type spatial; +render_mode blend_mix,depth_draw_always,cull_disabled,diffuse_burley,specular_schlick_ggx,depth_prepass_alpha; + +#include "inc/common.gdshaderinc" +#include "inc/curvature.gdshaderinc" +void vertex() { + UV=UV*uv1_scale.xy+uv1_offset.xy; + VERTEX = curvature_vertex(MODEL_MATRIX,VERTEX); +} + +void fragment() { + vec2 base_uv = UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + albedo_tex *= COLOR; + ALBEDO = albedo.rgb * albedo_tex.rgb; + float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel); + METALLIC = metallic_tex * metallic; + vec4 roughness_texture_channel = vec4(1.0,0.0,0.0,0.0); + float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel); + ROUGHNESS = roughness_tex * roughness; + SPECULAR = specular; + ALPHA *= albedo.a * albedo_tex.a; + if (emission_enabled) { + vec3 emission_tex = texture(texture_emission,base_uv).rgb; + EMISSION = (emission.rgb+emission_tex)*emission_energy; + } + + if (ao_enabled) { + AO = dot(texture(texture_ambient_occlusion,base_uv),ao_texture_channel); + AO_LIGHT_AFFECT = ao_light_affect; + } + + if (normal_enabled) { + NORMAL_MAP = texture(texture_normal,base_uv).rgb; + NORMAL_MAP_DEPTH = normal_scale; + } +} diff --git a/common/shader/curvature_alpha_scissor.gdshader b/common/shader/curvature_alpha_scissor.gdshader new file mode 100644 index 0000000..b54bee9 --- /dev/null +++ b/common/shader/curvature_alpha_scissor.gdshader @@ -0,0 +1,43 @@ +// NOTE: Shader automatically converted from Godot Engine 4.0.3.rc1's StandardMaterial3D. + +shader_type spatial; +render_mode blend_mix,depth_draw_always,cull_disabled,diffuse_burley,specular_schlick_ggx; + +#include "inc/common.gdshaderinc" +#include "inc/curvature.gdshaderinc" + +uniform float alpha_scissor_threshold = 0.934; + +void vertex() { + UV=UV*uv1_scale.xy+uv1_offset.xy; + VERTEX = curvature_vertex(MODEL_MATRIX,VERTEX); +} + +void fragment() { + vec2 base_uv = UV; + vec4 albedo_tex = texture(texture_albedo,base_uv); + albedo_tex *= COLOR; + ALBEDO = albedo.rgb * albedo_tex.rgb; + float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel); + METALLIC = metallic_tex * metallic; + vec4 roughness_texture_channel = vec4(1.0,0.0,0.0,0.0); + float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel); + ROUGHNESS = roughness_tex * roughness; + SPECULAR = specular; + ALPHA *= albedo.a * albedo_tex.a; + ALPHA_SCISSOR_THRESHOLD = alpha_scissor_threshold; + if (emission_enabled) { + vec3 emission_tex = texture(texture_emission,base_uv).rgb; + EMISSION = (emission.rgb+emission_tex)*emission_energy; + } + + if (ao_enabled) { + AO = dot(texture(texture_ambient_occlusion,base_uv),ao_texture_channel); + AO_LIGHT_AFFECT = ao_light_affect; + } + + if (normal_enabled) { + NORMAL_MAP = texture(texture_normal,base_uv).rgb; + NORMAL_MAP_DEPTH = normal_scale; + } +} diff --git a/common/shader/gaussian_blur.gdshader b/common/shader/gaussian_blur.gdshader new file mode 100644 index 0000000..53f7ffb --- /dev/null +++ b/common/shader/gaussian_blur.gdshader @@ -0,0 +1,46 @@ +shader_type canvas_item; +uniform float Fuzziness = 5; + +float normpdf(in float x, in float sigma){ + return 0.39894*exp(-.5*x*x/(sigma*sigma))/sigma; +} + +uniform float radius : hint_range(0.0, 1.0) = 0.0; +uniform vec2 size = vec2(1.0, 1.0); +uniform bool cool = false; + + + + + +vec4 gaussian_blur(sampler2D src, vec2 size_gb, vec2 uv, int m_size){ + vec4 cc = texture(src, uv); + vec3 c = cc.rgb; + int k_size = (m_size-1)/2; + float sigma = 7.; + vec3 final_color = vec3(0.); + float z = 0.; + for(int i=-k_size;i<=k_size;i++){ + float n = normpdf(float(i), sigma); + z+=n; + for(int j=-k_size;j<=k_size;j++){ + final_color+=n*n*texture(src,uv+(size_gb*Fuzziness)*vec2(float(i),float(j))).rgb; + } + } + return vec4(final_color/z/z,1.); +} + +void fragment(){ + if (cool == false ){ + COLOR = texture(TEXTURE, UV); + } + + vec2 size_ratio = vec2(max(1.0, size.x / size.y), max(1.0, size.y / size.x)); + float half_radius = 0.5 * radius; + vec2 dist_max = half_radius / size_ratio; + vec2 edge_pos = clamp(UV, dist_max, 1.0 - dist_max); + float edge_dist = distance(UV * size_ratio, edge_pos * size_ratio); + + COLOR = gaussian_blur(TEXTURE ,TEXTURE_PIXEL_SIZE ,UV , 20); + COLOR.a *= step(edge_dist, half_radius + 0.000001); +} \ No newline at end of file diff --git a/common/shader/inc/adjustment_global_color.gdshaderinc b/common/shader/inc/adjustment_global_color.gdshaderinc new file mode 100644 index 0000000..40ab691 --- /dev/null +++ b/common/shader/inc/adjustment_global_color.gdshaderinc @@ -0,0 +1,6 @@ + + + +vec3 adjust_global_color(vec3 g_color){ + return mix(pow((g_color.rgb + vec3(0.055)) * (1.0 / (1.0 + 0.055)), vec3(2.4)), g_color.rgb * (1.0 / 12.92), lessThan(g_color.rgb, vec3(0.04045))); +} \ No newline at end of file diff --git a/common/shader/inc/common.gdshaderinc b/common/shader/inc/common.gdshaderinc new file mode 100644 index 0000000..bca4f15 --- /dev/null +++ b/common/shader/inc/common.gdshaderinc @@ -0,0 +1,26 @@ +uniform vec4 albedo : source_color = vec4(1.0); +uniform sampler2D texture_albedo : source_color,filter_linear_mipmap,repeat_enable; +uniform float point_size : hint_range(0,128)= 1; +uniform float roughness : hint_range(0,1) = 0.5; +uniform sampler2D texture_metallic : hint_default_white,filter_linear_mipmap,repeat_enable; +uniform vec4 metallic_texture_channel; +uniform sampler2D texture_roughness : hint_roughness_r,filter_linear_mipmap,repeat_enable; +uniform float specular = 0.5; +uniform float metallic; +uniform bool emission_enabled = false; +uniform sampler2D texture_emission : source_color, hint_default_black,filter_linear_mipmap,repeat_enable; +uniform vec4 emission : source_color; +uniform float emission_energy; +uniform bool ao_enabled = false; +uniform sampler2D texture_ambient_occlusion : hint_default_white, filter_linear_mipmap,repeat_enable; +uniform vec4 ao_texture_channel =vec4(1,0,0,0); +uniform float ao_light_affect; +uniform bool normal_enabled = false; +uniform sampler2D texture_normal : hint_roughness_normal,filter_linear_mipmap,repeat_enable; +uniform float normal_scale : hint_range(-16,16); + + +uniform vec3 uv1_scale= vec3(1,1,1); +uniform vec3 uv1_offset; +uniform vec3 uv2_scale= vec3(1,1,1); +uniform vec3 uv2_offset; \ No newline at end of file diff --git a/common/shader/inc/curvature.gdshaderinc b/common/shader/inc/curvature.gdshaderinc new file mode 100644 index 0000000..ac45609 --- /dev/null +++ b/common/shader/inc/curvature.gdshaderinc @@ -0,0 +1,20 @@ +global uniform bool is_curvature; +global uniform float curvature_radius; +global uniform vec3 player_position; + + +float get_depth(float dist){ + return sqrt(dist*dist + curvature_radius * curvature_radius) - curvature_radius ; +} + +vec3 curvature_vertex(mat4 model_matrix ,vec3 vertex ) { + if (is_curvature ){ + vec3 vertex_world =(model_matrix * vec4(vertex, 1.0)).xyz ; + vec3 dist = vertex_world -player_position; + float depth = get_depth(length(dist.xz)); + vertex_world.y -= depth; + vec3 vertex_local = (inverse(model_matrix) * vec4(vertex_world, 1.0)).xyz; + vertex = vertex_local; + } + return vertex; +} diff --git a/common/shader/mask.gdshader b/common/shader/mask.gdshader new file mode 100644 index 0000000..46c9eff --- /dev/null +++ b/common/shader/mask.gdshader @@ -0,0 +1,42 @@ +shader_type canvas_item; + +uniform sampler2D texture; +uniform float time; +uniform vec2 resolution; +uniform vec4 dissolveColor; // Controllo del colore e della trasparenza dell'effetto di dissolvenza +uniform float circleSize; // Controllo sulla grandezza del cerchio +uniform sampler2D hologramTexture; +uniform float maxR = .5; +uniform float smoothness = .5; +uniform float displayRatio =1.7; +void fragment() { + // normalized configurable factors +// float maxR = .5; + + float minR = maxR * (1.0 - smoothness); + vec2 centerUv = vec2(0.5, 0.5); + + + + // just to play animation + + + // Normalized pixel coordinates (from 0 to 1) + vec2 uv = UV; + vec2 duv = uv; + duv.x *= displayRatio; + centerUv.x *= displayRatio; + + vec3 col = texture(texture, uv).rgb; + float dist = length(centerUv - duv); + COLOR.a = 0.; + if (dist > maxR) { + COLOR = vec4(0.0, 0.0, 0.0, 1.0); + } + + if (maxR > dist && dist > minR) { + col = mix(col, vec3(0.0, 0.0, 0.0), smoothstep(minR/maxR,1.0,dist/maxR)); + } + + // COLOR = vec4(col,1.0); +} \ No newline at end of file diff --git a/common/shader/round.gdshader b/common/shader/round.gdshader new file mode 100644 index 0000000..1720066 --- /dev/null +++ b/common/shader/round.gdshader @@ -0,0 +1,101 @@ +shader_type canvas_item; +render_mode blend_mix; + +uniform vec2 size = vec2(1.0, 1.0); + + + +uniform float round_all = 0.; + +uniform float left_top = 0.; +uniform float right_top = 0.; +uniform float left_bottom = 0.; +uniform float right_botom = 0.; + +uniform vec4 border_color : source_color; +uniform vec4 Background_color : source_color; +uniform float Background_color_a =0.; + +uniform float border_width = 0.; +uniform bool isColor = false; +uniform bool isBackground_color = false; +void fragment() { + vec2 size_ratio = vec2(max(1.0, size.x / size.y), max(1.0, size.y / size.x)); + if( !isColor ) { + COLOR = texture(TEXTURE, UV); + } +// if ( isBackground_color){ +// vec4 a = (Background_color - texture(TEXTURE, UV)); +// vec4 b = Background_color - a; +// if (a != Background_color){ +// a = 1.-a; +// } +// COLOR = a+b; +// COLOR = Background_color*(1.-texture(TEXTURE, UV))+texture(TEXTURE, UV); +// COLOR.a = texture(TEXTURE, UV).a; +// COLOR = texture(TEXTURE, UV)*Background_color; +// COLOR.a = 1.0 - (texture(TEXTURE, UV)*Background_color).a; +// COLOR += ; +// } + if (COLOR.a <= Background_color_a && isBackground_color){ + COLOR = Background_color; + + } + float minSize = min(size.x,size.y); + float left_top_my = left_top/minSize; + float right_top_my = right_top/minSize; + float left_bottom_my = left_bottom/minSize; + float right_botom_my = right_botom/minSize; + float border_width_my = border_width/minSize; + if (round_all>0.){ + left_top_my = round_all/minSize; + right_top_my = round_all/minSize; + left_bottom_my = round_all/minSize; + right_botom_my = round_all/minSize; + } + vec2 uv = UV; + if (uv.x*size_ratio.x <= left_top_my && uv.y*size_ratio.y+left_top_my <= left_top_my*2.){ + float len = length(vec2(uv.x*size_ratio.x - (left_top_my),(uv.y)*size_ratio.y-(left_top_my))); + if (0. ld && COLOR.g > ld && COLOR.b > ld){ + float r = clamp(COLOR.r*sin(TIME*time),-1,1); + float g = clamp(COLOR.g*sin(TIME*time),-1,1); + float b = clamp(COLOR.b*sin(TIME*time),-1,1); + float a = clamp(.1*sin(TIME*time),0,1); + COLOR = COLOR+vec4(abs(r),abs(g),abs(b),a); + } + +} \ No newline at end of file diff --git a/main.gd b/main.gd index d2c29b6..754693d 100644 --- a/main.gd +++ b/main.gd @@ -1,6 +1,7 @@ extends Control - - +var StateTab = null +func _ready() -> void: + StateTab = find_child("StateTab") func _on_more_option_pressed() -> void: %MoreOptionPanel.visibility_layer=not %MoreOptionPanel.visibility_layer pass # Replace with function body. @@ -10,13 +11,13 @@ func _on_ad_view_self_click(is_selected: bool) -> void: %ADPanel.visible=not is_selected if not is_selected: %ADTab.hide() - %StateTab.hide() + StateTab.hide() pass # Replace with function body. func _on_tunnel_panel_request_hide() -> void: %ADTab.hide() - %StateTab.hide() + StateTab.hide() pass # Replace with function body. @@ -27,8 +28,8 @@ func _on_tunnel_panel_search_click(str: String) -> void: func _on_language_pressed() -> void: if %ADView.is_select: - %StateTab.set_current_tab(0) - %StateTab.show() + StateTab.set_current_tab(0) + StateTab.show() else: %ADTab.set_current_tab(0) %ADTab.show() @@ -39,8 +40,8 @@ func _on_language_pressed() -> void: func _on_tunnel_pressed() -> void: if %ADView.is_select: - %StateTab.set_current_tab(1) - %StateTab.show() + StateTab.set_current_tab(1) + StateTab.show() else: %ADTab.set_current_tab(1) %ADTab.show() @@ -60,5 +61,5 @@ func _on_language_vertical_click(index: int) -> void: func _on_language_close_requeset() -> void: %ADTab.hide() - %StateTab.hide() + StateTab.hide() pass # Replace with function body. diff --git a/main.tscn b/main.tscn index da81547..2d6644a 100644 --- a/main.tscn +++ b/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=27 format=3 uid="uid://dwv63mpx0y857"] +[gd_scene load_steps=23 format=3 uid="uid://dwv63mpx0y857"] [ext_resource type="Script" path="res://main.gd" id="1_7mntx"] [ext_resource type="Texture2D" uid="uid://ctqyt5yh6uy78" path="res://res/bg/bg_dropdown_menu_active.png" id="1_rrn5x"] @@ -15,18 +15,15 @@ [ext_resource type="Texture2D" uid="uid://uaj4hq8l4sfr" path="res://res/icon/icon_hide_video_hover.png" id="8_ahwag"] [ext_resource type="Script" path="res://Modules/StateChangeButtonItem.gd" id="8_xyn63"] [ext_resource type="Texture2D" uid="uid://sbsycy5byl8k" path="res://res/icon/icon_show_video_default.png" id="11_nx1mp"] -[ext_resource type="Texture2D" uid="uid://dnpguw2kxiycr" path="res://res/bg/bg_info_panel_time_default.png" id="12_bp84h"] -[ext_resource type="PackedScene" uid="uid://b1v18ra6fsxt5" path="res://Modules/language_panel_horizontal.tscn" id="12_g3kjd"] [ext_resource type="Texture2D" uid="uid://0fslq0o4y3cl" path="res://res/icon/icon_show_video_hover.png" id="12_py6bo"] [ext_resource type="PackedScene" uid="uid://bk6628qw2j15m" path="res://Modules/language_panel_vertical.tscn" id="13_ec1yh"] -[ext_resource type="Texture2D" uid="uid://ncxqcxrll4gn" path="res://res/bg/bg_info_panel_speed_safebelt_default.png" id="13_ko5d5"] -[ext_resource type="Texture2D" uid="uid://bkftfoedt3036" path="res://res/icon/icon_safebelt_yes.png" id="14_1xl0y"] [ext_resource type="PackedScene" uid="uid://dh23at8cqmfe8" path="res://Modules/station_view_new.tscn" id="15_nyjwy"] +[ext_resource type="PackedScene" uid="uid://425pbmb8drum" path="res://main_perspectiveinfo.tscn" id="17_01nvm"] [ext_resource type="PackedScene" uid="uid://dwjj0vio2iyaf" path="res://Modules/tunnel_panel.tscn" id="17_6c7jw"] -[ext_resource type="Script" path="res://main_perspective.gd" id="17_cuo7m"] -[ext_resource type="Script" path="res://main_perspectiveinfo.gd" id="17_e06tv"] [ext_resource type="Environment" uid="uid://c5ksuke04sr07" path="res://res3D/mainEnvironment.tres" id="25_vr8se"] +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_itxs2"] + [node name="Control" type="Control"] layout_mode = 3 anchors_preset = 15 @@ -184,192 +181,28 @@ theme_override_constants/separation = 68 unique_name_in_owner = true layout_mode = 2 -[node name="MainPerspectiveinfo" type="Panel" parent="MarginContainer/VBoxContainer/HBoxContainer2"] -custom_minimum_size = Vector2(1346, 0) -layout_mode = 2 -size_flags_horizontal = 3 -script = ExtResource("17_e06tv") - -[node name="MainPerspective" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("17_cuo7m") - -[node name="StateView" type="Control" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView"] -layout_mode = 0 -offset_left = 50.5 -offset_top = 77.5 -offset_right = 393.5 -offset_bottom = 375.5 -theme_override_constants/separation = 20 - -[node name="Time" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer"] -layout_mode = 2 -texture = ExtResource("12_bp84h") - -[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Time"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/margin_left = 30 -theme_override_constants/margin_right = 30 - -[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Time/MarginContainer"] +[node name="MainPerspectiveinfo" parent="MarginContainer/VBoxContainer/HBoxContainer2" instance=ExtResource("17_01nvm")] layout_mode = 2 -[node name="Time" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Time/MarginContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) -theme_override_font_sizes/font_size = 36 -text = "16:40" - -[node name="Date" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Time/MarginContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) -theme_override_font_sizes/font_size = 36 -text = "11月5日" -horizontal_alignment = 2 - -[node name="Speed" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer"] -layout_mode = 2 -texture = ExtResource("13_ko5d5") - -[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/margin_top = 30 -theme_override_constants/margin_bottom = 30 - -[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer"] -layout_mode = 2 -theme_override_constants/separation = 0 - -[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer"] -layout_mode = 2 -size_flags_vertical = 3 -theme_override_colors/font_color = Color(0.584314, 0.584314, 0.584314, 1) -theme_override_font_sizes/font_size = 28 -text = "时速" -horizontal_alignment = 1 - -[node name="Speed" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer"] -layout_mode = 2 -size_flags_vertical = 3 -theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) -theme_override_font_sizes/font_size = 40 -text = "40 -" -horizontal_alignment = 1 -vertical_alignment = 2 - -[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer"] -layout_mode = 2 -size_flags_vertical = 3 -theme_override_colors/font_color = Color(0.584314, 0.584314, 0.584314, 1) -theme_override_font_sizes/font_size = 28 -text = "km/h" -horizontal_alignment = 1 -vertical_alignment = 2 - -[node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer2"] -layout_mode = 2 -size_flags_vertical = 3 -theme_override_colors/font_color = Color(0.584314, 0.584314, 0.584314, 1) -theme_override_font_sizes/font_size = 28 -text = "安全带" -horizontal_alignment = 1 - -[node name="SeatBeltTexture" type="TextureRect" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer2"] -layout_mode = 2 -size_flags_vertical = 3 -texture = ExtResource("14_1xl0y") -expand_mode = 1 -stretch_mode = 5 - -[node name="SeatBeltText" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer2"] -layout_mode = 2 -size_flags_vertical = 3 -theme_override_colors/font_color = Color(0.584314, 0.584314, 0.584314, 1) -theme_override_font_sizes/font_size = 28 -text = "已系好" -horizontal_alignment = 1 -vertical_alignment = 2 - -[node name="StateTab" type="TabContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo"] -unique_name_in_owner = true -visible = false -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -current_tab = 1 -tabs_visible = false - -[node name="LanguagePanelHorizontal" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateTab" instance=ExtResource("12_g3kjd")] -unique_name_in_owner = true -visible = false -layout_mode = 2 -metadata/_tab_index = 0 - -[node name="TunnelPanel" parent="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateTab" instance=ExtResource("17_6c7jw")] -layout_mode = 2 -metadata/_tab_index = 1 - -[node name="ADPanel" type="Panel" parent="MarginContainer/VBoxContainer/HBoxContainer2"] +[node name="ADPanel" type="MarginContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2"] unique_name_in_owner = true custom_minimum_size = Vector2(1426, 0) layout_mode = 2 [node name="ADTab" type="TabContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2/ADPanel"] unique_name_in_owner = true -visible = false -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -current_tab = 0 +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_itxs2") +current_tab = 1 tabs_visible = false [node name="LanguageVertical" parent="MarginContainer/VBoxContainer/HBoxContainer2/ADPanel/ADTab" instance=ExtResource("13_ec1yh")] unique_name_in_owner = true +visible = false layout_mode = 2 metadata/_tab_index = 0 [node name="TunnelPanel" parent="MarginContainer/VBoxContainer/HBoxContainer2/ADPanel/ADTab" instance=ExtResource("17_6c7jw")] -visible = false layout_mode = 2 metadata/_tab_index = 1 @@ -391,10 +224,6 @@ environment = ExtResource("25_vr8se") [connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/MoreOptionPanel/HBoxContainer/Tunnel" to="." method="_on_tunnel_pressed"] [connection signal="self_click" from="MarginContainer/VBoxContainer/HBoxContainer/MoreOptionPanel/HBoxContainer/ADView" to="." method="_on_ad_view_self_click"] [connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer/MoreOption" to="." method="_on_more_option_pressed"] -[connection signal="click" from="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateTab/LanguagePanelHorizontal" to="." method="_on_language_panel_horizontal_click"] -[connection signal="close_requeset" from="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateTab/LanguagePanelHorizontal" to="." method="_on_language_close_requeset"] -[connection signal="request_hide" from="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateTab/TunnelPanel" to="." method="_on_tunnel_panel_request_hide"] -[connection signal="search_click" from="MarginContainer/VBoxContainer/HBoxContainer2/MainPerspectiveinfo/StateTab/TunnelPanel" to="." method="_on_tunnel_panel_search_click"] [connection signal="click" from="MarginContainer/VBoxContainer/HBoxContainer2/ADPanel/ADTab/LanguageVertical" to="." method="_on_language_vertical_click"] [connection signal="close_requeset" from="MarginContainer/VBoxContainer/HBoxContainer2/ADPanel/ADTab/LanguageVertical" to="." method="_on_language_close_requeset"] [connection signal="request_hide" from="MarginContainer/VBoxContainer/HBoxContainer2/ADPanel/ADTab/TunnelPanel" to="." method="_on_tunnel_panel_request_hide"] diff --git a/main_perspective.gd b/main_perspective.gd index 295f662..781b993 100644 --- a/main_perspective.gd +++ b/main_perspective.gd @@ -8,6 +8,7 @@ func _ready() -> void: func _physics_process(delta: float) -> void: Global.EgoVehicle3D.main_sub_viewport.size = size -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass + var minSize = Vector2(1,size.y/size.x) + material.set_shader_parameter("size",minSize) + var Magnification = minSize.y / minSize.x + material.set_shader_parameter("round_all",0.05*Magnification) diff --git a/main_perspectiveinfo.gd b/main_perspectiveinfo.gd index 46d261c..abf931c 100644 --- a/main_perspectiveinfo.gd +++ b/main_perspectiveinfo.gd @@ -11,8 +11,20 @@ func message_received(data:Dictionary): if data.is_empty():return if !data.has("topic"):return match data.topic: - + "/hmi_input/app/cloud_control_platform/vehicle_info": + if (data.msg.seatbelt == 0): + %SeatBeltTexture.texture = preload("res://res/icon/icon_safebelt_yes.png") + pass + else: + %SeatBeltTexture.texture = preload("res://res/icon/icon_safebelt_no.png") + pass + %Speed.text = str(data.msg.spd) pass -func _process(delta: float) -> void: - pass +func vehicle_info():#所有车辆信息 + var send_data = { + "op": "subscribe", + "topic": "/hmi_input/app/cloud_control_platform/vehicle_info", + "type": "pixmoving_hmi_msgs/msg/VehicleInfo" + } + Websocket.send_msg(str(send_data)) diff --git a/main_perspectiveinfo.tscn b/main_perspectiveinfo.tscn new file mode 100644 index 0000000..3fd243c --- /dev/null +++ b/main_perspectiveinfo.tscn @@ -0,0 +1,200 @@ +[gd_scene load_steps=12 format=3 uid="uid://425pbmb8drum"] + +[ext_resource type="Script" path="res://main_perspectiveinfo.gd" id="1_jhed1"] +[ext_resource type="Shader" path="res://common/shader/round.gdshader" id="2_4dhun"] +[ext_resource type="Script" path="res://main_perspective.gd" id="2_hpq2e"] +[ext_resource type="Texture2D" uid="uid://dnpguw2kxiycr" path="res://res/bg/bg_info_panel_time_default.png" id="3_pbjh2"] +[ext_resource type="Texture2D" uid="uid://dpx1jnpwy316p" path="res://res/mask/overlay_drive_mask_semi_transparent.png" id="3_yv1k6"] +[ext_resource type="Texture2D" uid="uid://ncxqcxrll4gn" path="res://res/bg/bg_info_panel_speed_safebelt_default.png" id="4_bbrwr"] +[ext_resource type="Texture2D" uid="uid://bkftfoedt3036" path="res://res/icon/icon_safebelt_yes.png" id="5_841w7"] +[ext_resource type="PackedScene" uid="uid://b1v18ra6fsxt5" path="res://Modules/language_panel_horizontal.tscn" id="6_5ktx1"] +[ext_resource type="PackedScene" uid="uid://dwjj0vio2iyaf" path="res://Modules/tunnel_panel.tscn" id="7_h2grq"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_u5ddb"] +shader = ExtResource("2_4dhun") +shader_parameter/size = Vector2(1, 0.796) +shader_parameter/round_all = 0.02 +shader_parameter/left_top = 0.0 +shader_parameter/right_top = 0.0 +shader_parameter/left_bottom = 0.0 +shader_parameter/right_botom = 0.0 +shader_parameter/border_color = null +shader_parameter/Background_color = null +shader_parameter/Background_color_a = 0.0 +shader_parameter/border_width = 0.0 +shader_parameter/isColor = false +shader_parameter/isBackground_color = false + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_va1vh"] + +[node name="MainPerspectiveinfo" type="Panel"] +custom_minimum_size = Vector2(1346, 0) +offset_right = 1346.0 +offset_bottom = 1072.0 +size_flags_horizontal = 3 +script = ExtResource("1_jhed1") + +[node name="MainPerspective" type="TextureRect" parent="."] +material = SubResource("ShaderMaterial_u5ddb") +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_yv1k6") +expand_mode = 1 +script = ExtResource("2_hpq2e") + +[node name="StateView" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="StateView"] +layout_mode = 0 +offset_left = 50.5 +offset_top = 77.5 +offset_right = 393.5 +offset_bottom = 375.5 +theme_override_constants/separation = 20 + +[node name="Time" type="TextureRect" parent="StateView/VBoxContainer"] +layout_mode = 2 +texture = ExtResource("3_pbjh2") + +[node name="MarginContainer" type="MarginContainer" parent="StateView/VBoxContainer/Time"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 30 +theme_override_constants/margin_right = 30 + +[node name="HBoxContainer" type="HBoxContainer" parent="StateView/VBoxContainer/Time/MarginContainer"] +layout_mode = 2 + +[node name="Time" type="Label" parent="StateView/VBoxContainer/Time/MarginContainer/HBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) +theme_override_font_sizes/font_size = 36 +text = "16:40" + +[node name="Date" type="Label" parent="StateView/VBoxContainer/Time/MarginContainer/HBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) +theme_override_font_sizes/font_size = 36 +text = "11月5日" +horizontal_alignment = 2 + +[node name="Speed" type="TextureRect" parent="StateView/VBoxContainer"] +layout_mode = 2 +texture = ExtResource("4_bbrwr") + +[node name="MarginContainer" type="MarginContainer" parent="StateView/VBoxContainer/Speed"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_top = 30 +theme_override_constants/margin_bottom = 30 + +[node name="HBoxContainer" type="HBoxContainer" parent="StateView/VBoxContainer/Speed/MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 0 + +[node name="VBoxContainer" type="VBoxContainer" parent="StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Label" type="Label" parent="StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_colors/font_color = Color(0.584314, 0.584314, 0.584314, 1) +theme_override_font_sizes/font_size = 28 +text = "时速" +horizontal_alignment = 1 + +[node name="Speed" type="Label" parent="StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_vertical = 3 +theme_override_colors/font_color = Color(0.952941, 0.952941, 0.952941, 1) +theme_override_font_sizes/font_size = 40 +text = "40 +" +horizontal_alignment = 1 +vertical_alignment = 2 + +[node name="Label2" type="Label" parent="StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_colors/font_color = Color(0.584314, 0.584314, 0.584314, 1) +theme_override_font_sizes/font_size = 28 +text = "km/h" +horizontal_alignment = 1 +vertical_alignment = 2 + +[node name="VBoxContainer2" type="VBoxContainer" parent="StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Label" type="Label" parent="StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer2"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_colors/font_color = Color(0.584314, 0.584314, 0.584314, 1) +theme_override_font_sizes/font_size = 28 +text = "安全带" +horizontal_alignment = 1 + +[node name="SeatBeltTexture" type="TextureRect" parent="StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer2"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_vertical = 3 +texture = ExtResource("5_841w7") +expand_mode = 1 +stretch_mode = 5 + +[node name="SeatBeltText" type="Label" parent="StateView/VBoxContainer/Speed/MarginContainer/HBoxContainer/VBoxContainer2"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_vertical = 3 +theme_override_colors/font_color = Color(0.584314, 0.584314, 0.584314, 1) +theme_override_font_sizes/font_size = 28 +text = "已系好" +horizontal_alignment = 1 +vertical_alignment = 2 + +[node name="StateTab" type="TabContainer" parent="."] +unique_name_in_owner = true +visible = false +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxEmpty_va1vh") +current_tab = 1 +tabs_visible = false + +[node name="LanguagePanelHorizontal" parent="StateTab" instance=ExtResource("6_5ktx1")] +unique_name_in_owner = true +visible = false +layout_mode = 2 +metadata/_tab_index = 0 + +[node name="TunnelPanel" parent="StateTab" instance=ExtResource("7_h2grq")] +layout_mode = 2 +metadata/_tab_index = 1