98 lines
4.6 KiB
Markdown
98 lines
4.6 KiB
Markdown
The setup_and_radar_selection module handles the housekeeping of starting the radar exhibit.
|
|
|
|
It will use the radar_management_structure, which is in global data, will be used by this
|
|
module to manage what radars are available and which one is selected.
|
|
|
|
The selection of which radars are to be available to the museum visitors is accomplished
|
|
my entering the radars that will be available as parameters of the command for example:
|
|
|
|
radar_simulator chain_home marine_ascope marine_traffic police_boat - all radars
|
|
radar_simulator marine_ascope - only the marine ascope radar
|
|
|
|
Note: if the operator invokes no parameters, then all the radars are to be made available.
|
|
|
|
When the application is started, it will be in a state where no radar is in use. The visitor
|
|
will use the selector to select a radar to operate.
|
|
|
|
The setup_and_radar_selection shall be within the main.cpp file. It shall run in thread 1
|
|
as it accesses the shaders
|
|
|
|
The following is suggested.
|
|
|
|
1. Read the parameters; check to radar management stucture to make sure
|
|
that a selected radar is operatable. If it is, then set available in the
|
|
radar management structure.
|
|
|
|
2. Initialize opengl.
|
|
|
|
3. Put up introduction text on left panel.
|
|
|
|
4. Sit in select loop. Wait for operator to make a selection. If there is only
|
|
one radar available, wait 5 seconds and then go to that radar.
|
|
|
|
5. Run in a loop where every 30th of a second, update the selected radar.
|
|
|
|
======================================================================
|
|
|
|
CURRENT IMPLEMENTATION STATUS
|
|
|
|
File: src/main.cpp
|
|
Status: COMPLETE (stub phase)
|
|
|
|
The five-step flow described above is fully implemented in main():
|
|
|
|
Step 1 — parse_args()
|
|
Parses argv[] for radar names (chain_home, marine_ascope, marine_traffic,
|
|
police_boat). Sets radar_management[].available for each named radar.
|
|
With no arguments, all radars are made available.
|
|
|
|
STUB NOTE: The current build unconditionally sets operatable=1 for all four
|
|
radars before checking availability. When real radar components are built,
|
|
only the ones that are fully implemented should have operatable set to 1.
|
|
The check "available only if operatable" already works correctly in the code;
|
|
only the stub's operatable override needs to be updated.
|
|
|
|
Step 2 — GLFW / GLAD / OpenGL initialization
|
|
Creates a 1920x1080 window (WINDOW_WIDTH x WINDOW_HEIGHT from settings.h),
|
|
initialises GLAD, enables GL_DEBUG_OUTPUT (controlled by ENABLE_GL_DEBUG_OUTPUT
|
|
in settings.h), and sets global GL state (blending, no depth test).
|
|
|
|
Step 3 — Intro / selection screen
|
|
Renders the welcome text on the left panel (render_intro_left_panel()) and
|
|
the radar selection list centred in the scope viewport (render_radar_list()).
|
|
The status bar shows keyboard instructions (render_selection_status_bar()).
|
|
|
|
Step 4 — Selection loop
|
|
The GLFW key callback (key_callback) handles:
|
|
- Key 1: step selection forward
|
|
- Key 2: step selection backward
|
|
- ENTER: activate the highlighted radar; call reset_radar_controls()
|
|
- ESC: close the window
|
|
If exactly one radar is available, the application auto-activates it after
|
|
5 seconds (shows the selection screen during the countdown; breaks early
|
|
if ENTER is pressed).
|
|
|
|
Step 5 — Main render loop (~30 Hz)
|
|
Uses std::chrono::steady_clock to target a 1/30 s frame period.
|
|
Each frame:
|
|
- Polls GLFW events
|
|
- If SELECTION state: calls render_selection_screen()
|
|
- If OPERATING state: calls render_operating_screen(), which delegates
|
|
to g_active_radar->render_left_panel(), render_status_bar(),
|
|
render_scope() through the RadarBase virtual interface.
|
|
|
|
Additional features implemented:
|
|
- GL debug callback (gl_debug_callback) enabled via ENABLE_GL_DEBUG_OUTPUT
|
|
- Debug border-box renderer (draw_border_box) enabled via DEBUG_DRAW_WINDOW_BORDERS
|
|
in settings.h — draws white outlines around each panel for layout verification
|
|
- reset_radar_controls(): resets uniform_max_range, uniform_range_cursor,
|
|
uniform_bearing_cursor to defaults for the selected radar when it is activated
|
|
- Keyboard controls for all scope uniforms (intensity, sensitivity, STC, noise
|
|
filter, radiogoniometer, max range, range cursor, bearing cursor, antenna
|
|
rotation) are implemented in key_callback(); the controls are appropriately
|
|
restricted by radar type (e.g. noise filter only for PPI scopes)
|
|
|
|
Application state is tracked by AppState enum (SELECTION, OPERATING) in main.cpp.
|
|
The active radar object is pointed to by g_active_radar (a RadarBase*).
|
|
current_radar (global in global_data.cpp) holds the RADAR_* index of the active radar.
|