Changeset 9686 in orxonox.OLD for branches/new_class_id/src
- Timestamp:
- Aug 22, 2006, 2:36:54 PM (18 years ago)
- 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 28 28 #include <algorithm> 29 29 30 31 NewObjectListDefinition(EventHandler); 30 32 /** 31 33 * @brief standard constructor … … 33 35 EventHandler::EventHandler () 34 36 { 35 this-> setClassID(CL_EVENT_HANDLER, "EventHandler");37 this->registerObject(this, EventHandler::_objectList); 36 38 this->setName("EventHandler"); 37 39 -
branches/new_class_id/src/lib/event/event_handler.h
r8743 r9686 21 21 class EventHandler : public BaseObject 22 22 { 23 23 NewObjectListDeclaration(EventHandler); 24 24 public: 25 25 virtual ~EventHandler(); -
branches/new_class_id/src/lib/event/event_listener.cc
r7868 r9686 19 19 #include "event_handler.h" 20 20 21 NewObjectListDefinition(EventListener); 21 22 /** 22 23 * @brief standard constructor … … 24 25 EventListener::EventListener () 25 26 { 26 this-> setClassID(CL_EVENT_LISTENER, "EventListener");27 this->registerObject(this, EventListener::_objectList); 27 28 } 28 29 -
branches/new_class_id/src/lib/event/event_listener.h
r7868 r9686 12 12 13 13 //! A class for event listener 14 class EventListener : virtual public BaseObject { 15 16 public: 14 class EventListener : virtual public BaseObject 15 { 16 NewObjectListDeclaration(EventListener); 17 public: 17 18 EventListener(); 18 19 virtual ~EventListener(); -
branches/new_class_id/src/lib/event/key_mapper.cc
r9406 r9686 32 32 33 33 34 34 NewObjectListDefinition(KeyMapper); 35 35 36 36 /* initialize all variables to a reasonable value*/ … … 116 116 KeyMapper::KeyMapper () 117 117 { 118 this->setClassID(CL_KEY_MAPPER, "KeyMapper");118 this->registerObject(this, KeyMapper::_objectList); 119 119 } 120 120 -
branches/new_class_id/src/lib/event/key_mapper.h
r8724 r9686 16 16 class KeyMapper : public BaseObject 17 17 { 18 NewObjectListDeclaration(KeyMapper); 18 19 public: 19 20 //! A mapping from key-name to key-id -
branches/new_class_id/src/lib/graphics/effects/cloud_effect.cc
r9406 r9686 29 29 #include "script_class.h" 30 30 31 #include " parser/tinyxml/tinyxml.h"31 #include "class_id.h" 32 32 33 33 Vector CloudEffect::cloudColor; … … 48 48 49 49 50 CREATE_SCRIPTABLE_CLASS(CloudEffect, C L_CLOUD_EFFECT,50 CREATE_SCRIPTABLE_CLASS(CloudEffect, CloudEffect::classID(), 51 51 addMethod("skyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor)) 52 52 ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor)) … … 57 57 58 58 CREATE_FACTORY(CloudEffect, CL_CLOUD_EFFECT); 59 NewObjectListDefinitionID(CloudEffect, CL_CLOUD_EFFECT); 59 60 60 61 CloudEffect::CloudEffect(const TiXmlElement* root) { 61 this->setClassID(CL_CLOUD_EFFECT, "CloudEffect");62 this->registerObject(this, CloudEffect::_objectList); 62 63 63 64 this->init(); -
branches/new_class_id/src/lib/graphics/effects/cloud_effect.h
r9112 r9686 37 37 38 38 class CloudEffect : public WeatherEffect { 39 NewObjectListDeclaration(CloudEffect); 39 40 40 41 public: -
branches/new_class_id/src/lib/graphics/effects/fog_effect.cc
r9406 r9686 28 28 SHELL_COMMAND(fadeout, FogEffect, fadeOutFog); 29 29 30 31 32 CREATE_SCRIPTABLE_CLASS(FogEffect, CL_FOG_EFFECT,30 #include "class_id.h" 31 32 CREATE_SCRIPTABLE_CLASS(FogEffect, FogEffect::classID(), 33 33 addMethod("fadeIn", ExecutorLua0<FogEffect>(&FogEffect::fadeInFog)) 34 34 ->addMethod("fadeOut", ExecutorLua0<FogEffect>(&FogEffect::fadeOutFog)) … … 38 38 39 39 CREATE_FACTORY(FogEffect, CL_FOG_EFFECT); 40 NewObjectListDefinition(FogEffect); 40 41 41 42 /** … … 43 44 */ 44 45 FogEffect::FogEffect(const TiXmlElement* root) { 45 this->setClassID(CL_FOG_EFFECT, "FogEffect"); 46 46 this->registerObject(this, FogEffect::_objectList); 47 47 // Initialize values 48 48 this->init(); … … 85 85 this->fogFadeInActivate = false; 86 86 this->fogFadeOutActivate = false; 87 87 88 88 this->cloudColor = Vector(0.2f, 0.3f, 0.3f); 89 89 this->skyColor = Vector(0.2f, 0.3f, 0.3f); … … 105 105 LoadParam(root, "cloudcolor", this, FogEffect, setCloudColor); 106 106 LoadParam(root, "skycolor", this, FogEffect, setSkyColor); 107 107 108 108 LOAD_PARAM_START_CYCLE(root, element); 109 109 { … … 131 131 132 132 glEnable(GL_FOG); 133 133 134 134 // Store cloud- and sky color before the snow 135 135 this->oldCloudColor = CloudEffect::cloudColor; 136 136 this->oldSkyColor = CloudEffect::skyColor; 137 137 138 138 // Change the colors 139 139 CloudEffect::changeCloudColor(this->cloudColor, this->fogFadeInDuration); … … 241 241 this->fogFadeInActivate = false; 242 242 243 243 244 244 // If Fog is off, turn it on first 245 245 if (!this->fogActivate) -
branches/new_class_id/src/lib/graphics/effects/fog_effect.h
r9235 r9686 15 15 class FogEffect : public WeatherEffect 16 16 { 17 NewObjectListDeclaration(FogEffect); 17 18 public: 18 19 FogEffect(const TiXmlElement* root = NULL); … … 75 76 this->fogActivate = true; 76 77 } 77 78 78 79 inline void setCloudColor(float colorX, float colorY, float colorZ) 79 80 { … … 119 120 120 121 Vector colorVector; 121 float localTimer; 122 122 float localTimer; 123 123 124 Vector oldSkyColor; 124 125 Vector oldCloudColor; -
branches/new_class_id/src/lib/graphics/effects/lense_flare.cc
r9406 r9686 33 33 #include "camera.h" 34 34 35 36 37 35 #include "class_id.h" 38 36 39 37 CREATE_FACTORY(LenseFlare, CL_LENSE_FLARE); 40 38 NewObjectListDefinitionID(LenseFlare, CL_LENSE_FLARE); 41 39 42 40 /** … … 45 43 */ 46 44 LenseFlare::LenseFlare(const TiXmlElement* root) { 47 this->setClassID(CL_LENSE_FLARE, "LenseFlare");45 this->registerObject(this, LenseFlare::_objectList); 48 46 49 47 /* length image scale */ -
branches/new_class_id/src/lib/graphics/effects/lense_flare.h
r8619 r9686 26 26 class LenseFlare : public GraphicsEffect 27 27 { 28 NewObjectListDeclaration(LenseFlare); 28 29 public: 29 30 LenseFlare(const TiXmlElement* root = NULL); -
branches/new_class_id/src/lib/graphics/effects/lightning_effect.cc
r9406 r9686 23 23 #include "effects/billboard.h" 24 24 25 #include "glincl.h"26 #include "parser/tinyxml/tinyxml.h"27 28 25 #include "shell_command.h" 29 26 #include "light.h" 30 27 #include "cloud_effect.h" 31 28 #include "script_class.h" 29 #include "class_id.h" 32 30 33 31 SHELL_COMMAND(activate, LightningEffect, activateLightning); 34 32 SHELL_COMMAND(deactivate, LightningEffect, deactivateLightning); 35 33 36 37 38 CREATE_SCRIPTABLE_CLASS(LightningEffect, CL_LIGHTNING_EFFECT, 34 CREATE_SCRIPTABLE_CLASS(LightningEffect, LightningEffect::classID(), 39 35 addMethod("activate", ExecutorLua0<LightningEffect>(&LightningEffect::activate)) 40 36 ->addMethod("deactivate", ExecutorLua0<LightningEffect>(&LightningEffect::deactivate)) … … 42 38 43 39 CREATE_FACTORY(LightningEffect, CL_LIGHTNING_EFFECT); 40 NewObjectListDefinitionID(LightningEffect, CL_LIGHTNING_EFFECT); 44 41 45 42 LightningEffect::LightningEffect(const TiXmlElement* root) { 46 this->setClassID(CL_LIGHTNING_EFFECT, "LightningEffect"); 47 43 this->registerObject(this, LightningEffect::_objectList); 48 44 this->init(); 49 45 -
branches/new_class_id/src/lib/graphics/effects/lightning_effect.h
r9006 r9686 17 17 class Light; 18 18 19 class LightningEffect : public WeatherEffect { 19 class LightningEffect : public WeatherEffect 20 { 21 NewObjectListDeclaration(LightningEffect); 20 22 public: 21 22 23 LightningEffect(const TiXmlElement* root = NULL); 24 virtual ~LightningEffect(); 23 25 24 26 virtual void loadParams(const TiXmlElement* root); 25 27 26 28 virtual void init(); 27 29 28 29 30 virtual void activate(); 31 virtual void deactivate(); 30 32 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 } 37 41 38 42 virtual void tick(float dt); 39 43 40 41 44 void coord(float x, float y, float z); 45 void setFlashSize(float width, float height, float seedWidth, float seedHeight); 42 46 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 } 49 54 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 } 55 61 56 inline void setFlashConstTime(float holdTime) { 57 this->flashHoldTime = holdTime; 58 } 62 inline void setFlashConstTime(float holdTime) 63 { 64 this->flashHoldTime = holdTime; 65 } 59 66 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 } 66 74 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 } 71 80 72 81 73 82 private: 74 83 75 76 77 84 void newCoordinates(); 85 void setTexture(); 86 void switchTexture(); 78 87 79 80 88 Billboard* thunderBolt[4]; 89 bool thunderTextureA; 81 90 82 83 91 bool lightningActivate; 92 bool lightningMove; 84 93 85 86 87 88 94 float flashFrequency; 95 float flashFrequencyBase; 96 float flashHoldTime; 97 float flashRisingTime; 89 98 90 99 float time; 91 100 92 93 94 95 101 float width; 102 float height; 103 float seedWidth; 104 float seedHeight; 96 105 97 98 99 106 float seedX; 107 float seedZ; 108 float flashFrequencySeed; 100 109 101 102 103 110 float mainPosX; 111 float mainPosY; 112 float mainPosZ; 104 113 105 106 114 Vector origSkyColor; 115 Vector cameraCoor; 107 116 108 117 Light* flashLight; 109 118 110 111 119 OrxSound::SoundSource soundSource; 120 OrxSound::SoundBuffer* thunderBuffer; 112 121 113 122 }; -
branches/new_class_id/src/lib/graphics/effects/rain_effect.cc
r9406 r9686 31 31 #include "script_class.h" 32 32 33 #include " parser/tinyxml/tinyxml.h"33 #include "class_id.h" 34 34 35 35 // Define shell commands … … 41 41 42 42 43 CREATE_SCRIPTABLE_CLASS(RainEffect, CL_RAIN_EFFECT,43 CREATE_SCRIPTABLE_CLASS(RainEffect, RainEffect::classID(), 44 44 addMethod("startRaining", ExecutorLua0<RainEffect>(&RainEffect::startRaining)) 45 45 ->addMethod("stopRaining", ExecutorLua0<RainEffect>(&RainEffect::stopRaining)) … … 49 49 50 50 CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT); 51 NewObjectListDefinitionID(RainEffect, CL_RAIN_EFFECT); 51 52 52 53 /** … … 54 55 */ 55 56 RainEffect::RainEffect(const TiXmlElement* root) { 56 this->setClassID(CL_RAIN_EFFECT, "RainEffect"); 57 57 this->registerObject(this, RainEffect::_objectList); 58 58 this->init(); 59 59 -
branches/new_class_id/src/lib/graphics/effects/rain_effect.h
r9235 r9686 25 25 class RainEffect : public WeatherEffect 26 26 { 27 NewObjectListDeclaration(RainEffect); 27 28 public: 28 29 RainEffect(const TiXmlElement* root = NULL); … … 136 137 Vector skyColor; 137 138 Vector cloudColor; 138 139 139 140 LightManager* lightMan; 140 141 -
branches/new_class_id/src/lib/graphics/effects/snow_effect.cc
r9406 r9686 30 30 #include "cloud_effect.h" 31 31 32 #include " parser/tinyxml/tinyxml.h"32 #include "class_id.h" 33 33 34 34 SHELL_COMMAND(activate, SnowEffect, activateSnow); … … 36 36 37 37 38 CREATE_SCRIPTABLE_CLASS(SnowEffect, CL_SNOW_EFFECT,38 CREATE_SCRIPTABLE_CLASS(SnowEffect, SnowEffect::classID(), 39 39 addMethod("activate", ExecutorLua0<SnowEffect>(&SnowEffect::activate)) 40 40 ->addMethod("deactivate", ExecutorLua0<SnowEffect>(&SnowEffect::deactivate)) … … 42 42 43 43 CREATE_FACTORY(SnowEffect, CL_SNOW_EFFECT); 44 NewObjectListDefinitionID(SnowEffect, CL_SNOW_EFFECT); 44 45 45 46 SnowEffect::SnowEffect(const TiXmlElement* root) 46 47 { 47 this->setClassID(CL_SNOW_EFFECT, "SnowEffect");48 this->registerObject(this, SnowEffect::_objectList); 48 49 49 50 this->init(); -
branches/new_class_id/src/lib/graphics/effects/snow_effect.h
r9406 r9686 21 21 #include "sound_buffer.h" 22 22 23 class SnowEffect : public WeatherEffect { 23 class SnowEffect : public WeatherEffect 24 { 25 NewObjectListDeclaration(SnowEffect); 24 26 public: 25 26 27 SnowEffect(const TiXmlElement* root = NULL); 28 virtual ~SnowEffect(); 27 29 28 30 virtual void loadParams(const TiXmlElement* root); 29 31 30 32 virtual void init(); 31 33 32 33 34 virtual void activate(); 35 virtual void deactivate(); 34 36 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 } 41 45 42 43 46 virtual void draw() const; 47 virtual void tick(float dt); 44 48 45 49 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 } 92 106 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 } 100 115 101 116 102 117 private: 103 104 105 106 107 108 109 110 111 112 113 114 115 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; 116 131 117 118 132 bool snowMove; 133 bool snowActivate; 119 134 120 135 PlaneEmitter* emitter; 121 136 122 123 124 137 static SpriteParticles* snowParticles; 138 OrxSound::SoundSource soundSource; 139 OrxSound::SoundBuffer* windBuffer; 125 140 126 127 128 129 141 Vector oldSkyColor; 142 Vector oldCloudColor; 143 Vector skyColor; 144 Vector cloudColor; 130 145 }; 131 146 -
branches/new_class_id/src/lib/graphics/effects/volfog_effect.cc
r9406 r9686 47 47 48 48 49 49 #include "class_id.h" 50 50 51 51 CREATE_FACTORY(VolFogEffect, CL_VOLFOG_EFFECT); 52 NewObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT); 52 53 53 54 VolFogEffect::VolFogEffect(const TiXmlElement* root) { 54 this->setClassID(CL_VOLFOG_EFFECT, "VolFogEffect");55 this->registerObject(this, VolFogEffect::_objectList); 55 56 56 57 if (root != NULL) -
branches/new_class_id/src/lib/graphics/effects/volfog_effect.h
r8495 r9686 11 11 #include "glincl.h" 12 12 13 class VolFogEffect : public WeatherEffect { 13 class VolFogEffect : public WeatherEffect 14 { 15 NewObjectListDeclaration(VolFogEffect); 14 16 public: 15 16 17 VolFogEffect(const TiXmlElement* root = NULL); 18 virtual ~VolFogEffect(); 17 19 18 20 virtual void loadParams(const TiXmlElement* root); 19 21 20 22 virtual void init(); 21 23 22 23 24 virtual void activate(); 25 virtual void deactivate(); 24 26 25 26 27 virtual void draw() const; 28 virtual void tick(float dt); 27 29 28 30 private: 29 31 GLfloat fogColor[4]; 30 32 31 33 }; -
branches/new_class_id/src/lib/lang/base_object.cc
r9684 r9686 95 95 } 96 96 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 */ 103 bool 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 97 112 /** 98 113 * @brief Seeks in the Inheritance if it matches objectList. -
branches/new_class_id/src/lib/lang/base_object.h
r9684 r9686 52 52 53 53 bool isA(const NewObjectListBase& objectList) const; 54 bool isA(const NewClassID& classID) const; 54 55 bool isA(int classID) const; 55 56 bool isA(const std::string& className) const; -
branches/new_class_id/src/lib/lang/new_object_list.h
r9685 r9686 15 15 16 16 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 */ 17 24 #define NewObjectListDeclaration(ClassName) \ 18 25 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(); }; \ 20 28 private: \ 21 29 static NewObjectList<ClassName> _objectList … … 40 48 41 49 public: 50 inline const NewClassID& identity() const { return _identity; }; 42 51 inline int id() const { return _identity.id(); }; 43 52 inline const std::string& name() const { return _identity.name(); }; 44 53 bool operator==(int id) const { return _identity == id; }; 54 bool operator==(const NewClassID& id) const { return _identity == id; }; 45 55 bool operator==(const std::string& name) const { return _identity == name; }; 46 56 -
branches/new_class_id/src/lib/particles/box_emitter.cc
r9406 r9686 23 23 #include "util/loading/factory.h" 24 24 #include "debug.h" 25 #include "stdlibincl.h"26 25 27 28 26 #include "class_id.h" 29 27 30 28 CREATE_FACTORY(BoxEmitter, CL_BOX_EMITTER); 31 29 NewObjectListDefinitionID(BoxEmitter, CL_BOX_EMITTER); 32 30 /** 33 31 * standard constructor … … 68 66 void BoxEmitter::init() 69 67 { 70 this-> setClassID(CL_BOX_EMITTER, "BoxEmitter");68 this->registerObject(this, BoxEmitter::_objectList); 71 69 this->setSize(1.0f,1.0f,1.0f); 72 70 } … … 103 101 104 102 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); 108 106 109 107 // ROTATIONAL CALCULATION (this must not be done for all types of particles.) -
branches/new_class_id/src/lib/particles/box_emitter.h
r6826 r9686 19 19 class BoxEmitter : public ParticleEmitter 20 20 { 21 NewObjectListDeclaration(BoxEmitter); 21 22 friend class ParticleSystem; 22 23 public: -
branches/new_class_id/src/lib/particles/dot_emitter.cc
r9406 r9686 26 26 27 27 28 28 #include "class_id.h" 29 29 CREATE_FACTORY(DotEmitter, CL_DOT_EMITTER); 30 NewObjectListDefinitionID(DotEmitter, CL_DOT_EMITTER); 30 31 31 32 /** … … 66 67 void DotEmitter::init() 67 68 { 68 this-> setClassID(CL_DOT_EMITTER, "DotEmitter");69 this->registerObject(this, DotEmitter::_objectList); 69 70 } 70 71 -
branches/new_class_id/src/lib/particles/dot_emitter.h
r6825 r9686 12 12 class DotEmitter : public ParticleEmitter 13 13 { 14 NewObjectListDeclaration(DotEmitter); 15 14 16 friend class ParticleSystem; 15 17 public: -
branches/new_class_id/src/lib/particles/dot_particles.cc
r9406 r9686 29 29 30 30 CREATE_FACTORY(DotParticles, CL_DOT_PARTICLES); 31 NewObjectListDefinitionID(DotParticles, CL_DOT_PARTICLES); 31 32 32 33 SHELL_COMMAND(texture, DotParticles, setMaterialTexture) … … 68 69 void DotParticles::init() 69 70 { 70 this-> setClassID(CL_DOT_PARTICLES, "DotParticles");71 this->registerObject(this, DotParticles::_objectList); 71 72 72 73 this->material.setDiffuseMap("maps/radial-trans-noise.png"); -
branches/new_class_id/src/lib/particles/dot_particles.h
r7221 r9686 13 13 class DotParticles : public ParticleSystem 14 14 { 15 NewObjectListDeclaration(DotParticles); 15 16 16 17 public: -
branches/new_class_id/src/lib/particles/model_particles.cc
r9406 r9686 29 29 30 30 CREATE_FACTORY(ModelParticles, CL_MODEL_PARTICLES); 31 NewObjectListDefinitionID(ModelParticles, CL_MODEL_PARTICLES); 31 32 32 33 SHELL_COMMAND(texture, ModelParticles, setMaterialTexture) … … 68 69 void ModelParticles::init() 69 70 { 70 this-> setClassID(CL_MODEL_PARTICLES, "ModelParticles");71 this->registerObject(this, ModelParticles::_objectList); 71 72 72 73 this->material.setDiffuseMap("maps/radial-trans-noise.png"); -
branches/new_class_id/src/lib/particles/model_particles.h
r7221 r9686 13 13 class ModelParticles : public ParticleSystem 14 14 { 15 NewObjectListDeclaration(ModelParticles); 16 15 17 public: 16 18 ModelParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT); -
branches/new_class_id/src/lib/particles/particle_emitter.cc
r9406 r9686 22 22 #include "util/loading/load_param.h" 23 23 #include "debug.h" 24 #include "stdlibincl.h" 25 26 24 25 NewObjectListDefinition(ParticleEmitter); 27 26 28 27 /** … … 31 30 ParticleEmitter::ParticleEmitter(float emissionRate, float velocity, float angle) 32 31 { 33 this-> setClassID(CL_PARTICLE_EMITTER, "ParticleEmitter");32 this->registerObject(this, ParticleEmitter::_objectList); 34 33 35 34 this->system = NULL; -
branches/new_class_id/src/lib/particles/particle_emitter.h
r6825 r9686 23 23 class ParticleEmitter : public PNode 24 24 { 25 NewObjectListDeclaration(ParticleEmitter); 25 26 friend class ParticleSystem; 26 27 public: -
branches/new_class_id/src/lib/particles/particle_system.cc
r9656 r9686 32 32 #include <algorithm> 33 33 34 NewObjectListDefinition(ParticleSystem); 34 35 35 36 /** … … 40 41 ParticleSystem::ParticleSystem (unsigned int maxCount) 41 42 { 42 this-> setClassID(CL_PARTICLE_SYSTEM, "ParticleSystem");43 this->registerObject(this, ParticleSystem::_objectList); 43 44 44 45 this->setMaxCount(PARTICLE_DEFAULT_MAX_COUNT); … … 134 135 if (emitter != NULL) 135 136 { 136 if (emitter->isA( CL_PARTICLE_EMITTER))137 if (emitter->isA(ParticleEmitter::classID())) 137 138 this->addEmitter(dynamic_cast<ParticleEmitter*>(emitter)); 138 139 else -
branches/new_class_id/src/lib/particles/particle_system.h
r9656 r9686 56 56 //! A class to handle ParticleSystems 57 57 class ParticleSystem : public WorldEntity, public PhysicsInterface { 58 NewObjectListDeclaration(ParticleSystem); 58 59 59 60 public: -
branches/new_class_id/src/lib/particles/plane_emitter.cc
r9406 r9686 23 23 #include "util/loading/factory.h" 24 24 #include "debug.h" 25 #include "stdlibincl.h"26 25 27 28 26 #include "class_id.h" 29 27 30 28 CREATE_FACTORY(PlaneEmitter, CL_PLANE_EMITTER); 29 NewObjectListDefinitionID(PlaneEmitter, CL_PLANE_EMITTER); 31 30 32 31 /** … … 68 67 void PlaneEmitter::init() 69 68 { 70 this-> setClassID(CL_PLANE_EMITTER, "PlaneEmitter");69 this->registerObject(this, PlaneEmitter::_objectList); 71 70 this->setSize(1.0f, 1.0f); 72 71 } -
branches/new_class_id/src/lib/particles/plane_emitter.h
r6873 r9686 21 21 class PlaneEmitter : public ParticleEmitter 22 22 { 23 NewObjectListDeclaration(PlaneEmitter); 24 23 25 friend class ParticleSystem; 24 26 public: 25 27 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); 29 31 PlaneEmitter(const TiXmlElement* root); 30 32 virtual ~PlaneEmitter(); -
branches/new_class_id/src/lib/particles/spark_particles.cc
r9406 r9686 32 32 33 33 CREATE_FACTORY(SparkParticles, CL_SPARK_PARTICLES); 34 NewObjectListDefinitionID(SparkParticles, CL_SPARK_PARTICLES); 34 35 35 36 /** … … 67 68 void SparkParticles::init() 68 69 { 69 this-> setClassID(CL_SPARK_PARTICLES, "SparkParticles");70 this->registerObject(this, SparkParticles::_objectList); 70 71 } 71 72 -
branches/new_class_id/src/lib/particles/spark_particles.h
r6623 r9686 13 13 class SparkParticles : public ParticleSystem 14 14 { 15 NewObjectListDeclaration(SparkParticles); 15 16 16 17 public: -
branches/new_class_id/src/lib/particles/sprite_particles.cc
r9406 r9686 29 29 30 30 CREATE_FACTORY(SpriteParticles, CL_SPRITE_PARTICLES); 31 NewObjectListDefinitionID(SpriteParticles, CL_SPRITE_PARTICLES); 31 32 32 33 SHELL_COMMAND(texture, SpriteParticles, setMaterialTexture) … … 68 69 void SpriteParticles::init() 69 70 { 70 this-> setClassID(CL_SPRITE_PARTICLES, "SpriteParticles");71 this->registerObject(this, SpriteParticles::_objectList); 71 72 72 73 this->material.setDiffuseMap("maps/radial-trans-noise.png"); -
branches/new_class_id/src/lib/particles/sprite_particles.h
r7221 r9686 13 13 class SpriteParticles : public ParticleSystem 14 14 { 15 NewObjectListDeclaration(SpriteParticles); 15 16 16 17 public: -
branches/new_class_id/src/lib/physics/fields/field.cc
r9406 r9686 23 23 #include "util/loading/load_param.h" 24 24 25 NewObjectListDefinition(Field); 25 26 26 27 /** 27 * standard constructor28 * @brief standard constructor 28 29 */ 29 30 Field::Field () … … 33 34 34 35 /** 35 * standard deconstructor 36 37 */ 36 * @brief standard deconstructor 37 */ 38 38 Field::~Field () 39 39 { … … 42 42 43 43 /** 44 \brief initializes a Field45 */44 * @brief initializes a Field 45 */ 46 46 void Field::init() 47 47 { 48 this-> setClassID(CL_FIELD, "Field");48 this->registerObject(this, Field::_objectList); 49 49 this->setMagnitude(1); 50 50 this->setAttenuation(0); … … 54 54 55 55 /** 56 * @param root The XML-element to load settings from56 * @param root The XML-element to load settings from 57 57 */ 58 58 void Field::loadParams(const TiXmlElement* root) -
branches/new_class_id/src/lib/physics/fields/field.h
r6512 r9686 16 16 /*! 17 17 * @file field.h 18 *abstract definition of a Physical Field19 20 21 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 */ 23 23 24 24 #ifndef _FIELD_H … … 34 34 class Field : public PNode 35 35 { 36 NewObjectListDeclaration(Field); 36 37 public: 37 38 Field(); -
branches/new_class_id/src/lib/physics/fields/gravity.cc
r9406 r9686 21 21 #include "util/loading/factory.h" 22 22 23 23 #include "class_id.h" 24 NewObjectListDefinitionID(Gravity, CL_FIELD_GRAVITY); 24 25 25 26 CREATE_FACTORY(Gravity, CL_FIELD_GRAVITY); … … 27 28 Gravity::Gravity(const TiXmlElement* root) 28 29 { 29 this-> setClassID(CL_FIELD_GRAVITY, "Gravity");30 this->registerObject(this, Gravity::_objectList); 30 31 31 32 if (root != NULL) -
branches/new_class_id/src/lib/physics/fields/gravity.h
r6512 r9686 16 16 //! A class for ... 17 17 class Gravity : public Field { 18 NewObjectListDeclaration(Gravity); 18 19 19 20 public: -
branches/new_class_id/src/lib/physics/fields/point_gravity.cc
r9406 r9686 20 20 21 21 22 #include "class_id.h" 23 NewObjectListDefinitionID(PointGravity, CL_FIELD_POINT_GRAVITY); 24 22 25 23 26 /** … … 27 30 PointGravity::PointGravity () 28 31 { 29 this->setClassID(CL_FIELD_POINT_GRAVITY, "PointGravity");32 this->registerObject(this, PointGravity::_objectList); 30 33 } 31 34 -
branches/new_class_id/src/lib/physics/fields/point_gravity.h
r5405 r9686 1 /*! 1 /*! 2 2 * @file point_gravity.h 3 3 * Definition of ... … … 16 16 //! A class for ... 17 17 class PointGravity : public Field { 18 NewObjectListDeclaration(PointGravity); 18 19 19 20 public: -
branches/new_class_id/src/lib/physics/fields/twirl.cc
r9406 r9686 20 20 21 21 22 #include "class_id.h" 23 NewObjectListDefinitionID(Twirl, CL_FIELD_TWIRL); 24 22 25 23 26 /** … … 27 30 Twirl::Twirl () 28 31 { 29 this->setClassID(CL_FIELD_TWIRL, "Twirl");32 this->registerObject(this, Twirl::_objectList); 30 33 } 31 34 -
branches/new_class_id/src/lib/physics/fields/twirl.h
r5405 r9686 1 /*! 1 /*! 2 2 * @file twirl.h 3 3 * Definition of ... … … 16 16 //! A class for ... 17 17 class Twirl : public Field { 18 NewObjectListDeclaration(Twirl); 18 19 19 20 public: -
branches/new_class_id/src/lib/physics/physics_connection.cc
r9406 r9686 27 27 #include "util/loading/load_param.h" 28 28 29 29 #include "class_id.h" 30 30 31 31 CREATE_FACTORY(PhysicsConnection, CL_PHYSICS_CONNECTION); 32 32 NewObjectListDefinition(PhysicsConnection); 33 33 /** 34 34 * creates a PhysicsConnection … … 36 36 PhysicsConnection::PhysicsConnection(PhysicsInterface* subject, Field* field) 37 37 { 38 this-> setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");38 this->registerObject(this, PhysicsConnection::_objectList); 39 39 this->type = PCON_PhysIField; 40 40 … … 47 47 PhysicsConnection::PhysicsConnection(const TiXmlElement* root) 48 48 { 49 this-> setClassID(CL_PHYSICS_CONNECTION, "PhysicsConnection");49 this->registerObject(this, PhysicsConnection::_objectList); 50 50 this->type = PCON_PhysIField; 51 51 -
branches/new_class_id/src/lib/physics/physics_connection.h
r7221 r9686 27 27 class PhysicsConnection : public BaseObject 28 28 { 29 29 NewObjectListDeclaration(PhysicsConnection); 30 30 public: 31 31 PhysicsConnection(PhysicsInterface* subject, Field* field); -
branches/new_class_id/src/lib/physics/physics_engine.cc
r9406 r9686 18 18 #include "physics_engine.h" 19 19 20 #include "class_list.h"21 20 #include "parser/tinyxml/tinyxml.h" 22 21 #include "util/loading/factory.h" … … 25 24 26 25 27 28 /** 29 * standard constructor30 */26 NewObjectListDefinition(PhysicsEngine); 27 /** 28 * @brief standard constructor 29 */ 31 30 PhysicsEngine::PhysicsEngine() 32 31 { 33 this-> setClassID(CL_PHYSICS_ENGINE, "PhysicsEngine");32 this->registerObject(this, PhysicsEngine::_objectList); 34 33 this->setName("PhysicsEngine"); 35 34 this->interfaces = NULL; … … 130 129 PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const std::string& physicsInterfaceName) const 131 130 { 132 BaseObject* interface = ClassList::getObject(physicsInterfaceName, CL_PHYSICS_INTERFACE); 133 return (interface != NULL)? dynamic_cast<PhysicsInterface*>(interface) : NULL; 131 return PhysicsInterface::objectList().getObject(physicsInterfaceName); 134 132 } 135 133 … … 223 221 224 222 /* 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); 231 229 } 232 230 -
branches/new_class_id/src/lib/physics/physics_engine.h
r7221 r9686 20 20 21 21 //! A class, that brings things into motion through Physics. 22 class PhysicsEngine : public BaseObject { 23 24 public: 22 class PhysicsEngine : public BaseObject 23 { 24 NewObjectListDeclaration(PhysicsEngine); 25 public: 25 26 virtual ~PhysicsEngine(); 26 27 /** @returns a Pointer to the only object of this Class */ … … 46 47 void debug() const; 47 48 48 49 private: 49 50 PhysicsEngine(); 50 51 51 52 private: 52 53 static PhysicsEngine* singletonRef; //!< the singleton reference of the PhysicsEngine 53 54 -
branches/new_class_id/src/lib/physics/physics_interface.cc
r9406 r9686 31 31 32 32 33 33 NewObjectListDefinition(PhysicsInterface); 34 34 /** 35 * standard constructor35 * @brief standard constructor 36 36 */ 37 37 PhysicsInterface::PhysicsInterface () 38 38 { 39 this-> setClassID(CL_PHYSICS_INTERFACE, "PhysicsInterface");39 this->registerObject(this, PhysicsInterface::_objectList); 40 40 41 41 this->mass = 1; -
branches/new_class_id/src/lib/physics/physics_interface.h
r8190 r9686 29 29 class PhysicsInterface : virtual public BaseObject 30 30 { 31 NewObjectListDeclaration(PhysicsInterface); 31 32 public: 32 33 PhysicsInterface(); -
branches/new_class_id/src/lib/script_engine/script_class.h
r9685 r9686 30 30 31 31 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); } 33 33 34 34 virtual void registerClass(Script* script) = 0; … … 39 39 40 40 protected: 41 ScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods);41 ScriptClass(const std::string& name, NewClassID classID, ScriptMethod* scriptMethods); 42 42 43 43 private: 44 ClassID_classID;44 const NewClassID& _classID; 45 45 ScriptMethod* _scriptMethods; 46 46 }; … … 53 53 { 54 54 public: 55 tScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods)55 tScriptClass(const std::string& name, NewClassID classID, ScriptMethod* scriptMethods) 56 56 : ScriptClass(name, classID, scriptMethods) 57 57 { } -
branches/new_class_id/src/lib/sound/ogg_player.cc
r9406 r9686 49 49 namespace OrxSound 50 50 { 51 NewObjectListDefinition(OggPlayer); 51 52 /** 52 53 * initializes an Ogg-player from a file … … 55 56 OggPlayer::OggPlayer(const std::string& fileName) 56 57 { 57 this-> setClassID(CL_SOUND_OGG_PLAYER, "OggPlayer");58 this->registerObject(this, OggPlayer::_objectList); 58 59 59 60 this->state = OggPlayer::None; -
branches/new_class_id/src/lib/sound/ogg_player.h
r9019 r9686 25 25 class OggPlayer : public BaseObject 26 26 { 27 NewObjectListDeclaration(OggPlayer); 28 27 29 public: 28 30 /** -
branches/new_class_id/src/lib/sound/sound_buffer.cc
r8971 r9686 35 35 namespace OrxSound 36 36 { 37 NewObjectListDefinition(SoundBuffer); 37 38 ////////////////// 38 39 /* SOUND-BUFFER */ … … 44 45 SoundBuffer::SoundBuffer(const std::string& fileName) 45 46 { 46 this-> setClassID(CL_SOUND_BUFFER, "SoundBuffer");47 this->registerObject(this, SoundBuffer::_objectList); 47 48 this->setName(fileName); 48 49 -
branches/new_class_id/src/lib/sound/sound_buffer.h
r8969 r9686 18 18 class SoundBuffer : public BaseObject 19 19 { 20 NewObjectListDeclaration(SoundBuffer); 20 21 public: 21 22 SoundBuffer(const std::string& fileName); -
branches/new_class_id/src/lib/sound/sound_engine.cc
r9235 r9686 20 20 21 21 #include "sound_engine.h" 22 23 #include "class_list.h"24 22 25 23 #include "p_node.h" … … 31 29 namespace OrxSound 32 30 { 33 31 NewObjectListDefinition(SoundEngine); 34 32 ////////////////// 35 33 /* SOUND-ENGINE */ … … 40 38 SoundEngine::SoundEngine () 41 39 { 42 this-> setClassID(CL_SOUND_ENGINE, "SoundEngine");40 this->registerObject(this, SoundEngine::_objectList); 43 41 this->setName("SoundEngine"); 44 42 45 43 this->listener = NULL; 46 this->bufferList = NULL;47 this->sourceList = NULL;48 44 49 45 this->device = NULL; … … 69 65 { 70 66 // 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()); 76 69 77 70 while(!this->ALSources.empty()) … … 89 82 90 83 // 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()); 96 86 97 87 // removing openAL from AudioResource … … 212 202 213 203 // 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()) 219 210 { 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) 222 216 { 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)) 228 218 { 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__); 244 231 } 245 else246 {247 source->stop();248 }232 } 233 else 234 { 235 (*sourceIT)->stop(); 249 236 } 250 237 } … … 393 380 default: 394 381 case AL_NO_ERROR: 395 382 return ("AL_NO_ERROR"); 396 383 case AL_INVALID_NAME: 397 384 return ("AL_INVALID_NAME"); 398 385 case AL_INVALID_ENUM: 399 386 return ("AL_INVALID_ENUM"); 400 387 case AL_INVALID_VALUE: 401 388 return ("AL_INVALID_VALUE"); 402 389 case AL_INVALID_OPERATION: 403 390 return ("AL_INVALID_OPERATION"); 404 391 case AL_OUT_OF_MEMORY: 405 392 return ("AL_OUT_OF_MEMORY"); 406 393 }; 407 394 } … … 414 401 default: 415 402 case ALC_NO_ERROR: 416 403 return ("AL_NO_ERROR"); 417 404 case ALC_INVALID_DEVICE: 418 405 return ("ALC_INVALID_DEVICE"); 419 406 case ALC_INVALID_CONTEXT: 420 407 return("ALC_INVALID_CONTEXT"); 421 408 case ALC_INVALID_ENUM: 422 409 return("ALC_INVALID_ENUM"); 423 410 case ALC_INVALID_VALUE: 424 411 return ("ALC_INVALID_VALUE"); 425 412 case ALC_OUT_OF_MEMORY: 426 413 return("ALC_OUT_OF_MEMORY"); 427 414 }; 428 415 } -
branches/new_class_id/src/lib/sound/sound_engine.h
r7847 r9686 27 27 class SoundEngine : public BaseObject 28 28 { 29 public: 29 NewObjectListDeclaration(SoundEngine); 30 public: 30 31 virtual ~SoundEngine(); 31 32 /** @returns a Pointer to the only object of this Class */ … … 75 76 const PNode* listener; //!< The listener of the Scene 76 77 77 const std::list<BaseObject*>* bufferList; //!< A list of buffers78 const std::list<BaseObject*>* sourceList; //!< A list for all the sources in the scene.79 80 78 unsigned int maxSourceCount; //!< How many Sources is the Maximum 81 79 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 25 25 namespace OrxSound 26 26 { 27 NewObjectListDefinition(SoundSource); 27 28 /** 28 29 * @brief creates a SoundSource at position sourceNode with the SoundBuffer buffer … … 30 31 SoundSource::SoundSource(const PNode* sourceNode, const SoundBuffer* buffer) 31 32 { 32 this->setClassID(CL_SOUND_SOURCE, "SoundSource"); 33 33 this->registerObject(this, SoundSource::_objectList); 34 34 // adding the Source to the SourcesList of the SoundEngine 35 35 this->buffer = buffer; … … 51 51 SoundSource::SoundSource(const SoundSource& source) 52 52 { 53 this-> setClassID(CL_SOUND_SOURCE, "SoundSource");53 this->registerObject(this, SoundSource::_objectList); 54 54 55 55 // adding the Source to the SourcesList of the SoundEngine -
branches/new_class_id/src/lib/sound/sound_source.h
r8793 r9686 18 18 class SoundSource : public BaseObject 19 19 { 20 NewObjectListDeclaration(SoundSource); 20 21 public: 21 22 SoundSource(const PNode* sourceNode = NULL, const SoundBuffer* buffer = NULL); -
branches/new_class_id/src/lib/util/loading/factory.cc
r9684 r9686 29 29 */ 30 30 Factory::Factory (const std::string& factoryName, int classID) 31 : classID(classID),className(factoryName)31 : _classID(classID), _className(factoryName) 32 32 { 33 33 this->registerObject(this, Factory::_objectList); 34 34 this->setName(factoryName); 35 35 36 if( Factory:: factoryList == NULL)37 Factory:: factoryList = new std::list<Factory*>;36 if( Factory::_factoryList == NULL) 37 Factory::_factoryList = new std::list<Factory*>; 38 38 39 Factory:: factoryList->push_back(this);39 Factory::_factoryList->push_back(this); 40 40 } 41 41 42 42 /** @brief a reference to the First Factory */ 43 std::list<Factory*>* Factory:: factoryList = NULL;43 std::list<Factory*>* Factory::_factoryList = NULL; 44 44 45 45 /** … … 58 58 void Factory::deleteFactories() 59 59 { 60 if (Factory:: factoryList != NULL)60 if (Factory::_factoryList != NULL) 61 61 { 62 while(!Factory:: factoryList->empty())62 while(!Factory::_factoryList->empty()) 63 63 { 64 delete Factory:: factoryList->front();65 Factory:: factoryList->pop_front();64 delete Factory::_factoryList->front(); 65 Factory::_factoryList->pop_front(); 66 66 } 67 delete Factory:: factoryList;68 Factory:: factoryList = NULL;67 delete Factory::_factoryList; 68 Factory::_factoryList = NULL; 69 69 } 70 70 } … … 76 76 bool Factory::operator==(int classID) const 77 77 { 78 return (this-> classID == classID);78 return (this->_classID == classID); 79 79 } 80 80 … … 86 86 bool Factory::operator==(const char* className) const 87 87 { 88 return (className != NULL && this-> className == className);88 return (className != NULL && this->_className == className); 89 89 } 90 90 … … 96 96 bool Factory::operator==(const std::string& className) const 97 97 { 98 return (this-> className == className);98 return (this->_className == className); 99 99 } 100 100 … … 107 107 BaseObject* Factory::fabricate(const TiXmlElement* root) 108 108 { 109 assert (root != NULL && Factory:: factoryList != NULL);109 assert (root != NULL && Factory::_factoryList != NULL); 110 110 111 111 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++) 113 113 if (*(*factory) == root->Value()) 114 114 { … … 129 129 BaseObject* Factory::fabricate(const std::string& className) 130 130 { 131 if (Factory:: factoryList == NULL)131 if (Factory::_factoryList == NULL) 132 132 return NULL; 133 133 134 134 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++) 136 136 if (*(*factory) == className) 137 137 { … … 151 151 BaseObject* Factory::fabricate(int classID) 152 152 { 153 if (Factory:: factoryList == NULL)153 if (Factory::_factoryList == NULL) 154 154 return NULL; 155 155 156 156 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++) 158 158 if (*(*factory) == classID) 159 159 { -
branches/new_class_id/src/lib/util/loading/factory.h
r9684 r9686 60 60 61 61 protected: 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 Factories62 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 65 65 }; 66 66
Note: See TracChangeset
for help on using the changeset viewer.