gcblue-commits Mailing List for Global Conflict Blue (Page 33)
Status: Alpha
Brought to you by:
ddcforge
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(112) |
Feb
(106) |
Mar
(88) |
Apr
(111) |
May
(53) |
Jun
(60) |
Jul
(58) |
Aug
(61) |
Sep
(45) |
Oct
(31) |
Nov
(71) |
Dec
(70) |
| 2005 |
Jan
(33) |
Feb
(57) |
Mar
(98) |
Apr
(47) |
May
(53) |
Jun
(79) |
Jul
(79) |
Aug
|
Sep
(33) |
Oct
(1) |
Nov
(20) |
Dec
(64) |
| 2006 |
Jan
(20) |
Feb
(1) |
Mar
(43) |
Apr
(11) |
May
(8) |
Jun
(23) |
Jul
|
Aug
(28) |
Sep
(58) |
Oct
(25) |
Nov
(47) |
Dec
(70) |
|
From: Dewitt C. <ddc...@us...> - 2005-03-02 22:29:25
|
Update of /cvsroot/gcblue/gcb_wx/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15614/xml Modified Files: chat_box.xml network_view.xml options.xml Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: options.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/options.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** options.xml 27 Jan 2005 01:02:07 -0000 1.12 --- options.xml 2 Mar 2005 22:28:45 -0000 1.13 *************** *** 7,9 **** --- 7,11 ---- <xWriteXmlDatabase /> <Log3DModelDetails /> + <UsePositionRegistry /> + <AutoKillAssessment /> </Options> Index: network_view.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/network_view.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** network_view.xml 2 Oct 2004 22:41:34 -0000 1.6 --- network_view.xml 2 Mar 2005 22:28:45 -0000 1.7 *************** *** 16,20 **** <Button X="340" Y="305" Width="65" Height="15" Caption="Test Text" Command="170"/> <StatusBox X="250" Y="130" Width="200" Height="100"/> ! <ChatBox X="30" Y="350" Width="400" Height="200" FontSize="11.0"/> <ChatEntry X="30" Y="556" Width="400" Height="16" BarX="0.0" BarY="1.0" BarWidth="400.0" BarHeight="14.0" Caption=""/> --- 16,20 ---- <Button X="340" Y="305" Width="65" Height="15" Caption="Test Text" Command="170"/> <StatusBox X="250" Y="130" Width="200" Height="100"/> ! <ChatBox X="30" Y="350" Width="400" Height="200" FontSize="11.0" DrawBorder="1"/> <ChatEntry X="30" Y="556" Width="400" Height="16" BarX="0.0" BarY="1.0" BarWidth="400.0" BarHeight="14.0" Caption=""/> Index: chat_box.xml =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/xml/chat_box.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** chat_box.xml 9 May 2004 20:41:39 -0000 1.1 --- chat_box.xml 2 Mar 2005 22:28:45 -0000 1.2 *************** *** 1,5 **** <Window> ! <ChatBox X="10" Y="10" Width="280" Height="145" FontSize="9.0"/> ! <ChatEntry X="10" Y="160" Width="280" Height="16" BarX="0.0" BarY="1.0" BarWidth="280.0" BarHeight="14.0" Caption=""/> </Window> \ No newline at end of file --- 1,5 ---- <Window> ! <ChatBox X="10" Y="10" Width="280" Height="145" FontSize="9.0" DrawBorder="1"/> ! <ChatEntry X="10" Y="160" Width="280" Height="16" BarX="0.0" BarY="1.0" BarWidth="280.0" BarHeight="14.0" Caption="" DrawBorder="1"/> </Window> \ No newline at end of file |
|
From: Dewitt C. <ddc...@us...> - 2005-03-02 22:29:25
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15614/src/graphics Modified Files: tc3DWindow.cpp tcConsoleBox.cpp tcGameView.cpp tcMapView.cpp tcNetworkView.cpp tcNumberWidget.cpp Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: tcNetworkView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNetworkView.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcNetworkView.cpp 21 Oct 2004 04:10:59 -0000 1.3 --- tcNetworkView.cpp 2 Mar 2005 22:28:43 -0000 1.4 *************** *** 274,277 **** --- 274,278 ---- chatBox = new tcConsoleBox(this, current); chatBox->SetActive(true); + tcMultiplayerInterface::Get()->AddChatSubscriber(chatBox); Index: tcConsoleBox.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcConsoleBox.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tcConsoleBox.cpp 2 Nov 2004 04:23:56 -0000 1.11 --- tcConsoleBox.cpp 2 Mar 2005 22:28:43 -0000 1.12 *************** *** 110,114 **** } ! mbRedraw = true; return 0; } --- 110,114 ---- } ! redraw = true; return 0; } *************** *** 122,128 **** cursorLine = 0; cursorCol = 0; ! mbRedraw = true; } /** * --- 122,129 ---- cursorLine = 0; cursorCol = 0; ! redraw = true; } + /** * *************** *** 135,139 **** UpdateCursor(); // update cursor position for delayed draw effect ! if (!mbRedraw) return; // DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(1, 1, 1, 1)); --- 136,140 ---- UpdateCursor(); // update cursor position for delayed draw effect ! if (!redraw && !forceRedraw) return; // DrawRectangleR(0, 0, mnWidth, mnHeight, osg::Vec4(1, 1, 1, 1)); *************** *** 168,173 **** } ! mbForceRedraw = false; ! mbRedraw = false; HideUnusedObjects(); --- 169,174 ---- } ! forceRedraw = false; ! redraw = false; HideUnusedObjects(); *************** *** 253,257 **** if (cursorLine == (int)textArray.GetCount()) { ! mbRedraw = false; return; } --- 254,258 ---- if (cursorLine == (int)textArray.GetCount()) { ! redraw = false; return; } *************** *** 266,270 **** cursorCol = 0; } ! mbRedraw = true; return; } --- 267,271 ---- cursorCol = 0; } ! redraw = true; return; } *************** *** 279,283 **** if ((cursorLine == (int)textArray.GetCount()) && EOL) { ! mbRedraw = false; return; // do nothing, cursor has caught up to buffer } --- 280,284 ---- if ((cursorLine == (int)textArray.GetCount()) && EOL) { ! redraw = false; return; // do nothing, cursor has caught up to buffer } *************** *** 291,295 **** cursorCol++; } ! mbRedraw = true; } --- 292,296 ---- cursorCol++; } ! redraw = true; } *************** *** 307,312 **** nwrapcol(80), useDelayedTextEffect(false), ! mbRedraw(true), ! mbForceRedraw(true), nlinespace(15), isMouseOver(false), --- 308,313 ---- nwrapcol(80), useDelayedTextEffect(false), ! redraw(true), ! forceRedraw(true), nlinespace(15), isMouseOver(false), Index: tcNumberWidget.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcNumberWidget.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcNumberWidget.cpp 31 Jan 2005 01:33:07 -0000 1.2 --- tcNumberWidget.cpp 2 Mar 2005 22:28:43 -0000 1.3 *************** *** 144,148 **** SendRedraw(); ! tcSound::Get()->PlayEffect(19); } --- 144,148 ---- SendRedraw(); ! tcSound::Get()->PlayEffect("MutedBeep"); } Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** tcMapView.cpp 21 Feb 2005 18:26:12 -0000 1.17 --- tcMapView.cpp 2 Mar 2005 22:28:43 -0000 1.18 *************** *** 841,848 **** /* osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(GetAffiliationColor(affil)); symbol->setColorArray(colors); ! symbol->setColorBinding(osg::Geometry::BIND_OVERALL); ! */ // create vertex array --- 841,849 ---- /* osg::Vec4Array* colors = new osg::Vec4Array; ! colors->push_back(osg::Vec4(0.5, 0.5, 1.0, 0.5)); symbol->setColorArray(colors); ! symbol->setColorBinding(osg::Geometry::BIND_OVERALL); ! */ ! // create vertex array *************** *** 1554,1557 **** --- 1555,1593 ---- /** + * Creates faded copies of symbol tables. + * Call after tables are built. + */ + void tcTacticalMapView::CreateFadedSymbols() + { + for (int nAffiliation=0; nAffiliation<4; nAffiliation++) + { + for (int nSymbol=0; nSymbol<MAX_SYMBOL; nSymbol++) + { + { + osg::Geometry* fadedA = new osg::Geometry(*maSymbolA[nAffiliation][nSymbol]); + + osg::Vec4Array* colors = new osg::Vec4Array; + colors->push_back(osg::Vec4(0.4, 0.4, 0.4, 1.0)); + fadedA->setColorArray(colors); + fadedA->setColorBinding(osg::Geometry::BIND_OVERALL); + + maSymbolA_fade[nAffiliation][nSymbol] = fadedA; + } + { + osg::Geometry* fadedB = new osg::Geometry(*maSymbolB[nAffiliation][nSymbol]); + osg::Vec4Array* colors = new osg::Vec4Array; + colors->push_back(osg::Vec4(0.4, 0.4, 0.4, 1.0)); + fadedB->setColorArray(colors); + fadedB->setColorBinding(osg::Geometry::BIND_OVERALL); + + maSymbolB_fade[nAffiliation][nSymbol] = fadedB; + } + + } + } + } + + + /** * @returns symbol image pointer based on symbology mode */ *************** *** 1571,1574 **** --- 1607,1629 ---- } + /** + * Faded version of symbols for stale tracks + * @returns symbol image pointer based on symbology mode + */ + osg::Geometry* tcTacticalMapView::GetSymbolFaded(teAffiliation aeAffiliation, teSymbol aeSymbol) + { + int nAffilIdx = (int)aeAffiliation; + int nSymbolIdx = (int)aeSymbol; + + if (meSymbology == NTDS) + { + return maSymbolA_fade[nAffilIdx][nSymbolIdx].get(); + } + else + { + return maSymbolB_fade[nAffilIdx][nSymbolIdx].get(); + } + } + *************** *** 1588,1592 **** teSymbol type; const float passive_vect_size = 75.0f; ! h = pMO->mfHeading; int bHeadingValid = pMO->mnFlags & TRACK_HEADING_VALID; --- 1643,1647 ---- teSymbol type; const float passive_vect_size = 75.0f; ! h = pMO->mfHeading; int bHeadingValid = pMO->mnFlags & TRACK_HEADING_VALID; *************** *** 1729,1734 **** else { ! osg::Geometry* pSymbol = tcTacticalMapView::GetSymbol(pMO->meAffiliation, pMO->meSymbol); DrawGeometryR(pSymbol, x, y); } --- 1784,1808 ---- else { ! osg::Geometry* pSymbol = 0; ! if (!pMO->isStaleTrack) ! { ! pSymbol = tcTacticalMapView::GetSymbol(pMO->meAffiliation, pMO->meSymbol); ! } ! else ! { ! pSymbol = tcTacticalMapView::GetSymbolFaded(pMO->meAffiliation, pMO->meSymbol); ! symbolColor *= 0.5; ! } ! DrawGeometryR(pSymbol, x, y); + + // draw 'X' if destroyed + if (pMO->isDestroyed) + { + const osg::Vec4 red(1.0, 0, 0, 1.0); + const float halfWidth = 10.0f; + DrawLineR(x-halfWidth, y-halfWidth, x+halfWidth, y+halfWidth, red); + DrawLineR(x-halfWidth, y+halfWidth, x+halfWidth, y-halfWidth, red); + } } *************** *** 2023,2029 **** --- 2097,2105 ---- mpMapData->GetTheaterArea(mrectViewBounds); // restrict view to theater area SetView(p, C_PIOVER180*32.0f); + // Build symbologies BuildNTDS(); Build2525(); + CreateFadedSymbols(); } *************** *** 2325,2332 **** ! void tcTacticalMapView::UpdateNavPoints(vector<tcPoint> *mpPoints) { maNavPointGeo.clear(); int n = (int)mpPoints->size(); ! for (int i=0;i<n;i++) { maNavPointGeo.push_back(mpPoints->at(i)); } --- 2401,2410 ---- ! void tcTacticalMapView::UpdateNavPoints(vector<GeoPoint> *mpPoints) ! { maNavPointGeo.clear(); int n = (int)mpPoints->size(); ! for (int i=0;i<n;i++) ! { maNavPointGeo.push_back(mpPoints->at(i)); } *************** *** 2334,2343 **** } ! void tcTacticalMapView::UpdateScreenNavPoints(void) { maNavPointScreen.clear(); int n = (int)maNavPointGeo.size(); ! for (int i=0;i<n;i++) { ! tcPoint p = maNavPointGeo[i]; ! p = GeoToScreen(p); maNavPointScreen.push_back(p); } --- 2412,2423 ---- } ! void tcTacticalMapView::UpdateScreenNavPoints(void) ! { maNavPointScreen.clear(); int n = (int)maNavPointGeo.size(); ! for (int i=0;i<n;i++) ! { ! tcPoint p = GeoToScreen(maNavPointGeo[i].mfLon_rad, ! maNavPointGeo[i].mfLat_rad); maNavPointScreen.push_back(p); } Index: tcGameView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGameView.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcGameView.cpp 20 Feb 2005 18:20:19 -0000 1.4 --- tcGameView.cpp 2 Mar 2005 22:28:43 -0000 1.5 *************** *** 38,41 **** --- 38,42 ---- #include "tcMissileObject.h" #include "ai/Brain.h" + #include "ai/Nav.h" #ifdef _DEBUG *************** *** 131,150 **** } ! void tcGameView::UpdateNavPoints(void) { ! vector<tcPoint> navpoints; ! tcPlatformObject *pPlatformObj = dynamic_cast<tcPlatformObject*>(mpHookedObj); ! if (pPlatformObj == NULL) ! { ! navpoints.clear(); ! } ! else { ! tcPoint pcurrent; ! pcurrent.x = (float)pPlatformObj->mcKin.mfLon_rad; ! pcurrent.y = (float)pPlatformObj->mcKin.mfLat_rad; ! navpoints.push_back(pcurrent); // add current position ! pPlatformObj->mcAI.GetNavPoints(&navpoints); } mpMapView->UpdateNavPoints(&navpoints); } --- 132,162 ---- } ! void tcGameView::UpdateNavPoints() { ! vector<GeoPoint> navpoints; ! ! if (tcPlatformObject *platformObj = dynamic_cast<tcPlatformObject*>(mpHookedObj)) { ! if (ai::Nav* nav = platformObj->GetBrain()->GetNavTask()) ! { ! const vector<GeoPoint>& waypoints = nav->GetWaypoints(); ! // use current position as first point ! if (waypoints.size()) ! { ! GeoPoint pcurrent; ! pcurrent.mfLon_rad = (float)platformObj->mcKin.mfLon_rad; ! pcurrent.mfLat_rad = (float)platformObj->mcKin.mfLat_rad; ! pcurrent.mfAlt_m = platformObj->mcKin.mfAlt_m; ! navpoints.push_back(pcurrent); // add current position ! } ! // copy waypoints ! for (size_t k=0; k<waypoints.size(); k++) ! { ! navpoints.push_back(waypoints[k]); ! } ! } ! } + mpMapView->UpdateNavPoints(&navpoints); } *************** *** 693,696 **** --- 705,711 ---- mpMapView->maMapObj[rnIndex].mnID = track.mnID; mpMapView->maMapObj[rnIndex].mnColor = 0; + mpMapView->maMapObj[rnIndex].isStaleTrack = pSMTrack->IsStale(); + mpMapView->maMapObj[rnIndex].isDestroyed = pSMTrack->IsDestroyed(); + tcPoint point(track.mfLon_rad, track.mfLat_rad); Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tc3DWindow.cpp 21 Feb 2005 18:26:12 -0000 1.15 --- tc3DWindow.cpp 2 Mar 2005 22:28:42 -0000 1.16 *************** *** 406,410 **** for(size_t n=0;n<nChildren;n++) { ! // children[n]->SetActive(abActive); //children[n]->SetBaseRenderBin(baseRenderBin + 30); } --- 406,410 ---- for(size_t n=0;n<nChildren;n++) { ! children[n]->SetActive(abActive); //children[n]->SetBaseRenderBin(baseRenderBin + 30); } |
|
From: Dewitt C. <ddc...@us...> - 2005-03-02 22:29:21
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15614/include/scriptinterface Modified Files: tcPlatformInterface.h tcScenarioInterface.h Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** tcPlatformInterface.h 24 Feb 2005 22:19:14 -0000 1.34 --- tcPlatformInterface.h 2 Mar 2005 22:28:38 -0000 1.35 *************** *** 39,42 **** --- 39,46 ---- class tcAllianceSensorMap; } + namespace ai + { + class BlackboardInterface; + } class tcSimState; class tcSoundConsole; *************** *** 176,185 **** tcSubInterface GetSubInterface(); - // script variables - /// returns user variable n - UINT32 GetVar(int n) {return mpPlatformObj->mcAI.GetVar(n);} - /// sets user variable n - void SetVar(int n, UINT32 val) {mpPlatformObj->mcAI.SetVar(n,val);} - // target commands /// set target for platform --- 180,183 ---- *************** *** 237,258 **** // order related commands - /// true if platform has any orders - bool HasOrders(); - /// gets order info object for current platform order - tcOrder GetCurrentOrder(); - /// called to indicate current order is complete and to move to next order - void CompletedOrder(); /// adds generic order ! void AddOrder(std::string order_text, long data = -1); ! /// adds navigation order ! void AddNavOrder(float afLon_rad, float afLat_rad); ! /// clear all orders ! void ClearOrders(); /// delete task void DeleteTask(const std::string& taskName); ! /// get total number of orders ! int GetOrderCount(); ! /// get order info object for order n ! tcOrder GetOrder(int n); // sensor map and sensor commands --- 235,250 ---- // order related commands /// adds generic order ! void AddTask(const std::string& taskName, double priority); ! /// adds navigation waypoint (creates nav task if necessary) ! void AddNavWaypoint(float afLon_rad, float afLat_rad); ! /// clear all tasks ! void ClearTasks(); /// delete task void DeleteTask(const std::string& taskName); ! /// gets low-priority, anonymous interface to unit blackboard ! ai::BlackboardInterface GetBlackboardInterface(); ! /// @return true if task exists ! bool TaskExists(const std::string& taskName); // sensor map and sensor commands *************** *** 303,306 **** --- 295,305 ---- // miscellaneous + + /// Gets id from unit name, -1 if not found or not own-alliance + long LookupFriendlyId(const std::string& unitName); + /// Gets name from unit id, "" if not found or not own-alliance + std::string LookupFriendlyName(long id); + /// Get sim time for last platform update (current time) + double GetTime() const; void GetUserInput(std::string callback, std::string uitype); bool IsValid() const; *************** *** 312,317 **** /// sets text displayed in platform info panel void SetActionText(std::string text) {mpPlatformObj->mcAI.mzActionText = text;} - /// sets update interval for AI script revisits - void SetUpdateInterval(float afInterval) {mpPlatformObj->mcAI.mfUpdateInterval = (afInterval >= 0.25) ? afInterval : 0.25f;} /// returns a random number between 0 and 1 float GetRand() {return randf();} --- 311,314 ---- Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcScenarioInterface.h 16 Feb 2005 23:13:38 -0000 1.14 --- tcScenarioInterface.h 2 Mar 2005 22:28:39 -0000 1.15 *************** *** 56,59 **** --- 56,61 ---- }; + class tcPlatformInterface; + /** * *************** *** 90,93 **** --- 92,96 ---- void AddToUnitMagazine(const std::string& unitName, const std::string& item, unsigned int quantity); + tcPlatformInterface GetUnitInterface(const std::string& unitName); void SetUnitLauncherItem(const std::string& unitName, unsigned int launcherIdx, const std::string& item, unsigned int quantity); |
|
From: Dewitt C. <ddc...@us...> - 2005-03-02 22:29:19
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15614/include/graphics Modified Files: tcConsoleBox.h tcMapView.h Removed Files: extgl.h Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: tcConsoleBox.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcConsoleBox.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tcConsoleBox.h 7 Oct 2004 22:01:12 -0000 1.6 --- tcConsoleBox.h 2 Mar 2005 22:28:37 -0000 1.7 *************** *** 65,72 **** virtual void Draw(); ! void ForceRedraw() {mbForceRedraw = true;} bool IsCurrentLineEmpty(); virtual void OnSize(wxSizeEvent& event); ! bool Redraw() const {return mbRedraw != 0;} ///< @return true if console will be updated void SetDelayedTextEffect(bool effectOn) {useDelayedTextEffect = effectOn;} void SetLineSpacing(int anSpacing) {nlinespace = anSpacing;} --- 65,72 ---- virtual void Draw(); ! void ForceRedraw() {forceRedraw = true;} bool IsCurrentLineEmpty(); virtual void OnSize(wxSizeEvent& event); ! bool Redraw() const {return redraw != 0;} ///< @return true if console will be updated void SetDelayedTextEffect(bool effectOn) {useDelayedTextEffect = effectOn;} void SetLineSpacing(int anSpacing) {nlinespace = anSpacing;} *************** *** 78,83 **** protected: int useDelayedTextEffect; ! int mbRedraw; ///< redraw based on cursor update state ! bool mbForceRedraw; ///< a workaround to force redraw when button state changes bool isMouseOver; bool isFocused; --- 78,83 ---- protected: int useDelayedTextEffect; ! int redraw; ///< redraw based on cursor update state ! bool forceRedraw; ///< a workaround to force redraw when button state changes bool isMouseOver; bool isFocused; --- extgl.h DELETED --- Index: tcMapView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcMapView.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tcMapView.h 20 Feb 2005 21:54:32 -0000 1.12 --- tcMapView.h 2 Mar 2005 22:28:37 -0000 1.13 *************** *** 100,103 **** --- 100,105 ---- float mfLonExtent; ///< for pie float mfLatExtent; ///< for pie + bool isStaleTrack; ///< true for stale track + bool isDestroyed; ///< true for destroyed track UINT8 mnFlags; void Clear() *************** *** 107,110 **** --- 109,114 ---- mbExists=0;mbFocus=0;mnColor=0;mfHeading=0;mfLon=0;mfLat=0;mnID=0; mnFlags = 0; + isStaleTrack = 0; + isDestroyed = 0; } }; *************** *** 277,281 **** ! void UpdateNavPoints(std::vector<tcPoint> *mpPoints); /// returns id of closest unit to <pscreen> within fixed dist or -1 if none --- 281,285 ---- ! void UpdateNavPoints(std::vector<GeoPoint> *mpPoints); /// returns id of closest unit to <pscreen> within fixed dist or -1 if none *************** *** 337,344 **** std::string dateTime; ///< string with complete date/time WCHAR mzwchar[255]; ! std::vector<tcPoint> maNavPointGeo; std::vector<tcPoint> maNavPointScreen; osg::ref_ptr<osg::Geometry> maSymbolA[4][MAX_SYMBOL]; osg::ref_ptr<osg::Geometry> maSymbolB[4][MAX_SYMBOL]; teSymbology meSymbology; float mfSymbolXOffset, mfSymbolYOffset; --- 341,352 ---- std::string dateTime; ///< string with complete date/time WCHAR mzwchar[255]; ! std::vector<GeoPoint> maNavPointGeo; std::vector<tcPoint> maNavPointScreen; osg::ref_ptr<osg::Geometry> maSymbolA[4][MAX_SYMBOL]; osg::ref_ptr<osg::Geometry> maSymbolB[4][MAX_SYMBOL]; + /// faded versions for stale tracks + osg::ref_ptr<osg::Geometry> maSymbolA_fade[4][MAX_SYMBOL]; + osg::ref_ptr<osg::Geometry> maSymbolB_fade[4][MAX_SYMBOL]; + teSymbology meSymbology; float mfSymbolXOffset, mfSymbolYOffset; *************** *** 350,353 **** --- 358,362 ---- osg::Geometry* GetSymbol(teAffiliation aeAffiliation, teSymbol aeSymbol); + osg::Geometry* GetSymbolFaded(teAffiliation aeAffiliation, teSymbol aeSymbol); osg::Image* LoadSymbolImage(const char *azSymbolName); *************** *** 355,358 **** --- 364,368 ---- float xc, float yc, float width, float height, float startAngle, float stopAngle, unsigned int nPoints); + void CreateFadedSymbols(); osg::Geometry* CreateSymbolGeometry(); osg::Geometry* CreateTexturedSymbol(const char* symbolName); |
|
From: Dewitt C. <ddc...@us...> - 2005-03-02 22:29:17
|
Update of /cvsroot/gcblue/gcb_wx/include/database In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15614/include/database Modified Files: tcSensorDBObject.h Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: tcSensorDBObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/database/tcSensorDBObject.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcSensorDBObject.h 29 Nov 2004 03:54:49 -0000 1.8 --- tcSensorDBObject.h 2 Mar 2005 22:28:36 -0000 1.9 *************** *** 44,47 **** --- 44,48 ---- float mfFieldOfView_deg; ///< [degrees] 360 is max float mfScanPeriod_s; ///< [s] + bool isSurveillance; ///< true if this sensor contributes reports to alliance map virtual tcSensorState* CreateSensor(tcGameObject* parent); ///< factory method |
|
From: Dewitt C. <ddc...@us...> - 2005-03-02 22:29:16
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15614/include/common Modified Files: simmath.h tcSound.h Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** simmath.h 24 Feb 2005 22:19:13 -0000 1.26 --- simmath.h 2 Mar 2005 22:28:35 -0000 1.27 *************** *** 117,120 **** --- 117,121 ---- } bool IsAir() {return ((mnClassification & PTYPE_AIR) != 0);} + bool IsGround() {return ((mnClassification & PTYPE_FIXED) != 0);} bool IsMissile() {return ((mnClassification & PTYPE_MISSILE) != 0);} bool IsSurface() {return ((mnClassification & PTYPE_SURFACE) != 0);} Index: tcSound.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcSound.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcSound.h 21 Feb 2005 18:25:54 -0000 1.19 --- tcSound.h 2 Mar 2005 22:28:36 -0000 1.20 *************** *** 71,75 **** bool GetMusicPause() const; - void PlayEffect(int anEffect); void PlayEffect(std::string effectName); void PlayMusic(int anTrack); --- 71,74 ---- |
|
From: Dewitt C. <ddc...@us...> - 2005-03-02 22:29:15
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15614/include/ai Modified Files: BlackboardItem.h Brain.h Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: Brain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Brain.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Brain.h 24 Feb 2005 22:19:13 -0000 1.5 --- Brain.h 2 Mar 2005 22:28:35 -0000 1.6 *************** *** 41,44 **** --- 41,45 ---- class Blackboard; + class BlackboardInterface; class Task; class Nav; *************** *** 47,51 **** /** ! * Holds */ class Brain --- 48,52 ---- /** ! * Holds tasks for "ai" */ class Brain *************** *** 59,65 **** --- 60,70 ---- }; void AddTask(const std::string& taskName, double priority_); + /// gets a low priority, anonymous interface to board + BlackboardInterface GetBlackboardInterface(); Nav* GetNavTask(); + std::vector<std::string> GetTaskList(); double GetTaskPriority(const std::string& taskName) const; + void RemoveAllTasks(); void RemoveTask(const std::string& taskName); bool TaskExists(const std::string& taskName); *************** *** 78,81 **** --- 83,87 ---- double lastUpdateTime; ///< last time tasks were updated long target; ///< id of target (may be more general way to handle this) + bool updating; ///< true if in the middle of Update Blackboard board; ///< for inter-task communication Index: BlackboardItem.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/BlackboardItem.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BlackboardItem.h 16 Feb 2005 23:13:38 -0000 1.2 --- BlackboardItem.h 2 Mar 2005 22:28:35 -0000 1.3 *************** *** 38,43 **** { public: ! long author; ///< -1 for invalid double priority; std::string message; --- 38,46 ---- { public: ! /// -1 for invalid, 0 is anonymous outside author (i.e. not a task) ! long author; ! /// priority to control write access to board double priority; + /// blackboard message string std::string message; |
|
From: Dewitt C. <ddc...@us...> - 2005-03-02 22:29:14
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15614 Modified Files: GCblue.vcproj Log Message: Better sensor ageout behavior, more ai work, misc cleanup Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** GCblue.vcproj 24 Feb 2005 22:19:12 -0000 1.85 --- GCblue.vcproj 2 Mar 2005 22:28:34 -0000 1.86 *************** *** 500,503 **** --- 500,506 ---- </File> <File + RelativePath=".\src\sim\tcPositionRegistry.cpp"> + </File> + <File RelativePath="src\sim\tcRadar.cpp"> </File> *************** *** 1168,1174 **** </File> <File - RelativePath="include\graphics\extgl.h"> - </File> - <File RelativePath="include\graphics\ObjectUpdater.h"> </File> --- 1171,1174 ---- *************** *** 1437,1440 **** --- 1437,1443 ---- </File> <File + RelativePath=".\include\sim\tcPositionRegistry.h"> + </File> + <File RelativePath="include\sim\tcRadar.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:20:13
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/include/common Modified Files: simmath.h tcOggStreamer.h Log Message: More OpenAL++ changes and ai improvements Index: tcOggStreamer.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcOggStreamer.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tcOggStreamer.h 5 Dec 2004 02:49:45 -0000 1.7 --- tcOggStreamer.h 24 Feb 2005 22:19:13 -0000 1.8 *************** *** 1,6 **** ! /* ! ** tcOggStreamer.h ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcOggStreamer.h ! */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 27,45 **** #define _OGGSTREAMER_H_ #include <string> #include <iostream> - #include <AL/al.h> - #include <vorbis/vorbisfile.h> - - - - //#define BUFFER_SIZE (4096 * 4) - /** ! * Based on ogg_stream class from DevMaster.net ogg OpenAL tutorial ! * http://www.devmaster.net/articles/openal-tutorials/lesson8.php by ! * Jesse Maurais */ class tcOggStreamer --- 27,38 ---- #define _OGGSTREAMER_H_ + #include <openalpp/alpp.h> #include <string> #include <iostream> /** ! * Ogg streaming using OpenAL++ Stream ! * Stream is threaded */ class tcOggStreamer *************** *** 50,99 **** NUM_BUFFERS = 8 }; ! public: ! void Display(); ! bool GetPause() const {return paused;} ! void Init(); ! bool IsPaused(); ! bool IsPlaying(); ! bool IsSongQueued() {return queuedSong.size() > 1;} ! bool IsStopped(); ! float GetVolume() {return volume;} ! void Open(std::string path); ! bool Play(); ! void Queue(std::string path); ! void Release(); ! void Seek(double seekTime); ! void SetPause(bool state) {paused = state;} ! void SetVolume(float vol); ! void Stop(); ! bool Update(); ! tcOggStreamer(); ! ~tcOggStreamer(); ! ! protected: ! void Check(); ! void Empty(); ! std::string ErrorString(int code); ! ! bool Stream(ALuint buffer); ! private: ! FILE* oggFile; ! OggVorbis_File oggStream; ! vorbis_info* vorbisInfo; ! vorbis_comment* vorbisComment; ! float volume; ///< linear gain for source, 0.5f = -6 dB ! ! // when bufferFreeIndex == bufferBusyIndex, no buffers are available ! int bufferIndex; ///< index of next buffer to use (when free) ! int nFreeBuffers; ///< number of free buffers ! ALuint buffers[8]; ! ALuint source; ! ALenum format; ! char streamBuffer[BUFFER_SIZE]; ! std::string queuedSong; ///< complete file path of song to queue ! bool paused; }; --- 43,72 ---- NUM_BUFFERS = 8 }; ! public: ! void Display(); ! bool GetPause() const {return paused;} ! bool IsPaused(); ! bool IsPlaying(); ! bool IsSongQueued() {return queuedSong.size() > 1;} ! bool IsStopped(); ! float GetVolume() const {return volume;} ! void Open(std::string path); ! bool Play(); ! void Queue(std::string path); ! void Seek(double seekTime); ! void SetPause(bool state) {paused = state;} ! void SetVolume(float vol); ! void Stop(); ! tcOggStreamer(); ! ~tcOggStreamer(); ! private: ! openalpp::ref_ptr<openalpp::FileStream> stream; ! openalpp::ref_ptr<openalpp::Source> source; ! float volume; ///< linear gain for source, 0.5f = -6 dB ! std::string queuedSong; ///< complete file path of song to queue ! bool paused; }; Index: simmath.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/simmath.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** simmath.h 14 Nov 2004 22:52:19 -0000 1.25 --- simmath.h 24 Feb 2005 22:19:13 -0000 1.26 *************** *** 143,148 **** }; ! struct tsGeoPoint { float mfLon_rad; float mfLat_rad; --- 143,149 ---- }; ! class GeoPoint { + public: float mfLon_rad; float mfLat_rad; *************** *** 183,188 **** void PredictPosition(float dt_s, double& lon_rad, double& lat_rad, float& alt_m); float HeadingToTrack(const tcTrack& track); ! float HeadingToGeoRad(const tsGeoPoint *apGeoPoint); ! float RangeToKm(const tsGeoPoint *apGeoPoint); float RangeToKm(tcKinematics& k); float RangeToKm(const tcTrack& track); --- 184,189 ---- void PredictPosition(float dt_s, double& lon_rad, double& lat_rad, float& alt_m); float HeadingToTrack(const tcTrack& track); ! float HeadingToGeoRad(const GeoPoint *apGeoPoint); ! float RangeToKm(const GeoPoint *apGeoPoint); float RangeToKm(tcKinematics& k); float RangeToKm(const tcTrack& track); *************** *** 195,199 **** float& rfClimbAngle_rad, float& rfTimeToIntercept, float& rfRange_rad); void Serialize(tcFile& file, bool abLoad); ! void SetRelativeGeo(tsGeoPoint& rpGeoPoint, float afBearing_rad, float afRange_km); tcStream& operator<<(tcStream& stream); tcStream& operator>>(tcStream& stream); --- 196,200 ---- float& rfClimbAngle_rad, float& rfTimeToIntercept, float& rfRange_rad); void Serialize(tcFile& file, bool abLoad); ! void SetRelativeGeo(GeoPoint& rpGeoPoint, float afBearing_rad, float afRange_km); tcStream& operator<<(tcStream& stream); tcStream& operator>>(tcStream& stream); *************** *** 207,214 **** int AngleWithinRange(float afAngle_rad, float afAngle1_rad, float afAngle2_rad); ! float BearingTo(tsGeoPoint g1, tsGeoPoint g2); ! float RangeToKm(tsGeoPoint g1, tsGeoPoint g2); ! int GeoWithinRegion(tsGeoPoint p, tcRect *pRegion); inline float randf(void) {return (float)(rand() % RAND_MAX)/(float)RAND_MAX;} --- 208,215 ---- int AngleWithinRange(float afAngle_rad, float afAngle1_rad, float afAngle2_rad); ! float BearingTo(GeoPoint g1, GeoPoint g2); ! float RangeToKm(GeoPoint g1, GeoPoint g2); ! int GeoWithinRegion(GeoPoint p, tcRect *pRegion); inline float randf(void) {return (float)(rand() % RAND_MAX)/(float)RAND_MAX;} |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:20:12
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/include/scriptinterface Modified Files: tcPlatformInterface.h Log Message: More OpenAL++ changes and ai improvements Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** tcPlatformInterface.h 20 Feb 2005 18:20:18 -0000 1.33 --- tcPlatformInterface.h 24 Feb 2005 22:19:14 -0000 1.34 *************** *** 249,254 **** /// clear all orders void ClearOrders(); ! /// delete order ! void DeleteOrder(int n); /// get total number of orders int GetOrderCount(); --- 249,254 ---- /// clear all orders void ClearOrders(); ! /// delete task ! void DeleteTask(const std::string& taskName); /// get total number of orders int GetOrderCount(); |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:20:10
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465 Modified Files: GCblue.vcproj Log Message: More OpenAL++ changes and ai improvements Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** GCblue.vcproj 21 Feb 2005 18:25:46 -0000 1.84 --- GCblue.vcproj 24 Feb 2005 22:19:12 -0000 1.85 *************** *** 666,669 **** --- 666,672 ---- </File> <File + RelativePath=".\src\ai\Nav.cpp"> + </File> + <File RelativePath=".\src\ai\ScriptedTask.cpp"> </File> *************** *** 1606,1609 **** --- 1609,1615 ---- </File> <File + RelativePath=".\include\ai\Nav.h"> + </File> + <File RelativePath=".\include\ai\ScriptedTask.h"> </File> |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:19:56
|
Update of /cvsroot/gcblue/gcb_wx/include/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/include/ai Modified Files: Brain.h ScriptedTaskInterface.h Task.h Log Message: More OpenAL++ changes and ai improvements Index: Brain.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Brain.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Brain.h 20 Feb 2005 18:20:18 -0000 1.4 --- Brain.h 24 Feb 2005 22:19:13 -0000 1.5 *************** *** 28,31 **** --- 28,32 ---- #include <map> + #include <queue> #include <string> #include <vector> *************** *** 41,44 **** --- 42,46 ---- class Blackboard; class Task; + class Nav; *************** *** 53,59 **** enum { ! TEST_TASK = 0 }; void AddTask(const std::string& taskName, double priority_); std::vector<std::string> GetTaskList(); double GetTaskPriority(const std::string& taskName) const; --- 55,63 ---- enum { ! TEST_TASK = 0, ! NAV_TASK = 1 }; void AddTask(const std::string& taskName, double priority_); + Nav* GetNavTask(); std::vector<std::string> GetTaskList(); double GetTaskPriority(const std::string& taskName) const; *************** *** 77,83 **** --- 81,91 ---- Blackboard board; ///< for inter-task communication std::map<std::string, Task*> taskMap; + std::queue<std::string> removeList; ///< list of tasks to remove at next update static std::map<std::string, int> taskNameLookup; + void RemovePending(); + void RemoveTaskNow(const std::string& taskName); + static void InitTaskNameLookup(); }; Index: ScriptedTaskInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/ScriptedTaskInterface.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ScriptedTaskInterface.h 16 Feb 2005 23:13:38 -0000 1.1 --- ScriptedTaskInterface.h 24 Feb 2005 22:19:13 -0000 1.2 *************** *** 50,53 **** --- 50,54 ---- { public: + void EndTask(); ///< deletes task BlackboardInterface GetBlackboardInterface(); tcPlatformInterface GetPlatformInterface(); Index: Task.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/ai/Task.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Task.h 16 Feb 2005 23:13:38 -0000 1.3 --- Task.h 24 Feb 2005 22:19:13 -0000 1.4 *************** *** 55,59 **** --- 55,61 ---- tcPlatformInterface GetPlatformInterface(); + void EndTask(); void FinishUpdate(double t); + const std::string& GetTaskName() const; bool IsReadyForUpdate(double t) const; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:19:51
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/src/scriptinterface Modified Files: tcPlatformInterface.cpp tcPlatformInterfaceExtension.cpp tcPlatformInterfaceExtensionB.cpp tcScenarioInterface.cpp Log Message: More OpenAL++ changes and ai improvements Index: tcPlatformInterfaceExtensionB.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtensionB.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcPlatformInterfaceExtensionB.cpp 18 Feb 2005 17:41:51 -0000 1.19 --- tcPlatformInterfaceExtensionB.cpp 24 Feb 2005 22:19:15 -0000 1.20 *************** *** 112,116 **** .def("ClearOrders",&tcPlatformInterface::ClearOrders) .def("CompletedOrder",&tcPlatformInterface::CompletedOrder) - .def("DeleteOrder",&tcPlatformInterface::DeleteOrder) .def("GetCurrentOrder",&tcPlatformInterface::GetCurrentOrder) .def("GetLocalObj",&tcPlatformInterface::GetLocalObj) --- 112,115 ---- Index: tcPlatformInterfaceExtension.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterfaceExtension.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcPlatformInterfaceExtension.cpp 18 Feb 2005 17:41:51 -0000 1.13 --- tcPlatformInterfaceExtension.cpp 24 Feb 2005 22:19:15 -0000 1.14 *************** *** 98,105 **** ; ! class_<tsGeoPoint>("tsGeoPoint") ! .def_readonly("Alt",&tsGeoPoint::mfAlt_m) ! .def_readonly("Lon",&tsGeoPoint::mfLon_rad) ! .def_readonly("Lat",&tsGeoPoint::mfLat_rad) ; --- 98,105 ---- ; ! class_<GeoPoint>("GeoPoint") ! .def_readonly("Alt",&GeoPoint::mfAlt_m) ! .def_readonly("Lon",&GeoPoint::mfLon_rad) ! .def_readonly("Lat",&GeoPoint::mfLat_rad) ; Index: tcScenarioInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcScenarioInterface.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tcScenarioInterface.cpp 18 Feb 2005 17:41:51 -0000 1.19 --- tcScenarioInterface.cpp 24 Feb 2005 22:19:15 -0000 1.20 *************** *** 435,439 **** tcDatum datum; wxASSERT(mapData); ! tsGeoPoint randomPoint = mapData->GetRandomPointNear(lon, lat, rand_offset, min_alt, max_alt); datum.lon = C_180OVERPI*randomPoint.mfLon_rad; --- 435,439 ---- tcDatum datum; wxASSERT(mapData); ! GeoPoint randomPoint = mapData->GetRandomPointNear(lon, lat, rand_offset, min_alt, max_alt); datum.lon = C_180OVERPI*randomPoint.mfLon_rad; Index: tcPlatformInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/scriptinterface/tcPlatformInterface.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** tcPlatformInterface.cpp 20 Feb 2005 18:20:19 -0000 1.36 --- tcPlatformInterface.cpp 24 Feb 2005 22:19:15 -0000 1.37 *************** *** 49,52 **** --- 49,53 ---- #include "tcStores.h" #include "ai/Brain.h" + #include "ai/Nav.h" #ifdef _DEBUG *************** *** 382,386 **** float tcPlatformInterface::GetHeadingToDatum(float afLon_rad, float afLat_rad) { ! tsGeoPoint p; p.mfAlt_m = 0; p.mfLon_rad = afLon_rad; --- 383,387 ---- float tcPlatformInterface::GetHeadingToDatum(float afLon_rad, float afLat_rad) { ! GeoPoint p; p.mfAlt_m = 0; p.mfLon_rad = afLon_rad; *************** *** 392,396 **** float tcPlatformInterface::GetRangeToDatum(float afLon_rad, float afLat_rad) { ! tsGeoPoint p; p.mfAlt_m = 0; p.mfLon_rad = afLon_rad; --- 393,397 ---- float tcPlatformInterface::GetRangeToDatum(float afLon_rad, float afLat_rad) { ! GeoPoint p; p.mfAlt_m = 0; p.mfLon_rad = afLon_rad; *************** *** 568,572 **** float alt_m, int anLauncher) { ! tsGeoPoint p; p.mfLon_rad = afLon_rad; p.mfLat_rad = afLat_rad; --- 569,573 ---- float alt_m, int anLauncher) { ! GeoPoint p; p.mfLon_rad = afLon_rad; p.mfLat_rad = afLat_rad; *************** *** 739,758 **** void tcPlatformInterface::AddNavOrder(float afLon_rad, float afLat_rad) { ! tcOrder o; ! o.mstrOrdername = "Nav"; ! o.msDestination.mfAlt_m = 0; ! o.msDestination.mfLon_rad = afLon_rad; ! o.msDestination.mfLat_rad = afLat_rad; ! mpPlatformObj->mcAI.AddOrder(o); } ! void tcPlatformInterface::ClearOrders(void) { ! mpPlatformObj->mcAI.ClearOrders(); } ! void tcPlatformInterface::DeleteOrder(int n) { ! mpPlatformObj->mcAI.DeleteOrder(n); } --- 740,771 ---- void tcPlatformInterface::AddNavOrder(float afLon_rad, float afLat_rad) { ! ai::Brain* brain = mpPlatformObj->GetBrain(); ! wxASSERT(brain); ! ! ai::Nav* nav = brain->GetNavTask(); ! if (!nav) ! { ! brain->AddTask("Nav", 1.5f); ! nav = brain->GetNavTask(); ! } ! wxASSERT(nav); ! ! nav->AddWaypoint(afLon_rad, afLat_rad, 0); } ! /** ! * Only removes Nav task at the moment ! */ ! void tcPlatformInterface::ClearOrders() { ! ai::Brain* brain = mpPlatformObj->GetBrain(); ! wxASSERT(brain); ! ! mpPlatformObj->GetBrain()->RemoveTask("Nav"); } ! void tcPlatformInterface::DeleteTask(const std::string& taskName) { ! mpPlatformObj->GetBrain()->RemoveTask(taskName); } *************** *** 869,873 **** if ((bAffilMatch)&&(pTrack->mnClassification & anClassMask)&&(engagementsMatch)) { ! tsGeoPoint p; p.mfAlt_m = 0; p.mfLat_rad = pTrack->mfLat_rad; --- 882,886 ---- if ((bAffilMatch)&&(pTrack->mnClassification & anClassMask)&&(engagementsMatch)) { ! GeoPoint p; p.mfAlt_m = 0; p.mfLat_rad = pTrack->mfLat_rad; *************** *** 907,911 **** if ((bAffilMatch)&&(pTrack->mnClassification & anClassMask)) { ! tsGeoPoint p; p.mfAlt_m = 0; p.mfLat_rad = pTrack->mfLat_rad; --- 920,924 ---- if ((bAffilMatch)&&(pTrack->mnClassification & anClassMask)) { ! GeoPoint p; p.mfAlt_m = 0; p.mfLat_rad = pTrack->mfLat_rad; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:19:51
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/src/sim Modified Files: Game.cpp tcBallisticWeapon.cpp tcFlightPort.cpp tcGameObject.cpp tcMapData.cpp tcMissileObject.cpp tcPlatformObject.cpp tcSimState.cpp tcSurfaceObject.cpp tcTorpedoObject.cpp Log Message: More OpenAL++ changes and ai improvements Index: tcSimState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSimState.cpp,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** tcSimState.cpp 16 Feb 2005 23:13:49 -0000 1.66 --- tcSimState.cpp 24 Feb 2005 22:19:16 -0000 1.67 *************** *** 210,214 **** } /********************************************************************/ ! void tcSimState::DesignateLauncherDatum(tnPoolIndex anKey, tsGeoPoint p, unsigned anLauncher) { int bFound; --- 210,214 ---- } /********************************************************************/ ! void tcSimState::DesignateLauncherDatum(tnPoolIndex anKey, GeoPoint p, unsigned anLauncher) { int bFound; *************** *** 266,270 **** float fSeekerAz = po->mcKin.mfHeading_rad; // TODO: add launcher angle effect ! tsGeoPoint sSeekerLoc; sSeekerLoc.Set((float)po->mcKin.mfLon_rad,(float)po->mcKin.mfLat_rad); bool bCanDetect = RadarCanDetect(nSensorKey,pTargetObj,sSeekerLoc,fSeekerAz); --- 266,270 ---- float fSeekerAz = po->mcKin.mfHeading_rad; // TODO: add launcher angle effect ! GeoPoint sSeekerLoc; sSeekerLoc.Set((float)po->mcKin.mfLon_rad,(float)po->mcKin.mfLat_rad); bool bCanDetect = RadarCanDetect(nSensorKey,pTargetObj,sSeekerLoc,fSeekerAz); *************** *** 1155,1159 **** int nCount,nFCCount; tcRect region; ! tsGeoPoint currentpos; // tcDatabaseObject *pTargetDBObj; tcGameObject *pTargetObj; --- 1155,1159 ---- int nCount,nFCCount; tcRect region; ! GeoPoint currentpos; // tcDatabaseObject *pTargetDBObj; tcGameObject *pTargetObj; *************** *** 1312,1316 **** { long nTargetID; ! tsGeoPoint currentpos; tcTrack *pTrack; tcGameObject *ptarget; --- 1312,1316 ---- { long nTargetID; ! GeoPoint currentpos; tcTrack *pTrack; tcGameObject *ptarget; *************** *** 1400,1404 **** if (bFound) { ! bDetectable = apRadarSS->CanDetectTarget(ptarget,fRange); // (tsGeoPoint,float rcs_dbsm) if ((bDetectable)&&(fRange<fMinRange)) { --- 1400,1404 ---- if (bFound) { ! bDetectable = apRadarSS->CanDetectTarget(ptarget,fRange); // (GeoPoint,float rcs_dbsm) if ((bDetectable)&&(fRange<fMinRange)) { *************** *** 1974,1978 **** int nListIndex=0; tcKinematics *pKin; ! tsGeoPoint p; for (tnPoolIndex i=0;(i<nSize)&&(nListIndex<anLength);i++) --- 1974,1978 ---- int nListIndex=0; tcKinematics *pKin; ! GeoPoint p; for (tnPoolIndex i=0;(i<nSize)&&(nListIndex<anLength);i++) *************** *** 2391,2397 **** s.Format("tcSurfaceObject size: %d bytes",sizeof(tcSurfaceObject)); WTL(s.GetBuffer()); ! s.Format(" tcGuidanceState (%d) tsGeoPoint (%d) tsFormationParameters (%d) tcEngagementData (%d) " "tcAIData (%d)", ! sizeof(tcGuidanceState),sizeof(tsGeoPoint),sizeof(tsFormationParameters),sizeof(tcEngagementData), sizeof(tcAIData)); WTL(s.GetBuffer()); --- 2391,2397 ---- s.Format("tcSurfaceObject size: %d bytes",sizeof(tcSurfaceObject)); WTL(s.GetBuffer()); ! s.Format(" tcGuidanceState (%d) GeoPoint (%d) tsFormationParameters (%d) tcEngagementData (%d) " "tcAIData (%d)", ! sizeof(tcGuidanceState),sizeof(GeoPoint),sizeof(tsFormationParameters),sizeof(tcEngagementData), sizeof(tcAIData)); WTL(s.GetBuffer()); Index: tcMissileObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMissileObject.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcMissileObject.cpp 4 Feb 2005 18:54:51 -0000 1.22 --- tcMissileObject.cpp 24 Feb 2005 22:19:16 -0000 1.23 *************** *** 116,120 **** { tc3DPoint launcherPos = platObj->mpDBObject->GetLauncherPosition(nLauncher); ! tsGeoPoint pos = obj->RelPosToLatLonAlt(launcherPos.x, launcherPos.y, launcherPos.z); mcKin.mfLon_rad = pos.mfLon_rad; --- 116,120 ---- { tc3DPoint launcherPos = platObj->mpDBObject->GetLauncherPosition(nLauncher); ! GeoPoint pos = obj->RelPosToLatLonAlt(launcherPos.x, launcherPos.y, launcherPos.z); mcKin.mfLon_rad = pos.mfLon_rad; Index: tcTorpedoObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTorpedoObject.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcTorpedoObject.cpp 21 Feb 2005 18:26:26 -0000 1.4 --- tcTorpedoObject.cpp 24 Feb 2005 22:19:16 -0000 1.5 *************** *** 96,100 **** { tc3DPoint launcherPos = platObj->mpDBObject->GetLauncherPosition(nLauncher); ! tsGeoPoint pos = obj->RelPosToLatLonAlt(launcherPos.x, launcherPos.y, launcherPos.z); mcKin.mfLon_rad = pos.mfLon_rad; --- 96,100 ---- { tc3DPoint launcherPos = platObj->mpDBObject->GetLauncherPosition(nLauncher); ! GeoPoint pos = obj->RelPosToLatLonAlt(launcherPos.x, launcherPos.y, launcherPos.z); mcKin.mfLon_rad = pos.mfLon_rad; Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcFlightPort.cpp 31 Jan 2005 01:33:08 -0000 1.13 --- tcFlightPort.cpp 24 Feb 2005 22:19:16 -0000 1.14 *************** *** 352,356 **** wxASSERT(obj); ! tsGeoPoint p = obj->RelPosToLatLonAlt(spot->x, spot->y, spot->z); data.mfLat_rad = p.mfLat_rad; --- 352,356 ---- wxASSERT(obj); ! GeoPoint p = obj->RelPosToLatLonAlt(spot->x, spot->y, spot->z); data.mfLat_rad = p.mfLat_rad; *************** *** 486,490 **** unit->mfStatusTime = parent->mfStatusTime; ! tsGeoPoint childPos = parent->RelPosToLatLonAlt(unit->rel_pos); unit->mcKin.mfAlt_m = childPos.mfAlt_m; unit->mcKin.mfLat_rad = childPos.mfLat_rad; --- 486,490 ---- unit->mfStatusTime = parent->mfStatusTime; ! GeoPoint childPos = parent->RelPosToLatLonAlt(unit->rel_pos); unit->mcKin.mfAlt_m = childPos.mfAlt_m; unit->mcKin.mfLat_rad = childPos.mfLat_rad; Index: tcSurfaceObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSurfaceObject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcSurfaceObject.cpp 16 Feb 2005 23:13:50 -0000 1.15 --- tcSurfaceObject.cpp 24 Feb 2005 22:19:16 -0000 1.16 *************** *** 149,153 **** mnAlliance = 0; mfStatusTime = 0; ! tsGeoPoint randomPoint = mapData->GetRandomPointNear(afLon_deg, afLat_deg, 1.1f, -16000.0f, -20.0f); mcKin.mfLon_rad = randomPoint.mfLon_rad; mcKin.mfLat_rad = randomPoint.mfLat_rad; --- 149,153 ---- mnAlliance = 0; mfStatusTime = 0; ! GeoPoint randomPoint = mapData->GetRandomPointNear(afLon_deg, afLat_deg, 1.1f, -16000.0f, -20.0f); mcKin.mfLon_rad = randomPoint.mfLon_rad; mcKin.mfLat_rad = randomPoint.mfLat_rad; Index: tcBallisticWeapon.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcBallisticWeapon.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** tcBallisticWeapon.cpp 1 Feb 2005 02:29:15 -0000 1.8 --- tcBallisticWeapon.cpp 24 Feb 2005 22:19:16 -0000 1.9 *************** *** 77,81 **** { tc3DPoint launcherPos = platObj->mpDBObject->GetLauncherPosition(nLauncher); ! tsGeoPoint pos = obj->RelPosToLatLonAlt(launcherPos.x, launcherPos.y, launcherPos.z); mcKin.mfLon_rad = pos.mfLon_rad; --- 77,81 ---- { tc3DPoint launcherPos = platObj->mpDBObject->GetLauncherPosition(nLauncher); ! GeoPoint pos = obj->RelPosToLatLonAlt(launcherPos.x, launcherPos.y, launcherPos.z); mcKin.mfLon_rad = pos.mfLon_rad; *************** *** 103,107 **** mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; ! tsGeoPoint targetDatum = pLauncher->msDatum; mcKin.mfHeading_rad = mcKin.HeadingToGeoRad(&targetDatum); --- 103,107 ---- mcKin.mfSpeed_kts = C_MPSTOKTS * mpDBObject->launchSpeed_mps; ! GeoPoint targetDatum = pLauncher->msDatum; mcKin.mfHeading_rad = mcKin.HeadingToGeoRad(&targetDatum); Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** tcPlatformObject.cpp 20 Feb 2005 18:20:20 -0000 1.37 --- tcPlatformObject.cpp 24 Feb 2005 22:19:16 -0000 1.38 *************** *** 59,63 **** } ! void tcPlatformObject::DesignateLauncherDatum(tsGeoPoint p, unsigned int anLauncher) { mcLauncherState.SetLauncherDatum(anLauncher, p.mfLon_rad, p.mfLat_rad, p.mfAlt_m); --- 59,63 ---- } ! void tcPlatformObject::DesignateLauncherDatum(GeoPoint p, unsigned int anLauncher) { mcLauncherState.SetLauncherDatum(anLauncher, p.mfLon_rad, p.mfLat_rad, p.mfAlt_m); *************** *** 106,110 **** } ! tsGeoPoint msGeoForm; tsFormationParameters *pFP = &msFormationParameters; pFP->mcFormationKin.SetRelativeGeo(msGeoForm,pFP->mfFormationBearing_rad,pFP->mfFormationRange_km); --- 106,110 ---- } ! GeoPoint msGeoForm; tsFormationParameters *pFP = &msFormationParameters; pFP->mcFormationKin.SetRelativeGeo(msGeoForm,pFP->mfFormationBearing_rad,pFP->mfFormationRange_km); Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcMapData.cpp 21 Feb 2005 18:26:13 -0000 1.16 --- tcMapData.cpp 24 Feb 2005 22:19:16 -0000 1.17 *************** *** 56,64 **** * @param maxAlt maximum altitude in meters */ ! tsGeoPoint tcMapData::GetRandomPointNear(float lon, float lat, float r, float minAlt, float maxAlt) { enum {MAX_TRIALS = 100}; ! tsGeoPoint p; int trial = 0; --- 56,64 ---- * @param maxAlt maximum altitude in meters */ ! GeoPoint tcMapData::GetRandomPointNear(float lon, float lat, float r, float minAlt, float maxAlt) { enum {MAX_TRIALS = 100}; ! GeoPoint p; int trial = 0; Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** Game.cpp 20 Feb 2005 21:54:34 -0000 1.121 --- Game.cpp 24 Feb 2005 22:19:15 -0000 1.122 *************** *** 2149,2158 **** enableTacticalMap = !enableTacticalMap; return; ! case 'w': // toggle world map size ! if (worldMap) ! { ! worldMap->ToggleMapSize(); ! } return; case 'A': accelerateTime = (accelerateTime + 1)/2 - 1; --- 2149,2156 ---- enableTacticalMap = !enableTacticalMap; return; ! case 'p': ! if (!mbScenarioEdit) mbPaused = !mbPaused; return; + case 'A': accelerateTime = (accelerateTime + 1)/2 - 1; *************** *** 2171,2177 **** viewer->SetTerrainActive(!viewer->GetTerrainActive()); return; ! case 'p': ! if (!mbScenarioEdit) mbPaused = !mbPaused; return; case WXK_ESCAPE: ProcessEsc(); --- 2169,2179 ---- viewer->SetTerrainActive(!viewer->GetTerrainActive()); return; ! case 'W': // toggle world map size ! if (worldMap) ! { ! worldMap->ToggleMapSize(); ! } return; + case WXK_ESCAPE: ProcessEsc(); Index: tcGameObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGameObject.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** tcGameObject.cpp 1 Feb 2005 02:29:15 -0000 1.28 --- tcGameObject.cpp 24 Feb 2005 22:19:16 -0000 1.29 *************** *** 196,200 **** } ! tsGeoPoint tcGameObject::RelPosToLatLonAlt(const tsRelativePosition& rel_pos) const { return RelPosToLatLonAlt(rel_pos.dx, rel_pos.dy, rel_pos.dz); --- 196,200 ---- } ! GeoPoint tcGameObject::RelPosToLatLonAlt(const tsRelativePosition& rel_pos) const { return RelPosToLatLonAlt(rel_pos.dx, rel_pos.dy, rel_pos.dz); *************** *** 205,212 **** * Old system was: dx is right, dy is up, and dz is back */ ! tsGeoPoint tcGameObject::RelPosToLatLonAlt(const float& dx, const float& dy, const float& dz) const { ! tsGeoPoint p; float hdg = mcKin.mfHeading_rad; --- 205,212 ---- * Old system was: dx is right, dy is up, and dz is back */ ! GeoPoint tcGameObject::RelPosToLatLonAlt(const float& dx, const float& dy, const float& dz) const { ! GeoPoint p; float hdg = mcKin.mfHeading_rad; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:19:51
|
Update of /cvsroot/gcblue/gcb_wx/include/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/include/sim Modified Files: tcAIData.h tcGameObject.h tcLauncher.h tcMapData.h tcMissileObject.h tcPlatformObject.h tcSensorState.h tcSimState.h tcTorpedoObject.h Log Message: More OpenAL++ changes and ai improvements Index: tcGameObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcGameObject.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** tcGameObject.h 1 Feb 2005 02:28:09 -0000 1.30 --- tcGameObject.h 24 Feb 2005 22:19:14 -0000 1.31 *************** *** 122,127 **** void GetRelPosOf(tcGameObject *obj, tsRelativePosition& rel_pos); virtual void RandInitNear(float afLon_deg, float afLat_deg); ! tsGeoPoint RelPosToLatLonAlt(const tsRelativePosition& rel_pos) const; ! tsGeoPoint RelPosToLatLonAlt(const float& dx, const float& dy, const float& dz) const; virtual void PrintToFile(tcFile&); virtual void SaveToFile(tcFile& file); --- 122,127 ---- void GetRelPosOf(tcGameObject *obj, tsRelativePosition& rel_pos); virtual void RandInitNear(float afLon_deg, float afLat_deg); ! GeoPoint RelPosToLatLonAlt(const tsRelativePosition& rel_pos) const; ! GeoPoint RelPosToLatLonAlt(const float& dx, const float& dy, const float& dz) const; virtual void PrintToFile(tcFile&); virtual void SaveToFile(tcFile& file); *************** *** 145,152 **** virtual void UpdateEffects(); virtual void DesignateDatum(tcPoint p) {} ! virtual void DesignateLauncherDatum(tsGeoPoint p, unsigned int anLauncher) {} virtual bool DesignateLauncherTarget(tnPoolIndex anID, unsigned anLauncher) {return false;} virtual void DesignateTarget(long anID) {} ! virtual void GetDatum(tsGeoPoint& p) {} virtual void GetLauncherState(tcLauncherState*& pLauncherState) {pLauncherState = NULL;} virtual tcLauncher* GetLauncher(unsigned idx) {return 0;} --- 145,152 ---- virtual void UpdateEffects(); virtual void DesignateDatum(tcPoint p) {} ! virtual void DesignateLauncherDatum(GeoPoint p, unsigned int anLauncher) {} virtual bool DesignateLauncherTarget(tnPoolIndex anID, unsigned anLauncher) {return false;} virtual void DesignateTarget(long anID) {} ! virtual void GetDatum(GeoPoint& p) {} virtual void GetLauncherState(tcLauncherState*& pLauncherState) {pLauncherState = NULL;} virtual tcLauncher* GetLauncher(unsigned idx) {return 0;} Index: tcLauncher.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcLauncher.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcLauncher.h 18 Feb 2005 17:41:37 -0000 1.10 --- tcLauncher.h 24 Feb 2005 22:19:14 -0000 1.11 *************** *** 86,90 **** bool isLoading; ///< true if launcher is offline to load/unload weapons ! tsGeoPoint msDatum; ///< datum to pass to weapon nav guidance tnPoolIndex mnTargetID; ///< track that seeker can acquire teWeaponLaunchMode meLaunchMode; --- 86,90 ---- bool isLoading; ///< true if launcher is offline to load/unload weapons ! GeoPoint msDatum; ///< datum to pass to weapon nav guidance tnPoolIndex mnTargetID; ///< track that seeker can acquire teWeaponLaunchMode meLaunchMode; Index: tcTorpedoObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcTorpedoObject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcTorpedoObject.h 7 Dec 2004 03:59:14 -0000 1.2 --- tcTorpedoObject.h 24 Feb 2005 22:19:14 -0000 1.3 *************** *** 69,73 **** float guidanceUpdateInterval; ! tsGeoPoint waypoint; // nav datum float runToEnable_m; float ceiling_m; // min depth --- 69,73 ---- float guidanceUpdateInterval; ! GeoPoint waypoint; // nav datum float runToEnable_m; float ceiling_m; // min depth Index: tcMissileObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMissileObject.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcMissileObject.h 1 Feb 2005 02:28:09 -0000 1.15 --- tcMissileObject.h 24 Feb 2005 22:19:14 -0000 1.16 *************** *** 53,57 **** float mfGuidanceUpdateInterval; ! tsGeoPoint msWaypoint; // nav datum float mfRangeToObjective_km; // for segment determination UINT mnCurrentSegment; --- 53,57 ---- float mfGuidanceUpdateInterval; ! GeoPoint msWaypoint; // nav datum float mfRangeToObjective_km; // for segment determination UINT mnCurrentSegment; Index: tcMapData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcMapData.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcMapData.h 20 Feb 2005 21:54:32 -0000 1.9 --- tcMapData.h 24 Feb 2005 22:19:14 -0000 1.10 *************** *** 118,122 **** float GetHRLonSpan() {return 0.5f*mrTheaterView.Width();} void GetMapDataInfo(tsMapDataInfo *pMDI); ! tsGeoPoint GetRandomPointNear(float lon, float lat, float r, float minAlt = -16000.0f, float maxAlt = 16000.0f); float GetTerrainHeight(float afLon_deg, float afLat_deg, double afStatusTime); --- 118,122 ---- float GetHRLonSpan() {return 0.5f*mrTheaterView.Width();} void GetMapDataInfo(tsMapDataInfo *pMDI); ! GeoPoint GetRandomPointNear(float lon, float lat, float r, float minAlt = -16000.0f, float maxAlt = 16000.0f); float GetTerrainHeight(float afLon_deg, float afLat_deg, double afStatusTime); Index: tcPlatformObject.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcPlatformObject.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcPlatformObject.h 16 Feb 2005 23:13:38 -0000 1.22 --- tcPlatformObject.h 24 Feb 2005 22:19:14 -0000 1.23 *************** *** 89,93 **** Brain* brain; tcLaunchRequest mcLaunchRequest; ! tsGeoPoint msTargetDatum; tsFormationParameters msFormationParameters; tcGenericDBObject *mpDBObject; --- 89,93 ---- Brain* brain; tcLaunchRequest mcLaunchRequest; ! GeoPoint msTargetDatum; tsFormationParameters msFormationParameters; tcGenericDBObject *mpDBObject; *************** *** 98,106 **** virtual void Clear(); virtual void DesignateDatum(tcPoint p); ! virtual void DesignateLauncherDatum(tsGeoPoint p, unsigned int anLauncher); virtual bool DesignateLauncherTarget(tnPoolIndex anID, unsigned anLauncher); virtual void DesignateTarget(long anID); Brain* GetBrain(); ! virtual void GetDatum(tsGeoPoint& p) {p=msTargetDatum;} virtual tcLauncher* GetLauncher(unsigned idx); wxString GetLauncherDescription(); --- 98,106 ---- virtual void Clear(); virtual void DesignateDatum(tcPoint p); ! virtual void DesignateLauncherDatum(GeoPoint p, unsigned int anLauncher); virtual bool DesignateLauncherTarget(tnPoolIndex anID, unsigned anLauncher); virtual void DesignateTarget(long anID); Brain* GetBrain(); ! virtual void GetDatum(GeoPoint& p) {p=msTargetDatum;} virtual tcLauncher* GetLauncher(unsigned idx); wxString GetLauncherDescription(); Index: tcSimState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSimState.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** tcSimState.h 11 Dec 2004 01:09:05 -0000 1.32 --- tcSimState.h 24 Feb 2005 22:19:14 -0000 1.33 *************** *** 130,134 **** void DesignateTarget(long anKey, long anTargetKey); void DesignateDatum(long anKey, tcPoint p); ! void DesignateLauncherDatum(tnPoolIndex anKey, tsGeoPoint p, unsigned anLauncher); bool DesignateLauncherTarget(tnPoolIndex anKey, tnPoolIndex anTargetKey, unsigned anLauncher); void GenerateRandomGoals(); --- 130,134 ---- void DesignateTarget(long anKey, long anTargetKey); void DesignateDatum(long anKey, tcPoint p); ! void DesignateLauncherDatum(tnPoolIndex anKey, GeoPoint p, unsigned anLauncher); bool DesignateLauncherTarget(tnPoolIndex anKey, tnPoolIndex anTargetKey, unsigned anLauncher); void GenerateRandomGoals(); Index: tcSensorState.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcSensorState.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcSensorState.h 23 Nov 2004 23:30:50 -0000 1.13 --- tcSensorState.h 24 Feb 2005 22:19:14 -0000 1.14 *************** *** 64,68 **** int mnMode; tcTrack mcTrack; ! //tsGeoPoint msCurrentPos; ///< current true position of sensor //float mfLookAz_rad; ///< azimuth of center of coverage relative to north float mountAz_rad; ///< mounted azimuth of boresight relative to nose/bow of platform --- 64,68 ---- int mnMode; tcTrack mcTrack; ! //GeoPoint msCurrentPos; ///< current true position of sensor //float mfLookAz_rad; ///< azimuth of center of coverage relative to north float mountAz_rad; ///< mounted azimuth of boresight relative to nose/bow of platform Index: tcAIData.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/sim/tcAIData.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcAIData.h 20 Feb 2005 18:20:18 -0000 1.9 --- tcAIData.h 24 Feb 2005 22:19:14 -0000 1.10 *************** *** 39,43 **** public: std::string mstrOrdername; ! tsGeoPoint msDestination; ///< destination for order double mfTime; ///< time for order long data; ///< additional data for order (e.g. target ID) --- 39,43 ---- public: std::string mstrOrdername; ! GeoPoint msDestination; ///< destination for order double mfTime; ///< time for order long data; ///< additional data for order (e.g. target ID) |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:19:51
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/src/ai Modified Files: Brain.cpp ScriptedTaskInterface.cpp Task.cpp Log Message: More OpenAL++ changes and ai improvements Index: Task.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Task.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Task.cpp 16 Feb 2005 23:13:49 -0000 1.2 --- Task.cpp 24 Feb 2005 22:19:15 -0000 1.3 *************** *** 38,41 **** --- 38,45 ---- + void Task::EndTask() + { + GetPlatformInterface().DeleteTask(taskName); + } /** *************** *** 52,55 **** --- 56,64 ---- } + const std::string& Task::GetTaskName() const + { + return taskName; + } + bool Task::IsReadyForUpdate(double t) const { Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Brain.cpp 20 Feb 2005 21:54:32 -0000 1.4 --- Brain.cpp 24 Feb 2005 22:19:15 -0000 1.5 *************** *** 28,31 **** --- 28,32 ---- #include "ai/Brain.h" #include "ai/Task.h" + #include "ai/Nav.h" #include "ai/ScriptedTask.h" #include "sim/tcPlatformObject.h" *************** *** 47,50 **** --- 48,71 ---- } taskNameLookup["Test"] = TEST_TASK; + taskNameLookup["Nav"] = NAV_TASK; + } + + /** + * @return pointer to Nav task or 0 if none exists + */ + Nav* Brain::GetNavTask() + { + std::map<std::string, Task*>::iterator iter = taskMap.find("Nav"); + if (iter != taskMap.end()) + { + wxASSERT(iter->second); + return dynamic_cast<Nav*>(iter->second); + } + else + { + return 0; + } + + } *************** *** 101,104 **** --- 122,135 ---- void Brain::AddTask(const std::string& taskName, double priority_) { + // if task already exists, update priority + std::map<std::string, Task*>::iterator tm_iter = taskMap.find(taskName); + if (tm_iter != taskMap.end()) + { + tm_iter->second->SetPriority(priority_); + fprintf(stderr, "Warning - Brain::AddTask - task already exists, " + "updating priority (%s)\n", priority_); + return; + } + // check taskNameMap for C++ task, otherwise assume python script task std::map<std::string, int>::iterator iter = taskNameLookup.find(taskName); *************** *** 112,120 **** --- 143,191 ---- int taskCode = iter->second; // add switch for C++ task addition + switch (taskCode) + { + case TEST_TASK: + fprintf(stdout, "Test task called with priority %.1f\n", priority_); + break; + case NAV_TASK: + taskMap[taskName] = new Nav(platform, &board, + nextId++, priority_, taskName); + break; + default: + fprintf(stderr, "Unrecognized C++ taskname (%s)\n", taskName.c_str()); + break; + } + + } + } + + /** + * Removes tasks in removeList. This allows a task to safely delete itself. + */ + void Brain::RemovePending() + { + while (!removeList.empty()) + { + std::string taskName = removeList.front(); + removeList.pop(); + + RemoveTaskNow(taskName); } + } + /** + * Adds task to removeList for removal during next update. + */ void Brain::RemoveTask(const std::string& taskName) { + removeList.push(taskName); + } + + /** + * Immediately removes task + */ + void Brain::RemoveTaskNow(const std::string& taskName) + { std::map<std::string, Task*>::iterator iter = taskMap.find(taskName); if (iter != taskMap.end()) *************** *** 138,141 **** --- 209,214 ---- return; } + + RemovePending(); // iterate through task map and update tasks Index: ScriptedTaskInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/ScriptedTaskInterface.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ScriptedTaskInterface.cpp 16 Feb 2005 23:13:49 -0000 1.1 --- ScriptedTaskInterface.cpp 24 Feb 2005 22:19:15 -0000 1.2 *************** *** 52,55 **** --- 52,56 ---- class_<ScriptedTaskInterface>("ScriptedTaskInterface") + .def("EndTask", &ScriptedTaskInterface::EndTask) .def("GetBlackboardInterface", &ScriptedTaskInterface::GetBlackboardInterface) .def("GetPlatformInterface", &ScriptedTaskInterface::GetPlatformInterface) *************** *** 64,67 **** --- 65,77 ---- } + /** + * Call to safely end (remove) this task + */ + void ScriptedTaskInterface::EndTask() + { + wxASSERT(task); + task->EndTask(); + } + BlackboardInterface ScriptedTaskInterface::GetBlackboardInterface() { |
|
From: Dewitt C. <ddc...@us...> - 2005-02-24 22:19:51
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11465/src/common Modified Files: simmath.cpp tcOggStreamer.cpp tcSound.cpp Log Message: More OpenAL++ changes and ai improvements Index: tcOggStreamer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcOggStreamer.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcOggStreamer.cpp 10 Jan 2005 00:30:46 -0000 1.13 --- tcOggStreamer.cpp 24 Feb 2005 22:19:15 -0000 1.14 *************** *** 1,6 **** ! /* ! ** tcOggStreamer.cpp ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcOggStreamer.cpp ! */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 38,135 **** void tcOggStreamer::Open(std::string path) { ! int result; ! ! ! // Check if file is already open. Close it if so. ! if (oggFile != NULL) ! { ! Empty(); ! ov_clear(&oggStream); ! oggFile = NULL; ! } ! ! if(!(oggFile = fopen(path.c_str(), "rb"))) { ! fprintf(stderr,"tcOggStreamer--Could not open file: %s\n",path.c_str()); ! cerr << "Could not open Ogg file.\n"; // was: throw string("Could not open Ogg file."); ! return; } ! ! ! //if(!(oggFile = fopen("One_Light_Out_Whole_Lotta.ogg", "rb"))) ! ! ! if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0) { ! fclose(oggFile); ! oggFile = NULL; ! fprintf(stderr,"tcOggStreamer--Error opening Ogg stream: %s (%s)\n", ! ErrorString(result).c_str(),path.c_str()); ! return; ! //throw string("Could not open Ogg stream. ") + ErrorString(result); } ! fprintf(stdout,"Opened music: %s\n",path.c_str()); ! ! vorbisInfo = ov_info(&oggStream, -1); ! vorbisComment = ov_comment(&oggStream, -1); ! if(vorbisInfo->channels == 1) ! format = AL_FORMAT_MONO16; ! else ! format = AL_FORMAT_STEREO16; ! } - /** - * Called once at startup. - */ - void tcOggStreamer::Init() - { - std::cout << "Generating buffers" << std::endl; - alGenBuffers(NUM_BUFFERS, buffers); - Check(); - std::cout << "Generating source" << std::endl; - alGenSources(1, &source); - Check(); - - std::cout << "Configuring source" << std::endl; - alSource3f(source, AL_POSITION, 0.0, 0.0, 0.0); - alSource3f(source, AL_VELOCITY, 0.0, 0.0, 0.0); - alSource3f(source, AL_DIRECTION, 0.0, 0.0, 0.0); - alSourcef (source, AL_ROLLOFF_FACTOR, 0.0 ); - alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE ); - alSourcef (source, AL_GAIN, volume); - alSourcei(source, AL_LOOPING, AL_FALSE); - } - /** - * Called once before exit. - */ - void tcOggStreamer::Release() - { - alSourceStop(source); - Empty(); - alDeleteSources(1, &source); - Check(); - alDeleteBuffers(1, buffers); - Check(); ! if (oggFile) ov_clear(&oggStream); ! } /** * Seeks to seekTime if song is playing */ void tcOggStreamer::Seek(double seekTime) { - if (!oggFile) - { - fprintf(stderr,"tcOggStreamer::Seek called with no open stream\n"); - return; - } - ov_time_seek(&oggStream, seekTime); - Empty(); - Check(); } --- 38,69 ---- void tcOggStreamer::Open(std::string path) { ! return; ! if (source.valid()) { ! stream.get()->unref(); } ! else { ! source = new openalpp::Source; ! source->setAmbient(); ! source->setGain(volume); } ! stream = new openalpp::FileStream(path); ! source->setSound(stream.get()); ! source->play(); } ! /** * Seeks to seekTime if song is playing + * (not implemented yet in this version using OpenAL++) */ void tcOggStreamer::Seek(double seekTime) { } *************** *** 141,146 **** void tcOggStreamer::SetVolume(float vol) { - alSourcef (source, AL_GAIN, vol); volume = vol; } --- 75,83 ---- void tcOggStreamer::SetVolume(float vol) { volume = vol; + if (source.valid()) + { + source->setGain(volume); + } } *************** *** 150,157 **** void tcOggStreamer::Stop() { ! alSourceStop(source); ! if (oggFile == NULL) return; // already cleared ! ov_clear(&oggStream); ! oggFile = NULL; } --- 87,94 ---- void tcOggStreamer::Stop() { ! if (source.valid()) ! { ! source->stop(); ! } } *************** *** 159,178 **** void tcOggStreamer::Display() { - if (oggFile == NULL) return; - cout - << "version " << vorbisInfo->version << "\n" - << "channels " << vorbisInfo->channels << "\n" - << "rate (hz) " << vorbisInfo->rate << "\n" - << "bitrate upper " << vorbisInfo->bitrate_upper << "\n" - << "bitrate nominal " << vorbisInfo->bitrate_nominal << "\n" - << "bitrate lower " << vorbisInfo->bitrate_lower << "\n" - << "bitrate window " << vorbisInfo->bitrate_window << "\n" - << "\n" - << "vendor " << vorbisComment->vendor << "\n"; - - for(int i = 0; i < vorbisComment->comments; i++) - cout << " " << vorbisComment->user_comments[i] << "\n"; - - cout << endl; } --- 96,99 ---- *************** *** 187,214 **** bool tcOggStreamer::Play() { ! if (oggFile == NULL) return false; paused = false; - if (IsPlaying()) return true; - Update(); // new way of doing this ! #if 0 ! bool dataAvailable = true; ! for (int nBuff = 0;(nBuff < NUM_BUFFERS) && dataAvailable; nBuff++) { ! if(!Stream(buffers[nBuff])) dataAvailable = false; // out of music for stream ! alSourceQueueBuffers(source, 1, &buffers[nBuff]); } - #endif ! alSourcePlay(source); ! ! return true; } void tcOggStreamer::Queue(std::string path) { ! if (oggFile == NULL) { Open(path); --- 108,132 ---- bool tcOggStreamer::Play() { ! if (!source.valid()) return false; paused = false; ! ! if (IsPlaying()) return true; ! ! if (IsStopped()) { ! } ! return IsPlaying(); } + + void tcOggStreamer::Queue(std::string path) { ! if ( (!source.valid()) || (!IsPlaying())) { Open(path); *************** *** 219,232 **** queuedSong = path; } ! //const char *temp = queuedSong.c_str(); } bool tcOggStreamer::IsPaused() { ! ALenum state; ! ! alGetSourcei(source, AL_SOURCE_STATE, &state); ! ! return (state == AL_PAUSED); } --- 137,146 ---- queuedSong = path; } ! } bool tcOggStreamer::IsPaused() { ! return (source->getState() == openalpp::Paused); } *************** *** 234,493 **** bool tcOggStreamer::IsPlaying() { ! ALenum state; ! ! alGetSourcei(source, AL_SOURCE_STATE, &state); ! ! return (state == AL_PLAYING); ! } ! ! bool tcOggStreamer::IsStopped() ! { ! ALenum state; ! ! alGetSourcei(source, AL_SOURCE_STATE, &state); ! ! return (state == AL_STOPPED); ! } ! ! ! ! /* ! bool tcOggStreamer::Update() ! { ! int processed; ! bool active = true; ! ! alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed); ! ! while(processed--) ! { ! ALuint buffer; ! ! alSourceUnqueueBuffers(source, 1, &buffer); ! Check(); ! ! active = Stream(buffer); ! ! alSourceQueueBuffers(source, 1, &buffer); ! Check(); ! } ! ! return active; ! } ! */ ! bool tcOggStreamer::Update() ! { ! bool active = true; ! int nProcessed; ! int queued; ! ! if (paused) ! { ! return true; ! } ! ! if (IsStopped()) ! { ! ! //alSourceStop(source); ! alSourcePlay(source); // crashes frequently in OpenAL32.dll thread after here ! ! #ifdef _DEBUG ! fprintf(stderr, "tcOggStreamer::Update - Restarting source\n"); ! #endif ! //return true; ! } ! ! alGetSourcei(source, AL_BUFFERS_QUEUED, &queued); ! ! // Ask OpenAL how many buffers it has managed to play back ! alGetSourcei(source, AL_BUFFERS_PROCESSED, &nProcessed); ! nFreeBuffers += nProcessed; ! ! if (nFreeBuffers > NUM_BUFFERS) ! { ! wxASSERT(false); ! nFreeBuffers = NUM_BUFFERS; ! } ! ! ! /* If stall condition then set nFreeBuffers to NUM_BUFFERS ! ** to restart streaming (not sure if this works yet) ! */ ! int nQueued; ! alGetSourcei(source, AL_BUFFERS_QUEUED, &nQueued); ! if ((nFreeBuffers == 0) && (nQueued == 0)) ! { ! nFreeBuffers = NUM_BUFFERS; ! } ! ! ! while (active && nFreeBuffers) ! { ! if (nProcessed) ! { ! alSourceUnqueueBuffers(source, 1, &buffers[bufferIndex]); ! nProcessed--; ! } ! Check(); ! //fill the buffer ! active = Stream(buffers[bufferIndex]); ! ! if (active) ! { ! alSourceQueueBuffers(source, 1, &buffers[bufferIndex]); ! ! // fprintf(stdout,"Queued buffer: %d\n", bufferIndex); ! ! bufferIndex = (bufferIndex + 1) % NUM_BUFFERS; ! nFreeBuffers--; ! } ! ! Check(); ! } ! ! return active; ! } ! ! bool tcOggStreamer::Stream(ALuint buffer) ! { ! int currentSize = 0; ! int section; ! long result; ! ! currentSize = 0; ! while (currentSize < BUFFER_SIZE) ! { ! result = ov_read(&oggStream, ! streamBuffer + currentSize, BUFFER_SIZE - currentSize, 0, 2, 1, §ion); ! Check(); ! ! if (result > 0) ! { ! currentSize += result; ! } ! else if (result < 0) ! { ! fprintf(stderr, "%s\n", ErrorString(result).c_str()); ! } ! else ! { ! if (queuedSong.size() > 2) ! { ! Open(queuedSong); ! queuedSong = ""; ! return false; ! } ! else ! { ! result = ov_time_seek(&oggStream, 0.0); // loop if no queued song ! } ! break; ! } ! } ! ! if(currentSize == 0) ! return false; ! ! alBufferData(buffer, format, streamBuffer, currentSize, vorbisInfo->rate); ! Check(); ! ! return true; ! } ! ! ! ! ! void tcOggStreamer::Empty() ! { ! int queued; ! ! alSourceStop(source); ! alGetSourcei(source, AL_BUFFERS_QUEUED, &queued); ! ! while(queued--) ! { ! ALuint buffer; ! ! alSourceUnqueueBuffers(source, 1, &buffer); ! Check(); ! } ! bufferIndex = 0; ! nFreeBuffers = NUM_BUFFERS; } ! ! ! ! void tcOggStreamer::Check() { ! int error = alGetError(); ! ! if (error != AL_NO_ERROR) ! { ! fprintf(stderr, "OpenAL error: %s\n", ErrorString(error).c_str()); ! } ! } - string tcOggStreamer::ErrorString(int code) - { - switch(code) - { - case OV_EREAD: - return string("Read from media."); - case OV_ENOTVORBIS: - return string("Not Vorbis data."); - case OV_EVERSION: - return string("Vorbis version mismatch."); - case OV_EBADHEADER: - return string("Invalid Vorbis header."); - case OV_EFAULT: - return string("Internal logic fault (bug or heap/stack corruption."); - case OV_HOLE: - return string("Missing or corrupt data in the bitstream. Recovery is normally automatic. "); - case OV_EIMPL: - return string("Feature not implemented."); - case OV_EINVAL: - return string("Either an invalid argument, or incompletely initialized argument passed to libvorbisfile call"); - case OV_EBADLINK: - return string("The given link exists in the Vorbis data stream, but is not decipherable due to garbacge or corruption."); - case OV_ENOSEEK: - return string("The given stream is not seekable"); - case OV_ENOTAUDIO: - return string("This is not an audio data packet."); - case OV_EBADPACKET: - return string("Bad packet."); - case AL_INVALID_NAME: - return string("Invalid Name paramater passed to AL call."); - case AL_ILLEGAL_ENUM: - return string("Invalid parameter passed to AL call."); - case AL_INVALID_VALUE: - return string("Invalid enum parameter value."); - case AL_ILLEGAL_COMMAND: - return string("Illegal command."); - case AL_OUT_OF_MEMORY: - return string("AL out of memory."); - default: - wxString s = wxString::Format("Unknown Ogg error (%d)", code); - return string(s.c_str()); - } - } - tcOggStreamer::tcOggStreamer() { - oggFile = NULL; - volume = 0.2f; - bufferIndex = 0; - nFreeBuffers = NUM_BUFFERS; - queuedSong == ""; - paused = false; } tcOggStreamer::~tcOggStreamer() { } --- 148,176 ---- bool tcOggStreamer::IsPlaying() { ! if (!source.valid()) return false; ! return (source->getState() == openalpp::Playing); } ! bool tcOggStreamer::IsStopped() { ! return (source->getState() == openalpp::Stopped); } tcOggStreamer::tcOggStreamer() + : volume(0.2f), + queuedSong(""), + paused(false) { } tcOggStreamer::~tcOggStreamer() { + if (source.valid()) + { + source->stop(); + } } Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcSound.cpp 21 Feb 2005 18:26:06 -0000 1.23 --- tcSound.cpp 24 Feb 2005 22:19:15 -0000 1.24 *************** *** 108,112 **** - if (oggStreamer) oggStreamer->Init(); SetMusicVolume(0.5f); --- 108,111 ---- *************** *** 261,265 **** if (meMusicState == MS_STOPPED) return; ! if (!oggStreamer->Update()) { oggStreamer->Play(); --- 260,264 ---- if (meMusicState == MS_STOPPED) return; ! if (!oggStreamer->IsPlaying()) { oggStreamer->Play(); *************** *** 443,448 **** effectMap.clear(); - if (oggStreamer) oggStreamer->Release(); - //osgAL::SoundManager::instance()->shutdown(); --- 442,445 ---- *************** *** 473,477 **** std::cout << "Creating OGG streamer" << std::endl; ! oggStreamer = 0;//new tcOggStreamer(); std::cout << "Success - Create OGG streamer" << std::endl; } --- 470,474 ---- std::cout << "Creating OGG streamer" << std::endl; ! oggStreamer = new tcOggStreamer(); std::cout << "Success - Create OGG streamer" << std::endl; } Index: simmath.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/simmath.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** simmath.cpp 5 Dec 2004 02:49:47 -0000 1.20 --- simmath.cpp 24 Feb 2005 22:19:15 -0000 1.21 *************** *** 76,80 **** // assumes lon is within [-pi,pi) and lat [-pi/2,pi/2] ! int GeoWithinRegion(tsGeoPoint p, tcRect *pRegion) { if ((p.mfLat_rad > pRegion->top)||(p.mfLat_rad < pRegion->bottom)) {return 0;} --- 76,80 ---- // assumes lon is within [-pi,pi) and lat [-pi/2,pi/2] ! int GeoWithinRegion(GeoPoint p, tcRect *pRegion) { if ((p.mfLat_rad > pRegion->top)||(p.mfLat_rad < pRegion->bottom)) {return 0;} *************** *** 116,120 **** bool tcGeoRect::ContainsPoint(float x, float y) { ! tsGeoPoint p; p.Set(x, y, 0); return GeoWithinRegion(p, this) != 0; --- 116,120 ---- bool tcGeoRect::ContainsPoint(float x, float y) { ! GeoPoint p; p.Set(x, y, 0); return GeoWithinRegion(p, this) != 0; *************** *** 415,423 **** } ! /********************** tsGeoPoint *************************************/ /** * Load state from stream */ ! tcStream& tsGeoPoint::operator<<(tcStream& stream) { stream >> mfLon_rad; --- 415,423 ---- } ! /********************** GeoPoint *************************************/ /** * Load state from stream */ ! tcStream& GeoPoint::operator<<(tcStream& stream) { stream >> mfLon_rad; *************** *** 431,435 **** * Save state to stream */ ! tcStream& tsGeoPoint::operator>>(tcStream& stream) { stream << mfLon_rad; --- 431,435 ---- * Save state to stream */ ! tcStream& GeoPoint::operator>>(tcStream& stream) { stream << mfLon_rad; *************** *** 536,540 **** } // returns radian heading to (lat,lon) point ! float tcKinematics::HeadingToGeoRad(const tsGeoPoint *apGeoPoint) { return nsNav::GCHeadingApprox_rad((float)mfLat_rad,(float)mfLon_rad, (float)apGeoPoint->mfLat_rad,(float)apGeoPoint->mfLon_rad); --- 536,540 ---- } // returns radian heading to (lat,lon) point ! float tcKinematics::HeadingToGeoRad(const GeoPoint *apGeoPoint) { return nsNav::GCHeadingApprox_rad((float)mfLat_rad,(float)mfLon_rad, (float)apGeoPoint->mfLat_rad,(float)apGeoPoint->mfLon_rad); *************** *** 555,559 **** } ! float tcKinematics::RangeToKm(const tsGeoPoint *apGeoPoint) { return C_RADTOKM * nsNav::GCDistanceApprox_rad((float)mfLat_rad,(float)mfLon_rad, --- 555,559 ---- } ! float tcKinematics::RangeToKm(const GeoPoint *apGeoPoint) { return C_RADTOKM * nsNav::GCDistanceApprox_rad((float)mfLat_rad,(float)mfLon_rad, *************** *** 737,741 **** // current location of this tcKinematics object // altitude isn't changed, has issues off of equator like everything else :< ! void tcKinematics::SetRelativeGeo(tsGeoPoint& rpGeoPoint, float afBearing_rad, float afRange_km) { nsNav::OffsetApprox((float)mfLat_rad,(float)mfLon_rad, rpGeoPoint.mfLat_rad, rpGeoPoint.mfLon_rad, afBearing_rad,afRange_km*C_KMTORAD); --- 737,741 ---- // current location of this tcKinematics object // altitude isn't changed, has issues off of equator like everything else :< ! void tcKinematics::SetRelativeGeo(GeoPoint& rpGeoPoint, float afBearing_rad, float afRange_km) { nsNav::OffsetApprox((float)mfLat_rad,(float)mfLon_rad, rpGeoPoint.mfLat_rad, rpGeoPoint.mfLon_rad, afBearing_rad,afRange_km*C_KMTORAD); |
|
From: Dewitt C. <ddc...@us...> - 2005-02-21 18:27:38
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22705/src/graphics Modified Files: tc3DModel.cpp tc3DViewer.cpp tc3DWindow.cpp tcMapView.cpp Log Message: Replaced osgAL with OpenAL++ exclusively due to instability issues. Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** tcMapView.cpp 20 Feb 2005 21:54:33 -0000 1.16 --- tcMapView.cpp 21 Feb 2005 18:26:12 -0000 1.17 *************** *** 2281,2285 **** void tcTacticalMapView::OnMouseWheel(wxMouseEvent& event) { ! wxPoint point = event.GetPosition(); int zDelta = event.GetWheelRotation(); --- 2281,2285 ---- void tcTacticalMapView::OnMouseWheel(wxMouseEvent& event) { ! wxPoint point(mnXCenter, mnYCenter); // zoom on center regardless of pointer pos int zDelta = event.GetWheelRotation(); Index: tc3DModel.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DModel.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tc3DModel.cpp 31 Jan 2005 01:33:07 -0000 1.22 --- tc3DModel.cpp 21 Feb 2005 18:26:09 -0000 1.23 *************** *** 41,48 **** #include <osgUtil/SmoothingVisitor> ! #include <osgAL/SoundNode> ! #include <osgAL/SoundRoot> ! #include <osgAL/SoundManager> ! #include <osgAL/SoundState> #ifdef _DEBUG --- 41,48 ---- #include <osgUtil/SmoothingVisitor> ! //#include <osgAL/SoundNode> ! //#include <osgAL/SoundRoot> ! //#include <osgAL/SoundManager> ! //#include <osgAL/SoundState> #ifdef _DEBUG *************** *** 769,772 **** --- 769,773 ---- modelTransform->addChild(root.get()); + #if 0 // osgAL experiment try { *************** *** 782,786 **** fprintf(stderr, "Failed to load sound file\n"); } ! --- 783,787 ---- fprintf(stderr, "Failed to load sound file\n"); } ! #endif Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tc3DWindow.cpp 20 Feb 2005 21:54:33 -0000 1.14 --- tc3DWindow.cpp 21 Feb 2005 18:26:12 -0000 1.15 *************** *** 1697,1701 **** { ! #ifdef _DEBUG if (osg::StateSet* stateSet = backgroundRoot->getStateSet()) { --- 1697,1701 ---- { ! #if 0 if (osg::StateSet* stateSet = backgroundRoot->getStateSet()) { Index: tc3DViewer.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DViewer.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tc3DViewer.cpp 27 Jan 2005 01:01:49 -0000 1.9 --- tc3DViewer.cpp 21 Feb 2005 18:26:11 -0000 1.10 *************** *** 50,57 **** #include <osgUtil/UpdateVisitor> ! #include <osgAL/SoundNode> ! #include <osgAL/SoundRoot> ! #include <osgAL/SoundManager> ! #include <osgAL/SoundState> --- 50,57 ---- #include <osgUtil/UpdateVisitor> ! //#include <osgAL/SoundNode> ! //#include <osgAL/SoundRoot> ! //#include <osgAL/SoundManager> ! //#include <osgAL/SoundState> *************** *** 1062,1067 **** sceneViewFar->setViewMatrixAsLookAt(cameraPosition, cameraTarget, osg::Vec3(0,0,1)); ! osgAL::SoundManager::instance()->getListener()->setPosition(cameraPosition.x(), cameraPosition.y(), ! cameraPosition.z()); // update skyTransform based on camera position --- 1062,1067 ---- sceneViewFar->setViewMatrixAsLookAt(cameraPosition, cameraTarget, osg::Vec3(0,0,1)); ! //osgAL::SoundManager::instance()->getListener()->setPosition(cameraPosition.x(), cameraPosition.y(), ! // cameraPosition.z()); // update skyTransform based on camera position *************** *** 1879,1883 **** tc3DModel::LoadUnknowns(); ! rootnode->addChild(tcSound::Get()->GetSoundRoot()); } --- 1879,1883 ---- tc3DModel::LoadUnknowns(); ! // rootnode->addChild(tcSound::Get()->GetSoundRoot()); } |
|
From: Dewitt C. <ddc...@us...> - 2005-02-21 18:27:36
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22705/src/sim Modified Files: tcMapData.cpp tcRadar.cpp tcTorpedoObject.cpp Log Message: Replaced osgAL with OpenAL++ exclusively due to instability issues. Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcMapData.cpp 20 Feb 2005 21:54:35 -0000 1.15 --- tcMapData.cpp 21 Feb 2005 18:26:13 -0000 1.16 *************** *** 371,375 **** nRed = 10; nGreen = 10; ! nBlue = 100; maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + (nAlpha << 24); } --- 371,375 ---- nRed = 10; nGreen = 10; ! nBlue = 90; maPalette1[k] = nRed + (nGreen << 8) + (nBlue << 16) + (nAlpha << 24); } Index: tcTorpedoObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTorpedoObject.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcTorpedoObject.cpp 21 Dec 2004 02:26:18 -0000 1.3 --- tcTorpedoObject.cpp 21 Feb 2005 18:26:26 -0000 1.4 *************** *** 246,250 **** UpdateSpeedSimple(dt_s); ! float speed_mps = C_KTSTOMPS * mcKin.mfSpeed_kts; float disp_m = speed_mps * dt_s; // distance moved this update float disp_rad = C_MTORAD * disp_m; // distance in equator radians --- 246,250 ---- UpdateSpeedSimple(dt_s); ! float speed_mps = C_KTSTOMPS * cosf(mcKin.mfClimbAngle_rad) * mcKin.mfSpeed_kts; float disp_m = speed_mps * dt_s; // distance moved this update float disp_rad = C_MTORAD * disp_m; // distance in equator radians *************** *** 252,256 **** float heading_rad = mcKin.mfHeading_rad; - float fGroundSpeed_kts = cosf(mcKin.mfClimbAngle_rad) * mcKin.mfSpeed_kts; mcKin.mfLon_rad += disp_rad * (double)(sinf(heading_rad) / cosf((float)mcKin.mfLat_rad)); --- 252,255 ---- Index: tcRadar.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcRadar.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcRadar.cpp 1 Feb 2005 02:29:15 -0000 1.24 --- tcRadar.cpp 21 Feb 2005 18:26:26 -0000 1.25 *************** *** 381,385 **** (PTYPE_AIR | PTYPE_FIXED | PTYPE_MISSILE | PTYPE_SURFACE)) != 0); ! if (CanDetectTarget(ptarget, fRange_km)) { UpdateTrack(ptarget, t); --- 381,385 ---- (PTYPE_AIR | PTYPE_FIXED | PTYPE_MISSILE | PTYPE_SURFACE)) != 0); ! if (isEligible && CanDetectTarget(ptarget, fRange_km)) { UpdateTrack(ptarget, t); |
|
From: Dewitt C. <ddc...@us...> - 2005-02-21 18:27:10
|
Update of /cvsroot/gcblue/gcb_wx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22705 Modified Files: GCblue.vcproj Log Message: Replaced osgAL with OpenAL++ exclusively due to instability issues. Index: GCblue.vcproj =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/GCblue.vcproj,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** GCblue.vcproj 20 Feb 2005 21:54:31 -0000 1.83 --- GCblue.vcproj 21 Feb 2005 18:25:46 -0000 1.84 *************** *** 39,43 **** Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib GLaux.lib wrap_oald.lib ALutd.lib comctl32.lib rpcrt4.lib wsock32.lib wxmswd.lib zlibd.lib pngd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgParticled.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib sqlite.lib osgALd.lib oalppd.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" --- 39,43 ---- Name="VCLinkerTool" IgnoreImportLibrary="FALSE" ! AdditionalDependencies="python23.lib boost_python_debug.lib winmm.lib opengl32.lib glu32.lib GLaux.lib comctl32.lib rpcrt4.lib wsock32.lib wxmswd.lib zlibd.lib pngd.lib jpegd.lib tiffd.lib osgd.lib osgDBd.lib osgParticled.lib osgTextd.lib osgUtild.lib DemeterDebug.lib DemeterOSGDebug.lib sqlite.lib ogg_static_d.lib vorbis_static_d.lib vorbisfile_static_d.lib wrap_oald.lib ALutd.lib oalppd.lib" ShowProgress="0" OutputFile="$(ProjectDir)/bin/GCblueD.exe" *************** *** 98,102 **** RuntimeTypeInfo="TRUE" UsePrecompiledHeader="0" ! WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> --- 98,102 ---- RuntimeTypeInfo="TRUE" UsePrecompiledHeader="0" ! WarningLevel="4" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> *************** *** 105,109 **** <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib winmm.LIB opengl32.lib glu32.lib GLaux.lib wrap_oal.lib ALut.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib sqlite.lib OpenThreadsWin32.lib osgAL.lib oalpp.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" --- 105,109 ---- <Tool Name="VCLinkerTool" ! AdditionalDependencies="boost_python.lib python23.lib opengl32.lib winmm.lib GLaux.lib glu32.lib comctl32.lib rpcrt4.lib wsock32.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib osg.lib osgDB.lib osgParticle.lib osgUtil.lib osgText.lib Demeter.lib DemeterOSG.lib sqlite.lib OpenThreadsWin32.lib wrap_oal.lib ALut.lib oalpp.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib" OutputFile="$(ProjectDir)/bin/$(ProjectName).exe" LinkIncremental="1" |
|
From: Dewitt C. <ddc...@us...> - 2005-02-21 18:27:01
|
Update of /cvsroot/gcblue/gcb_wx/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22705/src/common Modified Files: tcSound.cpp Log Message: Replaced osgAL with OpenAL++ exclusively due to instability issues. Index: tcSound.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/common/tcSound.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** tcSound.cpp 18 Feb 2005 17:41:50 -0000 1.22 --- tcSound.cpp 21 Feb 2005 18:26:06 -0000 1.23 *************** *** 1,4 **** ! /* ! ** Copyright (C) 2003 Dewitt Cole (dew...@gl...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcSound.cpp ! */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 38,41 **** --- 40,45 ---- #endif + using openalpp::Source; + /* With the "Enable minimum rebuild option" compiler error C1055 out of keys occurs ** with this file and several graphics files. The error started occuring after modifications *************** *** 46,139 **** ! /** ! * Based on osgAL example osgal.cpp from ! * http://www.vrlab.umu.se/research/osgAL/osgal.cpp ! */ ! osg::ref_ptr<osgAL::SoundNode> tcSound::CreateSound(const std::string& file) { ! // Create a sample, load a .wav file. ! openalpp::Sample *sample = osgAL::SoundManager::instance()->getSample(file.c_str()); ! ! // Create a named sound state. ! std::string stateName = "state_"; ! stateName += file; ! osgAL::SoundState* sound_state = new osgAL::SoundState(stateName); ! ! // Let the soundstate use the sample we just created ! sound_state->setSample(sample); ! ! // Set its gain (volume) to 0.9 ! sound_state->setGain(0.4f); ! ! // Set its pitch to 1 (normal speed) ! sound_state->setPitch(1); - // Make it play - sound_state->setPlay(true); - // The sound should loop over and over again - sound_state->setLooping(true); - // Allocate a hardware soundsource to this soundstate (priority 10) - // - sound_state->allocateSource(10, false); - - // At 40 the gain will be half of full! - sound_state->setReferenceDistance(10); - sound_state->apply(); ! // Add the soundstate to the sound manager, so we can find it later on if we want to ! osgAL::SoundManager::instance()->addSoundState(sound_state); ! ! // Create a sound node and attach the soundstate to it. ! osg::ref_ptr<osgAL::SoundNode> sound = new osgAL::SoundNode; ! sound->setSoundState(sound_state); ! return sound; ! } ! bool tcSound::GetMusicPause() const ! { ! wxASSERT(oggStreamer); ! return oggStreamer->GetPause(); } - bool tcSound::Init() { ! InitOsgAL(); ! ! effectMap["Explosion"] = osgAL::SoundManager::instance()->getSample("Explosion.wav"); ! effectMap["Implosion"] = osgAL::SoundManager::instance()->getSample("Implosion.wav"); ! effectMap["ShortBeep"] = osgAL::SoundManager::instance()->getSample("ShortBeep.wav"); ! effectMap["MissileLaunch"] = osgAL::SoundManager::instance()->getSample("MissileLaunch.wav"); ! effectMap["TwoBeeps"] = osgAL::SoundManager::instance()->getSample("TwoBeeps.wav"); ! effectMap["consolebeep"] = osgAL::SoundManager::instance()->getSample("consolebeep.wav"); ! effectMap["Beep2"] = osgAL::SoundManager::instance()->getSample("Beep2.wav"); ! effectMap["RejectBeep"] = osgAL::SoundManager::instance()->getSample("RejectBeep.wav"); ! effectMap["Ping"] = osgAL::SoundManager::instance()->getSample("Ping.wav"); ! effectMap["Ping2"] = osgAL::SoundManager::instance()->getSample("Ping2.wav"); ! effectMap["radarping"] = osgAL::SoundManager::instance()->getSample("radarping.wav"); ! effectMap["LowBeep"] = osgAL::SoundManager::instance()->getSample("LowBeep.wav"); ! effectMap["Bloop"] = osgAL::SoundManager::instance()->getSample("Bloop.wav"); ! effectMap["NoisyBeepLow"] = osgAL::SoundManager::instance()->getSample("NoisyBeepLow.wav"); ! effectMap["Thuck"] = osgAL::SoundManager::instance()->getSample("Thuck.wav"); ! effectMap["Explosion2"] = osgAL::SoundManager::instance()->getSample("Explosion2.wav"); ! effectMap["Welcome"] = osgAL::SoundManager::instance()->getSample("Welcome.wav"); ! effectMap["jetlaunch"] = osgAL::SoundManager::instance()->getSample("jetlaunch.wav"); ! effectMap["MutedBeep"] = osgAL::SoundManager::instance()->getSample("MutedBeep.wav"); ! effectMap["intercom"] = osgAL::SoundManager::instance()->getSample("intercom.wav"); ! effectMap["fslide"] = osgAL::SoundManager::instance()->getSample("fslide.wav"); ! effectMap["NavalGun1"] = osgAL::SoundManager::instance()->getSample("NavalGun1.wav"); ! effectMap["helolaunch"] = osgAL::SoundManager::instance()->getSample("helolaunch.wav"); ! effectMap["radar_on"] = osgAL::SoundManager::instance()->getSample("radar_on.wav"); ! effectMap["radar_off"] = osgAL::SoundManager::instance()->getSample("radar_off.wav"); ! effectMap["torpedo_launch"] = osgAL::SoundManager::instance()->getSample("torpedo_launch.wav"); ! effectMap["shishding"] = osgAL::SoundManager::instance()->getSample("shishding.wav"); ! oggStreamer->Init(); SetMusicVolume(0.5f); --- 50,112 ---- ! bool tcSound::GetMusicPause() const { ! //wxASSERT(oggStreamer); ! if (!oggStreamer) return false; ! return oggStreamer->GetPause(); ! } ! /** ! * ! */ ! openalpp::Sample* tcSound::LoadSample(const std::string& file) ! { ! static std::string pathPrefix("sound\\wav\\"); ! std::string filePath = pathPrefix + file; + // Create a sample, load a .wav file. + openalpp::Sample* sample = new openalpp::Sample(filePath); ! return sample; } bool tcSound::Init() { + InitOpenAL(); ! effectMap["Explosion"] = LoadSample("Explosion.wav"); ! effectMap["Implosion"] = LoadSample("Implosion.wav"); ! effectMap["ShortBeep"] = LoadSample("ShortBeep.wav"); ! effectMap["MissileLaunch"] = LoadSample("MissileLaunch.wav"); ! effectMap["TwoBeeps"] = LoadSample("TwoBeeps.wav"); ! effectMap["consolebeep"] = LoadSample("consolebeep.wav"); ! effectMap["Beep2"] = LoadSample("Beep2.wav"); ! effectMap["RejectBeep"] = LoadSample("RejectBeep.wav"); ! effectMap["Ping"] = LoadSample("Ping.wav"); ! effectMap["Ping2"] = LoadSample("Ping2.wav"); ! effectMap["radarping"] = LoadSample("radarping.wav"); ! effectMap["LowBeep"] = LoadSample("LowBeep.wav"); ! effectMap["Bloop"] = LoadSample("Bloop.wav"); ! effectMap["NoisyBeepLow"] = LoadSample("NoisyBeepLow.wav"); ! effectMap["Thuck"] = LoadSample("Thuck.wav"); ! effectMap["Explosion2"] = LoadSample("Explosion2.wav"); ! effectMap["Welcome"] = LoadSample("Welcome.wav"); ! effectMap["jetlaunch"] = LoadSample("jetlaunch.wav"); ! effectMap["MutedBeep"] = LoadSample("MutedBeep.wav"); ! effectMap["intercom"] = LoadSample("intercom.wav"); ! effectMap["fslide"] = LoadSample("fslide.wav"); ! effectMap["NavalGun1"] = LoadSample("NavalGun1.wav"); ! effectMap["helolaunch"] = LoadSample("helolaunch.wav"); ! effectMap["radar_on"] = LoadSample("radar_on.wav"); ! effectMap["radar_off"] = LoadSample("radar_off.wav"); ! effectMap["torpedo_launch"] = LoadSample("torpedo_launch.wav"); ! effectMap["shishding"] = LoadSample("shishding.wav"); ! if (oggStreamer) oggStreamer->Init(); SetMusicVolume(0.5f); *************** *** 142,154 **** } - /** - * @return osgAL::SoundRoot to add to scene graph - */ - osgAL::SoundRoot* tcSound::GetSoundRoot() - { - wxASSERT(soundRoot.valid()); - return soundRoot.get(); - } /** --- 115,119 ---- *************** *** 156,218 **** * startup. */ ! void tcSound::InitOsgAL() { ! osgAL::SoundManager::instance()->init(16); ! osgAL::SoundManager::instance()->getEnvironment()->setDistanceModel(openalpp::InverseDistance); ! osgAL::SoundManager::instance()->getEnvironment()->setDopplerFactor(1); ! ! osgAL::SoundManager::instance()->addFilePath("sound\\wav"); ! ! // Create ONE (only one, otherwise the transformation of the listener and update for SoundManager will be ! // called several times, which is not catastrophic, but unnecessary) ! // SoundRoot that will make sure the listener is updated and ! // to keep the internal state of the SoundManager updated ! // This could also be done manually, this is just a handy way of doing it. ! if (!soundRoot.valid()) ! { ! soundRoot = new osgAL::SoundRoot; ! } ! ! // create SoundState's to use as buffers for (size_t n=0; n<N_EFFECT_BUFFERS; n++) { wxString stateName = wxString::Format("state%d", n); ! osgAL::SoundState* soundState = new osgAL::SoundState(stateName.c_str()); ! ! soundState->setAmbient(true); ! soundState->setGain(0.5f); // Set its gain (volume) ! soundState->setPitch(1); // Set its pitch to 1 (normal speed) ! soundState->setRelative(true); ! soundState->setPosition(osg::Vec3(0,0,0)); ! soundState->setLooping(false); ! soundState->setStopMethod(openalpp::Stopped); ! ! // Allocate a hardware soundsource to this soundstate (priority 10) ! // soundState->allocateSource(10, false); ! ! // Add the soundstate to the sound manager, so we can find it later on if we want to ! osgAL::SoundManager::instance()->addSoundState(soundState); ! ! effectBuffer.push_back(soundState); available.push_back(n); } } - /** - * - */ - void tcSound::SetListenerDirection(const osg::Vec3& dir) - { - osgAL::SoundManager::instance()->setListenerDirection(dir); - } - - /** - * Set the transformation matrix for the listener - */ - void tcSound::SetListenerMatrix(const osg::Matrix& matrix) - { - osgAL::SoundManager::instance()->setListenerMatrix(matrix); - } --- 121,142 ---- * startup. */ ! void tcSound::InitOpenAL() { ! // create Sources's to use as buffers for (size_t n=0; n<N_EFFECT_BUFFERS; n++) { wxString stateName = wxString::Format("state%d", n); ! openalpp::ref_ptr<Source> source = new Source; ! source->stop(); ! source->setAmbient(); ! source->setGain(0.5f); // volume ! source->setLooping(false); ! ! effectBuffer.push_back(source); available.push_back(n); } } *************** *** 249,253 **** { if (!mbInitialized) return; ! std::string musicPath = OGG_PATH; musicPath += song; --- 173,177 ---- { if (!mbInitialized) return; ! if (!oggStreamer) return; std::string musicPath = OGG_PATH; musicPath += song; *************** *** 263,267 **** { if (!mbInitialized) return; ! oggStreamer->Queue(song); } --- 187,191 ---- { if (!mbInitialized) return; ! if (oggStreamer) oggStreamer->Queue(song); } *************** *** 269,272 **** --- 193,197 ---- { if (!mbInitialized) return; + if (!oggStreamer) return; wxArrayString fileList; *************** *** 282,286 **** { if (!mbInitialized) return; ! oggStreamer->Seek(seekTime); } --- 207,211 ---- { if (!mbInitialized) return; ! if (oggStreamer) oggStreamer->Seek(seekTime); } *************** *** 288,292 **** { if (!mbInitialized) return; ! oggStreamer->SetPause(state); } --- 213,217 ---- { if (!mbInitialized) return; ! if (oggStreamer) oggStreamer->SetPause(state); } *************** *** 296,300 **** { if (!mbInitialized) return; ! oggStreamer->SetVolume(vol); } --- 221,225 ---- { if (!mbInitialized) return; ! if (oggStreamer) oggStreamer->SetVolume(vol); } *************** *** 315,319 **** { StopMusic(mnCurrentTrack); ! oggStreamer->Stop(); } } --- 240,244 ---- { StopMusic(mnCurrentTrack); ! if (oggStreamer) oggStreamer->Stop(); } } *************** *** 333,336 **** --- 258,263 ---- { if (!mbInitialized) return; + if (!oggStreamer) return; + if (meMusicState == MS_STOPPED) return; if (!oggStreamer->Update()) *************** *** 418,422 **** for(size_t i=0; i<effectBuffer.size(); i++) { ! if (!effectBuffer[i]->isPlaying()) { ReleaseEffectBuffer(i); --- 345,349 ---- for(size_t i=0; i<effectBuffer.size(); i++) { ! if (effectBuffer[i]->getState() != openalpp::Playing) { ReleaseEffectBuffer(i); *************** *** 451,456 **** wxASSERT(effectBuffer[bufferIdx].valid()); ! effectBuffer[bufferIdx]->setPlay(false); ! if (effectBuffer[bufferIdx]->getSource()) effectBuffer[bufferIdx]->releaseSource(); available.push_back((size_t)bufferIdx); } --- 378,382 ---- wxASSERT(effectBuffer[bufferIdx].valid()); ! effectBuffer[bufferIdx]->stop(); /// previous Sample remains in buffer until reset available.push_back((size_t)bufferIdx); } *************** *** 464,468 **** ReleaseStoppedBuffers(); ! std::map<std::string, openalpp::Sample*>::const_iterator mapIter; mapIter = effectMap.find(effectName); --- 390,394 ---- ReleaseStoppedBuffers(); ! std::map<std::string, openalpp::ref_ptr<openalpp::Sample> >::iterator mapIter; mapIter = effectMap.find(effectName); *************** *** 473,477 **** return; } ! openalpp::Sample* sample = mapIter->second; int nFreeBufferIdx = GetEffectBuffer(); // returns -1 if none available --- 399,403 ---- return; } ! openalpp::Sample* sample = mapIter->second.get(); int nFreeBufferIdx = GetEffectBuffer(); // returns -1 if none available *************** *** 481,491 **** } ! osgAL::SoundState* soundState = effectBuffer[nFreeBufferIdx].get(); ! soundState->setSample(sample); ! if (!soundState->getSource()) ! { ! soundState->allocateSource(10, false); ! } ! soundState->setPlay(true); } --- 407,414 ---- } ! openalpp::Source* source = effectBuffer[nFreeBufferIdx].get(); ! wxASSERT(source); ! source->setSound(sample); ! source->play(); } *************** *** 520,526 **** effectMap.clear(); ! oggStreamer->Release(); ! osgAL::SoundManager::instance()->shutdown(); mbInitialized = false; --- 443,449 ---- effectMap.clear(); ! if (oggStreamer) oggStreamer->Release(); ! //osgAL::SoundManager::instance()->shutdown(); mbInitialized = false; *************** *** 550,554 **** std::cout << "Creating OGG streamer" << std::endl; ! oggStreamer = new tcOggStreamer(); std::cout << "Success - Create OGG streamer" << std::endl; } --- 473,477 ---- std::cout << "Creating OGG streamer" << std::endl; ! oggStreamer = 0;//new tcOggStreamer(); std::cout << "Success - Create OGG streamer" << std::endl; } |
|
From: Dewitt C. <ddc...@us...> - 2005-02-21 18:26:46
|
Update of /cvsroot/gcblue/gcb_wx/include/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22705/include/common Modified Files: tcSound.h Log Message: Replaced osgAL with OpenAL++ exclusively due to instability issues. Index: tcSound.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/common/tcSound.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcSound.h 27 Jan 2005 01:01:43 -0000 1.18 --- tcSound.h 21 Feb 2005 18:25:54 -0000 1.19 *************** *** 1,6 **** ! /* ! ** tcSound.h ! ** ! ** Copyright (C) 2003 Dewitt Colclough (de...@tw...) ** All rights reserved. --- 1,6 ---- ! /** ! ** @file tcSound.h ! */ ! /* Copyright (C) 2003-2005 Dewitt Colclough (de...@tw...) ** All rights reserved. *************** *** 28,40 **** #endif ! #include <AL/al.h> ! #include <AL/alut.h> ! #include <AL/alc.h> ! #include "osgAL/SoundNode" ! #include "osgAL/SoundRoot" ! #include "osgAL/SoundManager" ! #include "osgAL/SoundState" #include <string> #include <map> --- 28,42 ---- #endif ! //#include <AL/al.h> ! //#include <AL/alut.h> ! //#include <AL/alc.h> ! #include <openalpp/alpp.h> ! //#include "osgAL/SoundNode" ! //#include "osgAL/SoundRoot" ! //#include "osgAL/SoundManager" ! //#include "osgAL/SoundState" + #include <queue> #include <string> #include <map> *************** *** 58,61 **** --- 60,65 ---- }; + + /** * Singleton class for sound *************** *** 66,72 **** static tcSound* Get(); - /// for 3D sound - osg::ref_ptr<osgAL::SoundNode> CreateSound(const std::string& file); - bool GetMusicPause() const; void PlayEffect(int anEffect); --- 70,73 ---- *************** *** 88,92 **** --- 89,96 ---- void UnInit(); + #if 0 // 3D sound methods + osg::ref_ptr<osgAL::SoundNode> CreateSound(const std::string& file); + osgAL::SoundRoot* GetSoundRoot(); void InitOsgAL(); *************** *** 95,98 **** --- 99,103 ---- /// Set the transformation matrix for the listener void SetListenerMatrix(const osg::Matrix& matrix); + #endif private: *************** *** 101,108 **** ~tcSound(); ! std::map<std::string, openalpp::Sample*> effectMap; ! /// buffer of SoundState's to use for non-directional sound effects ! std::vector<osg::ref_ptr<osgAL::SoundState> > effectBuffer; /// fifo of indices of available effectSounds --- 106,113 ---- ~tcSound(); ! std::map<std::string, openalpp::ref_ptr<openalpp::Sample> > effectMap; ! /// buffer of openalpp::Source to use for non-directional sound effects ! std::vector<openalpp::ref_ptr<openalpp::Source> > effectBuffer; /// fifo of indices of available effectSounds *************** *** 111,116 **** tcOggStreamer *oggStreamer; ///< class for streaming Ogg music - - bool mbInitialized; int mnCurrentTrack; --- 116,119 ---- *************** *** 120,128 **** long mnEffectVolume; ! ! osg::ref_ptr<osgAL::SoundRoot> soundRoot; ///< for 3D sound with osgAL ! int GetEffectBuffer(); void ReleaseEffectBuffer(int bufferIdx); void ReleaseStoppedBuffers(); --- 123,131 ---- long mnEffectVolume; ! // osg::ref_ptr<osgAL::SoundRoot> soundRoot; ///< for 3D sound with osgAL int GetEffectBuffer(); + void InitOpenAL(); + openalpp::Sample* LoadSample(const std::string& file); void ReleaseEffectBuffer(int bufferIdx); void ReleaseStoppedBuffers(); |
|
From: Dewitt C. <ddc...@us...> - 2005-02-21 18:26:45
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22705/include/graphics Modified Files: tc3DModel.h Log Message: Replaced osgAL with OpenAL++ exclusively due to instability issues. Index: tc3DModel.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DModel.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tc3DModel.h 31 Jan 2005 01:32:36 -0000 1.13 --- tc3DModel.h 21 Feb 2005 18:26:04 -0000 1.14 *************** *** 41,48 **** } ! namespace osgAL ! { ! class SoundNode; ! } /** --- 41,48 ---- } ! //namespace osgAL ! //{ ! // class SoundNode; ! //} /** *************** *** 144,148 **** // osgAL sound node for 3D sound ! osg::ref_ptr<osgAL::SoundNode> soundNode; static osg::ref_ptr<osg::Group> world; --- 144,148 ---- // osgAL sound node for 3D sound ! //osg::ref_ptr<osgAL::SoundNode> soundNode; static osg::ref_ptr<osg::Group> world; |
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 21:55:15
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469/src/sim Modified Files: Game.cpp gcb.cpp tcMapData.cpp Removed Files: tcCustomControl.cpp tcEditControl.cpp Log Message: Final GDI+ removal Index: Game.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/Game.cpp,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** Game.cpp 16 Feb 2005 23:13:49 -0000 1.120 --- Game.cpp 20 Feb 2005 21:54:34 -0000 1.121 *************** *** 37,41 **** #include "wx/datetime.h" - #include "tcCustomControl.h" #include "commandlist.h" // for custom command queue handler #include "tcCommandQueue.h" --- 37,40 ---- *************** *** 157,161 **** infoConsole->Print(s); infoConsole->Draw(); - mpGraphicsEngine->RenderAll(); } --- 156,159 ---- *************** *** 467,472 **** --- 465,472 ---- /*** Init edit control ***/ + /* editControl = new tcEditControl(glCanvas, wxPoint(200,200), wxSize(100,50)); editControl->SetActive(false); + */ chatBox = new tcChatBox(glCanvas, wxPoint(200, 200), wxSize(300, 180), "ChatBox"); *************** *** 679,683 **** messageCenter = new tcMessageCenter(glCanvas, wxPoint(0,0), frameSize, "MessageCenter"); ! messageCenter->SetBaseRenderBin(30); tcMessageInterface::SetMessageCenter(messageCenter); --- 679,683 ---- messageCenter = new tcMessageCenter(glCanvas, wxPoint(0,0), frameSize, "MessageCenter"); ! messageCenter->SetBaseRenderBin(40); tcMessageInterface::SetMessageCenter(messageCenter); *************** *** 705,709 **** wxSize(mnBriefingWidth, leftConsoleHeight), "xml/briefing_left.xml") ; ! briefingConsoleLeft->SetBaseRenderBin(20); if (!briefingConsoleLeft) --- 705,709 ---- wxSize(mnBriefingWidth, leftConsoleHeight), "xml/briefing_left.xml") ; ! briefingConsoleLeft->SetBaseRenderBin(30); if (!briefingConsoleLeft) *************** *** 852,856 **** wxSize(mrectWorldMap.right - mrectWorldMap.left - 1, mrectWorldMap.bottom - mrectWorldMap.top - 1)); ! worldMap->SetBaseRenderBin(20); if (!worldMap) --- 852,856 ---- wxSize(mrectWorldMap.right - mrectWorldMap.left - 1, mrectWorldMap.bottom - mrectWorldMap.top - 1)); ! worldMap->SetBaseRenderBin(25); if (!worldMap) *************** *** 881,885 **** wxPoint(mrectLowerLeft.left, mrectLowerLeft.top), wxSize(200,200), "xml/info_console.xml", "InfoConsole"); ! infoConsole->SetBaseRenderBin(20); infoConsole->LoadBackgroundImage("start_background.jpg"); messageConsole = infoConsole; --- 881,885 ---- wxPoint(mrectLowerLeft.left, mrectLowerLeft.top), wxSize(200,200), "xml/info_console.xml", "InfoConsole"); ! infoConsole->SetBaseRenderBin(30); infoConsole->LoadBackgroundImage("start_background.jpg"); messageConsole = infoConsole; *************** *** 901,905 **** hookInfo = new tcHookInfo(glCanvas, wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), wxSize(200,200)); ! hookInfo->SetBaseRenderBin(20); if (!hookInfo) { --- 901,905 ---- hookInfo = new tcHookInfo(glCanvas, wxPoint(mrectLowerLeft.right,mrectLowerLeft.top), wxSize(200,200)); ! hookInfo->SetBaseRenderBin(30); if (!hookInfo) { *************** *** 925,929 **** objectControl->LoadBackgroundImage("console_b.jpg"); ! objectControl->AttachUserInfo(&mcUserInfo); --- 925,929 ---- objectControl->LoadBackgroundImage("console_b.jpg"); ! objectControl->SetBaseRenderBin(30); objectControl->AttachUserInfo(&mcUserInfo); *************** *** 951,955 **** popupControl = new tcPopupControl(glCanvas, wxPoint(1400, 400), wxSize(400, 400)); ! popupControl->SetBaseRenderBin(30); if (!popupControl) { --- 951,955 ---- popupControl = new tcPopupControl(glCanvas, wxPoint(1400, 400), wxSize(400, 400)); ! popupControl->SetBaseRenderBin(40); if (!popupControl) { *************** *** 993,998 **** #endif - tcCustomControl::AttachCommandInterface(commandQueue); - tcCustomControl::InitGdi(); --- 993,996 ---- *************** *** 1033,1037 **** briefingConsoleLeft->Clear(); - tcCustomControl::ReleaseGdi(); } --- 1031,1034 ---- *************** *** 1431,1435 **** viewer->Update(gameDateZulu); ! //mpGraphicsEngine->RenderAll(); viewer->Frame(); --- 1428,1432 ---- viewer->Update(gameDateZulu); ! viewer->Frame(); *************** *** 1778,1783 **** if ((directorTime > 0.1f) && doRender) { - if (enableGraphicsEngine) mpGraphicsEngine->RenderAll(); - viewer->Frame(); } --- 1775,1778 ---- *************** *** 1816,1829 **** bool tcGame::Finish() { - // mpGraphicsEngine->DeleteAllSurfaces(); - /* - if (mpGraphicsEngine != NULL) - { - delete mpGraphicsEngine; - } - */ - tcSound::Get()->UnInit(); - tcCustomControl::ReleaseGdi(); if (director) delete director; --- 1811,1815 ---- *************** *** 2456,2460 **** tacticalMap = NULL; worldMap = NULL; - editControl = NULL; optionsView = NULL; hookInfo = NULL; --- 2442,2445 ---- Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tcMapData.cpp 2 Nov 2004 04:23:57 -0000 1.14 --- tcMapData.cpp 20 Feb 2005 21:54:35 -0000 1.15 *************** *** 1138,1142 **** if (apData == NULL) {return;} - // create map image using map data --- 1138,1141 ---- *************** *** 1170,1174 **** } apData[(M-1-m)*N + n] = pval + nAlphaOffset; - //apWindow->SetPixel(n,M-1-m,pval + nAlphaOffset); } } --- 1169,1172 ---- Index: gcb.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/gcb.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** gcb.cpp 28 Dec 2004 23:51:25 -0000 1.17 --- gcb.cpp 20 Feb 2005 21:54:35 -0000 1.18 *************** *** 35,39 **** #include "tcDisplayModes.h" - using namespace Gdiplus; IMPLEMENT_APP(GcbApp) --- 35,38 ---- *************** *** 172,176 **** { SetWorkingDirectory(); - InitializeGdiPlus(); // Reassign stderr and stdout --- 171,174 ---- *************** *** 214,219 **** WTL("FCLOSE"); // special string to close file - GdiplusShutdown(mgdiplusToken); - return wxApp::OnExit(); } --- 212,215 ---- *************** *** 252,264 **** } - /** - * Initializes GDI+. - */ - void GcbApp::InitializeGdiPlus() - { - GdiplusStartupInput gdiplusStartupInput; - - GdiplusStartup(&mgdiplusToken, &gdiplusStartupInput, NULL); - } /** --- 248,251 ---- *************** *** 267,279 **** void GcbApp::InitializeGameFrame() { - /* - if (gameFrame == NULL) - { - wxMessageBox("Failed to create the game frame."); - WTL("Failed to create the game frame."); - - throw exception(); - } - */ try { --- 254,257 ---- --- tcEditControl.cpp DELETED --- --- tcCustomControl.cpp DELETED --- |
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18469/src/graphics Modified Files: tc3DWindow.cpp tcGraphicsEngine.cpp tcMapView.cpp tcTerrainView.cpp Removed Files: extgl.c tc2DGraphicsSurface.cpp tcWindow.cpp Log Message: Final GDI+ removal --- tcWindow.cpp DELETED --- Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcMapView.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tcMapView.cpp 27 Jan 2005 01:01:49 -0000 1.15 --- tcMapView.cpp 20 Feb 2005 21:54:33 -0000 1.16 *************** *** 303,307 **** } ! /***********************************************************************************/ void tcMapView::SetActive(bool abActive) { --- 303,309 ---- } ! /** ! * ! */ void tcMapView::SetActive(bool abActive) { *************** *** 309,320 **** terrainView->SetActive(abActive); } - /***********************************************************************************/ - /* - void tcMapView::SetWindow(RECT& r) { - tcWindow::SetWindow(r); // call base class to set tcMapView's window - terrainView->SetWindow(r); - } - */ --- 311,320 ---- terrainView->SetActive(abActive); } + void tcMapView::SetBaseRenderBin(int n) + { + tc3DWindow::SetBaseRenderBin(n); + terrainView->SetBaseRenderBin(n - 10); + } *************** *** 620,623 **** --- 620,624 ---- terrainView->SetView(mrectCurrentView); + terrainView->Draw(); tcMapObject::SetMapView(this); *************** *** 681,685 **** vp.mnSurfaceWidth,vp.mnSurfaceHeight, vp.mrectGeo.left,vp.mrectGeo.right,vp.mrectGeo.bottom,vp.mrectGeo.top, ! vp.mrectDisplay.X, vp.mrectDisplay.Y, vp.mrectDisplay.Width, vp.mrectDisplay.Height); DrawTextR(sText.GetBuffer(), leftMargin + 50.0, 80.0, defaultFont.get(), color, 16.0, LEFT_BASE_LINE); --- 682,687 ---- vp.mnSurfaceWidth,vp.mnSurfaceHeight, vp.mrectGeo.left,vp.mrectGeo.right,vp.mrectGeo.bottom,vp.mrectGeo.top, ! vp.mrectDisplay.left, vp.mrectDisplay.bottom, ! vp.mrectDisplay.Width(), vp.mrectDisplay.Height()); DrawTextR(sText.GetBuffer(), leftMargin + 50.0, 80.0, defaultFont.get(), color, 16.0, LEFT_BASE_LINE); *************** *** 2438,2442 **** // done here to avoid artifacts from terrainview being out of sync with mapview terrainView->SetView(mrectCurrentView); ! if (mnWidth == iconSize) --- 2440,2445 ---- // done here to avoid artifacts from terrainview being out of sync with mapview terrainView->SetView(mrectCurrentView); ! ! terrainView->Draw(); if (mnWidth == iconSize) Index: tcTerrainView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcTerrainView.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tcTerrainView.cpp 2 Nov 2004 04:23:56 -0000 1.2 --- tcTerrainView.cpp 20 Feb 2005 21:54:33 -0000 1.3 *************** *** 30,36 **** #include "tcTerrainView.h" - #include "aerror.h" - #include "tcGraphicsEngine.h" #include "tcOptions.h" #ifdef _DEBUG --- 30,35 ---- #include "tcTerrainView.h" #include "tcOptions.h" + #include <osg/Texture2D> #ifdef _DEBUG *************** *** 38,45 **** #endif - using namespace Gdiplus; namespace MapView { void tcTerrainView::GetViewParameters(tsTerrainViewParameters& vp) --- 37,52 ---- #endif namespace MapView { + void tcTerrainView::Draw() + { + if (!redraw) return; + DrawZoomedImage(mapImage.get(), 0, 0, (float)mnWidth, (float)mnHeight, + displayRegion, ALIGN_BOTTOM_LEFT); + + FinishDraw(); + redraw = false; + } void tcTerrainView::GetViewParameters(tsTerrainViewParameters& vp) *************** *** 51,92 **** } ! /** ! * If the terrain view is minimized always force ! * abActive to false ! */ ! void tcTerrainView::SetActive(bool abActive) ! { ! if (IsWindowMinimized()) ! { ! tcWindow::SetActive(false); ! } ! tcWindow::SetActive(abActive); ! } /** ! * update display region of mp2DSurface */ ! void tcTerrainView::SetView(tcGeoRect r) { ! RectF rdisp; ! float fSurfaceWidth, fSurfaceHeight; // surface coordinate dimensions ! if (mrectCurrentView == r) return; mrectCurrentView = r; ! if (mp2DSurface == NULL) {return;} ! fSurfaceWidth = (float)mp2DSurface->mnWidth; ! fSurfaceHeight = (float)mp2DSurface->mnHeight; ! // assumes longitude is within [-pi,pi) and lat within [-pi/2,pi/2] ! rdisp.X = (fSurfaceWidth)*(r.left - mrectMap.left)/mrectMap.Width(); ! rdisp.Width = ((fSurfaceWidth)*(r.right - mrectMap.left)/mrectMap.Width()) - rdisp.X; ! rdisp.Y = (fSurfaceHeight)*(r.bottom - mrectMap.bottom)/mrectMap.Height(); ! rdisp.Height = (fSurfaceHeight)*(r.top - mrectMap.bottom)/mrectMap.Height() - rdisp.Y; ! SetDisplayRegion(rdisp); /* ! fprintf(stdout, "setting terrain to view L:%f R:%f T:%f B:%f\n", r.left, r.right, r.top, r.bottom); ! fprintf(stdout, " terrain window L:%d R:%d T:%d B:%d\n", ! mrectWindow.left, mrectWindow.right, mrectWindow.top, mrectWindow.bottom); */ ! //mp2DSurface->SetDisplayRegion(rdisp.x1,rdisp.y1,rdisp.x2,rdisp.y2); } --- 58,106 ---- } ! /** ! * If the terrain view is minimized always force ! * abActive to false ! */ ! void tcTerrainView::SetActive(bool abActive) ! { ! if (IsWindowMinimized()) ! { ! tc3DWindow::SetActive(false); ! } ! tc3DWindow::SetActive(abActive); ! } /** ! * */ ! void tcTerrainView::SetDisplayRegion(tcRect& r) { ! displayRegion = r; ! } ! /** ! * Sets new view, updating display region of map quad ! */ ! void tcTerrainView::SetView(tcGeoRect r) ! { ! if (mrectCurrentView == r) return; // no change, so return mrectCurrentView = r; ! /* ! float surfaceWidth, surfaceHeight; // surface coordinate dimensions ! osg::Image* image = mapImage->getImage(); ! wxASSERT(image); ! ! surfaceWidth = (float)image->s(); ! surfaceHeight = (float)image->t(); */ ! ! // assumes longitude is within [-pi,pi) and lat within [-pi/2,pi/2] ! displayRegion.left = (r.left - mrectMap.left)/mrectMap.Width(); ! displayRegion.right = (r.right - mrectMap.left)/mrectMap.Width(); ! displayRegion.bottom = (r.bottom - mrectMap.bottom)/mrectMap.Height(); ! displayRegion.top = (r.top - mrectMap.bottom)/mrectMap.Height(); ! ! redraw = true; } *************** *** 100,122 **** /*** Refresh low resolution map surface ***/ ! mnWidth = sMDI.mnLowResWidth; //mrectWindow.right - mrectWindow.left; // assumes SetWindow called first ! mnHeight = sMDI.mnLowResHeight; //mrectWindow.bottom - mrectWindow.top; ! if (yMirror) ! { ! mp2DSurface->SetWindow(mrectWindow.left, yMirror - mrectWindow.bottom, ! mrectWindow.right, yMirror - mrectWindow.top); ! } ! else { ! mp2DSurface->SetWindow(mrectWindow.left, mrectWindow.top, ! mrectWindow.right, mrectWindow.bottom); } mpMapData->GetWorldArea(mrectMap); - if (mp2DSurface->Init(sMDI.mnLowResWidth, sMDI.mnLowResHeight) != true) {return false;} - mp2DSurface->SetDisplayRegion(0,0,(float)sMDI.mnLowResWidth,(float)sMDI.mnLowResHeight); ! UINT32 *pBits; ! mp2DSurface->GetBits(pBits); wxASSERT(pBits != NULL); --- 114,133 ---- /*** Refresh low resolution map surface ***/ ! int width = sMDI.mnLowResWidth; ! int height = sMDI.mnLowResHeight; ! ! osg::Image* image = mapImage->getImage(); ! if (!image) { ! image = new osg::Image(); ! mapImage->setImage(image); } + image->allocateImage(width, height, 1, GL_RGBA, GL_BYTE, 1); + mpMapData->GetWorldArea(mrectMap); ! unsigned int* pBits = (unsigned int*) image->data(); ! wxASSERT(pBits != NULL); *************** *** 124,137 **** { mpMapData->CreateMapImage(mpOptions->mnMapMode, 0, pBits); - mp2DSurface->mbModified = true; } else { ! WTL("tcTerrainView::LoadLowResSurface - called without attached options, using default"); mpMapData->CreateMapImage(1, 0, pBits); } ! mp2DSurface->SetRenderTexture(true); ! mp2DSurface->mbModified = true; return true; --- 135,147 ---- { mpMapData->CreateMapImage(mpOptions->mnMapMode, 0, pBits); } else { ! fprintf(stderr, "tcTerrainView::LoadLowResSurface - " ! "called without attached options, using default\n"); mpMapData->CreateMapImage(1, 0, pBits); } ! redraw = true; return true; *************** *** 154,192 **** mpMapData->GetMapDataInfo(&sMDI); // get size of map data arrays ! /*** Update high resolution map surface ***/ ! if (yMirror) ! { ! mp2DSurface->SetWindow(mrectWindow.left, yMirror - mrectWindow.bottom, ! mrectWindow.right, yMirror - mrectWindow.top); ! } ! else { ! mp2DSurface->SetWindow(mrectWindow.left, mrectWindow.top, ! mrectWindow.right, mrectWindow.bottom); } mpMapData->GetTheaterArea(mrectMap); ! if (mp2DSurface->Init(sMDI.mnHighResWidth,sMDI.mnHighResHeight) != true) {return false;} ! mp2DSurface->SetDisplayRegion(0,0,(float)sMDI.mnHighResWidth,(float)sMDI.mnHighResHeight); ! UINT32 *pBits; ! mp2DSurface->GetBits(pBits); ! wxASSERT(pBits != NULL); ! //mpMapData->CreateHighResMapImage(mpOptions->mnMapMode, pBits); ! mpMapData->CreateMapImage(mpOptions->mnMapMode, 1, pBits); // 1 for high res ! mp2DSurface->mbModified = true; ! mp2DSurface->SetRenderTexture(mbTextureMaps); return true; } ! /** ! * call tcWindow::SetActive(false) on Minimize() ! */ ! void tcTerrainView::Minimize() ! { ! tcWindow::SetActive(false); ! tcWindow::Minimize(); ! } int tcTerrainView::RefreshSurfaces() --- 164,201 ---- mpMapData->GetMapDataInfo(&sMDI); // get size of map data arrays ! int width = sMDI.mnHighResWidth; ! int height = sMDI.mnHighResHeight; ! ! osg::Image* image = mapImage->getImage(); ! if (!image) { ! image = new osg::Image(); ! mapImage->setImage(image); } + image->allocateImage(width, height, 1, GL_RGBA, GL_BYTE, 1); + mpMapData->GetTheaterArea(mrectMap); ! ! unsigned int* pBits = (unsigned int*) image->data(); ! ! wxASSERT(pBits); ! ! mpMapData->CreateMapImage(mpOptions->mnMapMode, 1, pBits); // 1 for high res ! ! redraw = true; return true; } ! /** ! * call tcWindow::SetActive(false) on Minimize() ! */ ! void tcTerrainView::Minimize() ! { ! tc3DWindow::SetActive(false); ! tc3DWindow::Minimize(); ! } int tcTerrainView::RefreshSurfaces() *************** *** 197,201 **** return false; } ! if (mbHighRes) { return LoadHighResSurface(); --- 206,210 ---- return false; } ! if (highRes) { return LoadHighResSurface(); *************** *** 209,215 **** /** ! * overridden to create surface larger than window */ ! int tcTerrainView::CreateSurfaces(tcGraphicsEngine* apGraphicsEngine) { if (mpMapData == NULL) --- 218,224 ---- /** ! * */ ! int tcTerrainView::CreateSurfaces() { if (mpMapData == NULL) *************** *** 218,224 **** return false; } - if (apGraphicsEngine->Create2DSurface(mp2DSurface) == false) {return false;} ! if (mbHighRes) { return LoadHighResSurface(); --- 227,232 ---- return false; } ! if (highRes) { return LoadHighResSurface(); *************** *** 230,247 **** } ! ////////////////////////////////////////////////////////////////////// ! // Construction/Destruction ! ////////////////////////////////////////////////////////////////////// tcTerrainView::tcTerrainView(wxWindow *parent, const wxPoint& pos, const wxSize& size, ! bool isHighRes, ! const wxString& name) : ! mbHighRes(isHighRes), ! tcWindow(parent, pos, size, name) { mpMapData = NULL; ! mpOptions = NULL; SetResizeable2D(false); // do not resize 2D surface on resize } --- 238,258 ---- } ! tcTerrainView::tcTerrainView(wxWindow *parent, const wxPoint& pos, const wxSize& size, ! bool isHighRes, const wxString& name) ! : ! tc3DWindow(parent, pos, size, name, 0), ! highRes(isHighRes), ! displayRegion(0, 1, 0, 1), ! redraw(true) { mpMapData = NULL; ! mpOptions = tcOptions::Get(); SetResizeable2D(false); // do not resize 2D surface on resize + mapImage = new osg::Texture2D(); + + SetBlend(false); } Index: tcGraphicsEngine.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcGraphicsEngine.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcGraphicsEngine.cpp 1 Nov 2004 03:17:18 -0000 1.20 --- tcGraphicsEngine.cpp 20 Feb 2005 21:54:33 -0000 1.21 *************** *** 55,151 **** using std::cout; - bool tcGraphicsEngine::Create2DSurface(tc2DGraphicsSurface*& rp2DSurface) - { - if (mn2D >= MAX_2D_SURFACES) - { - wxMessageBox("tcGraphicsEngine - Max 2D surfaces exceeded"); - return false; - } - rp2DSurface = new tc2DGraphicsSurface; - if (rp2DSurface == NULL) - { - wxMessageBox("tcGraphicsEngine - Failed to allocated 2D surface memory"); - return false; - } - rp2DSurface->mnID = mn2D; - ma2D[mn2D++] = rp2DSurface; - return true; - } - - /** - * - */ - void tcGraphicsEngine::DeleteAllSurfaces() - { - unsigned int n; - - for(n=0;n<mn2D;n++) - { - if (ma2D[n] != NULL) - { - delete ma2D[n]; - ma2D[n] = NULL; - } - } - mn2D = 0; - } - - /** - * Moves surface to last in the drawing order so that surface - * is drawn on top of other surfaces. - * @return false if surface not found - */ - bool tcGraphicsEngine::MoveSurfaceToTop(tc2DGraphicsSurface* ap2DSurface) - { - unsigned n, nRaise; - bool bFound; - bFound = false; - for(n=0;(n<mn2D)&&(!bFound);n++) - { - if (ma2D[n] == ap2DSurface) - { - nRaise = n; - bFound = true; - } - } - if (!bFound) {return false;} - - tc2DGraphicsSurface *temp = ma2D[nRaise]; - - // move higher surfaces down one position - for(n=nRaise;n<mn2D-1;n++) - { - ma2D[n] = ma2D[n+1]; - } - ma2D[mn2D-1] = temp; // move to last (top) position - - return true; - } - - bool tcGraphicsEngine::Delete2DSurface(tc2DGraphicsSurface* ap2DSurface) - { - unsigned n, nDelete; - bool bFound; - - bFound = false; - for(n=0;(n<mn2D)&&(!bFound);n++) - { - if (ma2D[n] == ap2DSurface) - { - nDelete = n; - bFound = true; - } - } - if (!bFound) {return false;} - delete ma2D[nDelete]; - ma2D[nDelete] = NULL; - mn2D--; - for(n=nDelete;n<mn2D;n++) - { - ma2D[n] = ma2D[n+1]; - } - return true; - } tcGraphicsEngine* tcGraphicsEngine::Get() --- 55,59 ---- *************** *** 187,211 **** - // creates pixel maps for - bool tcGraphicsEngine::CreatePixelMaps() - { - const int nMapSize = 1024; - GLfloat afMap[nMapSize]; - - for(int n=0;n<nMapSize;n++) - { - afMap[n] = (float)n/(float)nMapSize; - } - glPixelMapfv(GL_PIXEL_MAP_I_TO_R,nMapSize,afMap); - glPixelMapfv(GL_PIXEL_MAP_I_TO_G,nMapSize,afMap); - glPixelMapfv(GL_PIXEL_MAP_I_TO_B,nMapSize,afMap); - - for(int n=0;n<nMapSize;n++) - { - afMap[n] = 1.0f; - } - glPixelMapfv(GL_PIXEL_MAP_I_TO_A,nMapSize,afMap); - return true; - } /** --- 95,98 ---- *************** *** 289,748 **** - /** - * loads a bmp image - */ - AUX_RGBImageRec* tcGraphicsEngine::LoadBmp(char *szFileName) - { - tcFile file; - - if (szFileName==NULL) {return NULL;} - if (file.Open(szFileName,tcFile::modeRead)) // check if file exists - { - file.Close(); - } - else - { - return NULL; - } - return auxDIBImageLoad(szFileName); // load the bmp and return ptr to bmp - } - - void tcGraphicsEngine::GetInfo(tsGraphicsEngineInfo& asGI) - { - asGI.mbTexture = mbTexture; - asGI.mbWireFrame = mbWireFrame; - } - - - - void tcGraphicsEngine::ConfigureFor2D() - { - if (meGraphicsMode == MODE_2D) {return;} - - // see Google groups: "Re: OpenGL PixelDraw slow??" Allen Akin, 1995/07/14 - glDisable(GL_ALPHA_TEST); - glDisable(GL_DEPTH_TEST); - glDisable(GL_DITHER); - glDisable(GL_FOG); - glDisable(GL_LIGHTING); - glDisable(GL_LOGIC_OP); - glDisable(GL_STENCIL_TEST); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); - glPixelTransferi(GL_MAP_COLOR, GL_FALSE); - glPixelTransferi(GL_RED_SCALE, 1); - glPixelTransferi(GL_RED_BIAS, 0); - glPixelTransferi(GL_GREEN_SCALE, 1); - glPixelTransferi(GL_GREEN_BIAS, 0); - glPixelTransferi(GL_BLUE_SCALE, 1); - glPixelTransferi(GL_BLUE_BIAS, 0); - glPixelTransferi(GL_ALPHA_SCALE, 1); - glPixelTransferi(GL_ALPHA_BIAS, 0); - - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background - glEnable(GL_SCISSOR_TEST); - - if (mbBlend) - { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - else - { - glDisable(GL_BLEND); // Turn Blending Off - } - meGraphicsMode = MODE_2D; - } - - - void tcGraphicsEngine::ConfigureForTexture2D() - { - if (meGraphicsMode == MODE_TEXTURE2D) {return;} - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glLoadIdentity(); // Reset The Projection Matrix - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glLoadIdentity(); - - glClearColor(0.00f, 0.00f, 0.00f, 0.0f); // Black Background - glDisable(GL_DEPTH_TEST); - glDisable(GL_ALPHA_TEST); - glDisable(GL_DITHER); - glEnable(GL_SCISSOR_TEST); - - // glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations - glEnable(GL_TEXTURE_2D); // Enable texture mapping - glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - - glDisable(GL_LIGHTING); - if (mbBlend) - { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - else - { - glDisable(GL_BLEND); - } - - meGraphicsMode = MODE_TEXTURE2D; - - CheckGLError("ConfigureForTexture2D - end"); - } - - - #if 0 - void tcGraphicsEngine::RenderBorder(ts3dGraphicsData *apGD) - { - if (apGD == NULL) {return;} - - int nWidth = apGD->r.right - apGD->r.left; - int nHeight = apGD->r.bottom-apGD->r.top; - - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glLoadIdentity(); // Reset The Projection Matrix - gluOrtho2D((GLint)0, (GLint)nWidth, - (GLint)0, (GLint)nHeight); // Set the current viewport - - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glLoadIdentity(); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); - - glColor4f(1.0f,1.0f,1.0f,1.0f); - - glBegin(GL_QUADS); - glVertex2i(0,0); - glVertex2i(nWidth,0); - glVertex2i(nWidth,nHeight); - glVertex2i(0,nHeight); - glEnd(); - - - if (!mbWireFrame) - { - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } - if (mbLight) - { - glEnable(GL_LIGHTING); - } - glEnable(GL_DEPTH_TEST); - } - #endif - - - /** - * glDrawPixels rendering of 2D surface - */ - void tcGraphicsEngine::Render2D(unsigned anSurface) - { - tsGraphicsParameters gp; - int nViewWidth,nViewHeight; - static float fz = 0; - - if (anSurface >= mn2D) {return;} - if (ma2D[anSurface] == NULL) {return;} - ma2D[anSurface]->GetParameters(gp); // retrieve window info and pixel pointer - if (gp.mbActive == false) {return;} // return without drawing if mbActive is false - nViewWidth = gp.rviewport.right-gp.rviewport.left; - nViewHeight = gp.rviewport.bottom-gp.rviewport.top; - - ConfigureFor2D(); - if (gp.mbBlend) - { - glEnable(GL_BLEND); - } - else - { - glDisable(GL_BLEND); - } - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluOrtho2D (0, (GLfloat)gp.mnSurfaceWidth, 0 , (GLfloat)gp.mnSurfaceHeight); - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glLoadIdentity(); - glScissor((GLint)gp.rviewport.left, (GLint)gp.rviewport.top, - (GLsizei)nViewWidth, (GLsizei)nViewHeight); // Set the current viewport - glViewport((GLint)gp.rviewport.left, (GLint)gp.rviewport.top, - (GLsizei)nViewWidth, (GLsizei)nViewHeight); // Set the current viewport - if (gp.mbClearViewport) { - glClear(GL_COLOR_BUFFER_BIT); - } - glRasterPos2i(0,0); - if (gp.mbZoomActive) { - float fX,fY,fZoomX,fZoomY; // lower left corner to render - // zooming subpixel causes problems, improve this later - if ((gp.rdisplay.x2 - gp.rdisplay.x1) <= 2.0f) { - gp.rdisplay.x2 = gp.rdisplay.x1 + 1.5f; - } - if ((gp.rdisplay.y2 - gp.rdisplay.y1) <= 2.0f) { - gp.rdisplay.y2 = gp.rdisplay.y1 + 1.5f; - } - fZoomX = ((GLfloat)nViewWidth)/(gp.rdisplay.x2 - gp.rdisplay.x1); - fZoomY = ((GLfloat)nViewHeight)/(gp.rdisplay.y2 - gp.rdisplay.y1); - if (gp.mbFlipUpDown) { - fX = -fZoomX*gp.rdisplay.x1; - fY = -fZoomY*(gp.rdisplay.y1-(GLfloat)nViewHeight); - } - else { - fX = -fZoomX*gp.rdisplay.x1; //*(GLfloat)gp.mnSurfaceWidth/(GLfloat)nViewWidth; - fY = -fZoomY*gp.rdisplay.y1; //*(GLfloat)gp.mnSurfaceHeight/(GLfloat)nViewHeight; - } - glBitmap (0, 0, 0, 0, fX, fY, NULL); // can't use glRasterPos for this - if (gp.mbFlipUpDown) { - glPixelZoom((GLfloat)fZoomX,(GLfloat)-fZoomY); - } - else { - glPixelZoom((GLfloat)fZoomX,(GLfloat)fZoomY); - } - } - else { - glPixelZoom((GLfloat)1.0,(GLfloat)1.0); - } - if (gp.ppixels != NULL) { - if (gp.mePixelFormat == RGBA) - { - // actually using BGRA which is supposed to be faster on windows - glDrawPixels(gp.mnSurfaceWidth,gp.mnSurfaceHeight, - GL_BGRA_EXT,GL_UNSIGNED_BYTE,gp.ppixels); - } - else if (gp.mePixelFormat == I16) { - glDrawPixels(gp.mnSurfaceWidth/2,gp.mnSurfaceHeight, - GL_BGRA_EXT,GL_UNSIGNED_BYTE,gp.ppixels); // error caused if read out of bounds!? - - } - - } - } - - /** - * texture mapped rendering of 2D surface - */ - void tcGraphicsEngine::RenderTexture2D(unsigned anSurface) - { - int m,n; - int nWidth,nHeight; - tsGraphicsParameters gp; - static int nCounter = 0; - - if ((unsigned)anSurface >= mn2D) {return;} - if (ma2D[anSurface] == NULL) {return;} - ma2D[anSurface]->GetParameters(gp); // retrieve window info and pixel pointer - if (gp.mbActive == false) {return;} // return without drawing if mbActive is false - nWidth = gp.rviewport.right-gp.rviewport.left; - nHeight = gp.rviewport.bottom-gp.rviewport.top; - - ConfigureForTexture2D(); - - glScissor((GLint)gp.rviewport.left, (GLint)gp.rviewport.top, - (GLsizei)nWidth, (GLsizei)nHeight); // Set the current viewport - glViewport((GLint)gp.rviewport.left, (GLint)gp.rviewport.top, - (GLsizei)nWidth, (GLsizei)nHeight); // Set the current viewport - - CheckGLError("RenderTexture2D - viewport"); - - //glClear(GL_COLOR_BUFFER_BIT); // glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - glMatrixMode(GL_PROJECTION); // Select The Projection Matrix - glLoadIdentity(); // Reset The Projection Matrix - - gluOrtho2D (gp.rdisplay.x1, gp.rdisplay.x2, - gp.rdisplay.y1, gp.rdisplay.y2); - - glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix - glLoadIdentity(); - - CheckGLError("RenderTexture2D - matrix"); - - float mfPaneX,mfPaneY,mfPaneZ; - float x1,y1,x2,y2,xstart,ystart; - int nTextureIdx; - mfPaneZ = 0; - mfPaneX = (float)(gp.pTextureData->mnTextureSize-gp.pTextureData->mnTextureOverlap); - mfPaneY = (float)(gp.pTextureData->mnTextureSize-gp.pTextureData->mnTextureOverlap); - xstart = 0.5f*(float)gp.pTextureData->mnTextureOverlap; - ystart = xstart; - //int nTexOverlap = gp.pTextureData->mnTextureOverlap; - // float doverlap = nTexOverLap - tcString s; - - if (!gp.pTextureData->mbLoaded) { - Load2DSurfaceTextures(anSurface); - } - else if (gp.mbModified) { - Load2DSurfaceTextures(anSurface); - ma2D[anSurface]->ClearModified(); - } - - float texa = xstart/mfPaneX; - float texb = 1.0f - texa; - - for(m=0;m<gp.pTextureData->mnRows;m++) { - y1 = ystart + (float)m*mfPaneY; - y2 = y1 + mfPaneY; - // textop = (m == 0) ? 1.0f : - for(n=0;n<gp.pTextureData->mnCols;n++) { - nTextureIdx = m*gp.pTextureData->mnCols + n; - x1 = xstart + (float)n*mfPaneX; - x2 = x1 + mfPaneX; - - glBindTexture(GL_TEXTURE_2D,gp.pTextureData->maTexture[nTextureIdx]); - glBegin(GL_QUADS); - /* - glTexCoord2f(0.00f, 0.00f); glVertex3f(x1, y1, 0); - glTexCoord2f(1.00f, 0.00f); glVertex3f(x2, y1, 0); - glTexCoord2f(1.00f, 1.00f); glVertex3f(x2, y2, 0); - glTexCoord2f(0.00f, 1.00f); glVertex3f(x1, y2, 0); - */ - glTexCoord2f(texa, texa); glVertex3f(x1, y1, 0); - glTexCoord2f(texb, texa); glVertex3f(x2, y1, 0); - glTexCoord2f(texb, texb); glVertex3f(x2, y2, 0); - glTexCoord2f(texa, texb); glVertex3f(x1, y2, 0); - - glEnd(); - - } - } - CheckGLError("RenderTexture2D - end"); - } - - /** - * update msTextureData structure of surface with surface bitmap data - * delete old textures if loaded - */ - void tcGraphicsEngine::Load2DSurfaceTextures(int anSurface) - { - tsGraphicsParameters gp; - int m,n; - int nWidth,nHeight; - tsBmp32 sBmp32; - UINT32 *aTextureData; - int nTextureSize, nTextureIdx; - - if ((unsigned)anSurface >= mn2D) {return;} - if (ma2D[anSurface] == NULL) {return;} - ma2D[anSurface]->GetParameters(gp); // retrieve window info and pixel pointer - nWidth = gp.mnSurfaceWidth; //gp.rviewport.right-gp.rviewport.left; - nHeight = gp.mnSurfaceHeight; //gp.rviewport.bottom-gp.rviewport.top; - - nTextureSize = gp.pTextureData->mnTextureSize; - sBmp32.mnWidth = nWidth; - sBmp32.mnHeight = nHeight; - sBmp32.mpPixels = (UINT32*)gp.ppixels; - int nTexSpacing = gp.pTextureData->mnTextureSize - - gp.pTextureData->mnTextureOverlap; - aTextureData = new UINT32[nTextureSize*nTextureSize]; - if (aTextureData == NULL) {return;} - - // delete old textures if they exist - if (gp.pTextureData->mbLoaded) { - glDeleteTextures(gp.pTextureData->mnTextures,gp.pTextureData->maTexture); - } - // generate new texture IDs - glGenTextures(gp.pTextureData->mnTextures,gp.pTextureData->maTexture); - // load texture data with glTextImage2D - for(m=0;m<gp.pTextureData->mnRows;m++) { - for(n=0;n<gp.pTextureData->mnCols;n++) { - nTextureIdx = m*gp.pTextureData->mnCols + n; - glBindTexture(GL_TEXTURE_2D, gp.pTextureData->maTexture[nTextureIdx]); - - ExtractTile(&aTextureData[0], sBmp32, nTextureSize, m*nTexSpacing, n*nTexSpacing); - - if (mbMipMapTextures) { - glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); - gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA8, nTextureSize, nTextureSize, - GL_RGBA, GL_UNSIGNED_BYTE, &aTextureData[0]); - } - else { - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, nTextureSize, nTextureSize, 0, - GL_RGBA, GL_UNSIGNED_BYTE, &aTextureData[0]); - } - - } - } - delete aTextureData; - gp.pTextureData->mbLoaded = true; - - } - - void tcGraphicsEngine::ExtractTile(UINT32 *apTile, tsBmp32 asBmp, - unsigned anTileSize, int anStartRow, int anStartCol) - { - int nWidth,nHeight; - int nRow,nCol,nStartRow,nStartCol; - UINT32 *pPixels; // assumed 32 bits per pixel bitmap format - if ((apTile==NULL)||(asBmp.mpPixels==NULL)) {return;} - - nWidth = asBmp.mnWidth; - nHeight = asBmp.mnHeight; - - - pPixels = (UINT32*)asBmp.mpPixels; - nStartRow = anStartRow; - nStartCol = anStartCol; - /* - for (nRow=nStartRow;(nRow<nStartRow+anTileSize)&&(nRow<(unsigned)nHeight);nRow++) { - memcpy(apTile+(nRow-nStartRow)*anTileSize,pPixels+(nRow*nWidth)+nStartCol, - sizeof(UINT32)*anTileSize); - // memcpy(apTile+(nRow-nStartRow)*anTileSize,pPixels,anTileSize); - } - */ - for (nRow=nStartRow;nRow<nStartRow+(int)anTileSize;nRow++) { - for (nCol=nStartCol;nCol<nStartCol+(int)anTileSize;nCol++) { - if ((nRow < nHeight)&&(nCol < nWidth)) { - *(apTile + (nRow-nStartRow)*anTileSize + nCol - nStartCol) = - *(pPixels + (nRow*nWidth) + nCol); - } - else { - *(apTile + (nRow-nStartRow)*anTileSize + nCol - nStartCol) = 0xFF000000; - } - } - } - } - - - - bool tcGraphicsEngine::RenderAll() - { - unsigned n; - static unsigned nCounter = 0; - - if (!mbInitialized) {return false;} - - - CheckGLError("pre render"); - - // save GL state so as not to interfere with OSG, may not need all of these flags - glPushAttrib(GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_FOG_BIT | GL_LIGHTING_BIT); - glPushMatrix(); - - meGraphicsMode = MODE_NONE; // clear mode to set state properly after OSG rendering - - // render 2d windows - for(n=0;n<mn2D;n++) - { - if (mbTexture2D&&(ma2D[n]->mbRenderTexture)) - { - RenderTexture2D(n); - } - else - { - Render2D(n); - } - } - - glPopMatrix(); - glPopAttrib(); - - CheckGLError("post render"); - - return true; - } --- 176,179 ---- *************** *** 824,850 **** } - ////////////////////////////////////////////////////////////////////// - // Construction/Destruction - ////////////////////////////////////////////////////////////////////// tcGraphicsEngine::tcGraphicsEngine() { - int n; - - for(n=0;n<MAX_2D_SURFACES;n++) - { - ma2D[n] = NULL; - } - - mn2D = 0; - mbInitialized = true; - mbBlend = true; - mbTexture = true; - mbTexture2D = true; - mbPerspective2D = false; - mbWireFrame = false; - mbMipMapTextures = true; - meGraphicsMode = MODE_NONE; LogGLInfo(); --- 255,262 ---- *************** *** 880,886 **** tcGraphicsEngine::~tcGraphicsEngine() { - /* will cause exception if called after Gdiplus is unintialized - if there are any surfaces remaining */ - DeleteAllSurfaces(); } --- 292,295 ---- --- tc2DGraphicsSurface.cpp DELETED --- --- extgl.c DELETED --- Index: tc3DWindow.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tc3DWindow.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tc3DWindow.cpp 21 Dec 2004 02:26:17 -0000 1.13 --- tc3DWindow.cpp 20 Feb 2005 21:54:33 -0000 1.14 *************** *** 859,862 **** --- 859,930 ---- } + /** + * This version draws a zoomed image on a quad, zoom rectangle specified by r + * @see tc3DWindow::DrawImage + */ + void tc3DWindow::DrawZoomedImage(osg::Texture2D* texture, float x, float y, float width, float height, + const tcRect& r, int alignMode) + { + wxASSERT(texture); + if (!texture) return; + + osg::Geometry* quad = GetImageQuadObject(); + wxASSERT(quad); + wxASSERT(texture); + + // set the texture coordinates using zoom rect, r + osg::Vec2Array* texcoords = dynamic_cast<osg::Vec2Array*>(quad->getTexCoordArray(0)); + wxASSERT(texcoords); + + float x1 = r.left; + float x2 = r.right; + float y1 = r.bottom; + float y2 = r.top; + + (*texcoords)[0].set(x1, y2); + (*texcoords)[1].set(x1, y1); + (*texcoords)[2].set(x2, y1); + (*texcoords)[3].set(x2, y2); + + + + if (osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(quad->getVertexArray())) + { + float left, right, top, bottom; + if (alignMode == CENTER) + { + const float half_width = 0.5f * width; + const float half_height = 0.5f * height; + left = x - half_width; + right = x + half_width; + top = y + half_height; + bottom = y - half_height; + } + else + { + left = x; + right = x + width; + top = y + height; + bottom = y; + } + + (*vertices)[0] = osg::Vec3(left, top, 0); + (*vertices)[1] = osg::Vec3(left, bottom, 0); + (*vertices)[2] = osg::Vec3(right, bottom, 0); + (*vertices)[3] = osg::Vec3(right, top, 0); + } + else + { + fprintf(stderr, "tc3DWindow::DrawZoomedImage - corrupt vertex array\n"); + wxASSERT(0); + } + + osg::StateSet* stateset = quad->getOrCreateStateSet(); + stateset->setTextureAttributeAndModes(0, texture, + osg::StateAttribute::ON); + } + + + /** *************** *** 873,876 **** --- 941,956 ---- } + /** + * This method is used for inverted y coordinate system used by wxWindows + * y = 0 is at top of screen. + */ + void tc3DWindow::DrawZoomedImageR(osg::Texture2D* texture, float x, float y, float width, float height, + const tcRect& r, int alignMode) + { + const float h = float(mnHeight); + + DrawZoomedImage(texture, x, h - y - height, width, height, r, alignMode); + } + /** *************** *** 1170,1177 **** * @return alpha blending state for window. */ ! bool tc3DWindow::GetBlend() { ! // return mp2DSurface->GetBlend(); ! return false; } --- 1250,1256 ---- * @return alpha blending state for window. */ ! bool tc3DWindow::GetBlend() const { ! return blendingOn; } *************** *** 1180,1186 **** * for window. */ ! void tc3DWindow::SetBlend(bool blendingOn) { ! // mp2DSurface->SetBlend(blendingOn); } --- 1259,1291 ---- * for window. */ ! void tc3DWindow::SetBlend(bool blend) { ! blendingOn = blend; ! ! ! osg::StateAttribute::GLModeValue value; ! if (blendingOn) ! { ! value = osg::StateAttribute::ON; ! } ! else ! { ! value = osg::StateAttribute::OFF; ! } ! ! osg::StateSet* stateSet = root->getOrCreateStateSet(); ! stateSet->setMode(GL_BLEND, value); ! ! osg::StateSet* groupStateSet = groupRoot->getOrCreateStateSet(); ! groupStateSet->setMode(GL_BLEND, value); ! ! osg::StateSet* textStateSet = textRoot->getOrCreateStateSet(); ! textStateSet->setMode(GL_BLEND, value); ! ! osg::StateSet* backgroundStateSet = backgroundRoot->getOrCreateStateSet(); ! backgroundStateSet->setMode(GL_BLEND, value); ! ! osg::StateSet* lineStateSet = lineRoot->getOrCreateStateSet(); ! lineStateSet->setMode(GL_BLEND, value); } *************** *** 1448,1452 **** ! #ifdef _DEBUG if (osg::StateSet* stateSet = textRoot->getStateSet()) { --- 1553,1557 ---- ! #if 0 if (osg::StateSet* stateSet = textRoot->getStateSet()) { *************** *** 1783,1787 **** fontSizeLarge(18.0), fontSizeSmall(9.0), ! hostParent(graphicsHost) { --- 1888,1893 ---- fontSizeLarge(18.0), fontSizeSmall(9.0), ! hostParent(graphicsHost), ! blendingOn(true) { |