added edge detection

This commit is contained in:
Luca 2025-02-28 09:42:00 +01:00
parent 7ada6a0f2c
commit 4dbba022af
4 changed files with 54 additions and 5 deletions

View file

@ -6,7 +6,7 @@ extends StaticBody3D
var current_exhibit: Node = null
@export_group("Exhibit Settings")
## Scene file to display as the exhibit
@export var exhibit: PackedScene:
get:
return exhibit
@ -14,6 +14,7 @@ var current_exhibit: Node = null
exhibit = value
set_exhibit()
## An optional prefix placed at the left side of the plinth
@export var prefix: String:
get:
return prefix
@ -21,6 +22,7 @@ var current_exhibit: Node = null
prefix = value
set_label3d()
## An optional title placed on the center of the plinth
@export var title: String:
get:
return title
@ -28,6 +30,9 @@ var current_exhibit: Node = null
title = value
set_label3d()
## Shortcut to the shader file of the exhibit
@export var shader_file: Shader
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
set_label3d()
@ -42,9 +47,20 @@ func set_exhibit():
# remove the old exhibit if present
if current_exhibit:
remove_child(current_exhibit)
shader_file = null
if exhibit != null:
var scene_node = exhibit.instantiate()
scene_node.position.y = 2
current_exhibit = scene_node
shader_file = get_first_shader_file(scene_node)
add_child(scene_node)
func get_first_shader_file(node):
var shader_file: Shader = null
for i: Node in node.get_children():
if i.mesh and i.mesh.material and i.mesh.material.shader != null:
shader_file = i.mesh.material.shader
return shader_file

View file

@ -9,7 +9,6 @@ size = Vector3(0.91626, 1.34576, 0.744141)
[node name="Plinth" type="StaticBody3D"]
script = ExtResource("1_c0mgr")
exhibit_position = Vector3(0, 0, 0)
prefix = "000"
title = "Title"