Rise
The Vieneo Province
Loading...
Searching...
No Matches
Tests/LocalCloudBaseLifecycleTests.h

Source at documentation-generation time. See Test catalog for fixture associations.

1static void CheckLocalCloudBaseLifecycle(Viewscreen& view,grid& terrain)
2{
3 auto& weather=view.weather;
7 view.volumeEnabled=true;playerships[0].isSimulator=false;g_bAboveClouds=false;
8 playerships[0].mslKm=.4f;playerships[0].position=view.CalculatePlanar(1019,1019)*(radiusC+.4f);
9 LoadTerrain(view,{1024,1016},0,450);
10 Check(Accept(weather.plotWeather,Packet(true,{1019,1019},0,1000,0,7))==PlotWeather::Result::Full,"base fixture full grid");
13 Check(CloudBaseWeather::Active(frame),"local cloud field not activated");
14 const int x=9,y=5,index=x*64+y;
15 auto cell=frame.grid->cells[y*64+x];
16 Check(Near(cell.base,(750+index)*.001f) && Near(cell.turbulence,float((index/7)%256)/255)
17 && cell.coverage==1,"cloud grid transposed, wrong terrain join, or wrong scalar units");
18 Check(frame.grid->cells[31*64].coverage==0,"missing terrain supplied invented cloud base");
19 const auto unchanged=frame.grid;weather.UpdateCloudBaseWeather(.1f);
20 Check(weather.cloudParameters.localBase.grid==unchanged,"unchanged grid republished every frame");
21 LoadTerrain(view,{1024,1016},0,950);weather.UpdateCloudBaseWeather(1);
22 cell=weather.cloudParameters.localBase.grid->cells[y*64+x];
23 Check(cell.base>frame.grid->cells[y*64+x].base && cell.base<frame.grid->cells[y*64+x].base+.01f,"terrain-only refresh snapped or ignored cloud base");
25 Check(Near(weather.cloudParameters.localBase.grid->cells[y*64+x].base,(1250+index)*.001f),"terrain revision did not reach cloud field");
27 Check(CloudBaseWeather::Active(weather.cloudParameters.localBase),"VIS diagnostic incorrectly disabled cloud bases");
29 Check(!weather.cloudParameters.localBase.grid,"BCL override retained regional controls");
32 && weather.cloudParameters.localBase.grid->cells[31*64+31].coverage<.1f,"BCL exit failed fresh coverage fade");
34 Check(!weather.cloudParameters.localBase.grid && !weather.cloudBaseWeather.Current(),"simulator entry retained cloud state");
36 Check(weather.cloudParameters.localBase.grid && weather.cloudParameters.localBase.grid->cells[31*64+31].coverage<.1f,"simulator exit replayed stale field");
38 Check(Near(weather.cloudParameters.localBase.weight,.5f),"ascent observer handoff wrong");
40 Check(!CloudBaseWeather::Active(weather.cloudParameters.localBase),"upper cloud transition retained local weight");
42 Check(!weather.cloudParameters.localBase.grid,"orbit retained local cloud state");
44 Check(!weather.cloudParameters.localBase.grid,"descent accepted stale pending grid");
46 Check(CloudBaseWeather::Active(weather.cloudParameters.localBase),"descent failed to rearm valid weather");
47 weather.QueuePlotWeatherReset();Check(!weather.cloudParameters.localBase.grid,"reposition retained regional cloud bases");
49 weather.ResetPlotWeatherConnection();Check(!weather.cloudParameters.localBase.grid,"reconnect retained regional cloud bases");
51 terrain.ClearGrid();
52}
RiseMath::Vector3 CalculatePlanar(short u, short v)
Definition grid.h:14
void ClearGrid()
Definition grid.cpp:78
float cloudCeilingOverrideKm
Definition weather.h:75
CloudBaseWeather::Store cloudBaseWeather
Definition weather.h:91
bool weatherPending
Definition weather.h:82
void QueuePlotWeatherReset()
Definition weather.cpp:1060
bool plotWeatherSuspended
Definition weather.h:83
uint16_t weatherRequestToken
Definition weather.h:85
float visibilityOverrideKm
Definition weather.h:65
CloudVolume::Parameters cloudParameters
Definition weather.h:216
void UpdateCloudBaseWeather(float elapsed)
Definition weather.cpp:1249
void ResetPlotWeatherConnection()
Definition weather.cpp:1008
PlotWeather::Store plotWeather
Definition weather.h:86
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
bool g_bAboveClouds
Definition globals.cpp:16
#define radiusC
Definition globals.h:87
bool Active(const Frame &frame)
CloudBaseWeather::Frame localBase
Definition CloudVolume.h:36
RiseMath::Vector3 position
Definition globals.h:511