mercator  0.4.0
A terrain generation library for the Worldforge system.
BasePoint.cpp
1 // This file may be redistributed and modified only under the terms of
2 // the GNU General Public License (See COPYING for details).
3 // Copyright (C) 2004 Damien McGinnes, Alistair Riddoch
4 
5 #include "BasePoint.h"
6 #include "iround.h"
7 
8 namespace Mercator {
9 
10 constexpr float BasePoint::HEIGHT;
11 constexpr float BasePoint::ROUGHNESS;
12 constexpr float BasePoint::FALLOFF;
13 
14 unsigned int BasePoint::seed() const
15 {
16  return I_ROUND(m_height * 1000.0);
17 }
18 
19 bool BasePoint::operator==(const BasePoint& rhs) const
20 {
21  return rhs.m_falloff == m_falloff && rhs.m_height == m_height && rhs.m_roughness == m_roughness;
22 }
23 
24 bool BasePoint::operator!=(const BasePoint& rhs) const
25 {
26  return !(*this == rhs);
27 }
28 
29 } //namespace Mercator
static constexpr float HEIGHT
Default height at the base point.
Definition: BasePoint.h:30
static constexpr float ROUGHNESS
Default roughness at the base point.
Definition: BasePoint.h:32
Point on the fundamental grid that is used as the basis for terrain.
Definition: BasePoint.h:19
static constexpr float FALLOFF
Default falloff at the base point.
Definition: BasePoint.h:34
unsigned int seed() const
Calculate the random seed used at this base point.
Definition: BasePoint.cpp:14