Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/volumetric_fog/src/world_entities/weather_effects/atmospheric_engine.cc

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

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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