Initial setup for project, preparing for first component
This commit is contained in:
112
global_data.cpp
Normal file
112
global_data.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* global_data.cpp
|
||||
* Author: Mark Allyn
|
||||
*
|
||||
* Definitions of all system-wide global variables.
|
||||
* Extern declarations live in include/data_structure_and_constants.h.
|
||||
*/
|
||||
|
||||
#include "include/data_structure_and_constants.h"
|
||||
|
||||
/* ============================================================
|
||||
* THREAD MUTEXES
|
||||
* Components: all threads as noted per mutex
|
||||
* ============================================================ */
|
||||
|
||||
// Thread 2 -> Thread 1: target data handoff
|
||||
// Components: Traffic Cop (Thread 2), Thread 1
|
||||
std::mutex mutex_target_data;
|
||||
|
||||
// Thread 3 -> Thread 2: simulator to traffic cop
|
||||
// Components: Simulator (Thread 3), Traffic Cop (Thread 2)
|
||||
std::mutex mutex_simulator_to_traffic_cop;
|
||||
|
||||
// Thread 4 -> Thread 1: physical control panel data (not yet implemented)
|
||||
// Components: Physical Controls (Thread 4), Thread 1
|
||||
std::mutex mutex_control_data_to_shaders;
|
||||
|
||||
// Thread 5 -> Thread 2: Raspberry Pi receiver to traffic cop (not yet implemented)
|
||||
// Components: Raspberry Pi Receiver (Thread 5), Traffic Cop (Thread 2)
|
||||
std::mutex mutex_raspberry_pi;
|
||||
|
||||
/* ============================================================
|
||||
* SHADER UNIFORM COPIES
|
||||
* These are set by keyboard callbacks in Thread 1 and pushed to
|
||||
* GLSL shader uniforms each frame render.
|
||||
* Initial values are sensible defaults; adjust in include/settings.h
|
||||
* as components are developed and tested.
|
||||
* ============================================================ */
|
||||
|
||||
// Scope intensity — keyboard 3 (lower) / 4 (higher)
|
||||
// GLSL uniform: float intensity
|
||||
// Components: all scopes
|
||||
float uniform_intensity = 1.0f;
|
||||
|
||||
// Receiver sensitivity — keyboard 5 (lower) / 6 (higher)
|
||||
// GLSL uniform: float sensitivity
|
||||
// Components: all scopes
|
||||
float uniform_sensitivity = 1.0f;
|
||||
|
||||
// STC sensitivity for close-in targets — keyboard q (lower) / w (higher)
|
||||
// GLSL uniform: float stc_sensitivity
|
||||
// Components: all scopes
|
||||
float uniform_stc_sensitivity = 0.5f;
|
||||
|
||||
// STC effective range (normalized 0-1) — keyboard e (lower) / r (higher)
|
||||
// GLSL uniform: float stc_range
|
||||
// Components: all scopes
|
||||
float uniform_stc_range = 0.3f;
|
||||
|
||||
// Rain noise filter, PPI scopes only — keyboard t (decrease) / y (increase)
|
||||
// GLSL uniform: float noise_filter
|
||||
// Components: PPI scopes (marine traffic control, on-board boat)
|
||||
float uniform_noise_filter = 0.0f;
|
||||
|
||||
// Chain Home radiogoniometer bearing in degrees — keyboard u (left) / i (right)
|
||||
// GLSL uniform: float radiogoniometer
|
||||
// Components: Chain Home A-scope
|
||||
float uniform_radiogoniometer = 0.0f;
|
||||
|
||||
// Maximum radar range (scope-dependent units) — keyboard o (lower) / p (higher)
|
||||
// GLSL uniform: float max_range
|
||||
// Components: Marine A-scope, PPI scopes (not Chain Home; that is fixed)
|
||||
float uniform_max_range = 1.0f;
|
||||
|
||||
// Range cursor position (normalized 0-1) — keyboard a (lower) / s (higher)
|
||||
// GLSL uniform: float range_cursor
|
||||
// Components: PPI scopes (marine traffic control, on-board boat)
|
||||
float uniform_range_cursor = 0.5f;
|
||||
|
||||
// Bearing cursor in degrees — keyboard d (CCW) / f (CW)
|
||||
// GLSL uniform: float bearing_cursor
|
||||
// Components: PPI scopes (marine traffic control, on-board boat)
|
||||
float uniform_bearing_cursor = 0.0f;
|
||||
|
||||
// Marine A-scope antenna rotation bearing in degrees — keyboard g (CCW) / h (CW)
|
||||
// GLSL uniform: float marine_a_bearing
|
||||
// Components: Marine A-scope
|
||||
float uniform_marine_a_bearing = 0.0f;
|
||||
Reference in New Issue
Block a user