[Gcblue-commits] gcb_wx/src/graphics tc3DModel.cpp,1.31,1.32 tcMapView.cpp,1.33,1.34
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-11-27 22:21:38
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6732/src/graphics Modified Files: tc3DModel.cpp tcMapView.cpp Log Message: - Added waypoint drag edit feature to gui. User can adjust waypoints on map screen by clicking and dragging - Fixed sound disable to include music. Previously sound failure would disable sound effects, but then play music leading to a crash. - Added random feature targeting to missiles. Missiles should now lock on to a random feature of the target instead of always hitting the center. Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcMapView.cpp 10 Sep 2005 21:47:38 -0000 1.33 --- tcMapView.cpp 27 Nov 2005 22:21:29 -0000 1.34 *************** *** 384,389 **** void tcTacticalMapView::DrawSelectionBox() { ! if (!isLButtonDown) return; ! osg::Vec4 color(1, 1, 1, 1); --- 384,388 ---- void tcTacticalMapView::DrawSelectionBox() { ! if ((!isLButtonDown)||(editPointIdx > 0)) return; osg::Vec4 color(1, 1, 1, 1); *************** *** 559,563 **** int nSize = (int)maNavPointScreen.size(); ! osg::Vec4 color(1, 1, 1, 0.5); for (int i=0; i<nSize-1; i++) --- 558,575 ---- int nSize = (int)maNavPointScreen.size(); ! /* if a waypoint is being edited, draw the edit point at the current mouse position ! ** by substituting edit point for appropriate point in navpoint array ! */ ! if ((editPointIdx > 0) && ((size_t)editPointIdx < maNavPointScreen.size())) ! { ! maNavPointScreen[editPointIdx] = tcPoint((float)mpointMouse.x, (float)mpointMouse.y); ! tcPoint editPoint = ScreenToGeo(maNavPointScreen[editPointIdx].x, ! maNavPointScreen[editPointIdx].y); ! maNavPointGeo[editPointIdx].mfLon_rad = editPoint.x; ! maNavPointGeo[editPointIdx].mfLat_rad = editPoint.y; ! } ! ! const osg::Vec4 color(1, 1, 1, 0.5); ! const osg::Vec4 editColor(1, 1, 1, 1); for (int i=0; i<nSize-1; i++) *************** *** 567,570 **** --- 579,590 ---- DrawLineR(p1.x, p1.y, p2.x, p2.y, color); + if (i != editPointIdx - 1) + { + DrawRectangleR(p2.x - 2.0, p2.y - 2.0, 4.0, 4.0, color, tc3DWindow::FILL_ON); + } + else + { + DrawRectangleR(p2.x - 3.0, p2.y - 3.0, 6.0, 6.0, editColor, tc3DWindow::FILL_ON); + } } } *************** *** 658,662 **** /*** Draw selection box ***/ ! DrawSelectionBox(); /*** Draw date and time text ***/ --- 678,682 ---- /*** Draw selection box ***/ ! DrawSelectionBox(); /*** Draw date and time text ***/ *************** *** 2346,2349 **** --- 2366,2372 ---- } + // check if button is down near a nav waypoint, if so start edit + CheckForNavPointEdit(buttonDownPoint); + isLButtonDown = true; *************** *** 2353,2356 **** --- 2376,2402 ---- /** + * Check if button is down near a nav waypoint-- if so, start edit + */ + void tcTacticalMapView::CheckForNavPointEdit(const wxPoint& buttonDownPoint) + { + tcPoint buttonDownPointFloat((float)buttonDownPoint.x, (float)buttonDownPoint.y); + const float editDistance = 4.0f; + + for (size_t n=1; n<maNavPointScreen.size(); n++) + { + const tcPoint& p = maNavPointScreen[n]; + + float distance = p.DistanceTo(buttonDownPointFloat); + if (distance < editDistance) + { + editPointIdx = (int)n; + return; + } + } + + editPointIdx = -1; // click was not near a waypoint + } + + /** * Left mouse button up event handler. */ *************** *** 2360,2363 **** --- 2406,2423 ---- wxPoint buttonUpPoint = event.GetPosition(); + + if (editPointIdx > 0) + { + tcPoint geoPoint = ScreenToGeo(buttonUpPoint); + wxString argString = wxString::Format(",%d,%f,%f", editPointIdx-1, geoPoint.x, geoPoint.y); + + mpCommandInterface->AddPythonCommandGeneral("EditWaypoint", argString.c_str(), hookedId); + + editPointIdx = -1; + isLButtonDown = false; + return; + } + + bool isAltDown = event.AltDown(); Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** tc3DModel.cpp 19 Nov 2005 19:27:47 -0000 1.31 --- tc3DModel.cpp 27 Nov 2005 22:21:29 -0000 1.32 *************** *** 492,496 **** } - osg::ref_ptr<osg::Node> tc3DModel::GetNode() { --- 492,495 ---- *************** *** 499,502 **** --- 498,506 ---- } + osg::Node* tc3DModel::GetModelNode() + { + return modelNode.get(); + } + unsigned int tc3DModel::GetNumParents() { *************** *** 516,519 **** --- 520,525 ---- } + + /** * @return radius of rendered model, considering generics *************** *** 893,899 **** if (explosionQueue.size() == 0) return; ! float scale = 20.0f; float intensity = 5.0f; // get location of model in world frame LocationParams p; --- 899,909 ---- if (explosionQueue.size() == 0) return; ! float scale = 15.0f; float intensity = 5.0f; + /* set position of explosion to location where it occurred, note that + ** explosion center is fixed in world frame and will not follow along + ** with vehicle movement */ + // get location of model in world frame LocationParams p; *************** *** 908,912 **** bool& isVisible = p.isVisible; ! osg::Vec3 pos(x, y, z); --- 918,925 ---- bool& isVisible = p.isVisible; ! osg::Vec3 pos = explosionQueue.front(); ! pos._v[0] += x; ! pos._v[1] += y; ! pos._v[2] += z; |