Skip to content

Commit

Permalink
added an audio visualizer to the demo
Browse files Browse the repository at this point in the history
add draw_box_ab
  • Loading branch information
DmitriySalnikov committed Dec 6, 2023
1 parent 15f9081 commit 5556d6c
Show file tree
Hide file tree
Showing 18 changed files with 378 additions and 37 deletions.
2 changes: 2 additions & 0 deletions dd3d_web_build/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
.godot/

# Copied files for testing
examples_dd3d
examples_dd3d/
addons
addons/

# Exported builds
Expand Down
30 changes: 29 additions & 1 deletion dd3d_web_build/export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,35 @@ vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/export_icon=true
html/custom_html_shell=""
html/head_include="<script src=\"coi-serviceworker.min.js\"></script>"
html/head_include="<script src=\"coi-serviceworker.min.js\"></script>
<script>
/* http://www.kehomsforge.com/tutorials/single/save-load-file-system-godot-html-export/ */
var gd_callbacks = {
dataLoaded: null,
dataLoadedResult: null
}
function loadData() {
var input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('accept', '.mp3');
input.click();
input.addEventListener('change', evt => {
var file = evt.target.files[0];
var reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onloadend = function (evt) {
if (gd_callbacks.dataLoaded) {
gd_callbacks.dataLoadedResult = reader.result;
gd_callbacks.dataLoaded(file.name);
}
}
});
}
</script>"
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
Expand Down
Binary file added dd3d_web_build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

importer="texture"
type="CompressedTexture2D"
uid="uid://1ju8du5cumca"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
uid="uid://deelh6rbgusgd"
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]

[params]

Expand All @@ -32,6 +32,3 @@ process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
1 change: 0 additions & 1 deletion dd3d_web_build/icon.svg

This file was deleted.

12 changes: 10 additions & 2 deletions dd3d_web_build/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ config_version=5

config/name="Debug Drawing Utility for Godot"
run/main_scene="res://examples_dd3d/DebugDrawDemoScene.tscn"
config/features=PackedStringArray("4.1", "GL Compatibility")
config/icon="res://icon.svg"
config/features=PackedStringArray("4.2", "GL Compatibility")
config/icon="res://icon.png"

[audio]

buses/default_bus_layout="res://examples_dd3d/VisualizerAudioBus.tres"

[dotnet]

project/assembly_name="Debug Drawing Utility for Godot"

[rendering]

Expand Down
12 changes: 10 additions & 2 deletions examples_dd3d/DebugDrawDemoScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,18 @@ func _process(delta: float) -> void:
DebugDraw3D.draw_box($Boxes/Box2.global_transform.origin, Vector3.ONE, Color.REBECCA_PURPLE)
DebugDraw3D.draw_box_xf(Transform3D(Basis(Vector3.UP, PI * 0.25).scaled(Vector3.ONE * 2), $Boxes/Box3.global_transform.origin), Color.ROSY_BROWN)

DebugDraw3D.draw_aabb(AABB($Boxes/AABB_fixed.global_transform.origin, Vector3(2, 1, 2)), Color.AQUA)
DebugDraw3D.draw_aabb_ab($Boxes/AABB/a.global_transform.origin, $Boxes/AABB/b.global_transform.origin, Color.DEEP_PINK)
DebugDraw3D.draw_aabb_ab($Boxes/AABB/a.global_transform.origin, $Boxes/AABB/b.global_transform.origin, Color.DEEP_PINK)

DebugDraw3D.draw_box_xf($Boxes/BoxOutOfDistanceCulling.global_transform, Color.RED)

DebugDraw3D.draw_aabb(AABB($Boxes/AABB_fixed.global_transform.origin, Vector3(2, 1, 2)), Color.AQUA)
DebugDraw3D.draw_aabb_ab($Boxes/AABB.get_child(0).global_transform.origin, $Boxes/AABB.get_child(1).global_transform.origin, Color.DEEP_PINK)
# Boxes AB
DebugDraw3D.draw_arrow_line($Boxes/BoxABEdge.global_position, $Boxes/BoxABEdge/o/up.global_position, Color.DARK_RED, 0.1, true)
DebugDraw3D.draw_box_ab($Boxes/BoxABEdge/a.global_transform.origin, $Boxes/BoxABEdge/b.global_transform.origin, $Boxes/BoxABEdge/o/up.global_position - $Boxes/BoxABEdge.global_position, Color.DARK_OLIVE_GREEN, false)

DebugDraw3D.draw_arrow_line($Boxes/BoxAB.global_position, $Boxes/BoxAB/o/up.global_position, Color.GOLD, 0.1, true)
DebugDraw3D.draw_box_ab($Boxes/BoxAB/a.global_transform.origin, $Boxes/BoxAB/b.global_transform.origin, $Boxes/BoxAB/o/up.global_position - $Boxes/BoxAB.global_position, Color.PERU)

# Lines
var target = $Lines/Target
Expand Down
Loading

0 comments on commit 5556d6c

Please sign in to comment.