Debug Draw 3D (and 2D) 1.5.1
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/font.hpp>
10#include <godot_cpp/classes/ref_counted.hpp>
11#include <godot_cpp/classes/viewport.hpp>
12GODOT_WARNING_RESTORE()
13using namespace godot;
14
59class DebugDraw3DScopeConfig : public RefCounted {
60 GDCLASS(DebugDraw3DScopeConfig, RefCounted)
61
62protected:
64 static void _bind_methods();
65
66private:
67 uint64_t thread_id;
68 uint64_t guard_id;
69
70 using unregister_func = std::function<void(const uint64_t &, const uint64_t &)>;
71 unregister_func unregister_action;
72
73public:
75 struct DebugContainerDependent {
76 Viewport *viewport = nullptr;
77 uint64_t viewport_id = 0;
78 bool no_depth_test = false;
79 };
80
82 struct Data {
83 // Update the constructor if changes are made!
84 real_t thickness;
85 real_t center_brightness;
86 real_t plane_size;
87 Transform3D transform;
88 Color text_outline_color;
89 uint32_t text_outline_color_hash;
90 int32_t text_outline_size;
91 Ref<Font> text_font;
92 DebugContainerDependent dcd;
93 bool hd_sphere;
94 bool custom_xform;
95
96 Data();
97 Data(const Data *parent);
98 };
100 std::shared_ptr<Data> data = nullptr;
101
103 // It can be used for example in C#
104 void _manual_unregister();
105
111 Ref<DebugDraw3DScopeConfig> set_thickness(real_t _value) const;
112 real_t get_thickness() const;
113
119 Ref<DebugDraw3DScopeConfig> set_center_brightness(real_t _value) const;
120 real_t get_center_brightness() const;
121
127 Ref<DebugDraw3DScopeConfig> set_hd_sphere(bool _value) const;
128 bool is_hd_sphere() const;
129
135 Ref<DebugDraw3DScopeConfig> set_plane_size(real_t _value) const;
136 real_t get_plane_size() const;
137
141 Ref<DebugDraw3DScopeConfig> set_transform(Transform3D _value) const;
142 Transform3D get_transform() const;
143
152 Ref<DebugDraw3DScopeConfig> set_text_outline_color(Color _value) const;
153 Color get_text_outline_color() const;
154
163 Ref<DebugDraw3DScopeConfig> set_text_outline_size(int32_t _value) const;
164 int32_t get_text_outline_size() const;
165
174 Ref<DebugDraw3DScopeConfig> set_text_font(Ref<Font> _value) const;
175 Ref<Font> get_text_font() const;
176
187 Ref<DebugDraw3DScopeConfig> set_viewport(Viewport *_value) const;
188 Viewport *get_viewport() const;
189
198 Ref<DebugDraw3DScopeConfig> set_no_depth_test(bool _value) const;
199 bool is_no_depth_test() const;
200
202 DebugDraw3DScopeConfig();
203
204 // `DDScopedConfig3D` is passed as Ref to avoid a random unreference
206 DebugDraw3DScopeConfig(const uint64_t &p_thread_id, const uint64_t &p_guard_id, const DebugDraw3DScopeConfig::Data *p_parent, const unregister_func p_unreg);
207 ~DebugDraw3DScopeConfig();
208};
Ref< DebugDraw3DScopeConfig > set_thickness(real_t _value) const
Ref< DebugDraw3DScopeConfig > set_text_font(Ref< Font > _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_text_outline_color(Color _value) const
Ref< DebugDraw3DScopeConfig > set_text_outline_size(int32_t _value) const
Ref< DebugDraw3DScopeConfig > set_viewport(Viewport *_value) const
Ref< DebugDraw3DScopeConfig > set_plane_size(real_t _value) const
Ref< DebugDraw3DScopeConfig > set_transform(Transform3D _value) const