实验viewport纹理作为材质在三维场景中绘制站台上的线路站点指示信息
This commit is contained in:
parent
f2bea7f892
commit
f2213efc26
@ -1,6 +1,12 @@
|
||||
@tool
|
||||
extends Node3D
|
||||
|
||||
#func _ready():
|
||||
#var lt = $LabelTexture.get_texture()
|
||||
#$Sprite3D.texture = lt
|
||||
@export_range(0.2, 20, 0.2) var repeat_times: float = 1
|
||||
|
||||
func _ready():
|
||||
var vp = $LabelTexture
|
||||
vp.set_clear_mode(SubViewport.CLEAR_MODE_ONCE)
|
||||
|
||||
$Plane.material_override.albedo_texture = vp.get_texture()
|
||||
$Plane.material_override.uv1_scale = Vector3(repeat_times, 1, 1)
|
||||
|
||||
|
@ -1,18 +1,31 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c63e3ugq35q5g"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://c63e3ugq35q5g"]
|
||||
|
||||
[ext_resource type="Script" path="res://experiments/psd_panel.gd" id="1_wg3fd"]
|
||||
[ext_resource type="PackedScene" uid="uid://c5vvgu50akjwl" path="res://experiments/psd_panel_ui.tscn" id="2_rtht1"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_c2vxd"]
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_lwjc8"]
|
||||
viewport_path = NodePath("LabelTexture")
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pbh8q"]
|
||||
albedo_texture = SubResource("ViewportTexture_lwjc8")
|
||||
uv1_scale = Vector3(5, 1, 1)
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_mfy0l"]
|
||||
resource_local_to_scene = true
|
||||
size = Vector2(100, 2)
|
||||
orientation = 2
|
||||
|
||||
[node name="PSD_Panel" type="Node3D"]
|
||||
script = ExtResource("1_wg3fd")
|
||||
repeat_times = 4.0
|
||||
|
||||
[node name="LabelTexture" type="SubViewport" parent="."]
|
||||
size = Vector2i(2048, 256)
|
||||
canvas_item_default_texture_repeat = 1
|
||||
size = Vector2i(1800, 256)
|
||||
render_target_clear_mode = 2
|
||||
|
||||
[node name="PSD_Panel_UI" parent="LabelTexture" instance=ExtResource("2_rtht1")]
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
texture = SubResource("ViewportTexture_c2vxd")
|
||||
[node name="Plane" type="MeshInstance3D" parent="."]
|
||||
material_override = SubResource("StandardMaterial3D_pbh8q")
|
||||
mesh = SubResource("PlaneMesh_mfy0l")
|
||||
|
@ -14,9 +14,9 @@ class StationLable:
|
||||
|
||||
|
||||
var stations = [
|
||||
StationLable.new("会展中心", "Exhibition Center", true),
|
||||
StationLable.new("会展中心", "Exhibition Center", false),
|
||||
StationLable.new("世纪大道", "Century Avenue", false),
|
||||
StationLable.new("交通大学", "JiaoTong Univercity", false),
|
||||
StationLable.new("交通大学", "JiaoTong Univercity", true),
|
||||
StationLable.new("市图书馆", "City Library", false),
|
||||
StationLable.new("中心医院", "Central Hospital", false),
|
||||
StationLable.new("未来路", "Wei lai lu", false),
|
||||
@ -25,11 +25,7 @@ var stations = [
|
||||
StationLable.new("体育中心", "sports center", false),
|
||||
]
|
||||
|
||||
var reverseStations = stations.reverse()
|
||||
|
||||
func _ready():
|
||||
print(stationLabelNode)
|
||||
|
||||
for i in stations.size():
|
||||
var slable = stations[i]
|
||||
print(slable.name, slable.enName, slable.current)
|
||||
|
@ -6,7 +6,7 @@
|
||||
script = ExtResource("1_cmik1")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_right = 43.0
|
||||
offset_right = 52.0
|
||||
offset_bottom = 25.0
|
||||
scale = Vector2(36.8932, 11.8384)
|
||||
color = Color(0.564706, 0.564706, 0.564706, 1)
|
||||
@ -23,14 +23,14 @@ layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 36
|
||||
text = "当前车站"
|
||||
text = "会展中心"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="EnName" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "Current Station"
|
||||
text = "Exhibition Center"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Container" type="Node2D" parent="."]
|
||||
|
@ -1,13 +1,9 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://crpmwcp85khdr"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://crpmwcp85khdr"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://biot7d8s87d3y" path="res://Assets/models/screendoor1/screenDoor.gltf" id="1_tvcny"]
|
||||
[ext_resource type="Script" path="res://experiments/screendoor_lcb.gd" id="2_5qyph"]
|
||||
|
||||
[node name="screenDoor" instance=ExtResource("1_tvcny")]
|
||||
|
||||
[node name="JH_GD_LCB" parent="." index="0"]
|
||||
script = ExtResource("2_5qyph")
|
||||
|
||||
[node name="Label3D" type="Label3D" parent="JH_GD_LCB" index="0"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.147186, 0)
|
||||
text = "LCB"
|
||||
|
@ -1,6 +1,7 @@
|
||||
@tool
|
||||
extends Node2D
|
||||
|
||||
func _init_station_name_and_position(name, enName, i):
|
||||
$StationName/Name.text = name
|
||||
$StationName/EnName.text = enName
|
||||
func _init_station_name_and_position(sn, sen, i):
|
||||
$StationName/Name.text = sn
|
||||
$StationName/EnName.text = sen
|
||||
self.translate(Vector2(100 * i, 0))
|
||||
|
@ -10,10 +10,10 @@ script = ExtResource("1_ch36d")
|
||||
[node name="StationName" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -24.0
|
||||
offset_top = -8.0
|
||||
offset_right = -24.0
|
||||
offset_bottom = -8.0
|
||||
offset_left = -16.0
|
||||
offset_top = -16.0
|
||||
offset_right = -16.0
|
||||
offset_bottom = -16.0
|
||||
rotation = -0.785397
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 8
|
||||
|
@ -2,10 +2,10 @@ extends Node3D
|
||||
|
||||
@onready var camera = $Camera3D
|
||||
|
||||
func _ready():
|
||||
var sp = get_screen_position($LCB)
|
||||
print("3D物体在屏幕上的位置: ", sp)
|
||||
|
||||
func get_screen_position(mesh_instance):
|
||||
var global_position = mesh_instance.global_transform.origin
|
||||
return camera.unproject_position(global_position)
|
||||
#func _ready():
|
||||
#var sp = get_screen_position($LCB)
|
||||
#print("3D物体在屏幕上的位置: ", sp)
|
||||
#
|
||||
#func get_screen_position(mesh_instance):
|
||||
#var global_position = mesh_instance.global_transform.origin
|
||||
#return camera.unproject_position(global_position)
|
||||
|
@ -1,9 +1,7 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://4ygkabji3g16"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://4ygkabji3g16"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bmiexmyoh0ehv" path="res://experiments/platform1.tscn" id="1_cq2ki"]
|
||||
[ext_resource type="Script" path="res://experiments/test_3d.gd" id="1_uqsdo"]
|
||||
[ext_resource type="PackedScene" uid="uid://crpmwcp85khdr" path="res://experiments/screen_door_t1.tscn" id="2_rvfj7"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5c3atssvhkwy" path="res://experiments/lcb.tscn" id="3_htmjl"]
|
||||
[ext_resource type="PackedScene" uid="uid://c63e3ugq35q5g" path="res://experiments/psd_panel.tscn" id="4_wjde3"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_mybsf"]
|
||||
@ -11,16 +9,12 @@ ambient_light_color = Color(0.831373, 0.290196, 0.556863, 1)
|
||||
ambient_light_energy = 6.23
|
||||
|
||||
[node name="Node3D" type="Node3D"]
|
||||
script = ExtResource("1_uqsdo")
|
||||
|
||||
[node name="platform" parent="." instance=ExtResource("1_cq2ki")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.16258, 0)
|
||||
|
||||
[node name="LCB" parent="." instance=ExtResource("3_htmjl")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.58244, 2.40247, -7.38809)
|
||||
|
||||
[node name="PSD_Panel" parent="." instance=ExtResource("4_wjde3")]
|
||||
transform = Transform3D(0.381944, 0, 0, 0, 0.381944, 0, 0, 0, 0.381944, 4.13301, 1.83159, -7.03252)
|
||||
transform = Transform3D(0.381944, 0, 0, 0, 0.381944, 0, 0, 0, 0.381944, 15.3792, 1.86346, -7.03252)
|
||||
|
||||
[node name="screenDoor" parent="." instance=ExtResource("2_rvfj7")]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user