Noise: Refresh module using ZNoise

https://github.com/Overdrivr/ZNoise

Former-commit-id: ea7bbeb58a7147934523e2f600b1bd02f1cae5ed [formerly 581ab53941abbda68e00417592240f52ebd482e6]
Former-commit-id: e948aca78eb101292f0458365cfa39e6564d0462
This commit is contained in:
Jérôme Leclercq
2016-06-18 07:52:33 +02:00
parent a66db53057
commit 33f2241d95
56 changed files with 1408 additions and 2017 deletions

View File

@@ -1,48 +1,38 @@
// Copyright (C) 2015 Rémi Bèges
// Copyright (C) 2016 Rémi Bèges
// This file is part of the "Nazara Engine - Noise module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NOISEBASE_HPP
#define NOISEBASE_HPP
#ifndef NAZARA_NOISEBASE_HPP
#define NAZARA_NOISEBASE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/Config.hpp>
#include <random>
namespace Nz
{
enum NoiseType
{
PERLIN,
SIMPLEX,
CELL
};
class NAZARA_NOISE_API NoiseBase
{
public:
NoiseBase(unsigned int seed = 0);
~NoiseBase() = default;
void SetNewSeed(unsigned int seed);
virtual float Get(std::initializer_list<float> coordinates, float scale) const = 0;
float GetScale();
void ShufflePermutationTable();
void SetScale(float scale);
void SetSeed(unsigned int seed);
unsigned int GetUniformRandomValue();
int fastfloor(float n);
int JenkinsHash(int a, int b, int c);
void Shuffle();
void Shuffle(unsigned int amount);
protected:
unsigned int perm[512];
float m_scale;
private:
unsigned int Ua, Uc, Um;
unsigned int UcurrentSeed;
unsigned int Uprevious, Ulast;
std::default_random_engine generator;
};
}
#endif // NOISEBASE_HPP
#endif // NAZARA_NOISEBASE_HPP