Skip to content

Commit

Permalink
changed the logic of obtaining UP vector.
Browse files Browse the repository at this point in the history
`draw_cylinder_ab` now uses a separate model.
added `draw_plane` backside color.
added support for inf and -inf in c# bindings generator.
updated documentation.
updated demo. improved physics tick support.
added cache for doxygen.
slightly updated css.
  • Loading branch information
DmitriySalnikov committed Dec 28, 2023
1 parent 9f4e693 commit e820b54
Show file tree
Hide file tree
Showing 33 changed files with 500 additions and 234 deletions.
5 changes: 2 additions & 3 deletions .github/actions/compile_gdextension/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ runs:
- name: Restore .scons_cache directory
if: inputs.use_cache != 'false'
id: restore_scons_cache
uses: actions/cache/restore@v3
with:
path: ${{env.SCONS_CACHE}}
key: ${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}
${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}
continue-on-error: true
- name: Set up Python 3.x
uses: actions/setup-python@v4
Expand Down Expand Up @@ -113,9 +113,8 @@ runs:
path: ${{inputs.output_libs_path}}/*

- name: Save .scons_cache directory
if: inputs.use_cache != 'false'
if: ${{!steps.restore_scons_cache.outputs.cache-hit && inputs.use_cache != 'false'}}
uses: actions/cache/save@v3
with:
path: ${{env.SCONS_CACHE}}
key: ${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}
continue-on-error: true
23 changes: 21 additions & 2 deletions .github/workflows/web_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: 🚀 Deploy content to Github Pages
on:
push:
branches-ignore: gh-pages
paths: [docs/**, images/**, dd3d_web_build/**, examples_dd3d/**, Doxyfile, src/**, .github/**, "!.github/**/util_*", "patches/**", lib_utils.py, SConstruct]
# Must not overlap with conditions in `gdextension_build.yml`
paths: [docs/**, images/**, dd3d_web_build/**, examples_dd3d/**, Doxyfile,
src/**, .github/**, "!.github/**/util_*", "patches/**", lib_utils.py, SConstruct
]
workflow_call:
workflow_dispatch:
inputs:
dev_deploy:
Expand Down Expand Up @@ -159,7 +163,7 @@ jobs:
runs-on: ubuntu-latest

env:
DOXYGEN_VERSION: 1.9.8
DOXYGEN_VERSION: 1.10.0

steps:
- name: Checkout
Expand All @@ -168,14 +172,29 @@ jobs:
lfs: true
submodules: recursive

- name: Restore doxygen directory
uses: actions/cache/restore@v3
id: restore_doxygen
with:
path: obj/doxygen-${{env.DOXYGEN_VERSION}}
key: doxygen-${{env.DOXYGEN_VERSION}}

- name: Install Doxygen
if: ${{!steps.restore_doxygen.outputs.cache-hit}}
shell: bash
run: |
mkdir obj
cd obj
wget -nv https://www.doxygen.nl/files/doxygen-${{env.DOXYGEN_VERSION}}.linux.bin.tar.gz
tar -xf doxygen-${{env.DOXYGEN_VERSION}}.linux.bin.tar.gz
- name: Save doxygen directory
if: ${{!steps.restore_doxygen.outputs.cache-hit}}
uses: actions/cache/save@v3
with:
path: obj/doxygen-${{env.DOXYGEN_VERSION}}
key: doxygen-${{env.DOXYGEN_VERSION}}

- name: Run Doxygen
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ obj/
bin/
src/gen/*
addons/debug_draw_3d/libs/~*
addons/debug_draw_3d/csharp/*
addons/debug_draw_3d/gen/*
clang_rt.asan_*
docs/images/classes/temp/
2 changes: 1 addition & 1 deletion addons/debug_draw_3d/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ 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>

<a href="https://qiwi.com/n/DMITRIYSALNIKOV"><img src="https://upload.wikimedia.org/wikipedia/commons/8/8f/QIWI_logo.svg" alt="qiwi" width=90px/></a>
<b>USDT-TRC20 TEw934PrsffHsAn5M63SoHYRuZo984EF6v</b>

## Features

Expand Down
2 changes: 2 additions & 0 deletions docs/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Your support adds motivation to develop my public projects.

[![](images/boosty.png){html: width=192px}](https://boosty.to/dmitriysalnikov/donate)

![USDT-TRC20 TEw934PrsffHsAn5M63SoHYRuZo984EF6v](images/USDT-TRC20.png)

<h2><a href="https://dd3d.dmitriysalnikov.ru/demo/">Interactive Web Demo</a></h2>

[![](/images/screenshot_web.png)](https://dd3d.dmitriysalnikov.ru/demo/)
Expand Down
40 changes: 33 additions & 7 deletions docs/doxygen_resources/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ html {
html {
/* primary theme color. This will affect the entire websites color scheme: links, arrows, labels, ... */
--primary-color: #ff810b;
--primary-dark-color: #f18c2c;
--primary-light-color: #e0c33e;
--primary-dark-color: #d56f15;
--primary-light-color: #dd9921;

--page-background-color: #ffffff;
--page-foreground-color: #1b1e21;
Expand All @@ -45,26 +45,34 @@ html {
--side-nav-background: #f3f3f3;
}

.paramname em {
color: var(--primary-light-color);
}

@media (prefers-color-scheme: dark) {
html:not(.light-mode) {
--primary-color: #f59031;
--primary-dark-color: #c07f42;
--primary-light-color: #e0c33e;
--primary-dark-color: #dd7d22;
--primary-light-color: #d9c775;

--page-background-color: #21232b;
--page-foreground-color: #ebf0f1;
--separator-color: #121212;

--side-nav-background: #282b35;
}

.paramname em {
color: var(--primary-light-color);
}
}

html.dark-mode {
color-scheme: dark;

--primary-color: #f59031;
--primary-dark-color: #c07f42;
--primary-light-color: #e0c33e;
--primary-dark-color: #dd7d22;
--primary-light-color: #d9c775;

--page-background-color: #21232b;
--page-foreground-color: #ebf0f1;
Expand All @@ -74,17 +82,33 @@ html.dark-mode {
}

#nav-tree .selected .arrow {
color: #f59031;
color: var(--primary-color);
text-shadow: none;
}

a:hover {
text-decoration: underline;
background: none;
}

#nav-tree .label a:hover {
background: linear-gradient(to bottom, transparent 0, transparent calc(100% - 1px), currentColor 100%);
}

a:hover>span.arrow {
text-decoration: none;
background: transparent;
}

span.mlabel {
background: var(--primary-color);
border-radius: 5px;
color: rgb(20, 20, 20);
font-weight: 800;
}

/* Version select */

select#dd3d_version_select {
color: var(--primary-color);
font-weight: 600;
Expand All @@ -97,6 +121,8 @@ select#dd3d_version_select option {
color: var(--page-foreground-color);
}

/* !Version select */

/* Octocat corner */

a.github-corner:hover .octo-arm {
Expand Down
6 changes: 3 additions & 3 deletions docs/doxygen_resources/footer.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!-- HTML footer for doxygen 1.9.8-->
<!-- HTML footer for doxygen 1.10.0-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer" id="dd3d_version_block">Docs version: <select id="dd3d_version_select"></select></li>
<li class="footer">$generatedby <a href="https://www.doxygen.org/index.html"><img class="footer"
src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen" /></a> $doxygenversion </li>
src="$relpath^doxygen.svg" width="104" height="31" alt="doxygen" /></a> $doxygenversion
<span id="dd3d_version_block" style="margin-left: 10px">Docs version: <select id="dd3d_version_select"></select></span></li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
Expand Down
Binary file added docs/images/USDT-TRC20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 32 additions & 16 deletions examples_dd3d/DebugDrawDemoScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ extends Node3D
@export var test_graphs := false
@export var more_test_cases := true
@export var draw_array_of_boxes := false
@export_range(0, 5, 0.001) var debug_thickness := 0.05
@export_range(0, 5, 0.001) var debug_thickness := 0.1
@export_range(0, 1, 0.001) var debug_center_brightness := 0.8
@export_range(0, 1024) var start_culling_distance := 55.0
@export_range(0, 1024) var start_culling_distance := 60.0

@export_group("Text groups", "text_groups")
@export var text_groups_show_hints := true
Expand All @@ -35,27 +35,36 @@ extends Node3D
@export var graph_is_enabled := true

var button_presses := {}
var frame_rendered := false
var phys_frame_called := false

var timer_1 := 0.0
var timer_2 := 0.0
var timer_3 := 0.0
var timer_text := 0.0

func _process(delta):

func _process(delta) -> void:
phys_frame_called = false
if !update_in_physics:
%RayEmitterAnimationPlayer.callback_mode_process = AnimationPlayer.ANIMATION_PROCESS_IDLE
main_update(delta)
_update_timers(delta)


## 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 update_in_physics:
%RayEmitterAnimationPlayer.callback_mode_process = AnimationPlayer.ANIMATION_PROCESS_PHYSICS
main_update(delta)
if !phys_frame_called:
phys_frame_called = true
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)

_draw_rays_casts()


func main_update(delta: float) -> void:
Expand Down Expand Up @@ -215,7 +224,9 @@ func main_update(delta: float) -> void:
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)
DebugDraw3D.draw_point_path(points_below4, DebugDraw3D.POINT_TYPE_SPHERE, 0.25, Color.MEDIUM_SEA_GREEN, Color.MEDIUM_VIOLET_RED)
if true:
var _sl = DebugDraw3D.new_scope_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)

# Misc
if true:
Expand Down Expand Up @@ -350,38 +361,43 @@ func _text_tests():
DebugDraw2D.end_text_group()


func _more_tests():
func _draw_rays_casts():
# Line hits render
for ray in $HitTest/RayEmitter.get_children():
if ray is RayCast3D:
DebugDraw3D.draw_line_hit(ray.global_position, ray.to_global(ray.target_position), ray.get_collision_point(), ray.is_colliding(), 0.15)

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_scope_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.5)

# Draw plane
if true:
var _s11 = DebugDraw3D.new_scope_config().set_thickness(0.01).set_plane_size(10)
var _s11 = DebugDraw3D.new_scope_config().set_thickness(0.02).set_plane_size(10)

var pl_node: Node3D = $PlaneOrigin/Plane
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 EditorInterface.get_editor_viewport_3d(0):
vp = EditorInterface.get_editor_viewport_3d(0)
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.GREEN * Color(1,1,1,0.3), pl_node.global_position)
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:
DebugDraw3D.draw_sphere(intersect, 0.25, Color.FIREBRICK)
# 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_array_of_boxes():
Expand Down
Loading

0 comments on commit e820b54

Please sign in to comment.