xp12camera

Owner: IIIlllIIIllI URL: git@github.com:nyangkosense/xp12camera.git

fixed

Commit 5f90346c885c3bd7b33764d33bed4fb87ec03353 by SM <seb.michalk@gmail.com> on 2025-06-25 19:25:47 +0200
diff --git a/FLIR_Camera.cpp b/FLIR_Camera.cpp
index b1d61bd..8d28809 100644
--- a/FLIR_Camera.cpp
+++ b/FLIR_Camera.cpp
@@ -456,28 +456,52 @@ static void DrawRealisticThermalOverlay(void)
     glEnable(GL_BLEND);
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     
+    // Camera effect - dark vignette border for camera look
+    glColor4f(0.0f, 0.0f, 0.0f, 0.7f);
+    float borderSize = 60.0f;
+    glBegin(GL_QUADS);
+    // Top border
+    glVertex2f(0, 0);
+    glVertex2f(screenWidth, 0);
+    glVertex2f(screenWidth, borderSize);
+    glVertex2f(0, borderSize);
+    // Bottom border
+    glVertex2f(0, screenHeight - borderSize);
+    glVertex2f(screenWidth, screenHeight - borderSize);
+    glVertex2f(screenWidth, screenHeight);
+    glVertex2f(0, screenHeight);
+    // Left border
+    glVertex2f(0, 0);
+    glVertex2f(borderSize, 0);
+    glVertex2f(borderSize, screenHeight);
+    glVertex2f(0, screenHeight);
+    // Right border
+    glVertex2f(screenWidth - borderSize, 0);
+    glVertex2f(screenWidth, 0);
+    glVertex2f(screenWidth, screenHeight);
+    glVertex2f(screenWidth - borderSize, screenHeight);
+    glEnd();
+    
     // Draw thermal border effect if thermal mode is active
     if (gThermalMode > 0) {
-        glColor4f(0.0f, 1.0f, 0.0f, 0.3f); // Subtle green tint
+        glColor4f(0.0f, 1.0f, 0.0f, 0.2f); // Subtle green tint
         glBegin(GL_QUADS);
         // Top border
-        glVertex2f(0, 0);
-        glVertex2f(screenWidth, 0);
-        glVertex2f(screenWidth, 20);
-        glVertex2f(0, 20);
+        glVertex2f(borderSize, borderSize);
+        glVertex2f(screenWidth - borderSize, borderSize);
+        glVertex2f(screenWidth - borderSize, borderSize + 10);
+        glVertex2f(borderSize, borderSize + 10);
         // Bottom border
-        glVertex2f(0, screenHeight - 20);
-        glVertex2f(screenWidth, screenHeight - 20);
-        glVertex2f(screenWidth, screenHeight);
-        glVertex2f(0, screenHeight);
+        glVertex2f(borderSize, screenHeight - borderSize - 10);
+        glVertex2f(screenWidth - borderSize, screenHeight - borderSize - 10);
+        glVertex2f(screenWidth - borderSize, screenHeight - borderSize);
+        glVertex2f(borderSize, screenHeight - borderSize);
         glEnd();
     }
     
-    // Military-style targeting brackets [ ] - FIXED SIZE
+    // Draw crosshair in center
     float centerX = screenWidth / 2.0f;
     float centerY = screenHeight / 2.0f;
-    float bracketSize = 50.0f;  // Fixed size - doesn't change with zoom
-    float bracketLength = 20.0f;
     
     // Set color based on lock status
     if (IsLockOnActive()) {
@@ -487,6 +511,21 @@ static void DrawRealisticThermalOverlay(void)
     }
     
     glLineWidth(2.0f);
+    
+    // Central crosshair
+    glBegin(GL_LINES);
+    // Horizontal line
+    glVertex2f(centerX - 20, centerY);
+    glVertex2f(centerX + 20, centerY);
+    // Vertical line
+    glVertex2f(centerX, centerY - 20);
+    glVertex2f(centerX, centerY + 20);
+    glEnd();
+    
+    // Military-style targeting brackets [ ] - FIXED SIZE
+    float bracketSize = 50.0f;  // Fixed size - doesn't change with zoom
+    float bracketLength = 20.0f;
+    
     glBegin(GL_LINES);
     
     // Top-left bracket [
@@ -515,6 +554,21 @@ static void DrawRealisticThermalOverlay(void)
     
     glEnd();
     
+    
+    // Corner indicators
+    glBegin(GL_LINES);
+    // Top corners
+    glVertex2f(borderSize + 20, borderSize + 20);
+    glVertex2f(borderSize + 40, borderSize + 20);
+    glVertex2f(borderSize + 20, borderSize + 20);
+    glVertex2f(borderSize + 20, borderSize + 40);
+    
+    glVertex2f(screenWidth - borderSize - 20, borderSize + 20);
+    glVertex2f(screenWidth - borderSize - 40, borderSize + 20);
+    glVertex2f(screenWidth - borderSize - 20, borderSize + 20);
+    glVertex2f(screenWidth - borderSize - 20, borderSize + 40);
+    glEnd();
+    
     // Center dot
     glPointSize(4.0f);
     glBegin(GL_POINTS);
diff --git a/FLIR_Camera.o b/FLIR_Camera.o
index a527ffd..60dc31d 100644
Binary files a/FLIR_Camera.o and b/FLIR_Camera.o differ
diff --git a/FLIR_HUD.lua b/FLIR_HUD.lua
index 21f9351..45e06c8 100644
--- a/FLIR_HUD.lua
+++ b/FLIR_HUD.lua
@@ -5,21 +5,26 @@
 -- Global variables
 flir_start_time = flir_start_time or os.time()
 
+-- Dataref variables (declared once to prevent stack overflow)
+local view_type_ref = dataref_table("sim/graphics/view/view_type")
+local manipulator_ref = dataref_table("sim/operation/prefs/misc/manipulator_disabled")
+local zulu_time_ref = dataref_table("sim/time/zulu_time_sec")
+local latitude_ref = dataref_table("sim/flightmodel/position/latitude") 
+local longitude_ref = dataref_table("sim/flightmodel/position/longitude")
+local altitude_ref = dataref_table("sim/flightmodel/position/elevation")
+local ground_speed_ref = dataref_table("sim/flightmodel/position/groundspeed")
+local heading_ref = dataref_table("sim/flightmodel/position/psi")
+
 function draw_flir_hud()
-    -- Check if FLIR camera is active via shared dataref
-    local flir_active = dataref_table("sim/operation/prefs/misc/manipulator_disabled")
-    
-    -- Only draw HUD when FLIR camera is actually active (manipulator disabled indicates camera mode)
-    local view_type = dataref_table("sim/graphics/view/view_type")
-    
-    if view_type[0] == 1026 and flir_active[0] == 1 then  -- External view AND camera active
-        -- Get basic aircraft data safely
-        local zulu_time = dataref_table("sim/time/zulu_time_sec")[0]
-        local latitude = dataref_table("sim/flightmodel/position/latitude")[0]
-        local longitude = dataref_table("sim/flightmodel/position/longitude")[0]
-        local altitude_msl = dataref_table("sim/flightmodel/position/elevation")[0]
-        local ground_speed = dataref_table("sim/flightmodel/position/groundspeed")[0]
-        local heading = dataref_table("sim/flightmodel/position/psi")[0]
+    -- Only draw HUD when FLIR camera is actually active
+    if view_type_ref[0] == 1026 and manipulator_ref[0] == 1 then  -- External view AND camera active
+        -- Get basic aircraft data safely using pre-declared datarefs
+        local zulu_time = zulu_time_ref[0]
+        local latitude = latitude_ref[0]
+        local longitude = longitude_ref[0]
+        local altitude_msl = altitude_ref[0]
+        local ground_speed = ground_speed_ref[0]
+        local heading = heading_ref[0]
         
         -- Convert zulu time to HH:MM format
         local hours = math.floor(zulu_time / 3600) % 24
diff --git a/build/FLIR_Camera/win_x64/FLIR_Camera.xpl b/build/FLIR_Camera/win_x64/FLIR_Camera.xpl
index 604d4df..596e120 100755
Binary files a/build/FLIR_Camera/win_x64/FLIR_Camera.xpl and b/build/FLIR_Camera/win_x64/FLIR_Camera.xpl differ