SYN_oGL_draw
Description
SYN_oGL_draw.c is a module within the SYN project (likely synSwath), specifically responsible for managing the 3D camera view (position and orientation) within the OpenGL simulation environment. It is not a standalone command-line tool.
This module provides the core logic for controlling how the user perceives the simulated scene, allowing for various “look-at” modes that dynamically adjust the camera based on different points of interest and the overall state of the simulation.
Functionality
void move_view()
- Purpose: Sets the camera’s position, orientation, and perspective in the 3D OpenGL scene. This function acts as the central control point for camera navigation within the
SYNapplication. - Action:
- Retrieves Global State: Accesses global variables that define the simulated object’s current pose (
object_roll,object_pitch,object_heading,object_heave), the camera’s current perspective settings (eye_x,eye_y,eye_z,eye_azi,eye_elev,eye_range), and the currentlookatmode. - Determines Look-at Target: Based on the
lookatglobal variable, it calculates the (x, y, z) coordinates of the point the camera should focus on:lookat == ANTENNA: The target is a specific antenna position (read fromRF_props[LOOKAT_FOCUS]), transformed from the object’s body frame to the geographical frame, considering the object’s attitude and heave.lookat == PLATE: The target is defined by the plate’s current position and nudges (plate_xshift,plate_yshift,plate_zshift,plate_xnudge,plate_ynudge,plate_znudge).lookat == CENTRE: The target is the origin (0,0,0) of the scene.lookat == MIDDLE: The target is (0,0,0.5), representing the middle depth.lookat == BOTTOM: The target is (0,0,1.0), representing the bottom of the normalized depth range.lookat == CUSTOM: The target is explicitly set bylookat_X,lookat_Y,lookat_Z.
- Calculates Camera Position: The camera’s eye position (
ex,ey,ez) is then calculated relative to the chosen look-at target, using the globaleye_x,eye_y,eye_zvalues (which represent the camera’s position relative to the target when the target is at the origin). - Applies OpenGL Transformations: Finally, it calls
move_the_view()(a function declared injGL_draw.hand implemented injGL_draw.c) passing the calculated eye and target coordinates. This function, in turn, usesgluPerspective()to set the viewing frustum andgluLookAt()to position and orient the camera in the OpenGL world.
- Retrieves Global State: Accesses global variables that define the simulated object’s current pose (
This module is a critical part of the application’s visualization core, enabling users to interactively navigate the complex simulated environment, inspect different components, and analyze data from various strategic perspectives.