Files
NazaraEngine/include/Nazara/Noise/NoiseBase.hpp
Remi Beges d0545eb760 Minor fixes
*Seed is uint instead of int
*Permutation table is uint instead of int, could lead before to program
crash with negative seeds


Former-commit-id: 49ad04987a09a5f5b4bcab6ee3916db9818172b6
2012-12-01 10:07:41 +01:00

43 lines
852 B
C++

// Copyright (C) 2012 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
#include <Nazara/Prerequesites.hpp>
enum nzNoises
{
PERLIN,
SIMPLEX,
CELL
};
class NAZARA_API NzNoiseBase
{
public:
NzNoiseBase(unsigned int seed = 0);
~NzNoiseBase() = default;
void SetNewSeed(unsigned int seed);
void ShufflePermutationTable();
unsigned int GetUniformRandomValue();
int fastfloor(float n);
int JenkinsHash(int a, int b, int c);
protected:
unsigned int perm[512];
private:
unsigned int Ua, Uc, Um;
unsigned int UcurrentSeed;
unsigned int Uprevious, Ulast;
};
#endif // NOISEBASE_HPP