Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
WeatherRadar.cpp
Go to the documentation of this file.
1
#include "
WeatherRadar.h
"
2
#include "
WeatherRadarSource.h
"
3
#include "
../Viewscreen/Viewscreen.h
"
4
#include "
../Viewscreen/grid.h
"
5
#include "
../Viewscreen/weather.h
"
6
#include "
../Rendering/FrameProfiler11.h
"
7
8
void
WeatherRadar::FrameMove
(
float
elapsed)
9
{
10
using namespace
WeatherRadarModel
;
11
Rendering::ProfileCpuScope11
timing(
"Weather radar"
);
12
const
auto
& ship=
playerships
[0];
13
Input
input;
14
input.
equipped
=
ourcockpit
.
weatherRadarEquipped
;
15
input.
power
=
ourcockpit
.
weatherRadarPower
&&
ourcockpit
.
power
>=.5f;
16
input.
simulator
=ship.isSimulator;
17
input.
vehicle
=ship.vehicleId;
18
input.
radiusKm
=
radiusC
;
19
input.
maxFrameSeconds
=
maxFrameSeconds
;
20
input.
rangeKm
=double(
bus
->
MapScaleInnerRingKm
)*2;
21
input.
position
={ship.position.x,ship.position.y,ship.position.z};
22
input.
aboveWeatherCoverage
=
AboveWeatherCoverage
(ship.mslKm,
g_bAboveClouds
,
cloudTopsMslC
,
cloudBufferMslC
);
23
// Heading is needed for an empty sweep too, while the weather feed is suspended.
24
MapFrame
(input.
position
,
bus
->
HeadingTrueDegrees
,input.
forward
,input.
right
);
25
const
auto
* source=input.
equipped
&& input.
power
&& !input.
simulator
&& !input.
aboveWeatherCoverage
&&
viewscreen
&&
26
viewscreen
->
ptrWeather
&&
viewscreen
->
ptrGrid
&&
viewscreen
->
ptrGrid
->
dataReady
?
27
viewscreen
->
ptrWeather
->
RadarWeatherData
() :
nullptr
;
28
input.
dataAvailable
=source!=
nullptr
&& std::isfinite(
bus
->
HeadingTrueDegrees
);
29
if
(source)
30
{
31
const
auto
& header=source->Header();
32
input.
generation
=(uint64_t(header.requestToken)<<8)|header.cube;
33
input.
revision
=header.revision;
34
}
35
scanner
.
Update
(input,elapsed,[&](Point position) {
36
if
(!source)
return
Sample
{};
37
const
auto
& terrain=*
viewscreen
->
ptrGrid
;
38
const
GridFootprint
terrainFootprint{unsigned(terrain.ElevationFace()),terrain.ElevationCenter()};
39
return
SampleGrid
(*source,position,
cloudTopsMslC
,[&](
unsigned
face,
double
u,
double
v,
float
& meters,
float
& water) {
40
return
terrain.InterpolateRadarSurface(
char
(face),u,v,meters,water);
41
},&terrainFootprint);
42
},
bus
->
weatherRadar
);
43
}
FrameProfiler11.h
Viewscreen.h
WeatherRadar.h
WeatherRadarSource.h
Bus::MapScaleInnerRingKm
float MapScaleInnerRingKm
Definition
Bus.h:490
Bus::HeadingTrueDegrees
float HeadingTrueDegrees
Definition
Bus.h:41
Bus::weatherRadar
WeatherRadarModel::Display weatherRadar
Definition
Bus.h:25
Module::bus
Bus * bus
Definition
Module.h:21
Module::maxFrameSeconds
float maxFrameSeconds
Definition
Module.h:30
Rendering::ProfileCpuScope11
Definition
FrameProfiler11.h:697
Viewscreen::ptrWeather
std::unique_ptr< weather > ptrWeather
Definition
Viewscreen.h:434
Viewscreen::ptrGrid
std::unique_ptr< grid > ptrGrid
Definition
Viewscreen.h:426
WeatherRadar::scanner
WeatherRadarModel::Scanner scanner
Definition
WeatherRadar.h:8
WeatherRadar::FrameMove
void FrameMove(float elapsed) override
Definition
WeatherRadar.cpp:8
WeatherRadar::viewscreen
Viewscreen * viewscreen
Definition
WeatherRadar.h:7
WeatherRadarModel::Scanner::Update
void Update(Input in, double elapsed, Sampler sample, Display &out)
Definition
WeatherRadarModel.h:337
grid::dataReady
bool dataReady
Definition
grid.h:36
weather::RadarWeatherData
const PlotWeather::Store * RadarWeatherData() const
Definition
weather.h:161
playerships
s_network_objects playerships[MAX_SCAN]
Definition
globals.cpp:112
ourcockpit
Scockpit ourcockpit
Definition
globals.cpp:114
g_bAboveClouds
bool g_bAboveClouds
Definition
globals.cpp:16
radiusC
#define radiusC
Definition
globals.h:87
cloudTopsMslC
#define cloudTopsMslC
Definition
globals.h:110
cloudBufferMslC
#define cloudBufferMslC
Definition
globals.h:111
grid.h
WeatherRadarModel
Definition
WeatherRadarDisplay.h:10
WeatherRadarModel::AboveWeatherCoverage
bool AboveWeatherCoverage(double mslKm, bool feedSuspended, double topKm, double resumeKm)
Definition
WeatherRadarModel.h:133
WeatherRadarModel::SampleGrid
Sample SampleGrid(const PlotWeather::Store &source, Point position, double topKm, Elevation elevation, const GridFootprint *terrainFootprint=nullptr)
Definition
WeatherRadarSource.h:25
WeatherRadarModel::MapFrame
void MapFrame(Point position, double headingDegrees, Point &forward, Point &right)
Definition
WeatherRadarModel.h:68
Scockpit::power
float power
Definition
globals.h:599
Scockpit::weatherRadarEquipped
bool weatherRadarEquipped
Definition
globals.h:669
Scockpit::weatherRadarPower
bool weatherRadarPower
Definition
globals.h:597
WeatherRadarModel::GridFootprint
Definition
WeatherRadarSource.h:9
WeatherRadarModel::Input
Definition
WeatherRadarModel.h:124
WeatherRadarModel::Input::revision
uint64_t revision
Definition
WeatherRadarModel.h:128
WeatherRadarModel::Input::dataAvailable
bool dataAvailable
Definition
WeatherRadarModel.h:125
WeatherRadarModel::Input::vehicle
int vehicle
Definition
WeatherRadarModel.h:127
WeatherRadarModel::Input::aboveWeatherCoverage
bool aboveWeatherCoverage
Definition
WeatherRadarModel.h:126
WeatherRadarModel::Input::position
Point position
Definition
WeatherRadarModel.h:129
WeatherRadarModel::Input::generation
uint64_t generation
Definition
WeatherRadarModel.h:128
WeatherRadarModel::Input::power
bool power
Definition
WeatherRadarModel.h:125
WeatherRadarModel::Input::maxFrameSeconds
double maxFrameSeconds
Definition
WeatherRadarModel.h:131
WeatherRadarModel::Input::equipped
bool equipped
Definition
WeatherRadarModel.h:125
WeatherRadarModel::Input::right
Point right
Definition
WeatherRadarModel.h:129
WeatherRadarModel::Input::simulator
bool simulator
Definition
WeatherRadarModel.h:125
WeatherRadarModel::Input::forward
Point forward
Definition
WeatherRadarModel.h:129
WeatherRadarModel::Input::rangeKm
double rangeKm
Definition
WeatherRadarModel.h:130
WeatherRadarModel::Input::radiusKm
double radiusKm
Definition
WeatherRadarModel.h:130
WeatherRadarModel::Sample
Definition
WeatherRadarModel.h:101
weather.h
Modules
WeatherRadar.cpp
Generated on
for Rise by
1.18.0