Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4251 in orxonox.OLD


Ignore:
Timestamp:
May 21, 2005, 11:17:18 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/levelLoader: some issues, to be able to describe what is loadable

Location:
orxonox/branches/levelLoader/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelLoader/src/util/loading/load_param.cc

    r4250 r4251  
    1616#include "load_param.h"
    1717
    18 //void BaseLoadParam::description(const char* paramDescription)
    19 //{
    2018
    21 //}
     19BaseLoadParam::BaseLoadParam(BaseObject* object, const char* type1, const char* type2,
     20                const char* type3, const char* type4, const char* type5)
     21{
     22 
     23}
    2224
    23 
     25/**
     26   \brief if the description of Parameters should be executed
     27*/
     28bool LoadClassDescription::ParametersDescription = false;
  • orxonox/branches/levelLoader/src/util/loading/load_param.h

    r4250 r4251  
    2525#include "debug.h"
    2626#include "substring.h"
     27
     28// Forward Declaration //
     29template<class T> class tList;
    2730
    2831/**
     
    3740#define l_INT_TYPE int
    3841#define l_INT_FUNC atoi
     42#define l_INT_NAME "int"
    3943
    4044#define l_LONG_TYPE long
    4145#define l_LONG_FUNC atol
     46#define l_LONG_NAME "long"
    4247
    4348#define l_SHORT_TYPE short
    4449#define l_SHORT_FUNC atoi
     50#define l_SHORT_NAME "short"
    4551
    4652#define l_FLOAT_TYPE float
    4753#define l_FLOAT_FUNC atof
     54#define l_FLOAT_NAME "float"
    4855
    4956#define l_STRING_TYPE const char*
    50 #define l_STRING_FUNC
     57#define l_STRING_FUNC
     58#define l_STRING_NAME "string"
    5159
    5260
     
    5765#define LoadParam1(type1) \
    5866 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE)) \
     67  : BaseLoadParam(pt2Object, type1##_NAME) \
    5968    { \
    6069      const char* loadString = grabParameter(root, paramName); \
     
    6271        (*pt2Object.*function)(type1##_FUNC(loadString)); \
    6372      else \
    64         PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     73        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    6574    }
    6675
     
    6978#define LoadParam2(type1, type2) \
    7079 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE)) \
     80  : BaseLoadParam(pt2Object, type1##_NAME, type2##_NAME) \
    7181    { \
    7282      const char* loadString = grabParameter(root, paramName); \
     
    8191        } \
    8292      else \
    83         PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    84     };
     93        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     94    }
    8595
    8696
    8797// 3. TYPES
    8898#define LoadParam3(type1, type2, type3) \
    89  LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE)) \
     99 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE))\
     100  : BaseLoadParam(pt2Object, type1##_NAME, type2##_NAME, type3##_NAME) \
    90101    { \
    91102      const char* loadString = grabParameter(root, paramName); \
     
    100111        } \
    101112      else \
    102         PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    103     };
     113        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     114    }
    104115
    105116
     
    107118#define LoadParam4(type1, type2, type3, type4) \
    108119 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE)) \
     120  : BaseLoadParam(pt2Object, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME) \
    109121    { \
    110122      const char* loadString = grabParameter(root, paramName); \
     
    119131        } \
    120132      else \
    121         PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    122     };
     133        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     134    }
    123135
    124136
     
    126138#define LoadParam5(type1, type2, type3, type4, type5) \
    127139 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE)) \
     140  : BaseLoadParam(pt2Object, type1##_NAME, type2##_NAME, type3##_NAME, type2##_NAME, type4##_NAME, type5##_NAME) \
    128141    { \
    129142      const char* loadString = grabParameter(root, paramName); \
     
    138151        } \
    139152      else \
    140         PRINTF(2)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    141     };
     153        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
     154    }
     155
    142156
    143157
     
    147161  int paramCount;
    148162  char** types;
     163  const char* className;
     164
     165};
     166
     167class LoadClassDescription
     168{
     169 public:
     170
     171
     172  static bool ParametersDescription;
     173 
     174 private:
     175  tList<LoadParamDescription>* paramList;
    149176};
    150177
     
    152179class BaseLoadParam
    153180{
    154  public:
     181 protected:
     182  BaseLoadParam(BaseObject* object, const char* type1 = NULL, const char* type2 = NULL,
     183                const char* type3 = NULL, const char* type4 = NULL, const char* type5 = NULL);
     184
     185 protected:
     186  LoadParamDescription* description;
    155187};
    156188
  • orxonox/branches/levelLoader/src/world_entities/skybox.cc

    r4250 r4251  
    4949  this->preInit();
    5050
     51  this->load(root);
     52
     53  this->postInit();
     54}
     55
     56void SkyBox::load(TiXmlElement* root)
     57{
    5158  LoadParam<SkyBox>(root, "Materialset", this, &SkyBox::setTexture);
    52 
    53   this->postInit();
    5459}
    5560
     
    208213  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,0, 3,2,0, 2,3,0); // right
    209214  this->skyModel->setMaterial(material[4]);
    210   this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front
     215  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,5); // front
    211216  this->skyModel->setMaterial(material[5]);
    212217  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back
  • orxonox/branches/levelLoader/src/world_entities/skybox.h

    r4249 r4251  
    2626  virtual ~SkyBox();
    2727
     28  void load(TiXmlElement* root);
     29
    2830  void preInit(void);
    2931  void postInit(void);
  • orxonox/branches/levelLoader/src/world_entities/world_entity.cc

    r4240 r4251  
    2626
    2727/**
    28    \brief standard constructor
    29 */
    30 WorldEntity::WorldEntity ()
     28   \brief Loads the WordEntity-specific Part of any derived Class
     29*/
     30WorldEntity::WorldEntity(TiXmlElement* root)
    3131{
    3232  this->setClassName ("WorldEntity");
     33  this->model = NULL;
     34
     35  if (root)
     36    this->load(root);
     37
    3338  this->bDraw = true;
    34   this->model = NULL;
    35   //  collisioncluster = NULL;
    36 }
    37 
    38 /**
    39    \brief Loads the WordEntity-specific Part of any derived Class
    40 */
    41 WorldEntity::WorldEntity(TiXmlElement* root)
    42 {
    43   this->setClassName ("WorldEntity");
    44   // Name Setup
     39}
     40
     41void WorldEntity::load(TiXmlElement* root)
     42{
     43  // name setup
    4544  LoadParam<WorldEntity>(root, "name", this, &WorldEntity::setName);
     45
    4646  // Model Loading     
    47   this->model = NULL;
    4847  LoadParam<WorldEntity>(root, "model", this, &WorldEntity::loadModel);
    49 
    50   this->bDraw = true;
    5148}
    5249
  • orxonox/branches/levelLoader/src/world_entities/world_entity.h

    r4239 r4251  
    2323
    2424 public:
    25   WorldEntity (void);
    26   WorldEntity(TiXmlElement* root);
     25  WorldEntity(TiXmlElement* root = NULL);
    2726  virtual ~WorldEntity ();
    2827
     28  void load(TiXmlElement* root);
    2929  void loadModel(const char* fileName);
    3030
Note: See TracChangeset for help on using the changeset viewer.