diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore index d9aac21..4709183 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,2 @@ # Godot 4+ specific ignores .godot/ - -# Godot-specific ignores -.import/ -export.cfg -export_presets.cfg - -# Imported translations (automatically generated from CSV files) -*.translation - -# Mono-specific ignores -.mono/ -data_*/ -mono_crash.*.json diff --git a/Scenes/Test.tscn b/Scenes/Test.tscn new file mode 100644 index 0000000..715fc68 --- /dev/null +++ b/Scenes/Test.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=2 format=3 uid="uid://cuo7pflu166w"] + +[ext_resource type="Script" path="res://Scripts/Waves.gd" id="1_ad0cf"] + +[node name="Node3D" type="Node3D"] + +[node name="Node" type="Node" parent="."] +script = ExtResource("1_ad0cf") + +[node name="Camera3D" type="Camera3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.38705) diff --git a/Scripts/Waves.gd b/Scripts/Waves.gd new file mode 100644 index 0000000..c3da687 --- /dev/null +++ b/Scripts/Waves.gd @@ -0,0 +1,48 @@ +extends Node + +# Constants +var SAMPLE_RATE = 44100 # Adjust as needed +var DURATION = 5.0 # Duration of the wave in seconds +var AMPLITUDE = 0.5 # Amplitude of the wave +var FREQUENCY = 440.0 # Frequency in Hz + +func _ready(): + # Calculate the number of samples + var num_samples = int(SAMPLE_RATE * DURATION) + + # Generate the wave data using FFT + var wave_data = generate_sine_wave(num_samples, AMPLITUDE, FREQUENCY) + + # Create a VisualInstance (for visualization purposes) + var visual_instance = VisualInstance3D.new() + var mesh = Mesh.new() + + # Create a SurfaceTool to manipulate the mesh + var st = SurfaceTool.new() + + # Create vertices and triangles for the 3D grid + for i in range(num_samples): + var t = i / float(SAMPLE_RATE) + var sample = wave_data[i] + st.add_vertex(Vector3(t, sample, 3.0)) # Adjust the third dimension as needed + + # Connect vertices to form triangles + if i > 0: + st.add_index(i - 1) + st.add_index(i) + + # Create the surface and set the mesh + st.create_to(mesh) + visual_instance.set_surface_material(0, ShaderMaterial.new()) + visual_instance.mesh_instance_set_mesh(0, mesh) + + # Add the VisualInstance as a child to visualize the wave + add_child(visual_instance) + +func generate_sine_wave(num_samples, amplitude, frequency): + var wave_data = [] + for i in range(num_samples): + var t = i / float(SAMPLE_RATE) + var sample = amplitude * sin(2.0 * PI * frequency * t) + wave_data.append(sample) + return wave_data diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..b370ceb --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..9194c9a --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bqscqsgno0gt5" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +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 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..3be95e4 --- /dev/null +++ b/project.godot @@ -0,0 +1,16 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Waves" +run/main_scene="res://Scenes/Test.tscn" +config/features=PackedStringArray("4.1", "Forward Plus") +config/icon="res://icon.svg"