Merge branch 'develop' into components
This commit is contained in:
commit
ed2249bdce
21
addons/debug_draw_3d/LICENSE
Normal file
21
addons/debug_draw_3d/LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 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.
|
||||||
162
addons/debug_draw_3d/README.md
Normal file
162
addons/debug_draw_3d/README.md
Normal file
@ -0,0 +1,162 @@
|
|||||||
|

|
||||||
|
|
||||||
|
# Debug drawing utility for Godot
|
||||||
|
|
||||||
|
This is an add-on for debug drawing in 3D and for some 2D overlays, which is written in `C++` and can be used with `GDScript` or `C#`.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
<a href="https://boosty.to/dmitriysalnikov/donate"><img src="/docs/images/boosty.png" alt="Boosty" width=150px/></a>
|
||||||
|
|
||||||
|
<img src="/docs/images/USDT-TRC20.png" alt="USDT-TRC20" width=150px/>
|
||||||
|
|
||||||
|
<b>USDT-TRC20 TEw934PrsffHsAn5M63SoHYRuZo984EF6v</b>
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
3D:
|
||||||
|
|
||||||
|
* Arrow
|
||||||
|
* Billboard opaque square
|
||||||
|
* Box
|
||||||
|
* Camera Frustum
|
||||||
|
* Cylinder
|
||||||
|
* Gizmo
|
||||||
|
* Grid
|
||||||
|
* Line
|
||||||
|
* Line Path
|
||||||
|
* Line with Arrow
|
||||||
|
* Plane
|
||||||
|
* Points
|
||||||
|
* Position 3D (3 crossing axes)
|
||||||
|
* Sphere
|
||||||
|
|
||||||
|
2D:
|
||||||
|
|
||||||
|
* **[Work in progress]**
|
||||||
|
|
||||||
|
Overlay:
|
||||||
|
|
||||||
|
* Text (with grouping and coloring)
|
||||||
|
* FPS Graph
|
||||||
|
* Custom Graphs
|
||||||
|
|
||||||
|
Precompiled for:
|
||||||
|
|
||||||
|
* Windows
|
||||||
|
* Linux (built on Ubuntu 20.04)
|
||||||
|
* macOS (10.14+)
|
||||||
|
* Android (5.0+)
|
||||||
|
* iOS
|
||||||
|
* Web (Firefox not supported)
|
||||||
|
|
||||||
|
This addon supports working with several World3D and different Viewports.
|
||||||
|
There is also a no depth test mode and other settings that can be changed for each instance.
|
||||||
|
|
||||||
|
This library supports double-precision builds, for more information, [see the documentation](https://dd3d.dmitriysalnikov.ru/docs/1.4.5/md_docs_2DoublePrecision.html).
|
||||||
|
|
||||||
|
## [Interactive Web Demo](https://dd3d.dmitriysalnikov.ru/demo/)
|
||||||
|
|
||||||
|
[](https://dd3d.dmitriysalnikov.ru/demo/)
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
>
|
||||||
|
> * Firefox most likely can't run this 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, 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)
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
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)
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
> [!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`).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 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, unlike `DataGraphs`.
|
||||||
|
|
||||||
|
[Frustum of Camera3D does not take into account the window size from ProjectSettings](https://github.com/godotengine/godot/issues/70362).
|
||||||
|
|
||||||
|
## More screenshots
|
||||||
|
|
||||||
|
`DebugDrawDemoScene.tscn` in editor
|
||||||
|

|
||||||
|
|
||||||
|
`DebugDrawDemoScene.tscn` in play mode
|
||||||
|

|
||||||
153
addons/debug_draw_3d/debug_draw_3d.gdextension
Normal file
153
addons/debug_draw_3d/debug_draw_3d.gdextension
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
[configuration]
|
||||||
|
|
||||||
|
entry_symbol = "debug_draw_3d_library_init"
|
||||||
|
compatibility_minimum = "4.1.4"
|
||||||
|
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 = { }
|
||||||
|
|
||||||
|
; 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 = { }
|
||||||
|
|
||||||
|
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 = { }
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
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.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"
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
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"
|
||||||
0
addons/debug_draw_3d/libs/.gdignore
Normal file
0
addons/debug_draw_3d/libs/.gdignore
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so
Normal file
BIN
addons/debug_draw_3d/libs/libdd3d.linux.editor.x86_64.so
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>libdd3d.macos.editor.universal.dylib</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Debug Draw 3D</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>Debug Draw 3D</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>ru.dmitriysalnikov.dd3d</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright (c) Dmitriy Salnikov.</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.4.5</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.4.5</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>DTPlatformName</key>
|
||||||
|
<string>macosx</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.14</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
||||||
Binary file not shown.
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>libdd3d.macos.template_release.universal.enabled.dylib</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Debug Draw 3D</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>Debug Draw 3D</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>ru.dmitriysalnikov.dd3d</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright (c) Dmitriy Salnikov.</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.4.5</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.4.5</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>DTPlatformName</key>
|
||||||
|
<string>macosx</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.14</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
||||||
Binary file not shown.
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>libdd3d.macos.template_release.universal.dylib</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Debug Draw 3D</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>Debug Draw 3D</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>ru.dmitriysalnikov.dd3d</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright (c) Dmitriy Salnikov.</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.4.5</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.4.5</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>DTPlatformName</key>
|
||||||
|
<string>macosx</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.14</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
BIN
addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm
Normal file
BIN
addons/debug_draw_3d/libs/libdd3d.web.template_debug.wasm32.wasm
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll
Normal file
BIN
addons/debug_draw_3d/libs/libdd3d.windows.editor.x86_64.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
experimente/felox/testmap.gd
Normal file
13
experimente/felox/testmap.gd
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn())
|
||||||
|
DebugDraw2D.set_text("FPS", Engine.get_frames_per_second())
|
||||||
|
DebugDraw2D.set_text("delta", delta)
|
||||||
File diff suppressed because one or more lines are too long
@ -1,3 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://cn2xvs2g7box5"]
|
|
||||||
|
|
||||||
[node name="FlowField" type="Node3D"]
|
|
||||||
11
swarm_engine/flow_field_navigation/flow_field_cell.gd
Normal file
11
swarm_engine/flow_field_navigation/flow_field_cell.gd
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
extends Resource
|
||||||
|
class_name FlowFieldCell
|
||||||
|
|
||||||
|
var position:Vector3 = Vector3(0.0, 0.0, 0.0)
|
||||||
|
var flow_direction:Vector3 = Vector3(randf(), 0.0, randf())
|
||||||
|
|
||||||
|
func debug_process() -> void:
|
||||||
|
if flow_direction.length() > 0.0:
|
||||||
|
DebugDraw3D.draw_arrow(position, position + flow_direction, Color(1,1,1,1), 0.1)
|
||||||
|
else:
|
||||||
|
DebugDraw3D.draw_sphere(position, .05)
|
||||||
71
swarm_engine/flow_field_navigation/flow_field_navigation.gd
Normal file
71
swarm_engine/flow_field_navigation/flow_field_navigation.gd
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
@export_group("Debug")
|
||||||
|
@export var debugVisu: bool = true
|
||||||
|
@export var line_color: Color = Color(1, 1, 1, 1)
|
||||||
|
|
||||||
|
@export_group("Grid")
|
||||||
|
@export var grid_size: int = 10
|
||||||
|
@export var cell_size: float = 1.0
|
||||||
|
|
||||||
|
var _cells: Dictionary
|
||||||
|
var grid_offset: Vector3
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
var half_size = (grid_size * cell_size) * 0.5
|
||||||
|
grid_offset = Vector3(-half_size + (cell_size * 0.5), 0, -half_size + (cell_size * 0.5))
|
||||||
|
create_grid()
|
||||||
|
|
||||||
|
func create_grid() -> void:
|
||||||
|
_cells.clear()
|
||||||
|
for x in range(grid_size):
|
||||||
|
for z in range(grid_size):
|
||||||
|
var cell = FlowFieldCell.new()
|
||||||
|
var world_x = x * cell_size + grid_offset.x
|
||||||
|
var world_z = z * cell_size + grid_offset.z
|
||||||
|
cell.position = Vector3(world_x, 0, world_z)
|
||||||
|
_cells[Vector3(x, 0, z)] = cell # Dictionary mit Grid-Koordinaten als Key
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if debugVisu:
|
||||||
|
_debug_draw_grid()
|
||||||
|
for cell in _cells.values():
|
||||||
|
cell.debug_process()
|
||||||
|
|
||||||
|
func _debug_draw_grid() -> void:
|
||||||
|
for x in range(grid_size + 1):
|
||||||
|
var pos_x = x * cell_size + grid_offset.x - (cell_size * 0.5)
|
||||||
|
DebugDraw3D.draw_line(Vector3(pos_x, 0, grid_offset.z - (cell_size * 0.5)), Vector3(pos_x, 0, grid_offset.z + grid_size * cell_size - (cell_size * 0.5)), line_color)
|
||||||
|
|
||||||
|
for z in range(grid_size + 1):
|
||||||
|
var pos_z = z * cell_size + grid_offset.z - (cell_size * 0.5)
|
||||||
|
DebugDraw3D.draw_line(Vector3(grid_offset.x - (cell_size * 0.5), 0, pos_z), Vector3(grid_offset.x + grid_size * cell_size - (cell_size * 0.5), 0, pos_z), line_color)
|
||||||
|
|
||||||
|
|
||||||
|
# Gibt die Zelle basierend auf einer Weltposition zurück
|
||||||
|
func get_cell_from_pos(world_pos: Vector3) -> FlowFieldCell:
|
||||||
|
var grid_x = int((world_pos.x - grid_offset.x) / cell_size)
|
||||||
|
var grid_z = int((world_pos.z - grid_offset.z) / cell_size)
|
||||||
|
var cell_pos = Vector3(grid_x, 0, grid_z)
|
||||||
|
|
||||||
|
return _cells.get(cell_pos, null)
|
||||||
|
|
||||||
|
|
||||||
|
# Raycast zur Bestimmung der Zelle unter dem Mauszeiger
|
||||||
|
func _input(event):
|
||||||
|
if event is InputEventMouseButton and event.pressed:
|
||||||
|
var camera = get_viewport().get_camera_3d()
|
||||||
|
var from = camera.project_ray_origin(get_viewport().get_mouse_position())
|
||||||
|
var to = from + camera.project_ray_normal(get_viewport().get_mouse_position()) * 1000
|
||||||
|
|
||||||
|
var space_state = get_world_3d().direct_space_state
|
||||||
|
var query = PhysicsRayQueryParameters3D.create(from, to)
|
||||||
|
var result = space_state.intersect_ray(query)
|
||||||
|
|
||||||
|
if result.has("position"):
|
||||||
|
var cell = get_cell_from_pos(result["position"])
|
||||||
|
if cell:
|
||||||
|
print("Zelle an", cell.position, ":", cell.flow_direction)
|
||||||
|
else:
|
||||||
|
print("Keine Zelle gefunden!")
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://cn2xvs2g7box5"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://swarm_engine/flow_field_navigation/flow_field_navigation.gd" id="1_h76mu"]
|
||||||
|
|
||||||
|
[node name="FlowFieldNavigation" type="Node3D"]
|
||||||
|
script = ExtResource("1_h76mu")
|
||||||
7
swarm_engine/swarm_engine_debug_level.gd
Normal file
7
swarm_engine/swarm_engine_debug_level.gd
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
extends Node3D
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
DebugDraw2D.set_text("Frames drawn", Engine.get_frames_drawn())
|
||||||
|
DebugDraw2D.set_text("FPS", Engine.get_frames_per_second())
|
||||||
|
DebugDraw2D.set_text("delta", delta)
|
||||||
@ -1,3 +1,20 @@
|
|||||||
[gd_scene format=3 uid="uid://bwo12me8h21q5"]
|
[gd_scene load_steps=3 format=3 uid="uid://bwo12me8h21q5"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://swarm_engine/swarm_engine_debug_level.gd" id="1_f0ttr"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cn2xvs2g7box5" path="res://swarm_engine/flow_field_navigation/flow_field_navigation.tscn" id="1_xwcpn"]
|
||||||
|
|
||||||
[node name="World" type="Node3D"]
|
[node name="World" type="Node3D"]
|
||||||
|
script = ExtResource("1_f0ttr")
|
||||||
|
|
||||||
|
[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)
|
||||||
|
shadow_enabled = true
|
||||||
|
|
||||||
|
[node name="FlowFieldNavigation" parent="." instance=ExtResource("1_xwcpn")]
|
||||||
|
grid_size = 100
|
||||||
|
cell_size = 2.0
|
||||||
|
|
||||||
|
[node name="CSGSphere3D" type="CSGSphere3D" parent="FlowFieldNavigation"]
|
||||||
|
|
||||||
|
[node name="Camera3D" type="Camera3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.331371, 0.943501, 0, -0.943501, 0.331371, 0, 13.203, 5.65752)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user