mercator 0.4.0
A terrain generation library for the Worldforge system.
BasePoint.h
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) 2003 Damien McGinnes, Alistair Riddoch
4
5#ifndef MERCATOR_BASE_POINT_H
6#define MERCATOR_BASE_POINT_H
7
8#include <iostream>
9
10namespace Mercator {
11
19class BasePoint {
20 private:
22 float m_height;
24 float m_roughness;
26 float m_falloff;
27
28 public:
30 static constexpr float HEIGHT = 8.0;
32 static constexpr float ROUGHNESS = 1.25;
34 static constexpr float FALLOFF = 0.25;
35
41 explicit BasePoint(float h = HEIGHT,
42 float r = ROUGHNESS,
43 float f = FALLOFF) :
44 m_height(h), m_roughness(r), m_falloff(f) {}
45
46
47 bool operator==(const BasePoint& rhs) const;
48 bool operator!=(const BasePoint& rhs) const;
49
51 float height() const { return m_height; }
53 float & height() { return m_height; }
54
56 float roughness() const { return m_roughness; }
58 float & roughness() { return m_roughness; }
59
61 float falloff() const { return m_falloff; }
63 float & falloff() { return m_falloff; }
64
66 //unsigned int seed() const { return (unsigned int)(m_height * 1000.0);}
67 unsigned int seed() const;
68};
69
70} //namespace Mercator
71
72#endif // MERCATOR_BASE_POINT_H
Point on the fundamental grid that is used as the basis for terrain.
Definition: BasePoint.h:19
float & falloff()
Accessor for the falloff at the base point.
Definition: BasePoint.h:63
float & roughness()
Accessor for the roughness at the base point.
Definition: BasePoint.h:58
static constexpr float FALLOFF
Default falloff at the base point.
Definition: BasePoint.h:34
BasePoint(float h=HEIGHT, float r=ROUGHNESS, float f=FALLOFF)
Constructor.
Definition: BasePoint.h:41
float falloff() const
Accessor for the falloff at the base point.
Definition: BasePoint.h:61
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
float roughness() const
Accessor for the roughness at the base point.
Definition: BasePoint.h:56
float & height()
Accessor for the height at the base point.
Definition: BasePoint.h:53
unsigned int seed() const
Calculate the random seed used at this base point.
Definition: BasePoint.cpp:14
float height() const
Accessor for the height at the base point.
Definition: BasePoint.h:51