[Gcblue-commits] gcb_wx/src/sim tcAeroAirObject.cpp,1.15,1.16 tcMapData.cpp,1.18,1.19
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-05-26 11:54:22
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29026/src/sim Modified Files: tcAeroAirObject.cpp tcMapData.cpp Log Message: air model changes Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcMapData.cpp 11 Mar 2005 02:34:58 -0000 1.18 --- tcMapData.cpp 26 May 2005 11:54:12 -0000 1.19 *************** *** 364,370 **** void tcMapData::CreatePalettes() { ! int nRed,nGreen,nBlue,nAlpha; - nAlpha = 255; for (int k=0; k<100; k++) { --- 364,371 ---- void tcMapData::CreatePalettes() { ! unsigned int nRed,nGreen,nBlue; ! ! unsigned int alpha_val = 0xFF000000; for (int k=0; k<100; k++) { *************** *** 372,376 **** nGreen = 10; nBlue = 90; ! maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + (nAlpha << 24); } for (k=100; k<1024; k++) --- 373,377 ---- nGreen = 10; nBlue = 90; ! maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; } for (k=100; k<1024; k++) *************** *** 380,387 **** nBlue = (k-100)*8/10; ! nRed = min(255,nRed+80); ! nGreen = min(255,nGreen+80); ! nBlue = min(255,nBlue+60); ! maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + (nAlpha << 24); } } --- 381,395 ---- nBlue = (k-100)*8/10; ! /* For some reason values have to be limited to 128 to avoid distorted colors. ! ** This started happening after switching the terrain map to use osg::Texture ! */ ! nRed = min(128,nRed+80); ! nGreen = min(128,nGreen+80); ! nBlue = min(128,nBlue+60); ! ! maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + alpha_val; ! //unsigned int nGray = (k-100); ! //if (nGray > 128) nGray = 128; ! //maPalette1[k] = nGray + (nGray << 8) + (nGray << 16) + alpha_val; } } *************** *** 1180,1186 **** pval = (anMapID==0) ? maGlobal[m][n] : maTheater[m][n]; // TODO: move out of loop somehow nPaletteIndex = (pval/10) + 100; ! if (nPaletteIndex > 147) // TODO bug here that needs fixing, higher values distort on texture { ! nPaletteIndex = 147; } else if (nPaletteIndex < 0) --- 1188,1194 ---- pval = (anMapID==0) ? maGlobal[m][n] : maTheater[m][n]; // TODO: move out of loop somehow nPaletteIndex = (pval/10) + 100; ! if (nPaletteIndex > 247) // TODO bug here that needs fixing, higher values distort on texture { ! nPaletteIndex = 247; } else if (nPaletteIndex < 0) Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcAeroAirObject.cpp 21 May 2005 02:01:04 -0000 1.15 --- tcAeroAirObject.cpp 26 May 2005 11:54:11 -0000 1.16 *************** *** 225,260 **** * @return parasitic drag coeff including 0.5 factor */ ! float tcAeroAirObject::GetParasiticDragCoefficient(float vmach) { ! float mcrit; // critical mach number ! float mtran; // midpoint of transonic region ! float msup; // start of supersonice region ! float K_dp; // parasitic drag coeff ! ! // parasitic drag coeff calculation ! mcrit = mpDBObject->mfMcm; ! msup = mpDBObject->mfMsupm; ! mtran = 0.5f*(mcrit + msup); ! ! ! if (vmach <= mcrit) ! { ! K_dp = mpDBObject->mfCdpsub; // drag coeff includes 0.5*area factor ! } ! else if (vmach >= msup) ! { ! K_dp = mpDBObject->mfCdpsup; ! } ! else if (vmach <= mtran) ! { ! K_dp = (vmach - mcrit)*(mpDBObject->mfCdptran-mpDBObject->mfCdpsub)/(mtran-mcrit) ! + mpDBObject->mfCdpsub; ! } ! else // (vmach > mtran)&&(vmach < msup) ! { ! K_dp = (msup - vmach)*(mpDBObject->mfCdptran-mpDBObject->mfCdpsup)/(msup-mtran) ! + mpDBObject->mfCdpsup; ! } ! return K_dp; } --- 225,231 ---- * @return parasitic drag coeff including 0.5 factor */ ! float tcAeroAirObject::GetParasiticDragCoefficient(float vmach) const { ! return mpDBObject->GetParasiticDragCoefficient(vmach); } *************** *** 271,282 **** // calculate thrust decay factor based on altitude ! float decayFactor = 1.0f; ! const float decayAlt = 5000.0f; // altitude to start decay at ! if (mcKin.mfAlt_m > decayAlt) ! { ! float dalt = mcKin.mfAlt_m - decayAlt; ! decayFactor = expf(-(dalt * dalt * mpDBObject->mfAltThrustDecay_pm)); ! } ! if (throttleFraction <= 1.0f) --- 242,247 ---- // calculate thrust decay factor based on altitude ! float decayFactor = mpDBObject->GetThrustFactor(mcKin.mfAlt_m); ! if (throttleFraction <= 1.0f) *************** *** 340,349 **** float ias_mps = sqrtf(0.8f * rho) * mfSpeed_mps; // approximate indicated airspeed ! float stall_margin = ias_mps - mpDBObject->stallSpeed_mps; - const float induced_drag_zone = 100.0f; - const float aoaConstant = 0.001f; ! if (stall_margin <= 0) { throttleFraction = 1.0f; --- 305,313 ---- float ias_mps = sqrtf(0.8f * rho) * mfSpeed_mps; // approximate indicated airspeed ! const float aoaConstant = 5.0f; // for approximation, aoa = C / IAS ! angleOfAttack = aoaConstant / ias_mps; ! if (ias_mps <= mpDBObject->stallSpeed_mps) { throttleFraction = 1.0f; *************** *** 351,368 **** inducedDrag_N = 0; // stall, no induced drag } ! else if (stall_margin < induced_drag_zone) { ! inducedDrag_N = mpDBObject->mfKdi * (induced_drag_zone - stall_margin); ! angleOfAttack = aoaConstant * (induced_drag_zone - stall_margin); } ! else ! { ! inducedDrag_N = 0; ! angleOfAttack = 0; ! } float netForce_N = fThrust_N - fDrag_N - inducedDrag_N - weight_N *sinf(k.mfClimbAngle_rad); ! /* drag model has some issues, acceleration is too slow, faster accel can ** obtained by climbing and then descending which is not correct. ** Adding a 4.0 factor for faster accel/decel --- 315,328 ---- inducedDrag_N = 0; // stall, no induced drag } ! else { ! // assumes level flight ! inducedDrag_N = mpDBObject->mfKdi * weight_N * angleOfAttack; } ! float netForce_N = fThrust_N - fDrag_N - inducedDrag_N - weight_N *sinf(k.mfClimbAngle_rad); ! /* drag model has issues: acceleration is too slow, faster accel can ** obtained by climbing and then descending which is not correct. ** Adding a 4.0 factor for faster accel/decel |