diff --git a/.forgejo/hypsographic-curve.jpg b/.forgejo/hypsographic-curve.jpg deleted file mode 100644 index 3e1efb9..0000000 --- a/.forgejo/hypsographic-curve.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:41b3a3cb6ccb59cf3a3eb40809ddbc1c7090eb5a7010854527e96d76da83b3d7 -size 56070 diff --git a/README.md b/README.md index c8dfb02..40fbab5 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,6 @@ This project is licensed under the MIT License - see the LICENSE.md file for det * [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) -* [Jyri Puputti](https://github.com/puputskov) - Math Genius -* [Mikael Mustonen](https://github.com/wastedalmond) - Color Genious ## End ![Exported Planet](.forgejo/export.png?raw=true) \ No newline at end of file diff --git a/assets/Planet9.glb b/assets/Planet9.glb deleted file mode 100644 index ee6d6d9..0000000 --- a/assets/Planet9.glb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0cce09bacc950488ad6080ba05dc8a4f5484306cd1525d30c5b1110f3fe1f974 -size 36791356 diff --git a/assets/Planet9.glb.import b/assets/Planet9.glb.import deleted file mode 100644 index 18aa6fd..0000000 --- a/assets/Planet9.glb.import +++ /dev/null @@ -1,54 +0,0 @@ -[remap] - -importer="scene" -importer_version=1 -type="PackedScene" -uid="uid://bqa8sh5xxe0s8" -path="res://.godot/imported/Planet9.glb-a48cb5485c47c247d4f1147b55356fd4.scn" - -[deps] - -source_file="res://assets/Planet9.glb" -dest_files=["res://.godot/imported/Planet9.glb-a48cb5485c47c247d4f1147b55356fd4.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=true -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": { -"Planet9_Icosphere": { -"generate/lightmap_uv": 0, -"generate/lods": 0, -"generate/shadow_meshes": 0, -"lods/normal_merge_angle": 20.0, -"save_to_file/enabled": true, -"save_to_file/fallback_path": "res://assets/Planet9.res", -"save_to_file/path": "uid://cb4avoh4i4smw" -} -} -} -gltf/naming_version=2 -gltf/embedded_image_handling=1 diff --git a/assets/Planet9.res b/assets/Planet9.res deleted file mode 100644 index 8d2c34a..0000000 --- a/assets/Planet9.res +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:da7ba1cc13a8e85ca000b27fe512f476c9c2cabc34a9fe20e7af7ab7229bc93b -size 78692425 diff --git a/assets/icosphere9.obj b/assets/icosphere9.obj deleted file mode 100644 index 75e2503..0000000 --- a/assets/icosphere9.obj +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:39c00ea88e8876fed0fcb8831a0c3c80d111eb35e42745e56401dc296a947f99 -size 135497005 diff --git a/assets/icosphere9.obj.import b/assets/icosphere9.obj.import deleted file mode 100644 index caa1155..0000000 --- a/assets/icosphere9.obj.import +++ /dev/null @@ -1,25 +0,0 @@ -[remap] - -importer="wavefront_obj" -importer_version=1 -type="Mesh" -uid="uid://dta10ebabswiy" -path="res://.godot/imported/icosphere9.obj-3c71916d073a9b5721f9a6889681dd1a.mesh" - -[deps] - -files=["res://.godot/imported/icosphere9.obj-3c71916d073a9b5721f9a6889681dd1a.mesh"] - -source_file="res://assets/icosphere9.obj" -dest_files=["res://.godot/imported/icosphere9.obj-3c71916d073a9b5721f9a6889681dd1a.mesh", "res://.godot/imported/icosphere9.obj-3c71916d073a9b5721f9a6889681dd1a.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/project.godot b/project.godot index 4543150..12b931d 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="adatonic" -config/version="0.0.4" +config/version="0.0.3" run/main_scene="uid://csfh7ptgerpm2" config/features=PackedStringArray("4.6", "C#", "GL Compatibility") config/icon="res://icon.svg" diff --git a/resources/fastnoise.tres b/resources/fastnoise.tres deleted file mode 100644 index 01d9433..0000000 --- a/resources/fastnoise.tres +++ /dev/null @@ -1,4 +0,0 @@ -[gd_resource type="FastNoiseLite" format=3 uid="uid://bec450igysexf"] - -[resource] -frequency = 0.027 diff --git a/resources/planet_gradient.tres b/resources/planet_gradient.tres index b5198ff..a7d0a93 100644 --- a/resources/planet_gradient.tres +++ b/resources/planet_gradient.tres @@ -1,5 +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.51515174, 0.5367887, 0.5766606, 0.7845561, 1) +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/remapcurve.tres b/resources/remapcurve.tres deleted file mode 100644 index 4cfeec3..0000000 --- a/resources/remapcurve.tres +++ /dev/null @@ -1,5 +0,0 @@ -[gd_resource type="Curve" format=3 uid="uid://d3jm8hqn6hf6v"] - -[resource] -_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.03899879, 0.2597651), 0.0, 0.0, 0, 0, Vector2(0.4429419, 0.37015414), 0.47422996, 0.47422996, 0, 0, Vector2(0.5, 0.5), 0.39357203, 0.39357203, 0, 0, Vector2(0.94081944, 0.64621437), 0.80014014, 0.80014014, 0, 0, Vector2(1, 1), 5.804001, 0.0, 0, 0] -point_count = 6 diff --git a/resources/stresscurve.tres b/resources/stresscurve.tres deleted file mode 100644 index 4cf642e..0000000 --- a/resources/stresscurve.tres +++ /dev/null @@ -1,5 +0,0 @@ -[gd_resource type="Curve" format=3 uid="uid://duabj1hpvrf2m"] - -[resource] -_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.5004223, 0.4959703), 2.8, 2.8, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0] -point_count = 3 diff --git a/resources/topogradient.tres b/resources/topogradient.tres deleted file mode 100644 index 0cd3a8a..0000000 --- a/resources/topogradient.tres +++ /dev/null @@ -1,5 +0,0 @@ -[gd_resource type="Gradient" format=3 uid="uid://dpafhsbw2t46k"] - -[resource] -offsets = PackedFloat32Array(0.30143952, 0.36898097, 0.4958336, 0.50410336, 0.51667744, 0.5272807, 0.5356805) -colors = PackedColorArray(0, 0, 0.54, 1, 0.34199998, 0.39780006, 0.9, 1, 0.070399985, 0.62362665, 0.88, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0.4569366, 0, 1, 1, 0, 0, 1) diff --git a/scenes/MainScene.tscn b/scenes/MainScene.tscn index cfb06e6..cf3ac9e 100644 --- a/scenes/MainScene.tscn +++ b/scenes/MainScene.tscn @@ -3,7 +3,6 @@ [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="Gradient" uid="uid://b5l44rktieewe" path="res://resources/planet_gradient.tres" id="2_ygjfp"] -[ext_resource type="Curve" uid="uid://d3jm8hqn6hf6v" path="res://resources/remapcurve.tres" id="3_1wiy7"] [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"] [ext_resource type="Texture2D" uid="uid://n56csi5ekat" path="res://icon.svg" id="5_ygjfp"] @@ -14,20 +13,13 @@ sky_material = SubResource("ProceduralSkyMaterial_uxrcv") [sub_resource type="Environment" id="Environment_rf2cd"] -background_mode = 1 -background_color = Color(0.11748905, 0.11748903, 0.11748903, 1) +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="CylinderMesh" id="CylinderMesh_ygjfp"] -top_radius = 0.005 -bottom_radius = 0.005 -height = 3.0 -radial_segments = 24 - [sub_resource type="SphereShape3D" id="SphereShape3D_rpqi1"] radius = 1.0 @@ -39,14 +31,13 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_611at") -_yawNode = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw") -_pitchNode = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch") -_cameraNode = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch/Camera3D") -_meshInstance = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Icosphere") -World = NodePath("TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo") +_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") _gradient = ExtResource("2_ygjfp") -_remapCurve = ExtResource("3_1wiy7") [node name="TabContainer" type="TabContainer" parent="." unique_id=1586027287] layout_mode = 1 @@ -61,93 +52,50 @@ current_tab = 0 layout_mode = 2 metadata/_tab_index = 0 -[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet" unique_id=1579792581] +[node name="SubViewportContainer" type="SubViewportContainer" parent="TabContainer/Planet" unique_id=58474785] layout_mode = 2 size_flags_horizontal = 3 size_flags_stretch_ratio = 1.44 - -[node name="SubViewportContainer" type="SubViewportContainer" parent="TabContainer/Planet/VBoxContainer" unique_id=58474785] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -size_flags_stretch_ratio = 1.44 stretch = true -[node name="SubViewport" type="SubViewport" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer" unique_id=1257998631] +[node name="SubViewport" type="SubViewport" parent="TabContainer/Planet/SubViewportContainer" unique_id=1257998631] handle_input_locally = false -size = Vector2i(677, 499) +size = Vector2i(677, 617) render_target_update_mode = 4 -[node name="ZaWarudo" type="Node3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport" unique_id=937719505] +[node name="ZaWarudo" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport" unique_id=937719505] -[node name="WorldEnvironment" type="WorldEnvironment" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=610642146] +[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="Sun" type="DirectionalLight3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=899426195] -unique_name_in_owner = true +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=899426195] transform = Transform3D(0.99999994, 0, 0, 0, 0.99999994, 0, 0, 0, 0.99999994, 0, 0, 0) -[node name="Icosphere" type="MeshInstance3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=793654005] +[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="MeshInstance3D" type="MeshInstance3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Icosphere" unique_id=1889403188] -transform = Transform3D(100, 0, 0, 0, 100, 0, 0, 0, 100, 0, 0, 0) -mesh = SubResource("CylinderMesh_ygjfp") +[node name="Yaw" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=2073443785] -[node name="Pointer" type="Sprite3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Icosphere" unique_id=1498529325] -unique_name_in_owner = true -modulate = Color(1, 0, 0, 1) -billboard = 1 -texture = ExtResource("5_ygjfp") +[node name="Pitch" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw" unique_id=98015529] -[node name="Yaw" type="Node3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=2073443785] - -[node name="Pitch" type="Node3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw" unique_id=98015529] - -[node name="Camera3D" type="Camera3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch" unique_id=1654616370] +[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/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=330930041] +[node name="StaticBody3D" type="StaticBody3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=330930041] -[node name="CollisionShape3D" type="CollisionShape3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo/StaticBody3D" unique_id=299495076] +[node name="CollisionShape3D" type="CollisionShape3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/StaticBody3D" unique_id=299495076] shape = SubResource("SphereShape3D_rpqi1") -[node name="MarginContainer" type="MarginContainer" parent="TabContainer/Planet/VBoxContainer" unique_id=1706135009] -layout_mode = 2 -theme_override_constants/margin_left = 8 -theme_override_constants/margin_top = 8 -theme_override_constants/margin_right = 8 -theme_override_constants/margin_bottom = 8 - -[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet/VBoxContainer/MarginContainer" unique_id=781791664] -layout_mode = 2 - -[node name="Label" type="Label" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=882691555] -layout_mode = 2 -text = "Sun Angle" -horizontal_alignment = 1 - -[node name="SunAngle" type="HSlider" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=1452623828] +[node name="Pointer" type="Sprite3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=1498529325] unique_name_in_owner = true -layout_mode = 2 -max_value = 360.0 - -[node name="HSeparator" type="HSeparator" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=1053749080] -layout_mode = 2 - -[node name="Label2" type="Label" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=473804807] -layout_mode = 2 -text = "Planet Rotation" -horizontal_alignment = 1 - -[node name="PlanetAngle" type="HSlider" parent="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer" unique_id=1574475714] -unique_name_in_owner = true -layout_mode = 2 -max_value = 360.0 +transform = Transform3D(0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0) +modulate = Color(1, 0, 0, 1) +billboard = 1 +texture = ExtResource("5_ygjfp") [node name="PanelContainer" type="PanelContainer" parent="TabContainer/Planet" unique_id=716838825] layout_mode = 2 @@ -163,24 +111,6 @@ theme_override_constants/margin_bottom = 12 [node name="VBoxContainer2" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer" unique_id=1788559732] layout_mode = 2 -[node name="VBoxContainer2" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2" unique_id=525897562] -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer2" unique_id=902181636] -layout_mode = 2 - -[node name="Label" type="Label" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer2/HBoxContainer" unique_id=1460559875] -layout_mode = 2 -text = "Axial Tilt" - -[node name="AxialTilt" type="LineEdit" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer2/HBoxContainer" unique_id=1085416630] -unique_name_in_owner = true -layout_mode = 2 -text = "23.5" - -[node name="HSeparator" type="HSeparator" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2" unique_id=907047328] -layout_mode = 2 - [node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2" unique_id=654818970] layout_mode = 2 size_flags_vertical = 3 @@ -327,13 +257,6 @@ stretch_mode = 5 metadata/_tab_index = 1 [connection signal="tab_changed" from="TabContainer" to="." method="Tab"] -[connection signal="mouse_entered" from="TabContainer/Planet/VBoxContainer/SubViewportContainer" to="." method="MouseInViewport"] -[connection signal="mouse_exited" from="TabContainer/Planet/VBoxContainer/SubViewportContainer" to="." method="MouseLeftViewport"] -[connection signal="drag_ended" from="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer/SunAngle" to="." method="SunAngleStop"] -[connection signal="drag_started" from="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer/SunAngle" to="." method="SunAngleStart"] -[connection signal="drag_ended" from="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer/PlanetAngle" to="." method="PlanetAngleStop"] -[connection signal="drag_started" from="TabContainer/Planet/VBoxContainer/MarginContainer/VBoxContainer/PlanetAngle" to="." method="PlanetAngleStart"] -[connection signal="text_changed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer2/HBoxContainer/AxialTilt" to="." method="AxialTiltChanged"] [connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/Reset" to="." method="MakeGo"] [connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/Advance" to="." method="Advance"] [connection signal="pressed" from="TabContainer/Planet/PanelContainer/MarginContainer/VBoxContainer2/VBoxContainer/HBoxContainer3/AutoRun" to="." method="AutoRun"] diff --git a/shaders/planet.gdshader b/shaders/planet.gdshader index 36376be..56ca46b 100644 --- a/shaders/planet.gdshader +++ b/shaders/planet.gdshader @@ -1,4 +1,5 @@ shader_type spatial; +render_mode unshaded; uniform int mode = 1; uniform sampler2D gradient; @@ -8,7 +9,7 @@ void vertex() { // Called for every vertex the material is visible on. world_position = VERTEX; color = COLOR.r; - VERTEX += VERTEX * COLOR.q * 0.03f; + VERTEX += VERTEX * COLOR.q * 0.1f; } void fragment() { diff --git a/src/Main.cs b/src/Main.cs index 2f58cc4..737d63b 100644 --- a/src/Main.cs +++ b/src/Main.cs @@ -8,7 +8,6 @@ using Godot.Collections; public partial class Main : Control { - public static Random Random = Random.Shared; private bool _moving = false; [Export] private Node3D _yawNode; @@ -31,35 +30,22 @@ public partial class Main : Control private int _resolution = 512; private PlanetHelper _planetHelper; - [Export] private Curve _remapCurve; public override void _Ready() { - _planetHelper = new PlanetHelper(_meshInstance, _textureRect, _remapCurve); + _planetHelper = new PlanetHelper(_meshInstance, _textureRect); UpdateStats(); Projector.GatherPoints(_planetHelper, int.Parse(GetNode("%Resolution").Text)); - AxialTiltChanged(GetNode("%AxialTilt").Text); } Vector3 _pointerPosition = Vector3.Zero; private const float RayLength = 1000.0f; - - private bool _rotateable = false; - public void MouseInViewport() - { - _rotateable = true; - } - - public void MouseLeftViewport() - { - _rotateable = false; - } public override void _Input(InputEvent @event) { if (@event is InputEventMouseButton mouseEvent) { if (mouseEvent.ButtonIndex == MouseButton.Left) { - _moving = mouseEvent.Pressed && _rotateable; + _moving = mouseEvent.Pressed; } if (mouseEvent.ButtonIndex == MouseButton.WheelUp) { @@ -97,8 +83,8 @@ public partial class Main : Control if (result.Count > 0) { Vector3 pos = result["position"].AsVector3(); + GD.Print($"Hit: '{pos}'"); - pos *= _meshInstance.Transform.Basis.Orthonormalized(); var closest = _planetHelper.Octree.SearchNearest(pos)?.Id; if (closest != null) { @@ -109,9 +95,7 @@ public partial class Main : Control _plate = null; UpdateStats(); Vector3 vertexPos = _planetHelper.Mdt.GetVertex(_vertex.Id) * 0.01f; - vertexPos *= _meshInstance.Transform.Basis.Inverse().Orthonormalized(); - _pointerPosition = (Vector3)vertexPos + (vertexPos * (_vertex.Height + 0.01f) * 0.03f); // vertexPos * 1.01f; - GetNode("%Pointer").GlobalPosition = _pointerPosition; + _pointerPosition = (Vector3)vertexPos + (vertexPos * (_vertex.Height + 0.01f) * 0.1f); // vertexPos * 1.01f; } } @@ -126,17 +110,7 @@ public partial class Main : Control _planetHelper.AutoRun = true; } _planetHelper.Process(); - if (_sunRotating) - { - GetNode("%Sun").Rotation -= GetNode("%Sun").Rotation; - GetNode("%Sun").Rotation += new Vector3(0, (float)Mathf.DegToRad(GetNode("%SunAngle").Value), 0); - } - if (_planetRotating) - { - _meshInstance.Rotation = Vector3.Zero; - _meshInstance.RotateY((float)Mathf.DegToRad(GetNode("%PlanetAngle").Value)); - _meshInstance.RotateZ(Mathf.DegToRad(_axialTilt)); - } + GetNode("%Pointer").Position = _pointerPosition; } public void UpdateStats() { @@ -167,7 +141,7 @@ public partial class Main : Control public void MakeGo() { - _planetHelper = new PlanetHelper(_meshInstance, _textureRect, _remapCurve); + _planetHelper = new PlanetHelper(_meshInstance, _textureRect); } public void Advance() @@ -225,39 +199,6 @@ public partial class Main : Control { change = new string(change.Where(c => char.IsDigit(c)).ToArray()); _resolution = Int32.Parse(change); - _resolution = Math.Clamp(_resolution, 4, 2048); - } - - public void AxialTiltChanged(string value) - { - if (float.TryParse(value, out float tilt)) - { - _meshInstance.RotateZ(-_meshInstance.Rotation.Z); - _meshInstance.RotateZ(Mathf.DegToRad(tilt)); - _axialTilt = tilt; - } - } - - private bool _sunRotating = false; - private float _axialTilt = 0f; - public void SunAngleStart() - { - _sunRotating = true; - } - - public void SunAngleStop(bool changed) - { - _sunRotating = false; - } - private bool _planetRotating = false; - private float _planetRotation = 0f; - public void PlanetAngleStart() - { - _planetRotating = true; - } - - public void PlanetAngleStop(bool changed) - { - _planetRotating = false; + _resolution = Math.Clamp(_resolution, 64, 2048); } } diff --git a/src/PlanetHelper.cs b/src/PlanetHelper.cs index 34122b5..291f4e0 100644 --- a/src/PlanetHelper.cs +++ b/src/PlanetHelper.cs @@ -13,7 +13,7 @@ public class PlanetHelper { public static float RandF(float min, float max) { - return min + (max - min) * Main.Random.NextSingle(); + return min + (max - min) * Random.Shared.NextSingle(); } public class PlateData(int Id = 0, Color Color = new(), bool IsLandform = false, List Vertices = null) { @@ -99,14 +99,12 @@ public class PlanetHelper public MeshDataTool Mdt; public Oct Octree = new Oct(); - - private Curve _remapCurve; - public PlanetHelper(MeshInstance3D meshInstance, TextureRect textureRect, Curve remapCurve) + + public PlanetHelper(MeshInstance3D meshInstance, TextureRect textureRect) { _meshInstance = meshInstance; _arrayMesh = meshInstance.Mesh as ArrayMesh; _textureRect = textureRect; - _remapCurve = remapCurve; _continentalNoise = new FastNoiseLite(); _mountainNoise = new FastNoiseLite(); @@ -117,7 +115,7 @@ public class PlanetHelper for (int i = 0; i < Mdt.GetVertexCount(); i++) { - Octree.Insert(new Node(i, Mdt.GetVertex(i) * 0.01f)); + Octree.Insert(new Node(i, Mdt.GetVertex(i) * 0.001f)); Mdt.SetVertexColor(i, Colors.Black); } if (_meshInstance.GetSurfaceOverrideMaterial(0) is ShaderMaterial shaderMaterial) @@ -436,7 +434,7 @@ public class PlanetHelper } public void SpreadStress() { - var availableVerts = Vertices.Where(d => d.StageComplete == false && d.IsEdge && d.StrainSamples.Any()).OrderByDescending(d => Mathf.Abs(d.StrainSamples.Max(s => s.Magnitude))).Take(2500).ToList(); + var availableVerts = Vertices.Where(d => d.StageComplete == false && d.IsEdge && d.StrainSamples.Any()).OrderByDescending(d => Mathf.Abs(d.StrainSamples.Max(s => s.Magnitude))).Take(500).ToList(); foreach (VertexData vertexData in availableVerts) { var neighbours = GetNeighboringVertices(vertexData.Id, false).ToList(); @@ -493,7 +491,7 @@ public class PlanetHelper float mountainNoise = (1.0f + _mountainNoise.GetNoise3Dv(GetVertexPosition(vertexData.Id))) * 0.5f; float hfNoise = _hfNoise.GetNoise3Dv(GetVertexPosition(vertexData.Id)); var majorStrain = AverageStrainList(vertexData.StrainSamples); - var normalRate = -majorStrain.NormalRate * majorStrain.Magnitude; // * (plate.IsLandform ? 1f : 0.5f); + var normalRate = -majorStrain.NormalRate * majorStrain.Magnitude * (plate.IsLandform ? 1f : 0.5f); var edgeDistance = vertexData.EdgeDistance * (plate.IsLandform ? 1f : -1f); float height = 0.5f; //height *= plate.PlateExpansion; @@ -504,7 +502,7 @@ public class PlanetHelper height = (height + 0.5f * mult) / (1f + mult); height += edgeDistance * 0.25f; height = (height + 0.5f * mult) / (1f + mult); - height += normalRate * 0.5f; + height += normalRate * 0.35f; height = Mathf.Clamp(height, 0.01f, 0.99f); ColorVertex(vertexData.Id, Colors.White * height); vertexData.StageComplete = true; @@ -515,12 +513,8 @@ public class PlanetHelper { GD.Print($"Heights - min:'{Vertices.Min(v => v.Height)}' - max:'{Vertices.Max(v => v.Height)}' - average:'{Vertices.Average(v => v.Height)}'"); ScaleValues(Vertices); - foreach (VertexData vertexData in Vertices) - { - vertexData.Height = _remapCurve.Sample(vertexData.Height); ColorVertex(vertexData.Id, Colors.White * vertexData.Height); - } float oceanPercentage = Vertices.Count(v => v.Height < 0.5f) / (float)Vertices.Count; GD.Print($"Ocean Percentage:'{oceanPercentage}'"); CompleteStage();