commit cf76e5c9b28bc6aaf0bf0c511bb5b753c709f2a9 Author: Aada Date: Mon Mar 2 15:04:15 2026 +0200 Initial Commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f28239b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*] +charset = utf-8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7d826c8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,42 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf + +# Git LFS Tracking (Assets) + +# 3D Models +*.fbx filter=lfs diff=lfs merge=lfs -text +*.gltf filter=lfs diff=lfs merge=lfs -text +*.glb filter=lfs diff=lfs merge=lfs -text +*.blend filter=lfs diff=lfs merge=lfs -text +*.obj filter=lfs diff=lfs merge=lfs -text + +# Images +*.png filter=lfs diff=lfs merge=lfs -text +*.svg filter=lfs diff=lfs merge=lfs -text +*.jpg filter=lfs diff=lfs merge=lfs -text +*.jpeg filter=lfs diff=lfs merge=lfs -text +*.gif filter=lfs diff=lfs merge=lfs -text +*.tga filter=lfs diff=lfs merge=lfs -text +*.webp filter=lfs diff=lfs merge=lfs -text +*.exr filter=lfs diff=lfs merge=lfs -text +*.hdr filter=lfs diff=lfs merge=lfs -text +*.dds filter=lfs diff=lfs merge=lfs -text + +# Audio +*.mp3 filter=lfs diff=lfs merge=lfs -text +*.wav filter=lfs diff=lfs merge=lfs -text +*.ogg filter=lfs diff=lfs merge=lfs -text + +# Font & Icon +*.ttf filter=lfs diff=lfs merge=lfs -text +*.otf filter=lfs diff=lfs merge=lfs -text +*.ico filter=lfs diff=lfs merge=lfs -text + +# Godot LFS Specific +*.scn filter=lfs diff=lfs merge=lfs -text +*.res filter=lfs diff=lfs merge=lfs -text +*.material filter=lfs diff=lfs merge=lfs -text +*.anim filter=lfs diff=lfs merge=lfs -text +*.mesh filter=lfs diff=lfs merge=lfs -text +*.lmbake filter=lfs diff=lfs merge=lfs -text + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0af181c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Godot 4+ specific ignores +.godot/ +/android/ diff --git a/.idea/.idea.adatonic/.idea/.gitignore b/.idea/.idea.adatonic/.idea/.gitignore new file mode 100644 index 0000000..ca5d0e9 --- /dev/null +++ b/.idea/.idea.adatonic/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/projectSettingsUpdater.xml +/contentModel.xml +/.idea.adatonic.iml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.adatonic/.idea/encodings.xml b/.idea/.idea.adatonic/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.adatonic/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.adatonic/.idea/indexLayout.xml b/.idea/.idea.adatonic/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.adatonic/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.adatonic/.idea/vcs.xml b/.idea/.idea.adatonic/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.adatonic/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..5057758 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,7 @@ +Copyright (c) 2026 Aada Tikkanen + +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, and/or 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/PlanetLow.mtl b/PlanetLow.mtl new file mode 100644 index 0000000..84f636a --- /dev/null +++ b/PlanetLow.mtl @@ -0,0 +1,2 @@ +# Blender 5.0.1 MTL File: 'None' +# www.blender.org diff --git a/README.md b/README.md new file mode 100644 index 0000000..909cb73 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# Adatonics + +Planet generation with simple plate tectonics. + +## Description + +TODO + +## Getting Started + +### Dependencies + +* Godot v4.6.1 + +### Installing + +* Open project in Godot +* TODO: Binaries + +### Executing program + +* TODO + +## Help + +* TODO + +## Authors + +Aada Tikkanen (Ade9) + +## Version History + +* 0.0.0 + * Initial Commit + +## License + +This project is licensed under the MIT License - see the LICENSE.md file for details + +## Acknowledgments + +* [Fractal Philosophy's video](https://www.youtube.com/watch?v=7xL0udlhnqI) +* [Devote's video](https://www.youtube.com/watch?v=CeJz8tsgCPw) +* [DomPizzie's readme template](https://gist.github.com/DomPizzie/7a5ff55ffa9081f2de27c315f5018afc) \ No newline at end of file diff --git a/adatonic.csproj b/adatonic.csproj new file mode 100644 index 0000000..e457872 --- /dev/null +++ b/adatonic.csproj @@ -0,0 +1,7 @@ + + + net8.0 + net9.0 + true + + \ No newline at end of file diff --git a/adatonic.sln b/adatonic.sln new file mode 100644 index 0000000..9bdc9b8 --- /dev/null +++ b/adatonic.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "adatonic", "adatonic.csproj", "{ADF8C75F-73BD-49E2-AFF0-C630B5D45619}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {ADF8C75F-73BD-49E2-AFF0-C630B5D45619}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADF8C75F-73BD-49E2-AFF0-C630B5D45619}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADF8C75F-73BD-49E2-AFF0-C630B5D45619}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {ADF8C75F-73BD-49E2-AFF0-C630B5D45619}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {ADF8C75F-73BD-49E2-AFF0-C630B5D45619}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {ADF8C75F-73BD-49E2-AFF0-C630B5D45619}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection +EndGlobal diff --git a/adatonic.sln.DotSettings.user b/adatonic.sln.DotSettings.user new file mode 100644 index 0000000..ceb9423 --- /dev/null +++ b/adatonic.sln.DotSettings.user @@ -0,0 +1,6 @@ + + ForceIncluded + ForceIncluded + ForceIncluded + ForceIncluded + ForceIncluded \ No newline at end of file diff --git a/assets/PlanetBase.glb b/assets/PlanetBase.glb new file mode 100644 index 0000000..0485efa --- /dev/null +++ b/assets/PlanetBase.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efae792f29c6d0f3a696fed43f2ac0fd487e29513b4ee88f372161913f9e53d0 +size 27453584 diff --git a/assets/PlanetBase.glb.import b/assets/PlanetBase.glb.import new file mode 100644 index 0000000..b7b1cbc --- /dev/null +++ b/assets/PlanetBase.glb.import @@ -0,0 +1,54 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://cdtbfiae03msw" +path="res://.godot/imported/PlanetBase.glb-cb9772b7baab7be7a9066dd45b99a7d7.scn" + +[deps] + +source_file="res://assets/PlanetBase.glb" +dest_files=["res://.godot/imported/PlanetBase.glb-cb9772b7baab7be7a9066dd45b99a7d7.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=false +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={ +"meshes": { +"PlanetBase_Icosphere": { +"generate/lightmap_uv": 2, +"generate/lods": 2, +"generate/shadow_meshes": 2, +"lods/normal_merge_angle": 20.0, +"save_to_file/enabled": false, +"save_to_file/fallback_path": "res://sphere.tres", +"save_to_file/path": "uid://2kh0vgcigdse" +} +} +} +gltf/naming_version=2 +gltf/embedded_image_handling=1 diff --git a/assets/PlanetBase.obj b/assets/PlanetBase.obj new file mode 100644 index 0000000..fa9dca1 --- /dev/null +++ b/assets/PlanetBase.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa4f37f8f758f26003e46328afb09e9175329669f15210c40bd0e898f1c78834 +size 23685601 diff --git a/assets/PlanetBase.obj.import b/assets/PlanetBase.obj.import new file mode 100644 index 0000000..fbcfcdd --- /dev/null +++ b/assets/PlanetBase.obj.import @@ -0,0 +1,25 @@ +[remap] + +importer="wavefront_obj" +importer_version=1 +type="Mesh" +uid="uid://65modei4jwaj" +path="res://.godot/imported/PlanetBase.obj-e7dd6f84cf7385297b2403f29d44bb02.mesh" + +[deps] + +files=["res://.godot/imported/PlanetBase.obj-e7dd6f84cf7385297b2403f29d44bb02.mesh"] + +source_file="res://assets/PlanetBase.obj" +dest_files=["res://.godot/imported/PlanetBase.obj-e7dd6f84cf7385297b2403f29d44bb02.mesh", "res://.godot/imported/PlanetBase.obj-e7dd6f84cf7385297b2403f29d44bb02.mesh"] + +[params] + +generate_tangents=true +generate_lods=true +generate_shadow_mesh=true +generate_lightmap_uv2=false +generate_lightmap_uv2_texel_size=0.2 +scale_mesh=Vector3(1, 1, 1) +offset_mesh=Vector3(0, 0, 0) +force_disable_mesh_compression=false diff --git a/assets/PlanetLow.obj b/assets/PlanetLow.obj new file mode 100644 index 0000000..a68796c --- /dev/null +++ b/assets/PlanetLow.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4883191d5cba21ad612eb206eaa94e32d0e87d1508fac9fc4ac3a52c2634e43f +size 316428 diff --git a/assets/PlanetLow.obj.import b/assets/PlanetLow.obj.import new file mode 100644 index 0000000..031782c --- /dev/null +++ b/assets/PlanetLow.obj.import @@ -0,0 +1,25 @@ +[remap] + +importer="wavefront_obj" +importer_version=1 +type="Mesh" +uid="uid://i15y020lbl21" +path="res://.godot/imported/PlanetLow.obj-04144c5140c8d3a6a9a4499e7542afe4.mesh" + +[deps] + +files=["res://.godot/imported/PlanetLow.obj-04144c5140c8d3a6a9a4499e7542afe4.mesh"] + +source_file="res://assets/PlanetLow.obj" +dest_files=["res://.godot/imported/PlanetLow.obj-04144c5140c8d3a6a9a4499e7542afe4.mesh", "res://.godot/imported/PlanetLow.obj-04144c5140c8d3a6a9a4499e7542afe4.mesh"] + +[params] + +generate_tangents=true +generate_lods=true +generate_shadow_mesh=true +generate_lightmap_uv2=false +generate_lightmap_uv2_texel_size=0.2 +scale_mesh=Vector3(1, 1, 1) +offset_mesh=Vector3(0, 0, 0) +force_disable_mesh_compression=false diff --git a/assets/PlanetMed.obj b/assets/PlanetMed.obj new file mode 100644 index 0000000..a4ac6ce --- /dev/null +++ b/assets/PlanetMed.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2eb720087d7f891047bbd9232149989242a8b9701caf6587642f187c5a26c626 +size 5630125 diff --git a/assets/PlanetMed.obj.import b/assets/PlanetMed.obj.import new file mode 100644 index 0000000..1419c86 --- /dev/null +++ b/assets/PlanetMed.obj.import @@ -0,0 +1,25 @@ +[remap] + +importer="wavefront_obj" +importer_version=1 +type="Mesh" +uid="uid://cxpivgqm7x7ky" +path="res://.godot/imported/PlanetMed.obj-a5753ae94b99c04c1b3bfb2440cece04.mesh" + +[deps] + +files=["res://.godot/imported/PlanetMed.obj-a5753ae94b99c04c1b3bfb2440cece04.mesh"] + +source_file="res://assets/PlanetMed.obj" +dest_files=["res://.godot/imported/PlanetMed.obj-a5753ae94b99c04c1b3bfb2440cece04.mesh", "res://.godot/imported/PlanetMed.obj-a5753ae94b99c04c1b3bfb2440cece04.mesh"] + +[params] + +generate_tangents=true +generate_lods=true +generate_shadow_mesh=true +generate_lightmap_uv2=false +generate_lightmap_uv2_texel_size=0.2 +scale_mesh=Vector3(1, 1, 1) +offset_mesh=Vector3(0, 0, 0) +force_disable_mesh_compression=false diff --git a/assets/icosphere.obj b/assets/icosphere.obj new file mode 100644 index 0000000..58b8183 --- /dev/null +++ b/assets/icosphere.obj @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd7662e611447786f40ef0fc50f04220a3f5994ca3ce41981265383288f2ae20 +size 1650 diff --git a/assets/icosphere.obj.import b/assets/icosphere.obj.import new file mode 100644 index 0000000..6fd25f5 --- /dev/null +++ b/assets/icosphere.obj.import @@ -0,0 +1,25 @@ +[remap] + +importer="wavefront_obj" +importer_version=1 +type="Mesh" +uid="uid://bpdmuywq6qd6d" +path="res://.godot/imported/icosphere.obj-18fc8dc1aa0ca7202b62526d6632660d.mesh" + +[deps] + +files=["res://.godot/imported/icosphere.obj-18fc8dc1aa0ca7202b62526d6632660d.mesh"] + +source_file="res://assets/icosphere.obj" +dest_files=["res://.godot/imported/icosphere.obj-18fc8dc1aa0ca7202b62526d6632660d.mesh", "res://.godot/imported/icosphere.obj-18fc8dc1aa0ca7202b62526d6632660d.mesh"] + +[params] + +generate_tangents=true +generate_lods=true +generate_shadow_mesh=true +generate_lightmap_uv2=false +generate_lightmap_uv2_texel_size=0.2 +scale_mesh=Vector3(1, 1, 1) +offset_mesh=Vector3(0, 0, 0) +force_disable_mesh_compression=false diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..90ddfb7 --- /dev/null +++ b/icon.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c80384360a5b269d1054bfb27241258154e2cc8167c522016fdc1820e84e0f8 +size 995 diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..e9199ca --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://n56csi5ekat" +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/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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..2026d74 --- /dev/null +++ b/project.godot @@ -0,0 +1,53 @@ +; 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="adatonic" +run/main_scene="uid://csfh7ptgerpm2" +config/features=PackedStringArray("4.6", "C#", "GL Compatibility") +config/icon="res://icon.svg" + +[dotnet] + +project/assembly_name="adatonic" + +[input] + +spacebar={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) +] +} +enter={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} +mouse_primary={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(343.16016, 11.21875),"global_position":Vector2(352.16016, 59.21875),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} +mouse_secondary={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(448.19922, 12.3359375),"global_position":Vector2(457.19922, 60.335938),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null) +] +} + +[physics] + +3d/physics_engine="Jolt Physics" + +[rendering] + +rendering_device/driver.windows="d3d12" +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" diff --git a/resources/planet_gradient.tres b/resources/planet_gradient.tres new file mode 100644 index 0000000..a7d0a93 --- /dev/null +++ b/resources/planet_gradient.tres @@ -0,0 +1,5 @@ +[gd_resource type="Gradient" format=3 uid="uid://b5l44rktieewe"] + +[resource] +offsets = PackedFloat32Array(0.020102732, 0.21077614, 0.4361486, 0.4835682, 0.49508524, 0.49909908, 0.52932715, 0.5585736, 0.6065243, 0.65517426, 1) +colors = PackedColorArray(2.5268645e-07, 3.128499e-07, 0.274243, 1, 8.904189e-07, 2.4065375e-07, 0.42930406, 1, 0.20772403, 0.34871656, 0.66512626, 1, 0.3622311, 0.6195445, 0.94423914, 1, 0.10825918, 0.3611443, 0.64106447, 1, 0.61873, 0.8132518, 0.40761396, 1, 0.35594854, 0.5452644, 0.23284999, 1, 0.77351433, 0.7971149, 0.5667908, 1, 0.7397217, 0.59494364, 0.46294695, 1, 0.3225033, 0.42213485, 0.47578907, 1, 1, 1, 1, 1) diff --git a/resources/simple_gradient.tres b/resources/simple_gradient.tres new file mode 100644 index 0000000..9cfa2ce --- /dev/null +++ b/resources/simple_gradient.tres @@ -0,0 +1,5 @@ +[gd_resource type="Gradient" format=3 uid="uid://cq6xba4c8m2j8"] + +[resource] +offsets = PackedFloat32Array(0, 0.499, 0.501, 1) +colors = PackedColorArray(0, 0, 0, 1, 0.17078295, 0.40157902, 0.9999513, 1, 0.4204993, 0.7579306, 0.19122374, 1, 1, 1, 1, 1) diff --git a/scenes/MainScene.tscn b/scenes/MainScene.tscn new file mode 100644 index 0000000..a7be514 --- /dev/null +++ b/scenes/MainScene.tscn @@ -0,0 +1,199 @@ +[gd_scene format=3 uid="uid://csfh7ptgerpm2"] + +[ext_resource type="Script" uid="uid://bhpic251bgvgk" path="res://src/Main.cs" id="1_611at"] +[ext_resource type="ArrayMesh" uid="uid://65modei4jwaj" path="res://assets/PlanetBase.obj" id="2_k24pf"] +[ext_resource type="Material" uid="uid://c55st036tapeo" path="res://shaders/planet.tres" id="3_ygjfp"] +[ext_resource type="Material" uid="uid://k3teblrpopsb" path="res://shaders/map.tres" id="4_1wiy7"] + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_uxrcv"] + +[sub_resource type="Sky" id="Sky_tlwt5"] +sky_material = SubResource("ProceduralSkyMaterial_uxrcv") + +[sub_resource type="Environment" id="Environment_rf2cd"] +background_mode = 2 +sky = SubResource("Sky_tlwt5") +ambient_light_source = 3 +reflected_light_source = 2 + +[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_a814b"] + +[sub_resource type="SphereShape3D" id="SphereShape3D_rpqi1"] +radius = 1.0 + +[node name="MainScene" type="Control" unique_id=1070682561 node_paths=PackedStringArray("_yawNode", "_pitchNode", "_cameraNode", "_meshInstance", "World", "_textureRect")] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_611at") +_yawNode = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw") +_pitchNode = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch") +_cameraNode = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch/Camera3D") +_meshInstance = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Icosphere") +World = NodePath("TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo") +_textureRect = NodePath("TabContainer/Projection") + +[node name="TabContainer" type="TabContainer" parent="." unique_id=1586027287] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +current_tab = 0 + +[node name="Planet" type="HBoxContainer" parent="TabContainer" unique_id=1786930306] +layout_mode = 2 +metadata/_tab_index = 0 + +[node name="SubViewportContainer" type="SubViewportContainer" parent="TabContainer/Planet" unique_id=58474785] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 1.44 +stretch = true + +[node name="SubViewport" type="SubViewport" parent="TabContainer/Planet/SubViewportContainer" unique_id=1257998631] +handle_input_locally = false +size = Vector2i(677, 617) +render_target_update_mode = 4 + +[node name="ZaWarudo" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport" unique_id=937719505] + +[node name="WorldEnvironment" type="WorldEnvironment" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=610642146] +environment = SubResource("Environment_rf2cd") +camera_attributes = SubResource("CameraAttributesPractical_a814b") + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=899426195] +transform = Transform3D(0.88874525, -0.29675773, 0.3493804, 0, 0.7621714, 0.6473753, -0.45840138, -0.5753517, 0.6773762, 0, 0, 0) + +[node name="Icosphere" type="MeshInstance3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=793654005] +transform = Transform3D(0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0) +mesh = ExtResource("2_k24pf") +surface_material_override/0 = ExtResource("3_ygjfp") + +[node name="Yaw" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=2073443785] + +[node name="Pitch" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw" unique_id=98015529] + +[node name="Camera3D" type="Camera3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch" unique_id=1654616370] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 30) +fov = 5.0 + +[node name="StaticBody3D" type="StaticBody3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=330930041] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/StaticBody3D" unique_id=299495076] +shape = SubResource("SphereShape3D_rpqi1") + +[node name="PanelContainer" type="PanelContainer" parent="TabContainer/Planet" unique_id=716838825] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="MarginContainer" type="MarginContainer" parent="TabContainer/Planet/PanelContainer" unique_id=249859922] +layout_mode = 2 +theme_override_constants/margin_left = 12 +theme_override_constants/margin_top = 12 +theme_override_constants/margin_right = 12 +theme_override_constants/margin_bottom = 12 + +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer" unique_id=654818970] +layout_mode = 2 + +[node name="Generate" type="Button" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer" unique_id=662365522] +layout_mode = 2 +text = "Generate" + +[node name="HSeparator" type="HSeparator" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer" unique_id=1862016318] +layout_mode = 2 + +[node name="Label2" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer" unique_id=186838891] +layout_mode = 2 +text = "- Point -" + +[node name="HBoxContainer2" type="HBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer" unique_id=1345806516] +layout_mode = 2 + +[node name="Margin" type="VSeparator" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1465747985] +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1300757041] +layout_mode = 2 +theme_override_colors/font_color = Color(0.4922884, 0.49228835, 0.49228835, 1) +text = "Point ID: " + +[node name="PointId" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1976947082] +unique_name_in_owner = true +layout_mode = 2 +text = "-1" + +[node name="VSeparator1" type="VSeparator" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2" unique_id=746067660] +layout_mode = 2 + +[node name="Label1" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2" unique_id=1690535936] +layout_mode = 2 +theme_override_colors/font_color = Color(0.4922884, 0.49228835, 0.49228835, 1) +text = "Height:" + +[node name="PointHeight" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer2" unique_id=2115494397] +unique_name_in_owner = true +layout_mode = 2 +text = "-1" + +[node name="Label3" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer" unique_id=1412781677] +layout_mode = 2 +text = " - Plate -" + +[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer" unique_id=471041646] +layout_mode = 2 + +[node name="Margin" type="VSeparator" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=1514412102] +layout_mode = 2 + +[node name="Label1" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=1070896445] +layout_mode = 2 +theme_override_colors/font_color = Color(0.4922884, 0.49228835, 0.49228835, 1) +text = "Plate ID:" + +[node name="PlateId" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=37820014] +unique_name_in_owner = true +layout_mode = 2 +text = "-1" + +[node name="VSeparator1" type="VSeparator" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=1699626450] +layout_mode = 2 + +[node name="Label2" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=288487629] +layout_mode = 2 +theme_override_colors/font_color = Color(0.4922884, 0.49228835, 0.49228835, 1) +text = "Is Landform:" + +[node name="IsLandform" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=2089133484] +unique_name_in_owner = true +layout_mode = 2 +text = "unknown" + +[node name="VSeparator2" type="VSeparator" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=75061841] +layout_mode = 2 + +[node name="Label3" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=1444405231] +layout_mode = 2 +theme_override_colors/font_color = Color(0.4922884, 0.49228835, 0.49228835, 1) +text = "Area:" + +[node name="Area" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/HBoxContainer" unique_id=849006497] +unique_name_in_owner = true +layout_mode = 2 +text = "0%" + +[node name="Projection" type="TextureRect" parent="TabContainer" unique_id=155743781] +visible = false +material = ExtResource("4_1wiy7") +layout_mode = 2 +expand_mode = 1 +stretch_mode = 5 +metadata/_tab_index = 1 + +[connection signal="tab_changed" from="TabContainer" to="." method="Tab"] +[connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer/Generate" to="." method="MakeGo"] diff --git a/shaders/map.gdshader b/shaders/map.gdshader new file mode 100644 index 0000000..a76116d --- /dev/null +++ b/shaders/map.gdshader @@ -0,0 +1,23 @@ +shader_type canvas_item; + +uniform int mode = 1; +uniform sampler2D gradient; +void vertex() { + // Called for every vertex the material is visible on. +} + +void fragment() { + if (mode == 1) { + COLOR = COLOR; + } + if (mode == 2) + { + vec4 ree = texture(gradient, vec2(COLOR.r)); + COLOR = ree; + } +} + +//void light() { +// // Called for every pixel for every light affecting the material. +// // Uncomment to replace the default light processing function with this one. +//} diff --git a/shaders/map.gdshader.uid b/shaders/map.gdshader.uid new file mode 100644 index 0000000..9995057 --- /dev/null +++ b/shaders/map.gdshader.uid @@ -0,0 +1 @@ +uid://b5n8mkb7vo6of diff --git a/shaders/map.tres b/shaders/map.tres new file mode 100644 index 0000000..02fbbaa --- /dev/null +++ b/shaders/map.tres @@ -0,0 +1,12 @@ +[gd_resource type="ShaderMaterial" format=3 uid="uid://k3teblrpopsb"] + +[ext_resource type="Shader" uid="uid://b5n8mkb7vo6of" path="res://shaders/map.gdshader" id="1_l44ik"] +[ext_resource type="Gradient" uid="uid://b5l44rktieewe" path="res://resources/planet_gradient.tres" id="2_1qhyp"] + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_e6qn0"] +gradient = ExtResource("2_1qhyp") + +[resource] +shader = ExtResource("1_l44ik") +shader_parameter/mode = 1 +shader_parameter/gradient = SubResource("GradientTexture1D_e6qn0") diff --git a/shaders/planet.gdshader b/shaders/planet.gdshader new file mode 100644 index 0000000..4b2dc69 --- /dev/null +++ b/shaders/planet.gdshader @@ -0,0 +1,32 @@ +shader_type spatial; +render_mode unshaded; + +uniform int mode = 1; +uniform sampler2D gradient; +varying vec3 world_position; +varying flat float color; +void vertex() { + // Called for every vertex the material is visible on. + world_position = VERTEX; + color = COLOR.r; +} + +void fragment() { + // Called for every pixel the material is visible on. + float temp = sin((world_position.y-95.0) / 60.0); + + temp = clamp(temp, 0.0, 1)*28.0; + if (mode == 1) { + ALBEDO = vec3(COLOR.r, COLOR.g, COLOR.b); + } + if (mode == 2) + { + vec4 ree = texture(gradient, vec2(color)); + ALBEDO = vec3(ree.x, ree.y, ree.z); + } +} + +//void light() { +// // Called for every pixel for every light affecting the material. +// // Uncomment to replace the default light processing function with this one. +//} diff --git a/shaders/planet.gdshader.uid b/shaders/planet.gdshader.uid new file mode 100644 index 0000000..73f97f7 --- /dev/null +++ b/shaders/planet.gdshader.uid @@ -0,0 +1 @@ +uid://bi1msxvmhvcqf diff --git a/shaders/planet.tres b/shaders/planet.tres new file mode 100644 index 0000000..d075bda --- /dev/null +++ b/shaders/planet.tres @@ -0,0 +1,13 @@ +[gd_resource type="ShaderMaterial" format=3 uid="uid://c55st036tapeo"] + +[ext_resource type="Shader" uid="uid://bi1msxvmhvcqf" path="res://shaders/planet.gdshader" id="1_p4gwj"] +[ext_resource type="Gradient" uid="uid://b5l44rktieewe" path="res://resources/planet_gradient.tres" id="2_tjikr"] + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_5ojgt"] +gradient = ExtResource("2_tjikr") + +[resource] +render_priority = 0 +shader = ExtResource("1_p4gwj") +shader_parameter/mode = 1 +shader_parameter/gradient = SubResource("GradientTexture1D_5ojgt") diff --git a/src/Main.cs b/src/Main.cs new file mode 100644 index 0000000..6a0b529 --- /dev/null +++ b/src/Main.cs @@ -0,0 +1,139 @@ +#nullable enable +using Godot; +using System; +using System.Globalization; +using System.Linq; +using Godot.Collections; + +public partial class Main : Control +{ + private bool _moving = false; + [Export] + private Node3D _yawNode; + [Export] + private Node3D _pitchNode; + [Export] + private Camera3D _cameraNode; + + [Export] private float _moveSensitivity = 1f/500f; + [Export] private float _zoomSensitivity = 1f; + + [Export] private MeshInstance3D _meshInstance; + [Export] private Node3D World; + [Export] private TextureRect _textureRect; + + private PlanetHelper.VertexData? _vertex = null; + private PlanetHelper.PlateData? _plate = null; + + private PlanetHelper _planetHelper; + public override void _Ready() + { + _planetHelper = new PlanetHelper(_meshInstance, _textureRect); + UpdateStats(); + } + + private const float RayLength = 1000.0f; + public override void _Input(InputEvent @event) + { + if (@event is InputEventMouseButton mouseEvent) + { + if (mouseEvent.ButtonIndex == MouseButton.Left) + { + _moving = mouseEvent.Pressed; + } + if (mouseEvent.ButtonIndex == MouseButton.WheelUp) + { + _cameraNode.Position += new Vector3(0, 0, _zoomSensitivity); + } + + if (mouseEvent.ButtonIndex == MouseButton.WheelDown) + { + _cameraNode.Position -= new Vector3(0, 0, _zoomSensitivity); + } + } + else if (@event is InputEventMouseMotion motionEvent && _moving) + { + _yawNode.RotateY(-motionEvent.ScreenRelative.X * _moveSensitivity); + _pitchNode.RotateX(-motionEvent.ScreenRelative.Y * _moveSensitivity); + } + } + + public void Tab(int tab) + { + if (tab == 1) + { + Projector.GatherPoints(_planetHelper); + _textureRect.Texture = Projector.Render(_planetHelper); + } + } + + public override void _Process(double delta) + { + if (Input.IsActionJustPressed("mouse_secondary")) + { + var from = _cameraNode.ProjectRayOrigin(GetViewport().GetMousePosition()); + var to = from + _cameraNode.ProjectRayNormal(GetViewport().GetMousePosition()) * RayLength; + var result = World.GetWorld3D().DirectSpaceState.IntersectRay(PhysicsRayQueryParameters3D.Create(from, to)); + if (result.Count > 0) + { + Vector3? pos = result["position"].AsVector3(); + if (pos != null) + { + GD.Print($"Hit: '{pos}'"); + var closest = _planetHelper.Octree.SearchNearest(pos ?? Vector3.Zero)?.Id; + if (closest != null) + { + _vertex = _planetHelper.Vertices.Single(v => v.Id == closest); + if (_planetHelper.Plates.Count > 0 && _vertex.PlateId != -1) + _plate = _planetHelper.Plates[_vertex.PlateId]; + else + _plate = null; + UpdateStats(); + } + } + } + } + + if (Input.IsActionJustPressed("spacebar")) + { + _planetHelper.Advance = true; + } + if (Input.IsActionJustPressed("enter")) + { + _planetHelper.AutoRun = true; + } + _planetHelper.Process(); + } + public void UpdateStats() + { + if (_vertex != null) + { + var height = -9000f * (0.5f - _vertex.Height) * 2f; + GetNode