using System.Text.Json; using XFEEDToolBox.Controls; using XFEEDToolBox.Core.Galaxy; using XFEEDToolBox.Core.Models; namespace XFEEDToolBox; public partial class App { private static async Task RunGalaxyAuthoredBackgroundProbeAsync(GalaxyMapView map,string directory) { map.Systems=[];map.CurrentSystem="";map.ClearSelection(); map.Filter=GalaxyMapFilter.Default with{ShowGrid=false,ShowMarkers=false,ShowGalacticZonesPlane=false, ShowRegionNames=false,ShowNebulaNames=false,ShowGalacticZoneNames=false,ShowConstellations=false}; var rows=new List();var aboveChanged=0; try { foreach(var (name,focus,zoom) in new[]{("sol",new Coordinates(0,0,0),1d), ("centre",new Coordinates(15,-30,25895),.125d),("above",new Coordinates(15,20000,25895),.0125d)}) { map.Centre=focus;map.ResetCamera();map.Zoom(zoom);map.AdvanceCameraMotionForProbe(256); map.SetOriginalPlaneEnabledForProbe(true);map.RenderNowForProbe();var on=map.CapturePixelsForProbe(); await SaveModelFrameAsync(new(on.Width,on.Height,on.Pixels,0),Path.Combine(directory,"authored-background-"+name+".png")); map.SetOriginalPlaneEnabledForProbe(false);map.RenderNowForProbe();var off=map.CapturePixelsForProbe(); var changed=0; for(var i=0;i3)changed++; if(name=="above") { aboveChanged=changed; await SaveModelFrameAsync(new(off.Width,off.Height,off.Pixels,0),Path.Combine(directory,"authored-background-above-without-plane.png")); } if(!map.OriginalPlaneReadyForProbe||!map.OriginalSceneHdrDrawnForProbe||map.VisibleStars!=0) throw new InvalidOperationException("Authored background integration lacks its original resources/HDR scope or introduced catalogue stars."); rows.Add(new{name,focus,actualPose=map.ActualCameraPoseForProbe,planeContributionPixelsAbove3=changed, originalPlaneReady=map.OriginalPlaneReadyForProbe,originalMilkyWayInstances=map.OriginalMilkyWayInstancesForProbe, sharedSceneHdr=map.OriginalSceneHdrDrawnForProbe,visibleCatalogueStars=map.VisibleStars}); } if(aboveChanged==0)throw new InvalidOperationException("The original plane made no visible contribution in the above-plane main renderer view."); } finally{map.SetOriginalPlaneEnabledForProbe(true);} var report=new{views=rows,cameraCoordinatesAreExplicitRendererFixtures=true,generatedCatalogueCoordinates=false, planeControlledToggle=true,sourceLayerOrder=new[]{"Plane1","Core10","MilkyWay13"},originalCompleteBackground=false,gameAccess=false}; await File.WriteAllTextAsync(Path.Combine(directory,"authored-background-probe.json"),JsonSerializer.Serialize(report,new JsonSerializerOptions{WriteIndented=true})); return report; } }