Eris  1.3.23
TerrainModTranslator.h
1 //
2 // C++ Interface: TerrainMod
3 //
4 // Description: The purpose of this class is to handle the bulk of the work
5 // involved with using Mercator::TerrainMods. It handles parsing
6 // the Atlas data and storing all the information needed by
7 // TerrainGenerator to add and remove them from the Terrain.
8 //
9 // TerrainGenerator listens for changes in the modifier and
10 // updates or removes the modifiers from the terrain as needed.
11 //
12 //
13 // Author: Tamas Bates <rhymer@gmail.com>, (C) 2008
14 // Author: Erik Hjortsberg <erik.hjortsberg@iteam.se>, (C) 2008
15 //
16 // This program is free software; you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation; either version 2 of the License, or
19 // (at your option) any later version.
20 //
21 // This program is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with this program; if not, write to the Free Software
28 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.//
29 //
30 #ifndef ERIS_TERRAINMOD_H
31 #define ERIS_TERRAINMOD_H
32 
33 #include <Atlas/Message/Element.h>
34 
35 #include <wfmath/point.h>
36 
37 namespace Mercator {
38  class TerrainMod;
39 }
40 
41 namespace Eris {
42 
49 {
50 protected:
51  template <template <int> class Shape>
52  bool parseStuff(const WFMath::Point<3> & pos,
53  const WFMath::Quaternion & orientation,
54  const Atlas::Message::MapType& modElement,
55  const std::string & typeName,
56  Shape<2> & shape,
57  const Atlas::Message::Element & shapeElement);
58 
59 public:
60 
61  bool parseData(const WFMath::Point<3> & pos,
62  const WFMath::Quaternion &,
63  const Atlas::Message::MapType &);
64 
70  Mercator::TerrainMod* getModifier();
71 
73 
74 protected:
75 
76  static float parsePosition(const WFMath::Point<3> & pos, const Atlas::Message::MapType& modElement);
77 
78  template <template <int> class Shape>
79  static bool parseShape(const Atlas::Message::Element& shapeElement,
80  const WFMath::Point<3>& pos,
81  const WFMath::Quaternion& orientation,
82  Shape<2> & shape);
83 
84  template <template <template <int> class Shape> class Mod,
85  template <int> class Shape>
86  bool createInstance(Shape<2> & shape,
87  const WFMath::Point<3>& pos,
88  const Atlas::Message::MapType &,
89  float,
90  float);
91 
92  template <template <template <int> class Shape> class Mod,
93  template <int> class Shape>
94  bool createInstance(Shape<2> & shape,
95  const WFMath::Point<3>& pos,
96  const Atlas::Message::MapType &);
97 
98  Mercator::TerrainMod * m_mod;
99 };
100 
101 }
102 
103 #endif
Eris::TerrainModTranslator::parsePosition
static float parsePosition(const WFMath::Point< 3 > &pos, const Atlas::Message::MapType &modElement)
Parses the changes to the position of the mod If no height data is given the height of the entity the...
Definition: TerrainModTranslator.cpp:144
Eris::error
Definition: LogStream.h:55
Eris::TerrainModTranslator::TerrainModTranslator
TerrainModTranslator()
Ctor.
Definition: TerrainModTranslator.cpp:47
Eris::TerrainModTranslator::parseData
bool parseData(const WFMath::Point< 3 > &pos, const WFMath::Quaternion &, const Atlas::Message::MapType &)
Parse the Atlas data and create the terrain mod instance with it.
Definition: TerrainModTranslator.cpp:91
Eris::TerrainModTranslator::getModifier
Mercator::TerrainMod * getModifier()
Accessor for the Mercator::TerrainMod created and held by this instance.
Definition: TerrainModTranslator.cpp:128
Eris::warning
Definition: LogStream.h:45
Eris::TerrainModTranslator
Base class for all terrain mod specific classes.This is not meant to be used directly by anything els...
Definition: TerrainModTranslator.h:48