Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/world_entities/weather_effects/atmospheric_engine.cc @ 9760

Last change on this file since 9760 was 9760, checked in by bensch, 18 years ago

moved around the weather effecs

File size: 2.7 KB
Line 
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 "weather_effects/fog_effect.h"
21
22#include "util/loading/load_param_xml.h"
23#include "util/loading/factory.h"
24
25ObjectListDefinition(AtmosphericEngine);
26
27/**
28 * @param root The XML-element to load the AtmosphericEngine from
29 */
30AtmosphericEngine::AtmosphericEngine()
31{
32  this->registerObject(this, AtmosphericEngine::_objectList);
33}
34
35/**
36 *  The Pointer to this AtmosphericEngine
37*/
38AtmosphericEngine* AtmosphericEngine::singletonRef = NULL;
39
40
41/**
42 *  destroys a AtmosphericEngine
43 */
44AtmosphericEngine::~AtmosphericEngine()
45{
46  AtmosphericEngine::singletonRef = NULL;
47
48  while(!WeatherEffect::objectList().empty())
49    delete WeatherEffect::objectList().front();
50}
51
52/**
53 * @param root The XML-element to load the AtmosphericEngine from
54 */
55void AtmosphericEngine::loadParams(const TiXmlElement* root)
56{
57  LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect);
58  LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect);
59}
60
61/**
62 * @param root The XML-element to load WeatherEffects from
63 */
64void 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);
70
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);
76}
77
78/**
79 * @param root The XML-element to load SunEffects from
80 */
81void 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);
88}
89
90
91/**
92 * draws the effect, if needed
93 */
94void AtmosphericEngine::draw() const
95{
96  for (ObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin();
97       it != WeatherEffect::objectList().end();
98       ++it)
99    (*it)->draw();
100}
101
102
103
104/**
105 * ticks the effect if there is any time dependancy
106 */
107void AtmosphericEngine::tick(float dt)
108{
109
110  for (ObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin();
111       it != WeatherEffect::objectList().end();
112       ++it)
113    (*it)->tick(dt);
114}
Note: See TracBrowser for help on using the repository browser.