diff --git a/addons/debug_draw_3d/LICENSE b/addons/debug_draw_3d/LICENSE new file mode 100644 index 0000000..8bfc8dd --- /dev/null +++ b/addons/debug_draw_3d/LICENSE @@ -0,0 +1,21 @@ +MIT License + +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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, andor sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/addons/debug_draw_3d/README.md b/addons/debug_draw_3d/README.md new file mode 100644 index 0000000..9c6ce4c --- /dev/null +++ b/addons/debug_draw_3d/README.md @@ -0,0 +1,163 @@ +![icon](/images/icon_3d_128.png) + +# 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`, `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) + +## [Documentation](https://dd3d.dmitriysalnikov.ru/docs/) + +## [Godot 3 version](https://github.com/DmitriySalnikov/godot_debug_draw_3d/tree/godot_3) + +## Support me + +Your support adds motivation to develop my public projects. + +Boosty + +USDT-TRC20 + +USDT-TRC20 TEw934PrsffHsAn5M63SoHYRuZo984EF6v + +## Features + +3D: + +* Arrow +* Billboard opaque square +* Box +* Camera Frustum +* Capsule +* Cylinder +* Gizmo +* Grid +* Line +* Line Path +* Line with Arrow +* Plane +* Points +* Position 3D (3 crossing axes) +* Sphere +* 3D Text + +Overlay: + +* Text (with grouping and coloring) + +Precompiled for: + +* Windows +* Linux (built on Ubuntu 22.04) +* macOS (10.15+) +* Android (5.0+) +* iOS +* Web (Firefox is supported by Godot 4.3+) + +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 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/) + +[![screenshot_web](/images/screenshot_web.png)](https://dd3d.dmitriysalnikov.ru/demo/) + +## Download + +To download, use the [Godot Asset Library](https://godotengine.org/asset-library/asset/1766) or use one of the stable versions from the [GitHub Releases](https://github.com/DmitriySalnikov/godot_debug_draw_3d/releases) page. + +For versions prior to `1.4.5`, just download one of the `source codes` in the assets. For newer versions, download `debug-draw-3d_[version].zip`. + +### Installation + +* Close editor +* Copy `addons/debug_draw_3d` to your `addons` folder, create it if the folder doesn't exist +* Launch editor + +## Examples + +More examples can be found in the `examples_dd3d/` folder. + +Simple test: + +```gdscript +func _process(delta: float) -> void: + var _time = Time.get_ticks_msec() / 1000.0 + var box_pos = Vector3(0, sin(_time * 4), 0) + var line_begin = Vector3(-1, sin(_time * 4), 0) + var line_end = Vector3(1, cos(_time * 4), 0) + + DebugDraw3D.draw_box(box_pos, Quaternion.IDENTITY, Vector3(1, 2, 1), Color(0, 1, 0)) + DebugDraw3D.draw_line(line_begin, line_end, Color(1, 1, 0)) + DebugDraw2D.set_text("Time", _time) + DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn()) + DebugDraw2D.set_text("FPS", Engine.get_frames_per_second()) + DebugDraw2D.set_text("delta", delta) +``` + +![screenshot_1](/images/screenshot_1.png) + +An example of using scoped configs: + +```gdscript +@tool +extends Node3D + +func _ready(): + # Set the base scoped_config. + # Each frame will be reset to these scoped values. + DebugDraw3D.scoped_config().set_thickness(0.1).set_center_brightness(0.6) + +func _process(delta): + # Draw using the base scoped config. + DebugDraw3D.draw_box(Vector3.ZERO, Quaternion.IDENTITY, Vector3.ONE * 2, Color.CORNFLOWER_BLUE) + if true: + # Create a scoped config that will exist until exiting this if. + var _s = DebugDraw3D.new_scoped_config().set_thickness(0).set_center_brightness(0.1) + # Draw with a thickness of 0 + DebugDraw3D.draw_box(Vector3.ZERO, Quaternion.IDENTITY, Vector3.ONE, Color.RED) + # If necessary, the values inside this scope can be changed + # even before each call to draw_*. + _s.set_thickness(0.05) + DebugDraw3D.draw_box(Vector3(1,0,1), Quaternion.IDENTITY, Vector3.ONE * 1, Color.BLUE_VIOLET) +``` + +![screenshot_5](/images/screenshot_5.png) + +> [!TIP] +> +> If you want to use a non-standard Viewport for rendering a 3d scene, then do not forget to specify it in the scoped config! + +## API + +This project has a separate [documentation](https://dd3d.dmitriysalnikov.ru/docs/) page. + +Also, a list of all functions is available in the documentation inside the editor (see `DebugDraw3D` and `DebugDraw2D`). + +![screenshot_4](/images/screenshot_4.png) + +## Known issues and limitations + +The text in the keys and values of a text group cannot contain multi-line strings. + +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 + +`DD3DDemo.tscn` in editor +![screenshot_2](/images/screenshot_2.png) + +`DD3DDemo.tscn` in play mode +![screenshot_3](/images/screenshot_3.png) diff --git a/addons/debug_draw_3d/debug_draw_3d.gdextension b/addons/debug_draw_3d/debug_draw_3d.gdextension new file mode 100644 index 0000000..ea0c157 --- /dev/null +++ b/addons/debug_draw_3d/debug_draw_3d.gdextension @@ -0,0 +1,162 @@ +[configuration] + +entry_symbol = "debug_draw_3d_library_init" +compatibility_minimum = "4.4.1" +reloadable = false + +[dependencies] + +; example.x86_64 = { "relative or absolute path to the dependency" : "the path relative to the exported project", } +; ------------------------------------- +; debug + +macos = { } +windows.x86_64 = { } +linux.x86_64 = { } +linux.arm64 = { } + +; by default godot is using threads +web.wasm32.nothreads = {} +web.wasm32 = {} + +android.arm32 = { } +android.arm64 = { } +android.x86_32 = { } +android.x86_64 = { } + +ios = {} + +; ------------------------------------- +; release no debug draw + +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 = { } + +android.template_release.arm32 = { } +android.template_release.arm64 = { } +android.template_release.x86_32 = { } +android.template_release.x86_64 = { } + +ios.template_release = {} + +; ------------------------------------- +; release forced debug draw + +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 = { } + +ios.template_release.forced_dd3d = {} + +[libraries] + +; ------------------------------------- +; debug + +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" + +android.arm32 = "libs/libdd3d.android.template_debug.arm32.so" +android.arm64 = "libs/libdd3d.android.template_debug.arm64.so" +android.x86_32 = "libs/libdd3d.android.template_debug.x86_32.so" +android.x86_64 = "libs/libdd3d.android.template_debug.x86_64.so" + +ios = "libs/libdd3d.ios.template_debug.universal.dylib" + +; ------------------------------------- +; release no debug draw + +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" + +android.template_release.arm32 = "libs/libdd3d.android.template_release.arm32.so" +android.template_release.arm64 = "libs/libdd3d.android.template_release.arm64.so" +android.template_release.x86_32 = "libs/libdd3d.android.template_release.x86_32.so" +android.template_release.x86_64 = "libs/libdd3d.android.template_release.x86_64.so" + +ios.template_release = "libs/libdd3d.ios.template_release.universal.dylib" + +; ------------------------------------- +; release forced debug draw + +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" + +ios.template_release.forced_dd3d = "libs/libdd3d.ios.template_release.universal.enabled.dylib" + +; ------------------------------------- +; DOUBLE PRECISION +; ------------------------------------- + +; ------------------------------------- +; debug + +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" + +android.arm32.double = "libs/libdd3d.android.template_debug.arm32.double.so" +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.double.dylib" + +; ------------------------------------- +; release no debug draw + +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" + +android.template_release.arm32.double = "libs/libdd3d.android.template_release.arm32.double.so" +android.template_release.arm64.double = "libs/libdd3d.android.template_release.arm64.double.so" +android.template_release.x86_32.double = "libs/libdd3d.android.template_release.x86_32.double.so" +android.template_release.x86_64.double = "libs/libdd3d.android.template_release.x86_64.double.so" + +ios.template_release.double = "libs/libdd3d.ios.template_release.universal.double.dylib" + +; ------------------------------------- +; release forced debug draw + +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" + +ios.template_release.forced_dd3d.double = "libs/libdd3d.ios.template_release.universal.enabled.double.dylib" diff --git a/addons/debug_draw_3d/debug_draw_3d.gdextension.uid b/addons/debug_draw_3d/debug_draw_3d.gdextension.uid new file mode 100644 index 0000000..15da0d3 --- /dev/null +++ b/addons/debug_draw_3d/debug_draw_3d.gdextension.uid @@ -0,0 +1 @@ +uid://svqaxfp5kyrl diff --git a/addons/debug_draw_3d/libs/.gdignore b/addons/debug_draw_3d/libs/.gdignore new file mode 100644 index 0000000..e69de29 diff --git a/addons/debug_draw_3d/libs/.gitignore b/addons/debug_draw_3d/libs/.gitignore new file mode 100644 index 0000000..6ad212f --- /dev/null +++ b/addons/debug_draw_3d/libs/.gitignore @@ -0,0 +1,3 @@ +# Temporary editor files +~*.dll +~*.TMP \ No newline at end of file diff --git a/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so b/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so new file mode 100644 index 0000000..3239358 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm32.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so b/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so new file mode 100644 index 0000000..b52c261 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.android.template_debug.arm64.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so b/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so new file mode 100644 index 0000000..ed0ae83 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_32.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so b/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so new file mode 100644 index 0000000..231cf9a Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.android.template_debug.x86_64.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so b/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so new file mode 100644 index 0000000..eb4e812 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm32.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so b/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so new file mode 100644 index 0000000..ee23e80 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.android.template_release.arm64.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so b/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so new file mode 100644 index 0000000..8bc3e64 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_32.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so b/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so new file mode 100644 index 0000000..cf86894 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.android.template_release.x86_64.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib b/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib new file mode 100644 index 0000000..96f9b4b Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.ios.template_debug.universal.dylib differ diff --git a/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib b/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib new file mode 100644 index 0000000..8145a35 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.dylib differ diff --git a/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib b/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib new file mode 100644 index 0000000..63eb961 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.ios.template_release.universal.enabled.dylib differ diff --git a/addons/debug_draw_3d/libs/libdd3d.linux.editor.arm64.so b/addons/debug_draw_3d/libs/libdd3d.linux.editor.arm64.so new file mode 100644 index 0000000..682182c Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.linux.editor.arm64.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so b/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so new file mode 100644 index 0000000..bce1492 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.enabled.so b/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/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.enabled.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.so b/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.so new file mode 100644 index 0000000..bd3c935 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.linux.template_release.arm64.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so b/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so new file mode 100644 index 0000000..bb1bd8c Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.enabled.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so b/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so new file mode 100644 index 0000000..0f66f8b Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.linux.template_release.x86_64.so differ diff --git a/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist b/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist new file mode 100644 index 0000000..cf1d97d --- /dev/null +++ b/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/Resources/Info.plist @@ -0,0 +1,37 @@ + + + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDevelopmentRegion + en + CFBundleExecutable + libdd3d.macos.editor.universal.dylib + CFBundleName + Debug Draw 3D + CFBundleDisplayName + Debug Draw 3D + CFBundleIdentifier + ru.dmitriysalnikov.dd3d + NSHumanReadableCopyright + Copyright (c) Dmitriy Salnikov. + CFBundleVersion + 1.7.3 + CFBundleShortVersionString + 1.7.3 + CFBundlePackageType + FMWK + CSResourcesFileMapped + + DTPlatformName + macosx + LSMinimumSystemVersion + 10.14 + CFBundleSupportedPlatforms + + MacOSX + + + + \ No newline at end of file diff --git a/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal.dylib b/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal.dylib new file mode 100644 index 0000000..148a2f3 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.macos.editor.universal.framework/libdd3d.macos.editor.universal.dylib differ diff --git a/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist b/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist new file mode 100644 index 0000000..536e25e --- /dev/null +++ b/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/Resources/Info.plist @@ -0,0 +1,37 @@ + + + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDevelopmentRegion + en + CFBundleExecutable + libdd3d.macos.template_release.universal.enabled.dylib + CFBundleName + Debug Draw 3D + CFBundleDisplayName + Debug Draw 3D + CFBundleIdentifier + ru.dmitriysalnikov.dd3d + NSHumanReadableCopyright + Copyright (c) Dmitriy Salnikov. + CFBundleVersion + 1.7.3 + CFBundleShortVersionString + 1.7.3 + CFBundlePackageType + FMWK + CSResourcesFileMapped + + DTPlatformName + macosx + LSMinimumSystemVersion + 10.14 + CFBundleSupportedPlatforms + + MacOSX + + + + \ No newline at end of file diff --git a/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled.dylib b/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled.dylib new file mode 100644 index 0000000..b9ac1d5 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.enabled.framework/libdd3d.macos.template_release.universal.enabled.dylib differ diff --git a/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist b/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist new file mode 100644 index 0000000..57716eb --- /dev/null +++ b/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/Resources/Info.plist @@ -0,0 +1,37 @@ + + + + + CFBundleInfoDictionaryVersion + 6.0 + CFBundleDevelopmentRegion + en + CFBundleExecutable + libdd3d.macos.template_release.universal.dylib + CFBundleName + Debug Draw 3D + CFBundleDisplayName + Debug Draw 3D + CFBundleIdentifier + ru.dmitriysalnikov.dd3d + NSHumanReadableCopyright + Copyright (c) Dmitriy Salnikov. + CFBundleVersion + 1.7.3 + CFBundleShortVersionString + 1.7.3 + CFBundlePackageType + FMWK + CSResourcesFileMapped + + DTPlatformName + macosx + LSMinimumSystemVersion + 10.14 + CFBundleSupportedPlatforms + + MacOSX + + + + \ No newline at end of file diff --git a/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal.dylib b/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal.dylib new file mode 100644 index 0000000..f53c5be Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.macos.template_release.universal.framework/libdd3d.macos.template_release.universal.dylib differ diff --git a/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.threads.wasm b/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.threads.wasm new file mode 100644 index 0000000..597645b Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.threads.wasm differ diff --git a/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm b/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm new file mode 100644 index 0000000..520a06e Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm differ diff --git a/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm b/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm new file mode 100644 index 0000000..9710164 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.enabled.wasm differ diff --git a/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.enabled.wasm b/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.enabled.wasm new file mode 100644 index 0000000..5ac780c Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.enabled.wasm differ diff --git a/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.wasm b/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.wasm new file mode 100644 index 0000000..ec8eadc Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.threads.wasm differ diff --git a/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm b/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm new file mode 100644 index 0000000..593990b Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.web.template_release.wasm32.wasm differ diff --git a/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll b/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll new file mode 100644 index 0000000..9abcf5d Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll differ diff --git a/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll b/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll new file mode 100644 index 0000000..17dc600 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.dll differ diff --git a/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll b/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll new file mode 100644 index 0000000..ee21ae1 Binary files /dev/null and b/addons/debug_draw_3d/libs/libdd3d.windows.template_release.x86_64.enabled.dll differ diff --git a/addons/debug_draw_3d/native_api/cpp/dd3d_cpp_api.hpp b/addons/debug_draw_3d/native_api/cpp/dd3d_cpp_api.hpp new file mode 100644 index 0000000..bf83474 --- /dev/null +++ b/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/addons/debug_draw_3d/native_api/cs/dd3d_cs_api.generated.cs b/addons/debug_draw_3d/native_api/cs/dd3d_cs_api.generated.cs new file mode 100644 index 0000000..3740de1 --- /dev/null +++ b/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 diff --git a/examples_dd3d/DD3DDemo.gd b/examples_dd3d/DD3DDemo.gd new file mode 100644 index 0000000..5d96af1 --- /dev/null +++ b/examples_dd3d/DD3DDemo.gd @@ -0,0 +1,652 @@ +@tool +extends Node3D + +@export var custom_font : Font +@export var custom_3d_font : Font +@export var zylann_example := false +@export var update_in_physics := false +@export var test_text := true +@export var more_test_cases := true +@export var draw_3d_text := true +@export var draw_array_of_boxes := false +@export var draw_text_with_boxes := false +@export var draw_1m_boxes := false +@export_range(0, 5, 0.001) var debug_thickness := 0.1 +@export_range(0, 1, 0.001) var debug_center_brightness := 0.75 +@export_range(0, 1) var camera_frustum_scale := 0.9 + +@export_group("Text groups", "text_groups") +@export var text_groups_show_examples := true +@export var text_groups_show_hints := true +@export var text_groups_show_stats := false +@export var text_groups_show_stats_2d := false +@export var text_groups_position := DebugDraw2DConfig.POSITION_LEFT_TOP +@export var text_groups_offset := Vector2i(8, 8) +@export var text_groups_padding := Vector2i(3, 1) +@export_range(1, 100) var text_groups_default_font_size := 15 +@export_range(1, 100) var text_groups_title_font_size := 20 +@export_range(1, 100) var text_groups_text_font_size := 17 + +@export_group("Tests", "tests") +@export var tests_use_threads := false +var test_thread : Thread = null +var test_thread_closing := false + +var button_presses := {} +var frame_rendered := false +var physics_tick_processed := false + +var timer_1 := 0.0 +var timer_cubes := 0.0 +var timer_3 := 0.0 +var timer_text := 0.0 + + +func _process(delta) -> void: + #print("Label3Ds count: %d" % get_child(0).get_child_count() if Engine.is_editor_hint() else get_tree().root.get_child(0).get_child_count()) + + $OtherWorld.mesh.material.set_shader_parameter("albedo_texture", $OtherWorld/SubViewport.get_texture()) + + physics_tick_processed = false + if not update_in_physics: + main_update(delta) + _update_timers(delta) + + _call_from_thread() + + +## Since physics frames may not be called every frame or may be called multiple times in one frame, +## there is an additional check to ensure that a new frame has been drawn before updating the data. +func _physics_process(delta: float) -> void: + if not physics_tick_processed: + physics_tick_processed = true + if update_in_physics: + main_update(delta) + _update_timers(delta) + + # Physics specific: + if not zylann_example: + DebugDraw3D.draw_line($"Lines/8".global_position, $Lines/Target.global_position, Color.YELLOW) + + if more_test_cases: + _draw_rays_casts() + + ## Additional drawing in the Viewport + if true: + var _w1 = DebugDraw3D.new_scoped_config().set_viewport(%OtherWorldBox.get_viewport()).set_thickness(0.01).set_center_brightness(1).set_no_depth_test(true) + DebugDraw3D.draw_box_xf(Transform3D(Basis() + .scaled(Vector3.ONE*0.3) + .rotated(Vector3(0,0,1), PI/4) + .rotated(Vector3(0,1,0), wrapf(Time.get_ticks_msec() / -1500.0, 0, TAU) - PI/4), %OtherWorldBox.global_transform.origin), + Color.BROWN, true, 0.4) + + +func main_update(delta: float) -> void: + DebugDraw3D.scoped_config().set_thickness(debug_thickness).set_center_brightness(debug_center_brightness) + + _update_keys_just_press() + + if _is_key_just_pressed(KEY_F1): + zylann_example = !zylann_example + + # Zylann's example :D + if zylann_example: + var _time = Time.get_ticks_msec() / 1000.0 + var box_pos = Vector3(0, sin(_time * 4), 0) + var line_begin = Vector3(-1, sin(_time * 4), 0) + var line_end = Vector3(1, cos(_time * 4), 0) + + DebugDraw3D.draw_box(box_pos, Quaternion.IDENTITY, Vector3(1, 2, 1), Color(0, 1, 0)) + DebugDraw3D.draw_line(line_begin, line_end, Color(1, 1, 0)) + DebugDraw2D.set_text("Time", _time) + DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn()) + DebugDraw2D.set_text("FPS", Engine.get_frames_per_second()) + DebugDraw2D.set_text("delta", delta) + + $HitTest.visible = false + $LagTest.visible = false + $PlaneOrigin.visible = false + $OtherWorld.visible = false + %ZDepthTestCube.visible = false + return + + $HitTest.visible = true + $LagTest.visible = true + $PlaneOrigin.visible = true + $OtherWorld.visible = true + %ZDepthTestCube.visible = true + + # Testing the rendering layers by showing the image from the second camera inside the 2D panel + DebugDraw3D.config.geometry_render_layers = 1 if not Input.is_key_pressed(KEY_ALT) else 0b10010 + $Panel.visible = Input.is_key_pressed(KEY_ALT) + DebugDraw2D.custom_canvas = %CustomCanvas if Input.is_key_pressed(KEY_ALT) else null + + # More property toggles + DebugDraw3D.config.freeze_3d_render = Input.is_key_pressed(KEY_DOWN) + DebugDraw3D.config.visible_instance_bounds = Input.is_key_pressed(KEY_RIGHT) + + # Regenerate meshes + if Input.is_action_just_pressed("ui_end"): + DebugDraw3D.regenerate_geometry_meshes() + + # Some property toggles + if _is_key_just_pressed(KEY_LEFT): + DebugDraw3D.config.frustum_culling_mode = wrapi(DebugDraw3D.config.frustum_culling_mode + 1, 0, 3) as DebugDraw3DConfig.CullingMode + if _is_key_just_pressed(KEY_UP): + DebugDraw3D.config.force_use_camera_from_scene = !DebugDraw3D.config.force_use_camera_from_scene + if _is_key_just_pressed(KEY_CTRL): + if not Engine.is_editor_hint(): + get_viewport().msaa_3d = Viewport.MSAA_DISABLED if get_viewport().msaa_3d == Viewport.MSAA_4X else Viewport.MSAA_4X + + if not Engine.is_editor_hint(): + if _is_key_just_pressed(KEY_1): + DebugDraw3D.debug_enabled = !DebugDraw3D.debug_enabled + if _is_key_just_pressed(KEY_2): + DebugDraw2D.debug_enabled = !DebugDraw2D.debug_enabled + if _is_key_just_pressed(KEY_3): + DebugDrawManager.debug_enabled = !DebugDrawManager.debug_enabled + + + DebugDraw3D.config.frustum_length_scale = camera_frustum_scale + + # Zones with black borders + for z in $Zones.get_children(): + DebugDraw3D.draw_box_xf(z.global_transform, Color.BLACK) + + # Spheres + _draw_zone_title(%SpheresBox, "Spheres") + + DebugDraw3D.draw_sphere_xf($Spheres/SphereTransform.global_transform, Color.CRIMSON) + if true: + var _shd = DebugDraw3D.new_scoped_config().set_hd_sphere(true) + DebugDraw3D.draw_sphere_xf($Spheres/SphereHDTransform.global_transform, Color.ORANGE_RED) + + ## Delayed spheres + if timer_1 < 0: + var s_xf: Transform3D = $Spheres/SpherePosition.global_transform + DebugDraw3D.draw_sphere(s_xf.origin, 2.0, Color.BLUE_VIOLET, 2.0) + var _shd = DebugDraw3D.new_scoped_config().set_hd_sphere(true) + DebugDraw3D.draw_sphere(s_xf.origin - s_xf.basis.z * 4.2, 2.0, Color.CORNFLOWER_BLUE, 2.0) + timer_1 = 2 + + # Capsules + if true: + _draw_zone_title(%CapsulesBox, "Capsules") + + var capsule1_xf: Transform3D = $Capsules/Capsule1.global_transform + var capsule1_scale: = capsule1_xf.basis.get_scale() + DebugDraw3D.draw_capsule(capsule1_xf.origin, capsule1_xf.basis.get_rotation_quaternion(), capsule1_scale.x, capsule1_scale.y, Color.CRIMSON) + DebugDraw3D.draw_capsule_ab($"Capsules/Capsule2/1".global_position, $"Capsules/Capsule2/2".global_position, 0.6) + + # Cylinders + if true: + _draw_zone_title(%CylindersBox, "Cylinders") + + DebugDraw3D.draw_cylinder($Cylinders/Cylinder1.global_transform, Color.CRIMSON) + DebugDraw3D.draw_cylinder(Transform3D(Basis.IDENTITY.scaled(Vector3(1,2,1)), $Cylinders/Cylinder2.global_position), Color.RED) + DebugDraw3D.draw_cylinder_ab($"Cylinders/Cylinder3/1".global_position, $"Cylinders/Cylinder3/2".global_position, 0.7) + + # Boxes + _draw_zone_title(%BoxesBox, "Boxes") + + DebugDraw3D.draw_box_xf($Boxes/Box1.global_transform, Color.MEDIUM_PURPLE) + DebugDraw3D.draw_box($Boxes/Box2.global_position, Quaternion.from_euler(Vector3(0, deg_to_rad(45), deg_to_rad(45))), Vector3.ONE, Color.REBECCA_PURPLE) + DebugDraw3D.draw_box_xf(Transform3D(Basis(Vector3.UP, PI * 0.25).scaled(Vector3.ONE * 2), $Boxes/Box3.global_position), Color.ROSY_BROWN) + + DebugDraw3D.draw_aabb(AABB($Boxes/AABB_fixed.global_position, Vector3(2, 1, 2)), Color.AQUA) + DebugDraw3D.draw_aabb_ab($Boxes/AABB/a.global_position, $Boxes/AABB/b.global_position, Color.DEEP_PINK) + + # Boxes AB + DebugDraw3D.draw_arrow($Boxes/BoxAB.global_position, $Boxes/BoxAB/o/up.global_position, Color.GOLD, 0.1, true) + DebugDraw3D.draw_box_ab($Boxes/BoxAB/a.global_position, $Boxes/BoxAB/b.global_position, $Boxes/BoxAB/o/up.global_position - $Boxes/BoxAB.global_position, Color.PERU) + + DebugDraw3D.draw_arrow($Boxes/BoxABEdge.global_position, $Boxes/BoxABEdge/o/up.global_position, Color.DARK_RED, 0.1, true) + DebugDraw3D.draw_box_ab($Boxes/BoxABEdge/a.global_position, $Boxes/BoxABEdge/b.global_position, $Boxes/BoxABEdge/o/up.global_position - $Boxes/BoxABEdge.global_position, Color.DARK_OLIVE_GREEN, false) + + # Lines + _draw_zone_title(%LinesBox, "Lines") + + var target = $Lines/Target + DebugDraw3D.draw_square(target.global_position, 0.5, Color.RED) + + DebugDraw3D.draw_line($"Lines/1".global_position, target.global_position, Color.FUCHSIA) + DebugDraw3D.draw_ray($"Lines/3".global_position, (target.global_position - $"Lines/3".global_position).normalized(), 3.0, Color.CRIMSON) + + if timer_3 < 0: + DebugDraw3D.draw_line($"Lines/6".global_position, target.global_position, Color.FUCHSIA, 2.0) + timer_3 = 2 + + # Test UP vector + DebugDraw3D.draw_line($"Lines/7".global_position, target.global_position, Color.RED) + + # Lines with Arrow + DebugDraw3D.draw_arrow($"Lines/2".global_position, target.global_position, Color.BLUE, 0.5, true) + DebugDraw3D.draw_arrow_ray($"Lines/4".global_position, (target.global_position - $"Lines/4".global_position).normalized(), 8.0, Color.LAVENDER, 0.5, true) + + DebugDraw3D.draw_line_hit_offset($"Lines/5".global_position, target.global_position, true, abs(sin(Time.get_ticks_msec() / 1000.0)), 0.25, Color.AQUA) + + # Paths + _draw_zone_title(%PathsBox, "Paths") + + _draw_paths() + _draw_paths(Vector3(-2, 0, -1), 0) # there should be no crashes + _draw_paths(Vector3(2, 0, -1), 1) # one element should always be displayed, if possible + + # Misc + _draw_zone_title(%MiscBox, "Misc") + + if Engine.is_editor_hint(): + #for i in 1000: + var _a11 = DebugDraw3D.new_scoped_config().set_thickness(0) + DebugDraw3D.draw_camera_frustum($Camera, Color.DARK_ORANGE) + + if true: + var _s123 = DebugDraw3D.new_scoped_config().set_center_brightness(0.1) + DebugDraw3D.draw_arrowhead($Misc/Arrow.global_transform, Color.YELLOW_GREEN) + + DebugDraw3D.draw_square($Misc/Billboard.global_position, 0.5, Color.GREEN) + + DebugDraw3D.draw_position($Misc/Position.global_transform, Color.BROWN) + + DebugDraw3D.draw_gizmo($Misc/GizmoTransform.global_transform, DebugDraw3D.empty_color, true) + DebugDraw3D.draw_gizmo($Misc/GizmoOneColor.global_transform, Color.BROWN, true) + if true: + var _s123 = DebugDraw3D.new_scoped_config().set_center_brightness(0.5).set_no_depth_test(true) + DebugDraw3D.draw_gizmo($Misc/GizmoNormal.global_transform.orthonormalized(), DebugDraw3D.empty_color, false) + + # Grids + _draw_zone_title_pos($Grids/GridCentered.global_position + Vector3(0, 1.5, 0), "Grids", 96, 36) + + var tg : Transform3D = $Grids/Grid.global_transform + var tn : Vector3 = $Grids/Grid/Subdivision.transform.origin + DebugDraw3D.draw_grid(tg.origin, tg.basis.x, tg.basis.z, Vector2i(int(tn.x*10), int(tn.z*10)), Color.LIGHT_CORAL, false) + + var tn1 = $Grids/GridCentered/Subdivision.transform.origin + DebugDraw3D.draw_grid_xf($Grids/GridCentered.global_transform, Vector2i(tn1.x*10, tn1.z*10)) + + if true: + var _s32 = DebugDraw3D.new_scoped_config().set_thickness(0.05) + DebugDraw3D.draw_box_xf($PostProcess.global_transform, Color.SEA_GREEN) + + # Local transform + _draw_local_xf_box(%LocalTransformRecursiveOrigin.global_transform, 0.05, 10) + + # 2D + DebugDraw2D.config.text_default_size = text_groups_default_font_size + DebugDraw2D.config.text_block_offset = text_groups_offset + DebugDraw2D.config.text_block_position = text_groups_position + DebugDraw2D.config.text_padding = text_groups_padding + + DebugDraw2D.config.text_custom_font = custom_font + + if test_text: + _text_tests() + + # Lag Test + var lag_test_pos = to_global($LagTest/RESET.get_animation("RESET").track_get_key_value(0,0)) + _draw_zone_title_pos(lag_test_pos, "Lag test") + + $LagTest.position = lag_test_pos + Vector3(sin(Time.get_ticks_msec() / 100.0) * 2.5, 0, 0) + DebugDraw3D.draw_box($LagTest.global_position, Quaternion.IDENTITY, Vector3.ONE * 2.01, Color.CHOCOLATE, true) + + if more_test_cases: + for ray in $HitTest/RayEmitter.get_children(): + ray.set_physics_process_internal(true) + + _more_tests() + else: + for ray in $HitTest/RayEmitter.get_children(): + ray.set_physics_process_internal(false) + + _draw_other_world() + + if draw_array_of_boxes: + _draw_array_of_boxes() + + +func _text_tests(): + DebugDraw2D.set_text("FPS", "%.2f" % Engine.get_frames_per_second(), 0, Color.GOLD) + + if text_groups_show_examples: + if timer_text < 0: + DebugDraw2D.set_text("Some delayed text", "for 2.5s", -1, Color.BLACK, 2.5) # it's supposed to show text for 2.5 seconds + timer_text = 5 + + DebugDraw2D.begin_text_group("-- First Group --", 2, Color.LIME_GREEN, true, text_groups_title_font_size, text_groups_text_font_size) + DebugDraw2D.set_text("Simple text") + DebugDraw2D.set_text("Text", "Value", 0, Color.AQUAMARINE) + DebugDraw2D.set_text("Text out of order", null, -1, Color.SILVER) + DebugDraw2D.begin_text_group("-- Second Group --", 1, Color.BEIGE) + DebugDraw2D.set_text("Rendered frames", Engine.get_frames_drawn()) + DebugDraw2D.end_text_group() + + if text_groups_show_stats or text_groups_show_stats_2d: + DebugDraw2D.begin_text_group("-- Stats --", 3, Color.WHEAT) + + var render_stats := DebugDraw3D.get_render_stats() + if render_stats && text_groups_show_stats: + DebugDraw2D.set_text("Total", render_stats.total_geometry) + DebugDraw2D.set_text("Instances", render_stats.instances + render_stats.instances_physics, 1) + DebugDraw2D.set_text("Lines", render_stats.lines + render_stats.lines_physics, 2) + DebugDraw2D.set_text("Total Visible", render_stats.total_visible, 3) + DebugDraw2D.set_text("Visible Instances", render_stats.visible_instances, 4) + DebugDraw2D.set_text("Visible Lines", render_stats.visible_lines, 5) + + DebugDraw2D.set_text("---", null, 12) + + DebugDraw2D.set_text("Culling time", "%.2f ms" % (render_stats.total_time_culling_usec / 1000.0), 13) + DebugDraw2D.set_text("Filling instances buffer", "%.2f ms" % (render_stats.time_filling_buffers_instances_usec / 1000.0), 14) + DebugDraw2D.set_text("Filling lines buffer", "%.2f ms" % (render_stats.time_filling_buffers_lines_usec / 1000.0), 15) + DebugDraw2D.set_text("Filling time", "%.2f ms" % (render_stats.total_time_filling_buffers_usec / 1000.0), 16) + DebugDraw2D.set_text("Total time", "%.2f ms" % (render_stats.total_time_spent_usec / 1000.0), 17) + + DebugDraw2D.set_text("----", null, 32) + + DebugDraw2D.set_text("Total Label3D", render_stats.nodes_label3d_exists_total, 33) + DebugDraw2D.set_text("Visible Label3D", render_stats.nodes_label3d_visible + render_stats.nodes_label3d_visible_physics, 34) + + DebugDraw2D.set_text("-----", null, 48) + + DebugDraw2D.set_text("Created scoped configs", "%d" % render_stats.created_scoped_configs, 49) + + if text_groups_show_stats && text_groups_show_stats_2d: + DebugDraw2D.set_text("------", null, 64) + + var render_stats_2d := DebugDraw2D.get_render_stats() + if render_stats_2d && text_groups_show_stats_2d: + DebugDraw2D.set_text("Text groups", render_stats_2d.overlay_text_groups, 96) + DebugDraw2D.set_text("Text lines", render_stats_2d.overlay_text_lines, 97) + + DebugDraw2D.end_text_group() + + if text_groups_show_hints: + DebugDraw2D.begin_text_group("controls", 1024, Color.WHITE, false) + if not Engine.is_editor_hint(): + DebugDraw2D.set_text("WASD QE, LMB", "To move", 0) + DebugDraw2D.set_text("Alt: change render layers", DebugDraw3D.config.geometry_render_layers, 1) + if not OS.has_feature("web"): + DebugDraw2D.set_text("Ctrl: toggle anti-aliasing", "MSAA 4x" if get_viewport().msaa_3d == Viewport.MSAA_4X else "Disabled", 2) + DebugDraw2D.set_text("Down: freeze render", DebugDraw3D.config.freeze_3d_render, 3) + if Engine.is_editor_hint(): + DebugDraw2D.set_text("Up: use scene camera", DebugDraw3D.config.force_use_camera_from_scene, 4) + DebugDraw2D.set_text("1,2,3: toggle debug", "%s, %s 😐, %s 😏" % [DebugDraw3D.debug_enabled, DebugDraw2D.debug_enabled, DebugDrawManager.debug_enabled], 5) + DebugDraw2D.set_text("Left: frustum culling mode", ["Disabled", "Rough", "Precise"][DebugDraw3D.config.frustum_culling_mode], 6) + DebugDraw2D.set_text("Right: draw bounds for culling", DebugDraw3D.config.visible_instance_bounds, 7) + DebugDraw2D.end_text_group() + + +func _draw_zone_title(node: Node3D, title: String): + if draw_3d_text: + var _s1 = DebugDraw3D.new_scoped_config().set_text_outline_size(72) + DebugDraw3D.draw_text(node.global_position + node.global_basis.y * 0.85, title, 128) + + +func _draw_zone_title_pos(pos: Vector3, title: String, font_size: int = 128, outline: int = 72): + if draw_3d_text: + var _s1 = DebugDraw3D.new_scoped_config().set_text_outline_size(outline) + DebugDraw3D.draw_text(pos, title, font_size) + + +const _local_mul := 0.45 +const _local_mul_vec := Vector3(_local_mul, _local_mul, _local_mul) +var __local_lines_cross_recursive = PackedVector3Array([Vector3(-0.5, -0.5, -0.5), Vector3(0.5, -0.5, 0.5), Vector3(-0.5, -0.5, 0.5), Vector3(0.5, -0.5, -0.5)]) +var __local_box_recursive = Transform3D.IDENTITY.rotated_local(Vector3.UP, deg_to_rad(30)).translated(Vector3(-0.25, -0.55, 0.25)).scaled(_local_mul_vec) +var __local_sphere_recursive = Transform3D.IDENTITY.translated(Vector3(0.5, 0.55, -0.5)).scaled(_local_mul_vec) + +func _draw_local_xf_box(xf: Transform3D, thickness: float, max_depth: int, depth: int = 0): + if depth >= max_depth: + return + + var _s1 = DebugDraw3D.new_scoped_config().set_thickness(thickness).set_transform(xf) + + # a box with a small offset + DebugDraw3D.draw_box_xf(Transform3D(Basis(), Vector3(0, 0.001, 0)), Color.BROWN) + # a box and a stand for the next depth + DebugDraw3D.draw_box_xf(__local_box_recursive, Color.CHARTREUSE) + # just a sphere and lines + DebugDraw3D.draw_sphere_xf(__local_sphere_recursive, Color.DARK_ORANGE) + _s1.set_thickness(0) + DebugDraw3D.draw_lines(__local_lines_cross_recursive, Color.CRIMSON) + + # A simple animation generator with descent into the depth of the scene + if false: + var anim: Animation = %RecursiveTransformTest.get_animation("recursive") + # clear keys + if depth == 0: for i in anim.track_get_key_count(0): anim.track_remove_key(0, 0); anim.track_remove_key(1, 0) + + var time = depth * 2 + var s_xf = xf * __local_sphere_recursive + var next_s_xf = (xf * __local_box_recursive.translated(__local_box_recursive.basis.y)) * __local_sphere_recursive + var get_sphere_pos = func(l_xf): return l_xf.origin + (l_xf).basis.y + anim.position_track_insert_key(0, time, get_sphere_pos.call(s_xf)) + anim.rotation_track_insert_key(1, time, Transform3D(Basis(), get_sphere_pos.call(s_xf)).looking_at(get_sphere_pos.call(next_s_xf), xf.basis.y).basis.get_rotation_quaternion()) + + _draw_local_xf_box(xf * __local_box_recursive.translated(__local_box_recursive.basis.y), thickness * _local_mul, max_depth, depth + 1) + + +func _draw_other_world(): + var _w1 = DebugDraw3D.new_scoped_config().set_viewport(%OtherWorldBox.get_viewport()) + DebugDraw3D.draw_box_xf(%OtherWorldBox.global_transform.rotated_local(Vector3(1,1,-1).normalized(), wrapf(Time.get_ticks_msec() / 1000.0, 0, TAU)), Color.SANDY_BROWN) + DebugDraw3D.draw_box_xf(%OtherWorldBox.global_transform.rotated_local(Vector3(-1,1,-1).normalized(), wrapf(Time.get_ticks_msec() / -1000.0, 0, TAU) - PI/4), Color.SANDY_BROWN) + + if draw_3d_text: + var angle = wrapf(Time.get_ticks_msec() / 1000.0, 0, TAU) + if true: + var _w2 = DebugDraw3D.new_scoped_config() \ + .set_text_font(custom_3d_font) \ + .set_text_fixed_size(true) + DebugDraw3D.draw_text(%OtherWorldBox.global_position + Vector3(cos(angle), -0.25, sin(angle)), "Hello world!", 40, Color.CRIMSON, 0) + + if true: + var _w3 = DebugDraw3D.new_scoped_config() \ + .set_no_depth_test(true) \ + .set_text_outline_color(Color.INDIAN_RED) \ + .set_text_outline_size(6) + DebugDraw3D.draw_text(%OtherWorldBox.global_position + Vector3(cos(angle), +0.25, sin(-angle)), "World without depth", 20, Color.PINK, 0) + + +func _draw_rays_casts(): + # Line hits render + _draw_zone_title_pos(%HitTestSphere.global_position, "Line hits", 96, 36) + + for ray in $HitTest/RayEmitter.get_children(): + if ray is RayCast3D: + ray.force_raycast_update() + DebugDraw3D.draw_line_hit(ray.global_position, ray.to_global(ray.target_position), ray.get_collision_point(), ray.is_colliding(), 0.3) + + +func _more_tests(): + # Delayed line render + if true: + var _a12 = DebugDraw3D.new_scoped_config().set_thickness(0.035) + DebugDraw3D.draw_line($LagTest.global_position + Vector3.UP, $LagTest.global_position + Vector3(0,3,sin(Time.get_ticks_msec() / 50.0)), DebugDraw3D.empty_color, 0.35) + + if draw_3d_text: + DebugDraw3D.draw_text($LagTest.global_position + Vector3(0,3,sin(Time.get_ticks_msec() / 50.0)), "%.1f" % sin(Time.get_ticks_msec() / 50.0), 16, DebugDraw3D.empty_color, 0.35) + + # Draw plane + if true: + var _s11 = DebugDraw3D.new_scoped_config().set_thickness(0.02).set_plane_size(10) + + var pl_node: Node3D = $PlaneOrigin + var xf: Transform3D = pl_node.global_transform + var normal: = xf.basis.y.normalized() + var plane = Plane(normal, xf.origin.dot(normal)) + + var vp: Viewport = get_viewport() + if Engine.is_editor_hint() and Engine.get_singleton(&"EditorInterface").get_editor_viewport_3d(0): + vp = Engine.get_singleton(&"EditorInterface").get_editor_viewport_3d(0) + + var cam = vp.get_camera_3d() + if cam: + var dir = vp.get_camera_3d().project_ray_normal(vp.get_mouse_position()) + var intersect = plane.intersects_ray(cam.global_position, dir) + + DebugDraw3D.draw_plane(plane, Color.CORAL * Color(1,1,1, 0.4), pl_node.global_position) + if intersect and intersect.distance_to(pl_node.global_position) < _s11.get_plane_size() * 0.5: + # Need to test different colors on both sides of the plane + var col = Color.FIREBRICK if plane.is_point_over(cam.global_position) else Color.AQUAMARINE + DebugDraw3D.draw_sphere(intersect, 0.3, col) + + +func _draw_paths(offset: Vector3 = Vector3.ZERO, max_points: int = -1): + ## preparing data + var points: PackedVector3Array = [] + var points_below: PackedVector3Array = [] + var points_below2: PackedVector3Array = [] + var points_below3: PackedVector3Array = [] + var points_below4: PackedVector3Array = [] + var lines_above: PackedVector3Array = [] + + var down_vec = -global_transform.basis.y + var c_count = $LinePath.get_child_count() + for c_idx in range(c_count if max_points < 0 else min(c_count, max_points)): + var c = $LinePath.get_child(c_idx) + if not c is Node3D: + break + points.append(c.global_position + offset) + points_below.append(c.global_position + down_vec + offset) + points_below2.append(c.global_position + down_vec * 2 + offset) + points_below3.append(c.global_position + down_vec * 3 + offset) + points_below4.append(c.global_position + down_vec * 4 + offset) + + for x in points.size()-1: + lines_above.append(points[x] - down_vec) + lines_above.append(points[x+1] - down_vec) + + ## drawing lines + DebugDraw3D.draw_lines(lines_above) + DebugDraw3D.draw_line_path(points, Color.BEIGE) + DebugDraw3D.draw_points(points_below, DebugDraw3D.POINT_TYPE_SQUARE, 0.2, Color.DARK_GREEN) + DebugDraw3D.draw_point_path(points_below2, DebugDraw3D.POINT_TYPE_SQUARE, 0.25, Color.BLUE, Color.TOMATO) + DebugDraw3D.draw_arrow_path(points_below3, Color.GOLD, 0.5) + if true: + var _sl = DebugDraw3D.new_scoped_config().set_thickness(0.05) + DebugDraw3D.draw_point_path(points_below4, DebugDraw3D.POINT_TYPE_SPHERE, 0.25, Color.MEDIUM_SEA_GREEN, Color.MEDIUM_VIOLET_RED) + + +func _draw_array_of_boxes(): + # Lots of boxes to check performance.. + var x_size := 50 + var y_size := 50 + var z_size := 3 + var mul := 1 + var cubes_show_time := 1.25 + var show_text := draw_text_with_boxes + var cfg = DebugDraw3D.new_scoped_config() + + if draw_1m_boxes: + x_size = 100 + y_size = 100 + z_size = 100 + mul = 4 + cubes_show_time = 60 + show_text = false + + var size := Vector3.ONE + var half_size := size * 0.5 + + if timer_cubes < 0: + var _start_time = Time.get_ticks_usec() + for x in x_size: + for y in y_size: + for z in z_size: + cfg.set_thickness(randf_range(0, 0.1)) + var pos := Vector3(x * mul, (-4-z) * mul, y * mul) + global_position + DebugDraw3D.draw_box(pos, Quaternion.IDENTITY, size, DebugDraw3D.empty_color, false, cubes_show_time) + + if show_text and z == 0: + DebugDraw3D.draw_text(pos + half_size, str(pos), 32, DebugDraw3D.empty_color, cubes_show_time) + print("Draw Boxes GDScript: %.3fms" % ((Time.get_ticks_usec() - _start_time) / 1000.0)) + timer_cubes = cubes_show_time + + if timer_cubes > cubes_show_time: + DebugDraw3D.clear_all(); + timer_cubes = 0; + + +func _ready() -> void: + print("DebugDraw3D version: ", DebugDrawManager.get_addon_version_str(), " ", DebugDrawManager.get_addon_version()) + + _update_keys_just_press() + + await get_tree().process_frame + + # this check is required for inherited scenes, because an instance of this + # script is created first, and then overridden by another + if not is_inside_tree(): + return + + DebugDraw2D.config.text_background_color = Color(0.3, 0.3, 0.3, 0.8) + + +func _is_key_just_pressed(key): + if (button_presses[key] == 1): + button_presses[key] = 2 + return true + return false + + +func _update_keys_just_press(): + var set_key = func (k: Key): + if Input.is_key_pressed(k) and button_presses.has(k): + if button_presses[k] == 0: + return 1 + else: + return button_presses[k] + else: + return 0 + button_presses[KEY_LEFT] = set_key.call(KEY_LEFT) + button_presses[KEY_UP] = set_key.call(KEY_UP) + button_presses[KEY_CTRL] = set_key.call(KEY_CTRL) + button_presses[KEY_F1] = set_key.call(KEY_F1) + button_presses[KEY_1] = set_key.call(KEY_1) + button_presses[KEY_2] = set_key.call(KEY_2) + button_presses[KEY_3] = set_key.call(KEY_3) + + +func _update_timers(delta : float): + timer_1 -= delta + timer_cubes -= delta + timer_3 -= delta + timer_text -= delta + + +func _notification(what: int) -> void: + if what == NOTIFICATION_EDITOR_PRE_SAVE or what == NOTIFICATION_EXIT_TREE: + _thread_stop() + + +func _call_from_thread(): + if tests_use_threads and (not test_thread or not test_thread.is_alive()): + test_thread_closing = false + test_thread = Thread.new() + test_thread.start(_thread_body) + elif not tests_use_threads and (test_thread and test_thread.is_alive()): + _thread_stop() + + +func _thread_stop(): + if test_thread and test_thread.is_alive(): + tests_use_threads = false + test_thread_closing = true + test_thread.wait_to_finish() + + +func _thread_body(): + print("Thread started!") + while not test_thread_closing: + DebugDraw3D.draw_box(Vector3(0,-1,0), Quaternion.IDENTITY, Vector3.ONE, Color.BROWN, true, 0.016) + + var boxes = 10 + for y in boxes: + var offset := sin(TAU/boxes * y + wrapf(Time.get_ticks_msec() / 100.0, 0, TAU)) + var pos := Vector3(offset, y, 0) + DebugDraw3D.draw_box(pos, Quaternion.IDENTITY, Vector3.ONE, Color.GREEN_YELLOW, true, 0.016) + DebugDraw3D.draw_text(pos, str(y), 64, Color.WHITE , 0.016) + + if y == 0: + DebugDraw2D.set_text("thread. sin", offset) + + OS.delay_msec(16) + print("Thread finished!") diff --git a/examples_dd3d/DD3DDemo.gd.uid b/examples_dd3d/DD3DDemo.gd.uid new file mode 100644 index 0000000..39b5273 --- /dev/null +++ b/examples_dd3d/DD3DDemo.gd.uid @@ -0,0 +1 @@ +uid://ba2ie81p2x3x7 diff --git a/examples_dd3d/DD3DDemo.tscn b/examples_dd3d/DD3DDemo.tscn new file mode 100644 index 0000000..023cf91 --- /dev/null +++ b/examples_dd3d/DD3DDemo.tscn @@ -0,0 +1,1061 @@ +[gd_scene load_steps=43 format=3 uid="uid://c3sccy6x0ht5j"] + +[ext_resource type="Script" uid="uid://ba2ie81p2x3x7" path="res://examples_dd3d/DD3DDemo.gd" id="1"] +[ext_resource type="FontFile" uid="uid://erdgllynwqkw" path="res://examples_dd3d/Roboto-Bold.ttf" id="2_aedbq"] +[ext_resource type="Script" uid="uid://b5mdrjubj0lg5" path="res://examples_dd3d/demo_camera_movement.gd" id="3_3m1mp"] +[ext_resource type="FontFile" uid="uid://cqbkyhs6g8trq" path="res://examples_dd3d/Minecraft - by BennyFonts1002 - from fontstruct.ttf" id="3_rgja2"] +[ext_resource type="Script" uid="uid://bebbekatkxaoe" path="res://examples_dd3d/demo_music_visualizer.gd" id="4_eq2lt"] +[ext_resource type="Script" uid="uid://83dhsep7l725" path="res://examples_dd3d/demo_settings_panel.gd" id="5_31v5h"] +[ext_resource type="Script" uid="uid://hvx3t70syvkm" path="res://examples_dd3d/demo_web_docs_version_select.gd" id="6_07f7q"] + +[sub_resource type="Animation" id="Animation_ucqh5"] +resource_name = "RESET" +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("..:tests_use_threads") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:mesh:material:shader_parameter/albedo_texture") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [null] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_cq37i"] +_data = { +&"RESET": SubResource("Animation_ucqh5") +} + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_87638"] +sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) +ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) + +[sub_resource type="Sky" id="Sky_4jfme"] +sky_material = SubResource("ProceduralSkyMaterial_87638") + +[sub_resource type="Environment" id="Environment_38m85"] +sky = SubResource("Sky_4jfme") +tonemap_mode = 2 +fog_light_energy = 0.41 +fog_density = 0.0757 +fog_height = 0.5 +fog_height_density = 4.6102 + +[sub_resource type="Animation" id="9"] +resource_name = "New Anim" +length = 1.5 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Spatial2:transform") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.7), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 1), Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0.31558, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Spatial5:transform") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -1, 1), Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -1.5801, 1)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Spatial4:transform") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.443643, 0, 1.53767), Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.443643, -0.791383, 1.53767)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Spatial7:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0.4, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector3(1.33, -0.119, -0.025), Vector3(1.32989, -0.583818, -0.025198)] +} + +[sub_resource type="Animation" id="10"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Spatial2:transform") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Spatial5:transform") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -1, 1)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Spatial4:transform") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.443643, 0, 1.53767)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Spatial7:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(1.32989, -0.583818, -0.025198)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_nj4nv"] +_data = { +&"New Anim": SubResource("9"), +&"RESET": SubResource("10") +} + +[sub_resource type="Shader" id="Shader_621vv"] +code = "shader_type spatial; +render_mode unshaded; + +uniform sampler2D albedo_texture : source_color; + +void fragment() { + ALBEDO = texture(albedo_texture,UV).rgb; +} +" + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ho0aq"] +render_priority = 0 +shader = SubResource("Shader_621vv") + +[sub_resource type="PlaneMesh" id="PlaneMesh_c6mie"] +material = SubResource("ShaderMaterial_ho0aq") +size = Vector2(4, 4) + +[sub_resource type="CapsuleMesh" id="CapsuleMesh_tigpa"] +radius = 0.395 +height = 1.825 + +[sub_resource type="BoxMesh" id="BoxMesh_b14rm"] + +[sub_resource type="Animation" id="Animation_w1m7s"] +length = 0.001 +tracks/0/type = "position_3d" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Camera") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = PackedFloat32Array(0, 1, -6.988, 10.986, 29.206) +tracks/1/type = "rotation_3d" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Camera") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = PackedFloat32Array(0, 1, -0.16935, 0, 0, 0.985556) + +[sub_resource type="Animation" id="Animation_h4e34"] +resource_name = "recursive" +length = 18.0 +tracks/0/type = "position_3d" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Camera") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = PackedFloat32Array(0, 1, -4.43594, -0.0101277, 8.56634, 2, 1, -4.63897, -0.279309, 8.78785, 4, 1, -4.65315, -0.433226, 8.88306, 6, 1, -4.6267, -0.506496, 8.90766, 8, 1, -4.60482, -0.535954, 8.90541, 10, 1, -4.59385, -0.545658, 8.89771, 12, 1, -4.59006, -0.547969, 8.89174, 14, 1, -4.58948, -0.548125, 8.88844, 16, 1, -4.58985, -0.547923, 8.887, 18, 1, -4.5903, -0.547799, 8.8865) +tracks/1/type = "rotation_3d" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Camera") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = PackedFloat32Array(0, 1, 0.190215, 0.859282, 0.43192, 0.197228, 2, 1, 0.183697, 0.853511, 0.484111, -0.0584063, 4, 1, 0.164659, 0.789579, 0.503307, -0.310057, 6, 1, -0.134401, -0.671836, -0.48821, 0.540577, 8, 1, -0.0949895, -0.508291, -0.439844, 0.734271, 10, 1, -0.0490975, -0.310157, -0.361506, 0.877898, 12, 1, 0.000153813, -0.090853, -0.258524, 0.961723, 14, 1, 0.0493618, 0.134434, -0.138051, 0.980017, 16, 1, 0.0953059, 0.351263, -0.00774742, 0.931381, 18, 1, 0.13493, 0.543814, 0.122741, 0.819143) + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_rcwnp"] +_data = { +&"RESET": SubResource("Animation_w1m7s"), +&"recursive": SubResource("Animation_h4e34") +} + +[sub_resource type="SphereShape3D" id="4"] +radius = 1.0 + +[sub_resource type="StandardMaterial3D" id="5"] +transparency = 1 +albedo_color = Color(0.54902, 0.54902, 0.729412, 0.403922) +emission_enabled = true +emission = Color(0.752941, 0.741176, 0.862745, 1) + +[sub_resource type="Animation" id="6"] +resource_name = "New Anim" +length = 3.0 +loop_mode = 1 +tracks/0/type = "rotation_3d" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("RayEmitter") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1, 1.3, 1, 1.31237e-06, -9.55543e-07, -2.2333e-06, 1, 2.3, 1, -0.158418, 0.0315871, 0.980558, -0.111409) +tracks/1/type = "position_3d" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("RayEmitter") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = PackedFloat32Array(0, 1, -1.03574, 2.47907, -0.819963, 0.5, 1, 0.914907, 1.78507, -0.103575, 1.3, 1, 0.00863326, 2.47907, -0.595551, 2.3, 1, 1.00051, 1.4046, 1.02585) + +[sub_resource type="Animation" id="7"] +length = 0.001 +tracks/0/type = "position_3d" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("RayEmitter") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = PackedFloat32Array(0, 1, -1.03574, 2.47907, -0.819963) +tracks/1/type = "rotation_3d" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("RayEmitter") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1) + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_vh8ml"] +_data = { +&"New Anim": SubResource("6"), +&"RESET": SubResource("7") +} + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rbfyn"] +transparency = 1 +cull_mode = 2 +shading_mode = 0 +albedo_color = Color(0.215686, 0.215686, 0.215686, 0.764706) + +[sub_resource type="QuadMesh" id="QuadMesh_1t0id"] +material = SubResource("StandardMaterial3D_rbfyn") +orientation = 1 + +[sub_resource type="StandardMaterial3D" id="1"] +shading_mode = 0 +albedo_color = Color(0.533333, 0.105882, 0.105882, 1) + +[sub_resource type="Animation" id="8"] +resource_name = "RESET" +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(7, -2, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_a7f1a"] +_data = { +&"RESET": SubResource("8") +} + +[sub_resource type="Shader" id="Shader_3cmiq"] +code = "shader_type spatial; +render_mode unshaded; + +uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest; + +void fragment() { + vec4 col = texture(screen_texture, SCREEN_UV); + ALBEDO = col.brg; + ALPHA = col.a; +} +" + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_t3isk"] +render_priority = 0 +shader = SubResource("Shader_3cmiq") + +[sub_resource type="BoxMesh" id="BoxMesh_0xv07"] +material = SubResource("ShaderMaterial_t3isk") + +[sub_resource type="Gradient" id="Gradient_tup4c"] +offsets = PackedFloat32Array(0.00471698, 0.316038, 0.646226, 1) +colors = PackedColorArray(0, 0.0156863, 1, 1, 0.0988327, 1, 0.122977, 1, 1, 0.111986, 0.118936, 1, 0, 0.0156863, 1, 1) + +[sub_resource type="Animation" id="Animation_n750a"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("../MusicPlayer:stream") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [null] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_0ity1"] +_data = { +&"RESET": SubResource("Animation_n750a") +} + +[sub_resource type="Theme" id="3"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_oj5gf"] +content_margin_top = 5.0 +content_margin_bottom = 7.0 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_boyhr"] +content_margin_left = 5.0 +content_margin_top = 5.0 +content_margin_right = 5.0 +content_margin_bottom = 5.0 +bg_color = Color(0.0705882, 0.0705882, 0.0705882, 0.784314) +corner_radius_top_left = 4 +corner_radius_top_right = 4 +corner_radius_bottom_right = 4 +corner_radius_bottom_left = 4 + +[node name="DD3DDemo" type="Node3D"] +process_priority = 1 +script = ExtResource("1") +custom_font = ExtResource("2_aedbq") +custom_3d_font = ExtResource("3_rgja2") +text_groups_position = 2 + +[node name="RESET" type="AnimationPlayer" parent="."] +root_node = NodePath("../OtherWorld") +libraries = { +&"": SubResource("AnimationLibrary_cq37i") +} + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0) +visible = false +directional_shadow_max_distance = 200.0 + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_38m85") + +[node name="Camera" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.9426419, 0.3338081, 0, -0.3338081, 0.9426419, -6.988, 10.986, 29.206) +cull_mask = 1 +current = true +fov = 53.0 +near = 0.001 +far = 100.0 +script = ExtResource("3_3m1mp") + +[node name="Panel" type="PanelContainer" parent="."] +visible = false +custom_minimum_size = Vector2(300, 300) +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_top = -300.0 +offset_right = 300.0 +grow_vertical = 0 + +[node name="ViewportContainer" type="SubViewportContainer" parent="Panel"] +layout_mode = 2 + +[node name="Viewport" type="SubViewport" parent="Panel/ViewportContainer"] +handle_input_locally = false +size = Vector2i(300, 300) +render_target_update_mode = 0 + +[node name="CameraLayer2_5" type="Camera3D" parent="Panel/ViewportContainer/Viewport"] +transform = Transform3D(1, 0, 0, 0, 0.34202, 0.939693, 0, -0.939693, 0.34202, -3.988, 39.474, 14.053) +cull_mask = 2 +current = true +fov = 38.8 +near = 2.63 +far = 52.5 + +[node name="Zones" type="Node3D" parent="."] + +[node name="SpheresBox" type="Node3D" parent="Zones"] +unique_name_in_owner = true +transform = Transform3D(8.3761, 0, 0, 0, 4.89771, 0, 0, 0, 9.36556, -11.1864, 0.645876, -7.86506) + +[node name="CylindersBox" type="Node3D" parent="Zones"] +unique_name_in_owner = true +transform = Transform3D(9.78549, 0, 0, 0, 4.20302, 0, 0, 0, 5.62455, -23.6827, -0.015712, -6.19233) + +[node name="CapsulesBox" type="Node3D" parent="Zones"] +unique_name_in_owner = true +transform = Transform3D(4.8696866, 0, 0, 0, 4.20302, 0, 0, 0, 4.7276874, -25.916273, -0.30829632, 2.7791631) + +[node name="BoxesBox" type="Node3D" parent="Zones"] +unique_name_in_owner = true +transform = Transform3D(10.0513, 0, 0, 0, 5.99877, 0, 0, 0, 12.1174, -16.0257, -0.206735, 6.27643) + +[node name="LinesBox" type="Node3D" parent="Zones"] +unique_name_in_owner = true +transform = Transform3D(10.7186, 0, 0, 0, 3.9777, 0, 0, 0, 7.05487, 10.6302, 1.91174, -7.11416) + +[node name="PathsBox" type="Node3D" parent="Zones"] +unique_name_in_owner = true +transform = Transform3D(5.95153, 0, 0, 0, 7.71864, 0, 0, 0, 6.31617, 0.184938, 1.12881, -7.18731) + +[node name="MiscBox" type="Node3D" parent="Zones"] +unique_name_in_owner = true +transform = Transform3D(4.38886, 0, 0, 0, 2.72083, 0, 0, 0, 8.81683, -5.69728, -0.206735, 5.58232) + +[node name="LinesAnim" type="AnimationPlayer" parent="."] +root_node = NodePath("../LinePath") +libraries = { +&"": SubResource("AnimationLibrary_nj4nv") +} +autoplay = "New Anim" + +[node name="LinePath" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.0543, -8) + +[node name="Spatial" type="Node3D" parent="LinePath"] + +[node name="Spatial2" type="Node3D" parent="LinePath"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 1) + +[node name="Spatial3" type="Node3D" parent="LinePath"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.462435, 0, 3) + +[node name="Spatial4" type="Node3D" parent="LinePath"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.443643, 0, 1.53767) + +[node name="Spatial5" type="Node3D" parent="LinePath"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -1, 1) + +[node name="Spatial6" type="Node3D" parent="LinePath"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, -1) + +[node name="Spatial7" type="Node3D" parent="LinePath"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.32989, -0.583818, -0.025198) + +[node name="Cylinders" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -23.5266, 4.76837e-07, -5.82213) + +[node name="Cylinder1" type="Node3D" parent="Cylinders"] +transform = Transform3D(1.20775, 0.591481, -3.4521e-07, 0.554162, -1.12986, 0.858242, 0.208031, -0.424147, -2.28622, -3.03832, 0, -0.377882) + +[node name="Cylinder2" type="Node3D" parent="Cylinders"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.234978, -0.4237, 0.332998) + +[node name="Cylinder3" type="Node3D" parent="Cylinders"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.35527, -0.655492, -0.352802) + +[node name="1" type="Node3D" parent="Cylinders/Cylinder3"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.419773, -2.38419e-07, -1.40591) + +[node name="2" type="Node3D" parent="Cylinders/Cylinder3"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.01018, 0.486778, 1.32635) + +[node name="Capsules" type="Node3D" parent="."] +unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -27.47091, 4.76837e-07, 3.1799905) + +[node name="Capsule1" type="Node3D" parent="Capsules"] +transform = Transform3D(0.75, 0, 0, 0, 3, 0, 0, 0, 1, 0.35848427, -0.4237, -1.2820461) + +[node name="Capsule2" type="Node3D" parent="Capsules"] +transform = Transform3D(0.8457092, 0, -0.533644, 0, 1, 0, 0.533644, 0, 0.8457092, 2.1917667, -0.655492, -0.33672953) + +[node name="1" type="Node3D" parent="Capsules/Capsule2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.90534526, -2) + +[node name="2" type="Node3D" parent="Capsules/Capsule2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.83874416, 2) + +[node name="Spheres" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.1201, 0.166728, -7.893) + +[node name="SphereTransform" type="Node3D" parent="Spheres"] +transform = Transform3D(3.018, 0, 0, 0, 0.945452, -3.30182, 0, 1.04515, 2.98686, -2.14465, 4.76837e-07, 2.11952) + +[node name="SphereHDTransform" type="Node3D" parent="Spheres"] +transform = Transform3D(1.26984, 1.16629, -2.42095, 0.098772, 0.80937, 4.21576, -2.65493, 0.587941, -1.00109, -2.13175, 4.76837e-07, -2.62531) + +[node name="SpherePosition" type="Node3D" parent="Spheres"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.76745, 0.458486, 1.95921) + +[node name="Boxes" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15.2493, 0, 6.42043) + +[node name="Box1" type="Node3D" parent="Boxes"] +transform = Transform3D(2.90583, -0.000527017, -5.34615, 0.00469241, 3.92788, 0.0141019, 0.556318, -0.0303774, 1.91619, -0.961557, 0, -3.78672) +rotation_edit_mode = 2 + +[node name="Box2" type="Node3D" parent="Boxes"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.531922, -1.34723, 1.44924) + +[node name="Box3" type="Node3D" parent="Boxes"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.34837, -1.08298, 4.36414) + +[node name="AABB_fixed" type="Node3D" parent="Boxes"] +transform = Transform3D(0.834492, 0, -0.551019, 0, 1, 0, 0.55102, 0, 0.834493, -3.71325, -1.03995, 0.470324) + +[node name="AABB" type="Node3D" parent="Boxes"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.99963, -0.869998, 0.205034) + +[node name="a" type="Node3D" parent="Boxes/AABB"] +transform = Transform3D(0.864099, 0.258702, 0.431747, -1.49012e-08, 0.857796, -0.51399, -0.503322, 0.444139, 0.741221, 1.48526, -1.45318, 1.96619) + +[node name="b" type="Node3D" parent="Boxes/AABB"] +transform = Transform3D(0.864099, 0.258702, 0.431747, -1.49012e-08, 0.857796, -0.51399, -0.503322, 0.444139, 0.741221, -1.24128, 1.47773, -2.13102) + +[node name="BoxAB" type="Node3D" parent="Boxes"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.66169, -2.2624, 4.04042) + +[node name="a" type="Node3D" parent="Boxes/BoxAB"] +transform = Transform3D(0.864099, 0.258702, 0.431747, -1.49012e-08, 0.857796, -0.51399, -0.503322, 0.444139, 0.741221, 0.556136, -0.666145, 0.951601) + +[node name="b" type="Node3D" parent="Boxes/BoxAB"] +transform = Transform3D(0.864099, 0.258702, 0.431747, -1.49012e-08, 0.857796, -0.51399, -0.503322, 0.444139, 0.741221, -0.548804, 0.715255, -0.942184) + +[node name="o" type="Node3D" parent="Boxes/BoxAB"] +transform = Transform3D(0.826805, 0.360538, 0.431748, -0.102949, 0.851596, -0.51399, -0.552988, 0.380522, 0.741221, 0, 0, 0) +metadata/_edit_group_ = true + +[node name="up" type="Node3D" parent="Boxes/BoxAB/o"] +transform = Transform3D(1, -1.49012e-08, 0, -1.04308e-07, 1, 0, 0, 0, 1, 0, 0.553809, -0.331842) + +[node name="BoxABEdge" type="Node3D" parent="Boxes"] +transform = Transform3D(0.965926, -0.0669873, -0.25, 0, 0.965926, -0.258819, 0.258819, 0.25, 0.933013, 0.348115, -1.30239, 4.88007) + +[node name="a" type="Node3D" parent="Boxes/BoxABEdge"] +transform = Transform3D(0.241143, 0.650584, 0.720132, -0.123077, 0.756539, -0.642262, -0.962654, 0.066246, 0.262507, 0.384618, -0.635015, 0.0956135) + +[node name="b" type="Node3D" parent="Boxes/BoxABEdge"] +transform = Transform3D(0.241143, 0.650584, 0.720133, -0.123077, 0.756539, -0.642261, -0.962654, 0.0662459, 0.262507, -0.287622, 0.997905, -0.144578) + +[node name="o" type="Node3D" parent="Boxes/BoxABEdge"] +transform = Transform3D(1, 1.49012e-08, 2.98023e-08, 7.45058e-09, 1, -1.49012e-08, -1.49012e-08, -1.49012e-08, 1, 0, 0, 0) +metadata/_edit_group_ = true + +[node name="up" type="Node3D" parent="Boxes/BoxABEdge/o"] +transform = Transform3D(1, -7.45058e-09, 0, -7.45058e-09, 1, 0, 2.98023e-08, -1.49012e-08, 1, -9.53674e-07, 0.6, 0) + +[node name="OtherWorld" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.53219, -2.5, 5.30229) +mesh = SubResource("PlaneMesh_c6mie") +skeleton = NodePath("") + +[node name="RESET" type="AnimationPlayer" parent="OtherWorld"] +libraries = { +&"": SubResource("AnimationLibrary_cq37i") +} + +[node name="SubViewport" type="SubViewport" parent="OtherWorld"] +own_world_3d = true +handle_input_locally = false +render_target_update_mode = 4 + +[node name="SubViewportContainer" type="SubViewportContainer" parent="OtherWorld/SubViewport"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +stretch = true + +[node name="SubViewport" type="SubViewport" parent="OtherWorld/SubViewport/SubViewportContainer"] +handle_input_locally = false +render_target_update_mode = 4 + +[node name="Camera3D" type="Camera3D" parent="OtherWorld/SubViewport/SubViewportContainer/SubViewport"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.57063, 0.6, 7.25557) +current = true +far = 5.0 + +[node name="MeshInstance3D" type="MeshInstance3D" parent="OtherWorld/SubViewport/SubViewportContainer/SubViewport"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.57063, 0.6, 5.72253) +mesh = SubResource("CapsuleMesh_tigpa") +skeleton = NodePath("../../..") + +[node name="OtherWorldBox" type="Node3D" parent="OtherWorld/SubViewport/SubViewportContainer/SubViewport"] +unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.57063, 0.6, 5.72253) + +[node name="Misc" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.68259, 0, 4.46741) + +[node name="Billboard" type="Node3D" parent="Misc"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.403353, -0.331599, 2.22542) + +[node name="Arrow" type="Node3D" parent="Misc"] +transform = Transform3D(0.802141, -0.286294, -0.524028, -0.539546, 0.0285125, -0.841473, 0.25585, 0.957718, -0.131597, -0.475607, -0.670307, 2.30581) + +[node name="Position" type="Node3D" parent="Misc"] +transform = Transform3D(1.51514, 0.589536, 1.00858, -1.34875, 0.662262, 1.133, 0, -0.462445, 2.90833, 0.853743, 0.0843356, -1.73676) + +[node name="GizmoNormal" type="Node3D" parent="Misc"] +transform = Transform3D(0.965926, 0, -0.258819, 0, 1, 0, 0.258819, 0, 0.965926, 0.890203, -0.306246, 0.356159) + +[node name="ZDepthTestCube" type="MeshInstance3D" parent="Misc/GizmoNormal"] +unique_name_in_owner = true +transform = Transform3D(0.591801, 0, 4.47035e-08, 0, 0.591801, 0, -4.47035e-08, 0, 0.591801, 0, 0, 0) +mesh = SubResource("BoxMesh_b14rm") + +[node name="GizmoTransform" type="Node3D" parent="Misc"] +transform = Transform3D(0.879881, 0.248446, -0.405072, -0.346604, 0.918688, -0.189411, 0.325077, 0.307059, 0.894449, -0.838587, -0.458, -0.176491) + +[node name="GizmoOneColor" type="Node3D" parent="Misc"] +transform = Transform3D(0.385568, 0.0415614, 0.921743, 0.082879, 0.993386, -0.0794599, -0.91895, 0.107031, 0.379573, -0.838587, -0.139425, -1.93055) + +[node name="LocalTransformRecursiveOrigin" type="Node3D" parent="Misc"] +unique_name_in_owner = true +transform = Transform3D(0.785829, 0.365814, 0.498651, 0.0146361, 0.795073, -0.606337, -0.618271, 0.483775, 0.619438, 0.92688, -0.70441, 4.03998) + +[node name="RecursiveTransformTest" type="AnimationPlayer" parent="Misc/LocalTransformRecursiveOrigin"] +unique_name_in_owner = true +root_node = NodePath("../../..") +libraries = { +&"": SubResource("AnimationLibrary_rcwnp") +} + +[node name="HitTest" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.724359, -1.03227, 7.85404) + +[node name="StaticBody" type="StaticBody3D" parent="HitTest"] + +[node name="CollisionShape" type="CollisionShape3D" parent="HitTest/StaticBody"] +shape = SubResource("4") + +[node name="HitTestSphere" type="CSGSphere3D" parent="HitTest/StaticBody"] +unique_name_in_owner = true +radius = 1.0 +radial_segments = 16 +rings = 10 +material = SubResource("5") + +[node name="RayEmitter" type="Node3D" parent="HitTest"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.03574, 2.47907, -0.819963) + +[node name="RayCast" type="RayCast3D" parent="HitTest/RayEmitter"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.732104, 0, -0.814761) +enabled = false +target_position = Vector3(0, -3.464, 0) + +[node name="RayCast2" type="RayCast3D" parent="HitTest/RayEmitter"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.684873, 0, -0.791145) +enabled = false +target_position = Vector3(0, -3.464, 0) + +[node name="RayCast3" type="RayCast3D" parent="HitTest/RayEmitter"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.708488, 0, 0.543175) +enabled = false +target_position = Vector3(0, -3.464, 0) + +[node name="RayCast4" type="RayCast3D" parent="HitTest/RayEmitter"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.708489, 0, 0.566791) +enabled = false +target_position = Vector3(0, -3.464, 0) + +[node name="RayCast5" type="RayCast3D" parent="HitTest/RayEmitter"] +transform = Transform3D(0.974217, -0.225614, 0, 0.225614, 0.974217, 0, 0, 0, 1, -0.447564, 0, -0.259778) +enabled = false +target_position = Vector3(0, -3.464, 0) + +[node name="RayCast6" type="RayCast3D" parent="HitTest/RayEmitter"] +transform = Transform3D(0.935992, 0.352021, 0, -0.352021, 0.935992, 0, 0, 0, 1, 0.35227, -0.245904, -0.25849) +enabled = false +target_position = Vector3(0, -3.464, 0) + +[node name="RayEmitterAnimationPlayer" type="AnimationPlayer" parent="HitTest"] +unique_name_in_owner = true +libraries = { +&"": SubResource("AnimationLibrary_vh8ml") +} +autoplay = "New Anim" + +[node name="Grids" type="Node3D" parent="."] +transform = Transform3D(0.707106, 0, -0.707108, 0, 1, 0, 0.707108, 0, 0.707106, 0.730597, -2.5, 2.76274) + +[node name="GridCentered" type="Node3D" parent="Grids"] +transform = Transform3D(1.74492, 0.723785, -1.74493, -1.24976, -7.72562e-08, -1.24975, -1.74493, 0.723783, 1.74493, 1.74919, -0.0010004, 1.75466) +rotation_edit_mode = 2 + +[node name="Subdivision" type="Node3D" parent="Grids/GridCentered"] +transform = Transform3D(1, -6.03961e-14, -2.68221e-07, 3.55271e-13, 1, 1.42109e-14, -1.19209e-07, 1.1724e-13, 1, -0.2, 4.76837e-07, 0.4) + +[node name="Grid" type="Node3D" parent="Grids"] +transform = Transform3D(5, 0, 4.76837e-07, 0, 1, 0, -4.76837e-07, 0, 5, 0, 0, 0) + +[node name="Subdivision" type="Node3D" parent="Grids/Grid"] +transform = Transform3D(1, 0, -2.98023e-08, 0, 0.999999, 1.90735e-05, 0, 4.65661e-10, 0.999999, 1, 0, 1) + +[node name="PlaneOrigin" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 11.0482, 7.33669, -13.1715) +mesh = SubResource("QuadMesh_1t0id") + +[node name="Lines" type="Node3D" parent="."] +transform = Transform3D(1.51514, 0.589536, 1.00858, -1.34875, 0.662262, 1.133, 0, -0.462445, 2.90833, 10.2488, -0.331599, -10.3326) + +[node name="1" type="Node3D" parent="Lines"] +transform = Transform3D(1, 6.61592e-09, 2.23038e-08, 9.40939e-07, 1, 0, -2.76085e-08, -1.49012e-08, 1, -1.46213, -4.03317, 0.61692) + +[node name="2" type="Node3D" parent="Lines"] +transform = Transform3D(1, 6.61592e-09, 2.23038e-08, 9.40939e-07, 1, 0, -2.76085e-08, -1.49012e-08, 1, -1.01875, -1.79584, -0.163045) + +[node name="3" type="Node3D" parent="Lines"] +transform = Transform3D(1, 6.61592e-09, 2.23038e-08, 6.87561e-07, 1, 0, -2.87275e-08, -1.49012e-08, 1, -0.1559, -0.407045, 0.0523388) + +[node name="4" type="Node3D" parent="Lines"] +transform = Transform3D(1, 6.61592e-09, 2.23038e-08, 4.9239e-07, 1, 0, -3.40677e-08, -1.49012e-08, 1, 1.18591, 1.8987, 0.301906) + +[node name="5" type="Node3D" parent="Lines"] +transform = Transform3D(-0.998871, -0.0207882, -0.0355643, 0.0855375, -0.5714, -2.68836, 0.0136011, -0.249864, 0.572532, 1.43126, 0.26242, 1.92347) + +[node name="6" type="Node3D" parent="Lines"] +transform = Transform3D(-0.998872, -0.0207882, -0.0355643, 0.085537, -0.5714, -2.68836, 0.0136012, -0.249864, 0.572533, 1.43441, 1.50606, 1.20028) + +[node name="7" type="Node3D" parent="Lines"] +transform = Transform3D(-0.998873, -0.0207882, -0.0355641, 0.0855357, -0.5714, -2.68836, 0.0136014, -0.249864, 0.572533, 0.0511096, -1.3236, 1.06745) + +[node name="8" type="Node3D" parent="Lines"] +transform = Transform3D(-0.998873, -0.0207882, -0.0355641, 0.0855353, -0.5714, -2.68836, 0.0136016, -0.249864, 0.572533, -1.01372, -3.80486, 1.25019) + +[node name="Target" type="Node3D" parent="Lines"] +transform = Transform3D(1, -2.7352e-06, 2.60722e-07, 4.10378e-06, 1, 0, -4.28605e-07, -1.49012e-08, 1, -0.69134, 0.176475, 1.30597) + +[node name="LagTest" type="CSGBox3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, -2, 0) +size = Vector3(2, 2, 2) +material = SubResource("1") + +[node name="RESET" type="AnimationPlayer" parent="LagTest"] +libraries = { +&"": SubResource("AnimationLibrary_a7f1a") +} + +[node name="PostProcess" type="MeshInstance3D" parent="."] +transform = Transform3D(-2.18557e-07, 0, 1.5, 0, 5, 0, -5, 0, -6.55671e-08, 16, 0, 0) +mesh = SubResource("BoxMesh_0xv07") +skeleton = NodePath("../Lines") + +[node name="MusicVisualizer" type="VBoxContainer" parent="."] +offset_left = 10.0 +offset_top = 10.0 +offset_right = 50.0 +offset_bottom = 50.0 +script = ExtResource("4_eq2lt") +colors = SubResource("Gradient_tup4c") + +[node name="OpenFile" type="Button" parent="MusicVisualizer"] +layout_mode = 2 +size_flags_horizontal = 0 +text = "Open music" + +[node name="RESET" type="AnimationPlayer" parent="MusicVisualizer"] +root_node = NodePath("../OpenFile") +libraries = { +&"": SubResource("AnimationLibrary_0ity1") +} + +[node name="MusicPlayer" type="AudioStreamPlayer" parent="MusicVisualizer"] +unique_name_in_owner = true +autoplay = true +bus = &"MusicAnalyzer" + +[node name="VBox" type="VBoxContainer" parent="MusicVisualizer"] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="MusicVisualizer/VBox"] +layout_mode = 2 + +[node name="VolumeSlider" type="HSlider" parent="MusicVisualizer/VBox/HBoxContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(100, 0) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +max_value = 1.0 +step = 0.01 +value = 0.1 + +[node name="MuteMaster" type="CheckBox" parent="MusicVisualizer/VBox/HBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +button_pressed = true +text = "Mute" + +[node name="AudioVisualizer" type="Node3D" parent="."] +unique_name_in_owner = true +transform = Transform3D(0.2, 0, 0, 0, 5, 0, 0, 0, 0.2, -5.31036, -1.422, 14.14) + +[node name="CustomCanvas" type="Control" parent="."] +unique_name_in_owner = true +layout_mode = 3 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -545.0 +offset_top = 46.0 +offset_right = -37.0 +offset_bottom = 638.0 +grow_horizontal = 0 +mouse_filter = 2 +metadata/_edit_lock_ = true + +[node name="Settings" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme = SubResource("3") +script = ExtResource("5_31v5h") +switch_to_scene = "res://examples_dd3d/DD3DDemoCS.tscn" +metadata/_edit_lock_ = true + +[node name="HBox" type="HBoxContainer" parent="Settings"] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -497.0 +offset_top = -372.0 +offset_right = -10.0006 +offset_bottom = -10.0 +grow_horizontal = 0 +grow_vertical = 0 + +[node name="VBoxContainer" type="VBoxContainer" parent="Settings/HBox"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 + +[node name="VersionBlock" type="HBoxContainer" parent="Settings/HBox/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +script = ExtResource("6_07f7q") + +[node name="Label" type="Label" parent="Settings/HBox/VBoxContainer/VersionBlock"] +layout_mode = 2 +size_flags_horizontal = 10 +theme_override_font_sizes/font_size = 13 +text = "Demo version:" + +[node name="OptionButton" type="OptionButton" parent="Settings/HBox/VBoxContainer/VersionBlock"] +layout_mode = 2 +size_flags_horizontal = 8 +theme_override_font_sizes/font_size = 13 +item_count = 1 +popup/item_0/text = "1.0.0" + +[node name="Label" type="Label" parent="Settings/HBox/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +theme_override_styles/normal = SubResource("StyleBoxEmpty_oj5gf") +text = "GDScript example" +horizontal_alignment = 2 +metadata/_edit_use_anchors_ = true + +[node name="VBox" type="VBoxContainer" parent="Settings/HBox"] +layout_mode = 2 +alignment = 2 + +[node name="HideShowPanelButton" type="Button" parent="Settings/HBox/VBox"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 4 +theme_override_font_sizes/font_size = 13 +text = "Hide panel" + +[node name="SettingsPanel" type="PanelContainer" parent="Settings/HBox/VBox"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +theme_override_styles/panel = SubResource("StyleBoxFlat_boyhr") + +[node name="VBox" type="VBoxContainer" parent="Settings/HBox/VBox/SettingsPanel"] +layout_mode = 2 +size_flags_horizontal = 3 +alignment = 2 + +[node name="Label" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +layout_mode = 2 +theme_override_colors/font_color = Color(0.792157, 0.792157, 0.792157, 1) +text = "Common:" + +[node name="HBox3" type="HBoxContainer" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +layout_mode = 2 + +[node name="Label" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox3"] +layout_mode = 2 +text = "Thickness " + +[node name="ThicknessSlider" type="HSlider" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox3"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +max_value = 0.5 +step = 0.001 +value = 0.05 + +[node name="HBox5" type="HBoxContainer" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +layout_mode = 2 + +[node name="Label" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox5"] +layout_mode = 2 +text = "Frustum Scale" + +[node name="FrustumScaleSlider" type="HSlider" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox5"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +max_value = 1.0 +step = 0.001 +value = 0.5 + +[node name="UpdateInPhysics" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "Update in physics (15 Ticks) *" + +[node name="Label4" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +layout_mode = 2 +theme_override_colors/font_color = Color(0.792157, 0.792157, 0.792157, 1) +text = "Text:" + +[node name="ShowText" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "Show text" + +[node name="ShowExamples" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "Examples" + +[node name="ShowStats" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "Debug stats" + +[node name="ShowHints" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "Hints" + +[node name="Draw3DText" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "3D Text" + +[node name="Label3" type="Label" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +layout_mode = 2 +theme_override_colors/font_color = Color(0.792157, 0.792157, 0.792157, 1) +text = "Boxes:" + +[node name="HBox4" type="HBoxContainer" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +layout_mode = 2 + +[node name="DrawBoxes" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox4"] +unique_name_in_owner = true +layout_mode = 2 +text = "Draw an array of boxes" + +[node name="Draw1MBoxes" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox/HBox4"] +unique_name_in_owner = true +layout_mode = 2 +tooltip_text = "Draw 1 Million boxes, otherwise 7500pcs." +text = "1M" + +[node name="DrawBoxesAddText" type="CheckBox" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "Add text to boxes" + +[node name="SwitchLang" type="Button" parent="Settings/HBox/VBox/SettingsPanel/VBox"] +unique_name_in_owner = true +layout_mode = 2 +text = "Switch to C#" + +[connection signal="pressed" from="MusicVisualizer/OpenFile" to="MusicVisualizer" method="_pressed"] +[connection signal="value_changed" from="MusicVisualizer/VBox/HBoxContainer/VolumeSlider" to="MusicVisualizer" method="_on_volume_slider_value_changed"] +[connection signal="toggled" from="MusicVisualizer/VBox/HBoxContainer/MuteMaster" to="MusicVisualizer" method="_on_mute_master_toggled"] +[connection signal="pressed" from="Settings/HBox/VBox/HideShowPanelButton" to="Settings" method="_on_hide_show_panel_pressed"] +[connection signal="value_changed" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox3/ThicknessSlider" to="Settings" method="_on_thickness_slider_value_changed"] +[connection signal="value_changed" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox5/FrustumScaleSlider" to="Settings" method="_on_frustum_scale_slider_value_changed"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/UpdateInPhysics" to="Settings" method="_on_update_in_physics_toggled"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/ShowText" to="Settings" method="_on_show_text_toggled"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/ShowExamples" to="Settings" method="_on_show_examples_toggled"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/ShowStats" to="Settings" method="_on_show_stats_toggled"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/ShowHints" to="Settings" method="_on_show_hints_toggled"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/Draw3DText" to="Settings" method="_on_draw_3d_text_toggled"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox4/DrawBoxes" to="Settings" method="_on_draw_boxes_toggled"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/HBox4/Draw1MBoxes" to="Settings" method="_on_draw_1m_boxes_toggled"] +[connection signal="toggled" from="Settings/HBox/VBox/SettingsPanel/VBox/DrawBoxesAddText" to="Settings" method="_on_add_text_to_boxes_toggled"] +[connection signal="pressed" from="Settings/HBox/VBox/SettingsPanel/VBox/SwitchLang" to="Settings" method="_on_Button_pressed"] diff --git a/examples_dd3d/DD3DDemoCS.cs b/examples_dd3d/DD3DDemoCS.cs new file mode 100644 index 0000000..e0eb520 --- /dev/null +++ b/examples_dd3d/DD3DDemoCS.cs @@ -0,0 +1,990 @@ + +using Godot; +using System; +using System.Collections.Generic; +using System.Threading; + +[Tool] +public partial class DD3DDemoCS : Node3D +{ + [Export] Font custom_font; + [Export] Font custom_3d_font; + [Export] bool zylann_example = false; + [Export] bool update_in_physics = false; + [Export] bool test_text = true; + [Export] bool more_test_cases = true; + [Export] bool draw_3d_text = true; + [Export] bool draw_array_of_boxes = false; + [Export] bool draw_text_with_boxes = false; + [Export] bool draw_1m_boxes = false; + [Export(PropertyHint.Range, "0, 5, 0.001")] float debug_thickness = 0.1f; + [Export(PropertyHint.Range, "0, 1, 0.001")] float debug_center_brightness = 0.8f; + [Export(PropertyHint.Range, "0, 1")] float camera_frustum_scale = 0.9f; + + [ExportGroup("Text groups", "text_groups")] + [Export] bool text_groups_show_examples = true; + [Export] bool text_groups_show_hints = true; + [Export] bool text_groups_show_stats = true; + [Export] bool text_groups_show_stats_2d = true; + [Export] DebugDraw2DConfig.BlockPosition text_groups_position = DebugDraw2DConfig.BlockPosition.LeftTop; + [Export] Vector2I text_groups_offset = new Vector2I(8, 8); + [Export] Vector2I text_groups_padding = new Vector2I(3, 1); + [Export(PropertyHint.Range, "1, 100")] int text_groups_default_font_size = 15; + [Export(PropertyHint.Range, "1, 100")] int text_groups_title_font_size = 20; + [Export(PropertyHint.Range, "1, 100")] int text_groups_text_font_size = 17; + + [ExportGroup("Tests", "tests")] + [Export] + bool tests_use_threads = false; + Thread[] test_thread = null; + bool test_thread_closing = false; + + + Dictionary button_presses = new Dictionary() { + { Key.Left, 0 }, + { Key.Up, 0 }, + { Key.Ctrl, 0 }, + { Key.F1, 0 }, + { Key.Key1, 0 }, + { Key.Key2, 0 }, + { Key.Key3, 0 }, + }; + + double timer_1 = 0.0; + double timer_cubes = 0.0; + double timer_3 = 0.0; + double timer_text = 0.0; + + public DD3DDemoCS() + { + // https://github.com/godotengine/godot/issues/78513 + // register cleanup code to prevent unloading issues + System.Runtime.Loader.AssemblyLoadContext.GetLoadContext(System.Reflection.Assembly.GetExecutingAssembly()).Unloading += alc => + { + _thread_stop(); + }; + } + + public override async void _Ready() + { + var ddm = Engine.GetSingleton("DebugDrawManager"); + GD.Print("DebugDraw3D version: ", ddm.Call("get_addon_version_str"), " ", ddm.Call("get_addon_version")); + + _get_nodes(); + _update_keys_just_press(); + + await new SignalAwaiter(GetTree(), "process_frame", this); + + // this check is required for inherited scenes, because an instance of this + // script is created first, and then overridden by another + if (!IsInsideTree()) + return; + + // DD3D GDExtension not loaded + if (DebugDraw3D.Config == null) + return; + DebugDraw2D.Config.TextBackgroundColor = new Color(0.3f, 0.3f, 0.3f, 0.8f); + } + + bool _is_key_just_pressed(Key key) + { + if (button_presses[key] == 1) + { + button_presses[key] = 2; + return true; + } + return false; + } + + void _update_timers(double delta) + { + timer_1 -= delta; + timer_cubes -= delta; + timer_3 -= delta; + timer_text -= delta; + } + + void _update_keys_just_press() + { + var set = (Key k) => Input.IsKeyPressed(k) ? (button_presses[k] == 0 ? 1 : button_presses[k]) : 0; + button_presses[Key.Left] = set(Key.Left); + button_presses[Key.Up] = set(Key.Up); + button_presses[Key.Ctrl] = set(Key.Ctrl); + button_presses[Key.F1] = set(Key.F1); + button_presses[Key.Key1] = set(Key.Key1); + button_presses[Key.Key2] = set(Key.Key2); + button_presses[Key.Key3] = set(Key.Key3); + } + + bool phys_frame_called = false; + public override void _Process(double delta) + { + ((ShaderMaterial)((PrimitiveMesh)dOtherWorld.Mesh).Material).SetShaderParameter("albedo_texture", dOtherWorldViewport.GetTexture()); + + phys_frame_called = false; + if (!update_in_physics) + { + MainUpdate(delta); + _update_timers(delta); + } + + _call_from_thread(); + } + + public override void _PhysicsProcess(double delta) + { + if (!phys_frame_called) + { + phys_frame_called = true; + if (update_in_physics) + { + MainUpdate(delta); + _update_timers(delta); + } + } + + // Physics specific: + if (!zylann_example) + { + // DD3D GDExtension not loaded + using (var _sc = DebugDraw3D.GetConfig()) + if (_sc == null) + return; + + DebugDraw3D.DrawLine(dLines_8.GlobalPosition, dLines_Target.GlobalPosition, Colors.Yellow); + if (more_test_cases) + { + _draw_rays_casts(); + } + + // Additional drawing in the Viewport + using (var _w1 = DebugDraw3D.NewScopedConfig().SetViewport(dOtherWorldBox.GetViewport()).SetThickness(0.01f).SetCenterBrightness(1).SetNoDepthTest(true)) + { + DebugDraw3D.DrawBoxXf(new Transform3D(Basis.Identity + .Scaled(Vector3.One * 0.3f) + .Rotated(new Vector3(0, 0, 1), Mathf.Pi / 4) + .Rotated(new Vector3(0, 1, 0), Mathf.Wrap(Time.GetTicksMsec() / -1500.0f, 0, Mathf.Tau) - Mathf.Pi / 4), dOtherWorldBox.GlobalPosition), + Colors.Brown, true, 0.4f); + } + } + } + + void MainUpdate(double delta) + { + // DD3D GDExtension not loaded + using (var _sc = DebugDraw3D.GetConfig()) + if (_sc == null) + return; + + DebugDraw3D.ScopedConfig().SetThickness(debug_thickness).SetCenterBrightness(debug_center_brightness).Dispose(); + + _update_keys_just_press(); + + if (_is_key_just_pressed(Key.F1)) + zylann_example = !zylann_example; + + // Zylann's example :D + if (zylann_example) + { + var _time = Time.GetTicksMsec() / 1000.0f; + var box_pos = new Vector3(0, Mathf.Sin(_time * 4f), 0); + var line_begin = new Vector3(-1, Mathf.Sin(_time * 4f), 0); + var line_end = new Vector3(1, Mathf.Cos(_time * 4f), 0); + DebugDraw3D.DrawBox(box_pos, Quaternion.Identity, new Vector3(1, 2, 1), new Color(0, 1, 0)); + DebugDraw3D.DrawLine(line_begin, line_end, new Color(1, 1, 0)); + DebugDraw2D.SetText("Time", _time.ToString()); + DebugDraw2D.SetText("Frames drawn", Engine.GetFramesDrawn().ToString()); + DebugDraw2D.SetText("FPS", Engine.GetFramesPerSecond().ToString()); + DebugDraw2D.SetText("delta", delta.ToString()); + + dHitTest.Visible = false; + dLagTest.Visible = false; + dPlaneOrigin.Visible = false; + pZDepthTestCube.Visible = false; + dOtherWorld.Visible = false; + return; + } + + dHitTest.Visible = true; + dLagTest.Visible = true; + dPlaneOrigin.Visible = true; + pZDepthTestCube.Visible = true; + dOtherWorld.Visible = true; + + // Testing the rendering layers by showing the image from the second camera inside the 2D panel + DebugDraw3D.Config.GeometryRenderLayers = !Input.IsKeyPressed(Key.Alt) ? 1 : 0b10010; + dPanel.Visible = Input.IsKeyPressed(Key.Alt); + DebugDraw2D.CustomCanvas = Input.IsKeyPressed(Key.Alt) ? dCustomCanvas : null; + + // More property toggles + DebugDraw3D.Config.Freeze3dRender = Input.IsKeyPressed(Key.Down); + DebugDraw3D.Config.VisibleInstanceBounds = Input.IsKeyPressed(Key.Right); + + // Regenerate meshes + if (Input.IsActionJustPressed("ui_end")) + DebugDraw3D.RegenerateGeometryMeshes(); + + // Some property toggles + if (_is_key_just_pressed(Key.Left)) + DebugDraw3D.Config.FrustumCullingMode = (DebugDraw3DConfig.CullingMode)Mathf.Wrap((int)DebugDraw3D.Config.FrustumCullingMode + 1, 0, 3); + + if (_is_key_just_pressed(Key.Up)) + DebugDraw3D.Config.ForceUseCameraFromScene = !DebugDraw3D.Config.ForceUseCameraFromScene; + + if (_is_key_just_pressed(Key.Ctrl)) + if (!Engine.IsEditorHint()) + GetViewport().Msaa3D = GetViewport().Msaa3D == Viewport.Msaa.Msaa4X ? Viewport.Msaa.Disabled : Viewport.Msaa.Msaa4X; + + if (!Engine.IsEditorHint()) + { + if (_is_key_just_pressed(Key.Key1)) + DebugDraw3D.DebugEnabled = !DebugDraw3D.DebugEnabled; + if (_is_key_just_pressed(Key.Key2)) + DebugDraw2D.DebugEnabled = !DebugDraw2D.DebugEnabled; + if (_is_key_just_pressed(Key.Key3)) + DebugDrawManager.DebugEnabled = !DebugDrawManager.DebugEnabled; + } + + + DebugDraw3D.Config.FrustumLengthScale = camera_frustum_scale; + + // Zones with black borders + foreach (var node in dZones.GetChildren()) + { + if (node is Node3D z) + { + DebugDraw3D.DrawBoxXf(z.GlobalTransform, Colors.Black); + } + } + + // Spheres + _draw_zone_title(pSpheresBox, "Spheres"); + + DebugDraw3D.DrawSphereXf(dSphereTransform.GlobalTransform, Colors.Crimson); + using (var _s1 = DebugDraw3D.NewScopedConfig().SetHdSphere(true)) + DebugDraw3D.DrawSphereXf(dSphereHDTransform.GlobalTransform, Colors.OrangeRed); + + /// Delayed spheres + if (timer_1 <= 0) + { + var s_xf = dSpherePosition.GlobalTransform; + DebugDraw3D.DrawSphere(s_xf.Origin, 2.0f, Colors.BlueViolet, 2.0f); + using (var _s1 = DebugDraw3D.NewScopedConfig().SetHdSphere(true)) + DebugDraw3D.DrawSphere(s_xf.Origin - s_xf.Basis.Z * 4.2f, 2.0f, Colors.CornflowerBlue, 2.0f); + timer_1 = 2; + } + + // Capsules + { + _draw_zone_title(pCapsulesBox, "Capsules"); + + var capsule1_xf = dCapsule1.GlobalTransform; + var capsule1_scale = capsule1_xf.Basis.Scale; + DebugDraw3D.DrawCapsule(capsule1_xf.Origin, capsule1_xf.Basis.GetRotationQuaternion(), capsule1_scale.X, capsule1_scale.Y, Colors.Crimson); + DebugDraw3D.DrawCapsuleAb(dCapsule2a.GlobalPosition, dCapsule2b.GlobalPosition, 0.6f); + } + + // Cylinders + { + _draw_zone_title(pCylindersBox, "Cylinders"); + + DebugDraw3D.DrawCylinder(dCylinder1.GlobalTransform, Colors.Crimson); + DebugDraw3D.DrawCylinder(new Transform3D(Basis.Identity.Scaled(new Vector3(1, 2, 1)), dCylinder2.GlobalPosition), Colors.Red); + DebugDraw3D.DrawCylinderAb(dCylinder3a.GlobalPosition, dCylinder3b.GlobalPosition, 0.7f); + } + + // Boxes + _draw_zone_title(pBoxesBox, "Boxes"); + + DebugDraw3D.DrawBoxXf(dBox1.GlobalTransform, Colors.MediumPurple); + DebugDraw3D.DrawBox(dBox2.GlobalPosition, Quaternion.FromEuler(new Vector3(0, Mathf.DegToRad(45), Mathf.DegToRad(45))), Vector3.One, Colors.RebeccaPurple); + DebugDraw3D.DrawBoxXf(new Transform3D(new Basis(Vector3.Up, Mathf.Pi * 0.25f).Scaled(Vector3.One * 2), dBox3.GlobalPosition), Colors.RosyBrown); + + DebugDraw3D.DrawAabb(new Aabb(dAABB_fixed.GlobalPosition, new Vector3(2, 1, 2)), Colors.Aqua); + DebugDraw3D.DrawAabbAb(dAABB.GetChild(0).GlobalPosition, dAABB.GetChild(1).GlobalPosition, Colors.DeepPink); + + // Boxes AB + + DebugDraw3D.DrawArrow(dBoxAB.GlobalPosition, dBoxABup.GlobalPosition, Colors.Gold, 0.1f, true); + DebugDraw3D.DrawBoxAb(dBoxABa.GlobalPosition, dBoxABb.GlobalPosition, dBoxABup.GlobalPosition - dBoxAB.GlobalPosition, Colors.Peru); + + DebugDraw3D.DrawArrow(dBoxABEdge.GlobalPosition, dBoxABEdgeup.GlobalPosition, Colors.DarkRed, 0.1f, true); + DebugDraw3D.DrawBoxAb(dBoxABEdgea.GlobalPosition, dBoxABEdgeb.GlobalPosition, dBoxABEdgeup.GlobalPosition - dBoxABEdge.GlobalPosition, Colors.DarkOliveGreen, false); + + // Lines + _draw_zone_title(pLinesBox, "Lines"); + + DebugDraw3D.DrawSquare(dLines_Target.GlobalPosition, 0.5f, Colors.Red); + + DebugDraw3D.DrawLine(dLines_1.GlobalPosition, dLines_Target.GlobalPosition, Colors.Fuchsia); + DebugDraw3D.DrawRay(dLines_3.GlobalPosition, (dLines_Target.GlobalPosition - dLines_3.GlobalPosition).Normalized(), 3.0f, Colors.Crimson); + + + if (timer_3 <= 0) + { + DebugDraw3D.DrawLine(dLines_6.GlobalPosition, dLines_Target.GlobalPosition, Colors.Fuchsia, 2.0f); + timer_3 = 2; + } + + // Test UP vector + DebugDraw3D.DrawLine(dLines_7.GlobalPosition, dLines_Target.GlobalPosition, Colors.Red); + + // Lines with Arrow + DebugDraw3D.DrawArrow(dLines_2.GlobalPosition, dLines_Target.GlobalPosition, Colors.Blue, 0.5f, true); + DebugDraw3D.DrawArrowRay(dLines_4.GlobalPosition, (dLines_Target.GlobalPosition - dLines_4.GlobalPosition).Normalized(), 8.0f, Colors.Lavender, 0.5f, true); + + DebugDraw3D.DrawLineHitOffset(dLines_5.GlobalPosition, dLines_Target.GlobalPosition, true, Mathf.Abs(Mathf.Sin(Time.GetTicksMsec() / 1000.0f)), 0.25f, Colors.Aqua); + + // Paths + _draw_zone_title(pPathsBox, "Paths"); + + _draw_paths(Vector3.Zero); + _draw_paths(new Vector3(-2, 0, -1), 0); + _draw_paths(new Vector3(2, 0, -1), 1); + + // Misc + _draw_zone_title(pMiscBox, "Misc"); + + if (Engine.IsEditorHint()) + { + using var s = DebugDraw3D.NewScopedConfig().SetThickness(0); + DebugDraw3D.DrawCameraFrustum(dCamera, Colors.DarkOrange); + } + + using (var s = DebugDraw3D.NewScopedConfig().SetCenterBrightness(0.1f)) + { + DebugDraw3D.DrawArrowhead(dMisc_Arrow.GlobalTransform, Colors.YellowGreen); + } + + DebugDraw3D.DrawSquare(dMisc_Billboard.GlobalPosition, 0.5f, Colors.Green); + + DebugDraw3D.DrawPosition(dMisc_Position.GlobalTransform, Colors.Brown); + + DebugDraw3D.DrawGizmo(dMisc_GizmoTransform.GlobalTransform, null, true); + DebugDraw3D.DrawGizmo(dMisc_GizmoOneColor.GlobalTransform, Colors.Brown, true); + using (var s = DebugDraw3D.NewScopedConfig().SetCenterBrightness(0.5f).SetNoDepthTest(true)) + { + DebugDraw3D.DrawGizmo(dMisc_GizmoNormal.GlobalTransform.Orthonormalized(), null, false); + } + + // Grids + _draw_zone_title_pos(dGrids_GridCentered.GlobalPosition + new Vector3(0, 1.5f, 0), "Grids", 96, 36); + + Transform3D tg = dGrids_Grid.GlobalTransform; + Vector3 tn = dGrids_Grid_Subdivision.Transform.Origin; + DebugDraw3D.DrawGrid(tg.Origin, tg.Basis.X, tg.Basis.Z, new Vector2I((int)tn.X * 10, (int)tn.Z * 10), Colors.LightCoral, false); + + var tn1 = dGrids_GridCentered_Subdivision.Transform.Origin; + DebugDraw3D.DrawGridXf(dGrids_GridCentered.GlobalTransform, new Vector2I((int)(tn1.X * 10), (int)(tn1.Z * 10))); + + using (var s = DebugDraw3D.NewScopedConfig().SetThickness(0.05f)) + { + DebugDraw3D.DrawBoxXf(dPostProcess.GlobalTransform, Colors.SeaGreen); + } + + // Local transform + _draw_local_xf_box(pLocalTransformRecursiveOrigin.GlobalTransform, 0.05f, 10); + + // 2D + DebugDraw2D.Config.TextDefaultSize = text_groups_default_font_size; + DebugDraw2D.Config.TextBlockOffset = text_groups_offset; + DebugDraw2D.Config.TextBlockPosition = text_groups_position; + DebugDraw2D.Config.TextPadding = text_groups_padding; + + DebugDraw2D.Config.TextCustomFont = custom_font; + + + if (test_text) + { + _text_tests(); + } + + // Lag Test + var lag_test_pos = ToGlobal((Vector3)dLagTest_RESET.GetAnimation("RESET").TrackGetKeyValue(0, 0)); + _draw_zone_title_pos(lag_test_pos, "Lag test"); + + dLagTest.Position = lag_test_pos + new Vector3(Mathf.Sin(Time.GetTicksMsec() / 100.0f) * 2.5f, 0, 0); + DebugDraw3D.DrawBox(dLagTest.GlobalPosition, Quaternion.Identity, Vector3.One * 2.01f, Colors.Chocolate, true); + + if (more_test_cases) + { + foreach (var node in dHitTest_RayEmitter.GetChildren()) + { + if (node is RayCast3D ray) + ray.SetPhysicsProcessInternal(true); + } + + _more_tests(); + } + else + { + foreach (var node in dHitTest_RayEmitter.GetChildren()) + { + if (node is RayCast3D ray) + ray.SetPhysicsProcessInternal(false); + } + } + + _draw_other_world(); + + if (draw_array_of_boxes) + { + _draw_array_of_boxes(); + } + + } + + void _text_tests() + { + DebugDraw2D.SetText("FPS", $"{Engine.GetFramesPerSecond():F2}", 0, Colors.Gold); + + if (text_groups_show_examples) + { + if (timer_text < 0) + { + DebugDraw2D.SetText("Some delayed text", "for 2.5s", -1, Colors.Black, 2.5f); // it's supposed to show text for 2.5 seconds + timer_text += 5; + } + + DebugDraw2D.BeginTextGroup("-- First Group --", 2, Colors.LimeGreen, true, text_groups_title_font_size, text_groups_text_font_size); + DebugDraw2D.SetText("Simple text"); + DebugDraw2D.SetText("Text", "Value", 0, Colors.Aquamarine); + DebugDraw2D.SetText("Text out of order", null, -1, Colors.Silver); + DebugDraw2D.BeginTextGroup("-- Second Group --", 1, Colors.Beige); + DebugDraw2D.SetText("Rendered frames", Engine.GetFramesDrawn().ToString()); + DebugDraw2D.EndTextGroup(); + } + + if (text_groups_show_stats) + { + DebugDraw2D.BeginTextGroup("-- Stats --", 3, Colors.Wheat); + var render_stats = DebugDraw3D.GetRenderStats(); + + if (render_stats != null && text_groups_show_stats) + { + DebugDraw2D.SetText("Total", render_stats.TotalGeometry.ToString()); + DebugDraw2D.SetText("Instances", render_stats.Instances.ToString(), 1); + DebugDraw2D.SetText("Lines", render_stats.Lines.ToString(), 2); + DebugDraw2D.SetText("Total Visible", render_stats.TotalVisible.ToString(), 3); + DebugDraw2D.SetText("Visible Instances", render_stats.VisibleInstances.ToString(), 4); + DebugDraw2D.SetText("Visible Lines", render_stats.VisibleLines.ToString(), 5); + + DebugDraw2D.SetText("---", "", 12); + + DebugDraw2D.SetText("Culling time", $"{(render_stats.TotalTimeCullingUsec / 1000.0):F2} ms", 13); + DebugDraw2D.SetText("Filling instances buffer", $"{(render_stats.TimeFillingBuffersInstancesUsec / 1000.0):F2} ms", 14); + DebugDraw2D.SetText("Filling lines buffer", $"{(render_stats.TimeFillingBuffersLinesUsec / 1000.0):F2} ms", 15); + DebugDraw2D.SetText("Filling time", $"{(render_stats.TotalTimeFillingBuffersUsec / 1000.0):F2} ms", 16); + DebugDraw2D.SetText("Total time", $"{(render_stats.TotalTimeSpentUsec / 1000.0):F2} ms", 17); + + DebugDraw2D.SetText("----", null, 32); + + DebugDraw2D.SetText("Total Label3D", render_stats.NodesLabel3dExistsTotal.ToString(), 33); + DebugDraw2D.SetText("Visible Label3D", (render_stats.NodesLabel3dVisible + render_stats.NodesLabel3dVisiblePhysics).ToString(), 34); + + DebugDraw2D.SetText("-----", null, 48); + + DebugDraw2D.SetText("Created scoped configs", $"{render_stats.CreatedScopedConfigs}", 49); + } + + if (text_groups_show_stats && text_groups_show_stats_2d) + { + DebugDraw2D.SetText("------", null, 64); + } + + var render_stats_2d = DebugDraw2D.GetRenderStats(); + if (render_stats_2d != null && text_groups_show_stats_2d) + { + DebugDraw2D.SetText("Text groups", render_stats_2d.OverlayTextGroups.ToString(), 96); + DebugDraw2D.SetText("Text lines", render_stats_2d.OverlayTextLines.ToString(), 97); + } + DebugDraw2D.EndTextGroup(); + } + + if (text_groups_show_hints) + { + DebugDraw2D.BeginTextGroup("controls", 1024, Colors.White, false); + if (!Engine.IsEditorHint()) + { + DebugDraw2D.SetText("WASD QE, LMB", "To move", 0); + } + DebugDraw2D.SetText("Alt: change render layers", DebugDraw3D.Config.GeometryRenderLayers.ToString(), 1); + if (!OS.HasFeature("web")) + { + DebugDraw2D.SetText("Ctrl: toggle anti-aliasing", GetViewport().Msaa3D == Viewport.Msaa.Msaa4X ? "MSAA 4x" : "Disabled", 2); + } + DebugDraw2D.SetText("Down: freeze render", DebugDraw3D.Config.Freeze3dRender.ToString(), 3); + if (Engine.IsEditorHint()) + { + DebugDraw2D.SetText("Up: use scene camera", DebugDraw3D.Config.ForceUseCameraFromScene.ToString(), 4); + } + DebugDraw2D.SetText("1,2,3: toggle debug", $"{DebugDraw3D.DebugEnabled}, {DebugDraw2D.DebugEnabled} 😐, {DebugDrawManager.DebugEnabled} 😏", 5); + DebugDraw2D.SetText("Left: frustum culling mode", frustum_culling_mode_names[(int)DebugDraw3D.Config.FrustumCullingMode], 6); + DebugDraw2D.SetText("Right: draw bounds for culling", DebugDraw3D.Config.VisibleInstanceBounds.ToString(), 7); + } + } + + readonly string[] frustum_culling_mode_names = ["Disabled", "Rough", "Precise"]; + + void _draw_zone_title(Node3D node, string title) + { + if (draw_3d_text) + { + using var _s1 = DebugDraw3D.NewScopedConfig().SetTextOutlineSize(72); + DebugDraw3D.DrawText(node.GlobalPosition + node.GlobalBasis.Y * 0.85f, title, 128); + } + } + + void _draw_zone_title_pos(Vector3 pos, string title, int font_size = 128, int outline = 72) + { + if (draw_3d_text) + { + using var _s1 = DebugDraw3D.NewScopedConfig().SetTextOutlineSize(outline); + DebugDraw3D.DrawText(pos, title, font_size); + } + } + + const float _local_mul = 0.45f; + static readonly Vector3 _local_mul_vec = new(_local_mul, _local_mul, _local_mul); + Vector3[] __local_lines_cross_recursive = [new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.5f, -0.5f, 0.5f), new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.5f, -0.5f, -0.5f)]; + Transform3D __local_box_recursive = Transform3D.Identity.RotatedLocal(Vector3.Up, Mathf.DegToRad(30)).Translated(new Vector3(-0.25f, -0.55f, 0.25f)).Scaled(_local_mul_vec); + Transform3D __local_sphere_recursive = Transform3D.Identity.Translated(new Vector3(0.5f, 0.55f, -0.5f)).Scaled(_local_mul_vec); + + void _draw_local_xf_box(Transform3D xf, float thickness, int max_depth, int depth = 0) + { + if (depth >= max_depth) + return; + + using var _s1 = DebugDraw3D.NewScopedConfig().SetThickness(thickness).SetTransform(xf); + + // a box with a small offset + DebugDraw3D.DrawBoxXf(new Transform3D(Basis.Identity, new Vector3(0, 0.001f, 0)), Colors.Brown); + // a box and a stand for the next depth + DebugDraw3D.DrawBoxXf(__local_box_recursive, Colors.Chartreuse); + // just a sphere and lines + DebugDraw3D.DrawSphereXf(__local_sphere_recursive, Colors.DarkOrange); + + _s1.SetThickness(0); + + DebugDraw3D.DrawLines(__local_lines_cross_recursive, Colors.Crimson); + + // A simple animation generator with descent into the depth of the scene +#if false + { + Animation anim = pRecursiveTransformTest.GetAnimation("recursive"); + // clear keys + if (depth == 0) + for (var i = 0; i < anim.TrackGetKeyCount(0); i++) + { + anim.TrackRemoveKey(0, 0); + anim.TrackRemoveKey(1, 0); + } + + var time = depth * 2; + var s_xf = xf * __local_sphere_recursive; + var next_s_xf = (xf * __local_box_recursive.Translated(__local_box_recursive.Basis.Y)) * __local_sphere_recursive; + var get_sphere_pos = (Transform3D l_xf) => l_xf.Origin + (l_xf).Basis.Y; + + anim.PositionTrackInsertKey(0, time, get_sphere_pos(s_xf)); + anim.RotationTrackInsertKey(1, time, new Transform3D(Basis.Identity, get_sphere_pos(s_xf)).LookingAt(get_sphere_pos(next_s_xf), xf.Basis.Y).Basis.GetRotationQuaternion()); + } +#endif + + _draw_local_xf_box(xf * __local_box_recursive.Translated(__local_box_recursive.Basis.Y), thickness * _local_mul, max_depth, depth + 1); + } + + + void _draw_other_world() + { + using var s = DebugDraw3D.NewScopedConfig().SetViewport(dOtherWorldBox.GetViewport()); + DebugDraw3D.DrawBoxXf(dOtherWorldBox.GlobalTransform.RotatedLocal(new Vector3(1, 1, -1).Normalized(), Mathf.Wrap(Time.GetTicksMsec() / 1000.0f, 0f, Mathf.Tau)), Colors.SandyBrown); + DebugDraw3D.DrawBoxXf(dOtherWorldBox.GlobalTransform.RotatedLocal(new Vector3(-1, 1, -1).Normalized(), Mathf.Wrap(Time.GetTicksMsec() / 1000.0f, 0f, Mathf.Tau) - Mathf.Pi / 4), Colors.SandyBrown); + + if (draw_3d_text) + { + var angle = Mathf.Wrap(Time.GetTicksMsec() / 1000.0f, 0, Mathf.Tau); + using (var _w2 = DebugDraw3D.NewScopedConfig().SetTextFont(custom_3d_font).SetTextFixedSize(true)) + { + DebugDraw3D.DrawText(dOtherWorldBox.GlobalPosition + new Vector3(Mathf.Cos(angle), -0.25f, Mathf.Sin(angle)), "Hello world!", 40, Colors.Crimson, 0); + } + + using (var _w3 = DebugDraw3D.NewScopedConfig().SetNoDepthTest(true).SetTextOutlineColor(Colors.IndianRed).SetTextOutlineSize(6)) + { + DebugDraw3D.DrawText(dOtherWorldBox.GlobalPosition + new Vector3(Mathf.Cos(angle), +0.25f, Mathf.Sin(-angle)), "World without depth", 20, Colors.Pink, 0); + } + } + } + + void _draw_rays_casts() + { + // Line hits render + _draw_zone_title_pos(pHitTestSphere.GlobalPosition, "Line hits", 96, 36); + + foreach (var node in dHitTest_RayEmitter.GetChildren()) + { + if (node is RayCast3D ray) + { + ray.ForceRaycastUpdate(); + DebugDraw3D.DrawLineHit(ray.GlobalPosition, ray.ToGlobal(ray.TargetPosition), ray.GetCollisionPoint(), ray.IsColliding(), 0.3f); + } + } + } + + void _more_tests() + { + // Delayed line render + using (var s = DebugDraw3D.NewScopedConfig().SetThickness(0.035f)) + { + DebugDraw3D.DrawLine(dLagTest.GlobalPosition + Vector3.Up, dLagTest.GlobalPosition + new Vector3(0, 3, Mathf.Sin(Time.GetTicksMsec() / 50.0f)), null, 0.35f); + + if (draw_3d_text) + { + DebugDraw3D.DrawText(dLagTest.GlobalPosition + new Vector3(0, 3, Mathf.Sin(Time.GetTicksMsec() / 50.0f)), $"{Mathf.Sin(Time.GetTicksMsec() / 50.0f):F1}", 16, null, 0.35f); + } + } + + // Draw plane + using (var _s11 = DebugDraw3D.NewScopedConfig().SetThickness(0.02f).SetPlaneSize(10)) + { + var pl_node = GetNode("PlaneOrigin"); + var xf = pl_node.GlobalTransform; + var normal = xf.Basis.Y.Normalized(); + var plane = new Plane(normal, xf.Origin.Dot(normal)); + + var vp = GetViewport(); + if (Engine.IsEditorHint() && (Viewport)Engine.GetSingleton("EditorInterface").Call("get_editor_viewport_3d", 0) != null) + { + vp = (Viewport)Engine.GetSingleton("EditorInterface").Call("get_editor_viewport_3d", 0); + } + + var cam = vp.GetCamera3D(); + if (cam != null) + { + var dir = vp.GetCamera3D().ProjectRayNormal(vp.GetMousePosition()); + Vector3? intersect = plane.IntersectsRay(cam.GlobalPosition, dir); + + DebugDraw3D.DrawPlane(plane, Colors.Coral * new Color(1, 1, 1, 0.4f), pl_node.GlobalPosition); + if (intersect.HasValue && intersect.Value.DistanceTo(pl_node.GlobalPosition) < _s11.GetPlaneSize() * 0.5f) + { + // Need to test different colors on both sides of the plane + var col = plane.IsPointOver(cam.GlobalPosition) ? Colors.Firebrick : Colors.Aquamarine; + DebugDraw3D.DrawSphere(intersect.Value, 0.3f, col); + } + } + } + } + + void _draw_paths(Vector3 offset, int max_points = -1) + { + /// preparing data + List points = []; + List points_below = []; + List points_below2 = []; + List points_below3 = []; + List points_below4 = []; + List lines_above = []; + + var down_vec = -GlobalTransform.Basis.Y; + for (int node_idx = 0; node_idx < (max_points < 0 ? dLinePath.GetChildCount() : Mathf.Min(dLinePath.GetChildCount(), max_points)); node_idx++) + { + var node = dLinePath.GetChild(node_idx); + if (node is Node3D c) + { + points.Add(c.GlobalPosition + offset); + points_below.Add(c.GlobalPosition + down_vec + offset); + points_below2.Add(c.GlobalPosition + down_vec * 2 + offset); + points_below3.Add(c.GlobalPosition + down_vec * 3 + offset); + points_below4.Add(c.GlobalPosition + down_vec * 4 + offset); + } + } + + for (int x = 0; x < points.Count - 1; x++) + { + lines_above.Add(points[x] - down_vec); + lines_above.Add(points[x + 1] - down_vec); + } + + /// drawing lines + DebugDraw3D.DrawLines(lines_above.ToArray()); + DebugDraw3D.DrawLinePath(points.ToArray(), Colors.Beige); + DebugDraw3D.DrawPoints(points_below.ToArray(), DebugDraw3D.PointType.TypeSquare, 0.2f, Colors.DarkGreen); + DebugDraw3D.DrawPointPath(points_below2.ToArray(), DebugDraw3D.PointType.TypeSquare, 0.25f, Colors.Blue, Colors.Tomato); + DebugDraw3D.DrawArrowPath(points_below3.ToArray(), Colors.Gold, 0.5f); + using (var _sl = DebugDraw3D.NewScopedConfig().SetThickness(0.05f)) + DebugDraw3D.DrawPointPath(points_below4.ToArray(), DebugDraw3D.PointType.TypeSphere, 0.25f, Colors.MediumSeaGreen, Colors.MediumVioletRed); + + } + void _draw_array_of_boxes() + { + // Lots of boxes to check performance.. + var x_size = 50; + var y_size = 50; + var z_size = 3; + var mul = 1.0f; + var cubes_max_time = 1.25f; + var show_text = draw_text_with_boxes; + using var cfg = DebugDraw3D.NewScopedConfig(); + + if (draw_1m_boxes) + { + x_size = 100; + y_size = 100; + z_size = 100; + mul = 4.0f; + cubes_max_time = 60f; + draw_text_with_boxes = false; + } + + var size = Vector3.One; + var half_size = size * 0.5f; + + if (timer_cubes <= 0) + { + var start_time = Time.GetTicksUsec(); + for (int x = 0; x < x_size; x++) + { + for (int y = 0; y < y_size; y++) + { + for (int z = 0; z < z_size; z++) + { + cfg.SetThickness(Random.Shared.NextSingle() * 0.1f); + var pos = new Vector3(x * mul, (-4 - z) * mul, y * mul) + GlobalPosition; + DebugDraw3D.DrawBox(pos, Quaternion.Identity, size, null, false, cubes_max_time); + + if (show_text && z == 0) + { + DebugDraw3D.DrawText(pos + half_size, pos.ToString(), 32, null, cubes_max_time); + } + } + } + } + GD.Print($"Draw Boxes C#: {((Time.GetTicksUsec() - start_time) / 1000.0):F3}ms"); + timer_cubes = cubes_max_time; + } + + if (timer_cubes > cubes_max_time) + { + DebugDraw3D.ClearAll(); + timer_cubes = 0; + } + } + + public override void _Notification(int what) + { + if (what == NotificationEditorPreSave || what == NotificationExitTree) + _thread_stop(); + } + + void _call_from_thread() + { + if (tests_use_threads && (test_thread == null || !test_thread[0].IsAlive)) + { + test_thread_closing = false; + test_thread = new Thread[4]; + for (int i = 0; i < test_thread.Length; i++) + { + test_thread[i] = new Thread(_thread_body); + test_thread[i].Start(); + } + } + else if (!tests_use_threads && (test_thread != null && test_thread[0].IsAlive)) + { + _thread_stop(); + } + } + + void _thread_stop() + { + if (test_thread != null && test_thread[0].IsAlive) + { + tests_use_threads = false; + test_thread_closing = true; + for (int i = 0; i < test_thread.Length; i++) + { + test_thread[i].Join(); + } + test_thread = null; + } + } + + void _thread_body() + { + GD.Print("C# Thread started!"); + while (!test_thread_closing) + { + DebugDraw3D.DrawBox(new Vector3(0, -1, 0), Quaternion.Identity, Vector3.One, Colors.Brown, true, 0.016f); + + var boxes = 10; + for (int y = 0; y < boxes; y++) + { + var offset = (float)Mathf.Sin(Mathf.Tau / boxes * y + Mathf.Wrap(Time.GetTicksMsec() / 100.0, 0, Mathf.Tau)); + var pos = new Vector3(offset, y, 0); + DebugDraw3D.DrawBox(pos, Quaternion.Identity, Vector3.One, Colors.GreenYellow, true, 0.016f); + DebugDraw3D.DrawText(pos, y.ToString(), 64, Colors.White, 0.016f); + + if (y == 0) + { + DebugDraw2D.SetText("thread. sin", offset.ToString()); + } + } + + { + var _mt_test_object_creation = new DebugDraw3DScopeConfig(); + } + OS.DelayMsec(16); + } + GD.Print("C# Thread finished!"); + } + + Node3D dHitTest; + CsgBox3D dLagTest; + PanelContainer dPanel; + Node3D dZones; + Node3D dSpherePosition; + Node3D dSphereTransform; + Node3D dSphereHDTransform; + Node3D dAABB; + Node3D dAABB_fixed; + Node3D dBox1; + Node3D dBox2; + Node3D dBox3; + Node3D dBoxAB; + Node3D dBoxABa; + Node3D dBoxABb; + Node3D dBoxABup; + Node3D dBoxABEdge; + Node3D dBoxABEdgea; + Node3D dBoxABEdgeb; + Node3D dBoxABEdgeup; + Node3D dLines_1; + Node3D dLines_2; + Node3D dLines_3; + Node3D dLines_4; + Node3D dLines_5; + Node3D dLines_6; + Node3D dLines_7; + Node3D dLines_8; + Node3D dLines_Target; + Node3D dLinePath; + Node3D dCylinder1; + Node3D dCylinder2; + Node3D dCylinder3a; + Node3D dCylinder3b; + Node3D dCapsule1; + Node3D dCapsule2a; + Node3D dCapsule2b; + + Node3D pSpheresBox; + Node3D pCylindersBox; + Node3D pCapsulesBox; + Node3D pBoxesBox; + Node3D pLinesBox; + Node3D pPathsBox; + Node3D pMiscBox; + + MeshInstance3D dPlaneOrigin; + MeshInstance3D pZDepthTestCube; + + MeshInstance3D dOtherWorld; + SubViewport dOtherWorldViewport; + Node3D dOtherWorldBox; + + Control dCustomCanvas; + Node3D dMisc_Arrow; + Camera3D dCamera; + Node3D dMisc_Billboard; + Node3D dMisc_Position; + Node3D dMisc_GizmoTransform; + Node3D dMisc_GizmoNormal; + Node3D dMisc_GizmoOneColor; + Node3D pLocalTransformRecursiveOrigin; + AnimationPlayer pRecursiveTransformTest; + + Node3D dGrids_Grid; + Node3D dGrids_Grid_Subdivision; + Node3D dGrids_GridCentered_Subdivision; + Node3D dGrids_GridCentered; + + MeshInstance3D dPostProcess; + AnimationPlayer dLagTest_RESET; + Node3D dHitTest_RayEmitter; + Node3D pHitTestSphere; + + void _get_nodes() + { + dHitTest = GetNode("HitTest"); + dLagTest = GetNode("LagTest"); + dPanel = GetNode("Panel"); + dZones = GetNode("Zones"); + dSpherePosition = GetNode("Spheres/SpherePosition"); + dSphereTransform = GetNode("Spheres/SphereTransform"); + dSphereHDTransform = GetNode("Spheres/SphereHDTransform"); + dAABB = GetNode("Boxes/AABB"); + dAABB_fixed = GetNode("Boxes/AABB_fixed"); + dBox1 = GetNode("Boxes/Box1"); + dBox2 = GetNode("Boxes/Box2"); + dBox3 = GetNode("Boxes/Box3"); + dBoxAB = GetNode("Boxes/BoxAB"); + dBoxABa = GetNode("Boxes/BoxAB/a"); + dBoxABb = GetNode("Boxes/BoxAB/b"); + dBoxABup = GetNode("Boxes/BoxAB/o/up"); + dBoxABEdge = GetNode("Boxes/BoxABEdge"); + dBoxABEdgea = GetNode("Boxes/BoxABEdge/a"); + dBoxABEdgeb = GetNode("Boxes/BoxABEdge/b"); + dBoxABEdgeup = GetNode("Boxes/BoxABEdge/o/up"); + dLines_1 = GetNode("Lines/1"); + dLines_2 = GetNode("Lines/2"); + dLines_3 = GetNode("Lines/3"); + dLines_4 = GetNode("Lines/4"); + dLines_5 = GetNode("Lines/5"); + dLines_6 = GetNode("Lines/6"); + dLines_7 = GetNode("Lines/7"); + dLines_8 = GetNode("Lines/8"); + dLines_Target = GetNode("Lines/Target"); + dLinePath = GetNode("LinePath"); + dCylinder1 = GetNode("Cylinders/Cylinder1"); + dCylinder2 = GetNode("Cylinders/Cylinder2"); + dCylinder3a = GetNode("Cylinders/Cylinder3/1"); + dCylinder3b = GetNode("Cylinders/Cylinder3/2"); + dCapsule1 = GetNode("Capsules/Capsule1"); + dCapsule2a = GetNode("Capsules/Capsule2/1"); + dCapsule2b = GetNode("Capsules/Capsule2/2"); + + pSpheresBox = GetNode("%SpheresBox"); + pCylindersBox = GetNode("%CylindersBox"); + pCapsulesBox = GetNode("%CapsulesBox"); + pBoxesBox = GetNode("%BoxesBox"); + pLinesBox = GetNode("%LinesBox"); + pPathsBox = GetNode("%PathsBox"); + pMiscBox = GetNode("%MiscBox"); + + dPlaneOrigin = GetNode("PlaneOrigin"); + pZDepthTestCube = GetNode("%ZDepthTestCube"); + + dOtherWorld = GetNode("OtherWorld"); + dOtherWorldViewport = GetNode("OtherWorld/SubViewport"); + dOtherWorldBox = GetNode("OtherWorld/SubViewport/SubViewportContainer/SubViewport/OtherWorldBox"); + + dCustomCanvas = GetNode("CustomCanvas"); + dMisc_Arrow = GetNode("Misc/Arrow"); + dCamera = GetNode("Camera"); + dMisc_Billboard = GetNode("Misc/Billboard"); + dMisc_Position = GetNode("Misc/Position"); + dMisc_GizmoTransform = GetNode("Misc/GizmoTransform"); + dMisc_GizmoNormal = GetNode("Misc/GizmoNormal"); + dMisc_GizmoOneColor = GetNode("Misc/GizmoOneColor"); + pLocalTransformRecursiveOrigin = GetNode("%LocalTransformRecursiveOrigin"); + pRecursiveTransformTest = GetNode("%RecursiveTransformTest"); + + dGrids_Grid = GetNode("Grids/Grid"); + dGrids_Grid_Subdivision = GetNode("Grids/Grid/Subdivision"); + dGrids_GridCentered_Subdivision = GetNode("Grids/GridCentered/Subdivision"); + dGrids_GridCentered = GetNode("Grids/GridCentered"); + + dPostProcess = GetNode("PostProcess"); + + dLagTest_RESET = GetNode("LagTest/RESET"); + dHitTest_RayEmitter = GetNode("HitTest/RayEmitter"); + pHitTestSphere = GetNode("%HitTestSphere"); + } +} diff --git a/examples_dd3d/DD3DDemoCS.cs.uid b/examples_dd3d/DD3DDemoCS.cs.uid new file mode 100644 index 0000000..8576e05 --- /dev/null +++ b/examples_dd3d/DD3DDemoCS.cs.uid @@ -0,0 +1 @@ +uid://dnf8ejsrnlvxb diff --git a/examples_dd3d/DD3DDemoCS.tscn b/examples_dd3d/DD3DDemoCS.tscn new file mode 100644 index 0000000..27377b5 --- /dev/null +++ b/examples_dd3d/DD3DDemoCS.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=3 format=3 uid="uid://sxtw8fme7g63"] + +[ext_resource type="PackedScene" uid="uid://c3sccy6x0ht5j" path="res://examples_dd3d/DD3DDemo.tscn" id="2"] +[ext_resource type="Script" uid="uid://dnf8ejsrnlvxb" path="res://examples_dd3d/DD3DDemoCS.cs" id="2_ipqea"] + +[node name="DD3DDemoCS" instance=ExtResource("2")] +script = ExtResource("2_ipqea") + +[node name="Settings" parent="." index="23"] +switch_to_scene = "res://examples_dd3d/DD3DDemo.tscn" + +[node name="Label" parent="Settings/HBox/VBoxContainer" index="1"] +text = "C# example" + +[node name="SwitchLang" parent="Settings/HBox/VBox/SettingsPanel/VBox" index="13"] +text = "Switch to GDScript" diff --git a/examples_dd3d/DD3DDemoSubViewport.tscn b/examples_dd3d/DD3DDemoSubViewport.tscn new file mode 100644 index 0000000..a9efd8f --- /dev/null +++ b/examples_dd3d/DD3DDemoSubViewport.tscn @@ -0,0 +1,116 @@ +[gd_scene load_steps=9 format=3 uid="uid://4pqund3nukl7"] + +[sub_resource type="GDScript" id="GDScript_y32ns"] +script/source = "@tool +extends Node3D + +@export var frustum_enabled = true: + set(val): + frustum_enabled = val + DebugDraw3D.config.frustum_culling_mode = DebugDraw3DConfig.FRUSTUM_PRECISE if val else DebugDraw3DConfig.FRUSTUM_DISABLED + +func _enter_tree() -> void: + DebugDraw3D.config.force_use_camera_from_scene = true + +func _exit_tree() -> void: + DebugDraw3D.config.force_use_camera_from_scene = false + +func _process(_delta: float) -> void: + var curve := $Path3D.curve as Curve3D + var points = curve.get_baked_points() + var ups = curve.get_baked_up_vectors() + var lines = PackedVector3Array() + lines.resize(points.size() * 2) + + for i in range(points.size()): + lines[i * 2] = points[i] + lines[i * 2 + 1] = points[i] + ups[i] + + DebugDraw3D.draw_lines(lines, Color.YELLOW) + + +func _on_check_box_toggled(toggled_on: bool) -> void: + self.frustum_enabled = toggled_on +" + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_wtcfe"] +sky_horizon_color = Color(0.66224277, 0.6717428, 0.6867428, 1) +ground_horizon_color = Color(0.66224277, 0.6717428, 0.6867428, 1) + +[sub_resource type="Sky" id="Sky_0e48y"] +sky_material = SubResource("ProceduralSkyMaterial_wtcfe") + +[sub_resource type="Environment" id="Environment_epypp"] +background_mode = 2 +sky = SubResource("Sky_0e48y") +tonemap_mode = 2 +glow_enabled = true + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_epypp"] +albedo_color = Color(0.3506754, 0.23276979, 0.12343951, 1) + +[sub_resource type="PlaneMesh" id="PlaneMesh_0hol4"] + +[sub_resource type="CapsuleMesh" id="CapsuleMesh_0e48y"] + +[sub_resource type="Curve3D" id="Curve3D_q6r6c"] +bake_interval = 0.11 +_data = { +"points": PackedVector3Array(0, 0, 0, 0, 0, 0, -5.531494, 0, -6.0880256, -5.817918, 0, -1.5365419, 5.817918, 0, 1.5365419, 2.5486827, 0, -8.88616, 0.8259964, 0, -2.056702, -0.8259964, 0, 2.056702, 8.37335, 0, -1.2475368, 4.7892456, 0, -0.3038473, -4.7892456, 0, 0.3038473, 0.88138366, 0, 2.1438887, -0.7307973, 0, -1.7408733, 0.7307973, 0, 1.7408733, -5.501097, 0, 8.557644, -2.1005936, 0, 0.22366333, 2.1005936, 0, -0.22366333, 0, 0, 11), +"tilts": PackedFloat32Array(0, 0.09319421, 0, 0, 0, 0) +} +point_count = 6 + +[node name="DD3D_SubViewportDemo" type="Node3D"] +script = SubResource("GDScript_y32ns") + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(-0.8660254, -0.43301278, 0.25, 0, 0.49999997, 0.86602545, -0.50000006, 0.75, -0.43301266, 0, 0, 0) +shadow_enabled = true + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_epypp") + +[node name="Floor" type="MeshInstance3D" parent="."] +transform = Transform3D(9.821215, 0, 0, 0, 1, 0, 0, 0, 11.795109, 0, 0, 0) +material_override = SubResource("StandardMaterial3D_epypp") +mesh = SubResource("PlaneMesh_0hol4") +metadata/_edit_lock_ = true + +[node name="Player" type="MeshInstance3D" parent="."] +transform = Transform3D(0.9217549, 0, -0.387773, 0, 1, 0, 0.387773, 0, 0.9217549, 0, 1.1781173, 0) +mesh = SubResource("CapsuleMesh_0e48y") +skeleton = NodePath("") + +[node name="Node3D" type="Node3D" parent="Player"] +transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 1.569, 2.551) + +[node name="Camera3D" type="Camera3D" parent="Player/Node3D"] +transform = Transform3D(1, 0, 0, 0, 0.9277516, 0.37319833, 0, -0.37319833, 0.9277516, 0, 0, 0) +current = true + +[node name="Path3D" type="Path3D" parent="."] +curve = SubResource("Curve3D_q6r6c") + +[node name="SubViewportContainer" type="SubViewportContainer" parent="."] +offset_right = 356.0 +offset_bottom = 335.0 +stretch = true + +[node name="MyViewport" type="SubViewport" parent="SubViewportContainer"] +handle_input_locally = false +size = Vector2i(356, 335) +render_target_update_mode = 4 + +[node name="Camera3D" type="Camera3D" parent="SubViewportContainer/MyViewport"] +transform = Transform3D(0.7890948, -0.46304747, 0.40362903, -1.3314483e-08, 0.65708584, 0.7538156, -0.6142715, -0.5948321, 0.51850295, 6.8549986, 9.895414, 9.748488) + +[node name="CheckBox" type="CheckBox" parent="."] +offset_left = 104.0 +offset_top = 305.0 +offset_right = 252.0 +offset_bottom = 336.0 +button_pressed = true +text = "frustum culling" + +[connection signal="toggled" from="CheckBox" to="." method="_on_check_box_toggled"] diff --git a/examples_dd3d/Minecraft - by BennyFonts1002 - from fontstruct.ttf b/examples_dd3d/Minecraft - by BennyFonts1002 - from fontstruct.ttf new file mode 100644 index 0000000..b3f4958 Binary files /dev/null and b/examples_dd3d/Minecraft - by BennyFonts1002 - from fontstruct.ttf differ diff --git a/examples_dd3d/Minecraft - by BennyFonts1002 - from fontstruct.ttf.import b/examples_dd3d/Minecraft - by BennyFonts1002 - from fontstruct.ttf.import new file mode 100644 index 0000000..956100a --- /dev/null +++ b/examples_dd3d/Minecraft - by BennyFonts1002 - from fontstruct.ttf.import @@ -0,0 +1,36 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://cqbkyhs6g8trq" +path="res://.godot/imported/Minecraft - by BennyFonts1002 - from fontstruct.ttf-d00da6aa22af37f0ca8eab1d542fffac.fontdata" + +[deps] + +source_file="res://examples_dd3d/Minecraft - by BennyFonts1002 - from fontstruct.ttf" +dest_files=["res://.godot/imported/Minecraft - by BennyFonts1002 - from fontstruct.ttf-d00da6aa22af37f0ca8eab1d542fffac.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +modulate_color_glyphs=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/examples_dd3d/Roboto-Bold.ttf b/examples_dd3d/Roboto-Bold.ttf new file mode 100644 index 0000000..d3f01ad Binary files /dev/null and b/examples_dd3d/Roboto-Bold.ttf differ diff --git a/examples_dd3d/Roboto-Bold.ttf.import b/examples_dd3d/Roboto-Bold.ttf.import new file mode 100644 index 0000000..f5260f6 --- /dev/null +++ b/examples_dd3d/Roboto-Bold.ttf.import @@ -0,0 +1,40 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://erdgllynwqkw" +path="res://.godot/imported/Roboto-Bold.ttf-3674de3d9ad3ee757cd4b4a89f1e126d.fontdata" + +[deps] + +source_file="res://examples_dd3d/Roboto-Bold.ttf" +dest_files=["res://.godot/imported/Roboto-Bold.ttf-3674de3d9ad3ee757cd4b4a89f1e126d.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +modulate_color_glyphs=false +hinting=1 +subpixel_positioning=1 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration" +}] +language_support={} +script_support={} +opentype_features={} diff --git a/examples_dd3d/VisualizerAudioBus.tres b/examples_dd3d/VisualizerAudioBus.tres new file mode 100644 index 0000000..4c7b662 --- /dev/null +++ b/examples_dd3d/VisualizerAudioBus.tres @@ -0,0 +1,17 @@ +[gd_resource type="AudioBusLayout" load_steps=2 format=3 uid="uid://7sy4h4ibftrk"] + +[sub_resource type="AudioEffectSpectrumAnalyzer" id="AudioEffectSpectrumAnalyzer_odciy"] +resource_name = "SpectrumAnalyzer" +fft_size = 3 + +[resource] +bus/0/mute = true +bus/0/volume_db = -20.0 +bus/1/name = &"MusicAnalyzer" +bus/1/solo = false +bus/1/mute = false +bus/1/bypass_fx = false +bus/1/volume_db = 0.0 +bus/1/send = &"Master" +bus/1/effect/0/effect = SubResource("AudioEffectSpectrumAnalyzer_odciy") +bus/1/effect/0/enabled = true diff --git a/examples_dd3d/addon_icon.gd b/examples_dd3d/addon_icon.gd new file mode 100644 index 0000000..758391d --- /dev/null +++ b/examples_dd3d/addon_icon.gd @@ -0,0 +1,11 @@ +@tool +extends Node3D + +func _process(_delta: float) -> void: + var _a = DebugDraw3D.new_scoped_config().set_thickness(0.015) + DebugDraw3D.draw_box_xf($box.global_transform, Color.GREEN) + DebugDraw3D.draw_gizmo($gizmo.global_transform) + DebugDraw3D.draw_grid_xf($gizmo/grid.global_transform, Vector2i(2,2), DebugDraw3D.empty_color, false) + DebugDraw3D.draw_sphere_xf($sphere.global_transform, Color.RED) + DebugDraw3D.draw_cylinder($cylinder.global_transform, Color.BLUE) + DebugDraw3D.draw_line_hit_offset($"line/1".global_transform.origin, $"line/2".global_transform.origin, true, 0.3, 0.1) diff --git a/examples_dd3d/addon_icon.gd.uid b/examples_dd3d/addon_icon.gd.uid new file mode 100644 index 0000000..c3fca43 --- /dev/null +++ b/examples_dd3d/addon_icon.gd.uid @@ -0,0 +1 @@ +uid://b2lj85riqyno0 diff --git a/examples_dd3d/addon_icon.tscn b/examples_dd3d/addon_icon.tscn new file mode 100644 index 0000000..0cd2227 --- /dev/null +++ b/examples_dd3d/addon_icon.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=3 format=3 uid="uid://1lhiwf8tgleh"] + +[ext_resource type="Script" uid="uid://b2lj85riqyno0" path="res://examples_dd3d/addon_icon.gd" id="1_bq18y"] + +[sub_resource type="Environment" id="1"] +background_mode = 1 + +[node name="icon" type="Node3D"] +script = ExtResource("1_bq18y") + +[node name="Camera" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 5.39732) +environment = SubResource("1") +current = true + +[node name="box" type="Node3D" parent="."] +transform = Transform3D(0.316305, 0.0204714, -0.293415, -0.239575, 0.267896, -0.239575, 0.170631, 0.338191, 0.207538, -0.410294, 0.312541, 0.243199) + +[node name="gizmo" type="Node3D" parent="."] +transform = Transform3D(0.707107, 0, -0.707107, -0.294265, 0.909294, -0.294265, 0.642968, 0.416154, 0.642968, 0, 0, 0) + +[node name="grid" type="Node3D" parent="gizmo"] +transform = Transform3D(1, -2.98023e-08, 1.19209e-07, 0, 1, 0, 1.19209e-07, -2.98023e-08, 1, -0.0263093, -0.0170284, -0.0263093) + +[node name="sphere" type="Node3D" parent="."] +transform = Transform3D(0.401341, 0.207831, -0.437109, -0.449118, 0.371584, -0.235691, 0.180418, 0.46267, 0.385639, 0.466197, 0.322665, 0.200436) + +[node name="cylinder" type="Node3D" parent="."] +transform = Transform3D(0.155034, 0.231693, -0.112783, -0.160003, 0.264761, -0.0839674, 0.0232275, 0.277352, 0.174372, -0.0566943, -0.290515, 0.905274) + +[node name="line" type="Node3D" parent="."] + +[node name="1" type="Node3D" parent="line"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.568458, -0.615948, 0.653444) + +[node name="2" type="Node3D" parent="line"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0051975, 0.373791, 0.0974927) diff --git a/examples_dd3d/demo_camera_movement.gd b/examples_dd3d/demo_camera_movement.gd new file mode 100644 index 0000000..51f758d --- /dev/null +++ b/examples_dd3d/demo_camera_movement.gd @@ -0,0 +1,60 @@ +extends Camera3D + +@export var mouse_sensitivity := 0.25 +@export var camera_speed := 10.0 +@export var camera_speed_fast := 30.0 + +var btn_clicked := false +const hPI := PI/2 +var rot_x := 0.0 +var rot_y := 0.0 + + +func _ready(): + reset_input_rotation() + + +func _unhandled_input(event) -> void: + if event is InputEventMouseButton: + btn_clicked = event.pressed + + +func reset_input_rotation(): + rot_x = rotation.y + rot_y = rotation.x + + +func _input(event) -> void: + if btn_clicked: + if event is InputEventMouseMotion: + if event.button_mask == MOUSE_BUTTON_LEFT: + rot_x += -deg_to_rad(event.relative.x * mouse_sensitivity) + rot_y += -deg_to_rad(event.relative.y * mouse_sensitivity) + rot_y = clamp(rot_y, -hPI, hPI) + + transform.basis = Basis() + rotate_object_local(Vector3.UP, rot_x) + rotate_object_local(Vector3.RIGHT, rot_y) + + +func get_axis(neg : Array[Key], pos : Array[Key]) -> float: + var pressed = func (arr: Array[Key]): + var p: float = 0 + for k in arr: + if Input.is_physical_key_pressed(k): + p = 1 + break + return p + + return pressed.call(pos) - pressed.call(neg) + + +func _process(delta) -> void: + var motion := Vector2(get_axis([KEY_S], [KEY_W]), get_axis([KEY_A], [KEY_D])) + var lift := get_axis([KEY_Q, KEY_CTRL], [KEY_E, KEY_SPACE]) + var speed := camera_speed_fast if Input.is_physical_key_pressed(KEY_SHIFT) else camera_speed + motion = motion.limit_length() + + var b := global_transform.basis + var v := (-b.z * motion.x) + (b.x * motion.y) + (b.y * lift) + global_position += v.limit_length() * speed * delta diff --git a/examples_dd3d/demo_camera_movement.gd.uid b/examples_dd3d/demo_camera_movement.gd.uid new file mode 100644 index 0000000..03651ca --- /dev/null +++ b/examples_dd3d/demo_camera_movement.gd.uid @@ -0,0 +1 @@ +uid://b5mdrjubj0lg5 diff --git a/examples_dd3d/demo_music_visualizer.gd b/examples_dd3d/demo_music_visualizer.gd new file mode 100644 index 0000000..73e9867 --- /dev/null +++ b/examples_dd3d/demo_music_visualizer.gd @@ -0,0 +1,175 @@ +@tool +extends VBoxContainer + +@export_range(1, 128) var bars_count := 32 +var transform: Transform3D: + get: + return %AudioVisualizer.global_transform +@export_exp_easing("inout") var motion_smoothing := 0.025 +@export_range(0, 0.5) var bar_thickness := 0.065 +@export_range(0, 10) var bars_separation := 0.325 +@export_exp_easing("inout") var color_offset_speed := 0.4 +@export var colors: Gradient = null + +var MusicAnalyzerBus := &"MusicAnalyzer" +var MasterBus := &"Master" +var MAX_HZ := 16000.0 +var MIN_HZ := 20.0 +var MIN_DB := 60.0 +var spectrum: AudioEffectSpectrumAnalyzerInstance = null + +var smoothed_energy: Array[float] = [] +var color_offset := 0.0 + +var _on_data_loaded_callback = null + + +func _ready(): + var bus = AudioServer.get_bus_index(MusicAnalyzerBus) + if bus == -1: + print("'MusicVisualizer' audio bus not found.\nSet 'VisualizerAudioBus.tres' as the default bus to use the audio visualizer.") + + spectrum = AudioServer.get_bus_effect_instance(bus, 0) + %MuteMaster.button_pressed = AudioServer.is_bus_mute(AudioServer.get_bus_index(MasterBus)) + %VolumeSlider.value = db_to_linear(AudioServer.get_bus_volume_db(AudioServer.get_bus_index(MasterBus))) + + if OS.has_feature('web'): + motion_smoothing = motion_smoothing * 1.5 + + _on_data_loaded_callback = JavaScriptBridge.create_callback(_on_data_loaded) + # Retrieve the 'gd_callbacks' object + var gdcallbacks: JavaScriptObject = JavaScriptBridge.get_interface("gd_callbacks") + # Assign the callbacks + gdcallbacks.dataLoaded = _on_data_loaded_callback + + +func _process(_delta): + if %MusicPlayer.playing: + draw_spectrum() + + +func _pressed(): + var open_file = func(filepath: String): + print("Opening '%s'" % filepath) + var file = FileAccess.open(filepath, FileAccess.READ) + var data = file.get_buffer(file.get_length()) + open_stream(filepath.get_extension(), data) + + if DisplayServer.has_feature(DisplayServer.FEATURE_NATIVE_DIALOG): + DisplayServer.file_dialog_show("Select audio file", "", "", true, DisplayServer.FILE_DIALOG_MODE_OPEN_FILE, ["*.mp3"], + func (status: bool, selected: PackedStringArray, _fileter: int): + if status and selected.size(): + open_file.call(selected[0]) + ) + elif OS.has_feature('web'): + JavaScriptBridge.eval("loadData()") + else: + var fd := FileDialog.new() + add_child(fd) + + fd.title = "Select audio file" + fd.access = FileDialog.ACCESS_FILESYSTEM + fd.file_mode = FileDialog.FILE_MODE_OPEN_FILE + fd.current_dir = OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS) + fd.add_filter("*.mp3") + fd.popup_centered_ratio(0.8) + + fd.file_selected.connect(func(path: String): + open_file.call(path) + ) + + fd.visibility_changed.connect(func(): + if not fd.visible: + fd.queue_free() + ) + + +func _on_data_loaded(data: Array) -> void: + # Make sure there is something + if (data.size() == 0): + return + + var file_name: String = data[0] + print("Opening '%s'" % file_name) + + var arr: PackedByteArray = JavaScriptBridge.eval("gd_callbacks.dataLoadedResult;") + open_stream(file_name.get_extension(), arr) + + +func open_stream(file_ext: String, data: PackedByteArray): + var stream: AudioStream = null + if file_ext == "mp3": + stream = AudioStreamMP3.new() + stream.data = data + + if not stream.data: + print("Failed to load MP3!") + return + + if not stream: + print("Failed to load music!") + return + + %MusicPlayer.stream = stream + %MusicPlayer.bus = MusicAnalyzerBus + %MusicPlayer.play() + + # Debugging frequencies + for ih in range(1, bars_count + 1): + var _hz: float = log_freq(ih / float(bars_count), MIN_HZ, MAX_HZ) + #print("%.0f hz %.2f" % [_hz, ih / float(bars_count)]) + + +func draw_spectrum(): + var _s1 = DebugDraw3D.scoped_config().set_thickness(bar_thickness).set_center_brightness(0.9) + var prev_hz = MIN_HZ + smoothed_energy.resize(bars_count) + + var xf := transform + var y := xf.basis.y + var h := y.length() + var x := xf.basis.x + var z := xf.basis.z + var origin := xf.origin - (x * bars_count + (x * bars_separation) * (bars_count - 1)) * 0.5 + var sum := 0.0 + + for ih in range(1, bars_count + 1): + var i := ih - 1 + var hz: float = log_freq(ih / float(bars_count), MIN_HZ, MAX_HZ) + var magnitude: float = spectrum.get_magnitude_for_frequency_range(prev_hz, hz, AudioEffectSpectrumAnalyzerInstance.MAGNITUDE_AVERAGE).length() + var energy: float = clampf((MIN_DB + linear_to_db(magnitude)) / MIN_DB, 0, 1) + var e: float = lerp(smoothed_energy[i], energy, clampf(get_process_delta_time() / motion_smoothing if motion_smoothing else 1.0, 0, 1)) + smoothed_energy[i] = e + var height: float = e * h + sum += e + + var s := x * bars_separation + + var a := origin + x * i + s * i + (z * 0.5) + var b := origin + x * (i + 1) + s * i + (z * -0.5) + xf.basis.y.normalized() * clampf(height, 0.001, h) + var c := Color.HOT_PINK + if colors: + c = colors.sample(wrapf(float(ih) / bars_count + color_offset, 0, 1)) + c.s = clamp(c.s - smoothed_energy[i] * 0.3, 0, 1.0) + + DebugDraw3D.draw_box_ab(a, b, y, c) + + prev_hz = hz + + color_offset = wrapf(color_offset + sum / smoothed_energy.size() * clampf(get_process_delta_time() / color_offset_speed if color_offset_speed else 1.0, 0, 1), 0, 1) + + +func log10(val: float) -> float: + return log(val) / 2.302585 + + +func log_freq(pos: float, min_hz: float, max_hz: float) -> float: + return pow(10, log10(min_hz) + (log10(max_hz) - log10(min_hz)) * pos) + + +func _on_volume_slider_value_changed(value): + AudioServer.set_bus_volume_db(AudioServer.get_bus_index(MasterBus), linear_to_db(value)) + + +func _on_mute_master_toggled(toggled_on): + AudioServer.set_bus_mute(AudioServer.get_bus_index(MasterBus), toggled_on) diff --git a/examples_dd3d/demo_music_visualizer.gd.uid b/examples_dd3d/demo_music_visualizer.gd.uid new file mode 100644 index 0000000..7463855 --- /dev/null +++ b/examples_dd3d/demo_music_visualizer.gd.uid @@ -0,0 +1 @@ +uid://bebbekatkxaoe diff --git a/examples_dd3d/demo_settings_panel.gd b/examples_dd3d/demo_settings_panel.gd new file mode 100644 index 0000000..4896b47 --- /dev/null +++ b/examples_dd3d/demo_settings_panel.gd @@ -0,0 +1,103 @@ +@tool +extends Control + +@export var switch_to_scene = "" +var is_ready := false + +func _ready(): + if Engine.is_editor_hint(): + return + + if ProjectSettings.has_setting("application/config/no_csharp_support"): + %SwitchLang.visible = false + + %SwitchLang.disabled = true + + %ThicknessSlider.value = get_parent().debug_thickness + %FrustumScaleSlider.value = get_parent().camera_frustum_scale + %UpdateInPhysics.text = "Update in physics (%d Ticks) *" % ProjectSettings.get_setting("physics/common/physics_ticks_per_second") + %UpdateInPhysics.button_pressed = get_parent().update_in_physics + + %ShowText.button_pressed = get_parent().test_text + %ShowExamples.button_pressed = get_parent().text_groups_show_examples + %ShowStats.button_pressed = get_parent().text_groups_show_stats + %ShowHints.button_pressed = get_parent().text_groups_show_hints + %Draw3DText.button_pressed = get_parent().draw_3d_text + + %DrawBoxes.button_pressed = get_parent().draw_array_of_boxes + %Draw1MBoxes.button_pressed = get_parent().draw_1m_boxes + %DrawBoxesAddText.button_pressed = get_parent().draw_text_with_boxes + + if get_tree(): + await get_tree().create_timer(0.2).timeout + + %SwitchLang.disabled = false + is_ready = true + + +func _on_Button_pressed() -> void: + get_tree().call_deferred("change_scene_to_file", switch_to_scene) + + +func _on_hide_show_panel_pressed(): + if %SettingsPanel.visible: + %SettingsPanel.hide() + %HideShowPanelButton.text = "Show panel" + else: + %SettingsPanel.show() + %HideShowPanelButton.text = "Hide panel" + + +func _on_thickness_slider_value_changed(value): + if not is_ready: return + + get_parent().debug_thickness = value + + +func _on_frustum_scale_slider_value_changed(value): + if not is_ready: return + + get_parent().camera_frustum_scale = value + + +func _on_update_in_physics_toggled(toggled_on): + get_parent().update_in_physics = toggled_on + + +func _on_show_text_toggled(toggled_on: bool) -> void: + get_parent().test_text = toggled_on + + +func _on_show_examples_toggled(toggled_on: bool) -> void: + get_parent().text_groups_show_examples = toggled_on + + +func _on_show_stats_toggled(toggled_on): + get_parent().text_groups_show_stats = toggled_on + + +func _on_show_hints_toggled(toggled_on: bool) -> void: + get_parent().text_groups_show_hints = toggled_on + + +func _on_draw_3d_text_toggled(toggled_on: bool) -> void: + get_parent().draw_3d_text = toggled_on + + +func _on_draw_boxes_toggled(toggled_on): + get_parent().draw_array_of_boxes = toggled_on + + DebugDraw3D.clear_all() + get_parent().timer_cubes = 0 + + +func _on_draw_1m_boxes_toggled(toggled_on): + get_parent().draw_1m_boxes = toggled_on + + if get_parent().draw_array_of_boxes: + DebugDraw3D.clear_all() + get_parent().timer_cubes = 0 + + +func _on_add_text_to_boxes_toggled(toggled_on: bool) -> void: + get_parent().draw_text_with_boxes = toggled_on diff --git a/examples_dd3d/demo_settings_panel.gd.uid b/examples_dd3d/demo_settings_panel.gd.uid new file mode 100644 index 0000000..3b41e62 --- /dev/null +++ b/examples_dd3d/demo_settings_panel.gd.uid @@ -0,0 +1 @@ +uid://83dhsep7l725 diff --git a/examples_dd3d/demo_web_docs_version_select.gd b/examples_dd3d/demo_web_docs_version_select.gd new file mode 100644 index 0000000..c63bc49 --- /dev/null +++ b/examples_dd3d/demo_web_docs_version_select.gd @@ -0,0 +1,42 @@ +extends HBoxContainer + +var _on_versions_loaded_callback = null +@onready var btn: OptionButton = $OptionButton + +func _enter_tree(): + hide() + + +func _ready(): + if OS.has_feature('web'): + _on_versions_loaded_callback = JavaScriptBridge.create_callback(_on_versions_loaded) + var versions_callbacks: JavaScriptObject = JavaScriptBridge.get_interface("versions_callbacks") + versions_callbacks.loaded = _on_versions_loaded_callback + + JavaScriptBridge.eval("loadVersions()") + + +func _on_versions_loaded(args: Array) -> void: + if (args.size() == 0): + return + + var current_version: String = args[0] + + var versions_str: String = JavaScriptBridge.eval("versions_callbacks.versions;") + var version_urls_str: String = JavaScriptBridge.eval("versions_callbacks.version_urls;") + var versions: PackedStringArray = versions_str.split(";", false) + var version_urls: PackedStringArray = version_urls_str.split(";", false) + + if versions: + show() + btn.clear() + btn.item_selected.connect(func(idx): + # move to another version + JavaScriptBridge.eval("window.location.href = \"%s\"" % version_urls[idx]) + ) + + for i in range(versions.size()): + btn.add_item(versions[i], i) + + if versions[i] == current_version: + btn.select(i) diff --git a/examples_dd3d/demo_web_docs_version_select.gd.uid b/examples_dd3d/demo_web_docs_version_select.gd.uid new file mode 100644 index 0000000..a058966 --- /dev/null +++ b/examples_dd3d/demo_web_docs_version_select.gd.uid @@ -0,0 +1 @@ +uid://hvx3t70syvkm diff --git a/project.godot b/project.godot index 3527648..1063075 100644 --- a/project.godot +++ b/project.godot @@ -23,6 +23,10 @@ Global="*uid://4hvgybxt05qj" LimboConsole="*uid://dyxornv8vwibg" input_icon="*uid://bljuok1y1nutj" +[debug_draw_3d] + +settings/addon_root_folder="res://addons/debug_draw_3d" + [display] window/size/sharp_corners=true @@ -162,6 +166,7 @@ hotbar_item_4={ 3d/default_cell_size=0.05 3d/default_cell_height=0.05 +3d/default_edge_connection_margin=0.5 [physics] diff --git a/scenes/game.tscn b/scenes/game.tscn index a00a157..3e186e6 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -9,19 +9,22 @@ [ext_resource type="Texture2D" uid="uid://b6krbvbco0jt6" path="res://textures/shadow.png" id="4_lbhrr"] [ext_resource type="PackedScene" uid="uid://cnii80nh1mxr2" path="res://scenes/living/dreamer_body.tscn" id="4_p57ef"] [ext_resource type="PackedScene" uid="uid://b0kty7juk7rfo" path="res://models/stalagmite.gltf" id="5_iywne"] -[ext_resource type="PackedScene" uid="uid://co5p7h3exggvh" path="res://scenes/living/slime.tscn" id="6_u5sy4"] [ext_resource type="PackedScene" uid="uid://b6otq05jy7m6d" path="res://scenes/prefabs/brightshroom.tscn" id="9_vtaks"] [ext_resource type="PackedScene" uid="uid://boelsm35tk0k6" path="res://scenes/prefabs/brightshroom_orange.tscn" id="10_kvpfn"] -[ext_resource type="PackedScene" uid="uid://cwpnnh7v4b5q2" path="res://scenes/dreamer.tscn" id="13_ca42v"] [ext_resource type="Texture2D" uid="uid://b8sc3vq5pmwil" path="res://textures/slime.png" id="14_trtic"] [ext_resource type="Script" uid="uid://btuscff4168hb" path="res://scripts/hide_node.gd" id="16_ca42v"] -[sub_resource type="NavigationMesh" id="NavigationMesh_kvuet"] -vertices = PackedVector3Array(-4.1668324, 6.5576696, -10.84375, -4.1668324, 6.5576696, -10.49375, 10.833168, 6.5576696, -10.49375, 10.833168, 6.5576696, -10.84375, -7.5168324, 0.55766946, -7.69375, -6.516833, 0.55766946, -7.69375, -6.516833, 0.55766946, -8.09375, -6.0668325, 0.55766946, -8.54375, -5.1668324, 0.55766946, -8.54375, -5.1668324, 0.55766946, -9.54375, -6.266833, 0.55766946, -8.44375, -7.5168324, 0.55766946, -9.54375, -3.6668324, 7.4576697, -3.94375, -3.7168326, 7.4076695, -3.6437497, -3.6168327, 7.3576694, -3.5437498, -3.4168324, 7.4076695, -4.04375, -2.7668324, 6.9076695, -3.49375, 1.8331671, 6.9076695, -8.09375, 1.2831678, 7.4076695, -8.74375, 1.1781673, 7.1076694, -8.04875, 2.0331678, 6.9076695, -8.19375, 2.4331675, 6.9076695, -8.19375, 2.4331675, 7.3576694, -8.99375, -3.6168327, 7.3576694, -3.0437498, -2.8668327, 6.9076695, -2.9937496, 1.4331675, 7.4576697, -9.04375, -2.7168322, 6.8576694, -8.14375, -2.8168325, 6.9076695, -7.79375, -2.1168327, 6.5576696, -7.39375, -2.2668324, 6.5576696, -7.58125, -2.3501663, 6.5576696, -7.5270834, -4.1668324, 7.3576694, -8.99375, -4.1668324, 7.1076694, -8.54375, -3.1168327, 7.1076694, -8.54375, -1.4168329, 6.8576694, -8.09375, -2.916833, 7.0576696, -8.44375, -1.7668324, 6.6076694, -7.74375, -0.06683254, 7.3576694, -8.99375, 10.833168, 6.9076695, -8.19375, 10.833168, 7.3576694, -8.99375, 4.2331676, 0.55766946, -6.54375, 4.833167, 0.55766946, -6.74375, 4.833167, 0.9076695, -8.39375, 2.5331678, 0.9076695, -8.39375, 2.333167, 0.55766946, -7.4937496, 4.833167, 0.55766946, -7.84375, 2.3831673, 0.55766946, -7.71875, 4.1861773, 0.55766946, -7.7399597, 2.0331678, 0.55766946, -6.84375, 7.9831676, 0.55766946, -7.79375, 8.383167, 0.55766946, -7.79375, 8.383167, 0.9076695, -8.39375, 7.783167, 0.55766946, -7.69375, 4.9831676, 0.55766946, -6.74375, 5.333168, 0.55766946, -6.49375, 4.8831673, 0.55766946, -7.84375, 6.8831787, 0.55766946, -7.7477627, 7.533167, 0.55766946, -7.34375, 5.583168, 0.55766946, -5.79375, 7.533167, 0.55766946, -5.79375, 10.833168, 0.55766946, -7.79375, 10.833168, 0.9076695, -8.39375, -3.1168327, 7.0576696, -7.54375, -2.7668324, 6.8576694, -6.74375, -2.279333, 6.5576696, -7.23125, -3.6168327, 7.3576694, -7.54375, -3.6168327, 7.3576694, -5.44375, -7.5168324, 0.55766946, -3.99375, -6.516833, 0.55766946, -4.94375, -10.516832, 6.5576696, 0.30625057, -10.216833, 6.5576696, 0.65625, -10.116833, 6.5576696, 0.65625, -5.1668324, 6.5576696, -4.29375, -5.6168327, 6.5576696, -4.54375, -5.1668324, 6.5576696, -7.54375, -5.516833, 6.5576696, -7.54375, -5.516833, 6.5576696, -4.74375, 0.48316765, 2.0576694, -6.6437497, 0.48316765, 2.0576694, -6.74375, 0.13316727, 2.1576693, -6.94375, -0.16683292, 2.2576694, -6.99375, -0.96683216, 2.2576694, -6.19375, 0.03316784, 1.9576695, -5.74375, 3.9831676, 0.55766946, -6.34375, 3.8831673, 0.55766946, -6.09375, 1.8831673, 0.55766946, -6.49375, 1.6831675, 0.55766946, -6.34375, 0.03316784, 0.55766946, -4.6437497, -0.31683254, 0.55766946, -4.84375, -0.71683216, 0.55766946, -3.84375, 0.53316784, 0.55766946, -4.74375, 1.9331675, 0.55766946, -3.84375, 3.583167, 0.55766946, -3.8937497, 4.583167, 0.55766946, -3.84375, 4.583167, 0.55766946, -5.09375, 4.1331673, 0.55766946, -5.34375, 1.2831678, 0.55766946, -6.24375, 0.68316746, 0.55766946, -4.8937497, 2.3831673, 0.55766946, -3.3937497, 2.3831673, 0.55766946, -1.9437494, 3.1331673, 0.55766946, -1.9437494, 3.1331673, 0.55766946, -3.44375, 3.2331676, 0.55766946, -3.6437497, 2.1331673, 0.55766946, -3.74375, 4.4831676, 2.5576694, -6.09375, 4.533168, 2.5576694, -5.74375, 4.9331684, 2.6076694, -5.84375, 4.833167, 2.6076694, -6.19375, 5.4331684, 0.55766946, -3.84375, 5.333168, 0.55766946, -5.34375, 5.6331673, 0.55766946, -3.74375, 5.8831673, 0.55766946, -3.3937497, 7.533167, 0.55766946, -3.1437502, 5.8831673, 0.55766946, -3.1437502, -2.2168322, 1.9576695, -4.79375, -2.0668325, 2.0576694, -4.69375, -1.9168329, 2.0076694, -4.94375, -1.9668322, 1.9576695, -5.04375, -3.3168325, 1.9076693, -3.74375, -3.2668328, 1.9576695, -3.2937498, -3.0668325, 2.0576694, -3.3937497, -3.1668324, 2.0076694, -3.7937498, 5.833168, 0.55766946, -1.59375, 5.6331673, 0.55766946, -1.2937498, 5.783167, 0.55766946, -1.2937498, 6.1331673, 0.55766946, -1.0437498, 6.2331676, 0.55766946, -0.5437498, 7.533167, 0.55766946, -0.5437498, -3.6168327, 7.3576694, 7.5062504, -2.8668327, 6.9076695, 7.5062504, -3.3168325, 1.8076694, -1.84375, -2.7168322, 1.7076695, -1.9937496, -2.8668327, 1.7076695, -2.4437494, -3.1668324, 1.7576694, -2.59375, -3.3168325, 1.8076694, -2.7937498, -5.516833, 6.5576696, 0.40625, -5.516833, 6.5576696, 0.7062502, -5.1668324, 6.5576696, 0.65625, -5.766833, 6.6576695, 0.056250572, -5.1668324, 6.8576694, -0.9937496, -5.5268326, 6.7576694, -0.3637495, -5.1668324, 6.5576696, -0.44374943, -6.7168326, 7.4076695, -0.7437496, -6.266833, 6.8576694, 0.056250572, -6.1168327, 6.8576694, -0.04374981, -4.8168325, 7.4076695, -2.6437502, -6.020825, 6.9576693, -0.5421572, -5.717828, 6.9576693, -0.8443546, -1.6168327, 0.55766946, -1.0437498, -1.8168325, 0.55766946, -1.1437502, -1.7168322, 0.55766946, -0.7437496, -0.46683216, 0.55766946, 1.6062498, -0.76683235, 0.55766946, 1.8062506, -0.76683235, 0.55766946, 1.90625, -0.06683254, 0.55766946, 2.3562498, -1.0668325, 0.55766946, -1.0437498, -1.2668324, 0.55766946, -0.44374943, -0.86683273, 0.55766946, -0.7937498, 5.033167, 0.55766946, 0.10624981, 4.7331676, 0.55766946, -0.24374962, 3.583167, 0.55766946, -1.1437502, 1.9331675, 0.55766946, -1.1437502, -0.36683273, 0.55766946, 1.15625, 0.083167076, 0.55766946, 2.5562506, 4.7331676, 0.55766946, -0.84375, 3.2331676, 0.55766946, -1.3937502, 2.2831678, 0.55766946, -1.3937502, -0.41683292, 0.55766946, -0.6937494, 0.13316727, 0.55766946, -1.1437502, 4.9331684, 0.55766946, -1.1437502, -0.86683273, 2.5576694, -1.59375, -0.6668329, 2.5576694, -1.2937498, -0.51683235, 2.5576694, -1.2937498, -0.26683235, 2.6076694, -1.5437498, -0.51683235, 2.5576694, -1.84375, -9.166833, 7.4076695, 1.7062502, -8.516832, 6.8576694, 2.3062506, 5.283167, 2.5576694, -0.6937494, 5.283167, 2.5576694, -0.34375, 5.583168, 2.5576694, -0.34375, 5.583168, 2.6076694, -0.6937494, -0.9168329, 0.55766946, 4.5062504, -0.9168329, 0.55766946, 4.5562506, -0.61683273, 0.55766946, 4.35625, 0.083167076, 0.55766946, 3.1062498, 6.2331676, 0.55766946, -0.24374962, 0.18316746, 0.55766946, 2.7062502, 5.1831684, 0.55766946, 0.20625019, -0.016832352, 0.55766946, 4.2562504, 0.33316708, 0.55766946, 4.5062504, 5.9831676, 0.55766946, 0.10624981, 0.48316765, 0.55766946, 4.8062496, 0.13316727, 0.55766946, 5.7562504, -0.36683273, 0.55766946, 5.90625, -0.36683273, 0.55766946, 7.5062504, 5.783167, 0.55766946, 0.20625019, 0.5831671, 0.55766946, 5.106251, 0.48316765, 0.55766946, 5.5062504, 7.533167, 0.55766946, 7.5062504, -3.2668328, 1.9576695, -0.44374943, -3.2668328, 1.9576695, 0.10624981, -3.1168327, 2.0076694, 0.056250572, -8.766832, 0.95766944, 2.0562506, -8.266832, 0.55766946, 2.6062498, -7.916833, 0.55766946, 2.5562506, -8.341833, 0.6576695, 2.3062506, -8.091833, 0.45766944, 2.5812502, -7.5168324, 0.55766946, 2.9562502, -7.5168324, 0.55766946, 3.3562498, -6.516833, 0.55766946, 3.3562498, -7.6168327, 0.55766946, 2.7562504, -6.5668325, 0.95766944, -0.14375019, -6.550166, 0.55766946, 1.0229168, -7.819818, 0.55766946, 2.1544352, -5.516833, 6.5576696, 7.5062504, -5.1668324, 6.5576696, 7.5062504, -3.3168325, 1.8076694, 1.5562506, -3.3168325, 1.8076694, 2.7562504, -2.666833, 1.6576693, 2.5062504, -3.0168324, 1.7076695, 1.4562502, -0.46683216, 7.0576696, 3.0562506, -0.46683216, 7.0576696, 3.9562502, 0.48316765, 7.0576696, 3.9562502, 0.48316765, 7.0576696, 3.0562506, -7.5168324, 0.55766946, 7.5062504, -6.516833, 0.55766946, 7.5062504, -1.2168322, 0.55766946, 4.706251, -1.1168327, 0.55766946, 4.856251, -1.7168322, 0.55766946, 7.0562496, -1.9168329, 0.55766946, 7.2562504, -1.5168324, 0.55766946, 4.60625, -1.3168325, 0.55766946, 5.356251, -0.96683216, 0.55766946, 5.456251, -2.5168324, 0.6076694, 7.5062504, -0.71683216, 0.55766946, 5.8062496, -1.6168327, 0.55766946, 6.65625, -1.6168327, 0.55766946, 5.7562504, -1.9168329, 0.55766946, 5.856251, -3.2668328, 1.9576695, 4.5562506, -3.2668328, 1.9576695, 5.206251, -3.0668325, 2.0576694, 5.106251, -0.51683235, 2.5576694, 4.90625, -0.46683216, 2.5576694, 5.2562504, -0.06683254, 2.6076694, 5.15625, -0.16683292, 2.6076694, 4.8062496, -2.7168322, 1.7076695, 6.5062504, -2.8668327, 1.7076695, 6.0562496, -3.1668324, 1.7576694, 5.90625, -3.3168325, 1.8076694, 6.706251, -3.3168325, 1.8076694, 5.706251) -polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1), PackedInt32Array(6, 5, 4), PackedInt32Array(9, 8, 7), PackedInt32Array(10, 6, 4), PackedInt32Array(9, 7, 10), PackedInt32Array(4, 11, 10), PackedInt32Array(10, 11, 9), PackedInt32Array(13, 12, 14), PackedInt32Array(14, 12, 15), PackedInt32Array(18, 19, 15), PackedInt32Array(15, 19, 16), PackedInt32Array(16, 19, 17), PackedInt32Array(17, 19, 18), PackedInt32Array(22, 21, 20), PackedInt32Array(14, 15, 23), PackedInt32Array(23, 15, 16), PackedInt32Array(23, 16, 24), PackedInt32Array(17, 18, 20), PackedInt32Array(20, 18, 25), PackedInt32Array(20, 25, 22), PackedInt32Array(28, 30, 29), PackedInt32Array(29, 30, 27), PackedInt32Array(29, 27, 26), PackedInt32Array(33, 32, 31), PackedInt32Array(28, 29, 36), PackedInt32Array(36, 29, 34), PackedInt32Array(34, 29, 26), PackedInt32Array(34, 26, 35), PackedInt32Array(33, 31, 34), PackedInt32Array(34, 31, 37), PackedInt32Array(34, 35, 33), PackedInt32Array(22, 39, 21), PackedInt32Array(21, 39, 38), PackedInt32Array(46, 47, 44), PackedInt32Array(44, 47, 40), PackedInt32Array(40, 47, 41), PackedInt32Array(41, 47, 45), PackedInt32Array(45, 47, 42), PackedInt32Array(42, 47, 43), PackedInt32Array(43, 47, 46), PackedInt32Array(40, 48, 44), PackedInt32Array(51, 50, 49), PackedInt32Array(53, 55, 54), PackedInt32Array(54, 56, 52), PackedInt32Array(52, 51, 49), PackedInt32Array(51, 56, 42), PackedInt32Array(42, 56, 55), PackedInt32Array(55, 56, 54), PackedInt32Array(56, 51, 52), PackedInt32Array(42, 55, 45), PackedInt32Array(45, 55, 41), PackedInt32Array(41, 55, 53), PackedInt32Array(52, 57, 54), PackedInt32Array(58, 54, 59), PackedInt32Array(59, 54, 57), PackedInt32Array(51, 61, 50), PackedInt32Array(50, 61, 60), PackedInt32Array(28, 64, 30), PackedInt32Array(30, 64, 27), PackedInt32Array(27, 64, 62), PackedInt32Array(62, 64, 63), PackedInt32Array(62, 63, 65), PackedInt32Array(65, 63, 66), PackedInt32Array(5, 68, 4), PackedInt32Array(4, 68, 67), PackedInt32Array(70, 69, 71), PackedInt32Array(71, 69, 73), PackedInt32Array(71, 73, 72), PackedInt32Array(75, 74, 76), PackedInt32Array(76, 74, 72), PackedInt32Array(73, 76, 72), PackedInt32Array(78, 77, 79), PackedInt32Array(79, 77, 80), PackedInt32Array(80, 77, 82), PackedInt32Array(80, 82, 81), PackedInt32Array(48, 40, 83), PackedInt32Array(83, 84, 48), PackedInt32Array(48, 84, 85), PackedInt32Array(85, 84, 86), PackedInt32Array(89, 88, 87), PackedInt32Array(87, 90, 89), PackedInt32Array(89, 90, 91), PackedInt32Array(94, 93, 95), PackedInt32Array(95, 93, 92), PackedInt32Array(97, 96, 86), PackedInt32Array(99, 98, 100), PackedInt32Array(100, 98, 101), PackedInt32Array(95, 92, 84), PackedInt32Array(84, 92, 91), PackedInt32Array(84, 91, 86), PackedInt32Array(86, 91, 97), PackedInt32Array(101, 98, 102), PackedInt32Array(102, 98, 103), PackedInt32Array(91, 90, 97), PackedInt32Array(103, 91, 102), PackedInt32Array(102, 91, 92), PackedInt32Array(107, 106, 104), PackedInt32Array(104, 106, 105), PackedInt32Array(93, 94, 108), PackedInt32Array(108, 94, 109), PackedInt32Array(110, 109, 111), PackedInt32Array(111, 109, 58), PackedInt32Array(111, 58, 59), PackedInt32Array(111, 59, 112), PackedInt32Array(109, 110, 108), PackedInt32Array(112, 113, 111), PackedInt32Array(116, 115, 117), PackedInt32Array(117, 115, 114), PackedInt32Array(121, 120, 118), PackedInt32Array(118, 120, 119), PackedInt32Array(124, 123, 122), PackedInt32Array(125, 124, 122), PackedInt32Array(127, 126, 125), PackedInt32Array(125, 122, 127), PackedInt32Array(127, 122, 113), PackedInt32Array(127, 113, 112), PackedInt32Array(129, 128, 24), PackedInt32Array(24, 128, 23), PackedInt32Array(132, 131, 133), PackedInt32Array(133, 131, 130), PackedInt32Array(134, 133, 130), PackedInt32Array(135, 137, 136), PackedInt32Array(139, 141, 140), PackedInt32Array(140, 141, 138), PackedInt32Array(138, 141, 135), PackedInt32Array(135, 141, 137), PackedInt32Array(144, 143, 142), PackedInt32Array(139, 147, 145), PackedInt32Array(145, 147, 142), PackedInt32Array(142, 146, 144), PackedInt32Array(144, 146, 138), PackedInt32Array(138, 146, 140), PackedInt32Array(140, 147, 139), PackedInt32Array(147, 146, 142), PackedInt32Array(146, 147, 140), PackedInt32Array(150, 149, 148), PackedInt32Array(152, 151, 153), PackedInt32Array(153, 151, 154), PackedInt32Array(157, 156, 155), PackedInt32Array(155, 156, 148), PackedInt32Array(148, 156, 150), PackedInt32Array(159, 158, 160), PackedInt32Array(160, 158, 161), PackedInt32Array(161, 158, 162), PackedInt32Array(162, 158, 163), PackedInt32Array(160, 164, 159), PackedInt32Array(165, 160, 166), PackedInt32Array(166, 160, 161), PackedInt32Array(157, 167, 156), PackedInt32Array(156, 167, 162), PackedInt32Array(99, 100, 166), PackedInt32Array(166, 100, 165), PackedInt32Array(168, 161, 167), PackedInt32Array(167, 161, 162), PackedInt32Array(154, 151, 163), PackedInt32Array(163, 151, 162), PackedInt32Array(160, 169, 164), PackedInt32Array(171, 170, 172), PackedInt32Array(172, 170, 173), PackedInt32Array(173, 170, 174), PackedInt32Array(176, 175, 143), PackedInt32Array(143, 175, 142), PackedInt32Array(180, 179, 177), PackedInt32Array(177, 179, 178), PackedInt32Array(182, 181, 183), PackedInt32Array(183, 181, 184), PackedInt32Array(185, 126, 127), PackedInt32Array(163, 158, 186), PackedInt32Array(186, 158, 187), PackedInt32Array(188, 183, 184), PackedInt32Array(189, 188, 184), PackedInt32Array(190, 185, 127), PackedInt32Array(191, 189, 184), PackedInt32Array(194, 193, 192), PackedInt32Array(190, 127, 195), PackedInt32Array(195, 127, 198), PackedInt32Array(195, 198, 196), PackedInt32Array(196, 198, 197), PackedInt32Array(191, 184, 196), PackedInt32Array(196, 184, 186), PackedInt32Array(196, 186, 187), PackedInt32Array(196, 187, 195), PackedInt32Array(192, 197, 194), PackedInt32Array(194, 197, 198), PackedInt32Array(201, 200, 199), PackedInt32Array(204, 206, 205), PackedInt32Array(205, 206, 203), PackedInt32Array(205, 203, 202), PackedInt32Array(209, 208, 207), PackedInt32Array(209, 207, 210), PackedInt32Array(209, 210, 204), PackedInt32Array(205, 213, 204), PackedInt32Array(204, 213, 209), PackedInt32Array(209, 213, 212), PackedInt32Array(212, 202, 211), PackedInt32Array(202, 213, 205), PackedInt32Array(213, 202, 212), PackedInt32Array(214, 136, 215), PackedInt32Array(215, 136, 137), PackedInt32Array(219, 218, 216), PackedInt32Array(216, 218, 217), PackedInt32Array(223, 222, 220), PackedInt32Array(220, 222, 221), PackedInt32Array(225, 224, 209), PackedInt32Array(209, 224, 208), PackedInt32Array(181, 182, 226), PackedInt32Array(226, 182, 227), PackedInt32Array(229, 228, 194), PackedInt32Array(226, 227, 230), PackedInt32Array(230, 227, 231), PackedInt32Array(231, 227, 232), PackedInt32Array(233, 229, 194), PackedInt32Array(234, 193, 235), PackedInt32Array(235, 193, 228), PackedInt32Array(228, 193, 194), PackedInt32Array(232, 234, 231), PackedInt32Array(231, 234, 236), PackedInt32Array(236, 234, 235), PackedInt32Array(235, 237, 236), PackedInt32Array(240, 239, 238), PackedInt32Array(244, 243, 241), PackedInt32Array(241, 243, 242), PackedInt32Array(246, 245, 247), PackedInt32Array(247, 245, 248), PackedInt32Array(248, 249, 247)] -geometry_source_geometry_mode = 1 -cell_size = 0.05 -cell_height = 0.05 +[sub_resource type="Environment" id="Environment_uwrxv"] +background_mode = 1 +background_color = Color(0.38, 0.152, 0.37240002, 1) +tonemap_mode = 2 +volumetric_fog_enabled = true +adjustment_enabled = true +adjustment_brightness = 1.25 +adjustment_contrast = 1.1 + +[sub_resource type="BoxShape3D" id="BoxShape3D_kvuet"] +size = Vector3(16, 16, 8) [sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_yqjtg"] auto_exposure_scale = 0.3 @@ -36,31 +39,41 @@ size = Vector3(1.2, 1, 1.3) radius = 0.15 height = 1.0 -[sub_resource type="Environment" id="Environment_uwrxv"] -background_mode = 1 -background_color = Color(0.38, 0.152, 0.37240002, 1) -tonemap_mode = 2 -volumetric_fog_enabled = true -adjustment_enabled = true -adjustment_brightness = 1.25 -adjustment_contrast = 1.1 - -[sub_resource type="BoxShape3D" id="BoxShape3D_kvuet"] -size = Vector3(16, 16, 8) +[sub_resource type="NavigationMesh" id="NavigationMesh_kvuet"] +geometry_source_geometry_mode = 1 +cell_size = 0.05 +cell_height = 0.05 [node name="Game" type="Node3D" unique_id=1358608749] script = ExtResource("1_gee14") -[node name="Navmesh" type="NavigationRegion3D" parent="." unique_id=1857418222] +[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1956400862] +environment = SubResource("Environment_uwrxv") + +[node name="CameraZone2" type="Area3D" parent="WorldEnvironment" unique_id=1501599928] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4) visible = false -navigation_mesh = SubResource("NavigationMesh_kvuet") +monitoring = false +monitorable = false + +[node name="CollisionShape3D" type="CollisionShape3D" parent="WorldEnvironment/CameraZone2" unique_id=693968382] +shape = SubResource("BoxShape3D_kvuet") + +[node name="Offset" type="Node3D" parent="WorldEnvironment/CameraZone2" unique_id=1432752210] + +[node name="Camera" type="Sprite3D" parent="WorldEnvironment/CameraZone2/Offset" unique_id=1992696506] +transform = Transform3D(-4.3711385e-08, -0.7071067, 0.70710677, 0, 0.7071067, 0.70710677, -0.99999994, 3.0908616e-08, -3.090862e-08, 4, 4, 0) +pixel_size = 0.05 +double_sided = false +texture = ExtResource("14_trtic") +script = ExtResource("16_ca42v") [node name="Map" type="Node3D" parent="." unique_id=19914124 groups=["navigation_mesh_source_group"]] [node name="CSG" type="Node3D" parent="Map" unique_id=1150408155] [node name="CSGBox3D2" type="CSGBox3D" parent="Map/CSG" unique_id=1285894233] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5) layers = 1023 use_collision = true collision_layer = 255 @@ -69,7 +82,7 @@ size = Vector3(16, 1, 18) material = ExtResource("2_gee14") [node name="CSGBox3D3" type="CSGBox3D" parent="Map/CSG" unique_id=646817034] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 3, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 3, -4) layers = 1023 use_collision = true collision_layer = 255 @@ -78,7 +91,7 @@ size = Vector3(2, 7, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D10" type="CSGBox3D" parent="Map/CSG" unique_id=850781226] -transform = Transform3D(0.8660254, 0.5, 0, -0.5, 0.8660254, 0, 0, 0, 1, -4.125, 5.5155444, 0) +transform = Transform3D(0.8660254, 0.5, 0, -0.5, 0.8660254, 0, 0, 0, 1, -4.125, 5.5155444, -4) layers = 1023 use_collision = true collision_layer = 255 @@ -87,7 +100,7 @@ size = Vector3(2, 3.5, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D6" type="CSGBox3D" parent="Map/CSG" unique_id=647905404] -transform = Transform3D(0.85165083, -0.42261833, 0.30997553, 0.39713126, 0.90630776, 0.14454395, -0.34202015, 0, 0.93969274, -3.2622721, 0.7556524, 4.6872506) +transform = Transform3D(0.85165083, -0.42261833, 0.30997553, 0.39713126, 0.90630776, 0.14454395, -0.34202015, 0, 0.93969274, -3.2622721, 0.7556524, 0.6872506) layers = 1023 use_collision = true collision_layer = 255 @@ -96,7 +109,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D9" type="CSGBox3D" parent="Map/CSG" unique_id=805609263] -transform = Transform3D(0.85165083, -0.42261833, 0.30997553, 0.39713126, 0.90630776, 0.14454395, -0.34202015, 0, 0.93969274, -3.2622721, 0.7556524, -0.3127494) +transform = Transform3D(0.85165083, -0.42261833, 0.30997553, 0.39713126, 0.90630776, 0.14454395, -0.34202015, 0, 0.93969274, -3.2622721, 0.7556524, -4.3127494) layers = 1023 use_collision = true collision_layer = 255 @@ -105,7 +118,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D7" type="CSGBox3D" parent="Map/CSG" unique_id=2127978297] -transform = Transform3D(-0.90767354, 0.2588191, -0.330366, 0.24321029, 0.96592575, 0.088521294, 0.3420201, 3.7856495e-08, -0.9396926, -3.5780458, 0.7556524, 2.1872506) +transform = Transform3D(-0.90767354, 0.2588191, -0.330366, 0.24321029, 0.96592575, 0.088521294, 0.3420201, 3.7856495e-08, -0.9396926, -3.5780458, 0.7556524, -1.8127494) layers = 1023 use_collision = true collision_layer = 255 @@ -114,7 +127,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D8" type="CSGBox3D" parent="Map/CSG" unique_id=1149175002] -transform = Transform3D(-0.9254167, 0.17364825, -0.33682403, 0.16317584, 0.98480767, 0.05939115, 0.3420201, 3.7856495e-08, -0.9396926, -3.5780458, 0.7556524, 6.1872506) +transform = Transform3D(-0.9254167, 0.17364825, -0.33682403, 0.16317584, 0.98480767, 0.05939115, 0.3420201, 3.7856495e-08, -0.9396926, -3.5780458, 0.7556524, 2.1872506) layers = 1023 use_collision = true collision_layer = 255 @@ -123,7 +136,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D20" type="CSGBox3D" parent="Map/CSG" unique_id=69107394] -transform = Transform3D(0.84405285, -0.2988363, -0.4452773, 0.39713123, 0.9063077, 0.14454393, 0.36036327, -0.29883623, 0.8836488, -1.9678717, 0.7556524, -5.067629) +transform = Transform3D(0.84405285, -0.2988363, -0.4452773, 0.39713123, 0.9063077, 0.14454393, 0.36036327, -0.29883623, 0.8836488, -1.9678717, 0.7556524, -9.067629) layers = 1023 use_collision = true collision_layer = 255 @@ -132,7 +145,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D21" type="CSGBox3D" parent="Map/CSG" unique_id=444002869] -transform = Transform3D(0.84405285, -0.2988363, -0.4452773, 0.39713123, 0.9063077, 0.14454393, 0.36036327, -0.29883623, 0.8836488, 0.82828665, 0.7556524, -8.175981) +transform = Transform3D(0.84405285, -0.2988363, -0.4452773, 0.39713123, 0.9063077, 0.14454393, 0.36036327, -0.29883623, 0.8836488, 0.82828665, 0.7556524, -12.175981) layers = 1023 use_collision = true collision_layer = 255 @@ -141,7 +154,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D23" type="CSGBox3D" parent="Map/CSG" unique_id=1865382177] -transform = Transform3D(-0.8836668, 0.18301272, 0.43085897, 0.24321027, 0.96592575, 0.08852128, -0.3999774, 0.18301277, -0.898067, -0.41298687, 1.0922339, -6.6314993) +transform = Transform3D(-0.8836668, 0.18301272, 0.43085897, 0.24321027, 0.96592575, 0.08852128, -0.3999774, 0.18301277, -0.898067, -0.41298687, 1.0922339, -10.631499) layers = 1023 use_collision = true collision_layer = 255 @@ -150,7 +163,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D24" type="CSGBox3D" parent="Map/CSG" unique_id=1440841103] -transform = Transform3D(-0.8962132, 0.122787826, 0.42629248, 0.16317585, 0.9848078, 0.059391156, -0.41252372, 0.12278789, -0.9026336, -3.6531224, 0.7556524, -3.803072) +transform = Transform3D(-0.8962132, 0.122787826, 0.42629248, 0.16317585, 0.9848078, 0.059391156, -0.41252372, 0.12278789, -0.9026336, -3.6531224, 0.7556524, -7.803072) layers = 1023 use_collision = true collision_layer = 255 @@ -159,7 +172,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D19" type="CSGBox3D" parent="Map/CSG" unique_id=641922484] -transform = Transform3D(0.85165083, -0.42261833, 0.30997553, 0.39713126, 0.90630776, 0.14454395, -0.34202015, 0, 0.93969274, -3.2622721, 0.7556524, -3.8127494) +transform = Transform3D(0.85165083, -0.42261833, 0.30997553, 0.39713126, 0.90630776, 0.14454395, -0.34202015, 0, 0.93969274, -3.2622721, 0.7556524, -7.8127494) layers = 1023 use_collision = true collision_layer = 255 @@ -168,7 +181,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D22" type="CSGBox3D" parent="Map/CSG" unique_id=1793973621] -transform = Transform3D(-0.9254167, 0.17364825, -0.33682403, 0.16317584, 0.98480767, 0.05939115, 0.3420201, 3.7856495e-08, -0.9396926, -3.5780458, 0.7556524, -2.3127494) +transform = Transform3D(-0.9254167, 0.17364825, -0.33682403, 0.16317584, 0.98480767, 0.05939115, 0.3420201, 3.7856495e-08, -0.9396926, -3.5780458, 0.7556524, -6.3127494) layers = 1023 use_collision = true collision_layer = 255 @@ -177,7 +190,7 @@ size = Vector3(2, 2, 2) material = ExtResource("4_kvuet") [node name="CSGBox3D4" type="CSGBox3D" parent="Map/CSG" unique_id=1670932518] -transform = Transform3D(0.9396926, -0.34202012, 0, 0.34202012, 0.9396926, 0, 0, 0, 1, -4, 1, 0) +transform = Transform3D(0.9396926, -0.34202012, 0, 0.34202012, 0.9396926, 0, 0, 0, 1, -4, 1, -4) layers = 1023 use_collision = true collision_layer = 255 @@ -186,7 +199,7 @@ size = Vector3(1, 3, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D5" type="CSGBox3D" parent="Map/CSG" unique_id=1498895198] -transform = Transform3D(0.5000001, -0.86602545, 0, 0.86602545, 0.5000001, 0, 0, 0, 1, -3.5, 0.5, 0) +transform = Transform3D(0.5000001, -0.86602545, 0, 0.86602545, 0.5000001, 0, 0, 0, 1, -3.5, 0.5, -4) layers = 1023 use_collision = true collision_layer = 255 @@ -195,7 +208,7 @@ size = Vector3(1, 3, 16) material = ExtResource("4_kvuet") [node name="CSGBox3D15" type="CSGBox3D" parent="Map/CSG" unique_id=871989333] -transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 3.34375, 3, -10.34375) +transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 3.34375, 3, -14.34375) layers = 1023 use_collision = true collision_layer = 255 @@ -204,7 +217,7 @@ size = Vector3(2, 7, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D16" type="CSGBox3D" parent="Map/CSG" unique_id=461304580] -transform = Transform3D(-3.7855173e-08, -2.1855694e-08, -1, -0.5, 0.8660254, 0, 0.8660254, 0.5, -4.371139e-08, 3.34375, 5.5155444, -9.46875) +transform = Transform3D(-3.7855173e-08, -2.1855694e-08, -1, -0.5, 0.8660254, 0, 0.8660254, 0.5, -4.371139e-08, 3.34375, 5.5155444, -13.46875) layers = 1023 use_collision = true collision_layer = 255 @@ -213,7 +226,7 @@ size = Vector3(2, 3.5, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D17" type="CSGBox3D" parent="Map/CSG" unique_id=120955804] -transform = Transform3D(-4.107527e-08, 1.4950176e-08, -1.0000001, 0.34202015, 0.93969274, 0, 0.9396926, -0.34202012, -4.371139e-08, 3.34375, 1, -9.34375) +transform = Transform3D(-4.107527e-08, 1.4950176e-08, -1.0000001, 0.34202015, 0.93969274, 0, 0.9396926, -0.34202012, -4.371139e-08, 3.34375, 1, -13.34375) layers = 1023 use_collision = true collision_layer = 255 @@ -222,7 +235,7 @@ size = Vector3(1, 3, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D18" type="CSGBox3D" parent="Map/CSG" unique_id=1241532821] -transform = Transform3D(-2.18557e-08, 3.7855173e-08, -1, 0.86602545, 0.5000001, 0, 0.5000001, -0.86602545, -4.371139e-08, 3.34375, 0.5, -8.84375) +transform = Transform3D(-2.18557e-08, 3.7855173e-08, -1, 0.86602545, 0.5000001, 0, 0.5000001, -0.86602545, -4.371139e-08, 3.34375, 0.5, -12.84375) layers = 1023 use_collision = true collision_layer = 255 @@ -231,7 +244,7 @@ size = Vector3(1, 3, 16) material = ExtResource("4_kvuet") [node name="CSGBox3D11" type="CSGBox3D" parent="Map/CSG" unique_id=1776294785] -transform = Transform3D(0.70710677, 0, -0.70710677, 0, 1, 0, 0.70710677, 0, 0.70710677, -4.7528715, 3, -4.5966215) +transform = Transform3D(0.70710677, 0, -0.70710677, 0, 1, 0, 0.70710677, 0, 0.70710677, -4.7528715, 3, -8.5966215) layers = 1023 use_collision = true collision_layer = 255 @@ -240,7 +253,7 @@ size = Vector3(2, 7, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D12" type="CSGBox3D" parent="Map/CSG" unique_id=804263927] -transform = Transform3D(0.6123724, 0.35355338, -0.70710677, -0.5, 0.8660254, 0, 0.6123724, 0.35355338, 0.70710677, -4.134153, 5.5155444, -3.977903) +transform = Transform3D(0.6123724, 0.35355338, -0.70710677, -0.5, 0.8660254, 0, 0.6123724, 0.35355338, 0.70710677, -4.134153, 5.5155444, -7.977903) layers = 1023 use_collision = true collision_layer = 255 @@ -249,7 +262,7 @@ size = Vector3(2, 3.5, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D13" type="CSGBox3D" parent="Map/CSG" unique_id=1679011295] -transform = Transform3D(0.66446304, -0.24184476, -0.7071068, 0.34202015, 0.93969274, 0, 0.664463, -0.24184474, 0.70710677, -4.0457644, 1, -3.8895144) +transform = Transform3D(0.66446304, -0.24184476, -0.7071068, 0.34202015, 0.93969274, 0, 0.664463, -0.24184474, 0.70710677, -4.0457644, 1, -7.8895144) layers = 1023 use_collision = true collision_layer = 255 @@ -258,7 +271,7 @@ size = Vector3(1, 3, 16) material = ExtResource("3_dinhu") [node name="CSGBox3D14" type="CSGBox3D" parent="Map/CSG" unique_id=737262338] -transform = Transform3D(0.35355347, -0.61237246, -0.70710677, 0.86602545, 0.5000001, 0, 0.35355347, -0.61237246, 0.70710677, -3.6922112, 0.5, -3.5359612) +transform = Transform3D(0.35355347, -0.61237246, -0.70710677, 0.86602545, 0.5000001, 0, 0.35355347, -0.61237246, 0.70710677, -3.6922112, 0.5, -7.535961) layers = 1023 use_collision = true collision_layer = 255 @@ -269,37 +282,56 @@ material = ExtResource("4_kvuet") [node name="Props" type="Node3D" parent="Map" unique_id=2137952764] [node name="Stalagmite" parent="Map/Props" unique_id=39322424 instance=ExtResource("5_iywne")] -transform = Transform3D(1, 0, 0, 0, 0.8, 0, 0, 0, 1, 1, 0.48141205, -2.5) +transform = Transform3D(1, 0, 0, 0, 0.8, 0, 0, 0, 1, 1, 0.48141205, -6.5) [node name="Stalagmite5" parent="Map/Props" unique_id=1945315033 instance=ExtResource("5_iywne")] -transform = Transform3D(0.9998552, 0, -0.017016139, 0, 0.8, 0, 0.017016139, 0, 0.9998552, 4.488328, 0.48141205, -2.5) +transform = Transform3D(0.9998552, 0, -0.017016139, 0, 0.8, 0, 0.017016139, 0, 0.9998552, 4.488328, 0.48141205, -6.5) [node name="Stalagmite6" parent="Map/Props" unique_id=2097625970 instance=ExtResource("5_iywne")] -transform = Transform3D(1, 0, 0, 0, 0.8, 0, 0, 0, 1, -1, 0.48141205, -2.5) +transform = Transform3D(1, 0, 0, 0, 0.8, 0, 0, 0, 1, -1, 0.48141205, -6.5) [node name="Stalagmite4" parent="Map/Props" unique_id=1700522460 instance=ExtResource("5_iywne")] -transform = Transform3D(-1, -8.742278e-08, 0, 8.742278e-08, -1, 0, 0, 0, 1, 0, 6.981412, 3.5) +transform = Transform3D(-1, -8.742278e-08, 0, 8.742278e-08, -1, 0, 0, 0, 1, 0, 6.981412, -0.5) [node name="Stalagmite2" parent="Map/Props" unique_id=703385516 instance=ExtResource("5_iywne")] -transform = Transform3D(0.81915206, 0, -0.57357645, 0, 1, 0, 0.57357645, 0, 0.81915206, -1.5, 0.48141205, 3) +transform = Transform3D(0.81915206, 0, -0.57357645, 0, 1, 0, 0.57357645, 0, 0.81915206, -1.5, 0.48141205, -1) [node name="Stalagmite3" parent="Map/Props" unique_id=370634587 instance=ExtResource("5_iywne")] -transform = Transform3D(0.50000006, 0, -0.86602557, 0, 0.9, 0, 0.86602557, 0, 0.50000006, -2, 0.48141205, 1) +transform = Transform3D(0.50000006, 0, -0.86602557, 0, 0.9, 0, 0.86602557, 0, 0.50000006, -2, 0.48141205, -3) [node name="blockbench_export" parent="Map/Props" unique_id=1509742770 instance=ExtResource("9_vtaks")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.482732, 0.4921612, -0.54847705) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.482732, 0.4921612, -4.548477) [node name="blockbench_export3" parent="Map/Props" unique_id=231004769 instance=ExtResource("9_vtaks")] -transform = Transform3D(0.64278764, 0, -0.76604444, 0, 1, 0, 0.76604444, 0, 0.64278764, -0.5172682, 0.4921612, -1.5484772) +transform = Transform3D(0.64278764, 0, -0.76604444, 0, 1, 0, 0.76604444, 0, 0.64278764, -0.5172682, 0.4921612, -5.548477) [node name="blockbench_export2" parent="Map/Props" unique_id=992880863 instance=ExtResource("10_kvpfn")] -transform = Transform3D(0.34202015, 0, -0.9396926, 0, 1, 0, 0.9396926, 0, 0.34202015, -0.2643292, 0.49367946, 5.0695834) +transform = Transform3D(0.34202015, 0, -0.9396926, 0, 1, 0, 0.9396926, 0, 0.34202015, -0.2643292, 0.49367946, 1.0695834) [node name="blockbench_export4" parent="Map/Props" unique_id=1001222209 instance=ExtResource("10_kvpfn")] -transform = Transform3D(0.34202015, 0, -0.9396926, 0, 1, 0, 0.9396926, 0, 0.34202015, 4.735671, 0.49367946, -5.930416) +transform = Transform3D(0.34202015, 0, -0.9396926, 0, 1, 0, 0.9396926, 0, 0.34202015, 4.735671, 0.49367946, -9.930416) + +[node name="Entities" type="Node3D" parent="." unique_id=227401299] + +[node name="CameraZones" type="Node3D" parent="." unique_id=1225967945] + +[node name="CameraZone" type="Area3D" parent="CameraZones" unique_id=1280290524] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="CameraZones/CameraZone" unique_id=1757431784] +shape = SubResource("BoxShape3D_kvuet") + +[node name="Offset" type="Node3D" parent="CameraZones/CameraZone" unique_id=1829870767] + +[node name="Camera" type="Sprite3D" parent="CameraZones/CameraZone/Offset" unique_id=1388726824] +transform = Transform3D(0.7071067, -0.40557975, 0.5792279, 0, 0.81915194, 0.5735764, -0.7071067, -0.40557975, 0.5792279, 4, 4, 4) +pixel_size = 0.05 +double_sided = false +texture = ExtResource("14_trtic") +script = ExtResource("16_ca42v") [node name="PlayerCamera" type="Camera3D" parent="." unique_id=1101523944] -transform = Transform3D(0.7071067, -0.40557978, 0.5792279, 0, 0.819152, 0.5735764, -0.7071067, -0.40557978, 0.5792279, 4, 6.5, 4) +transform = Transform3D(0.70710677, -0.40557978, 0.579228, 0, 0.819152, 0.57357645, -0.70710677, -0.40557978, 0.579228, 4, 6.5, 0) attributes = SubResource("CameraAttributesPractical_yqjtg") fov = 65.0 script = ExtResource("1_lnu2h") @@ -312,7 +344,7 @@ collision_mask = 0 shape = SubResource("SphereShape3D_kvuet") [node name="Player" type="CharacterBody3D" parent="." unique_id=1201448850] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, -4) script = ExtResource("1_yqjtg") [node name="HitCollision" type="Area3D" parent="Player" unique_id=1708789602] @@ -346,66 +378,6 @@ billboard = 2 no_depth_test = true text = "test" -[node name="Dreamer" parent="." unique_id=272925354 instance=ExtResource("13_ca42v")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 3, -4.5) - -[node name="Dreamer2" parent="." unique_id=1482035031 instance=ExtResource("13_ca42v")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 3, -4.5) - -[node name="Dreamer3" parent="." unique_id=1936797258 instance=ExtResource("13_ca42v")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 3, -4.5) - -[node name="Dreamer4" parent="." unique_id=1127143563 instance=ExtResource("13_ca42v")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 3, -3.5) - -[node name="Dreamer5" parent="." unique_id=1933354822 instance=ExtResource("13_ca42v")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 3, -3.5) - -[node name="Dreamer6" parent="." unique_id=860097929 instance=ExtResource("13_ca42v")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, -3.5) - -[node name="Slime" parent="." unique_id=393738189 instance=ExtResource("6_u5sy4")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 3, -5.81) - -[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1956400862] -environment = SubResource("Environment_uwrxv") - -[node name="CameraZone2" type="Area3D" parent="WorldEnvironment" unique_id=1501599928] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 4) -visible = false -monitoring = false -monitorable = false - -[node name="CollisionShape3D" type="CollisionShape3D" parent="WorldEnvironment/CameraZone2" unique_id=693968382] -shape = SubResource("BoxShape3D_kvuet") - -[node name="Offset" type="Node3D" parent="WorldEnvironment/CameraZone2" unique_id=1432752210] - -[node name="Camera" type="Sprite3D" parent="WorldEnvironment/CameraZone2/Offset" unique_id=1992696506] -transform = Transform3D(-4.3711385e-08, -0.7071067, 0.70710677, 0, 0.7071067, 0.70710677, -0.99999994, 3.0908616e-08, -3.090862e-08, 4, 4, 0) -pixel_size = 0.05 -double_sided = false -texture = ExtResource("14_trtic") -script = ExtResource("16_ca42v") - -[node name="CameraZones" type="Node3D" parent="." unique_id=1225967945] -visible = false - -[node name="CameraZone" type="Area3D" parent="CameraZones" unique_id=1280290524] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -4) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="CameraZones/CameraZone" unique_id=1757431784] -shape = SubResource("BoxShape3D_kvuet") - -[node name="Offset" type="Node3D" parent="CameraZones/CameraZone" unique_id=1829870767] - -[node name="Camera" type="Sprite3D" parent="CameraZones/CameraZone/Offset" unique_id=1388726824] -transform = Transform3D(0.7071067, -0.40557975, 0.5792279, 0, 0.81915194, 0.5735764, -0.7071067, -0.40557975, 0.5792279, 4, 4, 4) -pixel_size = 0.05 -double_sided = false -texture = ExtResource("14_trtic") -script = ExtResource("16_ca42v") - [node name="UI" type="CanvasLayer" parent="." unique_id=201561869] [node name="Hotbar" type="HBoxContainer" parent="UI" unique_id=1186915077] @@ -443,3 +415,6 @@ size_flags_horizontal = 3 show_percentage = false indeterminate = true editor_preview_indeterminate = false + +[node name="Navmesh" type="NavigationRegion3D" parent="." unique_id=2121822586] +navigation_mesh = SubResource("NavigationMesh_kvuet") diff --git a/scenes/marker/aggro_zone.tscn b/scenes/marker/aggro_zone.tscn new file mode 100644 index 0000000..f249941 --- /dev/null +++ b/scenes/marker/aggro_zone.tscn @@ -0,0 +1,5 @@ +[gd_scene format=3 uid="uid://bes8qlakdmyr6"] + +[node name="AggroZone" type="Area3D" unique_id=744621063] +collision_layer = 0 +monitorable = false diff --git a/scenes/marker/procedural_end.tscn b/scenes/marker/procedural_end.tscn new file mode 100644 index 0000000..1e95031 --- /dev/null +++ b/scenes/marker/procedural_end.tscn @@ -0,0 +1,6 @@ +[gd_scene format=3 uid="uid://dw1whdwjephca"] + +[ext_resource type="Script" uid="uid://b2hsiuhobrgef" path="res://scripts/marker/procedural_end.gd" id="1_iqn3b"] + +[node name="ProceduralEnd" type="Node3D" unique_id=1312865697] +script = ExtResource("1_iqn3b") diff --git a/scenes/marker/procedural_start.tscn b/scenes/marker/procedural_start.tscn new file mode 100644 index 0000000..1f97573 --- /dev/null +++ b/scenes/marker/procedural_start.tscn @@ -0,0 +1,6 @@ +[gd_scene format=3 uid="uid://bpkg5vy54815e"] + +[ext_resource type="Script" uid="uid://hv37j0qrsiw6" path="res://scripts/marker/procedural_start.gd" id="1_do42j"] + +[node name="ProceduralStart" type="Node3D" unique_id=1915860137] +script = ExtResource("1_do42j") diff --git a/scenes/marker/procgen_spawn.tscn b/scenes/marker/procgen_spawn.tscn new file mode 100644 index 0000000..68d6100 --- /dev/null +++ b/scenes/marker/procgen_spawn.tscn @@ -0,0 +1,6 @@ +[gd_scene format=3 uid="uid://d2v1prhy01lcv"] + +[ext_resource type="Script" uid="uid://dxmh71eq5nrrd" path="res://scripts/marker/procgen_spawn.gd" id="1_0euo2"] + +[node name="Spawn" type="Node3D" unique_id=2054091961] +script = ExtResource("1_0euo2") diff --git a/scenes/procgens/test1/item_1.tscn b/scenes/procgens/test1/item_1.tscn new file mode 100644 index 0000000..4ddd821 --- /dev/null +++ b/scenes/procgens/test1/item_1.tscn @@ -0,0 +1,28 @@ +[gd_scene format=3 uid="uid://cbkp7lqjrcu0e"] + +[ext_resource type="Material" uid="uid://bivt02tm06osv" path="res://materials/tile/stone_floor.tres" id="1_gw56t"] +[ext_resource type="PackedScene" uid="uid://bpkg5vy54815e" path="res://scenes/marker/procedural_start.tscn" id="2_23lxt"] +[ext_resource type="PackedScene" uid="uid://dw1whdwjephca" path="res://scenes/marker/procedural_end.tscn" id="3_wcgil"] + +[node name="Item1" type="Node3D" unique_id=1898621031] + +[node name="Geometry" type="Node3D" parent="." unique_id=1828031604] + +[node name="CSGBox3D25" type="CSGBox3D" parent="Geometry" unique_id=93057530] +layers = 1023 +use_collision = true +collision_layer = 255 +collision_mask = 255 +size = Vector3(8, 1, 8) +material = ExtResource("1_gw56t") + +[node name="Label3D" type="Label3D" parent="Geometry" unique_id=1011547739] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) +billboard = 1 +text = "1" + +[node name="ProceduralStart" parent="." unique_id=1915860137 instance=ExtResource("2_23lxt")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 0) + +[node name="ProceduralEnd" parent="." unique_id=1312865697 instance=ExtResource("3_wcgil")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0) diff --git a/scenes/procgens/test1/item_2.tscn b/scenes/procgens/test1/item_2.tscn new file mode 100644 index 0000000..77b83d0 --- /dev/null +++ b/scenes/procgens/test1/item_2.tscn @@ -0,0 +1,28 @@ +[gd_scene format=3 uid="uid://cccs7ovmoolcw"] + +[ext_resource type="Material" uid="uid://bivt02tm06osv" path="res://materials/tile/stone_floor.tres" id="1_u1b08"] +[ext_resource type="PackedScene" uid="uid://bpkg5vy54815e" path="res://scenes/marker/procedural_start.tscn" id="2_hdacx"] +[ext_resource type="PackedScene" uid="uid://dw1whdwjephca" path="res://scenes/marker/procedural_end.tscn" id="3_kycyq"] + +[node name="Item2" type="Node3D" unique_id=1898621031] + +[node name="Geometry" type="Node3D" parent="." unique_id=1828031604] + +[node name="CSGBox3D25" type="CSGBox3D" parent="Geometry" unique_id=93057530] +layers = 1023 +use_collision = true +collision_layer = 255 +collision_mask = 255 +size = Vector3(8, 1, 8) +material = ExtResource("1_u1b08") + +[node name="Label3D" type="Label3D" parent="Geometry" unique_id=1011547739] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) +billboard = 1 +text = "2" + +[node name="ProceduralStart" parent="." unique_id=1915860137 instance=ExtResource("2_hdacx")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 0) + +[node name="ProceduralEnd" parent="." unique_id=1312865697 instance=ExtResource("3_kycyq")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0) diff --git a/scenes/procgens/test1/item_3.tscn b/scenes/procgens/test1/item_3.tscn new file mode 100644 index 0000000..376910e --- /dev/null +++ b/scenes/procgens/test1/item_3.tscn @@ -0,0 +1,59 @@ +[gd_scene format=3 uid="uid://dioufwlo42kfh"] + +[ext_resource type="Material" uid="uid://bivt02tm06osv" path="res://materials/tile/stone_floor.tres" id="1_hue54"] +[ext_resource type="PackedScene" uid="uid://bpkg5vy54815e" path="res://scenes/marker/procedural_start.tscn" id="2_0r4hg"] +[ext_resource type="PackedScene" uid="uid://d2v1prhy01lcv" path="res://scenes/marker/procgen_spawn.tscn" id="2_pn80y"] +[ext_resource type="PackedScene" uid="uid://dw1whdwjephca" path="res://scenes/marker/procedural_end.tscn" id="3_pn80y"] +[ext_resource type="PackedScene" uid="uid://bes8qlakdmyr6" path="res://scenes/marker/aggro_zone.tscn" id="4_0r4hg"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_pn80y"] +size = Vector3(8, 4, 8) + +[sub_resource type="NavigationMesh" id="NavigationMesh_pn80y"] +vertices = PackedVector3Array(-3.75, 0.6000001, -3.75, -3.75, 0.6000001, 3.75, 3.75, 0.6000001, 3.75, 3.75, 0.6000001, -3.75) +polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)] +geometry_source_geometry_mode = 1 +cell_size = 0.05 +cell_height = 0.05 +border_size = 0.25 +agent_radius = 0.25 + +[node name="Item3" type="Node3D" unique_id=1898621031] + +[node name="Geometry" type="Node3D" parent="." unique_id=1828031604 groups=["navigation_mesh_source_group"]] + +[node name="CSGBox3D25" type="CSGBox3D" parent="Geometry" unique_id=93057530] +layers = 1023 +use_collision = true +collision_layer = 255 +collision_mask = 255 +size = Vector3(8, 1, 8) +material = ExtResource("1_hue54") + +[node name="Label3D" type="Label3D" parent="Geometry" unique_id=1011547739] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) +billboard = 1 +text = "3" + +[node name="Spawns" type="Node3D" parent="." unique_id=1153235281] + +[node name="Spawn" parent="Spawns" unique_id=2054091961 instance=ExtResource("2_pn80y")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0) + +[node name="ProceduralStart" parent="." unique_id=1915860137 instance=ExtResource("2_0r4hg")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0.5, 0) + +[node name="ProceduralEnd" parent="." unique_id=1312865697 instance=ExtResource("3_pn80y")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0.5, 0) + +[node name="AggroZone" parent="." unique_id=744621063 instance=ExtResource("4_0r4hg")] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="AggroZone" unique_id=687211074] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0) +shape = SubResource("BoxShape3D_pn80y") +debug_color = Color(0.98925954, 0, 0.29793912, 0.41960785) + +[node name="NavigationLink3D" type="NavigationLink3D" parent="." unique_id=553468132] + +[node name="Navmesh" type="NavigationRegion3D" parent="." unique_id=775691988] +navigation_mesh = SubResource("NavigationMesh_pn80y") diff --git a/scripts/enemies/dreamer.gd b/scripts/enemies/dreamer.gd index 1c628bd..b145d3a 100644 --- a/scripts/enemies/dreamer.gd +++ b/scripts/enemies/dreamer.gd @@ -9,6 +9,8 @@ var face_left = false var combatable = true +@export var awake = true + var iframes := 0.0 var knockback_time := 0.0 var health := 100.0 @@ -118,63 +120,64 @@ func _physics_process(delta: float) -> void: intended_velocity.y = JUMP_VELOCITY $DreamerBody/Animator.set("parameters/jump/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) - var direction = Vector3.ZERO + var direction = Vector3.ZERO - state_timer -= delta - - if state == STATE_APPROACH_ENEMY: - navigation_agent.set_target_position(player.global_position) - - var next_path_position: Vector3 = navigation_agent.get_next_path_position() - direction = global_position.direction_to(next_path_position) + if awake: + state_timer -= delta - if (player.global_position - global_position).length() < 1: - state = STATE_CHARGE_ATTACK - state_timer = 0.7 - - $DreamerBody/Animator.set("parameters/charge_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) - elif state == STATE_CHARGE_ATTACK: - $HitCollision.look_at(player.global_position) - $HitCollision.rotation.x = 0 - - if state_timer <= 0: - state = STATE_ATTACK - $DreamerBody/Animator.set("parameters/swing_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) - - var slash = Global.effects.attack_swooshy.slash.instantiate() - game.add_child(slash) - slash.global_position = global_position - slash.global_rotation.y = $HitCollision.global_rotation.y + deg_to_rad(90) - slash.play_effect() - - if player in $HitCollision.get_overlapping_bodies(): - if player.iframes <= 0: - player.health -= 20 - player.on_hit(self) + if state == STATE_APPROACH_ENEMY: + navigation_agent.set_target_position(player.global_position) - state_timer = 0.5 - elif state == STATE_ATTACK: - if state_timer <= 0: - state = STATE_APPROACH_ENEMY - elif state == STATE_HIT: - $DreamerBody/Animator.set("parameters/charge_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT) - $DreamerBody/Animator.set("parameters/hit/blend_amount", 1.0) - $DreamerBody/Animator.set("parameters/dead/blend_amount", 0.0) - - if health <= 0: - if (state_timer <= 0) or is_on_floor(): - state = STATE_DEAD - collision_layer = 0 - elif state_timer <= 0: - $DreamerBody/Animator.set("parameters/hit/blend_amount", 0.0) + var next_path_position: Vector3 = navigation_agent.get_next_path_position() + direction = global_position.direction_to(next_path_position) - state = STATE_APPROACH_ENEMY - elif state == STATE_DEAD: - if is_on_floor(): - $DreamerBody/Animator.set("parameters/dead/blend_amount", 1.0) - else: + if (player.global_position - global_position).length() < 1: + state = STATE_CHARGE_ATTACK + state_timer = 1 + + $DreamerBody/Animator.set("parameters/charge_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) + elif state == STATE_CHARGE_ATTACK: + $HitCollision.look_at(player.global_position) + $HitCollision.rotation.x = 0 + + if state_timer <= 0: + state = STATE_ATTACK + $DreamerBody/Animator.set("parameters/swing_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) + + var slash = Global.effects.attack_swooshy.slash.instantiate() + game.add_child(slash) + slash.global_position = global_position + slash.global_rotation.y = $HitCollision.global_rotation.y + deg_to_rad(90) + slash.play_effect() + + if player in $HitCollision.get_overlapping_bodies(): + if player.iframes <= 0: + player.health -= 20 + player.on_hit(self) + + state_timer = 0.5 + elif state == STATE_ATTACK: + if state_timer <= 0: + state = STATE_APPROACH_ENEMY + elif state == STATE_HIT: + $DreamerBody/Animator.set("parameters/charge_weapon/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT) + $DreamerBody/Animator.set("parameters/hit/blend_amount", 1.0) $DreamerBody/Animator.set("parameters/dead/blend_amount", 0.0) + if health <= 0: + if (state_timer <= 0) or is_on_floor(): + state = STATE_DEAD + collision_layer = 0 + elif state_timer <= 0: + $DreamerBody/Animator.set("parameters/hit/blend_amount", 0.0) + + state = STATE_APPROACH_ENEMY + elif state == STATE_DEAD: + if is_on_floor(): + $DreamerBody/Animator.set("parameters/dead/blend_amount", 1.0) + else: + $DreamerBody/Animator.set("parameters/dead/blend_amount", 0.0) + var camera_right = game.get_node("PlayerCamera").global_transform.basis.x if typeof(camera_right) == TYPE_VECTOR3: diff --git a/scripts/enemies/slime.gd b/scripts/enemies/slime.gd index f9b23af..e398d3d 100644 --- a/scripts/enemies/slime.gd +++ b/scripts/enemies/slime.gd @@ -9,6 +9,8 @@ var face_left = false var health = 35 var mid_knockback = false +@export var awake = true + @onready var player = get_parent().get_node("Player") enum { @@ -46,34 +48,35 @@ func _physics_process(delta: float) -> void: state_timer -= delta - if state_timer < 0: - if state == STATE_IDLE: - state = STATE_JUMP - state_timer = 0.6 - $Body/Animator.play("jump") + if awake: + if state_timer < 0: + if state == STATE_IDLE: + state = STATE_JUMP + state_timer = 0.6 + $Body/Animator.play("jump") + + elif state == STATE_JUMP: + state = STATE_LEAP + state_timer = 99999 + $Body/Animator.play("leap") + velocity = global_position.direction_to(player.global_position) * 3 + velocity.y = 3 + + elif state == STATE_DEATH: + queue_free() + + elif (state == STATE_LEAP) and is_on_floor(): + state = STATE_IDLE + state_timer = randf_range(0.8, 1.5) - elif state == STATE_JUMP: - state = STATE_LEAP - state_timer = 99999 - $Body/Animator.play("leap") - velocity = global_position.direction_to(player.global_position) * 3 - velocity.y = 3 + $Body/Animator.play("idle") + elif (state == STATE_HIT) and is_on_floor(): + state = STATE_IDLE + state_timer = 0.5 - elif state == STATE_DEATH: - queue_free() - - elif (state == STATE_LEAP) and is_on_floor(): - state = STATE_IDLE - state_timer = randf_range(0.8, 1.5) - - $Body/Animator.play("idle") - elif (state == STATE_HIT) and is_on_floor(): - state = STATE_IDLE - state_timer = 0.5 - - $Body/Animator.play("idle") - elif (state == STATE_DEATH): - pass + $Body/Animator.play("idle") + elif (state == STATE_DEATH): + pass if iframes > 0: iframes -= delta diff --git a/scripts/game.gd b/scripts/game.gd index 21df6f1..0436822 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -1,19 +1,57 @@ extends Node3D -var update_ui_timer = 0.1 +var update_timer = 0.1 @onready var player = $Player -# Called when the node enters the scene tree for the first time. +var procgen_map = [] + +func _procgen_add_next() -> void: + var procgen_item = load("res://scenes/procgens/test1/item_" + str(randi_range(3, 3)) + ".tscn").instantiate() + var entry = { + "item": procgen_item, + "enemies": [] + } + + if procgen_map.size() != 0: + procgen_item.global_position = procgen_map[procgen_map.size() - 1].item.get_node("ProceduralEnd").global_position - procgen_item.get_node("ProceduralStart").position + + procgen_map.push_back(entry) + + add_child(procgen_item) + + entry.has_aggro_zone = procgen_item.has_node("AggroZone") + if entry.has_aggro_zone: + procgen_item.get_node("AggroZone").body_entered.connect(func (body): if body == player: for n in entry.enemies: n.awake = true ) + + if procgen_item.has_node("Spawns"): + for n in procgen_item.get_node("Spawns").get_children(): + var enemy = Global.enemies[n.spawn_enemy].instantiate() + + enemy.awake = false + + add_child(enemy) + + enemy.global_position = n.global_position + + entry.enemies.push_back(enemy) + + + func _ready() -> void: - pass # Replace with function body. + _procgen_add_next() + _procgen_add_next() + _procgen_add_next() + _procgen_add_next() + _procgen_add_next() + _procgen_add_next() # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - update_ui_timer -= delta + update_timer -= delta - if update_ui_timer <= 0: - update_ui_timer = 0.1 + if update_timer <= 0: + update_timer = 0.1 $UI/Hotbar/Bars/Health/Bar.value = player.health diff --git a/scripts/global.gd b/scripts/global.gd index 7886a4d..691cf01 100644 --- a/scripts/global.gd +++ b/scripts/global.gd @@ -103,3 +103,7 @@ const effects = { "pierce": preload("res://scenes/effects/attack_swooshy/pierce.tscn") } } + +const enemies = { + "dreamer": preload("res://scenes/dreamer.tscn") +} diff --git a/scripts/marker/procedural_end.gd b/scripts/marker/procedural_end.gd new file mode 100644 index 0000000..2089a5a --- /dev/null +++ b/scripts/marker/procedural_end.gd @@ -0,0 +1,9 @@ +@tool +extends Node3D + +@export var width = 2.0 +@export var height = 2.0 + +func _process(delta: float) -> void: + if Engine.is_editor_hint(): + DebugDraw3D.draw_box(global_position + Vector3(0, (height / 2.0), 0), quaternion.normalized(), Vector3(0.001, height, width), Color(0, 1, 0), true) diff --git a/scripts/marker/procedural_end.gd.uid b/scripts/marker/procedural_end.gd.uid new file mode 100644 index 0000000..7535fb2 --- /dev/null +++ b/scripts/marker/procedural_end.gd.uid @@ -0,0 +1 @@ +uid://b2hsiuhobrgef diff --git a/scripts/marker/procedural_start.gd b/scripts/marker/procedural_start.gd new file mode 100644 index 0000000..f67961d --- /dev/null +++ b/scripts/marker/procedural_start.gd @@ -0,0 +1,9 @@ +@tool +extends Node3D + +@export var width = 2.0 +@export var height = 2.0 + +func _process(delta: float) -> void: + if Engine.is_editor_hint(): + DebugDraw3D.draw_box(global_position + Vector3(0, (height / 2.0), 0), quaternion.normalized(), Vector3(0.001, height, width), Color(1, 0, 0), true) diff --git a/scripts/marker/procedural_start.gd.uid b/scripts/marker/procedural_start.gd.uid new file mode 100644 index 0000000..29f1733 --- /dev/null +++ b/scripts/marker/procedural_start.gd.uid @@ -0,0 +1 @@ +uid://hv37j0qrsiw6 diff --git a/scripts/marker/procgen_spawn.gd b/scripts/marker/procgen_spawn.gd new file mode 100644 index 0000000..8bf0ca2 --- /dev/null +++ b/scripts/marker/procgen_spawn.gd @@ -0,0 +1,10 @@ +extends Node3D + +## The spawn class to use when spawning enemies. Higher priority than spawn_enemy. +@export var spawn_class = "" + +## The enemy to spawn. +@export var spawn_enemy = "dreamer" + +## The properties to apply to an enemy. Use strings for keys, and any value for attributes. +@export var properties: Dictionary = {} diff --git a/scripts/marker/procgen_spawn.gd.uid b/scripts/marker/procgen_spawn.gd.uid new file mode 100644 index 0000000..ea0cd27 --- /dev/null +++ b/scripts/marker/procgen_spawn.gd.uid @@ -0,0 +1 @@ +uid://dxmh71eq5nrrd