Rise
The Vieneo Province
Loading...
Searching...
No Matches
ExternalCameraOverlay.h
Go to the documentation of this file.
1#pragma once
2
4#include <cmath>
5#include <limits>
6#include <string>
7
9{
10 constexpr float Width = 544.0f;
11 constexpr float Height = 112.0f;
12
13 inline int HeadingDegrees(float degrees)
14 {
15 if (!std::isfinite(degrees)) return 0;
16 float wrapped = std::fmod(degrees, 360.0f);
17 if (wrapped < 0.0f) wrapped += 360.0f;
18 return static_cast<int>(std::round(wrapped)) % 360;
19 }
20
21 // Use the actual projection, including its flipped X axis, and view zoom.
22 inline float HorizontalFov(float projectionX, float zoom)
23 {
24 if (!std::isfinite(projectionX) || !std::isfinite(zoom) || zoom <= 0.0f)
25 return RiseMath::Pi * 0.5f;
26 return 2.0f * std::atan2(1.0f, std::fabs(projectionX) * zoom);
27 }
28
29 struct Readout
30 {
31 float panRadians = 0.0f; // Relative to vehicle forward, including seated head direction.
32 float tiltRadians = 0.0f; // Camera tilt; positive is up.
34 float zoom = 1.0f;
35 bool vehicleAvailable = false;
36 float pitchAttitudeRadians = std::numeric_limits<float>::quiet_NaN();
37 float rollAttitudeRadians = std::numeric_limits<float>::quiet_NaN();
38 float headingDegrees = 0.0f;
39 float altitudeMslKm = 0.0f; // Geometric MSL; selects the 10 km flight regime.
40 float altitudeAglKm = std::numeric_limits<float>::quiet_NaN(); // Radio altitude, when available.
41 bool groundVehicle = false;
43 float groundSpeedKms = 0.0f;
44 float verticalSpeedKms = 0.0f;
45 };
46
48 {
49 std::wstring value;
50 const wchar_t* label;
51 const wchar_t* units;
52 };
53
55 MetricText FormatSpeed(const Readout& data);
56}
57
58// A passive overlay: no input capture, textures, or changes to camera controls.
60{
61public:
63 void OnLostDevice();
64 void OnResetDevice();
65 void OnDestroyDevice();
67 float left, float top, float scale);
68
69private:
72};
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
Rendering::RenderFont * valueFont
Rendering::RenderFont * labelFont
HRESULT OnCreateDevice(Rendering::RenderDevice *device)
void Draw(Rendering::RenderSprite *sprite, const ExternalCamera::Readout &data, float left, float top, float scale)
float HorizontalFov(float projectionX, float zoom)
int HeadingDegrees(float degrees)
MetricText FormatAltitude(const Readout &data)
MetricText FormatSpeed(const Readout &data)
constexpr float Width
constexpr float Height
constexpr float Pi
Definition ClientMath.h:12