fixed projection pixel count, adjustable projection resolution, smaller initial resolution for projection, added button controls

This commit is contained in:
Aada 2026-03-03 07:34:13 +02:00
parent 6ca58040c4
commit 901177e2e4
4 changed files with 70 additions and 11 deletions

View file

@ -6,11 +6,8 @@ using System.Threading.Tasks;
public static class Projector
{
public static int[,] Points = new int[1024,512];
private static bool _gathered = false;
public static void GatherPoints(PlanetHelper helper, int resolutionH = 2048, bool regather = false)
public static void GatherPoints(PlanetHelper helper, int resolutionH = 2048)
{
if (!regather && _gathered)
return;
Points = new int[resolutionH,resolutionH / 2];
string filename = $"user://points-{resolutionH}-{resolutionH / 2}.dat";
if (FileAccess.FileExists(filename))
@ -44,13 +41,12 @@ public static class Projector
for (int x = 0; x < Points.GetLength(0); x++)
for (int y = 0; y < Points.GetLength(1); y++)
file.Store32((uint)Points[x,y]);
_gathered = true;
file.Close();
file.Close();
}
public static ImageTexture Render(PlanetHelper helper)
{
var image = Image.CreateEmpty(Points.GetLength(0) + 1, Points.GetLength(1) + 1, false, Image.Format.Rgb8);;
var image = Image.CreateEmpty(Points.GetLength(0), Points.GetLength(1), false, Image.Format.Rgb8);;
for (int x = 0; x < Points.GetLength(0); x++)
{