Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5789 for sandbox_light


Ignore:
Timestamp:
Sep 26, 2009, 12:44:49 AM (15 years ago)
Author:
rgrieder
Message:

Stripped sandbox further down to get a light version that excludes almost all core features.
Also, the Ogre dependency has been removed and a little ogremath library been added.

Location:
sandbox_light
Files:
33 added
55 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • sandbox_light/CMakeLists.txt

    r5695 r5789  
    3737################ General Config #################
    3838
    39 # Version info
    40 SET(ORXONOX_VERSION_MAJOR 0)
    41 SET(ORXONOX_VERSION_MINOR 0)
    42 SET(ORXONOX_VERSION_PATCH 3)
    43 SET(ORXONOX_VERSION 0.0.3)
    44 SET(ORXONOX_VERSION_NAME "Arcturus")
    45 
    4639# Standard path suffixes
    4740SET(DEFAULT_RUNTIME_PATH bin)
    4841SET(DEFAULT_LIBRARY_PATH lib)
    4942SET(DEFAULT_ARCHIVE_PATH lib/static)
    50 SET(DEFAULT_MODULE_PATH  lib/modules)
    5143SET(DEFAULT_DOC_PATH     doc)
    5244SET(DEFAULT_DATA_PATH    data)
     
    5850SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
    5951SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
    60 SET(CMAKE_MODULE_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_MODULE_PATH})
    6152SET(CMAKE_DOC_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH})
    6253# Data directories are only inputs, no delclaration here
    6354SET(CMAKE_CONFIG_OUTPUT_DIRECTORY  ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH})
    6455SET(CMAKE_LOG_OUTPUT_DIRECTORY     ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH})
    65 
    66 # Set the extension of the dynamic modules
    67 SET(ORXONOX_MODULE_EXTENSION ".module")
    6856
    6957# Sets where to find the external libraries like OgreMain.dll at runtime
  • sandbox_light/INSTALL

    r2710 r5789  
    99(for windows there are already precompiled packages on the website)
    1010
    11 OGRE 3D Graphics Engine          1.4 (1.6 not yet supported)
    12 CEGUI (Crazy Eddie's GUI System) 0.5
    13 Boost libraries                  1.34
    14 ENet (Network library)           1.1
    1511Lua (scripting language)         5.0 or 5.1
    16 Tcl (shell script language)      8.4 or 8.5
    17 OpenAL (audio)                   (no version requirements specified yet)
    18 ALUT (audio)                     (no version requirements specified yet)
    19 LibOgg                           (no version requirements specified yet)
    20 LibVorbis                        (no version requirements specified yet)
    21 ZLib (compression)               (no version requirements specified yet)
    22 
    23 OGRE supports both OpenGL and DirectX9 rendering. You will also need OGRE for the dedicated server!
    24 
    25 Further information about installing and running this application can be found on
    26 http://www.orxonox.net/wiki/Running
  • sandbox_light/cmake/InstallConfig.cmake

    r5695 r5789  
    4343SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIBRARY_PATH})
    4444SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH})
    45 SET(MODULE_INSTALL_DIRECTORY  ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MODULE_PATH})
    4645SET(DOC_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH})
    4746SET(DATA_INSTALL_DIRECTORY    ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DATA_PATH})
     
    5554    SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox)
    5655    SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static)
    57     SET(MODULE_INSTALL_DIRECTORY  ${CMAKE_INSTALL_PREFIX}/lib/orxonox/modules)
    5856    SET(DOC_INSTALL_DIRECTORY     ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
    5957    SET(DATA_INSTALL_DIRECTORY    ${CMAKE_INSTALL_PREFIX}/share/orxonox)
  • sandbox_light/cmake/LibraryConfig.cmake

    r5782 r5789  
    7373# Performs the search and sets the variables    #
    7474
    75 FIND_PACKAGE(OGRE  1.4       REQUIRED)
    7675##### Lua #####
    7776IF(CEGUILUA_USE_EXTERNAL_LIBRARY)
     
    102101IF(WIN32)
    103102  OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
    104   OPTION(LINK_OGRE_DYNAMIC  "Link OGRE dynamically on Windows" TRUE)
    105103  COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
    106104  IF(_version_comparison LESS 0)
     
    113111    MARK_AS_ADVANCED(
    114112      LINK_BOOST_DYNAMIC
    115       LINK_OGRE_DYNAMIC
    116113      LINK_LUA_DYNAMIC
    117114    )
  • sandbox_light/cmake/LibraryConfigTardis.cmake

    r5782 r5789  
    4545  SET(BOOST_LIBRARYDIR "/usr/pack/boost-1.36.0-sd/i686-debian-linux4.0/lib")
    4646  SET(ENV{LUA_DIR}     "/usr/pack/lua-5.1.4-sd;/usr/pack/lua-5.1.4-sd/i686-debian-linux4.0")
    47   SET(ENV{OGRE_HOME}   "/usr/pack/ogre-1.4.9-sd;/usr/pack/ogre-1.4.9-sd/i686-debian-linux4.0")
    4847ENDIF(TARDIS)
  • sandbox_light/cmake/PackageConfig.cmake

    r5782 r5789  
    5959SET(ENV{BOOST_ROOT}            ${DEP_INCLUDE_DIR}/boost)
    6060SET(ENV{LUA_DIR}               ${DEP_INCLUDE_DIR}/lua)
    61 SET(ENV{OGRE_HOME}             ${DEP_INCLUDE_DIR}/ogre)
    6261
    6362### INSTALL ###
  • sandbox_light/cmake/TargetUtilities.cmake

    r5695 r5789  
    188188  IF(_arg_VERSION)
    189189    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${_arg_VERSION})
    190   ELSEIF(NOT _arg_ORXONOX_EXTERNAL)
    191     SET_TARGET_PROPERTIES(${_target_name} PROPERTIES VERSION ${ORXONOX_VERSION})
    192190  ENDIF()
    193191
  • sandbox_light/data/CMakeLists.txt

    r5782 r5789  
    2121 #    Reto Grieder
    2222 #  Description:
    23  #    Finds the external data directory and configures the data installation.
    24  #    Default search paths are: ../../data and ../data_extern
     23 #    Connfigures the data installation.
    2524 #
    2625
  • sandbox_light/src/CMakeLists.txt

    r5782 r5789  
    3939ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
    4040ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL"   WIN32 LINK_LUA_DYNAMIC)
    41 # If no defines are specified, these libs get linked dynamically
    42 ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB"    WIN32 NOT LINK_OGRE_DYNAMIC)
    4341
    4442############## Include Directories ##############
     
    4745INCLUDE_DIRECTORIES(
    4846  # External
    49   ${OGRE_INCLUDE_DIR}
    5047  ${Boost_INCLUDE_DIRS}
    5148  ${LUA_INCLUDE_DIR}
     
    7471ADD_SUBDIRECTORY(libraries)
    7572ADD_SUBDIRECTORY(orxonox)
    76 ADD_SUBDIRECTORY(modules)
    7773
    7874################ Executable ################
  • sandbox_light/src/OrxonoxConfig.h.in

    r5695 r5789  
    108108
    109109/*---------------------------------
    110  * Version information
    111  *-------------------------------*/
    112 #define ORXONOX_VERSION_MAJOR @ORXONOX_VERSION_MAJOR@
    113 #define ORXONOX_VERSION_MINOR @ORXONOX_VERSION_MINOR@
    114 #define ORXONOX_VERSION_PATCH @ORXONOX_VERSION_PATCH@
    115 #define ORXONOX_VERSION_NAME "@ORXONOX_VERSION_NAME@"
    116 
    117 //! Defines version info encoded as 0xMMIIPP (M: Major version, I: Minor version, P: Patch version, all as hex)
    118 #define ORXONOX_VERSION \
    119     ((ORXONOX_VERSION_MAJOR << 16) | (ORXONOX_VERSION_MINOR << 8) | ORXONOX_VERSION_PATCH)
    120 
    121 
    122 /*---------------------------------
    123  * Unix settings
    124  *-------------------------------*/
    125 #ifdef ORXONOX_PLATFORM_UNIX
    126 
    127 // TODO: Check what this actually is and whether we need it or not
    128 #if 0
    129 #  ifdef ORXONOX_PLATFORM_APPLE
    130 #    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
    131 #  else // ORXONOX_PLATFORM_LINUX
    132 #    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
    133 #  endif
    134 #endif
    135 
    136 #endif /* Patform Unix */
    137 
    138 
    139 /*---------------------------------
    140  * Apple Settings
    141  *-------------------------------*/
    142 
    143 
    144 /*---------------------------------
    145110 * Options
    146111 *-------------------------------*/
  • sandbox_light/src/SpecialConfig.h.in

    r5782 r5789  
    7070    const char defaultLibraryPath[] = "@DEFAULT_LIBRARY_PATH@";
    7171    const char defaultArchivePath[] = "@DEFAULT_ARCHIVE_PATH@";
    72     const char defaultModulePath[]  = "@DEFAULT_MODULE_PATH@";
    7372    const char defaultDocPath[]     = "@DEFAULT_DOC_PATH@";
    7473    const char defaultDataPath[]    = "@DEFAULT_DATA_PATH@";
     
    7978    // INSTALLATION PATHS
    8079    const char dataInstallDirectory[]       = "@DATA_INSTALL_DIRECTORY@";
    81     const char moduleInstallDirectory[]     = "@MODULE_INSTALL_DIRECTORY@";
    8280#endif
    8381
     
    8583    const char dataDevDirectory[]           = "@DATA_DIRECTORY@";
    8684#ifdef CMAKE_CONFIGURATION_TYPES
    87     const char moduleDevDirectory[]         = "@CMAKE_MODULE_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
    8885    const char configDevDirectory[]         = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
    8986    const char logDevDirectory[]            = "@CMAKE_LOG_OUTPUT_DIRECTORY@/"    BOOST_PP_STRINGIZE(CMAKE_BUILD_TYPE);
    9087#else
    91     const char moduleDevDirectory[]         = "@CMAKE_MODULE_OUTPUT_DIRECTORY@";
    9288    const char configDevDirectory[]         = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@";
    9389    const char logDevDirectory[]            = "@CMAKE_LOG_OUTPUT_DIRECTORY@";
     
    9793    const char dependencyLibraryDirectory[] = "@DEP_LIBRARY_DIR@";
    9894#endif
    99 
    100     // Module extension
    101     const char moduleExtension[] = "@ORXONOX_MODULE_EXTENSION@";
    10295} }
    10396
  • sandbox_light/src/external/CMakeLists.txt

    r5782 r5789  
    2020################ Sub Directories ################
    2121
     22ADD_SUBDIRECTORY(ogremath)
    2223ADD_SUBDIRECTORY(tolua)
  • sandbox_light/src/libraries/core/CMakeLists.txt

    r5782 r5789  
    2020SET_SOURCE_FILES(CORE_SRC_FILES
    2121  Clock.cc
    22   ConfigFileManager.cc
    23   ConfigValueContainer.cc
     22  CommandLine.cc
    2423  Core.cc
    25   DynLib.cc
    26   DynLibManager.cc
    27   Game.cc
    28   GameState.cc
    29   Language.cc
    3024  LuaState.cc
    31   ObjectListBase.cc
    32   OrxonoxClass.cc
    33 
    34   # command
    35   CommandLine.cc
    36   Executor.cc
    37 
    38   # hierarchy
    39   Factory.cc
    40   Identifier.cc
    41   MetaObjectList.cc
    42 
    43   # level
    44   BaseObject.cc
    45 
    46   # multithreading
    47   Thread.cc
    48   ThreadPool.cc
    4925)
    5026
     
    5531  DEFINE_SYMBOL
    5632    "CORE_SHARED_BUILD"
    57   PCH_FILE
    58     CorePrecompiledHeaders.h
    5933  LINK_LIBRARIES
    60     ${OGRE_LIBRARY}
    6134    ${Boost_FILESYSTEM_LIBRARY}
    6235    ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
    63     ${Boost_THREAD_LIBRARY}
    64     ${Boost_DATE_TIME_LIBRARY} # Thread dependency
    6536    ${LUA_LIBRARIES}
     37    ogremath_orxonox
    6638    tolua++_orxonox
    6739    util
  • sandbox_light/src/libraries/core/Clock.cc

    r5738 r5789  
    3333
    3434#include "Clock.h"
    35 #include <OgreTimer.h>
     35#include <ogremath/OgreTimer.h>
    3636
    3737namespace orxonox
  • sandbox_light/src/libraries/core/CommandLine.cc

    r5738 r5789  
    3131#include <algorithm>
    3232#include <sstream>
    33 #include <boost/filesystem.hpp>
    3433
    3534#include "util/Convert.h"
     
    348347    {
    349348        std::string filename = CommandLine::getValue("optionsFile").getString();
    350         boost::filesystem::path filepath(Core::getConfigPath() / filename);
    351349
    352350        // look for additional arguments in given file or start.ini as default
    353351        // They will not overwrite the arguments given directly
    354352        std::ifstream file;
    355         file.open(filepath.string().c_str());
     353        file.open((Core::getConfigPathString() + filename).c_str());
    356354        std::vector<std::string> args;
    357355        if (file)
  • sandbox_light/src/libraries/core/Core.cc

    r5782 r5789  
    6464#include "Clock.h"
    6565#include "CommandLine.h"
    66 #include "ConfigFileManager.h"
    67 #include "ConfigValueIncludes.h"
    68 #include "CoreIncludes.h"
    69 #include "DynLibManager.h"
    70 #include "Factory.h"
    71 #include "Identifier.h"
    72 #include "Language.h"
    7366#include "LuaState.h"
    7467
     
    8578    Core* Core::singletonPtr_s  = 0;
    8679
    87     SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");
    8880    SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
    8981    SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
     
    9890        destruction in the Core destructor.
    9991    */
    100     class CoreConfiguration : public OrxonoxClass
     92    class CoreConfiguration
    10193    {
    10294    public:
     
    10698
    10799        void initialise()
    108         {
    109             RegisterRootObject(CoreConfiguration);
    110             this->setConfigValues();
    111         }
    112 
    113         /**
    114             @brief Function to collect the SetConfigValue-macro calls.
    115         */
    116         void setConfigValues()
    117100        {
    118101#ifdef NDEBUG
     
    125108            const unsigned int defaultLevelShell   = 3;
    126109#endif
    127             SetConfigValue(softDebugLevelConsole_, defaultLevelConsole)
    128                 .description("The maximal level of debug output shown in the console")
    129                 .callback(this, &CoreConfiguration::debugLevelChanged);
    130             SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile)
    131                 .description("The maximal level of debug output shown in the logfile")
    132                 .callback(this, &CoreConfiguration::debugLevelChanged);
    133             SetConfigValue(softDebugLevelShell_, defaultLevelShell)
    134                 .description("The maximal level of debug output shown in the ingame shell")
    135                 .callback(this, &CoreConfiguration::debugLevelChanged);
    136 
    137             SetConfigValue(language_, Language::getInstance().defaultLanguage_)
    138                 .description("The language of the ingame text")
    139                 .callback(this, &CoreConfiguration::languageChanged);
    140             SetConfigValue(bInitializeRandomNumberGenerator_, true)
    141                 .description("If true, all random actions are different each time you start the game")
    142                 .callback(this, &CoreConfiguration::initializeRandomNumberGenerator);
     110            softDebugLevelConsole_ = defaultLevelConsole;
     111            softDebugLevelLogfile_ = defaultLevelLogfile;
     112            softDebugLevelShell_   = defaultLevelShell;
     113            this->debugLevelChanged();
     114
     115            bInitializeRandomNumberGenerator_ = true;
     116            this->initializeRandomNumberGenerator();
    143117        }
    144118
     
    159133            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);
    160134            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell,   this->softDebugLevelShell_);
    161         }
    162 
    163         /**
    164             @brief Callback function if the language has changed.
    165         */
    166         void languageChanged()
    167         {
    168             // Read the translation file after the language was configured
    169             Language::getInstance().readTranslatedLanguageFile();
    170         }
    171 
    172         /**
    173             @brief Sets the language in the config-file back to the default.
    174         */
    175         void resetLanguage()
    176         {
    177             ResetConfigValue(language_);
    178135        }
    179136
     
    193150        int softDebugLevelLogfile_;                     //!< The debug level for the logfile
    194151        int softDebugLevelShell_;                       //!< The debug level for the ingame shell
    195         std::string language_;                          //!< The language
    196152        bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
    197153
     
    199155        boost::filesystem::path rootPath_;
    200156        boost::filesystem::path executablePath_;        //!< Path to the executable
    201         boost::filesystem::path modulePath_;            //!< Path to the modules
    202157        boost::filesystem::path dataPath_;              //!< Path to the data file folder
    203158        boost::filesystem::path configPath_;            //!< Path to the config file folder
     
    208163    Core::Core(const std::string& cmdLine)
    209164        // Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
    210         : identifierDestroyer_(Identifier::destroyAllIdentifiers)
    211         , configuration_(new CoreConfiguration()) // Don't yet create config values!
     165        : configuration_(new CoreConfiguration()) // Don't yet create config values!
    212166        , bDevRun_(false)
    213167    {
    214168        // Set the hard coded fixed paths
    215169        this->setFixedPaths();
    216 
    217         // Create a new dynamic library manager
    218         this->dynLibManager_.reset(new DynLibManager());
    219 
    220         // Load modules
    221         try
    222         {
    223             // We search for helper files with the following extension
    224             std::string moduleextension = specialConfig::moduleExtension;
    225             size_t moduleextensionlength = moduleextension.size();
    226 
    227             // Search in the directory of our executable
    228             boost::filesystem::path searchpath = this->configuration_->modulePath_;
    229 
    230             // Add that path to the PATH variable in case a module depends on another one
    231             std::string pathVariable = getenv("PATH");
    232             putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + configuration_->modulePath_.string()).c_str()));
    233 
    234             boost::filesystem::directory_iterator file(searchpath);
    235             boost::filesystem::directory_iterator end;
    236 
    237             // Iterate through all files
    238             while (file != end)
    239             {
    240                 std::string filename = file->BOOST_LEAF_FUNCTION();
    241 
    242                 // Check if the file ends with the exension in question
    243                 if (filename.size() > moduleextensionlength)
    244                 {
    245                     if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
    246                     {
    247                         // We've found a helper file - now load the library with the same name
    248                         std::string library = filename.substr(0, filename.size() - moduleextensionlength);
    249                         boost::filesystem::path librarypath = searchpath / library;
    250 
    251                         try
    252                         {
    253                             DynLibManager::getInstance().load(librarypath.string());
    254                         }
    255                         catch (...)
    256                         {
    257                             COUT(1) << "Couldn't load module \"" << librarypath.string() << "\": " << Exception::handleMessage() << std::endl;
    258                         }
    259                     }
    260                 }
    261 
    262                 ++file;
    263             }
    264         }
    265         catch (...)
    266         {
    267             COUT(1) << "An error occurred while loading modules: " << Exception::handleMessage() << std::endl;
    268         }
    269170
    270171        // Parse command line arguments AFTER the modules have been loaded (static code!)
     
    293194            setThreadAffinity(static_cast<unsigned int>(limitToCPU));
    294195#endif
    295 
    296         // Manage ini files and set the default settings file (usually orxonox.ini)
    297         this->configFileManager_.reset(new ConfigFileManager());
    298         this->configFileManager_->setFilename(ConfigFileType::Settings,
    299             CommandLine::getValue("settingsFile").getString());
    300 
    301         // Required as well for the config values
    302         this->languageInstance_.reset(new Language());
    303 
    304         // creates the class hierarchy for all classes with factories
    305         Factory::createClassHierarchy();
    306196
    307197        // Do this soon after the ConfigFileManager has been created to open up the
     
    360250    }
    361251
    362     /**
    363         @brief Returns the configured language.
    364     */
    365     /*static*/ const std::string& Core::getLanguage()
    366     {
    367         return Core::getInstance().configuration_->language_;
    368     }
    369 
    370     /**
    371         @brief Sets the language in the config-file back to the default.
    372     */
    373     /*static*/ void Core::resetLanguage()
    374     {
    375         Core::getInstance().configuration_->resetLanguage();
    376     }
    377 
    378252    /*static*/ const boost::filesystem::path& Core::getDataPath()
    379253    {
     
    524398            COUT(1) << "Running from the build tree." << std::endl;
    525399            Core::bDevRun_ = true;
    526             configuration_->modulePath_ = specialConfig::moduleDevDirectory;
    527400        }
    528401        else
     
    539412            if (configuration_->rootPath_.empty())
    540413                ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
    541 
    542             // Module path is fixed as well
    543             configuration_->modulePath_ = configuration_->rootPath_ / specialConfig::defaultModulePath;
    544 
    545 #else
    546 
    547             // There is no root path, so don't set it at all
    548             // Module path is fixed as well
    549             configuration_->modulePath_ = specialConfig::moduleInstallDirectory;
    550414
    551415#endif
     
    626490        }
    627491    }
    628 
    629     void Core::preUpdate(const Clock& time)
    630     {
    631     }
    632 
    633     void Core::postUpdate(const Clock& time)
    634     {
    635     }
    636492}
  • sandbox_light/src/libraries/core/Core.h

    r5782 r5789  
    6565        typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;
    6666        friend class Singleton<Core>;
    67         friend class Game;
    6867
    6968        public:
     
    8281            static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
    8382            static void  setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
    84             static const std::string& getLanguage();
    85             static void  resetLanguage();
    8683
    8784            //! Returns the path to the data files as boost::filesystem::path
     
    107104            Core(const Core&); //!< Don't use (undefined symbol)
    108105
    109             void preUpdate(const Clock& time);
    110             void postUpdate(const Clock& time);
    111 
    112106            void setFixedPaths();
    113107            void setConfigurablePaths();
     
    115109
    116110            // Mind the order for the destruction!
    117             scoped_ptr<DynLibManager>     dynLibManager_;
    118111            scoped_ptr<SignalHandler>     signalHandler_;
    119             SimpleScopeGuard              identifierDestroyer_;
    120             scoped_ptr<ConfigFileManager> configFileManager_;
    121             scoped_ptr<Language>          languageInstance_;
    122112            scoped_ptr<CoreConfiguration> configuration_;
    123113
  • sandbox_light/src/libraries/util/CMakeLists.txt

    r5782 r5789  
    1919
    2020SET_SOURCE_FILES(UTIL_SRC_FILES
    21   CRC32.cc
    2221  Exception.cc
    23   ExprParser.cc
    2422  Math.cc
    2523  MultiType.cc
    2624  OutputBuffer.cc
    2725  OutputHandler.cc
    28   Scope.cc
    2926  SignalHandler.cc
    3027  Sleep.cc
     
    4340    "UTIL_SHARED_BUILD"
    4441  LINK_LIBRARIES
    45     ${CEGUI_LIBRARY}
    46     ${OGRE_LIBRARY}
     42    ogremath_orxonox
    4743  SOURCE_FILES
    4844    ${UTIL_SRC_FILES}
  • sandbox_light/src/libraries/util/Math.cc

    r5738 r5789  
    3434#include "Math.h"
    3535
    36 #include <OgrePlane.h>
    37 
    3836#include "MathConvert.h"
    3937#include "SubString.h"
    40 // Do not remove this include, it avoids linker errors.
    41 #include "mbool.h"
    4238
    4339namespace orxonox
     
    8177        degree = temp;
    8278        return in;
    83     }
    84 
    85 
    86     /**
    87         @brief Gets the angle between my viewing direction and the direction to the position of the other object.
    88         @param myposition My position
    89         @param mydirection My viewing direction
    90         @param otherposition The position of the other object
    91         @return The angle
    92 
    93         @example
    94         If the other object is exactly in front of me, the function returns 0.
    95         If the other object is exactly behind me, the function returns pi.
    96         If the other object is exactly right/left to me (or above/below), the function returns pi/2.
    97     */
    98     float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition)
    99     {
    100         orxonox::Vector3 distance = otherposition - myposition;
    101         float distancelength = distance.length();
    102         if (distancelength == 0)
    103             return 0;
    104         else
    105             return acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1));
    106     }
    107 
    108     /**
    109         @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object.
    110         @param myposition My position
    111         @param mydirection My viewing direction
    112         @param myorthonormal My orthonormalvector (pointing upwards through my head)
    113         @param otherposition The position of the other object
    114         @return The viewing direction
    115 
    116         @example
    117         If the other object is exactly in front of me, the function returns Vector2(0, 0).
    118         If the other object is exactly at my left, the function returns Vector2(-1, 0).
    119         If the other object is exactly at my right, the function returns Vector2(1, 0).
    120         If the other object is only a bit at my right, the function still returns Vector2(1, 0).
    121         If the other object is exactly above me, the function returns Vector2(0, 1).
    122     */
    123     orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
    124     {
    125         orxonox::Vector3 distance = otherposition - myposition;
    126 
    127         // project difference vector on our plane
    128         orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
    129 
    130         float projectionlength = projection.length();
    131         if (projectionlength == 0)
    132         {
    133             if (myposition.dotProduct(otherposition) >= 0)
    134                 return orxonox::Vector2(0, 0);
    135             else
    136                 return orxonox::Vector2(0, 1);
    137         }
    138        
    139         float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
    140         float sin_value = sqrt( 1 - cos_value*cos_value );
    141        
    142         if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
    143             return orxonox::Vector2( sin_value, cos_value );
    144         else
    145             return orxonox::Vector2( -sin_value, cos_value );
    146     }
    147 
    148     /**
    149         @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
    150         @param myposition My position
    151         @param mydirection My viewing direction
    152         @param myorthonormal My orthonormalvector (pointing upwards through my head)
    153         @param otherposition The position of the other object
    154         @return The viewing direction
    155 
    156         @example
    157         If the other object is exactly in front of me, the function returns Vector2(0, 0).
    158         If the other object is exactly at my left, the function returns Vector2(-0.5, 0).
    159         If the other object is exactly at my right, the function returns Vector2(0.5, 0).
    160         If the other object is only a bit at my right, the function still returns Vector2(0.01, 0).
    161         If the other object is exactly above me, the function returns Vector2(0, 0.5).
    162     */
    163     orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
    164     {
    165         orxonox::Vector3 distance = otherposition - myposition;
    166 
    167         // project difference vector on our plane
    168         orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
    169 
    170         float projectionlength = projection.length();
    171         if (projectionlength == 0)
    172         {
    173             if (myposition.dotProduct(otherposition) >= 0)
    174                 return orxonox::Vector2(0, 0);
    175             else
    176                 return orxonox::Vector2(0, 1);
    177         }
    178         //float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
    179        
    180         float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
    181         float sin_value = sqrt( 1 - cos_value*cos_value );
    182 
    183         float distancelength = distance.length();
    184         if (distancelength == 0) return orxonox::Vector2(0, 0);
    185         float radius = acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1)) / Ogre::Math::PI;
    186 
    187         if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
    188             return orxonox::Vector2( sin_value * radius, cos_value * radius);
    189         else
    190             return orxonox::Vector2( -sin_value * radius, cos_value * radius);
    191     }
    192 
    193     /**
    194         @brief Returns the predicted position I have to aim at, if I want to hit a moving target with a moving projectile.
    195         @param myposition My position
    196         @param projectilespeed The speed of my projectile
    197         @param targetposition The position of my target
    198         @param targetvelocity The velocity of my target
    199         @return The predicted position
    200 
    201         The function predicts the position based on a linear velocity of the target. If the target changes speed or direction, the projectile will miss.
    202     */
    203     orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity)
    204     {
    205         float squaredProjectilespeed = projectilespeed * projectilespeed;
    206         orxonox::Vector3 distance = targetposition - myposition;
    207         float a = distance.squaredLength();
    208         float b = 2 * (distance.x + distance.y + distance.z) * (targetvelocity.x + targetvelocity.y + targetvelocity.z);
    209         float c = targetvelocity.squaredLength();
    210 
    211         float temp = 4*squaredProjectilespeed*c + a*a - 4*b*c;
    212         if (temp < 0)
    213             return orxonox::Vector3::ZERO;
    214 
    215         temp = sqrt(temp);
    216         float time = (temp + a) / (2 * (squaredProjectilespeed - b));
    217         return (targetposition + targetvelocity * time);
    21879    }
    21980
  • sandbox_light/src/libraries/util/Math.h

    r5738 r5789  
    4040#include <cmath>
    4141
    42 #include <OgreMath.h>
    43 #include <OgreVector2.h>
    44 #include <OgreVector3.h>
    45 #include <OgreVector4.h>
    46 #include <OgreQuaternion.h>
    47 #include <OgreColourValue.h>
     42#include <ogremath/OgreMath.h>
     43#include <ogremath/OgreVector2.h>
     44#include <ogremath/OgreVector3.h>
     45#include <ogremath/OgreVector4.h>
     46#include <ogremath/OgreQuaternion.h>
     47#include <ogremath/OgreColourValue.h>
    4848
    4949// Certain headers might define unwanted macros...
     
    6363    _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree);
    6464    _UtilExport std::istream& operator>>(std::istream& in, orxonox::Degree& degree);
    65 
    66     _UtilExport float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition);
    67     _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
    68     _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
    69     _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
    7065
    7166    /**
  • sandbox_light/src/libraries/util/MultiType.h

    r5738 r5789  
    7171#include <cassert>
    7272#include <string>
    73 #include <OgreVector2.h>
    74 #include <OgreVector3.h>
    75 #include <OgreVector4.h>
    76 #include <OgreQuaternion.h>
    77 #include <OgreColourValue.h>
     73#include <ogremath/OgreVector2.h>
     74#include <ogremath/OgreVector3.h>
     75#include <ogremath/OgreVector4.h>
     76#include <ogremath/OgreQuaternion.h>
     77#include <ogremath/OgreColourValue.h>
    7878
    7979#include "TypeTraits.h"
  • sandbox_light/src/orxonox/CMakeLists.txt

    r5782 r5789  
    2626SET_SOURCE_FILES(ORXONOX_SRC_FILES
    2727  Main.cc
    28   GSRoot.cc
    2928)
    3029
    3130ORXONOX_ADD_LIBRARY(orxonox
    3231  FIND_HEADER_FILES
     32  TOLUA_FILES
     33    Main.h
    3334  DEFINE_SYMBOL
    3435    "ORXONOX_SHARED_BUILD"
  • sandbox_light/src/orxonox/Main.cc

    r5782 r5789  
    3535
    3636#include "OrxonoxPrereqs.h"
    37 #include "SpecialConfig.h"
    3837
    39 #include "util/Exception.h"
    4038#include "core/CommandLine.h"
    41 #include "core/Game.h"
     39#include "core/Core.h"
     40#include "core/Clock.h"
    4241#include "core/LuaState.h"
     42#include "ToluaBindOrxonox.h"
    4343#include "Main.h"
     44
     45DeclareToluaInterface(Orxonox);
    4446
    4547namespace orxonox
    4648{
     49    void sandbox()
     50    {
     51    }
     52
    4753    /**
    4854    @brief
     
    5157    int main(const std::string& strCmdLine)
    5258    {
    53         Game* game = new Game(strCmdLine);
     59        // Create the Core
     60        Core* core = new Core(strCmdLine);
     61        // Set up a basic clock to keep time
     62        Clock* clock = new Clock();
    5463
    55         game->setStateHierarchy(
    56         "root"
    57         );
     64        sandbox();
    5865
    59         game->requestState("root");
    60 
    61         game->run();
    62         delete game;
    63 
     66        delete clock;
     67        delete core;
    6468        return 0;
    6569    }
Note: See TracChangeset for help on using the changeset viewer.