Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions addons/godot-xr-tools/materials/highlight.tres
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
[gd_resource type="ShaderMaterial" format=3 uid="uid://dyuaw57o8y3i"]

[sub_resource type="VisualShaderNodeColorParameter" id="VisualShaderNodeColorParameter_nl6jr"]
parameter_name = "Color"

[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_8dcmn"]
default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(0.5, 0.5, 0.5)]
operator = 2

[sub_resource type="VisualShaderNodeFloatConstant" id="VisualShaderNodeFloatConstant_2331j"]
constant = 0.1

[sub_resource type="VisualShaderNodeFresnel" id="VisualShaderNodeFresnel_tghd5"]

[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_wy3ip"]
operator = 2

[sub_resource type="VisualShader" id="VisualShader_wb0u4"]
nodes/fragment/0/position = Vector2(660, 60)
nodes/fragment/2/node = SubResource("VisualShaderNodeColorParameter_nl6jr")
nodes/fragment/2/position = Vector2(40, 40)
nodes/fragment/3/node = SubResource("VisualShaderNodeVectorOp_8dcmn")
nodes/fragment/3/position = Vector2(360, 60)
nodes/fragment/4/node = SubResource("VisualShaderNodeFloatConstant_2331j")
nodes/fragment/4/position = Vector2(20, 180)
nodes/fragment/5/node = SubResource("VisualShaderNodeFresnel_tghd5")
nodes/fragment/5/position = Vector2(40, 340)
nodes/fragment/6/node = SubResource("VisualShaderNodeVectorOp_wy3ip")
nodes/fragment/6/position = Vector2(360, 220)
nodes/fragment/connections = PackedInt32Array(2, 0, 3, 0, 3, 0, 0, 0, 4, 0, 3, 1, 2, 0, 6, 0, 5, 0, 6, 1, 6, 0, 0, 5)

[resource]
render_priority = 0
shader = SubResource("VisualShader_wb0u4")
shader_parameter/Color = Color(0.301961, 0.392157, 0.988235, 1)
14 changes: 7 additions & 7 deletions addons/godot-xr-tools/objects/highlight/highlight_ring.tres
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=2]
[gd_resource type="StandardMaterial3D" format=3 uid="uid://c6qkxj11rbbly"]

[ext_resource path="res://addons/godot-xr-tools/images/ring.png" type="Texture2D" id=1]
[ext_resource type="Texture2D" uid="uid://8s03ra8tp0hr" path="res://addons/godot-xr-tools/images/ring.png" id="1"]

[resource]
flags_transparent = true
flags_unshaded = true
flags_no_depth_test = true
params_billboard_mode = 1
albedo_texture = ExtResource( 1 )
transparency = 1
no_depth_test = true
shading_mode = 0
albedo_texture = ExtResource("1")
billboard_mode = 1
6 changes: 3 additions & 3 deletions addons/godot-xr-tools/objects/pickable.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[gd_scene load_steps=2 format=3 uid="uid://c8l60rnugru40"]
[gd_scene format=3 uid="uid://c8l60rnugru40"]

[ext_resource type="Script" uid="uid://bfrlpbsqg5lqr" path="res://addons/godot-xr-tools/objects/pickable.gd" id="1"]

[node name="PickableObject" type="RigidBody3D"]
[node name="PickableObject" type="RigidBody3D" unique_id=1392687463]
collision_layer = 4
collision_mask = 196615
freeze_mode = 1
script = ExtResource("1")

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1647278992]
4 changes: 4 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ version_control/autoload_on_startup=true

enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg", "res://addons/import_cleaner/addons/ImportCleaner/plugin.cfg", "res://addons/volume_layered_shader/plugin.cfg")

[global_group]

Player=""

[input]

ui_menu={
Expand Down
3 changes: 2 additions & 1 deletion scenes/Player/player.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[ext_resource type="PackedScene" uid="uid://dgdb1texynduw" path="res://addons/godot-xr-tools/objects/virtual_keyboard.tscn" id="13_bwjto"]
[ext_resource type="PackedScene" uid="uid://wtpox7m5vu2b" path="res://addons/godot-xr-tools/effects/fade.tscn" id="14_606se"]

[node name="XROrigin3D" type="XROrigin3D" unique_id=1551876214]
[node name="XROrigin3D" type="XROrigin3D" unique_id=1551876214 groups=["Player"]]
script = ExtResource("1_ivps1")

[node name="XRCamera3D" type="XRCamera3D" parent="." unique_id=101239405]
Expand Down Expand Up @@ -76,6 +76,7 @@ show_laser = 2
laser_length = 1
show_target = true
collision_mask = 5242884
collide_with_areas = true

[node name="VirtualKeyboard" parent="." unique_id=943683133 instance=ExtResource("13_bwjto")]
transform = Transform3D(1, 0, 0, 0, 0.75354, 0.657402, 0, -0.657402, 0.75354, 0, -0.49593, -0.728043)
Expand Down
12 changes: 9 additions & 3 deletions scenes/UI/procedural_link_ui.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ size_flags_vertical = 3
[node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer" unique_id=998015335]
layout_mode = 2

[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer2" unique_id=1051116865]
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer2" unique_id=1370265326]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/margin_left = 24
theme_override_constants/margin_right = 24

[node name="ProceduralForm" type="VBoxContainer" parent="MarginContainer/VBoxContainer2/ScrollContainer" unique_id=638409883]
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/VBoxContainer2/MarginContainer" unique_id=1051116865]
layout_mode = 2
size_flags_vertical = 3

[node name="ProceduralForm" type="VBoxContainer" parent="MarginContainer/VBoxContainer2/MarginContainer/ScrollContainer" unique_id=638409883]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
Expand All @@ -33,7 +39,7 @@ size_flags_vertical = 3
layout_mode = 2
alignment = 1

[node name="Button" type="Button" parent="MarginContainer/VBoxContainer2/ButtonContainer" unique_id=856813400]
[node name="CancelButton" type="Button" parent="MarginContainer/VBoxContainer2/ButtonContainer" unique_id=856813400]
unique_name_in_owner = true
layout_mode = 2
text = "Cancel"
Expand Down
23 changes: 19 additions & 4 deletions scenes/UI/vr_menu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,35 @@

[ext_resource type="Script" uid="uid://1id0q8i7gwbp" path="res://scripts/UI/vr_menu.gd" id="1_vrmenu"]
[ext_resource type="Script" uid="uid://eavk7267igp7" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.gd" id="2_v2d3d"]
[ext_resource type="Shader" uid="uid://bdcl4inxv0h1u" path="res://shaders/highlight.gdshader" id="2_w1ybm"]
[ext_resource type="Script" uid="uid://cpl5yiyf1ypft" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d_body.gd" id="3_v2dbody"]

[sub_resource type="BoxShape3D" id="BoxShape3D_grab"]
resource_local_to_scene = true
size = Vector3(2.1, 1.3, 0.05)

[sub_resource type="ShaderMaterial" id="ShaderMaterial_w1ybm"]
render_priority = 0
shader = ExtResource("2_w1ybm")
shader_parameter/glow_color = Color(1, 0.8, 0.1, 1)
shader_parameter/edge_width = 0.02
shader_parameter/glow_strength = 2.0

[sub_resource type="QuadMesh" id="QuadMesh_3cb7g"]
material = SubResource("ShaderMaterial_w1ybm")

[sub_resource type="QuadMesh" id="QuadMesh_screen"]
resource_local_to_scene = true
size = Vector2(2, 1.2)

[sub_resource type="ViewportTexture" id="ViewportTexture_5iaxp"]
[sub_resource type="ViewportTexture" id="ViewportTexture_4ojia"]
viewport_path = NodePath("Viewport2DIn3D/Viewport")

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_w1ybm"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_chs5w"]
transparency = 1
cull_mode = 2
shading_mode = 0
albedo_texture = SubResource("ViewportTexture_5iaxp")
albedo_texture = SubResource("ViewportTexture_4ojia")
texture_filter = 1

[sub_resource type="BoxShape3D" id="BoxShape3D_pointer"]
Expand All @@ -33,13 +44,17 @@ gravity_scale = 0.0
freeze = true
freeze_mode = 1
script = ExtResource("1_vrmenu")
highlight_when_enabled = null
release_mode = 1

[node name="GrabCollision" type="CollisionShape3D" parent="." unique_id=263098466]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.02)
shape = SubResource("BoxShape3D_grab")
debug_color = Color(0.9927115, 0, 0.2546581, 0.41960785)

[node name="Highlight" type="MeshInstance3D" parent="." unique_id=872886749]
mesh = SubResource("QuadMesh_3cb7g")

[node name="Viewport2DIn3D" type="Node3D" parent="." unique_id=69049931]
script = ExtResource("2_v2d3d")
screen_size = Vector2(2, 1.2)
Expand All @@ -59,7 +74,7 @@ render_target_update_mode = 1

[node name="Screen" type="MeshInstance3D" parent="Viewport2DIn3D" unique_id=1869170162]
mesh = SubResource("QuadMesh_screen")
surface_material_override/0 = SubResource("StandardMaterial3D_w1ybm")
surface_material_override/0 = SubResource("StandardMaterial3D_chs5w")

[node name="StaticBody3D" type="StaticBody3D" parent="Viewport2DIn3D" unique_id=1200919137]
collision_layer = 5242881
Expand Down
6 changes: 6 additions & 0 deletions scripts/DataClasses/mesh_data.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var normals: PackedFloat32Array
var flip_normals: bool = false

var _cached_mesh: ArrayMesh = null
var highlight_mesh: ArrayMesh = null


func is_valid() -> bool:
Expand All @@ -19,10 +20,12 @@ func is_valid() -> bool:
func get_data() -> ArrayMesh:
if _cached_mesh == null and is_valid():
_cached_mesh = MeshUtils.build_mesh(to_dict(), flip_normals)
highlight_mesh = _cached_mesh
return _cached_mesh

func invalidate_mesh() -> void:
_cached_mesh = null
highlight_mesh = null

## Set data from a dictionary (as received from network or loaders).
## Supports both legacy format {"vertices": [...], "indices": [...]}
Expand Down Expand Up @@ -54,6 +57,7 @@ func set_from_dict(data: Dictionary) -> void:
normals = n

_cached_mesh = null
highlight_mesh = null
data_ready.emit()


Expand All @@ -71,6 +75,7 @@ func clear() -> void:
indices = PackedInt32Array()
normals = PackedFloat32Array()
_cached_mesh = null
highlight_mesh = null


## Set data from the binary envelope body.
Expand Down Expand Up @@ -119,5 +124,6 @@ func set_from_bytes(preamble: Dictionary, body: PackedByteArray, offset: int) ->
normals = PackedFloat32Array()

_cached_mesh = null
highlight_mesh = null
data_ready.emit()
return true
Loading