champions-of-luneraria/Assets/Luneraria/Editor/World/LuneWorldBake.cs
Martin Stickelbroeck 8a72cb165a U2B World Geometry
G1-Karte in Unity (Assets/Luneraria/Scenes/G1_Map.unity), reproduzierbar
gebaut aus dem Godot-Weltgenerator (gebacken), den FBX-Modellen aus U2A und der
Karte des C#-Kerns.

- tools/godot-golden/world_export.gd: backt Gelände (Raster, Farben, Lauf- und
  Standhöhen), Lanebeläge, Plattform, Brücke, Randsteine, Basen, Landmarken,
  Vegetation, Adern, Grottentreppen, Aufstellungsbereiche und Licht. Braucht
  einen echten Renderer (HEADLESS=0); prüft auf Headless-Einheitstransformationen.
- LuneWorldBuilder: Meshes (GUID-stabil), Szene, Licht, Himmel, Post-Processing,
  16 Türme, 2 Ancients und die Grotte aus LuneMap mit Teammaterialien.
- Materialsystem: Luneraria/Surface (Gelände, Kluft-Oberflächen, Fluss, Adern,
  Kristall, G2-Werte mit Teamvarianten und Vertex-AO) und Luneraria/Pad;
  LuneMaterialSet.Dress wie Godots dress.
- View-Assembly: LuneSpace (Unity = (-x, h, y)), LuneGround, LuneCameraMath,
  LuneBuildingView (Zustände intakt bis Ruine).
- Vergleichsbilder mit den Kameraeinstellungen der Godot-G2-Aufnahmen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 16:01:25 +02:00

54 lines
1.7 KiB
C#

using System;
using System.IO;
using Newtonsoft.Json.Linq;
namespace Luneraria.EditorTools
{
/// <summary>
/// The world bake of tools/godot-golden/world_export.gd: g1_world.json (structure, transforms,
/// materials) and g1_world.bytes (little-endian arrays referenced as [offset, count]).
/// </summary>
public sealed class LuneWorldBake
{
public const string Folder = "Assets/Luneraria/World/Bake";
public readonly JObject Data;
readonly byte[] _blob;
LuneWorldBake(JObject data, byte[] blob)
{
Data = data;
_blob = blob;
}
public static LuneWorldBake Load(string folder = Folder)
{
return new LuneWorldBake(JObject.Parse(File.ReadAllText(Path.Combine(folder, "g1_world.json"))), File.ReadAllBytes(Path.Combine(folder, "g1_world.bytes")));
}
public float[] Floats(JToken reference, int components = 1)
{
int offset = (int)reference[0];
int count = (int)reference[1] * components;
var values = new float[count];
Buffer.BlockCopy(_blob, offset, values, 0, count * 4);
return values;
}
public int[] Ints(JToken reference)
{
int offset = (int)reference[0];
int count = (int)reference[1];
var values = new int[count];
Buffer.BlockCopy(_blob, offset, values, 0, count * 4);
return values;
}
public static float[] Transform(JToken values)
{
var result = new float[12];
for (int i = 0; i < 12; i++)
result[i] = (float)values[i];
return result;
}
}
}