diff --git a/examples_dd3d/DebugDrawDemoScene.gd b/examples_dd3d/DebugDrawDemoScene.gd index 011e48ca..1d29cbcc 100644 --- a/examples_dd3d/DebugDrawDemoScene.gd +++ b/examples_dd3d/DebugDrawDemoScene.gd @@ -10,7 +10,7 @@ extends Node3D @export var draw_array_of_boxes := false @export_range(0, 5, 0.001) var debug_thickness := 0.1 @export_range(0, 1, 0.001) var debug_center_brightness := 0.8 -@export_range(0, 1024) var start_culling_distance := 60.0 +@export_range(0, 1024) var start_culling_distance := 75.0 @export_group("Text groups", "text_groups") @export var text_groups_show_hints := true @@ -106,9 +106,9 @@ func main_update(delta: float) -> void: $LagTest.visible = true # Testing the rendering layers by showing the image from the second camera inside the 2D panel - DebugDraw3D.config.geometry_render_layers = 1 if !Input.is_key_pressed(KEY_SHIFT) else 0b10010 - $Panel.visible = Input.is_key_pressed(KEY_SHIFT) - DebugDraw2D.custom_canvas = %CustomCanvas if Input.is_key_pressed(KEY_SHIFT) else null + DebugDraw3D.config.geometry_render_layers = 1 if !Input.is_key_pressed(KEY_ALT) else 0b10010 + $Panel.visible = Input.is_key_pressed(KEY_ALT) + DebugDraw2D.custom_canvas = %CustomCanvas if Input.is_key_pressed(KEY_ALT) else null # More property toggles DebugDraw3D.config.freeze_3d_render = Input.is_key_pressed(KEY_DOWN) @@ -167,8 +167,6 @@ func main_update(delta: float) -> void: DebugDraw3D.draw_aabb(AABB($Boxes/AABB_fixed.global_position, Vector3(2, 1, 2)), Color.AQUA) DebugDraw3D.draw_aabb_ab($Boxes/AABB/a.global_position, $Boxes/AABB/b.global_position, Color.DEEP_PINK) - DebugDraw3D.draw_box_xf($Boxes/BoxOutOfDistanceCulling.global_transform, Color.RED) - # Boxes AB DebugDraw3D.draw_arrow($Boxes/BoxAB.global_position, $Boxes/BoxAB/o/up.global_position, Color.GOLD, 0.1, true) DebugDraw3D.draw_box_ab($Boxes/BoxAB/a.global_position, $Boxes/BoxAB/b.global_position, $Boxes/BoxAB/o/up.global_position - $Boxes/BoxAB.global_position, Color.PERU) @@ -350,11 +348,14 @@ func _text_tests(): if text_groups_show_hints: DebugDraw2D.begin_text_group("controls", 1024, Color.WHITE, false) - DebugDraw2D.set_text("Shift: change render layers", DebugDraw3D.config.geometry_render_layers, 1) + if not Engine.is_editor_hint(): + DebugDraw2D.set_text("WASD, QE, LMB", "To move", 0) + DebugDraw2D.set_text("Alt: change render layers", DebugDraw3D.config.geometry_render_layers, 1) if not OS.has_feature("web"): DebugDraw2D.set_text("Ctrl: toggle anti-aliasing", "MSAA 4x" if get_viewport().msaa_3d == Viewport.MSAA_4X else "Disabled", 2) DebugDraw2D.set_text("Down: freeze render", DebugDraw3D.config.freeze_3d_render, 3) - DebugDraw2D.set_text("Up: use scene camera", DebugDraw3D.config.force_use_camera_from_scene, 4) + if Engine.is_editor_hint(): + DebugDraw2D.set_text("Up: use scene camera", DebugDraw3D.config.force_use_camera_from_scene, 4) DebugDraw2D.set_text("1,2,3: toggle debug", "%s, %s 😐, %s 😏" % [DebugDraw3D.debug_enabled, DebugDraw2D.debug_enabled, DebugDrawManager.debug_enabled], 5) DebugDraw2D.set_text("Left: toggle frustum culling", DebugDraw3D.config.use_frustum_culling, 6) DebugDraw2D.set_text("Right: draw bounds for culling", DebugDraw3D.config.visible_instance_bounds, 7) diff --git a/examples_dd3d/DebugDrawDemoScene.tscn b/examples_dd3d/DebugDrawDemoScene.tscn index 651dfeec..4dbdecb6 100644 --- a/examples_dd3d/DebugDrawDemoScene.tscn +++ b/examples_dd3d/DebugDrawDemoScene.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=3 uid="uid://c3sccy6x0ht5j"] +[gd_scene load_steps=29 format=3 uid="uid://c3sccy6x0ht5j"] [ext_resource type="Script" path="res://examples_dd3d/DebugDrawDemoScene.gd" id="1"] [ext_resource type="FontFile" uid="uid://erdgllynwqkw" path="res://examples_dd3d/Roboto-Bold.ttf" id="2_aedbq"] @@ -106,6 +106,18 @@ tracks/2/keys = { "update": 0, "values": [Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.443643, 0, 1.53767), Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.443643, -0.791383, 1.53767)] } +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Spatial7:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0.4, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector3(1.33, -0.119, -0.025), Vector3(1.32989, -0.583818, -0.025198)] +} [sub_resource type="Animation" id="10"] length = 0.001 @@ -145,6 +157,18 @@ tracks/2/keys = { "update": 0, "values": [Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.443643, 0, 1.53767)] } +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Spatial7:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(1.32989, -0.583818, -0.025198)] +} [sub_resource type="AnimationLibrary" id="AnimationLibrary_nj4nv"] _data = { @@ -581,12 +605,12 @@ directional_shadow_max_distance = 200.0 environment = SubResource("Environment_38m85") [node name="Camera" type="Camera3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 0.953191, 0.30237, 0, -0.30237, 0.953191, -6.988, 13.525, 37.21) +transform = Transform3D(1, 0, 0, 0, 0.953191, 0.30237, 0, -0.30237, 0.953191, -6.988, 10.986, 29.2059) cull_mask = 1 current = true -fov = 38.8 -near = 2.63 -far = 60.0 +fov = 53.0 +far = 100.0 +script = SubResource("GDScript_yp7g8") [node name="Panel" type="PanelContainer" parent="."] visible = false @@ -673,7 +697,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -1, 1) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, -1) [node name="Spatial7" type="Node3D" parent="LinePath"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.32989, -0.583818, -0.025198) [node name="Cylinders" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -23.5266, 4.76837e-07, -5.82213) @@ -718,9 +742,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.104528, -0.809874, 2.10804 [node name="Box3" type="Node3D" parent="Boxes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.34837, -1.08298, 4.36414) -[node name="BoxOutOfDistanceCulling" type="Node3D" parent="Boxes"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.43744, 0.344, -27.9652) - [node name="AABB_fixed" type="Node3D" parent="Boxes"] transform = Transform3D(0.834492, 0, -0.551019, 0, 1, 0, 0.55102, 0, 0.834493, -3.12735, -0.835878, 0.470324) diff --git a/examples_dd3d/DebugDrawDemoSceneCS.cs b/examples_dd3d/DebugDrawDemoSceneCS.cs index 93c20d87..7406e410 100644 --- a/examples_dd3d/DebugDrawDemoSceneCS.cs +++ b/examples_dd3d/DebugDrawDemoSceneCS.cs @@ -67,7 +67,6 @@ public partial class DebugDrawDemoSceneCS : Node3D Node3D dBox1; Node3D dBox2; Node3D dBox3; - Node3D dBoxOutOfDistanceCulling; Node3D dBoxAB; Node3D dBoxABa; Node3D dBoxABb; @@ -123,7 +122,6 @@ public override async void _Ready() dBox1 = GetNode("Boxes/Box1"); dBox2 = GetNode("Boxes/Box2"); dBox3 = GetNode("Boxes/Box3"); - dBoxOutOfDistanceCulling = GetNode("Boxes/BoxOutOfDistanceCulling"); dBoxAB = GetNode("Boxes/BoxAB"); dBoxABa = GetNode("Boxes/BoxAB/a"); dBoxABb = GetNode("Boxes/BoxAB/b"); @@ -279,9 +277,9 @@ void MainUpdate(double delta) dLagTest.Visible = true; // Testing the rendering layers by showing the image from the second camera inside the 2D panel - DebugDraw3D.Config.GeometryRenderLayers = !Input.IsKeyPressed(Key.Shift) ? 1 : 0b10010; - dPanel.Visible = Input.IsKeyPressed(Key.Shift); - DebugDraw2D.CustomCanvas = Input.IsKeyPressed(Key.Shift) ? dCustomCanvas : null; + DebugDraw3D.Config.GeometryRenderLayers = !Input.IsKeyPressed(Key.Alt) ? 1 : 0b10010; + dPanel.Visible = Input.IsKeyPressed(Key.Alt); + DebugDraw2D.CustomCanvas = Input.IsKeyPressed(Key.Alt) ? dCustomCanvas : null; // More property toggles DebugDraw3D.Config.Freeze3dRender = Input.IsKeyPressed(Key.Down); @@ -356,8 +354,6 @@ void MainUpdate(double delta) DebugDraw3D.DrawAabb(new Aabb(dAABB_fixed.GlobalPosition, new Vector3(2, 1, 2)), Colors.Aqua); DebugDraw3D.DrawAabbAb(dAABB.GetChild(0).GlobalPosition, dAABB.GetChild(1).GlobalPosition, Colors.DeepPink); - DebugDraw3D.DrawBoxXf(dBoxOutOfDistanceCulling.GlobalTransform, Colors.Red); - // Boxes AB DebugDraw3D.DrawArrow(dBoxAB.GlobalPosition, dBoxABup.GlobalPosition, Colors.Gold, 0.1f, true); @@ -587,10 +583,20 @@ void _text_tests() if (text_groups_show_hints) { DebugDraw2D.BeginTextGroup("controls", 1024, Colors.White, false); - DebugDraw2D.SetText("Shift: change render layers", DebugDraw3D.Config.GeometryRenderLayers, 1); - DebugDraw2D.SetText("Ctrl: toggle anti-aliasing", GetViewport().Msaa3D == Viewport.Msaa.Msaa4X ? "MSAA 4x" : "Disabled", 2); + if (!Engine.IsEditorHint()) + { + DebugDraw2D.SetText("WASD QE, LMB", "To move", 0); + } + DebugDraw2D.SetText("Alt: change render layers", DebugDraw3D.Config.GeometryRenderLayers, 1); + if (!OS.HasFeature("web")) + { + DebugDraw2D.SetText("Ctrl: toggle anti-aliasing", GetViewport().Msaa3D == Viewport.Msaa.Msaa4X ? "MSAA 4x" : "Disabled", 2); + } DebugDraw2D.SetText("Down: freeze render", DebugDraw3D.Config.Freeze3dRender, 3); - DebugDraw2D.SetText("Up: use scene camera", DebugDraw3D.Config.ForceUseCameraFromScene, 4); + if (Engine.IsEditorHint()) + { + DebugDraw2D.SetText("Up: use scene camera", DebugDraw3D.Config.ForceUseCameraFromScene, 4); + } DebugDraw2D.SetText("1,2,3: toggle debug", $"{DebugDraw3D.DebugEnabled}, {DebugDraw2D.DebugEnabled} 😐, {DebugDrawManager.DebugEnabled} 😏", 5); DebugDraw2D.SetText("Left: toggle frustum culling", DebugDraw3D.Config.UseFrustumCulling, 6); DebugDraw2D.SetText("Right: draw bounds for culling", DebugDraw3D.Config.VisibleInstanceBounds, 7);