[Gcblue-commits] gcb_wx/src/graphics tc3DViewer.cpp,1.10,1.11 tcGameView.cpp,1.5,1.6 tcHookInfo.cpp,
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-03-05 22:38:13
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21843/src/graphics Modified Files: tc3DViewer.cpp tcGameView.cpp tcHookInfo.cpp tcMapView.cpp Log Message: Added sonobuoy model. 2525 view now uses small symbol for ballistic and sonobuoy instead of unknown symbol Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcMapView.cpp 2 Mar 2005 22:28:43 -0000 1.18 --- tcMapView.cpp 5 Mar 2005 22:38:02 -0000 1.19 *************** *** 967,970 **** --- 967,1010 ---- } + /** + * "Mark" symbol is for known objects such as shells and sonobuoys that do + * not have individual symbols, but may be shown on the map in some modes. + */ + osg::Geometry* tcTacticalMapView::DrawDefaultMark(teAffiliation affil) + { + float w = 2.0f; // symbol size + float h = 2.0f; + + osg::Geometry* symbol = CreateSymbolGeometry(); + + // set color + osg::Vec4Array* colors = new osg::Vec4Array; + colors->push_back(GetAffiliationColor(affil)); + symbol->setColorArray(colors); + symbol->setColorBinding(osg::Geometry::BIND_OVERALL); + + // create vertex array + osg::Vec3Array* vertices = new osg::Vec3Array; + symbol->setVertexArray(vertices); + + + switch (affil) + { + case FRIENDLY: + case NEUTRAL: + case UNKNOWN: + case HOSTILE: + { + vertices->push_back(osg::Vec3(-w, h, 0)); + vertices->push_back(osg::Vec3(-w, -h, 0)); + vertices->push_back(osg::Vec3(w, -h, 0)); + vertices->push_back(osg::Vec3(w, h, 0)); + symbol->addPrimitiveSet(new osg::DrawArrays(GL_LINE_LOOP,0,4)); + break; + } + } + + return symbol; + } /** *************** *** 1412,1416 **** osg::Geometry* pTorpedo = DrawNTDSTorpedo((teAffiliation)nAffiliation); ! // unknown (small square, not strictly NTDS --- 1452,1457 ---- osg::Geometry* pTorpedo = DrawNTDSTorpedo((teAffiliation)nAffiliation); ! // mark symbol ! osg::Geometry* pMark = DrawDefaultMark((teAffiliation)nAffiliation); // unknown (small square, not strictly NTDS *************** *** 1449,1452 **** --- 1490,1496 ---- pSymbol = pGround; break; + case SYMBOL_MARK: + pSymbol = pMark; + break; default: pSymbol = pUnknown; *************** *** 1508,1511 **** --- 1552,1557 ---- osg::Geometry* pTorpedo = CreateTexturedSymbol(zBuff); + osg::Geometry* pMark = DrawDefaultMark((teAffiliation)nAffiliation); + osg::Geometry* pUnknown = CreateTexturedSymbol("unknown.png"); *************** *** 1544,1547 **** --- 1590,1596 ---- pSymbol = pFixed; break; + case SYMBOL_MARK: + pSymbol = pMark; + break; default: pSymbol = pUnknown; *************** *** 1669,1672 **** --- 1718,1726 ---- symbsize = 30.0f; } + else if (type == SYMBOL_MARK) + { + symbsize = 8.0f; + vectsize = 10.0f; + } osg::Vec4 penColor = GetAffiliationColor(pMO->meAffiliation); *************** *** 1814,1826 **** } ! if ((mbShowTrackID) && (pMO->mnID!=NULL_INDEX) && (type != SYMBOL_UNKNOWN)) { wxString s = wxString::Format("%04d", pMO->mnID); - // char zBuff[16]; - //mpBrush->SetColor(0xFEFFFFFF); - //sprintf(zBuff,"%04d",pMO->mnID); DrawTextR(s.c_str(), x-9.0f, y+15.0f, defaultFont.get(), symbolColor, 8.0, LEFT_BASE_LINE); } // draw focus box if applicable if ((pMO->mbFocus)&&(pMO->mnID!=NULL_INDEX)) --- 1868,1880 ---- } + bool suppressTrackId = (pMO->mnID == NULL_INDEX) || (type == SYMBOL_UNKNOWN) || + (type == SYMBOL_MARK); ! if (mbShowTrackID && !suppressTrackId) { wxString s = wxString::Format("%04d", pMO->mnID); DrawTextR(s.c_str(), x-9.0f, y+15.0f, defaultFont.get(), symbolColor, 8.0, LEFT_BASE_LINE); } + // draw focus box if applicable if ((pMO->mbFocus)&&(pMO->mnID!=NULL_INDEX)) Index: tcHookInfo.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcHookInfo.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcHookInfo.cpp 7 Nov 2004 03:40:44 -0000 1.6 --- tcHookInfo.cpp 5 Mar 2005 22:38:02 -0000 1.7 *************** *** 134,138 **** DrawTextR(s.c_str(), ftextx, ftexty, defaultFont.get(), color, fontSize, LEFT_BASE_LINE); ! ftexty += 15; --- 134,148 ---- DrawTextR(s.c_str(), ftextx, ftexty, defaultFont.get(), color, fontSize, LEFT_BASE_LINE); ! ftexty += 15; ! ! // Draw reporting platform info ! unsigned nContributors = pSMTrack->mnContributors; ! s = "Detected by: "; ! for (unsigned k=0; k<nContributors; k++) ! { ! s += std::string(pSMTrack->GetContributorName(k)); ! if (k < nContributors-1) s += ","; ! } ! DrawTextR(s.c_str(), ftextx, ftexty, defaultFont.get(), color, fontSize, LEFT_BASE_LINE); ftexty += 15; Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tc3DViewer.cpp 21 Feb 2005 18:26:11 -0000 1.10 --- tc3DViewer.cpp 5 Mar 2005 22:37:52 -0000 1.11 *************** *** 1059,1062 **** --- 1059,1074 ---- } + bool shakeEligible = ((obj->mpDBObject->mnType & (PTYPE_AIR | PTYPE_MISSILE)) != 0) && + (cameraRange < 25.0f); + if (shakeAirCamera && shakeEligible) + { + osg::Vec3 walkOffset(randfc(0.1f), randfc(0.1f), randfc(0.08f)); + osg::Vec3 filteredOffset = walkOffset * 0.1f + lastWalkOffset * 0.9f; + lastWalkOffset = filteredOffset; + cameraWalkOffset += filteredOffset; + + cameraPosition += cameraWalkOffset; + } + sceneView->setViewMatrixAsLookAt(cameraPosition, cameraTarget, osg::Vec3(0,0,1)); sceneViewFar->setViewMatrixAsLookAt(cameraPosition, cameraTarget, osg::Vec3(0,0,1)); *************** *** 1792,1796 **** const wxString& name) : wxWindow(parent, -1, pos, size, wxTRANSPARENT_WINDOW | wxNO_FULL_REPAINT_ON_RESIZE, name), ! mnHeight(size.GetHeight()), mnWidth(size.GetWidth()) { glCanvas = parent; --- 1804,1809 ---- const wxString& name) : wxWindow(parent, -1, pos, size, wxTRANSPARENT_WINDOW | wxNO_FULL_REPAINT_ON_RESIZE, name), ! mnHeight(size.GetHeight()), mnWidth(size.GetWidth()), ! cameraWalkOffset(0, 0, 0) { glCanvas = parent; *************** *** 1879,1882 **** --- 1892,1897 ---- tc3DModel::LoadUnknowns(); + shakeAirCamera = tcOptions::Get()->OptionStringExists("ShakeAirCamera"); + // rootnode->addChild(tcSound::Get()->GetSoundRoot()); } Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcGameView.cpp 2 Mar 2005 22:28:43 -0000 1.5 --- tcGameView.cpp 5 Mar 2005 22:38:02 -0000 1.6 *************** *** 107,110 **** --- 107,114 ---- return SYMBOL_TORPEDO; break; + case PTYPE_BALLISTIC: + case PTYPE_SONOBUOY: + return SYMBOL_MARK; + break; case PTYPE_FIXED: return SYMBOL_FIXED; *************** *** 621,625 **** mpMapView->maMapObj[rnIndex].mnColor = 0; ! if (mpMapView->maMapObj[rnIndex].meSymbol != SYMBOL_FIXED) { mpMapView->maMapObj[rnIndex].mfHeading = po->mcKin.mfHeading_rad; --- 625,630 ---- mpMapView->maMapObj[rnIndex].mnColor = 0; ! if ((mpMapView->maMapObj[rnIndex].meSymbol != SYMBOL_FIXED) && ! (po->mcKin.mfSpeed_kts > 0)) { mpMapView->maMapObj[rnIndex].mfHeading = po->mcKin.mfHeading_rad; |