Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1211


Ignore:
Timestamp:
May 1, 2008, 6:09:05 PM (16 years ago)
Author:
scheusso
Message:

merged trunk changes from 1101 to 1202 into camera branch

Location:
code/branches/camera
Files:
4 deleted
14 edited
7 copied

Legend:

Unmodified
Added
Removed
  • code/branches/camera/CMakeLists.txt

    r1101 r1211  
    3232
    3333#set binary output directories
    34 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
    35 SET(LIBRARY_OUTPUT_PATH    ${PROJECT_BINARY_DIR}/bin/lib)
     34SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
     35SET(LIBRARY_OUTPUT_PATH    ${PROJECT_SOURCE_DIR}/bin/lib)
    3636
    3737# global compiler/linker flags. force -O2!
     
    4343SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
    4444
    45 #Create verbose makefile output when compiling
    46 SET(CMAKE_VERBOSE_MAKEFILE TRUE)
     45#use 'cmake -D make_verb:1 path' to get verbose make output when compiling
     46IF (MAKE_VERB)
     47 SET(CMAKE_VERBOSE_MAKEFILE TRUE)
     48ENDIF (MAKE_VERB)
    4749
    4850
     
    7981  ${ENet_INCLUDE_DIR}
    8082  ${Boost_INCLUDE_DIRS}
    81   ${OPENAL_INCLUDE_DIR} ${ALUT_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR} ${OGG_INCLUDE_DIR}
     83  ${OPENAL_INCLUDE_DIR}
     84  ${ALUT_INCLUDE_DIR}
     85  ${VORBIS_INCLUDE_DIR}
     86  ${OGG_INCLUDE_DIR}
    8287  ${Lua_INCLUDE_DIR}
    8388)
    84 
    85 
    86 ################ Source files ###################
    87 
    88 #if on a windows box, you have to generate the tolua bind files yourself
    89 IF(NOT WIN32)
    90 
    91   #At first, build lua
    92   MESSAGE(STATUS "\n******************* Building tolua... ******************\n\n")
    93   EXECUTE_PROCESS(COMMAND ./tolua-build)
    94   MESSAGE(STATUS "\n\n******************* Building tolua done ****************\n")
    95 
    96   #generate lua bind source files
    97   EXECUTE_PROCESS(COMMAND bin/./tolua-exec-script)
    98 
    99 ENDIF(NOT WIN32)
    10089
    10190#add main source dir
  • code/branches/camera/cmake/FindLua.cmake

    r1076 r1211  
    1 # Find Lua includes and library
     1#  Find Lua header and library files
    22#
    3 # This module defines
    4 #  Lua_INCLUDE_DIR
    5 #  Lua_LIBRARIES, the libraries to link against to use Lua.
    6 #  Lua_LIB_DIR, the location of the libraries
    7 #  Lua_FOUND, If false, do not try to use Lua
     3#  When called, this script tries to define:
     4#  Lua_INCLUDE_DIR    Header files directory
     5#  Lua_LIBRARIES      library files (or file when using lua 5.1)
     6#  Lua_FOUND          defined (true) if lua was found
     7#  Lua_VERSION        either 5.1 or 5.0 or undefined
    88#
    9 # Copyright © 2007, Matt Williams
    10 #
    11 # Redistribution and use is allowed according to the terms of the BSD license.
     9#  authors: Benjamin Knecht, Reto Grieder
    1210
    13 MESSAGE(STATUS "lua libs in cache: ${Lua_LIBRARIES}")
    1411IF (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
    15     SET(Lua_FIND_QUIETLY TRUE) # Already in cache, be silent
     12
     13  # Already in cache, be silent
     14  SET(Lua_FOUND TRUE)
     15  SET(Lua_FIND_QUIETLY TRUE)
     16  MESSAGE(STATUS "Lua was found.")
     17
     18ELSE (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
     19
     20  FIND_PATH(Lua_INCLUDE_DIR_51 lua.h
     21    /usr/include/lua5.1
     22    /usr/local/include/lua5.1
     23    ../libs/lua-5.1.3/src)
     24
     25  FIND_PATH(Lua_INCLUDE_DIR_50 lua.h
     26    /usr/include/lua50
     27    /usr/local/include/lua50
     28    /usr/pack/lua-5.0.3-sd/include)
     29
     30  FIND_LIBRARY(Lua_LIBRARY_51 NAMES lua5.1 lua PATHS
     31    /usr/lib
     32    /usr/local/lib
     33    ../libs/lua-5.1.3/lib)
     34
     35  FIND_LIBRARY(Lua_LIBRARY_1_50 NAMES lua50 lua PATHS
     36        /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis
     37    /usr/lib
     38    /usr/local/lib)
     39
     40  FIND_LIBRARY(Lua_LIBRARY_2_50 NAMES lualib50 lualib PATHS
     41        /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis
     42    /usr/lib
     43    /usr/local/lib)
     44
     45
     46  IF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
     47
     48    # Found newer lua 5.1 libs
     49    SET(Lua_FOUND TRUE)
     50    SET(Lua_VERSION 5.1 CACHE STRING "")
     51    SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_51} CACHE PATH "")
     52    SET(Lua_LIBRARIES ${Lua_LIBRARY_51} CACHE FILEPATH "")
     53
     54  ELSEIF(Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50)
     55
     56    # Found older lua 5.0 libs
     57    SET(Lua_FOUND TRUE)
     58    SET(Lua_VERSION 5.0 CACHE STRING "")
     59    SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_50} CACHE PATH "")
     60    SET(Lua_LIBRARIES ${Lua_LIBRARY_1_50} ${Lua_LIBRARY_2_50} CACHE FILEPATH "")
     61
     62  ENDIF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
     63       
     64
     65  IF (Lua_FOUND)
     66    MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}")
     67  ELSE (Lua_FOUND)
     68    IF (Lua_FIND_REQUIRED)
     69      MESSAGE(FATAL_ERROR "Could not find Lua")
     70    ENDIF (Lua_FIND_REQUIRED)
     71  ENDIF (Lua_FOUND)
     72
    1673ENDIF (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
    1774
    18 FIND_PATH(Lua_INCLUDE_DIR lua.h
    19         /usr/include/lua5.1
    20         /usr/local/include/lua5.1
    21         ../libs/lua-5.1.3/src)
    22 
    23 FIND_LIBRARY(Lua_LIBRARIES lua5.1
    24         /usr/lib
    25         /usr/local/lib
    26         ../libs/lua-5.1.3/lib)
    27 
    28 IF (NOT Lua_INCLUDE_DIR)
    29  FIND_PATH(Lua_INCLUDE_DIR lua.h
    30         /usr/include/lua50
    31         /usr/local/include/lua50
    32         /usr/pack/lua-5.0.3-sd/include)
    33 ENDIF (NOT Lua_INCLUDE_DIR)
    34 
    35 IF (NOT Lua_LIBRARIES)
    36  FIND_LIBRARY(Lua_LIBRARIES lua50
    37         /usr/lib
    38         /usr/local/lib)
    39 
    40  FIND_LIBRARY(Lua_LIBRARY lualib50
    41         /usr/lib
    42         /usr/local/lib)
    43 
    44 #SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})
    45 ENDIF (NOT Lua_LIBRARIES)
    46 
    47 #especially for tardis
    48 IF (NOT Lua_LIBRARIES)
    49  FIND_LIBRARY(Lua_LIBRARIES lua
    50         /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)
    51 
    52  FIND_LIBRARY(Lua_LIBRARY lualib
    53         /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)
    54 
    55 #SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})
    56 ENDIF (NOT Lua_LIBRARIES)
    57 
    58 IF (Lua_INCLUDE_DIR AND Lua_LIBRARIES)
    59     SET(Lua_FOUND TRUE)
    60 ENDIF (Lua_INCLUDE_DIR AND Lua_LIBRARIES)
    61 
    62 IF (Lua_FOUND)
    63     MESSAGE(STATUS "Found Lua: ${Lua_LIBRARIES}")
    64     MESSAGE(STATUS "Found Lua: ${Lua_LIBRARY}")
    65 ELSE (Lua_FOUND)
    66     IF (Lua_FIND_REQUIRED)
    67         MESSAGE(FATAL_ERROR "Could not find Lua")
    68     ENDIF (Lua_FIND_REQUIRED)
    69 ENDIF (Lua_FOUND)
  • code/branches/camera/src/core/CMakeLists.txt

    r1084 r1211  
    1 #get the created files
    2 AUX_SOURCE_DIRECTORY(tolua TOLUA_BIND_FILES)
    3 
    4 SET( CORE_SRC_FILES
     1SET(CORE_SRC_FILES
    52  OrxonoxClass.cc
    63  BaseObject.cc
     
    2926  Tickable.cc
    3027  Script.cc
    31   ${TOLUA_BIND_FILES}
     28  tolua/tolua_bind.cc
     29#tolua/tolua_bind.h
    3230)
    3331
    34 ADD_LIBRARY( core SHARED ${CORE_SRC_FILES})
     32#SET_SOURCE_FILES_PROPERTIES(tolua/tolua_bind.h
     33#  PROPERTIES
     34#  OBJECT_DEPENDS tolua/tolua_bind.h
     35#  OBJECT_DEPENDS tolua/tolua_bind.cc
     36#  GENERATED true
     37#  HEADER_FILE_ONLY true
     38#)
    3539
    36 TARGET_LINK_LIBRARIES( core
     40GET_TARGET_PROPERTY(TOLUA_EXE tolua LOCATION)
     41ADD_CUSTOM_COMMAND(
     42  OUTPUT tolua/tolua_bind.cc tolua/tolua_bind.h
     43  COMMAND ${TOLUA_EXE} -n core -o ../../src/core/tolua/tolua_bind.cc -H ../../src/core/tolua/tolua_bind.h ../../src/core/tolua/tolua.pkg
     44  DEPENDS tolua
     45  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
     46)
     47
     48ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
     49
     50TARGET_LINK_LIBRARIES(core
     51  ${Lua_LIBRARIES}
     52  ${OIS_LIBRARIES}
     53  ${OGRE_LIBRARIES}
    3754  util
    38   ${Lua_LIBRARIES}
    39   ${Lua_LIBRARY}
    40   ${OIS_LIBRARIES}
    4155)
  • code/branches/camera/src/core/ConfigFileManager.h

    r1064 r1211  
    6363    {
    6464        public:
     65            virtual ~ConfigFileEntry() {};
    6566            virtual void setValue(const std::string& value) = 0;
    6667            virtual std::string getValue() const = 0;
  • code/branches/camera/src/core/Script.cc

    r1102 r1211  
    6060    luaopen_debug(luaState_);
    6161#endif
    62     tolua_orxonox_open(luaState_);
     62    tolua_core_open(luaState_);
    6363    output_ = "";
    6464  }
  • code/branches/camera/src/core/Script.h

    r1201 r1211  
    5757    public:
    5858      inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export
    59       inline ~Script() { Script::singletonRef = NULL; }
     59      inline ~Script() { Script::singletonRef = NULL; };
    6060
    6161    void loadFile(std::string filename, bool luaTags);
  • code/branches/camera/src/orxonox/CMakeLists.txt

    r1201 r1211  
    3131#  objects/weapon/BulletManager.cc
    3232#  objects/weapon/WeaponStation.cc
     33  tolua/tolua_bind.cc
     34#  tolua/tolua_bind.h
    3335)
    3436
     37#SET_SOURCE_FILES_PROPERTIES(tolua/tolua_bind.h
     38#  PROPERTIES
     39#  OBJECT_DEPENDS tolua/tolua_bind.h
     40#  OBJECT_DEPENDS tolua/tolua_bind.cc
     41#  GENERATED true
     42#  HEADER_FILE_ONLY true
     43#)
     44
     45GET_TARGET_PROPERTY(TOLUA_EXE tolua LOCATION)
     46ADD_CUSTOM_COMMAND(
     47  OUTPUT tolua/tolua_bind.cc tolua/tolua_bind.h
     48  COMMAND ${TOLUA_EXE} -n orxonox -o ../../src/orxonox/tolua/tolua_bind.cc -H ../../src/orxonox/tolua/tolua_bind.h ../../src/orxonox/tolua/tolua.pkg
     49  DEPENDS tolua
     50  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
     51)
     52       
    3553ADD_EXECUTABLE( orxonox ${ORXONOX_SRC_FILES} )
    3654
  • code/branches/camera/src/orxonox/Orxonox.cc

    r1092 r1211  
    5454//#include "util/Sleep.h"
    5555#include "util/ArgReader.h"
     56#include "util/ExprParser.h"
    5657
    5758// core
     
    123124      InputBuffer* ib_;
    124125  };
     126
     127  class Calculator
     128  {
     129  public:
     130    static void calculate(const std::string& calculation)
     131    {
     132      ExprParser expr(calculation);
     133      if (expr.getSuccess())
     134      {
     135        if (expr.getResult() == 42.0)
     136          std::cout << "Greetings from the restaurant at the end of the universe." << std::endl;
     137        // FIXME: insert modifier to display in full precision
     138        std::cout << "Result is: " << expr.getResult() << std::endl;
     139        if (expr.getRemains() != "")
     140          std::cout << "Warning: Expression could not be parsed to the end! Remains: '"
     141              << expr.getRemains() << "'" << std::endl;
     142      }
     143      else
     144        std::cout << "Cannot calculate expression: Parse error" << std::endl;
     145    }
     146  };
     147  ConsoleCommandShortcut(Calculator, calculate, AccessLevel::None);
    125148
    126149  /**
     
    299322
    300323    Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
    301     HUD* orxonoxHud;
    302     orxonoxHud = new HUD();
    303     orxonoxHud->setEnergyValue(20);
    304     orxonoxHud->setEnergyDistr(20,20,60);
     324    orxonoxHUD_ = new HUD();
     325    orxonoxHUD_->setEnergyValue(20);
     326    orxonoxHUD_->setEnergyDistr(20,20,60);
    305327    hudOverlay->show();
    306328
     
    410432      return;
    411433    }
     434    Ogre::Root& ogreRoot = Ogre::Root::getSingleton();
     435
    412436
    413437    // Contains the times of recently fired events
     
    429453          {
    430454                  // Pump messages in all registered RenderWindows
     455      // This calls the WindowEventListener objects.
    431456      Ogre::WindowEventUtilities::messagePump();
    432457
     
    452477      // don't forget to call _fireFrameStarted in ogre to make sure
    453478      // everything goes smoothly
    454       Ogre::Root::getSingleton()._fireFrameStarted(evt);
     479      ogreRoot._fireFrameStarted(evt);
    455480
    456481      // server still renders at the moment
    457482      //if (mode_ != SERVER)
    458       Ogre::Root::getSingleton()._updateAllRenderTargets(); // only render in non-server mode
     483      ogreRoot._updateAllRenderTargets(); // only render in non-server mode
    459484
    460485      // get current time
     
    466491
    467492      // again, just to be sure ogre works fine
    468       Ogre::Root::getSingleton()._fireFrameEnded(evt);
     493      ogreRoot._fireFrameEnded(evt);
    469494          }
    470495  }
  • code/branches/camera/src/util/CMakeLists.txt

    r1085 r1211  
    1 AUX_SOURCE_DIRECTORY(tinyxml TINYXML_SRC_FILES)
    2 
    3 SET (UTIL_SRC_FILES
     1SET(UTIL_SRC_FILES
    42  ArgReader.cc
     3  Clipboard.cc
     4  ExprParser.cc
    55  Math.cc
    6   String.cc
    7   Clipboard.cc
    8   SubString.cc
    96  MultiTypePrimitive.cc
    107  MultiTypeString.cc
    118  MultiTypeMath.cc
     9  String.cc
     10  SubString.cc
     11
     12  tinyxml/ticpp.cc
     13  tinyxml/tinystr.cc
     14  tinyxml/tinyxml.cc
     15  tinyxml/tinyxmlerror.cc
     16  tinyxml/tinyxmlparser.cc
     17
    1218  tolua/tolua_event.c
    1319  tolua/tolua_is.c
     
    1521  tolua/tolua_push.c
    1622  tolua/tolua_to.c
    17   ${TINYXML_SRC_FILES}
    1823)
    1924
    20 ADD_LIBRARY( util SHARED ${UTIL_SRC_FILES} )
     25ADD_LIBRARY(util SHARED ${UTIL_SRC_FILES})
    2126
    2227IF(TESTING_ENABLED)
     
    2429ENDIF(TESTING_ENABLED)
    2530
    26 TARGET_LINK_LIBRARIES( util
     31TARGET_LINK_LIBRARIES(util
    2732  ${OGRE_LIBRARIES}
    2833  ${Lua_LIBRARIES}
    29   ${Lua_LIBRARY}
    3034)
    3135
     36ADD_SUBDIRECTORY(tolua)
     37
  • code/branches/camera/src/util/String.cc

    r1064 r1211  
    274274    if (str.size() == 0)
    275275        return str;
     276    else if (str.size() == 1)
     277    {
     278      //TODO: decide whether we need the commented code
     279      /*if (str[0] != '\\')
     280        return "";
     281      else*/
     282      return str;
     283    }
    276284
    277285    std::string output = "";
  • code/branches/camera/src/util/tolua/CMakeLists.txt

    r1076 r1211  
    1 PROJECT(ToLua)
    2 
    3 #This sets where to look for modules (e.g. "Find*.cmake" files)
    4 SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/)
    5 
    6 #Check whether we are on a tardis box
    7 INCLUDE(CheckTardis)
    8 
    9 ########## Compiler/Linker options ##############
    10 
    11 # if on tardis change compiler and reset boost include directory
    12 IF(IS_TARDIS)
    13   MESSAGE("System is a TARDIS: Setting Compiler to g++-4.1.1")
    14   # force-set the compiler on tardis machines, as default points to g++-3.3
    15   SET(CMAKE_CXX_COMPILER "g++-4.1.1")
    16 ENDIF(IS_TARDIS)
    17 
    18 #set binary output directories
    19 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/../../../bin)
    20 SET(LIBRARY_OUTPUT_PATH    ${PROJECT_BINARY_DIR}/../../../bin)
    21 
    22 # global compiler/linker flags. force -O2!
    23 SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O2 -Wall -g -ggdb")
    24 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O2 -Wall -g -ggdb")
    25 SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
    26 SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined")
    27 SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
    28 SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
    29 
    30 #Create verbose makefile output when compiling
    31 SET(CMAKE_VERBOSE_MAKEFILE TRUE)
    32 
    33 
    34 ############### Library finding #################
    35 
    36 #Performs the search and sets the variables
    37 FIND_PACKAGE(Lua)
    38 
    39 #Set the search paths for the linking
    40 LINK_DIRECTORIES(
    41 )
    42 
    43 #Set the search paths for include files
    44 INCLUDE_DIRECTORIES(
    45   ${Lua_INCLUDE_DIR}
    46 )
    47 
    48 
    49 ################ Source files ###################
    50 
    51 SET (TOLUA_SRC_FILES
     1SET(TOLUA_SRC_FILES
    522  tolua.c
    533  tolua_event.c
     
    599)
    6010
    61 ADD_EXECUTABLE( tolua ${TOLUA_SRC_FILES} )
     11ADD_EXECUTABLE(tolua ${TOLUA_SRC_FILES})
    6212
    63 TARGET_LINK_LIBRARIES( tolua
     13TARGET_LINK_LIBRARIES(tolua
    6414  ${Lua_LIBRARIES}
    65   ${Lua_LIBRARY}
    6615  m
    6716)
     17
  • code/branches/camera/visual_studio/vc8/core.vcproj

    r1084 r1211  
    258258                                        RelativePath="..\..\src\core\tolua\tolua_bind.cc"
    259259                                        >
    260                                         <FileConfiguration
    261                                                 Name="Debug|Win32"
    262                                                 >
    263                                                 <Tool
    264                                                         Name="VCCLCompilerTool"
    265                                                 />
    266                                         </FileConfiguration>
    267260                                </File>
    268261                        </Filter>
  • code/branches/camera/visual_studio/vc8/orxonox.vcproj

    r1035 r1211  
    384384                                </File>
    385385                        </Filter>
     386                        <Filter
     387                                Name="tolua"
     388                                >
     389                                <File
     390                                        RelativePath="..\..\src\orxonox\tolua\tolua_bind.cc"
     391                                        >
     392                                        <FileConfiguration
     393                                                Name="Debug|Win32"
     394                                                >
     395                                                <Tool
     396                                                        Name="VCCLCompilerTool"
     397                                                        UsePrecompiledHeader="0"
     398                                                />
     399                                        </FileConfiguration>
     400                                </File>
     401                        </Filter>
    386402                </Filter>
    387403                <Filter
     
    511527                                <File
    512528                                        RelativePath="..\..\src\orxonox\tools\Timer.h"
     529                                        >
     530                                </File>
     531                        </Filter>
     532                        <Filter
     533                                Name="tolua"
     534                                >
     535                                <File
     536                                        RelativePath="..\..\src\orxonox\tolua\tolua_bind.h"
    513537                                        >
    514538                                </File>
  • code/branches/camera/visual_studio/vc8/util.vcproj

    r1064 r1211  
    157157                        </File>
    158158                        <File
     159                                RelativePath="..\..\src\util\ExprParser.cc"
     160                                >
     161                        </File>
     162                        <File
    159163                                RelativePath="..\..\src\util\Math.cc"
    160164                                >
     
    199203                        </File>
    200204                        <File
     205                                RelativePath="..\..\src\util\ExprParser.h"
     206                                >
     207                        </File>
     208                        <File
    201209                                RelativePath="..\..\src\util\Math.h"
    202210                                >
Note: See TracChangeset for help on using the changeset viewer.