hypsographic curve
This commit is contained in:
parent
edffc76e05
commit
9a3be12f0f
7 changed files with 66 additions and 18 deletions
28
src/Main.cs
28
src/Main.cs
|
|
@ -31,9 +31,10 @@ 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);
|
||||
|
|
@ -109,7 +110,8 @@ public partial class Main : Control
|
|||
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.1f); // vertexPos * 1.01f;
|
||||
_pointerPosition = (Vector3)vertexPos + (vertexPos * (_vertex.Height + 0.01f) * 0.03f); // vertexPos * 1.01f;
|
||||
GetNode<Node3D>("%Pointer").GlobalPosition = _pointerPosition;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -124,12 +126,17 @@ public partial class Main : Control
|
|||
_planetHelper.AutoRun = true;
|
||||
}
|
||||
_planetHelper.Process();
|
||||
GetNode<Node3D>("%Pointer").GlobalPosition = _pointerPosition;
|
||||
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()
|
||||
{
|
||||
|
|
@ -160,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()
|
||||
|
|
@ -218,7 +225,7 @@ public partial class Main : Control
|
|||
{
|
||||
change = new string(change.Where(c => char.IsDigit(c)).ToArray());
|
||||
_resolution = Int32.Parse(change);
|
||||
_resolution = Math.Clamp(_resolution, 64, 2048);
|
||||
_resolution = Math.Clamp(_resolution, 4, 2048);
|
||||
}
|
||||
|
||||
public void AxialTiltChanged(string value)
|
||||
|
|
@ -242,4 +249,15 @@ public partial class Main : Control
|
|||
{
|
||||
_sunRotating = false;
|
||||
}
|
||||
private bool _planetRotating = false;
|
||||
private float _planetRotation = 0f;
|
||||
public void PlanetAngleStart()
|
||||
{
|
||||
_planetRotating = true;
|
||||
}
|
||||
|
||||
public void PlanetAngleStop(bool changed)
|
||||
{
|
||||
_planetRotating = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue