Debug Draw 3D (and 2D) 1.4.5
Draw 3D debug graphics and 2D overlays with this add-on.
Loading...
Searching...
No Matches
config_scope_3d.h
1#pragma once
2
3#include "utils/compiler.h"
4
5#include <functional>
6#include <memory>
7
8GODOT_WARNING_DISABLE()
9#include <godot_cpp/classes/ref_counted.hpp>
10#include <godot_cpp/classes/viewport.hpp>
11GODOT_WARNING_RESTORE()
12using namespace godot;
13
58class DebugDraw3DScopeConfig : public RefCounted {
59 GDCLASS(DebugDraw3DScopeConfig, RefCounted)
60
61protected:
63 static void _bind_methods();
64
65private:
66 uint64_t thread_id;
67 uint64_t guard_id;
68
69 using unregister_func = std::function<void(const uint64_t &, const uint64_t &)>;
70 unregister_func unregister_action;
71
72public:
74 struct DebugContainerDependent {
75 // TODO replace by instance_id
76 Viewport *viewport;
77 bool no_depth_test;
78
79 DebugContainerDependent() :
80 viewport(nullptr),
81 no_depth_test(false) {
82 }
83
84 DebugContainerDependent(Viewport *p_viewport, bool p_no_depth_test) :
85 viewport(p_viewport),
86 no_depth_test(p_no_depth_test) {
87 }
88 };
89
91 struct Data {
92 // Update the constructor if changes are made!
93 real_t thickness;
94 real_t center_brightness;
95 bool hd_sphere;
96 real_t plane_size;
97 DebugContainerDependent dcd;
98
99 Data();
100 Data(const std::shared_ptr<Data> &parent);
101 };
103 std::shared_ptr<Data> data = nullptr;
104
106 // It can be used for example in C#
107 void _manual_unregister();
108
114 Ref<DebugDraw3DScopeConfig> set_thickness(real_t _value) const;
115 real_t get_thickness() const;
116
122 Ref<DebugDraw3DScopeConfig> set_center_brightness(real_t _value) const;
123 real_t get_center_brightness() const;
124
130 Ref<DebugDraw3DScopeConfig> set_hd_sphere(bool _value) const;
131 bool is_hd_sphere() const;
132
138 Ref<DebugDraw3DScopeConfig> set_plane_size(real_t _value) const;
139 real_t get_plane_size() const;
140
151 Ref<DebugDraw3DScopeConfig> set_viewport(Viewport *_value) const;
152 Viewport *get_viewport() const;
153
162 Ref<DebugDraw3DScopeConfig> set_no_depth_test(bool _value) const;
163 bool is_no_depth_test() const;
164
167
168 // `DDScopedConfig3D` is passed as Ref to avoid a random unreference
170 DebugDraw3DScopeConfig(const uint64_t &p_thread_id, const uint64_t &p_guard_id, const std::shared_ptr<DebugDraw3DScopeConfig::Data> &p_parent, const unregister_func p_unreg);
172};
This class is used to override scope parameters for DebugDraw3D.
Definition config_scope_3d.h:58
Ref< DebugDraw3DScopeConfig > set_thickness(real_t _value) const
Ref< DebugDraw3DScopeConfig > set_hd_sphere(bool _value) const
Ref< DebugDraw3DScopeConfig > set_no_depth_test(bool _value) const
Ref< DebugDraw3DScopeConfig > set_center_brightness(real_t _value) const
Ref< DebugDraw3DScopeConfig > set_viewport(Viewport *_value) const
Ref< DebugDraw3DScopeConfig > set_plane_size(real_t _value) const