Publish gravity fog through generic Eve fields

This commit is contained in:
Meta Vens 2026-07-15 20:17:05 +01:00
commit 6f0375f4ad
22 changed files with 293 additions and 230 deletions

View file

@ -26,7 +26,7 @@ public sealed class AetheriaRenderSplatLayerRenderer : MonoBehaviour
return false;
}
public void Render(AetheriaRuntimeRenderSplatsViewportDocument document, int width, int height)
public void Render(EveFieldsSplatsDocument document, int width, int height)
{
if (document == null) return;
ResolveRenderer();

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using GameCult.Aetheria.State.Verse;
using GameCult.Eve.PluginFields;
using UnityEngine;
public sealed class AetheriaSceneRenderSplatSource : MonoBehaviour
@ -43,7 +44,7 @@ public sealed class AetheriaSceneRenderSplatSource : MonoBehaviour
[SerializeField]
private AetheriaSceneRenderSplatFixture[] fixtures = Array.Empty<AetheriaSceneRenderSplatFixture>();
public AetheriaRuntimeRenderSplatsViewportDocument BuildDocument(AetheriaRuntimeViewportBounds viewport)
public EveFieldsSplatsDocument BuildDocument(AetheriaRuntimeViewportBounds viewport)
{
viewport ??= new AetheriaRuntimeViewportBounds();
var normalizedViewport = Normalize(viewport);
@ -58,13 +59,19 @@ public sealed class AetheriaSceneRenderSplatSource : MonoBehaviour
foreach (var fixture in fixtures ?? Array.Empty<AetheriaSceneRenderSplatFixture>())
fixture.AddTo(builder, layerIndices);
return new AetheriaRuntimeRenderSplatsViewportDocument
return new EveFieldsSplatsDocument
{
PublishedAtUtc = DateTimeOffset.UtcNow.ToString("O"),
SimulationTimeSeconds = Application.isPlaying ? Time.timeAsDouble : 0,
RunId = "scene",
ZoneName = string.IsNullOrWhiteSpace(documentName) ? gameObject.scene.name : documentName,
Viewport = normalizedViewport,
Viewport = new EveFieldsViewport
{
MinX = normalizedViewport.MinX,
MinY = normalizedViewport.MinY,
MaxX = normalizedViewport.MaxX,
MaxY = normalizedViewport.MaxY
},
Layers = layers,
Splats = builder.Build()
};
@ -81,7 +88,7 @@ public sealed class AetheriaSceneRenderSplatSource : MonoBehaviour
};
}
private static AetheriaRuntimeRenderSplatLayerDefinition[] BuildLayers()
private static EveFieldsSplatLayer[] BuildLayers()
{
return new[]
{
@ -96,14 +103,14 @@ public sealed class AetheriaSceneRenderSplatSource : MonoBehaviour
};
}
private static AetheriaRuntimeRenderSplatLayerDefinition Layer(
private static EveFieldsSplatLayer Layer(
string key,
string displayName,
int channel,
string blendMode = AetheriaRuntimeRenderSplatBlendModes.Add,
string graphicsFormat = "R16_SFloat")
{
return new AetheriaRuntimeRenderSplatLayerDefinition
return new EveFieldsSplatLayer
{
LayerKey = key,
DisplayName = displayName,
@ -163,9 +170,9 @@ public sealed class AetheriaSceneRenderSplatSource : MonoBehaviour
_sourceFlags.Add(splat.SourceFlags);
}
public AetheriaRuntimeRenderSplatSoa Build()
public EveFieldsSplatSoa Build()
{
return new AetheriaRuntimeRenderSplatSoa
return new EveFieldsSplatSoa
{
Count = _centerX.Count,
CenterX = _centerX.ToArray(),

View file

@ -1,12 +1,13 @@
using System;
using GameCult.Aetheria.State.Verse;
using GameCult.Eve.PluginFields;
using GameCult.Mesh;
public sealed class AetheriaUnityGameViewportDocuments : IDisposable
{
private readonly CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> _contacts;
private readonly CultMeshReactiveDocument<AetheriaRuntimeObjectsViewportDocument> _objectsViewport;
private readonly CultMeshReactiveDocument<AetheriaRuntimeRenderSplatsViewportDocument> _renderSplatsViewport;
private readonly CultMeshReactiveDocument<EveFieldsSplatsDocument> _renderSplatsViewport;
private AetheriaUnityGameViewportDocuments(
AetheriaClientState state,
@ -30,7 +31,7 @@ public sealed class AetheriaUnityGameViewportDocuments : IDisposable
public AetheriaRuntimeZoneContactsDocument CurrentContacts => _contacts?.Current;
public AetheriaRuntimeObjectsViewportDocument CurrentObjectsViewport => _objectsViewport?.Current;
public AetheriaRuntimeRenderSplatsViewportDocument CurrentRenderSplatsViewport => _renderSplatsViewport?.Current;
public EveFieldsSplatsDocument CurrentRenderSplatsViewport => _renderSplatsViewport?.Current;
public static AetheriaUnityGameViewportDocuments OpenMap(
AetheriaClientState state,

View file

@ -1,5 +1,6 @@
using System;
using GameCult.Aetheria.State.Verse;
using GameCult.Eve.PluginFields;
using UnityEngine;
public sealed class AetheriaUnityRenderSplatViewportSource : MonoBehaviour
@ -40,7 +41,7 @@ public sealed class AetheriaUnityRenderSplatViewportSource : MonoBehaviour
}
}
public AetheriaRuntimeRenderSplatsViewportDocument CurrentDocument =>
public EveFieldsSplatsDocument CurrentDocument =>
_viewportDocuments?.CurrentRenderSplatsViewport;
public bool RenderInLateUpdate

View file

@ -506,6 +506,13 @@ public class DaemonRuntimeDocumentTests
Assert.IsTrue(ContainsSurfaceProp(surface.Surface.Root, "entityViewSchema",
EveEntitySoaViewDocument.SchemaId));
Assert.IsFalse(ContainsSurfaceKind(surface.Surface.Root, "world.entity3d"));
Assert.IsTrue(ContainsSurfaceKind(surface.Surface.Root, "field.volume3d"));
Assert.IsTrue(ContainsSurfaceProp(surface.Surface.Root, "materialAssetRef",
"shader.environment.gravity-fog"));
Assert.IsTrue(ContainsSurfaceProp(surface.Surface.Root, "documentSchema",
AetheriaRuntimeDaemonSchemas.RenderSplatsViewport));
Assert.IsFalse(ContainsSurfaceValueFragment(surface.Surface.Root, "_Nebula"),
"The semantic Eve surface must not own Unity shader property names.");
Assert.AreEqual(EveEntitySoaViewDocument.SchemaId, portable.Schema);
Assert.AreEqual(42, portable.Generation);
Assert.AreEqual(AetheriaRuntimeDaemonSoaColumnKinds.Position, portable.Columns.Single().Semantic);
@ -708,6 +715,13 @@ public class DaemonRuntimeDocumentTests
Assert.IsTrue(assetManifest.Assets.Any(asset =>
asset.Ref.AssetKey == "prefab.entity.ship" &&
asset.Ref.Kind == AetheriaRuntimeAssetKinds.Prefab));
Assert.IsTrue(assetManifest.Assets.Any(asset =>
asset.Ref.AssetKey == "shader.environment.gravity-fog" &&
asset.Ref.Kind == AetheriaRuntimeAssetKinds.Shader &&
asset.Ref.Metadata["unity.volume.texturePort.surfaceHeight"] == "_NebulaSurfaceHeight"));
Assert.IsTrue(assetManifest.Assets.Any(asset =>
asset.Ref.AssetKey == "texture.environment.volume-dither" &&
asset.Ref.Kind == AetheriaRuntimeAssetKinds.Texture));
var editorTuiSurface = result.EditorTuiSurface;
Assert.AreEqual("aetheria.daemon", editorTuiSurface.ProviderId);
Assert.AreEqual("editor.daemon", editorTuiSurface.ProviderKind);
@ -6224,6 +6238,14 @@ public class DaemonRuntimeDocumentTests
component.Children.Any(child => ContainsSurfaceKind(child, kind));
}
private static bool ContainsSurfaceValueFragment(AetheriaRuntimeSurfaceComponent component, string fragment)
{
if (component.Props.Values.Any(value =>
value != null && value.IndexOf(fragment, StringComparison.Ordinal) >= 0))
return true;
return component.Children.Any(child => ContainsSurfaceValueFragment(child, fragment));
}
private static bool ContainsSurfaceStateBinding(
AetheriaRuntimeSurfaceComponent component,
string targetProp,

View file

@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using GameCult.Aetheria.State.Verse;
using GameCult.Eve.PluginFields;
using GameCult.Mesh;
using TMPro;
using UniRx;
@ -357,7 +358,7 @@ public class SectorMap : MonoBehaviour
return InfluenceSplatRasterizer;
}
private AetheriaRuntimeRenderSplatsViewportDocument BuildInfluenceSplatDocument(int factionIndex)
private EveFieldsSplatsDocument BuildInfluenceSplatDocument(int factionIndex)
{
var zones = (_sectorMap?.Zones ?? Array.Empty<AetheriaRuntimeSectorMapZone>()).ToArray();
var minX = zones.Length > 0 ? zones.Min(zone => zone.X) : -1;
@ -420,10 +421,10 @@ public class SectorMap : MonoBehaviour
sourceFlags.Add(0);
}
return new AetheriaRuntimeRenderSplatsViewportDocument
return new EveFieldsSplatsDocument
{
Schema = AetheriaRuntimeDaemonSchemas.RenderSplatsViewport,
Viewport = new AetheriaRuntimeViewportBounds
Viewport = new EveFieldsViewport
{
MinX = minX - padding,
MinY = minY - padding,
@ -432,7 +433,7 @@ public class SectorMap : MonoBehaviour
},
Layers = new[]
{
new AetheriaRuntimeRenderSplatLayerDefinition
new EveFieldsSplatLayer
{
LayerKey = AetheriaRuntimeRenderSplatLayerKeys.Influence,
DisplayName = "Sector Influence",
@ -441,7 +442,7 @@ public class SectorMap : MonoBehaviour
GraphicsFormat = "R16_SFloat"
}
},
Splats = new AetheriaRuntimeRenderSplatSoa
Splats = new EveFieldsSplatSoa
{
Count = centerX.Count,
CenterX = centerX,

View file

@ -4,6 +4,7 @@
using System;
using GameCult.Aetheria.State.Verse;
using GameCult.Eve.PluginFields;
using UnityEngine;
using Unity.Mathematics;
using UnityEngine.Experimental.Rendering;
@ -222,7 +223,7 @@ public class VolumeSampling : MonoBehaviour
NebulaTint = ResolveLayerTexture(AetheriaRuntimeRenderSplatLayerKeys.FogTint, NebulaTint);
}
private AetheriaRuntimeRenderSplatsViewportDocument ResolveSceneSplatDocument(Vector2 center, Vector2 size)
private EveFieldsSplatsDocument ResolveSceneSplatDocument(Vector2 center, Vector2 size)
{
if (SceneSplatSource == null)
SceneSplatSource = GetComponent<AetheriaSceneRenderSplatSource>();
@ -231,7 +232,7 @@ public class VolumeSampling : MonoBehaviour
: null;
}
private AetheriaRuntimeRenderSplatsViewportDocument ResolveRuntimeSplatDocument(Vector2 center, Vector2 size)
private EveFieldsSplatsDocument ResolveRuntimeSplatDocument(Vector2 center, Vector2 size)
{
if (SplatViewportSource == null)
return null;