1
2
3namespace Rendering {
extern bool MovingMapBaselineSprites; }
4static void CheckMapLayers(const std::filesystem::path& output, NativeUiTest11& fixture,
7{
9 std::ifstream input("Displays/E-11.xml");
10 std::string xml((std::istreambuf_iterator<char>(input)),{});
11 rapidxml::xml_document<> doc;doc.parse<0>(xml.data());
12 auto* screens=doc.first_node("Displays")->first_node("Screens");
13 for(auto* screen=screens->first_node();screen;)
14 {
15 auto* next=screen->next_sibling();const std::string name=screen->first_attribute("name")->value();
16 if(name!="PFD" && name!="MFD")screens->remove_node(screen);
17 else for(auto* page=screen->first_node();page;)
18 {
19 auto* nextPage=page->next_sibling();
20 if(name=="MFD" && std::string(page->first_attribute("name")->value())!="Navigation")screen->remove_node(page);
21 page=nextPage;
22 }
23 screen=next;
24 }
26 for(
auto& screen:panels.
screens)screen.bypassVdat=
true;
33 unsigned images=0;
34 for(unsigned scenario=0;scenario<24;++scenario)
35 {
36 const float latitude=scenario<12 ? 5.413f : 35.3f,longitude=scenario<12 ? -26.359f : 45.064f;
39 for(int u=0;u<64;++u)for(int v=0;v<64;++v)
40 {
41 if(
gridarray[u][v].pri_landform==255)
continue;
44 }
52 for(unsigned i=0;i<4;++i)
53 {
56 }
58 std::vector<DWORD> clean;
59 for(
auto& screen:panels.
screens){screen.FrameMove(1);screen.FrameMove(1);}
60 for(unsigned pass=0;pass<4;++pass)
61 {
62 const bool hostile=pass%2!=0;
63 Rendering::MovingMapBaselineSprites=pass<2;
64 auto& d=fixture.device;
69 panels.
Render();NativeUiTest11::HR(d.EndScene());fixture.DebugClean();
70 const auto pixels=fixture.Pixels();
71 if(pass==0)clean=pixels;
72 else Check(pixels==clean,"baseline/optimized map layers or hostile stencil differ");
73 if(!hostile)
74 {
75 fixture.Save(output/("map-layers-"+std::to_string(scenario)+(pass==0?"-baseline.png":".png")));++images;
76 }
77 bool clipped=true;
78 for(int y=0;y<512;++y)for(int x=0;x<1024;++x)
79 {
80 bool inside=false;
81 for(
const auto& screen:panels.
screens)inside|=x>=screen.rect.left && x<screen.rect.right && y>=screen.rect.top && y<screen.rect.bottom;
82 if(!inside)clipped &= pixels[size_t(y)*1024+x]==0;
83 }
84 Check(clipped,"map/horizon escaped both authored screen scissors");
85 }
86 }
87 Rendering::MovingMapBaselineSprites=false;
89
93 for(const int callout : {-1,9,14})
94 {
96 for(
auto& screen:panels.
screens)screen.FrameMove(1);
97 auto& d=fixture.device;
99 NativeUiTest11::HR(d.BeginScene());
102 panels.
Render();NativeUiTest11::HR(d.EndScene());fixture.DebugClean();
103 for(
const auto& screen:panels.
screens)
104 fixture.Save(output/("e11-"+screen.name+"-tcas-test-"+std::to_string(callout)+".png"),&screen.rect);
105 }
108 std::cout<<"PASS: "<<images<<" baseline/optimized MFD/PFD images identical, range/heading/roll/pitch/overlays and hostile stencil\n";
109}
float RollAttitudeRadians
float MapScaleInnerRingKm
float PitchAttitudeRadians
float HeadingTrackDegrees
float LocalizerDeviationRadians
RiseMath::Vector3 NormalAcceleration
std::vector< Swaypoint > waypoint
RiseMath::Vector3 BattleRoyaleRingCenter
RiseMath::Vector2 FlightPathVectorDegrees
float GlideslopeDeviationRadians
std::vector< Font * > fonts
std::vector< Screen > screens
void ConfigureScreens(rapidxml::xml_node<> *xml_node)
void CalculateCubeAndTcp()
s_network_objects playerships[MAX_SCAN]
LOCALGRID2 gridarray[64][64]
constexpr uint32_t TARGET
constexpr uint32_t ZBUFFER
constexpr uint32_t STENCIL
constexpr uint32_t STENCILFUNC
constexpr uint32_t STENCILENABLE
constexpr uint32_t ZENABLE
float DesiredPitchRadians
enum Bus::Afcs::LateralModes CurrentLateralMode
unsigned char pri_landform
RiseMath::Vector3 location
RiseMath::Vector3 position