Compare commits
9 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe79f4fe89 | ||
|
|
9a3be12f0f | ||
|
|
edffc76e05 | ||
| 63f4423baf | |||
|
|
a780ef479d | ||
|
|
930ed42150 | ||
|
|
df46846953 | ||
| eb764ebc5e | |||
|
|
9c7d57e553 |
19 changed files with 373 additions and 86 deletions
BIN
.forgejo/export.png
(Stored with Git LFS)
Normal file
BIN
.forgejo/export.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
.forgejo/hypsographic-curve.jpg
(Stored with Git LFS)
Normal file
BIN
.forgejo/hypsographic-curve.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -49,4 +49,9 @@ 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)
|
||||
* [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
|
||||

|
||||
BIN
assets/Planet9.glb
(Stored with Git LFS)
Normal file
BIN
assets/Planet9.glb
(Stored with Git LFS)
Normal file
Binary file not shown.
54
assets/Planet9.glb.import
Normal file
54
assets/Planet9.glb.import
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
[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
|
||||
BIN
assets/Planet9.res
(Stored with Git LFS)
Normal file
BIN
assets/Planet9.res
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/icosphere9.obj
(Stored with Git LFS)
Normal file
BIN
assets/icosphere9.obj
(Stored with Git LFS)
Normal file
Binary file not shown.
25
assets/icosphere9.obj.import
Normal file
25
assets/icosphere9.obj.import
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[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
|
||||
|
|
@ -3,19 +3,20 @@
|
|||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://n56csi5ekat"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
|
|
@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
|
|||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
|
|
@ -37,7 +38,7 @@ 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
|
||||
detect_3d/compress_to=0
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="adatonic"
|
||||
config/version="0.0.1"
|
||||
config/version="0.0.4"
|
||||
run/main_scene="uid://csfh7ptgerpm2"
|
||||
config/features=PackedStringArray("4.6", "C#", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
|
|
|||
4
resources/fastnoise.tres
Normal file
4
resources/fastnoise.tres
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[gd_resource type="FastNoiseLite" format=3 uid="uid://bec450igysexf"]
|
||||
|
||||
[resource]
|
||||
frequency = 0.027
|
||||
|
|
@ -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.52932715, 0.5585736, 0.6065243, 0.65517426, 1)
|
||||
offsets = PackedFloat32Array(0.020102732, 0.21077614, 0.4361486, 0.4835682, 0.49508524, 0.49909908, 0.51515174, 0.5367887, 0.5766606, 0.7845561, 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)
|
||||
|
|
|
|||
5
resources/remapcurve.tres
Normal file
5
resources/remapcurve.tres
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[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
|
||||
5
resources/stresscurve.tres
Normal file
5
resources/stresscurve.tres
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[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
|
||||
5
resources/topogradient.tres
Normal file
5
resources/topogradient.tres
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[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)
|
||||
|
|
@ -3,8 +3,10 @@
|
|||
[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"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_uxrcv"]
|
||||
|
||||
|
|
@ -12,13 +14,20 @@
|
|||
sky_material = SubResource("ProceduralSkyMaterial_uxrcv")
|
||||
|
||||
[sub_resource type="Environment" id="Environment_rf2cd"]
|
||||
background_mode = 2
|
||||
background_mode = 1
|
||||
background_color = Color(0.11748905, 0.11748903, 0.11748903, 1)
|
||||
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
|
||||
|
||||
|
|
@ -30,13 +39,14 @@ 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")
|
||||
_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")
|
||||
_textureRect = NodePath("TabContainer/Projection")
|
||||
_gradient = ExtResource("2_ygjfp")
|
||||
_remapCurve = ExtResource("3_1wiy7")
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="." unique_id=1586027287]
|
||||
layout_mode = 1
|
||||
|
|
@ -51,44 +61,94 @@ current_tab = 0
|
|||
layout_mode = 2
|
||||
metadata/_tab_index = 0
|
||||
|
||||
[node name="SubViewportContainer" type="SubViewportContainer" parent="TabContainer/Planet" unique_id=58474785]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Planet" unique_id=1579792581]
|
||||
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/SubViewportContainer" unique_id=1257998631]
|
||||
[node name="SubViewport" type="SubViewport" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer" unique_id=1257998631]
|
||||
handle_input_locally = false
|
||||
size = Vector2i(677, 617)
|
||||
size = Vector2i(677, 499)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="ZaWarudo" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport" unique_id=937719505]
|
||||
[node name="ZaWarudo" type="Node3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport" unique_id=937719505]
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo" unique_id=610642146]
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="TabContainer/Planet/VBoxContainer/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="Sun" type="DirectionalLight3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=899426195]
|
||||
unique_name_in_owner = true
|
||||
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/SubViewportContainer/SubViewport/ZaWarudo" unique_id=793654005]
|
||||
[node name="Icosphere" type="MeshInstance3D" parent="TabContainer/Planet/VBoxContainer/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="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="Pitch" type="Node3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw" unique_id=98015529]
|
||||
[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="Camera3D" type="Camera3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/Yaw/Pitch" unique_id=1654616370]
|
||||
[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]
|
||||
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="StaticBody3D" type="StaticBody3D" parent="TabContainer/Planet/VBoxContainer/SubViewportContainer/SubViewport/ZaWarudo" unique_id=330930041]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TabContainer/Planet/SubViewportContainer/SubViewport/ZaWarudo/StaticBody3D" unique_id=299495076]
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="TabContainer/Planet/VBoxContainer/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]
|
||||
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
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="TabContainer/Planet" unique_id=716838825]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
|
@ -103,6 +163,24 @@ 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
|
||||
|
|
@ -249,6 +327,13 @@ 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"]
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
shader_type spatial;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform int mode = 1;
|
||||
uniform sampler2D gradient;
|
||||
varying vec3 world_position;
|
||||
varying flat float color;
|
||||
varying float color;
|
||||
void vertex() {
|
||||
// Called for every vertex the material is visible on.
|
||||
world_position = VERTEX;
|
||||
color = COLOR.r;
|
||||
VERTEX += VERTEX * COLOR.q * 0.03f;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
|
|
|
|||
100
src/Main.cs
100
src/Main.cs
|
|
@ -8,6 +8,7 @@ using Godot.Collections;
|
|||
|
||||
public partial class Main : Control
|
||||
{
|
||||
public static Random Random = Random.Shared;
|
||||
private bool _moving = false;
|
||||
[Export]
|
||||
private Node3D _yawNode;
|
||||
|
|
@ -30,21 +31,35 @@ 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);
|
||||
_planetHelper = new PlanetHelper(_meshInstance, _textureRect, _remapCurve);
|
||||
UpdateStats();
|
||||
Projector.GatherPoints(_planetHelper, int.Parse(GetNode<LineEdit>("%Resolution").Text));
|
||||
AxialTiltChanged(GetNode<LineEdit>("%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;
|
||||
_moving = mouseEvent.Pressed && _rotateable;
|
||||
}
|
||||
if (mouseEvent.ButtonIndex == MouseButton.WheelUp)
|
||||
{
|
||||
|
|
@ -76,26 +91,29 @@ public partial class Main : Control
|
|||
{
|
||||
if (Input.IsActionJustPressed("mouse_secondary"))
|
||||
{
|
||||
var from = _cameraNode.ProjectRayOrigin(GetViewport().GetMousePosition());
|
||||
var to = from + _cameraNode.ProjectRayNormal(GetViewport().GetMousePosition()) * RayLength;
|
||||
var from = _cameraNode.ProjectRayOrigin(_cameraNode.GetViewport().GetMousePosition());
|
||||
var to = from + _cameraNode.ProjectRayNormal(_cameraNode.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)
|
||||
Vector3 pos = result["position"].AsVector3();
|
||||
GD.Print($"Hit: '{pos}'");
|
||||
pos *= _meshInstance.Transform.Basis.Orthonormalized();
|
||||
var closest = _planetHelper.Octree.SearchNearest(pos)?.Id;
|
||||
if (closest != 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();
|
||||
}
|
||||
_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();
|
||||
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<Node3D>("%Pointer").GlobalPosition = _pointerPosition;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,6 +126,17 @@ public partial class Main : Control
|
|||
_planetHelper.AutoRun = true;
|
||||
}
|
||||
_planetHelper.Process();
|
||||
if (_sunRotating)
|
||||
{
|
||||
GetNode<Node3D>("%Sun").Rotation -= GetNode<Node3D>("%Sun").Rotation;
|
||||
GetNode<Node3D>("%Sun").Rotation += new Vector3(0, (float)Mathf.DegToRad(GetNode<HSlider>("%SunAngle").Value), 0);
|
||||
}
|
||||
if (_planetRotating)
|
||||
{
|
||||
_meshInstance.Rotation = Vector3.Zero;
|
||||
_meshInstance.RotateY((float)Mathf.DegToRad(GetNode<HSlider>("%PlanetAngle").Value));
|
||||
_meshInstance.RotateZ(Mathf.DegToRad(_axialTilt));
|
||||
}
|
||||
}
|
||||
public void UpdateStats()
|
||||
{
|
||||
|
|
@ -138,7 +167,7 @@ public partial class Main : Control
|
|||
|
||||
public void MakeGo()
|
||||
{
|
||||
_planetHelper = new PlanetHelper(_meshInstance, _textureRect);
|
||||
_planetHelper = new PlanetHelper(_meshInstance, _textureRect, _remapCurve);
|
||||
}
|
||||
|
||||
public void Advance()
|
||||
|
|
@ -196,6 +225,39 @@ public partial class Main : Control
|
|||
{
|
||||
change = new string(change.Where(c => char.IsDigit(c)).ToArray());
|
||||
_resolution = Int32.Parse(change);
|
||||
_resolution = Math.Clamp(_resolution, 64, 8192);
|
||||
_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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using Godot;
|
|||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using adatonic;
|
||||
using Node = adatonic.Node;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
|
@ -12,7 +13,7 @@ public class PlanetHelper
|
|||
{
|
||||
public static float RandF(float min, float max)
|
||||
{
|
||||
return min + (max - min) * Random.Shared.NextSingle();
|
||||
return min + (max - min) * Main.Random.NextSingle();
|
||||
}
|
||||
public class PlateData(int Id = 0, Color Color = new(), bool IsLandform = false, List<int> Vertices = null)
|
||||
{
|
||||
|
|
@ -23,7 +24,8 @@ public class PlanetHelper
|
|||
|
||||
public int CenterVertexId = -1;
|
||||
public float PlateExpansion { get; set; } = RandF(0.5f, 2f);
|
||||
public Vector3 Dir { get; set; } = Vector3.Zero;
|
||||
public Vector3 MovementAxis { get; set; } = Vector3.Zero;
|
||||
public float MovementSpeed { get; set; } = RandF(0f, 1f);
|
||||
}
|
||||
|
||||
public class VertexData(int Id = 0, int PlateId = 0, List<int> Neighbours = null, bool StageComplete = false)
|
||||
|
|
@ -97,12 +99,14 @@ public class PlanetHelper
|
|||
public MeshDataTool Mdt;
|
||||
|
||||
public Oct Octree = new Oct();
|
||||
|
||||
public PlanetHelper(MeshInstance3D meshInstance, TextureRect textureRect)
|
||||
|
||||
private Curve _remapCurve;
|
||||
public PlanetHelper(MeshInstance3D meshInstance, TextureRect textureRect, Curve remapCurve)
|
||||
{
|
||||
_meshInstance = meshInstance;
|
||||
_arrayMesh = meshInstance.Mesh as ArrayMesh;
|
||||
_textureRect = textureRect;
|
||||
_remapCurve = remapCurve;
|
||||
|
||||
_continentalNoise = new FastNoiseLite();
|
||||
_mountainNoise = new FastNoiseLite();
|
||||
|
|
@ -113,7 +117,7 @@ public class PlanetHelper
|
|||
|
||||
for (int i = 0; i < Mdt.GetVertexCount(); i++)
|
||||
{
|
||||
Octree.Insert(new Node(i, Mdt.GetVertex(i) * 0.001f));
|
||||
Octree.Insert(new Node(i, Mdt.GetVertex(i) * 0.01f));
|
||||
Mdt.SetVertexColor(i, Colors.Black);
|
||||
}
|
||||
if (_meshInstance.GetSurfaceOverrideMaterial(0) is ShaderMaterial shaderMaterial)
|
||||
|
|
@ -152,7 +156,7 @@ public class PlanetHelper
|
|||
ColorVertex(vertex.Id, color);
|
||||
PlateData plate = new PlateData(i, color, false, [vertex.Id]);
|
||||
|
||||
plate.Dir = GetRandomTangentialVelocity(Mdt.GetVertex(vertex.Id), RandF(0f, 1f));
|
||||
plate.MovementAxis = GetRandomVector3();
|
||||
Plates.Add(plate);
|
||||
}
|
||||
|
||||
|
|
@ -172,7 +176,14 @@ public class PlanetHelper
|
|||
return verts.Except([vertexId]);
|
||||
return verts.Where(v => Mdt.GetVertexColor(v) == Colors.Black).Except([vertexId]);
|
||||
}
|
||||
|
||||
|
||||
public Vector3 GetRandomVector3()
|
||||
{
|
||||
Vector3 vec = Vector3.Up;
|
||||
vec = vec.Rotated(Vector3.Forward, Mathf.DegToRad(RandF(0, 180f)));
|
||||
vec = vec.Rotated(Vector3.Up, Mathf.DegToRad(RandF(0, 360f)));
|
||||
return vec.Normalized();
|
||||
}
|
||||
public Vector3 GetRandomTangentialVelocity(Vector3 pointOnSphere, float speed)
|
||||
{
|
||||
Vector3 normal = pointOnSphere.Normalized();
|
||||
|
|
@ -392,12 +403,15 @@ public class PlanetHelper
|
|||
VertexData centerA = Vertices[plateA.CenterVertexId];
|
||||
VertexData centerB = Vertices[plateB.CenterVertexId];
|
||||
Vector3 p1, p2;
|
||||
p1 = Mdt.GetVertex(vertexData.Id).Cross(Mdt.GetVertex(centerA.Id));
|
||||
p2 = Mdt.GetVertex(neighbour).Cross(Mdt.GetVertex(centerB.Id));
|
||||
vertexData.StrainSamples.Add(CalculateStrainMagnitude(p1, p2, plateA.Dir, plateB.Dir));
|
||||
p1 = Mdt.GetVertex(vertexData.Id);
|
||||
p2 = Mdt.GetVertex(neighbour);
|
||||
Vector3 vel1 = ((p1 - p1.Rotated(plateA.MovementAxis, Mathf.DegToRad(1))).Normalized()) * plateA.MovementSpeed;
|
||||
Vector3 vel2 = ((p2 - p2.Rotated(plateB.MovementAxis, Mathf.DegToRad(1))).Normalized()) * plateB.MovementSpeed;
|
||||
vertexData.StrainSamples.Add(CalculateStrainMagnitude(p1, p2, vel1, vel2));
|
||||
}
|
||||
vertexData.StageComplete = true;
|
||||
var majorStrain = AverageStrainList(vertexData.StrainSamples);
|
||||
vertexData.StrainSamples = [majorStrain];
|
||||
switch (majorStrain.Type)
|
||||
{
|
||||
case StrainType.Compression:
|
||||
|
|
@ -422,41 +436,41 @@ public class PlanetHelper
|
|||
}
|
||||
public void SpreadStress()
|
||||
{
|
||||
var availableVerts = Vertices.Where(d => d.StageComplete == false && d.IsEdge && d.StrainSamples.Any()).OrderBy(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(2500).ToList();
|
||||
foreach (VertexData vertexData in availableVerts)
|
||||
{
|
||||
var neighbours = GetNeighboringVertices(vertexData.Id, false).ToList();
|
||||
var majorStrain = AverageStrainList(vertexData.StrainSamples);
|
||||
List<StrainAnalysis> localStrains = [];
|
||||
foreach (int neighbour in neighbours)
|
||||
{
|
||||
localStrains.AddRange(Vertices[neighbour].StrainSamples);
|
||||
}
|
||||
localStrains.AddRange(vertexData.StrainSamples);
|
||||
var averageStrain = AverageStrainList(localStrains);
|
||||
averageStrain.Magnitude *= 0.9f;
|
||||
averageStrain.NormalRate *= 0.9f;
|
||||
averageStrain.ShearRate *= 0.9f;
|
||||
foreach (int neighbour in neighbours)
|
||||
{
|
||||
VertexData neighbourVert = Vertices[neighbour];
|
||||
neighbourVert.IsEdge = true;
|
||||
|
||||
var newStrain = new StrainAnalysis();
|
||||
newStrain.Magnitude = majorStrain.Magnitude * 0.9f;
|
||||
newStrain.Type = majorStrain.Type;
|
||||
newStrain.NormalRate = majorStrain.NormalRate * 0.9f;
|
||||
newStrain.ShearRate = majorStrain.ShearRate * 0.9f;
|
||||
neighbourVert.StrainSamples.Add(newStrain);
|
||||
var newAverage = AverageStrainList(neighbourVert.StrainSamples);;
|
||||
neighbourVert.StrainSamples.Add(averageStrain);
|
||||
switch (majorStrain.Type)
|
||||
{
|
||||
case StrainType.Compression:
|
||||
ColorVertex(neighbourVert.Id, Colors.Red * newAverage.Magnitude);
|
||||
ColorVertex(neighbourVert.Id, Colors.Red * averageStrain.Magnitude);
|
||||
break;
|
||||
case StrainType.Shear:
|
||||
ColorVertex(neighbourVert.Id, Colors.Yellow * newAverage.Magnitude);
|
||||
ColorVertex(neighbourVert.Id, Colors.Yellow * averageStrain.Magnitude);
|
||||
break;
|
||||
case StrainType.Tension:
|
||||
ColorVertex(neighbourVert.Id, Colors.Blue * newAverage.Magnitude);
|
||||
ColorVertex(neighbourVert.Id, Colors.Blue * averageStrain.Magnitude);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (neighbours.All(n => Vertices[n].IsEdge))
|
||||
{
|
||||
vertexData.StageComplete = true;
|
||||
}
|
||||
vertexData.StrainSamples = [AverageStrainList(vertexData.StrainSamples)];
|
||||
vertexData.StageComplete = true;
|
||||
}
|
||||
|
||||
if (!availableVerts.Any())
|
||||
|
|
@ -479,7 +493,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;
|
||||
|
|
@ -490,7 +504,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.35f;
|
||||
height += normalRate * 0.5f;
|
||||
height = Mathf.Clamp(height, 0.01f, 0.99f);
|
||||
ColorVertex(vertexData.Id, Colors.White * height);
|
||||
vertexData.StageComplete = true;
|
||||
|
|
@ -501,8 +515,12 @@ 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();
|
||||
|
|
@ -631,10 +649,11 @@ public class PlanetHelper
|
|||
|
||||
double bestDiff = double.MaxValue;
|
||||
int bestMask = 0;
|
||||
|
||||
object lobject = new();
|
||||
int combinations = 1 << n;
|
||||
|
||||
for (int mask = 0; mask < combinations; mask++)
|
||||
var combs = Enumerable.Range(0, combinations / 4).Select(value => value * 4).ToList();
|
||||
combinations = combs.Count;
|
||||
Parallel.ForEach(combs, mask =>
|
||||
{
|
||||
int oceanArea = 0;
|
||||
|
||||
|
|
@ -645,13 +664,15 @@ public class PlanetHelper
|
|||
}
|
||||
|
||||
double diff = Math.Abs(oceanArea - targetOcean);
|
||||
|
||||
if (diff < bestDiff)
|
||||
lock (lobject)
|
||||
{
|
||||
bestDiff = diff;
|
||||
bestMask = mask;
|
||||
if (diff < bestDiff)
|
||||
{
|
||||
bestDiff = diff;
|
||||
bestMask = mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue