Debug Draw 3D (and 2D) 1.5.0
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>
11#include <godot_cpp/classes/font.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 bool hd_sphere;
87 real_t plane_size;
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
94 Data();
95 Data(const Data *parent);
96 };
98 std::shared_ptr<Data> data = nullptr;
99
101 // It can be used for example in C#
102 void _manual_unregister();
103
109 Ref<DebugDraw3DScopeConfig> set_thickness(real_t _value) const;
110 real_t get_thickness() const;
111
117 Ref<DebugDraw3DScopeConfig> set_center_brightness(real_t _value) const;
118 real_t get_center_brightness() const;
119
125 Ref<DebugDraw3DScopeConfig> set_hd_sphere(bool _value) const;
126 bool is_hd_sphere() const;
127
133 Ref<DebugDraw3DScopeConfig> set_plane_size(real_t _value) const;
134 real_t get_plane_size() const;
135
144 Ref<DebugDraw3DScopeConfig> set_text_outline_color(Color _value) const;
145 Color get_text_outline_color() const;
146
155 Ref<DebugDraw3DScopeConfig> set_text_outline_size(int32_t _value) const;
156 int32_t get_text_outline_size() const;
157
166 Ref<DebugDraw3DScopeConfig> set_text_font(Ref<Font> _value) const;
167 Ref<Font> get_text_font() const;
168
179 Ref<DebugDraw3DScopeConfig> set_viewport(Viewport *_value) const;
180 Viewport *get_viewport() const;
181
190 Ref<DebugDraw3DScopeConfig> set_no_depth_test(bool _value) const;
191 bool is_no_depth_test() const;
192
194 DebugDraw3DScopeConfig();
195
196 // `DDScopedConfig3D` is passed as Ref to avoid a random unreference
198 DebugDraw3DScopeConfig(const uint64_t &p_thread_id, const uint64_t &p_guard_id, const DebugDraw3DScopeConfig::Data *p_parent, const unregister_func p_unreg);
199 ~DebugDraw3DScopeConfig();
200};
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