From 42a5e86bdad04789d0d86337ae634565b35b31b9 Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Tue, 7 Nov 2023 18:43:53 -0500 Subject: [PATCH 01/14] main menu --- project/{ => Scenes}/main.tscn | 8 +-- project/Scenes/main_menu.tscn | 73 +++++++++++++++++++++++ project/Scripts/JustificationMenu.gd | 89 ---------------------------- project/Scripts/MainMenu.gd | 24 ++++++++ project/Scripts/main.gd | 4 +- project/icon.svg | 1 - project/icon.svg.import | 37 ------------ project/main.gdshader | 7 --- project/project.godot | 6 +- 9 files changed, 108 insertions(+), 141 deletions(-) rename project/{ => Scenes}/main.tscn (88%) create mode 100644 project/Scenes/main_menu.tscn delete mode 100644 project/Scripts/JustificationMenu.gd create mode 100644 project/Scripts/MainMenu.gd delete mode 100644 project/icon.svg delete mode 100644 project/icon.svg.import delete mode 100644 project/main.gdshader diff --git a/project/main.tscn b/project/Scenes/main.tscn similarity index 88% rename from project/main.tscn rename to project/Scenes/main.tscn index 1e391ea..81c7b40 100644 --- a/project/main.tscn +++ b/project/Scenes/main.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=6 format=3 uid="uid://bg6v0qeatg5pu"] -[ext_resource type="Script" path="res://Scripts/main.gd" id="1_geprs"] -[ext_resource type="Texture2D" uid="uid://j7g6v181jnum" path="res://Textures/skybox.jpg" id="2_fe00h"] +[ext_resource type="Script" path="res://Scripts/main.gd" id="1_8s8eo"] +[ext_resource type="Texture2D" uid="uid://j7g6v181jnum" path="res://Textures/skybox.jpg" id="2_x8dg1"] [sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_k2hox"] -panorama = ExtResource("2_fe00h") +panorama = ExtResource("2_x8dg1") [sub_resource type="Sky" id="Sky_nthfv"] sky_material = SubResource("PanoramaSkyMaterial_k2hox") @@ -25,7 +25,7 @@ volumetric_fog_gi_inject = 0.34 volumetric_fog_anisotropy = 0.9 [node name="main" type="Node"] -script = ExtResource("1_geprs") +script = ExtResource("1_8s8eo") [node name="ForwardLight" type="DirectionalLight3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.360501, 0.932759, 0, -0.932759, 0.360501, -262.079, 504.49, 0) diff --git a/project/Scenes/main_menu.tscn b/project/Scenes/main_menu.tscn new file mode 100644 index 0000000..4faf361 --- /dev/null +++ b/project/Scenes/main_menu.tscn @@ -0,0 +1,73 @@ +[gd_scene load_steps=2 format=3 uid="uid://dpo7uacswkwhy"] + +[ext_resource type="Script" path="res://Scripts/MainMenu.gd" id="1_dtnct"] + +[node name="MainMenu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_dtnct") + +[node name="ColorRect" type="ColorRect" parent="."] +show_behind_parent = true +layout_mode = 0 +offset_left = -131.0 +offset_top = -58.0 +offset_right = 1360.0 +offset_bottom = 721.0 +color = Color(0, 0, 0, 1) + +[node name="MarginContainer" type="MarginContainer" parent="ColorRect"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -183.5 +offset_top = -250.5 +offset_right = 183.5 +offset_bottom = 250.5 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_top = 300 + +[node name="VBoxContainer" type="VBoxContainer" parent="ColorRect/MarginContainer"] +layout_mode = 2 + +[node name="Standard" type="Button" parent="ColorRect/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Standard +" + +[node name="Virtual Reality" type="Button" parent="ColorRect/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Virtual Reality +" + +[node name="Exit" type="Button" parent="ColorRect/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Exit" + +[node name="RichTextLabel" type="RichTextLabel" parent="ColorRect"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -220.0 +offset_top = -70.5 +offset_right = 220.0 +offset_bottom = 70.5 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_font_sizes/normal_font_size = 75 +text = "Virtual Slate" + +[connection signal="pressed" from="ColorRect/MarginContainer/VBoxContainer/Standard" to="." method="_on_standard_pressed"] +[connection signal="pressed" from="ColorRect/MarginContainer/VBoxContainer/Virtual Reality" to="." method="_on_virtual_reality_pressed"] +[connection signal="pressed" from="ColorRect/MarginContainer/VBoxContainer/Exit" to="." method="_on_exit_pressed"] diff --git a/project/Scripts/JustificationMenu.gd b/project/Scripts/JustificationMenu.gd deleted file mode 100644 index f32468c..0000000 --- a/project/Scripts/JustificationMenu.gd +++ /dev/null @@ -1,89 +0,0 @@ -extends Control - -var selectArray -var selectionCount - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(_delta): - selectArray = $"../CharacterBody3D".selectArray - selectionCount = $"../CharacterBody3D".selectionCount - - -func _on_assumption_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("assume", "Assume") - - -func _on_negation_introduction_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("notI", "¬I") - - -func _on_negation_elimination_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("notE", "¬E") - - -func _on_conjunction_introduction_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("andI", "∧I") - - -func _on_conjunction_elimination_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("andE", "∧E") - - -func _on_disjunction_introduction_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("orI", "∨I") - - -func _on_disjunction_elimination_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("orE", "∨E") - - -func _on_conditional_introductionon_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("ifI", "→I") - - -func _on_conditional_elimination_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("ifE", "→E") - - -func _on_biconditional_introduction_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("iffI", "↔I") - - -func _on_biconditional_elimination_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("iffE", "↔E") - - -func _on_universal_introduction_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("forallI", "∀I") - - -func _on_universal_elimination_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("forallE", "∀E") - - -func _on_existential_introduction_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("existsI", "∃I") - - -func _on_existential_elimination_pressed(): - if selectionCount == 1: - selectArray[0].setJustification("existsE", "∃E") diff --git a/project/Scripts/MainMenu.gd b/project/Scripts/MainMenu.gd new file mode 100644 index 0000000..3f7c2e4 --- /dev/null +++ b/project/Scripts/MainMenu.gd @@ -0,0 +1,24 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + + +func _on_standard_pressed(): + var standard = load("res://Scenes/PlayerCharacter.tscn").instantiate() + get_tree().get_root().add_child(standard) + self.queue_free() + + +func _on_virtual_reality_pressed(): + pass # Replace with function body. + + +func _on_exit_pressed(): + get_tree().quit() diff --git a/project/Scripts/main.gd b/project/Scripts/main.gd index 4725b1c..1ae3ef4 100644 --- a/project/Scripts/main.gd +++ b/project/Scripts/main.gd @@ -27,8 +27,8 @@ func _ready(): #Loading standard 3D player character - var standard3D = load("res://Scenes/PlayerCharacter.tscn").instantiate() - self.add_child(standard3D) + var mainMenu = load("res://Scenes/main_menu.tscn").instantiate() + self.add_child(mainMenu) # Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(_delta): diff --git a/project/icon.svg b/project/icon.svg deleted file mode 100644 index b370ceb..0000000 --- a/project/icon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/project/icon.svg.import b/project/icon.svg.import deleted file mode 100644 index e59aac9..0000000 --- a/project/icon.svg.import +++ /dev/null @@ -1,37 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://dsh0cor2ywdmc" -path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://icon.svg" -dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 -svg/scale=1.0 -editor/scale_with_editor_scale=false -editor/convert_colors_with_editor_theme=false diff --git a/project/main.gdshader b/project/main.gdshader deleted file mode 100644 index 993e1de..0000000 --- a/project/main.gdshader +++ /dev/null @@ -1,7 +0,0 @@ -shader_type sky; - -uniform vec3 skyColor: source_color; - -void sky() { - COLOR = skyColor; -} diff --git a/project/project.godot b/project/project.godot index 588a577..deeefb2 100644 --- a/project/project.godot +++ b/project/project.godot @@ -11,10 +11,14 @@ config_version=5 [application] config/name="Project" -run/main_scene="res://main.tscn" +run/main_scene="res://Scenes/main.tscn" config/features=PackedStringArray("4.1", "Forward Plus") config/icon="res://icon.svg" +[display] + +window/stretch/mode="canvas_items" + [input] Interact={ From 3459a0d13d554c77df428e6a289f5918a163e34c Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Fri, 10 Nov 2023 20:39:52 -0500 Subject: [PATCH 02/14] basic interaction --- project/Scenes/main_menu.tscn | 8 +- project/Scenes/textbox.tscn | 13 ++ project/Scenes/vr_player.tscn | 70 ++++++ project/Scripts/main.gd | 32 +-- project/Scripts/vr_player.gd | 217 ++++++++++++++++++ .../objects/keyboard/virtual_keyboard_2d.tscn | 6 +- project/project.godot | 3 +- 7 files changed, 329 insertions(+), 20 deletions(-) create mode 100644 project/Scenes/textbox.tscn create mode 100644 project/Scenes/vr_player.tscn create mode 100644 project/Scripts/vr_player.gd diff --git a/project/Scenes/main_menu.tscn b/project/Scenes/main_menu.tscn index 4faf361..fff391a 100644 --- a/project/Scenes/main_menu.tscn +++ b/project/Scenes/main_menu.tscn @@ -59,10 +59,10 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -offset_left = -220.0 -offset_top = -70.5 -offset_right = 220.0 -offset_bottom = 70.5 +offset_left = -220.5 +offset_top = -81.5 +offset_right = 219.5 +offset_bottom = 23.5 grow_horizontal = 2 grow_vertical = 2 theme_override_font_sizes/normal_font_size = 75 diff --git a/project/Scenes/textbox.tscn b/project/Scenes/textbox.tscn new file mode 100644 index 0000000..268287d --- /dev/null +++ b/project/Scenes/textbox.tscn @@ -0,0 +1,13 @@ +[gd_scene format=3 uid="uid://cd0a77sysrjf7"] + +[node name="Node2D" type="Node2D"] + +[node name="LineEdit" type="LineEdit" parent="."] +offset_right = 541.0 +offset_bottom = 117.0 +theme_override_colors/font_color = Color(1, 1, 1, 1) +theme_override_colors/font_selected_color = Color(1, 1, 1, 1) +theme_override_colors/caret_color = Color(1, 1, 1, 1) +theme_override_font_sizes/font_size = 45 +placeholder_text = "apples are tasty" +alignment = 1 diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn new file mode 100644 index 0000000..73dc1a6 --- /dev/null +++ b/project/Scenes/vr_player.tscn @@ -0,0 +1,70 @@ +[gd_scene load_steps=9 format=3 uid="uid://bsqsl2sg40kes"] + +[ext_resource type="Script" path="res://Scripts/vr_player.gd" id="1_lugxl"] +[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="2_88kpy"] +[ext_resource type="PackedScene" uid="uid://lauwp8okd1vh" path="res://addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn" id="3_nc4pw"] +[ext_resource type="PackedScene" uid="uid://cd0a77sysrjf7" path="res://Scenes/textbox.tscn" id="4_cmjq8"] + +[sub_resource type="SphereMesh" id="SphereMesh_xc2q5"] + +[sub_resource type="CylinderMesh" id="CylinderMesh_le24m"] +top_radius = 0.01 +bottom_radius = 0.01 + +[sub_resource type="SphereMesh" id="SphereMesh_pe45r"] + +[sub_resource type="TextMesh" id="TextMesh_g1jrr"] +text = "Test" + +[node name="VRPlayer" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.000833228, 0, 0) +script = ExtResource("1_lugxl") + +[node name="XROrigin3D" type="XROrigin3D" parent="."] + +[node name="XRCamera3D" type="XRCamera3D" parent="XROrigin3D"] + +[node name="Right" type="XRController3D" parent="XROrigin3D"] +tracker = &"right_hand" + +[node name="rHand" type="MeshInstance3D" parent="XROrigin3D/Right"] +transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0) +mesh = SubResource("SphereMesh_xc2q5") + +[node name="RayCast3D" type="RayCast3D" parent="XROrigin3D/Right/rHand"] +transform = Transform3D(10, 0, 0, 0, -3.27835e-05, -10, 0, 750, -4.37114e-07, 0, 0, -0.262443) + +[node name="MeshInstance3D" type="MeshInstance3D" parent="XROrigin3D/Right/rHand/RayCast3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) +mesh = SubResource("CylinderMesh_le24m") + +[node name="Left" type="XRController3D" parent="XROrigin3D"] +tracker = &"left_hand" + +[node name="lHand" type="MeshInstance3D" parent="XROrigin3D/Left"] +transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0) +mesh = SubResource("SphereMesh_pe45r") + +[node name="ModeText" type="MeshInstance3D" parent="XROrigin3D/Left/lHand"] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 1.2, 0, 0) +mesh = SubResource("TextMesh_g1jrr") + +[node name="Keyboard" type="Node3D" parent="XROrigin3D/Left"] + +[node name="VirtualKeyboard" parent="XROrigin3D/Left/Keyboard" instance=ExtResource("2_88kpy")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5) +screen_size = Vector2(1, 1) +viewport_size = Vector2(600, 500) +scene = ExtResource("3_nc4pw") +collision_layer = 2097154 + +[node name="Text" parent="XROrigin3D/Left/Keyboard" instance=ExtResource("2_88kpy")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.170474, 0.228016, -0.468246) +screen_size = Vector2(0.5, 0.1) +viewport_size = Vector2(500, 125) +scene = ExtResource("4_cmjq8") +collision_layer = 2097154 + +[connection signal="button_pressed" from="XROrigin3D/Right" to="." method="_on_right_button_pressed"] +[connection signal="input_vector2_changed" from="XROrigin3D/Right" to="." method="_on_right_input_vector_2_changed"] +[connection signal="button_pressed" from="XROrigin3D/Left" to="." method="_on_left_button_pressed"] diff --git a/project/Scripts/main.gd b/project/Scripts/main.gd index 1ae3ef4..e2111cf 100644 --- a/project/Scripts/main.gd +++ b/project/Scripts/main.gd @@ -1,6 +1,7 @@ extends Node @export var pg: ProofGraph +var interface : XRInterface func initializeProofGraph(): pg = ProofGraph.new() @@ -12,24 +13,29 @@ func initializeProofGraph(): func _ready(): pg = initializeProofGraph() pg.addNode(Vector3(-8,12,-25)) - #pg.addNode(Vector3(8,6,-25)) - #pg.addNode(Vector3(0,-3,-25)) - get_node("ProofGraph/0").setData("Welcome") - #get_node("ProofGraph/1").setData("p→q") - #get_node("ProofGraph/2").setData("q") + pg.addNode(Vector3(8,6,-25)) + pg.addNode(Vector3(0,-3,-25)) + get_node("ProofGraph/0").setData("p") + get_node("ProofGraph/1").setData("p→q") + get_node("ProofGraph/2").setData("q") - #pg.addEdge(get_node("ProofGraph/0"), get_node("ProofGraph/2")) - #pg.addEdge(get_node("ProofGraph/1"), get_node("ProofGraph/2")) + pg.addEdge(get_node("ProofGraph/0"), get_node("ProofGraph/2")) + pg.addEdge(get_node("ProofGraph/1"), get_node("ProofGraph/2")) - #get_node("ProofGraph/0").setJustification("assume", "Assume") - #get_node("ProofGraph/1").setJustification("assume", "Assume") - #get_node("ProofGraph/2").setJustification("ifE", "→E") + get_node("ProofGraph/0").setJustification("assume", "Assume") + get_node("ProofGraph/1").setJustification("assume", "Assume") + get_node("ProofGraph/2").setJustification("ifE", "→E") - - #Loading standard 3D player character - var mainMenu = load("res://Scenes/main_menu.tscn").instantiate() + var mainMenu = load("res://Scenes/vr_player.tscn").instantiate() self.add_child(mainMenu) + interface = XRServer.find_interface("OpenXR") + if interface and interface.is_initialized(): + get_viewport().use_xr = true + + + + # Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(_delta): pass diff --git a/project/Scripts/vr_player.gd b/project/Scripts/vr_player.gd new file mode 100644 index 0000000..c0a33c1 --- /dev/null +++ b/project/Scripts/vr_player.gd @@ -0,0 +1,217 @@ +extends Node3D + +#@onready var line_edit = $"../LineEdit" +#@onready var virtual_keyboard_2d = $"../CanvasLayer/VirtualKeyboard2D" +@onready var ray = $"XROrigin3D/Right/rHand/RayCast3D" +@onready var rightHand = $"XROrigin3D/Right" +@onready var head = $"../" +@onready var pointerPG = head.pg +@onready var keyboard = $"XROrigin3D/Left/Keyboard" + +#Movement variables +var SPEED = 15.0 +var JUMP_VELOCITY = 15.0 +const TURN_SPEED = 0.03 + + +#Selection variables +@export var selectionCount = 0 +@export var selectArray: Array[LogNode] +const RAY_LENGTH = 1000 + +#Mode variables +enum modeTypes {CREATE_NODE, INPUT_DATA, CONNECT, DELETE_EDGE, DELETE_NODE, MOVE_NODE} +var playerMode = modeTypes.MOVE_NODE +var selectGate = 2 + +#Colors +const regularColor = Color(0.5, 0.75, 0.75, 0.25) +const selectColor = Color(0.75, 0.75, 0.5, 0.25) +const newColor = Color(0.25, 0.25, 0.25, 0.75) + +#Create Node flags +var newMeshExists = false +var newMeshPointer +var newMeshOffset = 15 +const offsetMax = 50 +const offsetMin = 10 + +#Move node vars +var distanceToNode +var blockPOS +var offsetPosition +var changeDistance = 0 + +#Input variables +var inputFlag = false + +func rayTraceSelect(): + if selectionCount >= selectGate: + return + + var nodeSelect = ray.get_collider() + if nodeSelect != null: + if nodeSelect.get_parent().get_class() == "LogNode": + var pNode = nodeSelect.get_parent() + if selectArray.find(pNode) != -1: + selectArray.erase(pNode) + selectionCount -= 1 + pNode.get_child(0).get_material_override().albedo_color = regularColor + else: + if selectionCount < selectGate-1: + selectArray.append(pNode) + selectionCount += 1 + pNode.get_child(0).get_material_override().albedo_color = selectColor + +func unselectAll(): + for pNode in selectArray: + pNode.get_child(0).get_material_override().albedo_color = regularColor + selectArray.clear() + selectionCount = 0 + inputFlag = false + +func newNodeLocationMesh(): + var lookDirection = rightHand.get_global_transform().basis.z + head = get_node("/root/main") + var tempMesh = MeshInstance3D.new() + tempMesh.set_name("tempMesh") + head.add_child(tempMesh) + var box = BoxMesh.new() + tempMesh.mesh = box + var skin = StandardMaterial3D.new() + tempMesh.set_surface_override_material(0,skin) + skin.albedo_color = newColor + skin.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA + tempMesh.global_scale(Vector3(10,5,2)) + tempMesh.global_position = rightHand.global_position - 10*lookDirection + newMeshExists = true + newMeshPointer = tempMesh + +func clearNewNodeLocationMesh(): + newMeshPointer.queue_free() + newMeshExists = false + +# Called when the node enters the scene tree for the first time. +func _ready(): + $"XROrigin3D/Left/lHand/ModeText".mesh.text = modeTypes.keys()[playerMode] + keyboard.hide() + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _physics_process(_delta): + match playerMode: + modeTypes.CONNECT: + pass + modeTypes.DELETE_NODE: + pass + modeTypes.CREATE_NODE: + if newMeshExists == false: + newNodeLocationMesh() + newMeshOffset += changeDistance*.2 + var lookDirection = rightHand.get_global_transform().basis.z + offsetPosition = rightHand.global_position - newMeshOffset*lookDirection + newMeshPointer.global_position = offsetPosition + modeTypes.MOVE_NODE: + var lookDirection = rightHand.get_global_transform().basis.z + if selectionCount == 1: + distanceToNode+= changeDistance*.2 + offsetPosition = rightHand.global_position - (distanceToNode)*lookDirection + selectArray[0].global_position = offsetPosition + pointerPG.updateEdges(selectArray[0]) + modeTypes.INPUT_DATA: + if inputFlag == true: + keyboard.show() + else: + keyboard.hide() + +func _on_right_button_pressed(rname): + if rname == "trigger_click" and inputFlag == false: + rayTraceSelect() + match playerMode: + modeTypes.CONNECT: + pass + modeTypes.DELETE_NODE: + pass + modeTypes.CREATE_NODE: + pass + modeTypes.MOVE_NODE: + if selectionCount == 1: + blockPOS = selectArray[0].global_position + distanceToNode = (blockPOS - rightHand.global_position).length() + modeTypes.INPUT_DATA: + if selectionCount == 1: + inputFlag = true + modeTypes.DELETE_EDGE: + pass + + if rname == "by_button": + unselectAll() + + if rname == "ax_button": + match playerMode: + modeTypes.CONNECT: + if selectionCount == 2: + pointerPG.addEdge(selectArray[0], selectArray[1]) + unselectAll() + modeTypes.DELETE_NODE: + if selectionCount == 1: + pointerPG.removeNode(selectArray[0]) + unselectAll() + modeTypes.CREATE_NODE: + clearNewNodeLocationMesh() + head = get_node("/root/main") + pointerPG = head.pg + pointerPG.addNode(offsetPosition) + modeTypes.MOVE_NODE: + unselectAll() + modeTypes.INPUT_DATA: + pass + modeTypes.DELETE_EDGE: + if selectionCount == 2: + if selectArray[1].isChild(selectArray[0]): + pointerPG.removeEdge(selectArray[1], selectArray[0]) + else: + pointerPG.removeEdge(selectArray[0], selectArray[1]) + unselectAll() + + +func _on_left_button_pressed(lname): + if lname == "trigger_click" and inputFlag == false: + inputFlag = false + if playerMode < 5: + playerMode = playerMode+1 + else: + playerMode = modeTypes.CREATE_NODE + + match playerMode: + modeTypes.CREATE_NODE: + selectGate = 0 + modeTypes.INPUT_DATA: + selectGate = 2 + clearNewNodeLocationMesh() + modeTypes.CONNECT: + selectGate = 3 + modeTypes.DELETE_EDGE: + selectGate = 3 + modeTypes.DELETE_NODE: + selectGate = 2 + modeTypes.MOVE_NODE: + selectGate = 2 + $"XROrigin3D/Left/lHand/ModeText".mesh.text = modeTypes.keys()[playerMode] + unselectAll() + +func _on_right_input_vector_2_changed(rjname, value): + if rjname == "primary" and inputFlag == false: + match playerMode: + modeTypes.CONNECT: + pass + modeTypes.DELETE_NODE: + pass + modeTypes.CREATE_NODE: + changeDistance = value[1] + modeTypes.MOVE_NODE: + if selectionCount == 1: + changeDistance = value[1] + modeTypes.INPUT_DATA: + pass + diff --git a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn index 0332f2b..2a2f272 100644 --- a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn +++ b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn @@ -8,8 +8,10 @@ follow_viewport_enabled = true script = ExtResource("1") [node name="Background" type="ColorRect" parent="."] -offset_right = 390.0 -offset_bottom = 150.0 +offset_left = 5.0 +offset_top = 181.0 +offset_right = 395.0 +offset_bottom = 331.0 color = Color(0.12549, 0.12549, 0.12549, 0.752941) [node name="Standard" type="Control" parent="Background"] diff --git a/project/project.godot b/project/project.godot index deeefb2..c78164d 100644 --- a/project/project.godot +++ b/project/project.godot @@ -114,5 +114,6 @@ Sprint={ [xr] -openxr/form_factor=1 +openxr/enabled=true +openxr/form_factor=0 shaders/enabled=true From bd78533e895c3ccc942a223d86c9d63d18f1dc0d Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Sun, 12 Nov 2023 21:29:45 -0500 Subject: [PATCH 03/14] everything but movement --- project/Scenes/textbox.tscn | 2 +- project/Scenes/vr_player.tscn | 44 ++++++++++++- project/Scripts/vr_player.gd | 11 ++++ .../objects/keyboard/virtual_keyboard_2d.gd | 63 ++++++++++--------- .../objects/viewport_2d_in_3d.tscn | 8 +-- 5 files changed, 90 insertions(+), 38 deletions(-) diff --git a/project/Scenes/textbox.tscn b/project/Scenes/textbox.tscn index 268287d..bf57c9d 100644 --- a/project/Scenes/textbox.tscn +++ b/project/Scenes/textbox.tscn @@ -9,5 +9,5 @@ theme_override_colors/font_color = Color(1, 1, 1, 1) theme_override_colors/font_selected_color = Color(1, 1, 1, 1) theme_override_colors/caret_color = Color(1, 1, 1, 1) theme_override_font_sizes/font_size = 45 -placeholder_text = "apples are tasty" +placeholder_text = "formula" alignment = 1 diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index 73dc1a6..9c4c65a 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=9 format=3 uid="uid://bsqsl2sg40kes"] +[gd_scene load_steps=14 format=3 uid="uid://bsqsl2sg40kes"] [ext_resource type="Script" path="res://Scripts/vr_player.gd" id="1_lugxl"] +[ext_resource type="PackedScene" uid="uid://cqhw276realc" path="res://addons/godot-xr-tools/functions/function_pointer.tscn" id="2_42m2a"] [ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="2_88kpy"] [ext_resource type="PackedScene" uid="uid://lauwp8okd1vh" path="res://addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn" id="3_nc4pw"] [ext_resource type="PackedScene" uid="uid://cd0a77sysrjf7" path="res://Scenes/textbox.tscn" id="4_cmjq8"] @@ -16,6 +17,24 @@ bottom_radius = 0.01 [sub_resource type="TextMesh" id="TextMesh_g1jrr"] text = "Test" +[sub_resource type="QuadMesh" id="QuadMesh_4qjll"] +resource_local_to_scene = true +size = Vector2(0.5, 0.1) + +[sub_resource type="ViewportTexture" id="ViewportTexture_e03uw"] +viewport_path = NodePath("Viewport") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hg5ic"] +transparency = 1 +cull_mode = 2 +shading_mode = 0 +albedo_texture = SubResource("ViewportTexture_e03uw") +texture_filter = 1 + +[sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] +resource_local_to_scene = true +size = Vector3(0.5, 0.1, 0.02) + [node name="VRPlayer" type="Node3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.000833228, 0, 0) script = ExtResource("1_lugxl") @@ -35,9 +54,13 @@ mesh = SubResource("SphereMesh_xc2q5") transform = Transform3D(10, 0, 0, 0, -3.27835e-05, -10, 0, 750, -4.37114e-07, 0, 0, -0.262443) [node name="MeshInstance3D" type="MeshInstance3D" parent="XROrigin3D/Right/rHand/RayCast3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 1.54099e-13) mesh = SubResource("CylinderMesh_le24m") +[node name="keyRay" parent="XROrigin3D/Right/rHand" instance=ExtResource("2_42m2a")] +visible = false +collision_mask = 2097152 + [node name="Left" type="XRController3D" parent="XROrigin3D"] tracker = &"left_hand" @@ -65,6 +88,23 @@ viewport_size = Vector2(500, 125) scene = ExtResource("4_cmjq8") collision_layer = 2097154 +[node name="Viewport" parent="XROrigin3D/Left/Keyboard/Text" index="0"] +size = Vector2i(500, 125) + +[node name="Screen" parent="XROrigin3D/Left/Keyboard/Text" index="1"] +mesh = SubResource("QuadMesh_4qjll") +surface_material_override/0 = SubResource("StandardMaterial3D_hg5ic") + +[node name="StaticBody3D" parent="XROrigin3D/Left/Keyboard/Text" index="2"] +collision_layer = 2097154 +screen_size = Vector2(0.5, 0.1) +viewport_size = Vector2(500, 125) + +[node name="CollisionShape3D" parent="XROrigin3D/Left/Keyboard/Text/StaticBody3D" index="0"] +shape = SubResource("BoxShape3D_ucoqh") + [connection signal="button_pressed" from="XROrigin3D/Right" to="." method="_on_right_button_pressed"] [connection signal="input_vector2_changed" from="XROrigin3D/Right" to="." method="_on_right_input_vector_2_changed"] [connection signal="button_pressed" from="XROrigin3D/Left" to="." method="_on_left_button_pressed"] + +[editable path="XROrigin3D/Left/Keyboard/Text"] diff --git a/project/Scripts/vr_player.gd b/project/Scripts/vr_player.gd index c0a33c1..58cace7 100644 --- a/project/Scripts/vr_player.gd +++ b/project/Scripts/vr_player.gd @@ -7,6 +7,9 @@ extends Node3D @onready var head = $"../" @onready var pointerPG = head.pg @onready var keyboard = $"XROrigin3D/Left/Keyboard" +@onready var nodeRay = $"XROrigin3D/Right/rHand/RayCast3D" +@onready var keyRay = $"XROrigin3D/Right/rHand/keyRay" +@onready var lineEdit = $"XROrigin3D/Left/Keyboard/Text/".get_child(0).get_child(0).get_child(0) #Movement variables var SPEED = 15.0 @@ -121,8 +124,16 @@ func _physics_process(_delta): modeTypes.INPUT_DATA: if inputFlag == true: keyboard.show() + nodeRay.hide() + keyRay.show() + if Input.is_action_just_pressed("EnterInput"): + selectArray[0].setData(lineEdit.text) + unselectAll() + inputFlag = false else: keyboard.hide() + nodeRay.show() + keyRay.hide() func _on_right_button_pressed(rname): if rname == "trigger_click" and inputFlag == false: diff --git a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd index 5f34b63..040e292 100644 --- a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd +++ b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd @@ -2,6 +2,7 @@ class_name XRToolsVirtualKeyboard2D extends CanvasLayer +@onready var player = $"../../../../../../" ## Enumeration of keyboard view modes enum KeyboardMode { @@ -108,108 +109,108 @@ func _update_visible(): func _on_assumption_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("assume", "Assume") func _on_negation_introduction_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("notI", "¬I") func _on_negation_elimination_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("notE", "¬E") func _on_conjunction_introduction_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("andI", "∧I") func _on_conjunction_elimination_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("andE", "∧E") func _on_disjunction_introduction_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("orI", "∨I") func _on_disjunction_elimination_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("orE", "∨E") func _on_conditional_introduction_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("ifI", "→I") func _on_conditional_elimination_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("ifE", "→E") func _on_biconditional_introduction_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("iffI", "↔I") func _on_biconditional_elimination_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("iffE", "↔E") func _on_universal_introduction_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("forallI", "∀I") func _on_universal_elimination_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("forallE", "∀E") func _on_existential_introduction_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("existsI", "∃I") func _on_existential_elimination_pressed(): - selectArray = $"../../CharacterBody3D".selectArray - selectionCount = $"../../CharacterBody3D".selectionCount + selectArray = player.selectArray + selectionCount = player.selectionCount if selectionCount == 1: selectArray[0].setJustification("existsE", "∃E") func _on_clear_pressed(): - $"../../LineEdit".clear() + print($"../") diff --git a/project/addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn b/project/addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn index f5d3692..b82da83 100644 --- a/project/addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn +++ b/project/addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn @@ -7,14 +7,14 @@ resource_local_to_scene = true size = Vector2(3, 2) -[sub_resource type="ViewportTexture" id="ViewportTexture_wx1vc"] +[sub_resource type="ViewportTexture" id="ViewportTexture_xmjef"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ej8nj"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qutda"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_wx1vc") +albedo_texture = SubResource("ViewportTexture_xmjef") texture_filter = 1 [sub_resource type="BoxShape3D" id="4"] @@ -33,7 +33,7 @@ render_target_update_mode = 1 [node name="Screen" type="MeshInstance3D" parent="."] mesh = SubResource("1") -surface_material_override/0 = SubResource("StandardMaterial3D_ej8nj") +surface_material_override/0 = SubResource("StandardMaterial3D_qutda") [node name="StaticBody3D" type="StaticBody3D" parent="."] collision_layer = 1048577 From af1e97e04e966c2c8372fcff6f9ec31edef6568a Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Mon, 13 Nov 2023 00:26:41 -0500 Subject: [PATCH 04/14] basic vr movement --- extension/proofgraph.cpp | 48 ++++++------ project/Scenes/vr_player.tscn | 77 ++++++++++++------- project/Scripts/main.gd | 32 ++++---- project/Scripts/vr_player.gd | 35 +++++---- project/Scripts/vrmovement.gd | 41 ++++++++++ .../functions/movement_direct.gd | 2 +- .../objects/keyboard/virtual_keyboard_2d.gd | 4 +- .../objects/keyboard/virtual_keyboard_2d.tscn | 2 +- .../godot-xr-tools/player/player_body.gd | 29 ++++--- project/project.godot | 8 ++ 10 files changed, 172 insertions(+), 106 deletions(-) create mode 100644 project/Scripts/vrmovement.gd diff --git a/extension/proofgraph.cpp b/extension/proofgraph.cpp index ad6a6d6..9fc89e4 100644 --- a/extension/proofgraph.cpp +++ b/extension/proofgraph.cpp @@ -23,7 +23,6 @@ LogNode::LogNode(){ justification = ""; HashSet logParents; HashSet logChildren; - } void LogNode::setID(int nodeID){ @@ -54,19 +53,17 @@ void LogNode::setData(String newData){ newText->set_mesh(letters); letters->TextMesh::set_text(newData); StandardMaterial3D* skin = memnew(StandardMaterial3D); - //skin->set_emission(Color(1,1,1,1)); - //skin->set_emission_energy_multiplier(8); - //skin->set_emission_operator(BaseMaterial3D::EMISSION_OP_MULTIPLY); - //skin->set_emission_intensity(2); newText->set_material_overlay(skin); - newText->global_scale(Vector3(12,12,5)); - newText->set_position(Vector3(0,.4,0)); + newText->global_scale(Vector3(1.2,1.2,.5)); + newText->set_position(Vector3(0,.04,0)); + MeshInstance3D* oldBox = (MeshInstance3D*) get_node_or_null("box"); if (newData.length() > 9){ - MeshInstance3D* oldBox = (MeshInstance3D*) get_node_or_null("box"); - //Each additional letter adds more than 1 scale unit - oldBox->set_scale(Vector3(10+(newData.length()-10)*1.15,5,2)); + oldBox->set_scale(Vector3(1+(newData.length()-10)*.135,.5,.2)); + } + else { + oldBox->set_scale(Vector3(1.0,.5,.2)); } } @@ -107,8 +104,8 @@ void LogNode::setParentRep(){ TextMesh* letters = memnew(TextMesh); newText->set_mesh(letters); letters->TextMesh::set_text(this->getParentRep()); - newText->global_scale(Vector3(8,8,5)); - newText->set_position(Vector3(0,-1.5,0)); + newText->global_scale(Vector3(.8,.8,.5)); + newText->set_position(Vector3(0,-.15,0)); } void LogNode::setJustification(String code, String symbol){ @@ -126,11 +123,11 @@ void LogNode::setJustification(String code, String symbol){ TextMesh* letters = memnew(TextMesh); newText->set_mesh(letters); letters->TextMesh::set_text(symbol); - newText->global_scale(Vector3(12,12,5)); - newText->set_position(Vector3(0,3.85,0)); + newText->global_scale(Vector3(1.2,1.2,.5)); + newText->set_position(Vector3(0,.385,0)); MeshInstance3D* oldBox = (MeshInstance3D*) get_node_or_null("justBox"); - oldBox->set_scale(Vector3(symbol.length()*1.15+1,2.25,2)); + oldBox->set_scale(Vector3((symbol.length()*.115)+.1,.225,.2)); } @@ -176,7 +173,7 @@ void ProofGraph::addNode(Vector3 position){ newNode->add_child(box); box->set_mesh(shape); box->set_material_override(skin); - box->set_scale(Vector3(10,5,2)); + box->set_scale(Vector3(1.0,.5,.2)); skin->set_transparency(BaseMaterial3D::TRANSPARENCY_ALPHA); skin->set_albedo(Color(0.5, 0.75, 0.75, 0.25)); @@ -187,8 +184,8 @@ void ProofGraph::addNode(Vector3 position){ TextMesh* numbers = memnew(TextMesh); idText->set_mesh(numbers); numbers->TextMesh::set_text("ID: " + String::num_int64(newNode->getID())); - idText->set_position(Vector3(-3.25, 1.9, 0)); - idText->set_scale(Vector3(8,8,5)); + idText->set_position(Vector3(-.325, .19, 0)); + idText->set_scale(Vector3(.8,.8,.5)); //Physics collider for ray casts @@ -199,7 +196,7 @@ void ProofGraph::addNode(Vector3 position){ newNode->add_child(nodeCollider); nodeCollider->add_child(physBody); physBody->set_shape(physBox); - physBody->set_scale(Vector3(10,5,2)); + physBody->set_scale(Vector3(1.0,.5,.2)); //Create box mesh for justification MeshInstance3D* justBox = memnew(MeshInstance3D); @@ -209,17 +206,17 @@ void ProofGraph::addNode(Vector3 position){ newNode->add_child(justBox); justBox->set_mesh(justShape); justBox->set_material_override(justSkin); - justBox->set_scale(Vector3(3,2.25,2)); + justBox->set_scale(Vector3(.3,.225,.2)); justSkin->set_transparency(BaseMaterial3D::TRANSPARENCY_ALPHA); justSkin->set_albedo(Color(0.5, 0.75, 0.75, 0.25)); - justBox->set_position(Vector3(0,3.75,0)); + justBox->set_position(Vector3(0,.375,.0)); } void ProofGraph::edgeSetter(LogNode* start, LogNode* end, MeshInstance3D* workingEdge){ - Vector3 topBoxOffset = Vector3(0,1.25,0); - Vector3 bottomBoxOffset = Vector3(0,2.5,0); + Vector3 topBoxOffset = Vector3(0,.125,0); + Vector3 bottomBoxOffset = Vector3(0,.25,0); Vector3 sPos = start->get_global_position(); - Vector3 ePos = end->get_global_position() + Vector3(0,3.75,0); + Vector3 ePos = end->get_global_position() + Vector3(0,.375,0); Vector3 startOffset = Vector3(0,0,0); Vector3 endOffset = Vector3(0,0,0); if (sPos.y > ePos.y){ @@ -234,7 +231,7 @@ void ProofGraph::edgeSetter(LogNode* start, LogNode* end, MeshInstance3D* workin Vector3 location = (startOffset+endOffset)/2; double lineLength = (startOffset-endOffset).length(); - workingEdge->set_scale(Vector3(0.3,0.3,lineLength)); + workingEdge->set_scale(Vector3(0.03,0.03,lineLength)); // Sets both global position and facing direction workingEdge->look_at_from_position(location, endOffset, Vector3(0,1,0), true); } @@ -276,7 +273,6 @@ void ProofGraph::removeEdge(LogNode* start, LogNode* end){ badEdge->queue_free(); end->setParentRep(); } - } // Needs checks for node validity diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index 9c4c65a..748d249 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -1,17 +1,30 @@ -[gd_scene load_steps=14 format=3 uid="uid://bsqsl2sg40kes"] +[gd_scene load_steps=18 format=3 uid="uid://bsqsl2sg40kes"] [ext_resource type="Script" path="res://Scripts/vr_player.gd" id="1_lugxl"] +[ext_resource type="Script" path="res://Scripts/vrmovement.gd" id="2_0ke33"] [ext_resource type="PackedScene" uid="uid://cqhw276realc" path="res://addons/godot-xr-tools/functions/function_pointer.tscn" id="2_42m2a"] [ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="2_88kpy"] [ext_resource type="PackedScene" uid="uid://lauwp8okd1vh" path="res://addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn" id="3_nc4pw"] [ext_resource type="PackedScene" uid="uid://cd0a77sysrjf7" path="res://Scenes/textbox.tscn" id="4_cmjq8"] +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ah1ml"] + [sub_resource type="SphereMesh" id="SphereMesh_xc2q5"] [sub_resource type="CylinderMesh" id="CylinderMesh_le24m"] top_radius = 0.01 bottom_radius = 0.01 +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_1wq6r"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_h2bms"] +albedo_color = Color(0.0352941, 0.54902, 0.698039, 1) +albedo_texture = SubResource("NoiseTexture2D_1wq6r") +emission_enabled = true +emission = Color(0, 0.901961, 0.952941, 1) +emission_energy_multiplier = 2.0 +emission_operator = 1 + [sub_resource type="SphereMesh" id="SphereMesh_pe45r"] [sub_resource type="TextMesh" id="TextMesh_g1jrr"] @@ -21,14 +34,14 @@ text = "Test" resource_local_to_scene = true size = Vector2(0.5, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_e03uw"] +[sub_resource type="ViewportTexture" id="ViewportTexture_7oher"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hg5ic"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ud3la"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_e03uw") +albedo_texture = SubResource("ViewportTexture_7oher") texture_filter = 1 [sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] @@ -39,72 +52,82 @@ size = Vector3(0.5, 0.1, 0.02) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.000833228, 0, 0) script = ExtResource("1_lugxl") -[node name="XROrigin3D" type="XROrigin3D" parent="."] +[node name="CharacterBody3D" type="CharacterBody3D" parent="."] +script = ExtResource("2_0ke33") -[node name="XRCamera3D" type="XRCamera3D" parent="XROrigin3D"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"] +transform = Transform3D(0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0) +shape = SubResource("CapsuleShape3D_ah1ml") -[node name="Right" type="XRController3D" parent="XROrigin3D"] +[node name="XROrigin3D" type="XROrigin3D" parent="CharacterBody3D"] + +[node name="Right" type="XRController3D" parent="CharacterBody3D/XROrigin3D"] tracker = &"right_hand" -[node name="rHand" type="MeshInstance3D" parent="XROrigin3D/Right"] +[node name="rHand" type="MeshInstance3D" parent="CharacterBody3D/XROrigin3D/Right"] transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0) mesh = SubResource("SphereMesh_xc2q5") -[node name="RayCast3D" type="RayCast3D" parent="XROrigin3D/Right/rHand"] +[node name="RayCast3D" type="RayCast3D" parent="CharacterBody3D/XROrigin3D/Right/rHand"] transform = Transform3D(10, 0, 0, 0, -3.27835e-05, -10, 0, 750, -4.37114e-07, 0, 0, -0.262443) -[node name="MeshInstance3D" type="MeshInstance3D" parent="XROrigin3D/Right/rHand/RayCast3D"] +[node name="MeshInstance3D" type="MeshInstance3D" parent="CharacterBody3D/XROrigin3D/Right/rHand/RayCast3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 1.54099e-13) mesh = SubResource("CylinderMesh_le24m") +surface_material_override/0 = SubResource("StandardMaterial3D_h2bms") -[node name="keyRay" parent="XROrigin3D/Right/rHand" instance=ExtResource("2_42m2a")] -visible = false +[node name="keyRay" parent="CharacterBody3D/XROrigin3D/Right/rHand" instance=ExtResource("2_42m2a")] collision_mask = 2097152 -[node name="Left" type="XRController3D" parent="XROrigin3D"] +[node name="Left" type="XRController3D" parent="CharacterBody3D/XROrigin3D"] tracker = &"left_hand" -[node name="lHand" type="MeshInstance3D" parent="XROrigin3D/Left"] +[node name="lHand" type="MeshInstance3D" parent="CharacterBody3D/XROrigin3D/Left"] transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0) mesh = SubResource("SphereMesh_pe45r") -[node name="ModeText" type="MeshInstance3D" parent="XROrigin3D/Left/lHand"] +[node name="ModeText" type="MeshInstance3D" parent="CharacterBody3D/XROrigin3D/Left/lHand"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 1.2, 0, 0) mesh = SubResource("TextMesh_g1jrr") -[node name="Keyboard" type="Node3D" parent="XROrigin3D/Left"] +[node name="Keyboard" type="Node3D" parent="CharacterBody3D/XROrigin3D/Left"] -[node name="VirtualKeyboard" parent="XROrigin3D/Left/Keyboard" instance=ExtResource("2_88kpy")] +[node name="VirtualKeyboard" parent="CharacterBody3D/XROrigin3D/Left/Keyboard" instance=ExtResource("2_88kpy")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5) screen_size = Vector2(1, 1) viewport_size = Vector2(600, 500) scene = ExtResource("3_nc4pw") collision_layer = 2097154 -[node name="Text" parent="XROrigin3D/Left/Keyboard" instance=ExtResource("2_88kpy")] +[node name="Text" parent="CharacterBody3D/XROrigin3D/Left/Keyboard" instance=ExtResource("2_88kpy")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.170474, 0.228016, -0.468246) screen_size = Vector2(0.5, 0.1) viewport_size = Vector2(500, 125) scene = ExtResource("4_cmjq8") collision_layer = 2097154 -[node name="Viewport" parent="XROrigin3D/Left/Keyboard/Text" index="0"] +[node name="Viewport" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="0"] size = Vector2i(500, 125) -[node name="Screen" parent="XROrigin3D/Left/Keyboard/Text" index="1"] +[node name="Screen" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="1"] mesh = SubResource("QuadMesh_4qjll") -surface_material_override/0 = SubResource("StandardMaterial3D_hg5ic") +surface_material_override/0 = SubResource("StandardMaterial3D_ud3la") -[node name="StaticBody3D" parent="XROrigin3D/Left/Keyboard/Text" index="2"] +[node name="StaticBody3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="2"] collision_layer = 2097154 screen_size = Vector2(0.5, 0.1) viewport_size = Vector2(500, 125) -[node name="CollisionShape3D" parent="XROrigin3D/Left/Keyboard/Text/StaticBody3D" index="0"] +[node name="CollisionShape3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text/StaticBody3D" index="0"] shape = SubResource("BoxShape3D_ucoqh") -[connection signal="button_pressed" from="XROrigin3D/Right" to="." method="_on_right_button_pressed"] -[connection signal="input_vector2_changed" from="XROrigin3D/Right" to="." method="_on_right_input_vector_2_changed"] -[connection signal="button_pressed" from="XROrigin3D/Left" to="." method="_on_left_button_pressed"] +[node name="XRCamera3D" type="XRCamera3D" parent="CharacterBody3D/XROrigin3D"] + +[connection signal="button_pressed" from="CharacterBody3D/XROrigin3D/Right" to="." method="_on_right_button_pressed"] +[connection signal="input_vector2_changed" from="CharacterBody3D/XROrigin3D/Right" to="." method="_on_right_input_vector_2_changed"] +[connection signal="button_pressed" from="CharacterBody3D/XROrigin3D/Left" to="." method="_on_left_button_pressed"] +[connection signal="button_pressed" from="CharacterBody3D/XROrigin3D/Left" to="CharacterBody3D" method="_on_left_button_pressed"] +[connection signal="button_released" from="CharacterBody3D/XROrigin3D/Left" to="CharacterBody3D" method="_on_left_button_released"] +[connection signal="input_vector2_changed" from="CharacterBody3D/XROrigin3D/Left" to="CharacterBody3D" method="_on_left_input_vector_2_changed"] -[editable path="XROrigin3D/Left/Keyboard/Text"] +[editable path="CharacterBody3D/XROrigin3D/Left/Keyboard/Text"] diff --git a/project/Scripts/main.gd b/project/Scripts/main.gd index e2111cf..826338a 100644 --- a/project/Scripts/main.gd +++ b/project/Scripts/main.gd @@ -11,31 +11,29 @@ func initializeProofGraph(): # Called when the node enters the scene tree for the first time. func _ready(): + interface = XRServer.find_interface("OpenXR") + if interface and interface.is_initialized(): + get_viewport().use_xr = true + pg = initializeProofGraph() - pg.addNode(Vector3(-8,12,-25)) - pg.addNode(Vector3(8,6,-25)) - pg.addNode(Vector3(0,-3,-25)) - get_node("ProofGraph/0").setData("p") - get_node("ProofGraph/1").setData("p→q") - get_node("ProofGraph/2").setData("q") + #pg.addNode(Vector3(-2,3,-6)) + #pg.addNode(Vector3(2,1.5,-6)) + #pg.addNode(Vector3(0,-1.5,-6)) + #get_node("ProofGraph/0").setData("p") + #get_node("ProofGraph/1").setData("p→q") + #get_node("ProofGraph/2").setData("q") - pg.addEdge(get_node("ProofGraph/0"), get_node("ProofGraph/2")) - pg.addEdge(get_node("ProofGraph/1"), get_node("ProofGraph/2")) + #pg.addEdge(get_node("ProofGraph/0"), get_node("ProofGraph/2")) + #pg.addEdge(get_node("ProofGraph/1"), get_node("ProofGraph/2")) - get_node("ProofGraph/0").setJustification("assume", "Assume") - get_node("ProofGraph/1").setJustification("assume", "Assume") - get_node("ProofGraph/2").setJustification("ifE", "→E") + #get_node("ProofGraph/0").setJustification("assume", "Assume") + #get_node("ProofGraph/1").setJustification("assume", "Assume") + #get_node("ProofGraph/2").setJustification("ifE", "→E") var mainMenu = load("res://Scenes/vr_player.tscn").instantiate() self.add_child(mainMenu) - interface = XRServer.find_interface("OpenXR") - if interface and interface.is_initialized(): - get_viewport().use_xr = true - - - # Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(_delta): pass diff --git a/project/Scripts/vr_player.gd b/project/Scripts/vr_player.gd index 58cace7..9d6538c 100644 --- a/project/Scripts/vr_player.gd +++ b/project/Scripts/vr_player.gd @@ -2,21 +2,20 @@ extends Node3D #@onready var line_edit = $"../LineEdit" #@onready var virtual_keyboard_2d = $"../CanvasLayer/VirtualKeyboard2D" -@onready var ray = $"XROrigin3D/Right/rHand/RayCast3D" -@onready var rightHand = $"XROrigin3D/Right" +@onready var ray = $"CharacterBody3D/XROrigin3D/Right/rHand/RayCast3D" +@onready var rightHand = $"CharacterBody3D/XROrigin3D/Right" @onready var head = $"../" @onready var pointerPG = head.pg -@onready var keyboard = $"XROrigin3D/Left/Keyboard" -@onready var nodeRay = $"XROrigin3D/Right/rHand/RayCast3D" -@onready var keyRay = $"XROrigin3D/Right/rHand/keyRay" -@onready var lineEdit = $"XROrigin3D/Left/Keyboard/Text/".get_child(0).get_child(0).get_child(0) +@onready var keyboard = $"CharacterBody3D/XROrigin3D/Left/Keyboard" +@onready var nodeRay = $"CharacterBody3D/XROrigin3D/Right/rHand/RayCast3D" +@onready var keyRay = $"CharacterBody3D/XROrigin3D/Right/rHand/keyRay" +@onready var lineEdit = $"CharacterBody3D/XROrigin3D/Left/Keyboard/Text/".get_child(0).get_child(0).get_child(0) #Movement variables -var SPEED = 15.0 -var JUMP_VELOCITY = 15.0 +var SPEED = 1.0 +var JUMP_VELOCITY = 1.0 const TURN_SPEED = 0.03 - #Selection variables @export var selectionCount = 0 @export var selectArray: Array[LogNode] @@ -35,7 +34,7 @@ const newColor = Color(0.25, 0.25, 0.25, 0.75) #Create Node flags var newMeshExists = false var newMeshPointer -var newMeshOffset = 15 +var newMeshOffset = 10 const offsetMax = 50 const offsetMin = 10 @@ -85,8 +84,8 @@ func newNodeLocationMesh(): tempMesh.set_surface_override_material(0,skin) skin.albedo_color = newColor skin.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA - tempMesh.global_scale(Vector3(10,5,2)) - tempMesh.global_position = rightHand.global_position - 10*lookDirection + tempMesh.global_scale(Vector3(1.0,.5,.2)) + tempMesh.global_position = rightHand.global_position - 5*lookDirection newMeshExists = true newMeshPointer = tempMesh @@ -96,12 +95,15 @@ func clearNewNodeLocationMesh(): # Called when the node enters the scene tree for the first time. func _ready(): - $"XROrigin3D/Left/lHand/ModeText".mesh.text = modeTypes.keys()[playerMode] + $"CharacterBody3D/XROrigin3D/Left/lHand/ModeText".mesh.text = modeTypes.keys()[playerMode] keyboard.hide() + keyRay.enabled = false # Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(_delta): + + match playerMode: modeTypes.CONNECT: pass @@ -125,15 +127,16 @@ func _physics_process(_delta): if inputFlag == true: keyboard.show() nodeRay.hide() - keyRay.show() + keyRay.enabled = true if Input.is_action_just_pressed("EnterInput"): selectArray[0].setData(lineEdit.text) unselectAll() + lineEdit.clear() inputFlag = false else: keyboard.hide() nodeRay.show() - keyRay.hide() + keyRay.enabled = false func _on_right_button_pressed(rname): if rname == "trigger_click" and inputFlag == false: @@ -208,7 +211,7 @@ func _on_left_button_pressed(lname): selectGate = 2 modeTypes.MOVE_NODE: selectGate = 2 - $"XROrigin3D/Left/lHand/ModeText".mesh.text = modeTypes.keys()[playerMode] + $"CharacterBody3D/XROrigin3D/Left/lHand/ModeText".mesh.text = modeTypes.keys()[playerMode] unselectAll() func _on_right_input_vector_2_changed(rjname, value): diff --git a/project/Scripts/vrmovement.gd b/project/Scripts/vrmovement.gd new file mode 100644 index 0000000..6bb50d6 --- /dev/null +++ b/project/Scripts/vrmovement.gd @@ -0,0 +1,41 @@ +extends CharacterBody3D +@onready var cam = $"XROrigin3D/XRCamera3D" + +var SPEED = 2 +var JUMP = 0 +var xdir = 0 +var ydir = 0 + +func _physics_process(_delta): + + var direction = (cam.transform.basis * Vector3(xdir, 0, ydir)).normalized() + if direction: + velocity.x = direction.x * SPEED + velocity.z = direction.z * SPEED + else: + velocity.x = move_toward(velocity.x, 0, SPEED) + velocity.z = move_toward(velocity.z, 0, SPEED) + + velocity.y = JUMP + + move_and_slide() + + +func _on_left_input_vector_2_changed(lname, value): + if lname == "primary": + xdir = value[0] + ydir = -value[1] + + +func _on_left_button_pressed(lname): + if lname == "by_button": + JUMP = 2 + if lname == "ax_button": + JUMP = -2 + + +func _on_left_button_released(lname): + if lname == "by_button": + JUMP = 0 + if lname == "ax_button": + JUMP = 0 diff --git a/project/addons/godot-xr-tools/functions/movement_direct.gd b/project/addons/godot-xr-tools/functions/movement_direct.gd index 5b88b8b..de8ef47 100644 --- a/project/addons/godot-xr-tools/functions/movement_direct.gd +++ b/project/addons/godot-xr-tools/functions/movement_direct.gd @@ -19,7 +19,7 @@ extends XRToolsMovementProvider @export var max_speed : float = 10.0 ## If true, the player can strafe -@export var strafe : bool = false +@export var strafe : bool = true ## Input action for movement direction @export var input_action : String = "primary" diff --git a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd index 040e292..a1b8e66 100644 --- a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd +++ b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd @@ -2,7 +2,7 @@ class_name XRToolsVirtualKeyboard2D extends CanvasLayer -@onready var player = $"../../../../../../" +@onready var player = $"../../../../../../../" ## Enumeration of keyboard view modes enum KeyboardMode { @@ -212,5 +212,3 @@ func _on_existential_elimination_pressed(): if selectionCount == 1: selectArray[0].setJustification("existsE", "∃E") -func _on_clear_pressed(): - print($"../") diff --git a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn index 2a2f272..953f0e4 100644 --- a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn +++ b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn @@ -214,6 +214,7 @@ text = "Existential Elimination " [node name="Clear" type="Button" parent="Background/Standard"] +visible = false layout_mode = 0 offset_left = 3.0 offset_top = 118.0 @@ -915,4 +916,3 @@ unicode = 63 [connection signal="pressed" from="Background/Standard/VBoxContainer/Universal Elimination" to="." method="_on_universal_elimination_pressed"] [connection signal="pressed" from="Background/Standard/VBoxContainer/Existential Introduction" to="." method="_on_existential_introduction_pressed"] [connection signal="pressed" from="Background/Standard/VBoxContainer/Existential Elimination" to="." method="_on_existential_elimination_pressed"] -[connection signal="pressed" from="Background/Standard/Clear" to="." method="_on_clear_pressed"] diff --git a/project/addons/godot-xr-tools/player/player_body.gd b/project/addons/godot-xr-tools/player/player_body.gd index c019518..3d00cd8 100644 --- a/project/addons/godot-xr-tools/player/player_body.gd +++ b/project/addons/godot-xr-tools/player/player_body.gd @@ -239,8 +239,7 @@ func _physics_process(delta: float): up_player_plane = Plane(up_player_vector, 0.0) # Determine environmental gravity - var gravity_state := PhysicsServer3D.body_get_direct_state(get_rid()) - gravity = gravity_state.total_gravity + gravity = Vector3(0,0,0) # Update the kinematic body to be under the camera _update_body_under_camera() @@ -252,14 +251,14 @@ func _physics_process(delta: float): p.physics_pre_movement(delta, self) # Determine the gravity "up" direction and plane - if gravity.is_equal_approx(Vector3.ZERO): + #if gravity.is_equal_approx(Vector3.ZERO): # Gravity too weak - use player - up_gravity_vector = up_player_vector - up_gravity_plane = up_player_plane - else: + # up_gravity_vector = up_player_vector + # up_gravity_plane = up_player_plane + #else: # Use gravity direction - up_gravity_vector = -gravity.normalized() - up_gravity_plane = Plane(up_gravity_vector, 0.0) + # up_gravity_vector = -gravity.normalized() + # up_gravity_plane = Plane(up_gravity_vector, 0.0) # Update the ground information _update_ground_information(delta) @@ -284,21 +283,21 @@ func _physics_process(delta: float): # If no controller has performed an exclusive-update then apply gravity and # perform any ground-control - if !exclusive: - if on_ground and ground_physics.stop_on_slope and ground_angle < ground_physics.move_max_slope: + #if !exclusive: + # if on_ground and ground_physics.stop_on_slope and ground_angle < ground_physics.move_max_slope: # Apply gravity towards slope to prevent sliding - velocity += -ground_vector * gravity.length() * delta - else: + # velocity += -ground_vector * gravity.length() * delta + # else: # Apply gravity - velocity += gravity * delta - _apply_velocity_and_control(delta) + # velocity += gravity * delta + # _apply_velocity_and_control(delta) # Apply the player-body movement to the XR origin var movement := global_transform.origin - position_before_movement origin_node.global_transform.origin += movement # Orient the player towards (potentially modified) gravity - slew_up(-gravity.normalized(), 5.0 * delta) + #slew_up(-gravity.normalized(), 5.0 * delta) ## Request a jump diff --git a/project/project.godot b/project/project.godot index c78164d..87c132b 100644 --- a/project/project.godot +++ b/project/project.godot @@ -15,10 +15,18 @@ run/main_scene="res://Scenes/main.tscn" config/features=PackedStringArray("4.1", "Forward Plus") config/icon="res://icon.svg" +[autoload] + +XRToolsUserSettings="*res://addons/godot-xr-tools/user_settings/user_settings.gd" + [display] window/stretch/mode="canvas_items" +[editor_plugins] + +enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg") + [input] Interact={ From c2c898c3349617d412e18497f6f0d0e894b366f8 Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Mon, 13 Nov 2023 15:04:52 -0500 Subject: [PATCH 05/14] keyboard tweaks --- project/Scenes/vr_player.tscn | 8 +- project/Scripts/main.gd | 34 +- .../objects/keyboard/virtual_keyboard_2d.tscn | 922 +++++------------- 3 files changed, 245 insertions(+), 719 deletions(-) diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index 748d249..24ffc97 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -34,14 +34,14 @@ text = "Test" resource_local_to_scene = true size = Vector2(0.5, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_7oher"] +[sub_resource type="ViewportTexture" id="ViewportTexture_kafv6"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ud3la"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1fvug"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_7oher") +albedo_texture = SubResource("ViewportTexture_kafv6") texture_filter = 1 [sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] @@ -111,7 +111,7 @@ size = Vector2i(500, 125) [node name="Screen" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="1"] mesh = SubResource("QuadMesh_4qjll") -surface_material_override/0 = SubResource("StandardMaterial3D_ud3la") +surface_material_override/0 = SubResource("StandardMaterial3D_1fvug") [node name="StaticBody3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="2"] collision_layer = 2097154 diff --git a/project/Scripts/main.gd b/project/Scripts/main.gd index 826338a..a9a87f1 100644 --- a/project/Scripts/main.gd +++ b/project/Scripts/main.gd @@ -9,31 +9,33 @@ func initializeProofGraph(): self.add_child(pg) return pg +func demo(): + pg.addNode(Vector3(-2,3,-6)) + pg.addNode(Vector3(2,1.5,-6)) + pg.addNode(Vector3(0,-1.5,-6)) + + get_node("ProofGraph/0").setData("p") + get_node("ProofGraph/1").setData("p→q") + get_node("ProofGraph/2").setData("q") + + pg.addEdge(get_node("ProofGraph/0"), get_node("ProofGraph/2")) + pg.addEdge(get_node("ProofGraph/1"), get_node("ProofGraph/2")) + + get_node("ProofGraph/0").setJustification("assume", "Assume") + get_node("ProofGraph/1").setJustification("assume", "Assume") + get_node("ProofGraph/2").setJustification("ifE", "→E") + # Called when the node enters the scene tree for the first time. func _ready(): + pg = initializeProofGraph() + interface = XRServer.find_interface("OpenXR") if interface and interface.is_initialized(): get_viewport().use_xr = true - pg = initializeProofGraph() - #pg.addNode(Vector3(-2,3,-6)) - #pg.addNode(Vector3(2,1.5,-6)) - #pg.addNode(Vector3(0,-1.5,-6)) - #get_node("ProofGraph/0").setData("p") - #get_node("ProofGraph/1").setData("p→q") - #get_node("ProofGraph/2").setData("q") - - #pg.addEdge(get_node("ProofGraph/0"), get_node("ProofGraph/2")) - #pg.addEdge(get_node("ProofGraph/1"), get_node("ProofGraph/2")) - - #get_node("ProofGraph/0").setJustification("assume", "Assume") - #get_node("ProofGraph/1").setJustification("assume", "Assume") - #get_node("ProofGraph/2").setJustification("ifE", "→E") - var mainMenu = load("res://Scenes/vr_player.tscn").instantiate() self.add_child(mainMenu) - # Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(_delta): pass diff --git a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn index 953f0e4..6125a3f 100644 --- a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn +++ b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.tscn @@ -8,911 +8,435 @@ follow_viewport_enabled = true script = ExtResource("1") [node name="Background" type="ColorRect" parent="."] -offset_left = 5.0 -offset_top = 181.0 -offset_right = 395.0 -offset_bottom = 331.0 -color = Color(0.12549, 0.12549, 0.12549, 0.752941) - -[node name="Standard" type="Control" parent="Background"] -layout_mode = 1 -anchors_preset = 0 -offset_top = -1.0 -offset_right = 390.0 -offset_bottom = 149.0 - -[node name="ToggleShift" type="Button" parent="Background/Standard"] -visible = false -layout_mode = 0 -offset_top = 90.0 -offset_right = 50.0 -offset_bottom = 115.0 -focus_mode = 0 -toggle_mode = true -text = "SHIFT" - -[node name="ToggleCaps" type="Button" parent="Background/Standard"] -visible = false -layout_mode = 0 -offset_top = 120.0 -offset_right = 45.0 -offset_bottom = 145.0 -focus_mode = 0 -toggle_mode = true -text = "CAPS" - -[node name="ToggleAlt" type="Button" parent="Background/Standard"] -visible = false -layout_mode = 0 -offset_left = 55.0 -offset_top = 120.0 -offset_right = 90.0 -offset_bottom = 145.0 -focus_mode = 0 -toggle_mode = true -text = "ALT" - -[node name="VirtualKeyBackspace" parent="Background/Standard" instance=ExtResource("2")] -layout_mode = 0 -offset_left = 340.0 -offset_top = 90.0 -offset_right = 390.0 -offset_bottom = 115.0 -text = "BKSP" -scan_code_text = "BackSpace" - -[node name="VirtualKeySpace" parent="Background/Standard" instance=ExtResource("2")] -visible = false -layout_mode = 0 -offset_left = 100.0 -offset_top = 120.0 -offset_right = 290.0 -offset_bottom = 145.0 -text = "Space" -scan_code_text = "Space" -unicode = 32 - -[node name="VirtualKeyPeriod" parent="Background/Standard" instance=ExtResource("2")] -visible = false -layout_mode = 0 -offset_left = 300.0 -offset_top = 120.0 -offset_right = 330.0 -offset_bottom = 145.0 -text = "." -scan_code_text = "Period" -unicode = 46 - -[node name="VirtualKeyEnter" parent="Background/Standard" instance=ExtResource("2")] -visible = false -layout_mode = 0 -offset_left = 340.0 -offset_top = 120.0 -offset_right = 390.0 -offset_bottom = 145.0 -text = "Enter" -scan_code_text = "Enter" - -[node name="negation" parent="Background/Standard" instance=ExtResource("2")] -layout_mode = 0 -offset_left = 10.0 -offset_right = 76.0 -text = "¬" -scan_code_text = "¬" -unicode = 172 - -[node name="and" parent="Background/Standard" instance=ExtResource("2")] -layout_mode = 0 -offset_left = 86.0 -offset_right = 152.0 -text = "∧" -scan_code_text = "∧" -unicode = 8743 - -[node name="or" parent="Background/Standard" instance=ExtResource("2")] -layout_mode = 0 -offset_left = 162.0 -offset_right = 228.0 -text = "∨" -scan_code_text = "∨" -unicode = 8744 - -[node name="if" parent="Background/Standard" instance=ExtResource("2")] -layout_mode = 0 -offset_left = 238.0 -offset_right = 304.0 -text = "→" -scan_code_text = "→" -unicode = 8594 - -[node name="iff" parent="Background/Standard" instance=ExtResource("2")] -layout_mode = 0 -offset_left = 314.0 -offset_right = 380.0 -offset_bottom = 31.0 -text = "↔" -scan_code_text = "↔" -unicode = 8596 - -[node name="Confirm" type="Button" parent="Background/Standard"] -layout_mode = 0 -offset_left = 143.0 -offset_top = 119.0 -offset_right = 256.0 -offset_bottom = 150.0 -text = " Confirm " - -[node name="VBoxContainer" type="VBoxContainer" parent="Background/Standard"] -layout_mode = 0 -offset_left = 404.0 -offset_top = -173.0 -offset_right = 615.0 -offset_bottom = 348.0 -scale = Vector2(0.75, 0.75) - -[node name="Assumption" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Assumption" - -[node name="Negation Introduction" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Negation Introduction" - -[node name="Negation Elimination" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Negation Elimination" - -[node name="Conjunction Introduction" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Conjunction Introduction" - -[node name="Conjunction Elimination" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Conjunction Elimination" - -[node name="Disjunction Introduction" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Disjunction Introduction -" - -[node name="Disjunction Elimination" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Disjunction Elimination" - -[node name="Conditional Introduction" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Conditional Introduction" - -[node name="Conditional Elimination" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Conditional Elimination" - -[node name="Biconditional Introduction" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Biconditional Introduction -" - -[node name="Biconditional Elimination" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Biconditional Elimination" - -[node name="Universal Introduction" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Universal Introduction" - -[node name="Universal Elimination" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Universal Elimination" - -[node name="Existential Introduction" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Existential Introduction" - -[node name="Existential Elimination" type="Button" parent="Background/Standard/VBoxContainer"] -layout_mode = 2 -text = "Existential Elimination -" - -[node name="Clear" type="Button" parent="Background/Standard"] -visible = false -layout_mode = 0 offset_left = 3.0 -offset_top = 118.0 -offset_right = 52.0 -offset_bottom = 149.0 -text = "Clear" +offset_top = 178.0 +offset_right = 399.0 +offset_bottom = 357.0 +color = Color(0.27451, 0.27451, 0.27451, 1) [node name="LowerCase" type="Node2D" parent="Background"] position = Vector2(0, 30) [node name="VirtualKeyLowerQ" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 3.0 +offset_top = 5.0 +offset_right = 33.0 +offset_bottom = 36.0 text = "q" scan_code_text = "Q" unicode = 113 [node name="VirtualKeyLowerW" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 40.0 +offset_top = 5.0 offset_right = 70.0 +offset_bottom = 36.0 text = "w" scan_code_text = "W" unicode = 119 [node name="VirtualKeyLowerE" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 80.0 +offset_top = 5.0 offset_right = 110.0 +offset_bottom = 36.0 text = "e" scan_code_text = "E" unicode = 101 [node name="VirtualKeyLowerR" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 120.0 +offset_top = 5.0 offset_right = 150.0 +offset_bottom = 36.0 text = "r" scan_code_text = "R" unicode = 114 [node name="VirtualKeyLowerT" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 160.0 +offset_top = 5.0 offset_right = 190.0 +offset_bottom = 36.0 text = "t" scan_code_text = "T" unicode = 116 [node name="VirtualKeyLowerY" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 200.0 +offset_top = 5.0 offset_right = 230.0 +offset_bottom = 36.0 text = "y" scan_code_text = "Y" unicode = 121 [node name="VirtualKeyLowerU" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 240.0 +offset_top = 5.0 offset_right = 270.0 +offset_bottom = 36.0 text = "u" scan_code_text = "U" unicode = 117 [node name="VirtualKeyLowerI" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 280.0 +offset_top = 5.0 offset_right = 310.0 +offset_bottom = 36.0 text = "i" scan_code_text = "I" unicode = 105 [node name="VirtualKeyLowerO" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 320.0 +offset_top = 5.0 offset_right = 350.0 +offset_bottom = 36.0 text = "o" scan_code_text = "O" unicode = 111 [node name="VirtualKeyLowerP" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 360.0 +offset_top = 5.0 offset_right = 390.0 +offset_bottom = 36.0 text = "p" scan_code_text = "P" unicode = 112 [node name="VirtualKeyLowerA" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 20.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 50.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "a" scan_code_text = "A" unicode = 97 [node name="VirtualKeyLowerS" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 60.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 90.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "s" scan_code_text = "S" unicode = 115 [node name="VirtualKeyLowerD" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 100.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 130.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "d" scan_code_text = "D" unicode = 100 [node name="VirtualKeyLowerF" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 140.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 170.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "f" scan_code_text = "F" unicode = 102 [node name="VirtualKeyLowerG" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 180.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 210.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "g" scan_code_text = "G" unicode = 103 [node name="VirtualKeyLowerH" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 220.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 250.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "h" scan_code_text = "H" unicode = 104 [node name="VirtualKeyLowerJ" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 260.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 290.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "j" scan_code_text = "J" unicode = 106 [node name="VirtualKeyLowerK" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 300.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 330.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "k" scan_code_text = "K" unicode = 107 [node name="VirtualKeyLowerL" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 340.0 -offset_top = 30.0 +offset_top = 40.0 offset_right = 370.0 -offset_bottom = 55.0 +offset_bottom = 71.0 text = "l" scan_code_text = "L" unicode = 108 [node name="VirtualKeyLowerZ" parent="Background/LowerCase" instance=ExtResource("2")] -offset_left = 60.0 -offset_top = 60.0 -offset_right = 90.0 -offset_bottom = 85.0 +offset_left = 63.0 +offset_top = 76.0 +offset_right = 93.0 +offset_bottom = 107.0 text = "z" scan_code_text = "Z" unicode = 122 [node name="VirtualKeyLowerX" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 100.0 -offset_top = 60.0 +offset_top = 76.0 offset_right = 130.0 -offset_bottom = 85.0 +offset_bottom = 107.0 text = "x" scan_code_text = "X" unicode = 120 [node name="VirtualKeyLowerC" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 140.0 -offset_top = 60.0 +offset_top = 76.0 offset_right = 170.0 -offset_bottom = 85.0 +offset_bottom = 107.0 text = "c" scan_code_text = "C" unicode = 99 [node name="VirtualKeyLowerV" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 180.0 -offset_top = 60.0 +offset_top = 76.0 offset_right = 210.0 -offset_bottom = 85.0 +offset_bottom = 107.0 text = "v" scan_code_text = "V" unicode = 118 [node name="VirtualKeyLowerB" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 220.0 -offset_top = 60.0 +offset_top = 76.0 offset_right = 250.0 -offset_bottom = 85.0 +offset_bottom = 107.0 text = "b" scan_code_text = "B" unicode = 98 [node name="VirtualKeyLowerN" parent="Background/LowerCase" instance=ExtResource("2")] offset_left = 260.0 -offset_top = 60.0 +offset_top = 76.0 offset_right = 290.0 -offset_bottom = 85.0 +offset_bottom = 107.0 text = "n" scan_code_text = "N" unicode = 110 [node name="VirtualKeyLowerM" parent="Background/LowerCase" instance=ExtResource("2")] -offset_left = 300.0 -offset_top = 60.0 -offset_right = 330.0 -offset_bottom = 85.0 +offset_left = 301.0 +offset_top = 76.0 +offset_right = 331.0 +offset_bottom = 107.0 text = "m" scan_code_text = "M" unicode = 109 -[node name="UpperCase" type="Node2D" parent="Background"] -visible = false -position = Vector2(0, 30) - -[node name="VirtualKeyUpperQ" parent="Background/UpperCase" instance=ExtResource("2")] -text = "Q" -scan_code_text = "Q" -unicode = 81 -shift_modifier = true - -[node name="VirtualKeyUpperW" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 40.0 -offset_right = 70.0 -text = "W" -scan_code_text = "W" -unicode = 87 -shift_modifier = true - -[node name="VirtualKeyUpperE" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 80.0 -offset_right = 110.0 -text = "E" -scan_code_text = "E" -unicode = 69 -shift_modifier = true - -[node name="VirtualKeyUpperR" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 120.0 -offset_right = 150.0 -text = "R" -scan_code_text = "R" -unicode = 82 -shift_modifier = true - -[node name="VirtualKeyUpperT" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 160.0 -offset_right = 190.0 -text = "T" -scan_code_text = "T" -unicode = 84 -shift_modifier = true - -[node name="VirtualKeyUpperY" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 200.0 -offset_right = 230.0 -text = "Y" -scan_code_text = "Y" -unicode = 89 -shift_modifier = true - -[node name="VirtualKeyUpperU" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 240.0 -offset_right = 270.0 -text = "U" -scan_code_text = "U" -unicode = 85 -shift_modifier = true - -[node name="VirtualKeyUpperI" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 280.0 -offset_right = 310.0 -text = "I" -scan_code_text = "I" -unicode = 73 -shift_modifier = true - -[node name="VirtualKeyUpperO" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 320.0 -offset_right = 350.0 -text = "O" -scan_code_text = "O" -unicode = 79 -shift_modifier = true - -[node name="VirtualKeyUpperP" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 360.0 -offset_right = 390.0 -text = "P" -scan_code_text = "P" -unicode = 80 -shift_modifier = true - -[node name="VirtualKeyUpperA" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 20.0 -offset_top = 30.0 -offset_right = 50.0 -offset_bottom = 55.0 -text = "A" -scan_code_text = "A" -unicode = 65 -shift_modifier = true - -[node name="VirtualKeyUpperS" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 60.0 -offset_top = 30.0 -offset_right = 90.0 -offset_bottom = 55.0 -text = "S" -scan_code_text = "S" -unicode = 83 -shift_modifier = true - -[node name="VirtualKeyUpperD" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 100.0 -offset_top = 30.0 -offset_right = 130.0 -offset_bottom = 55.0 -text = "D" -scan_code_text = "D" -unicode = 68 -shift_modifier = true - -[node name="VirtualKeyUpperF" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 140.0 -offset_top = 30.0 -offset_right = 170.0 -offset_bottom = 55.0 -text = "F" -scan_code_text = "F" -unicode = 70 -shift_modifier = true - -[node name="VirtualKeyUpperG" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 180.0 -offset_top = 30.0 -offset_right = 210.0 -offset_bottom = 55.0 -text = "G" -scan_code_text = "G" -unicode = 71 -shift_modifier = true - -[node name="VirtualKeyUpperH" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 220.0 -offset_top = 30.0 -offset_right = 250.0 -offset_bottom = 55.0 -text = "H" -scan_code_text = "H" -unicode = 72 -shift_modifier = true - -[node name="VirtualKeyUpperJ" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 260.0 -offset_top = 30.0 -offset_right = 290.0 -offset_bottom = 55.0 -text = "J" -scan_code_text = "J" -unicode = 74 -shift_modifier = true - -[node name="VirtualKeyUpperK" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 300.0 -offset_top = 30.0 -offset_right = 330.0 -offset_bottom = 55.0 -text = "K" -scan_code_text = "K" -unicode = 75 -shift_modifier = true - -[node name="VirtualKeyUpperL" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 340.0 -offset_top = 30.0 -offset_right = 370.0 -offset_bottom = 55.0 -text = "L" -scan_code_text = "L" -unicode = 76 -shift_modifier = true - -[node name="VirtualKeyUpperZ" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 60.0 -offset_top = 60.0 -offset_right = 90.0 -offset_bottom = 85.0 -text = "Z" -scan_code_text = "Z" -unicode = 90 -shift_modifier = true +[node name="VirtualKeyBackspace" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 341.0 +offset_top = 76.0 +offset_right = 391.0 +offset_bottom = 107.0 +text = "BKSP" +scan_code_text = "BackSpace" -[node name="VirtualKeyUpperX" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 100.0 -offset_top = 60.0 -offset_right = 130.0 -offset_bottom = 85.0 -text = "X" -scan_code_text = "X" -unicode = 88 -shift_modifier = true +[node name="negation" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 10.0 +offset_top = -29.0 +offset_right = 76.0 +offset_bottom = 2.0 +text = "¬" +scan_code_text = "¬" +unicode = 172 -[node name="VirtualKeyUpperC" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 140.0 -offset_top = 60.0 -offset_right = 170.0 -offset_bottom = 85.0 -text = "C" -scan_code_text = "C" -unicode = 67 -shift_modifier = true +[node name="and" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 86.0 +offset_top = -29.0 +offset_right = 152.0 +offset_bottom = 2.0 +text = "∧" +scan_code_text = "∧" +unicode = 8743 -[node name="VirtualKeyUpperV" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 180.0 -offset_top = 60.0 -offset_right = 210.0 -offset_bottom = 85.0 -text = "V" -scan_code_text = "V" -unicode = 86 -shift_modifier = true +[node name="or" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 162.0 +offset_top = -29.0 +offset_right = 228.0 +offset_bottom = 2.0 +text = "∨" +scan_code_text = "∨" +unicode = 8744 -[node name="VirtualKeyUpperB" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 220.0 -offset_top = 60.0 -offset_right = 250.0 -offset_bottom = 85.0 -text = "B" -scan_code_text = "B" -unicode = 66 -shift_modifier = true +[node name="if" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 238.0 +offset_top = -29.0 +offset_right = 304.0 +offset_bottom = 2.0 +text = "→" +scan_code_text = "→" +unicode = 8594 -[node name="VirtualKeyUpperN" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 260.0 -offset_top = 60.0 -offset_right = 290.0 -offset_bottom = 85.0 -text = "N" -scan_code_text = "N" -unicode = 78 -shift_modifier = true +[node name="iff" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 313.0 +offset_top = -29.0 +offset_right = 379.0 +offset_bottom = 2.0 +text = "↔" +scan_code_text = "↔" +unicode = 8596 -[node name="VirtualKeyUpperM" parent="Background/UpperCase" instance=ExtResource("2")] -offset_left = 300.0 -offset_top = 60.0 -offset_right = 330.0 -offset_bottom = 85.0 -text = "M" -scan_code_text = "M" -unicode = 77 -shift_modifier = true +[node name="Confirm" type="Button" parent="Background/LowerCase"] +offset_left = 144.0 +offset_top = 112.0 +offset_right = 257.0 +offset_bottom = 143.0 +text = " Confirm " -[node name="Alternate" type="Node2D" parent="Background"] +[node name="Clear" type="Button" parent="Background/LowerCase"] visible = false -position = Vector2(0, 30) - -[node name="VirtualKeyPlus" parent="Background/Alternate" instance=ExtResource("2")] -text = "+" -scan_code_text = "Plus" -unicode = 43 - -[node name="VirtualKeyAsterisk" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 40.0 -offset_right = 70.0 -text = "*" -scan_code_text = "Asterisk" -unicode = 42 - -[node name="VirtualKeyDivision" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 80.0 -offset_right = 110.0 -text = "÷" -scan_code_text = "Division" -unicode = 247 - -[node name="VirtualKeyEqual" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 120.0 -offset_right = 150.0 -text = "=" -scan_code_text = "Equal" -unicode = 61 - -[node name="VirtualKeySlash" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 160.0 -offset_right = 190.0 -text = "/" -scan_code_text = "Slash" -unicode = 47 - -[node name="VirtualKeyUnderScore" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 200.0 -offset_right = 230.0 -text = "_" -scan_code_text = "UnderScore" -unicode = 95 +offset_left = 3.0 +offset_top = 87.0 +offset_right = 52.0 +offset_bottom = 118.0 +text = "Clear" -[node name="VirtualKeyLess" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 240.0 -offset_right = 270.0 -text = "<" -scan_code_text = "Less" -unicode = 60 -shift_modifier = true +[node name="VirtualKeyParenLeft" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 274.0 +offset_top = 112.0 +offset_right = 332.0 +offset_bottom = 143.0 +text = "(" +scan_code_text = "ParenLeft" +unicode = 40 -[node name="VirtualKeyGreater" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 280.0 -offset_right = 310.0 -text = ">" -scan_code_text = "Greater" -unicode = 62 +[node name="VirtualKeyParenRight" parent="Background/LowerCase" instance=ExtResource("2")] +offset_left = 334.0 +offset_top = 112.0 +offset_right = 393.0 +offset_bottom = 143.0 +text = ")" +scan_code_text = "ParenRight" +unicode = 41 -[node name="VirtualKeyBracketLeft" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 320.0 -offset_right = 350.0 -text = "[" -scan_code_text = "BracketLeft" -unicode = 91 -shift_modifier = true +[node name="ColorRect" type="ColorRect" parent="Background"] +layout_mode = 0 +offset_left = 399.0 +offset_top = -179.0 +offset_right = 567.0 +offset_bottom = 221.0 +color = Color(0.27451, 0.27451, 0.27451, 1) -[node name="VirtualKeyBracketRight" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 360.0 -offset_right = 390.0 -text = "]" -scan_code_text = "BracketRight" -unicode = 93 +[node name="VBoxContainer" type="VBoxContainer" parent="Background/ColorRect"] +layout_mode = 0 +offset_left = 5.0 +offset_top = 5.0 +offset_right = 216.0 +offset_bottom = 526.0 +scale = Vector2(0.75, 0.75) -[node name="VirtualKeyExclam" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 20.0 -offset_top = 30.0 -offset_right = 50.0 -offset_bottom = 55.0 -text = "!" -scan_code_text = "Exclam" -unicode = 33 +[node name="Assumption" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Assumption" -[node name="VirtualKeyAt" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 60.0 -offset_top = 30.0 -offset_right = 90.0 -offset_bottom = 55.0 -text = "@" -scan_code_text = "At" -unicode = 64 +[node name="Negation Introduction" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Negation Introduction" -[node name="VirtualKeyNumberSign" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 100.0 -offset_top = 30.0 -offset_right = 130.0 -offset_bottom = 55.0 -text = "#" -scan_code_text = "NumberSign" -unicode = 35 +[node name="Negation Elimination" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Negation Elimination" -[node name="VirtualKeyDollar" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 140.0 -offset_top = 30.0 -offset_right = 170.0 -offset_bottom = 55.0 -text = "$" -scan_code_text = "Dollar" -unicode = 36 +[node name="Conjunction Introduction" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Conjunction Introduction" -[node name="VirtualKeyPercent" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 180.0 -offset_top = 30.0 -offset_right = 210.0 -offset_bottom = 55.0 -text = "%" -scan_code_text = "Percent" -unicode = 37 +[node name="Conjunction Elimination" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Conjunction Elimination" -[node name="VirtualKeyCircumflex" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 220.0 -offset_top = 30.0 -offset_right = 250.0 -offset_bottom = 55.0 -text = "^" -scan_code_text = "AsciiCircum" -unicode = 94 +[node name="Disjunction Introduction" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Disjunction Introduction +" -[node name="VirtualKeyAmpersand" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 260.0 -offset_top = 30.0 -offset_right = 290.0 -offset_bottom = 55.0 -text = "&" -scan_code_text = "Ampersand" -unicode = 38 +[node name="Disjunction Elimination" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Disjunction Elimination" -[node name="VirtualKeyParenLeft" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 300.0 -offset_top = 30.0 -offset_right = 330.0 -offset_bottom = 55.0 -text = "(" -scan_code_text = "ParenLeft" -unicode = 40 +[node name="Conditional Introduction" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Conditional Introduction" -[node name="VirtualKeyParenRight" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 340.0 -offset_top = 30.0 -offset_right = 370.0 -offset_bottom = 55.0 -text = ")" -scan_code_text = "ParenRight" -unicode = 41 +[node name="Conditional Elimination" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Conditional Elimination" -[node name="VirtualKeyMinus" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 60.0 -offset_top = 60.0 -offset_right = 90.0 -offset_bottom = 85.0 -text = "-" -scan_code_text = "Minus" -unicode = 45 +[node name="Biconditional Introduction" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Biconditional Introduction +" -[node name="VirtualKeyApostrophe" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 100.0 -offset_top = 60.0 -offset_right = 130.0 -offset_bottom = 85.0 -text = "'" -scan_code_text = "Apostrophe" -unicode = 39 +[node name="Biconditional Elimination" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Biconditional Elimination" -[node name="VirtualKeyQuoteDbl" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 140.0 -offset_top = 60.0 -offset_right = 170.0 -offset_bottom = 85.0 -text = "\"" -scan_code_text = "QuoteDbl" -unicode = 34 +[node name="Universal Introduction" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Universal Introduction" -[node name="VirtualKeyColon" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 180.0 -offset_top = 60.0 -offset_right = 210.0 -offset_bottom = 85.0 -text = ":" -scan_code_text = "Colon" -unicode = 58 +[node name="Universal Elimination" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Universal Elimination" -[node name="VirtualKeySemicolon" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 220.0 -offset_top = 60.0 -offset_right = 250.0 -offset_bottom = 85.0 -text = ";" -scan_code_text = "Semicolon" -unicode = 59 +[node name="Existential Introduction" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Existential Introduction" -[node name="VirtualKeyComma" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 260.0 -offset_top = 60.0 -offset_right = 290.0 -offset_bottom = 85.0 -text = "," -scan_code_text = "Comma" -unicode = 44 +[node name="Existential Elimination" type="Button" parent="Background/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Existential Elimination +" -[node name="VirtualKeyQuestion" parent="Background/Alternate" instance=ExtResource("2")] -offset_left = 300.0 -offset_top = 60.0 -offset_right = 330.0 -offset_bottom = 85.0 -text = "?" -scan_code_text = "Question" -unicode = 63 - -[connection signal="toggled" from="Background/Standard/ToggleShift" to="." method="on_shift_toggle"] -[connection signal="toggled" from="Background/Standard/ToggleCaps" to="." method="on_caps_toggle"] -[connection signal="toggled" from="Background/Standard/ToggleAlt" to="." method="on_alt_toggle"] -[connection signal="pressed" from="Background/Standard/Confirm" to="." method="_on_confirm_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Assumption" to="." method="_on_assumption_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Negation Introduction" to="." method="_on_negation_introduction_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Negation Elimination" to="." method="_on_negation_elimination_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Conjunction Introduction" to="." method="_on_conjunction_introduction_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Conjunction Elimination" to="." method="_on_conjunction_elimination_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Disjunction Introduction" to="." method="_on_disjunction_introduction_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Disjunction Elimination" to="." method="_on_disjunction_elimination_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Conditional Introduction" to="." method="_on_conditional_introduction_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Conditional Elimination" to="." method="_on_conditional_elimination_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Biconditional Introduction" to="." method="_on_biconditional_introduction_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Biconditional Elimination" to="." method="_on_biconditional_elimination_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Universal Introduction" to="." method="_on_universal_introduction_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Universal Elimination" to="." method="_on_universal_elimination_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Existential Introduction" to="." method="_on_existential_introduction_pressed"] -[connection signal="pressed" from="Background/Standard/VBoxContainer/Existential Elimination" to="." method="_on_existential_elimination_pressed"] +[node name="ColorRect2" type="ColorRect" parent="Background"] +layout_mode = 0 +offset_left = 1.0 +offset_top = -71.0 +offset_right = 396.0 +offset_bottom = -7.0 +color = Color(0.27451, 0.27451, 0.27451, 1) + +[connection signal="pressed" from="Background/LowerCase/Confirm" to="." method="_on_confirm_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Assumption" to="." method="_on_assumption_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Negation Introduction" to="." method="_on_negation_introduction_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Negation Elimination" to="." method="_on_negation_elimination_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Conjunction Introduction" to="." method="_on_conjunction_introduction_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Conjunction Elimination" to="." method="_on_conjunction_elimination_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Disjunction Introduction" to="." method="_on_disjunction_introduction_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Disjunction Elimination" to="." method="_on_disjunction_elimination_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Conditional Introduction" to="." method="_on_conditional_introduction_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Conditional Elimination" to="." method="_on_conditional_elimination_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Biconditional Introduction" to="." method="_on_biconditional_introduction_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Biconditional Elimination" to="." method="_on_biconditional_elimination_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Universal Introduction" to="." method="_on_universal_introduction_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Universal Elimination" to="." method="_on_universal_elimination_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Existential Introduction" to="." method="_on_existential_introduction_pressed"] +[connection signal="pressed" from="Background/ColorRect/VBoxContainer/Existential Elimination" to="." method="_on_existential_elimination_pressed"] From a24e20b0a49c8e9e4f6d197041045acbfb9c5971 Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Mon, 13 Nov 2023 15:53:54 -0500 Subject: [PATCH 06/14] rotation --- project/Scenes/vr_player.tscn | 11 +++++++---- project/Scripts/Player.gd | 2 +- project/Scripts/vr_player.gd | 10 +++++++++- project/Scripts/vrmovement.gd | 13 ++++++++++++- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index 24ffc97..a1276b2 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -18,12 +18,14 @@ bottom_radius = 0.01 [sub_resource type="NoiseTexture2D" id="NoiseTexture2D_1wq6r"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_h2bms"] -albedo_color = Color(0.0352941, 0.54902, 0.698039, 1) +transparency = 1 +albedo_color = Color(0.0352941, 0.54902, 0.698039, 0.592157) albedo_texture = SubResource("NoiseTexture2D_1wq6r") emission_enabled = true emission = Color(0, 0.901961, 0.952941, 1) -emission_energy_multiplier = 2.0 -emission_operator = 1 +emission_energy_multiplier = 3.0 +emission_on_uv2 = true +backlight = Color(1, 1, 1, 1) [sub_resource type="SphereMesh" id="SphereMesh_pe45r"] @@ -69,7 +71,7 @@ transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0) mesh = SubResource("SphereMesh_xc2q5") [node name="RayCast3D" type="RayCast3D" parent="CharacterBody3D/XROrigin3D/Right/rHand"] -transform = Transform3D(10, 0, 0, 0, -3.27835e-05, -10, 0, 750, -4.37114e-07, 0, 0, -0.262443) +transform = Transform3D(1, 0, 0, 0, -3.27835e-05, -1, 0, 750, -4.37114e-08, 0, 0, -0.262443) [node name="MeshInstance3D" type="MeshInstance3D" parent="CharacterBody3D/XROrigin3D/Right/rHand/RayCast3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 1.54099e-13) @@ -125,6 +127,7 @@ shape = SubResource("BoxShape3D_ucoqh") [connection signal="button_pressed" from="CharacterBody3D/XROrigin3D/Right" to="." method="_on_right_button_pressed"] [connection signal="input_vector2_changed" from="CharacterBody3D/XROrigin3D/Right" to="." method="_on_right_input_vector_2_changed"] +[connection signal="input_vector2_changed" from="CharacterBody3D/XROrigin3D/Right" to="CharacterBody3D" method="_on_right_input_vector_2_changed"] [connection signal="button_pressed" from="CharacterBody3D/XROrigin3D/Left" to="." method="_on_left_button_pressed"] [connection signal="button_pressed" from="CharacterBody3D/XROrigin3D/Left" to="CharacterBody3D" method="_on_left_button_pressed"] [connection signal="button_released" from="CharacterBody3D/XROrigin3D/Left" to="CharacterBody3D" method="_on_left_button_released"] diff --git a/project/Scripts/Player.gd b/project/Scripts/Player.gd index 4ed0a48..0fc3cb2 100644 --- a/project/Scripts/Player.gd +++ b/project/Scripts/Player.gd @@ -11,7 +11,6 @@ var SPEED = 15.0 var JUMP_VELOCITY = 15.0 const TURN_SPEED = 0.03 - #Selection variables @export var selectionCount = 0 @export var selectArray: Array[LogNode] @@ -36,6 +35,7 @@ const offsetMin = 10 #Move node vars var distanceToNode +var moveFlag = false #Input variables var inputFlag = false diff --git a/project/Scripts/vr_player.gd b/project/Scripts/vr_player.gd index 9d6538c..f42ecd4 100644 --- a/project/Scripts/vr_player.gd +++ b/project/Scripts/vr_player.gd @@ -43,9 +43,11 @@ var distanceToNode var blockPOS var offsetPosition var changeDistance = 0 +@export var moveFlag = false +var rotdir = 0 #Input variables -var inputFlag = false +@export var inputFlag = false func rayTraceSelect(): if selectionCount >= selectGate: @@ -123,6 +125,7 @@ func _physics_process(_delta): offsetPosition = rightHand.global_position - (distanceToNode)*lookDirection selectArray[0].global_position = offsetPosition pointerPG.updateEdges(selectArray[0]) + selectArray[0].rotate_y(rotdir*TURN_SPEED) modeTypes.INPUT_DATA: if inputFlag == true: keyboard.show() @@ -152,6 +155,9 @@ func _on_right_button_pressed(rname): if selectionCount == 1: blockPOS = selectArray[0].global_position distanceToNode = (blockPOS - rightHand.global_position).length() + moveFlag = true + else: + moveFlag = false modeTypes.INPUT_DATA: if selectionCount == 1: inputFlag = true @@ -192,6 +198,7 @@ func _on_right_button_pressed(rname): func _on_left_button_pressed(lname): if lname == "trigger_click" and inputFlag == false: inputFlag = false + moveFlag = false if playerMode < 5: playerMode = playerMode+1 else: @@ -226,6 +233,7 @@ func _on_right_input_vector_2_changed(rjname, value): modeTypes.MOVE_NODE: if selectionCount == 1: changeDistance = value[1] + rotdir = -value[0] modeTypes.INPUT_DATA: pass diff --git a/project/Scripts/vrmovement.gd b/project/Scripts/vrmovement.gd index 6bb50d6..50098ef 100644 --- a/project/Scripts/vrmovement.gd +++ b/project/Scripts/vrmovement.gd @@ -1,14 +1,17 @@ extends CharacterBody3D @onready var cam = $"XROrigin3D/XRCamera3D" +@onready var main = $"../" var SPEED = 2 var JUMP = 0 var xdir = 0 var ydir = 0 +var rotdir = 0 +var ROTATE = 0.025 func _physics_process(_delta): - var direction = (cam.transform.basis * Vector3(xdir, 0, ydir)).normalized() + var direction = (transform.basis * Vector3(xdir, 0, ydir)).normalized() if direction: velocity.x = direction.x * SPEED velocity.z = direction.z * SPEED @@ -18,6 +21,10 @@ func _physics_process(_delta): velocity.y = JUMP + if main.moveFlag == false: + rotate_y(ROTATE*rotdir) + cam.rotate_y(ROTATE*rotdir) + move_and_slide() @@ -39,3 +46,7 @@ func _on_left_button_released(lname): JUMP = 0 if lname == "ax_button": JUMP = 0 + +func _on_right_input_vector_2_changed(rname, value): + if rname == "primary": + rotdir = -value[0] From 37ea476a5d5fee269fea138ed0167f9d9032f9fd Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Mon, 20 Nov 2023 22:14:19 -0500 Subject: [PATCH 07/14] acyclic draft --- extension/proofgraph.cpp | 32 ++++++++++++++++++++++++++++++++ extension/proofgraph.h | 2 ++ project/Scenes/vr_player.tscn | 8 ++++---- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/extension/proofgraph.cpp b/extension/proofgraph.cpp index 9fc89e4..1d3d23c 100644 --- a/extension/proofgraph.cpp +++ b/extension/proofgraph.cpp @@ -130,6 +130,38 @@ void LogNode::setJustification(String code, String symbol){ oldBox->set_scale(Vector3((symbol.length()*.115)+.1,.225,.2)); } +bool LogNode::findParentless(LogNode* targetNode){ + if(targetNode->logParents.is_empty()){ + HashSet found; + bool cycleFlag = dfsCheck(targetNode, &found); + return cycleFlag; + } + bool cycleFlag = 0; + for(LogNode* parent : targetNode->logParents){ + cycleFlag = findParentless(parent); + if (cycleFlag == 1){ + return cycleFlag; + } + } + return cycleFlag; +} +bool LogNode::dfsCheck(LogNode* targetNode, HashSet* found){ + if(found->find(targetNode->getID())){ + return 1; + } + if (targetNode->logChildren.is_empty()){ + return 0; + } + found->insert(targetNode->getID()); + bool cycleFlag = 0; + for(LogNode* child : targetNode->logChildren){ + cycleFlag = dfsCheck(child, found); + if (cycleFlag == 1){ + return cycleFlag; + } + } + return cycleFlag; +} void LogNode::_bind_methods(){ ClassDB::bind_method(D_METHOD("setID", "ID"), &LogNode::setID); diff --git a/extension/proofgraph.h b/extension/proofgraph.h index 4979d70..bba95e2 100644 --- a/extension/proofgraph.h +++ b/extension/proofgraph.h @@ -36,6 +36,8 @@ class LogNode : public Node3D{ String getParentRep(); void setParentRep(); void setJustification(String code, String symbol); + bool findParentless(LogNode* targetNode); + bool dfsCheck(LogNode* targetNode, HashSet* found); protected: diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index a1276b2..d89e696 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -36,14 +36,14 @@ text = "Test" resource_local_to_scene = true size = Vector2(0.5, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_kafv6"] +[sub_resource type="ViewportTexture" id="ViewportTexture_7eeie"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1fvug"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mm6wq"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_kafv6") +albedo_texture = SubResource("ViewportTexture_7eeie") texture_filter = 1 [sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] @@ -113,7 +113,7 @@ size = Vector2i(500, 125) [node name="Screen" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="1"] mesh = SubResource("QuadMesh_4qjll") -surface_material_override/0 = SubResource("StandardMaterial3D_1fvug") +surface_material_override/0 = SubResource("StandardMaterial3D_mm6wq") [node name="StaticBody3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="2"] collision_layer = 2097154 From 64d2cc5e8123a9fe11f1f8a39a8ba54c8274de87 Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Mon, 20 Nov 2023 22:55:40 -0500 Subject: [PATCH 08/14] acyclic check functional --- extension/proofgraph.cpp | 61 +++++++++++++++++------------------ extension/proofgraph.h | 4 +-- project/Scenes/vr_player.tscn | 8 ++--- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/extension/proofgraph.cpp b/extension/proofgraph.cpp index 1d3d23c..57fe6ba 100644 --- a/extension/proofgraph.cpp +++ b/extension/proofgraph.cpp @@ -130,38 +130,30 @@ void LogNode::setJustification(String code, String symbol){ oldBox->set_scale(Vector3((symbol.length()*.115)+.1,.225,.2)); } -bool LogNode::findParentless(LogNode* targetNode){ +bool LogNode::findParentless(LogNode* targetNode, HashSet found){ if(targetNode->logParents.is_empty()){ - HashSet found; - bool cycleFlag = dfsCheck(targetNode, &found); - return cycleFlag; - } - bool cycleFlag = 0; - for(LogNode* parent : targetNode->logParents){ - cycleFlag = findParentless(parent); - if (cycleFlag == 1){ - return cycleFlag; - } + return 0; } - return cycleFlag; -} -bool LogNode::dfsCheck(LogNode* targetNode, HashSet* found){ - if(found->find(targetNode->getID())){ + found.insert(targetNode->getID()); + if (found.find(targetNode->getID()) != found.end()){ return 1; } - if (targetNode->logChildren.is_empty()){ - return 0; - } - found->insert(targetNode->getID()); bool cycleFlag = 0; - for(LogNode* child : targetNode->logChildren){ - cycleFlag = dfsCheck(child, found); + for (LogNode* parent : targetNode->logParents){ + cycleFlag = findParentless(parent, found); if (cycleFlag == 1){ return cycleFlag; } } return cycleFlag; } +bool LogNode::dfsCheck(){ + bool cycleFlag = 0; + HashSet found; + cycleFlag = findParentless(this, found); + return cycleFlag; + } + void LogNode::_bind_methods(){ ClassDB::bind_method(D_METHOD("setID", "ID"), &LogNode::setID); @@ -276,19 +268,26 @@ void ProofGraph::addEdge(LogNode* start, LogNode* end){ } else { //Logic - nodeMap[start->getID()]->logChildren.insert(nodeMap[end->getID()]); - nodeMap[end->getID()]->logParents.insert(nodeMap[start->getID()]); + nodeMap[start->getID()]->logChildren.insert(nodeMap[end->getID()]); + nodeMap[end->getID()]->logParents.insert(nodeMap[start->getID()]); - //Meshes - MeshInstance3D* lineMesh = memnew(MeshInstance3D); - BoxMesh* shape = memnew(BoxMesh); - lineMesh->set_mesh(shape); - lineMesh->set_name(String::num_int64(start->getID())+ String::num_int64(end->getID())); + if (start->dfsCheck()){ + nodeMap[start->getID()]->logChildren.erase(nodeMap[end->getID()]); + nodeMap[end->getID()]->logParents.erase(nodeMap[start->getID()]); + } - start->add_child(lineMesh); + else{ + //Meshes + MeshInstance3D* lineMesh = memnew(MeshInstance3D); + BoxMesh* shape = memnew(BoxMesh); + lineMesh->set_mesh(shape); + lineMesh->set_name(String::num_int64(start->getID())+ String::num_int64(end->getID())); - edgeSetter(start, end, lineMesh); - end->setParentRep(); + start->add_child(lineMesh); + + edgeSetter(start, end, lineMesh); + end->setParentRep(); + } } } diff --git a/extension/proofgraph.h b/extension/proofgraph.h index bba95e2..83015a0 100644 --- a/extension/proofgraph.h +++ b/extension/proofgraph.h @@ -36,8 +36,8 @@ class LogNode : public Node3D{ String getParentRep(); void setParentRep(); void setJustification(String code, String symbol); - bool findParentless(LogNode* targetNode); - bool dfsCheck(LogNode* targetNode, HashSet* found); + bool findParentless(LogNode* targetNode, HashSet found); + bool dfsCheck(); protected: diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index d89e696..d4a8322 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -36,14 +36,14 @@ text = "Test" resource_local_to_scene = true size = Vector2(0.5, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_7eeie"] +[sub_resource type="ViewportTexture" id="ViewportTexture_vcsyu"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mm6wq"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_j1fsh"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_7eeie") +albedo_texture = SubResource("ViewportTexture_vcsyu") texture_filter = 1 [sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] @@ -113,7 +113,7 @@ size = Vector2i(500, 125) [node name="Screen" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="1"] mesh = SubResource("QuadMesh_4qjll") -surface_material_override/0 = SubResource("StandardMaterial3D_mm6wq") +surface_material_override/0 = SubResource("StandardMaterial3D_j1fsh") [node name="StaticBody3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="2"] collision_layer = 2097154 From b5081b6cf08d5d4056b89bdf76ef8096e957185a Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Tue, 21 Nov 2023 00:47:48 -0500 Subject: [PATCH 09/14] arrow hack --- extension/proofgraph.cpp | 14 +++++++++----- project/Meshes/cone.obj.import | 21 +++++++++++++++++++++ project/Scenes/main.tscn | 3 ++- project/Scenes/vr_player.tscn | 8 ++++---- project/Scripts/vr_player.gd | 30 +++++++++++++++++++++++++++++- 5 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 project/Meshes/cone.obj.import diff --git a/extension/proofgraph.cpp b/extension/proofgraph.cpp index 57fe6ba..4873dab 100644 --- a/extension/proofgraph.cpp +++ b/extension/proofgraph.cpp @@ -131,14 +131,18 @@ void LogNode::setJustification(String code, String symbol){ } bool LogNode::findParentless(LogNode* targetNode, HashSet found){ + // If a node has no parents it is not part of a cycle if(targetNode->logParents.is_empty()){ return 0; } - found.insert(targetNode->getID()); + + // If the node is revisited, we are in a cycle if (found.find(targetNode->getID()) != found.end()){ return 1; } + found.insert(targetNode->getID()); bool cycleFlag = 0; + // Recursive DFS through parents to check for cycles for (LogNode* parent : targetNode->logParents){ cycleFlag = findParentless(parent, found); if (cycleFlag == 1){ @@ -237,10 +241,10 @@ void ProofGraph::addNode(Vector3 position){ } void ProofGraph::edgeSetter(LogNode* start, LogNode* end, MeshInstance3D* workingEdge){ - Vector3 topBoxOffset = Vector3(0,.125,0); + Vector3 topBoxOffset = Vector3(0,.475,0); Vector3 bottomBoxOffset = Vector3(0,.25,0); Vector3 sPos = start->get_global_position(); - Vector3 ePos = end->get_global_position() + Vector3(0,.375,0); + Vector3 ePos = end->get_global_position(); Vector3 startOffset = Vector3(0,0,0); Vector3 endOffset = Vector3(0,0,0); if (sPos.y > ePos.y){ @@ -248,8 +252,8 @@ void ProofGraph::edgeSetter(LogNode* start, LogNode* end, MeshInstance3D* workin endOffset = ePos + topBoxOffset; } else{ - startOffset = sPos - topBoxOffset; - endOffset = ePos + bottomBoxOffset; + startOffset = sPos + topBoxOffset; + endOffset = ePos - bottomBoxOffset; } Vector3 location = (startOffset+endOffset)/2; diff --git a/project/Meshes/cone.obj.import b/project/Meshes/cone.obj.import new file mode 100644 index 0000000..10cb95e --- /dev/null +++ b/project/Meshes/cone.obj.import @@ -0,0 +1,21 @@ +[remap] + +importer="wavefront_obj" +importer_version=1 +type="Mesh" +uid="uid://dyrmb0my26kdm" +path="res://.godot/imported/cone.obj-7fe4728ba11c37dfd77f944abbb9392f.mesh" + +[deps] + +files=["res://.godot/imported/cone.obj-7fe4728ba11c37dfd77f944abbb9392f.mesh"] + +source_file="res://Meshes/cone.obj" +dest_files=["res://.godot/imported/cone.obj-7fe4728ba11c37dfd77f944abbb9392f.mesh", "res://.godot/imported/cone.obj-7fe4728ba11c37dfd77f944abbb9392f.mesh"] + +[params] + +generate_tangents=true +scale_mesh=Vector3(1, 1, 1) +offset_mesh=Vector3(0, 0, 0) +optimize_mesh=true diff --git a/project/Scenes/main.tscn b/project/Scenes/main.tscn index 81c7b40..c1767ef 100644 --- a/project/Scenes/main.tscn +++ b/project/Scenes/main.tscn @@ -16,6 +16,7 @@ sky_custom_fov = 90.0 sky_rotation = Vector3(-0.349066, 2.61799, 0) ambient_light_source = 3 ambient_light_color = Color(1, 1, 1, 1) +ambient_light_energy = 3.0 tonemap_mode = 1 ssao_enabled = true fog_sky_affect = 0.0 @@ -28,7 +29,7 @@ volumetric_fog_anisotropy = 0.9 script = ExtResource("1_8s8eo") [node name="ForwardLight" type="DirectionalLight3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 0.360501, 0.932759, 0, -0.932759, 0.360501, -262.079, 504.49, 0) +transform = Transform3D(1, 0, 0, 0, 0.360501, 0.932759, 0, -0.932759, 0.360501, -262.079, 500, 0) light_energy = 4.0 light_indirect_energy = 4.0 sky_mode = 1 diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index d4a8322..9037c73 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -36,14 +36,14 @@ text = "Test" resource_local_to_scene = true size = Vector2(0.5, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_vcsyu"] +[sub_resource type="ViewportTexture" id="ViewportTexture_47yps"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_j1fsh"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cbwax"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_vcsyu") +albedo_texture = SubResource("ViewportTexture_47yps") texture_filter = 1 [sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] @@ -113,7 +113,7 @@ size = Vector2i(500, 125) [node name="Screen" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="1"] mesh = SubResource("QuadMesh_4qjll") -surface_material_override/0 = SubResource("StandardMaterial3D_j1fsh") +surface_material_override/0 = SubResource("StandardMaterial3D_cbwax") [node name="StaticBody3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="2"] collision_layer = 2097154 diff --git a/project/Scripts/vr_player.gd b/project/Scripts/vr_player.gd index f42ecd4..6f622d7 100644 --- a/project/Scripts/vr_player.gd +++ b/project/Scripts/vr_player.gd @@ -49,6 +49,33 @@ var rotdir = 0 #Input variables @export var inputFlag = false +func arrowAddHack(): + pointerPG.addEdge(selectArray[0], selectArray[1]) + + var edgeLocation = "../ProofGraph/"+str(selectArray[0].getID())+"/"+str(selectArray[0].getID())+str(selectArray[1].getID()) + var edge = get_node_or_null(edgeLocation) + + if edge != null: + var cone = MeshInstance3D.new() + var coneMesh = load("res://Meshes/cone.obj") + var skin = StandardMaterial3D.new() + cone.mesh = coneMesh + edge.add_child(cone) + cone.set_scale(Vector3(5,5,0.05)) + + skin.emission_enabled = true + skin.emission_energy_multiplier = 2 + skin.emission = Color(1, 1, 1, 1) + skin.albedo_color = Color(.75, 1, 1, 1) + cone.set_surface_override_material(0, skin) + + if selectArray[0].global_position.y > selectArray[1].global_position.y: + cone.look_at(selectArray[1].global_position + Vector3(0,.445,0), Vector3(0,1,0)) + else : + cone.look_at(selectArray[1].global_position - Vector3(0,.025,0), Vector3(0,1,0)) + pass + + func rayTraceSelect(): if selectionCount >= selectGate: return @@ -171,7 +198,8 @@ func _on_right_button_pressed(rname): match playerMode: modeTypes.CONNECT: if selectionCount == 2: - pointerPG.addEdge(selectArray[0], selectArray[1]) + #pointerPG.addEdge(selectArray[0], selectArray[1]) + arrowAddHack() unselectAll() modeTypes.DELETE_NODE: if selectionCount == 1: From 5e0e53fa0217d53bd776906c7bca366fe9bf0df4 Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Tue, 21 Nov 2023 00:50:28 -0500 Subject: [PATCH 10/14] mesh added --- .gitignore | 1 + project/Meshes/cone.obj | 169 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 project/Meshes/cone.obj diff --git a/.gitignore b/.gitignore index 6966268..42adc67 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.os project/bin/* !project/bin/ProofGraphs.gdextension +!project/Meshes/cone.obj venv # Godot 4+ specific ignores .godot/ diff --git a/project/Meshes/cone.obj b/project/Meshes/cone.obj new file mode 100644 index 0000000..e652edd --- /dev/null +++ b/project/Meshes/cone.obj @@ -0,0 +1,169 @@ +# Blender 3.4.1 +# www.blender.org +mtllib cone.mtl +o Cone +v -1.000000 0.000000 1.000000 +v -0.980785 -0.195090 1.000000 +v -0.923879 -0.382683 1.000000 +v -0.831470 -0.555570 1.000000 +v -0.707107 -0.707107 1.000000 +v -0.555570 -0.831470 1.000000 +v -0.382683 -0.923879 1.000000 +v -0.195090 -0.980785 1.000000 +v 0.000000 -1.000000 1.000000 +v 0.195090 -0.980785 1.000000 +v 0.382683 -0.923879 1.000000 +v 0.555570 -0.831470 1.000000 +v 0.707107 -0.707107 1.000000 +v 0.831470 -0.555570 1.000000 +v 0.923880 -0.382683 1.000000 +v 0.980785 -0.195090 1.000000 +v 1.000000 0.000000 1.000000 +v 0.980785 0.195090 1.000000 +v 0.923880 0.382683 1.000000 +v 0.831470 0.555570 1.000000 +v 0.707107 0.707107 1.000000 +v 0.555570 0.831470 1.000000 +v 0.382683 0.923880 1.000000 +v 0.195090 0.980785 1.000000 +v 0.000000 1.000000 1.000000 +v -0.195090 0.980785 1.000000 +v -0.382683 0.923880 1.000000 +v -0.555570 0.831470 1.000000 +v -0.707107 0.707107 1.000000 +v -0.831470 0.555570 1.000000 +v -0.923879 0.382683 1.000000 +v -0.980785 0.195090 1.000000 +v -0.000000 -0.000000 -1.000000 +vn -0.8910 -0.0878 -0.4455 +vn -0.8567 -0.2599 -0.4455 +vn -0.7896 -0.4220 -0.4455 +vn -0.6921 -0.5680 -0.4455 +vn -0.5680 -0.6921 -0.4455 +vn -0.4220 -0.7896 -0.4455 +vn -0.2599 -0.8567 -0.4455 +vn -0.0878 -0.8910 -0.4455 +vn 0.0878 -0.8910 -0.4455 +vn 0.2599 -0.8567 -0.4455 +vn 0.4220 -0.7896 -0.4455 +vn 0.5680 -0.6921 -0.4455 +vn 0.6921 -0.5680 -0.4455 +vn 0.7896 -0.4220 -0.4455 +vn 0.8567 -0.2599 -0.4455 +vn 0.8910 -0.0878 -0.4455 +vn 0.8910 0.0878 -0.4455 +vn 0.8567 0.2599 -0.4455 +vn 0.7896 0.4220 -0.4455 +vn 0.6921 0.5680 -0.4455 +vn 0.5680 0.6921 -0.4455 +vn 0.4220 0.7896 -0.4455 +vn 0.2599 0.8567 -0.4455 +vn 0.0878 0.8910 -0.4455 +vn -0.0878 0.8910 -0.4455 +vn -0.2599 0.8567 -0.4455 +vn -0.4220 0.7896 -0.4455 +vn -0.5680 0.6921 -0.4455 +vn -0.6921 0.5680 -0.4455 +vn -0.7896 0.4220 -0.4455 +vn -0.0000 -0.0000 1.0000 +vn -0.8567 0.2599 -0.4455 +vn -0.8910 0.0878 -0.4455 +vt 0.750000 0.490000 +vt 0.250000 0.490000 +vt 0.296822 0.485388 +vt 0.796822 0.485388 +vt 0.341844 0.471731 +vt 0.841844 0.471731 +vt 0.383337 0.449553 +vt 0.883337 0.449553 +vt 0.419706 0.419706 +vt 0.919706 0.419706 +vt 0.449553 0.383337 +vt 0.949553 0.383337 +vt 0.471731 0.341844 +vt 0.971731 0.341844 +vt 0.485388 0.296822 +vt 0.985388 0.296822 +vt 0.490000 0.250000 +vt 0.990000 0.250000 +vt 0.485388 0.203178 +vt 0.985388 0.203178 +vt 0.471731 0.158156 +vt 0.971731 0.158156 +vt 0.449553 0.116663 +vt 0.949553 0.116663 +vt 0.419706 0.080294 +vt 0.919706 0.080294 +vt 0.383337 0.050447 +vt 0.883337 0.050447 +vt 0.341844 0.028269 +vt 0.841844 0.028269 +vt 0.296822 0.014612 +vt 0.796822 0.014612 +vt 0.250000 0.010000 +vt 0.750000 0.010000 +vt 0.203178 0.014612 +vt 0.703178 0.014612 +vt 0.158156 0.028269 +vt 0.658156 0.028269 +vt 0.116663 0.050447 +vt 0.616663 0.050447 +vt 0.080294 0.080294 +vt 0.580294 0.080294 +vt 0.050447 0.116663 +vt 0.550447 0.116663 +vt 0.028269 0.158156 +vt 0.528269 0.158156 +vt 0.014612 0.203178 +vt 0.514612 0.203178 +vt 0.010000 0.250000 +vt 0.510000 0.250000 +vt 0.014612 0.296822 +vt 0.514612 0.296822 +vt 0.028269 0.341844 +vt 0.528269 0.341844 +vt 0.050447 0.383337 +vt 0.550447 0.383337 +vt 0.080294 0.419706 +vt 0.580294 0.419706 +vt 0.116663 0.449553 +vt 0.616663 0.449553 +vt 0.658156 0.471731 +vt 0.158156 0.471731 +vt 0.703178 0.485388 +vt 0.203178 0.485388 +vt 0.250000 0.250000 +s 0 +f 1/2/1 33/65/1 2/3/1 +f 2/3/2 33/65/2 3/5/2 +f 3/5/3 33/65/3 4/7/3 +f 4/7/4 33/65/4 5/9/4 +f 5/9/5 33/65/5 6/11/5 +f 6/11/6 33/65/6 7/13/6 +f 7/13/7 33/65/7 8/15/7 +f 8/15/8 33/65/8 9/17/8 +f 9/17/9 33/65/9 10/19/9 +f 10/19/10 33/65/10 11/21/10 +f 11/21/11 33/65/11 12/23/11 +f 12/23/12 33/65/12 13/25/12 +f 13/25/13 33/65/13 14/27/13 +f 14/27/14 33/65/14 15/29/14 +f 15/29/15 33/65/15 16/31/15 +f 16/31/16 33/65/16 17/33/16 +f 17/33/17 33/65/17 18/35/17 +f 18/35/18 33/65/18 19/37/18 +f 19/37/19 33/65/19 20/39/19 +f 20/39/20 33/65/20 21/41/20 +f 21/41/21 33/65/21 22/43/21 +f 22/43/22 33/65/22 23/45/22 +f 23/45/23 33/65/23 24/47/23 +f 24/47/24 33/65/24 25/49/24 +f 25/49/25 33/65/25 26/51/25 +f 26/51/26 33/65/26 27/53/26 +f 27/53/27 33/65/27 28/55/27 +f 28/55/28 33/65/28 29/57/28 +f 29/57/29 33/65/29 30/59/29 +f 30/59/30 33/65/30 31/62/30 +f 1/1/31 2/4/31 3/6/31 4/8/31 5/10/31 6/12/31 7/14/31 8/16/31 9/18/31 10/20/31 11/22/31 12/24/31 13/26/31 14/28/31 15/30/31 16/32/31 17/34/31 18/36/31 19/38/31 20/40/31 21/42/31 22/44/31 23/46/31 24/48/31 25/50/31 26/52/31 27/54/31 28/56/31 29/58/31 30/60/31 31/61/31 32/63/31 +f 31/62/32 33/65/32 32/64/32 +f 32/64/33 33/65/33 1/2/33 From 1bfd9cc0ea870bd91ef970fb611077ba82e81528 Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Mon, 27 Nov 2023 12:21:18 -0500 Subject: [PATCH 11/14] changed assume rep --- extension/proofgraph.cpp | 68 ++++++++++++++++++++++++++++++++--- extension/proofgraph.h | 4 +++ project/Scenes/vr_player.tscn | 8 ++--- 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/extension/proofgraph.cpp b/extension/proofgraph.cpp index 4873dab..59a128b 100644 --- a/extension/proofgraph.cpp +++ b/extension/proofgraph.cpp @@ -108,6 +108,59 @@ void LogNode::setParentRep(){ newText->set_position(Vector3(0,-.15,0)); } +void LogNode::assumeFind(LogNode* currentNode, HashSet* tempAssume){ + for (LogNode* parent : currentNode->logParents){ + if (parent->justification == "assume"){ + tempAssume->insert(parent->getID()); + } + assumeFind(parent, tempAssume); + } +} + +String LogNode::assumeString(HashSet* assume){ + String value = "("; + for(int i : *(assume)){ + value = value + String::num_uint64(i); + value = value + ","; + } + if (value.length() > 1){ + value = value.left(value.length() - 1); + value = value + ")"; + } + else { + value = ""; + } + return value; +} + +void LogNode::setAssumeRep(){ + HashSet tempAssume; + + assumeFind(this, &tempAssume); + String words = assumeString(&tempAssume); + + Node* oldText = get_node_or_null("Parents"); + if(oldText != NULL){ + remove_child(oldText); + oldText->queue_free(); + } + MeshInstance3D* newText = memnew(MeshInstance3D); + newText->set_name("Parents"); + add_child(newText); + TextMesh* letters = memnew(TextMesh); + newText->set_mesh(letters); + letters->TextMesh::set_text(words); + newText->global_scale(Vector3(.8,.8,.5)); + newText->set_position(Vector3(0,-.15,0)); +} + +void LogNode::assumeCascade(){ + for (LogNode* child : this->logChildren){ + child->setAssumeRep(); + child->assumeCascade(); + } +} + void LogNode::setJustification(String code, String symbol){ this->justification = code; @@ -128,6 +181,8 @@ void LogNode::setJustification(String code, String symbol){ MeshInstance3D* oldBox = (MeshInstance3D*) get_node_or_null("justBox"); oldBox->set_scale(Vector3((symbol.length()*.115)+.1,.225,.2)); + + this->assumeCascade(); } bool LogNode::findParentless(LogNode* targetNode, HashSet found){ @@ -135,7 +190,6 @@ bool LogNode::findParentless(LogNode* targetNode, HashSet found){ if(targetNode->logParents.is_empty()){ return 0; } - // If the node is revisited, we are in a cycle if (found.find(targetNode->getID()) != found.end()){ return 1; @@ -151,6 +205,7 @@ bool LogNode::findParentless(LogNode* targetNode, HashSet found){ } return cycleFlag; } + bool LogNode::dfsCheck(){ bool cycleFlag = 0; HashSet found; @@ -264,7 +319,6 @@ void ProofGraph::edgeSetter(LogNode* start, LogNode* end, MeshInstance3D* workin workingEdge->look_at_from_position(location, endOffset, Vector3(0,1,0), true); } - void ProofGraph::addEdge(LogNode* start, LogNode* end){ if (nodeMap[start->getID()]->logChildren.find(nodeMap[end->getID()]) != nodeMap[start->getID()]->logChildren.end() @@ -290,7 +344,8 @@ void ProofGraph::addEdge(LogNode* start, LogNode* end){ start->add_child(lineMesh); edgeSetter(start, end, lineMesh); - end->setParentRep(); + end->setAssumeRep(); + end->assumeCascade(); } } } @@ -306,7 +361,8 @@ void ProofGraph::removeEdge(LogNode* start, LogNode* end){ Node* badEdge = get_node_internal(String::num_int64(start->getID()) + "/" +String::num_int64(start->getID())+String::num_int64(end->getID())); start->remove_child(badEdge); badEdge->queue_free(); - end->setParentRep(); + end->setAssumeRep(); + end->assumeCascade(); } } @@ -322,10 +378,12 @@ void ProofGraph::removeNode(LogNode* badNode){ badEdge->queue_free(); } + badNode->assumeCascade(); + // Logic remove pointers of children to badNode, updates parent rep for (LogNode* i : badNode->logChildren){ i->logParents.erase(badNode); - i->setParentRep(); + i->setAssumeRep(); } nodeMap.erase(badNode->getID()); diff --git a/extension/proofgraph.h b/extension/proofgraph.h index 83015a0..9757209 100644 --- a/extension/proofgraph.h +++ b/extension/proofgraph.h @@ -35,6 +35,10 @@ class LogNode : public Node3D{ bool isChild(LogNode* potentialChild); String getParentRep(); void setParentRep(); + void assumeFind(LogNode* currentNode, HashSet* tempAssume); + String assumeString(HashSet* assume); + void setAssumeRep(); + void assumeCascade(); void setJustification(String code, String symbol); bool findParentless(LogNode* targetNode, HashSet found); bool dfsCheck(); diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index 9037c73..a02c55f 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -36,14 +36,14 @@ text = "Test" resource_local_to_scene = true size = Vector2(0.5, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_47yps"] +[sub_resource type="ViewportTexture" id="ViewportTexture_imo86"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cbwax"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a1vdj"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_47yps") +albedo_texture = SubResource("ViewportTexture_imo86") texture_filter = 1 [sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] @@ -113,7 +113,7 @@ size = Vector2i(500, 125) [node name="Screen" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="1"] mesh = SubResource("QuadMesh_4qjll") -surface_material_override/0 = SubResource("StandardMaterial3D_cbwax") +surface_material_override/0 = SubResource("StandardMaterial3D_a1vdj") [node name="StaticBody3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="2"] collision_layer = 2097154 From ea404794af0e391ee818f0eac9db5569d6bde75b Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Mon, 27 Nov 2023 14:18:53 -0500 Subject: [PATCH 12/14] finished line edit tweak --- extension/proofgraph.cpp | 14 ++++++-------- project/Scenes/textbox.tscn | 3 +++ project/Scenes/vr_player.tscn | 8 ++++---- project/Scripts/main.gd | 4 ++-- project/Scripts/vr_player.gd | 16 +++++----------- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/extension/proofgraph.cpp b/extension/proofgraph.cpp index 59a128b..76a2aa5 100644 --- a/extension/proofgraph.cpp +++ b/extension/proofgraph.cpp @@ -76,6 +76,7 @@ bool LogNode::isChild(LogNode* potentialChild){ } } +// Old version, not used String LogNode::getParentRep(){ String value = "("; for(LogNode* i : logParents){ @@ -92,6 +93,7 @@ String LogNode::getParentRep(){ return value; } +//Old version, not used void LogNode::setParentRep(){ Node* oldText = get_node_or_null("Parents"); if(oldText != NULL){ @@ -108,6 +110,9 @@ void LogNode::setParentRep(){ newText->set_position(Vector3(0,-.15,0)); } +// Set used to avoid duplicates +// Finds all ancestor node IDs +// Cycle check should keep it from running infinitely void LogNode::assumeFind(LogNode* currentNode, HashSet* tempAssume){ for (LogNode* parent : currentNode->logParents){ if (parent->justification == "assume"){ @@ -117,6 +122,7 @@ void LogNode::assumeFind(LogNode* currentNode, HashSet* tempAssume){ } } +// Converts the set to a string for mesh representation String LogNode::assumeString(HashSet* assume){ String value = "("; for(int i : *(assume)){ @@ -426,13 +432,6 @@ void ProofGraph::updateEdges(LogNode* updateNode){ } } -void ProofGraph::boxLookAtPlayer(){ - Node3D* playerNode = (Node3D*) get_parent()->get_node_or_null("PlayerCharacter/CharacterBody3D/Neck/Camera3D"); - for (KeyValue i : nodeMap){ - i.value->look_at(playerNode->get_global_position(), Vector3(0,-1,0)); - } -} - void ProofGraph::_bind_methods(){ ClassDB::bind_method(D_METHOD("addNode", "newNode"), &ProofGraph::addNode); ClassDB::bind_method(D_METHOD("addEdge", "start", "end"), &ProofGraph::addEdge); @@ -441,5 +440,4 @@ void ProofGraph::_bind_methods(){ ClassDB::bind_method(D_METHOD("getNodeCount"), &ProofGraph::getNodeCount); ClassDB::bind_method(D_METHOD("getData", "nodeID"), &ProofGraph::getNodeData); ClassDB::bind_method(D_METHOD("updateEdges"), &ProofGraph::updateEdges); - ClassDB::bind_method(D_METHOD("boxLookAtPlayer"), &ProofGraph::boxLookAtPlayer); } diff --git a/project/Scenes/textbox.tscn b/project/Scenes/textbox.tscn index bf57c9d..895b059 100644 --- a/project/Scenes/textbox.tscn +++ b/project/Scenes/textbox.tscn @@ -11,3 +11,6 @@ theme_override_colors/caret_color = Color(1, 1, 1, 1) theme_override_font_sizes/font_size = 45 placeholder_text = "formula" alignment = 1 +clear_button_enabled = true +caret_blink = true +caret_force_displayed = true diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index a02c55f..34fb9b7 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -36,14 +36,14 @@ text = "Test" resource_local_to_scene = true size = Vector2(0.5, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_imo86"] +[sub_resource type="ViewportTexture" id="ViewportTexture_kb5em"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a1vdj"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xw3in"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_imo86") +albedo_texture = SubResource("ViewportTexture_kb5em") texture_filter = 1 [sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] @@ -113,7 +113,7 @@ size = Vector2i(500, 125) [node name="Screen" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="1"] mesh = SubResource("QuadMesh_4qjll") -surface_material_override/0 = SubResource("StandardMaterial3D_a1vdj") +surface_material_override/0 = SubResource("StandardMaterial3D_xw3in") [node name="StaticBody3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="2"] collision_layer = 2097154 diff --git a/project/Scripts/main.gd b/project/Scripts/main.gd index a9a87f1..f7b9e89 100644 --- a/project/Scripts/main.gd +++ b/project/Scripts/main.gd @@ -33,8 +33,8 @@ func _ready(): if interface and interface.is_initialized(): get_viewport().use_xr = true - var mainMenu = load("res://Scenes/vr_player.tscn").instantiate() - self.add_child(mainMenu) + var vrStart = load("res://Scenes/vr_player.tscn").instantiate() + self.add_child(vrStart) # Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(_delta): diff --git a/project/Scripts/vr_player.gd b/project/Scripts/vr_player.gd index 6f622d7..29d28fb 100644 --- a/project/Scripts/vr_player.gd +++ b/project/Scripts/vr_player.gd @@ -1,7 +1,5 @@ extends Node3D -#@onready var line_edit = $"../LineEdit" -#@onready var virtual_keyboard_2d = $"../CanvasLayer/VirtualKeyboard2D" @onready var ray = $"CharacterBody3D/XROrigin3D/Right/rHand/RayCast3D" @onready var rightHand = $"CharacterBody3D/XROrigin3D/Right" @onready var head = $"../" @@ -75,7 +73,6 @@ func arrowAddHack(): cone.look_at(selectArray[1].global_position - Vector3(0,.025,0), Vector3(0,1,0)) pass - func rayTraceSelect(): if selectionCount >= selectGate: return @@ -100,7 +97,7 @@ func unselectAll(): selectArray.clear() selectionCount = 0 inputFlag = false - + func newNodeLocationMesh(): var lookDirection = rightHand.get_global_transform().basis.z head = get_node("/root/main") @@ -128,11 +125,8 @@ func _ready(): keyboard.hide() keyRay.enabled = false - # Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(_delta): - - match playerMode: modeTypes.CONNECT: pass @@ -187,13 +181,14 @@ func _on_right_button_pressed(rname): moveFlag = false modeTypes.INPUT_DATA: if selectionCount == 1: + lineEdit.text = selectArray[0].getData() inputFlag = true modeTypes.DELETE_EDGE: pass - + if rname == "by_button": unselectAll() - + if rname == "ax_button": match playerMode: modeTypes.CONNECT: @@ -248,7 +243,7 @@ func _on_left_button_pressed(lname): selectGate = 2 $"CharacterBody3D/XROrigin3D/Left/lHand/ModeText".mesh.text = modeTypes.keys()[playerMode] unselectAll() - + func _on_right_input_vector_2_changed(rjname, value): if rjname == "primary" and inputFlag == false: match playerMode: @@ -264,4 +259,3 @@ func _on_right_input_vector_2_changed(rjname, value): rotdir = -value[0] modeTypes.INPUT_DATA: pass - From ebeb04f01c317e49f075e897bee69a0c90449e15 Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Wed, 6 Dec 2023 16:28:14 -0500 Subject: [PATCH 13/14] review fixes --- extension/proofgraph.cpp | 2 +- project/Scenes/vr_player.tscn | 8 +-- .../objects/keyboard/virtual_keyboard_2d.gd | 49 +++++++------------ .../godot-xr-tools/player/player_body.gd | 30 ------------ 4 files changed, 23 insertions(+), 66 deletions(-) diff --git a/extension/proofgraph.cpp b/extension/proofgraph.cpp index 76a2aa5..c6517fb 100644 --- a/extension/proofgraph.cpp +++ b/extension/proofgraph.cpp @@ -217,7 +217,7 @@ bool LogNode::dfsCheck(){ HashSet found; cycleFlag = findParentless(this, found); return cycleFlag; - } +} void LogNode::_bind_methods(){ diff --git a/project/Scenes/vr_player.tscn b/project/Scenes/vr_player.tscn index 34fb9b7..b895f0b 100644 --- a/project/Scenes/vr_player.tscn +++ b/project/Scenes/vr_player.tscn @@ -36,14 +36,14 @@ text = "Test" resource_local_to_scene = true size = Vector2(0.5, 0.1) -[sub_resource type="ViewportTexture" id="ViewportTexture_kb5em"] +[sub_resource type="ViewportTexture" id="ViewportTexture_w2xxr"] viewport_path = NodePath("Viewport") -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xw3in"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7523s"] transparency = 1 cull_mode = 2 shading_mode = 0 -albedo_texture = SubResource("ViewportTexture_kb5em") +albedo_texture = SubResource("ViewportTexture_w2xxr") texture_filter = 1 [sub_resource type="BoxShape3D" id="BoxShape3D_ucoqh"] @@ -113,7 +113,7 @@ size = Vector2i(500, 125) [node name="Screen" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="1"] mesh = SubResource("QuadMesh_4qjll") -surface_material_override/0 = SubResource("StandardMaterial3D_xw3in") +surface_material_override/0 = SubResource("StandardMaterial3D_7523s") [node name="StaticBody3D" parent="CharacterBody3D/XROrigin3D/Left/Keyboard/Text" index="2"] collision_layer = 2097154 diff --git a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd index a1b8e66..6e4e452 100644 --- a/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd +++ b/project/addons/godot-xr-tools/objects/keyboard/virtual_keyboard_2d.gd @@ -106,109 +106,96 @@ func _update_visible(): $Background/LowerCase.visible = _mode == KeyboardMode.LOWER_CASE $Background/UpperCase.visible = _mode == KeyboardMode.UPPER_CASE $Background/Alternate.visible = _mode == KeyboardMode.ALTERNATE - - -func _on_assumption_pressed(): +func selectHelper(): selectArray = player.selectArray selectionCount = player.selectionCount + +func _on_assumption_pressed(): + selectHelper() if selectionCount == 1: selectArray[0].setJustification("assume", "Assume") func _on_negation_introduction_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("notI", "¬I") func _on_negation_elimination_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("notE", "¬E") func _on_conjunction_introduction_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("andI", "∧I") func _on_conjunction_elimination_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("andE", "∧E") func _on_disjunction_introduction_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("orI", "∨I") func _on_disjunction_elimination_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("orE", "∨E") func _on_conditional_introduction_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("ifI", "→I") func _on_conditional_elimination_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("ifE", "→E") func _on_biconditional_introduction_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("iffI", "↔I") func _on_biconditional_elimination_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("iffE", "↔E") func _on_universal_introduction_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("forallI", "∀I") func _on_universal_elimination_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("forallE", "∀E") func _on_existential_introduction_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("existsI", "∃I") func _on_existential_elimination_pressed(): - selectArray = player.selectArray - selectionCount = player.selectionCount + selectHelper() if selectionCount == 1: selectArray[0].setJustification("existsE", "∃E") diff --git a/project/addons/godot-xr-tools/player/player_body.gd b/project/addons/godot-xr-tools/player/player_body.gd index 3d00cd8..d440392 100644 --- a/project/addons/godot-xr-tools/player/player_body.gd +++ b/project/addons/godot-xr-tools/player/player_body.gd @@ -73,9 +73,6 @@ const NEAR_GROUND_DISTANCE := 1.0 @export var ground_control : GroundControl = GroundControl.ON_GROUND -## Player 3D Velocity - modified by [XRToolsMovementProvider] nodes -#var velocity : Vector3 = Vector3.ZERO - ## Current player gravity var gravity : Vector3 = Vector3.ZERO @@ -250,16 +247,6 @@ func _physics_process(delta: float): if p.enabled: p.physics_pre_movement(delta, self) - # Determine the gravity "up" direction and plane - #if gravity.is_equal_approx(Vector3.ZERO): - # Gravity too weak - use player - # up_gravity_vector = up_player_vector - # up_gravity_plane = up_player_plane - #else: - # Use gravity direction - # up_gravity_vector = -gravity.normalized() - # up_gravity_plane = Plane(up_gravity_vector, 0.0) - # Update the ground information _update_ground_information(delta) @@ -281,23 +268,11 @@ func _physics_process(delta: float): if p.physics_movement(delta, self, exclusive): exclusive = true - # If no controller has performed an exclusive-update then apply gravity and - # perform any ground-control - #if !exclusive: - # if on_ground and ground_physics.stop_on_slope and ground_angle < ground_physics.move_max_slope: - # Apply gravity towards slope to prevent sliding - # velocity += -ground_vector * gravity.length() * delta - # else: - # Apply gravity - # velocity += gravity * delta - # _apply_velocity_and_control(delta) # Apply the player-body movement to the XR origin var movement := global_transform.origin - position_before_movement origin_node.global_transform.origin += movement - # Orient the player towards (potentially modified) gravity - #slew_up(-gravity.normalized(), 5.0 * delta) ## Request a jump @@ -585,11 +560,6 @@ func _apply_velocity_and_control(delta: float): velocity = local_velocity + ground_velocity emit_signal("player_bounced", collision_node, magnitude) - # Hack to ensure feet stick to ground (if not jumping) - # TODO: FIX - #if abs(velocity.y) < 0.001: - # velocity.y = ground_velocity.y - # Test if the player can apply ground control given the settings and the ground state. func _can_apply_ground_control() -> bool: match ground_control: From d7e793677a1c8bcebcfefc7d4a2e1908e070c7e3 Mon Sep 17 00:00:00 2001 From: mkerr6872 Date: Fri, 8 Dec 2023 22:57:43 -0500 Subject: [PATCH 14/14] changes for merge --- .gitmodules | 3 ++ extension/register_types.cpp | 4 +- .../{proofgraph.cpp => vrproofgraph.cpp} | 38 +++++++++---------- extension/{proofgraph.h => vrproofgraph.h} | 8 ++-- 4 files changed, 28 insertions(+), 25 deletions(-) rename extension/{proofgraph.cpp => vrproofgraph.cpp} (92%) rename extension/{proofgraph.h => vrproofgraph.h} (94%) diff --git a/.gitmodules b/.gitmodules index 8b954ad..92f95a5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = godot-cpp url = https://github.com/godotengine/godot-cpp branch = 4.1 +[submodule "SlateCore"] + path = SlateCore + url = https://github.com/James-Oswald/SlateCore.git \ No newline at end of file diff --git a/extension/register_types.cpp b/extension/register_types.cpp index 36b9fb1..3c617d6 100644 --- a/extension/register_types.cpp +++ b/extension/register_types.cpp @@ -1,6 +1,6 @@ #include "register_types.h" -#include "proofgraph.h" +#include "vrproofgraph.h" #include #include @@ -15,7 +15,7 @@ void initialize_proofgraph_module(ModuleInitializationLevel p_level) { } ClassDB::register_class(); - ClassDB::register_class(); + ClassDB::register_class(); } void uninitialize_proofgraph_module(ModuleInitializationLevel p_level) { diff --git a/extension/proofgraph.cpp b/extension/vrproofgraph.cpp similarity index 92% rename from extension/proofgraph.cpp rename to extension/vrproofgraph.cpp index c6517fb..ab0d165 100644 --- a/extension/proofgraph.cpp +++ b/extension/vrproofgraph.cpp @@ -3,7 +3,7 @@ #include #include -#include "proofgraph.h" +#include "VRproofgraph.h" #include "godot_cpp/classes/mesh.hpp" #include "godot_cpp/classes/box_mesh.hpp" @@ -230,19 +230,19 @@ void LogNode::_bind_methods(){ ClassDB::bind_method(D_METHOD("setJustification", "consise", "verbose"), &LogNode::setJustification); } -ProofGraph::ProofGraph(){ +VRProofGraph::VRProofGraph(){ nodeCount = 0; nodeIDCount = 0; HashMap nodeMap; } -ProofGraph::~ProofGraph(){ +VRProofGraph::~VRProofGraph(){ for(auto& i : nodeMap){ nodeMap.erase(i.key); } } -void ProofGraph::addNode(Vector3 position){ +void VRProofGraph::addNode(Vector3 position){ // Godot specific method of allocating memory to objects LogNode* newNode = memnew(LogNode); newNode->setID(nodeIDCount); @@ -301,7 +301,7 @@ void ProofGraph::addNode(Vector3 position){ justBox->set_position(Vector3(0,.375,.0)); } -void ProofGraph::edgeSetter(LogNode* start, LogNode* end, MeshInstance3D* workingEdge){ +void VRProofGraph::edgeSetter(LogNode* start, LogNode* end, MeshInstance3D* workingEdge){ Vector3 topBoxOffset = Vector3(0,.475,0); Vector3 bottomBoxOffset = Vector3(0,.25,0); Vector3 sPos = start->get_global_position(); @@ -325,7 +325,7 @@ void ProofGraph::edgeSetter(LogNode* start, LogNode* end, MeshInstance3D* workin workingEdge->look_at_from_position(location, endOffset, Vector3(0,1,0), true); } -void ProofGraph::addEdge(LogNode* start, LogNode* end){ +void VRProofGraph::addEdge(LogNode* start, LogNode* end){ if (nodeMap[start->getID()]->logChildren.find(nodeMap[end->getID()]) != nodeMap[start->getID()]->logChildren.end() || nodeMap[end->getID()]->logParents.find(nodeMap[start->getID()]) != nodeMap[end->getID()]->logParents.end()){ @@ -356,7 +356,7 @@ void ProofGraph::addEdge(LogNode* start, LogNode* end){ } } -void ProofGraph::removeEdge(LogNode* start, LogNode* end){ +void VRProofGraph::removeEdge(LogNode* start, LogNode* end){ if (nodeMap[start->getID()]->logChildren.find(nodeMap[end->getID()]) != nodeMap[start->getID()]->logChildren.end() ){ //Logic @@ -373,7 +373,7 @@ void ProofGraph::removeEdge(LogNode* start, LogNode* end){ } // Needs checks for node validity -void ProofGraph::removeNode(LogNode* badNode){ +void VRProofGraph::removeNode(LogNode* badNode){ // Logic remove pointers of parents to badNode for(LogNode* i : badNode->logParents){ i->logChildren.erase(badNode); @@ -403,15 +403,15 @@ void ProofGraph::removeNode(LogNode* badNode){ badNode->queue_free(); } -int ProofGraph::getNodeCount(){ +int VRProofGraph::getNodeCount(){ return nodeCount; } -String ProofGraph::getNodeData(int targetNodeID){ +String VRProofGraph::getNodeData(int targetNodeID){ return nodeMap[targetNodeID]->data; } -void ProofGraph::updateEdges(LogNode* updateNode){ +void VRProofGraph::updateEdges(LogNode* updateNode){ for(LogNode* i : updateNode->logParents){ // Meshes Node* currentEdge = get_node_or_null(String::num_int64(i->getID()) + "/" + String::num_int64(i->getID()) + String::num_int64(updateNode->getID())); @@ -432,12 +432,12 @@ void ProofGraph::updateEdges(LogNode* updateNode){ } } -void ProofGraph::_bind_methods(){ - ClassDB::bind_method(D_METHOD("addNode", "newNode"), &ProofGraph::addNode); - ClassDB::bind_method(D_METHOD("addEdge", "start", "end"), &ProofGraph::addEdge); - ClassDB::bind_method(D_METHOD("removeEdge", "start", "end"), &ProofGraph::removeEdge); - ClassDB::bind_method(D_METHOD("removeNode", "node_pointer"), &ProofGraph::removeNode); - ClassDB::bind_method(D_METHOD("getNodeCount"), &ProofGraph::getNodeCount); - ClassDB::bind_method(D_METHOD("getData", "nodeID"), &ProofGraph::getNodeData); - ClassDB::bind_method(D_METHOD("updateEdges"), &ProofGraph::updateEdges); +void VRProofGraph::_bind_methods(){ + ClassDB::bind_method(D_METHOD("addNode", "newNode"), &VRProofGraph::addNode); + ClassDB::bind_method(D_METHOD("addEdge", "start", "end"), &VRProofGraph::addEdge); + ClassDB::bind_method(D_METHOD("removeEdge", "start", "end"), &VRProofGraph::removeEdge); + ClassDB::bind_method(D_METHOD("removeNode", "node_pointer"), &VRProofGraph::removeNode); + ClassDB::bind_method(D_METHOD("getNodeCount"), &VRProofGraph::getNodeCount); + ClassDB::bind_method(D_METHOD("getData", "nodeID"), &VRProofGraph::getNodeData); + ClassDB::bind_method(D_METHOD("updateEdges"), &VRProofGraph::updateEdges); } diff --git a/extension/proofgraph.h b/extension/vrproofgraph.h similarity index 94% rename from extension/proofgraph.h rename to extension/vrproofgraph.h index 9757209..6d14c95 100644 --- a/extension/proofgraph.h +++ b/extension/vrproofgraph.h @@ -48,8 +48,8 @@ class LogNode : public Node3D{ static void _bind_methods(); }; -class ProofGraph : public Node{ - GDCLASS(ProofGraph, Node) +class VRProofGraph : public Node{ + GDCLASS(VRProofGraph, Node) private: int nodeCount; @@ -58,8 +58,8 @@ class ProofGraph : public Node{ public: // Constructor, creates empty proof graph - ProofGraph(); - ~ProofGraph(); + VRProofGraph(); + ~VRProofGraph(); //void addNode(Vector3 location, int data); void addNode(Vector3 position);