diff --git a/game/addons/debug_draw_3d/LICENSE b/game/addons/debug_draw_3d/LICENSE index 617a15b..8bfc8dd 100644 --- a/game/addons/debug_draw_3d/LICENSE +++ b/game/addons/debug_draw_3d/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 DmitriySalnikov +Copyright (c) 2026 DmitriySalnikov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal diff --git a/game/addons/debug_draw_3d/README.md b/game/addons/debug_draw_3d/README.md index 3cd3961..9c6ce4c 100644 --- a/game/addons/debug_draw_3d/README.md +++ b/game/addons/debug_draw_3d/README.md @@ -2,7 +2,7 @@ # Debug drawing utility for Godot -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#`. +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`, `C++` or `C#`. Based on my previous addon, which was developed [only for C#](https://github.com/DmitriySalnikov/godot_debug_draw_cs), and which was inspired by [Zylann's GDScript addon](https://github.com/Zylann/godot_debug_draw) @@ -28,6 +28,7 @@ Your support adds motivation to develop my public projects. * Billboard opaque square * Box * Camera Frustum +* Capsule * Cylinder * Gizmo * Grid @@ -40,10 +41,6 @@ Your support adds motivation to develop my public projects. * Sphere * 3D Text -2D: - -* **[Work in progress]** - Overlay: * Text (with grouping and coloring) @@ -57,10 +54,11 @@ Precompiled for: * iOS * Web (Firefox is supported by Godot 4.3+) -This addon supports working with several World3D and different Viewports. +This addon supports working with several World3D and different Viewports. [More information](https://dd3d.dmitriysalnikov.ru/docs/?page=md_docs_2SubViewports.html). + There is also a no depth test mode and other settings that can be changed for each instance. -This library supports double-precision builds, for more information, [see the documentation](https://dd3d.dmitriysalnikov.ru/docs/?page=md_docs_2DoublePrecision.html). +This addon supports double-precision builds, for more information, [see the documentation](https://dd3d.dmitriysalnikov.ru/docs/?page=md_docs_2DoublePrecision.html). ## [Interactive Web Demo](https://dd3d.dmitriysalnikov.ru/demo/) @@ -148,10 +146,18 @@ The entire text overlay can only be placed in one corner. [Frustum of Camera3D does not take into account the window size from ProjectSettings](https://github.com/godotengine/godot/issues/70362). +## Usage Analytics + +This addon collects anonymous statistics on **editor** usage time. The data includes the library version, engine version, operating system, system architecture, and locale. No personally identifiable information is gathered. + +Libraries without **editor** support do not collect statistics in any way. Also, previews running in the editor do not collect any usage statistics. + +You can disable this in the editor settings at: `debug_draw_3d/settings/telemetry_state`. + ## More screenshots -`DebugDrawDemoScene.tscn` in editor +`DD3DDemo.tscn` in editor ![screenshot_2](/images/screenshot_2.png) -`DebugDrawDemoScene.tscn` in play mode +`DD3DDemo.tscn` in play mode ![screenshot_3](/images/screenshot_3.png) diff --git a/game/addons/debug_draw_3d/debug_draw_3d.gdextension b/game/addons/debug_draw_3d/debug_draw_3d.gdextension index cead527..ea0c157 100644 --- a/game/addons/debug_draw_3d/debug_draw_3d.gdextension +++ b/game/addons/debug_draw_3d/debug_draw_3d.gdextension @@ -1,7 +1,7 @@ [configuration] entry_symbol = "debug_draw_3d_library_init" -compatibility_minimum = "4.2.2" +compatibility_minimum = "4.4.1" reloadable = false [dependencies] @@ -13,6 +13,7 @@ reloadable = false macos = { } windows.x86_64 = { } linux.x86_64 = { } +linux.arm64 = { } ; by default godot is using threads web.wasm32.nothreads = {} @@ -31,6 +32,7 @@ ios = {} macos.template_release = { } windows.template_release.x86_64 = { } linux.template_release.x86_64 = { } +linux.template_release.arm64 = { } web.template_release.wasm32.nothreads = { } web.template_release.wasm32 = { } @@ -48,6 +50,7 @@ ios.template_release = {} macos.template_release.forced_dd3d = { } windows.template_release.x86_64.forced_dd3d = { } linux.template_release.x86_64.forced_dd3d = { } +linux.template_release.arm64.forced_dd3d = { } web.template_release.wasm32.nothreads.forced_dd3d = { } web.template_release.wasm32.forced_dd3d = { } @@ -62,6 +65,7 @@ ios.template_release.forced_dd3d = {} macos = "libs/libdd3d.macos.editor.universal.framework" windows.x86_64 = "libs/libdd3d.windows.editor.x86_64.dll" linux.x86_64 = "libs/libdd3d.linux.editor.x86_64.so" +linux.arm64 = "libs/libdd3d.linux.editor.arm64.so" web.wasm32.nothreads = "libs/libdd3d.web.template_debug.wasm32.wasm" web.wasm32 = "libs/libdd3d.web.template_debug.wasm32.threads.wasm" @@ -79,6 +83,7 @@ ios = "libs/libdd3d.ios.template_debug.universal.dylib" macos.template_release = "libs/libdd3d.macos.template_release.universal.framework" windows.template_release.x86_64 = "libs/libdd3d.windows.template_release.x86_64.dll" linux.template_release.x86_64 = "libs/libdd3d.linux.template_release.x86_64.so" +linux.template_release.arm64 = "libs/libdd3d.linux.template_release.arm64.so" web.template_release.wasm32.nothreads = "libs/libdd3d.web.template_release.wasm32.wasm" web.template_release.wasm32 = "libs/libdd3d.web.template_release.wasm32.threads.wasm" @@ -96,6 +101,7 @@ ios.template_release = "libs/libdd3d.ios.template_release.universal.dylib" macos.template_release.forced_dd3d = "libs/libdd3d.macos.template_release.universal.enabled.framework" windows.template_release.x86_64.forced_dd3d = "libs/libdd3d.windows.template_release.x86_64.enabled.dll" linux.template_release.x86_64.forced_dd3d = "libs/libdd3d.linux.template_release.x86_64.enabled.so" +linux.template_release.arm64.forced_dd3d = "libs/libdd3d.linux.template_release.arm64.enabled.so" web.template_release.wasm32.nothreads.forced_dd3d = "libs/libdd3d.web.template_release.wasm32.enabled.wasm" web.template_release.wasm32.forced_dd3d = "libs/libdd3d.web.template_release.wasm32.threads.enabled.wasm" @@ -112,6 +118,7 @@ ios.template_release.forced_dd3d = "libs/libdd3d.ios.template_release.universal. macos.double = "libs/libdd3d.macos.editor.universal.double.framework" windows.x86_64.double = "libs/libdd3d.windows.editor.x86_64.double.dll" linux.x86_64.double = "libs/libdd3d.linux.editor.x86_64.double.so" +linux.arm64.double = "libs/libdd3d.linux.editor.arm64.double.so" web.wasm32.nothreads.double = "libs/libdd3d.web.template_debug.wasm32.double.wasm" web.wasm32.double = "libs/libdd3d.web.template_debug.wasm32.threads.double.wasm" @@ -121,7 +128,7 @@ android.arm64.double = "libs/libdd3d.android.template_debug.arm64.double.so" android.x86_32.double = "libs/libdd3d.android.template_debug.x86_32.double.so" android.x86_64.double = "libs/libdd3d.android.template_debug.x86_64.double.so" -ios.double = "libs/libdd3d.ios.template_debug.universal.dylib" +ios.double = "libs/libdd3d.ios.template_debug.universal.double.dylib" ; ------------------------------------- ; release no debug draw @@ -129,6 +136,7 @@ ios.double = "libs/libdd3d.ios.template_debug.universal.dylib" macos.template_release.double = "libs/libdd3d.macos.template_release.universal.double.framework" windows.template_release.x86_64.double = "libs/libdd3d.windows.template_release.x86_64.double.dll" linux.template_release.x86_64.double = "libs/libdd3d.linux.template_release.x86_64.double.so" +linux.template_release.arm64.double = "libs/libdd3d.linux.template_release.arm64.double.so" web.template_release.wasm32.nothreads.double = "libs/libdd3d.web.template_release.wasm32.double.wasm" web.template_release.wasm32.double = "libs/libdd3d.web.template_release.wasm32.threads.double.wasm" @@ -146,6 +154,7 @@ ios.template_release.double = "libs/libdd3d.ios.template_release.universal.doubl macos.template_release.forced_dd3d.double = "libs/libdd3d.macos.template_release.universal.enabled.double.framework" windows.template_release.x86_64.forced_dd3d.double = "libs/libdd3d.windows.template_release.x86_64.enabled.double.dll" linux.template_release.x86_64.forced_dd3d.double = "libs/libdd3d.linux.template_release.x86_64.enabled.double.so" +linux.template_release.arm64.forced_dd3d.double = "libs/libdd3d.linux.template_release.arm64.enabled.double.so" web.template_release.wasm32.nothreads.forced_dd3d.double = "libs/libdd3d.web.template_release.wasm32.enabled.double.wasm" web.template_release.wasm32.forced_dd3d.double = "libs/libdd3d.web.template_release.wasm32.threads.enabled.double.wasm" diff --git a/game/addons/debug_draw_3d/libs/.gitignore b/game/addons/debug_draw_3d/libs/.gitignore new file mode 100644 index 0000000..6ad212f --- /dev/null +++ b/game/addons/debug_draw_3d/libs/.gitignore @@ -0,0 +1,3 @@ +# Temporary editor files +~*.dll +~*.TMP \ No newline at end of file diff --git a/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so b/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so index 736dbf6..3239358 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so and b/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so b/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so index 988a651..b52c261 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so and b/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so b/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so index 1649efd..ed0ae83 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so and b/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so b/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so index 67f74fe..231cf9a 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so and b/game/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so b/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so index 63cce77..eb4e812 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so and b/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so b/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so index 5f40036..ee23e80 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so and b/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so b/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so index 6668ae3..8bc3e64 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so and b/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so b/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so index 9ff227f..cf86894 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so and b/game/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib b/game/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib index 0d23bf4..96f9b4b 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib and b/game/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib b/game/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib index 7784065..8145a35 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib and b/game/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib b/game/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib index b634723..63eb961 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib and b/game/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.linux.editor.arm64.so b/game/addons/debug_draw_3d/libs/libdd3d.linux.editor.arm64.so new file mode 100644 index 0000000..682182c Binary files /dev/null and b/game/addons/debug_draw_3d/libs/libdd3d.linux.editor.arm64.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so b/game/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so index a58e48c..bce1492 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so and b/game/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.enabled.so b/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.enabled.so new file mode 100644 index 0000000..3450918 Binary files /dev/null and b/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.enabled.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.so b/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.so new file mode 100644 index 0000000..bd3c935 Binary files /dev/null and b/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so b/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so index fdd0816..bb1bd8c 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so and b/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so b/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so index 708b16c..0f66f8b 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so and b/game/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist b/game/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist index 933a7f8..cf1d97d 100644 --- a/game/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist +++ b/game/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist @@ -17,9 +17,9 @@ NSHumanReadableCopyright Copyright (c) Dmitriy Salnikov. CFBundleVersion - 1.5.1 + 1.7.3 CFBundleShortVersionString - 1.5.1 + 1.7.3 CFBundlePackageType FMWK CSResourcesFileMapped diff --git a/game/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal.dylib b/game/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal.dylib index e15b931..148a2f3 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal.dylib and b/game/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal.dylib differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist b/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist index 33bf631..536e25e 100644 --- a/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist +++ b/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist @@ -17,9 +17,9 @@ NSHumanReadableCopyright Copyright (c) Dmitriy Salnikov. CFBundleVersion - 1.5.1 + 1.7.3 CFBundleShortVersionString - 1.5.1 + 1.7.3 CFBundlePackageType FMWK CSResourcesFileMapped diff --git a/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled.dylib b/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled.dylib index 0955618..b9ac1d5 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled.dylib and b/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled.dylib differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist b/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist index 0b36e0b..57716eb 100644 --- a/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist +++ b/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist @@ -17,9 +17,9 @@ NSHumanReadableCopyright Copyright (c) Dmitriy Salnikov. CFBundleVersion - 1.5.1 + 1.7.3 CFBundleShortVersionString - 1.5.1 + 1.7.3 CFBundlePackageType FMWK CSResourcesFileMapped diff --git a/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal.dylib b/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal.dylib index 83d014e..f53c5be 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal.dylib and b/game/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal.dylib differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.threads.wasm b/game/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.threads.wasm index 33fe474..597645b 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.threads.wasm and b/game/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.threads.wasm differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm b/game/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm index a27ea99..520a06e 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm and b/game/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm b/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm index a8445e3..9710164 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm and b/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.enabled.wasm b/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.enabled.wasm index c90fb24..5ac780c 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.enabled.wasm and b/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.enabled.wasm differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.wasm b/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.wasm index 4ee4c42..ec8eadc 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.wasm and b/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.wasm differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm b/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm index b5e7a64..593990b 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm and b/game/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll b/game/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll index e733469..9abcf5d 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll and b/game/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll b/game/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll index 37889ff..17dc600 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll and b/game/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll differ diff --git a/game/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll b/game/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll index 8a04f8b..ee21ae1 100644 Binary files a/game/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll and b/game/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll differ diff --git a/game/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll b/game/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll index e733469..9abcf5d 100644 Binary files a/game/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll and b/game/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll differ diff --git a/game/addons/debug_draw_3d/native_api/cpp/dd3d_cpp_api.hpp b/game/addons/debug_draw_3d/native_api/cpp/dd3d_cpp_api.hpp new file mode 100644 index 0000000..bf83474 --- /dev/null +++ b/game/addons/debug_draw_3d/native_api/cpp/dd3d_cpp_api.hpp @@ -0,0 +1,2619 @@ +#pragma once + +// This file is generated! +// +// To create new instances of Ref, where T is the DD3D class, use std::make_shared, e.g.: +// auto cfg = std::make_shared(); +// +// Functions with strings and arrays also have an additional "_c" version of functions for native arrays. +// The "_c" version only accepts `utf8` strings. +// +// Define DD3D_ENABLE_MISMATCH_CHECKS to enable signature mismatch checking +// +// Define FORCED_DD3D to ignore the lack of DEBUG_ENABLED. + +//#define DD3D_ENABLE_MISMATCH_CHECKS +//#define FORCED_DD3D + +#if defined(DEBUG_ENABLED) || defined(FORCED_DD3D) +#define _DD3D_RUNTIME_CHECK_ENABLED +#endif + +#include + +#if _MSC_VER +__pragma(warning(disable : 4244 26451 26495)); +#endif +#include +#include +#include +#include +#include +#include +#include +#if _MSC_VER +__pragma(warning(default : 4244 26451 26495)); +#endif + +#ifndef ZoneScoped +#define _NoProfiler +#define ZoneScoped +#endif + + +#ifdef DD3D_ENABLE_MISMATCH_CHECKS +#include +#include +#include +#endif + +namespace DD3DShared { + +#ifdef DD3D_ENABLE_MISMATCH_CHECKS +template +struct FunctionSignature; + +template +struct FunctionSignature { + static godot::String get() { + std::ostringstream oss; + oss << typeid(R).name() << " ("; + ((oss << getTypeName() << ", "), ...); + return godot::String(oss.str().c_str()).trim_suffix(", ") + ")"; + } + +private: + template + static std::string getTypeName() { + std::ostringstream oss; + if constexpr (std::is_const::value) { + oss << "const "; + } + if constexpr (std::is_reference::value) { + oss << getTypeName>() << "&"; + } else { + oss << typeid(U).name(); + } + return oss.str(); + } +}; +#endif + +struct CQuaternion { + real_t x = 0.0; + real_t y = 0.0; + real_t z = 0.0; + real_t w = 1.0; + + _FORCE_INLINE_ operator godot::Quaternion() const { + return godot::Quaternion(x, y, z, w); + } + + CQuaternion(const godot::Quaternion &q) : + x(q.x), y(q.y), z(q.z), w(q.w) { + } +}; + +struct CProjection { + godot::Vector4 columns[4]; + + _FORCE_INLINE_ operator godot::Projection() const { + return godot::Projection(columns[0], columns[1], columns[2], columns[3]); + } + + CProjection(const godot::Projection &p) { + columns[0] = p[0]; + columns[1] = p[1]; + columns[2] = p[2]; + columns[3] = p[3]; + } +}; + +} // namespace DD3DShared + + +struct _DD3D_Loader_ { + static constexpr const char *log_prefix = "[DD3D C++] "; + static constexpr const char *get_funcs_is_double_name = "_get_native_functions_is_double"; + static constexpr const char *get_funcs_hash_name = "_get_native_functions_hash"; + static constexpr const char *get_funcs_name = "_get_native_functions"; + + enum class LoadingResult { + None, + Success, + Failure + }; + + static godot::Object *get_dd3d() { + ZoneScoped; + + static godot::Object *dd3d_c = nullptr; + static bool failed_to_load = false; + + if (failed_to_load) + return nullptr; + + if (dd3d_c) + return dd3d_c; + + if (godot::Engine::get_singleton()->has_singleton("DebugDrawManager")) { + godot::Object *dd3d = godot::Engine::get_singleton()->get_singleton("DebugDrawManager"); + + if (!dd3d->has_method(get_funcs_is_double_name)) { + godot::UtilityFunctions::printerr(log_prefix, get_funcs_is_double_name, " not found!"); + failed_to_load = true; + return nullptr; + } + +#ifdef REAL_T_IS_DOUBLE + bool is_double = true; +#else + bool is_double = false; +#endif + if ((bool)dd3d->call(get_funcs_is_double_name) != is_double) { + godot::UtilityFunctions::printerr(log_prefix, "The precision of Vectors and Matrices of DD3D and the current library do not match!"); + failed_to_load = true; + return nullptr; + } + + if (!dd3d->has_method(get_funcs_hash_name)) { + godot::UtilityFunctions::printerr(log_prefix, get_funcs_hash_name, " not found!"); + failed_to_load = true; + return nullptr; + } + + if (!dd3d->has_method(get_funcs_name)) { + godot::UtilityFunctions::printerr(log_prefix, get_funcs_name, " not found!"); + failed_to_load = true; + return nullptr; + } + + dd3d_c = dd3d; + } else { + ERR_PRINT(godot::String(log_prefix) + "DebugDrawManager not found! Most likely, DebugDraw3D was not loaded correctly."); + failed_to_load = true; + } + return dd3d_c; + } + + static bool load_function(int64_t &val, const godot::String &sign2, const char *name) { + ZoneScoped; + if (godot::Object *dd3d = get_dd3d(); dd3d) { + int64_t api_hash = dd3d->call(get_funcs_hash_name); + + // TODO: add an actual comparison with the previous hash. It is useful in case of library reloading, but is it really useful for users?.. + if (api_hash != 0) { + godot::Dictionary api = dd3d->call(get_funcs_name); + if (api.has(name)) { + godot::Dictionary func_dict = api[name]; + +#ifdef DD3D_ENABLE_MISMATCH_CHECKS + godot::String sign1 = func_dict.get("signature", ""); + //godot::UtilityFunctions::print(log_prefix, "FUNCTION SIGNATURE\n\tFunc name:\t", name, "\n\tDD3D Sign:\t", sign1, "\n\tClient Sign:\t", sign2); + + if (!sign1.is_empty() && sign1 != sign2) { + godot::UtilityFunctions::printerr(log_prefix, "!!! FUNCTION SIGNATURE MISMATCH !!!\n\tFunc name:\t", name, "\n\tDD3D Sign:\t", sign1, "\n\tClient Sign:\t", sign2); + return false; + } +#endif + val = (int64_t)func_dict["ptr"]; + return true; + } else { + godot::UtilityFunctions::printerr(log_prefix, "!!! FUNCTION NOT FOUND !!! function name: ", name); + return false; + } + } + } + return false; + } +}; + +#ifdef DD3D_ENABLE_MISMATCH_CHECKS +#define FUNC_GET_SIGNATURE(func_name) DD3DShared::FunctionSignature::get() +#else +#define FUNC_GET_SIGNATURE(func_name) "" +#endif + +#define LOADING_RESULT static _DD3D_Loader_::LoadingResult _dd3d_loading_result = _DD3D_Loader_::LoadingResult::None +#define IS_FIRST_LOADING _dd3d_loading_result == _DD3D_Loader_::LoadingResult::None +#define IS_LOADED_SUCCESSFULLY _dd3d_loading_result == _DD3D_Loader_::LoadingResult::Success +#define IS_FAILED_TO_LOAD _dd3d_loading_result == _DD3D_Loader_::LoadingResult::Failure +#define LOAD_FUNC_AND_STORE_RESULT(_name) \ + int64_t _dd3d_func_ptr = 0; \ + _dd3d_loading_result = _DD3D_Loader_::load_function(_dd3d_func_ptr, FUNC_GET_SIGNATURE(_name), #_name) ? _DD3D_Loader_::LoadingResult::Success : _DD3D_Loader_::LoadingResult::Failure; \ + if (IS_LOADED_SUCCESSFULLY) { \ + _name = reinterpret_cast(_dd3d_func_ptr); \ + } + +#define LOAD_AND_CALL_FUNC_POINTER(_name, ...) \ + ZoneScoped; \ + LOADING_RESULT; \ + if (IS_FIRST_LOADING) { \ + LOAD_FUNC_AND_STORE_RESULT(_name); \ + if (IS_FAILED_TO_LOAD) { \ + return; \ + } \ + } \ + if (IS_LOADED_SUCCESSFULLY) { \ + _name(__VA_ARGS__); \ + } + +#define LOAD_AND_CALL_FUNC_POINTER_SELFRET(_name, ...) \ + ZoneScoped; \ + LOADING_RESULT; \ + if (IS_FIRST_LOADING) { \ + LOAD_FUNC_AND_STORE_RESULT(_name); \ + if (IS_FAILED_TO_LOAD) { \ + return shared_from_this(); \ + } \ + } \ + if (IS_LOADED_SUCCESSFULLY) { \ + _name(__VA_ARGS__); \ + } + +#define LOAD_AND_CALL_FUNC_POINTER_RET(_name, _def_ret_val, ...) \ + ZoneScoped; \ + LOADING_RESULT; \ + if (IS_FIRST_LOADING) { \ + LOAD_FUNC_AND_STORE_RESULT(_name); \ + if (IS_FAILED_TO_LOAD) { \ + return _def_ret_val; \ + } \ + } \ + if (IS_LOADED_SUCCESSFULLY) { \ + return _name(__VA_ARGS__); \ + } \ + return _def_ret_val + +#define LOAD_AND_CALL_FUNC_POINTER_RET_CAST(_name, _ret_cast, _def_ret_val, ...) \ + ZoneScoped; \ + LOADING_RESULT; \ + if (IS_FIRST_LOADING) { \ + LOAD_FUNC_AND_STORE_RESULT(_name); \ + if (IS_FAILED_TO_LOAD) { \ + return _def_ret_val; \ + } \ + } \ + if (IS_LOADED_SUCCESSFULLY) { \ + return static_cast<_ret_cast>(_name(__VA_ARGS__)); \ + } \ + return _def_ret_val + +#define LOAD_AND_CALL_FUNC_POINTER_RET_GODOT_OBJECT(_name, godot_object_type, _def_ret_val, ...) \ + ZoneScoped; \ + LOADING_RESULT; \ + if (IS_FIRST_LOADING) { \ + LOAD_FUNC_AND_STORE_RESULT(_name); \ + if (IS_FAILED_TO_LOAD) { \ + return _def_ret_val; \ + } \ + } \ + if (IS_LOADED_SUCCESSFULLY) { \ + return godot::Object::cast_to(godot::ObjectDB::get_instance(_name(__VA_ARGS__))); \ + } \ + return _def_ret_val + +#define LOAD_AND_CALL_FUNC_POINTER_RET_GODOT_REF(_name, godot_ref_type, _def_ret_val, ...) \ + ZoneScoped; \ + LOADING_RESULT; \ + if (IS_FIRST_LOADING) { \ + LOAD_FUNC_AND_STORE_RESULT(_name); \ + if (IS_FAILED_TO_LOAD) { \ + return _def_ret_val; \ + } \ + } \ + if (IS_LOADED_SUCCESSFULLY) { \ + return godot::Ref(godot::Object::cast_to(godot::ObjectDB::get_instance(_name(__VA_ARGS__)))); \ + } \ + return _def_ret_val + +#define LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED(_name, _cls, _def_ret_val, ...) \ + ZoneScoped; \ + LOADING_RESULT; \ + if (IS_FIRST_LOADING && !_name) { \ + LOAD_FUNC_AND_STORE_RESULT(_name); \ + if (IS_FAILED_TO_LOAD) { \ + return _def_ret_val; \ + } \ + } \ + if (IS_LOADED_SUCCESSFULLY) { \ + return std::make_shared<_cls>(_name(__VA_ARGS__)); \ + } \ + return _def_ret_val + +class DebugDraw2DConfig; +class DebugDraw2DStats; +class DebugDraw3DConfig; +class DebugDraw3DScopeConfig; +class DebugDraw3DStats; + +// Start of the generated API +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +// Original type - godot::Quaternion +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +// Original type - godot::Projection +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + +static_assert(std::is_standard_layout_v); +static_assert(std::is_trivially_copyable_v); + + +/** + * @brief + * This is a class for storing part of the DebugDraw2D configuration. + * + * You can use DebugDraw2D.get_config to get the current instance of the configuration. + */ +class DebugDraw2DConfig { +public: + enum BlockPosition : uint32_t { + POSITION_LEFT_TOP = 0, + POSITION_RIGHT_TOP = 1, + POSITION_LEFT_BOTTOM = 2, + POSITION_RIGHT_BOTTOM = 3, + }; + +private: + void *inst_ptr; + +public: + DebugDraw2DConfig(void *inst_ptr) : + inst_ptr(inst_ptr) {} + + DebugDraw2DConfig(bool instantiate = true) : + inst_ptr(instantiate ? create() : create_nullptr()) {} + + ~DebugDraw2DConfig() { destroy(inst_ptr); } + + operator void *() const { return inst_ptr; } + + /** + * Position of the text block + */ + void set_text_block_position(const DebugDraw2DConfig::BlockPosition &_position) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DConfig_set_text_block_position)(void * /*inst_ptr*/, uint32_t /*DebugDraw2DConfig::BlockPosition _position*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_set_text_block_position, inst_ptr, static_cast(_position)); +#endif + } + + DebugDraw2DConfig::BlockPosition get_text_block_position() { + static uint32_t /*DebugDraw2DConfig::BlockPosition*/ (*DebugDraw2DConfig_get_text_block_position)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_CAST(DebugDraw2DConfig_get_text_block_position, DebugDraw2DConfig::BlockPosition, {}, inst_ptr); + } + + /** + * Offset from the corner selected in 'set_text_block_position' + */ + void set_text_block_offset(const godot::Vector2i &_offset) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DConfig_set_text_block_offset)(void * /*inst_ptr*/, const godot::Vector2i /*_offset*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_set_text_block_offset, inst_ptr, _offset); +#endif + } + + godot::Vector2i get_text_block_offset() { + static godot::Vector2i (*DebugDraw2DConfig_get_text_block_offset)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DConfig_get_text_block_offset, {}, inst_ptr); + } + + /** + * Text padding for each line + */ + void set_text_padding(const godot::Vector2i &_padding) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DConfig_set_text_padding)(void * /*inst_ptr*/, const godot::Vector2i /*_padding*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_set_text_padding, inst_ptr, _padding); +#endif + } + + godot::Vector2i get_text_padding() { + static godot::Vector2i (*DebugDraw2DConfig_get_text_padding)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DConfig_get_text_padding, {}, inst_ptr); + } + + /** + * How long the text remains visible after creation. + */ + void set_text_default_duration(const real_t &_duration) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DConfig_set_text_default_duration)(void * /*inst_ptr*/, const real_t /*_duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_set_text_default_duration, inst_ptr, _duration); +#endif + } + + real_t get_text_default_duration() { + static real_t (*DebugDraw2DConfig_get_text_default_duration)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DConfig_get_text_default_duration, {}, inst_ptr); + } + + /** + * Default text size + */ + void set_text_default_size(const int &_size) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DConfig_set_text_default_size)(void * /*inst_ptr*/, const int /*_size*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_set_text_default_size, inst_ptr, _size); +#endif + } + + int get_text_default_size() { + static int (*DebugDraw2DConfig_get_text_default_size)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DConfig_get_text_default_size, {}, inst_ptr); + } + + /** + * Default color of the text + */ + void set_text_foreground_color(const godot::Color &_new_color) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DConfig_set_text_foreground_color)(void * /*inst_ptr*/, const godot::Color /*_new_color*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_set_text_foreground_color, inst_ptr, _new_color); +#endif + } + + godot::Color get_text_foreground_color() { + static godot::Color (*DebugDraw2DConfig_get_text_foreground_color)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DConfig_get_text_foreground_color, {}, inst_ptr); + } + + /** + * Background color of the text + */ + void set_text_background_color(const godot::Color &_new_color) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DConfig_set_text_background_color)(void * /*inst_ptr*/, const godot::Color /*_new_color*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_set_text_background_color, inst_ptr, _new_color); +#endif + } + + godot::Color get_text_background_color() { + static godot::Color (*DebugDraw2DConfig_get_text_background_color)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DConfig_get_text_background_color, {}, inst_ptr); + } + + /** + * Custom text Font + */ + void set_text_custom_font(const godot::Ref &_custom_font) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DConfig_set_text_custom_font)(void * /*inst_ptr*/, const uint64_t /*_custom_font*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_set_text_custom_font, inst_ptr, _custom_font.is_valid() ? _custom_font->get_instance_id() : 0); +#endif + } + + godot::Ref get_text_custom_font() { + static const uint64_t (*DebugDraw2DConfig_get_text_custom_font)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_GODOT_REF(DebugDraw2DConfig_get_text_custom_font, godot::Font, {}, inst_ptr); + } + +private: + static void * create() { + static void * (*DebugDraw2DConfig_create)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DConfig_create, nullptr); + } + + static void * create_nullptr() { + static void * (*DebugDraw2DConfig_create_nullptr)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DConfig_create_nullptr, nullptr); + } + + static void destroy(void * inst_ptr) { + static void (*DebugDraw2DConfig_destroy)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DConfig_destroy, inst_ptr); + } + +}; // class DebugDraw2DConfig + +/** + * @brief + * Singleton class for calling debugging 2D methods. + * + * Currently, this class supports drawing an overlay with text. + */ +namespace DebugDraw2D { +/** + * Set whether debug drawing works or not. + */ +static void set_debug_enabled(const bool &_state) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2D_set_debug_enabled)(const bool /*_state*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2D_set_debug_enabled, _state); +#endif +} + +static bool is_debug_enabled() { + static bool (*DebugDraw2D_is_debug_enabled)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2D_is_debug_enabled, {}); +} + +/** + * Set the configuration global for everything in DebugDraw2D. + */ +static void set_config(const std::shared_ptr &_cfg) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2D_set_config)(void * /*_cfg*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2D_set_config, *_cfg); +#endif +} + +/** + * Get the DebugDraw2DConfig. + */ +static std::shared_ptr get_config() { + static void * (*DebugDraw2D_get_config)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED(DebugDraw2D_get_config, DebugDraw2DConfig, nullptr); +} + +/** + * Set a custom Control to be used as the canvas for drawing the graphic. + * + * You can use any Control, even one that is in a different window. + */ +static void set_custom_canvas(const godot::Control * _canvas) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2D_set_custom_canvas)(const uint64_t /*godot::Control _canvas*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2D_set_custom_canvas, _canvas ? _canvas->get_instance_id() : 0); +#endif +} + +static godot::Control * get_custom_canvas() { + static const uint64_t (*DebugDraw2D_get_custom_canvas)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_GODOT_OBJECT(DebugDraw2D_get_custom_canvas, godot::Control, {}); +} + +/** + * Returns the DebugDraw2DStats instance with the current statistics. + * + * Some data can be delayed by 1 frame. + */ +static std::shared_ptr get_render_stats() { + static void * (*DebugDraw2D_get_render_stats)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED(DebugDraw2D_get_render_stats, DebugDraw2DStats, nullptr); +} + +/** + * Clear all 2D objects + */ +static void clear_all() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2D_clear_all)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2D_clear_all); +#endif +} + +/** + * Begin a text group to which all of the following text from DebugDraw2D.set_text will be added + * + * @param group_title Group title and ID + * @param group_priority Group priority based on which groups will be sorted from top to bottom. + * @param group_color Main color of the group + * @param show_title Whether to show the title + * @param title_size Title font size + * @param text_size Text font size + */ +static void begin_text_group_c(const char * group_title_string, const int &group_priority = 0, const godot::Color &group_color = godot::Color(0.96f, 0.96f, 0.96f, 1.0f), const bool &show_title = true, const int &title_size = -1, const int &text_size = -1) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2D_begin_text_group_c)(const char * /*group_title_string*/, int /*group_priority*/, godot::Color /*group_color*/, bool /*show_title*/, int /*title_size*/, int /*text_size*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2D_begin_text_group_c, group_title_string, group_priority, group_color, show_title, title_size, text_size); +#endif +} + +/** + * Begin a text group to which all of the following text from DebugDraw2D.set_text will be added + * + * @param group_title Group title and ID + * @param group_priority Group priority based on which groups will be sorted from top to bottom. + * @param group_color Main color of the group + * @param show_title Whether to show the title + * @param title_size Title font size + * @param text_size Text font size + */ +static void begin_text_group(const godot::String &group_title, const int &group_priority = 0, const godot::Color &group_color = godot::Color(0.96f, 0.96f, 0.96f, 1.0f), const bool &show_title = true, const int &title_size = -1, const int &text_size = -1) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + begin_text_group_c(group_title.utf8().ptr(), group_priority, group_color, show_title, title_size, text_size); +#endif +} + +/** + * Ends the text group. Should be called after DebugDraw2D.begin_text_group. + * + * If you need to create multiple groups, just call DebugDraw2D.begin_text_group again and this function at the end. + */ +static void end_text_group() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2D_end_text_group)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2D_end_text_group); +#endif +} + +/** + * Add or update text in an overlay + * + * @param key Left value if 'value' is set, otherwise the entire string is 'key' + * @param value Value of field + * @param priority Priority of this line. Lower value is higher position + * @param color_of_value Value color + * @param duration Expiration time + */ +static void set_text_c(const char * key_string, const char * value_string = "", const int &priority = 0, const godot::Color &color_of_value = godot::Color(0, 0, 0, 0), const real_t &duration = -1) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2D_set_text_c)(const char * /*key_string*/, const char * /*value_string*/, int /*priority*/, godot::Color /*color_of_value*/, real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2D_set_text_c, key_string, value_string, priority, color_of_value, duration); +#endif +} + +/** + * Add or update text in an overlay + * + * @param key Left value if 'value' is set, otherwise the entire string is 'key' + * @param value Value of field + * @param priority Priority of this line. Lower value is higher position + * @param color_of_value Value color + * @param duration Expiration time + */ +static void set_text(const godot::String &key, const godot::String &value = "", const int &priority = 0, const godot::Color &color_of_value = godot::Color(0, 0, 0, 0), const real_t &duration = -1) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + set_text_c(key.utf8().ptr(), value.utf8().ptr(), priority, color_of_value, duration); +#endif +} + +/** + * Clear all text + */ +static void clear_texts() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2D_clear_texts)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2D_clear_texts); +#endif +} + +} // namespace DebugDraw2D + +/** + * @brief + * You can get basic statistics about 2D rendering from this class. + * + * All names try to reflect what they mean. + * + * To get an instance of this class with current statistics, use DebugDraw2D.get_render_stats. + */ +class DebugDraw2DStats { +private: + void *inst_ptr; + +public: + DebugDraw2DStats(void *inst_ptr) : + inst_ptr(inst_ptr) {} + + DebugDraw2DStats(bool instantiate = true) : + inst_ptr(instantiate ? create() : create_nullptr()) {} + + ~DebugDraw2DStats() { destroy(inst_ptr); } + + operator void *() const { return inst_ptr; } + + int64_t get_overlay_text_groups() { + static int64_t (*DebugDraw2DStats_get_overlay_text_groups)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DStats_get_overlay_text_groups, {}, inst_ptr); + } + + void set_overlay_text_groups(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DStats_set_overlay_text_groups)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DStats_set_overlay_text_groups, inst_ptr, val); +#endif + } + + int64_t get_overlay_text_lines() { + static int64_t (*DebugDraw2DStats_get_overlay_text_lines)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DStats_get_overlay_text_lines, {}, inst_ptr); + } + + void set_overlay_text_lines(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw2DStats_set_overlay_text_lines)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DStats_set_overlay_text_lines, inst_ptr, val); +#endif + } + +private: + static void * create() { + static void * (*DebugDraw2DStats_create)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DStats_create, nullptr); + } + + static void * create_nullptr() { + static void * (*DebugDraw2DStats_create_nullptr)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw2DStats_create_nullptr, nullptr); + } + + static void destroy(void * inst_ptr) { + static void (*DebugDraw2DStats_destroy)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw2DStats_destroy, inst_ptr); + } + +}; // class DebugDraw2DStats + +/** + * @brief + * This is a class for storing part of the DebugDraw3D configuration. + * + * You can use DebugDraw3D.get_config to get the current instance of the configuration. + */ +class DebugDraw3DConfig { +public: + enum CullingMode : uint32_t { + FRUSTUM_DISABLED = 0, + FRUSTUM_ROUGH = 1, + FRUSTUM_PRECISE = 2, + }; + +private: + void *inst_ptr; + +public: + DebugDraw3DConfig(void *inst_ptr) : + inst_ptr(inst_ptr) {} + + DebugDraw3DConfig(bool instantiate = true) : + inst_ptr(instantiate ? create() : create_nullptr()) {} + + ~DebugDraw3DConfig() { destroy(inst_ptr); } + + operator void *() const { return inst_ptr; } + + /** + * Set whether debug 3D graphics rendering is frozen. + * This means that previously created geometry will not be updated until set to false or until DebugDraw3D.clear_all is called. + */ + void set_freeze_3d_render(const bool &_state) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_freeze_3d_render)(void * /*inst_ptr*/, const bool /*_state*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_freeze_3d_render, inst_ptr, _state); +#endif + } + + bool is_freeze_3d_render() { + static bool (*DebugDraw3DConfig_is_freeze_3d_render)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_is_freeze_3d_render, {}, inst_ptr); + } + + /** + * Set whether the boundaries of instances are displayed. + * Based on these boundaries, instances are culled if set_use_frustum_culling is activated. + */ + void set_visible_instance_bounds(const bool &_state) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_visible_instance_bounds)(void * /*inst_ptr*/, const bool /*_state*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_visible_instance_bounds, inst_ptr, _state); +#endif + } + + bool is_visible_instance_bounds() { + static bool (*DebugDraw3DConfig_is_visible_instance_bounds)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_is_visible_instance_bounds, {}, inst_ptr); + } + + /** + * @deprecated + * Set whether frustum culling is used. + * This is a wrapper over DebugDraw3DConfig.set_frustum_culling_mode and exists for compatibility with older versions. + * + * @note + * Enabling or disabling this option does not affect the rough culling based on the camera's AABB of frustum. + * This option enables more accurate culling based on the camera's frustum planes. + */ + void set_use_frustum_culling(const bool &_state) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_use_frustum_culling)(void * /*inst_ptr*/, const bool /*_state*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_use_frustum_culling, inst_ptr, _state); +#endif + } + + bool is_use_frustum_culling() { + static bool (*DebugDraw3DConfig_is_use_frustum_culling)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_is_use_frustum_culling, {}, inst_ptr); + } + + /** + * Set frustum culling mode. + */ + void set_frustum_culling_mode(const DebugDraw3DConfig::CullingMode &_mode) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_frustum_culling_mode)(void * /*inst_ptr*/, uint32_t /*DebugDraw3DConfig::CullingMode _mode*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_frustum_culling_mode, inst_ptr, static_cast(_mode)); +#endif + } + + DebugDraw3DConfig::CullingMode get_frustum_culling_mode() { + static uint32_t /*DebugDraw3DConfig::CullingMode*/ (*DebugDraw3DConfig_get_frustum_culling_mode)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_CAST(DebugDraw3DConfig_get_frustum_culling_mode, DebugDraw3DConfig::CullingMode, {}, inst_ptr); + } + + /** + * Change the distance between the Far and Near Planes of the Viewport's Camera3D. + */ + void set_frustum_length_scale(const real_t &_distance) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_frustum_length_scale)(void * /*inst_ptr*/, const real_t /*_distance*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_frustum_length_scale, inst_ptr, _distance); +#endif + } + + real_t get_frustum_length_scale() { + static real_t (*DebugDraw3DConfig_get_frustum_length_scale)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_get_frustum_length_scale, {}, inst_ptr); + } + + /** + * Set the forced use of the scene camera instead of the editor camera. + */ + void set_force_use_camera_from_scene(const bool &_state) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_force_use_camera_from_scene)(void * /*inst_ptr*/, const bool /*_state*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_force_use_camera_from_scene, inst_ptr, _state); +#endif + } + + bool is_force_use_camera_from_scene() { + static bool (*DebugDraw3DConfig_is_force_use_camera_from_scene)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_is_force_use_camera_from_scene, {}, inst_ptr); + } + + /** + * Set the visibility layer on which the 3D geometry will be drawn. + * Similar to using VisualInstance3D.layers. + */ + void set_geometry_render_layers(const int32_t &_layers) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_geometry_render_layers)(void * /*inst_ptr*/, const int32_t /*_layers*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_geometry_render_layers, inst_ptr, _layers); +#endif + } + + int32_t get_geometry_render_layers() { + static int32_t (*DebugDraw3DConfig_get_geometry_render_layers)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_get_geometry_render_layers, {}, inst_ptr); + } + + /** + * Set the default color for the collision point of DebugDraw3D.draw_line_hit. + */ + void set_line_hit_color(const godot::Color &_new_color) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_line_hit_color)(void * /*inst_ptr*/, const godot::Color /*_new_color*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_line_hit_color, inst_ptr, _new_color); +#endif + } + + godot::Color get_line_hit_color() { + static godot::Color (*DebugDraw3DConfig_get_line_hit_color)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_get_line_hit_color, {}, inst_ptr); + } + + /** + * Set the default color for the line after the collision point of DebugDraw3D.draw_line_hit. + */ + void set_line_after_hit_color(const godot::Color &_new_color) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DConfig_set_line_after_hit_color)(void * /*inst_ptr*/, const godot::Color /*_new_color*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_set_line_after_hit_color, inst_ptr, _new_color); +#endif + } + + godot::Color get_line_after_hit_color() { + static godot::Color (*DebugDraw3DConfig_get_line_after_hit_color)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_get_line_after_hit_color, {}, inst_ptr); + } + +private: + static void * create() { + static void * (*DebugDraw3DConfig_create)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_create, nullptr); + } + + static void * create_nullptr() { + static void * (*DebugDraw3DConfig_create_nullptr)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DConfig_create_nullptr, nullptr); + } + + static void destroy(void * inst_ptr) { + static void (*DebugDraw3DConfig_destroy)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DConfig_destroy, inst_ptr); + } + +}; // class DebugDraw3DConfig + +/** + * @brief + * This class is used to override scope parameters for DebugDraw3D. + * + * `Scope` means that these overridden parameters will affect the drawn geometry until it exits the current scope. + * + * To create it, use DebugDraw3D.new_scoped_config. + * Immediately after creation, you can change the values and save the reference in a variable. + * + * @warning + * But the main thing is not to save it outside the method or in other objects. + * After leaving the scope, this object should be deleted. + * + * --- + * @warning + * Also, you can't use scope config between `await`s unless this object is freed before `await`. + * So, narrow the scope if you want to use `await` and DebugDraw3DScopeConfig in the same method. + * Or set the value of the variable to `null` so that the object is cleared due to lack of references. + * ```python + * # Bad example + * var _s = DebugDraw3D.new_scoped_config().set_thickness(0.3) + * DebugDraw3D.draw_box(Vector3.ZERO, Quaternion.IDENTITY, Vector3.ONE) + * await get_tree().process_frame + * # your code... + * + * # Good example + * if true: + * var _s = DebugDraw3D.new_scoped_config().set_thickness(0.3) + * DebugDraw3D.draw_box(Vector3.ZERO, Quaternion.IDENTITY, Vector3.ONE) + * await get_tree().process_frame + * # your code... + * ``` + * + * ### Examples: + * ```python + * var _s = DebugDraw3D.new_scoped_config().set_thickness(0.025).set_center_brightness(0.7) + * DebugDraw3D.draw_grid_xf(%Grid.global_transform, Vector2i(10,10), Color.LIGHT_GRAY) + * ``` + * + * ```cs + * using (var s = DebugDraw3D.NewScopedConfig().SetThickness(0)) + * DebugDraw3D.DrawCameraFrustum(dCamera, Colors.DarkOrange); + * ``` + */ +class DebugDraw3DScopeConfig : public std::enable_shared_from_this { +private: + void *inst_ptr; + +public: + DebugDraw3DScopeConfig(void *inst_ptr) : + inst_ptr(inst_ptr) {} + + DebugDraw3DScopeConfig(bool instantiate = true) : + inst_ptr(instantiate ? create() : create_nullptr()) {} + + ~DebugDraw3DScopeConfig() { destroy(inst_ptr); } + + operator void *() const { return inst_ptr; } + + /** + * Set the thickness of the volumetric lines. If the value is 0, the standard wireframe rendering will be used. + * + * [THERE WAS AN IMAGE] + */ + std::shared_ptr set_thickness(const real_t &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_thickness_selfreturn)(void * /*inst_ptr*/, const real_t /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_thickness_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + real_t get_thickness() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static real_t (*DebugDraw3DScopeConfig_get_thickness)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_get_thickness, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set the brightness of the central part of the volumetric lines. + * + * [THERE WAS AN IMAGE] + */ + std::shared_ptr set_center_brightness(const real_t &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_center_brightness_selfreturn)(void * /*inst_ptr*/, const real_t /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_center_brightness_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + real_t get_center_brightness() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static real_t (*DebugDraw3DScopeConfig_get_center_brightness)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_get_center_brightness, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set the mesh density of the sphere + * + * [THERE WAS AN IMAGE] + */ + std::shared_ptr set_hd_sphere(const bool &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_hd_sphere_selfreturn)(void * /*inst_ptr*/, const bool /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_hd_sphere_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + bool is_hd_sphere() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static bool (*DebugDraw3DScopeConfig_is_hd_sphere)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_is_hd_sphere, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set the size of the `Plane` in DebugDraw3D.draw_plane. If set to `INF`, the `Far` parameter of the current camera will be used. + * + * [THERE WAS AN IMAGE] + */ + std::shared_ptr set_plane_size(const real_t &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_plane_size_selfreturn)(void * /*inst_ptr*/, const real_t /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_plane_size_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + real_t get_plane_size() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static real_t (*DebugDraw3DScopeConfig_get_plane_size)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_get_plane_size, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set the base/local `transform` relative to which the shapes will be drawn. + * + * [THERE WAS AN IMAGE] + */ + std::shared_ptr set_transform(const godot::Transform3D &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_transform_selfreturn)(void * /*inst_ptr*/, const godot::Transform3D /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_transform_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + godot::Transform3D get_transform() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static godot::Transform3D (*DebugDraw3DScopeConfig_get_transform)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_get_transform, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set the `outline` color in DebugDraw3D.draw_text. + * + * [THERE WAS AN IMAGE] + * + * @warning + * Frequent unsystematic changes to this property can lead to significant performance degradation. + */ + std::shared_ptr set_text_outline_color(const godot::Color &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_text_outline_color_selfreturn)(void * /*inst_ptr*/, const godot::Color /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_text_outline_color_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + godot::Color get_text_outline_color() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static godot::Color (*DebugDraw3DScopeConfig_get_text_outline_color)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_get_text_outline_color, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set the size of the `outline` in DebugDraw3D.draw_text. + * + * [THERE WAS AN IMAGE] + * + * @warning + * Frequent unsystematic changes to this property can lead to significant performance degradation. + */ + std::shared_ptr set_text_outline_size(const int32_t &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_text_outline_size_selfreturn)(void * /*inst_ptr*/, const int32_t /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_text_outline_size_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + int32_t get_text_outline_size() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static int32_t (*DebugDraw3DScopeConfig_get_text_outline_size)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_get_text_outline_size, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Makes the text in DebugDraw3D.draw_text the same size regardless of distance. + * + * [THERE WAS AN IMAGE] + * + * @warning + * Frequent unsystematic changes to this property can lead to significant performance degradation. + */ + std::shared_ptr set_text_fixed_size(const bool &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn)(void * /*inst_ptr*/, const bool /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + bool get_text_fixed_size() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static bool (*DebugDraw3DScopeConfig_get_text_fixed_size)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_get_text_fixed_size, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set the font of the text in DebugDraw3D.draw_text. + * + * [THERE WAS AN IMAGE] + * + * @warning + * Frequent unsystematic changes to this property can lead to significant performance degradation. + */ + std::shared_ptr set_text_font(const godot::Ref &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_text_font_selfreturn)(void * /*inst_ptr*/, const uint64_t /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_text_font_selfreturn, inst_ptr, _value.is_valid() ? _value->get_instance_id() : 0); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + godot::Ref get_text_font() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static const uint64_t (*DebugDraw3DScopeConfig_get_text_font)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_GODOT_REF(DebugDraw3DScopeConfig_get_text_font, godot::Font, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set which Viewport will be used to get World3D. + * + * If the World3D of this Viewport has not been used before, + * then the owner of this World3D will be found in the current branch of the tree, + * and special observer nodes will be added to it. + * + * @note + * Objects created for a specific Viewport will use only one camera related to that Viewport for culling. + */ + std::shared_ptr set_viewport(const godot::Viewport * _value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_viewport_selfreturn)(void * /*inst_ptr*/, const uint64_t /*godot::Viewport _value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_viewport_selfreturn, inst_ptr, _value ? _value->get_instance_id() : 0); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + godot::Viewport * get_viewport() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static const uint64_t (*DebugDraw3DScopeConfig_get_viewport)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_GODOT_OBJECT(DebugDraw3DScopeConfig_get_viewport, godot::Viewport, {}, inst_ptr); +#else + return {}; +#endif + } + + /** + * Set whether the `depth_test_disabled` flag is added or not in the shaders of the debug shapes. + * + * @note + * It may cause artifacts when drawing volumetric objects. + * + * [THERE WAS AN IMAGE] + */ + std::shared_ptr set_no_depth_test(const bool &_value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DScopeConfig_set_no_depth_test_selfreturn)(void * /*inst_ptr*/, const bool /*_value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_SELFRET(DebugDraw3DScopeConfig_set_no_depth_test_selfreturn, inst_ptr, _value); + return shared_from_this(); +#else + return shared_from_this(); +#endif + } + + bool is_no_depth_test() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static bool (*DebugDraw3DScopeConfig_is_no_depth_test)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_is_no_depth_test, {}, inst_ptr); +#else + return {}; +#endif + } + +private: + static void * create() { + static void * (*DebugDraw3DScopeConfig_create)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_create, nullptr); + } + + static void * create_nullptr() { + static void * (*DebugDraw3DScopeConfig_create_nullptr)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DScopeConfig_create_nullptr, nullptr); + } + + static void destroy(void * inst_ptr) { + static void (*DebugDraw3DScopeConfig_destroy)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DScopeConfig_destroy, inst_ptr); + } + +}; // class DebugDraw3DScopeConfig + +/** + * @brief + * 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. + * + * [THERE WAS AN IMAGE] + * + * `use_icosphere` and `use_icosphere_for_hd` allow you to change the sphere mesh. + * + * [THERE WAS AN IMAGE] + * + * @note + * Wireframe shapes and volumetric wireframes do not support translucency to avoid overlap issues and for better performance. + * At this point, you can use translucency when drawing planes DebugDraw3D.draw_plane. + * + * --- + * @note + * Objects created in `_physics_process` are processed separately from those created in `_process`, + * so they will be deleted only in the first physics tick after rendering. + * This allows to display objects even if several frames passed between physics ticks. + * + * --- + * @note + * You can use this class anywhere, including in `_physics_process` and `_process` (and probably from other threads). + * It is worth mentioning that physics ticks may not be called every frame or may be called several times in one frame. + * So if you want to avoid multiple identical `draw_` calls, you can call `draw_` methods in `_process` or use such a check: + * ```python + * var physics_tick_processed := false + * func _process(delta: float) -> void: + * # Reset after rendering frame + * physics_tick_processed = false + * # some logic + * + * func _physics_process(delta: float) -> void: + * if not physics_tick_processed: + * physics_tick_processed = true + * # some DD3D logic + * ``` + * + * --- + * @note + * Due to the way Godot registers this addon, it is not possible to use the `draw_` methods + * in the first few frames immediately after the project is launched. + */ +namespace DebugDraw3D { +enum PointType : uint32_t { + POINT_TYPE_SQUARE = 0, + POINT_TYPE_SPHERE = 1, +}; + +/** + * 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. + */ +static std::shared_ptr new_scoped_config() { + static void * (*DebugDraw3D_new_scoped_config)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED(DebugDraw3D_new_scoped_config, DebugDraw3DScopeConfig, nullptr); +} + +/** + * 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`. + * + * @note + * When used in a managed language, this is not mandatory, but it is recommended to finish the `scoped_config()` configuration with a dispose. + * This will reduce the number of objects awaiting removal by the garbage collector. + * ```cs + * DebugDraw3D.ScopedConfig().SetThickness(debug_thickness).Dispose(); + * ``` + */ +static std::shared_ptr scoped_config() { + static void * (*DebugDraw3D_scoped_config)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED(DebugDraw3D_scoped_config, DebugDraw3DScopeConfig, nullptr); +} + +/** + * Set the configuration global for everything in DebugDraw3D. + */ +static void set_config(const std::shared_ptr &cfg) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_set_config)(void * /*cfg*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_set_config, *cfg); +#endif +} + +/** + * Get the DebugDraw3DConfig. + */ +static std::shared_ptr get_config() { + static void * (*DebugDraw3D_get_config)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED(DebugDraw3D_get_config, DebugDraw3DConfig, nullptr); +} + +/** + * Set whether debug drawing works or not. + */ +static void set_debug_enabled(const bool &state) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_set_debug_enabled)(const bool /*state*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_set_debug_enabled, state); +#endif +} + +static bool is_debug_enabled() { + static bool (*DebugDraw3D_is_debug_enabled)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3D_is_debug_enabled, {}); +} + +/** + * Returns an instance of DebugDraw3DStats with the current statistics. + * + * Some data can be delayed by 1 frame. + */ +static std::shared_ptr get_render_stats() { + static void * (*DebugDraw3D_get_render_stats)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED(DebugDraw3D_get_render_stats, DebugDraw3DStats, nullptr); +} + +/** + * Returns an instance of DebugDraw3DStats with the current statistics for the World3D of the Viewport. + * + * Some data can be delayed by 1 frame. + */ +static std::shared_ptr get_render_stats_for_world(const godot::Viewport * viewport) { + static void * (*DebugDraw3D_get_render_stats_for_world)(const uint64_t /*godot::Viewport viewport*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED(DebugDraw3D_get_render_stats_for_world, DebugDraw3DStats, nullptr, viewport ? viewport->get_instance_id() : 0); +} + +/** + * Regenerate meshes. + * + * Can be useful if you want to change some project settings and not restart the project. + */ +static void regenerate_geometry_meshes() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_regenerate_geometry_meshes)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_regenerate_geometry_meshes); +#endif +} + +/** + * Clear all 3D geometry + */ +static void clear_all() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_clear_all)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_clear_all); +#endif +} + +/** + * Draw a sphere + * + * [THERE WAS AN IMAGE] + * + * @param position Center of the sphere + * @param radius Sphere radius + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_sphere(const godot::Vector3 &position, const real_t &radius = 0.5f, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_sphere)(const godot::Vector3 /*position*/, const real_t /*radius*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_sphere, position, radius, color, duration); +#endif +} + +/** + * Draw a sphere with a radius of 0.5 + * + * [THERE WAS AN IMAGE] + * + * @param transform Sphere transform + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_sphere_xf(const godot::Transform3D &transform, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_sphere_xf)(const godot::Transform3D /*transform*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_sphere_xf, transform, color, duration); +#endif +} + +/** + * Draw a vertical capsule + * + * [THERE WAS AN IMAGE] + * + * @note + * A capsule will not be displayed if the height or radius is approximately equal to or less than zero. + * + * --- + * @note + * If you need to apply additional transformations, you can use DebugDraw3DScopeConfig.set_transform. + * + * @param position Capsule position + * @param rotation Capsule rotation + * @param radius Capsule radius + * @param height Capsule height including caps. Based on this value, the actual radius of the capsule will be calculated. + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_capsule(const godot::Vector3 &position, const godot::Quaternion &rotation, const real_t &radius, const real_t &height, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_capsule)(const godot::Vector3 /*position*/, const DD3DShared::CQuaternion /*rotation*/, const real_t /*radius*/, const real_t /*height*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_capsule, position, rotation, radius, height, color, duration); +#endif +} + +/** + * Draw a capsule between points A and B with the desired radius. + * + * [THERE WAS AN IMAGE] + * + * @note + * A capsule will not be displayed if the distance between points A and B or the radius is approximately equal to or less than zero. + * + * @param a First pole of the capsule + * @param b Second pole of the capsule + * @param radius Capsule radius + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_capsule_ab(const godot::Vector3 &a, const godot::Vector3 &b, const real_t &radius = 0.5f, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_capsule_ab)(const godot::Vector3 /*a*/, const godot::Vector3 /*b*/, const real_t /*radius*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_capsule_ab, a, b, radius, color, duration); +#endif +} + +/** + * Draw a vertical cylinder with radius 1.0 (x, z) and height 1.0 (y) + * + * [THERE WAS AN IMAGE] + * + * @param transform Cylinder transform + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_cylinder(const godot::Transform3D &transform, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_cylinder)(const godot::Transform3D /*transform*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_cylinder, transform, color, duration); +#endif +} + +/** + * Draw a cylinder between points A and B with a certain radius. + * + * @note + * A cylinder will not be displayed if the distance between points A and B is approximately zero. + * + * [THERE WAS AN IMAGE] + * + * @param a Bottom point of the Cylinder + * @param b Top point of the Cylinder + * @param radius Cylinder radius + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_cylinder_ab(const godot::Vector3 &a, const godot::Vector3 &b, const real_t &radius = 0.5f, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_cylinder_ab)(const godot::Vector3 /*a*/, const godot::Vector3 /*b*/, const real_t /*radius*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_cylinder_ab, a, b, radius, color, duration); +#endif +} + +/** + * Draw a box + * + * [THERE WAS AN IMAGE] + * + * [THERE WAS AN IMAGE] + * + * @param position Position of the Box + * @param rotation Rotation of the box + * @param size Size of the Box + * @param color Primary color + * @param is_box_centered Set where the center of the box will be. In the center or in the bottom corner + * @param duration The duration of how long the object will be visible + */ +static void draw_box(const godot::Vector3 &position, const godot::Quaternion &rotation, const godot::Vector3 &size, const godot::Color &color = godot::Color(0, 0, 0, 0), const bool &is_box_centered = false, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_box)(const godot::Vector3 /*position*/, const DD3DShared::CQuaternion /*rotation*/, const godot::Vector3 /*size*/, const godot::Color /*color*/, const bool /*is_box_centered*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_box, position, rotation, size, color, is_box_centered, duration); +#endif +} + +/** + * Draw a box between points A and B by rotating and scaling based on the up vector + * + * [THERE WAS AN IMAGE] + * + * [THERE WAS AN IMAGE] + * + * @note + * A box will not be displayed if its dimensions are close to zero or if the up vector is approximately zero. + * + * @param a Start position + * @param b End position + * @param up Vertical vector by which the box will be aligned + * @param color Primary color + * @param is_ab_diagonal Set uses the diagonal between the corners or the diagonal between the centers of two edges + * @param duration The duration of how long the object will be visible + */ +static void draw_box_ab(const godot::Vector3 &a, const godot::Vector3 &b, const godot::Vector3 &up, const godot::Color &color = godot::Color(0, 0, 0, 0), const bool &is_ab_diagonal = true, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_box_ab)(const godot::Vector3 /*a*/, const godot::Vector3 /*b*/, const godot::Vector3 /*up*/, const godot::Color /*color*/, const bool /*is_ab_diagonal*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_box_ab, a, b, up, color, is_ab_diagonal, duration); +#endif +} + +/** + * Draw a box as in DebugDraw3D.draw_box + * + * @param transform Box transform + * @param color Primary color + * @param is_box_centered Set where the center of the box will be. In the center or in the bottom corner + * @param duration The duration of how long the object will be visible + */ +static void draw_box_xf(const godot::Transform3D &transform, const godot::Color &color = godot::Color(0, 0, 0, 0), const bool &is_box_centered = true, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_box_xf)(const godot::Transform3D /*transform*/, const godot::Color /*color*/, const bool /*is_box_centered*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_box_xf, transform, color, is_box_centered, duration); +#endif +} + +/** + * Draw a box as in DebugDraw3D.draw_box, but based on the AABB + * + * @param aabb AABB + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_aabb(const godot::AABB &aabb, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_aabb)(const godot::AABB /*aabb*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_aabb, aabb, color, duration); +#endif +} + +/** + * Draw the box as in DebugDraw3D.draw_aabb, but AABB is defined by the diagonal AB + * + * @param a Start position + * @param b End position + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_aabb_ab(const godot::Vector3 &a, const godot::Vector3 &b, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_aabb_ab)(const godot::Vector3 /*a*/, const godot::Vector3 /*b*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_aabb_ab, a, b, color, duration); +#endif +} + +/** + * 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. + * + * [THERE WAS AN IMAGE] + * + * @param start Start point + * @param end End point + * @param hit Hit point + * @param is_hit Whether to draw the collision point + * @param hit_size Size of the hit point + * @param hit_color Color of the hit point and line before hit + * @param after_hit_color Color of line after hit position + * @param duration The duration of how long the object will be visible + */ +static void draw_line_hit(const godot::Vector3 &start, const godot::Vector3 &end, const godot::Vector3 &hit, const bool &is_hit, const real_t &hit_size = 0.25f, const godot::Color &hit_color = godot::Color(0, 0, 0, 0), const godot::Color &after_hit_color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_line_hit)(const godot::Vector3 /*start*/, const godot::Vector3 /*end*/, const godot::Vector3 /*hit*/, const bool /*is_hit*/, const real_t /*hit_size*/, const godot::Color /*hit_color*/, const godot::Color /*after_hit_color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_line_hit, start, end, hit, is_hit, hit_size, hit_color, after_hit_color, duration); +#endif +} + +/** + * 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. + * + * @param start Start point + * @param end End point + * @param is_hit Whether to draw the collision point + * @param unit_offset_of_hit Unit offset on the line where the collision occurs + * @param hit_size Size of the hit point + * @param hit_color Color of the hit point and line before hit + * @param after_hit_color Color of line after hit position + * @param duration The duration of how long the object will be visible + */ +static void draw_line_hit_offset(const godot::Vector3 &start, const godot::Vector3 &end, const bool &is_hit, const real_t &unit_offset_of_hit = 0.5f, const real_t &hit_size = 0.25f, const godot::Color &hit_color = godot::Color(0, 0, 0, 0), const godot::Color &after_hit_color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_line_hit_offset)(const godot::Vector3 /*start*/, const godot::Vector3 /*end*/, const bool /*is_hit*/, const real_t /*unit_offset_of_hit*/, const real_t /*hit_size*/, const godot::Color /*hit_color*/, const godot::Color /*after_hit_color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_line_hit_offset, start, end, is_hit, unit_offset_of_hit, hit_size, hit_color, after_hit_color, duration); +#endif +} + +/** + * Draw a single line + * + * [THERE WAS AN IMAGE] + * + * @param a Start point + * @param b End point + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_line(const godot::Vector3 &a, const godot::Vector3 &b, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_line)(const godot::Vector3 /*a*/, const godot::Vector3 /*b*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_line, a, b, color, duration); +#endif +} + +/** + * Draw a ray. + * + * Same as DebugDraw3D.draw_line, but uses origin, direction and length instead of A and B. + * + * @param origin Origin + * @param direction Direction + * @param length Length + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_ray(const godot::Vector3 &origin, const godot::Vector3 &direction, const real_t &length, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_ray)(const godot::Vector3 /*origin*/, const godot::Vector3 /*direction*/, const real_t /*length*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_ray, origin, direction, length, color, duration); +#endif +} + +/** + * Draw an array of lines. Each line is two points, so the array must be of even size. + * + * [THERE WAS AN IMAGE] + * + * @param lines An array of points of lines. 1 line = 2 vectors3. The array size must be even. + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_lines_c(const godot::Vector3 * lines_data, const uint64_t &lines_size, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_lines_c)(const godot::Vector3 * /*lines_data*/, const uint64_t /*lines_size*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_lines_c, lines_data, lines_size, color, duration); +#endif +} + +/** + * Draw an array of lines. Each line is two points, so the array must be of even size. + * + * [THERE WAS AN IMAGE] + * + * @param lines An array of points of lines. 1 line = 2 vectors3. The array size must be even. + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_lines(const godot::PackedVector3Array &lines, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + draw_lines_c(lines.ptr(), lines.size(), color, duration); +#endif +} + +/** + * 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. + * + * @note + * If the path size is equal to 1, then DebugDraw3D.draw_square will be used instead of drawing a line. + * + * @param path Sequence of points + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_line_path_c(const godot::Vector3 * path_data, const uint64_t &path_size, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_line_path_c)(const godot::Vector3 * /*path_data*/, const uint64_t /*path_size*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_line_path_c, path_data, path_size, color, duration); +#endif +} + +/** + * 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. + * + * @note + * If the path size is equal to 1, then DebugDraw3D.draw_square will be used instead of drawing a line. + * + * @param path Sequence of points + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_line_path(const godot::PackedVector3Array &path, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + draw_line_path_c(path.ptr(), path.size(), color, duration); +#endif +} + +/** + * Draw the arrowhead + * + * @param transform godot::Transform3D of the Arrowhead + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_arrowhead(const godot::Transform3D &transform, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_arrowhead)(const godot::Transform3D /*transform*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_arrowhead, transform, color, duration); +#endif +} + +/** + * Draw line with arrowhead + * + * [THERE WAS AN IMAGE] + * + * @note + * An arrow will not be displayed if the distance between points a and b is approximately zero. + * + * @param a Start point + * @param b End point + * @param color Primary color + * @param arrow_size Size of the arrow + * @param is_absolute_size Is `arrow_size` absolute or relative to the length of the string? + * @param duration The duration of how long the object will be visible + */ +static void draw_arrow(const godot::Vector3 &a, const godot::Vector3 &b, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &arrow_size = 0.5f, const bool &is_absolute_size = false, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_arrow)(const godot::Vector3 /*a*/, const godot::Vector3 /*b*/, const godot::Color /*color*/, const real_t /*arrow_size*/, const bool /*is_absolute_size*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_arrow, a, b, color, arrow_size, is_absolute_size, duration); +#endif +} + +/** + * Same as DebugDraw3D.draw_arrow, but uses origin, direction and length instead of A and B. + * + * @param origin Origin + * @param direction Direction + * @param length Length + * @param color Primary color + * @param arrow_size Size of the arrow + * @param is_absolute_size Is `arrow_size` absolute or relative to the line length? + * @param duration The duration of how long the object will be visible + */ +static void draw_arrow_ray(const godot::Vector3 &origin, const godot::Vector3 &direction, const real_t &length, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &arrow_size = 0.5f, const bool &is_absolute_size = false, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_arrow_ray)(const godot::Vector3 /*origin*/, const godot::Vector3 /*direction*/, const real_t /*length*/, const godot::Color /*color*/, const real_t /*arrow_size*/, const bool /*is_absolute_size*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_arrow_ray, origin, direction, length, color, arrow_size, is_absolute_size, duration); +#endif +} + +/** + * Draw a sequence of points connected by lines with arrows like DebugDraw3D.draw_line_path. + * + * [THERE WAS AN IMAGE] + * + * @note + * If the path size is equal to 1, then DebugDraw3D.draw_square will be used instead of drawing a line. + * + * @param path Sequence of points + * @param color Primary color + * @param arrow_size Size of the arrow + * @param is_absolute_size Is the `arrow_size` absolute or relative to the length of the line? + * @param duration The duration of how long the object will be visible + */ +static void draw_arrow_path_c(const godot::Vector3 * path_data, const uint64_t &path_size, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &arrow_size = 0.75f, const bool &is_absolute_size = true, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_arrow_path_c)(const godot::Vector3 * /*path_data*/, const uint64_t /*path_size*/, const godot::Color /*color*/, const real_t /*arrow_size*/, const bool /*is_absolute_size*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_arrow_path_c, path_data, path_size, color, arrow_size, is_absolute_size, duration); +#endif +} + +/** + * Draw a sequence of points connected by lines with arrows like DebugDraw3D.draw_line_path. + * + * [THERE WAS AN IMAGE] + * + * @note + * If the path size is equal to 1, then DebugDraw3D.draw_square will be used instead of drawing a line. + * + * @param path Sequence of points + * @param color Primary color + * @param arrow_size Size of the arrow + * @param is_absolute_size Is the `arrow_size` absolute or relative to the length of the line? + * @param duration The duration of how long the object will be visible + */ +static void draw_arrow_path(const godot::PackedVector3Array &path, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &arrow_size = 0.75f, const bool &is_absolute_size = true, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + draw_arrow_path_c(path.ptr(), path.size(), color, arrow_size, is_absolute_size, duration); +#endif +} + +/** + * Draw a sequence of points connected by lines using billboard squares or spheres like DebugDraw3D.draw_line_path. + * + * [THERE WAS AN IMAGE] + * + * [THERE WAS AN IMAGE] + * + * @note + * If the path size is equal to 1, then DebugDraw3D.draw_square or DebugDraw3D.draw_sphere will be used instead of drawing a line. + * + * @param path Sequence of points + * @param type Type of points + * @param points_color Color of points + * @param lines_color Color of lines + * @param size Size of squares + * @param duration The duration of how long the object will be visible + */ +static void draw_point_path_c(const godot::Vector3 * path_data, const uint64_t &path_size, const DebugDraw3D::PointType &type = PointType::POINT_TYPE_SQUARE, const real_t &size = 0.25f, const godot::Color &points_color = godot::Color(0, 0, 0, 0), const godot::Color &lines_color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_point_path_c)(const godot::Vector3 * /*path_data*/, const uint64_t /*path_size*/, uint32_t /*DebugDraw3D::PointType type*/, const real_t /*size*/, const godot::Color /*points_color*/, const godot::Color /*lines_color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_point_path_c, path_data, path_size, static_cast(type), size, points_color, lines_color, duration); +#endif +} + +/** + * Draw a sequence of points connected by lines using billboard squares or spheres like DebugDraw3D.draw_line_path. + * + * [THERE WAS AN IMAGE] + * + * [THERE WAS AN IMAGE] + * + * @note + * If the path size is equal to 1, then DebugDraw3D.draw_square or DebugDraw3D.draw_sphere will be used instead of drawing a line. + * + * @param path Sequence of points + * @param type Type of points + * @param points_color Color of points + * @param lines_color Color of lines + * @param size Size of squares + * @param duration The duration of how long the object will be visible + */ +static void draw_point_path(const godot::PackedVector3Array &path, const DebugDraw3D::PointType &type = PointType::POINT_TYPE_SQUARE, const real_t &size = 0.25f, const godot::Color &points_color = godot::Color(0, 0, 0, 0), const godot::Color &lines_color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + draw_point_path_c(path.ptr(), path.size(), type, size, points_color, lines_color, duration); +#endif +} + +/** + * Draw a sequence of points using billboard squares or spheres. + * + * [THERE WAS AN IMAGE] + * + * @param points Sequence of points + * @param type Type of points + * @param size Size of squares + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_points_c(const godot::Vector3 * points_data, const uint64_t &points_size, const DebugDraw3D::PointType &type = DebugDraw3D::PointType::POINT_TYPE_SQUARE, const real_t &size = 0.25f, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_points_c)(const godot::Vector3 * /*points_data*/, const uint64_t /*points_size*/, uint32_t /*DebugDraw3D::PointType type*/, const real_t /*size*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_points_c, points_data, points_size, static_cast(type), size, color, duration); +#endif +} + +/** + * Draw a sequence of points using billboard squares or spheres. + * + * [THERE WAS AN IMAGE] + * + * @param points Sequence of points + * @param type Type of points + * @param size Size of squares + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_points(const godot::PackedVector3Array &points, const DebugDraw3D::PointType &type = DebugDraw3D::PointType::POINT_TYPE_SQUARE, const real_t &size = 0.25f, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + draw_points_c(points.ptr(), points.size(), type, size, color, duration); +#endif +} + +/** + * Draw a square that will always be turned towards the camera + * + * @param position Center position of square + * @param size Square size + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_square(const godot::Vector3 &position, const real_t &size = 0.2f, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_square)(const godot::Vector3 /*position*/, const real_t /*size*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_square, position, size, color, duration); +#endif +} + +/** + * 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. + * + * [THERE WAS AN IMAGE] + * + * @param plane Plane data + * @param color Primary color + * @param anchor_point A point that is projected onto a Plane, and its projection is used as the center of the drawn plane + * @param duration The duration of how long the object will be visible + */ +static void draw_plane(const godot::Plane &plane, const godot::Color &color = godot::Color(0, 0, 0, 0), const godot::Vector3 &anchor_point = godot::Vector3(INFINITY, INFINITY, INFINITY), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_plane)(const godot::Plane /*plane*/, const godot::Color /*color*/, const godot::Vector3 /*anchor_point*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_plane, plane, color, anchor_point, duration); +#endif +} + +/** + * Draw 3 intersecting lines with the given transformations + * + * [THERE WAS AN IMAGE] + * + * @param transform godot::Transform3D of lines + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_position(const godot::Transform3D &transform, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_position)(const godot::Transform3D /*transform*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_position, transform, color, duration); +#endif +} + +/** + * Draw 3 lines with the given transformations and arrows at the ends + * + * [THERE WAS AN IMAGE] + * + * [THERE WAS AN IMAGE] + * + * @param transform godot::Transform3D of lines + * @param color Primary color + * @param is_centered If `true`, then the lines will intersect in the center of the transform + * @param duration The duration of how long the object will be visible + */ +static void draw_gizmo(const godot::Transform3D &transform, const godot::Color &color = godot::Color(0, 0, 0, 0), const bool &is_centered = false, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_gizmo)(const godot::Transform3D /*transform*/, const godot::Color /*color*/, const bool /*is_centered*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_gizmo, transform, color, is_centered, duration); +#endif +} + +/** + * Draw simple grid with given size and subdivision + * + * [THERE WAS AN IMAGE] + * + * @param origin Grid origin + * @param x_size Direction and size of the X side. As an axis in the Basis. + * @param y_size Direction and size of the Y side. As an axis in the Basis. + * @param subdivision Number of cells for the X and Y axes + * @param color Primary color + * @param is_centered Draw lines relative to origin + * @param duration The duration of how long the object will be visible + */ +static void draw_grid(const godot::Vector3 &origin, const godot::Vector3 &x_size, const godot::Vector3 &y_size, const godot::Vector2i &subdivision, const godot::Color &color = godot::Color(0, 0, 0, 0), const bool &is_centered = true, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_grid)(const godot::Vector3 /*origin*/, const godot::Vector3 /*x_size*/, const godot::Vector3 /*y_size*/, const godot::Vector2i /*subdivision*/, const godot::Color /*color*/, const bool /*is_centered*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_grid, origin, x_size, y_size, subdivision, color, is_centered, duration); +#endif +} + +/** + * 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. + * + * @param transform godot::Transform3D of the Grid + * @param p_subdivision Number of cells for the X and Y axes + * @param color Primary color + * @param is_centered Draw lines relative to origin + * @param duration The duration of how long the object will be visible + */ +static void draw_grid_xf(const godot::Transform3D &transform, const godot::Vector2i &p_subdivision, const godot::Color &color = godot::Color(0, 0, 0, 0), const bool &is_centered = true, const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_grid_xf)(const godot::Transform3D /*transform*/, const godot::Vector2i /*p_subdivision*/, const godot::Color /*color*/, const bool /*is_centered*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_grid_xf, transform, p_subdivision, color, is_centered, duration); +#endif +} + +/** + * Draw camera frustum area. + * + * [THERE WAS AN IMAGE] + * + * @param camera Camera node + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_camera_frustum(const godot::Camera3D * camera, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_camera_frustum)(const uint64_t /*godot::Camera3D camera*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_camera_frustum, camera ? camera->get_instance_id() : 0, color, duration); +#endif +} + +/** + * Draw the frustum area of the camera based on an array of 6 planes. + * + * @param camera_frustum Array of frustum planes + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_camera_frustum_planes_c(const godot::Plane * camera_frustum_data, const uint64_t &camera_frustum_size, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_camera_frustum_planes_c)(const godot::Plane * /*camera_frustum_data*/, const uint64_t /*camera_frustum_size*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_camera_frustum_planes_c, camera_frustum_data, camera_frustum_size, color, duration); +#endif +} + +/** + * Draw text using Label3D. + * + * @note + * Outline can be changed using DebugDraw3DScopeConfig.set_text_outline_color and DebugDraw3DScopeConfig.set_text_outline_size. + * The font can be changed using DebugDraw3DScopeConfig.set_text_font. + * The text can be made to stay the same size regardless of distance using DebugDraw3DScopeConfig.set_text_fixed_size. + * + * [THERE WAS AN IMAGE] + * + * @param position Center position of Label + * @param text Label's text + * @param size Font size + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_text_c(const godot::Vector3 &position, const char * text_string, const int &size = 32, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3D_draw_text_c)(const godot::Vector3 /*position*/, const char * /*text_string*/, const int /*size*/, const godot::Color /*color*/, const real_t /*duration*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3D_draw_text_c, position, text_string, size, color, duration); +#endif +} + +/** + * Draw text using Label3D. + * + * @note + * Outline can be changed using DebugDraw3DScopeConfig.set_text_outline_color and DebugDraw3DScopeConfig.set_text_outline_size. + * The font can be changed using DebugDraw3DScopeConfig.set_text_font. + * The text can be made to stay the same size regardless of distance using DebugDraw3DScopeConfig.set_text_fixed_size. + * + * [THERE WAS AN IMAGE] + * + * @param position Center position of Label + * @param text Label's text + * @param size Font size + * @param color Primary color + * @param duration The duration of how long the object will be visible + */ +static void draw_text(const godot::Vector3 &position, const godot::String &text, const int &size = 32, const godot::Color &color = godot::Color(0, 0, 0, 0), const real_t &duration = 0) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + draw_text_c(position, text.utf8().ptr(), size, color, duration); +#endif +} + +} // namespace DebugDraw3D + +/** + * @brief + * You can get statistics about 3D rendering from this class. + * + * All names try to reflect what they mean. + * + * To get an instance of this class with current statistics, use DebugDraw3D.get_render_stats. + * + * `instances` lets you know how many instances have been created. + * + * `instances_physics` reports how many instances were created inside `_physics_process`. + * + * `total_time_spent_usec` reports the time in microseconds spent to process everything and display the geometry on the screen. + */ +class DebugDraw3DStats { +private: + void *inst_ptr; + +public: + DebugDraw3DStats(void *inst_ptr) : + inst_ptr(inst_ptr) {} + + DebugDraw3DStats(bool instantiate = true) : + inst_ptr(instantiate ? create() : create_nullptr()) {} + + ~DebugDraw3DStats() { destroy(inst_ptr); } + + operator void *() const { return inst_ptr; } + + int64_t get_instances() { + static int64_t (*DebugDraw3DStats_get_instances)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_instances, {}, inst_ptr); + } + + void set_instances(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_instances)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_instances, inst_ptr, val); +#endif + } + + int64_t get_lines() { + static int64_t (*DebugDraw3DStats_get_lines)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_lines, {}, inst_ptr); + } + + void set_lines(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_lines)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_lines, inst_ptr, val); +#endif + } + + int64_t get_instances_physics() { + static int64_t (*DebugDraw3DStats_get_instances_physics)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_instances_physics, {}, inst_ptr); + } + + void set_instances_physics(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_instances_physics)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_instances_physics, inst_ptr, val); +#endif + } + + int64_t get_lines_physics() { + static int64_t (*DebugDraw3DStats_get_lines_physics)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_lines_physics, {}, inst_ptr); + } + + void set_lines_physics(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_lines_physics)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_lines_physics, inst_ptr, val); +#endif + } + + int64_t get_total_geometry() { + static int64_t (*DebugDraw3DStats_get_total_geometry)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_total_geometry, {}, inst_ptr); + } + + void set_total_geometry(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_total_geometry)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_total_geometry, inst_ptr, val); +#endif + } + + int64_t get_visible_instances() { + static int64_t (*DebugDraw3DStats_get_visible_instances)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_visible_instances, {}, inst_ptr); + } + + void set_visible_instances(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_visible_instances)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_visible_instances, inst_ptr, val); +#endif + } + + int64_t get_visible_lines() { + static int64_t (*DebugDraw3DStats_get_visible_lines)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_visible_lines, {}, inst_ptr); + } + + void set_visible_lines(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_visible_lines)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_visible_lines, inst_ptr, val); +#endif + } + + int64_t get_total_visible() { + static int64_t (*DebugDraw3DStats_get_total_visible)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_total_visible, {}, inst_ptr); + } + + void set_total_visible(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_total_visible)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_total_visible, inst_ptr, val); +#endif + } + + int64_t get_time_filling_buffers_instances_usec() { + static int64_t (*DebugDraw3DStats_get_time_filling_buffers_instances_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_time_filling_buffers_instances_usec, {}, inst_ptr); + } + + void set_time_filling_buffers_instances_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_time_filling_buffers_instances_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_time_filling_buffers_instances_usec, inst_ptr, val); +#endif + } + + int64_t get_time_filling_buffers_lines_usec() { + static int64_t (*DebugDraw3DStats_get_time_filling_buffers_lines_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_time_filling_buffers_lines_usec, {}, inst_ptr); + } + + void set_time_filling_buffers_lines_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_time_filling_buffers_lines_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_time_filling_buffers_lines_usec, inst_ptr, val); +#endif + } + + int64_t get_time_filling_buffers_instances_physics_usec() { + static int64_t (*DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec, {}, inst_ptr); + } + + void set_time_filling_buffers_instances_physics_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec, inst_ptr, val); +#endif + } + + int64_t get_time_filling_buffers_lines_physics_usec() { + static int64_t (*DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec, {}, inst_ptr); + } + + void set_time_filling_buffers_lines_physics_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec, inst_ptr, val); +#endif + } + + int64_t get_total_time_filling_buffers_usec() { + static int64_t (*DebugDraw3DStats_get_total_time_filling_buffers_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_total_time_filling_buffers_usec, {}, inst_ptr); + } + + void set_total_time_filling_buffers_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_total_time_filling_buffers_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_total_time_filling_buffers_usec, inst_ptr, val); +#endif + } + + int64_t get_time_culling_instances_usec() { + static int64_t (*DebugDraw3DStats_get_time_culling_instances_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_time_culling_instances_usec, {}, inst_ptr); + } + + void set_time_culling_instances_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_time_culling_instances_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_time_culling_instances_usec, inst_ptr, val); +#endif + } + + int64_t get_time_culling_lines_usec() { + static int64_t (*DebugDraw3DStats_get_time_culling_lines_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_time_culling_lines_usec, {}, inst_ptr); + } + + void set_time_culling_lines_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_time_culling_lines_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_time_culling_lines_usec, inst_ptr, val); +#endif + } + + int64_t get_total_time_culling_usec() { + static int64_t (*DebugDraw3DStats_get_total_time_culling_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_total_time_culling_usec, {}, inst_ptr); + } + + void set_total_time_culling_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_total_time_culling_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_total_time_culling_usec, inst_ptr, val); +#endif + } + + int64_t get_total_time_spent_usec() { + static int64_t (*DebugDraw3DStats_get_total_time_spent_usec)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_total_time_spent_usec, {}, inst_ptr); + } + + void set_total_time_spent_usec(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_total_time_spent_usec)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_total_time_spent_usec, inst_ptr, val); +#endif + } + + int64_t get_created_scoped_configs() { + static int64_t (*DebugDraw3DStats_get_created_scoped_configs)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_created_scoped_configs, {}, inst_ptr); + } + + void set_created_scoped_configs(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_created_scoped_configs)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_created_scoped_configs, inst_ptr, val); +#endif + } + + int64_t get_orphan_scoped_configs() { + static int64_t (*DebugDraw3DStats_get_orphan_scoped_configs)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_orphan_scoped_configs, {}, inst_ptr); + } + + void set_orphan_scoped_configs(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_orphan_scoped_configs)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_orphan_scoped_configs, inst_ptr, val); +#endif + } + + int64_t get_nodes_label3d_visible() { + static int64_t (*DebugDraw3DStats_get_nodes_label3d_visible)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_nodes_label3d_visible, {}, inst_ptr); + } + + void set_nodes_label3d_visible(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_nodes_label3d_visible)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_nodes_label3d_visible, inst_ptr, val); +#endif + } + + int64_t get_nodes_label3d_visible_physics() { + static int64_t (*DebugDraw3DStats_get_nodes_label3d_visible_physics)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_nodes_label3d_visible_physics, {}, inst_ptr); + } + + void set_nodes_label3d_visible_physics(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_nodes_label3d_visible_physics)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_nodes_label3d_visible_physics, inst_ptr, val); +#endif + } + + int64_t get_nodes_label3d_exists() { + static int64_t (*DebugDraw3DStats_get_nodes_label3d_exists)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_nodes_label3d_exists, {}, inst_ptr); + } + + void set_nodes_label3d_exists(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_nodes_label3d_exists)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_nodes_label3d_exists, inst_ptr, val); +#endif + } + + int64_t get_nodes_label3d_exists_physics() { + static int64_t (*DebugDraw3DStats_get_nodes_label3d_exists_physics)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_nodes_label3d_exists_physics, {}, inst_ptr); + } + + void set_nodes_label3d_exists_physics(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_nodes_label3d_exists_physics)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_nodes_label3d_exists_physics, inst_ptr, val); +#endif + } + + int64_t get_nodes_label3d_exists_total() { + static int64_t (*DebugDraw3DStats_get_nodes_label3d_exists_total)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_get_nodes_label3d_exists_total, {}, inst_ptr); + } + + void set_nodes_label3d_exists_total(const int64_t &val) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDraw3DStats_set_nodes_label3d_exists_total)(void * /*inst_ptr*/, int64_t /*val*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_set_nodes_label3d_exists_total, inst_ptr, val); +#endif + } + +private: + static void * create() { + static void * (*DebugDraw3DStats_create)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_create, nullptr); + } + + static void * create_nullptr() { + static void * (*DebugDraw3DStats_create_nullptr)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDraw3DStats_create_nullptr, nullptr); + } + + static void destroy(void * inst_ptr) { + static void (*DebugDraw3DStats_destroy)(void * /*inst_ptr*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDraw3DStats_destroy, inst_ptr); + } + +}; // class DebugDraw3DStats + +/** + * @brief + * The main singleton class that handles DebugDraw2D and DebugDraw3D. + * + * Several additional settings can be found in the project settings. + * + * @note The following settings require a restart. + * + * `debug_draw_3d/settings/initial_debug_state` sets the initial debugging state. + * + * `debug_draw_3d/settings/common/DebugDrawManager_singleton_aliases` sets aliases for DebugDrawManager to be registered as additional singletons. + * + * `debug_draw_3d/settings/common/DebugDraw2D_singleton_aliases` sets aliases for DebugDraw2D to be registered as additional singletons. + * + * `debug_draw_3d/settings/common/DebugDraw3D_singleton_aliases` sets aliases for DebugDraw3D to be registered as additional singletons. + * + * Using these aliases you can reference singletons with shorter words: + * + * ```python + * var _s = Dbg3.new_scoped_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) + * ``` + */ +namespace DebugDrawManager { +/** + * Clear all 2D and 3D geometry + */ +static void clear_all() { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDrawManager_clear_all)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDrawManager_clear_all); +#endif +} + +/** + * Set whether to display 2D and 3D debug graphics + */ +static void set_debug_enabled(const bool &value) { +#ifdef _DD3D_RUNTIME_CHECK_ENABLED + static void (*DebugDrawManager_set_debug_enabled)(bool /*value*/) = nullptr; + LOAD_AND_CALL_FUNC_POINTER(DebugDrawManager_set_debug_enabled, value); +#endif +} + +/** + * Whether debug 2D and 3D graphics are disabled + */ +static bool is_debug_enabled() { + static bool (*DebugDrawManager_is_debug_enabled)() = nullptr; + LOAD_AND_CALL_FUNC_POINTER_RET(DebugDrawManager_is_debug_enabled, {}); +} + +} // namespace DebugDrawManager + +// End of the generated API + +#undef _DD3D_RUNTIME_CHECK_ENABLED + +#undef FUNC_GET_SIGNATURE +#undef LOADING_RESULT +#undef LOAD_FUNC_AND_STORE_RESULT +#undef IS_FIRST_LOADING +#undef IS_LOADED_SUCCESSFULLY +#undef IS_FAILED_TO_LOAD + +#undef LOAD_AND_CALL_FUNC_POINTER +#undef LOAD_AND_CALL_FUNC_POINTER_SELFRET +#undef LOAD_AND_CALL_FUNC_POINTER_RET +#undef LOAD_AND_CALL_FUNC_POINTER_RET_CAST +#undef LOAD_AND_CALL_FUNC_POINTER_RET_GODOT_OBJECT +#undef LOAD_AND_CALL_FUNC_POINTER_RET_GODOT_REF +#undef LOAD_AND_CALL_FUNC_POINTER_RET_REF_TO_SHARED + +#ifdef _NoProfiler +#undef ZoneScoped +#endif +#undef _NoProfiler diff --git a/game/addons/debug_draw_3d/native_api/cs/dd3d_cs_api.generated.cs b/game/addons/debug_draw_3d/native_api/cs/dd3d_cs_api.generated.cs new file mode 100644 index 0000000..3740de1 --- /dev/null +++ b/game/addons/debug_draw_3d/native_api/cs/dd3d_cs_api.generated.cs @@ -0,0 +1,3876 @@ +/// ////////////////////////////////////////////////////////////// +/// THIS FILE HAS BEEN GENERATED. +/// THE CHANGES IN THIS FILE WILL BE OVERWRITTEN AFTER THE UPDATE! +/// ////////////////////////////////////////////////////////////// + +#if !DEBUG && !FORCED_DD3D +#define _DD3D_RUNTIME_CHECK_ENABLED +#endif + +#if (!DEBUG || FORCED_DD3D) || (DEBUG && !FORCED_DD3D) +#define _DD3D_COMPILETIME_CHECK_ENABLED +#endif + +using Godot; +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using DD3DFuncLoadingResult = InternalDD3DApiLoaderUtils_.LoadingResult; + +// Precision is replaced during generation, but can be replaced manually if necessary. +using real_t = float; + +internal static class InternalDD3DApiLoaderUtils_ +{ + const bool is_debug_enabled = +#if DEBUG + true; +#else + false; +#endif + public static readonly bool IsCallEnabled = is_debug_enabled || OS.HasFeature("forced_dd3d"); + + static readonly string log_prefix = "[DD3D C#] "; + static readonly string get_funcs_is_double_name = "_get_native_functions_is_double"; + static readonly string get_funcs_hash_name = "_get_native_functions_hash"; + static readonly string get_classes_name = "_get_native_classes"; + static readonly string get_funcs_name = "_get_native_functions"; + + public enum LoadingResult + { + None, + Success, + Failure + }; + + static GodotObject dd3d_c = null; + static bool failed_to_load = false; + static System.Collections.Generic.Dictionary dd3d_class_sizes = new(); + + static GodotObject get_dd3d() + { + if (failed_to_load) + return null; + + if (dd3d_c != null) + return dd3d_c; + + if (Engine.HasSingleton("DebugDrawManager")) + { + GodotObject dd3d = Engine.GetSingleton("DebugDrawManager"); + + if (!dd3d.HasMethod(get_funcs_is_double_name)) + { + GD.PrintErr(log_prefix, get_funcs_is_double_name, " not found!"); + failed_to_load = true; + return null; + } + + bool is_double = OS.HasFeature("double"); + + if (dd3d.Call(get_funcs_is_double_name).AsBool() != is_double) + { + GD.PrintErr(log_prefix, "The precision of Vectors and Matrices of DD3D and the current library do not match!"); + failed_to_load = true; + return null; + } + + foreach (string name in new string[] { get_funcs_hash_name, get_classes_name, get_funcs_name }) + { + if (!dd3d.HasMethod(name)) + { + GD.PrintErr(log_prefix, name, " not found!"); + failed_to_load = true; + return null; + } + } + + dd3d_c = dd3d; + return dd3d_c; + } + else + { + GD.PrintErr(log_prefix, "DebugDrawManager not found! Most likely, DebugDraw3D was not loaded correctly."); + failed_to_load = true; + } + + return null; + } + + static bool _load_function(string name, ref dlgt_T func) + { + GodotObject dd3d = get_dd3d(); + if (dd3d != null) + { + Godot.Collections.Dictionary api = dd3d.Call(get_funcs_name).AsGodotDictionary(); + if (api.ContainsKey(name)) + { + Godot.Collections.Dictionary func_dict = api[name].AsGodotDictionary(); + + // TODO: signature check? + + func = Marshal.GetDelegateForFunctionPointer((nint)func_dict["ptr"].AsInt64()); + return true; + } + else + { + GD.PrintErr(log_prefix, "!!! FUNCTION NOT FOUND !!! function name: ", name); + return false; + } + } + return false; + } + + static int _get_class_size(Type cls) + { + GodotObject dd3d = get_dd3d(); + if (dd3d != null) + { + Godot.Collections.Dictionary api = dd3d.Call(get_classes_name).AsGodotDictionary(); + if (api.ContainsKey(cls.Name)) + { + Godot.Collections.Dictionary cls_dict = api[cls.Name].AsGodotDictionary(); + + var size = cls_dict["size"].AsInt32(); + dd3d_class_sizes[cls] = size; + return size; + } + else + { + GD.PrintErr(log_prefix, "!!! CLASS NOT FOUND !!! class name: ", cls.Name); + return -1; // crash + } + } + return -1; // crash + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool LoadFunction(string name, ref dlgt_T func, ref DD3DFuncLoadingResult result) + { + if (result == DD3DFuncLoadingResult.None) + result = _load_function(name, ref func) ? DD3DFuncLoadingResult.Success : DD3DFuncLoadingResult.Failure; + if (result == DD3DFuncLoadingResult.Failure) + return false; + return true; + } + + public static int GetDD3DClassSize(Type cls) + { + if (dd3d_class_sizes.TryGetValue(cls, out int val)) + return val; + else + return _get_class_size(cls); + } + + public static readonly Color _default_arg_0 = new Color(0.96f, 0.96f, 0.96f, 1.0f); + public static readonly Color _default_arg_1 = new Color(0, 0, 0, 0); + public static readonly Vector3 _default_arg_2 = new Vector3(real_t.PositiveInfinity, real_t.PositiveInfinity, real_t.PositiveInfinity); +} + +// Start of the generated API + +/// +/// +/// This is a class for storing part of the DebugDraw2D configuration. +/// +/// +/// You can use DebugDraw2D.get_config to get the current instance of the configuration. +/// +internal class DebugDraw2DConfig : IDisposable +{ + public enum BlockPosition : uint + { + LeftTop = 0, + RightTop = 1, + LeftBottom = 2, + RightBottom = 3, + } + + IntPtr inst_ptr; + + public DebugDraw2DConfig(IntPtr inst_ptr) + { + this.inst_ptr = inst_ptr; + } + + public DebugDraw2DConfig(bool instantiate = true) + { + this.inst_ptr = instantiate ? Create() : CreateNullptr(); + } + + ~DebugDraw2DConfig() => Dispose(); + + public static explicit operator IntPtr(DebugDraw2DConfig o) { return o.inst_ptr; } + + public void Dispose() + { + if (inst_ptr != IntPtr.Zero) + { + Destroy(inst_ptr); + inst_ptr = IntPtr.Zero; + } + } + + /// + /// Position of the text block + /// + public DebugDraw2DConfig.BlockPosition TextBlockPosition { get => GetTextBlockPosition(); set => SetTextBlockPosition(value); } + + /// + /// Offset from the corner selected in 'set_text_block_position' + /// + public Vector2I TextBlockOffset { get => GetTextBlockOffset(); set => SetTextBlockOffset(value); } + + /// + /// Text padding for each line + /// + public Vector2I TextPadding { get => GetTextPadding(); set => SetTextPadding(value); } + + /// + /// How long the text remains visible after creation. + /// + public real_t TextDefaultDuration { get => GetTextDefaultDuration(); set => SetTextDefaultDuration(value); } + + /// + /// Default text size + /// + public int TextDefaultSize { get => GetTextDefaultSize(); set => SetTextDefaultSize(value); } + + /// + /// Default color of the text + /// + public Color TextForegroundColor { get => GetTextForegroundColor(); set => SetTextForegroundColor(value); } + + /// + /// Background color of the text + /// + public Color TextBackgroundColor { get => GetTextBackgroundColor(); set => SetTextBackgroundColor(value); } + + /// + /// Custom text Font + /// + public Font TextCustomFont { get => GetTextCustomFont(); set => SetTextCustomFont(value); } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_set_text_block_position(IntPtr inst_ptr, uint /*DebugDraw2DConfig::BlockPosition*/ _position); + static dlgt_DebugDraw2DConfig_set_text_block_position func_DebugDraw2DConfig_set_text_block_position; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_set_text_block_position; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate uint /*DebugDraw2DConfig::BlockPosition*/ dlgt_DebugDraw2DConfig_get_text_block_position(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_get_text_block_position func_DebugDraw2DConfig_get_text_block_position; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_get_text_block_position; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_set_text_block_offset(IntPtr inst_ptr, Vector2I _offset); + static dlgt_DebugDraw2DConfig_set_text_block_offset func_DebugDraw2DConfig_set_text_block_offset; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_set_text_block_offset; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate Vector2I dlgt_DebugDraw2DConfig_get_text_block_offset(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_get_text_block_offset func_DebugDraw2DConfig_get_text_block_offset; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_get_text_block_offset; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_set_text_padding(IntPtr inst_ptr, Vector2I _padding); + static dlgt_DebugDraw2DConfig_set_text_padding func_DebugDraw2DConfig_set_text_padding; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_set_text_padding; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate Vector2I dlgt_DebugDraw2DConfig_get_text_padding(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_get_text_padding func_DebugDraw2DConfig_get_text_padding; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_get_text_padding; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_set_text_default_duration(IntPtr inst_ptr, real_t _duration); + static dlgt_DebugDraw2DConfig_set_text_default_duration func_DebugDraw2DConfig_set_text_default_duration; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_set_text_default_duration; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate real_t dlgt_DebugDraw2DConfig_get_text_default_duration(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_get_text_default_duration func_DebugDraw2DConfig_get_text_default_duration; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_get_text_default_duration; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_set_text_default_size(IntPtr inst_ptr, int _size); + static dlgt_DebugDraw2DConfig_set_text_default_size func_DebugDraw2DConfig_set_text_default_size; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_set_text_default_size; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate int dlgt_DebugDraw2DConfig_get_text_default_size(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_get_text_default_size func_DebugDraw2DConfig_get_text_default_size; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_get_text_default_size; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_set_text_foreground_color(IntPtr inst_ptr, Color _new_color); + static dlgt_DebugDraw2DConfig_set_text_foreground_color func_DebugDraw2DConfig_set_text_foreground_color; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_set_text_foreground_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate Color dlgt_DebugDraw2DConfig_get_text_foreground_color(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_get_text_foreground_color func_DebugDraw2DConfig_get_text_foreground_color; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_get_text_foreground_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_set_text_background_color(IntPtr inst_ptr, Color _new_color); + static dlgt_DebugDraw2DConfig_set_text_background_color func_DebugDraw2DConfig_set_text_background_color; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_set_text_background_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate Color dlgt_DebugDraw2DConfig_get_text_background_color(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_get_text_background_color func_DebugDraw2DConfig_get_text_background_color; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_get_text_background_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_set_text_custom_font(IntPtr inst_ptr, ulong _custom_font); + static dlgt_DebugDraw2DConfig_set_text_custom_font func_DebugDraw2DConfig_set_text_custom_font; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_set_text_custom_font; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate ulong dlgt_DebugDraw2DConfig_get_text_custom_font(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_get_text_custom_font func_DebugDraw2DConfig_get_text_custom_font; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_get_text_custom_font; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw2DConfig_create(); + static dlgt_DebugDraw2DConfig_create func_DebugDraw2DConfig_create; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_create; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw2DConfig_create_nullptr(); + static dlgt_DebugDraw2DConfig_create_nullptr func_DebugDraw2DConfig_create_nullptr; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_create_nullptr; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DConfig_destroy(IntPtr inst_ptr); + static dlgt_DebugDraw2DConfig_destroy func_DebugDraw2DConfig_destroy; static DD3DFuncLoadingResult func_load_result_DebugDraw2DConfig_destroy; + + /// + /// Position of the text block + /// + public void SetTextBlockPosition(DebugDraw2DConfig.BlockPosition _position) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_set_text_block_position", ref func_DebugDraw2DConfig_set_text_block_position, ref func_load_result_DebugDraw2DConfig_set_text_block_position)) + return; + func_DebugDraw2DConfig_set_text_block_position(inst_ptr, (uint)(_position)); +#endif + } + } + + public DebugDraw2DConfig.BlockPosition GetTextBlockPosition() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_get_text_block_position", ref func_DebugDraw2DConfig_get_text_block_position, ref func_load_result_DebugDraw2DConfig_get_text_block_position)) + return default; + return (DebugDraw2DConfig.BlockPosition)func_DebugDraw2DConfig_get_text_block_position(inst_ptr); + } + + /// + /// Offset from the corner selected in 'set_text_block_position' + /// + public void SetTextBlockOffset(Vector2I _offset) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_set_text_block_offset", ref func_DebugDraw2DConfig_set_text_block_offset, ref func_load_result_DebugDraw2DConfig_set_text_block_offset)) + return; + func_DebugDraw2DConfig_set_text_block_offset(inst_ptr, _offset); +#endif + } + } + + public Vector2I GetTextBlockOffset() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_get_text_block_offset", ref func_DebugDraw2DConfig_get_text_block_offset, ref func_load_result_DebugDraw2DConfig_get_text_block_offset)) + return default; + return func_DebugDraw2DConfig_get_text_block_offset(inst_ptr); + } + + /// + /// Text padding for each line + /// + public void SetTextPadding(Vector2I _padding) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_set_text_padding", ref func_DebugDraw2DConfig_set_text_padding, ref func_load_result_DebugDraw2DConfig_set_text_padding)) + return; + func_DebugDraw2DConfig_set_text_padding(inst_ptr, _padding); +#endif + } + } + + public Vector2I GetTextPadding() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_get_text_padding", ref func_DebugDraw2DConfig_get_text_padding, ref func_load_result_DebugDraw2DConfig_get_text_padding)) + return default; + return func_DebugDraw2DConfig_get_text_padding(inst_ptr); + } + + /// + /// How long the text remains visible after creation. + /// + public void SetTextDefaultDuration(real_t _duration) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_set_text_default_duration", ref func_DebugDraw2DConfig_set_text_default_duration, ref func_load_result_DebugDraw2DConfig_set_text_default_duration)) + return; + func_DebugDraw2DConfig_set_text_default_duration(inst_ptr, _duration); +#endif + } + } + + public real_t GetTextDefaultDuration() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_get_text_default_duration", ref func_DebugDraw2DConfig_get_text_default_duration, ref func_load_result_DebugDraw2DConfig_get_text_default_duration)) + return default; + return func_DebugDraw2DConfig_get_text_default_duration(inst_ptr); + } + + /// + /// Default text size + /// + public void SetTextDefaultSize(int _size) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_set_text_default_size", ref func_DebugDraw2DConfig_set_text_default_size, ref func_load_result_DebugDraw2DConfig_set_text_default_size)) + return; + func_DebugDraw2DConfig_set_text_default_size(inst_ptr, _size); +#endif + } + } + + public int GetTextDefaultSize() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_get_text_default_size", ref func_DebugDraw2DConfig_get_text_default_size, ref func_load_result_DebugDraw2DConfig_get_text_default_size)) + return default; + return func_DebugDraw2DConfig_get_text_default_size(inst_ptr); + } + + /// + /// Default color of the text + /// + public void SetTextForegroundColor(Color _new_color) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_set_text_foreground_color", ref func_DebugDraw2DConfig_set_text_foreground_color, ref func_load_result_DebugDraw2DConfig_set_text_foreground_color)) + return; + func_DebugDraw2DConfig_set_text_foreground_color(inst_ptr, _new_color); +#endif + } + } + + public Color GetTextForegroundColor() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_get_text_foreground_color", ref func_DebugDraw2DConfig_get_text_foreground_color, ref func_load_result_DebugDraw2DConfig_get_text_foreground_color)) + return default; + return func_DebugDraw2DConfig_get_text_foreground_color(inst_ptr); + } + + /// + /// Background color of the text + /// + public void SetTextBackgroundColor(Color _new_color) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_set_text_background_color", ref func_DebugDraw2DConfig_set_text_background_color, ref func_load_result_DebugDraw2DConfig_set_text_background_color)) + return; + func_DebugDraw2DConfig_set_text_background_color(inst_ptr, _new_color); +#endif + } + } + + public Color GetTextBackgroundColor() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_get_text_background_color", ref func_DebugDraw2DConfig_get_text_background_color, ref func_load_result_DebugDraw2DConfig_get_text_background_color)) + return default; + return func_DebugDraw2DConfig_get_text_background_color(inst_ptr); + } + + /// + /// Custom text Font + /// + public void SetTextCustomFont(Font _custom_font) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_set_text_custom_font", ref func_DebugDraw2DConfig_set_text_custom_font, ref func_load_result_DebugDraw2DConfig_set_text_custom_font)) + return; + func_DebugDraw2DConfig_set_text_custom_font(inst_ptr, _custom_font != null ? _custom_font.GetInstanceId() : 0); +#endif + } + } + + public Font GetTextCustomFont() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_get_text_custom_font", ref func_DebugDraw2DConfig_get_text_custom_font, ref func_load_result_DebugDraw2DConfig_get_text_custom_font)) + return default; + return (Font)GodotObject.InstanceFromId(func_DebugDraw2DConfig_get_text_custom_font(inst_ptr)); + } + + private static IntPtr Create() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_create", ref func_DebugDraw2DConfig_create, ref func_load_result_DebugDraw2DConfig_create)) + return IntPtr.Zero; + return func_DebugDraw2DConfig_create(); + } + + private static IntPtr CreateNullptr() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_create_nullptr", ref func_DebugDraw2DConfig_create_nullptr, ref func_load_result_DebugDraw2DConfig_create_nullptr)) + return IntPtr.Zero; + return func_DebugDraw2DConfig_create_nullptr(); + } + + private static void Destroy(IntPtr inst_ptr) + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DConfig_destroy", ref func_DebugDraw2DConfig_destroy, ref func_load_result_DebugDraw2DConfig_destroy)) + return; + func_DebugDraw2DConfig_destroy(inst_ptr); + } + +}; // class DebugDraw2DConfig + +/// +/// +/// Singleton class for calling debugging 2D methods. +/// +/// +/// Currently, this class supports drawing an overlay with text. +/// +internal static class DebugDraw2D +{ + /// + /// Set whether debug drawing works or not. + /// + public static bool DebugEnabled { get => IsDebugEnabled(); set => SetDebugEnabled(value); } + + /// + /// Set the configuration global for everything in DebugDraw2D. + /// + public static DebugDraw2DConfig Config { get => GetConfig(); set => SetConfig(value); } + + /// + /// Set a custom Control to be used as the canvas for drawing the graphic. + /// + /// You can use any Control, even one that is in a different window. + /// + public static Control CustomCanvas { get => GetCustomCanvas(); set => SetCustomCanvas(value); } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2D_set_debug_enabled(bool _state); + static dlgt_DebugDraw2D_set_debug_enabled func_DebugDraw2D_set_debug_enabled; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_set_debug_enabled; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw2D_is_debug_enabled(); + static dlgt_DebugDraw2D_is_debug_enabled func_DebugDraw2D_is_debug_enabled; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_is_debug_enabled; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2D_set_config(IntPtr _cfg); + static dlgt_DebugDraw2D_set_config func_DebugDraw2D_set_config; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_set_config; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw2D_get_config(); + static dlgt_DebugDraw2D_get_config func_DebugDraw2D_get_config; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_get_config; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2D_set_custom_canvas(ulong /*godot::Control*/ _canvas); + static dlgt_DebugDraw2D_set_custom_canvas func_DebugDraw2D_set_custom_canvas; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_set_custom_canvas; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate ulong dlgt_DebugDraw2D_get_custom_canvas(); + static dlgt_DebugDraw2D_get_custom_canvas func_DebugDraw2D_get_custom_canvas; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_get_custom_canvas; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw2D_get_render_stats(); + static dlgt_DebugDraw2D_get_render_stats func_DebugDraw2D_get_render_stats; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_get_render_stats; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2D_clear_all(); + static dlgt_DebugDraw2D_clear_all func_DebugDraw2D_clear_all; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_clear_all; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2D_begin_text_group_c([MarshalAs(UnmanagedType.LPUTF8Str)] string /*godot::String*/ group_title_string, int group_priority, Color group_color, bool show_title, int title_size, int text_size); + static dlgt_DebugDraw2D_begin_text_group_c func_DebugDraw2D_begin_text_group_c; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_begin_text_group_c; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2D_end_text_group(); + static dlgt_DebugDraw2D_end_text_group func_DebugDraw2D_end_text_group; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_end_text_group; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2D_set_text_c([MarshalAs(UnmanagedType.LPUTF8Str)] string /*godot::String*/ key_string, [MarshalAs(UnmanagedType.LPUTF8Str)] string /*godot::String*/ value_string, int priority, Color color_of_value, real_t duration); + static dlgt_DebugDraw2D_set_text_c func_DebugDraw2D_set_text_c; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_set_text_c; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2D_clear_texts(); + static dlgt_DebugDraw2D_clear_texts func_DebugDraw2D_clear_texts; static DD3DFuncLoadingResult func_load_result_DebugDraw2D_clear_texts; + + /// + /// Set whether debug drawing works or not. + /// + public static void SetDebugEnabled(bool _state) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_set_debug_enabled", ref func_DebugDraw2D_set_debug_enabled, ref func_load_result_DebugDraw2D_set_debug_enabled)) + return; + func_DebugDraw2D_set_debug_enabled(_state); +#endif + } + } + + public static bool IsDebugEnabled() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_is_debug_enabled", ref func_DebugDraw2D_is_debug_enabled, ref func_load_result_DebugDraw2D_is_debug_enabled)) + return default; + return func_DebugDraw2D_is_debug_enabled(); + } + + /// + /// Set the configuration global for everything in DebugDraw2D. + /// + public static void SetConfig(DebugDraw2DConfig _cfg) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_set_config", ref func_DebugDraw2D_set_config, ref func_load_result_DebugDraw2D_set_config)) + return; + func_DebugDraw2D_set_config((IntPtr)_cfg); +#endif + } + } + + /// + /// Get the DebugDraw2DConfig. + /// + public static DebugDraw2DConfig GetConfig() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_get_config", ref func_DebugDraw2D_get_config, ref func_load_result_DebugDraw2D_get_config)) + return null; + return new DebugDraw2DConfig(func_DebugDraw2D_get_config()); + } + + /// + /// Set a custom Control to be used as the canvas for drawing the graphic. + /// + /// You can use any Control, even one that is in a different window. + /// + public static void SetCustomCanvas(Control _canvas) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_set_custom_canvas", ref func_DebugDraw2D_set_custom_canvas, ref func_load_result_DebugDraw2D_set_custom_canvas)) + return; + func_DebugDraw2D_set_custom_canvas(_canvas != null ? _canvas.GetInstanceId() : 0); +#endif + } + } + + public static Control GetCustomCanvas() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_get_custom_canvas", ref func_DebugDraw2D_get_custom_canvas, ref func_load_result_DebugDraw2D_get_custom_canvas)) + return default; + return (Control)GodotObject.InstanceFromId(func_DebugDraw2D_get_custom_canvas()); + } + + /// + /// Returns the DebugDraw2DStats instance with the current statistics. + /// + /// Some data can be delayed by 1 frame. + /// + public static DebugDraw2DStats GetRenderStats() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_get_render_stats", ref func_DebugDraw2D_get_render_stats, ref func_load_result_DebugDraw2D_get_render_stats)) + return null; + return new DebugDraw2DStats(func_DebugDraw2D_get_render_stats()); + } + + /// + /// Clear all 2D objects + /// + public static void ClearAll() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_clear_all", ref func_DebugDraw2D_clear_all, ref func_load_result_DebugDraw2D_clear_all)) + return; + func_DebugDraw2D_clear_all(); +#endif + } + } + + /// + /// Begin a text group to which all of the following text from DebugDraw2D.set_text will be added + /// + /// + /// Group title and ID + /// Group priority based on which groups will be sorted from top to bottom. + /// Main color of the group + /// Whether to show the title + /// Title font size + /// Text font size + public static void BeginTextGroup(string group_title, int group_priority = 0, Color? group_color = null, bool show_title = true, int title_size = -1, int text_size = -1) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_begin_text_group_c", ref func_DebugDraw2D_begin_text_group_c, ref func_load_result_DebugDraw2D_begin_text_group_c)) + return; + func_DebugDraw2D_begin_text_group_c(group_title, group_priority, group_color ?? InternalDD3DApiLoaderUtils_._default_arg_0, show_title, title_size, text_size); +#endif + } + } + + /// + /// Ends the text group. Should be called after DebugDraw2D.begin_text_group. + /// + /// If you need to create multiple groups, just call DebugDraw2D.begin_text_group again and this function at the end. + /// + public static void EndTextGroup() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_end_text_group", ref func_DebugDraw2D_end_text_group, ref func_load_result_DebugDraw2D_end_text_group)) + return; + func_DebugDraw2D_end_text_group(); +#endif + } + } + + /// + /// Add or update text in an overlay + /// + /// + /// Left value if 'value' is set, otherwise the entire string is 'key' + /// Value of field + /// Priority of this line. Lower value is higher position + /// Value color + /// Expiration time + public static void SetText(string key, string value = "", int priority = 0, Color? color_of_value = null, real_t duration = -1) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_set_text_c", ref func_DebugDraw2D_set_text_c, ref func_load_result_DebugDraw2D_set_text_c)) + return; + func_DebugDraw2D_set_text_c(key, value, priority, color_of_value ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Clear all text + /// + public static void ClearTexts() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2D_clear_texts", ref func_DebugDraw2D_clear_texts, ref func_load_result_DebugDraw2D_clear_texts)) + return; + func_DebugDraw2D_clear_texts(); +#endif + } + } + +} // class DebugDraw2D + +/// +/// +/// You can get basic statistics about 2D rendering from this class. +/// +/// +/// All names try to reflect what they mean. +/// +/// To get an instance of this class with current statistics, use DebugDraw2D.get_render_stats. +/// +internal class DebugDraw2DStats : IDisposable +{ + IntPtr inst_ptr; + + public DebugDraw2DStats(IntPtr inst_ptr) + { + this.inst_ptr = inst_ptr; + } + + public DebugDraw2DStats(bool instantiate = true) + { + this.inst_ptr = instantiate ? Create() : CreateNullptr(); + } + + ~DebugDraw2DStats() => Dispose(); + + public static explicit operator IntPtr(DebugDraw2DStats o) { return o.inst_ptr; } + + public void Dispose() + { + if (inst_ptr != IntPtr.Zero) + { + Destroy(inst_ptr); + inst_ptr = IntPtr.Zero; + } + } + + public long OverlayTextGroups { get => GetOverlayTextGroups(); set => SetOverlayTextGroups(value); } + + public long OverlayTextLines { get => GetOverlayTextLines(); set => SetOverlayTextLines(value); } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw2DStats_get_overlay_text_groups(IntPtr inst_ptr); + static dlgt_DebugDraw2DStats_get_overlay_text_groups func_DebugDraw2DStats_get_overlay_text_groups; static DD3DFuncLoadingResult func_load_result_DebugDraw2DStats_get_overlay_text_groups; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DStats_set_overlay_text_groups(IntPtr inst_ptr, long val); + static dlgt_DebugDraw2DStats_set_overlay_text_groups func_DebugDraw2DStats_set_overlay_text_groups; static DD3DFuncLoadingResult func_load_result_DebugDraw2DStats_set_overlay_text_groups; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw2DStats_get_overlay_text_lines(IntPtr inst_ptr); + static dlgt_DebugDraw2DStats_get_overlay_text_lines func_DebugDraw2DStats_get_overlay_text_lines; static DD3DFuncLoadingResult func_load_result_DebugDraw2DStats_get_overlay_text_lines; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DStats_set_overlay_text_lines(IntPtr inst_ptr, long val); + static dlgt_DebugDraw2DStats_set_overlay_text_lines func_DebugDraw2DStats_set_overlay_text_lines; static DD3DFuncLoadingResult func_load_result_DebugDraw2DStats_set_overlay_text_lines; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw2DStats_create(); + static dlgt_DebugDraw2DStats_create func_DebugDraw2DStats_create; static DD3DFuncLoadingResult func_load_result_DebugDraw2DStats_create; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw2DStats_create_nullptr(); + static dlgt_DebugDraw2DStats_create_nullptr func_DebugDraw2DStats_create_nullptr; static DD3DFuncLoadingResult func_load_result_DebugDraw2DStats_create_nullptr; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw2DStats_destroy(IntPtr inst_ptr); + static dlgt_DebugDraw2DStats_destroy func_DebugDraw2DStats_destroy; static DD3DFuncLoadingResult func_load_result_DebugDraw2DStats_destroy; + + public long GetOverlayTextGroups() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DStats_get_overlay_text_groups", ref func_DebugDraw2DStats_get_overlay_text_groups, ref func_load_result_DebugDraw2DStats_get_overlay_text_groups)) + return default; + return func_DebugDraw2DStats_get_overlay_text_groups(inst_ptr); + } + + public void SetOverlayTextGroups(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DStats_set_overlay_text_groups", ref func_DebugDraw2DStats_set_overlay_text_groups, ref func_load_result_DebugDraw2DStats_set_overlay_text_groups)) + return; + func_DebugDraw2DStats_set_overlay_text_groups(inst_ptr, val); +#endif + } + } + + public long GetOverlayTextLines() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DStats_get_overlay_text_lines", ref func_DebugDraw2DStats_get_overlay_text_lines, ref func_load_result_DebugDraw2DStats_get_overlay_text_lines)) + return default; + return func_DebugDraw2DStats_get_overlay_text_lines(inst_ptr); + } + + public void SetOverlayTextLines(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DStats_set_overlay_text_lines", ref func_DebugDraw2DStats_set_overlay_text_lines, ref func_load_result_DebugDraw2DStats_set_overlay_text_lines)) + return; + func_DebugDraw2DStats_set_overlay_text_lines(inst_ptr, val); +#endif + } + } + + private static IntPtr Create() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DStats_create", ref func_DebugDraw2DStats_create, ref func_load_result_DebugDraw2DStats_create)) + return IntPtr.Zero; + return func_DebugDraw2DStats_create(); + } + + private static IntPtr CreateNullptr() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DStats_create_nullptr", ref func_DebugDraw2DStats_create_nullptr, ref func_load_result_DebugDraw2DStats_create_nullptr)) + return IntPtr.Zero; + return func_DebugDraw2DStats_create_nullptr(); + } + + private static void Destroy(IntPtr inst_ptr) + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw2DStats_destroy", ref func_DebugDraw2DStats_destroy, ref func_load_result_DebugDraw2DStats_destroy)) + return; + func_DebugDraw2DStats_destroy(inst_ptr); + } + +}; // class DebugDraw2DStats + +/// +/// +/// This is a class for storing part of the DebugDraw3D configuration. +/// +/// +/// You can use DebugDraw3D.get_config to get the current instance of the configuration. +/// +internal class DebugDraw3DConfig : IDisposable +{ + public enum CullingMode : uint + { + Disabled = 0, + Rough = 1, + Precise = 2, + } + + IntPtr inst_ptr; + + public DebugDraw3DConfig(IntPtr inst_ptr) + { + this.inst_ptr = inst_ptr; + } + + public DebugDraw3DConfig(bool instantiate = true) + { + this.inst_ptr = instantiate ? Create() : CreateNullptr(); + } + + ~DebugDraw3DConfig() => Dispose(); + + public static explicit operator IntPtr(DebugDraw3DConfig o) { return o.inst_ptr; } + + public void Dispose() + { + if (inst_ptr != IntPtr.Zero) + { + Destroy(inst_ptr); + inst_ptr = IntPtr.Zero; + } + } + + /// + /// Set whether debug 3D graphics rendering is frozen. + /// This means that previously created geometry will not be updated until set to false or until DebugDraw3D.clear_all is called. + /// + public bool Freeze3dRender { get => IsFreeze3dRender(); set => SetFreeze3dRender(value); } + + /// + /// Set whether the boundaries of instances are displayed. + /// Based on these boundaries, instances are culled if set_use_frustum_culling is activated. + /// + public bool VisibleInstanceBounds { get => IsVisibleInstanceBounds(); set => SetVisibleInstanceBounds(value); } + + /// + /// Deprecated + /// Set whether frustum culling is used. + /// This is a wrapper over DebugDraw3DConfig.set_frustum_culling_mode and exists for compatibility with older versions. + /// + /// + /// Enabling or disabling this option does not affect the rough culling based on the camera's AABB of frustum. + /// This option enables more accurate culling based on the camera's frustum planes. + /// + /// + public bool UseFrustumCulling { get => IsUseFrustumCulling(); set => SetUseFrustumCulling(value); } + + /// + /// Set frustum culling mode. + /// + public DebugDraw3DConfig.CullingMode FrustumCullingMode { get => GetFrustumCullingMode(); set => SetFrustumCullingMode(value); } + + /// + /// Change the distance between the Far and Near Planes of the Viewport's Camera3D. + /// + public real_t FrustumLengthScale { get => GetFrustumLengthScale(); set => SetFrustumLengthScale(value); } + + /// + /// Set the forced use of the scene camera instead of the editor camera. + /// + public bool ForceUseCameraFromScene { get => IsForceUseCameraFromScene(); set => SetForceUseCameraFromScene(value); } + + /// + /// Set the visibility layer on which the 3D geometry will be drawn. + /// Similar to using VisualInstance3D.layers. + /// + public int GeometryRenderLayers { get => GetGeometryRenderLayers(); set => SetGeometryRenderLayers(value); } + + /// + /// Set the default color for the collision point of DebugDraw3D.draw_line_hit. + /// + public Color LineHitColor { get => GetLineHitColor(); set => SetLineHitColor(value); } + + /// + /// Set the default color for the line after the collision point of DebugDraw3D.draw_line_hit. + /// + public Color LineAfterHitColor { get => GetLineAfterHitColor(); set => SetLineAfterHitColor(value); } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_freeze_3d_render(IntPtr inst_ptr, bool _state); + static dlgt_DebugDraw3DConfig_set_freeze_3d_render func_DebugDraw3DConfig_set_freeze_3d_render; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_freeze_3d_render; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw3DConfig_is_freeze_3d_render(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_is_freeze_3d_render func_DebugDraw3DConfig_is_freeze_3d_render; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_is_freeze_3d_render; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_visible_instance_bounds(IntPtr inst_ptr, bool _state); + static dlgt_DebugDraw3DConfig_set_visible_instance_bounds func_DebugDraw3DConfig_set_visible_instance_bounds; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_visible_instance_bounds; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw3DConfig_is_visible_instance_bounds(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_is_visible_instance_bounds func_DebugDraw3DConfig_is_visible_instance_bounds; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_is_visible_instance_bounds; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_use_frustum_culling(IntPtr inst_ptr, bool _state); + static dlgt_DebugDraw3DConfig_set_use_frustum_culling func_DebugDraw3DConfig_set_use_frustum_culling; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_use_frustum_culling; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw3DConfig_is_use_frustum_culling(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_is_use_frustum_culling func_DebugDraw3DConfig_is_use_frustum_culling; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_is_use_frustum_culling; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_frustum_culling_mode(IntPtr inst_ptr, uint /*DebugDraw3DConfig::CullingMode*/ _mode); + static dlgt_DebugDraw3DConfig_set_frustum_culling_mode func_DebugDraw3DConfig_set_frustum_culling_mode; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_frustum_culling_mode; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate uint /*DebugDraw3DConfig::CullingMode*/ dlgt_DebugDraw3DConfig_get_frustum_culling_mode(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_get_frustum_culling_mode func_DebugDraw3DConfig_get_frustum_culling_mode; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_get_frustum_culling_mode; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_frustum_length_scale(IntPtr inst_ptr, real_t _distance); + static dlgt_DebugDraw3DConfig_set_frustum_length_scale func_DebugDraw3DConfig_set_frustum_length_scale; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_frustum_length_scale; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate real_t dlgt_DebugDraw3DConfig_get_frustum_length_scale(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_get_frustum_length_scale func_DebugDraw3DConfig_get_frustum_length_scale; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_get_frustum_length_scale; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_force_use_camera_from_scene(IntPtr inst_ptr, bool _state); + static dlgt_DebugDraw3DConfig_set_force_use_camera_from_scene func_DebugDraw3DConfig_set_force_use_camera_from_scene; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_force_use_camera_from_scene; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw3DConfig_is_force_use_camera_from_scene(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_is_force_use_camera_from_scene func_DebugDraw3DConfig_is_force_use_camera_from_scene; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_is_force_use_camera_from_scene; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_geometry_render_layers(IntPtr inst_ptr, int _layers); + static dlgt_DebugDraw3DConfig_set_geometry_render_layers func_DebugDraw3DConfig_set_geometry_render_layers; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_geometry_render_layers; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate int dlgt_DebugDraw3DConfig_get_geometry_render_layers(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_get_geometry_render_layers func_DebugDraw3DConfig_get_geometry_render_layers; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_get_geometry_render_layers; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_line_hit_color(IntPtr inst_ptr, Color _new_color); + static dlgt_DebugDraw3DConfig_set_line_hit_color func_DebugDraw3DConfig_set_line_hit_color; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_line_hit_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate Color dlgt_DebugDraw3DConfig_get_line_hit_color(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_get_line_hit_color func_DebugDraw3DConfig_get_line_hit_color; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_get_line_hit_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_set_line_after_hit_color(IntPtr inst_ptr, Color _new_color); + static dlgt_DebugDraw3DConfig_set_line_after_hit_color func_DebugDraw3DConfig_set_line_after_hit_color; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_set_line_after_hit_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate Color dlgt_DebugDraw3DConfig_get_line_after_hit_color(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_get_line_after_hit_color func_DebugDraw3DConfig_get_line_after_hit_color; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_get_line_after_hit_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3DConfig_create(); + static dlgt_DebugDraw3DConfig_create func_DebugDraw3DConfig_create; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_create; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3DConfig_create_nullptr(); + static dlgt_DebugDraw3DConfig_create_nullptr func_DebugDraw3DConfig_create_nullptr; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_create_nullptr; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DConfig_destroy(IntPtr inst_ptr); + static dlgt_DebugDraw3DConfig_destroy func_DebugDraw3DConfig_destroy; static DD3DFuncLoadingResult func_load_result_DebugDraw3DConfig_destroy; + + /// + /// Set whether debug 3D graphics rendering is frozen. + /// This means that previously created geometry will not be updated until set to false or until DebugDraw3D.clear_all is called. + /// + public void SetFreeze3dRender(bool _state) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_freeze_3d_render", ref func_DebugDraw3DConfig_set_freeze_3d_render, ref func_load_result_DebugDraw3DConfig_set_freeze_3d_render)) + return; + func_DebugDraw3DConfig_set_freeze_3d_render(inst_ptr, _state); +#endif + } + } + + public bool IsFreeze3dRender() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_is_freeze_3d_render", ref func_DebugDraw3DConfig_is_freeze_3d_render, ref func_load_result_DebugDraw3DConfig_is_freeze_3d_render)) + return default; + return func_DebugDraw3DConfig_is_freeze_3d_render(inst_ptr); + } + + /// + /// Set whether the boundaries of instances are displayed. + /// Based on these boundaries, instances are culled if set_use_frustum_culling is activated. + /// + public void SetVisibleInstanceBounds(bool _state) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_visible_instance_bounds", ref func_DebugDraw3DConfig_set_visible_instance_bounds, ref func_load_result_DebugDraw3DConfig_set_visible_instance_bounds)) + return; + func_DebugDraw3DConfig_set_visible_instance_bounds(inst_ptr, _state); +#endif + } + } + + public bool IsVisibleInstanceBounds() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_is_visible_instance_bounds", ref func_DebugDraw3DConfig_is_visible_instance_bounds, ref func_load_result_DebugDraw3DConfig_is_visible_instance_bounds)) + return default; + return func_DebugDraw3DConfig_is_visible_instance_bounds(inst_ptr); + } + + /// + /// Deprecated + /// Set whether frustum culling is used. + /// This is a wrapper over DebugDraw3DConfig.set_frustum_culling_mode and exists for compatibility with older versions. + /// + /// + /// Enabling or disabling this option does not affect the rough culling based on the camera's AABB of frustum. + /// This option enables more accurate culling based on the camera's frustum planes. + /// + /// + public void SetUseFrustumCulling(bool _state) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_use_frustum_culling", ref func_DebugDraw3DConfig_set_use_frustum_culling, ref func_load_result_DebugDraw3DConfig_set_use_frustum_culling)) + return; + func_DebugDraw3DConfig_set_use_frustum_culling(inst_ptr, _state); +#endif + } + } + + public bool IsUseFrustumCulling() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_is_use_frustum_culling", ref func_DebugDraw3DConfig_is_use_frustum_culling, ref func_load_result_DebugDraw3DConfig_is_use_frustum_culling)) + return default; + return func_DebugDraw3DConfig_is_use_frustum_culling(inst_ptr); + } + + /// + /// Set frustum culling mode. + /// + public void SetFrustumCullingMode(DebugDraw3DConfig.CullingMode _mode) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_frustum_culling_mode", ref func_DebugDraw3DConfig_set_frustum_culling_mode, ref func_load_result_DebugDraw3DConfig_set_frustum_culling_mode)) + return; + func_DebugDraw3DConfig_set_frustum_culling_mode(inst_ptr, (uint)(_mode)); +#endif + } + } + + public DebugDraw3DConfig.CullingMode GetFrustumCullingMode() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_get_frustum_culling_mode", ref func_DebugDraw3DConfig_get_frustum_culling_mode, ref func_load_result_DebugDraw3DConfig_get_frustum_culling_mode)) + return default; + return (DebugDraw3DConfig.CullingMode)func_DebugDraw3DConfig_get_frustum_culling_mode(inst_ptr); + } + + /// + /// Change the distance between the Far and Near Planes of the Viewport's Camera3D. + /// + public void SetFrustumLengthScale(real_t _distance) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_frustum_length_scale", ref func_DebugDraw3DConfig_set_frustum_length_scale, ref func_load_result_DebugDraw3DConfig_set_frustum_length_scale)) + return; + func_DebugDraw3DConfig_set_frustum_length_scale(inst_ptr, _distance); +#endif + } + } + + public real_t GetFrustumLengthScale() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_get_frustum_length_scale", ref func_DebugDraw3DConfig_get_frustum_length_scale, ref func_load_result_DebugDraw3DConfig_get_frustum_length_scale)) + return default; + return func_DebugDraw3DConfig_get_frustum_length_scale(inst_ptr); + } + + /// + /// Set the forced use of the scene camera instead of the editor camera. + /// + public void SetForceUseCameraFromScene(bool _state) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_force_use_camera_from_scene", ref func_DebugDraw3DConfig_set_force_use_camera_from_scene, ref func_load_result_DebugDraw3DConfig_set_force_use_camera_from_scene)) + return; + func_DebugDraw3DConfig_set_force_use_camera_from_scene(inst_ptr, _state); +#endif + } + } + + public bool IsForceUseCameraFromScene() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_is_force_use_camera_from_scene", ref func_DebugDraw3DConfig_is_force_use_camera_from_scene, ref func_load_result_DebugDraw3DConfig_is_force_use_camera_from_scene)) + return default; + return func_DebugDraw3DConfig_is_force_use_camera_from_scene(inst_ptr); + } + + /// + /// Set the visibility layer on which the 3D geometry will be drawn. + /// Similar to using VisualInstance3D.layers. + /// + public void SetGeometryRenderLayers(int _layers) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_geometry_render_layers", ref func_DebugDraw3DConfig_set_geometry_render_layers, ref func_load_result_DebugDraw3DConfig_set_geometry_render_layers)) + return; + func_DebugDraw3DConfig_set_geometry_render_layers(inst_ptr, _layers); +#endif + } + } + + public int GetGeometryRenderLayers() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_get_geometry_render_layers", ref func_DebugDraw3DConfig_get_geometry_render_layers, ref func_load_result_DebugDraw3DConfig_get_geometry_render_layers)) + return default; + return func_DebugDraw3DConfig_get_geometry_render_layers(inst_ptr); + } + + /// + /// Set the default color for the collision point of DebugDraw3D.draw_line_hit. + /// + public void SetLineHitColor(Color _new_color) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_line_hit_color", ref func_DebugDraw3DConfig_set_line_hit_color, ref func_load_result_DebugDraw3DConfig_set_line_hit_color)) + return; + func_DebugDraw3DConfig_set_line_hit_color(inst_ptr, _new_color); +#endif + } + } + + public Color GetLineHitColor() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_get_line_hit_color", ref func_DebugDraw3DConfig_get_line_hit_color, ref func_load_result_DebugDraw3DConfig_get_line_hit_color)) + return default; + return func_DebugDraw3DConfig_get_line_hit_color(inst_ptr); + } + + /// + /// Set the default color for the line after the collision point of DebugDraw3D.draw_line_hit. + /// + public void SetLineAfterHitColor(Color _new_color) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_set_line_after_hit_color", ref func_DebugDraw3DConfig_set_line_after_hit_color, ref func_load_result_DebugDraw3DConfig_set_line_after_hit_color)) + return; + func_DebugDraw3DConfig_set_line_after_hit_color(inst_ptr, _new_color); +#endif + } + } + + public Color GetLineAfterHitColor() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_get_line_after_hit_color", ref func_DebugDraw3DConfig_get_line_after_hit_color, ref func_load_result_DebugDraw3DConfig_get_line_after_hit_color)) + return default; + return func_DebugDraw3DConfig_get_line_after_hit_color(inst_ptr); + } + + private static IntPtr Create() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_create", ref func_DebugDraw3DConfig_create, ref func_load_result_DebugDraw3DConfig_create)) + return IntPtr.Zero; + return func_DebugDraw3DConfig_create(); + } + + private static IntPtr CreateNullptr() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_create_nullptr", ref func_DebugDraw3DConfig_create_nullptr, ref func_load_result_DebugDraw3DConfig_create_nullptr)) + return IntPtr.Zero; + return func_DebugDraw3DConfig_create_nullptr(); + } + + private static void Destroy(IntPtr inst_ptr) + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DConfig_destroy", ref func_DebugDraw3DConfig_destroy, ref func_load_result_DebugDraw3DConfig_destroy)) + return; + func_DebugDraw3DConfig_destroy(inst_ptr); + } + +}; // class DebugDraw3DConfig + +/// +/// +/// This class is used to override scope parameters for DebugDraw3D. +/// +/// +/// `Scope` means that these overridden parameters will affect the drawn geometry until it exits the current scope. +/// +/// To create it, use DebugDraw3D.new_scoped_config. +/// Immediately after creation, you can change the values and save the reference in a variable. +/// +/// +/// But the main thing is not to save it outside the method or in other objects. +/// After leaving the scope, this object should be deleted. +/// +/// +/// --- +/// +/// Also, you can't use scope config between `await`s unless this object is freed before `await`. +/// So, narrow the scope if you want to use `await` and DebugDraw3DScopeConfig in the same method. +/// Or set the value of the variable to `null` so that the object is cleared due to lack of references. +/// +/// # Bad example +/// var _s = DebugDraw3D.new_scoped_config().set_thickness(0.3) +/// DebugDraw3D.draw_box(Vector3.ZERO, Quaternion.IDENTITY, Vector3.ONE) +/// await get_tree().process_frame +/// # your code... +/// +/// # Good example +/// if true: +/// var _s = DebugDraw3D.new_scoped_config().set_thickness(0.3) +/// DebugDraw3D.draw_box(Vector3.ZERO, Quaternion.IDENTITY, Vector3.ONE) +/// await get_tree().process_frame +/// # your code... +/// +/// +/// +/// ### Examples: +/// +/// var _s = DebugDraw3D.new_scoped_config().set_thickness(0.025).set_center_brightness(0.7) +/// DebugDraw3D.draw_grid_xf(%Grid.global_transform, Vector2i(10,10), Color.LIGHT_GRAY) +/// +/// +/// +/// using (var s = DebugDraw3D.NewScopedConfig().SetThickness(0)) +/// DebugDraw3D.DrawCameraFrustum(dCamera, Colors.DarkOrange); +/// +/// +internal class DebugDraw3DScopeConfig : IDisposable +{ + IntPtr inst_ptr; + + public DebugDraw3DScopeConfig(IntPtr inst_ptr) + { + this.inst_ptr = inst_ptr; + } + + public DebugDraw3DScopeConfig(bool instantiate = true) + { + this.inst_ptr = instantiate ? Create() : CreateNullptr(); + } + + ~DebugDraw3DScopeConfig() => Dispose(); + + public static explicit operator IntPtr(DebugDraw3DScopeConfig o) { return o.inst_ptr; } + + public void Dispose() + { + if (inst_ptr != IntPtr.Zero) + { + Destroy(inst_ptr); + inst_ptr = IntPtr.Zero; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_thickness_selfreturn(IntPtr inst_ptr, real_t _value); + static dlgt_DebugDraw3DScopeConfig_set_thickness_selfreturn func_DebugDraw3DScopeConfig_set_thickness_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_thickness_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate real_t dlgt_DebugDraw3DScopeConfig_get_thickness(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_thickness func_DebugDraw3DScopeConfig_get_thickness; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_thickness; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_center_brightness_selfreturn(IntPtr inst_ptr, real_t _value); + static dlgt_DebugDraw3DScopeConfig_set_center_brightness_selfreturn func_DebugDraw3DScopeConfig_set_center_brightness_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_center_brightness_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate real_t dlgt_DebugDraw3DScopeConfig_get_center_brightness(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_center_brightness func_DebugDraw3DScopeConfig_get_center_brightness; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_center_brightness; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_hd_sphere_selfreturn(IntPtr inst_ptr, bool _value); + static dlgt_DebugDraw3DScopeConfig_set_hd_sphere_selfreturn func_DebugDraw3DScopeConfig_set_hd_sphere_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_hd_sphere_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw3DScopeConfig_is_hd_sphere(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_is_hd_sphere func_DebugDraw3DScopeConfig_is_hd_sphere; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_is_hd_sphere; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_plane_size_selfreturn(IntPtr inst_ptr, real_t _value); + static dlgt_DebugDraw3DScopeConfig_set_plane_size_selfreturn func_DebugDraw3DScopeConfig_set_plane_size_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_plane_size_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate real_t dlgt_DebugDraw3DScopeConfig_get_plane_size(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_plane_size func_DebugDraw3DScopeConfig_get_plane_size; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_plane_size; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_transform_selfreturn(IntPtr inst_ptr, Transform3D _value); + static dlgt_DebugDraw3DScopeConfig_set_transform_selfreturn func_DebugDraw3DScopeConfig_set_transform_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_transform_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate Transform3D dlgt_DebugDraw3DScopeConfig_get_transform(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_transform func_DebugDraw3DScopeConfig_get_transform; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_transform; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_text_outline_color_selfreturn(IntPtr inst_ptr, Color _value); + static dlgt_DebugDraw3DScopeConfig_set_text_outline_color_selfreturn func_DebugDraw3DScopeConfig_set_text_outline_color_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_text_outline_color_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate Color dlgt_DebugDraw3DScopeConfig_get_text_outline_color(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_text_outline_color func_DebugDraw3DScopeConfig_get_text_outline_color; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_text_outline_color; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_text_outline_size_selfreturn(IntPtr inst_ptr, int _value); + static dlgt_DebugDraw3DScopeConfig_set_text_outline_size_selfreturn func_DebugDraw3DScopeConfig_set_text_outline_size_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_text_outline_size_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate int dlgt_DebugDraw3DScopeConfig_get_text_outline_size(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_text_outline_size func_DebugDraw3DScopeConfig_get_text_outline_size; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_text_outline_size; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn(IntPtr inst_ptr, bool _value); + static dlgt_DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn func_DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw3DScopeConfig_get_text_fixed_size(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_text_fixed_size func_DebugDraw3DScopeConfig_get_text_fixed_size; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_text_fixed_size; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_text_font_selfreturn(IntPtr inst_ptr, ulong _value); + static dlgt_DebugDraw3DScopeConfig_set_text_font_selfreturn func_DebugDraw3DScopeConfig_set_text_font_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_text_font_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate ulong dlgt_DebugDraw3DScopeConfig_get_text_font(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_text_font func_DebugDraw3DScopeConfig_get_text_font; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_text_font; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_viewport_selfreturn(IntPtr inst_ptr, ulong /*godot::Viewport*/ _value); + static dlgt_DebugDraw3DScopeConfig_set_viewport_selfreturn func_DebugDraw3DScopeConfig_set_viewport_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_viewport_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate ulong dlgt_DebugDraw3DScopeConfig_get_viewport(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_get_viewport func_DebugDraw3DScopeConfig_get_viewport; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_get_viewport; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_set_no_depth_test_selfreturn(IntPtr inst_ptr, bool _value); + static dlgt_DebugDraw3DScopeConfig_set_no_depth_test_selfreturn func_DebugDraw3DScopeConfig_set_no_depth_test_selfreturn; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_set_no_depth_test_selfreturn; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw3DScopeConfig_is_no_depth_test(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_is_no_depth_test func_DebugDraw3DScopeConfig_is_no_depth_test; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_is_no_depth_test; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3DScopeConfig_create(); + static dlgt_DebugDraw3DScopeConfig_create func_DebugDraw3DScopeConfig_create; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_create; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3DScopeConfig_create_nullptr(); + static dlgt_DebugDraw3DScopeConfig_create_nullptr func_DebugDraw3DScopeConfig_create_nullptr; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_create_nullptr; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DScopeConfig_destroy(IntPtr inst_ptr); + static dlgt_DebugDraw3DScopeConfig_destroy func_DebugDraw3DScopeConfig_destroy; static DD3DFuncLoadingResult func_load_result_DebugDraw3DScopeConfig_destroy; + + /// + /// Set the thickness of the volumetric lines. If the value is 0, the standard wireframe rendering will be used. + /// + /// [THERE WAS AN IMAGE] + /// + public DebugDraw3DScopeConfig SetThickness(real_t _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_thickness_selfreturn", ref func_DebugDraw3DScopeConfig_set_thickness_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_thickness_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_thickness_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public real_t GetThickness() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_thickness", ref func_DebugDraw3DScopeConfig_get_thickness, ref func_load_result_DebugDraw3DScopeConfig_get_thickness)) + return default; + return func_DebugDraw3DScopeConfig_get_thickness(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set the brightness of the central part of the volumetric lines. + /// + /// [THERE WAS AN IMAGE] + /// + public DebugDraw3DScopeConfig SetCenterBrightness(real_t _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_center_brightness_selfreturn", ref func_DebugDraw3DScopeConfig_set_center_brightness_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_center_brightness_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_center_brightness_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public real_t GetCenterBrightness() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_center_brightness", ref func_DebugDraw3DScopeConfig_get_center_brightness, ref func_load_result_DebugDraw3DScopeConfig_get_center_brightness)) + return default; + return func_DebugDraw3DScopeConfig_get_center_brightness(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set the mesh density of the sphere + /// + /// [THERE WAS AN IMAGE] + /// + public DebugDraw3DScopeConfig SetHdSphere(bool _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_hd_sphere_selfreturn", ref func_DebugDraw3DScopeConfig_set_hd_sphere_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_hd_sphere_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_hd_sphere_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public bool IsHdSphere() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_is_hd_sphere", ref func_DebugDraw3DScopeConfig_is_hd_sphere, ref func_load_result_DebugDraw3DScopeConfig_is_hd_sphere)) + return default; + return func_DebugDraw3DScopeConfig_is_hd_sphere(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set the size of the `Plane` in DebugDraw3D.draw_plane. If set to `INF`, the `Far` parameter of the current camera will be used. + /// + /// [THERE WAS AN IMAGE] + /// + public DebugDraw3DScopeConfig SetPlaneSize(real_t _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_plane_size_selfreturn", ref func_DebugDraw3DScopeConfig_set_plane_size_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_plane_size_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_plane_size_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public real_t GetPlaneSize() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_plane_size", ref func_DebugDraw3DScopeConfig_get_plane_size, ref func_load_result_DebugDraw3DScopeConfig_get_plane_size)) + return default; + return func_DebugDraw3DScopeConfig_get_plane_size(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set the base/local `transform` relative to which the shapes will be drawn. + /// + /// [THERE WAS AN IMAGE] + /// + public DebugDraw3DScopeConfig SetTransform(Transform3D _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_transform_selfreturn", ref func_DebugDraw3DScopeConfig_set_transform_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_transform_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_transform_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public Transform3D GetTransform() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_transform", ref func_DebugDraw3DScopeConfig_get_transform, ref func_load_result_DebugDraw3DScopeConfig_get_transform)) + return default; + return func_DebugDraw3DScopeConfig_get_transform(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set the `outline` color in DebugDraw3D.draw_text. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Frequent unsystematic changes to this property can lead to significant performance degradation. + /// + /// + public DebugDraw3DScopeConfig SetTextOutlineColor(Color _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_text_outline_color_selfreturn", ref func_DebugDraw3DScopeConfig_set_text_outline_color_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_text_outline_color_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_text_outline_color_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public Color GetTextOutlineColor() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_text_outline_color", ref func_DebugDraw3DScopeConfig_get_text_outline_color, ref func_load_result_DebugDraw3DScopeConfig_get_text_outline_color)) + return default; + return func_DebugDraw3DScopeConfig_get_text_outline_color(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set the size of the `outline` in DebugDraw3D.draw_text. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Frequent unsystematic changes to this property can lead to significant performance degradation. + /// + /// + public DebugDraw3DScopeConfig SetTextOutlineSize(int _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_text_outline_size_selfreturn", ref func_DebugDraw3DScopeConfig_set_text_outline_size_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_text_outline_size_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_text_outline_size_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public int GetTextOutlineSize() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_text_outline_size", ref func_DebugDraw3DScopeConfig_get_text_outline_size, ref func_load_result_DebugDraw3DScopeConfig_get_text_outline_size)) + return default; + return func_DebugDraw3DScopeConfig_get_text_outline_size(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Makes the text in DebugDraw3D.draw_text the same size regardless of distance. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Frequent unsystematic changes to this property can lead to significant performance degradation. + /// + /// + public DebugDraw3DScopeConfig SetTextFixedSize(bool _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn", ref func_DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_text_fixed_size_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public bool GetTextFixedSize() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_text_fixed_size", ref func_DebugDraw3DScopeConfig_get_text_fixed_size, ref func_load_result_DebugDraw3DScopeConfig_get_text_fixed_size)) + return default; + return func_DebugDraw3DScopeConfig_get_text_fixed_size(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set the font of the text in DebugDraw3D.draw_text. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Frequent unsystematic changes to this property can lead to significant performance degradation. + /// + /// + public DebugDraw3DScopeConfig SetTextFont(Font _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_text_font_selfreturn", ref func_DebugDraw3DScopeConfig_set_text_font_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_text_font_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_text_font_selfreturn(inst_ptr, _value != null ? _value.GetInstanceId() : 0); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public Font GetTextFont() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_text_font", ref func_DebugDraw3DScopeConfig_get_text_font, ref func_load_result_DebugDraw3DScopeConfig_get_text_font)) + return default; + return (Font)GodotObject.InstanceFromId(func_DebugDraw3DScopeConfig_get_text_font(inst_ptr)); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set which Viewport will be used to get World3D. + /// + /// If the World3D of this Viewport has not been used before, + /// then the owner of this World3D will be found in the current branch of the tree, + /// and special observer nodes will be added to it. + /// + /// + /// Objects created for a specific Viewport will use only one camera related to that Viewport for culling. + /// + /// + public DebugDraw3DScopeConfig SetViewport(Viewport _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_viewport_selfreturn", ref func_DebugDraw3DScopeConfig_set_viewport_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_viewport_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_viewport_selfreturn(inst_ptr, _value != null ? _value.GetInstanceId() : 0); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public Viewport GetViewport() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_get_viewport", ref func_DebugDraw3DScopeConfig_get_viewport, ref func_load_result_DebugDraw3DScopeConfig_get_viewport)) + return default; + return (Viewport)GodotObject.InstanceFromId(func_DebugDraw3DScopeConfig_get_viewport(inst_ptr)); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + /// + /// Set whether the `depth_test_disabled` flag is added or not in the shaders of the debug shapes. + /// + /// + /// It may cause artifacts when drawing volumetric objects. + /// + /// + /// [THERE WAS AN IMAGE] + /// + public DebugDraw3DScopeConfig SetNoDepthTest(bool _value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_set_no_depth_test_selfreturn", ref func_DebugDraw3DScopeConfig_set_no_depth_test_selfreturn, ref func_load_result_DebugDraw3DScopeConfig_set_no_depth_test_selfreturn)) + return this; + func_DebugDraw3DScopeConfig_set_no_depth_test_selfreturn(inst_ptr, _value); + return this; +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return this; +#endif + } + + public bool IsNoDepthTest() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_is_no_depth_test", ref func_DebugDraw3DScopeConfig_is_no_depth_test, ref func_load_result_DebugDraw3DScopeConfig_is_no_depth_test)) + return default; + return func_DebugDraw3DScopeConfig_is_no_depth_test(inst_ptr); +#endif + } +#if _DD3D_RUNTIME_CHECK_ENABLED + return default; +#endif + } + + private static IntPtr Create() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_create", ref func_DebugDraw3DScopeConfig_create, ref func_load_result_DebugDraw3DScopeConfig_create)) + return IntPtr.Zero; + return func_DebugDraw3DScopeConfig_create(); + } + + private static IntPtr CreateNullptr() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_create_nullptr", ref func_DebugDraw3DScopeConfig_create_nullptr, ref func_load_result_DebugDraw3DScopeConfig_create_nullptr)) + return IntPtr.Zero; + return func_DebugDraw3DScopeConfig_create_nullptr(); + } + + private static void Destroy(IntPtr inst_ptr) + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DScopeConfig_destroy", ref func_DebugDraw3DScopeConfig_destroy, ref func_load_result_DebugDraw3DScopeConfig_destroy)) + return; + func_DebugDraw3DScopeConfig_destroy(inst_ptr); + } + +}; // class DebugDraw3DScopeConfig + +/// +/// +/// 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. +/// +/// [THERE WAS AN IMAGE] +/// +/// `use_icosphere` and `use_icosphere_for_hd` allow you to change the sphere mesh. +/// +/// [THERE WAS AN IMAGE] +/// +/// +/// Wireframe shapes and volumetric wireframes do not support translucency to avoid overlap issues and for better performance. +/// At this point, you can use translucency when drawing planes DebugDraw3D.draw_plane. +/// +/// +/// --- +/// +/// Objects created in `_physics_process` are processed separately from those created in `_process`, +/// so they will be deleted only in the first physics tick after rendering. +/// This allows to display objects even if several frames passed between physics ticks. +/// +/// +/// --- +/// +/// You can use this class anywhere, including in `_physics_process` and `_process` (and probably from other threads). +/// It is worth mentioning that physics ticks may not be called every frame or may be called several times in one frame. +/// So if you want to avoid multiple identical `draw_` calls, you can call `draw_` methods in `_process` or use such a check: +/// +/// var physics_tick_processed := false +/// func _process(delta: float) -> void: +/// # Reset after rendering frame +/// physics_tick_processed = false +/// # some logic +/// +/// func _physics_process(delta: float) -> void: +/// if not physics_tick_processed: +/// physics_tick_processed = true +/// # some DD3D logic +/// +/// +/// +/// --- +/// +/// Due to the way Godot registers this addon, it is not possible to use the `draw_` methods +/// in the first few frames immediately after the project is launched. +/// +/// +internal static class DebugDraw3D +{ + public enum PointType : uint + { + TypeSquare = 0, + TypeSphere = 1, + } + + /// + /// Set the configuration global for everything in DebugDraw3D. + /// + public static DebugDraw3DConfig Config { get => GetConfig(); set => SetConfig(value); } + + /// + /// Set whether debug drawing works or not. + /// + public static bool DebugEnabled { get => IsDebugEnabled(); set => SetDebugEnabled(value); } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3D_new_scoped_config(); + static dlgt_DebugDraw3D_new_scoped_config func_DebugDraw3D_new_scoped_config; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_new_scoped_config; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3D_scoped_config(); + static dlgt_DebugDraw3D_scoped_config func_DebugDraw3D_scoped_config; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_scoped_config; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_set_config(IntPtr cfg); + static dlgt_DebugDraw3D_set_config func_DebugDraw3D_set_config; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_set_config; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3D_get_config(); + static dlgt_DebugDraw3D_get_config func_DebugDraw3D_get_config; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_get_config; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_set_debug_enabled(bool state); + static dlgt_DebugDraw3D_set_debug_enabled func_DebugDraw3D_set_debug_enabled; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_set_debug_enabled; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDraw3D_is_debug_enabled(); + static dlgt_DebugDraw3D_is_debug_enabled func_DebugDraw3D_is_debug_enabled; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_is_debug_enabled; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3D_get_render_stats(); + static dlgt_DebugDraw3D_get_render_stats func_DebugDraw3D_get_render_stats; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_get_render_stats; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3D_get_render_stats_for_world(ulong /*godot::Viewport*/ viewport); + static dlgt_DebugDraw3D_get_render_stats_for_world func_DebugDraw3D_get_render_stats_for_world; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_get_render_stats_for_world; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_regenerate_geometry_meshes(); + static dlgt_DebugDraw3D_regenerate_geometry_meshes func_DebugDraw3D_regenerate_geometry_meshes; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_regenerate_geometry_meshes; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_clear_all(); + static dlgt_DebugDraw3D_clear_all func_DebugDraw3D_clear_all; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_clear_all; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_sphere(Vector3 position, real_t radius, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_sphere func_DebugDraw3D_draw_sphere; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_sphere; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_sphere_xf(Transform3D transform, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_sphere_xf func_DebugDraw3D_draw_sphere_xf; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_sphere_xf; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_capsule(Vector3 position, Quaternion rotation, real_t radius, real_t height, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_capsule func_DebugDraw3D_draw_capsule; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_capsule; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_capsule_ab(Vector3 a, Vector3 b, real_t radius, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_capsule_ab func_DebugDraw3D_draw_capsule_ab; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_capsule_ab; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_cylinder(Transform3D transform, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_cylinder func_DebugDraw3D_draw_cylinder; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_cylinder; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_cylinder_ab(Vector3 a, Vector3 b, real_t radius, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_cylinder_ab func_DebugDraw3D_draw_cylinder_ab; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_cylinder_ab; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_box(Vector3 position, Quaternion rotation, Vector3 size, Color color, bool is_box_centered, real_t duration); + static dlgt_DebugDraw3D_draw_box func_DebugDraw3D_draw_box; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_box; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_box_ab(Vector3 a, Vector3 b, Vector3 up, Color color, bool is_ab_diagonal, real_t duration); + static dlgt_DebugDraw3D_draw_box_ab func_DebugDraw3D_draw_box_ab; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_box_ab; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_box_xf(Transform3D transform, Color color, bool is_box_centered, real_t duration); + static dlgt_DebugDraw3D_draw_box_xf func_DebugDraw3D_draw_box_xf; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_box_xf; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_aabb(Aabb aabb, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_aabb func_DebugDraw3D_draw_aabb; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_aabb; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_aabb_ab(Vector3 a, Vector3 b, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_aabb_ab func_DebugDraw3D_draw_aabb_ab; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_aabb_ab; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_line_hit(Vector3 start, Vector3 end, Vector3 hit, bool is_hit, real_t hit_size, Color hit_color, Color after_hit_color, real_t duration); + static dlgt_DebugDraw3D_draw_line_hit func_DebugDraw3D_draw_line_hit; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_line_hit; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_line_hit_offset(Vector3 start, Vector3 end, bool is_hit, real_t unit_offset_of_hit, real_t hit_size, Color hit_color, Color after_hit_color, real_t duration); + static dlgt_DebugDraw3D_draw_line_hit_offset func_DebugDraw3D_draw_line_hit_offset; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_line_hit_offset; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_line(Vector3 a, Vector3 b, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_line func_DebugDraw3D_draw_line; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_line; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_ray(Vector3 origin, Vector3 direction, real_t length, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_ray func_DebugDraw3D_draw_ray; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_ray; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_lines_c(IntPtr /*godot::PackedVector3Array*/ lines_data, ulong lines_size, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_lines_c func_DebugDraw3D_draw_lines_c; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_lines_c; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_line_path_c(IntPtr /*godot::PackedVector3Array*/ path_data, ulong path_size, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_line_path_c func_DebugDraw3D_draw_line_path_c; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_line_path_c; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_arrowhead(Transform3D transform, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_arrowhead func_DebugDraw3D_draw_arrowhead; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_arrowhead; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_arrow(Vector3 a, Vector3 b, Color color, real_t arrow_size, bool is_absolute_size, real_t duration); + static dlgt_DebugDraw3D_draw_arrow func_DebugDraw3D_draw_arrow; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_arrow; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_arrow_ray(Vector3 origin, Vector3 direction, real_t length, Color color, real_t arrow_size, bool is_absolute_size, real_t duration); + static dlgt_DebugDraw3D_draw_arrow_ray func_DebugDraw3D_draw_arrow_ray; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_arrow_ray; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_arrow_path_c(IntPtr /*godot::PackedVector3Array*/ path_data, ulong path_size, Color color, real_t arrow_size, bool is_absolute_size, real_t duration); + static dlgt_DebugDraw3D_draw_arrow_path_c func_DebugDraw3D_draw_arrow_path_c; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_arrow_path_c; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_point_path_c(IntPtr /*godot::PackedVector3Array*/ path_data, ulong path_size, uint /*DebugDraw3D::PointType*/ type, real_t size, Color points_color, Color lines_color, real_t duration); + static dlgt_DebugDraw3D_draw_point_path_c func_DebugDraw3D_draw_point_path_c; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_point_path_c; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_points_c(IntPtr /*godot::PackedVector3Array*/ points_data, ulong points_size, uint /*DebugDraw3D::PointType*/ type, real_t size, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_points_c func_DebugDraw3D_draw_points_c; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_points_c; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_square(Vector3 position, real_t size, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_square func_DebugDraw3D_draw_square; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_square; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_plane(Plane plane, Color color, Vector3 anchor_point, real_t duration); + static dlgt_DebugDraw3D_draw_plane func_DebugDraw3D_draw_plane; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_plane; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_position(Transform3D transform, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_position func_DebugDraw3D_draw_position; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_position; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_gizmo(Transform3D transform, Color color, bool is_centered, real_t duration); + static dlgt_DebugDraw3D_draw_gizmo func_DebugDraw3D_draw_gizmo; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_gizmo; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_grid(Vector3 origin, Vector3 x_size, Vector3 y_size, Vector2I subdivision, Color color, bool is_centered, real_t duration); + static dlgt_DebugDraw3D_draw_grid func_DebugDraw3D_draw_grid; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_grid; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_grid_xf(Transform3D transform, Vector2I p_subdivision, Color color, bool is_centered, real_t duration); + static dlgt_DebugDraw3D_draw_grid_xf func_DebugDraw3D_draw_grid_xf; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_grid_xf; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_camera_frustum(ulong /*godot::Camera3D*/ camera, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_camera_frustum func_DebugDraw3D_draw_camera_frustum; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_camera_frustum; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_camera_frustum_planes_c(IntPtr /*const godot::Plane **/ camera_frustum_data, ulong camera_frustum_size, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_camera_frustum_planes_c func_DebugDraw3D_draw_camera_frustum_planes_c; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_camera_frustum_planes_c; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3D_draw_text_c(Vector3 position, [MarshalAs(UnmanagedType.LPUTF8Str)] string /*godot::String*/ text_string, int size, Color color, real_t duration); + static dlgt_DebugDraw3D_draw_text_c func_DebugDraw3D_draw_text_c; static DD3DFuncLoadingResult func_load_result_DebugDraw3D_draw_text_c; + + /// + /// 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. + /// + public static DebugDraw3DScopeConfig NewScopedConfig() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_new_scoped_config", ref func_DebugDraw3D_new_scoped_config, ref func_load_result_DebugDraw3D_new_scoped_config)) + return null; + return new DebugDraw3DScopeConfig(func_DebugDraw3D_new_scoped_config()); + } + + /// + /// 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`. + /// + /// + /// When used in a managed language, this is not mandatory, but it is recommended to finish the `scoped_config()` configuration with a dispose. + /// This will reduce the number of objects awaiting removal by the garbage collector. + /// + /// DebugDraw3D.ScopedConfig().SetThickness(debug_thickness).Dispose(); + /// + /// + /// + public static DebugDraw3DScopeConfig ScopedConfig() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_scoped_config", ref func_DebugDraw3D_scoped_config, ref func_load_result_DebugDraw3D_scoped_config)) + return null; + return new DebugDraw3DScopeConfig(func_DebugDraw3D_scoped_config()); + } + + /// + /// Set the configuration global for everything in DebugDraw3D. + /// + public static void SetConfig(DebugDraw3DConfig cfg) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_set_config", ref func_DebugDraw3D_set_config, ref func_load_result_DebugDraw3D_set_config)) + return; + func_DebugDraw3D_set_config((IntPtr)cfg); +#endif + } + } + + /// + /// Get the DebugDraw3DConfig. + /// + public static DebugDraw3DConfig GetConfig() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_get_config", ref func_DebugDraw3D_get_config, ref func_load_result_DebugDraw3D_get_config)) + return null; + return new DebugDraw3DConfig(func_DebugDraw3D_get_config()); + } + + /// + /// Set whether debug drawing works or not. + /// + public static void SetDebugEnabled(bool state) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_set_debug_enabled", ref func_DebugDraw3D_set_debug_enabled, ref func_load_result_DebugDraw3D_set_debug_enabled)) + return; + func_DebugDraw3D_set_debug_enabled(state); +#endif + } + } + + public static bool IsDebugEnabled() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_is_debug_enabled", ref func_DebugDraw3D_is_debug_enabled, ref func_load_result_DebugDraw3D_is_debug_enabled)) + return default; + return func_DebugDraw3D_is_debug_enabled(); + } + + /// + /// Returns an instance of DebugDraw3DStats with the current statistics. + /// + /// Some data can be delayed by 1 frame. + /// + public static DebugDraw3DStats GetRenderStats() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_get_render_stats", ref func_DebugDraw3D_get_render_stats, ref func_load_result_DebugDraw3D_get_render_stats)) + return null; + return new DebugDraw3DStats(func_DebugDraw3D_get_render_stats()); + } + + /// + /// Returns an instance of DebugDraw3DStats with the current statistics for the World3D of the Viewport. + /// + /// Some data can be delayed by 1 frame. + /// + public static DebugDraw3DStats GetRenderStatsForWorld(Viewport viewport) + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_get_render_stats_for_world", ref func_DebugDraw3D_get_render_stats_for_world, ref func_load_result_DebugDraw3D_get_render_stats_for_world)) + return null; + return new DebugDraw3DStats(func_DebugDraw3D_get_render_stats_for_world(viewport != null ? viewport.GetInstanceId() : 0)); + } + + /// + /// Regenerate meshes. + /// + /// Can be useful if you want to change some project settings and not restart the project. + /// + public static void RegenerateGeometryMeshes() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_regenerate_geometry_meshes", ref func_DebugDraw3D_regenerate_geometry_meshes, ref func_load_result_DebugDraw3D_regenerate_geometry_meshes)) + return; + func_DebugDraw3D_regenerate_geometry_meshes(); +#endif + } + } + + /// + /// Clear all 3D geometry + /// + public static void ClearAll() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_clear_all", ref func_DebugDraw3D_clear_all, ref func_load_result_DebugDraw3D_clear_all)) + return; + func_DebugDraw3D_clear_all(); +#endif + } + } + + /// + /// Draw a sphere + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Center of the sphere + /// Sphere radius + /// Primary color + /// The duration of how long the object will be visible + public static void DrawSphere(Vector3 position, real_t radius = 0.5f, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_sphere", ref func_DebugDraw3D_draw_sphere, ref func_load_result_DebugDraw3D_draw_sphere)) + return; + func_DebugDraw3D_draw_sphere(position, radius, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw a sphere with a radius of 0.5 + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Sphere transform + /// Primary color + /// The duration of how long the object will be visible + public static void DrawSphereXf(Transform3D transform, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_sphere_xf", ref func_DebugDraw3D_draw_sphere_xf, ref func_load_result_DebugDraw3D_draw_sphere_xf)) + return; + func_DebugDraw3D_draw_sphere_xf(transform, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw a vertical capsule + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// A capsule will not be displayed if the height or radius is approximately equal to or less than zero. + /// + /// + /// --- + /// + /// If you need to apply additional transformations, you can use DebugDraw3DScopeConfig.set_transform. + /// + /// + /// + /// Capsule position + /// Capsule rotation + /// Capsule radius + /// Capsule height including caps. Based on this value, the actual radius of the capsule will be calculated. + /// Primary color + /// The duration of how long the object will be visible + public static void DrawCapsule(Vector3 position, Quaternion rotation, real_t radius, real_t height, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_capsule", ref func_DebugDraw3D_draw_capsule, ref func_load_result_DebugDraw3D_draw_capsule)) + return; + func_DebugDraw3D_draw_capsule(position, rotation, radius, height, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw a capsule between points A and B with the desired radius. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// A capsule will not be displayed if the distance between points A and B or the radius is approximately equal to or less than zero. + /// + /// + /// + /// First pole of the capsule + /// Second pole of the capsule + /// Capsule radius + /// Primary color + /// The duration of how long the object will be visible + public static void DrawCapsuleAb(Vector3 a, Vector3 b, real_t radius = 0.5f, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_capsule_ab", ref func_DebugDraw3D_draw_capsule_ab, ref func_load_result_DebugDraw3D_draw_capsule_ab)) + return; + func_DebugDraw3D_draw_capsule_ab(a, b, radius, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw a vertical cylinder with radius 1.0 (x, z) and height 1.0 (y) + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Cylinder transform + /// Primary color + /// The duration of how long the object will be visible + public static void DrawCylinder(Transform3D transform, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_cylinder", ref func_DebugDraw3D_draw_cylinder, ref func_load_result_DebugDraw3D_draw_cylinder)) + return; + func_DebugDraw3D_draw_cylinder(transform, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw a cylinder between points A and B with a certain radius. + /// + /// + /// A cylinder will not be displayed if the distance between points A and B is approximately zero. + /// + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Bottom point of the Cylinder + /// Top point of the Cylinder + /// Cylinder radius + /// Primary color + /// The duration of how long the object will be visible + public static void DrawCylinderAb(Vector3 a, Vector3 b, real_t radius = 0.5f, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_cylinder_ab", ref func_DebugDraw3D_draw_cylinder_ab, ref func_load_result_DebugDraw3D_draw_cylinder_ab)) + return; + func_DebugDraw3D_draw_cylinder_ab(a, b, radius, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw a box + /// + /// [THERE WAS AN IMAGE] + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Position of the Box + /// Rotation of the box + /// Size of the Box + /// Primary color + /// Set where the center of the box will be. In the center or in the bottom corner + /// The duration of how long the object will be visible + public static void DrawBox(Vector3 position, Quaternion rotation, Vector3 size, Color? color = null, bool is_box_centered = false, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_box", ref func_DebugDraw3D_draw_box, ref func_load_result_DebugDraw3D_draw_box)) + return; + func_DebugDraw3D_draw_box(position, rotation, size, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, is_box_centered, duration); +#endif + } + } + + /// + /// Draw a box between points A and B by rotating and scaling based on the up vector + /// + /// [THERE WAS AN IMAGE] + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// A box will not be displayed if its dimensions are close to zero or if the up vector is approximately zero. + /// + /// + /// + /// Start position + /// End position + /// Vertical vector by which the box will be aligned + /// Primary color + /// Set uses the diagonal between the corners or the diagonal between the centers of two edges + /// The duration of how long the object will be visible + public static void DrawBoxAb(Vector3 a, Vector3 b, Vector3 up, Color? color = null, bool is_ab_diagonal = true, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_box_ab", ref func_DebugDraw3D_draw_box_ab, ref func_load_result_DebugDraw3D_draw_box_ab)) + return; + func_DebugDraw3D_draw_box_ab(a, b, up, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, is_ab_diagonal, duration); +#endif + } + } + + /// + /// Draw a box as in DebugDraw3D.draw_box + /// + /// + /// Box transform + /// Primary color + /// Set where the center of the box will be. In the center or in the bottom corner + /// The duration of how long the object will be visible + public static void DrawBoxXf(Transform3D transform, Color? color = null, bool is_box_centered = true, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_box_xf", ref func_DebugDraw3D_draw_box_xf, ref func_load_result_DebugDraw3D_draw_box_xf)) + return; + func_DebugDraw3D_draw_box_xf(transform, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, is_box_centered, duration); +#endif + } + } + + /// + /// Draw a box as in DebugDraw3D.draw_box, but based on the AABB + /// + /// + /// AABB + /// Primary color + /// The duration of how long the object will be visible + public static void DrawAabb(Aabb aabb, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_aabb", ref func_DebugDraw3D_draw_aabb, ref func_load_result_DebugDraw3D_draw_aabb)) + return; + func_DebugDraw3D_draw_aabb(aabb, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw the box as in DebugDraw3D.draw_aabb, but AABB is defined by the diagonal AB + /// + /// + /// Start position + /// End position + /// Primary color + /// The duration of how long the object will be visible + public static void DrawAabbAb(Vector3 a, Vector3 b, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_aabb_ab", ref func_DebugDraw3D_draw_aabb_ab, ref func_load_result_DebugDraw3D_draw_aabb_ab)) + return; + func_DebugDraw3D_draw_aabb_ab(a, b, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// 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. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Start point + /// End point + /// Hit point + /// Whether to draw the collision point + /// Size of the hit point + /// Color of the hit point and line before hit + /// Color of line after hit position + /// The duration of how long the object will be visible + public static void DrawLineHit(Vector3 start, Vector3 end, Vector3 hit, bool is_hit, real_t hit_size = 0.25f, Color? hit_color = null, Color? after_hit_color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_line_hit", ref func_DebugDraw3D_draw_line_hit, ref func_load_result_DebugDraw3D_draw_line_hit)) + return; + func_DebugDraw3D_draw_line_hit(start, end, hit, is_hit, hit_size, hit_color ?? InternalDD3DApiLoaderUtils_._default_arg_1, after_hit_color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// 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 point + /// End point + /// Whether to draw the collision point + /// Unit offset on the line where the collision occurs + /// Size of the hit point + /// Color of the hit point and line before hit + /// Color of line after hit position + /// The duration of how long the object will be visible + public static void DrawLineHitOffset(Vector3 start, Vector3 end, bool is_hit, real_t unit_offset_of_hit = 0.5f, real_t hit_size = 0.25f, Color? hit_color = null, Color? after_hit_color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_line_hit_offset", ref func_DebugDraw3D_draw_line_hit_offset, ref func_load_result_DebugDraw3D_draw_line_hit_offset)) + return; + func_DebugDraw3D_draw_line_hit_offset(start, end, is_hit, unit_offset_of_hit, hit_size, hit_color ?? InternalDD3DApiLoaderUtils_._default_arg_1, after_hit_color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw a single line + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Start point + /// End point + /// Primary color + /// The duration of how long the object will be visible + public static void DrawLine(Vector3 a, Vector3 b, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_line", ref func_DebugDraw3D_draw_line, ref func_load_result_DebugDraw3D_draw_line)) + return; + func_DebugDraw3D_draw_line(a, b, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw a ray. + /// + /// Same as DebugDraw3D.draw_line, but uses origin, direction and length instead of A and B. + /// + /// + /// Origin + /// Direction + /// Length + /// Primary color + /// The duration of how long the object will be visible + public static void DrawRay(Vector3 origin, Vector3 direction, real_t length, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_ray", ref func_DebugDraw3D_draw_ray, ref func_load_result_DebugDraw3D_draw_ray)) + return; + func_DebugDraw3D_draw_ray(origin, direction, length, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw an array of lines. Each line is two points, so the array must be of even size. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// An array of points of lines. 1 line = 2 vectors3. The array size must be even. + /// Primary color + /// The duration of how long the object will be visible + public static void DrawLines(Vector3[] lines, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_lines_c", ref func_DebugDraw3D_draw_lines_c, ref func_load_result_DebugDraw3D_draw_lines_c)) + return; + + var lines_native_fixed = GCHandle.Alloc(lines, GCHandleType.Pinned); + try + { + func_DebugDraw3D_draw_lines_c(lines_native_fixed.AddrOfPinnedObject(), (ulong)lines.Length, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); + } + finally + { + lines_native_fixed.Free(); + } +#endif + } + } + + /// + /// 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. + /// + /// + /// If the path size is equal to 1, then DebugDraw3D.draw_square will be used instead of drawing a line. + /// + /// + /// + /// Sequence of points + /// Primary color + /// The duration of how long the object will be visible + public static void DrawLinePath(Vector3[] path, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_line_path_c", ref func_DebugDraw3D_draw_line_path_c, ref func_load_result_DebugDraw3D_draw_line_path_c)) + return; + + var path_native_fixed = GCHandle.Alloc(path, GCHandleType.Pinned); + try + { + func_DebugDraw3D_draw_line_path_c(path_native_fixed.AddrOfPinnedObject(), (ulong)path.Length, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); + } + finally + { + path_native_fixed.Free(); + } +#endif + } + } + + /// + /// Draw the arrowhead + /// + /// + /// godot::Transform3D of the Arrowhead + /// Primary color + /// The duration of how long the object will be visible + public static void DrawArrowhead(Transform3D transform, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_arrowhead", ref func_DebugDraw3D_draw_arrowhead, ref func_load_result_DebugDraw3D_draw_arrowhead)) + return; + func_DebugDraw3D_draw_arrowhead(transform, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw line with arrowhead + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// An arrow will not be displayed if the distance between points a and b is approximately zero. + /// + /// + /// + /// Start point + /// End point + /// Primary color + /// Size of the arrow + /// Is `arrow_size` absolute or relative to the length of the string? + /// The duration of how long the object will be visible + public static void DrawArrow(Vector3 a, Vector3 b, Color? color = null, real_t arrow_size = 0.5f, bool is_absolute_size = false, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_arrow", ref func_DebugDraw3D_draw_arrow, ref func_load_result_DebugDraw3D_draw_arrow)) + return; + func_DebugDraw3D_draw_arrow(a, b, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, arrow_size, is_absolute_size, duration); +#endif + } + } + + /// + /// Same as DebugDraw3D.draw_arrow, but uses origin, direction and length instead of A and B. + /// + /// + /// Origin + /// Direction + /// Length + /// Primary color + /// Size of the arrow + /// Is `arrow_size` absolute or relative to the line length? + /// The duration of how long the object will be visible + public static void DrawArrowRay(Vector3 origin, Vector3 direction, real_t length, Color? color = null, real_t arrow_size = 0.5f, bool is_absolute_size = false, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_arrow_ray", ref func_DebugDraw3D_draw_arrow_ray, ref func_load_result_DebugDraw3D_draw_arrow_ray)) + return; + func_DebugDraw3D_draw_arrow_ray(origin, direction, length, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, arrow_size, is_absolute_size, duration); +#endif + } + } + + /// + /// Draw a sequence of points connected by lines with arrows like DebugDraw3D.draw_line_path. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// If the path size is equal to 1, then DebugDraw3D.draw_square will be used instead of drawing a line. + /// + /// + /// + /// Sequence of points + /// Primary color + /// Size of the arrow + /// Is the `arrow_size` absolute or relative to the length of the line? + /// The duration of how long the object will be visible + public static void DrawArrowPath(Vector3[] path, Color? color = null, real_t arrow_size = 0.75f, bool is_absolute_size = true, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_arrow_path_c", ref func_DebugDraw3D_draw_arrow_path_c, ref func_load_result_DebugDraw3D_draw_arrow_path_c)) + return; + + var path_native_fixed = GCHandle.Alloc(path, GCHandleType.Pinned); + try + { + func_DebugDraw3D_draw_arrow_path_c(path_native_fixed.AddrOfPinnedObject(), (ulong)path.Length, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, arrow_size, is_absolute_size, duration); + } + finally + { + path_native_fixed.Free(); + } +#endif + } + } + + /// + /// Draw a sequence of points connected by lines using billboard squares or spheres like DebugDraw3D.draw_line_path. + /// + /// [THERE WAS AN IMAGE] + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// If the path size is equal to 1, then DebugDraw3D.draw_square or DebugDraw3D.draw_sphere will be used instead of drawing a line. + /// + /// + /// + /// Sequence of points + /// Type of points + /// Color of points + /// Color of lines + /// Size of squares + /// The duration of how long the object will be visible + public static void DrawPointPath(Vector3[] path, DebugDraw3D.PointType type = PointType.TypeSquare, real_t size = 0.25f, Color? points_color = null, Color? lines_color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_point_path_c", ref func_DebugDraw3D_draw_point_path_c, ref func_load_result_DebugDraw3D_draw_point_path_c)) + return; + + var path_native_fixed = GCHandle.Alloc(path, GCHandleType.Pinned); + try + { + func_DebugDraw3D_draw_point_path_c(path_native_fixed.AddrOfPinnedObject(), (ulong)path.Length, (uint)(type), size, points_color ?? InternalDD3DApiLoaderUtils_._default_arg_1, lines_color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); + } + finally + { + path_native_fixed.Free(); + } +#endif + } + } + + /// + /// Draw a sequence of points using billboard squares or spheres. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Sequence of points + /// Type of points + /// Size of squares + /// Primary color + /// The duration of how long the object will be visible + public static void DrawPoints(Vector3[] points, DebugDraw3D.PointType type = DebugDraw3D.PointType.TypeSquare, real_t size = 0.25f, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_points_c", ref func_DebugDraw3D_draw_points_c, ref func_load_result_DebugDraw3D_draw_points_c)) + return; + + var points_native_fixed = GCHandle.Alloc(points, GCHandleType.Pinned); + try + { + func_DebugDraw3D_draw_points_c(points_native_fixed.AddrOfPinnedObject(), (ulong)points.Length, (uint)(type), size, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); + } + finally + { + points_native_fixed.Free(); + } +#endif + } + } + + /// + /// Draw a square that will always be turned towards the camera + /// + /// + /// Center position of square + /// Square size + /// Primary color + /// The duration of how long the object will be visible + public static void DrawSquare(Vector3 position, real_t size = 0.2f, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_square", ref func_DebugDraw3D_draw_square, ref func_load_result_DebugDraw3D_draw_square)) + return; + func_DebugDraw3D_draw_square(position, size, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// 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. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Plane data + /// Primary color + /// A point that is projected onto a Plane, and its projection is used as the center of the drawn plane + /// The duration of how long the object will be visible + public static void DrawPlane(Plane plane, Color? color = null, Vector3? anchor_point = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_plane", ref func_DebugDraw3D_draw_plane, ref func_load_result_DebugDraw3D_draw_plane)) + return; + func_DebugDraw3D_draw_plane(plane, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, anchor_point ?? InternalDD3DApiLoaderUtils_._default_arg_2, duration); +#endif + } + } + + /// + /// Draw 3 intersecting lines with the given transformations + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// godot::Transform3D of lines + /// Primary color + /// The duration of how long the object will be visible + public static void DrawPosition(Transform3D transform, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_position", ref func_DebugDraw3D_draw_position, ref func_load_result_DebugDraw3D_draw_position)) + return; + func_DebugDraw3D_draw_position(transform, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw 3 lines with the given transformations and arrows at the ends + /// + /// [THERE WAS AN IMAGE] + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// godot::Transform3D of lines + /// Primary color + /// If `true`, then the lines will intersect in the center of the transform + /// The duration of how long the object will be visible + public static void DrawGizmo(Transform3D transform, Color? color = null, bool is_centered = false, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_gizmo", ref func_DebugDraw3D_draw_gizmo, ref func_load_result_DebugDraw3D_draw_gizmo)) + return; + func_DebugDraw3D_draw_gizmo(transform, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, is_centered, duration); +#endif + } + } + + /// + /// Draw simple grid with given size and subdivision + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Grid origin + /// Direction and size of the X side. As an axis in the Basis. + /// Direction and size of the Y side. As an axis in the Basis. + /// Number of cells for the X and Y axes + /// Primary color + /// Draw lines relative to origin + /// The duration of how long the object will be visible + public static void DrawGrid(Vector3 origin, Vector3 x_size, Vector3 y_size, Vector2I subdivision, Color? color = null, bool is_centered = true, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_grid", ref func_DebugDraw3D_draw_grid, ref func_load_result_DebugDraw3D_draw_grid)) + return; + func_DebugDraw3D_draw_grid(origin, x_size, y_size, subdivision, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, is_centered, duration); +#endif + } + } + + /// + /// 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. + /// + /// + /// godot::Transform3D of the Grid + /// Number of cells for the X and Y axes + /// Primary color + /// Draw lines relative to origin + /// The duration of how long the object will be visible + public static void DrawGridXf(Transform3D transform, Vector2I p_subdivision, Color? color = null, bool is_centered = true, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_grid_xf", ref func_DebugDraw3D_draw_grid_xf, ref func_load_result_DebugDraw3D_draw_grid_xf)) + return; + func_DebugDraw3D_draw_grid_xf(transform, p_subdivision, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, is_centered, duration); +#endif + } + } + + /// + /// Draw camera frustum area. + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Camera node + /// Primary color + /// The duration of how long the object will be visible + public static void DrawCameraFrustum(Camera3D camera, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_camera_frustum", ref func_DebugDraw3D_draw_camera_frustum, ref func_load_result_DebugDraw3D_draw_camera_frustum)) + return; + func_DebugDraw3D_draw_camera_frustum(camera != null ? camera.GetInstanceId() : 0, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + + /// + /// Draw the frustum area of the camera based on an array of 6 planes. + /// + /// + /// Array of frustum planes + /// Primary color + /// The duration of how long the object will be visible + public static void DrawCameraFrustumPlanes(Plane[] camera_frustum, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_camera_frustum_planes_c", ref func_DebugDraw3D_draw_camera_frustum_planes_c, ref func_load_result_DebugDraw3D_draw_camera_frustum_planes_c)) + return; + + var camera_frustum_native_fixed = GCHandle.Alloc(camera_frustum, GCHandleType.Pinned); + try + { + func_DebugDraw3D_draw_camera_frustum_planes_c(camera_frustum_native_fixed.AddrOfPinnedObject(), (ulong)camera_frustum.Length, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); + } + finally + { + camera_frustum_native_fixed.Free(); + } +#endif + } + } + + /// + /// Draw text using Label3D. + /// + /// + /// Outline can be changed using DebugDraw3DScopeConfig.set_text_outline_color and DebugDraw3DScopeConfig.set_text_outline_size. + /// The font can be changed using DebugDraw3DScopeConfig.set_text_font. + /// The text can be made to stay the same size regardless of distance using DebugDraw3DScopeConfig.set_text_fixed_size. + /// + /// + /// [THERE WAS AN IMAGE] + /// + /// + /// Center position of Label + /// Label's text + /// Font size + /// Primary color + /// The duration of how long the object will be visible + public static void DrawText(Vector3 position, string text, int size = 32, Color? color = null, real_t duration = 0) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3D_draw_text_c", ref func_DebugDraw3D_draw_text_c, ref func_load_result_DebugDraw3D_draw_text_c)) + return; + func_DebugDraw3D_draw_text_c(position, text, size, color ?? InternalDD3DApiLoaderUtils_._default_arg_1, duration); +#endif + } + } + +} // class DebugDraw3D + +/// +/// +/// You can get statistics about 3D rendering from this class. +/// +/// +/// All names try to reflect what they mean. +/// +/// To get an instance of this class with current statistics, use DebugDraw3D.get_render_stats. +/// +/// `instances` lets you know how many instances have been created. +/// +/// `instances_physics` reports how many instances were created inside `_physics_process`. +/// +/// `total_time_spent_usec` reports the time in microseconds spent to process everything and display the geometry on the screen. +/// +internal class DebugDraw3DStats : IDisposable +{ + IntPtr inst_ptr; + + public DebugDraw3DStats(IntPtr inst_ptr) + { + this.inst_ptr = inst_ptr; + } + + public DebugDraw3DStats(bool instantiate = true) + { + this.inst_ptr = instantiate ? Create() : CreateNullptr(); + } + + ~DebugDraw3DStats() => Dispose(); + + public static explicit operator IntPtr(DebugDraw3DStats o) { return o.inst_ptr; } + + public void Dispose() + { + if (inst_ptr != IntPtr.Zero) + { + Destroy(inst_ptr); + inst_ptr = IntPtr.Zero; + } + } + + public long Instances { get => GetInstances(); set => SetInstances(value); } + + public long Lines { get => GetLines(); set => SetLines(value); } + + public long InstancesPhysics { get => GetInstancesPhysics(); set => SetInstancesPhysics(value); } + + public long LinesPhysics { get => GetLinesPhysics(); set => SetLinesPhysics(value); } + + public long TotalGeometry { get => GetTotalGeometry(); set => SetTotalGeometry(value); } + + public long VisibleInstances { get => GetVisibleInstances(); set => SetVisibleInstances(value); } + + public long VisibleLines { get => GetVisibleLines(); set => SetVisibleLines(value); } + + public long TotalVisible { get => GetTotalVisible(); set => SetTotalVisible(value); } + + public long TimeFillingBuffersInstancesUsec { get => GetTimeFillingBuffersInstancesUsec(); set => SetTimeFillingBuffersInstancesUsec(value); } + + public long TimeFillingBuffersLinesUsec { get => GetTimeFillingBuffersLinesUsec(); set => SetTimeFillingBuffersLinesUsec(value); } + + public long TimeFillingBuffersInstancesPhysicsUsec { get => GetTimeFillingBuffersInstancesPhysicsUsec(); set => SetTimeFillingBuffersInstancesPhysicsUsec(value); } + + public long TimeFillingBuffersLinesPhysicsUsec { get => GetTimeFillingBuffersLinesPhysicsUsec(); set => SetTimeFillingBuffersLinesPhysicsUsec(value); } + + public long TotalTimeFillingBuffersUsec { get => GetTotalTimeFillingBuffersUsec(); set => SetTotalTimeFillingBuffersUsec(value); } + + public long TimeCullingInstancesUsec { get => GetTimeCullingInstancesUsec(); set => SetTimeCullingInstancesUsec(value); } + + public long TimeCullingLinesUsec { get => GetTimeCullingLinesUsec(); set => SetTimeCullingLinesUsec(value); } + + public long TotalTimeCullingUsec { get => GetTotalTimeCullingUsec(); set => SetTotalTimeCullingUsec(value); } + + public long TotalTimeSpentUsec { get => GetTotalTimeSpentUsec(); set => SetTotalTimeSpentUsec(value); } + + public long CreatedScopedConfigs { get => GetCreatedScopedConfigs(); set => SetCreatedScopedConfigs(value); } + + public long OrphanScopedConfigs { get => GetOrphanScopedConfigs(); set => SetOrphanScopedConfigs(value); } + + public long NodesLabel3dVisible { get => GetNodesLabel3dVisible(); set => SetNodesLabel3dVisible(value); } + + public long NodesLabel3dVisiblePhysics { get => GetNodesLabel3dVisiblePhysics(); set => SetNodesLabel3dVisiblePhysics(value); } + + public long NodesLabel3dExists { get => GetNodesLabel3dExists(); set => SetNodesLabel3dExists(value); } + + public long NodesLabel3dExistsPhysics { get => GetNodesLabel3dExistsPhysics(); set => SetNodesLabel3dExistsPhysics(value); } + + public long NodesLabel3dExistsTotal { get => GetNodesLabel3dExistsTotal(); set => SetNodesLabel3dExistsTotal(value); } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_instances(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_instances func_DebugDraw3DStats_get_instances; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_instances; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_instances(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_instances func_DebugDraw3DStats_set_instances; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_instances; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_lines(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_lines func_DebugDraw3DStats_get_lines; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_lines; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_lines(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_lines func_DebugDraw3DStats_set_lines; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_lines; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_instances_physics(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_instances_physics func_DebugDraw3DStats_get_instances_physics; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_instances_physics; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_instances_physics(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_instances_physics func_DebugDraw3DStats_set_instances_physics; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_instances_physics; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_lines_physics(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_lines_physics func_DebugDraw3DStats_get_lines_physics; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_lines_physics; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_lines_physics(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_lines_physics func_DebugDraw3DStats_set_lines_physics; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_lines_physics; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_total_geometry(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_total_geometry func_DebugDraw3DStats_get_total_geometry; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_total_geometry; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_total_geometry(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_total_geometry func_DebugDraw3DStats_set_total_geometry; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_total_geometry; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_visible_instances(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_visible_instances func_DebugDraw3DStats_get_visible_instances; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_visible_instances; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_visible_instances(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_visible_instances func_DebugDraw3DStats_set_visible_instances; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_visible_instances; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_visible_lines(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_visible_lines func_DebugDraw3DStats_get_visible_lines; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_visible_lines; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_visible_lines(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_visible_lines func_DebugDraw3DStats_set_visible_lines; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_visible_lines; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_total_visible(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_total_visible func_DebugDraw3DStats_get_total_visible; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_total_visible; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_total_visible(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_total_visible func_DebugDraw3DStats_set_total_visible; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_total_visible; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_time_filling_buffers_instances_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_time_filling_buffers_instances_usec func_DebugDraw3DStats_get_time_filling_buffers_instances_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_time_filling_buffers_instances_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_time_filling_buffers_instances_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_time_filling_buffers_instances_usec func_DebugDraw3DStats_set_time_filling_buffers_instances_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_time_filling_buffers_instances_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_time_filling_buffers_lines_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_time_filling_buffers_lines_usec func_DebugDraw3DStats_get_time_filling_buffers_lines_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_time_filling_buffers_lines_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_time_filling_buffers_lines_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_time_filling_buffers_lines_usec func_DebugDraw3DStats_set_time_filling_buffers_lines_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_time_filling_buffers_lines_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec func_DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec func_DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec func_DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec func_DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_total_time_filling_buffers_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_total_time_filling_buffers_usec func_DebugDraw3DStats_get_total_time_filling_buffers_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_total_time_filling_buffers_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_total_time_filling_buffers_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_total_time_filling_buffers_usec func_DebugDraw3DStats_set_total_time_filling_buffers_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_total_time_filling_buffers_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_time_culling_instances_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_time_culling_instances_usec func_DebugDraw3DStats_get_time_culling_instances_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_time_culling_instances_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_time_culling_instances_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_time_culling_instances_usec func_DebugDraw3DStats_set_time_culling_instances_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_time_culling_instances_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_time_culling_lines_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_time_culling_lines_usec func_DebugDraw3DStats_get_time_culling_lines_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_time_culling_lines_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_time_culling_lines_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_time_culling_lines_usec func_DebugDraw3DStats_set_time_culling_lines_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_time_culling_lines_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_total_time_culling_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_total_time_culling_usec func_DebugDraw3DStats_get_total_time_culling_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_total_time_culling_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_total_time_culling_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_total_time_culling_usec func_DebugDraw3DStats_set_total_time_culling_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_total_time_culling_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_total_time_spent_usec(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_total_time_spent_usec func_DebugDraw3DStats_get_total_time_spent_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_total_time_spent_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_total_time_spent_usec(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_total_time_spent_usec func_DebugDraw3DStats_set_total_time_spent_usec; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_total_time_spent_usec; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_created_scoped_configs(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_created_scoped_configs func_DebugDraw3DStats_get_created_scoped_configs; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_created_scoped_configs; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_created_scoped_configs(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_created_scoped_configs func_DebugDraw3DStats_set_created_scoped_configs; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_created_scoped_configs; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_orphan_scoped_configs(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_orphan_scoped_configs func_DebugDraw3DStats_get_orphan_scoped_configs; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_orphan_scoped_configs; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_orphan_scoped_configs(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_orphan_scoped_configs func_DebugDraw3DStats_set_orphan_scoped_configs; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_orphan_scoped_configs; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_nodes_label3d_visible(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_nodes_label3d_visible func_DebugDraw3DStats_get_nodes_label3d_visible; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_nodes_label3d_visible; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_nodes_label3d_visible(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_nodes_label3d_visible func_DebugDraw3DStats_set_nodes_label3d_visible; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_nodes_label3d_visible; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_nodes_label3d_visible_physics(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_nodes_label3d_visible_physics func_DebugDraw3DStats_get_nodes_label3d_visible_physics; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_nodes_label3d_visible_physics; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_nodes_label3d_visible_physics(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_nodes_label3d_visible_physics func_DebugDraw3DStats_set_nodes_label3d_visible_physics; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_nodes_label3d_visible_physics; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_nodes_label3d_exists(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_nodes_label3d_exists func_DebugDraw3DStats_get_nodes_label3d_exists; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_nodes_label3d_exists; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_nodes_label3d_exists(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_nodes_label3d_exists func_DebugDraw3DStats_set_nodes_label3d_exists; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_nodes_label3d_exists; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_nodes_label3d_exists_physics(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_nodes_label3d_exists_physics func_DebugDraw3DStats_get_nodes_label3d_exists_physics; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_nodes_label3d_exists_physics; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_nodes_label3d_exists_physics(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_nodes_label3d_exists_physics func_DebugDraw3DStats_set_nodes_label3d_exists_physics; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_nodes_label3d_exists_physics; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate long dlgt_DebugDraw3DStats_get_nodes_label3d_exists_total(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_get_nodes_label3d_exists_total func_DebugDraw3DStats_get_nodes_label3d_exists_total; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_get_nodes_label3d_exists_total; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_set_nodes_label3d_exists_total(IntPtr inst_ptr, long val); + static dlgt_DebugDraw3DStats_set_nodes_label3d_exists_total func_DebugDraw3DStats_set_nodes_label3d_exists_total; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_set_nodes_label3d_exists_total; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3DStats_create(); + static dlgt_DebugDraw3DStats_create func_DebugDraw3DStats_create; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_create; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate IntPtr dlgt_DebugDraw3DStats_create_nullptr(); + static dlgt_DebugDraw3DStats_create_nullptr func_DebugDraw3DStats_create_nullptr; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_create_nullptr; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDraw3DStats_destroy(IntPtr inst_ptr); + static dlgt_DebugDraw3DStats_destroy func_DebugDraw3DStats_destroy; static DD3DFuncLoadingResult func_load_result_DebugDraw3DStats_destroy; + + public long GetInstances() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_instances", ref func_DebugDraw3DStats_get_instances, ref func_load_result_DebugDraw3DStats_get_instances)) + return default; + return func_DebugDraw3DStats_get_instances(inst_ptr); + } + + public void SetInstances(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_instances", ref func_DebugDraw3DStats_set_instances, ref func_load_result_DebugDraw3DStats_set_instances)) + return; + func_DebugDraw3DStats_set_instances(inst_ptr, val); +#endif + } + } + + public long GetLines() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_lines", ref func_DebugDraw3DStats_get_lines, ref func_load_result_DebugDraw3DStats_get_lines)) + return default; + return func_DebugDraw3DStats_get_lines(inst_ptr); + } + + public void SetLines(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_lines", ref func_DebugDraw3DStats_set_lines, ref func_load_result_DebugDraw3DStats_set_lines)) + return; + func_DebugDraw3DStats_set_lines(inst_ptr, val); +#endif + } + } + + public long GetInstancesPhysics() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_instances_physics", ref func_DebugDraw3DStats_get_instances_physics, ref func_load_result_DebugDraw3DStats_get_instances_physics)) + return default; + return func_DebugDraw3DStats_get_instances_physics(inst_ptr); + } + + public void SetInstancesPhysics(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_instances_physics", ref func_DebugDraw3DStats_set_instances_physics, ref func_load_result_DebugDraw3DStats_set_instances_physics)) + return; + func_DebugDraw3DStats_set_instances_physics(inst_ptr, val); +#endif + } + } + + public long GetLinesPhysics() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_lines_physics", ref func_DebugDraw3DStats_get_lines_physics, ref func_load_result_DebugDraw3DStats_get_lines_physics)) + return default; + return func_DebugDraw3DStats_get_lines_physics(inst_ptr); + } + + public void SetLinesPhysics(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_lines_physics", ref func_DebugDraw3DStats_set_lines_physics, ref func_load_result_DebugDraw3DStats_set_lines_physics)) + return; + func_DebugDraw3DStats_set_lines_physics(inst_ptr, val); +#endif + } + } + + public long GetTotalGeometry() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_total_geometry", ref func_DebugDraw3DStats_get_total_geometry, ref func_load_result_DebugDraw3DStats_get_total_geometry)) + return default; + return func_DebugDraw3DStats_get_total_geometry(inst_ptr); + } + + public void SetTotalGeometry(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_total_geometry", ref func_DebugDraw3DStats_set_total_geometry, ref func_load_result_DebugDraw3DStats_set_total_geometry)) + return; + func_DebugDraw3DStats_set_total_geometry(inst_ptr, val); +#endif + } + } + + public long GetVisibleInstances() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_visible_instances", ref func_DebugDraw3DStats_get_visible_instances, ref func_load_result_DebugDraw3DStats_get_visible_instances)) + return default; + return func_DebugDraw3DStats_get_visible_instances(inst_ptr); + } + + public void SetVisibleInstances(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_visible_instances", ref func_DebugDraw3DStats_set_visible_instances, ref func_load_result_DebugDraw3DStats_set_visible_instances)) + return; + func_DebugDraw3DStats_set_visible_instances(inst_ptr, val); +#endif + } + } + + public long GetVisibleLines() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_visible_lines", ref func_DebugDraw3DStats_get_visible_lines, ref func_load_result_DebugDraw3DStats_get_visible_lines)) + return default; + return func_DebugDraw3DStats_get_visible_lines(inst_ptr); + } + + public void SetVisibleLines(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_visible_lines", ref func_DebugDraw3DStats_set_visible_lines, ref func_load_result_DebugDraw3DStats_set_visible_lines)) + return; + func_DebugDraw3DStats_set_visible_lines(inst_ptr, val); +#endif + } + } + + public long GetTotalVisible() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_total_visible", ref func_DebugDraw3DStats_get_total_visible, ref func_load_result_DebugDraw3DStats_get_total_visible)) + return default; + return func_DebugDraw3DStats_get_total_visible(inst_ptr); + } + + public void SetTotalVisible(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_total_visible", ref func_DebugDraw3DStats_set_total_visible, ref func_load_result_DebugDraw3DStats_set_total_visible)) + return; + func_DebugDraw3DStats_set_total_visible(inst_ptr, val); +#endif + } + } + + public long GetTimeFillingBuffersInstancesUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_time_filling_buffers_instances_usec", ref func_DebugDraw3DStats_get_time_filling_buffers_instances_usec, ref func_load_result_DebugDraw3DStats_get_time_filling_buffers_instances_usec)) + return default; + return func_DebugDraw3DStats_get_time_filling_buffers_instances_usec(inst_ptr); + } + + public void SetTimeFillingBuffersInstancesUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_time_filling_buffers_instances_usec", ref func_DebugDraw3DStats_set_time_filling_buffers_instances_usec, ref func_load_result_DebugDraw3DStats_set_time_filling_buffers_instances_usec)) + return; + func_DebugDraw3DStats_set_time_filling_buffers_instances_usec(inst_ptr, val); +#endif + } + } + + public long GetTimeFillingBuffersLinesUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_time_filling_buffers_lines_usec", ref func_DebugDraw3DStats_get_time_filling_buffers_lines_usec, ref func_load_result_DebugDraw3DStats_get_time_filling_buffers_lines_usec)) + return default; + return func_DebugDraw3DStats_get_time_filling_buffers_lines_usec(inst_ptr); + } + + public void SetTimeFillingBuffersLinesUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_time_filling_buffers_lines_usec", ref func_DebugDraw3DStats_set_time_filling_buffers_lines_usec, ref func_load_result_DebugDraw3DStats_set_time_filling_buffers_lines_usec)) + return; + func_DebugDraw3DStats_set_time_filling_buffers_lines_usec(inst_ptr, val); +#endif + } + } + + public long GetTimeFillingBuffersInstancesPhysicsUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec", ref func_DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec, ref func_load_result_DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec)) + return default; + return func_DebugDraw3DStats_get_time_filling_buffers_instances_physics_usec(inst_ptr); + } + + public void SetTimeFillingBuffersInstancesPhysicsUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec", ref func_DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec, ref func_load_result_DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec)) + return; + func_DebugDraw3DStats_set_time_filling_buffers_instances_physics_usec(inst_ptr, val); +#endif + } + } + + public long GetTimeFillingBuffersLinesPhysicsUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec", ref func_DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec, ref func_load_result_DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec)) + return default; + return func_DebugDraw3DStats_get_time_filling_buffers_lines_physics_usec(inst_ptr); + } + + public void SetTimeFillingBuffersLinesPhysicsUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec", ref func_DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec, ref func_load_result_DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec)) + return; + func_DebugDraw3DStats_set_time_filling_buffers_lines_physics_usec(inst_ptr, val); +#endif + } + } + + public long GetTotalTimeFillingBuffersUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_total_time_filling_buffers_usec", ref func_DebugDraw3DStats_get_total_time_filling_buffers_usec, ref func_load_result_DebugDraw3DStats_get_total_time_filling_buffers_usec)) + return default; + return func_DebugDraw3DStats_get_total_time_filling_buffers_usec(inst_ptr); + } + + public void SetTotalTimeFillingBuffersUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_total_time_filling_buffers_usec", ref func_DebugDraw3DStats_set_total_time_filling_buffers_usec, ref func_load_result_DebugDraw3DStats_set_total_time_filling_buffers_usec)) + return; + func_DebugDraw3DStats_set_total_time_filling_buffers_usec(inst_ptr, val); +#endif + } + } + + public long GetTimeCullingInstancesUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_time_culling_instances_usec", ref func_DebugDraw3DStats_get_time_culling_instances_usec, ref func_load_result_DebugDraw3DStats_get_time_culling_instances_usec)) + return default; + return func_DebugDraw3DStats_get_time_culling_instances_usec(inst_ptr); + } + + public void SetTimeCullingInstancesUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_time_culling_instances_usec", ref func_DebugDraw3DStats_set_time_culling_instances_usec, ref func_load_result_DebugDraw3DStats_set_time_culling_instances_usec)) + return; + func_DebugDraw3DStats_set_time_culling_instances_usec(inst_ptr, val); +#endif + } + } + + public long GetTimeCullingLinesUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_time_culling_lines_usec", ref func_DebugDraw3DStats_get_time_culling_lines_usec, ref func_load_result_DebugDraw3DStats_get_time_culling_lines_usec)) + return default; + return func_DebugDraw3DStats_get_time_culling_lines_usec(inst_ptr); + } + + public void SetTimeCullingLinesUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_time_culling_lines_usec", ref func_DebugDraw3DStats_set_time_culling_lines_usec, ref func_load_result_DebugDraw3DStats_set_time_culling_lines_usec)) + return; + func_DebugDraw3DStats_set_time_culling_lines_usec(inst_ptr, val); +#endif + } + } + + public long GetTotalTimeCullingUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_total_time_culling_usec", ref func_DebugDraw3DStats_get_total_time_culling_usec, ref func_load_result_DebugDraw3DStats_get_total_time_culling_usec)) + return default; + return func_DebugDraw3DStats_get_total_time_culling_usec(inst_ptr); + } + + public void SetTotalTimeCullingUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_total_time_culling_usec", ref func_DebugDraw3DStats_set_total_time_culling_usec, ref func_load_result_DebugDraw3DStats_set_total_time_culling_usec)) + return; + func_DebugDraw3DStats_set_total_time_culling_usec(inst_ptr, val); +#endif + } + } + + public long GetTotalTimeSpentUsec() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_total_time_spent_usec", ref func_DebugDraw3DStats_get_total_time_spent_usec, ref func_load_result_DebugDraw3DStats_get_total_time_spent_usec)) + return default; + return func_DebugDraw3DStats_get_total_time_spent_usec(inst_ptr); + } + + public void SetTotalTimeSpentUsec(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_total_time_spent_usec", ref func_DebugDraw3DStats_set_total_time_spent_usec, ref func_load_result_DebugDraw3DStats_set_total_time_spent_usec)) + return; + func_DebugDraw3DStats_set_total_time_spent_usec(inst_ptr, val); +#endif + } + } + + public long GetCreatedScopedConfigs() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_created_scoped_configs", ref func_DebugDraw3DStats_get_created_scoped_configs, ref func_load_result_DebugDraw3DStats_get_created_scoped_configs)) + return default; + return func_DebugDraw3DStats_get_created_scoped_configs(inst_ptr); + } + + public void SetCreatedScopedConfigs(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_created_scoped_configs", ref func_DebugDraw3DStats_set_created_scoped_configs, ref func_load_result_DebugDraw3DStats_set_created_scoped_configs)) + return; + func_DebugDraw3DStats_set_created_scoped_configs(inst_ptr, val); +#endif + } + } + + public long GetOrphanScopedConfigs() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_orphan_scoped_configs", ref func_DebugDraw3DStats_get_orphan_scoped_configs, ref func_load_result_DebugDraw3DStats_get_orphan_scoped_configs)) + return default; + return func_DebugDraw3DStats_get_orphan_scoped_configs(inst_ptr); + } + + public void SetOrphanScopedConfigs(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_orphan_scoped_configs", ref func_DebugDraw3DStats_set_orphan_scoped_configs, ref func_load_result_DebugDraw3DStats_set_orphan_scoped_configs)) + return; + func_DebugDraw3DStats_set_orphan_scoped_configs(inst_ptr, val); +#endif + } + } + + public long GetNodesLabel3dVisible() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_nodes_label3d_visible", ref func_DebugDraw3DStats_get_nodes_label3d_visible, ref func_load_result_DebugDraw3DStats_get_nodes_label3d_visible)) + return default; + return func_DebugDraw3DStats_get_nodes_label3d_visible(inst_ptr); + } + + public void SetNodesLabel3dVisible(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_nodes_label3d_visible", ref func_DebugDraw3DStats_set_nodes_label3d_visible, ref func_load_result_DebugDraw3DStats_set_nodes_label3d_visible)) + return; + func_DebugDraw3DStats_set_nodes_label3d_visible(inst_ptr, val); +#endif + } + } + + public long GetNodesLabel3dVisiblePhysics() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_nodes_label3d_visible_physics", ref func_DebugDraw3DStats_get_nodes_label3d_visible_physics, ref func_load_result_DebugDraw3DStats_get_nodes_label3d_visible_physics)) + return default; + return func_DebugDraw3DStats_get_nodes_label3d_visible_physics(inst_ptr); + } + + public void SetNodesLabel3dVisiblePhysics(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_nodes_label3d_visible_physics", ref func_DebugDraw3DStats_set_nodes_label3d_visible_physics, ref func_load_result_DebugDraw3DStats_set_nodes_label3d_visible_physics)) + return; + func_DebugDraw3DStats_set_nodes_label3d_visible_physics(inst_ptr, val); +#endif + } + } + + public long GetNodesLabel3dExists() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_nodes_label3d_exists", ref func_DebugDraw3DStats_get_nodes_label3d_exists, ref func_load_result_DebugDraw3DStats_get_nodes_label3d_exists)) + return default; + return func_DebugDraw3DStats_get_nodes_label3d_exists(inst_ptr); + } + + public void SetNodesLabel3dExists(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_nodes_label3d_exists", ref func_DebugDraw3DStats_set_nodes_label3d_exists, ref func_load_result_DebugDraw3DStats_set_nodes_label3d_exists)) + return; + func_DebugDraw3DStats_set_nodes_label3d_exists(inst_ptr, val); +#endif + } + } + + public long GetNodesLabel3dExistsPhysics() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_nodes_label3d_exists_physics", ref func_DebugDraw3DStats_get_nodes_label3d_exists_physics, ref func_load_result_DebugDraw3DStats_get_nodes_label3d_exists_physics)) + return default; + return func_DebugDraw3DStats_get_nodes_label3d_exists_physics(inst_ptr); + } + + public void SetNodesLabel3dExistsPhysics(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_nodes_label3d_exists_physics", ref func_DebugDraw3DStats_set_nodes_label3d_exists_physics, ref func_load_result_DebugDraw3DStats_set_nodes_label3d_exists_physics)) + return; + func_DebugDraw3DStats_set_nodes_label3d_exists_physics(inst_ptr, val); +#endif + } + } + + public long GetNodesLabel3dExistsTotal() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_get_nodes_label3d_exists_total", ref func_DebugDraw3DStats_get_nodes_label3d_exists_total, ref func_load_result_DebugDraw3DStats_get_nodes_label3d_exists_total)) + return default; + return func_DebugDraw3DStats_get_nodes_label3d_exists_total(inst_ptr); + } + + public void SetNodesLabel3dExistsTotal(long val) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_set_nodes_label3d_exists_total", ref func_DebugDraw3DStats_set_nodes_label3d_exists_total, ref func_load_result_DebugDraw3DStats_set_nodes_label3d_exists_total)) + return; + func_DebugDraw3DStats_set_nodes_label3d_exists_total(inst_ptr, val); +#endif + } + } + + private static IntPtr Create() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_create", ref func_DebugDraw3DStats_create, ref func_load_result_DebugDraw3DStats_create)) + return IntPtr.Zero; + return func_DebugDraw3DStats_create(); + } + + private static IntPtr CreateNullptr() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_create_nullptr", ref func_DebugDraw3DStats_create_nullptr, ref func_load_result_DebugDraw3DStats_create_nullptr)) + return IntPtr.Zero; + return func_DebugDraw3DStats_create_nullptr(); + } + + private static void Destroy(IntPtr inst_ptr) + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDraw3DStats_destroy", ref func_DebugDraw3DStats_destroy, ref func_load_result_DebugDraw3DStats_destroy)) + return; + func_DebugDraw3DStats_destroy(inst_ptr); + } + +}; // class DebugDraw3DStats + +/// +/// +/// The main singleton class that handles DebugDraw2D and DebugDraw3D. +/// +/// +/// Several additional settings can be found in the project settings. +/// +/// The following settings require a restart. +/// +/// +/// `debug_draw_3d/settings/initial_debug_state` sets the initial debugging state. +/// +/// `debug_draw_3d/settings/common/DebugDrawManager_singleton_aliases` sets aliases for DebugDrawManager to be registered as additional singletons. +/// +/// `debug_draw_3d/settings/common/DebugDraw2D_singleton_aliases` sets aliases for DebugDraw2D to be registered as additional singletons. +/// +/// `debug_draw_3d/settings/common/DebugDraw3D_singleton_aliases` sets aliases for DebugDraw3D to be registered as additional singletons. +/// +/// Using these aliases you can reference singletons with shorter words: +/// +/// +/// var _s = Dbg3.new_scoped_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) +/// +/// +internal static class DebugDrawManager +{ + /// + /// Set whether to display 2D and 3D debug graphics + /// + public static bool DebugEnabled { get => IsDebugEnabled(); set => SetDebugEnabled(value); } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDrawManager_clear_all(); + static dlgt_DebugDrawManager_clear_all func_DebugDrawManager_clear_all; static DD3DFuncLoadingResult func_load_result_DebugDrawManager_clear_all; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void dlgt_DebugDrawManager_set_debug_enabled(bool value); + static dlgt_DebugDrawManager_set_debug_enabled func_DebugDrawManager_set_debug_enabled; static DD3DFuncLoadingResult func_load_result_DebugDrawManager_set_debug_enabled; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate bool dlgt_DebugDrawManager_is_debug_enabled(); + static dlgt_DebugDrawManager_is_debug_enabled func_DebugDrawManager_is_debug_enabled; static DD3DFuncLoadingResult func_load_result_DebugDrawManager_is_debug_enabled; + + /// + /// Clear all 2D and 3D geometry + /// + public static void ClearAll() + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDrawManager_clear_all", ref func_DebugDrawManager_clear_all, ref func_load_result_DebugDrawManager_clear_all)) + return; + func_DebugDrawManager_clear_all(); +#endif + } + } + + /// + /// Set whether to display 2D and 3D debug graphics + /// + public static void SetDebugEnabled(bool value) + { +#if _DD3D_RUNTIME_CHECK_ENABLED + if (InternalDD3DApiLoaderUtils_.IsCallEnabled) +#endif + { +#if _DD3D_COMPILETIME_CHECK_ENABLED + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDrawManager_set_debug_enabled", ref func_DebugDrawManager_set_debug_enabled, ref func_load_result_DebugDrawManager_set_debug_enabled)) + return; + func_DebugDrawManager_set_debug_enabled(value); +#endif + } + } + + /// + /// Whether debug 2D and 3D graphics are disabled + /// + public static bool IsDebugEnabled() + { + if (!InternalDD3DApiLoaderUtils_.LoadFunction("DebugDrawManager_is_debug_enabled", ref func_DebugDrawManager_is_debug_enabled, ref func_load_result_DebugDrawManager_is_debug_enabled)) + return default; + return func_DebugDrawManager_is_debug_enabled(); + } + +} // class DebugDrawManager + +// End of the generated API