Switch from Nz prefix to namespace Nz

What a huge commit


Former-commit-id: 38ac5eebf70adc1180f571f6006192d28fb99897
This commit is contained in:
Lynix
2015-09-25 19:20:05 +02:00
parent c214251ecf
commit df8da275c4
609 changed files with 68265 additions and 66534 deletions

View File

@@ -7,70 +7,73 @@
#include <Nazara/Noise/Config.hpp>
#include <Nazara/Noise/Debug.hpp>
NzNoiseBase::NzNoiseBase(unsigned int seed)
namespace Nz
{
Ua = 16807;
Uc = 0;
Um = 2147483647;
UcurrentSeed = 0;
Uprevious = 0;
NoiseBase::NoiseBase(unsigned int seed)
{
Ua = 16807;
Uc = 0;
Um = 2147483647;
UcurrentSeed = 0;
Uprevious = 0;
SetNewSeed(seed);
SetNewSeed(seed);
for(int i(0) ; i < 512 ; i++)
perm[i] = i & 255;
for(int i(0) ; i < 512 ; i++)
perm[i] = i & 255;
}
void NzNoiseBase::SetNewSeed(unsigned int seed)
{
Uprevious = seed;
UcurrentSeed = seed;
}
unsigned int NzNoiseBase::GetUniformRandomValue()
{
Ulast = Ua*Uprevious + Uc%Um;
Uprevious = Ulast;
return Ulast;
}
void NzNoiseBase::ShufflePermutationTable()
{
int xchanger;
unsigned int ncase;
for(unsigned int i(0) ; i < 256 ; i++)
perm[i] = i;
for(unsigned int j(0) ; j < 20 ; ++j)
for (unsigned int i(0); i < 256 ; ++i)
{
ncase = this->GetUniformRandomValue() & 255;
xchanger = perm[i];
perm[i] = perm[ncase];
perm[ncase] = xchanger;
}
for(unsigned int i(256) ; i < 512; ++i)
perm[i] = perm[i & 255];
}
int NzNoiseBase::fastfloor(float n)
{
return (n >= 0) ? static_cast<int>(n) : static_cast<int>(n-1);
}
int NzNoiseBase::JenkinsHash(int a, int b, int c)
{
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 13);
b = b-c; b = b - a; b = b^(a << 8);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 13);
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 12);
b = b-c; b = b - a; b = b^(a << 16);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 5);
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 3);
b = b-c; b = b - a; b = b^(a << 10);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 15);
return c;
}
void NoiseBase::SetNewSeed(unsigned int seed)
{
Uprevious = seed;
UcurrentSeed = seed;
}
unsigned int NoiseBase::GetUniformRandomValue()
{
Ulast = Ua*Uprevious + Uc%Um;
Uprevious = Ulast;
return Ulast;
}
void NoiseBase::ShufflePermutationTable()
{
int xchanger;
unsigned int ncase;
for(unsigned int i(0) ; i < 256 ; i++)
perm[i] = i;
for(unsigned int j(0) ; j < 20 ; ++j)
for (unsigned int i(0); i < 256 ; ++i)
{
ncase = this->GetUniformRandomValue() & 255;
xchanger = perm[i];
perm[i] = perm[ncase];
perm[ncase] = xchanger;
}
for(unsigned int i(256) ; i < 512; ++i)
perm[i] = perm[i & 255];
}
int NoiseBase::fastfloor(float n)
{
return (n >= 0) ? static_cast<int>(n) : static_cast<int>(n-1);
}
int NoiseBase::JenkinsHash(int a, int b, int c)
{
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 13);
b = b-c; b = b - a; b = b^(a << 8);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 13);
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 12);
b = b-c; b = b - a; b = b^(a << 16);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 5);
a = a-b; a = a - c; a = a^(static_cast<unsigned int>(c) >> 3);
b = b-c; b = b - a; b = b^(a << 10);
c = c-a; c = c - b; c = c^(static_cast<unsigned int>(b) >> 15);
return c;
}
}