Singleton class for calling debugging 3D methods. More...
#include <debug_draw_3d.h>
Public Types | |
| enum | PointType : int { POINT_TYPE_SQUARE , POINT_TYPE_SPHERE } |
Public Member Functions | |
| Ref< DebugDraw3DScopeConfig > | new_scoped_config () |
| Ref< DebugDraw3DScopeConfig > | scoped_config () override |
| void | set_config (Ref< DebugDraw3DConfig > cfg) |
| Ref< DebugDraw3DConfig > | get_config () const |
| Color | get_empty_color () const |
| void | set_debug_enabled (const bool &state) |
| bool | is_debug_enabled () const |
| Ref< DebugDraw3DStats > | get_render_stats () |
| Ref< DebugDraw3DStats > | get_render_stats_for_world (Viewport *viewport) |
| void | regenerate_geometry_meshes () |
| void | clear_all () |
| void | draw_sphere (const Vector3 &position, const real_t &radius=0.5f, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_sphere_xf (const Transform3D &transform, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_cylinder (const Transform3D &transform, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_cylinder_ab (const Vector3 &a, const Vector3 &b, const real_t &radius=0.5f, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_box (const Vector3 &position, const Quaternion &rotation, const Vector3 &size, const Color &color=Colors::empty_color, const bool &is_box_centered=false, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_box_ab (const Vector3 &a, const Vector3 &b, const Vector3 &up, const Color &color=Colors::empty_color, const bool &is_ab_diagonal=true, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_box_xf (const Transform3D &transform, const Color &color=Colors::empty_color, const bool &is_box_centered=true, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_aabb (const AABB &aabb, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_aabb_ab (const Vector3 &a, const Vector3 &b, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_line_hit (const Vector3 &start, const Vector3 &end, const Vector3 &hit, const bool &is_hit, const real_t &hit_size=0.25f, const Color &hit_color=Colors::empty_color, const Color &after_hit_color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_line_hit_offset (const Vector3 &start, const Vector3 &end, const bool &is_hit, const real_t &unit_offset_of_hit=0.5f, const real_t &hit_size=0.25f, const Color &hit_color=Colors::empty_color, const Color &after_hit_color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_line (const Vector3 &a, const Vector3 &b, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_ray (const Vector3 &origin, const Vector3 &direction, const real_t &length, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_lines (const PackedVector3Array &lines, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_line_path (const PackedVector3Array &path, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_arrowhead (const Transform3D &transform, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_arrow (const Vector3 &a, const Vector3 &b, const Color &color=Colors::empty_color, const real_t &arrow_size=0.5f, const bool &is_absolute_size=false, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_arrow_ray (const Vector3 &origin, const Vector3 &direction, const real_t &length, const Color &color=Colors::empty_color, const real_t &arrow_size=0.5f, const bool &is_absolute_size=false, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_arrow_path (const PackedVector3Array &path, const Color &color=Colors::empty_color, const real_t &arrow_size=0.75f, const bool &is_absolute_size=true, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_point_path (const PackedVector3Array &path, const PointType type=PointType::POINT_TYPE_SQUARE, const real_t &size=0.25f, const Color &points_color=Colors::empty_color, const Color &lines_color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_points (const PackedVector3Array &points, const PointType type=PointType::POINT_TYPE_SQUARE, const real_t &size=0.25f, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_square (const Vector3 &position, const real_t &size=0.2f, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_plane (const Plane &plane, const Color &color=Colors::empty_color, const Vector3 &anchor_point=Vector3(INFINITY, INFINITY, INFINITY), const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_position (const Transform3D &transform, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_gizmo (const Transform3D &transform, const Color &color=Colors::empty_color, const bool &is_centered=false, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_grid (const Vector3 &origin, const Vector3 &x_size, const Vector3 &y_size, const Vector2i &subdivision, const Color &color=Colors::empty_color, const bool &is_centered=true, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_grid_xf (const Transform3D &transform, const Vector2i &p_subdivision, const Color &color=Colors::empty_color, const bool &is_centered=true, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_camera_frustum (const class godot::Camera3D *camera, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_camera_frustum_planes (const Array &camera_frustum, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
| void | draw_text (const Vector3 &position, const String text, const int size=32, const Color &color=Colors::empty_color, const real_t &duration=0) FAKE_FUNC_IMPL |
Static Public Member Functions | |
| static DebugDraw3D * | get_singleton () |
Singleton class for calling debugging 3D methods.
You can use the project settings debug_draw_3d/settings/3d for additional customization.
For example, add_bevel_to_volumetric_geometry allows you to remove or add a bevel for volumetric lines.
use_icosphere and use_icosphere_for_hd allow you to change the sphere mesh.
| enum DebugDraw3D::PointType : int |
Appearance of points on the path
|
inlinestatic |
Get singleton. Not available in GDScript.
| Ref< DebugDraw3DScopeConfig > DebugDraw3D::new_scoped_config | ( | ) |
Create a new DebugDraw3DScopeConfig instance and register it.
This class allows you to override some parameters within scope for the following draw_* calls.
Store this instance in a local variable inside the method.
|
override |
Returns the default scope settings that will be applied at the start of each new frame.
Default values can be overridden in the project settings debug_draw_3d/settings/3d/volumetric_defaults.
| void DebugDraw3D::set_config | ( | Ref< DebugDraw3DConfig > | cfg | ) |
Set the configuration global for everything in DebugDraw3D.
| Ref< DebugDraw3DConfig > DebugDraw3D::get_config | ( | ) | const |
Get the DebugDraw3DConfig.
| Color DebugDraw3D::get_empty_color | ( | ) | const |
Get the color that is used as the default parameter for draw_* calls.
| void DebugDraw3D::set_debug_enabled | ( | const bool & | state | ) |
Set whether debug drawing works or not.
| Ref< DebugDraw3DStats > DebugDraw3D::get_render_stats | ( | ) |
Returns an instance of DebugDraw3DStats with the current statistics.
Some data can be delayed by 1 frame.
| Ref< DebugDraw3DStats > DebugDraw3D::get_render_stats_for_world | ( | Viewport * | viewport | ) |
Returns an instance of DebugDraw3DStats with the current statistics for the World3D of the Viewport.
Some data can be delayed by 1 frame.
| void DebugDraw3D::regenerate_geometry_meshes | ( | ) |
Regenerate meshes.
Can be useful if you want to change some project settings and not restart the project.
| void DebugDraw3D::clear_all | ( | ) |
Clear all 3D geometry
| void DebugDraw3D::draw_sphere | ( | const Vector3 & | position, |
| const real_t & | radius = 0.5f, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a sphere
| position | Center of the sphere |
| radius | Sphere radius |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_sphere_xf | ( | const Transform3D & | transform, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a sphere with a radius of 0.5
| transform | Sphere transform |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_cylinder | ( | const Transform3D & | transform, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a vertical cylinder with radius 0.5 and height 1.0
| transform | Cylinder transform |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_cylinder_ab | ( | const Vector3 & | a, |
| const Vector3 & | b, | ||
| const real_t & | radius = 0.5f, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a cylinder between points A and B with a certain radius
| a | Bottom point of the Cylinder |
| b | Top point of the Cylinder |
| radius | Cylinder radius |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_box | ( | const Vector3 & | position, |
| const Quaternion & | rotation, | ||
| const Vector3 & | size, | ||
| const Color & | color = Colors::empty_color, | ||
| const bool & | is_box_centered = false, | ||
| const real_t & | duration = 0 ) |
Draw a box
| position | Position of the Box |
| rotation | Rotation of the box |
| size | Size of the Box |
| color | Primary color |
| is_box_centered | Set where the center of the box will be. In the center or in the bottom corner |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_box_ab | ( | const Vector3 & | a, |
| const Vector3 & | b, | ||
| const Vector3 & | up, | ||
| const Color & | color = Colors::empty_color, | ||
| const bool & | is_ab_diagonal = true, | ||
| const real_t & | duration = 0 ) |
Draw a box between points A and B by rotating and scaling based on the up vector
| a | Start position |
| b | End position |
| up | Vertical vector by which the box will be aligned |
| color | Primary color |
| is_ab_diagonal | Set uses the diagonal between the corners or the diagonal between the centers of two edges |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_box_xf | ( | const Transform3D & | transform, |
| const Color & | color = Colors::empty_color, | ||
| const bool & | is_box_centered = true, | ||
| const real_t & | duration = 0 ) |
Draw a box as in DebugDraw3D.draw_box
| transform | Box transform |
| color | Primary color |
| is_box_centered | Set where the center of the box will be. In the center or in the bottom corner |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_aabb | ( | const AABB & | aabb, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a box as in DebugDraw3D.draw_box, but based on the AABB
| aabb | AABB |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_aabb_ab | ( | const Vector3 & | a, |
| const Vector3 & | b, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw the box as in DebugDraw3D.draw_aabb, but AABB is defined by the diagonal AB
| a | Start position |
| b | End position |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_line_hit | ( | const Vector3 & | start, |
| const Vector3 & | end, | ||
| const Vector3 & | hit, | ||
| const bool & | is_hit, | ||
| const real_t & | hit_size = 0.25f, | ||
| const Color & | hit_color = Colors::empty_color, | ||
| const Color & | after_hit_color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw line separated by hit point (billboard square) or not separated if is_hit = false.
Some of the default settings can be overridden in DebugDraw3DConfig.
| start | Start point |
| end | End point |
| hit | Hit point |
| is_hit | Whether to draw the collision point |
| hit_size | Size of the hit point |
| hit_color | Color of the hit point and line before hit |
| after_hit_color | Color of line after hit position |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_line_hit_offset | ( | const Vector3 & | start, |
| const Vector3 & | end, | ||
| const bool & | is_hit, | ||
| const real_t & | unit_offset_of_hit = 0.5f, | ||
| const real_t & | hit_size = 0.25f, | ||
| const Color & | hit_color = Colors::empty_color, | ||
| const Color & | after_hit_color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw line separated by hit point.
Similar to DebugDraw3D.draw_line_hit, but instead of a hit point, an offset from the start point is used.
Some of the default settings can be overridden in DebugDraw3DConfig.
| start | Start point |
| end | End point |
| is_hit | Whether to draw the collision point |
| unit_offset_of_hit | Unit offset on the line where the collision occurs |
| hit_size | Size of the hit point |
| hit_color | Color of the hit point and line before hit |
| after_hit_color | Color of line after hit position |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_line | ( | const Vector3 & | a, |
| const Vector3 & | b, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a single line
| a | Start point |
| b | End point |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_ray | ( | const Vector3 & | origin, |
| const Vector3 & | direction, | ||
| const real_t & | length, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a ray.
Same as DebugDraw3D.draw_line, but uses origin, direction and length instead of A and B.
| origin | Origin |
| direction | Direction |
| length | Length |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_lines | ( | const PackedVector3Array & | lines, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw an array of lines. Each line is two points, so the array must be of even size.
| lines | An array of points of lines. 1 line = 2 vectors3. The array size must be even. |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_line_path | ( | const PackedVector3Array & | path, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw an array of lines.
Unlike DebugDraw3D.draw_lines, here lines are drawn between each point in the array.
The array can be of any size.
| path | Sequence of points |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_arrowhead | ( | const Transform3D & | transform, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw the arrowhead
| transform | Transform3D of the Arrowhead |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_arrow | ( | const Vector3 & | a, |
| const Vector3 & | b, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | arrow_size = 0.5f, | ||
| const bool & | is_absolute_size = false, | ||
| const real_t & | duration = 0 ) |
Draw line with arrowhead
| a | Start point |
| b | End point |
| color | Primary color |
| arrow_size | Size of the arrow |
| is_absolute_size | Is arrow_size absolute or relative to the length of the string? |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_arrow_ray | ( | const Vector3 & | origin, |
| const Vector3 & | direction, | ||
| const real_t & | length, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | arrow_size = 0.5f, | ||
| const bool & | is_absolute_size = false, | ||
| const real_t & | duration = 0 ) |
Same as DebugDraw3D.draw_arrow, but uses origin, direction and length instead of A and B.
| origin | Origin |
| direction | Direction |
| length | Length |
| color | Primary color |
| arrow_size | Size of the arrow |
| is_absolute_size | Is arrow_size absolute or relative to the line length? |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_arrow_path | ( | const PackedVector3Array & | path, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | arrow_size = 0.75f, | ||
| const bool & | is_absolute_size = true, | ||
| const real_t & | duration = 0 ) |
Draw a sequence of points connected by lines with arrows like DebugDraw3D.draw_line_path.
| path | Sequence of points |
| color | Primary color |
| arrow_size | Size of the arrow |
| is_absolute_size | Is the arrow_size absolute or relative to the length of the line? |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_point_path | ( | const PackedVector3Array & | path, |
| const PointType | type = PointType::POINT_TYPE_SQUARE, | ||
| const real_t & | size = 0.25f, | ||
| const Color & | points_color = Colors::empty_color, | ||
| const Color & | lines_color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a sequence of points connected by lines using billboard squares or spheres like DebugDraw3D.draw_line_path.
| path | Sequence of points |
| type | Type of points |
| points_color | Color of points |
| lines_color | Color of lines |
| size | Size of squares |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_points | ( | const PackedVector3Array & | points, |
| const PointType | type = PointType::POINT_TYPE_SQUARE, | ||
| const real_t & | size = 0.25f, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a sequence of points using billboard squares or spheres.
| points | Sequence of points |
| type | Type of points |
| size | Size of squares |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_square | ( | const Vector3 & | position, |
| const real_t & | size = 0.2f, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw a square that will always be turned towards the camera
| position | Center position of square |
| size | Square size |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_plane | ( | const Plane & | plane, |
| const Color & | color = Colors::empty_color, | ||
| const Vector3 & | anchor_point = Vector3(INFINITY, INFINITY, INFINITY), | ||
| const real_t & | duration = 0 ) |
Draws a plane of non-infinite size relative to the position of the current camera.
The plane size is set based on the Far parameter of the current camera or with DebugDraw3DScopeConfig.set_plane_size.
| plane | Plane data |
| color | Primary color |
| anchor_point | A point that is projected onto a Plane, and its projection is used as the center of the drawn plane |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_position | ( | const Transform3D & | transform, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw 3 intersecting lines with the given transformations
| transform | Transform3D of lines |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_gizmo | ( | const Transform3D & | transform, |
| const Color & | color = Colors::empty_color, | ||
| const bool & | is_centered = false, | ||
| const real_t & | duration = 0 ) |
Draw 3 lines with the given transformations and arrows at the ends
| transform | Transform3D of lines |
| color | Primary color |
| is_centered | If true, then the lines will intersect in the center of the transform |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_grid | ( | const Vector3 & | origin, |
| const Vector3 & | x_size, | ||
| const Vector3 & | y_size, | ||
| const Vector2i & | subdivision, | ||
| const Color & | color = Colors::empty_color, | ||
| const bool & | is_centered = true, | ||
| const real_t & | duration = 0 ) |
Draw simple grid with given size and subdivision
| origin | Grid origin |
| x_size | Direction and size of the X side. As an axis in the Basis. |
| y_size | Direction and size of the Y side. As an axis in the Basis. |
| subdivision | Number of cells for the X and Y axes |
| color | Primary color |
| is_centered | Draw lines relative to origin |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_grid_xf | ( | const Transform3D & | transform, |
| const Vector2i & | p_subdivision, | ||
| const Color & | color = Colors::empty_color, | ||
| const bool & | is_centered = true, | ||
| const real_t & | duration = 0 ) |
Draw a simple grid with a given transform and subdivision.
Like DebugDraw3D.draw_grid, but instead of origin, x_size and y_size, a single transform is used.
| transform | Transform3D of the Grid |
| p_subdivision | Number of cells for the X and Y axes |
| color | Primary color |
| is_centered | Draw lines relative to origin |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_camera_frustum | ( | const class godot::Camera3D * | camera, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw camera frustum area.
| camera | Camera node |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_camera_frustum_planes | ( | const Array & | camera_frustum, |
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw the frustum area of the camera based on an array of 6 planes.
| camera_frustum | Array of frustum planes |
| color | Primary color |
| duration | The duration of how long the object will be visible |
| void DebugDraw3D::draw_text | ( | const Vector3 & | position, |
| const String | text, | ||
| const int | size = 32, | ||
| const Color & | color = Colors::empty_color, | ||
| const real_t & | duration = 0 ) |
Draw text using Label3D.
| position | Center position of Label |
| text | Label's text |
| size | Font size |
| color | Primary color |
| duration | The duration of how long the object will be visible |