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: Oliver O. <fr...@us...> - 2007-07-24 00:57:30
|
Update of /cvsroot/simspark/simspark/spark/utility/ois/linux In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12593/linux Log Message: Directory /cvsroot/simspark/simspark/spark/utility/ois/linux added to the repository --> Using per-directory sticky tag `projectx' |
From: Oliver O. <fr...@us...> - 2007-07-24 00:57:30
|
Update of /cvsroot/simspark/simspark/spark/utility/ois/SDL In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12620/SDL Log Message: Directory /cvsroot/simspark/simspark/spark/utility/ois/SDL added to the repository --> Using per-directory sticky tag `projectx' |
From: Oliver O. <fr...@us...> - 2007-07-24 00:57:09
|
Update of /cvsroot/simspark/simspark/spark/utility/ois/win32 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12593/win32 Log Message: Directory /cvsroot/simspark/simspark/spark/utility/ois/win32 added to the repository --> Using per-directory sticky tag `projectx' |
From: Oliver O. <fr...@us...> - 2007-07-24 00:56:12
|
Update of /cvsroot/simspark/simspark/spark/utility/ois In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv11849/ois Log Message: Directory /cvsroot/simspark/simspark/spark/utility/ois added to the repository --> Using per-directory sticky tag `projectx' |
From: Oliver O. <fr...@us...> - 2007-07-19 01:41:11
|
Update of /cvsroot/simspark/simspark/spark/plugin/rubysceneimporter In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21870 Modified Files: Tag: projectx rubysceneimporter.cpp Log Message: added abbrevs. from rcssserver3D Index: rubysceneimporter.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/rubysceneimporter/rubysceneimporter.cpp,v retrieving revision 1.2.2.3.2.1 retrieving revision 1.2.2.3.2.2 diff -C2 -d -r1.2.2.3.2.1 -r1.2.2.3.2.2 *** rubysceneimporter.cpp 17 Jun 2007 12:03:00 -0000 1.2.2.3.2.1 --- rubysceneimporter.cpp 19 Jul 2007 01:41:05 -0000 1.2.2.3.2.2 *************** *** 104,107 **** --- 104,112 ---- mTranslationTable["RSG"] = S_SCENEGRAPH; mTranslationTable["SLT"] = "setLocalTransform"; + mTranslationTable["sSc"] = "setScale"; + mTranslationTable["sMat"] = "setMaterial"; + mTranslationTable["BN"] = "BaseNode"; + mTranslationTable["SMN"] = "SingleMatNode"; + mTranslationTable["TRF"] = "Transform"; } |
Update of /cvsroot/simspark/simspark/spark/plugin/sparkmonitor In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26634 Modified Files: Tag: projectx Makefile.am export.cpp Added Files: Tag: projectx sparkmonitorlogfileserver.cpp sparkmonitorlogfileserver.h sparkmonitorlogfileserver_c.cpp Log Message: added sparkmonitorlogfileserver --- NEW FILE: sparkmonitorlogfileserver_c.cpp --- /* -*- 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: sparkmonitorlogfileserver_c.cpp,v 1.1.2.1 2007/07/18 23:08:50 fruit 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. */ #include "sparkmonitorlogfileserver.h" using namespace std; using namespace oxygen; FUNCTION(SparkMonitorLogFileServer, setFileName) { string inName; if ( (in.GetSize() != 1) || (! in.GetValue(in[0], inName)) ) { return false; } obj->SetFileName(inName); return true; } FUNCTION(SparkMonitorLogFileServer, setStepDelay) { int inDelay; if ( (in.GetSize() != 1) || (! in.GetValue(in[0], inDelay)) ) { return false; } obj->SetStepDelay(inDelay); return true; } FUNCTION(SparkMonitorLogFileServer, pauseMode) { if (in.GetSize() != 0) { return false; } obj->Pause(); return true; } FUNCTION(SparkMonitorLogFileServer, stepForward) { if (in.GetSize() != 0) { return false; } obj->ForwardStep(); return true; } FUNCTION(SparkMonitorLogFileServer, stepBackward) { if (in.GetSize() != 0) { return false; } obj->BackwardStep(); return true; } FUNCTION(SparkMonitorLogFileServer, playBackward) { if (in.GetSize() != 0) { return false; } obj->BackwardPlayback(); return true; } void CLASS(SparkMonitorLogFileServer)::DefineClass() { DEFINE_BASECLASS(oxygen/SimControlNode); DEFINE_FUNCTION(setFileName); DEFINE_FUNCTION(pauseMode); DEFINE_FUNCTION(stepForward); DEFINE_FUNCTION(stepBackward); DEFINE_FUNCTION(playBackward); DEFINE_FUNCTION(setStepDelay); } --- NEW FILE: sparkmonitorlogfileserver.h --- /* -*- 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 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 SPARK_SPARKMONITORLOGFILESERVER_H #define SPARK_SPARKMONITORLOGFILESERVER_H #include <sfsexp/sexp.h> #include <zeitgeist/class.h> #include <oxygen/simulationserver/simcontrolnode.h> #include <oxygen/sceneserver/sceneserver.h> #include <oxygen/sceneserver/scene.h> #include <oxygen/sceneserver/sceneimporter.h> #include <oxygen/gamecontrolserver/predicate.h> #include <fstream> #include <stack> class SparkMonitorLogFileServer : public oxygen::SimControlNode { public: SparkMonitorLogFileServer(); virtual ~SparkMonitorLogFileServer(); /** called once when the simulation is started */ virtual void InitSimulation(); /** called once before the simulation is shut down */ virtual void DoneSimulation(); /** called when a new simulation cycle starts, before the simulation is stepped */ virtual void StartCycle(); /** set the log file name */ void SetFileName(std::string fileName){ mLogfileName = fileName; } /** pause the log player */ void Pause(){ mPause = !mPause; } /** go to the next step */ void ForwardStep(){ mForwardStep = true; } /** go to the previous step */ void BackwardStep(); /** backward play the log file back */ void BackwardPlayback(); /** set the length of delay between steps */ void SetStepDelay(int delay){ mStepDelay = delay; } protected: /** parses a received message */ void ParseMessage(const std::string& msg); void ParseCustomPredicates(sexp_t* sexp, oxygen::PredicateList& pList); /** parses the given s-expression into a ParameterList and transfers it to a registered user monitor */ void ParseCustomPredicates(sexp_t* sexp); virtual void OnLink(); virtual void OnUnlink(); protected: /** cached reference to the SceneServer */ boost::shared_ptr<oxygen::SceneServer> mSceneServer; /** cached reference to the current active scene */ boost::shared_ptr<oxygen::Scene> mActiveScene; /** chached reference to the scene importer */ boost::shared_ptr<oxygen::SceneImporter> mSceneImporter; /** the root node of the managed scene */ boost::shared_ptr<oxygen::BaseNode> mManagedScene; /** the logfile name */ std::string mLogfileName; /** the logfile */ std::ifstream mLog; /** the pause state of the log player */ bool mPause; /** go to the next step in the log file */ bool mForwardStep; /** line numbers storage */ std::stack<unsigned> linePositions; /** the length of delay between seteps */ int mStepDelay; bool mBackwardPlayback; /** cached reference to the script server */ boost::shared_ptr<zeitgeist::ScriptServer> mScriptServer; }; DECLARE_CLASS(SparkMonitorLogFileServer); #endif // SPARKMONITORLOGFILESERVER_H Index: Makefile.am =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/sparkmonitor/Makefile.am,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** Makefile.am 13 Dec 2005 21:48:50 -0000 1.1 --- Makefile.am 18 Jul 2007 23:08:50 -0000 1.1.4.1 *************** *** 8,12 **** sparkmonitorclient.h \ sparkmonitorclient.cpp \ ! sparkmonitorclient_c.cpp sparkmonitor_la_LDFLAGS = -module -version-info 0:0:0 -L${top_srcdir}/utility/sfsexp/ --- 8,15 ---- sparkmonitorclient.h \ sparkmonitorclient.cpp \ ! sparkmonitorclient_c.cpp \ ! sparkmonitorlogfileserver.h \ ! sparkmonitorlogfileserver.cpp \ ! sparkmonitorlogfileserver_c.cpp sparkmonitor_la_LDFLAGS = -module -version-info 0:0:0 -L${top_srcdir}/utility/sfsexp/ --- NEW FILE: sparkmonitorlogfileserver.cpp --- /* -*- 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 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 "sparkmonitorlogfileserver.h" #include <oxygen/monitorserver/custommonitor.h> #include <zeitgeist/logserver/logserver.h> #include <zeitgeist/scriptserver/scriptserver.h> #include <netinet/in.h> #include <rcssnet/exception.hpp> #include <cerrno> using namespace oxygen; using namespace zeitgeist; using namespace rcss::net; using namespace salt; using namespace boost; using namespace std; SparkMonitorLogFileServer::SparkMonitorLogFileServer() : SimControlNode() { mPause = false; mForwardStep = false; mStepDelay = 0; mBackwardPlayback = false; } SparkMonitorLogFileServer::~SparkMonitorLogFileServer() { } void SparkMonitorLogFileServer::OnLink() { mScriptServer = GetCore()->GetScriptServer(); // setup SceneServer reference mSceneServer = shared_dynamic_cast<SceneServer> (GetCore()->Get("/sys/server/scene")); if (mSceneServer.get() == 0) { GetLog()->Error() << "(SparkMonitor) ERROR: SceneServer not found\n"; } } void SparkMonitorLogFileServer::OnUnlink() { mSceneServer.reset(); if (mManagedScene.get() != 0) { mManagedScene->UnlinkChildren(); mManagedScene.reset(); } } void SparkMonitorLogFileServer::InitSimulation() { // get the SceneImporter mSceneImporter = shared_dynamic_cast<SceneImporter> (GetCore()->Get("/sys/server/scene/RubySceneImporter")); if (mSceneImporter.get() == 0) { GetLog()->Error() << "(SparkMonitorLogFileServer) ERROR: cannot create" << " a RubySceneImporter instance\n"; } mLog.open(mLogfileName.c_str()); if (! mLog.is_open()) { GetLog()->Error() << "(SparkMonitorLogFileServer) ERROR: cannot open" << " the log file\n"; exit(1); } } void SparkMonitorLogFileServer::DoneSimulation() { mActiveScene.reset(); mSceneImporter.reset(); mLog.close(); } void SparkMonitorLogFileServer::StartCycle() { if (mPause && !mForwardStep) { return; } if (mBackwardPlayback) { if (linePositions.size() < 3) return; linePositions.pop(); linePositions.pop(); mLog.seekg( linePositions.top() ); } string msg; linePositions.push( mLog.tellg() ); std::getline(mLog,msg); if (msg.size() != 0) { ParseMessage(msg); } usleep(mStepDelay); mForwardStep = false; } void SparkMonitorLogFileServer::ParseCustomPredicates(sexp_t* sexp, PredicateList& pList) { if ( (sexp == 0) || (sexp->ty != SEXP_VALUE) ) { return; } Predicate& pred = pList.AddPredicate(); pred.name = sexp->val; sexp = sexp->next; while (sexp != 0) { if (sexp->ty == SEXP_VALUE) { pred.parameter.AddValue(sexp->val); } sexp = sexp->next; } } void SparkMonitorLogFileServer::ParseCustomPredicates(sexp_t* sexp) { // ( (name param1 param2 ...) (name param1 param2 ...) ... ) if (sexp == 0) { return; } // get list of registered CustomMonitor objects TLeafList customList; ListChildrenSupportingClass<CustomMonitor>(customList); customList.push_back(GetCore()->Get("/sys/server/simulation/SparkMonitorClient/SoccerMonitor")); if (customList.empty()) { return; } // parse predicates PredicateList pList; sexp = sexp->list; while (sexp != 0) { if (sexp->ty == SEXP_LIST) { sexp_t* sPred = sexp->list; ParseCustomPredicates(sPred,pList); } sexp = sexp->next; } // pass predicates to all registered CustomMonitor objects for ( TLeafList::iterator iter = customList.begin(); iter != customList.end(); ++iter ) { shared_static_cast<CustomMonitor>((*iter)) ->ParseCustomPredicates(pList); } } void SparkMonitorLogFileServer::ParseMessage(const string& msg) { if ( (mSceneServer.get() == 0) || (mSceneImporter.get() == 0) ) { return; } mActiveScene = mSceneServer->GetActiveScene(); if (mActiveScene.get() == 0) { return; } if (mManagedScene.get() == 0) { mManagedScene = shared_dynamic_cast<BaseNode> (GetCore()->New("oxygen/BaseNode")); mActiveScene->AddChildReference(mManagedScene); } // parse s-expressions; we expect a leading list of custom // predicates followed by the RubySceneGraph expressions /** ( (predicate parameter ...) (predicate parameter ...) ... ) (RubySceneGraph Header) (RubySceneGraph Body) ) **/ char* msgBuf = const_cast<char*>(msg.c_str()); pcont_t* pcont = init_continuation(msgBuf); sexp_t* sexp_custom = iparse_sexp(msgBuf,msg.size(),pcont); if (sexp_custom == 0) { destroy_sexp(sexp_custom); destroy_continuation(pcont); return; } ParseCustomPredicates(sexp_custom); mSceneImporter->ParseScene(string(pcont->lastPos), mManagedScene, shared_ptr<ParameterList>()); destroy_sexp(sexp_custom); destroy_continuation(pcont); } void SparkMonitorLogFileServer::BackwardStep() { if (linePositions.size() < 3) return; linePositions.pop(); linePositions.pop(); mLog.seekg( linePositions.top() ); mForwardStep = true; } void SparkMonitorLogFileServer::BackwardPlayback() { mBackwardPlayback = !mBackwardPlayback; mPause = false; } Index: export.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/plugin/sparkmonitor/export.cpp,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** export.cpp 13 Dec 2005 21:48:50 -0000 1.1 --- export.cpp 18 Jul 2007 23:08:50 -0000 1.1.4.1 *************** *** 22,25 **** --- 22,26 ---- #include "sparkmonitor.h" #include "sparkmonitorclient.h" + #include "sparkmonitorlogfileserver.h" #include <zeitgeist/zeitgeist.h> *************** *** 29,31 **** --- 30,33 ---- ZEITGEIST_EXPORT(SparkMonitor); ZEITGEIST_EXPORT(SparkMonitorClient); + ZEITGEIST_EXPORT(SparkMonitorLogFileServer); ZEITGEIST_EXPORT_END() |
Update of /cvsroot/simspark/simspark/spark/plugin/openglsysogre In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25806 Added Files: Tag: projectx .cvsignore Makefile.am export.cpp ogrematerialexporter.cpp ogrematerialexporter.h ogrematerialexporter_c.cpp ogremeshexporter.cpp ogremeshexporter.h ogremeshexporter_c.cpp ogreobjectmanager.cpp ogreobjectmanager.h ogreobjectmanager_c.cpp ogrerenderserver.cpp ogrerenderserver.h ogrerenderserver_c.cpp openglsysframelistener.cpp openglsysframelistener.h openglsystemogre.cpp openglsystemogre.h openglsystemogre_c.cpp Log Message: added ogre renderer --- NEW FILE: .cvsignore --- *.la *.lo .deps .libs Makefile Makefile.in --- NEW FILE: ogrematerialexporter.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogrematerialexporter.h,v 1.1.2.1 2007/07/18 23:06:41 fruit 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. MaterialExporter NOTE: This class serves as an (abstract) exporter to register materials with other graphic engines (possibly also for exporting). HISTORY: 03/05/07 - OO - Initial version */ #ifndef OGREMATERIALEXPORTER_H #define OGREMATERIALEXPORTER_H #include <kerosin/materialserver/materialexporter.h> /** \class OgreMaterialExporter. This class implements a MaterialExporter for the ogre render server, which needs to be informed about the materials used for a specific simulation. By registering an OgreMaterialExporter implementation to the MaterialServer, materials are registered to the Ogre system. */ class OgreMaterialExporter : public kerosin::MaterialExporter { public: OgreMaterialExporter() { std::cerr << "OgreMaterialExporter constructed\n"; } virtual ~OgreMaterialExporter() { std::cerr << "OgreMaterialExporter destroyed\n"; } /** Register / Export the given material. \param material the material to register / export. */ virtual void RegisterMaterial(boost::shared_ptr<kerosin::Material> basematerial); }; DECLARE_CLASS(OgreMaterialExporter); #endif // OGREMATERIALEXPORTER --- NEW FILE: openglsysframelistener.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: openglsysframelistener.cpp,v 1.1.2.1 2007/07/18 23:06:42 fruit 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. OpenGLSysFrameListener (derived from ExampleFrameListener shipping with OGRE) HISTORY: 16/03/07 - OO - Initial version */ #include "openglsysframelistener.h" using namespace Ogre; using namespace OIS; void OpenGLSysFrameListener::UpdateStats() { return; #if 0 static String currFps = "Current FPS: "; static String avgFps = "Average FPS: "; static String bestFps = "Best FPS: "; static String worstFps = "Worst FPS: "; static String tris = "Triangle Count: "; static String batches = "Batch Count: "; // update stats when necessary try { OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Spark/AverageFps"); OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Spark/CurrFps"); OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Spark/BestFps"); OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Spark/WorstFps"); const RenderTarget::FrameStats& stats = mWindow->getStatistics(); guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS)); guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS)); guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS) +" "+StringConverter::toString(stats.bestFrameTime)+" ms"); guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS) +" "+StringConverter::toString(stats.worstFrameTime)+" ms"); OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Spark/NumTris"); guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount)); OverlayElement* guiBatches = OverlayManager::getSingleton().getOverlayElement("Spark/NumBatches"); guiBatches->setCaption(batches + StringConverter::toString(stats.batchCount)); OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Spark/DebugText"); mDebugText = "P: " + StringConverter::toString(mOOM->GetMainCamera()->getDerivedPosition()) + " " + "O: " + StringConverter::toString(mOOM->GetMainCamera()->getDerivedOrientation()); guiDbg->setCaption(mDebugText); } catch(...) { /* ignore */ } #endif } OpenGLSysFrameListener::OpenGLSysFrameListener(RenderWindow* win, OgreObjectManager* oom, bool bufferedKeys, bool bufferedMouse, bool bufferedJoy) : mOOM(oom), mTranslateVector(Vector3::ZERO), mWindow(win), mStatsOn(true), mNumScreenShots(0), mMoveScale(0.0f), mRotScale(0.0f), mTimeUntilNextToggle(0), mFiltering(TFO_BILINEAR), mAniso(1), mSceneDetailIndex(0), mMoveSpeed(40), mRotateSpeed(36), mDebugOverlay(0), mShowBBs(false) // mInputManager(0), mMouse(0), mKeyboard(0), mJoy(0), { mDebugOverlay = OverlayManager::getSingleton().getByName("Spark/DebugOverlay"); // LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***"); ParamList pl; size_t windowHnd = 0; std::ostringstream windowHndStr; win->getCustomAttribute("WINDOW", &windowHnd); windowHndStr << windowHnd; pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str())); #if 0 mInputManager = InputManager::createInputSystem( pl ); //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse) mKeyboard = static_cast<Keyboard*>(mInputManager->createInputObject( OISKeyboard, bufferedKeys )); mMouse = static_cast<Mouse*>(mInputManager->createInputObject( OISMouse, bufferedMouse )); try { mJoy = static_cast<JoyStick*>(mInputManager->createInputObject( OISJoyStick, bufferedJoy )); } catch(...) { mJoy = 0; } #endif //Set initial mouse clipping size windowResized(mWindow); showDebugOverlay(true); //Register as a Window listener WindowEventUtilities::addWindowEventListener(mWindow, this); } OpenGLSysFrameListener::~OpenGLSysFrameListener() { //Remove ourself as a Window listener WindowEventUtilities::removeWindowEventListener(mWindow, this); windowClosed(mWindow); } void OpenGLSysFrameListener::windowResized(RenderWindow* rw) { unsigned int width, height, depth; int left, top; rw->getMetrics(width, height, depth, left, top); #if 0 const OIS::MouseState &ms = mMouse->getMouseState(); ms.width = width; ms.height = height; #endif } void OpenGLSysFrameListener::windowClosed(RenderWindow* rw) { #if 0 //Only close for window that created OIS (the main window for us) if (rw == mWindow) { if (mInputManager) { mInputManager->destroyInputObject(mMouse); mInputManager->destroyInputObject(mKeyboard); mInputManager->destroyInputObject(mJoy); OIS::InputManager::destroyInputSystem(mInputManager); mInputManager = 0; } } #endif } #if 0 bool OpenGLSysFrameListener::processUnbufferedKeyInput(const FrameEvent& evt) { if (mKeyboard->isKeyDown(KC_A)) mTranslateVector.x = -mMoveScale; // Move camera left if (mKeyboard->isKeyDown(KC_D)) mTranslateVector.x = mMoveScale; // Move camera RIGHT if(mKeyboard->isKeyDown(KC_UP) || mKeyboard->isKeyDown(KC_W) ) mTranslateVector.z = -mMoveScale; // Move camera forward if (mKeyboard->isKeyDown(KC_DOWN) || mKeyboard->isKeyDown(KC_S)) mTranslateVector.z = mMoveScale; // Move camera backward if (mKeyboard->isKeyDown(KC_PGUP)) mTranslateVector.y = mMoveScale; // Move camera up if (mKeyboard->isKeyDown(KC_PGDOWN)) mTranslateVector.y = -mMoveScale; // Move camera down if (mKeyboard->isKeyDown(KC_RIGHT)) mCamera->yaw(-mRotScale); if (mKeyboard->isKeyDown(KC_LEFT)) mCamera->yaw(mRotScale); if (mKeyboard->isKeyDown(KC_ESCAPE) || mKeyboard->isKeyDown(KC_Q)) return false; if (mKeyboard->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0) { mStatsOn = !mStatsOn; showDebugOverlay(mStatsOn); mTimeUntilNextToggle = 1; } if (mKeyboard->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0) { switch(mFiltering) { case TFO_BILINEAR: mFiltering = TFO_TRILINEAR; mAniso = 1; break; case TFO_TRILINEAR: mFiltering = TFO_ANISOTROPIC; mAniso = 8; break; case TFO_ANISOTROPIC: mFiltering = TFO_BILINEAR; mAniso = 1; break; default: break; } MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering); MaterialManager::getSingleton().setDefaultAnisotropy(mAniso); showDebugOverlay(mStatsOn); mTimeUntilNextToggle = 1; } if (mKeyboard->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0) { std::ostringstream ss; ss << "screenshot_" << ++mNumScreenShots << ".png"; mWindow->writeContentsToFile(ss.str()); mTimeUntilNextToggle = 0.5; mDebugText = "Saved: " + ss.str(); } if (mKeyboard->isKeyDown(KC_R) && mTimeUntilNextToggle <=0) { mSceneDetailIndex = (mSceneDetailIndex+1)%3 ; switch(mSceneDetailIndex) { case 0 : mCamera->setPolygonMode(PM_SOLID); break; case 1 : mCamera->setPolygonMode(PM_WIREFRAME); break; case 2 : mCamera->setPolygonMode(PM_POINTS); break; } mTimeUntilNextToggle = 0.5; } static bool displayCameraDetails = true; if (mKeyboard->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0) { displayCameraDetails = !displayCameraDetails; mTimeUntilNextToggle = 0.5; if (!displayCameraDetails) mDebugText = ""; } // Print camera details if (displayCameraDetails) mDebugText = "P: " + StringConverter::toString(mCamera->getDerivedPosition()) + " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation()); // Return true to continue rendering return true; } bool OpenGLSysFrameListener::processUnbufferedMouseInput(const FrameEvent& evt) { // Rotation factors, may not be used if the second mouse button is pressed // 2nd mouse button - slide, otherwise rotate const MouseState &ms = mMouse->getMouseState(); if (ms.buttonDown( MB_Right )) { mTranslateVector.x += ms.X.rel * 0.13; mTranslateVector.y -= ms.Y.rel * 0.13; } else { mRotX = Degree(-ms.X.rel * 0.13); mRotY = Degree(-ms.Y.rel * 0.13); } return true; } #endif #if 0 void OpenGLSysFrameListener::moveCamera() { // Make all the changes to the camera // Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW //(e.g. airplane) mCamera->yaw(mRotX); mCamera->pitch(mRotY); mCamera->moveRelative(mTranslateVector); } #endif void OpenGLSysFrameListener::showDebugOverlay(bool show) { if (mDebugOverlay) { if (show) mDebugOverlay->show(); else mDebugOverlay->hide(); } } // Override frameStarted event to process that (don't care about frameEnded) bool OpenGLSysFrameListener::frameStarted(const FrameEvent& evt) { if (mWindow->isClosed()) return false; #if 0 //Need to capture/update each device mKeyboard->capture(); mMouse->capture(); if( mJoy ) mJoy->capture(); bool buffJ = (mJoy) ? mJoy->buffered() : true; // Check if one of the devices is not buffered if (!mMouse->buffered() || !mKeyboard->buffered() || !buffJ) { // one of the input modes is immediate, so setup what is needed for immediate movement if (mTimeUntilNextToggle >= 0) mTimeUntilNextToggle -= evt.timeSinceLastFrame; // If this is the first frame, pick a speed if (evt.timeSinceLastFrame == 0) { mMoveScale = 1; mRotScale = 0.1; } // Otherwise scale movement units by time passed since last frame else { // Move about 100 units per second, mMoveScale = mMoveSpeed * evt.timeSinceLastFrame; // Take about 10 seconds for full rotation mRotScale = mRotateSpeed * evt.timeSinceLastFrame; } mRotX = 0; mRotY = 0; mTranslateVector = Ogre::Vector3::ZERO; } //Check to see which device is not buffered, and handle it if (!mKeyboard->buffered()) if (processUnbufferedKeyInput(evt) == false) return false; if (!mMouse->buffered()) if (processUnbufferedMouseInput(evt) == false) return false; if (!mMouse->buffered() || !mKeyboard->buffered() || !buffJ) moveCamera(); #endif #if 0 static Real timeDelay = 0; timeDelay -= evt.timeSinceLastFrame; KEY_PRESSED(OIS::KC_B, 1, mShowBBs = !mShowBBs, mSceneMgr->showBoundingBoxes(mShowBBs); ) #endif return true; } bool OpenGLSysFrameListener::frameEnded(const FrameEvent& evt) { // UpdateStats(); return true; } --- NEW FILE: ogremeshexporter.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogremeshexporter.h,v 1.1.2.1 2007/07/18 23:06:41 fruit 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. MeshBridge NOTE: This class serves as an (abstract) exporter to register meshes with other graphic engines (possibly also for exporting). HISTORY: 30/03/07 - OO - Initial version */ #ifndef OGREMESHEXPORTER_H #define OGREMESHEXPORTER_H #include <oxygen/geometryserver/meshexporter.h> /** \class OgreMeshExporter. This class implements a MeshExporter for the ogre render server, which needs to be informed about the meshes used for a specific simulation. By registering an OgreMeshExporter implementation to the GeometryServer, meshes are registered to the Ogre system. */ class OgreMeshExporter : public oxygen::MeshExporter { public: OgreMeshExporter() { std::cerr << "OgreMeshExporter constructed\n"; } virtual ~OgreMeshExporter() { std::cerr << "OgreMeshExporter destroyed\n"; } /** Register / Export the given mesh. \param mesh the mesh to register / export. */ virtual void RegisterMesh(boost::shared_ptr<oxygen::TriMesh> mesh); }; DECLARE_CLASS(OgreMeshExporter); #endif // OGREMESHEXPORTER --- NEW FILE: Makefile.am --- if BUILD_KEROSIN pkglib_LTLIBRARIES = openglsysogre.la endif openglsysogre_la_SOURCES = \ ogrerenderserver.cpp ogrerenderserver_c.cpp ogrerenderserver.h \ openglsysframelistener.h openglsysframelistener.cpp \ openglsystemogre.h openglsystemogre.cpp openglsystemogre_c.cpp \ ogremeshexporter.h ogremeshexporter.cpp ogremeshexporter_c.cpp \ ogrematerialexporter.h ogrematerialexporter.cpp ogrematerialexporter_c.cpp \ ogreobjectmanager.h ogreobjectmanager.cpp ogreobjectmanager_c.cpp export.cpp # -module tells automake we're not building a library but a loadable module # so we don't need the "lib" prefix in the module name ./libois.a openglsysogre_la_LDFLAGS = -module -avoid-version AM_CPPFLAGS = -I${top_srcdir}/lib @RUBY_CPPFLAGS@ #-I/Library/Frameworks/Ogre.framework/Headers --- NEW FILE: openglsystemogre.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: openglsystemogre.h,v 1.1.2.1 2007/07/18 23:06:42 fruit 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. OpenGLSystemOGRE HISTORY: 16/03/07 - OO - Initial version */ #ifndef __OpenGLSystemOGRE_H__ #define __OpenGLSystemOGRE_H__ #include <zeitgeist/corecontext.h> #include <kerosin/openglserver/openglsystem.h> #include "openglsystemogre.h" #include "ogreobjectmanager.h" #include "openglsysframelistener.h" #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN #include "windows.h" #endif using namespace Ogre; #define KEY_PRESSED(_key,_timeDelay, _macro) \ { \ if (mKeyboard->isKeyDown(_key) && timeDelay <= 0) \ { \ timeDelay = _timeDelay; \ _macro ; \ } \ } /** Base class which manages the standard startup of an Ogre application. Designed to be subclassed for specific examples if required. */ class OpenGLSystemOGRE : public kerosin::OpenGLSystem { public: /// Standard constructor OpenGLSystemOGRE(); /// Standard destructor virtual ~OpenGLSystemOGRE(); bool Init(); void Update(); void SwapBuffers(); virtual bool IsGLLocked() const { return true; } protected: void CreateScene(); // Create new frame listener void createFrameListener(); protected: //! a reference to the node where we store some pointers to Ogre objects boost::shared_ptr<OgreObjectManager> mObjectManager; SceneNode *mpObjsNode; // the node wich will hold our entities Ogre::Root *mRoot; OpenGLSysFrameListener* mFrameListener; Ogre::RenderWindow* mWindow; Ogre::String mResourcePath; /** Configures the application. @return false if the user chooses to abandon configuration. */ bool Configure(); void ChooseSceneManager(); void CreateCamera(); void CreateViewports(); /// Method which will define the source of resources (other than current folder) virtual void setupResources(); /// Optional override method where you can create resource listeners (e.g. for loading screens) virtual void createResourceListener(); /// Optional override method where you can perform resource group loading /// Must at least do ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); virtual void loadResources(); }; DECLARE_CLASS(OpenGLSystemOGRE); #endif --- NEW FILE: ogremeshexporter.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogremeshexporter.cpp,v 1.1.2.1 2007/07/18 23:06:41 fruit 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. MeshExporter NOTE: This class serves as an (abstract) exporter to register meshes with other graphic engines (possibly also for exporting). HISTORY: 30/03/07 - OO - Initial version */ #include "ogremeshexporter.h" #include <zeitgeist/logserver/logserver.h> #ifdef __APPLE__ #include <Ogre/Ogre.h> #else #include <Ogre.h> #endif using namespace Ogre; void OgreMeshExporter::RegisterMesh(boost::shared_ptr<oxygen::TriMesh> mesh) { if (mesh.get() == 0) { GetLog()->Warning() << "(OgreMeshExporter) RegisterMesh with no mesh\n"; return; } GetLog()->Debug() << "(OgreMeshExporter) RegisterMesh " << mesh->GetName() << "\n"; std::cerr << "(OgreMeshExporter) RegisterMesh " << mesh->GetName() << "\n"; // create the same mesh manually in OGRE MeshPtr oMesh = MeshManager::getSingleton().createManual(mesh->GetName() + ".mesh", "Custom"); // we do one submesh per material SubMesh* oSubMesh = oMesh->createSubMesh(); // transfer the vertex data oSubMesh->useSharedVertices = false; oSubMesh->vertexData = new VertexData(); oSubMesh->vertexData->vertexCount = mesh->GetVertexCount(); // declare what the vertex contains VertexDeclaration* declaration = oSubMesh->vertexData->vertexDeclaration; static const unsigned short source = 0; size_t offset = 0; offset += declaration->addElement(source,offset,VET_FLOAT3,VES_POSITION).getSize(); offset += declaration->addElement(source,offset,VET_FLOAT3,VES_NORMAL).getSize(); offset += declaration->addElement(source,offset,VET_FLOAT2,VES_TEXTURE_COORDINATES).getSize(); // we create the hardware vertex buffer HardwareVertexBufferSharedPtr vbuffer = HardwareBufferManager::getSingleton().createVertexBuffer ( declaration->getVertexSize(source), // == offset oSubMesh->vertexData->vertexCount, // == GetVertexCount() HardwareBuffer::HBU_STATIC_WRITE_ONLY); // fill the hardware buffer, and record the axis aligned bounding box AxisAlignedBox aabox; float* vdata = static_cast<float*>(vbuffer->lock(HardwareBuffer::HBL_DISCARD)); const boost::shared_array<float> pos = mesh->GetPos(); const boost::shared_array<float> tex = mesh->GetTexCoords(); for (size_t i=0; i < mesh->GetVertexCount(); ++i) { // std::cerr << "registering pos: " << i << " (" << mesh->GetVertexCount() << ")\n"; // position Vector3 position(pos[i*3 + 0], pos[i*3 + 2], pos[i*3 + 1]); *vdata++ = position.x; *vdata++ = position.y; *vdata++ = position.z; aabox.merge(position); // normal Vector3 normal = position.normalisedCopy(); *vdata++ = normal.x; *vdata++ = normal.y; *vdata++ = normal.z; // texture coordinate #if 1 // std::cerr << "registering tex: " << i << " (" << mesh->GetVertexCount() << ")\n"; if (tex.get() != 0) { // in kerosin, the coordinates are 3-D with the 3rd coordinate set to 0 Vector2 tcoordinate(tex[i*3 + 0], tex[i*3 + 1]); *vdata++ = tcoordinate.x; *vdata++ = tcoordinate.y; } else { *vdata++ = 0.0; *vdata++ = 0.0; } #endif } vbuffer->unlock(); oSubMesh->vertexData->vertexBufferBinding->setBinding(source,vbuffer); // Creates the index data oxygen::TriMesh::TFaces::const_iterator i = mesh->GetFaces().begin(); const size_t verticesPerFace = 3; size_t total_faces = 0; if (mesh->GetFaces().size() < 1) { std::cerr << "(OgreMeshExporter) no faces found\n"; } else { total_faces = i->indeces->GetNumIndex(); if (mesh->GetFaces().size() > 1) { std::cerr << "(OgremeshExporter) ignoring multiple faces (not implemented)\n"; } } // std::cerr << "adding " << total_faces << "\n"; #if 1 oSubMesh->indexData->indexStart = 0; oSubMesh->indexData->indexCount = total_faces; oSubMesh->indexData->indexBuffer = HardwareBufferManager::getSingleton().createIndexBuffer(HardwareIndexBuffer::IT_16BIT, oSubMesh->indexData->indexCount, HardwareBuffer::HBU_STATIC_WRITE_ONLY); uint16* idata = static_cast<uint16*>(oSubMesh->indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD)); if (i != mesh->GetFaces().end()) { for (int j=0; j<total_faces; j+=3) { *idata++ = ((i->indeces->GetIndex()).get())[j]; *idata++ = ((i->indeces->GetIndex()).get())[j+2]; *idata++ = ((i->indeces->GetIndex()).get())[j+1]; } oSubMesh->indexData->indexBuffer->unlock(); // We must indicate the bounding box oMesh->_setBounds(aabox); oMesh->_setBoundingSphereRadius((aabox.getMaximum()-aabox.getMinimum()).length()/2.0); // Finally we set a material to the submesh oSubMesh->setMaterialName(i->material); } // And we load the mesh oMesh->load(); #endif } --- NEW FILE: ogrerenderserver.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogrerenderserver.cpp,v 1.1.2.1 2007/07/18 23:06:42 fruit 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. OgreRenderServer NOTE: This is a renderserver in order to support Ogre HISTORY: 29/03/07 - OO - Initial version */ #include "ogrerenderserver.h" #include "ogreobjectmanager.h" #include <oxygen/sceneserver/sceneserver.h> #include <oxygen/sceneserver/scene.h> #include <oxygen/sceneserver/camera.h> #include <boost/shared_ptr.hpp> #include <oxygen/physicsserver/spherecollider.h> // #include <kerosin/renderserver/rendernode.h> #include <kerosin/sceneserver/staticmesh.h> #include <kerosin/sceneserver/light.h> #include <kerosin/materialserver/material.h> // #include <kerosin/openglserver/glbase.h> using namespace boost; using namespace oxygen; OgreRenderServer::OgreRenderServer() : mAmbientLight(Ogre::ColourValue::White) { } void OgreRenderServer::OnLink() { BaseRenderServer::OnLink(); mObjectManager = shared_dynamic_cast<OgreObjectManager>(GetCore()->Get("/sys/ogre/objectmanager")); if (mObjectManager.get() == 0) { std::cerr << "(OgreRenderServer) ERROR: no Ogre objectmanager object found\n"; return; } } void OgreRenderServer::Render() { if (! GetActiveScene() || (mObjectManager.get() == 0)) { std::cerr << "no active scene or no OgreObjectManager\n"; return; } Ogre::ColourValue oldAmbientLight = mAmbientLight; mAmbientLight = Ogre::ColourValue::Black; RenderScene(mActiveScene); CleanUpOgreSceneNodes(); if (oldAmbientLight != mAmbientLight) { Ogre::SceneManager* sceneManager = mObjectManager->GetSceneManager(); sceneManager->setAmbientLight(mAmbientLight); } } void OgreRenderServer::RenderScene(boost::shared_ptr<oxygen::BaseNode> node) { /* here, the kerosin renderserver takes the kerosin/staticmesh rendernode, and renders the node using the staticmesh an registered materials. */ shared_ptr<kerosin::StaticMesh> renderNode = shared_dynamic_cast<kerosin::StaticMesh>(node); if (renderNode.get() != 0) { Ogre::SceneNode* sceneNode = RegisterAtOgre(renderNode); UpdateOgreNode(sceneNode,renderNode); } else { shared_ptr<kerosin::Light> lightNode = shared_dynamic_cast<kerosin::Light>(node); if (lightNode.get() != 0) { Ogre::Light* light = RegisterAtOgre(lightNode); UpdateOgreNode(light,lightNode); } shared_ptr<oxygen::Camera> cameraNode = shared_dynamic_cast<oxygen::Camera>(node); if (cameraNode.get() != 0) { Ogre::Camera* camera = RegisterAtOgre(cameraNode); UpdateOgreNode(camera,cameraNode); } } // traverse the the hierarchy for (TLeafList::iterator i = node->begin(); i!= node->end(); ++i) { shared_ptr<BaseNode> node = shared_dynamic_cast<BaseNode>(*i); if (node.get() == 0) { continue; } RenderScene(node); } } Ogre::SceneNode* OgreRenderServer::RegisterAtOgre(shared_ptr<kerosin::StaticMesh> renderNode) { Ogre::SceneNode* sceneNode = 0; std::pair<TNodeRegistry::iterator, bool> inserted; const std::string entityName = renderNode->GetFullPath(); const std::string nodeName = entityName + ".node"; Ogre::SceneManager* sceneManager = mObjectManager->GetSceneManager(); inserted = mRenderNodeRegistry.insert(TNodeRegistry::value_type(entityName, true)); if (inserted.second) { // the node wasn't registered yet. const std::string meshName = renderNode->UseExternalMesh() ? renderNode->GetExternalMeshName() : renderNode->GetMesh()->GetName() + ".mesh"; if (renderNode->UseExternalMesh()) std::cerr << "(OgreRenderServer) RegisterAtOgre: trying to use ext. Mesh " << meshName << "\n"; // create an entity at ogre Ogre::Entity* entity = sceneManager->createEntity(entityName, meshName); // set if the entity is a shadow caster entity->setCastShadows(renderNode->CastShadows()); /** external meshes come with their own materials (?), so we don't * ** set the name here. */ if (!renderNode->UseExternalMesh()) { // look up and set the first material (right now, we use only one) const std::string materialName = ((renderNode->GetMaterials())[0])->GetName(); /** set all material names (we should get the sub-entities and * ** set different material name separately here. */ entity->setMaterialName(materialName); } // create an ogre scene node and attach the entity sceneNode = sceneManager->getRootSceneNode()->createChildSceneNode(nodeName); sceneNode->attachObject(entity); // finally, set the scale of the object salt::Vector3f scale(renderNode->GetScale()); if (renderNode->UseExternalMesh()) { salt::Vector3f exScale(renderNode->ExternalMeshScale()); std::cerr << "********************************************************************************\n"; std::cerr << "Using external mesh scale: " << exScale << " for " << nodeName << "\n"; std::cerr << "********************************************************************************\n"; sceneNode->setScale(exScale.x()*scale.x(), exScale.z()*scale.z(), exScale.y()*scale.y()); } else { sceneNode->setScale(scale.x(), scale.z(), scale.y()); } } else { // there was already a registered node, so we set <entry>.second to true to indicate // that the node was still processed this cycle. inserted.first->second = true; // get the pointer to the scene node sceneNode = sceneManager->getSceneNode(nodeName); } return sceneNode; } #if 1 Ogre::Light* OgreRenderServer::RegisterAtOgre(shared_ptr<kerosin::Light> lightNode) { /* In Ogre (and similar in kerosin), lights can be attached to a scene node. In this case, the position & direction of the lightin Ogre is derived from the scene node. We don't use this feature here, because we derive the position / direction of the light from simspark. */ Ogre::Light* light = 0; std::pair<TNodeRegistry::iterator, bool> inserted; const std::string lightName = lightNode->GetFullPath(); Ogre::SceneManager* sceneManager = mObjectManager->GetSceneManager(); inserted = mLightNodeRegistry.insert(TNodeRegistry::value_type(lightName, true)); if (inserted.second) { // the node wasn't registered yet. light = sceneManager->createLight(lightName); light->setType(Ogre::Light::LT_POINT); // SPOTLIGHT); // POINT); // //DIRECTIONAL kerosin::RGBA colour = lightNode->GetDiffuse(); light->setDiffuseColour(colour.r(), colour.g(), colour.b()); colour = lightNode->GetSpecular(); light->setSpecularColour(colour.r(), colour.g(), colour.b()); } else { // there was already a registered node, so we set <entry>.second to true to indicate // that the node was still processed this cycle. inserted.first->second = true; // get the pointer to the scene node light = sceneManager->getLight(lightName); } return light; } #endif Ogre::Camera* OgreRenderServer::RegisterAtOgre(shared_ptr<oxygen::Camera> cameraNode) { Ogre::Camera* camera = 0; std::pair<TNodeRegistry::iterator, bool> inserted; const std::string cameraName = cameraNode->GetFullPath(); Ogre::SceneManager* sceneManager = mObjectManager->GetSceneManager(); inserted = mCameraNodeRegistry.insert(TNodeRegistry::value_type(cameraName, true)); if (inserted.second) { // the node wasn't registered yet. const std::string cameraNodeName = cameraName + ".camera"; // create an ogre scene node Ogre::SceneNode* sceneNode = sceneManager->getRootSceneNode()->createChildSceneNode(cameraNodeName); // create an ogre camera node camera = sceneManager->createCamera(cameraName); std::cerr << "(OgreRenderServer) new camera created: " << cameraName << "\n"; camera->setPosition(Ogre::Vector3(0,0,0)); // Look back along -Z camera->lookAt(Ogre::Vector3(0,0,1000)); cameraNode->LookAt(salt::Vector3f(0,-1000,0)); camera->setNearClipDistance(cameraNode->GetZNear()); camera->setFarClipDistance(cameraNode->GetZFar()); camera->setFOVy(Ogre::Degree(cameraNode->GetFOV())); // and now attach the camera to the scene node sceneNode->attachObject(camera); Ogre::Viewport* vp = mObjectManager->GetMainViewport(); camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight())); vp->setCamera(camera); mObjectManager->SetMainCamera(camera); } else { // there was already a registered node, so we set <entry>.second to true to indicate // that the node was still processed this cycle. inserted.first->second = true; // get the pointer to the camera node camera = sceneManager->getCamera(cameraName); } return camera; } void OgreRenderServer::CleanUpOgreSceneNodes() { TNodeRegistry::iterator i = mRenderNodeRegistry.begin(); while (i != mRenderNodeRegistry.end()) { TNodeRegistry::iterator j = i; j++; if (i->second) { i->second = false; } else { const std::string entityName = i->first; const std::string nodeName = entityName + ".node"; Ogre::SceneManager* sceneManager = mObjectManager->GetSceneManager(); std::cerr << "(OgreRenderServer) cleaning up unused entity node: " << entityName << "\n"; // destroy the scene node sceneManager->destroySceneNode(nodeName); // the entity should be destroyed only after entity and scene node are detached sceneManager->destroyEntity(entityName); mRenderNodeRegistry.erase(i); } i = j; } } void OgreRenderServer::UpdateOgreNode(Ogre::SceneNode* sceneNode, shared_ptr<kerosin::StaticMesh> renderNode) { const salt::Matrix m(renderNode->GetWorldTransform()); salt::Vector3f pos = m.Pos(); // m rotated around z by 180 degrees Ogre::Matrix4 matrix(-m.m[ 0],-m.m[ 1],-m.m[ 2],-m.m[ 3], -m.m[ 4],-m.m[ 5],-m.m[ 6],-m.m[ 7], m.m[ 8], m.m[ 9], m.m[10],m.m[11], m.m[12], m.m[13], m.m[14],m.m[15]); sceneNode->setPosition(pos.x(), pos.z(), -pos.y()); Ogre::Quaternion q = matrix.extractQuaternion(); sceneNode->setOrientation(q[0],-q[1],-q[3],q[2]); } void OgreRenderServer::UpdateOgreNode(Ogre::Light* light, shared_ptr<kerosin::Light> lightNode) { const salt::Matrix m(lightNode->GetWorldTransform()); salt::Vector3f pos = m.Pos(); light->setPosition(pos.x(), pos.z(), -pos.y()); // setDirection takes 3 params (describing an angle, I guess) // applies to spotlights and directional lights only // and so far there are none of these in simspark (?). To simulate at least // directional lights, we take the direction as the vector from position to origin. // Directional Lights don't have a position, so for these, that is a working fix. // For spot lights, the approach does have do be changed. light->setDirection(-pos.x(),-pos.z(), pos.y()); // light->setDirection(0,-1, -1); kerosin::RGBA colour = lightNode->GetAmbient(); mAmbientLight.r = std::min(1.0f, mAmbientLight.r + colour.r()); mAmbientLight.g = std::min(1.0f, mAmbientLight.g + colour.g()); mAmbientLight.b = std::min(1.0f, mAmbientLight.b + colour.b()); mAmbientLight.a = std::min(1.0f, mAmbientLight.a + colour.a()); } void OgreRenderServer::UpdateOgreNode(Ogre::Camera* camera, shared_ptr<oxygen::Camera> cameraNode) { const salt::Matrix m(cameraNode->GetWorldTransform()); // m rotated around z by 180 degrees Ogre::Matrix4 matrix(-m.m[ 0],-m.m[ 1],-m.m[ 2],-m.m[ 3], -m.m[ 4],-m.m[ 5],-m.m[ 6],-m.m[ 7], m.m[ 8], m.m[ 9], m.m[10], m.m[11], m.m[12], m.m[13], m.m[14], m.m[15]); salt::Vector3f pos = m.Pos(); Ogre::SceneNode* camNode = camera->getParentSceneNode(); if (camNode == 0) { // shouldn't happen, but just in case we try to be nice camera->setPosition(pos.x(), pos.z(), -pos.y()); } else { camNode->setPosition(pos.x(), pos.z(), -pos.y()); Ogre::Quaternion q = matrix.extractQuaternion(); /** ohne drehung der matrix: ohne aenderung: rotation um y beim links/rechts schauen, vorwaerts rueckwaerts vertauscht -q[0]: rotation um y beim links rechts schauen -q[1]: rotation um y beim links rechts schauen -q[2]: rotation um y beim links rechts schauen -q[3]: rotation um y beim links rechts schauen, hoch runter schauen vertauscht -q[0],-q[1]: rotation um y beim links rechts schauen, hoch runter schauen vertauscht -q[0],-q[2]: rotation um y beim links rechts schauen, hoch runter schauen vertauscht -q[0],-q[3]: rotation um y beim links rechts schauen -q[1],-q[2]: rotation um y beim links rechts schauen ... q[2],q[3] vertauscht: links/rechts rotation falsch, sonst alles richtig -q[0]; q[2],q[3] vertauscht: rotation um die y achse beim hoch/runterschauen -q[1]; q[2],q[3] vertauscht: links/rechts rotation falsch, rotation um y achse beim hoch runter -q[2]; q[2],q[3] vertauscht: links/rechts rotation falsch, rotation um y achse beim hoch runter -q[3]; q[2],q[3] vertauscht: links/rechts vo/hi vertauscht, rotation um y achse beim hoch runter -q[0],-q[1]; q[2],q[3] vertauscht: links/rechts vo/hi vertauscht, sonst alles richtig -q[0],-q[2]; q[2],q[3] vertauscht: links/rechts vo/hi vertauscht, hoch/runter schaun vertauscht -q[0],-q[3]; q[2],q[3] vertauscht: hoch/runter und links/rechts rotation vertauscht -q[1],-q[2]; q[2],q[3] vertauscht: hoch/runter und links/rechts rotation vertauscht -q[1],-q[3]; q[2],q[3] vertauscht: hoch/runter schaun vertauscht, li/re vo/hi vertauscht -q[2],-q[3]; q[2],q[3] vertauscht: li/re vo/hi vertauscht -q[0],-q[1],-q[2]; q[2],q[3] vertauscht: links/rechts vo/hi vertauscht, rotation um y beim hoch runter -q[0],-q[1],-q[3]; q[2],q[3] vertauscht: rotation um die y achse beim hoch/runterschauen -q[1],-q[2],-q[3]; q[2],q[3] vertauscht: rotation um die y achse beim hoch/runterschauen, li/re vo/hi -q[0],-q[1],-q[2],-q[3]: q[2],q[3] vertauscht: hoch/runterschaun vertauscht drehung der matrix: rotZ180: rotation um y beim links/rechts schauen, hoch runter vertauscht */ camNode->setOrientation(q[0],-q[1],-q[3],q[2]); } } int OgreRenderServer::Width() const { if ((mObjectManager.get() == 0) || (mObjectManager->GetRenderTarget() == 0)) { return 0; } return mObjectManager->GetRenderTarget()->getWidth(); } int OgreRenderServer::Height() const { if ((mObjectManager.get() == 0) || (mObjectManager->GetRenderTarget() == 0)) { return 0; } return mObjectManager->GetRenderTarget()->getHeight(); } bool OgreRenderServer::CopyFrame(char* buffer) const { if ((mObjectManager.get() == 0) || (mObjectManager->GetRenderTarget() == 0)) { return false; } // void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer) Ogre::PixelBox pb(Width(),Height(),1,Ogre::PF_BYTE_RGB,buffer); mObjectManager->GetRenderTarget()->copyContentsToMemory(pb); return true; } #if 0 void OgreRenderServer::RegisterSceneManager(Ogre::SceneManager* sceneManager) { // mSceneManager = sceneManager; } #endif --- NEW FILE: openglsystemogre_c.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; -*- this file is part of simspark Fri May 9 2003 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group $Id: openglsystemogre_c.cpp,v 1.1.2.1 2007/07/18 23:06:42 fruit 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. */ #include "openglsystemogre.h" void CLASS(OpenGLSystemOGRE)::DefineClass() { DEFINE_BASECLASS(kerosin/OpenGLSystem); } --- NEW FILE: ogrerenderserver.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogrerenderserver.h,v 1.1.2.1 2007/07/18 23:06:42 fruit 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. OgreRenderServer NOTE: This is a renderserver in order to support OGRE HISTORY: 29/03/07 - OO - Initial version */ #ifndef OGRERENDERSERVER_H #define OGRERENDERSERVER_H #include "ogreobjectmanager.h" #include <kerosin/renderserver/baserenderserver.h> #include <salt/matrix.h> #ifdef __APPLE__ #include <Ogre/Ogre.h> #else #include <Ogre.h> #endif namespace oxygen { class Camera; } namespace kerosin { class Light; class StaticMesh; } class OgreRenderServer : public kerosin::BaseRenderServer { public: typedef std::map<std::string, bool> TNodeRegistry; public: OgreRenderServer(); virtual ~OgreRenderServer() {} //! display the current active scene virtual void Render(); //! width of the render target virtual int Width() const; //! height of the render target virtual int Height() const; //! get a shot of the current frame virtual bool CopyFrame(char* buffer) const; //! register an Ogre SceneManager object // void RegisterSceneManager(Ogre::SceneManager* sceneManager); protected: virtual void OnLink(); private: void RenderScene(boost::shared_ptr<oxygen::BaseNode> node); Ogre::SceneNode* RegisterAtOgre(boost::shared_ptr<kerosin::StaticMesh> renderNode); Ogre::Light* RegisterAtOgre(boost::shared_ptr<kerosin::Light> lightNode); Ogre::Camera* RegisterAtOgre(boost::shared_ptr<oxygen::Camera> cameraNode); void UpdateOgreNode(Ogre::SceneNode* sceneNode, boost::shared_ptr<kerosin::StaticMesh> renderNode); void UpdateOgreNode(Ogre::Light* light, boost::shared_ptr<kerosin::Light> lightNode); void UpdateOgreNode(Ogre::Camera* light, boost::shared_ptr<oxygen::Camera> cameraNode); void CleanUpOgreSceneNodes(); boost::shared_ptr<OgreObjectManager> mObjectManager; TNodeRegistry mRenderNodeRegistry; TNodeRegistry mLightNodeRegistry; TNodeRegistry mCameraNodeRegistry; Ogre::ColourValue mAmbientLight; }; DECLARE_CLASS(OgreRenderServer); #endif // OGRERENDERSERVER_H --- NEW FILE: openglsysframelistener.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: openglsysframelistener.h,v 1.1.2.1 2007/07/18 23:06:42 fruit 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. OpenGLSysFrameListener (derived from ExampleFrameListener shipping with OGRE) HISTORY: 16/03/07 - OO - Initial version */ /* ----------------------------------------------------------------------------- Filename: OpenGLSysFrameListener.h Description: Defines an example frame listener which responds to frame events. This frame listener just moves a specified camera around based on keyboard and mouse movements. Mouse: Freelook W or Up: Forward S or Down:Backward A: Step left D: Step right PgUp: Move upwards PgDown: Move downwards F: Toggle frame rate stats on/off R: Render mode T: Cycle texture filtering Bilinear, Trilinear, Anisotropic(8) P: Toggle on/off display of camera position / orientation ----------------------------------------------------------------------------- */ #ifndef OPENGLSYSFRAMELISTENER_H #define OPENGLSYSFRAMELISTENER_H #ifdef __APPLE__ #include <Ogre/Ogre.h> #else #include <Ogre.h> #endif //Use this define to signify OIS will be used as a DLL //(so that dll import/export macros are in effect) #define OIS_DYNAMIC_LIB #include <OIS/OIS.h> #include "ogreobjectmanager.h" class OpenGLSysFrameListener: public Ogre::FrameListener, public Ogre::WindowEventListener { public: // Constructor takes a RenderWindow because it uses that to determine input context OpenGLSysFrameListener(Ogre::RenderWindow* win, OgreObjectManager* oom, bool bufferedKeys = false, bool bufferedMouse = false, bool bufferedJoy = false); // Window has resized: derived from WindowEventListener. Adjust mouse clipping area virtual void windowResized(Ogre::RenderWindow* rw); // Window has been closed: derived from WindowEventListener. virtual void windowClosed(Ogre::RenderWindow* rw); virtual ~OpenGLSysFrameListener(); // virtual bool processUnbufferedKeyInput(const Ogre::FrameEvent& evt); // bool processUnbufferedMouseInput(const Ogre::FrameEvent& evt); // void moveCamera(); void showDebugOverlay(bool show); // Derived from FrameListener, called when a frame is about to begin rendering. // Override frameStarted event to process that (don't care about frameEnded) bool frameStarted(const Ogre::FrameEvent& evt); // DErived from FrameListener: called when a frame has just been rendered. bool frameEnded(const Ogre::FrameEvent& evt); protected: void UpdateStats(); protected: OgreObjectManager* mOOM; Ogre::Vector3 mTranslateVector; Ogre::RenderWindow* mWindow; bool mStatsOn; std::string mDebugText; bool mShowBBs; unsigned int mNumScreenShots; float mMoveScale; Ogre::Degree mRotScale; // just to stop toggles flipping too fast Ogre::Real mTimeUntilNextToggle ; Ogre::Radian mRotX, mRotY; Ogre::TextureFilterOptions mFiltering; int mAniso; int mSceneDetailIndex ; Ogre::Real mMoveSpeed; Ogre::Degree mRotateSpeed; Ogre::Overlay* mDebugOverlay; #if 0 //OIS Input devices OIS::InputManager* mInputManager; OIS::Mouse* mMouse; OIS::Keyboard* mKeyboard; OIS::JoyStick* mJoy; #endif }; #endif --- NEW FILE: ogreobjectmanager.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogreobjectmanager.h,v 1.1.2.1 2007/07/18 23:06:41 fruit 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. OgreObjectManager (wrapper for Ogre SceneManager and other ogre pointers) HISTORY: 01/05/07 - OO - Initial version */ #ifndef OGREOBJECTMANAGER_H #define OGREOBJECTMANAGER_H #include <zeitgeist/leaf.h> #include <zeitgeist/class.h> namespace Ogre { class Camera; class SceneManager; class Viewport; class RenderTarget; } class OgreObjectManager : public zeitgeist::Leaf { public: /// Standard constructor OgreObjectManager(); /// Standard destructor ~OgreObjectManager(); /// set the SceneManager pointer void SetSceneManager(Ogre::SceneManager* sceneManager); /// return the SceneManager pointer Ogre::SceneManager* GetSceneManager() const; /// set the main camera pointer void SetMainCamera(Ogre::Camera* camera); /// return the main camera pointer Ogre::Camera* GetMainCamera() const; /// set the main viewport pointer void SetMainViewport(Ogre::Viewport* viewport); /// return the main viewport pointer Ogre::Viewport* GetMainViewport() const; /// set the render target (window) pointer void SetRenderTarget(Ogre::RenderTarget* render); /// return the render target pointer Ogre::RenderTarget* GetRenderTarget() const; protected: //! a pointer to the Ogre scenemanager used Ogre::SceneManager* mSceneManager; //! a pointer to the currently used main camera Ogre::Camera* mMainCamera; //! a pointer to the main viewport Ogre::Viewport* mMainViewport; //! a pointer to the render target Ogre::RenderTarget* mRenderTarget; }; DECLARE_CLASS(OgreObjectManager); #endif --- NEW FILE: ogrematerialexporter_c.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogrematerialexporter_c.cpp,v 1.1.2.1 2007/07/18 23:06:41 fruit 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. OgreMaterialExporter NOTE: This class serves as exporter, to register materiales with other graphic engines (possibly also for exporting) HISTORY: 03/05/07 - OO - Initial version */ #include "ogrematerialexporter.h" using namespace kerosin; void CLASS(OgreMaterialExporter)::DefineClass() { DEFINE_BASECLASS(kerosin/MaterialExporter); } --- NEW FILE: ogremeshexporter_c.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Tue May 9 2006 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogremeshexporter_c.cpp,v 1.1.2.1 2007/07/18 23:06:41 fruit 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. MeshBridge NOTE: This class serves as an (abstract) bridge, to register meshes with other graphic engines (possibly also for exporting) HISTORY: 30/03/07 - OO - Initial version */ #include "ogremeshexporter.h" using namespace oxygen; void CLASS(OgreMeshExporter)::DefineClass() { DEFINE_BASECLASS(oxygen/MeshExporter); } --- NEW FILE: ogreobjectmanager.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: ogreobjectmanager.cpp,v 1.1.2.1 2007/07/18 23:06:41 fruit 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. OgreObjectManager NOTE: This is a class collecting pointers to ogre objects to be used in various spark classes HISTORY: 01/05/07 - OO - Initial version */ #include "ogreobjectmanager.h" #ifdef __APPLE__ #include <Ogre/Ogre.h> #else #include <Ogre.h> #endif OgreObjectManager::OgreObjectManager() : mSceneManager(0), mMainCamera(0), mMainViewport(0), mRenderTarget(0) { } OgreObjectManager::~OgreObjectManager() { } void OgreObjectManager::SetSceneManager(Ogre::SceneManager* sceneManager) { mSceneManager = sceneManager; } Ogre::SceneManager* OgreObjectManager::GetSceneManager() const { return mSceneManager; } void OgreObjectManager::SetMainCamera(Ogre::Camera* camera) { mMainCamera = camera; } Ogre::Camera* OgreObjectManager::GetMainCamera() const { return mMainCamera; } void OgreObjectManager::SetMainViewport(Ogre::View... [truncated message content] |
From: Oliver O. <fr...@us...> - 2007-07-18 23:05:41
|
Update of /cvsroot/simspark/simspark/spark/plugin/openglsysogre In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25364/openglsysogre Log Message: Directory /cvsroot/simspark/simspark/spark/plugin/openglsysogre added to the repository --> Using per-directory sticky tag `projectx' |
From: Oliver O. <fr...@us...> - 2007-07-18 06:56:26
|
Update of /cvsroot/simspark/simspark/spark/plugin/movieff In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv6408 Added Files: Tag: projectx .cvsignore Log Message: --- NEW FILE: .cvsignore --- *.la *.lo .deps .libs Makefile Makefile.in |
From: Oliver O. <fr...@us...> - 2007-07-18 06:53:58
|
Update of /cvsroot/simspark/simspark/spark/plugin/movieff In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv5247 Added Files: Tag: projectx Makefile.am export.cpp iitemmovieff.cpp iitemmovieff.h iitemmovieff_c.cpp movieff.cpp movieff.h movieff_c.cpp Log Message: added movieff plugin --- NEW FILE: export.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group $Id: export.cpp,v 1.1.2.1 2007/07/18 06:53:54 fruit 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. */ #include "movieff.h" #include "iitemmovieff.h" #include <zeitgeist/zeitgeist.h> ZEITGEIST_EXPORT_BEGIN() ZEITGEIST_EXPORT(MovieFF); ZEITGEIST_EXPORT(IItemMovieFF); ZEITGEIST_EXPORT_END() --- NEW FILE: movieff.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: movieff.h,v 1.1.2.1 2007/07/18 06:53:54 fruit 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. MovieFF HISTORY: 26/05/07 - OO - Initial version */ #ifndef MOVIEFF_H #define MOVIEFF_H #include <ffmpeg/avformat.h> #include <oxygen/sceneserver/sceneserver.h> #include <kerosin/renderserver/baserenderserver.h> #include <kerosin/renderserver/customrender.h> #include <fstream> class MovieFF : public kerosin::CustomRender { public: MovieFF(); virtual ~MovieFF(); virtual void OnLink(); // called each step after the renderer finished virtual void Render(); //! open a movie file bool Open(const std::string& name); //! finish the file void Close(); //! start a series of snapshots (static pictures of the current scene) bool StartSnapshots(const std::string& s); //! stop taking snapshots void StopSnapshots(); protected: bool InitBuffers(); void FreeBuffers(); void RecordInternalState(const std::string& name); protected: /** cached reference to the RenderServer */ boost::shared_ptr<kerosin::BaseRenderServer> mRenderServer; /** chached reference to the SceneServer */ boost::shared_ptr<oxygen::SceneServer> mSceneServer; unsigned int mEncLength, mRGBLength, mYUVLength; //! pointer to a yuv buffer uint8_t* mYUVBuffer; //! pointer to a rgb buffer uint8_t* mRGBBuffer; //! pointer to a buffer uint8_t* mEncBuffer; //! reference to a codec context AVCodecContext* mContext; //! reference to a codec AVCodec* mCodec; //! pointer to a frame buffer AVFrame* mRGBpic; //! pointer to a frame buffer AVFrame* mYUVpic; //! flag if the movie file was successfully opened bool mOpen; //! file handle std::ofstream mFile; //! the rate for taking snapshots (every 'rate' call of Render(), we take one) unsigned int mSnapRate; //! flag if we currently want to take snapshots or not bool mDoSnaps; //! the base name for snapshot files std::string mSnapName; //! are we OK? bool mInitialized; }; DECLARE_CLASS(MovieFF); #endif // MOVIEFF_H --- NEW FILE: iitemmovieff_c.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: iitemmovieff_c.cpp,v 1.1.2.1 2007/07/18 06:53:54 fruit 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. IItemMovieFF HISTORY: 26/05/07 - OO - Initial version */ #include "iitemmovieff.h" void CLASS(IItemMovieFF)::DefineClass() { DEFINE_BASECLASS(kerosin/InputItem); } --- NEW FILE: Makefile.am --- if BUILD_KEROSIN pkglib_LTLIBRARIES = movieff.la endif movieff_la_SOURCES = \ movieff.cpp movieff.h movieff_c.cpp \ iitemmovieff.cpp iitemmovieff.h iitemmovieff_c.cpp \ export.cpp # -module tells automake we're not building a library but a loadable module # so we don't need the "lib" prefix in the module name movieff_la_LDFLAGS = -module -avoid-version -lavformat -lavcodec -lavutil AM_CPPFLAGS = -I${top_srcdir}/lib @RUBY_CPPFLAGS@ -D__STDC_CONSTANT_MACROS --- NEW FILE: iitemmovieff.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: iitemmovieff.cpp,v 1.1.2.1 2007/07/18 06:53:54 fruit 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. InputItem for MovieFF HISTORY: 26/05/07 - OO - Initial version */ #include "iitemmovieff.h" #include <zeitgeist/scriptserver/scriptserver.h> #include <zeitgeist/corecontext.h> #include <iomanip> #include <sstream> // just an arbitrary number (above 12) static const int CmdRecord = 95; static const int CmdSnapshot = 96; IItemMovieFF::IItemMovieFF() : mRec(false), mMovieNo(0) { } void IItemMovieFF::OnLink() { boost::shared_ptr<zeitgeist::ScriptServer> scriptServer = GetCore()->GetScriptServer(); // publish constants to the scripts scriptServer->CreateVariable("Command.Record", CmdRecord); scriptServer->CreateVariable("Command.Snapshot", CmdSnapshot); time_t timet = time(0); tm* now = localtime(&timet); int year = now->tm_year - 100; while (year < 0) year += 100; // fix for wrong clocks while (year > 99) year -= 100; // be future proof for beyond robocup 2099 ;-) std::ostringstream ss; ss << std::setw(2) << std::setfill('0') << year << std::setw(2) << std::setfill('0') << now->tm_mon + 1 << std::setw(2) << std::setfill('0') << now->tm_mday << std::setw(2) << std::setfill('0') << now->tm_hour << std::setw(2) << std::setfill('0') << now->tm_min; mFilenameInfix = ss.str(); } void IItemMovieFF::ProcessInput(const kerosin::Input& input) { // just an arbitrary constant. It has to be mapped to a key somewhere (e.g. bindings.rb) if ((input.mId != CmdRecord) && (input.mId != CmdSnapshot)) return; if (mMovieFF.get() == 0) { boost::shared_ptr<zeitgeist::CoreContext> context = GetCore()->CreateContext(); mMovieFF = boost::shared_static_cast<MovieFF> (context->New("MovieFF", "/sys/server/simulation/RenderControl/MovieFF")); if (mMovieFF.get() == 0) { return; } } switch (input.mId) { case CmdSnapshot: if (mSnap) { mMovieFF->StopSnapshots(); mSnap = false; } else { mSnap = mMovieFF->StartSnapshots("sparkphoto_" + mFilenameInfix); std::cerr << "(iitemmovieff) starting snapshots\n"; } break; case CmdRecord: if (mRec) { ++mMovieNo; mMovieFF->Close(); mRec = false; } else { std::ostringstream ss; ss << "sparkmovie_" << mFilenameInfix << "-" << mMovieNo << ".mpg"; mRec = mMovieFF->Open(ss.str()); } break; default: ;/* nothing to do */ } return; } --- NEW FILE: iitemmovieff.h --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: iitemmovieff.h,v 1.1.2.1 2007/07/18 06:53:54 fruit 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. InputItem for MovieFF HISTORY: 26/05/07 - OO - Initial version */ #ifndef IITEMMOVIEFF_H #define IITEMMOVIEFF_H #include "movieff.h" #include <kerosin/inputserver/inputitem.h> class IItemMovieFF : public kerosin::InputItem { public: IItemMovieFF(); virtual ~IItemMovieFF() {} virtual void OnLink(); virtual void ProcessInput(const kerosin::Input& input); private: bool mRec; bool mSnap; unsigned int mMovieNo; boost::shared_ptr<MovieFF> mMovieFF; std::string mFilenameInfix; }; DECLARE_CLASS(IItemMovieFF); #endif // IITEMMOVIEFF_H --- NEW FILE: movieff_c.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: movieff_c.cpp,v 1.1.2.1 2007/07/18 06:53:54 fruit 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. MovieFF HISTORY: 26/05/07 - OO - Initial version */ #include "movieff.h" FUNCTION(MovieFF,open) { std::string filename; if ( (in.GetSize() != 1) || (! in.GetValue(in[0],filename)) ) { return false; } return obj->Open(filename); } FUNCTION(MovieFF,closeMovie) { if ( (in.GetSize() != 0)) { return false; } obj->Close(); return true; } void CLASS(MovieFF)::DefineClass() { DEFINE_BASECLASS(kerosin/CustomRender); DEFINE_FUNCTION(open); DEFINE_FUNCTION(closeMovie); } --- NEW FILE: movieff.cpp --- /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- this file is part of simspark Wed May 9 2007 Copyright (C) 2002,2003 Koblenz University Copyright (C) 2007 RoboCup Soccer Server 3D Maintenance Group $Id: movieff.cpp,v 1.1.2.1 2007/07/18 06:53:54 fruit 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. MovieFF HISTORY: 26/05/07 - OO - Initial version */ #include "movieff.h" #include <zeitgeist/logserver/logserver.h> #include <oxygen/physicsserver/hingejoint.h> #include <oxygen/physicsserver/universaljoint.h> #include <iomanip> #include <sstream> MovieFF::MovieFF() : mEncLength(0), mRGBLength(0), mYUVLength(0), mYUVBuffer(0), mRGBBuffer(0), mEncBuffer(0), mContext(0), mCodec(0), mRGBpic(0), mYUVpic(0), mOpen(false), mSnapRate(15), mDoSnaps(false), mSnapName("movieff_"), mInitialized(false) { av_register_all(); } MovieFF::~MovieFF() { StopSnapshots(); Close(); } void MovieFF::OnLink() { mRenderServer = boost::shared_dynamic_cast<kerosin::BaseRenderServer>(GetCore()->Get("/sys/server/render")); if (mRenderServer.get() == 0) { GetLog()->Error() << "(MovieFF) ERROR: RenderServer not found\n"; } mSceneServer = boost::shared_dynamic_cast<oxygen::SceneServer>(GetCore()->Get("/sys/server/scene")); if (mSceneServer.get() == 0) { GetLog()->Error() << "(MovieFF) ERROR: SceneServer not found\n"; } std::cerr << "(MovieFF) OnLink\n"; } void MovieFF::Render() { if (!mOpen && !mDoSnaps) { return; } if (!mRenderServer->CopyFrame((char*) mRGBBuffer)) { std::cerr << "(MovieFF) couldn't get buffer content\n"; return; } static unsigned int snapCounter = 0; static unsigned int snapNo = 0; // do snapshots if requested if (mDoSnaps && ++snapCounter >= mSnapRate) { snapCounter = 0; std::ostringstream fnstr, internalstr; fnstr << mSnapName << "-" << std::setw(4) << std::setfill('0') << snapNo << ".ppm"; internalstr << mSnapName << "-" << std::setw(4) << std::setfill('0') << snapNo << ".txt"; std::cerr << "Opening " << fnstr.str().c_str() << "\n"; std::ofstream ppm(fnstr.str().c_str()); ppm << "P3\n"; ppm << "# " << fnstr.str() << ", generated by simspark movieff plugin.\n"; ppm << mContext->width << " " << mContext->height << "\n255\n"; for (int y = 0; y < mContext->height; ++y) { ppm << " "; for (int x = 0; x < mContext->width; ++x) { ppm << (int) mRGBBuffer[y * mContext->width * 3 + x * 3 + 0] << " "; ppm << (int) mRGBBuffer[y * mContext->width * 3 + x * 3 + 1] << " "; ppm << (int) mRGBBuffer[y * mContext->width * 3 + x * 3 + 2] << "\n"; } } ppm.close(); RecordInternalState(internalstr.str()); snapNo++; } if (!mOpen) return; /* * Colorspace conversion from RGB to codec's format (likely YUV420P). * OpenGL's RGB pixel format is RGB24 in lavc. */ img_convert((AVPicture *) mYUVpic, mContext->pix_fmt, (AVPicture *) mRGBpic, PIX_FMT_RGB24, mContext->width, mContext->height); /* Encode the frame yuv_pic storing the output in enc_buf. */ int size = avcodec_encode_video(mContext, mEncBuffer, mEncLength, mYUVpic); if (size) { mFile.write((char *)mEncBuffer, size); } } bool MovieFF::Open(const std::string& name) { if (mOpen) return true; std::cerr << "(MovieFF) open " << name << "\n"; if (!InitBuffers()) return false; mFile.open(name.c_str()); if (!mFile.is_open()) { GetLog()->Error() << "(MovieFF) ERROR: opening output file " << name << "\n"; FreeBuffers(); return false; } mOpen = true; return true; } void MovieFF::Close() { static bool exit = false; if (!exit) { exit = true; return; } std::cerr << "(MovieFF) Closing movie\n"; FreeBuffers(); mFile.close(); mOpen = false; } bool MovieFF::StartSnapshots(const std::string& s) { mSnapName = s; mDoSnaps = true; if (mRenderServer.get() == 0) { std::cerr << "(MovieFF) mRenderServer expired\n"; GetLog()->Error() << "(MovieFF) ERROR: No reference to RenderServer\n"; return false; } return InitBuffers(); } void MovieFF::StopSnapshots() { return; std::cerr << "(MovieFF) Stopping snapshots\n"; FreeBuffers(); mDoSnaps = false; } void MovieFF::RecordInternalState(const std::string& name) { if (mSceneServer.get() == 0) return; boost::shared_ptr<oxygen::Scene> scene(mSceneServer->GetActiveScene()); if (scene.get() == 0) return; std::ofstream fout(name.c_str()); Leaf::TLeafList jointList; scene->GetChildrenSupportingClass("Joint", jointList, true); Leaf::TLeafList::const_iterator i = jointList.begin(); while (i != jointList.end()) { boost::shared_ptr<oxygen::UniversalJoint> uj = boost::shared_dynamic_cast<oxygen::UniversalJoint>(*i); boost::shared_ptr<oxygen::HingeJoint> hj = boost::shared_dynamic_cast<oxygen::HingeJoint>(*i); if (uj.get() != 0) { fout << uj->GetFullPath() << "1\t" << uj->GetAngle(oxygen::Joint::AI_FIRST) << "\n"; fout << uj->GetFullPath() << "2\t" << uj->GetAngle(oxygen::Joint::AI_SECOND) << "\n"; } else if (hj.get() != 0) { fout << hj->GetFullPath() << "\t" << hj->GetAngle() << "\n"; } ++i; } } bool MovieFF::InitBuffers() { if (mInitialized) return true; if (mRenderServer.get() == 0) { GetLog()->Error() << "(MovieFF) ERROR: No reference to RenderServer\n"; return false; } int width = mRenderServer->Width(); int height = mRenderServer->Height(); if (width < 1 || height < 1) { GetLog()->Error() << "(MovieFF) ERROR: RenderServer target size invalid\n"; return false; } std::cerr << "(MovieFF) Init buffers\n"; mContext = avcodec_alloc_context(); if (mContext == 0) { GetLog()->Error() << "(MovieFF) ERROR: Allocating the codec context failed\n"; return false; } mContext->codec_id = CODEC_ID_MPEG1VIDEO; mContext->codec_type = CODEC_TYPE_VIDEO; mCodec = avcodec_find_encoder(mContext->codec_id); if (mCodec == 0) { GetLog()->Error() << "(MovieFF) ERROR: Could not find MPEG-1 encoder\n"; av_free(mContext); return false; } mContext->pix_fmt = PIX_FMT_YUV420P; mContext->width = width; mContext->height = height; #if ( LIBAVCODEC_VERSION_INT >> 16 ) >= 51 mContext->time_base = ( AVRational ) { 1, 25 }; #else mContext->frame_rate = 25; #endif mContext->bit_rate = 1600 * 1000; mContext->gop_size = 10; mContext->max_b_frames = 1; int err = avcodec_open(mContext, mCodec); if (err < 0) { GetLog()->Error() << "(MovieFF) ERROR opening video output codec (" << err << ")\n"; av_free(mContext); return false; } mRGBpic = avcodec_alloc_frame(); mYUVpic = avcodec_alloc_frame(); if (mRGBpic == 0 || mYUVpic == 0) { GetLog()->Error() << "(MovieFF) Could not allocate avcodec frame\n"; av_free(mContext); av_free(mRGBpic); av_free(mYUVpic); return false; } /* enc_buf holds the encoded frame, so enc_len must be at least * a reasonable estimate of the size of the largest I-frame. */ mEncLength = width * height * 3; mEncBuffer = new uint8_t[ mEncLength ]; /* rgb_buf holds the unencoded frame in packed RGB from OpenGL. */ mRGBLength = avpicture_get_size(PIX_FMT_RGB24, width, height); mRGBBuffer = new uint8_t[ mRGBLength ]; avpicture_fill(( AVPicture * ) mRGBpic, mRGBBuffer, PIX_FMT_RGB24, width, height); // yuv_buf holds the unencoded frame in codec's native pixel format. mYUVLength = avpicture_get_size(mContext->pix_fmt, width, height); mYUVBuffer = new uint8_t[mYUVLength]; avpicture_fill(( AVPicture * ) mYUVpic, mYUVBuffer, mContext->pix_fmt, width, height ); mInitialized = true; return true; } void MovieFF::FreeBuffers() { if (mOpen && mDoSnaps) return; std::cerr << "(MovieFF) Freeing buffers\n"; mInitialized = false; if (mOpen) { // Flush any frames left in lavc buffer by encoding a NULL frame. for (int i = 0; i <= mContext->max_b_frames; ++i) { int size = avcodec_encode_video(mContext, mEncBuffer, mEncLength, NULL); if (size) mFile.write((char*)(mEncBuffer), size); } char trailer[4]; trailer[0] = 0x00; trailer[1] = 0x00; trailer[2] = 0x01; trailer[3] = 0xb7; mFile.write(trailer, 4); avcodec_close(mContext); } delete[] mRGBBuffer; mRGBBuffer = 0; delete[] mYUVBuffer; mYUVBuffer = 0; delete[] mEncBuffer; mEncBuffer = 0; av_free(mContext); av_free(mRGBpic); av_free(mYUVpic); } |
From: Oliver O. <fr...@us...> - 2007-07-18 06:52:59
|
Update of /cvsroot/simspark/simspark/spark/plugin/movieff In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4850/movieff Log Message: Directory /cvsroot/simspark/simspark/spark/plugin/movieff added to the repository --> Using per-directory sticky tag `projectx' |
From: Markus R. <rol...@us...> - 2007-07-15 12:13:31
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23245 Modified Files: kinematicframe.cpp kinematicframe.h Log Message: - added method AddJointDescription() - show jointdescription (i.e. type and full path) on a separate line - show a joint specific icon next to the joint description Index: kinematicframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/kinematicframe.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** kinematicframe.h 15 Jul 2007 10:41:10 -0000 1.3 --- kinematicframe.h 15 Jul 2007 12:13:13 -0000 1.4 *************** *** 75,79 **** --- 75,82 ---- protected: int GetParamVel(int axis) const; + + void AddJointDescription(boost::shared_ptr<oxygen::Joint> joint); void AddJointControl(boost::shared_ptr<oxygen::Joint> joint, int axis); + void OnSliderChanged(wxCommandEvent& event); void OnScrollChanged(wxScrollEvent& event); *************** *** 89,92 **** --- 92,99 ---- TJointControlMap mJoints; + wxBitmap mBmpUniversal; + wxBitmap mBmpSlider; + wxBitmap mBmpHinge; + }; // wxGlade: end class Index: kinematicframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/kinematicframe.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** kinematicframe.cpp 15 Jul 2007 10:41:10 -0000 1.3 --- kinematicframe.cpp 15 Jul 2007 12:13:13 -0000 1.4 *************** *** 31,34 **** --- 31,37 ---- #include <oxygen/physicsserver/sliderjoint.h> #include <oxygen/physicsserver/hingejoint.h> + #include <rsgedit/res/xpm_universal.xpm> + #include <rsgedit/res/xpm_slider.xpm> + #include <rsgedit/res/xpm_hinge.xpm> BEGIN_EVENT_TABLE(kinematicFrame, wxFrame) *************** *** 47,51 **** kinematicFrame::kinematicFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): wxFrame(parent, id, title, pos, wxSize(640,-1), ! wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER|wxFRAME_TOOL_WINDOW|wxFRAME_NO_TASKBAR|wxFRAME_FLOAT_ON_PARENT|wxCLIP_CHILDREN) { SetTitle(wxT("Kinematics")); --- 50,55 ---- kinematicFrame::kinematicFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style): wxFrame(parent, id, title, pos, wxSize(640,-1), ! wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER|wxFRAME_TOOL_WINDOW|wxFRAME_NO_TASKBAR|wxFRAME_FLOAT_ON_PARENT|wxCLIP_CHILDREN), ! mBmpUniversal(xpm_universal), mBmpSlider(xpm_slider), mBmpHinge(xpm_hinge) { SetTitle(wxT("Kinematics")); *************** *** 59,68 **** int rows = 0; // dynamic ! int cols = 2; int vgap = 0; int hgap = 0; wxFlexGridSizer* sizer = new wxFlexGridSizer(rows, cols, vgap, hgap); ! sizer->AddGrowableCol(1); sizer->SetFlexibleDirection(wxHORIZONTAL); mCtrScrollWnd->SetSizer(sizer); --- 63,72 ---- int rows = 0; // dynamic ! int cols = 3; int vgap = 0; int hgap = 0; wxFlexGridSizer* sizer = new wxFlexGridSizer(rows, cols, vgap, hgap); ! sizer->AddGrowableCol(2); sizer->SetFlexibleDirection(wxHORIZONTAL); mCtrScrollWnd->SetSizer(sizer); *************** *** 73,77 **** } ! void kinematicFrame::AddJointControl(shared_ptr<Joint> joint, int axis) { wxSizer* sizer = mCtrScrollWnd->GetSizer(); --- 77,81 ---- } ! void kinematicFrame::AddJointDescription(shared_ptr<Joint> joint) { wxSizer* sizer = mCtrScrollWnd->GetSizer(); *************** *** 85,97 **** } ! wxString path = joint->GetFullPath(); wxStaticText* text = ! new wxStaticText( mCtrScrollWnd, wxID_ANY, path, wxDefaultPosition, wxDefaultSize, 0 ); sizer->Add(text, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxSlider* slider = new wxSlider( mCtrScrollWnd, wxID_ANY, 0, -179, 179, wxDefaultPosition, wxSize(250,-1), ! wxSL_HORIZONTAL|wxSL_AUTOTICKS|wxSL_LABELS ); sizer->Add(slider, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); --- 89,159 ---- } ! sizer->AddSpacer(0); ! ! wxStaticBitmap* bmp = 0; ! wxString strType; ! ! const int jt = joint->GetType(); ! switch (jt) ! { ! default: ! assert(false); ! strType = "?"; ! break; ! ! case dJointTypeUniversal: ! bmp = new wxStaticBitmap(mCtrScrollWnd, wxID_ANY, mBmpUniversal); ! strType = "Universal"; ! break; ! ! case dJointTypeHinge: ! bmp = new wxStaticBitmap(mCtrScrollWnd, wxID_ANY, mBmpHinge); ! strType = "Hinge"; ! break; ! ! case dJointTypeSlider: ! bmp = new wxStaticBitmap(mCtrScrollWnd, wxID_ANY, mBmpSlider); ! strType = "Slider"; ! break; ! } ! ! if (bmp == 0) ! { ! sizer->AddSpacer(0); ! } else ! { ! sizer->Add(bmp, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); ! } ! ! wxString path = strType + " at " + joint->GetFullPath(); wxStaticText* text = ! new wxStaticText(mCtrScrollWnd, wxID_ANY, path, wxDefaultPosition, wxDefaultSize, 0 ); ! ! sizer->Add(text, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); ! } ! ! void kinematicFrame::AddJointControl(shared_ptr<Joint> joint, int axis) ! { ! wxSizer* sizer = mCtrScrollWnd->GetSizer(); ! if ( ! (sizer == 0) || ! (joint.get() == 0) ! ) ! { ! assert(false); ! return; ! } ! + sizer->AddSpacer(0); + + wxString label(wxString::Format("%d :",axis)); + wxStaticText* text = + new wxStaticText( mCtrScrollWnd, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, 0 ); sizer->Add(text, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); wxSlider* slider = new wxSlider( mCtrScrollWnd, wxID_ANY, 0, -179, 179, wxDefaultPosition, wxSize(250,-1), ! wxSL_HORIZONTAL|wxSL_LABELS ); sizer->Add(slider, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); *************** *** 144,155 **** { shared_ptr<Joint> joint = shared_static_cast<Joint>(*iter); ! switch (joint->GetType()) { case dJointTypeUniversal: AddJointControl(joint, 0); AddJointControl(joint, 1); default: AddJointControl(joint, 0); break; --- 206,224 ---- { shared_ptr<Joint> joint = shared_static_cast<Joint>(*iter); + int jt = joint->GetType(); ! switch (jt) { + case dJointTypeFixed: + break; + case dJointTypeUniversal: + AddJointDescription(joint); AddJointControl(joint, 0); AddJointControl(joint, 1); + break; default: + AddJointDescription(joint); AddJointControl(joint, 0); break; |
From: Markus R. <rol...@us...> - 2007-07-15 12:11:36
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/res In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22438 Added Files: xpm_hinge.xpm xpm_slider.xpm xpm_universal.xpm Log Message: - added hinge, slider and universal icons for the kinematicframe --- NEW FILE: xpm_universal.xpm --- /* XPM */ static char *xpm_universal[] = { /* columns rows colors chars-per-pixel */ "64 21 220 2", " c None", "U. c #84869C", "j. c #343454", "i. c #BCDAFC", "2X c #8C8E90", "P. c #ACB2D4", "J c #6C77FC", "* c #A4A65C", "+X c #7C8AE4", ":. c #B4B024", "s. c #8492D4", "8 c #D4D2E4", "a. c #8CA6EC", "[ c #7C7A34", "+ c #ACAE54", "v c #ACB2E4", "u. c #C4E2FC", "x. c #1C1E28", "- c #B4AA1C", "qX c #646274", ",. c #4C4F3C", "!. c #545A34", "O c #949E2C", "F c #6C6A64", "R. c #444757", "eX c #94969C", "e c #C4C62C", "8X c #BCBCBC", "b. c #242626", "X. c #545A44", "}. c #5C6234", "R c #4C493D", "f. c #646EB4", ": c #BCB224", "& c #BCB6B4", "% c #E4E2E4", "a c #949E4C", "Z c #FCF624", "3. c #94ABFC", "%X c #747274", "k. c #9C9EA4", ".. c #54513B", "B. c #444777", "1. c #2C2E2D", "/. c #D4D624", "7 c #E4E2F4", ">. c #5C5C39", "2 c #C4C64C", "$. c #8C9AFC", "'. c #F4FEFC", "tX c #A4A6A0", "W. c #4C527C", "F. c #F4FA74", ",X c #2C2E3C", "=X c #545A6C", "T c #646432", ".X c #94923C", ":X c #444A94", "). c #9496CC", "f c #C4CAEC", " . c #5C5638", "j c #8C8EE4", "Y. c #7C7A7C", "5. c #9CB0FC", "H c #6477FC", "+. c #8C94FC", "M c #DCDB21", "E. c #4C528C", "W c #343636", "z. c #645E34", "L c #646EEC", "G c #6471F9", "Q. c #ACAEAC", "P c #747ECC", "9X c #CCC6CC", "g. c #545A90", "] c #3C3E3E", "S. c #6C6634", "r c #DCD224", "# c #DCD6B4", "t. c #A4B2FC", "<. c #444634", "&X c #646464", "5 c #FCFAFC", "^ c #7484FC", "0. c #44463E", "h c #9C9EF4", "<X c #8C8A8C", "} c #F4F624", ";X c #545AAC", "t c #E4DA24", "oX c #5C6EC4", "4X c #DCDCDE", "i c #F4F018", "#X c #44464C", "{ c #BCBA28", "/ c #747EFC", "> c #BCB418", "A c #FCFE24", ", c #ACBE14", "M. c #5C62AC", "9 c #DCDFF7", "= c #9CA214", "H. c #C4C6AC", "y. c #C4DEFC", "C. c #444965", "3 c #E4D2A4", "~. c #545639", "E c #4C4E4C", "C c #FCFE30", ">X c #3C3E74", "x c #545ACC", "_. c #B4B6E4", "D. c #F4F64C", "3X c #C4C6C4", "| c #8C862C", ". c #B4AAC4", "b c #D4D6A4", "6 c #ECF2FC", "0X c #545654", "yX c #ECECEC", "y c #ECD624", "K c #6476EC", "w c #CCC420", "^. c #948E2C", "n. c #949EE4", "h. c #4C4E71", " X c #ACB224", "@ c #D4CA94", "c. c #DCDEAC", "I c #F4F7F9", "rX c #A4A2A4", "I. c #54566C", "4. c #A4BAFC", "*. c #343232", "' c #343544", "( c #6C7EFC", "|. c #34323C", "N c #E4E224", "O. c #3C3A32", "; c #C4AA24", "L. c #ACAAAF", "_ c #B4CAEC", "l. c #A49E34", "e. c #6C622C", "$X c #3C404C", "q. c #74702E", "&. c #9492EC", "#. c #84A2FC", "$ c #FCF6EC", "! c #7C94FC", "U c #4C4A14", "X c #C4C27C", "-. c #3C3A3C", "`. c #D4DCFC", "J. c #8C8E14", "OX c #B4CAFC", "2. c #3C3A44", "]. c #E4F5FC", "r. c #444234", "A. c #B4B2B4", "@. c #8CAAFC", "Q c #7C8EFC", "d c #D4D6F9", "g c #ACB6F4", "@X c #545CBC", "S c #444241", "*X c #7C7224", "XX c #CCEEFC", ";. c #8C8E2C", "T. c #44424C", "Z. c #E4E6E4", "~ c #7C88FC", "q c #B4BA64", "(. c #CCD22C", "G. c #F4F6C4", "z c #5462E4", "o c #949624", "u c #ECDE24", "%. c #8493FC", "7X c #747678", "9. c #E4E6F4", "wX c #4C4A4C", "8. c #8C9EFC", "m. c #6C7ABC", "6. c #9CB7F9", "B c #F4E624", "n c #A4A614", "p c #E4EA0C", "-X c #BCC6FC", ") c #5C6AEC", "Y c #9C9E2C", "{. c #4C4A5C", "l c #6472DC", "7. c #94A6FC", "K. c #242A5C", "m c #D4D121", "s c #ECEEFC", "` c #2C292C", "uX c #7C7E84", "[. c #4C4A68", "V c #FCEE24", "d. c #7482C4", "1 c #B4C22C", "o. c #54525C", "5X c #CCCACC", "=. c #3C423C", "0 c #B4BAA4", "N. c #4C5094", "w. c #6C6A34", "1X c #5C5A5C", "6X c #848384", "V. c #4C4A84", "c c #4C56AC", "k c #7482DC", "< c #B4B61C", "v. c #D4D5D1", "p. c #B4D2FC", "D c #64624C", "4 c #F4DEBC", /* pixels */ " ", " . X o O + @ # $ ", " % & * = - ; : : > , < 1 2 3 4 $ 5 6 7 8 9 5 ", " 0 q > w w e r r t t y u u u i p a s d f g h j k l z x x x c v ", " b n m r M N B V C Z C A C A A A : S D F G H H H J J J H J H K L z P I ", " U Y r A A C A C A C A A A C M T R R D E W Q ! ~ Q ~ ~ ^ ^ ^ / ( ( G ) _ ", " ` W ' ] [ { } A A A A C Z | . ...R X. o.O.] +.@.#.$.$.+.%.%.~ %.~ ~ / G &. ", " *.=.S S ] -.-...;.w A :.T T >. .,.R <. 1.S ] 2.3.4.5.6.3.3.7.7.8.8.%.$.8.! ~ 9. ", " S ] S S S 0.0.R S S q.q.w.e. .r.S S W ` ] S ] 2.t.y.y.u.i.p.6.a.s.d.f.g.h.j.k. ", " S ] ] S S S 0.0.R R q.q.T >.>.M l.z.x. c.v. b.O.-.S ] 2.n.m.M.N.B.V.B.B.C.C.C.C.' Z. ", " A.W S =.S S S 0.R 0.T S.z...| } A A C D.F.G. H.p J.K.L. I 7 P.I.U.Y.-.T.R.c E.E.W.W.h.h.h.C.C.R.R.1. ", " Q.*.S S ] S S S 0.S >.T !...] W ~.^./.A A A (.J.i ). 6._.9 d d 9 `.s '.].1.=.R.g.W.E.h.h.h.[.C.{.R.{.T.' ", " ` ] S =.S =.S S 0.R }.~.,.,.S 2.' |.O.e.{ T X.X]. XXoX 6 `.OX3.+XoX@XN.B.] S C.h.h.h.[.[.C.{.R.R.#XT.$X%X ", " *.] S S ] S S S 0.0.>...,.R R 0.W 2.&Xo.$X' *X=X+.-X! B.;X:X>Xj.,X|.W R O.] ] S r.C.W.[.h.C.C.{.R.T.R.#XT.W L. ", " W ] ] S S ] S S S S >.,.R R 0.1.<X 6 Q.Y.1XS S B.;XB.W E 1X%X2XQ.3X4X4X1.S S ] ] R.[.C.{.R.R.T.R.R.T.T.T.W L. ", " b.*.W ] ] S =.S S ~.,.R S b.5X 6X7X-.] ] *.-.4X 8X1.] S S R.{.R.R.R.R.R.#XT.#XS $X` ", " 9X<XW *.W ] S =...R W 0X% I 2XqX] wXeX wX] S ] C.R.R.#XT.R.T.#XT.=.T.=.,X ", " v.2X-.1.W <.1.eX 3Xb.-.S #XR.T.{.R.#XT.T.S T.T.W rX ", " 4X<XwXv. -.] R.{.T.T.S T.] W W W 1.x.5 ", " 4X` -.W W W 1.-.&X6XtX3XyX ", " 8XuXL.3XZ. " }; --- NEW FILE: xpm_slider.xpm --- /* XPM */ static char *xpm_slider[] = { /* columns rows colors chars-per-pixel */ "64 30 223 2", " c None", "A c #5C5EF4", "[ c #3C3624", "Q. c #909AD8", "_. c #4C4A94", "; c #DCCE9C", "k c #A49A2C", "w c #ECEF2F", "| c #ACA6AC", "& c #D4AE64", "oX c #3C3C48", "(. c #2C265C", "d c #141324", "r c #F4F724", ". c #F4EAFC", "= c #FCF2EC", "&X c #2C296B", "5. c #6466FC", "I c #443B22", "K c #1C1B1B", "tX c #342E54", "9X c #B4AEAC", "q. c #ECF254", "Y. c #9CC2FC", "%. c #4C4624", "q c #DCEA14", "S. c #E4EEF8", "m. c #94B4FC", "J c #BCBCB4", "2. c #8CA6FC", "C. c #1C1E34", "~. c #ECF6EC", "8. c #443E44", "^ c #8495FC", ", c #CCCE24", "y. c #A4CAFC", "S c #7C84F8", "6. c #343A9C", "7X c #242634", "R c #C4BEA4", "@. c #4C56FC", "x c #2C2B25", "'. c #F4FEF8", "i c #ECF27C", "g. c #040204", "e. c #F4F2D4", "# c #9C940C", "M. c #5C66E4", "6X c #7C7A79", "` c #343324", "P c #2C2B37", "V c #2C2526", "rX c #2C2E46", "4 c #D4CA14", "XX c #544E4F", "4. c #8F9EFC", "' c #343634", "Z c #748AE4", "d. c #A4A224", "] c #3C3B24", "=X c #6C6AB4", ":X c #F4ECE4", "t. c #8CB4FC", "H c #DCEEF8", "b c #ACABA9", "uX c #848284", "+. c #6C7CFC", "u. c #A2BBFC", "u c #FCFAF0", "&. c #444324", "! c #505EFC", "6 c #DCDE4C", "|. c #5C565F", "i. c #A4B2FC", "O c #FCFAFC", "n. c #94BCFC", "<. c #8CAEFC", "X c #F4E6EC", ".. c #7484FC", "$ c #AC9E14", "2X c #34335A", "w. c #F4EE8C", "T c #7C7624", "+X c #5C629C", "W c #6C73FC", "- c #F0F2F8", "9. c #545624", "o. c #7C8CFC", "O. c #747EFC", "e c #FCFE24", "Z. c #847E24", "E. c #34367C", "G. c #C4DEFC", "wX c #949294", "g c #E4E4E0", "I. c #ACDAFC", "$. c #8C90BC", "t c #C4C224", "z c #242526", "N. c #7C826C", ">. c #F4FAD4", ";X c #848EEC", "a c #FCFE36", "j c #7C8A0C", ".X c #4C4B51", ",X c #747478", "P. c #B4E2FC", ") c #E4E4F4", "]. c #A4C6FC", "> c #C4B614", "^. c #747A94", "-. c #9C9C24", "8 c #ECECEC", "H. c #DCFCFC", "0. c #FCFE50", "2 c #E0D424", "h c #A4A294", "x. c #B4DCFC", "D c #94A4F8", "* c #E0DECC", "`. c #9CA6D4", " X c #545359", ",. c #8C96FC", "4X c #7C8EBC", ">X c #CCCECC", "a. c #545664", "M c #9C9624", "o c #F4F7F6", "+ c #DCDEAC", "-X c #CCDAFC", "1 c #E0CE22", "f. c #FCFE64", "#. c #6C7EEC", " . c #BCBEFC", "f c #0C0C0F", "B. c #A4A2A8", "aX c #7C767C", "5X c #545674", "Q c #5C65FC", "5 c #D4C614", "< c #D4CC28", "C c #D4D6CC", "% c #C4B63C", "s. c #5C5B5C", "y c #141408", "U. c #ACC5FC", "J. c #E4FEFC", "pX c #706E70", "eX c #343549", "z. c #BCDEFC", "B c #3C3D39", "c. c #B4D0FC", "h. c #D4D6DC", "c c #141415", "@X c #2C2A58", "p. c #9CA6FC", "E c #646DFC", "_ c #ACA4A0", "X. c #7C94FC", "D. c #647EBC", "W. c #5462BC", "l. c #C4E6FC", "n c #140E14", "F c #ACBCFC", "0X c #DCDEE0", "$X c #343565", "{. c #B4B2B4", "3 c #CCD214", "3. c #849CFC", "A. c #BCBC2C", "l c #1C1C24", "k. c #CCEEFC", "8X c #1C1614", "). c #2F2E6C", "7. c #242A2C", "@ c #B4AE34", "1X c #645A64", "0 c #D4DA14", "qX c #BCBDBF", "j. c #C1D3FC", "T. c #343888", "V. c #242A34", "<X c #6C686C", "*. c #F4F234", ";. c #BCC254", "( c #CCC2FC", "{ c #4F4B24", "N c #F4EC24", "3X c #5C5EAC", "K. c #CCE8FC", "b. c #B0CAFC", "s c #5C5A24", ": c #C4BE24", "1. c #94ACFC", "R. c #9C9C9C", "~ c #5462F8", "m c #241E24", "L. c #CCE2FC", "=. c #D4DA34", "}. c #4C4A5C", "F. c #9CAEE4", "Y c #D4D424", "v. c #ACD0FC", "} c #040614", "!. c #D4EDFC", "yX c #C4C2CC", "/. c #242448", "OX c #6466BC", "iX c #2C324C", "7 c #E4D664", "v c #FCFEE4", "#X c #2C3258", "G c #CCD6F4", "/ c #9CABF7", "[. c #A49EA1", "L c #342E26", "9 c #DCCE84", "%X c #2C3264", "*X c #444294", ":. c #ECF6B4", "U c #6C6424", "p c #F4FA14", "r. c #ECE2F8", /* pixels */ " . X o O O ", " + @ # # $ @ % & * = = O O O ", " - ; : > , < 1 1 1 2 1 3 4 5 < 6 7 O ", " O 8 9 0 q w e r e e e e e e e e e e t y = ", " u i p e e e e e e a e e e e e e e e s d f g ", " h j : r e e e a e e e e a e e e k l z x c * v o O O ", " b n m l x s M : N e a e e e 2 B z x V x n C Z A S D F G H v ", " J K x x L L x x P I U M Y T z x L x x z c R v D E W W E Q Q ! ~ W ^ / ( ) ", " _ c x x P x ` ' ] ] [ I { I [ ` x l d d } | v ...^ X.o...S ..O.+.W E Q ~ ! @.A #.$. ", " c x x x x L ` ` [ I I %.&.L P l *.a =.-.;.:.>. G ,.<.1.2.2.3.4.^ ^ ^ ..o...+.W W E 5.6. ", " K z 7.x x x x ' ` ' B 8.&.L V 9.e e a 0.a e 0.r w q.w.e.v r.t.y.y.F u.F i.i./ p.4.3.3.^ o.S ..+.W a. ", " s.m z V x P x x x L ` ] ] x x x &.U d.2 r e e a f.0.0.g.h. v o j.k.l.z.x.x.c.v.v.b.F u.n.m.<.2.3.X.^ M.N. ", " B.K z 7.V x x x x ` x ' ] x V.z z z l C.L { Z.A.N e k .- S.r.r.8 v $.D.F.G.H.J.H.H.K.L.P.I.v.c.U.Y.n.m.1.<.T.R. ", " _ c V z z 7.x x x x L x ' x x V z z z z x z l c z %.I C.E.W.Q.c.!.- S.~.^./.(.(.)._.D.`.j.J.'.o S.K.G c.v.].u.u.n [. ", " {.c 7.V z V 7.x x x x x ` x z z x z K z }.|. X.X8.P l B s.XXoXP /.E.OXi.+X@X#X$X$X%X$X&X&X&X*X=XQ.b.!.J.H.l.-X;Xg. ", " :Xy z x 7.z V 7.P x x x ` V x z z K s. - >X[.,X X X X|. X.X X|.<X1X.XB P 2X#X$X#X$X$X$X$X%XE.).&X&X(.T.3X4XU.5Xy ", " 6Xf K m z z V 7.x x x ` 7Xz z 8X.X 8 9X0X :XqXwX<X.X}.|.eXrXrXtX#XtX#X2X$X$X2X$X$X$X$X$X).&X(.l K ", " O u yXuXB c c K z z V x x V z l ,X O 0XqXeXP rXrXrXiXtX#X2X#X2X#X2X#X2X%X2X2X2XK R. ", " O qX6XB d c l z K x - o oX7XrXP rXrXrXtXrXtX#X2X#X2X2X2X#X%X2Xy B. ", " u J 6X' X P P P P P P P P P rXrXrXiXrXrXrXiXtXrXc B. ", " O o O O o l 7XP P P P P rXP P P P rXrXrX@XrXrXx f ", " O n V.V P V.P V.V P P P P P P P P P rXz c ", " c P V.V 7XP P P V.P 7XrXP P P P P P K [. ", " f z 7XP P V.V 7XP V.P V P 7XP P 7XP c [. ", " d z V V.z V V.P z P 7XV.P P 7XP P z f ", " x K K l z V.V z P 7Xx V.V 7.P z 7Xz s. ", " O 8 {.,XP K l l z z V V.V V.V V.P 8XR. ", " g b pXP l K l z z 7Xx z f ", " X b pXP K K l z d ", " O O o O O O ) {.aXx 9X " }; --- NEW FILE: xpm_hinge.xpm --- /* XPM */ static char *xpm_hinge[] = { /* columns rows colors chars-per-pixel */ "64 22 213 2", "_ c #3C4249", " c None", " . c #DCD62C", "( c #848084", "N c #D4D2D1", "x. c #747234", "a. c #444A3F", "1X c #8C8E8C", ". c #ECF6CC", "l. c #B4B634", "u. c #3C425C", "a c #F4FEBC", "4. c #9C9E74", "<. c #4C523C", "9. c #3C4264", "3. c #7C7A34", "^. c #8C8B94", "u c #E4DE34", "q c #D4E21C", "p. c #DCDADC", "X. c #3C3644", "c c #F4EE14", "< c #A4AAFC", "9X c #949694", "OX c #545A38", "O. c #5C5A8C", "6 c #545ECC", "-. c #444A64", "8. c #44475C", "$X c #4C462C", "t c #DCEA1C", "B. c #8C9ADC", "B c #6C6A74", "@X c #E4E2E1", "C c #8CA0FC", "/. c #4C463C", "D. c #444A7C", "v c #FCF624", "~. c #9C9EA4", "Z c #848FFC", "*X c #2C2E2D", "W. c #9496BC", "0X c #C4BEB4", "U c #9CB6FC", ":. c #544E3B", "R c #8C9AFC", "| c #CCC82C", ";. c #ECEAEC", "] c #A4C1FC", "0 c #D4D630", "V c #6462AC", "+X c #A4A6A4", ", c #C4D0FC", "U. c #9C9A2C", "4 c #5C66EC", "' c #4C5284", "e. c #B4DAFC", "K c #7C7A7C", "- c #E4EAA4", "J. c #5C563B", "T c #94A2FC", "P c #343635", "3 c #5C66F4", "o c #ECEAFC", ":X c #5C6268", "e c #E4E620", "8 c #F4F2F1", "(. c #645E34", "f. c #6C6624", "h. c #A4A230", "j c #6C7FFC", "6X c #ACAEB1", "5. c #F4F2FC", "t. c #747ED4", "i c #F4E24C", "s. c #44462C", "s c #C4BEEC", "F. c #3C3E45", "1. c #BCC634", "P. c #44463F", "% c #BCBA1C", "+ c #A4A6E4", "%. c #ACBAFC", "r. c #8CA2E4", "m c #FCFE19", "H. c #4C4E3B", "1 c #7C8CFC", "Z. c #444652", "b. c #E4E65C", "-X c #BCBEBC", "n c #FCFE24", "w. c #C4DEFC", "d c #8497FC", "$. c #B4C2FC", "7 c #646A9C", "R. c #9C9A84", "&X c #BCBEC8", "G c #FCFE31", "_. c #54563C", "& c #C4C228", "]. c #4C4E50", "A c #7C86FC", "@. c #444664", "g. c #847E34", "9 c #F4EEB4", "}. c #4C4844", "k. c #FCFE3C", "z. c #5C5E34", "* c #CCD64C", "2X c #C4C6C8", " X c #6C72A4", "Q. c #444674", "Y c #94AAFC", "2. c #9CA234", "L. c #64662C", "c. c #8C8634", "2 c #5C6BF4", "7X c #2C2A2C", ") c #545660", ".X c #4C4E74", "[ c #9CB2FC", "p c #F4F66C", "@ c #8C8AD4", "M. c #F4FAFC", "V. c #4C4E7C", "8X c #CCCED4", "5 c #5C62E8", "7. c #6C72C4", "Q c #FCFE64", "E. c #CCCA4C", "`. c #5C523C", "L c #5C5E64", "[. c #343235", "!. c #4C4E8C", "> c #ECE6FC", "'. c #747630", "I. c #7C7E24", "w c #E4E224", ",X c #ACAAAC", ".. c #343244", "` c #3C3D3C", "/ c #3C3A32", "I c #545C9C", "S c #7486FC", "=X c #DCDED4", "h c #6C78FC", "*. c #7C8EEC", "n. c #FCFE8C", "D c #5C6AAC", ";X c #8C867C", "#. c #A4AEFC", "^ c #3C3A46", "x c #ECF654", "! c #F4F21C", "5X c #6C6E6C", "~ c #44423C", "f c #7480FC", "j. c #ECEA34", "6. c #D4D6FC", "0. c #8C9EDC", "i. c #444247", ",. c #8C8E2C", "H c #4C4A3B", "#X c #74766C", "g c #747AFC", "XX c #BCBABC", "o. c #444255", "F c #FCFEB4", "l c #5C76FC", "; c #F4F6CC", "b c #FCFA2C", "$ c #D4C664", "{. c #BCBAC7", "&. c #9CBAFC", "A. c #8C92D4", "d. c #54523B", "<X c #7C7E6C", "oX c #4C4A51", "J c #2C3238", ">X c #747684", "y c #DCE21C", "C. c #444268", "= c #E4E274", "K. c #5C5A35", "# c #ECEEF4", "O c #C4CEEC", "m. c #FCFED0", "E c #6472DC", "T. c #949644", "} c #94A6FC", "W c #9CA2C4", "G. c #545254", "=. c #6C7AD4", "q. c #D4EAFC", "k c #6478FC", "S. c #7482C4", "+. c #4C4A6C", "). c #646234", "%X c #7C7E8C", "r c #E4EA24", "M c #444A1C", "4X c #5C5A4C", ": c #FCFEE4", "{ c #9CAEFC", "y. c #545E8C", "z c #CCCACC", "N. c #BCBAF4", "Y. c #DCE244", "|. c #3C423C", "X c #FCFEF1", ">. c #6C6A34", "v. c #ACAE2C", "3X c #84868C", /* pixels */ " ", " . X o O + @ # ", " $ % % & * = - ; : > , < 1 2 3 4 4 5 6 7 8 ", " 9 0 q w w e r r r t y u i p a s d f g h h f j j h k k l 2 6 z ", " x c v v b n n n m n n n b m m M N B V C d 1 Z 1 1 A S f f j h h 3 D 8 ", " F b m G n n n n n n G n n n n G H J K L P I U Y T C R R d Z 1 1 A S j h E W 8 ", " Q m n n n n G n n G n n n G n ! ~ ^ / ( ) _ ` ' U ] [ { Y } T C R Z Z 1 1 A g V ", " | v n n n G n n n n n n n n n .^ ..X.J ( P o.O.+.@.#., $.%.&.%.[ [ { C *.=.I -.J ", ";./ :.>.,.| w b G G G G G G G | X.<.1.2.3.4. 5.6.7.7.V +.8.9.0.q.w.e.] r.t.y.+.u.` i.` ^ ", "p.a.s.H H H d.f.g.h. .j.k.k.l.` ~ H z.x.c.v. .b.n.m.: X m. : M.> N.B.7.V.C.o.i._ i.Z.@.9.A.S.y.D.9.F.i.Z.i.i.i.F.i. ", " G.~ H H.<.d.J.J.K.K.L.g.h.` P.~ P.d.<.:.H H d.f.I.U.0 Y.T.R.E.W.O.Q.C.^ F.i.Z.Z.Z.Z.i.8.@.+.!.u.8.8.Z.o.o.i.i._ F.P ~. ", " ^./ P./.H.H.:.J.K.(.).(.x.H P.i.~ _.d.d.J._.J.`.d.:.:.` '.'./.].F.o.Z.Z.Z.Z.Z.Z.o._ Z.i.Z.8.' 8.8.o.Z.Z.i.i._ i.~ [.{. ", " z P P.P.H }.H.d.d.K.K.(.>.:.~ P.|.d.d.d.d.d.`._.J.K.d.}.J._.Z. Xo.8.o.o.Z.Z.Z.Z.i.i.i.Z.Z.8..Xo.Z.Z.i.i._ i.i.|.` P XX ", " / i.P.P.a.H H.H.<._.J.(.d.~ ~ F.d.d.:.d.:._.J._.J.<.oXa.P.i.8.Z.o.Z.Z.Z.Z.o.i.Z.Z._ i.Z.o.+.Z.i.Z.i._ i.i.` i.~ F. ", " L ` ~ i.P.P.P.H H.d.:._.:.|.i.` :.:.d.:.d.d.d._.OXd.i.Z.-.~ o.Z.Z.Z.Z.Z.Z.i.i.u.P.i._ i.Z.-.i.i.i.i.i._ ~ F.` ` i. ", " +XP ~ ~ /.P.P.}.H H H.<.d.i.` i.H.H H :.:.d.d.d.d._.i.8.@._ oXo.Z.i.o.Z.F.F.^ ` ^ i.i.Z.o.Z._ i.i._ i.~ F.~ i.P ^. ", " @X[.~ _ ~ P.~ P.P.H H H.H.~ ` i.` G.#X_.$X$X$X<.d.d./.Z.Z.}.) i.u.F.^ _ ) %X&X@Xi.` _ i.Z.i.i._ i.~ F.~ F.~ F.[.XX ", " [.` ~ i.~ i.P./.P.P.H H.` i.` *XX =X-X;Xz.H.$X~ :.<.}.:X^ ) >X{.@X N ` ` i.Z.i.i.i.i.` i.` ` P [.:X ", " ,X*XP P ~ ~ P.P.P.H P.:.F.` [.8 8 N <Xs.d.[. p. 8 P F.o._ i.` _ / [.` i.1X2X8 ", " 8 -X3XZ.P [.` ~ ~ P.a.~ *XN 4X~ #X ;.J i.` P P X.5X6X;. ", " 8 &X^.Z.P / / 7XXX 6X*X^ F. @X7X].~.8XX ", " 2X9X6X 0X6X " }; |
From: Markus R. <rol...@us...> - 2007-07-15 10:41:15
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv470 Modified Files: kinematicframe.cpp kinematicframe.h Log Message: - support kinematic control for second universal joint axis Index: kinematicframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/kinematicframe.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** kinematicframe.h 15 Jul 2007 10:29:53 -0000 1.2 --- kinematicframe.h 15 Jul 2007 10:41:10 -0000 1.3 *************** *** 74,77 **** --- 74,78 ---- protected: + int GetParamVel(int axis) const; void AddJointControl(boost::shared_ptr<oxygen::Joint> joint, int axis); void OnSliderChanged(wxCommandEvent& event); Index: kinematicframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/kinematicframe.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** kinematicframe.cpp 15 Jul 2007 10:29:53 -0000 1.2 --- kinematicframe.cpp 15 Jul 2007 10:41:10 -0000 1.3 *************** *** 144,148 **** { shared_ptr<Joint> joint = shared_static_cast<Joint>(*iter); ! AddJointControl(joint, 0); } --- 144,158 ---- { shared_ptr<Joint> joint = shared_static_cast<Joint>(*iter); ! ! switch (joint->GetType()) ! { ! case dJointTypeUniversal: ! AddJointControl(joint, 0); ! AddJointControl(joint, 1); ! ! default: ! AddJointControl(joint, 0); ! break; ! } } *************** *** 254,259 **** --- 264,276 ---- } + int kinematicFrame::GetParamVel(int axis) const + { + return (axis == 0) ? dParamVel : dParamVel2; + } + void kinematicFrame::MoveJoint(JointControl& entry) { + int paramVel = GetParamVel(entry.axis); + switch (entry.type) { *************** *** 270,277 **** { entry.mode = CM_PASSIV; ! hinge->SetParameter(dParamVel, 0); } else { ! hinge->SetParameter(dParamVel, GetJointVel(diff)); } break; --- 287,294 ---- { entry.mode = CM_PASSIV; ! hinge->SetParameter(paramVel, 0); } else { ! hinge->SetParameter(paramVel, GetJointVel(diff)); } break; *************** *** 282,294 **** shared_ptr<UniversalJoint> universal = shared_static_cast<UniversalJoint>(entry.joint.lock()); ! int value_joint = static_cast<int>(universal->GetAngle(static_cast<Joint::EAxisIndex>(entry.axis))); int diff = (entry.target - value_joint); if (abs(diff) < MIN_JOINT_DIFF) { entry.mode = CM_PASSIV; ! universal->SetParameter(dParamVel, 0); } else { ! universal->SetParameter(dParamVel, GetJointVel(diff)); } break; --- 299,314 ---- shared_ptr<UniversalJoint> universal = shared_static_cast<UniversalJoint>(entry.joint.lock()); ! int value_joint = static_cast<int> ! (universal->GetAngle(static_cast<Joint::EAxisIndex>(entry.axis))); int diff = (entry.target - value_joint); + + if (abs(diff) < MIN_JOINT_DIFF) { entry.mode = CM_PASSIV; ! universal->SetParameter(paramVel, 0); } else { ! universal->SetParameter(paramVel, GetJointVel(diff)); } break; |
From: Markus R. <rol...@us...> - 2007-07-15 10:29:57
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv28263 Modified Files: kinematicframe.cpp kinematicframe.h Log Message: - refactored joint control creation into kinematicFrame::AddJointControl() Index: kinematicframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/kinematicframe.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** kinematicframe.h 8 Jul 2007 13:44:17 -0000 1.1 --- kinematicframe.h 15 Jul 2007 10:29:53 -0000 1.2 *************** *** 25,28 **** --- 25,32 ---- #include <zeitgeist/leaf.h> + namespace oxygen + { + class Joint; + } class kinematicFrame: public wxFrame { *************** *** 70,73 **** --- 74,78 ---- protected: + void AddJointControl(boost::shared_ptr<oxygen::Joint> joint, int axis); void OnSliderChanged(wxCommandEvent& event); void OnScrollChanged(wxScrollEvent& event); Index: kinematicframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/kinematicframe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** kinematicframe.cpp 8 Jul 2007 13:44:17 -0000 1.1 --- kinematicframe.cpp 15 Jul 2007 10:29:53 -0000 1.2 *************** *** 73,76 **** --- 73,107 ---- } + void kinematicFrame::AddJointControl(shared_ptr<Joint> joint, int axis) + { + wxSizer* sizer = mCtrScrollWnd->GetSizer(); + if ( + (sizer == 0) || + (joint.get() == 0) + ) + { + assert(false); + return; + } + + wxString path = joint->GetFullPath(); + wxStaticText* text = + new wxStaticText( mCtrScrollWnd, wxID_ANY, path, wxDefaultPosition, wxDefaultSize, 0 ); + + sizer->Add(text, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); + + wxSlider* slider = + new wxSlider( mCtrScrollWnd, wxID_ANY, 0, -179, 179, wxDefaultPosition, wxSize(250,-1), + wxSL_HORIZONTAL|wxSL_AUTOTICKS|wxSL_LABELS ); + sizer->Add(slider, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); + + JointControl entry; + entry.type = joint->GetType(); + entry.axis = axis; + entry.joint = joint; + + mJoints[slider] = entry; + } + void kinematicFrame::UpdateCached() { *************** *** 113,131 **** { shared_ptr<Joint> joint = shared_static_cast<Joint>(*iter); ! ! wxString path = joint->GetFullPath(); ! wxStaticText* text = new wxStaticText( mCtrScrollWnd, wxID_ANY, path, wxDefaultPosition, wxDefaultSize, 0 ); ! sizer->Add(text, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL|wxADJUST_MINSIZE, 5); ! ! wxSlider* slider = new wxSlider( mCtrScrollWnd, wxID_ANY, 0, -179, 179, wxDefaultPosition, wxSize(250,-1), ! wxSL_HORIZONTAL|wxSL_AUTOTICKS|wxSL_LABELS ); ! sizer->Add(slider, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); ! ! JointControl entry; ! entry.type = joint->GetType(); ! entry.axis = 0; ! entry.joint = joint; ! ! mJoints[slider] = entry; } --- 144,148 ---- { shared_ptr<Joint> joint = shared_static_cast<Joint>(*iter); ! AddJointControl(joint, 0); } |
From: Markus R. <rol...@us...> - 2007-07-15 10:18:02
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23615 Modified Files: mainframe.cpp mainframe.h Log Message: - added member OnFileNew, SaveFileAs, OnFileSaveAs and SaveFile - added support for unnamed files Index: mainframe.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** mainframe.h 9 Jul 2007 18:49:08 -0000 1.21 --- mainframe.h 15 Jul 2007 10:17:58 -0000 1.22 *************** *** 98,104 **** --- 98,110 ---- void OnUpdateViewLog(wxUpdateUIEvent& event); + void OnFileNew(wxCommandEvent& event); + void OnFileOpen(wxCommandEvent& event); void OnUpdateFileOpen(wxUpdateUIEvent& event); + bool SaveFileAs(wxScintilla* edit); + void OnFileSaveAs(wxCommandEvent& event); + + bool SaveFile(wxScintilla* edit); void OnFileSave(wxCommandEvent& event); void OnUpdateFileSave(wxUpdateUIEvent& event); Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** mainframe.cpp 10 Jul 2007 15:16:29 -0000 1.30 --- mainframe.cpp 15 Jul 2007 10:17:58 -0000 1.31 *************** *** 35,38 **** --- 35,39 ---- #include <rsgedit/res/xpm_step.xpm> #include <rsgedit/res/xpm_pause.xpm> + #include <rsgedit/res/xpm_new.xpm> #include <rsgedit/res/xpm_open.xpm> #include <rsgedit/res/xpm_save.xpm> *************** *** 80,87 **** --- 81,91 ---- EVT_UPDATE_UI(ID_VIEW_TREE, mainframe::OnUpdateViewTree) + EVT_MENU(ID_FILE_NEW, mainframe::OnFileNew) + EVT_MENU(ID_FILE_OPEN, mainframe::OnFileOpen) EVT_UPDATE_UI(ID_FILE_OPEN, mainframe::OnUpdateFileOpen) EVT_MENU(ID_FILE_SAVE, mainframe::OnFileSave) + EVT_MENU(ID_FILE_SAVEAS, mainframe::OnFileSaveAs) EVT_UPDATE_UI(ID_FILE_SAVE, mainframe::OnUpdateFileSave) *************** *** 166,171 **** --- 170,177 ---- SetMenuBar(MainFrame_menubar); wxMenu* wxglade_tmp_menu_1 = new wxMenu(); + wxglade_tmp_menu_1->Append(ID_FILE_NEW, wxT("&New"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(ID_FILE_OPEN, wxT("&Open\tctrl+o"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(ID_FILE_SAVE, wxT("&Save\tctrl+s"), wxEmptyString, wxITEM_NORMAL); + wxglade_tmp_menu_1->Append(ID_FILE_SAVEAS, wxT("Save as..."), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->Append(ID_FILE_RELOAD, wxT("&Reload\tctrl+r"), wxEmptyString, wxITEM_NORMAL); wxglade_tmp_menu_1->AppendSeparator(); *************** *** 231,234 **** --- 237,241 ---- mToolBar = CreateToolBar( wxTB_FLAT|wxTB_HORIZONTAL, wxID_ANY ); + mToolBar->AddTool(ID_FILE_NEW, wxT("New"), wxBitmap(xpm_new)); mToolBar->AddTool(ID_FILE_OPEN, wxT("Open"), wxBitmap(xpm_open)); mToolBar->AddTool(ID_FILE_RELOAD, wxT("Reload"), wxBitmap(xpm_reload)); *************** *** 1023,1026 **** --- 1030,1070 ---- } + bool mainframe::SaveFileAs(wxScintilla* edit) + { + if (edit == 0) + { + return false; + } + + wxString message(wxT("Choose a file to save")); + wxString default_path; + wxString default_filename; + wxString default_extension; + wxString wildcard(wxT("simspark files (*.rsg, *.rb)|*.rb;*.rsg")); + int flags = wxFD_SAVE | wxFD_OVERWRITE_PROMPT; + + wxString filename = wxFileSelector(message, default_path, default_filename, + default_extension, wildcard,flags); + + if (filename.empty() ) + { + return false; + } + + SparkEdit::GetInstance().SaveFileAs(mCtrNotebook, edit, filename); + return true; + } + + void mainframe::OnFileSaveAs(wxCommandEvent& event) + { + wxScintilla* edit = SparkEdit::GetCurrentPage(mCtrNotebook); + if (edit == 0) + { + return; + } + + SaveFileAs(edit); + } + void mainframe::OnUpdateFileSave(wxUpdateUIEvent& event) { *************** *** 1028,1031 **** --- 1072,1091 ---- } + bool mainframe::SaveFile(wxScintilla* edit) + { + if (edit == 0) + { + return false; + } + + if (SparkEdit::GetInstance().GetFile(edit).IsEmpty()) + { + return SaveFileAs(edit); + } + + SparkEdit::GetInstance().SaveFile(edit); + return true; + } + void mainframe::OnFileSave(wxCommandEvent& event) { *************** *** 1036,1040 **** } ! SparkEdit::GetInstance().SaveFile(edit); } --- 1096,1100 ---- } ! SaveFile(edit); } *************** *** 1052,1055 **** --- 1112,1121 ---- } + void mainframe::OnFileNew(wxCommandEvent& event) + { + bool select = true; + SparkEdit::GetInstance().GetEdit(wxString(), mCtrNotebook, select); + } + void mainframe::OnFileOpen(wxCommandEvent& event) { *************** *** 1059,1064 **** wxString default_extension(wxT("")); wxString wildcard(wxT("simspark files (*.rsg, *.rb)|*.rb;*.rsg")); ! wxString filename = wxFileSelector(message, default_path, default_filename, default_extension, wildcard); if (filename.empty() ) { --- 1125,1132 ---- wxString default_extension(wxT("")); wxString wildcard(wxT("simspark files (*.rsg, *.rb)|*.rb;*.rsg")); + int flags = wxFD_OPEN | wxFD_FILE_MUST_EXIST; ! wxString filename = wxFileSelector(message, default_path, default_filename, ! default_extension, wildcard, flags); if (filename.empty() ) { *************** *** 1264,1268 **** if (edit->GetModify()) { ! int res = wxMessageBox("The file '"+SparkEdit::GetInstance().GetFile(edit)+"' is modified.\n" "Do you want to save your changes?", "rsgedit", --- 1332,1336 ---- if (edit->GetModify()) { ! int res = wxMessageBox("The file '"+SparkEdit::GetInstance().GetTitle(edit)+"' is modified.\n" "Do you want to save your changes?", "rsgedit", *************** *** 1281,1285 **** case wxYES: ! SparkEdit::GetInstance().SaveFile(edit); break; --- 1349,1357 ---- case wxYES: ! if (! SaveFile(edit)) ! { ! event.Veto(); ! return; ! } break; |
From: Markus R. <rol...@us...> - 2007-07-15 10:16:23
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23210 Modified Files: sparkedit.cpp sparkedit.h Log Message: - made EditEntry::fn member protected, moved cleaning of filename and filename access to member functions - added member SaveFileAs, SetFile and GetTitle() - added support for unnamed files Index: sparkedit.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkedit.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sparkedit.cpp 10 Jul 2007 15:15:26 -0000 1.5 --- sparkedit.cpp 15 Jul 2007 10:16:18 -0000 1.6 *************** *** 20,24 **** #include "sparkedit.h" #include <wx/colour.h> - #include <wx/filename.h> #include <rsgedit/res/xpm_play.xpm> --- 20,23 ---- *************** *** 30,33 **** --- 29,50 ---- static wxColour COL_KEYWORD(0,0,255); + + // --- SparkEdit::EditEntry + + const wxFileName& SparkEdit::EditEntry::GetFileName() const + { + return fn; + } + + + void SparkEdit::EditEntry::SetFileName(const wxString& fname) + { + fn = wxFileName(fname); + fn.Normalize(); + } + + // --- SparkEdit + + SparkEdit::SparkEdit() : mStartScript(0) *************** *** 64,73 **** } ! wxString SparkEdit::GetTitle(wxScintilla* edit, const EditEntry& entry) { ! wxString title(wxFileName(entry.fname).GetFullName()); ! if (edit->GetModify()) { title += "*"; --- 81,107 ---- } ! wxString SparkEdit::GetTitle(wxScintilla* edit) { + TEditMap::iterator iter = mEditMap.find(edit); + if (iter == mEditMap.end()) + { + assert(false); + return wxString(); + } ! const EditEntry& entry = (*iter).second; ! bool markModified = false; ! return GetTitle(edit, entry, markModified); ! } ! wxString SparkEdit::GetTitle(wxScintilla* edit, const EditEntry& entry, bool markModified) ! { ! wxString fname = entry.GetFileName().GetFullName(); ! wxString title(fname.IsEmpty() ? "<unnamed>" : fname); ! ! if ( ! (markModified) && ! (edit->GetModify()) ! ) { title += "*"; *************** *** 85,107 **** } ! wxFileName fn(fname); ! fn.Normalize(); ! ! for ( ! TEditMap::iterator iter = mEditMap.begin(); ! iter != mEditMap.end(); ! ++iter ! ) { ! EditEntry& entry = (*iter).second; ! if (fn.GetFullPath() == entry.fname) { ! wxScintilla* edit = (*iter).first; ! if (select) ! { ! SelectEdit(notebook, edit); ! } ! return edit; } } --- 119,144 ---- } ! EditEntry newEntry; ! if (! fname.IsEmpty()) { ! newEntry.SetFileName(fname); ! ! for ( ! TEditMap::iterator iter = mEditMap.begin(); ! iter != mEditMap.end(); ! ++iter ! ) { ! EditEntry& entry = (*iter).second; ! if (newEntry.GetFileName() == entry.GetFileName()) ! { ! wxScintilla* edit = (*iter).first; ! if (select) ! { ! SelectEdit(notebook, edit); ! } ! return edit; ! } } } *************** *** 109,116 **** wxScintilla* edit = Create(notebook); ! EditEntry entry; ! entry.fname = fn.GetFullPath(); ! ! if (! LoadFile(edit, entry)) { edit->Destroy(); --- 146,153 ---- wxScintilla* edit = Create(notebook); ! if ( ! (! fname.IsEmpty()) && ! (! LoadFile(edit, newEntry)) ! ) { edit->Destroy(); *************** *** 118,122 **** } ! wxString title(GetTitle(edit, entry)); notebook->AddPage(edit,title,select); --- 155,160 ---- } ! bool markModified = true; ! wxString title(GetTitle(edit, newEntry, markModified)); notebook->AddPage(edit,title,select); *************** *** 126,132 **** } ! mEditMap[edit] = entry; ! UpdateIcon(notebook, edit, entry); return edit; } --- 164,170 ---- } ! mEditMap[edit] = newEntry; ! UpdateIcon(notebook, edit, newEntry); return edit; } *************** *** 140,148 **** } - wxFileName fn(entry.fname); - if ( ! (! fn.FileExists()) || ! (! edit->LoadFile(entry.fname)) ) { --- 178,184 ---- } if ( ! (! entry.GetFileName().FileExists()) || ! (! edit->LoadFile(entry.GetFileName().GetFullPath())) ) { *************** *** 151,156 **** } ! edit->SetLabel(entry.fname); ! wxString ext(fn.GetExt().Lower()); if (ext == "rsg") --- 187,205 ---- } ! PrepareEdit(edit, entry); ! return true; ! } ! ! void SparkEdit::PrepareEdit(wxScintilla* edit, EditEntry& entry) ! { ! if (edit == 0) ! { ! assert(false); ! return; ! } ! ! ! edit->SetLabel(entry.GetFileName().GetFullPath()); ! wxString ext(entry.GetFileName().GetExt().Lower()); if (ext == "rsg") *************** *** 174,190 **** } - PrepareEdit(edit, entry); - - return true; - } - - void SparkEdit::PrepareEdit(wxScintilla* edit, const EditEntry& entry) - { - if (edit == 0) - { - assert(false); - return; - } - switch (entry.type) { --- 223,226 ---- *************** *** 362,366 **** const EditEntry& entry = (*iter).second; ! notebook->SetPageText(page, GetTitle(edit, entry)); } --- 398,403 ---- const EditEntry& entry = (*iter).second; ! bool markModified = true; ! notebook->SetPageText(page, GetTitle(edit, entry, markModified)); } *************** *** 392,396 **** } ! edit->SaveFile(entry.fname); } --- 429,433 ---- } ! edit->SaveFile(entry.GetFileName().GetFullPath()); } *************** *** 407,410 **** --- 444,469 ---- } + void SparkEdit::SaveFileAs(wxFlatNotebook* notebook, wxScintilla* edit, const wxString& fname) + { + if (notebook == 0) + { + assert(false); + return; + } + + TEditMap::iterator iter = mEditMap.find(edit); + if (iter == mEditMap.end()) + { + return; + } + + EditEntry& entry = (*iter).second; + entry.SetFileName(fname); + + edit->SaveFile(entry.GetFileName().GetFullPath()); + PrepareEdit(edit, entry); + UpdateIcon(notebook, edit, entry); + } + void SparkEdit::SetStartScript(wxFlatNotebook* notebook, wxScintilla* edit) { *************** *** 444,448 **** const EditEntry& entry = (*iter).second; ! return entry.fname; } --- 503,528 ---- const EditEntry& entry = (*iter).second; ! return entry.GetFileName().GetFullPath(); ! } ! ! void SparkEdit::SetFile(wxScintilla* edit, wxFlatNotebook* notebook, const wxString& fname) ! { ! if (edit == 0) ! { ! assert(false); ! return; ! } ! ! TEditMap::iterator iter = mEditMap.find(edit); ! if (iter == mEditMap.end()) ! { ! return; ! } ! ! EditEntry& entry = (*iter).second; ! entry.SetFileName(fname); ! ! PrepareEdit(edit, entry); ! UpdateIcon(notebook, edit, entry); } Index: sparkedit.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkedit.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sparkedit.h 10 Jul 2007 15:15:26 -0000 1.6 --- sparkedit.h 15 Jul 2007 10:16:18 -0000 1.7 *************** *** 21,24 **** --- 21,25 ---- #define SPARKEDIT_H__ + #include <wx/filename.h> #include <wx/string.h> #include <wx/wxscintilla.h> *************** *** 52,57 **** public: EEditType type; - wxString fname; public: EditEntry() --- 53,59 ---- public: EEditType type; + protected: + wxFileName fn; public: EditEntry() *************** *** 59,62 **** --- 61,67 ---- { } + + const wxFileName& GetFileName() const; + void SetFileName(const wxString& fname); }; *************** *** 76,79 **** --- 81,85 ---- void UpdateIcons(wxFlatNotebook* notebook); void SaveFile(wxScintilla* edit); + void SaveFileAs(wxFlatNotebook* notebook, wxScintilla* edit, const wxString& fname); void SaveModified(); void SetStartScript(wxFlatNotebook* notebook, wxScintilla* edit); *************** *** 81,87 **** --- 87,95 ---- EEditType GetFileType(wxScintilla* edit); wxString GetFile(wxScintilla* edit); + void SetFile(wxScintilla* edit, wxFlatNotebook* notebook, const wxString& fname); wxString GetStartScriptFile(); void PrepareImageList(wxFlatNotebook* notebook); void SelectEdit(wxFlatNotebook* notebook, wxScintilla* edit); + wxString GetTitle(wxScintilla* edit); static wxScintilla* GetCurrentPage(wxFlatNotebook* notebook); *************** *** 90,95 **** wxScintilla* Create(wxWindow* parent); bool LoadFile(wxScintilla* edit, EditEntry& entry); ! void PrepareEdit(wxScintilla* edit, const EditEntry& entry); ! wxString GetTitle(wxScintilla* edit, const EditEntry& entry); void UpdateIcon(wxFlatNotebook* notebook, wxScintilla* edit, const EditEntry& entry); --- 98,103 ---- wxScintilla* Create(wxWindow* parent); bool LoadFile(wxScintilla* edit, EditEntry& entry); ! void PrepareEdit(wxScintilla* edit, EditEntry& entry); ! wxString GetTitle(wxScintilla* edit, const EditEntry& entry, bool markModified); void UpdateIcon(wxFlatNotebook* notebook, wxScintilla* edit, const EditEntry& entry); |
From: Markus R. <rol...@us...> - 2007-07-15 10:14:13
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22385 Modified Files: rsgedit.wxg Log Message: - added 'new' and 'save as' to file menu Index: rsgedit.wxg =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/rsgedit.wxg,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** rsgedit.wxg 9 Jul 2007 19:11:55 -0000 1.12 --- rsgedit.wxg 15 Jul 2007 10:14:10 -0000 1.13 *************** *** 1,4 **** <?xml version="1.0"?> ! <!-- generated by wxGlade 0.5 on Mon Jul 09 21:09:18 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" is_template="0"> --- 1,4 ---- <?xml version="1.0"?> ! <!-- generated by wxGlade 0.5 on Sun Jul 15 12:13:24 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" is_template="0"> *************** *** 13,16 **** --- 13,20 ---- <menu name="" label="&File"> <item> + <label>&New</label> + <id>ID_FILE_NEW</id> + </item> + <item> <label>&Open\tctrl+o</label> <id>ID_FILE_OPEN</id> *************** *** 21,24 **** --- 25,32 ---- </item> <item> + <label>Save as...</label> + <id>ID_FILE_SAVEAS</id> + </item> + <item> <label>&Reload\tctrl+r</label> <id>ID_FILE_RELOAD</id> |
From: Markus R. <rol...@us...> - 2007-07-15 10:13:30
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/res In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21990 Added Files: xpm_new.xpm Log Message: - added 'file new' icon --- NEW FILE: xpm_new.xpm --- /* XPM */ static const char *xpm_new[] = { "15 15 5 1", " c #FFFF00", ". c None", "X c #C0C0C0", "o c #000000", "O c #FFFFFF", " ..X ooXooo....", "X .X..X OOoo...", ".X X X OOOoOo..", ". X OXXXXOoOOo.", "XXXo OOOOooooo", "...XOOXooOOOOOo", "X..X OOOOOOOOOo", "...XOoooooooOOo", "...oOOOOOOOOOOo", "...oOoooooooOOo", "...oOOOOOOOOOOo", "...oOoooooooOOo", "...oOOOOOOOOOOo", "...oOOOOOOOOOOo", "...oooooooooooo"}; |
From: Markus R. <rol...@us...> - 2007-07-15 10:13:10
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21829 Modified Files: constants.h Log Message: - added constants ID_FILE_SAVEAS and ID_FILE_NEW Index: constants.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/constants.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** constants.h 8 Jul 2007 14:42:09 -0000 1.12 --- constants.h 15 Jul 2007 10:13:06 -0000 1.13 *************** *** 65,68 **** --- 65,70 ---- ID_FILE_SAVE = (wxID_HIGHEST+40), ID_CONTEXT_KINEMATIC = (wxID_HIGHEST+41), + ID_FILE_SAVEAS = (wxID_HIGHEST+42), + ID_FILE_NEW = (wxID_HIGHEST+43), ID_TAB_CLOSE = (wxID_HIGHEST+50), |
From: Markus R. <rol...@us...> - 2007-07-10 15:16:34
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12478 Modified Files: mainframe.cpp Log Message: - use SparkEdit::GetCurrentPage Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** mainframe.cpp 9 Jul 2007 19:14:18 -0000 1.29 --- mainframe.cpp 10 Jul 2007 15:16:29 -0000 1.30 *************** *** 1025,1035 **** void mainframe::OnUpdateFileSave(wxUpdateUIEvent& event) { ! wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); ! event.Enable(edit != 0); } void mainframe::OnFileSave(wxCommandEvent& event) { ! wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); if (edit == 0) { --- 1025,1034 ---- void mainframe::OnUpdateFileSave(wxUpdateUIEvent& event) { ! event.Enable(SparkEdit::GetCurrentPage(mCtrNotebook) != 0); } void mainframe::OnFileSave(wxCommandEvent& event) { ! wxScintilla* edit = SparkEdit::GetCurrentPage(mCtrNotebook); if (edit == 0) { *************** *** 1301,1305 **** void mainframe::OnTabStartScript(wxCommandEvent& event) { ! wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); if (edit == 0) { --- 1300,1304 ---- void mainframe::OnTabStartScript(wxCommandEvent& event) { ! wxScintilla* edit = SparkEdit::GetCurrentPage(mCtrNotebook); if (edit == 0) { *************** *** 1346,1350 **** void mainframe::OnTabContextMenu(wxFlatNotebookEvent& event) { ! wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); if (edit == 0) { --- 1345,1349 ---- void mainframe::OnTabContextMenu(wxFlatNotebookEvent& event) { ! wxScintilla* edit = SparkEdit::GetCurrentPage(mCtrNotebook); if (edit == 0) { *************** *** 1387,1391 **** void mainframe::OnEditCommand(wxCommandEvent& event) { ! wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); if (edit == 0) { --- 1386,1390 ---- void mainframe::OnEditCommand(wxCommandEvent& event) { ! wxScintilla* edit = SparkEdit::GetCurrentPage(mCtrNotebook); if (edit == 0) { *************** *** 1424,1428 **** void mainframe::OnUpdateEditCommand(wxUpdateUIEvent& event) { ! wxScintilla* edit = dynamic_cast<wxScintilla*>(mCtrNotebook->GetCurrentPage()); if (edit == 0) { --- 1423,1427 ---- void mainframe::OnUpdateEditCommand(wxUpdateUIEvent& event) { ! wxScintilla* edit = SparkEdit::GetCurrentPage(mCtrNotebook); if (edit == 0) { |
From: Markus R. <rol...@us...> - 2007-07-10 15:15:32
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12011 Modified Files: sparkedit.cpp sparkedit.h Log Message: - added method GetCurrentPage(); refactored from mainframe Index: sparkedit.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkedit.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sparkedit.cpp 8 Jul 2007 13:58:28 -0000 1.4 --- sparkedit.cpp 10 Jul 2007 15:15:26 -0000 1.5 *************** *** 418,421 **** --- 418,432 ---- } + wxScintilla* SparkEdit::GetCurrentPage(wxFlatNotebook* notebook) + { + if (notebook == 0) + { + assert(false); + return 0; + } + + return dynamic_cast<wxScintilla*>(notebook->GetCurrentPage()); + } + wxString SparkEdit::GetFile(wxScintilla* edit) { Index: sparkedit.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkedit.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sparkedit.h 10 Jul 2007 15:07:50 -0000 1.5 --- sparkedit.h 10 Jul 2007 15:15:26 -0000 1.6 *************** *** 85,88 **** --- 85,90 ---- void SelectEdit(wxFlatNotebook* notebook, wxScintilla* edit); + static wxScintilla* GetCurrentPage(wxFlatNotebook* notebook); + protected: wxScintilla* Create(wxWindow* parent); |
From: Markus R. <rol...@us...> - 2007-07-10 15:07:53
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv8983 Modified Files: sparkedit.h Log Message: - ws only Index: sparkedit.h =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/sparkedit.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sparkedit.h 8 Jul 2007 13:58:28 -0000 1.4 --- sparkedit.h 10 Jul 2007 15:07:50 -0000 1.5 *************** *** 70,98 **** ~SparkEdit(); ! wxScintilla* GetEdit(const wxString& fname, wxFlatNotebook* notebook, bool select); ! void PutEdit(wxScintilla* edit); ! void UpdateTitles(wxFlatNotebook* notebook); ! void UpdateTitle(wxFlatNotebook* notebook, wxScintilla* edit); ! void UpdateIcons(wxFlatNotebook* notebook); ! void SaveFile(wxScintilla* edit); ! void SaveModified(); ! void SetStartScript(wxFlatNotebook* notebook, wxScintilla* edit); ! wxScintilla* GetStartScript(); ! EEditType GetFileType(wxScintilla* edit); ! wxString GetFile(wxScintilla* edit); ! wxString GetStartScriptFile(); ! void PrepareImageList(wxFlatNotebook* notebook); ! void SelectEdit(wxFlatNotebook* notebook, wxScintilla* edit); protected: ! wxScintilla* Create(wxWindow* parent); ! bool LoadFile(wxScintilla* edit, EditEntry& entry); ! void PrepareEdit(wxScintilla* edit, const EditEntry& entry); ! wxString GetTitle(wxScintilla* edit, const EditEntry& entry); ! void UpdateIcon(wxFlatNotebook* notebook, wxScintilla* edit, const EditEntry& entry); ! int GetImageIndex(const wxScintilla* edit, const EditEntry& entry); ! void SaveFile(wxScintilla* edit, const EditEntry& entry); protected: --- 70,98 ---- ~SparkEdit(); ! wxScintilla* GetEdit(const wxString& fname, wxFlatNotebook* notebook, bool select); ! void PutEdit(wxScintilla* edit); ! void UpdateTitles(wxFlatNotebook* notebook); ! void UpdateTitle(wxFlatNotebook* notebook, wxScintilla* edit); ! void UpdateIcons(wxFlatNotebook* notebook); ! void SaveFile(wxScintilla* edit); ! void SaveModified(); ! void SetStartScript(wxFlatNotebook* notebook, wxScintilla* edit); ! wxScintilla* GetStartScript(); ! EEditType GetFileType(wxScintilla* edit); ! wxString GetFile(wxScintilla* edit); ! wxString GetStartScriptFile(); ! void PrepareImageList(wxFlatNotebook* notebook); ! void SelectEdit(wxFlatNotebook* notebook, wxScintilla* edit); protected: ! wxScintilla* Create(wxWindow* parent); ! bool LoadFile(wxScintilla* edit, EditEntry& entry); ! void PrepareEdit(wxScintilla* edit, const EditEntry& entry); ! wxString GetTitle(wxScintilla* edit, const EditEntry& entry); ! void UpdateIcon(wxFlatNotebook* notebook, wxScintilla* edit, const EditEntry& entry); ! int GetImageIndex(const wxScintilla* edit, const EditEntry& entry); ! void SaveFile(wxScintilla* edit, const EditEntry& entry); protected: |
From: Markus R. <rol...@us...> - 2007-07-09 19:14:21
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv26085 Modified Files: mainframe.cpp Log Message: - added edit icons to toolbar Index: mainframe.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/contrib/rsgedit/mainframe.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** mainframe.cpp 9 Jul 2007 18:49:08 -0000 1.28 --- mainframe.cpp 9 Jul 2007 19:14:18 -0000 1.29 *************** *** 37,40 **** --- 37,45 ---- #include <rsgedit/res/xpm_open.xpm> #include <rsgedit/res/xpm_save.xpm> + #include <rsgedit/res/xpm_cut.xpm> + #include <rsgedit/res/xpm_copy.xpm> + #include <rsgedit/res/xpm_paste.xpm> + #include <rsgedit/res/xpm_undo.xpm> + #include <rsgedit/res/xpm_redo.xpm> #include <rsgedit/res/xpm_reload.xpm> #include <rsgedit/res/xpm_agent.xpm> *************** *** 236,239 **** --- 241,251 ---- mToolBar->AddTool(ID_SIM_PAUSE, wxT("Pause"), wxBitmap(xpm_pause)); mToolBar->AddSeparator(); + mToolBar->AddTool(wxID_CUT, wxT("Cut"), wxBitmap(xpm_cut)); + mToolBar->AddTool(wxID_COPY, wxT("Copy"), wxBitmap(xpm_copy)); + mToolBar->AddTool(wxID_COPY, wxT("Paste"), wxBitmap(xpm_paste)); + mToolBar->AddSeparator(); + mToolBar->AddTool(wxID_UNDO, wxT("Undo"), wxBitmap(xpm_undo)); + mToolBar->AddTool(wxID_REDO, wxT("Redo"), wxBitmap(xpm_redo)); + mToolBar->AddSeparator(); mSimState = new wxTextCtrl( mToolBar, wxID_ANY, _T(""), wxDefaultPosition, wxSize(120, -1), wxTE_READONLY ); |
From: Markus R. <rol...@us...> - 2007-07-09 19:12:37
|
Update of /cvsroot/simspark/simspark/contrib/rsgedit/res In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25284 Added Files: xpm_copy.xpm xpm_cut.xpm xpm_paste.xpm xpm_redo.xpm xpm_undo.xpm Log Message: - added icons for copy, cut, past, redo, undo --- NEW FILE: xpm_copy.xpm --- /* XPM */ static const char *xpm_copy[] = { "16 16 4 1", " c None", ". c #000000", "X c #FFFFFF", "o c #000080", " ", " ", "...... ", ".XXXX.. ", ".XXXX.X. ", ".X..X.oooooo ", ".XXXXXoXXXXoo ", ".X....oXXXXoXo ", ".XXXXXoX..Xoooo ", ".X....oXXXXXXXo ", ".XXXXXoX.....Xo ", "......oXXXXXXXo ", " oX.....Xo ", " oXXXXXXXo ", " ooooooooo ", " "}; --- NEW FILE: xpm_undo.xpm --- /* XPM */ static char *xpm_undo[] = { /* columns rows colors chars-per-pixel */ "16 16 2 1", " c None", ". c #000080", /* pixels */ " ", " ", " ", " ", " .... ", " . .. . ", " .. . . ", " ... . ", " .... . ", " ..... . ", " . ", " ", " ", " ", " ", " " }; --- NEW FILE: xpm_redo.xpm --- /* XPM */ static char *xpm_redo[] = { /* columns rows colors chars-per-pixel */ "16 16 2 1", " c None", ". c #000080", /* pixels */ " ", " ", " ", " ", " .... ", " . .. . ", " . . .. ", " . ... ", " . .... ", " . ..... ", " . ", " ", " ", " ", " ", " " }; --- NEW FILE: xpm_cut.xpm --- /* XPM */ static char *xpm_cut[] = { /* columns rows colors chars-per-pixel */ "16 16 3 1", ". c Black", " c None", "X c #000080", /* pixels */ " ", " . . ", " . . ", " . . ", " .. .. ", " . . ", " ... ", " . ", " X.X ", " X XXX ", " XXX X X ", " X X X X ", " X X X X ", " X X XX ", " XX ", " " }; --- NEW FILE: xpm_paste.xpm --- /* XPM */ static char *xpm_paste[] = { /* columns rows colors chars-per-pixel */ "18 17 7 1", ". c Black", "+ c #FFFFFF", "@ c #000080", "X c #FFFF00", " c None", "O c #C0C0C0", "o c #808000", /* pixels */ " ", " ", " .... ", " .....XX..... ", " .oOo.X..X.OoO. ", " .OO.++++++.Oo. ", " .o+........OO. ", " .OoOoOoOoOoOo. ", " .oOoOo@@@@@@@. ", " .OoOoO@+++++@@ ", " .oOoOo@+++++@+@ ", " .OoOoO@+...+@@@@ ", " .oOoOo@++++++++@ ", " .OoOoO@+......+@ ", " .....@++++++++@ ", " @@@@@@@@@@ ", " " }; |