Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9686 in orxonox.OLD for branches/new_class_id/src


Ignore:
Timestamp:
Aug 22, 2006, 2:36:54 PM (18 years ago)
Author:
bensch
Message:

new_class_id: many more classes done

Location:
branches/new_class_id/src/lib
Files:
66 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/lib/event/event_handler.cc

    r9656 r9686  
    2828#include <algorithm>
    2929
     30
     31NewObjectListDefinition(EventHandler);
    3032/**
    3133 * @brief standard constructor
     
    3335EventHandler::EventHandler ()
    3436{
    35   this->setClassID(CL_EVENT_HANDLER, "EventHandler");
     37  this->registerObject(this, EventHandler::_objectList);
    3638  this->setName("EventHandler");
    3739
  • branches/new_class_id/src/lib/event/event_handler.h

    r8743 r9686  
    2121class EventHandler : public BaseObject
    2222{
    23 
     23  NewObjectListDeclaration(EventHandler);
    2424public:
    2525  virtual ~EventHandler();
  • branches/new_class_id/src/lib/event/event_listener.cc

    r7868 r9686  
    1919#include "event_handler.h"
    2020
     21NewObjectListDefinition(EventListener);
    2122/**
    2223 * @brief standard constructor
     
    2425EventListener::EventListener ()
    2526{
    26   this->setClassID(CL_EVENT_LISTENER, "EventListener");
     27  this->registerObject(this, EventListener::_objectList);
    2728}
    2829
  • branches/new_class_id/src/lib/event/event_listener.h

    r7868 r9686  
    1212
    1313//! A class for event listener
    14 class EventListener : virtual public BaseObject {
    15 
    16  public:
     14class EventListener : virtual public BaseObject
     15{
     16  NewObjectListDeclaration(EventListener);
     17public:
    1718  EventListener();
    1819  virtual ~EventListener();
  • branches/new_class_id/src/lib/event/key_mapper.cc

    r9406 r9686  
    3232
    3333
    34 
     34NewObjectListDefinition(KeyMapper);
    3535
    3636/* initialize all variables to a reasonable value*/
     
    116116KeyMapper::KeyMapper ()
    117117{
    118    this->setClassID(CL_KEY_MAPPER, "KeyMapper");
     118  this->registerObject(this, KeyMapper::_objectList);
    119119}
    120120
  • branches/new_class_id/src/lib/event/key_mapper.h

    r8724 r9686  
    1616class KeyMapper : public BaseObject
    1717{
     18  NewObjectListDeclaration(KeyMapper);
    1819public:
    1920  //! A mapping from key-name to key-id
  • branches/new_class_id/src/lib/graphics/effects/cloud_effect.cc

    r9406 r9686  
    2929#include "script_class.h"
    3030
    31 #include "parser/tinyxml/tinyxml.h"
     31#include "class_id.h"
    3232
    3333Vector    CloudEffect::cloudColor;
     
    4848
    4949
    50 CREATE_SCRIPTABLE_CLASS(CloudEffect, CL_CLOUD_EFFECT,
     50CREATE_SCRIPTABLE_CLASS(CloudEffect, CloudEffect::classID(),
    5151                        addMethod("skyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor))
    5252                        ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor))
     
    5757
    5858CREATE_FACTORY(CloudEffect, CL_CLOUD_EFFECT);
     59NewObjectListDefinitionID(CloudEffect, CL_CLOUD_EFFECT);
    5960
    6061CloudEffect::CloudEffect(const TiXmlElement* root) {
    61     this->setClassID(CL_CLOUD_EFFECT, "CloudEffect");
     62  this->registerObject(this, CloudEffect::_objectList);
    6263
    6364    this->init();
  • branches/new_class_id/src/lib/graphics/effects/cloud_effect.h

    r9112 r9686  
    3737
    3838class CloudEffect : public WeatherEffect {
     39  NewObjectListDeclaration(CloudEffect);
    3940
    4041public:
  • branches/new_class_id/src/lib/graphics/effects/fog_effect.cc

    r9406 r9686  
    2828SHELL_COMMAND(fadeout, FogEffect, fadeOutFog);
    2929
    30 
    31 
    32 CREATE_SCRIPTABLE_CLASS(FogEffect, CL_FOG_EFFECT,
     30#include "class_id.h"
     31
     32CREATE_SCRIPTABLE_CLASS(FogEffect, FogEffect::classID(),
    3333                        addMethod("fadeIn", ExecutorLua0<FogEffect>(&FogEffect::fadeInFog))
    3434                            ->addMethod("fadeOut", ExecutorLua0<FogEffect>(&FogEffect::fadeOutFog))
     
    3838
    3939CREATE_FACTORY(FogEffect, CL_FOG_EFFECT);
     40NewObjectListDefinition(FogEffect);
    4041
    4142/**
     
    4344 */
    4445FogEffect::FogEffect(const TiXmlElement* root) {
    45     this->setClassID(CL_FOG_EFFECT, "FogEffect");
    46 
     46  this->registerObject(this, FogEffect::_objectList);
    4747    // Initialize values
    4848    this->init();
     
    8585  this->fogFadeInActivate = false;
    8686  this->fogFadeOutActivate = false;
    87  
     87
    8888  this->cloudColor = Vector(0.2f, 0.3f, 0.3f);
    8989  this->skyColor = Vector(0.2f, 0.3f, 0.3f);
     
    105105    LoadParam(root, "cloudcolor", this, FogEffect, setCloudColor);
    106106    LoadParam(root, "skycolor", this, FogEffect, setSkyColor);
    107    
     107
    108108    LOAD_PARAM_START_CYCLE(root, element);
    109109    {
     
    131131
    132132    glEnable(GL_FOG);
    133    
     133
    134134    // Store cloud- and sky color before the snow
    135135    this->oldCloudColor = CloudEffect::cloudColor;
    136136    this->oldSkyColor   = CloudEffect::skyColor;
    137    
     137
    138138    // Change the colors
    139139    CloudEffect::changeCloudColor(this->cloudColor, this->fogFadeInDuration);
     
    241241    this->fogFadeInActivate = false;
    242242
    243    
     243
    244244    // If Fog is off, turn it on first
    245245    if (!this->fogActivate)
  • branches/new_class_id/src/lib/graphics/effects/fog_effect.h

    r9235 r9686  
    1515class FogEffect : public WeatherEffect
    1616{
     17  NewObjectListDeclaration(FogEffect);
    1718public:
    1819  FogEffect(const TiXmlElement* root = NULL);
     
    7576      this->fogActivate = true;
    7677  }
    77  
     78
    7879  inline void setCloudColor(float colorX, float colorY, float colorZ)
    7980  {
     
    119120
    120121  Vector        colorVector;
    121   float         localTimer; 
    122  
     122  float         localTimer;
     123
    123124  Vector oldSkyColor;
    124125  Vector oldCloudColor;
  • branches/new_class_id/src/lib/graphics/effects/lense_flare.cc

    r9406 r9686  
    3333#include "camera.h"
    3434
    35 
    36 
    37 
     35#include "class_id.h"
    3836
    3937CREATE_FACTORY(LenseFlare, CL_LENSE_FLARE);
    40 
     38NewObjectListDefinitionID(LenseFlare, CL_LENSE_FLARE);
    4139
    4240/**
     
    4543 */
    4644LenseFlare::LenseFlare(const TiXmlElement* root) {
    47     this->setClassID(CL_LENSE_FLARE, "LenseFlare");
     45  this->registerObject(this, LenseFlare::_objectList);
    4846
    4947    /*          length                      image scale */
  • branches/new_class_id/src/lib/graphics/effects/lense_flare.h

    r8619 r9686  
    2626class LenseFlare : public GraphicsEffect
    2727{
     28  NewObjectListDeclaration(LenseFlare);
    2829  public:
    2930    LenseFlare(const TiXmlElement* root = NULL);
  • branches/new_class_id/src/lib/graphics/effects/lightning_effect.cc

    r9406 r9686  
    2323#include "effects/billboard.h"
    2424
    25 #include "glincl.h"
    26 #include "parser/tinyxml/tinyxml.h"
    27 
    2825#include "shell_command.h"
    2926#include "light.h"
    3027#include "cloud_effect.h"
    3128#include "script_class.h"
     29#include "class_id.h"
    3230
    3331SHELL_COMMAND(activate, LightningEffect, activateLightning);
    3432SHELL_COMMAND(deactivate, LightningEffect, deactivateLightning);
    3533
    36 
    37 
    38 CREATE_SCRIPTABLE_CLASS(LightningEffect, CL_LIGHTNING_EFFECT,
     34CREATE_SCRIPTABLE_CLASS(LightningEffect, LightningEffect::classID(),
    3935                        addMethod("activate", ExecutorLua0<LightningEffect>(&LightningEffect::activate))
    4036                            ->addMethod("deactivate", ExecutorLua0<LightningEffect>(&LightningEffect::deactivate))
     
    4238
    4339CREATE_FACTORY(LightningEffect, CL_LIGHTNING_EFFECT);
     40NewObjectListDefinitionID(LightningEffect, CL_LIGHTNING_EFFECT);
    4441
    4542LightningEffect::LightningEffect(const TiXmlElement* root) {
    46     this->setClassID(CL_LIGHTNING_EFFECT, "LightningEffect");
    47 
     43  this->registerObject(this, LightningEffect::_objectList);
    4844    this->init();
    4945
  • branches/new_class_id/src/lib/graphics/effects/lightning_effect.h

    r9006 r9686  
    1717class Light;
    1818
    19 class LightningEffect : public WeatherEffect {
     19class LightningEffect : public WeatherEffect
     20{
     21  NewObjectListDeclaration(LightningEffect);
    2022public:
    21     LightningEffect(const TiXmlElement* root = NULL);
    22     virtual ~LightningEffect();
     23  LightningEffect(const TiXmlElement* root = NULL);
     24  virtual ~LightningEffect();
    2325
    24     virtual void loadParams(const TiXmlElement* root);
     26  virtual void loadParams(const TiXmlElement* root);
    2527
    26     virtual void init();
     28  virtual void init();
    2729
    28     virtual void activate();
    29     virtual void deactivate();
     30  virtual void activate();
     31  virtual void deactivate();
    3032
    31     inline  void activateLightning() {
    32         this->activate();
    33     }
    34     inline  void deactivateLightning() {
    35         this->deactivate();
    36     }
     33  inline  void activateLightning()
     34  {
     35    this->activate();
     36  }
     37  inline  void deactivateLightning()
     38  {
     39    this->deactivate();
     40  }
    3741
    38     virtual void tick(float dt);
     42  virtual void tick(float dt);
    3943
    40     void coord(float x, float y, float z);
    41     void setFlashSize(float width, float height, float seedWidth, float seedHeight);
     44  void coord(float x, float y, float z);
     45  void setFlashSize(float width, float height, float seedWidth, float seedHeight);
    4246
    43     inline void setLightningOption(const std::string& option) {
    44         if (option == "activate")
    45             this->lightningActivate = true;
    46         if (option == "movelightning")
    47             this->lightningMove = true;
    48     }
     47  inline void setLightningOption(const std::string& option)
     48  {
     49    if (option == "activate")
     50      this->lightningActivate = true;
     51    if (option == "movelightning")
     52      this->lightningMove = true;
     53  }
    4954
    50     inline void setFlashFrequency(float baseFrequency, float seedTime) {
    51         this->flashFrequencyBase = baseFrequency;
    52         this->flashFrequency = baseFrequency;
    53         this->flashFrequencySeed = seedTime;
    54     }
     55  inline void setFlashFrequency(float baseFrequency, float seedTime)
     56  {
     57    this->flashFrequencyBase = baseFrequency;
     58    this->flashFrequency = baseFrequency;
     59    this->flashFrequencySeed = seedTime;
     60  }
    5561
    56     inline void setFlashConstTime(float holdTime) {
    57         this->flashHoldTime = holdTime;
    58     }
     62  inline void setFlashConstTime(float holdTime)
     63  {
     64    this->flashHoldTime = holdTime;
     65  }
    5966
    60     inline void setFlashRisingTime(float flashRisingTime) {
    61         if(flashRisingTime > this->flashHoldTime)
    62             this->flashRisingTime = this->flashHoldTime * 0.5;
    63         else
    64             this->flashRisingTime = flashRisingTime;
    65     }
     67  inline void setFlashRisingTime(float flashRisingTime)
     68  {
     69    if(flashRisingTime > this->flashHoldTime)
     70      this->flashRisingTime = this->flashHoldTime * 0.5;
     71    else
     72      this->flashRisingTime = flashRisingTime;
     73  }
    6674
    67     inline void setFlashSeed(float seedX, float seedZ) {
    68         this->seedX = seedX;
    69         this->seedZ = seedZ;
    70     }
     75  inline void setFlashSeed(float seedX, float seedZ)
     76  {
     77    this->seedX = seedX;
     78    this->seedZ = seedZ;
     79  }
    7180
    7281
    7382private:
    7483
    75     void newCoordinates();
    76     void setTexture();
    77     void switchTexture();
     84  void newCoordinates();
     85  void setTexture();
     86  void switchTexture();
    7887
    79     Billboard* thunderBolt[4];
    80     bool thunderTextureA;
     88  Billboard* thunderBolt[4];
     89  bool thunderTextureA;
    8190
    82     bool lightningActivate;
    83     bool lightningMove;
     91  bool lightningActivate;
     92  bool lightningMove;
    8493
    85     float flashFrequency;
    86     float flashFrequencyBase;
    87     float flashHoldTime;
    88     float flashRisingTime;
     94  float flashFrequency;
     95  float flashFrequencyBase;
     96  float flashHoldTime;
     97  float flashRisingTime;
    8998
    90     float time;
     99  float time;
    91100
    92     float width;
    93     float height;
    94     float seedWidth;
    95     float seedHeight;
     101  float width;
     102  float height;
     103  float seedWidth;
     104  float seedHeight;
    96105
    97     float seedX;
    98     float seedZ;
    99     float flashFrequencySeed;
     106  float seedX;
     107  float seedZ;
     108  float flashFrequencySeed;
    100109
    101     float mainPosX;
    102     float mainPosY;
    103     float mainPosZ;
     110  float mainPosX;
     111  float mainPosY;
     112  float mainPosZ;
    104113
    105     Vector origSkyColor;
    106     Vector cameraCoor;
     114  Vector origSkyColor;
     115  Vector cameraCoor;
    107116
    108     Light* flashLight;
     117  Light* flashLight;
    109118
    110     OrxSound::SoundSource    soundSource;
    111     OrxSound::SoundBuffer*   thunderBuffer;
     119  OrxSound::SoundSource    soundSource;
     120  OrxSound::SoundBuffer*   thunderBuffer;
    112121
    113122};
  • branches/new_class_id/src/lib/graphics/effects/rain_effect.cc

    r9406 r9686  
    3131#include "script_class.h"
    3232
    33 #include "parser/tinyxml/tinyxml.h"
     33#include "class_id.h"
    3434
    3535// Define shell commands
     
    4141
    4242
    43 CREATE_SCRIPTABLE_CLASS(RainEffect, CL_RAIN_EFFECT,
     43CREATE_SCRIPTABLE_CLASS(RainEffect, RainEffect::classID(),
    4444                        addMethod("startRaining", ExecutorLua0<RainEffect>(&RainEffect::startRaining))
    4545                            ->addMethod("stopRaining", ExecutorLua0<RainEffect>(&RainEffect::stopRaining))
     
    4949
    5050CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT);
     51NewObjectListDefinitionID(RainEffect, CL_RAIN_EFFECT);
    5152
    5253/**
     
    5455 */
    5556RainEffect::RainEffect(const TiXmlElement* root) {
    56     this->setClassID(CL_RAIN_EFFECT, "RainEffect");
    57 
     57  this->registerObject(this, RainEffect::_objectList);
    5858    this->init();
    5959
  • branches/new_class_id/src/lib/graphics/effects/rain_effect.h

    r9235 r9686  
    2525class RainEffect : public WeatherEffect
    2626{
     27  NewObjectListDeclaration(RainEffect);
    2728public:
    2829  RainEffect(const TiXmlElement* root = NULL);
     
    136137  Vector                      skyColor;
    137138  Vector                      cloudColor;
    138  
     139
    139140  LightManager*               lightMan;
    140141
  • branches/new_class_id/src/lib/graphics/effects/snow_effect.cc

    r9406 r9686  
    3030#include "cloud_effect.h"
    3131
    32 #include "parser/tinyxml/tinyxml.h"
     32#include "class_id.h"
    3333
    3434SHELL_COMMAND(activate, SnowEffect, activateSnow);
     
    3636
    3737
    38 CREATE_SCRIPTABLE_CLASS(SnowEffect, CL_SNOW_EFFECT,
     38CREATE_SCRIPTABLE_CLASS(SnowEffect, SnowEffect::classID(),
    3939                            addMethod("activate", ExecutorLua0<SnowEffect>(&SnowEffect::activate))
    4040                            ->addMethod("deactivate", ExecutorLua0<SnowEffect>(&SnowEffect::deactivate))
     
    4242
    4343CREATE_FACTORY(SnowEffect, CL_SNOW_EFFECT);
     44NewObjectListDefinitionID(SnowEffect, CL_SNOW_EFFECT);
    4445
    4546SnowEffect::SnowEffect(const TiXmlElement* root)
    4647{
    47         this->setClassID(CL_SNOW_EFFECT, "SnowEffect");
     48  this->registerObject(this, SnowEffect::_objectList);
    4849
    4950        this->init();
  • branches/new_class_id/src/lib/graphics/effects/snow_effect.h

    r9406 r9686  
    2121#include "sound_buffer.h"
    2222
    23 class SnowEffect : public WeatherEffect {
     23class SnowEffect : public WeatherEffect
     24{
     25  NewObjectListDeclaration(SnowEffect);
    2426public:
    25     SnowEffect(const TiXmlElement* root = NULL);
    26     virtual ~SnowEffect();
     27  SnowEffect(const TiXmlElement* root = NULL);
     28  virtual ~SnowEffect();
    2729
    28     virtual void loadParams(const TiXmlElement* root);
     30  virtual void loadParams(const TiXmlElement* root);
    2931
    30     virtual void init();
     32  virtual void init();
    3133
    32     virtual void activate();
    33     virtual void deactivate();
     34  virtual void activate();
     35  virtual void deactivate();
    3436
    35     inline void activateSnow() {
    36         this->activate();
    37     }
    38     inline void deactivateSnow() {
    39         this->deactivate();
    40     }
     37  inline void activateSnow()
     38  {
     39    this->activate();
     40  }
     41  inline void deactivateSnow()
     42  {
     43    this->deactivate();
     44  }
    4145
    42     virtual void draw() const;
    43     virtual void tick(float dt);
     46  virtual void draw() const;
     47  virtual void tick(float dt);
    4448
    4549
    46     inline void numParticles(int n) {
    47         this->particles = n;
    48     }
    49     inline void materialTexture(const std::string& texture) {
    50         this->texture = texture;
    51     }
    52     inline void lifeSpan(float lifeSpan, float randomLifeSpan) {
    53         this->snowLife = lifeSpan;
    54         this->randomLife = randomLifeSpan;
    55     }
    56     inline void radius(float radius, float randomRadius) {
    57         this->snowRadius = radius;
    58         this->randomRadius = randomRadius;
    59     }
    60     inline void mass(float mass, float randomMass) {
    61         this->snowMass = mass;
    62         this->randomMass = randomMass;
    63     }
    64     inline void emissionRate(float emissionRate) {
    65         this->rate = emissionRate;
    66     }
    67     inline void emissionVelocity(float velocity, float randomVelocity) {
    68         this->velocity = velocity;
    69         this->randomVelocity = randomVelocity;
    70     }
    71     inline void size(float sizeX, float sizeY) {
    72         this->snowSize = Vector2D(sizeX, sizeY);
    73     }
    74     inline void coord(float x, float y, float z) {
    75         this->snowCoord = Vector(x, y, z);
    76     }
    77     inline void wind(int force) {
    78         this->snowWindForce = force;
    79     }
    80     inline void setCloudColor(float colorX, float colorY, float colorZ)
    81     {
    82       this->cloudColor = Vector(colorX, colorY, colorZ);
    83     }
    84     inline void setSkyColor(float colorX, float colorY, float colorZ)
    85     {
    86       this->skyColor = Vector(colorX, colorY, colorZ);
    87     }
    88     inline void setFadeTime(float time)
    89     {
    90       this->fadeTime = time;
    91     }
     50  inline void numParticles(int n)
     51  {
     52    this->particles = n;
     53  }
     54  inline void materialTexture(const std::string& texture)
     55  {
     56    this->texture = texture;
     57  }
     58  inline void lifeSpan(float lifeSpan, float randomLifeSpan)
     59  {
     60    this->snowLife = lifeSpan;
     61    this->randomLife = randomLifeSpan;
     62  }
     63  inline void radius(float radius, float randomRadius)
     64  {
     65    this->snowRadius = radius;
     66    this->randomRadius = randomRadius;
     67  }
     68  inline void mass(float mass, float randomMass)
     69  {
     70    this->snowMass = mass;
     71    this->randomMass = randomMass;
     72  }
     73  inline void emissionRate(float emissionRate)
     74  {
     75    this->rate = emissionRate;
     76  }
     77  inline void emissionVelocity(float velocity, float randomVelocity)
     78  {
     79    this->velocity = velocity;
     80    this->randomVelocity = randomVelocity;
     81  }
     82  inline void size(float sizeX, float sizeY)
     83  {
     84    this->snowSize = Vector2D(sizeX, sizeY);
     85  }
     86  inline void coord(float x, float y, float z)
     87  {
     88    this->snowCoord = Vector(x, y, z);
     89  }
     90  inline void wind(int force)
     91  {
     92    this->snowWindForce = force;
     93  }
     94  inline void setCloudColor(float colorX, float colorY, float colorZ)
     95  {
     96    this->cloudColor = Vector(colorX, colorY, colorZ);
     97  }
     98  inline void setSkyColor(float colorX, float colorY, float colorZ)
     99  {
     100    this->skyColor = Vector(colorX, colorY, colorZ);
     101  }
     102  inline void setFadeTime(float time)
     103  {
     104    this->fadeTime = time;
     105  }
    92106
    93     inline void setSnowOption(const std::string& option) {
    94         /*if (option == "fade") this->snowFade = true;*/
    95         if (option == "movesnow")
    96             this->snowMove = true;
    97         if (option == "activate")
    98             this->snowActivate = true;
    99     }
     107  inline void setSnowOption(const std::string& option)
     108  {
     109    /*if (option == "fade") this->snowFade = true;*/
     110    if (option == "movesnow")
     111      this->snowMove = true;
     112    if (option == "activate")
     113      this->snowActivate = true;
     114  }
    100115
    101116
    102117private:
    103     int               particles;
    104     std::string       texture;
    105     float             snowLife, randomLife;
    106     float             snowRadius, randomRadius;
    107     float             snowMass, randomMass;
    108     float             rate;
    109     float             velocity, randomVelocity;
    110     float             angle, randomAngle;
    111     float             alpha;
    112     float             fadeTime;
    113     Vector            snowCoord;
    114     Vector2D          snowSize;
    115     int               snowWindForce;
     118  int               particles;
     119  std::string       texture;
     120  float             snowLife, randomLife;
     121  float             snowRadius, randomRadius;
     122  float             snowMass, randomMass;
     123  float             rate;
     124  float             velocity, randomVelocity;
     125  float             angle, randomAngle;
     126  float             alpha;
     127  float             fadeTime;
     128  Vector            snowCoord;
     129  Vector2D          snowSize;
     130  int               snowWindForce;
    116131
    117     bool              snowMove;
    118     bool              snowActivate;
     132  bool              snowMove;
     133  bool              snowActivate;
    119134
    120     PlaneEmitter*     emitter;
     135  PlaneEmitter*     emitter;
    121136
    122     static SpriteParticles*   snowParticles;
    123     OrxSound::SoundSource     soundSource;
    124     OrxSound::SoundBuffer*    windBuffer;
     137  static SpriteParticles*   snowParticles;
     138  OrxSound::SoundSource     soundSource;
     139  OrxSound::SoundBuffer*    windBuffer;
    125140
    126     Vector            oldSkyColor;
    127     Vector            oldCloudColor;
    128     Vector            skyColor;
    129     Vector            cloudColor;
     141  Vector            oldSkyColor;
     142  Vector            oldCloudColor;
     143  Vector            skyColor;
     144  Vector            cloudColor;
    130145};
    131146
  • branches/new_class_id/src/lib/graphics/effects/volfog_effect.cc

    r9406 r9686  
    4747
    4848
    49 
     49#include "class_id.h"
    5050
    5151CREATE_FACTORY(VolFogEffect, CL_VOLFOG_EFFECT);
     52NewObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT);
    5253
    5354VolFogEffect::VolFogEffect(const TiXmlElement* root) {
    54     this->setClassID(CL_VOLFOG_EFFECT, "VolFogEffect");
     55  this->registerObject(this, VolFogEffect::_objectList);
    5556
    5657    if (root != NULL)
  • branches/new_class_id/src/lib/graphics/effects/volfog_effect.h

    r8495 r9686  
    1111#include "glincl.h"
    1212
    13 class VolFogEffect : public WeatherEffect {
     13class VolFogEffect : public WeatherEffect
     14{
     15  NewObjectListDeclaration(VolFogEffect);
    1416public:
    15     VolFogEffect(const TiXmlElement* root = NULL);
    16     virtual ~VolFogEffect();
     17  VolFogEffect(const TiXmlElement* root = NULL);
     18  virtual ~VolFogEffect();
    1719
    18     virtual void loadParams(const TiXmlElement* root);
     20  virtual void loadParams(const TiXmlElement* root);
    1921
    20     virtual void init();
     22  virtual void init();
    2123
    22     virtual void activate();
    23     virtual void deactivate();
     24  virtual void activate();
     25  virtual void deactivate();
    2426
    25     virtual void draw() const;
    26     virtual void tick(float dt);
     27  virtual void draw() const;
     28  virtual void tick(float dt);
    2729
    2830private:
    29     GLfloat fogColor[4];
     31  GLfloat fogColor[4];
    3032
    3133};
  • branches/new_class_id/src/lib/lang/base_object.cc

    r9684 r9686  
    9595}
    9696
     97
     98/**
     99 * @brief Seeks in the Inheritance if it matches objectList.
     100 * @param objectList The ObjectList this should be a member of (by Pointer-comparison).
     101 * @return True if found, false if not.
     102 */
     103bool BaseObject::isA(const NewClassID& classID) const
     104{
     105  ClassList::const_iterator it;
     106  for (it = this->_classes.begin(); it != this->_classes.end(); ++it)
     107    if (*(*it)._objectList == classID)
     108      return true;
     109  return false;
     110}
     111
    97112/**
    98113 * @brief Seeks in the Inheritance if it matches objectList.
  • branches/new_class_id/src/lib/lang/base_object.h

    r9684 r9686  
    5252
    5353  bool isA(const NewObjectListBase& objectList) const;
     54  bool isA(const NewClassID& classID) const;
    5455  bool isA(int classID) const;
    5556  bool isA(const std::string& className) const;
  • branches/new_class_id/src/lib/lang/new_object_list.h

    r9685 r9686  
    1515
    1616
     17
     18/**
     19 * @brief Use this macro to easily declare a Class to store its own ObjectListDeclaration
     20 * @param ClassName the Name of the Class.
     21 * @note: Using this inside of a Class means, that you loose the member: _objectList, while defining
     22 * two new functions objectList() and classID().
     23 */
    1724#define NewObjectListDeclaration(ClassName) \
    1825  public: \
    19    static const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \
     26   static inline const NewObjectList<ClassName>& objectList() { return ClassName::_objectList; }; \
     27   static inline const NewClassID classID() { return ClassName::_objectList.identity(); }; \
    2028  private: \
    2129   static NewObjectList<ClassName> _objectList
     
    4048
    4149public:
     50  inline const NewClassID& identity() const { return _identity; };
    4251  inline int id() const { return _identity.id(); };
    4352  inline const std::string& name() const { return _identity.name(); };
    4453  bool operator==(int id) const { return _identity == id; };
     54  bool operator==(const NewClassID& id) const { return _identity == id; };
    4555  bool operator==(const std::string& name) const { return _identity == name; };
    4656
  • branches/new_class_id/src/lib/particles/box_emitter.cc

    r9406 r9686  
    2323#include "util/loading/factory.h"
    2424#include "debug.h"
    25 #include "stdlibincl.h"
    2625
    27 
    28 
     26#include "class_id.h"
    2927
    3028CREATE_FACTORY(BoxEmitter, CL_BOX_EMITTER);
    31 
     29NewObjectListDefinitionID(BoxEmitter, CL_BOX_EMITTER);
    3230/**
    3331 *  standard constructor
     
    6866void BoxEmitter::init()
    6967{
    70   this->setClassID(CL_BOX_EMITTER, "BoxEmitter");
     68  this->registerObject(this, BoxEmitter::_objectList);
    7169  this->setSize(1.0f,1.0f,1.0f);
    7270}
     
    103101
    104102    Vector box = this->getAbsCoor() +
    105         xDir * ((float)rand()/RAND_MAX -.5) +
    106         yDir * ((float)rand()/RAND_MAX -.5) +
    107         zDir * ((float)rand()/RAND_MAX -.5);
     103                 xDir * ((float)rand()/RAND_MAX -.5) +
     104                 yDir * ((float)rand()/RAND_MAX -.5) +
     105                 zDir * ((float)rand()/RAND_MAX -.5);
    108106
    109107    // ROTATIONAL CALCULATION (this must not be done for all types of particles.)
  • branches/new_class_id/src/lib/particles/box_emitter.h

    r6826 r9686  
    1919class BoxEmitter : public ParticleEmitter
    2020{
     21  NewObjectListDeclaration(BoxEmitter);
    2122  friend class ParticleSystem;
    2223public:
  • branches/new_class_id/src/lib/particles/dot_emitter.cc

    r9406 r9686  
    2626
    2727
    28 
     28#include "class_id.h"
    2929CREATE_FACTORY(DotEmitter, CL_DOT_EMITTER);
     30NewObjectListDefinitionID(DotEmitter, CL_DOT_EMITTER);
    3031
    3132/**
     
    6667void DotEmitter::init()
    6768{
    68   this->setClassID(CL_DOT_EMITTER, "DotEmitter");
     69  this->registerObject(this, DotEmitter::_objectList);
    6970}
    7071
  • branches/new_class_id/src/lib/particles/dot_emitter.h

    r6825 r9686  
    1212class DotEmitter : public ParticleEmitter
    1313{
     14  NewObjectListDeclaration(DotEmitter);
     15
    1416  friend class ParticleSystem;
    1517public:
  • branches/new_class_id/src/lib/particles/dot_particles.cc

    r9406 r9686  
    2929
    3030CREATE_FACTORY(DotParticles, CL_DOT_PARTICLES);
     31NewObjectListDefinitionID(DotParticles, CL_DOT_PARTICLES);
    3132
    3233SHELL_COMMAND(texture, DotParticles, setMaterialTexture)
     
    6869void DotParticles::init()
    6970{
    70   this->setClassID(CL_DOT_PARTICLES, "DotParticles");
     71  this->registerObject(this, DotParticles::_objectList);
    7172
    7273  this->material.setDiffuseMap("maps/radial-trans-noise.png");
  • branches/new_class_id/src/lib/particles/dot_particles.h

    r7221 r9686  
    1313class DotParticles : public ParticleSystem
    1414{
     15  NewObjectListDeclaration(DotParticles);
    1516
    1617public:
  • branches/new_class_id/src/lib/particles/model_particles.cc

    r9406 r9686  
    2929
    3030CREATE_FACTORY(ModelParticles, CL_MODEL_PARTICLES);
     31NewObjectListDefinitionID(ModelParticles, CL_MODEL_PARTICLES);
    3132
    3233SHELL_COMMAND(texture, ModelParticles, setMaterialTexture)
     
    6869void ModelParticles::init()
    6970{
    70   this->setClassID(CL_MODEL_PARTICLES, "ModelParticles");
     71  this->registerObject(this, ModelParticles::_objectList);
    7172
    7273  this->material.setDiffuseMap("maps/radial-trans-noise.png");
  • branches/new_class_id/src/lib/particles/model_particles.h

    r7221 r9686  
    1313class ModelParticles : public ParticleSystem
    1414{
     15  NewObjectListDeclaration(ModelParticles);
     16
    1517public:
    1618  ModelParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
  • branches/new_class_id/src/lib/particles/particle_emitter.cc

    r9406 r9686  
    2222#include "util/loading/load_param.h"
    2323#include "debug.h"
    24 #include "stdlibincl.h"
    25 
    26 
     24
     25NewObjectListDefinition(ParticleEmitter);
    2726
    2827/**
     
    3130ParticleEmitter::ParticleEmitter(float emissionRate, float velocity, float angle)
    3231{
    33   this->setClassID(CL_PARTICLE_EMITTER, "ParticleEmitter");
     32  this->registerObject(this, ParticleEmitter::_objectList);
    3433
    3534  this->system = NULL;
  • branches/new_class_id/src/lib/particles/particle_emitter.h

    r6825 r9686  
    2323class ParticleEmitter : public PNode
    2424{
     25  NewObjectListDeclaration(ParticleEmitter);
    2526  friend class ParticleSystem;
    2627public:
  • branches/new_class_id/src/lib/particles/particle_system.cc

    r9656 r9686  
    3232#include <algorithm>
    3333
     34NewObjectListDefinition(ParticleSystem);
    3435
    3536/**
     
    4041ParticleSystem::ParticleSystem (unsigned int maxCount)
    4142{
    42   this->setClassID(CL_PARTICLE_SYSTEM, "ParticleSystem");
     43  this->registerObject(this, ParticleSystem::_objectList);
    4344
    4445  this->setMaxCount(PARTICLE_DEFAULT_MAX_COUNT);
     
    134135    if (emitter != NULL)
    135136    {
    136       if (emitter->isA(CL_PARTICLE_EMITTER))
     137      if (emitter->isA(ParticleEmitter::classID()))
    137138        this->addEmitter(dynamic_cast<ParticleEmitter*>(emitter));
    138139      else
  • branches/new_class_id/src/lib/particles/particle_system.h

    r9656 r9686  
    5656//! A class to handle ParticleSystems
    5757class ParticleSystem : public WorldEntity, public PhysicsInterface {
     58  NewObjectListDeclaration(ParticleSystem);
    5859
    5960 public:
  • branches/new_class_id/src/lib/particles/plane_emitter.cc

    r9406 r9686  
    2323#include "util/loading/factory.h"
    2424#include "debug.h"
    25 #include "stdlibincl.h"
    2625
    27 
    28 
     26#include "class_id.h"
    2927
    3028CREATE_FACTORY(PlaneEmitter, CL_PLANE_EMITTER);
     29NewObjectListDefinitionID(PlaneEmitter, CL_PLANE_EMITTER);
    3130
    3231/**
     
    6867void PlaneEmitter::init()
    6968{
    70   this->setClassID(CL_PLANE_EMITTER, "PlaneEmitter");
     69  this->registerObject(this, PlaneEmitter::_objectList);
    7170  this->setSize(1.0f, 1.0f);
    7271}
  • branches/new_class_id/src/lib/particles/plane_emitter.h

    r6873 r9686  
    2121class PlaneEmitter : public ParticleEmitter
    2222{
     23  NewObjectListDeclaration(PlaneEmitter);
     24
    2325  friend class ParticleSystem;
    2426public:
    2527  PlaneEmitter(const Vector2D& size = PLANE_EMITTER_DEFAULT_SIZE,
    26              float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
    27              float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
    28              float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
     28               float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
     29               float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
     30               float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
    2931  PlaneEmitter(const TiXmlElement* root);
    3032  virtual ~PlaneEmitter();
  • branches/new_class_id/src/lib/particles/spark_particles.cc

    r9406 r9686  
    3232
    3333CREATE_FACTORY(SparkParticles, CL_SPARK_PARTICLES);
     34NewObjectListDefinitionID(SparkParticles, CL_SPARK_PARTICLES);
    3435
    3536/**
     
    6768void SparkParticles::init()
    6869{
    69   this->setClassID(CL_SPARK_PARTICLES, "SparkParticles");
     70  this->registerObject(this, SparkParticles::_objectList);
    7071}
    7172
  • branches/new_class_id/src/lib/particles/spark_particles.h

    r6623 r9686  
    1313class SparkParticles : public ParticleSystem
    1414{
     15  NewObjectListDeclaration(SparkParticles);
    1516
    1617public:
  • branches/new_class_id/src/lib/particles/sprite_particles.cc

    r9406 r9686  
    2929
    3030CREATE_FACTORY(SpriteParticles, CL_SPRITE_PARTICLES);
     31NewObjectListDefinitionID(SpriteParticles, CL_SPRITE_PARTICLES);
    3132
    3233SHELL_COMMAND(texture, SpriteParticles, setMaterialTexture)
     
    6869void SpriteParticles::init()
    6970{
    70   this->setClassID(CL_SPRITE_PARTICLES, "SpriteParticles");
     71  this->registerObject(this, SpriteParticles::_objectList);
    7172
    7273  this->material.setDiffuseMap("maps/radial-trans-noise.png");
  • branches/new_class_id/src/lib/particles/sprite_particles.h

    r7221 r9686  
    1313class SpriteParticles : public ParticleSystem
    1414{
     15  NewObjectListDeclaration(SpriteParticles);
    1516
    1617public:
  • branches/new_class_id/src/lib/physics/fields/field.cc

    r9406 r9686  
    2323#include "util/loading/load_param.h"
    2424
     25NewObjectListDefinition(Field);
    2526
    2627/**
    27  * standard constructor
     28 * @brief standard constructor
    2829*/
    2930Field::Field ()
     
    3334
    3435/**
    35  *  standard deconstructor
    36 
    37 */
     36 * @brief standard deconstructor
     37 */
    3838Field::~Field ()
    3939{
     
    4242
    4343/**
    44   \brief initializes a Field
    45 */
     44  * @brief initializes a Field
     45 */
    4646void Field::init()
    4747{
    48   this->setClassID(CL_FIELD, "Field");
     48  this->registerObject(this, Field::_objectList);
    4949  this->setMagnitude(1);
    5050  this->setAttenuation(0);
     
    5454
    5555/**
    56 * @param root The XML-element to load settings from
     56 * @param root The XML-element to load settings from
    5757 */
    5858void Field::loadParams(const TiXmlElement* root)
  • branches/new_class_id/src/lib/physics/fields/field.h

    r6512 r9686  
    1616/*!
    1717 * @file field.h
    18   * abstract definition of a Physical Field
    19 
    20    This is a totally abstract class, that only enables different Physical Fields to
    21    exist on a common Level.
    22 */
     18 * abstract definition of a Physical Field
     19 *
     20 * This is a totally abstract class, that only enables different Physical Fields to
     21 * exist on a common Level.
     22 */
    2323
    2424#ifndef _FIELD_H
     
    3434class Field : public PNode
    3535{
     36  NewObjectListDeclaration(Field);
    3637 public:
    3738  Field();
  • branches/new_class_id/src/lib/physics/fields/gravity.cc

    r9406 r9686  
    2121#include "util/loading/factory.h"
    2222
    23 
     23#include "class_id.h"
     24NewObjectListDefinitionID(Gravity, CL_FIELD_GRAVITY);
    2425
    2526CREATE_FACTORY(Gravity, CL_FIELD_GRAVITY);
     
    2728Gravity::Gravity(const TiXmlElement* root)
    2829{
    29   this->setClassID(CL_FIELD_GRAVITY, "Gravity");
     30  this->registerObject(this, Gravity::_objectList);
    3031
    3132  if (root != NULL)
  • branches/new_class_id/src/lib/physics/fields/gravity.h

    r6512 r9686  
    1616//! A class for ...
    1717class Gravity : public Field {
     18  NewObjectListDeclaration(Gravity);
    1819
    1920 public:
  • branches/new_class_id/src/lib/physics/fields/point_gravity.cc

    r9406 r9686  
    2020
    2121
     22#include "class_id.h"
     23NewObjectListDefinitionID(PointGravity, CL_FIELD_POINT_GRAVITY);
     24
    2225
    2326/**
     
    2730PointGravity::PointGravity ()
    2831{
    29    this->setClassID(CL_FIELD_POINT_GRAVITY, "PointGravity");
     32  this->registerObject(this, PointGravity::_objectList);
    3033}
    3134
  • branches/new_class_id/src/lib/physics/fields/point_gravity.h

    r5405 r9686  
    1 /*! 
     1/*!
    22 * @file point_gravity.h
    33  *  Definition of ...
     
    1616//! A class for ...
    1717class PointGravity : public Field {
     18  NewObjectListDeclaration(PointGravity);
    1819
    1920 public:
  • branches/new_class_id/src/lib/physics/fields/twirl.cc

    r9406 r9686  
    2020
    2121
     22#include "class_id.h"
     23NewObjectListDefinitionID(Twirl, CL_FIELD_TWIRL);
     24
    2225
    2326/**
     
    2730Twirl::Twirl ()
    2831{
    29    this->setClassID(CL_FIELD_TWIRL, "Twirl");
     32  this->registerObject(this, Twirl::_objectList);
    3033}
    3134
  • branches/new_class_id/src/lib/physics/fields/twirl.h

    r5405 r9686  
    1 /*! 
     1/*!
    22 * @file twirl.h
    33  *  Definition of ...
     
    1616//! A class for ...
    1717class Twirl : public Field {
     18  NewObjectListDeclaration(Twirl);
    1819
    1920 public:
  • branches/new_class_id/src/lib/physics/physics_connection.cc

    r9406 r9686  
    2727#include "util/loading/load_param.h"
    2828
    29 
     29#include "class_id.h"
    3030
    3131CREATE_FACTORY(PhysicsConnection, CL_PHYSICS_CONNECTION);
    32 
     32NewObjectListDefinition(PhysicsConnection);
    3333/**
    3434 *  creates a PhysicsConnection
     
    3636PhysicsConnection::PhysicsConnection(PhysicsInterface* subject, Field* field)
    3737{
    38   this->setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");
     38  this->registerObject(this, PhysicsConnection::_objectList);
    3939  this->type = PCON_PhysIField;
    4040
     
    4747PhysicsConnection::PhysicsConnection(const TiXmlElement* root)
    4848{
    49   this->setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");
     49  this->registerObject(this, PhysicsConnection::_objectList);
    5050  this->type = PCON_PhysIField;
    5151
  • branches/new_class_id/src/lib/physics/physics_connection.h

    r7221 r9686  
    2727class PhysicsConnection : public BaseObject
    2828{
    29 
     29  NewObjectListDeclaration(PhysicsConnection);
    3030 public:
    3131  PhysicsConnection(PhysicsInterface* subject, Field* field);
  • branches/new_class_id/src/lib/physics/physics_engine.cc

    r9406 r9686  
    1818#include "physics_engine.h"
    1919
    20 #include "class_list.h"
    2120#include "parser/tinyxml/tinyxml.h"
    2221#include "util/loading/factory.h"
     
    2524
    2625
    27 
    28 /**
    29  * standard constructor
    30 */
     26NewObjectListDefinition(PhysicsEngine);
     27/**
     28 * @brief standard constructor
     29 */
    3130PhysicsEngine::PhysicsEngine()
    3231{
    33   this->setClassID(CL_PHYSICS_ENGINE, "PhysicsEngine");
     32  this->registerObject(this, PhysicsEngine::_objectList);
    3433  this->setName("PhysicsEngine");
    3534  this->interfaces = NULL;
     
    130129PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const std::string& physicsInterfaceName) const
    131130{
    132   BaseObject* interface = ClassList::getObject(physicsInterfaceName, CL_PHYSICS_INTERFACE);
    133   return (interface != NULL)?  dynamic_cast<PhysicsInterface*>(interface) : NULL;
     131  return PhysicsInterface::objectList().getObject(physicsInterfaceName);
    134132}
    135133
     
    223221
    224222  /* actually tick all the PhysicsInterfaces. Move the objects around */
    225   if (this->interfaces != NULL || (this->interfaces = ClassList::getList(CL_PHYSICS_INTERFACE)) != NULL)
    226   {
    227     std::list<BaseObject*>::const_iterator tickPhys;
    228     for (tickPhys = this->interfaces->begin(); tickPhys != this->interfaces->end(); tickPhys++)
    229       dynamic_cast<PhysicsInterface*>(*tickPhys)->tickPhys(dt);
    230   }
     223
     224  NewObjectList<PhysicsInterface>::const_iterator it;
     225  for (it = PhysicsInterface::objectList().begin();
     226       it != PhysicsInterface::objectList().end();
     227       ++it)
     228      (*it)->tickPhys(dt);
    231229}
    232230
  • branches/new_class_id/src/lib/physics/physics_engine.h

    r7221 r9686  
    2020
    2121//! A class, that brings things into motion through Physics.
    22 class PhysicsEngine : public BaseObject {
    23 
    24  public:
     22class PhysicsEngine : public BaseObject
     23{
     24  NewObjectListDeclaration(PhysicsEngine);
     25public:
    2526  virtual ~PhysicsEngine();
    2627  /** @returns a Pointer to the only object of this Class */
     
    4647  void                   debug() const;
    4748
    48  private:
     49private:
    4950  PhysicsEngine();
    5051
    51  private:
     52private:
    5253  static PhysicsEngine*         singletonRef;         //!< the singleton reference of the PhysicsEngine
    5354
  • branches/new_class_id/src/lib/physics/physics_interface.cc

    r9406 r9686  
    3131
    3232
    33 
     33NewObjectListDefinition(PhysicsInterface);
    3434/**
    35  * standard constructor
     35 * @brief standard constructor
    3636 */
    3737PhysicsInterface::PhysicsInterface ()
    3838{
    39   this->setClassID(CL_PHYSICS_INTERFACE, "PhysicsInterface");
     39  this->registerObject(this, PhysicsInterface::_objectList);
    4040
    4141  this->mass = 1;
  • branches/new_class_id/src/lib/physics/physics_interface.h

    r8190 r9686  
    2929class PhysicsInterface : virtual public BaseObject
    3030{
     31  NewObjectListDeclaration(PhysicsInterface);
    3132 public:
    3233  PhysicsInterface();
  • branches/new_class_id/src/lib/script_engine/script_class.h

    r9685 r9686  
    3030
    3131  bool operator==(const std::string& name) { return (this->getName() == name); }
    32   bool operator==(ClassID classID) { return (this->_classID == classID); }
     32  bool operator==(NewClassID classID) { return (this->_classID == classID); }
    3333
    3434  virtual void registerClass(Script* script) = 0;
     
    3939
    4040protected:
    41   ScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods);
     41  ScriptClass(const std::string& name, NewClassID classID, ScriptMethod* scriptMethods);
    4242
    4343private:
    44   ClassID             _classID;
     44  const NewClassID&   _classID;
    4545  ScriptMethod*       _scriptMethods;
    4646};
     
    5353{
    5454public:
    55   tScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods)
     55  tScriptClass(const std::string& name, NewClassID classID, ScriptMethod* scriptMethods)
    5656      : ScriptClass(name, classID, scriptMethods)
    5757  { }
  • branches/new_class_id/src/lib/sound/ogg_player.cc

    r9406 r9686  
    4949namespace OrxSound
    5050{
     51  NewObjectListDefinition(OggPlayer);
    5152  /**
    5253   * initializes an Ogg-player from a file
     
    5556  OggPlayer::OggPlayer(const std::string& fileName)
    5657  {
    57     this->setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");
     58    this->registerObject(this, OggPlayer::_objectList);
    5859
    5960    this->state = OggPlayer::None;
  • branches/new_class_id/src/lib/sound/ogg_player.h

    r9019 r9686  
    2525  class OggPlayer : public BaseObject
    2626  {
     27    NewObjectListDeclaration(OggPlayer);
     28
    2729  public:
    2830    /**
  • branches/new_class_id/src/lib/sound/sound_buffer.cc

    r8971 r9686  
    3535namespace OrxSound
    3636{
     37  NewObjectListDefinition(SoundBuffer);
    3738  //////////////////
    3839  /* SOUND-BUFFER */
     
    4445  SoundBuffer::SoundBuffer(const std::string& fileName)
    4546  {
    46     this->setClassID(CL_SOUND_BUFFER, "SoundBuffer");
     47    this->registerObject(this, SoundBuffer::_objectList);
    4748    this->setName(fileName);
    4849
  • branches/new_class_id/src/lib/sound/sound_buffer.h

    r8969 r9686  
    1818  class SoundBuffer : public BaseObject
    1919  {
     20    NewObjectListDeclaration(SoundBuffer);
    2021  public:
    2122    SoundBuffer(const std::string& fileName);
  • branches/new_class_id/src/lib/sound/sound_engine.cc

    r9235 r9686  
    2020
    2121#include "sound_engine.h"
    22 
    23 #include "class_list.h"
    2422
    2523#include "p_node.h"
     
    3129namespace OrxSound
    3230{
    33 
     31  NewObjectListDefinition(SoundEngine);
    3432  //////////////////
    3533  /* SOUND-ENGINE */
     
    4038  SoundEngine::SoundEngine ()
    4139  {
    42     this->setClassID(CL_SOUND_ENGINE, "SoundEngine");
     40    this->registerObject(this, SoundEngine::_objectList);
    4341    this->setName("SoundEngine");
    4442
    4543    this->listener = NULL;
    46     this->bufferList = NULL;
    47     this->sourceList = NULL;
    4844
    4945    this->device = NULL;
     
    6965  {
    7066    // deleting all the SoundSources
    71     if(this->sourceList != NULL)
    72     {
    73       while (this->sourceList->size() > 0)
    74         delete static_cast<SoundSource*>(this->sourceList->front());
    75     }
     67    while (!SoundSource::objectList().empty())
     68      delete (SoundSource::objectList().front());
    7669
    7770    while(!this->ALSources.empty())
     
    8982
    9083    // deleting all the SoundBuffers
    91     if (this->bufferList != NULL)
    92     {
    93       while(this->bufferList->size() > 0)
    94         ResourceManager::getInstance()->unload(static_cast<SoundBuffer*>(this->bufferList->front()));
    95     }
     84    while(!SoundBuffer::objectList().empty())
     85      ResourceManager::getInstance()->unload(SoundBuffer::objectList().front());
    9686
    9787    // removing openAL from AudioResource
     
    212202
    213203    // updating all the Sources positions
    214     if (likely(this->sourceList != NULL || (this->sourceList = ClassList::getList(CL_SOUND_SOURCE)) != NULL))
    215     {
    216       std::list<BaseObject*>::const_iterator sourceIT;
    217       SoundSource* source;
    218       for (sourceIT = this->sourceList->begin(); sourceIT != this->sourceList->end(); sourceIT++)
     204    NewObjectList<SoundSource>::const_iterator sourceIT;
     205    for (sourceIT = SoundSource::objectList().begin();
     206         sourceIT != SoundSource::objectList().end();
     207         sourceIT++)
     208    {
     209      if ((*sourceIT)->isPlaying())
    219210      {
    220         source = static_cast<SoundSource*>(*sourceIT);
    221         if (source->isPlaying())
     211        int play = 0x000;
     212        alGetSourcei((*sourceIT)->getID(), AL_SOURCE_STATE, &play);
     213        if (DEBUG_LEVEL > 2)
     214          SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
     215        if(play == AL_PLAYING)
    222216        {
    223           int play = 0x000;
    224           alGetSourcei(source->getID(), AL_SOURCE_STATE, &play);
    225           if (DEBUG_LEVEL > 2)
    226             SoundEngine::checkError("SoundEngine::update() Play", __LINE__);
    227           if(play == AL_PLAYING)
     217          if (likely((*sourceIT)->getNode() != NULL))
    228218          {
    229             if (likely(source->getNode() != NULL))
    230             {
    231               alSource3f(source->getID(), AL_POSITION,
    232                          source->getNode()->getAbsCoor().x,
    233                          source->getNode()->getAbsCoor().y,
    234                          source->getNode()->getAbsCoor().z);
    235               if (DEBUG_LEVEL > 2)
    236                 SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
    237               alSource3f(source->getID(), AL_VELOCITY,
    238                          source->getNode()->getVelocity().x,
    239                          source->getNode()->getVelocity().y,
    240                          source->getNode()->getVelocity().z);
    241               if (DEBUG_LEVEL > 2)
    242                 SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
    243             }
     219            alSource3f((*sourceIT)->getID(), AL_POSITION,
     220                       (*sourceIT)->getNode()->getAbsCoor().x,
     221                       (*sourceIT)->getNode()->getAbsCoor().y,
     222                       (*sourceIT)->getNode()->getAbsCoor().z);
     223            if (DEBUG_LEVEL > 2)
     224              SoundEngine::checkError("SoundEngine::update() Set Source Position", __LINE__);
     225            alSource3f((*sourceIT)->getID(), AL_VELOCITY,
     226                       (*sourceIT)->getNode()->getVelocity().x,
     227                       (*sourceIT)->getNode()->getVelocity().y,
     228                       (*sourceIT)->getNode()->getVelocity().z);
     229            if (DEBUG_LEVEL > 2)
     230              SoundEngine::checkError("SoundEngine::update() Set Source Velocity", __LINE__);
    244231          }
    245           else
    246           {
    247             source->stop();
    248           }
     232        }
     233        else
     234        {
     235          (*sourceIT)->stop();
    249236        }
    250237      }
     
    393380      default:
    394381      case AL_NO_ERROR:
    395         return ("AL_NO_ERROR");
     382      return ("AL_NO_ERROR");
    396383      case AL_INVALID_NAME:
    397         return ("AL_INVALID_NAME");
     384      return ("AL_INVALID_NAME");
    398385      case AL_INVALID_ENUM:
    399         return ("AL_INVALID_ENUM");
     386      return ("AL_INVALID_ENUM");
    400387      case AL_INVALID_VALUE:
    401         return ("AL_INVALID_VALUE");
     388      return ("AL_INVALID_VALUE");
    402389      case AL_INVALID_OPERATION:
    403         return ("AL_INVALID_OPERATION");
     390      return ("AL_INVALID_OPERATION");
    404391      case AL_OUT_OF_MEMORY:
    405         return ("AL_OUT_OF_MEMORY");
     392      return ("AL_OUT_OF_MEMORY");
    406393    };
    407394  }
     
    414401      default:
    415402      case ALC_NO_ERROR:
    416         return ("AL_NO_ERROR");
     403      return ("AL_NO_ERROR");
    417404      case ALC_INVALID_DEVICE:
    418         return ("ALC_INVALID_DEVICE");
     405      return ("ALC_INVALID_DEVICE");
    419406      case ALC_INVALID_CONTEXT:
    420         return("ALC_INVALID_CONTEXT");
     407      return("ALC_INVALID_CONTEXT");
    421408      case ALC_INVALID_ENUM:
    422         return("ALC_INVALID_ENUM");
     409      return("ALC_INVALID_ENUM");
    423410      case ALC_INVALID_VALUE:
    424         return ("ALC_INVALID_VALUE");
     411      return ("ALC_INVALID_VALUE");
    425412      case ALC_OUT_OF_MEMORY:
    426         return("ALC_OUT_OF_MEMORY");
     413      return("ALC_OUT_OF_MEMORY");
    427414    };
    428415  }
  • branches/new_class_id/src/lib/sound/sound_engine.h

    r7847 r9686  
    2727  class SoundEngine : public BaseObject
    2828  {
    29   public:
     29    NewObjectListDeclaration(SoundEngine);
     30    public:
    3031    virtual ~SoundEngine();
    3132    /** @returns a Pointer to the only object of this Class */
     
    7576    const PNode*                   listener;                 //!< The listener of the Scene
    7677
    77     const std::list<BaseObject*>*  bufferList;               //!< A list of buffers
    78     const std::list<BaseObject*>*  sourceList;               //!< A list for all the sources in the scene.
    79 
    8078    unsigned int                   maxSourceCount;           //!< How many Sources is the Maximum
    8179    std::stack<ALuint>             ALSources;                //!< A list of real openAL-Sources, the engine allocates, and stores for reuse.
  • branches/new_class_id/src/lib/sound/sound_source.cc

    r8969 r9686  
    2525namespace OrxSound
    2626{
     27  NewObjectListDefinition(SoundSource);
    2728  /**
    2829  * @brief creates a SoundSource at position sourceNode with the SoundBuffer buffer
     
    3031  SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer)
    3132  {
    32     this->setClassID(CL_SOUND_SOURCE, "SoundSource");
    33 
     33    this->registerObject(this, SoundSource::_objectList);
    3434    // adding the Source to the SourcesList of the SoundEngine
    3535    this->buffer = buffer;
     
    5151  SoundSource::SoundSource(const SoundSource& source)
    5252  {
    53     this->setClassID(CL_SOUND_SOURCE, "SoundSource");
     53    this->registerObject(this, SoundSource::_objectList);
    5454
    5555    // adding the Source to the SourcesList of the SoundEngine
  • branches/new_class_id/src/lib/sound/sound_source.h

    r8793 r9686  
    1818  class SoundSource : public BaseObject
    1919  {
     20    NewObjectListDeclaration(SoundSource);
    2021  public:
    2122    SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL);
  • branches/new_class_id/src/lib/util/loading/factory.cc

    r9684 r9686  
    2929 */
    3030Factory::Factory (const std::string& factoryName, int classID)
    31     : classID(classID), className(factoryName)
     31    : _classID(classID), _className(factoryName)
    3232{
    3333  this->registerObject(this, Factory::_objectList);
    3434  this->setName(factoryName);
    3535
    36   if( Factory::factoryList == NULL)
    37     Factory::factoryList = new std::list<Factory*>;
     36  if( Factory::_factoryList == NULL)
     37    Factory::_factoryList = new std::list<Factory*>;
    3838
    39   Factory::factoryList->push_back(this);
     39  Factory::_factoryList->push_back(this);
    4040}
    4141
    4242/** @brief a reference to the First Factory */
    43 std::list<Factory*>* Factory::factoryList = NULL;
     43std::list<Factory*>* Factory::_factoryList = NULL;
    4444
    4545/**
     
    5858void Factory::deleteFactories()
    5959{
    60   if (Factory::factoryList != NULL)
     60  if (Factory::_factoryList != NULL)
    6161  {
    62     while(!Factory::factoryList->empty())
     62    while(!Factory::_factoryList->empty())
    6363    {
    64       delete Factory::factoryList->front();
    65       Factory::factoryList->pop_front();
     64      delete Factory::_factoryList->front();
     65      Factory::_factoryList->pop_front();
    6666    }
    67     delete Factory::factoryList;
    68     Factory::factoryList = NULL;
     67    delete Factory::_factoryList;
     68    Factory::_factoryList = NULL;
    6969  }
    7070}
     
    7676bool Factory::operator==(int classID) const
    7777{
    78   return (this->classID == classID);
     78  return (this->_classID == classID);
    7979}
    8080
     
    8686bool Factory::operator==(const char* className) const
    8787{
    88   return (className != NULL && this->className == className);
     88  return (className != NULL && this->_className == className);
    8989}
    9090
     
    9696bool Factory::operator==(const std::string& className) const
    9797{
    98   return (this->className == className);
     98  return (this->_className == className);
    9999}
    100100
     
    107107BaseObject* Factory::fabricate(const TiXmlElement* root)
    108108{
    109   assert (root != NULL && Factory::factoryList != NULL);
     109  assert (root != NULL && Factory::_factoryList != NULL);
    110110
    111111  std::list<Factory*>::const_iterator factory;
    112   for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
     112  for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++)
    113113    if (*(*factory) == root->Value())
    114114    {
     
    129129BaseObject* Factory::fabricate(const std::string& className)
    130130{
    131   if (Factory::factoryList == NULL)
     131  if (Factory::_factoryList == NULL)
    132132    return NULL;
    133133
    134134  std::list<Factory*>::const_iterator factory;
    135   for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
     135  for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++)
    136136    if (*(*factory) == className)
    137137    {
     
    151151BaseObject* Factory::fabricate(int classID)
    152152{
    153   if (Factory::factoryList == NULL)
     153  if (Factory::_factoryList == NULL)
    154154    return NULL;
    155155
    156156  std::list<Factory*>::const_iterator factory;
    157   for (factory = Factory::factoryList->begin(); factory != Factory::factoryList->end(); factory++)
     157  for (factory = Factory::_factoryList->begin(); factory != Factory::_factoryList->end(); factory++)
    158158    if (*(*factory) == classID)
    159159    {
  • branches/new_class_id/src/lib/util/loading/factory.h

    r9684 r9686  
    6060
    6161protected:
    62   const int                     classID;              //!< The Class-Identifyer of the Factory.
    63   const std::string             className;            //!< The name of the Class.
    64   static std::list<Factory*>*   factoryList;          //!< List of Registered Factories
     62  const int                     _classID;              //!< The Class-Identifyer of the Factory.
     63  const std::string             _className;            //!< The name of the Class.
     64  static std::list<Factory*>*   _factoryList;          //!< List of Registered Factories
    6565};
    6666
Note: See TracChangeset for help on using the changeset viewer.