Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "Move initialization back to implementation."
As MSVC nowadays support constexpr.
This reverts commit e7bf8e8.
  • Loading branch information
erikogenvik committed Oct 25, 2015
1 parent 3f89d9a commit babba18
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions Mercator/BasePoint.cpp
Expand Up @@ -6,8 +6,8 @@

namespace Mercator {

const float BasePoint::HEIGHT = 8.0;
const float BasePoint::ROUGHNESS = 1.25;
const float BasePoint::FALLOFF = 0.25;
constexpr float BasePoint::HEIGHT;
constexpr float BasePoint::ROUGHNESS;
constexpr float BasePoint::FALLOFF;

} //namespace Mercator
6 changes: 3 additions & 3 deletions Mercator/BasePoint.h
Expand Up @@ -27,11 +27,11 @@ class BasePoint {

public:
/// Default height at the base point.
static const float HEIGHT;
static constexpr float HEIGHT = 8.0;
/// Default roughness at the base point.
static const float ROUGHNESS;
static constexpr float ROUGHNESS = 1.25;
/// Default falloff at the base point.
static const float FALLOFF;
static constexpr float FALLOFF = 0.25;

/// \brief Constructor
///
Expand Down
6 changes: 3 additions & 3 deletions Mercator/Terrain.cpp
Expand Up @@ -24,9 +24,9 @@

namespace Mercator {

const unsigned int Terrain::DEFAULT = 0x0000;
const unsigned int Terrain::SHADED = 0x0001;
const float Terrain::defaultLevel = 8.f;
const unsigned int Terrain::DEFAULT;
const unsigned int Terrain::SHADED;
constexpr float Terrain::defaultLevel;

/// \brief Construct a new Terrain object with optional options and resolution.
///
Expand Down
6 changes: 3 additions & 3 deletions Mercator/Terrain.h
Expand Up @@ -54,9 +54,9 @@ class Terrain {
typedef std::map<const Effector *, Rect> Effectorstore;

/// \brief value provided for no flags set.
static const unsigned int DEFAULT;
static const unsigned int DEFAULT = 0x0000;
/// \brief set if shaders are going to be used on this terrain.
static const unsigned int SHADED;
static const unsigned int SHADED = 0x0001;
// More options go here as bit flags, and below should be a private
// test function
private:
Expand Down Expand Up @@ -99,7 +99,7 @@ class Terrain {
}
public:
/// \brief Height value used when no data is available.
static const float defaultLevel;
static constexpr float defaultLevel = 8.f;

explicit Terrain(unsigned int options = DEFAULT,
unsigned int resolution = defaultResolution);
Expand Down
6 changes: 3 additions & 3 deletions tests/Buffertest.cpp
Expand Up @@ -29,8 +29,8 @@ Segment::~Segment()
{
}

const float BasePoint::HEIGHT = 8.0;
const float BasePoint::ROUGHNESS = 1.25;
const float BasePoint::FALLOFF = 0.25;
constexpr float BasePoint::HEIGHT;
constexpr float BasePoint::ROUGHNESS;
constexpr float BasePoint::FALLOFF;

}
6 changes: 3 additions & 3 deletions tests/Segmentperf.cpp
Expand Up @@ -42,9 +42,9 @@ int main(int argc, char ** argv)

namespace Mercator {

const float BasePoint::HEIGHT = 8.0;
const float BasePoint::ROUGHNESS = 1.25;
const float BasePoint::FALLOFF = 0.25;
constexpr float BasePoint::HEIGHT;
constexpr float BasePoint::ROUGHNESS;
constexpr float BasePoint::FALLOFF;

void Surface::populate()
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Segmenttest.cpp
Expand Up @@ -39,9 +39,9 @@ int main()

namespace Mercator {

const float BasePoint::HEIGHT = 8.0;
const float BasePoint::ROUGHNESS = 1.25;
const float BasePoint::FALLOFF = 0.25;
constexpr float BasePoint::HEIGHT;
constexpr float BasePoint::ROUGHNESS;
constexpr float BasePoint::FALLOFF;

void Surface::populate()
{
Expand Down
6 changes: 3 additions & 3 deletions tests/TerrainaddAreatest.cpp
Expand Up @@ -155,9 +155,9 @@ void TerrainMod::removeFromSegment(Segment & s) const
{
}

const float BasePoint::HEIGHT = 8.0;
const float BasePoint::ROUGHNESS = 1.25;
const float BasePoint::FALLOFF = 0.25;
constexpr float BasePoint::HEIGHT;
constexpr float BasePoint::ROUGHNESS;
constexpr float BasePoint::FALLOFF;

Effector::Effector()
{
Expand Down

0 comments on commit babba18

Please sign in to comment.