using System.Numerics;
using XFEEDToolBox.Rendering;
using XFEEDToolBox.Core.Galaxy;
using XFEEDToolBox.Core.Rendering;
namespace XFEEDToolBox.Controls;
public sealed partial class GalaxyMapView
{
private readonly GalaxyPowerContour[] powerContours=new GalaxyPowerContour[4096];
internal int VisiblePowerContoursForProbe=>graphics?.SubmittedPowerContours??0;
internal bool OriginalPowerBillboardForProbe=>graphics?.OriginalPowerTerritoryBillboardRestored==true;
internal int PreparedPowerActivityRingsForProbe=>graphics?.PreparedPowerActivityRings??0;
internal int SubmittedPowerActivityRingsForProbe=>graphics?.SubmittedPowerActivityRings??0;
internal bool PowerActivityRingSourceUnknownForProbe=>graphics?.PowerActivityRingSourceUnknown==true;
internal int SubmittedPowerActivityBillboardsForProbe=>graphics?.SubmittedPowerActivityBillboards??0;
internal bool PowerActivityBillboardSourceUnknownForProbe=>graphics?.PowerActivityBillboardSourceUnknown==true;
private float? powerActivityRingEmissiveRescaling;
// Fixture injection is explicit. It is not a fallback for a missing game
// exposure source and is never persisted with a system's public facts.
internal void SetPowerActivityRingEmissiveForProbe(float? scalar)
{powerActivityRingEmissiveRescaling=scalar;Invalidate();}
private void UpdatePowerActivityRing(GalaxyCamera camera)
{
if(graphics is null)return;
GalaxyNativePowerOuter? bound=null;
(int Process,string Fid,long Origin)? source=null;var coherent=true;var extentCoherent=true;
if(Filter is{UsesPowerOuter:true} filter)
foreach(var sample in ordered)
{
var system=sample.System;
if(!filter.Matches(system)||system.Data.NativeFilterFacts is not{} facts||facts.PowerOuter is not{} candidate)continue;
if(!GalaxyOriginalPowerActivityRingGeometry.TryCreate(candidate,camera.Eye,out _))continue;
var actor=(facts.ProcessId,facts.AccountFid,facts.OriginSystemAddress);
if(bound is null){bound=candidate;source=actor;}
else if(source!=actor||bound.CentreSystemAddress!=candidate.CentreSystemAddress||bound.CentrePosition!=candidate.CentrePosition||bound.Radius!=candidate.Radius)
{coherent=false;break;}
else if(bound.Extent!=candidate.Extent)extentCoherent=false;
}
GalaxyOriginalPowerActivityRing? ring=coherent&&GalaxyOriginalPowerActivityRingGeometry.TryCreate(bound,camera.Eye,out var value)?value:null;
graphics.SetOriginalPowerActivityRing(ring,powerActivityRingEmissiveRescaling);
GalaxyOriginalPowerActivityBillboard? billboard=coherent&&extentCoherent&&GalaxyOriginalPowerActivityBillboardGeometry.TryCreate(bound,camera.Eye,out var silhouette)?silhouette:null;
graphics.SetOriginalPowerActivityBillboard(billboard,powerActivityRingEmissiveRescaling);
}
private void UpdatePowerContours()
{
if(graphics is null)return;var count=0;
if(Filter is {UsesPowerTerritory:true} filter)
foreach(var sample in ordered)
{
if(count>=powerContours.Length)break;
var system=sample.System;
if(!filter.Matches(system)||filter.PowerTerritoryStyle(system) is not {LinearRgb.Count:3} style||style.Opacity<=0||!system.Position.IsValid)continue;
var frameOpacity=originalFrameFade is{} fade?fade.Alpha(new((float)system.Position.X,(float)system.Position.Y,(float)system.Position.Z),true,true):1;
if(frameOpacity<=0)continue;
powerContours[count++]=new(new((float)system.Position.X,(float)system.Position.Y,(float)system.Position.Z),style.Radius,
new(style.LinearRgb[0],style.LinearRgb[1],style.LinearRgb[2],style.Opacity*frameOpacity));
}
graphics.SetPowerContours(powerContours.AsSpan(0,count));
}
}
using System.Numerics;
using XFEEDToolBox.Rendering;
using XFEEDToolBox.Core.Galaxy;
using XFEEDToolBox.Core.Rendering;
namespace XFEEDToolBox.Controls;
public sealed partial class GalaxyMapView
{
private readonly GalaxyPowerContour[] powerContours=new GalaxyPowerContour[4096];
internal int VisiblePowerContoursForProbe=>graphics?.SubmittedPowerContours??0;
internal bool OriginalPowerBillboardForProbe=>graphics?.OriginalPowerTerritoryBillboardRestored==true;
internal int PreparedPowerActivityRingsForProbe=>graphics?.PreparedPowerActivityRings??0;
internal int SubmittedPowerActivityRingsForProbe=>graphics?.SubmittedPowerActivityRings??0;
internal bool PowerActivityRingSourceUnknownForProbe=>graphics?.PowerActivityRingSourceUnknown==true;
internal int SubmittedPowerActivityBillboardsForProbe=>graphics?.SubmittedPowerActivityBillboards??0;
internal bool PowerActivityBillboardSourceUnknownForProbe=>graphics?.PowerActivityBillboardSourceUnknown==true;
private float? powerActivityRingEmissiveRescaling;
// Fixture injection is explicit. It is not a fallback for a missing game
// exposure source and is never persisted with a system's public facts.
internal void SetPowerActivityRingEmissiveForProbe(float? scalar)
{powerActivityRingEmissiveRescaling=scalar;Invalidate();}
private void UpdatePowerActivityRing(GalaxyCamera camera)
{
if(graphics is null)return;
GalaxyNativePowerOuter? bound=null;
(int Process,string Fid,long Origin)? source=null;var coherent=true;var extentCoherent=true;
if(Filter is{UsesPowerOuter:true} filter)
foreach(var sample in ordered)
{
var system=sample.System;
if(!filter.Matches(system)||system.Data.NativeFilterFacts is not{} facts||facts.PowerOuter is not{} candidate)continue;
if(!GalaxyOriginalPowerActivityRingGeometry.TryCreate(candidate,camera.Eye,out _))continue;
var actor=(facts.ProcessId,facts.AccountFid,facts.OriginSystemAddress);
if(bound is null){bound=candidate;source=actor;}
else if(source!=actor||bound.CentreSystemAddress!=candidate.CentreSystemAddress||bound.CentrePosition!=candidate.CentrePosition||bound.Radius!=candidate.Radius)
{coherent=false;break;}
else if(bound.Extent!=candidate.Extent)extentCoherent=false;
}
GalaxyOriginalPowerActivityRing? ring=coherent&&GalaxyOriginalPowerActivityRingGeometry.TryCreate(bound,camera.Eye,out var value)?value:null;
graphics.SetOriginalPowerActivityRing(ring,powerActivityRingEmissiveRescaling);
GalaxyOriginalPowerActivityBillboard? billboard=coherent&&extentCoherent&&GalaxyOriginalPowerActivityBillboardGeometry.TryCreate(bound,camera.Eye,out var silhouette)?silhouette:null;
graphics.SetOriginalPowerActivityBillboard(billboard,powerActivityRingEmissiveRescaling);
}
private void UpdatePowerContours()
{
if(graphics is null)return;var count=0;
if(Filter is {UsesPowerTerritory:true} filter)
foreach(var sample in ordered)
{
if(count>=powerContours.Length)break;
var system=sample.System;
if(!filter.Matches(system)||filter.PowerTerritoryStyle(system) is not {LinearRgb.Count:3} style||style.Opacity<=0||!system.Position.IsValid)continue;
var frameOpacity=originalFrameFade is{} fade?fade.Alpha(new((float)system.Position.X,(float)system.Position.Y,(float)system.Position.Z),true,true):1;
if(frameOpacity<=0)continue;
powerContours[count++]=new(new((float)system.Position.X,(float)system.Position.Y,(float)system.Position.Z),style.Radius,
new(style.LinearRgb[0],style.LinearRgb[1],style.LinearRgb[2],style.Opacity*frameOpacity));
}
graphics.SetPowerContours(powerContours.AsSpan(0,count));
}
}