X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCockpit%2Fhud_tbi.cxx;h=c6130c867b4f5b445c7b38f692898720a627a3ff;hb=d982efc4c4d166e144023664b8ac1c63233f5f82;hp=25db5111c35fb0b2426f1f713d441f86ea9a3f03;hpb=1bf3001749ee560d3da6dafe556418f3f53348a3;p=flightgear.git diff --git a/src/Cockpit/hud_tbi.cxx b/src/Cockpit/hud_tbi.cxx index 25db5111c..c6130c867 100644 --- a/src/Cockpit/hud_tbi.cxx +++ b/src/Cockpit/hud_tbi.cxx @@ -1,5 +1,6 @@ #include "hud.hxx" +#include //============ Top of fgTBI_instr class member definitions ============== @@ -14,7 +15,9 @@ fgTBI_instr( int x, float maxBankAngle, float maxSlipAngle, UINT gap_width, - bool working ) : + bool working, + bool tsivalue, //suma + float radius) : //suma dual_instr_item( x, y, width, height, chn1_source, chn2_source, @@ -24,6 +27,8 @@ fgTBI_instr( int x, SlewLimit ((int)(maxSlipAngle)), scr_hole (gap_width ) { + tsi=tsivalue; //suma + rad=radius; //suma } fgTBI_instr :: ~fgTBI_instr() {} @@ -65,64 +70,230 @@ operator = (const fgTBI_instr & rhs ) RECT My_box = get_location(); POINT centroid = get_centroid(); int tee_height = My_box.bottom; - + bank_angle = current_ch2(); // Roll limit +/- 30 degrees - if( bank_angle < -SG_PI_2/3 ) { - bank_angle = -SG_PI_2/3; - } else if( bank_angle > SG_PI_2/3 ) { - bank_angle = SG_PI_2/3; + if( bank_angle < -SGD_PI_2/3 ) + { + bank_angle = -SGD_PI_2/3; + } + else if( bank_angle > SGD_PI_2/3 ) + { + bank_angle = SGD_PI_2/3; } - sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees - - if( sideslip_angle < -SG_PI/9 ) { - sideslip_angle = -SG_PI/9; - } else if( sideslip_angle > SG_PI/9 ) { - sideslip_angle = SG_PI/9; + + sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees + + if( sideslip_angle < -SGD_PI/9 ) + { + sideslip_angle = -SGD_PI/9; + } + else if( sideslip_angle > SGD_PI/9 ) + { + sideslip_angle = SGD_PI/9; } cen_x = centroid.x; cen_y = centroid.y; - bank = bank_angle * RAD_TO_DEG; - tee = -tee_height; + + bank = bank_angle * SGD_RADIANS_TO_DEGREES; + tee = -tee_height; fspan = span; hole = scr_hole; - ss_const = 2 * sideslip_angle * fspan/(SG_2PI/9); // width represents 40 degrees + ss_const = 2 * sideslip_angle * fspan/(SGD_2PI/9); // width represents 40 degrees // printf("side_slip: %f fspan: %f\n", sideslip_angle, fspan); // printf("ss_const: %f hole: %f\n", ss_const, hole); + glPushMatrix(); glTranslatef(cen_x, cen_y, zero); glRotatef(-bank, zero, zero, 1.0); - glBegin(GL_LINES); + if(!tsi) + { + + glBegin(GL_LINES); + + if( !scr_hole ) + { + glVertex2f( -fspan, zero ); + glVertex2f( fspan, zero ); + } + else + { + glVertex2f( -fspan, zero ); + glVertex2f( -hole, zero ); + glVertex2f( hole, zero ); + glVertex2f( fspan, zero ); + } + // draw teemarks + glVertex2f( hole, zero ); + glVertex2f( hole, tee ); + glVertex2f( -hole, zero ); + glVertex2f( -hole, tee ); + + glEnd(); - if( !scr_hole ) - { - glVertex2f( -fspan, zero ); - glVertex2f( fspan, zero ); - } else { - glVertex2f( -fspan, zero ); - glVertex2f( -hole, zero ); - glVertex2f( hole, zero ); - glVertex2f( fspan, zero ); - } - // draw teemarks - glVertex2f( hole, zero ); - glVertex2f( hole, tee ); - glVertex2f( -hole, zero ); - glVertex2f( -hole, tee ); - - glEnd(); - - glBegin(GL_LINE_LOOP); - glVertex2f( ss_const, -hole); - glVertex2f( ss_const + hole, zero); - glVertex2f( ss_const, hole); - glVertex2f( ss_const - hole, zero); - glEnd(); - - glPopMatrix(); + glBegin(GL_LINE_LOOP); + glVertex2f( ss_const, -hole); + glVertex2f( ss_const + hole, zero); + glVertex2f( ss_const, hole); + glVertex2f( ss_const - hole, zero); + glEnd(); + + + } + + + else //if tsi enabled + { + float factor = My_box.right / 6.0; + + drawOneLine(cen_x-1.0, My_box.top, cen_x+1.0, My_box.top); + drawOneLine(cen_x-1.0, My_box.top, cen_x-1.0, My_box.top+10.0); + drawOneLine(cen_x+1.0, My_box.top, cen_x+1.0, My_box.top+10.0); + drawOneLine(cen_x-1.0, My_box.top+10.0, cen_x+1.0, My_box.top+10.0); + + float x1, y1, x2, y2, x3, y3, x4,y4, x5, y5; + float xc, yc, r=rad, r1= rad-10.0, r2=rad-5.0; + + xc = My_box.left + My_box.right/ 2.0 ; + yc = My_box.top + r; + +//first n last lines + x1= xc + r * cos (255.0 * SGD_DEGREES_TO_RADIANS); + y1= yc + r * sin (255.0 * SGD_DEGREES_TO_RADIANS); + + x2= xc + r1 * cos (255.0 * SGD_DEGREES_TO_RADIANS); + y2= yc + r1 * sin (255.0 * SGD_DEGREES_TO_RADIANS); + + drawOneLine(x1,y1,x2,y2); + + x1= xc + r * cos (285.0 * SGD_DEGREES_TO_RADIANS); + y1= yc + r * sin (285.0 * SGD_DEGREES_TO_RADIANS); + + x2= xc + r1 * cos (285.0 * SGD_DEGREES_TO_RADIANS); + y2= yc + r1 * sin (285.0 * SGD_DEGREES_TO_RADIANS); + + drawOneLine(x1,y1,x2,y2); + +//second n fifth lines + + x1= xc + r * cos (260.0 * SGD_DEGREES_TO_RADIANS); + y1= yc + r * sin (260.0 * SGD_DEGREES_TO_RADIANS); + + x2= xc + r2 * cos (260.0 * SGD_DEGREES_TO_RADIANS); + y2= yc + r2 * sin (260.0 * SGD_DEGREES_TO_RADIANS); + + drawOneLine(x1,y1,x2,y2); + + x1= xc + r * cos (280.0 * SGD_DEGREES_TO_RADIANS); + y1= yc + r * sin (280.0 * SGD_DEGREES_TO_RADIANS); + + + x2= xc + r2 * cos (280.0 * SGD_DEGREES_TO_RADIANS); + y2= yc + r2 * sin (280.0 * SGD_DEGREES_TO_RADIANS); + + drawOneLine(x1,y1,x2,y2); + +//third n fourth lines + + + x1= xc + r * cos (265.0 * SGD_DEGREES_TO_RADIANS); + y1= yc + r * sin (265.0 * SGD_DEGREES_TO_RADIANS); + + + x2= xc + r2 * cos (265.0 * SGD_DEGREES_TO_RADIANS); + y2= yc + r2 * sin (265.0 * SGD_DEGREES_TO_RADIANS); + + drawOneLine(x1,y1,x2,y2); + + x1= xc + r * cos (275.0 * SGD_DEGREES_TO_RADIANS); + y1= yc + r * sin (275.0 * SGD_DEGREES_TO_RADIANS); + + x2= xc + r2 * cos (275.0 * SGD_DEGREES_TO_RADIANS); + y2= yc + r2 * sin (275.0 * SGD_DEGREES_TO_RADIANS); + + drawOneLine(x1,y1,x2,y2); + + //to draw marker + + + + float valbank, valsideslip, sideslip; + + r = rad + 5.0; //5 is added to get a gap + // upper polygon + bank_angle = current_ch2(); + + bank= bank_angle * SGD_RADIANS_TO_DEGREES; // Roll limit +/- 30 degrees + if(bank > BankLimit) + bank = BankLimit; + if(bank < -1.0*BankLimit) + bank = -1.0*BankLimit; + + valbank = bank * 15.0 / BankLimit; // total span of TSI is 30 degrees + + sideslip_angle = current_ch1(); // Sideslip limit +/- 20 degrees + sideslip= sideslip_angle * SGD_RADIANS_TO_DEGREES; + if(sideslip > SlewLimit) + sideslip = SlewLimit; + if(sideslip < -1.0*SlewLimit) + sideslip = -1.0*SlewLimit; + valsideslip = sideslip * 15.0 / SlewLimit; + + //values 270, 225 and 315 are angles in degrees... + + x1= xc + r * cos ((valbank+270.0) * SGD_DEGREES_TO_RADIANS); + y1= yc + r * sin ((valbank+270.0) * SGD_DEGREES_TO_RADIANS); + + x2= x1 + 6.0 * cos (225 * SGD_DEGREES_TO_RADIANS); + y2= y1 + 6.0 * sin (225 * SGD_DEGREES_TO_RADIANS); + + x3= x1 + 6.0 * cos (315 * SGD_DEGREES_TO_RADIANS); + y3= y1 + 6.0 * sin (315 * SGD_DEGREES_TO_RADIANS); + + drawOneLine(x1, y1, x2, y2); + drawOneLine(x2, y2, x3, y3); + drawOneLine(x3, y3, x1, y1); + + //lower polygon... + + + + x1= xc + r * cos ((valbank+270.0) * SGD_DEGREES_TO_RADIANS); + y1= yc + r * sin ((valbank+270.0) * SGD_DEGREES_TO_RADIANS); + + x2= x1 + 6.0 * cos (225 * SGD_DEGREES_TO_RADIANS); + y2= y1 + 6.0 * sin (225 * SGD_DEGREES_TO_RADIANS); + + x3= x1 + 6.0 * cos (315 * SGD_DEGREES_TO_RADIANS); + y3= y1 + 6.0 * sin (315 * SGD_DEGREES_TO_RADIANS); + + x4= x1 + 10.0 * cos (225 * SGD_DEGREES_TO_RADIANS); + y4= y1 + 10.0 * sin (225 * SGD_DEGREES_TO_RADIANS); + + x5= x1 + 10.0 * cos (315 * SGD_DEGREES_TO_RADIANS); + y5= y1 + 10.0 * sin (315 * SGD_DEGREES_TO_RADIANS); + + x2 = x2 + cos (valsideslip * SGD_DEGREES_TO_RADIANS); + y2 = y2 + sin (valsideslip * SGD_DEGREES_TO_RADIANS); + x3 = x3 + cos (valsideslip * SGD_DEGREES_TO_RADIANS); + y3 = y3 + sin (valsideslip * SGD_DEGREES_TO_RADIANS); + x4 = x4 + cos (valsideslip * SGD_DEGREES_TO_RADIANS); + y4 = y4 + sin (valsideslip * SGD_DEGREES_TO_RADIANS); + x5 = x5 + cos (valsideslip * SGD_DEGREES_TO_RADIANS); + y5 = y5 + sin (valsideslip * SGD_DEGREES_TO_RADIANS); + + drawOneLine(x2, y2, x3, y3); + drawOneLine(x3, y3, x5, y5); + drawOneLine(x5, y5, x4, y4); + drawOneLine(x4, y4, x2, y2); + + + } + + glPopMatrix(); }