[Gcblue-commits] gcb_wx/src/graphics tc3DViewer.cpp, 1.38, 1.39 tcContainerItem.cpp, 1.3, 1.4 tcFli
Status: Alpha
Brought to you by:
ddcforge
From: Dewitt C. <ddc...@us...> - 2006-10-01 21:07:45
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv6071/src/graphics Modified Files: tc3DViewer.cpp tcContainerItem.cpp tcFlightPortGui.cpp tcMapView.cpp tcStartView.cpp Log Message: Airbase automation updates Index: tcStartView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcStartView.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcStartView.cpp 27 Mar 2006 01:08:17 -0000 1.13 --- tcStartView.cpp 1 Oct 2006 21:07:40 -0000 1.14 *************** *** 96,103 **** ! /*wxString s = wxString::Format("%s Test Build", __DATE__); ! DrawTextR(s.c_str(), 85.0, 180.0, ! GetDefaultFont(), color, 24.0, LEFT_BASE_LINE);*/ --- 96,103 ---- ! wxString s = wxString::Format("%s Test Build", __DATE__); ! DrawTextR(s.c_str(), 85.0, 225.0, ! GetDefaultFont(), color, 24.0, LEFT_BASE_LINE); Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** tcMapView.cpp 24 Sep 2006 19:50:20 -0000 1.49 --- tcMapView.cpp 1 Oct 2006 21:07:40 -0000 1.50 *************** *** 725,729 **** // update symbology selection ! meSymbology = (mpOptions->mbUseNTDS) ? NTDS : M2525; /*** Draw nav points ***/ --- 725,741 ---- // update symbology selection ! // 0 - 2525, 1 - NTDS computer, 2 - NTDS image ! if (mpOptions->symbologyType == 0) ! { ! meSymbology = M2525; ! } ! else if (mpOptions->symbologyType == 1) ! { ! meSymbology = NTDS; ! } ! else ! { ! meSymbology = NTDS_IMAGE; ! } /*** Draw nav points ***/ *************** *** 1676,1685 **** } /** ! * Creates textured osg::Geometry objects for M2525 icon symbol set */ ! void tcTacticalMapView::Build2525() { ! char zBuff[128]; osg::Geometry* pSymbol = 0; --- 1688,1712 ---- } + + void tcTacticalMapView::Build2525() + { + BuildImageSymbology(0, "m2525"); + } + + void tcTacticalMapView::BuildNTDSImage() + { + BuildImageSymbology(1, "ntds"); + } + + /** ! * Creates textured osg::Geometry objects for symbology described in image files ! * @param subdirectory directory within images\symbology to read files from ! * */ ! void tcTacticalMapView::BuildImageSymbology(int symbolArray, const std::string& subdirectory) { ! const size_t nBuff = 128; ! char zBuff[nBuff]; osg::Geometry* pSymbol = 0; *************** *** 1704,1738 **** } ! sprintf(zBuff,"seasurface%s",zAffil); osg::Geometry* pSurface = CreateTexturedSymbol(zBuff); ! sprintf(zBuff,"carrier%s",zAffil); osg::Geometry* pCarrier = CreateTexturedSymbol(zBuff); ! sprintf(zBuff,"air_fw%s",zAffil); osg::Geometry* pAir = CreateTexturedSymbol(zBuff); ! sprintf(zBuff,"air_rw%s",zAffil); osg::Geometry* pHelo = CreateTexturedSymbol(zBuff); ! sprintf(zBuff,"missile%s",zAffil); osg::Geometry* pMissile = CreateTexturedSymbol(zBuff); ! sprintf(zBuff,"fixed%s",zAffil); osg::Geometry* pFixed = CreateTexturedSymbol(zBuff); ! sprintf(zBuff,"airfield%s",zAffil); osg::Geometry* pAirfield = CreateTexturedSymbol(zBuff); ! sprintf(zBuff,"sub%s",zAffil); osg::Geometry* pSub = CreateTexturedSymbol(zBuff); ! sprintf(zBuff,"torp%s",zAffil); osg::Geometry* pTorpedo = CreateTexturedSymbol(zBuff); osg::Geometry* pMark = DrawDefaultMark((teAffiliation)nAffiliation); ! ! osg::Geometry* pUnknown = CreateTexturedSymbol("unknown.png"); --- 1731,1765 ---- } ! _snprintf(zBuff, nBuff, "%s\\seasurface%s", subdirectory.c_str(), zAffil); osg::Geometry* pSurface = CreateTexturedSymbol(zBuff); ! _snprintf(zBuff, nBuff, "%s\\carrier%s", subdirectory.c_str(), zAffil); osg::Geometry* pCarrier = CreateTexturedSymbol(zBuff); ! _snprintf(zBuff, nBuff, "%s\\air_fw%s", subdirectory.c_str(), zAffil); osg::Geometry* pAir = CreateTexturedSymbol(zBuff); ! _snprintf(zBuff, nBuff, "%s\\air_rw%s", subdirectory.c_str(), zAffil); osg::Geometry* pHelo = CreateTexturedSymbol(zBuff); ! _snprintf(zBuff, nBuff, "%s\\missile%s", subdirectory.c_str(), zAffil); osg::Geometry* pMissile = CreateTexturedSymbol(zBuff); ! _snprintf(zBuff, nBuff, "%s\\fixed%s", subdirectory.c_str(), zAffil); osg::Geometry* pFixed = CreateTexturedSymbol(zBuff); ! _snprintf(zBuff, nBuff, "%s\\airfield%s", subdirectory.c_str(), zAffil); osg::Geometry* pAirfield = CreateTexturedSymbol(zBuff); ! _snprintf(zBuff, nBuff, "%s\\sub%s", subdirectory.c_str(), zAffil); osg::Geometry* pSub = CreateTexturedSymbol(zBuff); ! _snprintf(zBuff, nBuff, "%s\\torp%s", subdirectory.c_str(), zAffil); osg::Geometry* pTorpedo = CreateTexturedSymbol(zBuff); osg::Geometry* pMark = DrawDefaultMark((teAffiliation)nAffiliation); ! _snprintf(zBuff, nBuff, "%s\\unknown.png", subdirectory.c_str()); ! osg::Geometry* pUnknown = CreateTexturedSymbol(zBuff); *************** *** 1782,1786 **** break; } ! maSymbolB[nAffiliation][nSymbol] = pSymbol; } } --- 1809,1820 ---- break; } ! if (symbolArray == 0) ! { ! maSymbolB[nAffiliation][nSymbol] = pSymbol; ! } ! else ! { ! maSymbolC[nAffiliation][nSymbol] = pSymbol; ! } } } *************** *** 1819,1822 **** --- 1853,1866 ---- } { + osg::Geometry* fadedC = new osg::Geometry(*maSymbolC[nAffiliation][nSymbol]); + osg::Vec4Array* colors = new osg::Vec4Array; + colors->push_back(osg::Vec4(0.4, 0.4, 0.4, 1.0)); + fadedC->setColorArray(colors); + fadedC->setColorBinding(osg::Geometry::BIND_OVERALL); + + maSymbolC_fade[nAffiliation][nSymbol] = fadedC; + } + + { osg::Geometry* altA = new osg::Geometry(*maSymbolA[nAffiliation][nSymbol]); *************** *** 1838,1841 **** --- 1882,1894 ---- maSymbolB_alt[nAffiliation][nSymbol] = altB; } + { + osg::Geometry* altC = new osg::Geometry(*maSymbolC[nAffiliation][nSymbol]); + osg::Vec4Array* colors = new osg::Vec4Array; + colors->push_back(osg::Vec4(0.6, 0.6, 0.8, 1.0)); + altC->setColorArray(colors); + altC->setColorBinding(osg::Geometry::BIND_OVERALL); + + maSymbolC_alt[nAffiliation][nSymbol] = altC; + } } *************** *** 1861,1868 **** return maSymbolA[nAffilIdx][nSymbolIdx].get(); } ! else { return maSymbolB[nAffilIdx][nSymbolIdx].get(); } } --- 1914,1925 ---- return maSymbolA[nAffilIdx][nSymbolIdx].get(); } ! else if (meSymbology == M2525) { return maSymbolB[nAffilIdx][nSymbolIdx].get(); } + else + { + return maSymbolC[nAffilIdx][nSymbolIdx].get(); + } } *************** *** 1881,1888 **** return maSymbolA_alt[nAffilIdx][nSymbolIdx].get(); } ! else { return maSymbolB_alt[nAffilIdx][nSymbolIdx].get(); } } --- 1938,1949 ---- return maSymbolA_alt[nAffilIdx][nSymbolIdx].get(); } ! else if (meSymbology == M2525) { return maSymbolB_alt[nAffilIdx][nSymbolIdx].get(); } + else + { + return maSymbolC_alt[nAffilIdx][nSymbolIdx].get(); + } } *************** *** 1901,1908 **** return maSymbolA_fade[nAffilIdx][nSymbolIdx].get(); } ! else { return maSymbolB_fade[nAffilIdx][nSymbolIdx].get(); } } --- 1962,1973 ---- return maSymbolA_fade[nAffilIdx][nSymbolIdx].get(); } ! else if (meSymbology == M2525) { return maSymbolB_fade[nAffilIdx][nSymbolIdx].get(); } + else + { + return maSymbolC_fade[nAffilIdx][nSymbolIdx].get(); + } } *************** *** 2433,2436 **** --- 2498,2502 ---- BuildNTDS(); Build2525(); + BuildNTDSImage(); CreateAlternateSymbols(); Index: tcFlightPortGui.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcFlightPortGui.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcFlightPortGui.cpp 28 Sep 2006 02:01:53 -0000 1.10 --- tcFlightPortGui.cpp 1 Oct 2006 21:07:40 -0000 1.11 *************** *** 37,40 **** --- 37,42 ---- #include "tcPlatformObject.h" #include "tcSimState.h" + #include <osg/Geometry> + #include "ai/tcMissionManager.h" #ifdef _DEBUG *************** *** 167,170 **** --- 169,173 ---- captionColor, 18.0f, LEFT_BASE_LINE); + // draw slots and items size_t nSlots = slots.size(); *************** *** 175,189 **** bool isMouseOver = slot.IsMouseOver(); if (item) { int drawState = item->GetDrawState(); ! bool doDraw = (drawState == tcContainerItem::NORMAL) || ! ((drawState == tcContainerItem::BLINK) && blinkOn); ! if (doDraw) { ! osg::Geometry* icon = slot.GetIcon(); ! DrawGeometryR(icon, slot.loc.XCenter(), slot.loc.YCenter()); ! } // draw description caption if mouse is over slot --- 178,224 ---- bool isMouseOver = slot.IsMouseOver(); + bool unitQueuedForTakeoff = false; if (item) { int drawState = item->GetDrawState(); ! osg::Vec4 itemColor(1, 1, 1, 1); ! /* Determine item color (color mixed with image color) ! ** Damaged - red ! ** Not fully equipped and refueled - yellow ! ** Repositioning - blink blue ! ** Reserved for mission - darken 50% ! */ ! tcPlatformObject* platform = dynamic_cast<tcPlatformObject*>(item->GetEntity()); ! if (platform != 0) { ! if (platform->GetDamageLevel() > 0) ! { ! itemColor.set(1, 0, 0, 1); ! } ! else if (!platform->IsReadyForLaunch()) ! { ! itemColor.set(1, 1, 0.5, 1); ! } ! else if ((drawState == tcContainerItem::BLINK) && !blinkOn) ! { ! itemColor.set(0.5, 0.5, 1, 1); ! } ! ! if (flightPort->GetMissionManager()->IsAircraftReserved(platform->mnID)) ! { ! itemColor = itemColor * 0.7; ! } ! ! unitQueuedForTakeoff = flightPort->IsQueuedForTakeoff(platform->mnID); ! } ! ! osg::Geometry* icon = slot.GetIcon(); ! ! osg::Vec4Array* colorArray = dynamic_cast<osg::Vec4Array*>(icon->getColorArray()); // assumes color array already created ! colorArray->back() = itemColor; ! ! DrawGeometryR(icon, slot.loc.XCenter(), slot.loc.YCenter()); ! // draw description caption if mouse is over slot *************** *** 205,212 **** borderColor.set(1, 1, 1, 1); } else { ! borderColor.set(0.5, 0.5, 0.5, 1); } DrawRectangleR(r, borderColor, tc3DWindow::FILL_OFF); --- 240,252 ---- borderColor.set(1, 1, 1, 1); } + else if (unitQueuedForTakeoff) + { + borderColor.set(0.8, 1.0, 0.8, 1.0); + } else { ! borderColor.set(0.5, 0.5, 0.5, 1.0); } + DrawRectangleR(r, borderColor, tc3DWindow::FILL_OFF); Index: tcContainerItem.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcContainerItem.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcContainerItem.cpp 23 Mar 2006 01:11:02 -0000 1.3 --- tcContainerItem.cpp 1 Oct 2006 21:07:40 -0000 1.4 *************** *** 29,32 **** --- 29,33 ---- #include "tcContainerItem.h" #include "tcContainerGui.h" + #include <osg/CopyOp> #include <osg/Geometry> *************** *** 93,97 **** void tcContainerItem::SetIcon(osg::Geometry* icon_) { ! icon = icon_; } --- 94,98 ---- void tcContainerItem::SetIcon(osg::Geometry* icon_) { ! icon = new osg::Geometry(*icon_, osg::CopyOp(osg::CopyOp::DEEP_COPY_DRAWABLES)); } Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** tc3DViewer.cpp 24 Sep 2006 19:50:20 -0000 1.38 --- tc3DViewer.cpp 1 Oct 2006 21:07:40 -0000 1.39 *************** *** 1949,1953 **** { viewerText->setPosition(osg::Vec3(20.0f,(float)mnHeight - 40.0f,0.0f)); ! viewerText->setAlignment(osgText::Text::AlignmentType::LEFT_BASE_LINE); } else if (positionCode == 1) --- 1949,1953 ---- { viewerText->setPosition(osg::Vec3(20.0f,(float)mnHeight - 40.0f,0.0f)); ! viewerText->setAlignment(osgText::Text::LEFT_BASE_LINE); } else if (positionCode == 1) *************** *** 1955,1959 **** viewerText->setPosition(osg::Vec3(0.5f * (float)mnWidth, (float)mnHeight - 40.0f, 0.0f)); ! viewerText->setAlignment(osgText::Text::AlignmentType::CENTER_CENTER); } else --- 1955,1959 ---- viewerText->setPosition(osg::Vec3(0.5f * (float)mnWidth, (float)mnHeight - 40.0f, 0.0f)); ! viewerText->setAlignment(osgText::Text::CENTER_CENTER); } else *************** *** 1961,1965 **** viewerText->setPosition(osg::Vec3(0.5f * (float)mnWidth, (float)40.0f, 0.0f)); ! viewerText->setAlignment(osgText::Text::AlignmentType::CENTER_CENTER); } } --- 1961,1965 ---- viewerText->setPosition(osg::Vec3(0.5f * (float)mnWidth, (float)40.0f, 0.0f)); ! viewerText->setAlignment(osgText::Text::CENTER_CENTER); } } *************** *** 1974,1987 **** AddTextObject(0, upperLeft, 12.0, color, ! osgText::Text::AlignmentType::LEFT_BASE_LINE); AddTextObject(1, upperRight, 12.0, color, ! osgText::Text::AlignmentType::LEFT_BASE_LINE); AddTextObject(2, bottomCenter, 16.0, osg::Vec4(0.9f, 0.9f, 0.7f, 0.9f), ! osgText::Text::AlignmentType::CENTER_CENTER); AddTextObject(3, topCenter, 16.0, osg::Vec4(0.9f, 0.9f, 0.7f, 0.9f), ! osgText::Text::AlignmentType::CENTER_CENTER); } --- 1974,1987 ---- AddTextObject(0, upperLeft, 12.0, color, ! osgText::Text::LEFT_BASE_LINE); AddTextObject(1, upperRight, 12.0, color, ! osgText::Text::LEFT_BASE_LINE); AddTextObject(2, bottomCenter, 16.0, osg::Vec4(0.9f, 0.9f, 0.7f, 0.9f), ! osgText::Text::CENTER_CENTER); AddTextObject(3, topCenter, 16.0, osg::Vec4(0.9f, 0.9f, 0.7f, 0.9f), ! osgText::Text::CENTER_CENTER); } *************** *** 2106,2110 **** { pm = new osg::PolygonMode(); ! pm->setMode(osg::PolygonMode::Face::FRONT_AND_BACK, osg::PolygonMode::FILL); stateSet->setAttribute(pm, osg::StateAttribute::ON); } --- 2106,2110 ---- { pm = new osg::PolygonMode(); ! pm->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL); stateSet->setAttribute(pm, osg::StateAttribute::ON); } *************** *** 2112,2120 **** if (viewWireframe) { ! pm->setMode(osg::PolygonMode::Face::FRONT_AND_BACK, osg::PolygonMode::LINE); } else { ! pm->setMode(osg::PolygonMode::Face::FRONT_AND_BACK, osg::PolygonMode::FILL); } --- 2112,2120 ---- if (viewWireframe) { ! pm->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE); } else { ! pm->setMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL); } |