-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added documentation pages Introduction and Examples.
- Loading branch information
1 parent
8580817
commit de997c0
Showing
52 changed files
with
317 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Examples | ||
|
||
More examples can be found in the `examples_dd3d/` folder. | ||
|
||
Simple test: | ||
|
||
```python | ||
func _process(delta: float) -> void: | ||
var _time = Time.get_ticks_msec() / 1000.0 | ||
var box_pos = Vector3(0, sin(_time * 4), 0) | ||
var line_begin = Vector3(-1, sin(_time * 4), 0) | ||
var line_end = Vector3(1, cos(_time * 4), 0) | ||
|
||
DebugDraw3D.draw_box(box_pos, Vector3(1, 2, 1), Color(0, 1, 0)) | ||
DebugDraw3D.draw_line(line_begin, line_end, Color(1, 1, 0)) | ||
DebugDraw2D.set_text("Time", _time) | ||
DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn()) | ||
DebugDraw2D.set_text("FPS", Engine.get_frames_per_second()) | ||
DebugDraw2D.set_text("delta", delta) | ||
``` | ||
|
||
## CSharp | ||
|
||
When you start the engine for the first time, bindings for `C#` will be generated automatically. If this does not happen, you can manually generate them through the `Project - Tools - Debug Draw` menu. | ||
|
||
![](/images/project_tools_menu.png) | ||
|
||
```csharp | ||
public override void _Process(float delta) | ||
{ | ||
var _time = Time.GetTicksMsec() / 1000.0f; | ||
var box_pos = new Vector3(0, Mathf.Sin(_time * 4f), 0); | ||
var line_begin = new Vector3(-1, Mathf.Sin(_time * 4f), 0); | ||
var line_end = new Vector3(1, Mathf.Cos(_time * 4f), 0); | ||
|
||
DebugDraw3D.DrawBox(box_pos, new Vector3(1, 2, 1), new Color(0, 1, 0)); | ||
DebugDraw3D.DrawLine(line_begin, line_end, new Color(1, 1, 0)); | ||
DebugDraw2D.SetText("Time", _time); | ||
DebugDraw2D.SetText("Frames drawn", Engine.GetFramesDrawn()); | ||
DebugDraw2D.SetText("FPS", Engine.GetFramesPerSecond()); | ||
DebugDraw2D.SetText("delta", delta); | ||
} | ||
``` | ||
|
||
@warning | ||
C# bindings work using ClassDB, which greatly decreases its performance and it can run slower than GDScript. There is currently no way to fix this. | ||
|
||
## Aliases | ||
|
||
If you don't want to write `DebugDraw3D`/`DebugDraw2D` every time, so you can use aliases for these singletons. | ||
|
||
```python | ||
var _s = Dbg3.new_scope_config().set_thickness(0.025).set_center_brightness(0.7) | ||
Dbg3.draw_grid_xf(%Grid.global_transform, Vector2i(10,10), Color.LIGHT_GRAY) | ||
Dbg2.set_text("Frametime", delta) | ||
``` | ||
|
||
There is more information in the description of DebugDrawManager. | ||
|
||
## Scope configs | ||
|
||
When using DebugDraw3D, you will probably want to use the scope configurations DebugDraw3DScopeConfig. With this class you will be able to change the thickness of the geometry, the brightness of the volumetric shapes, the density of the sphere mesh and possibly other parameters in the future. | ||
|
||
![](images/classes/LineThickness.webp) | ||
|
||
## Project Settings | ||
|
||
You can also explore other project settings in `debug_draw_3d/settings`. | ||
|
||
![](images/project_settings.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Introduction | ||
|
||
This is an add-on for debug drawing in 3D and for some 2D overlays, which is written in `C++` and can be used with `GDScript` or `C#`. | ||
|
||
## Screenshots | ||
|
||
`DebugDrawDemoScene.tscn` in editor | ||
![screenshot_2](/images/screenshot_2.png) | ||
|
||
`DebugDrawDemoScene.tscn` in play mode | ||
![screenshot_3](/images/screenshot_3.png) | ||
|
||
## Features | ||
|
||
3D: | ||
|
||
* Arrow | ||
* Billboard opaque square | ||
* Box | ||
* Camera Frustum | ||
* Cylinder | ||
* Gizmo | ||
* Grid | ||
* Line | ||
* Line Path | ||
* Line with Arrow | ||
* Points | ||
* Position 3D (3 crossing axes) | ||
* Sphere | ||
|
||
2D: | ||
|
||
* **[Work in progress]** | ||
|
||
Overlay: | ||
|
||
* Text (with grouping and coloring) | ||
* FPS Graph | ||
* Custom Graphs | ||
|
||
Precompiled for: | ||
|
||
* Windows | ||
* Linux | ||
* macOS | ||
* Android | ||
* Web (WebAssembly) | ||
|
||
## Download | ||
|
||
To download, use the [Godot Asset Library](https://godotengine.org/asset-library/asset/1766) or download the archive from the [GithHub](https://github.com/DmitriySalnikov/godot_debug_draw_3d) page by clicking the button at the top of the repository page: `Code -> Download ZIP`, then unzip it to your project folder. Or use one of the stable versions from the [GitHub Releases](https://github.com/DmitriySalnikov/godot_debug_draw_3d/releases) page (just download one of the `Source Codes` in assets). | ||
|
||
* Close editor | ||
* Copy `addons/debug_draw_3d` to your `addons` folder, create it if the folder doesn't exist | ||
* Launch editor | ||
|
||
## Support me | ||
|
||
Your support adds motivation to develop my public projects. | ||
|
||
<a href="https://boosty.to/dmitriysalnikov/donate"><img src="https://static.boosty.to/assets/images/boostyDomainLogo.5Vlxt.svg" alt="Boosty" width=120px/></a> | ||
|
||
## Next step | ||
|
||
[Examples](Examples.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.