| 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 |  | 
|---|
| 21 | #include "effects/fog_effect.h" | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 |  | 
|---|
| 25 | #include "util/loading/load_param.h" | 
|---|
| 26 | #include "util/loading/factory.h" | 
|---|
| 27 | #include "class_list.h" | 
|---|
| 28 |  | 
|---|
| 29 |  | 
|---|
| 30 | using namespace std; | 
|---|
| 31 |  | 
|---|
| 32 |  | 
|---|
| 33 |  | 
|---|
| 34 | /** | 
|---|
| 35 |  * @param root The XML-element to load the AtmosphericEngine from | 
|---|
| 36 |  */ | 
|---|
| 37 | AtmosphericEngine::AtmosphericEngine() | 
|---|
| 38 | { | 
|---|
| 39 |   //this->setClassID(CL_ATMOSPHERIC_ENGINE, "AtmosphericEngine"); | 
|---|
| 40 |   this->bActivated = false; | 
|---|
| 41 | } | 
|---|
| 42 |  | 
|---|
| 43 | /** | 
|---|
| 44 |  *  The Pointer to this AtmosphericEngine | 
|---|
| 45 | */ | 
|---|
| 46 | AtmosphericEngine* AtmosphericEngine::singletonRef = NULL; | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 | /** | 
|---|
| 50 |  *  destroys a AtmosphericEngine | 
|---|
| 51 |  */ | 
|---|
| 52 | AtmosphericEngine::~AtmosphericEngine() | 
|---|
| 53 | { | 
|---|
| 54 |   AtmosphericEngine::singletonRef = NULL; | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 |  | 
|---|
| 58 | /** | 
|---|
| 59 |  * @param root The XML-element to load the AtmosphericEngine from | 
|---|
| 60 |  */ | 
|---|
| 61 | void AtmosphericEngine::loadParams(const TiXmlElement* root) | 
|---|
| 62 | { | 
|---|
| 63 |   LoadParamXML(root, "WeatherEffects", this, AtmosphericEngine, loadWeatherEffects); | 
|---|
| 64 |   LoadParamXML(root, "SunEffects", this, AtmosphericEngine, loadSunEffects); | 
|---|
| 65 | } | 
|---|
| 66 |  | 
|---|
| 67 | /** | 
|---|
| 68 |  * @param root The XML-element to load WeatherEffects from | 
|---|
| 69 |  */ | 
|---|
| 70 | void AtmosphericEngine::loadWeatherEffects(const TiXmlElement* root) | 
|---|
| 71 | { | 
|---|
| 72 |   LOAD_PARAM_START_CYCLE(root, element); | 
|---|
| 73 |   { | 
|---|
| 74 |     PRINTF(4)("element is: %s\n", element->Value()); | 
|---|
| 75 |     Factory::fabricate(element); | 
|---|
| 76 |   } | 
|---|
| 77 |   LOAD_PARAM_END_CYCLE(element); | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 | /** | 
|---|
| 81 |  * @param root The XML-element to load SunEffects from | 
|---|
| 82 |  */ | 
|---|
| 83 | void AtmosphericEngine::loadSunEffects(const TiXmlElement* root) | 
|---|
| 84 | { | 
|---|
| 85 |   LOAD_PARAM_START_CYCLE(root, element); | 
|---|
| 86 |   { | 
|---|
| 87 |     PRINTF(4)("element is: %s\n", element->Value()); | 
|---|
| 88 |     Factory::fabricate(element); | 
|---|
| 89 |   } | 
|---|
| 90 |   LOAD_PARAM_END_CYCLE(element); | 
|---|
| 91 | } | 
|---|
| 92 |  | 
|---|
| 93 |  | 
|---|
| 94 | /** | 
|---|
| 95 |  *  initializes the graphics effect | 
|---|
| 96 |  */ | 
|---|
| 97 | bool AtmosphericEngine::init() | 
|---|
| 98 | {} | 
|---|
| 99 |  | 
|---|
| 100 |  | 
|---|
| 101 |  | 
|---|
| 102 | /** | 
|---|
| 103 |  * draws the effect, if needed | 
|---|
| 104 |  */ | 
|---|
| 105 | void AtmosphericEngine::draw() const | 
|---|
| 106 | {} | 
|---|
| 107 |  | 
|---|
| 108 |  | 
|---|
| 109 |  | 
|---|
| 110 | /** | 
|---|
| 111 |  * ticks the effect if there is any time dependancy | 
|---|
| 112 |  */ | 
|---|
| 113 | void AtmosphericEngine::tick(float dt) | 
|---|
| 114 | {} | 
|---|