Changeset 9685 in orxonox.OLD for branches/new_class_id/src/lib/graphics/effects
- Timestamp:
- Aug 22, 2006, 1:16:23 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/graphics/effects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/effects/atmospheric_engine.cc
r9406 r9685 22 22 #include "util/loading/load_param.h" 23 23 #include "util/loading/factory.h" 24 #include "class_list.h"25 24 26 27 25 NewObjectListDefinition(AtmosphericEngine); 28 26 29 27 /** 30 28 * @param root The XML-element to load the AtmosphericEngine from 31 29 */ 32 AtmosphericEngine::AtmosphericEngine() { 33 this->setClassID(CL_ATMOSPHERIC_ENGINE, "AtmosphericEngine"); 30 AtmosphericEngine::AtmosphericEngine() 31 { 32 this->registerObject(this, AtmosphericEngine::_objectList); 34 33 } 35 34 … … 43 42 * destroys a AtmosphericEngine 44 43 */ 45 AtmosphericEngine::~AtmosphericEngine() { 46 AtmosphericEngine::singletonRef = NULL; 44 AtmosphericEngine::~AtmosphericEngine() 45 { 46 AtmosphericEngine::singletonRef = NULL; 47 47 48 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 49 50 if (weatherEffects != NULL) { 51 while(!weatherEffects->empty()) 52 delete weatherEffects->front(); 53 } 48 while(!WeatherEffect::objectList().empty()) 49 delete WeatherEffect::objectList().front(); 54 50 } 55 51 … … 57 53 * @param root The XML-element to load the AtmosphericEngine from 58 54 */ 59 void AtmosphericEngine::loadParams(const TiXmlElement* root) { 60 LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect); 61 LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect); 55 void AtmosphericEngine::loadParams(const TiXmlElement* root) 56 { 57 LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect); 58 LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect); 62 59 } 63 60 … … 65 62 * @param root The XML-element to load WeatherEffects from 66 63 */ 67 void AtmosphericEngine::loadWeatherEffect(const TiXmlElement* root) { 68 LOAD_PARAM_START_CYCLE(root, element); 69 { 70 PRINTF(4)("element is: %s\n", element->Value()); 71 // Factory::fabricate(element); 64 void AtmosphericEngine::loadWeatherEffect(const TiXmlElement* root) 65 { 66 LOAD_PARAM_START_CYCLE(root, element); 67 { 68 PRINTF(4)("element is: %s\n", element->Value()); 69 // Factory::fabricate(element); 72 70 73 74 75 76 77 71 BaseObject* bo = Factory::fabricate(element); 72 if( bo == NULL) 73 PRINTF(0)(" Could not create Element %s\n", element->Value()); 74 } 75 LOAD_PARAM_END_CYCLE(element); 78 76 } 79 77 … … 81 79 * @param root The XML-element to load SunEffects from 82 80 */ 83 void AtmosphericEngine::loadSunEffect(const TiXmlElement* root) { 84 LOAD_PARAM_START_CYCLE(root, element); 85 { 86 PRINTF(4)("element is: %s\n", element->Value()); 87 } 88 LOAD_PARAM_END_CYCLE(element); 81 void AtmosphericEngine::loadSunEffect(const TiXmlElement* root) 82 { 83 LOAD_PARAM_START_CYCLE(root, element); 84 { 85 PRINTF(4)("element is: %s\n", element->Value()); 86 } 87 LOAD_PARAM_END_CYCLE(element); 89 88 } 90 89 … … 93 92 * draws the effect, if needed 94 93 */ 95 void AtmosphericEngine::draw() const { 96 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 97 98 // draw the weather effects 99 if (weatherEffects != NULL) { 100 std::list<BaseObject*>::const_iterator it; 101 for (it = weatherEffects->begin(); it != weatherEffects->end(); it++) 102 dynamic_cast<WeatherEffect*>(*it)->draw(); 103 } 94 void AtmosphericEngine::draw() const 95 { 96 for (NewObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin(); 97 it != WeatherEffect::objectList().end(); 98 ++it) 99 (*it)->draw(); 104 100 } 105 101 … … 109 105 * ticks the effect if there is any time dependancy 110 106 */ 111 void AtmosphericEngine::tick(float dt) {112 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 107 void AtmosphericEngine::tick(float dt) 108 { 113 109 114 // tick the weather effects 115 if (weatherEffects != NULL) { 116 std::list<BaseObject*>::const_iterator it; 117 for (it = weatherEffects->begin(); it != weatherEffects->end(); it++) { 118 /* printf("%s::%s \n", (*it)->getClassCName(), (*it)->getName());*/ 119 dynamic_cast<WeatherEffect*>(*it)->tick(dt); 120 } 121 } 110 for (NewObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin(); 111 it != WeatherEffect::objectList().end(); 112 ++it) 113 (*it)->tick(dt); 122 114 } -
branches/new_class_id/src/lib/graphics/effects/atmospheric_engine.h
r7810 r9685 1 1 /*! 2 2 * @file atmospheric_engine.h 3 * 3 * 4 4 */ 5 5 … … 14 14 class AtmosphericEngine : public BaseObject 15 15 { 16 NewObjectListDeclaration(AtmosphericEngine); 16 17 public: 17 18 ~AtmosphericEngine(); -
branches/new_class_id/src/lib/graphics/effects/graphics_effect.cc
r9406 r9685 22 22 #include "util/loading/load_param.h" 23 23 24 25 26 27 24 NewObjectListDefinition(GraphicsEffect); 28 25 29 26 /** … … 33 30 */ 34 31 GraphicsEffect::GraphicsEffect(const TiXmlElement* root) { 35 this->setClassID(CL_GRAPHICS_EFFECT, "GraphicsEffect");32 this->registerObject(this, GraphicsEffect::_objectList); 36 33 this->bActivated = false; 37 34 } -
branches/new_class_id/src/lib/graphics/effects/graphics_effect.h
r8495 r9685 13 13 //! A class that handles GraphicsEffects. The GraphicsEffectManager operates on this. 14 14 class GraphicsEffect : public BaseObject { 15 public: 15 NewObjectListDeclaration(GraphicsEffect); 16 public: 16 17 GraphicsEffect(const TiXmlElement* root = NULL); 17 18 virtual ~GraphicsEffect(); -
branches/new_class_id/src/lib/graphics/effects/weather_effect.cc
r9406 r9685 20 20 #include "util/loading/load_param.h" 21 21 22 23 24 22 NewObjectListDefinition(WeatherEffect); 25 23 26 24 /** … … 29 27 WeatherEffect::WeatherEffect(const TiXmlElement* root) 30 28 { 31 this-> setClassID(CL_WEATHER_EFFECT, "WeatherEffect");29 this->registerObject(this, WeatherEffect::_objectList); 32 30 this->bActivated = false; 33 31 } -
branches/new_class_id/src/lib/graphics/effects/weather_effect.h
r8495 r9685 12 12 class WeatherEffect : public BaseObject 13 13 { 14 NewObjectListDeclaration(WeatherEffect); 15 14 16 public: 15 17 WeatherEffect(const TiXmlElement* root = NULL);
Note: See TracChangeset
for help on using the changeset viewer.