+ }
+
+ //****************************************************************
+ //velocity vector reticle - computations
+ if(velocity_vector) {
+ Vxx = get_Vx();
+ Vyy = get_Vy();
+ Vzz = get_Vz();
+ Axx = get_Ax();
+ Ayy = get_Ay();
+ Azz = get_Az();
+ psi = get_heading();
+
+ if (psi > 180.0) psi = psi - 360;
+
+ total_vel = sqrt(Vxx*Vxx + Vyy*Vyy + Vzz*Vzz);
+ ground_vel = sqrt(Vxx*Vxx + Vyy*Vyy);
+ up_vel = Vzz;
+
+ if (ground_vel < 2.0) {
+ if (fabs(up_vel) < 2.0) {
+ actslope = 0.0;
+ } else {
+ actslope = (up_vel/fabs(up_vel))*90.0;
+ }
+ } else {
+ actslope = atan(up_vel/ground_vel)*SGD_RADIANS_TO_DEGREES;
+ }
+
+ xvvr = (((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi)*
+ (factor/globals->get_current_view()->get_aspect_ratio()));
+ drift = ((atan2(Vyy,Vxx)*SGD_RADIANS_TO_DEGREES)-psi);
+ yvvr = ((actslope - pitch_value)*factor);
+ vel_y = ((actslope -pitch_value) * cos(roll_value) + drift*sin(roll_value))*factor;
+ vel_x = (-(actslope -pitch_value)*sin(roll_value) + drift*cos(roll_value))*
+ (factor/globals->get_current_view()->get_aspect_ratio());
+ // printf("%f %f %f %f\n",vel_x,vel_y,drift,psi);
+ //****************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE - DRIFT MARKER
+ // ATTRIB - ALWAYS
+ // drift marker
+ if(drift_marker) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f((xvvr*25/120)-6, -4);
+ glVertex2f(xvvr*25/120, 8);
+ glVertex2f((xvvr*25/120)+6, -4);
+ glEnd();
+ }
+
+ //****************************************************************
+ // Clipping coordinates for ladder to be input from xml file
+ // Clip hud ladder
+ if (clip_plane) {
+ glClipPlane(GL_CLIP_PLANE0,eqn_top);
+ glEnable(GL_CLIP_PLANE0);
+ glClipPlane(GL_CLIP_PLANE1,eqn_left);
+ glEnable(GL_CLIP_PLANE1);
+ glClipPlane(GL_CLIP_PLANE2,eqn_right);
+ glEnable(GL_CLIP_PLANE2);
+ // glScissor(-100,-240,200,240);
+ // glEnable(GL_SCISSOR_TEST);
+ }
+ //****************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE VELOCITY VECTOR
+ // ATTRIB - ALWAYS
+ // velocity vector
+ glBegin(GL_LINE_LOOP); // Use polygon to approximate a circle
+ for(count=0; count<50; count++) {
+ cosine = 6 * cos(count * 2 * SGD_PI/50.0);
+ sine = 6 * sin(count * 2 * SGD_PI/50.0);
+ glVertex2f(cosine+vel_x, sine+vel_y);
+ }
+ glEnd();
+ //velocity vector reticle orientation lines
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-12, vel_y);
+ glVertex2f(vel_x-6, vel_y);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+12, vel_y);
+ glVertex2f(vel_x+6, vel_y);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x, vel_y+12);
+ glVertex2f(vel_x, vel_y+6);
+ glEnd();
+
+ // OBJECT MOVING RETICLE
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ if (lgear == 1) {
+ // undercarriage status
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+8, vel_y);
+ glVertex2f(vel_x+8, vel_y-4);
+ glEnd();
+ // OBJECT MOVING RETICLE
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-8, vel_y);
+ glVertex2f(vel_x-8, vel_y-4);
+ glEnd();
+ // OBJECT MOVING RETICLE
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x, vel_y-6);
+ glVertex2f(vel_x, vel_y-10);
+ glEnd();
+ }
+
+ // OBJECT MOVING RETICLE
+ // TYPE V
+ // ATTRIB - ON CONDITION
+ if (ihook == 1) {
+ // arrestor hook status
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-4, vel_y-8);
+ glVertex2f(vel_x, vel_y-10);
+ glVertex2f(vel_x+4, vel_y-8);
+ glEnd();
+ }
+ }//if velocity_vector
+
+ //***************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE - SQUARE_BRACKET
+ // ATTRIB - ON CONDITION
+ // alpha bracket
+ if (alpha_bracket) {
+ if (ihook == 1) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-20 , vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x-17, vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x-17, vel_y-(14-alpha)*factor);
+ glVertex2f(vel_x-20, vel_y-(14-alpha)*factor);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+20 , vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x+17, vel_y-(16-alpha)*factor);
+ glVertex2f(vel_x+17, vel_y-(14-alpha)*factor);
+ glVertex2f(vel_x+20, vel_y-(14-alpha)*factor);
+ glEnd();
+ }
+ }
+ //printf("xvr=%f,yvr=%f,Vx=%f,Vy=%f,Vz=%f\n",xvvr,yvvr,Vx,Vy,Vz);
+ //printf("Ax=%f,Ay=%f,Az=%f\n",Ax,Ay,Az);
+ //****************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE ENERGY_MARKERS
+ // ATTRIB - ALWAYS
+ //energy markers - compute potential slope
+ if(energy_marker) {
+ if (total_vel < 5.0) {
+ t1 = 0;
+ t2 = 0;
+ } else {
+ t1 = up_vel/total_vel;
+ t2 = asin((Vxx*Axx + Vyy*Ayy + Vzz*Azz)/(9.81*total_vel));
+ }
+ pot_slope = ((t2/3)*SGD_RADIANS_TO_DEGREES)*factor + vel_y;
+ // if (pot_slope < (vel_y - 45)) pot_slope = vel_y-45;
+ // if (pot_slope > (vel_y + 45)) pot_slope = vel_y+45;
+
+ //energy markers
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-20, pot_slope-5);
+ glVertex2f(vel_x-15, pot_slope);
+ glVertex2f(vel_x-20, pot_slope+5);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+20, pot_slope-5);
+ glVertex2f(vel_x+15, pot_slope);
+ glVertex2f(vel_x+20, pot_slope+5);
+ glEnd();
+ if (pla > (105.0/131.0)) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x-24, pot_slope-5);
+ glVertex2f(vel_x-19, pot_slope);
+ glVertex2f(vel_x-24, pot_slope+5);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(vel_x+24, pot_slope-5);
+ glVertex2f(vel_x+19, pot_slope);
+ glVertex2f(vel_x+24, pot_slope+5);
+ glEnd();
+ }
+ }
+ //**********************************************************
+ // ramp reticle
+ // OBJECT STATIC RETICLE
+ // TYPE LINE
+ // ATTRIB - ON CONDITION
+ if (energy_worm) {
+ if (ilcanclaw == 1) {
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(-15, -134);
+ glVertex2f(15, -134);
+ glEnd();
+ // OBJECT MOVING RETICLE
+ // TYPE BOX
+ // ATTRIB - ON CONDITION
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(-6, -134);
+ glVertex2f(-6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
+ glVertex2f(+6, t2*SGD_RADIANS_TO_DEGREES*4.0 - 134);
+ glVertex2f(6, -134);
+ glEnd();
+ // OBJECT MOVING RETICLE
+ // TYPE DIAMOND
+ // ATTRIB - ON CONDITION
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(-6, actslope*4.0 - 134);
+ glVertex2f(0, actslope*4.0 -134 +3);
+ glVertex2f(6, actslope*4.0 - 134);
+ glVertex2f(0, actslope*4.0 -134 -3);
+ glEnd();
+ }
+ }
+ //*************************************************************
+ // OBJECT MOVING RETICLE
+ // TYPE DIAMOND
+ // ATTRIB - ALWAYS
+ // Draw the locked velocity vector.
+ if(climb_dive_marker) {
+ glBegin(GL_LINE_LOOP);
+ glVertex2f( -3.0, 0.0+vel_y);
+ glVertex2f(0.0, 6.0+vel_y);
+ glVertex2f( 3.0, 0.0+vel_y);
+ glVertex2f(0.0, -6.0+vel_y);
+ glEnd();
+ }
+
+ //****************************************************************
+
+ if(climb_dive_ladder)
+ { // CONFORMAL_HUD
+
+ vmin = pitch_value - (float)width_units;
+ vmax = pitch_value + (float)width_units;
+
+ glTranslatef( vel_x, vel_y, 0);