[7379] | 1 | /* |
---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: Andreas Maechler, David Hasenfratz |
---|
| 13 | co-programmer: ... |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #include "atmospheric_engine.h" |
---|
| 17 | |
---|
| 18 | #include "util/loading/resource_manager.h" |
---|
| 19 | |
---|
| 20 | #include "effects/fog_effect.h" |
---|
| 21 | |
---|
| 22 | #include "util/loading/load_param.h" |
---|
| 23 | #include "util/loading/factory.h" |
---|
| 24 | #include "class_list.h" |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | using namespace std; |
---|
| 28 | |
---|
| 29 | /** |
---|
| 30 | * @param root The XML-element to load the AtmosphericEngine from |
---|
| 31 | */ |
---|
| 32 | AtmosphericEngine::AtmosphericEngine() |
---|
| 33 | { |
---|
[7416] | 34 | this->setClassID(CL_ATMOSPHERIC_ENGINE, "AtmosphericEngine"); |
---|
[7392] | 35 | // this->bActivated = false; |
---|
[7379] | 36 | } |
---|
| 37 | |
---|
| 38 | /** |
---|
| 39 | * The Pointer to this AtmosphericEngine |
---|
| 40 | */ |
---|
| 41 | AtmosphericEngine* AtmosphericEngine::singletonRef = NULL; |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * destroys a AtmosphericEngine |
---|
| 46 | */ |
---|
| 47 | AtmosphericEngine::~AtmosphericEngine() |
---|
| 48 | { |
---|
| 49 | AtmosphericEngine::singletonRef = NULL; |
---|
[7503] | 50 | |
---|
| 51 | this->weatherEffects = ClassList::getList( CL_WEATHER_EFFECT); |
---|
| 52 | |
---|
| 53 | if (this->weatherEffects != NULL) |
---|
| 54 | { |
---|
| 55 | list<BaseObject*>::const_iterator it; |
---|
| 56 | for (it = this->weatherEffects->begin(); it != this->weatherEffects->end(); it++) |
---|
| 57 | dynamic_cast<WeatherEffect*>(*it)->deactivate(); |
---|
| 58 | } |
---|
| 59 | |
---|
[7379] | 60 | } |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | /** |
---|
| 64 | * @param root The XML-element to load the AtmosphericEngine from |
---|
| 65 | */ |
---|
| 66 | void AtmosphericEngine::loadParams(const TiXmlElement* root) |
---|
| 67 | { |
---|
[7381] | 68 | LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect); |
---|
| 69 | LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect); |
---|
[7379] | 70 | } |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * @param root The XML-element to load WeatherEffects from |
---|
| 74 | */ |
---|
[7381] | 75 | void AtmosphericEngine::loadWeatherEffect(const TiXmlElement* root) |
---|
[7379] | 76 | { |
---|
| 77 | LOAD_PARAM_START_CYCLE(root, element); |
---|
| 78 | { |
---|
| 79 | PRINTF(4)("element is: %s\n", element->Value()); |
---|
| 80 | Factory::fabricate(element); |
---|
| 81 | } |
---|
| 82 | LOAD_PARAM_END_CYCLE(element); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | /** |
---|
| 86 | * @param root The XML-element to load SunEffects from |
---|
| 87 | */ |
---|
[7381] | 88 | void AtmosphericEngine::loadSunEffect(const TiXmlElement* root) |
---|
[7379] | 89 | { |
---|
| 90 | LOAD_PARAM_START_CYCLE(root, element); |
---|
| 91 | { |
---|
| 92 | PRINTF(4)("element is: %s\n", element->Value()); |
---|
| 93 | Factory::fabricate(element); |
---|
| 94 | } |
---|
| 95 | LOAD_PARAM_END_CYCLE(element); |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | /** |
---|
| 100 | * initializes the graphics effect |
---|
| 101 | */ |
---|
[7392] | 102 | //bool AtmosphericEngine::init() |
---|
| 103 | //{} |
---|
[7379] | 104 | |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | /** |
---|
| 108 | * draws the effect, if needed |
---|
| 109 | */ |
---|
| 110 | void AtmosphericEngine::draw() const |
---|
| 111 | {} |
---|
| 112 | |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | /** |
---|
| 116 | * ticks the effect if there is any time dependancy |
---|
| 117 | */ |
---|
| 118 | void AtmosphericEngine::tick(float dt) |
---|
| 119 | {} |
---|