259 lines
10 KiB
C
259 lines
10 KiB
C
/*
|
|
* MIT License
|
|
*
|
|
* Copyright (c) 2026 Mark Allyn
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*/
|
|
|
|
/*
|
|
* settings.h
|
|
* Author: Mark Allyn
|
|
*
|
|
* System-wide configuration and debug toggles.
|
|
* Include this file in ALL components.
|
|
* Change a value and recompile — no AI rewrite needed.
|
|
*
|
|
* Each section is labeled with the component name it governs.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
/* ============================================================
|
|
* GENERAL / OPENGL DEBUG
|
|
* Component: Thread 1 (initialization)
|
|
* ============================================================ */
|
|
|
|
// 1 = enable GL_DEBUG_OUTPUT and glDebugMessageCallback at startup
|
|
#define ENABLE_GL_DEBUG_OUTPUT 1
|
|
|
|
/* ============================================================
|
|
* THREAD 1 - OpenGL / Shader Init / Keyboard / Main Loop
|
|
* ============================================================ */
|
|
|
|
// 1 = print shader compile and link status to stdout
|
|
#define DEBUG_SHADER_COMPILE 1
|
|
|
|
/* ============================================================
|
|
* THREAD 2 - Traffic Cop
|
|
* ============================================================ */
|
|
|
|
// 1 = print each target record received from simulator or Raspberry Pi
|
|
#define DEBUG_TRAFFIC_COP_INPUT 0
|
|
|
|
// 1 = print each target record handed off to Thread 1
|
|
#define DEBUG_TRAFFIC_COP_OUTPUT 0
|
|
|
|
/* ============================================================
|
|
* THREAD 3 - Simulator
|
|
* ============================================================ */
|
|
|
|
// 1 = print simulated target positions each update cycle
|
|
#define DEBUG_SIMULATOR_OUTPUT 0
|
|
|
|
/* ============================================================
|
|
* SCOPE RENDERING - ISOLATION TOGGLES
|
|
* Use these to isolate subsystems during development.
|
|
* ============================================================ */
|
|
|
|
// 1 = disable P7 phosphor persistence layer (see raw target hits only)
|
|
#define DISABLE_P7_PERSISTENCE 0
|
|
|
|
// 1 = disable land and terrain rendering (see targets without background)
|
|
#define DISABLE_LAND_TERRAIN 0
|
|
|
|
// 1 = disable target rendering (see terrain/land background alone)
|
|
#define DISABLE_TARGETS 0
|
|
|
|
/* ============================================================
|
|
* CHAIN HOME A-SCOPE
|
|
* Component: Chain Home scope (1940s, World War 2)
|
|
* ============================================================ */
|
|
|
|
// Fixed maximum range in nautical miles; the o/p range control has no effect for this scope
|
|
#define CHAIN_HOME_MAX_RANGE_NM 200.0f
|
|
|
|
/* ============================================================
|
|
* MARINE A-SCOPE
|
|
* Component: 1940s marine A-scope (pre-PPI)
|
|
* ============================================================ */
|
|
|
|
// Selectable maximum range steps in nautical miles (o/p keys step through these)
|
|
#define MARINE_A_SCOPE_NUM_RANGES 4
|
|
#define MARINE_A_SCOPE_RANGE_STEP_1 3.0f
|
|
#define MARINE_A_SCOPE_RANGE_STEP_2 6.0f
|
|
#define MARINE_A_SCOPE_RANGE_STEP_3 12.0f
|
|
#define MARINE_A_SCOPE_RANGE_STEP_4 24.0f
|
|
|
|
// Pip spacing on the A-scope sweep (nm between range pips), one value per range step
|
|
#define MARINE_A_SCOPE_PIP_STEP_1 0.5f /* 3 nm range — pip every 0.5 nm */
|
|
#define MARINE_A_SCOPE_PIP_STEP_2 1.0f /* 6 nm range — pip every 1.0 nm */
|
|
#define MARINE_A_SCOPE_PIP_STEP_3 2.0f /* 12 nm range — pip every 2.0 nm */
|
|
#define MARINE_A_SCOPE_PIP_STEP_4 4.0f /* 24 nm range — pip every 4.0 nm */
|
|
|
|
/* ============================================================
|
|
* PPI SCOPE - MARINE TRAFFIC CONTROL
|
|
* Component: PPI scope, marine traffic control station
|
|
* ============================================================ */
|
|
|
|
// Selectable maximum range steps in nautical miles
|
|
#define PPI_MTC_NUM_RANGES 5
|
|
#define PPI_MTC_RANGE_STEP_1 3.0f
|
|
#define PPI_MTC_RANGE_STEP_2 6.0f
|
|
#define PPI_MTC_RANGE_STEP_3 12.0f
|
|
#define PPI_MTC_RANGE_STEP_4 24.0f
|
|
#define PPI_MTC_RANGE_STEP_5 48.0f
|
|
|
|
/*
|
|
* Range ring positions (nm from centre) per range step.
|
|
* Two rings per step, placed at 1/3 and 2/3 of the maximum range.
|
|
* No ring at the maximum range itself — that is the scope edge / graticule boundary.
|
|
*/
|
|
#define PPI_MTC_RING1_STEP_1 1.0f /* 3 nm — inner ring */
|
|
#define PPI_MTC_RING2_STEP_1 2.0f /* 3 nm — outer ring */
|
|
#define PPI_MTC_RING1_STEP_2 2.0f /* 6 nm */
|
|
#define PPI_MTC_RING2_STEP_2 4.0f
|
|
#define PPI_MTC_RING1_STEP_3 4.0f /* 12 nm */
|
|
#define PPI_MTC_RING2_STEP_3 8.0f
|
|
#define PPI_MTC_RING1_STEP_4 8.0f /* 24 nm */
|
|
#define PPI_MTC_RING2_STEP_4 16.0f
|
|
#define PPI_MTC_RING1_STEP_5 16.0f /* 48 nm */
|
|
#define PPI_MTC_RING2_STEP_5 32.0f
|
|
|
|
/* ============================================================
|
|
* PPI SCOPE - ON-BOARD BOAT
|
|
* Component: PPI scope, on-board boat view
|
|
* ============================================================ */
|
|
|
|
// Selectable maximum range steps in nautical miles
|
|
#define PPI_BOAT_NUM_RANGES 5
|
|
#define PPI_BOAT_RANGE_STEP_1 1.5f
|
|
#define PPI_BOAT_RANGE_STEP_2 3.0f
|
|
#define PPI_BOAT_RANGE_STEP_3 6.0f
|
|
#define PPI_BOAT_RANGE_STEP_4 12.0f
|
|
#define PPI_BOAT_RANGE_STEP_5 24.0f
|
|
|
|
/*
|
|
* Range ring positions (nm from centre) per range step.
|
|
* Two rings per step, placed at 1/3 and 2/3 of the maximum range.
|
|
* No ring at the maximum range itself — that is the scope edge / graticule boundary.
|
|
*/
|
|
#define PPI_BOAT_RING1_STEP_1 0.5f /* 1.5 nm — inner ring */
|
|
#define PPI_BOAT_RING2_STEP_1 1.0f /* 1.5 nm — outer ring */
|
|
#define PPI_BOAT_RING1_STEP_2 1.0f /* 3 nm */
|
|
#define PPI_BOAT_RING2_STEP_2 2.0f
|
|
#define PPI_BOAT_RING1_STEP_3 2.0f /* 6 nm */
|
|
#define PPI_BOAT_RING2_STEP_3 4.0f
|
|
#define PPI_BOAT_RING1_STEP_4 4.0f /* 12 nm */
|
|
#define PPI_BOAT_RING2_STEP_4 8.0f
|
|
#define PPI_BOAT_RING1_STEP_5 8.0f /* 24 nm */
|
|
#define PPI_BOAT_RING2_STEP_5 16.0f
|
|
|
|
/* ============================================================
|
|
* WINDOW AND PANEL LAYOUT
|
|
* Component: Thread 1 (main.cpp), 01_classes, 02_text_description
|
|
* ============================================================ */
|
|
|
|
#define WINDOW_WIDTH 1920
|
|
#define WINDOW_HEIGHT 1080
|
|
#define WINDOW_TITLE "RAF / Marine Radar Exhibit"
|
|
|
|
/* Left side is split vertically: text panel on top, status bar on bottom.
|
|
* Right side is the scope viewport — it takes the full window height. */
|
|
#define LEFT_PANEL_WIDTH 500
|
|
#define STATUS_BAR_HEIGHT 250
|
|
|
|
// Derived dimensions
|
|
#define SCOPE_WIDTH (WINDOW_WIDTH - LEFT_PANEL_WIDTH)
|
|
#define SCOPE_HEIGHT WINDOW_HEIGHT // scope takes full right-side height
|
|
#define LEFT_TEXT_HEIGHT (WINDOW_HEIGHT - STATUS_BAR_HEIGHT) // text portion of left panel
|
|
|
|
// Pixel margin on every side of the scope area (keeps edges visible on the monitor)
|
|
#define SCOPE_MARGIN 10
|
|
// Available scope area after removing the margin
|
|
#define SCOPE_VW (SCOPE_WIDTH - 2 * SCOPE_MARGIN)
|
|
#define SCOPE_VH (SCOPE_HEIGHT - 2 * SCOPE_MARGIN)
|
|
// Square scope: side length is the smaller of SCOPE_VW and SCOPE_VH (height wins here)
|
|
#define SCOPE_SQUARE SCOPE_VH
|
|
// Horizontal offset to centre the square inside the SCOPE_VW-wide available area
|
|
#define SCOPE_SQUARE_XOFF ((SCOPE_VW - SCOPE_SQUARE) / 2)
|
|
|
|
// 1 = draw a white debug border box around each screen panel (temporary layout aid)
|
|
#define DEBUG_DRAW_WINDOW_BORDERS 1
|
|
|
|
/* ============================================================
|
|
* TEXT RENDERING
|
|
* Component: 02_text_description
|
|
* ============================================================ */
|
|
|
|
#define FONT_PATH "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
|
|
#define FONT_SIZE_NORMAL 18u
|
|
#define FONT_SIZE_TITLE 26u
|
|
|
|
// Pixels between text baselines at scale 1.0 with FONT_SIZE_NORMAL
|
|
#define LINE_HEIGHT 24.0f
|
|
// Pixels between text baselines at scale 1.0 with FONT_SIZE_TITLE
|
|
#define LINE_HEIGHT_LARGE 34.0f
|
|
|
|
// Pixel margin from panel edge for text placement
|
|
#define TEXT_MARGIN 10.0f
|
|
|
|
/* ============================================================
|
|
* SHADER DIRECTORY
|
|
* Component: all components that load shaders
|
|
* ============================================================ */
|
|
|
|
// Path is relative to the build/ directory where the executable lives
|
|
#define SHADER_DIR "../shaders/"
|
|
|
|
/* ============================================================
|
|
* KEYBOARD CONTROL STEP SIZES
|
|
* Component: Thread 1 keyboard handler (main.cpp)
|
|
* ============================================================ */
|
|
|
|
#define INTENSITY_STEP 0.05f
|
|
#define SENSITIVITY_STEP 0.05f
|
|
#define STC_SENSITIVITY_STEP 0.05f
|
|
#define STC_RANGE_STEP 0.05f
|
|
#define NOISE_FILTER_STEP 0.05f
|
|
#define RADIOGON_STEP 1.0f
|
|
#define BEARING_CURSOR_STEP 1.0f
|
|
#define RANGE_CURSOR_STEP 0.02f
|
|
#define MARINE_A_BEARING_STEP 1.0f
|
|
// Max range is now step-indexed (see MARINE_A_SCOPE_*, PPI_MTC_*, PPI_BOAT_* tables above)
|
|
|
|
/* ============================================================
|
|
* KEYBOARD CONTROL LIMITS
|
|
* Component: Thread 1 keyboard handler (main.cpp)
|
|
* ============================================================ */
|
|
|
|
#define INTENSITY_MIN 0.0f
|
|
#define INTENSITY_MAX 2.0f
|
|
#define SENSITIVITY_MIN 0.0f
|
|
#define SENSITIVITY_MAX 2.0f
|
|
#define STC_SENSITIVITY_MIN 0.0f
|
|
#define STC_SENSITIVITY_MAX 1.0f
|
|
#define STC_RANGE_MIN 0.0f
|
|
#define STC_RANGE_MAX 1.0f
|
|
#define NOISE_FILTER_MIN 0.0f
|
|
#define NOISE_FILTER_MAX 1.0f
|
|
#define RANGE_CURSOR_MIN 0.0f
|
|
#define RANGE_CURSOR_MAX 1.0f
|
|
// Max range limits removed — range is now step-indexed, clamped by table size
|