Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3655 in orxonox.OLD


Ignore:
Timestamp:
Mar 26, 2005, 3:28:39 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: moved protoclass to folder proto
added protosingleton
added resourceManager
modiefied some stuff to work better

Location:
orxonox/trunk/src
Files:
3 added
13 edited
2 copied
2 moved

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r3652 r3655  
    6666                 lib/util/ini_parser.cc \
    6767                 lib/util/list.cc \
     68                 lib/util/resource_manager.cc \
    6869                 lib/math/vector.cc \
    6970                 lib/math/curve.cc \
    70                  glmenu/glmenu_imagescreen.cc 
     71                 glmenu/glmenu_imagescreen.cc
    7172
    7273noinst_HEADERS = orxonox.h \
     
    7677                 camera.h \
    7778                 keynames.h \
    78                  proto_class.h \
    7979                 command_node.h \
    8080                 message_structures.h \
     
    117117                 lib/util/list.h \
    118118                 lib/util/list_template.h \
     119                 lib/util/resource_manager.h \
    119120                 lib/util/ini_parser.h \
    120121                 lib/math/vector.h \
     
    124125
    125126## orxonox.conf will be used from home-dir instead.
    126 EXTRA_DIST = orxonox.conf
     127EXTRA_DIST = orxonox.conf \
     128             proto/proto_class.h \
     129             proto/proto_class.cc \
     130             proto/proto_singleton.h \
     131             proto/proto_singleton.cc
    127132
    128133if SUB_PROJECTS
  • orxonox/trunk/src/Makefile.in

    r3652 r3655  
    6767        model.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \
    6868        base_entity.$(OBJEXT) base_object.$(OBJEXT) \
    69         ini_parser.$(OBJEXT) list.$(OBJEXT) vector.$(OBJEXT) \
    70         curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
     69        ini_parser.$(OBJEXT) list.$(OBJEXT) resource_manager.$(OBJEXT) \
     70        vector.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT)
    7171orxonox_OBJECTS = $(am_orxonox_OBJECTS)
    7272orxonox_LDADD = $(LDADD)
     
    9494@AMDEP_TRUE@    ./$(DEPDIR)/player.Po ./$(DEPDIR)/primitive.Po \
    9595@AMDEP_TRUE@    ./$(DEPDIR)/projectile.Po \
     96@AMDEP_TRUE@    ./$(DEPDIR)/resource_manager.Po \
    9697@AMDEP_TRUE@    ./$(DEPDIR)/simple_animation.Po \
    9798@AMDEP_TRUE@    ./$(DEPDIR)/skysphere.Po \
     
    270271                 lib/util/ini_parser.cc \
    271272                 lib/util/list.cc \
     273                 lib/util/resource_manager.cc \
    272274                 lib/math/vector.cc \
    273275                 lib/math/curve.cc \
    274                  glmenu/glmenu_imagescreen.cc 
     276                 glmenu/glmenu_imagescreen.cc
    275277
    276278noinst_HEADERS = orxonox.h \
     
    280282                 camera.h \
    281283                 keynames.h \
    282                  proto_class.h \
    283284                 command_node.h \
    284285                 message_structures.h \
     
    321322                 lib/util/list.h \
    322323                 lib/util/list_template.h \
     324                 lib/util/resource_manager.h \
    323325                 lib/util/ini_parser.h \
    324326                 lib/math/vector.h \
     
    326328                 glmenu/glmenu_imagescreen.h
    327329
    328 EXTRA_DIST = orxonox.conf
     330EXTRA_DIST = orxonox.conf \
     331             proto/proto_class.h \
     332             proto/proto_class.cc \
     333             proto/proto_singleton.h \
     334             proto/proto_singleton.cc
     335
    329336@SUB_PROJECTS_FALSE@SUB_PROGS =
    330337@SUB_PROJECTS_TRUE@SUB_PROGS = lib subprojects
     
    428435@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primitive.Po@am__quote@
    429436@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/projectile.Po@am__quote@
     437@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_manager.Po@am__quote@
    430438@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_animation.Po@am__quote@
    431439@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
     
    936944@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    937945@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.obj `if test -f 'lib/util/list.cc'; then $(CYGPATH_W) 'lib/util/list.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/list.cc'; fi`
     946
     947resource_manager.o: lib/util/resource_manager.cc
     948@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.o -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.o `test -f 'lib/util/resource_manager.cc' || echo '$(srcdir)/'`lib/util/resource_manager.cc; \
     949@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
     950@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/util/resource_manager.cc' object='resource_manager.o' libtool=no @AMDEPBACKSLASH@
     951@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
     952@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     953@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.o `test -f 'lib/util/resource_manager.cc' || echo '$(srcdir)/'`lib/util/resource_manager.cc
     954
     955resource_manager.obj: lib/util/resource_manager.cc
     956@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT resource_manager.obj -MD -MP -MF "$(DEPDIR)/resource_manager.Tpo" -c -o resource_manager.obj `if test -f 'lib/util/resource_manager.cc'; then $(CYGPATH_W) 'lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/resource_manager.cc'; fi`; \
     957@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/resource_manager.Tpo" "$(DEPDIR)/resource_manager.Po"; else rm -f "$(DEPDIR)/resource_manager.Tpo"; exit 1; fi
     958@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='lib/util/resource_manager.cc' object='resource_manager.obj' libtool=no @AMDEPBACKSLASH@
     959@AMDEP_TRUE@@am__fastdepCXX_FALSE@      depfile='$(DEPDIR)/resource_manager.Po' tmpdepfile='$(DEPDIR)/resource_manager.TPo' @AMDEPBACKSLASH@
     960@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     961@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o resource_manager.obj `if test -f 'lib/util/resource_manager.cc'; then $(CYGPATH_W) 'lib/util/resource_manager.cc'; else $(CYGPATH_W) '$(srcdir)/lib/util/resource_manager.cc'; fi`
    938962
    939963vector.o: lib/math/vector.cc
     
    11071131
    11081132distdir: $(DISTFILES)
    1109         $(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/graphics/font $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/network $(distdir)/story_entities $(distdir)/world_entities
     1133        $(mkdir_p) $(distdir)/ai $(distdir)/defs $(distdir)/glmenu $(distdir)/lib/coord $(distdir)/lib/data $(distdir)/lib/graphics $(distdir)/lib/graphics/font $(distdir)/lib/lang $(distdir)/lib/math $(distdir)/lib/util $(distdir)/network $(distdir)/proto $(distdir)/story_entities $(distdir)/world_entities
    11101134        @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
    11111135        topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
  • orxonox/trunk/src/defs/debug.h

    r3645 r3655  
    5757#else /* DEBUG_SPECIAL_MODULE */
    5858// DEFINE MODULES \\
    59 #define DEBUG_MODULE_ORXONOX            2
    60 #define DEBUG_MODULE_WORLD              3
    61 #define DEBUG_MODULE_PNODE              2
    62 #define DEBUG_MODULE_WORLD_ENTITY       2
    63 #define DEBUG_MODULE_COMMAND_NODE       2
    64 #define DEBUG_MODULE_GRAPHICS           2
    65 
    66 #define DEBUG_MODULE_IMPORTER           2
    67 #define DEBUG_MODULE_TRACK_MANAGER      2
    68 #define DEBUG_MODULE_LIGHT              2
    69 #define DEBUG_MODULE_PLAYER             2
    70 #define DEBUG_MODULE_MATH               2
    71 
    72 #define DEBUG_MODULE_NULL_PARENT        2
     59#define DEBUG_MODULE_ORXONOX            0
     60#define DEBUG_MODULE_WORLD              0
     61#define DEBUG_MODULE_PNODE              0
     62#define DEBUG_MODULE_WORLD_ENTITY       0
     63#define DEBUG_MODULE_COMMAND_NODE       0
     64#define DEBUG_MODULE_GRAPHICS           0
     65#define DEBUG_MODULE_LOAD               4
     66
     67#define DEBUG_MODULE_IMPORTER           0
     68#define DEBUG_MODULE_TRACK_MANAGER      0
     69#define DEBUG_MODULE_LIGHT              0
     70#define DEBUG_MODULE_PLAYER             3
     71#define DEBUG_MODULE_MATH               0
     72
     73#define DEBUG_MODULE_NULL_PARENT        0
    7374
    7475
  • orxonox/trunk/src/lib/graphics/importer/material.cc

    r3590 r3655  
    2323#include <stdlib.h>
    2424#include <string.h>
     25
     26//! \todo check if we are in RESOURCE MANAGER-mode
     27#include "resource_manager.h"
    2528
    2629using namespace std;
     
    104107  this->ambientTextureSet = false;
    105108  this->specularTextureSet = false;
    106 
    107  
    108109}
    109110
     
    333334{
    334335  PRINTF(4)("setting Diffuse Map %s\n", dMap);
    335   diffuseTexture = new Texture();
    336   this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
    337 
     336    diffuseTexture = new Texture();
     337    this->diffuseTextureSet = diffuseTexture->loadImage(dMap);
     338
     339  //! \todo check if RESOURCE MANAGER is availiable
     340  //this->diffuseTextureSet = this->diffuseTexture = (Texture*)ResourceManager::load(dMap, IMAGE);
    338341}
    339342
  • orxonox/trunk/src/lib/graphics/importer/objModel.cc

    r3590 r3655  
    2121
    2222#include "debug.h"
    23 
    24 /**
    25    \brief Crates a 3D-Model and loads in a File.
    26    \param fileName file to parse and load (must be a .obj file)
    27 */
    28 OBJModel::OBJModel(char* fileName)
    29 {
    30   this->initializeOBJ();
    31 
    32   this->importFile (fileName);
    33 
    34   this->importToGL ();
    35 
    36   this->cleanup();
    37 }
    3823
    3924/**
     
    193178      else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented
    194179        {
    195           PRINTF(3)("smoothing groups not supportet yet. line: %s\n", Buffer);
     180          PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer);
    196181        }
    197182    }
  • orxonox/trunk/src/lib/graphics/importer/objModel.h

    r3454 r3655  
    1313{
    1414 public:
    15   OBJModel(char* fileName);
    16   OBJModel(char* fileName, float scaling);
     15  OBJModel(char* fileName, float scaling = 1.0);
    1716  virtual ~OBJModel();
    1817  void initializeOBJ(void);
     
    2827  bool readFromObjFile (void);
    2928  bool readMtlLib (char* matFile);
    30 
    3129};
    3230
  • orxonox/trunk/src/lib/graphics/importer/texture.cc

    r3622 r3655  
    131131
    132132/**
     133   \brief Constructor for a Texture
     134*/
     135Texture::Texture(const char* imageName)
     136{
     137  this->pImage = new Image;
     138  this->pImage->data = NULL;
     139  this->map = NULL;
     140  this->texture = 0;
     141  this->loadImage(imageName);
     142
     143
     144/**
    133145   \brief Destructor of a Texture
    134146   
     
    149161   \returns pathName+texName if texName was found in the pathList. NULL if the Texture is not found.
    150162*/
    151 char* Texture::searchTextureInPaths(char* texName) const
     163char* Texture::searchTextureInPaths(const char* texName) const
    152164{
    153165  char* tmpName = NULL;
     
    215227
    216228#ifdef HAVE_SDL_SDL_IMAGE_H
    217 bool Texture::loadImage(char* imageName)
     229bool Texture::loadImage(const char* imageName)
    218230{
    219231  if (GraphicsEngine::texturesEnabled)
     
    269281   \todo Checks where to find the Image
    270282*/
    271 bool Texture::loadImage(char* imageName)
     283bool Texture::loadImage(const char* imageName)
    272284{
    273285  if (GraphicsEngine::texturesEnabled)
  • orxonox/trunk/src/lib/graphics/importer/texture.h

    r3548 r3655  
    7070  GLuint texture;   //!< The Texture-ID of opengl from this Texture.
    7171  SDL_Surface* map; //!< The map SDL initializes for this element.
    72   char* searchTextureInPaths(char* texName) const;
     72  char* searchTextureInPaths(const char* texName) const;
    7373  inline void swap(unsigned char &a, unsigned char &b);
    7474 public:
    7575  Texture(void);
     76  Texture(const char* imageName);
    7677  ~Texture(void);
    7778  /** \returns The textureID of this texture.  */
     
    7980  bool loadTexToGL (Image* pImage);
    8081
    81   bool loadImage(char* imageName);
     82  bool loadImage(const char* imageName);
    8283#ifndef HAVE_SDL_SDL_IMAGE_H
    8384
  • orxonox/trunk/src/lib/util/resource_manager.cc

    r3645 r3655  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    1210
    1311   ### File Specific:
    14    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1513   co-programmer: ...
    1614*/
    1715
    18 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOAD
    1917
    20 #include "proto_class.h"
     18#include "resource_manager.h"
    2119
    22 #include "stdincl.h" // maybe
     20// different resource Types
     21#include "objModel.h"
     22#include "texture.h"
     23
     24// File Handling Includes
     25#include <sys/types.h>
     26#include <sys/stat.h>
     27#include <unistd.h>
     28
    2329
    2430using namespace std;
     
    2733/**
    2834   \brief standard constructor
    29    \todo this constructor is not jet implemented - do it
    3035*/
    31 ProtoClass::ProtoClass ()
     36ResourceManager::ResourceManager ()
    3237{
    33    this->setClassName ("ProtoClass");
     38   this->setClassName ("ResourceManager");
     39   this->dataDir = NULL;
     40}
     41
     42ResourceManager* ResourceManager::getInstance(void)
     43{
     44  if (!ResourceManager::singletonRef)
     45    ResourceManager::singletonRef = new ResourceManager();
     46  return ResourceManager::singletonRef;
     47}
     48
     49ResourceManager* ResourceManager::singletonRef = NULL;
     50
     51/**
     52   \brief standard deconstructor
     53*/
     54ResourceManager::~ResourceManager (void)
     55{
     56  ResourceManager::singletonRef = NULL;
    3457}
    3558
    3659
     60
    3761/**
    38    \brief standard deconstructor
    39 
     62   \brief sets the data main directory
     63   \param dataDir the DataDirectory.
    4064*/
    41 ProtoClass::~ProtoClass ()
     65bool ResourceManager::setDataDir(char* dataDir)
    4266{
    43   // delete what has to be deleted here
     67  if (isDir(dataDir))
     68    {
     69      this->dataDir = new char[strlen(dataDir)+1];
     70      strcpy(this->dataDir, dataDir);
     71    }
     72  else
     73    {
     74      PRINTF(1)("%s is not a Directory, and can not be the Data Directory\n", dataDir);
     75    }
    4476}
    4577
    4678/**
    47    \brief nonsense - delete this method
    48    \param realy nothing to give
    49    \returns true or false - probably nothing?
     79   \brief loads resources
     80   \param fileName The fileName of the resource to load
     81   \returns a pointer to a desired Resource.
     82*/
     83void* ResourceManager::load(const char* fileName)
     84{
     85  ResourceType tmpType;
     86  if (!strncmp(fileName+(strlen(fileName)-4), ".obj", 4))
     87    tmpType = OBJ;
    5088
    51    this is just to show the doxygen abilities (this for example is an extension for a long comment)
     89  return ResourceManager::load(fileName, tmpType);
     90}
     91
     92/**
     93   \brief loads resources
     94   \param fileName The fileName of the resource to load
     95   \param type The Type of Resource to load (\see ResourceType)
     96   \returns a pointer to a desired Resource.
    5297*/
    53 bool ProtoClass::doNonSense (int nothing) {}
     98void* ResourceManager::load(const char* fileName, ResourceType type)
     99{
     100  void* tmpResource = NULL;
     101  char* tmpName = new char[strlen(fileName)+1];
     102  strcpy(tmpName, fileName);
     103  // Checking for the type of resource \see ResourceType
     104  switch(type)
     105    {
     106    case OBJ:
     107      if(isFile(tmpName))
     108        tmpResource = new OBJModel(tmpName);
     109      else
     110        {
     111          PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", tmpName);
     112          tmpResource = new Model(CUBE);
     113        }
     114      break;
     115    case IMAGE:
     116      if(isFile(tmpName))
     117        {
     118          tmpResource = new Texture(tmpName);
     119        }
     120      else
     121        PRINTF(1)("!!Texture %s not Found!!\n", tmpName);
     122      break;
     123    default:
     124      tmpResource = NULL;
     125      PRINTF(2)("No type found for %s.\n   !!This should not happen unless the Type is not supported yet.!!\n", tmpName);
     126      break;
     127    }
     128
     129  // checking if the File really exists.
     130  if(!isFile(tmpName))
     131    {
     132      PRINTF(2)("Sorry, %s is not a regular file.\n", tmpName);
     133      tmpResource = NULL;
     134    }
     135  return tmpResource;
     136}
     137
     138/**
     139   \brief Checks if it is a Directory
     140   \param directoryName the Directory to check for
     141   \returns true if it is a directory/symlink false otherwise
     142*/
     143bool ResourceManager::isDir(const char* directoryName)
     144{
     145  struct stat status;
     146  stat(directoryName, &status);
     147  if (status.st_mode & (S_IFDIR | S_IFLNK))
     148    return true;
     149  else
     150    return false;
     151}
     152
     153/**
     154   \brief Checks if the file is either a Regular file or a Symlink
     155   \param fileName the File to check for
     156   \returns true if it is a regular file/symlink, false otherwise
     157*/
     158bool ResourceManager::isFile(const char* fileName)
     159{
     160  struct stat status;
     161  stat(fileName, &status);
     162  if (status.st_mode & (S_IFREG | S_IFLNK))
     163    return true;
     164  else
     165    return false;
     166}
  • orxonox/trunk/src/lib/util/resource_manager.h

    r3645 r3655  
    11/*!
    2     \file proto_class.h
    3     \brief Definition of the proto class template, used quickly start work
    4     \todo Example: this shows how to use simply add a Marker that here has to be done something.
     2    \file resource_manager.h
     3    \brief The Resource Manager checks if a file/resource is loaded.
    54
    6     The Protoclass exists, to help you quikly getting the run for how to develop in orxonox.
    7     It is an example for the CODING-CONVENTION, and a starting-point for every class.
     5    If a file/resource was already loaded the resourceManager will
     6    return a void pointer to the desired resource.
     7    Otherwise it will instruct the coresponding resource-loader to load,
     8    and receive a pointer to it.
    89*/
    910
    10 #ifndef _PROTO_CLASS_H
    11 #define _PROTO_CLASS_H
     11#ifndef _RESOURCE_MANAGER_H
     12#define _RESOURCE_MANAGER_H
    1213
    13 #include "what realy has to be included"
    1414#include "base_object.h"
    1515
    1616// FORWARD DEFINITION \\
    17 class someClassWeNeed;
    1817
    1918
    20 /*class Test;*/ /* forward definition of class Test (without including it here!)*/
     19enum ResourceType {OBJ, WAV, MP3, OGG, IMAGE};
    2120
    22 //! A default class that aids you to start creating a new class
     21//! The ResourceManager is a class, that decides if a file/resource should be loaded
    2322/**
    24    here can be some longer description of this class
     23   If a file/resource was already loaded the resourceManager will
     24   return a void pointer to the desired resource.
     25   Otherwise it will instruct the corresponding resource-loader to load,
     26   and receive the pointer to it.
     27
     28   It does it by looking, if a desired file has already been loaded.
    2529*/
    26 class ProtoClass : public BaseObject {
     30class ResourceManager : public BaseObject
     31{
     32 public:
     33  static ResourceManager* getInstance();
     34  virtual ~ResourceManager();
    2735
    28  public:
    29   ProtoClass();
    30   virtual ~ProtoClass();
    31 
    32   bool doNonSense (int nothing);
     36  bool setDataDir(char* dataDir);
     37  static void* load(const char* fileName);
     38  static void* load(const char* fileName, ResourceType type);
    3339
    3440 private:
    35   int nonSense;  //!< doxygen tag here like this for all the variables - delete this variable if you use this
     41  ResourceManager();
     42  static ResourceManager* singletonRef;
    3643
     44
     45  struct file;
     46  struct folder
     47  {
     48    char* name;
     49    folder** subfolders;             //!<
     50    file** files;                    //!< Files in the directory
     51  };
     52  struct file
     53  {
     54    char* name;                      //!< exact Name of a file
     55    void* pointer;
     56  };
     57
     58  char* dataDir;                     //!< The main data directory
     59
     60  static bool isDir(const char* directory);
     61  static bool isFile(const char* directory); 
    3762};
    3863
    39 #endif /* _PROTO_CLASS_H */
     64#endif /* _RESOURCE_MANAGER_H */
  • orxonox/trunk/src/orxonox.cc

    r3652 r3655  
    3131#include "game_loader.h"
    3232#include "graphics_engine.h"
     33#include "resource_manager.h"
    3334
    3435#include <string.h>
     
    159160int Orxonox::initResources()
    160161{
    161   printf("Not yet implemented\n");
     162  //  printf("Not yet implemented\n");
     163  PRINT(3)("initializing ResourceManager\n");
     164  resourceManager = ResourceManager::getInstance();
     165  resourceManager->setDataDir("../data");
    162166  return 0;
    163167}
  • orxonox/trunk/src/orxonox.h

    r3648 r3655  
    1616class Camera;
    1717class GameLoader;
     18class ResourceManager;
    1819
    1920//! Orxonox core singleton class
     
    3334  SDL_Surface* screen;        //!< The current Screen
    3435  GameLoader* gameLoader;     //!< The gameLoader
     36  ResourceManager* resourceManager; //!< The ResourceManager
    3537 
    3638  bool bQuitOrxonox;          //!< If Orxonox should Quit
  • orxonox/trunk/src/world_entities/player.cc

    r3654 r3655  
    2222#include "track_manager.h"
    2323#include "objModel.h"
     24#include "resource_manager.h"
    2425#include "weapon.h"
    2526#include "test_gun.h"
     
    4445     the player.cc for debug also
    4546  */
    46   this->model = new OBJModel("../data/models/reaplow.obj");
     47  this->model = (Model*) ResourceManager::load("../data/models/reaplow.obj", OBJ);
    4748  travelSpeed = 15.0;
    4849  velocity = new Vector();
  • orxonox/trunk/src/world_entities/player.h

    r3620 r3655  
    1010
    1111template<class T> class tList;
    12 class OBJModel;
    1312class Weapon;
    1413class Vector;
  • orxonox/trunk/src/world_entities/world_entity.h

    r3608 r3655  
    1212//class CollisionCluster;
    1313class CharacterAttributes;
    14 class OBJModel;
     14class Model;
    1515
    1616
     
    4848 
    4949 protected:
    50   OBJModel* model;                  //!< The model that should be loaded for this entity.
     50  Model* model;                  //!< The model that should be loaded for this entity.
    5151  CharacterAttributes* charAttr;      //!< the character attributes of a world_entity
    5252 
Note: See TracChangeset for help on using the changeset viewer.