Changeset 8351 for code/trunk/src/libraries
- Timestamp:
- Apr 28, 2011, 7:15:14 AM (14 years ago)
- Location:
- code/trunk/src/libraries
- Files:
-
- 2 deleted
- 67 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/CMakeLists.txt
r8079 r8351 58 58 command/ArgumentCompletionFunctions.cc 59 59 ConfigFileManager.cc 60 MemoryArchive.cc61 60 PathConfig.cc 62 61 COMPILATION_END … … 98 97 ${CEGUI_LIBRARY} 99 98 ${CEGUILUA_LIBRARY} 100 ${LUA_LIBRARIES} 99 ${CEGUI_TOLUA_LIBRARY} 100 ${CEGUI_OGRE_RENDERER_LIBRARY} 101 ${LUA5.1_LIBRARY} 101 102 cpptcl_orxonox 102 ogreceguirenderer_orxonox103 103 ois_orxonox 104 104 tinyxml_orxonox 105 tolua_orxonox106 105 util 106 LINK_LIBS_UNIX 107 dl 108 pthread 107 109 SOURCE_FILES 108 110 ${CORE_SRC_FILES} -
code/trunk/src/libraries/core/ConfigValueContainer.cc
r7284 r8351 158 158 { 159 159 return this->callFunctionWithIndex(&ConfigValueContainer::tset, input); 160 return false;161 160 } 162 161 else -
code/trunk/src/libraries/core/Core.cc
r8079 r8351 81 81 82 82 SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file"); 83 #if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN) 83 84 SetCommandLineSwitch(noIOConsole).information("Use this if you don't want to use the IOConsole (for instance for Lua debugging)"); 85 #endif 84 86 85 87 #ifdef ORXONOX_PLATFORM_WINDOWS … … 156 158 this->setConfigValues(); 157 159 158 // create persistent io console 160 #if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN) 161 // Create persistent IO console 159 162 if (CommandLineParser::getValue("noIOConsole").getBool()) 160 163 { … … 163 166 if (this->bStartIOConsole_) 164 167 this->ioConsole_.reset(new IOConsole()); 168 #endif 165 169 166 170 // creates the class hierarchy for all classes with factories -
code/trunk/src/libraries/core/CorePrereqs.h
r8079 r8351 38 38 #include "OrxonoxConfig.h" 39 39 #include <boost/version.hpp> 40 #include <CEGUIVersion.h> 40 41 41 42 //----------------------------------------------------------------------- … … 53 54 # endif 54 55 # endif 55 #elif defined ( ORXONOX_GCC_VISIBILITY ) 56 # define _CorePrivate 57 #elif defined (ORXONOX_GCC_VISIBILITY) 56 58 # define _CoreExport __attribute__ ((visibility("default"))) 59 # define _CorePrivate __attribute__ ((visibility("hidden"))) 57 60 #else 58 61 # define _CoreExport 62 # define _CorePrivate 59 63 #endif 60 64 … … 259 263 { 260 264 #if (BOOST_VERSION < 104400) 265 261 266 namespace filesystem 262 267 { … … 265 270 typedef basic_path<std::string, path_traits> path; 266 271 } 267 #else 272 273 #elif (BOOST_VERSION < 104800) 274 275 # if BOOST_FILESYSTEM_VERSION == 2 268 276 namespace filesystem2 269 277 { … … 278 286 using filesystem2::path; 279 287 } 288 # elif BOOST_FILESYSTEM_VERSION == 3 289 namespace filesystem3 290 { 291 class path; 292 } 293 namespace filesystem 294 { 295 using filesystem3::path; 296 } 297 # endif 298 299 #else 300 301 // TODO: Check this once boost 1.48 is released 302 namespace filesystem 303 { 304 class path; 305 } 306 280 307 #endif 308 281 309 class thread; 282 310 class mutex; … … 306 334 class LuaScriptModule; 307 335 336 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 308 337 class OgreCEGUIRenderer; 309 338 class OgreCEGUIResourceProvider; 310 339 class OgreCEGUITexture; 340 #else 341 class OgreRenderer; 342 class OgreResourceProvider; 343 class OgreImageCodec; 344 #endif 311 345 } 312 346 -
code/trunk/src/libraries/core/DynLib.cc
r6417 r8351 42 42 #endif 43 43 44 #ifdef ORXONOX_PLATFORM_ LINUX44 #ifdef ORXONOX_PLATFORM_UNIX 45 45 # include <dlfcn.h> 46 46 #endif 47 47 48 48 #ifdef ORXONOX_PLATFORM_APPLE 49 # include <macPlugins.h>49 # include <OSX/macUtils.h> // OGRE include 50 50 #endif 51 51 … … 75 75 if (name.substr(name.length() - 3, 3) != ".so") 76 76 name += ".so"; 77 #elif defined(ORXONOX_PLATFORM_APPLE) 78 // dlopen() does not add .dylib to the filename, like windows does for .dll 79 if (name.substr(name.length() - 6, 6) != ".dylib") 80 name += ".dylib"; 81 #elif defined(ORXONOX_PLATFORM_WINDOWS) 82 // Although LoadLibraryEx will add .dll itself when you only specify the library name, 83 // if you include a relative path then it does not. So, add it to be sure. 84 if (name.substr(name.length() - 4, 4) != ".dll") 85 name += ".dll"; 77 86 #endif 78 87 … … 127 136 LocalFree( lpMsgBuf ); 128 137 return ret; 129 #elif defined(ORXONOX_PLATFORM_ LINUX)138 #elif defined(ORXONOX_PLATFORM_UNIX) 130 139 return std::string(dlerror()); 131 #elif defined(ORXONOX_PLATFORM_APPLE)132 return std::string(mac_errorBundle());133 140 #else 134 141 return ""; 135 142 #endif 136 143 } 137 138 144 } -
code/trunk/src/libraries/core/DynLib.h
r7401 r8351 52 52 typedef struct HINSTANCE__* hInstance; 53 53 54 #elif defined(ORXONOX_PLATFORM_ LINUX)54 #elif defined(ORXONOX_PLATFORM_UNIX) 55 55 # define DYNLIB_HANDLE void* 56 56 # define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL) 57 57 # define DYNLIB_GETSYM( a, b ) dlsym( a, b ) 58 58 # define DYNLIB_UNLOAD( a ) dlclose( a ) 59 60 #elif defined(ORXONOX_PLATFORM_APPLE)61 # define DYNLIB_HANDLE CFBundleRef62 # define DYNLIB_LOAD( a ) mac_loadExeBundle( a )63 # define DYNLIB_GETSYM( a, b ) mac_getBundleSym( a, b )64 # define DYNLIB_UNLOAD( a ) mac_unloadExeBundle( a )65 59 #endif 66 60 -
code/trunk/src/libraries/core/GUIManager.cc
r8079 r8351 30 30 #include "GUIManager.h" 31 31 32 #include <memory> 32 33 #include <boost/bind.hpp> 33 #include <memory> 34 #include <OgreRenderQueue.h> 35 #include <OgreRenderWindow.h> 34 36 35 37 #include <CEGUIDefaultLogger.h> … … 43 45 #include <elements/CEGUIListbox.h> 44 46 #include <elements/CEGUIListboxItem.h> 45 #include <ogreceguirenderer/OgreCEGUIRenderer.h> 46 47 #include "SpecialConfig.h" // Configures the macro below 48 #ifdef CEGUILUA_USE_INTERNAL_LIBRARY 49 # include <ceguilua/CEGUILua.h> 50 #else 51 # include <CEGUILua.h> 47 48 #ifdef ORXONOX_OLD_CEGUI 49 # include <CEGUILua.h> 50 # include <ogreceguirenderer/OgreCEGUIRenderer.h> 51 extern "C" { 52 # include <lauxlib.h> 53 } 54 #else 55 # include <ScriptingModules/LuaScriptModule/CEGUILua.h> 56 # include <RendererModules/Ogre/CEGUIOgreImageCodec.h> 57 # include <RendererModules/Ogre/CEGUIOgreRenderer.h> 58 # include <RendererModules/Ogre/CEGUIOgreResourceProvider.h> 59 # include <OgreCamera.h> 60 # include <OgreRenderQueueListener.h> 61 # include <OgreSceneManager.h> 52 62 #endif 53 63 … … 89 99 case CEGUI::Informative: orxonoxLevel = 5; break; 90 100 case CEGUI::Insane: orxonoxLevel = 6; break; 91 default: OrxAssert(false, "CEGUI log level out of range, in pect immediately!");101 default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!"); 92 102 } 93 103 OutputHandler::getOutStream(orxonoxLevel) … … 97 107 } 98 108 }; 109 110 #ifdef ORXONOX_OLD_CEGUI 111 /** Class with the same memory layout as CEGUI::LuaScriptModule. <br> 112 We need this to fix a problem with an uninitialised member variable 113 in CEGUI < 0.7 <br> 114 Notice the "public" modifier for the otherwise private variables. 115 */ 116 class LuaScriptModuleWorkaround : public CEGUI::ScriptModule 117 { 118 public: 119 LuaScriptModuleWorkaround(); 120 ~LuaScriptModuleWorkaround(); 121 122 public: 123 bool d_ownsState; 124 lua_State* d_state; 125 CEGUI::String d_errFuncName; 126 int d_errFuncIndex; 127 CEGUI::String d_activeErrFuncName; 128 int d_activeErrFuncIndex; 129 }; 130 #else 131 /// RenderQueueListener based class used to hook into the ogre rendering system 132 class RQListener : public Ogre::RenderQueueListener 133 { 134 public: 135 /// Callback from Ogre invoked before other stuff in our target queue is rendered 136 void renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue) 137 { 138 if (id == Ogre::RENDER_QUEUE_SKIES_LATE)//Ogre::RENDER_QUEUE_OVERLAY) 139 CEGUI::System::getSingleton().renderGUI(); 140 } 141 }; 142 #endif 99 143 100 144 static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button); … … 118 162 */ 119 163 GUIManager::GUIManager(const std::pair<int, int>& mousePosition) 120 : resourceProvider_(NULL) 164 : destroyer_(*this, &GUIManager::cleanup) 165 , guiRenderer_(NULL) 166 , resourceProvider_(NULL) 167 #ifndef ORXONOX_OLD_CEGUI 168 , imageCodec_(NULL) 169 #endif 170 , luaState_(NULL) 171 , scriptModule_(NULL) 172 , guiSystem_(NULL) 121 173 , camera_(NULL) 122 174 { … … 129 181 130 182 // Note: No SceneManager specified yet 131 guiRenderer_.reset(new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000)); 183 #ifdef ORXONOX_OLD_CEGUI 184 guiRenderer_ = new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000); 132 185 resourceProvider_ = guiRenderer_->createResourceProvider(); 186 #else 187 guiRenderer_ = &OgreRenderer::create(*GraphicsManager::getInstance().getRenderWindow()); 188 // We use our own RenderQueueListener so we can draw UNDER overlays 189 guiRenderer_->setFrameControlExecutionEnabled(false); 190 rqListener_ = new RQListener(); 191 resourceProvider_ = &OgreRenderer::createOgreResourceProvider(); 192 imageCodec_ = &OgreRenderer::createOgreImageCodec(); 193 #endif 133 194 resourceProvider_->setDefaultResourceGroup("General"); 134 195 135 196 // Setup scripting 136 luaState_ .reset(new LuaState());197 luaState_ = new LuaState(); 137 198 rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua"); 138 199 // This is necessary to ensure that input events also use the right resource info when triggering lua functions 139 200 luaState_->setDefaultResourceInfo(this->rootFileInfo_); 140 scriptModule_.reset(new LuaScriptModule(luaState_->getInternalLuaState())); 201 #ifdef ORXONOX_OLD_CEGUI 202 scriptModule_ = new LuaScriptModule(luaState_->getInternalLuaState()); 203 // Ugly workaround: older CEGUILua versions don't initialise the member 204 // d_activeErrFuncIndex at all. That leads to "error in error handling" 205 // problems when a Lua error occurs. 206 // We fix this by setting the member manually. 207 reinterpret_cast<LuaScriptModuleWorkaround*>(scriptModule_)->d_activeErrFuncIndex = LUA_NOREF; 208 luaState_->doString("ORXONOX_OLD_CEGUI = true"); 209 #else 210 scriptModule_ = &LuaScriptModule::create(luaState_->getInternalLuaState()); 211 #endif 141 212 scriptModule_->setDefaultPCallErrorHandler(LuaState::ERROR_HANDLER_NAME); 142 213 … … 144 215 std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger()); 145 216 ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log"); 146 // set the log level according to ours (translate by subtracting 1)217 // Set the log level according to ours (translate by subtracting 1) 147 218 ceguiLogger->setLoggingLevel( 148 219 static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1)); … … 150 221 151 222 // Create the CEGUI system singleton 152 guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get())); 223 #ifdef ORXONOX_OLD_CEGUI 224 guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_); 225 // Add functions that have been renamed in newer versions 226 luaState_->doString("CEGUI.SchemeManager.create = CEGUI.SchemeManager.loadScheme"); 227 luaState_->doString("CEGUI.Window.getUnclippedOuterRect = CEGUI.Window.getUnclippedPixelRect"); 228 #else 229 guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_); 230 #endif 153 231 154 232 // Align CEGUI mouse with OIS mouse … … 175 253 } 176 254 177 /** 178 @brief 179 Basically shuts down CEGUI (member smart pointers) but first unloads our Tolua modules. 180 */ 181 GUIManager::~GUIManager() 182 { 255 void GUIManager::cleanup() 256 { 257 using namespace CEGUI; 258 259 #ifdef ORXONOX_OLD_CEGUI 260 delete guiSystem_; 261 delete guiRenderer_; 262 delete scriptModule_; 263 #else 264 System::destroy(); 265 OgreRenderer::destroyOgreResourceProvider(*resourceProvider_); 266 OgreRenderer::destroyOgreImageCodec(*imageCodec_); 267 OgreRenderer::destroy(*guiRenderer_); 268 LuaScriptModule::destroy(*scriptModule_); 269 delete ceguiLogger_; 270 delete rqListener_; 271 #endif 272 delete luaState_; 183 273 } 184 274 … … 221 311 void GUIManager::setCamera(Ogre::Camera* camera) 222 312 { 223 this->camera_ = camera; 313 #ifdef ORXONOX_OLD_CEGUI 224 314 if (camera == NULL) 225 315 this->guiRenderer_->setTargetSceneManager(0); 226 316 else 227 317 this->guiRenderer_->setTargetSceneManager(camera->getSceneManager()); 318 #else 319 if (camera_ != NULL && camera_->getSceneManager() != NULL) 320 camera_->getSceneManager()->removeRenderQueueListener(rqListener_); 321 if (camera != NULL && camera->getSceneManager() != NULL) 322 camera->getSceneManager()->addRenderQueueListener(rqListener_); 323 #endif 324 this->camera_ = camera; 228 325 } 229 326 … … 321 418 false | False | True | Dontcare 322 419 */ 420 421 #ifdef ORXONOX_PLATFORM_APPLE 422 // There is no non exclusive mode on OS X yet 423 state->setMouseExclusive(TriBool::True); 424 #else 323 425 if (showCursor == TriBool::Dontcare) 324 426 state->setMouseExclusive(TriBool::Dontcare); … … 327 429 else 328 430 state->setMouseExclusive(TriBool::False); 431 #endif 329 432 330 433 if (showCursor == TriBool::True) … … 522 625 The Listbox for which to enable (or disable) tooltips. 523 626 @param enabled 524 Whether to enable or disab elthe tooltips.627 Whether to enable or disable the tooltips. 525 628 */ 526 629 void GUIManager::setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled) -
code/trunk/src/libraries/core/GUIManager.h
r8079 r8351 42 42 #include <string> 43 43 #include <CEGUIForwardRefs.h> 44 #include < boost/scoped_ptr.hpp>44 #include <CEGUIVersion.h> 45 45 #include <boost/shared_ptr.hpp> 46 #include <loki/ScopeGuard.h> 46 47 47 48 #include "util/OgreForwardRefs.h" … … 57 58 $cfile "../util/TriBool.h" // tolua_export 58 59 */ 60 61 #if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7 62 # define ORXONOX_OLD_CEGUI 63 #endif 59 64 60 65 namespace orxonox // tolua_export … … 78 83 public: 79 84 GUIManager(const std::pair<int, int>& mousePosition); 80 ~GUIManager(); 85 //! Leave empty and use cleanup() instead 86 ~GUIManager() {} 81 87 82 88 void setConfigValues(void); … … 104 110 const std::string& createInputState(const std::string& name, TriBool::Value showCursor = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export 105 111 LuaState* getLuaState(void) 106 { return this->luaState_ .get(); }112 { return this->luaState_; } 107 113 108 114 //! Returns the root window for all menu sheets … … 127 133 private: 128 134 GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class) 135 136 /// Destructor that also executes when object fails to construct 137 void cleanup(); 138 129 139 void executeCode(const std::string& str); 130 140 … … 147 157 virtual void windowFocusChanged(bool bFocus); 148 158 149 scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_; //!< CEGUI's interface to the Ogre Engine 150 scoped_ptr<LuaState> luaState_; //!< LuaState, access point to the Lua engine 151 scoped_ptr<CEGUI::LuaScriptModule> scriptModule_; //!< CEGUI's script module to use Lua 152 scoped_ptr<CEGUI::System> guiSystem_; //!< CEGUI's main system 159 /// Surrogate for the destructor 160 Loki::ObjScopeGuardImpl0<GUIManager, void (GUIManager::*)()> destroyer_; 161 162 #ifdef ORXONOX_OLD_CEGUI 163 CEGUI::OgreCEGUIRenderer* guiRenderer_; //!< CEGUI's interface to the Ogre Engine 164 CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider 165 #else 166 CEGUI::OgreRenderer* guiRenderer_; //!< CEGUI's interface to the Ogre Engine 167 Ogre::RenderQueueListener* rqListener_; //!< RQ listener so we can draw UNDER Ogre overlays 168 CEGUI::OgreResourceProvider* resourceProvider_; //!< CEGUI's resource provider 169 CEGUI::OgreImageCodec* imageCodec_; 170 #endif 171 LuaState* luaState_; //!< LuaState, access point to the Lua engine 172 CEGUI::LuaScriptModule* scriptModule_; //!< CEGUI's script module to use Lua 173 CEGUI::System* guiSystem_; //!< CEGUI's main system 153 174 shared_ptr<ResourceInfo> rootFileInfo_; //!< Resource information about the root script 154 CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider155 175 CEGUI::Logger* ceguiLogger_; //!< CEGUI's logger to be able to log CEGUI errors in our log 156 176 CEGUI::Window* rootWindow_; //!< Root node for all windows -
code/trunk/src/libraries/core/Game.cc
r8245 r8351 459 459 ThrowException(GameState, "Emtpy GameState hierarchy provided, terminating."); 460 460 // Add element with large identation to detect the last with just an iterator 461 stateStrings.push_back(std::make_pair( "", -1));461 stateStrings.push_back(std::make_pair(std::string(), -1)); 462 462 463 463 // Parse elements recursively -
code/trunk/src/libraries/core/GraphicsManager.cc
r8079 r8351 30 30 #include "GraphicsManager.h" 31 31 32 #include <cstdlib> 32 33 #include <fstream> 33 34 #include <sstream> … … 35 36 #include <boost/shared_array.hpp> 36 37 37 #include <OgreArchiveFactory.h>38 #include <OgreArchiveManager.h>39 38 #include <OgreFrameListener.h> 40 39 #include <OgreRoot.h> … … 60 59 #include "GUIManager.h" 61 60 #include "Loader.h" 62 #include "MemoryArchive.h"63 61 #include "PathConfig.h" 64 62 #include "ViewportEventListener.h" … … 102 100 GraphicsManager::GraphicsManager(bool bLoadRenderer) 103 101 : ogreWindowEventListener_(new OgreWindowEventListener()) 104 #if OGRE_VERSION < 0x010600105 , memoryArchiveFactory_(new MemoryArchiveFactory())106 #endif107 102 , renderWindow_(0) 108 103 , viewport_(0) … … 126 121 // Only for development runs 127 122 if (PathConfig::isDevelopmentRun()) 128 {129 123 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getExternalDataPathString(), "FileSystem"); 130 extResources_.reset(new XMLFile("resources.oxr")); 131 extResources_->setLuaSupport(false);132 Loader::open(extResources_.get());133 }124 125 extResources_.reset(new XMLFile("resources.oxr")); 126 extResources_->setLuaSupport(false); 127 Loader::open(extResources_.get()); 134 128 135 129 if (bLoadRenderer) … … 156 150 // Undeclare the resources 157 151 Loader::unload(resources_.get()); 158 if (PathConfig::isDevelopmentRun()) 159 Loader::unload(extResources_.get()); 152 Loader::unload(extResources_.get()); 160 153 } 161 154 … … 164 157 SetConfigValue(ogreConfigFile_, "ogre.cfg") 165 158 .description("Location of the Ogre config file"); 166 SetConfigValue(ogrePluginsDirectory_, specialConfig::ogrePluginsDirectory)167 .description("Folder where the Ogre plugins are located.");168 159 SetConfigValue(ogrePlugins_, specialConfig::ogrePlugins) 169 160 .description("Comma separated list of all plugins to load."); … … 196 187 this->loadRenderer(); 197 188 198 #if OGRE_VERSION < 0x010600199 // WORKAROUND: There is an incompatibility for particle scripts when trying200 // to support both Ogre 1.4 and 1.6. The hacky solution is to create201 // scripts for the 1.6 version and then remove the inserted "particle_system"202 // keyword. But we need to supply these new scripts as well, which is why203 // there is an extra Ogre::Archive dealing with it in the memory.204 using namespace Ogre;205 ArchiveManager::getSingleton().addArchiveFactory(memoryArchiveFactory_.get());206 const StringVector& groups = ResourceGroupManager::getSingleton().getResourceGroups();207 // Travers all groups208 for (StringVector::const_iterator itGroup = groups.begin(); itGroup != groups.end(); ++itGroup)209 {210 FileInfoListPtr files = ResourceGroupManager::getSingleton().findResourceFileInfo(*itGroup, "*.particle");211 for (FileInfoList::const_iterator itFile = files->begin(); itFile != files->end(); ++itFile)212 {213 // open file214 Ogre::DataStreamPtr input = ResourceGroupManager::getSingleton().openResource(itFile->filename, *itGroup, false);215 std::stringstream output;216 // Parse file and replace "particle_system" with nothing217 while (!input->eof())218 {219 std::string line = input->getLine();220 size_t pos = line.find("particle_system");221 if (pos != std::string::npos)222 {223 // 15 is the length of "particle_system"224 line.replace(pos, 15, "");225 }226 output << line << std::endl;227 }228 // Add file to the memory archive229 shared_array<char> data(new char[output.str().size()]);230 // Debug optimisations231 const std::string& outputStr = output.str();232 char* rawData = data.get();233 for (unsigned i = 0; i < outputStr.size(); ++i)234 rawData[i] = outputStr[i];235 MemoryArchive::addFile("particle_scripts_ogre_1.4_" + *itGroup, itFile->filename, data, output.str().size());236 }237 if (!files->empty())238 {239 // Declare the files, but using a new group240 ResourceGroupManager::getSingleton().addResourceLocation("particle_scripts_ogre_1.4_" + *itGroup,241 "Memory", "particle_scripts_ogre_1.4_" + *itGroup);242 }243 }244 #endif245 246 189 // Initialise all resources (do this AFTER the renderer has been loaded!) 247 190 // Note: You can only do this once! Ogre will check whether a resource group has … … 305 248 void GraphicsManager::loadOgrePlugins() 306 249 { 307 // just to make sure the next statement doesn't segfault 308 if (ogrePluginsDirectory_.empty()) 309 ogrePluginsDirectory_ = '.'; 310 311 boost::filesystem::path folder(ogrePluginsDirectory_); 250 // Plugin path can have many different locations... 251 std::string pluginPath = specialConfig::ogrePluginsDirectory; 252 #ifdef DEPENDENCY_PACKAGE_ENABLE 253 if (!PathConfig::isDevelopmentRun()) 254 { 255 # if defined(ORXONOX_PLATFORM_WINDOWS) 256 pluginPath = PathConfig::getExecutablePathString(); 257 # elif defined(ORXONOX_PLATFORM_APPLE) 258 // TODO: Where are the plugins being installed to? 259 pluginPath = PathConfig::getExecutablePathString(); 260 # endif 261 } 262 #endif 263 264 #ifdef ORXONOX_PLATFORM_WINDOWS 265 // Add OGRE plugin path to the environment. That way one plugin could 266 // also depend on another without problems on Windows 267 const char* currentPATH = getenv("PATH"); 268 std::string newPATH = pluginPath; 269 if (currentPATH != NULL) 270 newPATH = std::string(currentPATH) + ';' + newPATH; 271 putenv(const_cast<char*>(("PATH=" + newPATH).c_str())); 272 #endif 273 312 274 // Do some SubString magic to get the comma separated list of plugins 313 275 SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '{', '}', false, '\0'); 314 // Use backslash paths on Windows! file_string() already does that though.315 276 for (unsigned int i = 0; i < plugins.size(); ++i) 316 ogreRoot_->loadPlugin( (folder / plugins[i]).file_string());277 ogreRoot_->loadPlugin(pluginPath + '/' + plugins[i]); 317 278 } 318 279 -
code/trunk/src/libraries/core/GraphicsManager.h
r8079 r8351 114 114 115 115 scoped_ptr<OgreWindowEventListener> ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h 116 #if OGRE_VERSION < 0x010600117 scoped_ptr<MemoryArchiveFactory> memoryArchiveFactory_; //!< Stores the modified particle scripts118 #endif119 116 scoped_ptr<Ogre::LogManager> ogreLogger_; 120 117 scoped_ptr<Ogre::Root> ogreRoot_; //!< Ogre's root … … 131 128 // config values 132 129 std::string ogreConfigFile_; //!< ogre config filename 133 std::string ogrePluginsDirectory_; //!< Directory where the Ogre plugins are located134 130 std::string ogrePlugins_; //!< Comma separated list of all plugins to load 135 131 std::string ogreLogFile_; //!< log filename for Ogre log messages -
code/trunk/src/libraries/core/Identifier.h
r7401 r8351 123 123 124 124 /// Returns the unique ID of the class. 125 FORCEINLINE unsigned int getClassID() const { return this->classID_; }125 ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; } 126 126 127 127 /// Returns the list of all existing objects of this class. … … 395 395 { 396 396 // Get the name of the class 397 const std::string&name = typeid(T).name();397 std::string name = typeid(T).name(); 398 398 399 399 // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used. … … 486 486 */ 487 487 template <class T, class U> 488 FORCEINLINE T orxonox_cast(U* source)488 ORX_FORCEINLINE T orxonox_cast(U* source) 489 489 { 490 490 #ifdef ORXONOX_COMPILER_MSVC -
code/trunk/src/libraries/core/LuaState.cc
r7284 r8351 30 30 #include "LuaState.h" 31 31 32 #include <tolua /tolua++.h>32 #include <tolua++.h> 33 33 extern "C" { 34 34 #include <lua.h> … … 60 60 luaState_ = lua_open(); 61 61 Loki::ScopeGuard luaStateGuard = Loki::MakeGuard(&lua_close, luaState_); 62 #if LUA_VERSION_NUM == 50163 62 luaL_openlibs(luaState_); 64 #else65 luaopen_base(luaState_);66 luaopen_string(luaState_);67 luaopen_table(luaState_);68 luaopen_math(luaState_);69 luaopen_io(luaState_);70 luaopen_debug(luaState_);71 #endif72 63 73 64 // Open all available tolua interfaces … … 187 178 } 188 179 189 #if LUA_VERSION_NUM != 501190 LoadS ls;191 ls.s = code.c_str();192 ls.size = code.size();193 int error = lua_load(luaState_, &orxonox::LuaState::lua_Chunkreader, &ls, chunkname.c_str());194 #else195 180 int error = luaL_loadbuffer(luaState_, code.c_str(), code.size(), chunkname.c_str()); 196 #endif197 181 198 182 switch (error) … … 293 277 } 294 278 295 #if LUA_VERSION_NUM != 501296 const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size)297 {298 LoadS* ls = static_cast<LoadS*>(data);299 if (ls->size == 0)300 return NULL;301 *size = ls->size;302 ls->size = 0;303 return ls->s;304 }305 #endif306 307 279 /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name) 308 280 { -
code/trunk/src/libraries/core/LuaState.h
r7401 r8351 113 113 shared_ptr<ResourceInfo> getFileInfo(const std::string& filename); 114 114 115 #if LUA_VERSION_NUM != 501116 struct LoadS117 {118 const char* s;119 size_t size;120 };121 122 static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);123 #endif124 125 115 std::stringstream output_; 126 116 lua_State* luaState_; -
code/trunk/src/libraries/core/OrxonoxClass.h
r8079 r8351 135 135 Returns NULL if the no pointer was found. 136 136 */ 137 FORCEINLINE void* getDerivedPointer(unsigned int classID)137 ORX_FORCEINLINE void* getDerivedPointer(unsigned int classID) 138 138 { 139 139 for (int i = this->objectPointers_.size() - 1; i >= 0; --i) … … 146 146 147 147 /// Version of getDerivedPointer with template 148 template <class T> FORCEINLINE T* getDerivedPointer(unsigned int classID)148 template <class T> ORX_FORCEINLINE T* getDerivedPointer(unsigned int classID) 149 149 { return static_cast<T*>(this->getDerivedPointer(classID)); } 150 150 /// Const version of getDerivedPointer with template 151 template <class T> FORCEINLINE const T* getDerivedPointer(unsigned int classID) const151 template <class T> ORX_FORCEINLINE const T* getDerivedPointer(unsigned int classID) const 152 152 { return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID); } 153 153 -
code/trunk/src/libraries/core/PathConfig.cc
r6417 r8351 33 33 #include <cstdio> 34 34 #include <vector> 35 #include <boost/version.hpp>36 35 #include <boost/filesystem.hpp> 37 36 … … 56 55 #include "CommandLineParser.h" 57 56 58 // Boost 1.36 has some issues with deprecated functions that have been omitted 59 #if (BOOST_VERSION == 103600) 60 # define BOOST_LEAF_FUNCTION filename 57 // Differentiate Boost Filesystem v2 and v3 58 #if (BOOST_FILESYSTEM_VERSION < 3) 59 # define BF_LEAF leaf 60 # define BF_GENERIC_STRING string 61 # define BF_NATIVE_STRING file_string 61 62 #else 62 # define BOOST_LEAF_FUNCTION leaf 63 # define BF_LEAF path().filename().string 64 # define BF_GENERIC_STRING generic_string 65 # define BF_NATIVE_STRING string 63 66 #endif 64 67 … … 95 98 #elif defined(ORXONOX_PLATFORM_APPLE) 96 99 char buffer[1024]; 97 u nsigned longpath_len = 1023;100 uint32_t path_len = 1023; 98 101 if (_NSGetExecutablePath(buffer, &path_len)) 99 102 ThrowException(General, "Could not retrieve executable path."); … … 125 128 #endif 126 129 127 executablePath_ = bf::path(buffer); 128 #ifndef ORXONOX_PLATFORM_APPLE 129 executablePath_ = executablePath_.branch_path(); // remove executable name 130 #endif 130 // Remove executable filename 131 executablePath_ = bf::path(buffer).branch_path(); 131 132 132 133 ///////////////////// … … 206 207 207 208 // Get user directory 208 # ifdef ORXONOX_PLATFORM_UNIX /* Apple? */209 #ifdef ORXONOX_PLATFORM_UNIX 209 210 char* userDataPathPtr(getenv("HOME")); 210 # 211 #else 211 212 char* userDataPathPtr(getenv("APPDATA")); 212 # 213 #endif 213 214 if (userDataPathPtr == NULL) 214 215 ThrowException(General, "Could not retrieve user data path."); … … 233 234 // Create directories to avoid problems when opening files in non existent folders. 234 235 std::vector<std::pair<bf::path, std::string> > directories; 235 directories.push_back(std::make_pair(bf::path(configPath_), "config"));236 directories.push_back(std::make_pair(bf::path(logPath_), "log"));236 directories.push_back(std::make_pair(bf::path(configPath_), std::string("config"))); 237 directories.push_back(std::make_pair(bf::path(logPath_), std::string("log"))); 237 238 238 239 for (std::vector<std::pair<bf::path, std::string> >::iterator it = directories.begin(); … … 242 243 { 243 244 ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \ 244 Please remove " + it->first. string());245 Please remove " + it->first.BF_GENERIC_STRING()); 245 246 } 246 247 if (bf::create_directories(it->first)) // function may not return true at all (bug?) … … 259 260 size_t moduleextensionlength = moduleextension.size(); 260 261 262 #ifdef ORXONOX_PLATFORM_WINDOWS 261 263 // Add that path to the PATH variable in case a module depends on another one 262 std::string pathVariable(getenv("PATH")); 263 putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str())); 264 const char* currentPATH = getenv("PATH"); 265 std::string newPATH = modulePath_.BF_NATIVE_STRING(); 266 if (currentPATH != NULL) 267 newPATH = std::string(currentPATH) + ';' + newPATH; 268 putenv(const_cast<char*>(("PATH=" + newPATH).c_str())); 269 #endif 264 270 265 271 // Make sure the path exists, otherwise don't load modules … … 273 279 while (file != end) 274 280 { 275 const std::string& filename = file->BOOST_LEAF_FUNCTION();276 277 // Check if the file ends with the ex ension in question281 std::string filename = file->BF_LEAF(); 282 283 // Check if the file ends with the extension in question 278 284 if (filename.size() > moduleextensionlength) 279 285 { … … 282 288 // We've found a helper file 283 289 const std::string& library = filename.substr(0, filename.size() - moduleextensionlength); 284 modulePaths.push_back( (modulePath_ / library).file_string());290 modulePaths.push_back(getModulePathString() + library); 285 291 } 286 292 } … … 293 299 /*static*/ std::string PathConfig::getRootPathString() 294 300 { 295 return getInstance().rootPath_. string() + '/';301 return getInstance().rootPath_.BF_GENERIC_STRING() + '/'; 296 302 } 297 303 298 304 /*static*/ std::string PathConfig::getExecutablePathString() 299 305 { 300 return getInstance().executablePath_. string() + '/';306 return getInstance().executablePath_.BF_GENERIC_STRING() + '/'; 301 307 } 302 308 303 309 /*static*/ std::string PathConfig::getDataPathString() 304 310 { 305 return getInstance().dataPath_. string() + '/';311 return getInstance().dataPath_.BF_GENERIC_STRING() + '/'; 306 312 } 307 313 308 314 /*static*/ std::string PathConfig::getExternalDataPathString() 309 315 { 310 return getInstance().externalDataPath_. string() + '/';316 return getInstance().externalDataPath_.BF_GENERIC_STRING() + '/'; 311 317 } 312 318 313 319 /*static*/ std::string PathConfig::getConfigPathString() 314 320 { 315 return getInstance().configPath_. string() + '/';321 return getInstance().configPath_.BF_GENERIC_STRING() + '/'; 316 322 } 317 323 318 324 /*static*/ std::string PathConfig::getLogPathString() 319 325 { 320 return getInstance().logPath_. string() + '/';326 return getInstance().logPath_.BF_GENERIC_STRING() + '/'; 321 327 } 322 328 323 329 /*static*/ std::string PathConfig::getModulePathString() 324 330 { 325 return getInstance().modulePath_. string() + '/';331 return getInstance().modulePath_.BF_GENERIC_STRING() + '/'; 326 332 } 327 333 } -
code/trunk/src/libraries/core/PathConfig.h
r7427 r8351 113 113 static std::string getModulePathString(); 114 114 115 //! Return tr rue for runs in the build directory (not installed)115 //! Return true for runs in the build directory (not installed) 116 116 static bool isDevelopmentRun() { return getInstance().bDevRun_; } 117 117 -
code/trunk/src/libraries/core/Resource.cc
r6746 r8351 34 34 #include <OgreResourceGroupManager.h> 35 35 36 // Differentiate Boost Filesystem v2 and v3 37 #if (BOOST_FILESYSTEM_VERSION < 3) 38 # define BF_GENERIC_STRING string 39 #else 40 # define BF_GENERIC_STRING generic_string 41 #endif 42 36 43 namespace orxonox 37 44 { 38 std::string Resource::DEFAULT_GROUP(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 45 const std::string& Resource::getDefaultResourceGroup() 46 { 47 return Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME; 48 } 39 49 40 50 DataStreamPtr Resource::open(const std::string& name) 41 51 { 42 52 return Ogre::ResourceGroupManager::getSingleton().openResource(name, 43 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);53 getDefaultResourceGroup(), true); 44 54 } 45 55 … … 95 105 boost::filesystem::path base(it->archive->getName()); 96 106 base /= it->filename; 97 ptr->fileSystemPath = base. string();107 ptr->fileSystemPath = base.BF_GENERIC_STRING(); 98 108 } 99 109 return ptr; -
code/trunk/src/libraries/core/Resource.h
r7401 r8351 137 137 138 138 //! Name of the default resource group (usually "General") 139 static std::string DEFAULT_GROUP;139 static const std::string& getDefaultResourceGroup(); 140 140 141 141 private: -
code/trunk/src/libraries/core/Super.h
r7401 r8351 94 94 struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> \ 95 95 { \ 96 static void check() \96 static void superCheck() \ 97 97 { \ 98 98 SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \ 99 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>:: check(); \99 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); \ 100 100 } \ 101 101 \ … … 132 132 struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \ 133 133 { \ 134 static void check() \135 { \ 136 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>:: check(); \134 static void superCheck() \ 135 { \ 136 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \ 137 137 } \ 138 138 }; … … 150 150 struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> 151 151 { 152 static void check()152 static void superCheck() 153 153 { 154 154 // This call to the apply-function is the whole check. By calling the function with … … 156 156 SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); 157 157 158 // Go go the check for of next super-function (functionnumber + 1)159 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>:: check();158 // Go go the superCheck for of next super-function (functionnumber + 1) 159 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); 160 160 } 161 161 … … 202 202 struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \ 203 203 { \ 204 // The check function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)205 static void check() \206 { \ 207 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>:: check(); \204 // The superCheck function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1) 205 static void superCheck() \ 206 { \ 207 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \ 208 208 } \ 209 209 }; … … 303 303 struct SuperFunctionCondition 304 304 { 305 static void check() {}305 static void superCheck() {} 306 306 }; 307 307 … … 338 338 struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2> \ 339 339 { \ 340 static void check() \340 static void superCheck() \ 341 341 { \ 342 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>:: check(); \342 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck(); \ 343 343 } \ 344 344 }; \ … … 421 421 // If this function gets called, the header-file of the super function is not 422 422 // included, so this fallback template (templatehack not specialized) is used 423 static void check()423 static void superCheck() 424 424 { 425 425 // Calls the condition-check of the next super-function (functionnumber + 1) 426 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>:: check();426 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck(); 427 427 } 428 428 }; … … 574 574 virtual void createSuperFunctionCaller() const 575 575 { 576 SuperFunctionCondition<0, T, 0, 0>:: check();576 SuperFunctionCondition<0, T, 0, 0>::superCheck(); 577 577 } 578 578 -
code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc
r7401 r8351 35 35 36 36 #include <map> 37 #include <boost/version.hpp>38 37 #include <boost/filesystem.hpp> 39 38 … … 47 46 #include "TclThreadManager.h" 48 47 49 // Boost 1.36 has some issues with deprecated functions that have been omitted 50 #if (BOOST_VERSION == 103600) 51 # define BOOST_LEAF_FUNCTION filename 48 // Differentiate Boost Filesystem v2 and v3 49 #if (BOOST_FILESYSTEM_VERSION < 3) 50 # define BF_LEAF leaf 51 # define BF_GENERIC_STRING string 52 # define BF_DICTIONARY_ENTRY_NAME string 52 53 #else 53 # define BOOST_LEAF_FUNCTION leaf 54 # define BF_LEAF path().filename().string 55 # define BF_GENERIC_STRING generic_string 56 # define BF_DICTIONARY_ENTRY_NAME path().string 54 57 #endif 55 58 … … 245 248 else 246 249 { 247 const std::string& dir = startdirectory. string();250 const std::string& dir = startdirectory.BF_GENERIC_STRING(); 248 251 if (dir.size() > 0 && dir[dir.size() - 1] == ':') 249 252 startdirectory = dir + '/'; … … 257 260 { 258 261 if (boost::filesystem::is_directory(*file)) 259 dirlist.push_back(ArgumentCompletionListElement(file-> string() + '/', getLowercase(file->string()) + '/', file->BOOST_LEAF_FUNCTION() + '/'));262 dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/')); 260 263 else 261 filelist.push_back(ArgumentCompletionListElement(file-> string(), getLowercase(file->string()), file->BOOST_LEAF_FUNCTION()));264 filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF())); 262 265 ++file; 263 266 } -
code/trunk/src/libraries/core/command/TclThreadManager.cc
r8079 r8351 116 116 TclThreadManager::~TclThreadManager() 117 117 { 118 delete this->interpreterBundles_[0]; 118 119 delete this->interpreterBundlesMutex_; 119 // delete this->mainInterpreterMutex_; // <-- temporar y disabled to avoid crash if a thread is still actively queriyng120 // delete this->mainInterpreterMutex_; // <-- temporarily disabled to avoid crash if a thread is still actively querying 120 121 delete this->messageQueue_; 121 122 } -
code/trunk/src/libraries/core/input/InputDevice.h
r7271 r8351 184 184 protected: 185 185 //! Common code for all button pressed events (updates pressed buttons list and calls the input states) 186 FORCEINLINE void buttonPressed(ButtonTypeParam button)186 ORX_FORCEINLINE void buttonPressed(ButtonTypeParam button) 187 187 { 188 188 // check whether the button already is in the list (can happen when focus was lost) … … 201 201 202 202 //! Common code for all button released events (updates pressed buttons list and calls the input states) 203 FORCEINLINE void buttonReleased(ButtonTypeParam button)203 ORX_FORCEINLINE void buttonReleased(ButtonTypeParam button) 204 204 { 205 205 // remove the button from the pressedButtons_ list -
code/trunk/src/libraries/core/input/InputManager.cc
r8079 r8351 151 151 assert(devices_.size() == InputDeviceEnumerator::FirstJoyStick); 152 152 153 typedef std::pair<std::string, std::string> StringPair; 154 153 155 // Fill parameter list 154 156 OIS::ParamList paramList; 155 157 size_t windowHnd = GraphicsManager::getInstance().getRenderWindowHandle(); 156 paramList.insert( std::make_pair("WINDOW", multi_cast<std::string>(windowHnd)));158 paramList.insert(StringPair("WINDOW", multi_cast<std::string>(windowHnd))); 157 159 #if defined(ORXONOX_PLATFORM_WINDOWS) 158 paramList.insert( std::make_pair("w32_keyboard", "DISCL_NONEXCLUSIVE"));159 paramList.insert( std::make_pair("w32_keyboard", "DISCL_FOREGROUND"));160 paramList.insert( std::make_pair("w32_mouse", "DISCL_FOREGROUND"));160 paramList.insert(StringPair("w32_keyboard", "DISCL_NONEXCLUSIVE")); 161 paramList.insert(StringPair("w32_keyboard", "DISCL_FOREGROUND")); 162 paramList.insert(StringPair("w32_mouse", "DISCL_FOREGROUND")); 161 163 if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen()) 162 164 { 163 165 // Disable Windows key plus special keys (like play, stop, next, etc.) 164 paramList.insert( std::make_pair("w32_keyboard", "DISCL_NOWINKEY"));165 paramList.insert( std::make_pair("w32_mouse", "DISCL_EXCLUSIVE"));166 } 167 else 168 paramList.insert( std::make_pair("w32_mouse", "DISCL_NONEXCLUSIVE"));166 paramList.insert(StringPair("w32_keyboard", "DISCL_NOWINKEY")); 167 paramList.insert(StringPair("w32_mouse", "DISCL_EXCLUSIVE")); 168 } 169 else 170 paramList.insert(StringPair("w32_mouse", "DISCL_NONEXCLUSIVE")); 169 171 #elif defined(ORXONOX_PLATFORM_LINUX) 170 172 // Enabling this is probably a bad idea, but whenever orxonox crashes, the setting stays on 171 173 // Trouble might be that the Pressed event occurs a bit too often... 172 paramList.insert( std::make_pair("XAutoRepeatOn", "true"));174 paramList.insert(StringPair("XAutoRepeatOn", "true")); 173 175 174 176 if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen()) 175 177 { 176 178 if (CommandLineParser::getValue("keyboard_no_grab").getBool()) 177 paramList.insert( std::make_pair("x11_keyboard_grab", "false"));179 paramList.insert(StringPair("x11_keyboard_grab", "false")); 178 180 else 179 paramList.insert( std::make_pair("x11_keyboard_grab", "true"));180 paramList.insert( std::make_pair("x11_mouse_grab", "true"));181 paramList.insert( std::make_pair("x11_mouse_hide", "true"));182 } 183 else 184 { 185 paramList.insert( std::make_pair("x11_keyboard_grab", "false"));186 paramList.insert( std::make_pair("x11_mouse_grab", "false"));187 paramList.insert( std::make_pair("x11_mouse_hide", "false"));181 paramList.insert(StringPair("x11_keyboard_grab", "true")); 182 paramList.insert(StringPair("x11_mouse_grab", "true")); 183 paramList.insert(StringPair("x11_mouse_hide", "true")); 184 } 185 else 186 { 187 paramList.insert(StringPair("x11_keyboard_grab", "false")); 188 paramList.insert(StringPair("x11_mouse_grab", "false")); 189 paramList.insert(StringPair("x11_mouse_hide", "false")); 188 190 } 189 191 #endif -
code/trunk/src/libraries/core/input/InputState.h
r7401 r8351 176 176 }; 177 177 178 FORCEINLINE void InputState::update(float dt)178 ORX_FORCEINLINE void InputState::update(float dt) 179 179 { 180 180 for (unsigned int i = 0; i < handlers_.size(); ++i) … … 183 183 } 184 184 185 FORCEINLINE void InputState::update(float dt, unsigned int device)185 ORX_FORCEINLINE void InputState::update(float dt, unsigned int device) 186 186 { 187 187 switch (device) … … 205 205 206 206 template <typename EventType, class ButtonTypeParam> 207 FORCEINLINE void InputState::buttonEvent(unsigned int device, ButtonTypeParam button)207 ORX_FORCEINLINE void InputState::buttonEvent(unsigned int device, ButtonTypeParam button) 208 208 { 209 209 assert(device < handlers_.size()); … … 216 216 } 217 217 218 FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)218 ORX_FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) 219 219 { 220 220 if (handlers_[mouseIndex_s] != NULL) … … 222 222 } 223 223 224 FORCEINLINE void InputState::mouseScrolled(int abs, int rel)224 ORX_FORCEINLINE void InputState::mouseScrolled(int abs, int rel) 225 225 { 226 226 if (handlers_[mouseIndex_s] != NULL) … … 228 228 } 229 229 230 FORCEINLINE void InputState::joyStickAxisMoved(unsigned int device, unsigned int axis, float value)230 ORX_FORCEINLINE void InputState::joyStickAxisMoved(unsigned int device, unsigned int axis, float value) 231 231 { 232 232 assert(device < handlers_.size()); -
code/trunk/src/libraries/core/input/KeyBinder.cc
r8079 r8351 396 396 397 397 // iterate over all modes 398 for ( size_t mode_index = 0; mode_index < 3; ++mode_index)399 { 400 if (mode_index == (unsigned int)new_mode) // skip commands that are already in the desired mode398 for (int mode_index = 0; mode_index < 3; ++mode_index) 399 { 400 if (mode_index == new_mode) // skip commands that are already in the desired mode 401 401 continue; 402 402 -
code/trunk/src/libraries/network/CMakeLists.txt
r8327 r8351 87 87 enet_orxonox 88 88 ${Boost_THREAD_LIBRARY} 89 ${CEGUI_TOLUA_LIBRARY} 89 90 util 90 91 core -
code/trunk/src/libraries/network/LANDiscoverable.cc
- Property svn:eol-style set to native
r7801 r8351 29 29 #include "LANDiscoverable.h" 30 30 31 #include "NetworkPrereqs.h"32 #include "packet/ServerInformation.h"33 34 31 #include <enet/enet.h> 35 32 #include <cassert> 36 33 #include <cstring> 34 35 #include "util/Debug.h" 36 #include "packet/ServerInformation.h" 37 37 38 38 namespace orxonox -
code/trunk/src/libraries/network/LANDiscoverable.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/LANDiscovery.cc
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/LANDiscovery.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/MasterServer.cc
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/MasterServer.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/MasterServerComm.cc
- Property svn:eol-style set to native
r7801 r8351 28 28 29 29 #include "MasterServerComm.h" 30 #include "util/Debug.h" 30 31 31 32 namespace orxonox -
code/trunk/src/libraries/network/MasterServerComm.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/MasterServerProtocol.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/NetworkPrecompiledHeaders.h
r7952 r8351 62 62 #include <cmath> // 15 63 63 64 #define WIN32_LEAN_AND_MEAN65 #include <enet/enet.h> // 6, 3.1MB66 67 64 #include <OgreMath.h> // 15 68 65 #include <OgreVector2.h> // 15 … … 71 68 #include <OgreQuaternion.h> // 15 72 69 #include <OgreColourValue.h> // 15 70 71 #define WIN32_LEAN_AND_MEAN 72 #include <enet/enet.h> // 6, 3.1MB 73 73 74 74 #include "util/mbool.h" // 11 -
code/trunk/src/libraries/network/NetworkPrereqs.h
r8327 r8351 52 52 # endif 53 53 # endif 54 #elif defined ( ORXONOX_GCC_VISIBILITY ) 54 # define _NetworkPrivate 55 #elif defined (ORXONOX_GCC_VISIBILITY) 55 56 # define _NetworkExport __attribute__ ((visibility("default"))) 57 # define _NetworkPrivate __attribute__ ((visibility("hidden"))) 56 58 #else 57 59 # define _NetworkExport 60 # define _NetworkPrivate 58 61 #endif 59 62 -
code/trunk/src/libraries/network/PeerList.cc
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/PeerList.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/Server.cc
r8327 r8351 252 252 * @brief: return packet loss ratio to client (scales from 0 to 1) 253 253 */ 254 doubleServer::getPacketLoss(unsigned int clientID)254 float Server::getPacketLoss(unsigned int clientID) 255 255 { 256 256 // assert(ClientInformation::findClient(clientID)); -
code/trunk/src/libraries/network/Server.h
r8327 r8351 74 74 unsigned int getRTT(unsigned int clientID); 75 75 virtual void printRTT(); 76 doublegetPacketLoss(unsigned int clientID);76 float getPacketLoss(unsigned int clientID); 77 77 protected: 78 78 void updateGamestate(); -
code/trunk/src/libraries/network/ServerList.cc
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/ServerList.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/WANDiscoverable.cc
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/WANDiscoverable.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/WANDiscovery.cc
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/WANDiscovery.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/packet/FunctionCalls.cc
r7801 r8351 33 33 #include "network/FunctionCallManager.h" 34 34 #include "network/GamestateHandler.h" 35 #include "network/Host.h" 35 36 36 37 namespace orxonox { -
code/trunk/src/libraries/network/packet/ServerInformation.cc
- Property svn:eol-style set to native
-
code/trunk/src/libraries/network/packet/ServerInformation.h
- Property svn:eol-style set to native
-
code/trunk/src/libraries/tools/BulletConversions.h
r5781 r8351 43 43 struct ConverterExplicit<orxonox::Vector3, btVector3> 44 44 { 45 FORCEINLINE static bool convert(btVector3* output, const orxonox::Vector3& input)45 ORX_FORCEINLINE static bool convert(btVector3* output, const orxonox::Vector3& input) 46 46 { 47 47 output->setX(input.x); … … 56 56 struct ConverterExplicit<btVector3, orxonox::Vector3> 57 57 { 58 FORCEINLINE static bool convert(orxonox::Vector3* output, const btVector3& input)58 ORX_FORCEINLINE static bool convert(orxonox::Vector3* output, const btVector3& input) 59 59 { 60 60 output->x = input.x(); … … 69 69 struct ConverterExplicit<orxonox::Quaternion, btQuaternion> 70 70 { 71 FORCEINLINE static bool convert(btQuaternion* output, const orxonox::Quaternion& input)71 ORX_FORCEINLINE static bool convert(btQuaternion* output, const orxonox::Quaternion& input) 72 72 { 73 73 output->setW(input.w); … … 83 83 struct ConverterExplicit<btQuaternion, orxonox::Quaternion> 84 84 { 85 FORCEINLINE static bool convert(orxonox::Quaternion* output, const btQuaternion& input)85 ORX_FORCEINLINE static bool convert(orxonox::Quaternion* output, const btQuaternion& input) 86 86 { 87 87 output->w = input.w(); -
code/trunk/src/libraries/tools/CMakeLists.txt
r7172 r8351 21 21 FIND_HEADER_FILES 22 22 LINK_LIBRARIES 23 ${OGRE_LIBRARY} 24 ${Boost_FILESYSTEM_LIBRARY} 25 ${Boost_SYSTEM_LIBRARY} # Filesystem dependency 26 tinyxml_orxonox 27 util 23 28 core 24 SOURCE_FILES ${TOOLS_SRC_FILES} 29 SOURCE_FILES 30 ${TOOLS_SRC_FILES} 25 31 ) -
code/trunk/src/libraries/tools/Mesh.cc
r6417 r8351 69 69 this->entity_ = this->scenemanager_->createEntity("Mesh" + multi_cast<std::string>(Mesh::meshCounter_s++), meshsource); 70 70 this->entity_->setCastShadows(this->bCastShadows_); 71 72 #if OGRE_VERSION < 0x01060073 this->entity_->setNormaliseNormals(true);74 /*75 Excerpt from Ogre forum:76 "Note that the above is only for the fixed function pipeline.77 If/when you get into shaders, you'll need to manually normalize() the normal inside the vertex or pixel shader."78 79 I don't know exactly what this means, but I put this here if there will be problems with shaders.80 */81 #endif82 71 } 83 72 catch (...) -
code/trunk/src/libraries/tools/ResourceCollection.cc
r7401 r8351 45 45 46 46 // Default group is "General" 47 this->setResourceGroup(Resource:: DEFAULT_GROUP);47 this->setResourceGroup(Resource::getDefaultResourceGroup()); 48 48 } 49 49 -
code/trunk/src/libraries/tools/ToolsPrereqs.h
r8079 r8351 52 52 # endif 53 53 # endif 54 #elif defined ( ORXONOX_GCC_VISIBILITY ) 54 # define _ToolsPrivate 55 #elif defined (ORXONOX_GCC_VISIBILITY) 55 56 # define _ToolsExport __attribute__ ((visibility("default"))) 57 # define _ToolsPrivate __attribute__ ((visibility("hidden"))) 56 58 #else 57 59 # define _ToolsExport 60 # define _ToolsPrivate 58 61 #endif 59 62 -
code/trunk/src/libraries/util/CMakeLists.txt
r7449 r8351 19 19 20 20 SET_SOURCE_FILES(UTIL_SRC_FILES 21 Clock.cc22 Exception.cc23 ExprParser.cc24 Math.cc25 MultiType.cc26 Scope.cc27 StringUtils.cc28 21 COMPILATION_BEGIN StableCompilation.cc 29 22 Clipboard.cc 23 Clock.cc 30 24 Convert.cc 31 25 CRC32.cc 26 ExprParser.cc 32 27 OutputHandler.cc 28 Scope.cc 33 29 ScopedSingletonManager.cc 34 30 SharedPtr.cc 35 SignalHandler.cc36 31 Sleep.cc 37 32 SmallObjectAllocator.cc 38 33 SubString.cc 39 34 COMPILATION_END 35 36 MultiType.cc 37 Exception.cc 38 Math.cc 39 SignalHandler.cc 40 StringUtils.cc 40 41 ) 41 42 42 IF(GCC_NO_SYSTEM_HEADER_SUPPORT)43 # Get around displaying a few hundred lines of warning code44 SET_SOURCE_FILES_PROPERTIES(MultiType.cc PROPERTIES COMPILE_FLAGS "-w")45 ENDIF()46 43 IF(MSVC) 47 44 # Simply using #pragma warning(disable:4244) doesn't really disable it -
code/trunk/src/libraries/util/Convert.h
r7401 r8351 143 143 struct ConverterFallback 144 144 { 145 FORCEINLINE static bool convert(ToType* output, const FromType& input)145 ORX_FORCEINLINE static bool convert(ToType* output, const FromType& input) 146 146 { 147 147 COUT(2) << "Could not convert value of type " << typeid(FromType).name() … … 155 155 struct ConverterFallback<FromType*, ToType*> 156 156 { 157 FORCEINLINE static bool convert(ToType** output, FromType* const input)157 ORX_FORCEINLINE static bool convert(ToType** output, FromType* const input) 158 158 { 159 159 ToType* temp = dynamic_cast<ToType*>(input); … … 182 182 struct ConverterStringStream 183 183 { 184 FORCEINLINE static bool convert(ToType* output, const FromType& input)184 ORX_FORCEINLINE static bool convert(ToType* output, const FromType& input) 185 185 { 186 186 return orxonox::ConverterFallback<FromType, ToType>::convert(output, input); … … 198 198 /// Fallback operator <<() (delegates to orxonox::ConverterFallback) 199 199 template <class FromType> 200 FORCEINLINE bool operator <<(std::ostream& outstream, const FromType& input)200 ORX_FORCEINLINE bool operator <<(std::ostream& outstream, const FromType& input) 201 201 { 202 202 std::string temp; … … 215 215 struct ConverterStringStream<FromType, std::string> 216 216 { 217 FORCEINLINE static bool convert(std::string* output, const FromType& input)217 ORX_FORCEINLINE static bool convert(std::string* output, const FromType& input) 218 218 { 219 219 using namespace fallbackTemplates; … … 241 241 /// Fallback operator >>() (delegates to orxonox::ConverterFallback) 242 242 template <class ToType> 243 FORCEINLINE bool operator >>(std::istream& instream, ToType& output)243 ORX_FORCEINLINE bool operator >>(std::istream& instream, ToType& output) 244 244 { 245 245 std::string input(static_cast<std::istringstream&>(instream).str()); … … 252 252 struct ConverterStringStream<std::string, ToType> 253 253 { 254 FORCEINLINE static bool convert(ToType* output, const std::string& input)254 ORX_FORCEINLINE static bool convert(ToType* output, const std::string& input) 255 255 { 256 256 using namespace fallbackTemplates; … … 276 276 /// %Template delegates to ::ConverterStringStream 277 277 template <class FromType, class ToType> 278 FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<false>)278 ORX_FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<false>) 279 279 { 280 280 return ConverterStringStream<FromType, ToType>::convert(output, input); … … 283 283 /// Makes an implicit cast from \a FromType to \a ToType 284 284 template <class FromType, class ToType> 285 FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<true>)285 ORX_FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<true>) 286 286 { 287 287 (*output) = static_cast<ToType>(input); … … 303 303 { 304 304 enum { probe = ImplicitConversion<FromType, ToType>::exists }; 305 FORCEINLINE static bool convert(ToType* output, const FromType& input)305 ORX_FORCEINLINE static bool convert(ToType* output, const FromType& input) 306 306 { 307 307 // Use the probe's value to delegate to the right function … … 327 327 */ 328 328 template <class FromType, class ToType> 329 FORCEINLINE bool convertValue(ToType* output, const FromType& input)329 ORX_FORCEINLINE bool convertValue(ToType* output, const FromType& input) 330 330 { 331 331 return ConverterExplicit<FromType, ToType>::convert(output, input); … … 348 348 */ 349 349 template<class FromType, class ToType> 350 FORCEINLINE bool convertValue(ToType* output, const FromType& input, const ToType& fallback)350 ORX_FORCEINLINE bool convertValue(ToType* output, const FromType& input, const ToType& fallback) 351 351 { 352 352 if (convertValue(output, input)) … … 361 361 /// Directly returns the converted value, but uses the fallback on failure. @see convertValue 362 362 template<class FromType, class ToType> 363 FORCEINLINE ToType getConvertedValue(const FromType& input, const ToType& fallback)363 ORX_FORCEINLINE ToType getConvertedValue(const FromType& input, const ToType& fallback) 364 364 { 365 365 ToType output; … … 380 380 */ 381 381 template<class ToType, class FromType> 382 FORCEINLINE ToType multi_cast(const FromType& input)382 ORX_FORCEINLINE ToType multi_cast(const FromType& input) 383 383 { 384 384 ToType output; … … 395 395 struct ConverterExplicit<const char*, ToType> 396 396 { 397 FORCEINLINE static bool convert(ToType* output, const char* input)397 ORX_FORCEINLINE static bool convert(ToType* output, const char* input) 398 398 { 399 399 return convertValue<std::string, ToType>(output, input); … … 405 405 struct ConverterExplicit<char, std::string> 406 406 { 407 FORCEINLINE static bool convert(std::string* output, const char input)407 ORX_FORCEINLINE static bool convert(std::string* output, const char input) 408 408 { 409 409 *output = input; … … 415 415 struct ConverterExplicit<unsigned char, std::string> 416 416 { 417 FORCEINLINE static bool convert(std::string* output, const unsigned char input)417 ORX_FORCEINLINE static bool convert(std::string* output, const unsigned char input) 418 418 { 419 419 *output = input; … … 425 425 struct ConverterExplicit<std::string, char> 426 426 { 427 FORCEINLINE static bool convert(char* output, const std::string& input)427 ORX_FORCEINLINE static bool convert(char* output, const std::string& input) 428 428 { 429 429 if (!input.empty()) … … 438 438 struct ConverterExplicit<std::string, unsigned char> 439 439 { 440 FORCEINLINE static bool convert(unsigned char* output, const std::string& input)440 ORX_FORCEINLINE static bool convert(unsigned char* output, const std::string& input) 441 441 { 442 442 if (!input.empty()) … … 453 453 struct ConverterExplicit<bool, std::string> 454 454 { 455 FORCEINLINE static bool convert(std::string* output, const bool& input)455 ORX_FORCEINLINE static bool convert(std::string* output, const bool& input) 456 456 { 457 457 if (input) -
code/trunk/src/libraries/util/Exception.cc
r7401 r8351 35 35 #include "Exception.h" 36 36 37 #include <cstddef> 37 38 #include <CEGUIExceptions.h> 38 39 #include "Debug.h" … … 95 96 throw; 96 97 } 98 catch (const CEGUI::Exception& ex) 99 { 100 return GeneralException(ex.getMessage().c_str(), ex.getLine(), 101 ex.getFileName().c_str(), ex.getName().c_str()).getDescription(); 102 } 97 103 catch (const std::exception& ex) 98 104 { 99 105 return ex.what(); 100 }101 catch (const CEGUI::Exception& ex)102 {103 #if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6104 return GeneralException(ex.getMessage().c_str()).getDescription();105 #else106 return GeneralException(ex.getMessage().c_str(), ex.getLine(),107 ex.getFileName().c_str(), ex.getName().c_str()).getDescription();108 #endif109 106 } 110 107 catch (...) -
code/trunk/src/libraries/util/ExprParser.cc
r7184 r8351 52 52 { 53 53 this->failed_ = false; 54 this->variables_["pi"] = math::pi _d;55 this->variables_["e"] = math::e _d;56 } 57 58 void ExprParser::setVariable(const std::string& varname, doublevalue)54 this->variables_["pi"] = math::pi; 55 this->variables_["e"] = math::e; 56 } 57 58 void ExprParser::setVariable(const std::string& varname, float value) 59 59 { 60 60 this->variables_[varname] = value; … … 78 78 //Private functions: 79 79 /******************/ 80 doubleExprParser::parse_argument()81 { 82 doublevalue = parse_expr_8();80 float ExprParser::parse_argument() 81 { 82 float value = parse_expr_8(); 83 83 if (*reading_stream == ',') 84 84 { … … 93 93 } 94 94 95 doubleExprParser::parse_last_argument()96 { 97 doublevalue = parse_expr_8();95 float ExprParser::parse_last_argument() 96 { 97 float value = parse_expr_8(); 98 98 if (*reading_stream == ')') 99 99 { … … 108 108 } 109 109 110 doubleExprParser::parse_expr_8()111 { 112 doublevalue = parse_expr_7();110 float ExprParser::parse_expr_8() 111 { 112 float value = parse_expr_7(); 113 113 for(;;) 114 114 { … … 124 124 125 125 126 doubleExprParser::parse_expr_7()127 { 128 doublevalue = parse_expr_6();126 float ExprParser::parse_expr_7() 127 { 128 float value = parse_expr_6(); 129 129 for(;;) 130 130 { … … 139 139 } 140 140 141 doubleExprParser::parse_expr_6()142 { 143 doublevalue = parse_expr_5();141 float ExprParser::parse_expr_6() 142 { 143 float value = parse_expr_5(); 144 144 for(;;) 145 145 { … … 158 158 } 159 159 160 doubleExprParser::parse_expr_5()161 { 162 doublevalue = parse_expr_4();160 float ExprParser::parse_expr_5() 161 { 162 float value = parse_expr_4(); 163 163 for(;;) 164 164 { … … 183 183 } 184 184 185 doubleExprParser::parse_expr_4()186 { 187 doublevalue = parse_expr_3();185 float ExprParser::parse_expr_4() 186 { 187 float value = parse_expr_3(); 188 188 for(;;) 189 189 { … … 202 202 } 203 203 204 doubleExprParser::parse_expr_3()205 { 206 doublevalue = parse_expr_2();204 float ExprParser::parse_expr_3() 205 { 206 float value = parse_expr_2(); 207 207 for(;;) 208 208 { … … 217 217 case modulo: 218 218 { 219 doubletemp = parse_expr_2();219 float temp = parse_expr_2(); 220 220 value = value - floor(value/temp)*temp; 221 221 break; … … 227 227 } 228 228 229 doubleExprParser::parse_expr_2()230 { 231 doublevalue = parse_expr_1();229 float ExprParser::parse_expr_2() 230 { 231 float value = parse_expr_1(); 232 232 while (*reading_stream != '\0') 233 233 { … … 246 246 } 247 247 248 doubleExprParser::parse_expr_1()248 float ExprParser::parse_expr_1() 249 249 { 250 250 PARSE_BLANKS; 251 doublevalue;251 float value; 252 252 253 253 unary_operator op = parse_unary_operator(); … … 262 262 else if ((*reading_stream > 47 && *reading_stream < 59) || *reading_stream == 46) 263 263 { // number 264 value = strtod(reading_stream, const_cast<char**>(&reading_stream));264 value = (float)strtod(reading_stream, const_cast<char**>(&reading_stream)); 265 265 } 266 266 else if ((*reading_stream > 64 && *reading_stream < 91) || (*reading_stream > 96 && *reading_stream < 123) || *reading_stream == 46) … … 306 306 { 307 307 value = parse_last_argument(); 308 value = 0.5 *log((value + 1)/(value - 1));308 value = 0.5f*log((value + 1.0f)/(value - 1.0f)); 309 309 } 310 310 CASE("int") … … 325 325 { 326 326 value = parse_last_argument(); 327 value = (value>0 ? 1 : (value<0 ? -1 : 0));327 value = (value>0.0f ? 1.0f : (value<0.0f ? -1.0f : 0.0f)); 328 328 } 329 329 CASE("sqrt") 330 330 value = sqrt(parse_last_argument()); 331 331 CASE("degrees") 332 value = parse_last_argument()*180 /math::pi_d;332 value = parse_last_argument()*180.0f/math::pi; 333 333 CASE("radians") 334 value = parse_last_argument()*math::pi _d/180;334 value = parse_last_argument()*math::pi/180.0f; 335 335 CASE("mod") 336 336 { 337 337 value = parse_argument(); 338 doublevalue2 = parse_last_argument();338 float value2 = parse_last_argument(); 339 339 value = value - floor(value/value2)*value2; 340 340 } … … 356 356 else 357 357 { 358 std::map<std::string, double>::const_iterator it = this->variables_.find(word);358 std::map<std::string, float>::const_iterator it = this->variables_.find(word); 359 359 if (it != this->variables_.end()) 360 360 value = it->second; -
code/trunk/src/libraries/util/ExprParser.h
r7401 r8351 57 57 COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << '\'' << std::endl; 58 58 } 59 doubleresult = expr.getResult();59 float result = expr.getResult(); 60 60 } 61 61 else … … 125 125 void parse(const std::string& str); 126 126 const std::string& getRemains() { return this->remains_; } 127 doublegetResult() { return this->result_; }127 float getResult() { return this->result_; } 128 128 bool getSuccess() { return !this->failed_; } 129 129 130 void setVariable(const std::string& varname, doublevalue);130 void setVariable(const std::string& varname, float value); 131 131 132 132 private: 133 doubleparse_expr_1();134 doubleparse_expr_2();135 doubleparse_expr_3();136 doubleparse_expr_4();137 doubleparse_expr_5();138 doubleparse_expr_6();139 doubleparse_expr_7();140 doubleparse_expr_8();133 float parse_expr_1(); 134 float parse_expr_2(); 135 float parse_expr_3(); 136 float parse_expr_4(); 137 float parse_expr_5(); 138 float parse_expr_6(); 139 float parse_expr_7(); 140 float parse_expr_8(); 141 141 char* parse_word(char* str); 142 142 binary_operator parse_binary_operator(); 143 143 unary_operator parse_unary_operator(); 144 144 145 doubleparse_argument();146 doubleparse_last_argument();145 float parse_argument(); 146 float parse_last_argument(); 147 147 148 148 binary_operator op; 149 149 const char* reading_stream; 150 150 bool failed_; 151 doubleresult_;151 float result_; 152 152 std::string remains_; 153 std::map<std::string, double> variables_;153 std::map<std::string, float> variables_; 154 154 }; 155 155 156 156 //Endzeichen für float expression: ')', '}', ']', ',', ';' 157 _UtilExport bool parse_float(char* const, char**, double*);157 _UtilExport bool parse_float(char* const, char**, float*); 158 158 //Endzeichen angegeben 159 _UtilExport bool parse_float(char* const, char**, char, double*);159 _UtilExport bool parse_float(char* const, char**, char, float*); 160 160 //Letzter Teil-float eines Vektors parsen (keine Vergleichs- und Logikoperationen) 161 _UtilExport bool parse_vector_float(char* const, char**, bool, double*);161 _UtilExport bool parse_vector_float(char* const, char**, bool, float*); 162 162 } 163 163 -
code/trunk/src/libraries/util/Math.h
r7427 r8351 66 66 namespace orxonox 67 67 { 68 // C++ doesn't define any constants for pi, e, etc. 68 /** Often used numerical constants because C++ doesn't define any. 69 @note 70 The values here are decimal representations of the approximate floating 71 point value as it is stored according to the IEEE 754 standard. 72 */ 69 73 namespace math 70 74 { 71 const float pi = 3.14159265f; ///< PI 72 const float pi_2 = 1.57079633f; ///< PI / 2 73 const float pi_4 = 7.85398163e-1f; ///< PI / 4 74 const float e = 2.71828183f; ///< e 75 const float sqrt2 = 1.41421356f; ///< sqrt(2) 76 const float sqrt2_2 = 7.07106781e-1f; ///< sqrt(2) / 2 77 78 const double pi_d = 3.14159265358979324; ///< PI (double) 79 const double pi_2_d = 1.57079632679489662; ///< PI / 2 (double) 80 const double pi_4_d = 7.85398163397448310e-1; ///< PI / 4 (double) 81 const double e_d = 2.71828182845904524; ///< e (double) 82 const double sqrt2_d = 1.41421356237309505; ///< sqrt(2) (double) 83 const double sqrt2_2_d = 7.07106781186547524e-1; ///< sqrt(2) / 2 (double) 75 const float twoPi = 6.283185482025146484375f; ///< PI * 2 76 const float pi = 3.1415927410125732421875f; ///< PI 77 const float pi_2 = 1.57079637050628662109375f; ///< PI / 2 78 const float pi_4 = 0.785398185253143310546875f; ///< PI / 4 79 const float e = 2.718281269073486328125f; ///< e 80 const float sqrt2 = 1.41421353816986083984375f; ///< sqrt(2) 81 const float sqrt2_2 = 0.707106769084930419921875f; ///< sqrt(2) / 2 84 82 } 85 83 -
code/trunk/src/libraries/util/MathConvert.h
r7401 r8351 51 51 struct ConverterExplicit<orxonox::Vector2, std::string> 52 52 { 53 FORCEINLINE static bool convert(std::string* output, const orxonox::Vector2& input)53 ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::Vector2& input) 54 54 { 55 55 std::ostringstream ostream; … … 67 67 struct ConverterExplicit<orxonox::Vector3, std::string> 68 68 { 69 FORCEINLINE static bool convert(std::string* output, const orxonox::Vector3& input)69 ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::Vector3& input) 70 70 { 71 71 std::ostringstream ostream; … … 83 83 struct ConverterExplicit<orxonox::Vector4, std::string> 84 84 { 85 FORCEINLINE static bool convert(std::string* output, const orxonox::Vector4& input)85 ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::Vector4& input) 86 86 { 87 87 std::ostringstream ostream; … … 99 99 struct ConverterExplicit<orxonox::Quaternion, std::string> 100 100 { 101 FORCEINLINE static bool convert(std::string* output, const orxonox::Quaternion& input)101 ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::Quaternion& input) 102 102 { 103 103 std::ostringstream ostream; … … 115 115 struct ConverterExplicit<orxonox::ColourValue, std::string> 116 116 { 117 FORCEINLINE static bool convert(std::string* output, const orxonox::ColourValue& input)117 ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::ColourValue& input) 118 118 { 119 119 std::ostringstream ostream; … … 157 157 struct ConverterFallback<orxonox::Radian, ToType> 158 158 { 159 FORCEINLINE static bool convert(ToType* output, const orxonox::Radian& input)159 ORX_FORCEINLINE static bool convert(ToType* output, const orxonox::Radian& input) 160 160 { 161 161 return convertValue<Ogre::Real, ToType>(output, input.valueRadians()); … … 167 167 struct ConverterFallback<orxonox::Degree, ToType> 168 168 { 169 FORCEINLINE static bool convert(ToType* output, const orxonox::Degree& input)169 ORX_FORCEINLINE static bool convert(ToType* output, const orxonox::Degree& input) 170 170 { 171 171 return convertValue<Ogre::Real, ToType>(output, input.valueDegrees()); … … 177 177 struct ConverterFallback<FromType, orxonox::Radian> 178 178 { 179 FORCEINLINE static bool convert(orxonox::Radian* output, const FromType& input)179 ORX_FORCEINLINE static bool convert(orxonox::Radian* output, const FromType& input) 180 180 { 181 181 float temp; … … 194 194 struct ConverterFallback<FromType, orxonox::Degree> 195 195 { 196 FORCEINLINE static bool convert(orxonox::Degree* output, const FromType& input)196 ORX_FORCEINLINE static bool convert(orxonox::Degree* output, const FromType& input) 197 197 { 198 198 float temp; -
code/trunk/src/libraries/util/SharedPtr.h
r7401 r8351 163 163 public: 164 164 SharedCounter() : count_(1) {} 165 virtual ~SharedCounter() {} 165 166 virtual void destroy() = 0; 166 167 … … 186 187 _UtilExport SmallObjectAllocator& createSharedCounterPool(); 187 188 188 FORCEINLINE SmallObjectAllocator& getSharedCounterPool()189 ORX_FORCEINLINE SmallObjectAllocator& getSharedCounterPool() 189 190 { 190 191 static SmallObjectAllocator& instance = createSharedCounterPool(); -
code/trunk/src/libraries/util/SignalHandler.cc
r7801 r8351 37 37 #include <cstdlib> 38 38 #include <cstring> 39 #include <cstdio> 39 40 40 41 #include "Debug.h" -
code/trunk/src/libraries/util/SignalHandler.h
r7457 r8351 70 70 71 71 /// The SignalHandler is used to catch signals like SIGSEGV and write a backtrace to the logfile. 72 class SignalHandler : public Singleton<SignalHandler>72 class _UtilExport SignalHandler : public Singleton<SignalHandler> 73 73 { 74 74 friend class Singleton<SignalHandler>; -
code/trunk/src/libraries/util/UtilPrereqs.h
r6417 r8351 52 52 # endif 53 53 # endif 54 #elif defined ( ORXONOX_GCC_VISIBILITY ) 54 # define _UtilPrivate 55 #elif defined (ORXONOX_GCC_VISIBILITY) 55 56 # define _UtilExport __attribute__ ((visibility("default"))) 57 # define _UtilPrivate __attribute__ ((visibility("hidden"))) 56 58 #else 57 59 # define _UtilExport 60 # define _UtilPrivate 58 61 #endif 59 62
Note: See TracChangeset
for help on using the changeset viewer.