You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(153) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(48) |
Feb
(46) |
Mar
(12) |
Apr
(4) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
(263) |
Mar
(235) |
Apr
(66) |
May
(42) |
Jun
(270) |
Jul
(65) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Markus R. <rol...@us...> - 2007-02-18 08:52:48
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15088 Modified Files: Tag: WIN32 propertyframe.cpp propertyframe.h Log Message: - use a CachedPath to the referenced node so the reference can be reconstructed after a simulation is reloaded Index: propertyframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/propertyframe.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** propertyframe.h 15 Feb 2007 10:57:28 -0000 1.2.2.1 --- propertyframe.h 18 Feb 2007 08:52:44 -0000 1.2.2.2 *************** *** 32,35 **** --- 32,36 ---- #include <boost/weak_ptr.hpp> + #include <zeitgeist/leaf.h> #include "propertylist.h" *************** *** 46,53 **** --- 47,59 ---- propertyframe(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE); + /** set the managed leaf */ void SetLeaf(boost::weak_ptr<zeitgeist::Leaf> leaf); + /** refresh the displayed properties of the managed leaf */ void RefreshProperties(); + /** update the cached reference to the managed leaf */ + void UpdateCached(); + private: // begin wxGlade: propertyframe::methods *************** *** 61,65 **** // end wxGlade ! boost::weak_ptr<zeitgeist::Leaf> mLeaf; PropertyList mPropList; }; // wxGlade: end class --- 67,72 ---- // end wxGlade ! zeitgeist::Leaf::CachedPath<zeitgeist::Leaf> mPath; ! PropertyList mPropList; }; // wxGlade: end class Index: propertyframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/propertyframe.cpp,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** propertyframe.cpp 15 Feb 2007 10:57:27 -0000 1.2.2.1 --- propertyframe.cpp 18 Feb 2007 08:52:44 -0000 1.2.2.2 *************** *** 22,25 **** --- 22,26 ---- #include "propertyframe.h" #include "main.h" + #include "simspark.h" //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro *************** *** 63,70 **** } void propertyframe::SetLeaf(weak_ptr<Leaf> leaf) { ! mLeaf = leaf; ! mPropList.Init(mLeaf,mCtrPropList); RefreshProperties(); } --- 64,97 ---- } + void propertyframe::UpdateCached() + { + shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if (spark.get() == 0) + { + return; + } + + mPath.Update(spark->GetCore()); + mPropList.Init(mPath.get(),mCtrPropList); + } + void propertyframe::SetLeaf(weak_ptr<Leaf> leaf) { ! shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! if (spark.get() == 0) ! { ! return; ! } ! ! if (leaf.expired()) ! { ! mPath = Leaf::CachedPath<zeitgeist::Leaf>(); ! } else ! { ! std::string path = leaf.lock()->GetFullPath(); ! mPath.SetKey(Core::CacheKey(spark->GetCore()->GetRoot(), path)); ! } ! ! UpdateCached(); RefreshProperties(); } |
From: Markus R. <rol...@us...> - 2007-02-18 08:51:08
|
Update of /cvsroot/simspark/simspark/spark/zeitgeist In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv14681 Modified Files: Tag: WIN32 core.h Log Message: - added SetKey() and reset() to CachedLeafPath Index: core.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/zeitgeist/core.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** core.h 16 Feb 2007 15:36:51 -0000 1.2.2.1 --- core.h 18 Feb 2007 08:51:04 -0000 1.2.2.2 *************** *** 99,102 **** --- 99,105 ---- { return key; } + void SetKey(const CacheKey& k) + { key = k; } + boost::weak_ptr<Leaf>& GetLeaf() { return leaf; } *************** *** 119,122 **** --- 122,130 ---- return leaf.expired(); } + + void reset() + { + leaf.reset(); + } }; |
From: Markus R. <rol...@us...> - 2007-02-18 08:08:01
|
Update of /cvsroot/simspark/simspark/spark/spark In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30902 Modified Files: Tag: WIN32 spark.cpp spark.h Log Message: - added ResetCached() and UpdateCached() Index: spark.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/spark/spark.cpp,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** spark.cpp 15 Feb 2007 21:03:22 -0000 1.3.2.1 --- spark.cpp 18 Feb 2007 08:07:57 -0000 1.3.2.2 *************** *** 52,55 **** --- 52,60 ---- // reset shared ptr to objects in the zeitgeist hierarchy before // the zeitgeist core is shutdown + ResetCached(); + } + + void Spark::ResetCached() + { mLogServer.reset(); mScriptServer.reset(); *************** *** 58,69 **** } ! bool ! Spark::Init(int argc, char** argv) { mLogServer = mZeitgeist->GetCore()->GetLogServer(); if (mLogServer.get() == 0) { cerr << "(Spark) ERROR: LogServer not found\n"; ! return false; } --- 63,75 ---- } ! bool Spark::UpdateCached() { + bool ok = true; + mLogServer = mZeitgeist->GetCore()->GetLogServer(); if (mLogServer.get() == 0) { cerr << "(Spark) ERROR: LogServer not found\n"; ! ok = false; } *************** *** 72,86 **** { mLogServer->Error() << "(Spark) ERROR: ScriptServer not found\n"; ! return false; } - // run the spark init script - mZeitgeist->GetCore()->GetRoot()->GetScript()->RunInitScript - ( - "spark.rb", - "lib/spark", - ScriptServer::IS_COMMON - ); - mSceneServer = shared_dynamic_cast<SceneServer> (mZeitgeist->GetCore()->Get("/sys/server/scene")); --- 78,84 ---- { mLogServer->Error() << "(Spark) ERROR: ScriptServer not found\n"; ! ok = false; } mSceneServer = shared_dynamic_cast<SceneServer> (mZeitgeist->GetCore()->Get("/sys/server/scene")); *************** *** 89,93 **** { mLogServer->Error() << "(Spark) ERROR: SceneServer not found\n"; ! return false; } --- 87,91 ---- { mLogServer->Error() << "(Spark) ERROR: SceneServer not found\n"; ! ok = false; } *************** *** 98,104 **** { mLogServer->Error() << "(Spark) ERROR: SimulationServer not found\n"; ! return false; } // run the app defined init return InitApp(argc,argv); --- 96,118 ---- { mLogServer->Error() << "(Spark) ERROR: SimulationServer not found\n"; ! ok = false; } + return ok; + } + + bool + Spark::Init(int argc, char** argv) + { + // run the spark init script + mZeitgeist->GetCore()->GetScriptServer()->RunInitScript + ( + "spark.rb", + "lib/spark", + ScriptServer::IS_COMMON + ); + + UpdateCached(); + // run the app defined init return InitApp(argc,argv); Index: spark.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/spark/spark.h,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** spark.h 8 Mar 2006 18:17:03 -0000 1.3 --- spark.h 18 Feb 2007 08:07:57 -0000 1.3.2.1 *************** *** 72,75 **** --- 72,81 ---- bool Init(int argc, char** argv); + /** resets all cached object references */ + void ResetCached(); + + /** updated all cached object references */ + bool UpdateCached(); + // // user callbacks |
From: Markus R. <rol...@us...> - 2007-02-18 08:07:43
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30883 Modified Files: Tag: WIN32 mainframe.cpp Log Message: - update cached references in Spark object after loading a new simulation Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.8.2.4 retrieving revision 1.8.2.5 diff -C2 -d -r1.8.2.4 -r1.8.2.5 *** mainframe.cpp 16 Feb 2007 17:06:40 -0000 1.8.2.4 --- mainframe.cpp 18 Feb 2007 08:07:37 -0000 1.8.2.5 *************** *** 583,586 **** --- 583,588 ---- } + spark->UpdateCached(); + shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); if (sim.get() == 0) |
From: Markus R. <rol...@us...> - 2007-02-16 17:08:46
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32017 Modified Files: Tag: WIN32 rsgedit.wxg Log Message: - add reload to file menu Index: rsgedit.wxg =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.wxg,v retrieving revision 1.4.2.2 retrieving revision 1.4.2.3 diff -C2 -d -r1.4.2.2 -r1.4.2.3 *** rsgedit.wxg 15 Feb 2007 21:17:01 -0000 1.4.2.2 --- rsgedit.wxg 16 Feb 2007 17:08:35 -0000 1.4.2.3 *************** *** 1,4 **** <?xml version="1.0"?> ! <!-- generated by wxGlade 0.4.1 on Thu Feb 15 22:16:15 2007 --> <application path="." name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6"> --- 1,4 ---- <?xml version="1.0"?> ! <!-- generated by wxGlade 0.4.1 on Fri Feb 16 18:07:47 2007 --> <application path="." name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6"> *************** *** 17,20 **** --- 17,24 ---- </item> <item> + <label>&Reload</label> + <id>ID_FILE_RELOAD</id> + </item> + <item> <label>&Exit</label> <id>wxID_EXIT</id> |
From: Markus R. <rol...@us...> - 2007-02-16 17:07:04
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30646 Modified Files: Tag: WIN32 constants.h mainframe.cpp mainframe.h Log Message: - move GUI ID_ constansts to constants.h - add automatic reload button Index: constants.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/Attic/constants.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** constants.h 15 Feb 2007 21:08:00 -0000 1.1.2.1 --- constants.h 16 Feb 2007 17:06:00 -0000 1.1.2.2 *************** *** 27,29 **** --- 27,39 ---- }; + #define ID_SIM_START (wxID_HIGHEST+10) + #define ID_SIM_PAUSE (wxID_HIGHEST+11) + + #define ID_VIEW_LOG (wxID_HIGHEST+20) + #define ID_VIEW_TREE (wxID_HIGHEST+21) + #define ID_VIEW_TOOLBAR (wxID_HIGHEST+22) + + #define ID_FILE_OPEN (wxID_HIGHEST+23) + #define ID_FILE_RELOAD (wxID_HIGHEST+24) + #endif // RSGEDIT_CONSTANTS_H Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.7.2.3 retrieving revision 1.7.2.4 diff -C2 -d -r1.7.2.3 -r1.7.2.4 *** mainframe.h 15 Feb 2007 21:07:59 -0000 1.7.2.3 --- mainframe.h 16 Feb 2007 17:06:41 -0000 1.7.2.4 *************** *** 45,57 **** // end wxGlade - #define ID_SIM_START (wxID_HIGHEST+10) - #define ID_SIM_PAUSE (wxID_HIGHEST+11) - - #define ID_VIEW_LOG (wxID_HIGHEST+20) - #define ID_VIEW_TREE (wxID_HIGHEST+21) - #define ID_VIEW_TOOLBAR (wxID_HIGHEST+22) - - #define ID_FILE_OPEN (wxID_HIGHEST+23) - class mainframe: public wxFrame { public: --- 45,48 ---- *************** *** 102,105 **** --- 93,99 ---- void OnUpdateFileOpen(wxUpdateUIEvent& event); + void OnFileReload(wxCommandEvent& event); + void OnUpdateFileReload(wxUpdateUIEvent& event); + void OnExit(wxCommandEvent& event); void OnClose( wxCloseEvent& event ); *************** *** 109,113 **** /** appends the accumulated log buffer to the log window pane */ void UpdateLogWindow(); ! /** returns true iff its safe to close this frame now */ bool CanClose(); --- 103,107 ---- /** appends the accumulated log buffer to the log window pane */ void UpdateLogWindow(); ! /** returns true iff its safe to close this frame now */ bool CanClose(); *************** *** 116,119 **** --- 110,121 ---- ESimState GetSimState() const; + /** update the title of the window */ + void mainframe::UpdateTitle(); + + /** resets the current simulation and starts a new one from the + given script file + */ + bool OpenSimulation(const wxString& fname); + void InitTreeNodeProperties(); *************** *** 156,159 **** --- 158,166 ---- int mLastVertSashPosition; + /** the filename of the current simulation (i.e. the corresponding + startup .rb script) + */ + wxString mSimFName; + DECLARE_EVENT_TABLE() }; // wxGlade: end class Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -C2 -d -r1.8.2.3 -r1.8.2.4 *** mainframe.cpp 15 Feb 2007 21:07:59 -0000 1.8.2.3 --- mainframe.cpp 16 Feb 2007 17:06:40 -0000 1.8.2.4 *************** *** 29,32 **** --- 29,33 ---- #include <rsgedit/res/xpm_pause.xpm> #include <rsgedit/res/xpm_open.xpm> + #include <rsgedit/res/xpm_reload.xpm> //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro *************** *** 59,62 **** --- 60,66 ---- EVT_UPDATE_UI(ID_FILE_OPEN, mainframe::OnUpdateFileOpen) + EVT_MENU(ID_FILE_RELOAD, mainframe::OnFileReload) + EVT_UPDATE_UI(ID_FILE_RELOAD, mainframe::OnUpdateFileReload) + EVT_TIMER(1, mainframe::OnLogTimer) *************** *** 73,77 **** // the default height of the log window pane [pixel] ! static const int LOGWND_DEFAULT_HEIGHT = 80; // the update interval of the log window [milliseconds} --- 77,81 ---- // the default height of the log window pane [pixel] ! static const int LOGWND_DEFAULT_HEIGHT = 150; // the update interval of the log window [milliseconds} *************** *** 101,104 **** --- 105,109 ---- wxMenu* wxglade_tmp_menu_1 = new wxMenu(); wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open"), wxT(""), wxITEM_NORMAL); + wxglade_tmp_menu_1->Append(ID_FILE_RELOAD, wxT("&Reload"), wxT(""), wxITEM_NORMAL); wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxT(""), wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); *************** *** 125,128 **** --- 130,134 ---- mToolBar->AddTool(ID_FILE_OPEN, wxT("Open"), wxBitmap(xpm_open)); + mToolBar->AddTool(ID_FILE_RELOAD, wxT("Reload"), wxBitmap(xpm_reload)); mToolBar->AddSeparator(); mToolBar->AddTool(ID_SIM_START, wxT("Start"), wxBitmap(xpm_play)); *************** *** 149,152 **** --- 155,160 ---- // init log wnd timer mTimer.Start(LOGWND_UPDATE_INTERVAL); + + UpdateTitle(); } *************** *** 155,158 **** --- 163,177 ---- } + void mainframe::UpdateTitle() + { + wxString title = "SimSpark"; + if (! mSimFName.empty()) + { + title += " <" + mSimFName + ">"; + } + + SetTitle(title); + } + void mainframe::SplitHor() { *************** *** 545,562 **** } ! void mainframe::OnFileOpen(wxCommandEvent& event) { - wxString message = "Choose a ruby script to run"; - wxString default_path = "./rsg"; - wxString default_filename = ""; - wxString default_extension = ""; - wxString wildcard = "ruby scripts (*.rb)|*.rb"; - - wxString filename = wxFileSelector(message, default_path, default_filename, default_extension, wildcard); - if (filename.empty() ) - { - return; - } - ResetSimulation(); mSparkTree.Init(mCtrTree); --- 564,569 ---- } ! bool mainframe::OpenSimulation(const wxString& fname) { ResetSimulation(); mSparkTree.Init(mCtrTree); *************** *** 567,575 **** { assert(false); ! return; } ! spark->GetScriptServer()->Run(filename.c_str()); ! spark->GetLog()->Normal() << "(RsgEdit) reading " << filename << "\n"; shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); --- 574,585 ---- { assert(false); ! return false; } ! spark->GetLog()->Normal() << "(RsgEdit) reading " << fname << "\n"; ! if (! spark->GetScriptServer()->Run(fname.c_str())) ! { ! return false; ! } shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); *************** *** 577,581 **** { assert(false); ! return; } --- 587,591 ---- { assert(false); ! return false; } *************** *** 583,585 **** --- 593,629 ---- AdvanceSimulation(sim, 0.01f); DoneSimulation(sim); + + mSimFName = fname; + UpdateTitle(); + return true; + } + + void mainframe::OnFileOpen(wxCommandEvent& event) + { + wxString message = "Choose a ruby script to run"; + wxString default_path = "./rsg"; + wxString default_filename = ""; + wxString default_extension = ""; + wxString wildcard = "ruby scripts (*.rb)|*.rb"; + + wxString filename = wxFileSelector(message, default_path, default_filename, default_extension, wildcard); + if (filename.empty() ) + { + return; + } + + OpenSimulation(filename); + } + + void mainframe::OnUpdateFileReload(wxUpdateUIEvent& event) + { + event.Enable( + (GetSimState() == S_PAUSED) && + (! mSimFName.empty()) + ); + } + + void mainframe::OnFileReload(wxCommandEvent& event) + { + OpenSimulation(mSimFName); } |
From: Markus R. <rol...@us...> - 2007-02-16 17:06:53
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/res In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30866 Added Files: Tag: WIN32 xpm_reload.xpm Log Message: - a reload icon --- NEW FILE: xpm_reload.xpm --- /* XPM */ static const char *xpm_reload[] = { "16 16 5 1", " c None", ". c #000000", "X c #808080", "o c #FFFFFF", "O c #008000", " ..........X ", " .ooooooooo.. ", " .ooooooOoo. . ", " .ooooooOOoX..X ", " .ooooOOOOOooo. ", " .oooOooOOoooo. ", " .oooOooOooooo. ", " .oooOooooOooo. ", " .oooooOooOooo. ", " .ooooOOooOooo. ", " .oooOOOOOoooo. ", " .ooooOOoooooo. ", " .oooooOoooooo. ", " .oooooooooooo. ", " .............. ", " "}; |
From: Markus R. <rol...@us...> - 2007-02-16 15:44:04
|
Update of /cvsroot/simspark/simspark/spark/oxygen/sceneserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25267/sceneserver Modified Files: Tag: WIN32 sceneserver.cpp sceneserver.h Log Message: - cleanup - use CachedPath objects to cache references Index: sceneserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/sceneserver/sceneserver.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** sceneserver.h 5 Dec 2005 21:21:17 -0000 1.1 --- sceneserver.h 16 Feb 2007 15:42:53 -0000 1.1.2.1 *************** *** 37,40 **** --- 37,41 ---- #include <zeitgeist/class.h> #include <zeitgeist/node.h> + #include "scene.h" namespace oxygen *************** *** 66,70 **** /** creates a new scene hierarchy at a specific location, new hierarchy is also made current */ ! boost::shared_ptr<Scene> CreateScene(const std::string &location); /** sets the active scene */ --- 67,71 ---- /** creates a new scene hierarchy at a specific location, new hierarchy is also made current */ ! bool CreateScene(const std::string &location); /** sets the active scene */ *************** *** 72,76 **** /** returns a reference to the current active scene */ ! boost::shared_ptr<Scene> GetActiveScene() { return mActiveScene; } /** updates the state of the current active scene (deltaTime is in --- 73,77 ---- /** returns a reference to the current active scene */ ! boost::shared_ptr<Scene> GetActiveScene() { return mActiveScene.get(); } /** updates the state of the current active scene (deltaTime is in *************** *** 118,122 **** private: /** the current active scene */ ! boost::shared_ptr<Scene> mActiveScene; /** cached reference to the Space node below the active scene */ --- 119,123 ---- private: /** the current active scene */ ! CachedPath<Scene> mActiveScene; /** cached reference to the Space node below the active scene */ Index: sceneserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/sceneserver/sceneserver.cpp,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** sceneserver.cpp 18 Feb 2006 19:46:54 -0000 1.2 --- sceneserver.cpp 16 Feb 2007 15:42:53 -0000 1.2.2.1 *************** *** 49,53 **** } ! boost::shared_ptr<Scene> SceneServer::CreateScene(const std::string &location) { shared_ptr<CoreContext> context = GetCore()->CreateContext(); --- 49,53 ---- } ! bool SceneServer::CreateScene(const std::string &location) { shared_ptr<CoreContext> context = GetCore()->CreateContext(); *************** *** 56,86 **** (context->New("oxygen/Scene", location)); ! if (scene.get() != 0) ! { ! ResetCache(); ! mActiveScene = scene; ! } ! ! return scene; } bool SceneServer::SetActiveScene(const std::string &location) { ! shared_ptr<Scene> scene = ! shared_dynamic_cast<Scene>(GetCore()->Get(location)); ! ! if (scene.get() != 0) ! { ! ResetCache(); ! mActiveScene = scene; ! return true; ! } ! ! return false; } void SceneServer::ResetCache() { - mActiveScene.reset(); mActiveSpace.reset(); mActiveWorld.reset(); --- 56,73 ---- (context->New("oxygen/Scene", location)); ! ResetCache(); ! RegisterCachedPath(mActiveScene, location); ! return (scene.get() != 0); } bool SceneServer::SetActiveScene(const std::string &location) { ! ResetCache(); ! RegisterCachedPath(mActiveScene, location); ! return (mActiveScene.get() != 0); } void SceneServer::ResetCache() { mActiveSpace.reset(); mActiveWorld.reset(); |
From: Markus R. <rol...@us...> - 2007-02-16 15:43:41
|
Update of /cvsroot/simspark/simspark/spark/oxygen/physicsserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25267/physicsserver Modified Files: Tag: WIN32 bodycontroller.cpp collisionhandler.cpp collisionhandler.h Log Message: - cleanup - use CachedPath objects to cache references Index: collisionhandler.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/collisionhandler.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** collisionhandler.cpp 5 Dec 2005 21:16:49 -0000 1.1 --- collisionhandler.cpp 16 Feb 2007 15:42:51 -0000 1.1.2.1 *************** *** 33,39 **** --- 33,59 ---- CollisionHandler::OnLink() { + UpdateCached(); + } + + void + CollisionHandler::ResetCache() + { + mCollider.reset(); + mWorld.reset(); + mSpace.reset(); + } + + void + CollisionHandler::UpdateCached() + { // setup the scene, world, space and collider references shared_ptr<Scene> scene = GetScene(); + ResetCache(); + if (scene.get() == 0) + { + return; + } + mWorld = shared_static_cast<World>(scene->GetChildOfClass("World")); if (mWorld.get() == 0) *************** *** 61,67 **** CollisionHandler::OnUnlink() { ! mCollider.reset(); ! mWorld.reset(); ! mSpace.reset(); } --- 81,86 ---- CollisionHandler::OnUnlink() { ! BaseNode::OnUnlink(); ! ResetCache(); } Index: collisionhandler.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/collisionhandler.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** collisionhandler.h 13 Feb 2007 19:52:34 -0000 1.1.2.1 --- collisionhandler.h 16 Feb 2007 15:42:51 -0000 1.1.2.2 *************** *** 50,53 **** --- 50,56 ---- virtual ~CollisionHandler() {}; + /** update variables from a script */ + virtual void UpdateCached(); + /** HandleCollision is called from the Collider to which this CollisionHandler is registered to. Derived classes implement *************** *** 100,103 **** --- 103,108 ---- virtual void OnUnlink(); + void ResetCache(); + // // Members Index: bodycontroller.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/bodycontroller.cpp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** bodycontroller.cpp 15 Feb 2007 21:00:18 -0000 1.1.2.1 --- bodycontroller.cpp 16 Feb 2007 15:42:50 -0000 1.1.2.2 *************** *** 35,38 **** --- 35,39 ---- void BodyController::OnUnlink() { + BaseNode::OnUnlink(); mBody.reset(); } |
Update of /cvsroot/simspark/simspark/spark/oxygen/simulationserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25267/simulationserver Modified Files: Tag: WIN32 agentcontrol.cpp agentcontrol.h monitorcontrol.cpp monitorcontrol.h simulationserver.cpp simulationserver.h Log Message: - cleanup - use CachedPath objects to cache references Index: simulationserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/simulationserver.cpp,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** simulationserver.cpp 8 Jan 2006 14:07:38 -0000 1.3 --- simulationserver.cpp 16 Feb 2007 15:42:56 -0000 1.3.2.1 *************** *** 22,28 **** #include "simulationserver.h" #include "simcontrolnode.h" - #include <oxygen/monitorserver/monitorserver.h> - #include <oxygen/sceneserver/sceneserver.h> - #include <oxygen/gamecontrolserver/gamecontrolserver.h> #include <zeitgeist/logserver/logserver.h> #include <signal.h> --- 22,25 ---- *************** *** 65,81 **** void SimulationServer::OnLink() { ! mMonitorServer = shared_dynamic_cast<MonitorServer> ! (GetCore()->Get("/sys/server/monitor")); ! ! if (mMonitorServer.get() == 0) ! { ! GetLog()->Error() ! << "(SimulationServer) ERROR: MonitorServer not found.\n"; ! } ! ! mGameControlServer = shared_dynamic_cast<GameControlServer> ! (GetCore()->Get("/sys/server/gamecontrol")); ! if (mGameControlServer.get() == 0) { GetLog()->Error() --- 62,68 ---- void SimulationServer::OnLink() { ! RegisterCachedPath(mGameControlServer, "/sys/server/gamecontrol"); ! if (mGameControlServer.expired()) { GetLog()->Error() *************** *** 83,90 **** } ! mSceneServer = shared_dynamic_cast<SceneServer> ! (GetCore()->Get("/sys/server/scene")); ! ! if (mSceneServer.get() == 0) { GetLog()->Error() --- 70,75 ---- } ! RegisterCachedPath(mSceneServer, "/sys/server/scene"); ! if (mSceneServer.expired()) { GetLog()->Error() *************** *** 93,104 **** } - - void SimulationServer::OnUnlink() - { - mMonitorServer.reset(); - mGameControlServer.reset(); - mSceneServer.reset(); - } - void SimulationServer::Quit() { --- 78,81 ---- *************** *** 203,208 **** { if ( ! (mSceneServer.get() == 0) || ! (mGameControlServer.get() == 0) ) { --- 180,185 ---- { if ( ! (mSceneServer.expired()) || ! (mGameControlServer.expired()) ) { *************** *** 336,352 **** } - shared_ptr<GameControlServer> SimulationServer::GetGameControlServer() - { - return mGameControlServer; - } - - shared_ptr<MonitorServer> SimulationServer::GetMonitorServer() - { - return mMonitorServer; - } - shared_ptr<SceneServer> SimulationServer::GetSceneServer() { ! return mSceneServer; } --- 313,319 ---- } shared_ptr<SceneServer> SimulationServer::GetSceneServer() { ! return mSceneServer.get(); } Index: monitorcontrol.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/monitorcontrol.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** monitorcontrol.h 5 Dec 2005 21:21:18 -0000 1.1 --- monitorcontrol.h 16 Feb 2007 15:42:56 -0000 1.1.2.1 *************** *** 22,25 **** --- 22,26 ---- #include "netcontrol.h" + #include <oxygen/monitorserver/monitorserver.h> namespace oxygen *************** *** 56,64 **** protected: virtual void OnLink(); - virtual void OnUnlink(); protected: /** cached reference to the MonitorServer */ ! boost::shared_ptr<MonitorServer> mMonitorServer; /** the update interval for the connected monitors in cycles */ --- 57,64 ---- protected: virtual void OnLink(); protected: /** cached reference to the MonitorServer */ ! CachedPath<MonitorServer> mMonitorServer; /** the update interval for the connected monitors in cycles */ Index: agentcontrol.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/agentcontrol.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** agentcontrol.h 5 Dec 2005 21:21:18 -0000 1.1 --- agentcontrol.h 16 Feb 2007 15:42:55 -0000 1.1.2.1 *************** *** 22,25 **** --- 22,26 ---- #include "netcontrol.h" + #include <oxygen/gamecontrolserver/gamecontrolserver.h> namespace oxygen *************** *** 53,61 **** protected: virtual void OnLink(); - virtual void OnUnlink(); protected: /** cached reference to the GameControlServer */ ! boost::shared_ptr<GameControlServer> mGameControlServer; }; --- 54,61 ---- protected: virtual void OnLink(); protected: /** cached reference to the GameControlServer */ ! CachedPath<GameControlServer> mGameControlServer; }; Index: monitorcontrol.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/monitorcontrol.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** monitorcontrol.cpp 5 Dec 2005 21:21:18 -0000 1.1 --- monitorcontrol.cpp 16 Feb 2007 15:42:55 -0000 1.1.2.1 *************** *** 22,26 **** #include "netmessage.h" #include <zeitgeist/logserver/logserver.h> - #include <oxygen/monitorserver/monitorserver.h> #include <oxygen/sceneserver/sceneserver.h> #include <oxygen/sceneserver/scene.h> --- 22,25 ---- *************** *** 44,62 **** { NetControl::OnLink(); ! shared_ptr<SimulationServer> sim = GetSimulationServer(); ! if (sim.get() == 0) { GetLog()->Error() ! << "(MonitorControl) ERROR: SimulationServer not found\n"; return; } - - mMonitorServer = sim->GetMonitorServer(); - } - - void MonitorControl::OnUnlink() - { - NetControl::OnUnlink(); - mMonitorServer.reset(); } --- 43,54 ---- { NetControl::OnLink(); ! RegisterCachedPath(mMonitorServer, "/sys/server/monitor"); ! ! if (mMonitorServer.expired() == 0) { GetLog()->Error() ! << "(MonitorControl) ERROR: MonitorServer not found\n"; return; } } Index: simulationserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/simulationserver.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** simulationserver.h 2 Jan 2006 20:37:41 -0000 1.2 --- simulationserver.h 16 Feb 2007 15:42:57 -0000 1.2.2.1 *************** *** 24,34 **** #include <zeitgeist/node.h> namespace oxygen { ! class GameControlServer; ! class MonitorServer; ! class SceneServer; ! class SimControlNode; class SimulationServer : public zeitgeist::Node --- 24,33 ---- #include <zeitgeist/node.h> + #include <oxygen/gamecontrolserver/gamecontrolserver.h> + #include <oxygen/sceneserver/sceneserver.h> namespace oxygen { ! class SimControlNode; class SimulationServer : public zeitgeist::Node *************** *** 121,130 **** virtual void Run(int argc = 0, char** argv = 0); - /** returns the cached MonitorServer reference */ - boost::shared_ptr<MonitorServer> GetMonitorServer(); - - /** returns the cached GameControlServer reference */ - boost::shared_ptr<GameControlServer> GetGameControlServer(); - /** returns thr cached SceneServer reference */ boost::shared_ptr<SceneServer> GetSceneServer(); --- 120,123 ---- *************** *** 135,139 **** protected: virtual void OnLink(); - virtual void OnUnlink(); /** advances the simulation mSumDeltaTime seconds. If mSimStep is --- 128,131 ---- *************** *** 180,191 **** int mCycle; - /** a cached reference to the monitor server */ - boost::shared_ptr<MonitorServer> mMonitorServer; - /** a cached reference to the GameControlServer */ ! boost::shared_ptr<GameControlServer> mGameControlServer; /** a cached reference to the SceneServer */ ! boost::shared_ptr<SceneServer> mSceneServer; }; --- 172,180 ---- int mCycle; /** a cached reference to the GameControlServer */ ! CachedPath<GameControlServer> mGameControlServer; /** a cached reference to the SceneServer */ ! CachedPath<SceneServer> mSceneServer; }; Index: agentcontrol.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/simulationserver/agentcontrol.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** agentcontrol.cpp 5 Dec 2005 21:21:18 -0000 1.1 --- agentcontrol.cpp 16 Feb 2007 15:42:54 -0000 1.1.2.1 *************** *** 22,26 **** #include "netmessage.h" #include <zeitgeist/logserver/logserver.h> - #include <oxygen/gamecontrolserver/gamecontrolserver.h> #include <oxygen/agentaspect/agentaspect.h> --- 22,25 ---- *************** *** 42,60 **** { NetControl::OnLink(); ! shared_ptr<SimulationServer> sim = GetSimulationServer(); ! if (sim.get() == 0) ! { ! GetLog()->Error() ! << "(AgentControl) ERROR: SimulationServer not found\n"; ! return; ! } ! ! mGameControlServer = sim->GetGameControlServer(); ! } ! void AgentControl::OnUnlink() ! { ! NetControl::OnUnlink(); ! mGameControlServer.reset(); } --- 41,51 ---- { NetControl::OnLink(); ! RegisterCachedPath(mGameControlServer, "/sys/server/gamecontrol"); ! if (mGameControlServer.expired()) ! { ! GetLog()->Error() ! << "(AgentControl) ERROR: GameControlServer not found.\n"; ! } } |
From: Markus R. <rol...@us...> - 2007-02-16 15:42:44
|
Update of /cvsroot/simspark/simspark/spark/kerosin/renderserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24230/renderserver Modified Files: Tag: WIN32 rendercontrol.cpp rendercontrol.h renderserver.cpp renderserver.h Log Message: - cleanup - use CachedPath objects to cache references Index: renderserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/renderserver/renderserver.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** renderserver.h 15 Feb 2007 21:01:57 -0000 1.2.2.1 --- renderserver.h 16 Feb 2007 15:40:48 -0000 1.2.2.2 *************** *** 42,45 **** --- 42,46 ---- #include <zeitgeist/class.h> #include <zeitgeist/leaf.h> + #include <oxygen/sceneserver/sceneserver.h> #include <kerosin/openglserver/glbase.h> *************** *** 107,116 **** /** reference to the SceneServer */ ! boost::shared_ptr<oxygen::SceneServer> mSceneServer; ! ! /** reference to the OpenGLServer */ ! boost::shared_ptr<kerosin::OpenGLServer> mOpenGLServer; - unsigned int mAmbientVP; RGBA mAmbientColor; }; --- 108,113 ---- /** reference to the SceneServer */ ! CachedPath<oxygen::SceneServer> mSceneServer; RGBA mAmbientColor; }; *************** *** 121,122 **** --- 118,134 ---- #endif // KEROSIN_RENDERSERVER_H + + + + + + + + + + + + + + + Index: rendercontrol.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/renderserver/rendercontrol.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** rendercontrol.cpp 5 Dec 2005 21:38:23 -0000 1.1 --- rendercontrol.cpp 16 Feb 2007 15:40:47 -0000 1.1.2.1 *************** *** 21,26 **** #include "customrender.h" #include <zeitgeist/logserver/logserver.h> - #include <kerosin/renderserver/renderserver.h> - #include <kerosin/openglserver/openglserver.h> using namespace kerosin; --- 21,24 ---- *************** *** 41,48 **** void RenderControl::OnLink() { ! mRenderServer = shared_dynamic_cast<RenderServer> ! (GetCore()->Get("/sys/server/render")); ! if (mRenderServer.get() == 0) { GetLog()->Error() --- 39,45 ---- void RenderControl::OnLink() { ! RegisterCachedPath(mRenderServer, "/sys/server/render"); ! if (mRenderServer.expired()) { GetLog()->Error() *************** *** 50,57 **** } ! mOpenGLServer = shared_dynamic_cast<OpenGLServer> ! (GetCore()->Get("/sys/server/opengl")); ! if (mOpenGLServer.get() == 0) { GetLog()->Error() --- 47,53 ---- } ! RegisterCachedPath(mOpenGLServer,"/sys/server/opengl"); ! if (mOpenGLServer.expired()) { GetLog()->Error() *************** *** 60,69 **** } - void RenderControl::OnUnlink() - { - mRenderServer.reset(); - mOpenGLServer.reset(); - } - void RenderControl::RenderCustom() { --- 56,59 ---- *************** *** 85,88 **** --- 75,86 ---- void RenderControl::EndCycle() { + if ( + (mOpenGLServer.expired()) || + (mRenderServer.expired()) + ) + { + return; + } + // update the window (pumps event loop, etc..) and render the // current frame Index: renderserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/renderserver/renderserver.cpp,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** renderserver.cpp 15 Feb 2007 21:01:57 -0000 1.2.2.1 --- renderserver.cpp 16 Feb 2007 15:40:47 -0000 1.2.2.2 *************** *** 49,82 **** { // setup SceneServer reference ! mSceneServer = shared_dynamic_cast<SceneServer> ! (GetCore()->Get("/sys/server/scene")); ! if (mSceneServer.get() == 0) { GetLog()->Error() << "(RenderServer) ERROR: SceneServer not found\n"; } - - // setup OpenGLServer reference - mOpenGLServer = shared_dynamic_cast<OpenGLServer> - (GetCore()->Get("sys/server/opengl")); - - if (mOpenGLServer.get() == 0) - { - GetLog()->Error() - << "(RenderServer) ERROR: OpenGLServer not found\n"; - } else - { - mAmbientVP = 0; - #if 0 - mAmbientVP = mOpenGLServer->LoadARBVertexProgram - ("/sys/program/ambient.vp"); - if (mAmbientVP == 0) - { - GetLog()->Error() - << "(RenderServer) ERROR: Could not load vertex program\n"; - } - #endif - } } --- 49,59 ---- { // setup SceneServer reference ! RegisterCachedPath(mSceneServer, "/sys/server/scene"); ! if (mSceneServer.expired()) { GetLog()->Error() << "(RenderServer) ERROR: SceneServer not found\n"; } } *************** *** 84,90 **** RenderServer::OnUnlink() { - mSceneServer.reset(); - mOpenGLServer.reset(); mActiveScene.reset(); } --- 61,66 ---- RenderServer::OnUnlink() { mActiveScene.reset(); + Leaf::OnUnlink(); } *************** *** 92,96 **** RenderServer::GetActiveScene() { ! if (mSceneServer.get() == 0) { mActiveScene.reset(); --- 68,72 ---- RenderServer::GetActiveScene() { ! if (mSceneServer.expired()) { mActiveScene.reset(); *************** *** 110,185 **** void - RenderServer::RenderFancyLighting(const salt::Frustum& /*frustum*/, - boost::shared_ptr<oxygen::Camera>& /*camera*/, - TLeafList& /*myLights*/, TLeafList& /*allMeshes*/, - TLeafList& /*visibleMeshes*/) - - { - #if 0 - glEnable(GL_VERTEX_PROGRAM_ARB); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, mAmbientVP); - - glColor3f(0.1f,0.1f,0.1f); - mActiveScene->RenderAmbient(); - - // render lights - glBlendFunc(GL_ONE, GL_ONE); - glEnable(GL_BLEND); - //glEnable(GL_ALPHA_TEST); - //glAlphaFunc(GL_GREATER, 0.0f); - glDepthMask(0); - glDepthFunc(GL_EQUAL); - - for (TLeafList::iterator i=myLights.begin(); i != myLights.end(); ++i) - { - shared_ptr<Light> light = shared_static_cast<Light>(*i); - - // only render the light if it is visible - if (frustum.Intersects(light->GetWorldBoundingBox())!=Frustum::FS_OUTSIDE) - { - for (TLeafList::iterator j=visibleMeshes.begin(); j != visibleMeshes.end(); ++j) - { - shared_ptr<StaticMesh> mesh = shared_static_cast<StaticMesh>(*j); - - // we only have to render meshes, whose bounding volume intersects the light volume - if (light->GetWorldBoundingBox().Intersects(mesh->GetWorldBoundingBox())) - { - Matrix toObjectSpace; - toObjectSpace.Identity(); - toObjectSpace = mesh->GetWorldTransform(); - toObjectSpace.InvertRotationMatrix(); - //light->GetWorldTransform().Pos().Dump(); - light->Prepare(); - Vector3f lightPos = toObjectSpace.Transform(light->GetWorldTransform().Pos()); - Vector3f viewPos = toObjectSpace.Transform(camera->GetWorldTransform().Pos()); - glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 0, lightPos.x(), lightPos.y(), lightPos.z(), 1.0f); - glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 1, viewPos.x(), viewPos.y(), viewPos.z(), 1.0f); - light->RenderLitMesh(shared_static_cast<StaticMesh>(*j)); - } - } - } - } - - glDisable(GL_BLEND); - glDepthMask(1); - - glActiveTextureARB(GL_TEXTURE0_ARB); - glDisable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glDisable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE2_ARB); - glDisable(GL_TEXTURE_2D); - - glEnable(GL_VERTEX_PROGRAM_ARB); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, mAmbientVP); - - // standard rendering - mActiveScene->Render(); - - glDisable(GL_VERTEX_PROGRAM_ARB); - #endif - } - - void RenderServer::Render() { --- 86,89 ---- *************** *** 213,240 **** BindCamera(camera); - #if 0 - // get the view frustum from the camera - Frustum frustum; - camera->DescribeFrustum(frustum); - - // cull lights and geometries against the frustum - TLeafList myLights; - TLeafList allMeshes; - TLeafList visibleMeshes; - - mActiveScene->GetChildrenSupportingClass("Light", myLights, true); - mActiveScene->GetChildrenSupportingClass("StaticMesh", allMeshes, true); - - TLeafList::iterator i; - for (i = allMeshes.begin(); i != allMeshes.end(); ++i) - { - // try to cull meshes, which are outside the viewing frustum - if (frustum.Intersects(shared_static_cast<StaticMesh>(*i)->GetWorldBoundingBox())!=Frustum::FS_OUTSIDE) - { - visibleMeshes.push_back(*i); - } - } - #endif - // actual rendering --- 117,120 ---- *************** *** 273,287 **** // reset GL lights glDisable(GL_LIGHTING); - - #if 0 - // test for fancy lighting support - disabled for now - const bool doFancyLighting = false; /*openglServer->SupportsFancyLighting()*/ - - if (doFancyLighting) - { - RenderFancyLighting(frustum, camera, myLights, allMeshes, visibleMeshes); - } - else - #endif } --- 153,156 ---- Index: rendercontrol.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/renderserver/rendercontrol.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** rendercontrol.h 5 Dec 2005 21:38:23 -0000 1.1 --- rendercontrol.h 16 Feb 2007 15:40:47 -0000 1.1.2.1 *************** *** 22,31 **** #include <oxygen/simulationserver/simcontrolnode.h> namespace kerosin { - class RenderServer; - class OpenGLServer; - /** \class RenderControl is a SimControlNode that renders the current scene and pumps the SDL event loop at the end of each simulation --- 22,30 ---- #include <oxygen/simulationserver/simcontrolnode.h> + #include <kerosin/renderserver/renderserver.h> + #include <kerosin/openglserver/openglserver.h> namespace kerosin { /** \class RenderControl is a SimControlNode that renders the current scene and pumps the SDL event loop at the end of each simulation *************** *** 46,59 **** protected: virtual void OnLink(); - virtual void OnUnlink(); - void RenderCustom(); protected: /** cached reference to the RenderServer */ ! boost::shared_ptr<kerosin::RenderServer> mRenderServer; /** cached reference to the OpenGLServer */ ! boost::shared_ptr<kerosin::OpenGLServer> mOpenGLServer; /** total frames rendered */ --- 45,56 ---- protected: virtual void OnLink(); void RenderCustom(); protected: /** cached reference to the RenderServer */ ! CachedPath<kerosin::RenderServer> mRenderServer; /** cached reference to the OpenGLServer */ ! CachedPath<kerosin::OpenGLServer> mOpenGLServer; /** total frames rendered */ |
From: Markus R. <rol...@us...> - 2007-02-16 15:42:36
|
Update of /cvsroot/simspark/simspark/spark/kerosin/sceneserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24230/sceneserver Modified Files: Tag: WIN32 light.cpp light.h Log Message: - cleanup - use CachedPath objects to cache references Index: light.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/sceneserver/light.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** light.h 5 Dec 2005 21:38:23 -0000 1.1 --- light.h 16 Feb 2007 15:40:49 -0000 1.1.2.1 *************** *** 24,27 **** --- 24,28 ---- #include <kerosin/openglserver/glbase.h> + #include <kerosin/openglserver/openglserver.h> #include "staticmesh.h" #include "oxygen/geometryserver/indexbuffer.h" *************** *** 121,126 **** std::vector<oxygen::IndexBuffer> mCachedIndices; ! /** reference to the RenderServer */ ! boost::shared_ptr<OpenGLServer> mOpenGLServer; }; --- 122,127 ---- std::vector<oxygen::IndexBuffer> mCachedIndices; ! /** reference to the OpenGLServer */ ! CachedPath<OpenGLServer> mOpenGLServer; }; Index: light.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/sceneserver/light.cpp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** light.cpp 10 Feb 2007 16:18:24 -0000 1.1.2.1 --- light.cpp 16 Feb 2007 15:40:48 -0000 1.1.2.2 *************** *** 26,30 **** #include "light.h" #include <kerosin/renderserver/renderserver.h> - #include <kerosin/openglserver/openglserver.h> #include <zeitgeist/logserver/logserver.h> --- 26,29 ---- *************** *** 159,163 **** void Light::FlushCache() { ! const unsigned int n = static_cast<unsigned int>(mCachedIndices.size()); --- 158,162 ---- void Light::FlushCache() { ! const unsigned int n = static_cast<unsigned int>(mCachedIndices.size()); *************** *** 177,215 **** void Light::OnLink() { ! mOpenGLServer = shared_dynamic_cast<OpenGLServer> ! (GetCore()->Get("sys/server/opengl")); ! if (mOpenGLServer.get() == 0) { GetLog()->Error() << "(Light) ERROR: OpenGLServer not found\n"; ! } else ! { ! mGLLight = mOpenGLServer->AllocLight(); ! ! if (mGLLight < 0) ! { ! GetLog()->Error() ! << "(Light) ERROR: No more OpenGL lights available\n"; ! } ! ! #if 0 ! mVP = mOpenGLServer->LoadARBVertexProgram("sys/program/omnilight.vp"); ! if (mVP == 0) ! { ! GetLog()->Error() ! << "(Light) ERROR: Could not load vertex program\n"; ! } ! ! mFP = mOpenGLServer->LoadARBFragmentProgram("sys/program/omnilight.fp"); ! if (mFP == 0) ! { ! GetLog()->Error() ! << "(Light) ERROR: Could not load fragment program\n"; ! } ! #endif ! } } --- 176,195 ---- void Light::OnLink() { ! RegisterCachedPath(mOpenGLServer, "sys/server/opengl"); ! if (mOpenGLServer.expired()) { GetLog()->Error() << "(Light) ERROR: OpenGLServer not found\n"; ! return; ! } ! mGLLight = mOpenGLServer->AllocLight(); + if (mGLLight < 0) + { + GetLog()->Error() + << "(Light) ERROR: No more OpenGL lights available\n"; + } } *************** *** 217,221 **** { if ( ! (mOpenGLServer.get() != 0) && (mGLLight >= 0) ) --- 197,201 ---- { if ( ! (! mOpenGLServer.expired()) && (mGLLight >= 0) ) *************** *** 225,229 **** } ! mOpenGLServer.reset(); } --- 205,209 ---- } ! BaseNode::OnUnlink(); } |
From: Markus R. <rol...@us...> - 2007-02-16 15:42:34
|
Update of /cvsroot/simspark/simspark/spark/kerosin/openglserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24230/openglserver Modified Files: Tag: WIN32 openglsystem.h Log Message: - cleanup - use CachedPath objects to cache references Index: openglsystem.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/openglserver/openglsystem.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** openglsystem.h 5 Dec 2005 21:38:23 -0000 1.1 --- openglsystem.h 16 Feb 2007 15:40:46 -0000 1.1.2.1 *************** *** 51,55 **** protected: - // // members --- 51,54 ---- |
Update of /cvsroot/simspark/simspark/spark/kerosin/textureserver In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24230/textureserver Modified Files: Tag: WIN32 texture.cpp texture.h texture2d.cpp texture2d.h textureserver.cpp textureserver.h Log Message: - cleanup - use CachedPath objects to cache references Index: texture2d.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/texture2d.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** texture2d.cpp 5 Dec 2005 21:38:23 -0000 1.1 --- texture2d.cpp 16 Feb 2007 15:40:49 -0000 1.1.2.1 *************** *** 1,9 **** #include "texture2d.h" ! #include "../openglserver/openglserver.h" ! #include "../imageserver/image.h" using namespace kerosin; ! Texture2D::Texture2D(const boost::shared_ptr<TextureServer> &textureServer) : Texture(textureServer) { } --- 1,30 ---- + /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #include "texture2d.h" ! #include <kerosin/openglserver/openglserver.h> ! #include <kerosin/imageserver/image.h> using namespace kerosin; ! Texture2D::Texture2D() : Texture() { } *************** *** 15,21 **** void Texture2D::Bind() const { ! if (mTexID != 0) { ! glBindTexture(GL_TEXTURE_2D, mTexID); } } --- 36,42 ---- void Texture2D::Bind() const { ! if (mTexID != 0) { ! glBindTexture(GL_TEXTURE_2D, mTexID); } } *************** *** 23,67 **** void Texture2D::Enable() const { ! glEnable(GL_TEXTURE_2D); } void Texture2D::Disable() const { ! glDisable(GL_TEXTURE_2D); } void Texture2D::Create(boost::shared_ptr<Image> &image) { ! mWidth = image->Width(); ! mHeight = image->Height(); ! Acquire(); ! Bind(); ! glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE ); ! if(image->HasAlpha()) ! glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, mWidth, mHeight, 0, image->Format(), image->Type(), image->Data()); ! else ! glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, mWidth, mHeight, 0, image->Format(), image->Type(), image->Data()); ! glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); ! glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); } void Texture2D::Clamp() const { ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } void Texture2D::ClampToEdge() const { ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } void Texture2D::Repeat() const { ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } --- 44,92 ---- void Texture2D::Enable() const { ! glEnable(GL_TEXTURE_2D); } void Texture2D::Disable() const { ! glDisable(GL_TEXTURE_2D); } void Texture2D::Create(boost::shared_ptr<Image> &image) { ! mWidth = image->Width(); ! mHeight = image->Height(); ! Acquire(); ! Bind(); ! glTexParameteri( GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE ); ! if(image->HasAlpha()) ! { ! glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, mWidth, mHeight, 0, image->Format(), image->Type(), image->Data()); ! } ! else ! { ! glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, mWidth, mHeight, 0, image->Format(), image->Type(), image->Data()); ! } ! glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); ! glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); } void Texture2D::Clamp() const { ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } void Texture2D::ClampToEdge() const { ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } void Texture2D::Repeat() const { ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); ! glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } Index: textureserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/textureserver.cpp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** textureserver.cpp 10 Feb 2007 16:19:21 -0000 1.1.2.1 --- textureserver.cpp 16 Feb 2007 15:40:53 -0000 1.1.2.2 *************** *** 44,81 **** void TextureServer::OnLink() { ! // setup OpenGLServer reference ! mOpenGLServer = shared_dynamic_cast<OpenGLServer> ! (GetCore()->Get("sys/server/opengl")); ! ! if (mOpenGLServer.get() == 0) ! { ! GetLog()->Error() ! << "(TextureServer) ERROR: OpenGLServer not found\n"; ! } ! // setup ImageServer reference ! #ifdef WIN32 ! mImageServer.reset(); ! #else ! mImageServer = shared_dynamic_cast<ImageServer> ! (GetCore()->Get("sys/server/image")); ! #endif ! if (mImageServer.get() == 0) { GetLog()->Error() << "(TextureServer) ERROR: ImageServer not found\n"; } ! } ! ! void TextureServer::OnUnlink() ! { ! mOpenGLServer.reset(); ! mImageServer.reset(); ! } ! ! boost::shared_ptr<OpenGLServer> TextureServer::GetOpenGLServer() const ! { ! return mOpenGLServer; } --- 44,57 ---- void TextureServer::OnLink() { ! #ifndef WIN32 // setup ImageServer reference ! RegisterCachedPath(mImageServer, "/sys/server/image"); ! if (mImageServer.expired()) { GetLog()->Error() << "(TextureServer) ERROR: ImageServer not found\n"; } ! #endif } *************** *** 90,94 **** } ! if (mImageServer.get() == 0) { return shared_ptr<Texture>(); --- 66,70 ---- } ! if (mImageServer.expired()) { return shared_ptr<Texture>(); *************** *** 106,111 **** } ! Texture2D *tex2D = new Texture2D(shared_static_cast<TextureServer> ! (make_shared(GetSelf()))); tex2D->Create(image); shared_ptr<Texture> texture(tex2D); --- 82,86 ---- } ! Texture2D *tex2D = new Texture2D(); tex2D->Create(image); shared_ptr<Texture> texture(tex2D); Index: textureserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/textureserver.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** textureserver.h 5 Dec 2005 21:38:23 -0000 1.1 --- textureserver.h 16 Feb 2007 15:40:53 -0000 1.1.2.1 *************** *** 44,47 **** --- 44,49 ---- #include <zeitgeist/class.h> #include <zeitgeist/leaf.h> + #include <kerosin/openglserver/openglserver.h> + #include <kerosin/imageserver/imageserver.h> #if HAVE_HASH_MAP *************** *** 57,62 **** #endif - class OpenGLServer; - class ImageServer; class Texture; --- 59,62 ---- *************** *** 91,106 **** virtual void OnLink(); - /** reset OpenGLServer and ImageServer reference */ - virtual void OnUnlink(); - // // members // private: - /** reference to the OpenGLServer */ - boost::shared_ptr<OpenGLServer> mOpenGLServer; - /** reference to the ImageServer */ ! boost::shared_ptr<ImageServer> mImageServer; /** registry of cached textures */ --- 91,100 ---- virtual void OnLink(); // // members // private: /** reference to the ImageServer */ ! CachedPath<ImageServer> mImageServer; /** registry of cached textures */ Index: texture.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/texture.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** texture.cpp 5 Dec 2005 21:38:23 -0000 1.1 --- texture.cpp 16 Feb 2007 15:40:49 -0000 1.1.2.1 *************** *** 1,2 **** --- 1,23 ---- + /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #include "texture.h" #include "../openglserver/openglserver.h" *************** *** 5,10 **** using namespace kerosin; ! Texture::Texture(const boost::shared_ptr<TextureServer> &textureServer) : ! mTexID(0), mWidth(0), mHeight(0), mTextureServer(textureServer) { } --- 26,31 ---- using namespace kerosin; ! Texture::Texture() ! : mTexID(0), mWidth(0), mHeight(0) { } *************** *** 12,45 **** Texture::~Texture() { ! Reset(); } void Texture::Reset() { ! if (mTexID) ! { ! glDeleteTextures(1, &mTexID); ! mTexID = 0; ! } } void Texture::Acquire() { ! Reset(); ! glGenTextures(1, &mTexID); } unsigned int Texture::GetWidth() const { ! return mWidth; } unsigned int Texture::GetHeight() const { ! return mHeight; ! } ! ! boost::shared_ptr<TextureServer> Texture::GetTextureServer() const ! { ! return make_shared(mTextureServer); } --- 33,63 ---- Texture::~Texture() { ! Reset(); } void Texture::Reset() { ! if (! mTexID) ! { ! return; ! } ! ! glDeleteTextures(1, &mTexID); ! mTexID = 0; } void Texture::Acquire() { ! Reset(); ! glGenTextures(1, &mTexID); } unsigned int Texture::GetWidth() const { ! return mWidth; } unsigned int Texture::GetHeight() const { ! return mHeight; } Index: texture2d.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/texture2d.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** texture2d.h 5 Dec 2005 21:38:23 -0000 1.1 --- texture2d.h 16 Feb 2007 15:40:52 -0000 1.1.2.1 *************** *** 36,48 **** // public: ! Texture2D(const boost::shared_ptr<TextureServer> &textureServer); ~Texture2D(); ! //! bind the texture contained in this object to the corresponding target (user code is responsible for setting correct enables and tex units) virtual void Bind() const; ! //! enable the target associated with a texture type (e.g. GL_TEXTURE_2D) virtual void Enable() const; ! //! disable the target associated with a texture type (e.g. GL_TEXTURE_2D) virtual void Disable() const; virtual void Clamp() const; virtual void ClampToEdge() const; --- 36,58 ---- // public: ! Texture2D(); ~Texture2D(); ! /** bind the texture contained in this object to the corresponding ! target (user code is responsible for setting correct enables ! and tex units) ! */ virtual void Bind() const; ! ! /** enable the target associated with a texture type ! (e.g. GL_TEXTURE_2D) ! */ virtual void Enable() const; ! ! /** disable the target associated with a texture type ! (e.g. GL_TEXTURE_2D) ! */ virtual void Disable() const; + virtual void Clamp() const; virtual void ClampToEdge() const; Index: texture.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/textureserver/texture.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** texture.h 5 Dec 2005 21:38:23 -0000 1.1 --- texture.h 16 Feb 2007 15:40:49 -0000 1.1.2.1 *************** *** 57,61 **** // public: ! Texture(const boost::shared_ptr<TextureServer> &textureServer); virtual ~Texture(); --- 57,61 ---- // public: ! Texture(); virtual ~Texture(); *************** *** 66,75 **** void Acquire(); ! //! bind the texture contained in this object to the corresponding target (user code is responsible for setting correct enables and tex units) virtual void Bind() const = 0; ! //! enable the target associated with a texture type (e.g. GL_TEXTURE_2D) virtual void Enable() const = 0; ! //! disable the target associated with a texture type (e.g. GL_TEXTURE_2D) virtual void Disable() const = 0; virtual void Clamp() const = 0; virtual void ClampToEdge() const = 0; --- 66,85 ---- void Acquire(); ! /** bind the texture contained in this object to the corresponding ! target (user code is responsible for setting correct enables ! and tex units) ! */ virtual void Bind() const = 0; ! ! /** enable the target associated with a texture type ! (e.g. GL_TEXTURE_2D) ! */ virtual void Enable() const = 0; ! ! /** disable the target associated with a texture type ! (e.g. GL_TEXTURE_2D) ! */ virtual void Disable() const = 0; + virtual void Clamp() const = 0; virtual void ClampToEdge() const = 0; *************** *** 80,93 **** unsigned int GetHeight() const; - boost::shared_ptr<TextureServer> GetTextureServer() const; // // members // protected: ! unsigned int mTexID; // OpenGL texture handle (initialized to 0) ! unsigned int mWidth; // width of texture ! unsigned int mHeight; // height of texture ! private: ! boost::weak_ptr<TextureServer> mTextureServer; // texture server, which created this object }; --- 90,105 ---- unsigned int GetHeight() const; // // members // protected: ! //! OpenGL texture handle ! unsigned int mTexID; ! ! //! width of texture ! unsigned int mWidth; ! ! //! height of texture ! unsigned int mHeight; }; |
From: Markus R. <rol...@us...> - 2007-02-16 15:39:29
|
Update of /cvsroot/simspark/simspark/spark/zeitgeist In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23540 Modified Files: Tag: WIN32 node.cpp Log Message: - fix UpdateCached() Index: node.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/zeitgeist/node.cpp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** node.cpp 15 Feb 2007 20:53:33 -0000 1.1.2.1 --- node.cpp 16 Feb 2007 15:39:23 -0000 1.1.2.2 *************** *** 273,276 **** --- 273,278 ---- Node::UpdateCached() { + Leaf::UpdateCached(); + // update all Leaves found for (TLeafList::iterator iter = begin(); |
From: Markus R. <rol...@us...> - 2007-02-16 15:38:51
|
Update of /cvsroot/simspark/simspark/spark/zeitgeist In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22972 Modified Files: Tag: WIN32 leaf.cpp leaf.h Log Message: - implement a registry of path references that each node caches. The references are updated from UpdateCached() Index: leaf.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/zeitgeist/leaf.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** leaf.cpp 5 Dec 2005 20:59:18 -0000 1.1 --- leaf.cpp 16 Feb 2007 15:38:42 -0000 1.1.2.1 *************** *** 168,175 **** } ! void Leaf::ClearCachedData() const { delete mCachedFullPath; mCachedFullPath = NULL; } --- 168,176 ---- } ! void Leaf::ClearCachedData() { delete mCachedFullPath; mCachedFullPath = NULL; + mCachedPaths.clear(); } *************** *** 242,243 **** --- 243,269 ---- { } + + void Leaf::UpdateCached() + { + shared_ptr<Core> core(GetCore()); + + for ( + TCachedPathSet::iterator iter = mCachedPaths.begin(); + iter != mCachedPaths.end(); + ++iter + ) + { + (*iter)->Update(core); + } + } + + void Leaf::RegisterCachedPath(Core::CachedLeafPath& path, const std::string& pathStr) + { + path.Cache(GetCore(), pathStr); + mCachedPaths.insert(&path); + } + + void Leaf::RegisterCachedPath(Core::CachedLeafPath& path) + { + mCachedPaths.insert(&path); + } Index: leaf.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/zeitgeist/leaf.h,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** leaf.h 5 Dec 2005 20:59:18 -0000 1.1 --- leaf.h 16 Feb 2007 15:38:43 -0000 1.1.2.1 *************** *** 38,42 **** #define ZEITGEIST_LEAF_H ! #include <list> #include <string> #include "object.h" --- 38,42 ---- #define ZEITGEIST_LEAF_H ! #include <set> #include <string> #include "object.h" *************** *** 55,59 **** --- 55,65 ---- // public: + template <typename _CLASS> + struct CachedPath : public Core::CachedPath<_CLASS> + { + }; + typedef std::list< boost::shared_ptr<Leaf> > TLeafList; + typedef std::set<Core::CachedLeafPath*> TCachedPathSet; // *************** *** 229,234 **** virtual void Dump() const; /** update variables from a script */ ! virtual void UpdateCached() {} /** constructs the full path of this node by walking up the --- 235,246 ---- virtual void Dump() const; + /** update and register a path reference */ + void RegisterCachedPath(Core::CachedLeafPath& path, const std::string& pathStr); + + /** register a path reference */ + void Leaf::RegisterCachedPath(Core::CachedLeafPath& path); + /** update variables from a script */ ! virtual void UpdateCached(); /** constructs the full path of this node by walking up the *************** *** 239,243 **** /** clears any cached data (e.g. the cached full path and forces the node to recalculate all values */ ! void ClearCachedData() const; /** sets the name of this node */ --- 251,255 ---- /** clears any cached data (e.g. the cached full path and forces the node to recalculate all values */ ! void ClearCachedData(); /** sets the name of this node */ *************** *** 290,294 **** which can hold children. We use a weak pointer to break the cyclic dependency. */ ! boost::weak_ptr<Node> mParent; private: --- 302,306 ---- which can hold children. We use a weak pointer to break the cyclic dependency. */ ! boost::weak_ptr<Node> mParent; private: *************** *** 298,301 **** --- 310,316 ---- /** temporary cached full path of this node in the hierarchy */ mutable std::string *mCachedFullPath; + + /** list of cached path references to other nodes */ + TCachedPathSet mCachedPaths; }; |
From: Markus R. <rol...@us...> - 2007-02-16 15:36:56
|
Update of /cvsroot/simspark/simspark/spark/zeitgeist In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21907 Modified Files: Tag: WIN32 core.cpp core.h Log Message: - added class Core::CachedPath that implements a pointer that carries along a path string and is therefore able to refresh the managed reference incase the object pointed to is replaced or removed. Index: core.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/zeitgeist/core.cpp,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -C2 -d -r1.2.2.2 -r1.2.2.3 *** core.cpp 12 Feb 2007 23:52:04 -0000 1.2.2.2 --- core.cpp 16 Feb 2007 15:36:51 -0000 1.2.2.3 *************** *** 334,343 **** } ! boost::shared_ptr<Leaf> Core::GetInternal(const std::string &pathStr, ! const boost::shared_ptr<Leaf>& leaf) { ! // lookup the path in the internal cache ! CacheKey key(leaf, pathStr); ! TPathCache::iterator iter = mPathCache.find(key); if (iter != mPathCache.end()) --- 334,340 ---- } ! boost::weak_ptr<Leaf> Core::GetCachedInternal(const CacheKey& key) { ! // lookup the key in the internal cache TPathCache::iterator iter = mPathCache.find(key); if (iter != mPathCache.end()) *************** *** 346,351 **** if (! entry.expired()) { ! return entry.lock(); ! } // remove entry as it points to an expired node --- 343,348 ---- if (! entry.expired()) { ! return entry; ! } // remove entry as it points to an expired node *************** *** 353,369 **** } // walk the hierarchy ! Path path(pathStr); ! boost::shared_ptr<Leaf> current; if ( (path.IsAbsolute()) || ! (leaf.get() == NULL) ) { ! current= mRoot; } else { ! current = leaf; } --- 350,384 ---- } + return shared_ptr<Leaf>(); + } + + void Core::PutCachedInternal(const CacheKey& key, const boost::weak_ptr<Leaf>& leaf) + { + // update cache; note that we can't cache the fact, that a node is + // not present as it may be created later on + + if (leaf.expired()) + { + return; + } + + mPathCache[key] = leaf; + } + + boost::shared_ptr<Leaf> Core::GetUncachedInternal(const CacheKey& key) + { // walk the hierarchy ! shared_ptr<Leaf> current; ! Path path(key.path); if ( (path.IsAbsolute()) || ! (key.root.expired()) ) { ! current = mRoot; } else { ! current = key.root.lock(); } *************** *** 378,389 **** } ! // update cache; note that we can't cache the fact, that a node is ! // not present as it may be created later on ! if (current.get() != 0) { ! mPathCache[key] = current; } ! return current; } --- 393,415 ---- } ! // update cache ! PutCachedInternal(key, current); ! ! return current; ! } ! ! boost::shared_ptr<Leaf> Core::GetInternal(const std::string &pathStr, ! const boost::shared_ptr<Leaf>& leaf) ! { ! // lookup the path in the internal cache ! CacheKey key(leaf, pathStr); ! ! boost::weak_ptr<Leaf> cached(GetCachedInternal(key)); ! if (! cached.expired()) { ! return cached.lock(); } ! return GetUncachedInternal(key); } Index: core.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/zeitgeist/core.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** core.h 10 Mar 2006 00:16:06 -0000 1.2 --- core.h 16 Feb 2007 15:36:51 -0000 1.2.2.1 *************** *** 26,29 **** --- 26,30 ---- #include <list> #include <map> + #include <set> #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> *************** *** 55,59 **** class Core { ! protected: // // types --- 56,60 ---- class Core { ! public: // // types *************** *** 73,81 **** public: ! CacheKey(boost::weak_ptr<Leaf> r, const std::string& p) : root(r), path(p) {}; bool operator == (const CacheKey& key) const; bool operator < (const CacheKey& key) const; }; /** TPathCache defines a mapping from a CacheKey to a weak reference of the corresponding Leaf --- 74,179 ---- public: ! CacheKey() ! {} ! ! CacheKey(boost::weak_ptr<Leaf> r, const std::string& p) : root(r), path(p) ! {}; ! bool operator == (const CacheKey& key) const; bool operator < (const CacheKey& key) const; }; + /** CachedLeafPath defines a pair of path key and it's + corresponding weak reference. It acts like a smart pointer + that is able to update the keep the managed reference up to + date with the help of the core and the CacheKey + */ + struct CachedLeafPath + { + protected: + CacheKey key; + boost::weak_ptr<Leaf> leaf; + + public: + const CacheKey& GetKey() + { return key; } + + boost::weak_ptr<Leaf>& GetLeaf() + { return leaf; } + + virtual void Cache(boost::shared_ptr<Core> core, const std::string& pathStr) = 0; + virtual void Update(boost::shared_ptr<Core> core) = 0; + + bool operator == (const CachedLeafPath& p) + { + return (key == p.key); + } + + bool operator < (const CachedLeafPath& p) + { + return (key < p.key); + } + + bool expired() + { + return leaf.expired(); + } + }; + + template<typename _CLASS> + struct CachedPath : public CachedLeafPath + { + public: + CachedPath() : CachedLeafPath() + {} + + CachedPath(const CacheKey& k, const boost::weak_ptr<_CLASS> &l) + : CachedLeafPath(k,l) + {} + + virtual void Cache(boost::shared_ptr<Core> core, const std::string& pathStr) + { + if (core.get() == NULL) + { + leaf.reset(); + return; + } + + key = CacheKey(core->mRoot, pathStr); + Update(core); + } + + virtual void Update(boost::shared_ptr<Core> core) + { + if (core.get() == NULL) + { + leaf.reset(); + return; + } + + // lookup the path in the internal core cache + boost::weak_ptr<Leaf> lookup = core->GetCachedInternal(key); + if (! lookup.expired()) + { + leaf = boost::shared_dynamic_cast<_CLASS>(lookup.lock()); + return; + } + + leaf = boost::shared_dynamic_cast<_CLASS> + (core->GetUncachedInternal(key)); + } + + boost::shared_ptr<_CLASS> get() + { + return boost::shared_static_cast<_CLASS>(leaf.lock()); + } + + _CLASS* operator -> () + { + return boost::shared_static_cast<_CLASS>(leaf.lock()).get(); + } + }; + + protected: /** TPathCache defines a mapping from a CacheKey to a weak reference of the corresponding Leaf *************** *** 141,145 **** boost::shared_ptr<Leaf> GetRoot() const { return mRoot; } ! /** returns a reference to the object denoted by the path expression 'pathStr'. */ boost::shared_ptr<Leaf> Get(const std::string &pathStr); --- 239,245 ---- boost::shared_ptr<Leaf> GetRoot() const { return mRoot; } ! /** returns a reference to the object denoted by the path ! expression 'pathStr'. ! */ boost::shared_ptr<Leaf> Get(const std::string &pathStr); *************** *** 175,178 **** --- 275,296 ---- protected: + /** returns a cached reference to the Leaf corresponding to the + given key. If the cached reference expired the entry is + removed from the cache + */ + boost::weak_ptr<Leaf> GetCachedInternal(const CacheKey& key); + + /** returns a reference to the object denoted by the path + expression 'pathStr', relative to the node base. This method + does not lookup for a cached reference but does update the + cache accordingly + */ + boost::shared_ptr<Leaf> GetUncachedInternal(const CacheKey& key); + + /** checks that the leaf reference isn't expired and inserts the + given key,leaf pair into the cache + */ + void PutCachedInternal(const CacheKey& key, const boost::weak_ptr<Leaf>& leaf); + /** returns a reference to the object denoted by the path expression 'pathStr', relative to the node base. |
From: Markus R. <rol...@us...> - 2007-02-15 21:17:07
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31026 Modified Files: Tag: WIN32 rsgedit.wxg Log Message: - add file open menu command to gui Index: rsgedit.wxg =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.wxg,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** rsgedit.wxg 15 Feb 2007 10:57:28 -0000 1.4.2.1 --- rsgedit.wxg 15 Feb 2007 21:17:01 -0000 1.4.2.2 *************** *** 1,4 **** <?xml version="1.0"?> ! <!-- generated by wxGlade 0.4.1 on Thu Feb 15 10:38:44 2007 --> <application path="." name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6"> --- 1,4 ---- <?xml version="1.0"?> ! <!-- generated by wxGlade 0.4.1 on Thu Feb 15 22:16:15 2007 --> <application path="." name="" class="" option="1" language="C++" top_window="MainFrame" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.6"> *************** *** 13,16 **** --- 13,20 ---- <menu name="" label="&File"> <item> + <label>&Open</label> + <id>ID_FILE_OPEN</id> + </item> + <item> <label>&Exit</label> <id>wxID_EXIT</id> |
From: Markus R. <rol...@us...> - 2007-02-15 21:14:49
|
Update of /cvsroot/simspark/simspark/spark/win32 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30118 Modified Files: Tag: WIN32 simspark.iss Log Message: - include simulation setup scripts Index: simspark.iss =================================================================== RCS file: /cvsroot/simspark/simspark/spark/win32/Attic/simspark.iss,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** simspark.iss 15 Feb 2007 09:51:54 -0000 1.1.2.2 --- simspark.iss 15 Feb 2007 21:14:44 -0000 1.1.2.3 *************** *** 17,20 **** --- 17,21 ---- #define MyKerosinDir "..\kerosin" #define MySparkDir "..\spark" + #define MyRsgDir "..\..\simulations\parts\rsg" [Setup] *************** *** 60,64 **** ; rsg files ! Source: C:\develop\x\simspark\simulations\parts\rsg\*.rsg; DestDir: {app}\rsg; Flags: recursesubdirs ; support dlls --- 61,66 ---- ; rsg files ! Source: {#MyRsgDir}\*.rsg; DestDir: {app}\rsg; Flags: recursesubdirs ! Source: {#MyRsgDir}\*.rb; DestDir: {app}\rsg; Flags: recursesubdirs ; support dlls |
From: Markus R. <rol...@us...> - 2007-02-15 21:14:49
|
Update of /cvsroot/simspark/simspark/simulations/parts/rsg In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30104 Added Files: Tag: WIN32 boxspheres.rb jointtest.rb Log Message: - added simulation specific startup script for rsgedit --- NEW FILE: boxspheres.rb --- # create an arena to test simple boxes and spheres scene = get($scenePath) scene.importScene('rsg/boxspheres/simspark.rsg') --- NEW FILE: jointtest.rb --- # create an arena to test various joint bodies scene = get($scenePath) scene.importScene('rsg/jointtest/simspark.rsg') |
From: Markus R. <rol...@us...> - 2007-02-15 21:10:05
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27778 Modified Files: Tag: WIN32 rsgedit.rb Log Message: - don't setup a default simulation just setup spark (simulations are now opened through rsgedit) Index: rsgedit.rb =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.rb,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** rsgedit.rb 10 Feb 2007 19:01:54 -0000 1.4.2.1 --- rsgedit.rb 15 Feb 2007 21:09:58 -0000 1.4.2.2 *************** *** 2,5 **** --- 2,20 ---- # rsgedit.rb # + + def rsgeditResetScene + # let spark create a default camera + sparkAddFPSCamera( + $scenePath+'camera', + x = -5, + y = -40, + z = 2, + maxSpeed = 15.0, + accel = 400.0, + drag = 4, + addCollider = false + ) + end + # sparkLogAllToCerr() sparkSetupServer() *************** *** 13,27 **** sparkSetupInput('InputSystemWX') ! # let spark create a default camera ! sparkAddFPSCamera( ! $scenePath+'camera', ! x = -5, ! y = -40, ! z = 2, ! maxSpeed = 15.0, ! accel = 400.0, ! drag = 4, ! addCollider = false ! ) # setup default input bindings --- 28,33 ---- sparkSetupInput('InputSystemWX') ! # prepare a default scene ! rsgeditResetScene() # setup default input bindings *************** *** 55,68 **** material.setDiffuse(0.1,0.1,0.1,1.0) - # - # uncomment any of the following to run a simulation - # - - # scene = get($scenePath) - # scene = get($scenePath) - # scene.importScene('rsg/boxspheres/simspark.rsg') - - # create an arena to test various joint bodies - scene = get($scenePath) - scene.importScene('rsg/jointtest/simspark.rsg') --- 61,63 ---- |
From: Markus R. <rol...@us...> - 2007-02-15 21:08:08
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26874 Modified Files: Tag: WIN32 mainframe.cpp mainframe.h simspark.cpp simspark.h sparkglcanvas.cpp sparkglcanvas.h Added Files: Tag: WIN32 constants.h Log Message: - added the ability to open simulations at runtime --- NEW FILE: constants.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of rcssserver3D Fri May 9 2003 Copyright (C) 2003 Koblenz University $Id: constants.h,v 1.1.2.1 2007/02/15 21:08:00 rollmark Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef RSGEDIT_CONSTANTS_H #define RSGEDIT_CONSTANTS_H enum ESimState { S_PAUSED, S_RUNNING }; #endif // RSGEDIT_CONSTANTS_H Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.7.2.2 retrieving revision 1.7.2.3 diff -C2 -d -r1.7.2.2 -r1.7.2.3 *** mainframe.h 15 Feb 2007 10:57:27 -0000 1.7.2.2 --- mainframe.h 15 Feb 2007 21:07:59 -0000 1.7.2.3 *************** *** 25,28 **** --- 25,29 ---- #include <wx/wx.h> #include <wx/image.h> + #include "constants.h" #include "sparktree.h" #include "propertylist.h" *************** *** 33,36 **** --- 34,42 ---- class SparkGLCanvas; + namespace oxygen + { + class SimulationServer; + } + // begin wxGlade: ::dependencies #include <wx/splitter.h> *************** *** 46,49 **** --- 52,57 ---- #define ID_VIEW_TOOLBAR (wxID_HIGHEST+22) + #define ID_FILE_OPEN (wxID_HIGHEST+23) + class mainframe: public wxFrame { public: *************** *** 67,70 **** --- 75,90 ---- void PauseSimulation(); + /** pause and reset the running simulation */ + void ResetSimulation(); + + /** go through one simulation cycle with the given time step */ + void AdvanceSimulation(boost::shared_ptr<oxygen::SimulationServer>& sim, float tDeltaSec); + + /** prepare to start the simulation */ + void InitSimulation(boost::shared_ptr<oxygen::SimulationServer>& sim); + + /** shut down the simulation */ + void DoneSimulation(boost::shared_ptr<oxygen::SimulationServer>& sim); + void OnUpdateStartSimulation(wxUpdateUIEvent& event); void OnStartSimulation(wxCommandEvent& event); *************** *** 79,82 **** --- 99,105 ---- void OnUpdateViewLog(wxUpdateUIEvent& event); + void OnFileOpen(wxCommandEvent& event); + void OnUpdateFileOpen(wxUpdateUIEvent& event); + void OnExit(wxCommandEvent& event); void OnClose( wxCloseEvent& event ); *************** *** 86,93 **** /** appends the accumulated log buffer to the log window pane */ void UpdateLogWindow(); ! /** returns true iff its safe to close this frame now */ bool CanClose(); void InitTreeNodeProperties(); --- 109,119 ---- /** appends the accumulated log buffer to the log window pane */ void UpdateLogWindow(); ! /** returns true iff its safe to close this frame now */ bool CanClose(); + /** returns the current simulation state */ + ESimState GetSimState() const; + void InitTreeNodeProperties(); Index: sparkglcanvas.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkglcanvas.cpp,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** sparkglcanvas.cpp 10 Feb 2007 19:01:54 -0000 1.4.2.1 --- sparkglcanvas.cpp 15 Feb 2007 21:07:59 -0000 1.4.2.2 *************** *** 69,72 **** --- 69,77 ---- } + void SparkGLCanvas::Reset() + { + mInit = false; + } + void SparkGLCanvas::Render(wxDC& dc) { *************** *** 251,255 **** if ( (spark.get() == 0) || ! (spark->GetSimState() != SimSpark::S_RUNNING) ) { --- 256,260 ---- if ( (spark.get() == 0) || ! (spark->GetSimState() != S_RUNNING) ) { Index: simspark.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/simspark.cpp,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** simspark.cpp 9 Jan 2006 11:28:24 -0000 1.4 --- simspark.cpp 15 Feb 2007 21:07:59 -0000 1.4.2.1 *************** *** 21,24 **** --- 21,25 ---- #include <zeitgeist/scriptserver/scriptserver.h> #include <zeitgeist/logserver/logserver.h> + #include <oxygen/sceneserver/scene.h> #include <oxygen/simulationserver/simulationserver.h> *************** *** 26,29 **** --- 27,31 ---- using namespace boost; using namespace zeitgeist; + using namespace oxygen; using namespace spark; *************** *** 53,56 **** --- 55,70 ---- } + void SimSpark::ResetSimulation() + { + // recreat scene along with world and space nodes + GetScriptServer()->Eval("sparkResetScene()"); + + // recreate a default empty scene with a camera node + GetScriptServer()->Eval("rsgeditResetScene()"); + + // update stale references + GetScriptServer()->UpdateCachedAllNodes(); + } + void SimSpark::PrintHelp() { *************** *** 66,70 **** } ! SimSpark::ESimState SimSpark::GetSimState() const { return mState; --- 80,84 ---- } ! ESimState SimSpark::GetSimState() const { return mState; Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -C2 -d -r1.8.2.2 -r1.8.2.3 *** mainframe.cpp 15 Feb 2007 10:57:26 -0000 1.8.2.2 --- mainframe.cpp 15 Feb 2007 21:07:59 -0000 1.8.2.3 *************** *** 24,29 **** --- 24,32 ---- #include "propertyframe.h" + #include <wx/filedlg.h> + #include <rsgedit/res/xpm_play.xpm> #include <rsgedit/res/xpm_pause.xpm> + #include <rsgedit/res/xpm_open.xpm> //! wxWidgets and zeitgeist both use a 'DECLARE_CLASS' macro *************** *** 31,34 **** --- 34,38 ---- #include <zeitgeist/logserver/logserver.h> + #include <zeitgeist/scriptserver/scriptserver.h> #include <oxygen/simulationserver/simulationserver.h> #include <oxygen/sceneserver/sceneserver.h> *************** *** 52,55 **** --- 56,62 ---- EVT_UPDATE_UI(ID_VIEW_TREE, mainframe::OnUpdateViewTree) + EVT_MENU(ID_FILE_OPEN, mainframe::OnFileOpen) + EVT_UPDATE_UI(ID_FILE_OPEN, mainframe::OnUpdateFileOpen) + EVT_TIMER(1, mainframe::OnLogTimer) *************** *** 93,96 **** --- 100,104 ---- SetMenuBar(MainFrame_menubar); wxMenu* wxglade_tmp_menu_1 = new wxMenu(); + wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open"), wxT(""), wxITEM_NORMAL); wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("&Exit"), wxT(""), wxITEM_NORMAL); MainFrame_menubar->Append(wxglade_tmp_menu_1, wxT("&File")); *************** *** 116,119 **** --- 124,129 ---- mToolBar = CreateToolBar( wxTB_FLAT|wxTB_HORIZONTAL, wxID_ANY ); + mToolBar->AddTool(ID_FILE_OPEN, wxT("Open"), wxBitmap(xpm_open)); + mToolBar->AddSeparator(); mToolBar->AddTool(ID_SIM_START, wxT("Start"), wxBitmap(xpm_play)); mToolBar->AddTool(ID_SIM_PAUSE, wxT("Pause"), wxBitmap(xpm_pause)); *************** *** 228,231 **** --- 238,253 ---- } + ESimState mainframe::GetSimState() const + { + shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if (spark.get() == 0) + { + assert(false); + return S_PAUSED; + } + + return spark->GetSimState(); + } + bool mainframe::CanClose() { *************** *** 233,237 **** if ( (spark.get() != 0) && ! (spark->GetSimState() == SimSpark::S_RUNNING) ) { --- 255,259 ---- if ( (spark.get() != 0) && ! (spark->GetSimState() == S_RUNNING) ) { *************** *** 242,245 **** --- 264,268 ---- } + void mainframe::OnClose( wxCloseEvent& event ) { *************** *** 261,271 **** void mainframe::OnUpdateStartSimulation(wxUpdateUIEvent& event) { ! shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! bool enable = ( ! (spark.get() != 0) && ! (spark->GetSimState() == SimSpark::S_PAUSED) ! ); ! ! event.Enable(enable); } --- 284,288 ---- void mainframe::OnUpdateStartSimulation(wxUpdateUIEvent& event) { ! event.Enable(GetSimState() == S_PAUSED); } *************** *** 277,287 **** void mainframe::OnUpdatePauseSimulation(wxUpdateUIEvent& event) { ! shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! bool enable = ( ! (spark.get() != 0) && ! (spark->GetSimState() == SimSpark::S_RUNNING) ! ); ! ! event.Enable(enable); } --- 294,298 ---- void mainframe::OnUpdatePauseSimulation(wxUpdateUIEvent& event) { ! event.Enable(GetSimState() == S_RUNNING); } *************** *** 315,319 **** if ( (spark.get() == 0) || ! (spark->GetSimState() != SimSpark::S_RUNNING) ) { --- 326,330 ---- if ( (spark.get() == 0) || ! (spark->GetSimState() != S_RUNNING) ) { *************** *** 331,352 **** } ! void mainframe::StartSimulation() { shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); if ( (spark.get() == 0) || ! (spark->GetSimState() != SimSpark::S_PAUSED) ) { return; } ! shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); ! if (sim.get() == 0) ! { ! return; ! } ! spark->SetSimState(SimSpark::S_RUNNING); // tell the inputControl node the loaction of our camera --- 342,385 ---- } ! void mainframe::ResetSimulation() { + PauseSimulation(); shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if ( (spark.get() == 0) || ! (spark->GetSimState() != S_PAUSED) ) { + assert(false); return; } ! spark->ResetSimulation(); ! mCanvas->Reset(); ! spark->GetLog()->Normal() << "(RsgEdit) resetting simulation\n"; ! } ! void mainframe::AdvanceSimulation(shared_ptr<SimulationServer>& sim, float tDeltaSec) ! { ! // go through the next simulation cycle ! sim->AdvanceTime(tDeltaSec); ! sim->Cycle(); ! ! // refresh the display ! RefreshProperties(); ! ! wxClientDC dc(this); ! mCanvas->Render(dc); ! } ! ! void mainframe::InitSimulation(shared_ptr<SimulationServer>& sim) ! { ! shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); ! if (spark.get() == 0) ! { ! assert(false); ! return; ! } // tell the inputControl node the loaction of our camera *************** *** 361,364 **** --- 394,424 ---- sim->Init(0,0); sim->SetAutoTimeMode(false); + } + + void mainframe::DoneSimulation(shared_ptr<SimulationServer>& sim) + { + sim->Done(); + } + + void mainframe::StartSimulation() + { + shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if ( + (spark.get() == 0) || + (spark->GetSimState() != S_PAUSED) + ) + { + return; + } + + shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); + if (sim.get() == 0) + { + return; + } + + spark->SetSimState(S_RUNNING); + + InitSimulation(sim); spark->GetLog()->Normal() << "(RsgEdit) starting simulation\n"; *************** *** 374,386 **** tLast = tNow; ! // go through the next simulation cycle ! sim->AdvanceTime(tDeltaSec); ! sim->Cycle(); ! ! // refresh the display ! RefreshProperties(); ! ! wxClientDC dc(this); ! mCanvas->Render(dc); // pump the wxWidgets message loop --- 434,438 ---- tLast = tNow; ! AdvanceSimulation(sim, tDeltaSec); // pump the wxWidgets message loop *************** *** 388,393 **** } ! sim->Done(); ! spark->SetSimState(SimSpark::S_PAUSED); spark->GetLog()->Normal() << "(RsgEdit) simulation paused\n"; --- 440,446 ---- } ! DoneSimulation(sim); ! ! spark->SetSimState(S_PAUSED); spark->GetLog()->Normal() << "(RsgEdit) simulation paused\n"; *************** *** 486,487 **** --- 539,585 ---- } } + + void mainframe::OnUpdateFileOpen(wxUpdateUIEvent& event) + { + event.Enable(GetSimState() == S_PAUSED); + } + + void mainframe::OnFileOpen(wxCommandEvent& event) + { + wxString message = "Choose a ruby script to run"; + wxString default_path = "./rsg"; + wxString default_filename = ""; + wxString default_extension = ""; + wxString wildcard = "ruby scripts (*.rb)|*.rb"; + + wxString filename = wxFileSelector(message, default_path, default_filename, default_extension, wildcard); + if (filename.empty() ) + { + return; + } + + ResetSimulation(); + mSparkTree.Init(mCtrTree); + InitTreeNodeProperties(); + + shared_ptr<SimSpark> spark = wxGetApp().GetSpark(); + if (spark.get() == 0) + { + assert(false); + return; + } + + spark->GetScriptServer()->Run(filename.c_str()); + spark->GetLog()->Normal() << "(RsgEdit) reading " << filename << "\n"; + + shared_ptr<SimulationServer> sim = spark->GetSimulationServer(); + if (sim.get() == 0) + { + assert(false); + return; + } + + InitSimulation(sim); + AdvanceSimulation(sim, 0.01f); + DoneSimulation(sim); + } Index: sparkglcanvas.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkglcanvas.h,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** sparkglcanvas.h 10 Feb 2007 19:01:54 -0000 1.3.2.1 --- sparkglcanvas.h 15 Feb 2007 21:07:59 -0000 1.3.2.2 *************** *** 64,67 **** --- 64,68 ---- void Render(wxDC& dc); + void Reset(); protected: Index: simspark.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/simspark.h,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** simspark.h 8 Jan 2006 15:37:37 -0000 1.3 --- simspark.h 15 Feb 2007 21:07:59 -0000 1.3.2.1 *************** *** 23,26 **** --- 23,27 ---- #include <spark/spark.h> #include <wx/string.h> + #include "constants.h" #include <sstream> *************** *** 28,38 **** { public: - enum ESimState - { - S_PAUSED, - S_RUNNING - }; - - public: SimSpark(const std::string& relPathPrefix); --- 29,32 ---- *************** *** 52,55 **** --- 46,52 ---- ESimState GetSimState() const; + /** resets the simulation, i.e. empties the scene */ + void ResetSimulation(); + /** set the current simulationm state */ void SetSimState(ESimState state); |
From: Markus R. <rol...@us...> - 2007-02-15 21:08:04
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/res In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26874/res Added Files: Tag: WIN32 xpm_open.xpm Log Message: - added the ability to open simulations at runtime --- NEW FILE: xpm_open.xpm --- /* XPM */ static char *xpm_open[] = { /* columns rows colors chars-per-pixel */ "16 16 7 1", " c #040404", ". c #999900", "X c #CCCC66", "o c #FFCC99", "O c #FFFF99", "+ c gray100", "@ c None", /* pixels */ "@@@@@@@@@@@@@@@@", "@@@.....@@@@@@@@", "@@.+++++.@@@@@@@", "@.+OOOOO+......@", "@.+OOOOOOO++++X ", "@.+OOOOOOOOOOOX ", "............XOX ", ".+OOOOOOoOoX XX ", ".+OOOOoOOoOX XX ", "@.+OOOOOoOoo. . ", "@.+OOoOoOoooX . ", "@@.+oOoOooooX. ", "@@............ ", "@@@ ", "@@@@@@@@@@@@@@@@", "@@@@@@@@@@@@@@@@" }; |
From: Markus R. <rol...@us...> - 2007-02-15 21:06:30
|
Update of /cvsroot/simspark/simspark/spark/spark In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26440 Modified Files: Tag: WIN32 spark.rb Log Message: - add funtion sparkResetScene() that destroys and rebuilds the current scene, installls a new world and space node and takes care to invalidate all stale references Index: spark.rb =================================================================== RCS file: /cvsroot/simspark/simspark/spark/spark/spark.rb,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** spark.rb 15 Feb 2006 01:08:19 -0000 1.5 --- spark.rb 15 Feb 2007 21:06:21 -0000 1.5.2.1 *************** *** 44,47 **** --- 44,67 ---- # below is a set of utility functions for the user app # + + # rebuild scene and update all cached references + def sparkResetScene + scene = get($scenePath) + scene.unlinkChildren() + + # (re-)create world and space aspects + world = new('oxygen/World', $scenePath+'world') + world.setGravity(0.0, 0.0, -9.81) + new('oxygen/Space', $scenePath+'space') + + # invalidate all cached references + scriptServer = get($serverPath+'script') + scriptServer.updateCachedAllNodes() + + # force update references to scene objects (world, space etc.) + sceneServer = get($serverPath+'scene') + sceneServer.setActiveScene($scenePath) + end + def sparkSetupMonitor print "(spark.rb) sparkSetupMonitor\n" *************** *** 323,330 **** sceneServer.initSceneImporter("RosImporter"); ! # create world and space aspects ! world = new('oxygen/World', $scenePath+'world') ! world.setGravity(0.0, 0.0, -9.81) ! new('oxygen/Space', $scenePath+'space') # --- 343,348 ---- sceneServer.initSceneImporter("RosImporter"); ! # prepare scene ! sparkResetScene() # |
From: Markus R. <rol...@us...> - 2007-02-15 21:03:26
|
Update of /cvsroot/simspark/simspark/spark/spark In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25046 Modified Files: Tag: WIN32 spark.cpp Log Message: - ws change Index: spark.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/spark/spark.cpp,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** spark.cpp 8 Mar 2006 18:17:03 -0000 1.3 --- spark.cpp 15 Feb 2007 21:03:22 -0000 1.3.2.1 *************** *** 58,62 **** } ! bool Spark::Init(int argc, char** argv) { --- 58,62 ---- } ! bool Spark::Init(int argc, char** argv) { *************** *** 105,109 **** } ! bool Spark::InitApp(int /*argc*/, char** /*argv*/) { --- 105,109 ---- } ! bool Spark::InitApp(int /*argc*/, char** /*argv*/) { *************** *** 111,115 **** } ! Zeitgeist& Spark::GetZeitgeist() { --- 111,115 ---- } ! Zeitgeist& Spark::GetZeitgeist() { *************** *** 117,121 **** } ! shared_ptr<Core> Spark::GetCore() { --- 117,121 ---- } ! shared_ptr<Core> Spark::GetCore() { *************** *** 123,127 **** } ! shared_ptr<zeitgeist::LogServer> Spark::GetLog() { --- 123,127 ---- } ! shared_ptr<zeitgeist::LogServer> Spark::GetLog() { *************** *** 129,133 **** } ! shared_ptr<SceneServer> Spark::GetSceneServer() { --- 129,133 ---- } ! shared_ptr<SceneServer> Spark::GetSceneServer() { *************** *** 135,139 **** } ! shared_ptr<SimulationServer> Spark::GetSimulationServer() { --- 135,139 ---- } ! shared_ptr<SimulationServer> Spark::GetSimulationServer() { *************** *** 142,146 **** #if HAVE_KEROSIN_H ! shared_ptr<InputControl> Spark::GetInputControl() { --- 142,146 ---- #if HAVE_KEROSIN_H ! shared_ptr<InputControl> Spark::GetInputControl() { *************** *** 154,158 **** } ! shared_ptr<InputServer> Spark::GetInputServer() { --- 154,158 ---- } ! shared_ptr<InputServer> Spark::GetInputServer() { *************** *** 161,165 **** } ! shared_ptr<RenderControl> Spark::GetRenderControl() { --- 161,165 ---- } ! shared_ptr<RenderControl> Spark::GetRenderControl() { *************** *** 174,178 **** #endif // HAVE_KEROSIN_H ! shared_ptr<ScriptServer> Spark::GetScriptServer() { --- 174,178 ---- #endif // HAVE_KEROSIN_H ! shared_ptr<ScriptServer> Spark::GetScriptServer() { *************** *** 180,184 **** } ! shared_ptr<Scene> Spark::GetActiveScene() { --- 180,184 ---- } ! shared_ptr<Scene> Spark::GetActiveScene() { *************** *** 187,191 **** if (scene.get() == 0) { ! mLogServer->Warning() << "(Spark) Warning: no active scene registered\n"; } --- 187,191 ---- if (scene.get() == 0) { ! mLogServer->Warning() << "(Spark) Warning: no active scene registered\n"; } |