Changeset 8457 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects/atmospheric_engine.cc
- Timestamp:
- Jun 15, 2006, 1:43:24 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/atmospheric_engine.cc
r8190 r8457 30 30 * @param root The XML-element to load the AtmosphericEngine from 31 31 */ 32 AtmosphericEngine::AtmosphericEngine() 33 { 34 this->setClassID(CL_ATMOSPHERIC_ENGINE, "AtmosphericEngine"); 32 AtmosphericEngine::AtmosphericEngine() { 33 this->setClassID(CL_ATMOSPHERIC_ENGINE, "AtmosphericEngine"); 35 34 } 36 35 … … 44 43 * destroys a AtmosphericEngine 45 44 */ 46 AtmosphericEngine::~AtmosphericEngine() 47 { 48 AtmosphericEngine::singletonRef = NULL; 45 AtmosphericEngine::~AtmosphericEngine() { 46 AtmosphericEngine::singletonRef = NULL; 49 47 50 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT);48 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 51 49 52 if (weatherEffects != NULL) 53 { 54 while(!weatherEffects->empty()) 55 delete weatherEffects->front(); 56 } 50 if (weatherEffects != NULL) { 51 while(!weatherEffects->empty()) 52 delete weatherEffects->front(); 53 } 57 54 } 58 55 … … 60 57 * @param root The XML-element to load the AtmosphericEngine from 61 58 */ 62 void AtmosphericEngine::loadParams(const TiXmlElement* root) 63 { 64 LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect); 65 LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect); 59 void AtmosphericEngine::loadParams(const TiXmlElement* root) { 60 LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect); 61 LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect); 66 62 } 67 63 … … 69 65 * @param root The XML-element to load WeatherEffects from 70 66 */ 71 void AtmosphericEngine::loadWeatherEffect(const TiXmlElement* root) 72 { 73 LOAD_PARAM_START_CYCLE(root, element); 74 { 75 PRINTF(4)("element is: %s\n", element->Value()); 76 // Factory::fabricate(element); 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); 77 72 78 BaseObject* bo = Factory::fabricate(element);79 if( bo == NULL)80 PRINTF(0)(" Could not create Element %s\n", element->Value());81 }82 LOAD_PARAM_END_CYCLE(element);73 BaseObject* bo = Factory::fabricate(element); 74 if( bo == NULL) 75 PRINTF(0)(" Could not create Element %s\n", element->Value()); 76 } 77 LOAD_PARAM_END_CYCLE(element); 83 78 } 84 79 … … 86 81 * @param root The XML-element to load SunEffects from 87 82 */ 88 void AtmosphericEngine::loadSunEffect(const TiXmlElement* root) 89 { 90 LOAD_PARAM_START_CYCLE(root, element); 91 { 92 PRINTF(4)("element is: %s\n", element->Value()); 93 } 94 LOAD_PARAM_END_CYCLE(element); 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); 95 89 } 96 90 … … 99 93 * draws the effect, if needed 100 94 */ 101 void AtmosphericEngine::draw() const 102 { 103 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 95 void AtmosphericEngine::draw() const { 96 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 104 97 105 // draw the weather effects 106 if (weatherEffects != NULL) 107 { 108 std::list<BaseObject*>::const_iterator it; 109 for (it = weatherEffects->begin(); it != weatherEffects->end(); it++) 110 dynamic_cast<WeatherEffect*>(*it)->draw(); 111 } 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 } 112 104 } 113 105 … … 117 109 * ticks the effect if there is any time dependancy 118 110 */ 119 void AtmosphericEngine::tick(float dt) 120 { 121 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 111 void AtmosphericEngine::tick(float dt) { 112 const std::list<BaseObject*>* weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); 122 113 123 // tick the weather effects 124 if (weatherEffects != NULL) 125 { 126 std::list<BaseObject*>::const_iterator it; 127 for (it = weatherEffects->begin(); it != weatherEffects->end(); it++) 128 { 129 /* printf("%s::%s \n", (*it)->getClassName(), (*it)->getName());*/ 130 dynamic_cast<WeatherEffect*>(*it)->tick(dt); 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)->getClassName(), (*it)->getName());*/ 119 dynamic_cast<WeatherEffect*>(*it)->tick(dt); 120 } 131 121 } 132 }133 122 }
Note: See TracChangeset
for help on using the changeset viewer.