Modifications for the new architecture

to fullfill mixer implementation requirements
*Added FBM2D, first complex noise class of the new architecture
*Removed NoiseMachine, because was redundant and not fitting with the new
architecture
*Minor changes to almost every other noise class (mostly adding 'this->')
everywhere an inherited member from template base class was called from
the inherited class
This commit is contained in:
Remi Beges
2012-10-02 19:55:35 +02:00
parent a41a2ddcb3
commit 3f8e3cfb60
21 changed files with 295 additions and 994 deletions

View File

@@ -8,28 +8,33 @@
#define COMPLEXNOISEBASE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
class NAZARA_API NzComplexNoiseBase : public NzNoiseBase
template <typename T>
class NzComplexNoiseBase
{
public:
NzComplexNoiseBase();
~NzComplexNoiseBase() = default;
void SetLacunarity(float lacunarity);
void SetHurstParameter(float h);
void SetOctavesNumber(float octaves);
T GetOctaveNumber() const;
T GetLacunarity() const;
T GetHurstParameter() const;
void SetLacunarity(T lacunarity);
void SetHurstParameter(T h);
void SetOctavesNumber(T octaves);
void RecomputeExponentArray();
protected:
float m_lacunarity;
float m_hurst;
float m_octaves;
float exponent_array[30];
float m_sum;
T m_lacunarity;
T m_hurst;
T m_octaves;
T exponent_array[30];
T m_sum;
private:
bool m_parametersModified;
};
#include<Nazara/Noise/ComplexNoiseBase.inl>
#endif // COMPLEXNOISEBASE_HPP

View File

@@ -0,0 +1,102 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <cmath>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Noise/Config.hpp>
#include <Nazara/Noise/Debug.hpp>
#include <iostream>
using namespace std;
template <typename T>
NzComplexNoiseBase<T>::NzComplexNoiseBase()
{
m_parametersModified = true;
m_lacunarity = 5.0f;
m_hurst = 1.2f;
m_octaves = 3.0f;
for (int i(0) ; i < m_octaves; ++i)
{
exponent_array[i] = 0;
}
}
template <typename T>
T NzComplexNoiseBase<T>::GetLacunarity() const
{
return m_lacunarity;
}
template <typename T>
T NzComplexNoiseBase<T>::GetHurstParameter() const
{
return m_hurst;
}
template <typename T>
T NzComplexNoiseBase<T>::GetOctaveNumber() const
{
return m_octaves;
}
template <typename T>
void NzComplexNoiseBase<T>::SetLacunarity(T lacunarity)
{
// if(lacunarity != m_lacunarity)
//{
m_lacunarity = lacunarity;
m_parametersModified = true;
//}
}
template <typename T>
void NzComplexNoiseBase<T>::SetHurstParameter(T h)
{
//if(h != m_hurst)
//{
m_hurst = h;
m_parametersModified = true;
//}
}
template <typename T>
void NzComplexNoiseBase<T>::SetOctavesNumber(T octaves)
{
if(octaves <= 30.0f)
m_octaves = octaves;
else
m_octaves = 30.0f;
m_parametersModified = true;
}
template <typename T>
void NzComplexNoiseBase<T>::RecomputeExponentArray()
{
if(m_parametersModified)
{
cout<<"Recomputing exponent array"<<endl;
float frequency = 1.0;
m_sum = 0.f;
for (int i(0) ; i < static_cast<int>(m_octaves) ; ++i)
{
exponent_array[i] = std::pow( frequency, -m_hurst );
cout<<"expo["<<i<<"] : "<<exponent_array[i]<<endl;
frequency *= m_lacunarity;
//m_sum += 1.0f/exponent_array[i];//A tester
m_sum += exponent_array[i];
}
cout<<"sum = "<<m_sum<<endl;
m_parametersModified = false;
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -0,0 +1,33 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef FBM2DNOISE_HPP
#define FBM2DNOISE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/ComplexNoiseBase.hpp>
#include <Nazara/Noise/Abstract2DNoise.hpp>
template <typename T> class NzFBM2D : public NzAbstract2DNoise<T>, public NzComplexNoiseBase<T>
{
public:
NzFBM2D(nzNoises source, int seed);
T GetValue(T x, T y, T resolution);
~NzFBM2D();
protected:
private:
NzAbstract2DNoise<T>* m_source;
T m_value;
T m_remainder;
nzNoises m_noiseType;
};
typedef NzFBM2D<float> NzFBM2Df;
typedef NzFBM2D<double> NzFBM2Dd;
#include <Nazara/Noise/FBM2D.inl>
#endif // FBM2DNOISE_HPP

View File

@@ -0,0 +1,70 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/Error.hpp>
#include <Nazara/Noise/Config.hpp>
#include <Nazara/Noise/Debug.hpp>
#include <Nazara/Noise/Perlin2D.hpp>
#include <Nazara/Noise/Simplex2D.hpp>
#include <iostream>
using namespace std;
template <typename T>
NzFBM2D<T>::NzFBM2D(nzNoises source, int seed) : NzComplexNoiseBase<T>()
{
switch(source)
{
case PERLIN:
m_source = new NzPerlin2D<T>;
break;
default:
m_source = new NzSimplex2D<T>;
break;
}
m_source->SetNewSeed(seed);
m_source->ShufflePermutationTable();
m_noiseType = source;
}
template <typename T>
T NzFBM2D<T>::GetValue(T x, T y, T resolution)
{
this->RecomputeExponentArray();
m_value = 0.0;
for (int i(0); i < this->m_octaves; ++i)
{
m_value += m_source->GetValue(x,y,resolution) * this->exponent_array[i];
resolution *= this->m_lacunarity;
}
//cout<<m_value<<endl;//"|"<<this->m_sum<<endl;
//m_remainder = this->m_octaves - static_cast<int>(this->m_octaves);
//if(!NzNumberEquals(remainder, static_cast<T>(0.0)))
// m_value += remainder * Get2DSimplexNoiseValue(x,y,resolution) * exponent_array[(int)m_octaves-1];
//0.65 is an experimental value to make the noise stick closer to [-1 , 1]
return m_value / (this->m_sum * 0.65);
}
template <typename T>
NzFBM2D<T>::~NzFBM2D()
{
switch(m_noiseType)
{
case PERLIN:
delete dynamic_cast<NzPerlin2D<T>*>(m_source);
break;
default:
delete dynamic_cast<NzSimplex2D<T>*>(m_source);
break;
}
}
#include <Nazara/Core/DebugOff.hpp>

View File

@@ -8,8 +8,9 @@
#define NAZARA_MAPPEDNOISEBASE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/NoiseBase.hpp>
template <typename T> class NzMappedNoiseBase
template <typename T> class NzMappedNoiseBase : public NzNoiseBase
{
public:
NzMappedNoiseBase();

View File

@@ -9,6 +9,13 @@
#include <Nazara/Prerequesites.hpp>
enum nzNoises
{
PERLIN,
SIMPLEX,
CELL
};
class NAZARA_API NzNoiseBase
{
public:

View File

@@ -1,93 +0,0 @@
// Copyright (C) 2012 Rémi Bèges
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NOISEMACHINE_HPP
#define NOISEMACHINE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Noise/ComplexNoiseBase.hpp>
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Math/Vector3.hpp>
#include <Nazara/Math/Vector4.hpp>
class NAZARA_API NzNoiseMachine : public NzComplexNoiseBase
{
public:
NzNoiseMachine(int seed = 0);
~NzNoiseMachine() = default;
float Get2DPerlinNoiseValue (float x, float y, float res);
float Get3DPerlinNoiseValue (float x, float y, float z, float res);
float Get4DPerlinNoiseValue (float x, float y, float z, float w, float res);
float Get2DSimplexNoiseValue(float x, float y, float res);
float Get3DSimplexNoiseValue(float x, float y, float z, float res);
float Get4DSimplexNoiseValue(float x, float y, float z, float w, float res);
float Get2DCellNoiseValue(float x, float y, float res);
float Get3DCellNoiseValue(float x, float y, float z, float res);
float Get4DCellNoiseValue(float x, float y, float z, float w, float res);
float Get2DFBMNoiseValue(float x, float y, float res);
float Get3DFBMNoiseValue(float x, float y, float z, float res);
float Get2DHybridMultiFractalNoiseValue(float x, float y, float res);
float Get3DHybridMultiFractalNoiseValue(float x, float y, float z, float res);
protected:
private:
float gradient2[8][2];
int gradient3[16][3];
int gradient4[32][4];
int lookupTable4D[64][4];
//----------------------- Common variables --------------------------------------
int ii,jj,kk,ll;
int gi0,gi1,gi2,gi3,gi4,gi5,gi6,gi7,gi8,gi9,gi10,gi11,gi12,gi13,gi14,gi15;
//----------------------- Simplex variables --------------------------------------
float n1, n2, n3, n4, n5;
NzVector4f d1,d2,d3,d4,d5,unskewedCubeOrigin,unskewedDistToOrigin;
NzVector4i off1, off2,off3,skewedCubeOrigin;
float c1,c2,c3,c4,c5,c6;
int c;
float SkewCoeff2D;
float UnskewCoeff2D;
float SkewCoeff3D;
float UnskewCoeff3D;
float SkewCoeff4D;
float UnskewCoeff4D;
float sum;
//----------------------- Perlin Variables -------------------------------------
int x0,y0,z0,w0;
float Li1,Li2,Li3,Li4,Li5,Li6,Li7,Li8,Li9,Li10,Li11,Li12,Li13,Li14;
float s[4],t[4],u[4],v[4];
float Cx, Cy, Cz, Cw;
NzVector4f temp;
float tmp;
//---------------------- Complex Noise Variables --------------------------------
bool first;
float value;
float remainder;
float smax;
float smin;
};
#endif // NOISEMACHINE_HPP

View File

@@ -12,12 +12,12 @@
#include <Nazara/Noise/Abstract2DNoise.hpp>
#include <Nazara/Math/Vector2.hpp>
template <typename T> class NzPerlin2D : public NzAbstract2DNoise<T>, public NzNoiseBase
template <typename T> class NzPerlin2D : public NzAbstract2DNoise<T>
{
public:
NzPerlin2D();
T GetValue(T x, T y, T resolution);
~NzPerlin2D() = default;
virtual ~NzPerlin2D() = default;
protected:
private:
int x0, y0;

View File

@@ -23,16 +23,16 @@ T NzPerlin2D<T>::GetValue(T x, T y, T resolution)
x *= resolution;
y *= resolution;
x0 = fastfloor(x);
y0 = fastfloor(y);
x0 = this->fastfloor(x);
y0 = this->fastfloor(y);
ii = x0 & 255;
jj = y0 & 255;
gi0 = perm[ii + perm[jj]] & 7;
gi1 = perm[ii + 1 + perm[jj]] & 7;
gi2 = perm[ii + perm[jj + 1]] & 7;
gi3 = perm[ii + 1 + perm[jj + 1]] & 7;
gi0 = this->perm[ii + this->perm[jj]] & 7;
gi1 = this->perm[ii + 1 + this->perm[jj]] & 7;
gi2 = this->perm[ii + this->perm[jj + 1]] & 7;
gi3 = this->perm[ii + 1 + this->perm[jj + 1]] & 7;
temp.x = x-x0;
temp.y = y-y0;

View File

@@ -12,7 +12,7 @@
#include <Nazara/Noise/Abstract3DNoise.hpp>
#include <Nazara/Math/Vector3.hpp>
template <typename T> class NzPerlin3D : public NzAbstract3DNoise<T>, public NzNoiseBase
template <typename T> class NzPerlin3D : public NzAbstract3DNoise<T>
{
public:
NzPerlin3D();

View File

@@ -28,23 +28,23 @@ T NzPerlin3D<T>::GetValue(T x, T y, T z, T resolution)
y /= resolution;
z /= resolution;
x0 = fastfloor(x);
y0 = fastfloor(y);
z0 = fastfloor(z);
x0 = this->fastfloor(x);
y0 = this->fastfloor(y);
z0 = this->fastfloor(z);
ii = x0 & 255;
jj = y0 & 255;
kk = z0 & 255;
gi0 = perm[ii + perm[jj + perm[kk]]] & 15;
gi1 = perm[ii + 1 + perm[jj + perm[kk]]] & 15;
gi2 = perm[ii + perm[jj + 1 + perm[kk]]] & 15;
gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk]]] & 15;
gi0 = this->perm[ii + this->perm[jj + this->perm[kk]]] & 15;
gi1 = this->perm[ii + 1 + this->perm[jj + this->perm[kk]]] & 15;
gi2 = this->perm[ii + this->perm[jj + 1 + this->perm[kk]]] & 15;
gi3 = this->perm[ii + 1 + this->perm[jj + 1 + this->perm[kk]]] & 15;
gi4 = perm[ii + perm[jj + perm[kk + 1]]] & 15;
gi5 = perm[ii + 1 + perm[jj + perm[kk + 1]]] & 15;
gi6 = perm[ii + perm[jj + 1 + perm[kk + 1]]] & 15;
gi7 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1]]] & 15;
gi4 = this->perm[ii + this->perm[jj + this->perm[kk + 1]]] & 15;
gi5 = this->perm[ii + 1 + this->perm[jj + this->perm[kk + 1]]] & 15;
gi6 = this->perm[ii + this->perm[jj + 1 + this->perm[kk + 1]]] & 15;
gi7 = this->perm[ii + 1 + this->perm[jj + 1 + this->perm[kk + 1]]] & 15;
temp.x = x-x0;
temp.y = y-y0;

View File

@@ -12,7 +12,7 @@
#include <Nazara/Noise/Abstract4DNoise.hpp>
#include <Nazara/Math/Vector4.hpp>
template <typename T> class NzPerlin4D : public NzAbstract4DNoise<T>, public NzNoiseBase
template <typename T> class NzPerlin4D : public NzAbstract4DNoise<T>
{
public:
NzPerlin4D();

View File

@@ -34,35 +34,35 @@ T NzPerlin4D<T>::GetValue(T x, T y, T z, T w, T resolution)
z *= resolution;
w *= resolution;
x0 = fastfloor(x);
y0 = fastfloor(y);
z0 = fastfloor(z);
w0 = fastfloor(w);
x0 = this->fastfloor(x);
y0 = this->fastfloor(y);
z0 = this->fastfloor(z);
w0 = this->fastfloor(w);
ii = x0 & 255;
jj = y0 & 255;
kk = z0 & 255;
ll = w0 & 255;
gi0 = perm[ii + perm[jj + perm[kk + perm[ll ]]]] & 31;
gi1 = perm[ii + 1 + perm[jj + perm[kk + perm[ll ]]]] & 31;
gi2 = perm[ii + perm[jj + 1 + perm[kk + perm[ll ]]]] & 31;
gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk + perm[ll ]]]] & 31;
gi0 = this->perm[ii + this->perm[jj + this->perm[kk + this->perm[ll]]]] & 31;
gi1 = this->perm[ii + 1 + this->perm[jj + this->perm[kk + this->perm[ll]]]] & 31;
gi2 = this->perm[ii + this->perm[jj + 1 + this->perm[kk + this->perm[ll]]]] & 31;
gi3 = this->perm[ii + 1 + this->perm[jj + 1 + this->perm[kk + this->perm[ll]]]] & 31;
gi4 = perm[ii + perm[jj + + perm[kk + 1 + perm[ll ]]]] & 31;
gi5 = perm[ii + 1 + perm[jj + + perm[kk + 1 + perm[ll ]]]] & 31;
gi6 = perm[ii + perm[jj + 1 + perm[kk + 1 + perm[ll ]]]] & 31;
gi7 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll ]]]] & 31;
gi4 = this->perm[ii + this->perm[jj + + this->perm[kk + 1 + this->perm[ll]]]] & 31;
gi5 = this->perm[ii + 1 + this->perm[jj + + this->perm[kk + 1 + this->perm[ll]]]] & 31;
gi6 = this->perm[ii + this->perm[jj + 1 + this->perm[kk + 1 + this->perm[ll]]]] & 31;
gi7 = this->perm[ii + 1 + this->perm[jj + 1 + this->perm[kk + 1 + this->perm[ll]]]] & 31;
gi8 = perm[ii + perm[jj + perm[kk + perm[ll + 1]]]] & 31;
gi9 = perm[ii + 1 + perm[jj + perm[kk + perm[ll + 1]]]] & 31;
gi10 = perm[ii + perm[jj + 1 + perm[kk + perm[ll + 1]]]] & 31;
gi11 = perm[ii + 1 + perm[jj + 1 + perm[kk + perm[ll + 1]]]] & 31;
gi8 = this->perm[ii + this->perm[jj + this->perm[kk + this->perm[ll + 1]]]] & 31;
gi9 = this->perm[ii + 1 + this->perm[jj + this->perm[kk + this->perm[ll + 1]]]] & 31;
gi10 = this->perm[ii + this->perm[jj + 1 + this->perm[kk + this->perm[ll + 1]]]] & 31;
gi11 = this->perm[ii + 1 + this->perm[jj + 1 + this->perm[kk + this->perm[ll + 1]]]] & 31;
gi12 = perm[ii + perm[jj + perm[kk + 1 + perm[ll + 1]]]] & 31;
gi13 = perm[ii + 1 + perm[jj + perm[kk + 1 + perm[ll + 1]]]] & 31;
gi14 = perm[ii + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] & 31;
gi15 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] & 31;
gi12 = this->perm[ii + this->perm[jj + this->perm[kk + 1 + this->perm[ll + 1]]]] & 31;
gi13 = this->perm[ii + 1 + this->perm[jj + this->perm[kk + 1 + this->perm[ll + 1]]]] & 31;
gi14 = this->perm[ii + this->perm[jj + 1 + this->perm[kk + 1 + this->perm[ll + 1]]]] & 31;
gi15 = this->perm[ii + 1 + this->perm[jj + 1 + this->perm[kk + 1 + this->perm[ll + 1]]]] & 31;
temp.x = x-x0;
temp.y = y-y0;

View File

@@ -12,12 +12,12 @@
#include <Nazara/Noise/Abstract2DNoise.hpp>
#include <Nazara/Math/Vector2.hpp>
template <typename T> class NzSimplex2D : public NzAbstract2DNoise<T>, public NzNoiseBase
template <typename T> class NzSimplex2D : public NzAbstract2DNoise<T>
{
public:
NzSimplex2D();
T GetValue(T x, T y, T resolution);
~NzSimplex2D() = default;
virtual ~NzSimplex2D() = default;
protected:
private:
int ii,jj;

View File

@@ -27,8 +27,8 @@ T NzSimplex2D<T>::GetValue(T x, T y, T resolution)
y *= resolution;
sum = (x + y) * SkewCoeff2D;
skewedCubeOrigin.x = fastfloor(x + sum);
skewedCubeOrigin.y = fastfloor(y + sum);
skewedCubeOrigin.x = this->fastfloor(x + sum);
skewedCubeOrigin.y = this->fastfloor(y + sum);
sum = (skewedCubeOrigin.x + skewedCubeOrigin.y) * UnskewCoeff2D;
unskewedCubeOrigin.x = skewedCubeOrigin.x - sum;
@@ -59,9 +59,9 @@ T NzSimplex2D<T>::GetValue(T x, T y, T resolution)
ii = skewedCubeOrigin.x & 255;
jj = skewedCubeOrigin.y & 255;
gi0 = perm[ii + perm[jj ]] & 7;
gi1 = perm[ii + off1.x + perm[jj + off1.y]] & 7;
gi2 = perm[ii + 1 + perm[jj + 1 ]] & 7;
gi0 = this->perm[ii + this->perm[jj ]] & 7;
gi1 = this->perm[ii + off1.x + this->perm[jj + off1.y]] & 7;
gi2 = this->perm[ii + 1 + this->perm[jj + 1 ]] & 7;
c1 = 0.5 - d1.x * d1.x - d1.y * d1.y;
c2 = 0.5 - d2.x * d2.x - d2.y * d2.y;

View File

@@ -12,7 +12,7 @@
#include <Nazara/Noise/Abstract3DNoise.hpp>
#include <Nazara/Math/Vector3.hpp>
template <typename T> class NzSimplex3D : public NzAbstract3DNoise<T>, public NzNoiseBase
template <typename T> class NzSimplex3D : public NzAbstract3DNoise<T>
{
public:
NzSimplex3D();

View File

@@ -29,9 +29,9 @@ T NzSimplex3D<T>::GetValue(T x, T y, T z, T resolution)
z *= resolution;
sum = (x + y + z) * SkewCoeff3D;
skewedCubeOrigin.x = fastfloor(x + sum);
skewedCubeOrigin.y = fastfloor(y + sum);
skewedCubeOrigin.z = fastfloor(z + sum);
skewedCubeOrigin.x = this->fastfloor(x + sum);
skewedCubeOrigin.y = this->fastfloor(y + sum);
skewedCubeOrigin.z = this->fastfloor(z + sum);
sum = (skewedCubeOrigin.x + skewedCubeOrigin.y + skewedCubeOrigin.z) * UnskewCoeff3D;
unskewedCubeOrigin.x = skewedCubeOrigin.x - sum;
@@ -121,10 +121,10 @@ T NzSimplex3D<T>::GetValue(T x, T y, T z, T resolution)
jj = skewedCubeOrigin.y & 255;
kk = skewedCubeOrigin.z & 255;
gi0 = perm[ii + perm[jj + perm[kk ]]] % 12;
gi1 = perm[ii + off1.x + perm[jj + off1.y + perm[kk + off1.z]]] % 12;
gi2 = perm[ii + off2.x + perm[jj + off2.y + perm[kk + off2.z]]] % 12;
gi3 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 ]]] % 12;
gi0 = this->perm[ii + this->perm[jj + this->perm[kk ]]] % 12;
gi1 = this->perm[ii + off1.x + this->perm[jj + off1.y + this->perm[kk + off1.z]]] % 12;
gi2 = this->perm[ii + off2.x + this->perm[jj + off2.y + this->perm[kk + off2.z]]] % 12;
gi3 = this->perm[ii + 1 + this->perm[jj + 1 + this->perm[kk + 1 ]]] % 12;
c1 = 0.6 - d1.x * d1.x - d1.y * d1.y - d1.z * d1.z;
c2 = 0.6 - d2.x * d2.x - d2.y * d2.y - d2.z * d2.z;

View File

@@ -12,7 +12,7 @@
#include <Nazara/Noise/Abstract4DNoise.hpp>
#include <Nazara/Math/Vector4.hpp>
template <typename T> class NzSimplex4D : public NzAbstract4DNoise<T>, public NzNoiseBase
template <typename T> class NzSimplex4D : public NzAbstract4DNoise<T>
{
public:
NzSimplex4D();

View File

@@ -54,10 +54,10 @@ T NzSimplex4D<T>::GetValue(T x, T y, T z, T w, T resolution)
w *= resolution;
sum = (x + y + z + w) * SkewCoeff4D;
skewedCubeOrigin.x = fastfloor(x + sum);
skewedCubeOrigin.y = fastfloor(y + sum);
skewedCubeOrigin.z = fastfloor(z + sum);
skewedCubeOrigin.w = fastfloor(w + sum);
skewedCubeOrigin.x = this->fastfloor(x + sum);
skewedCubeOrigin.y = this->fastfloor(y + sum);
skewedCubeOrigin.z = this->fastfloor(z + sum);
skewedCubeOrigin.w = this->fastfloor(w + sum);
sum = (skewedCubeOrigin.x + skewedCubeOrigin.y + skewedCubeOrigin.z + skewedCubeOrigin.w) * UnskewCoeff4D;
unskewedCubeOrigin.x = skewedCubeOrigin.x - sum;
@@ -120,11 +120,11 @@ T NzSimplex4D<T>::GetValue(T x, T y, T z, T w, T resolution)
kk = skewedCubeOrigin.z & 255;
ll = skewedCubeOrigin.w & 255;
gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] & 31;
gi1 = perm[ii + off1.x + perm[jj + off1.y + perm[kk + off1.z + perm[ll + off1.w]]]] & 31;
gi2 = perm[ii + off2.x + perm[jj + off2.y + perm[kk + off2.z + perm[ll + off2.w]]]] & 31;
gi3 = perm[ii + off3.x + perm[jj + off3.y + perm[kk + off3.z + perm[ll + off3.w]]]] & 31;
gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32;
gi0 = this->perm[ii + this->perm[jj + this->perm[kk + this->perm[ll]]]] & 31;
gi1 = this->perm[ii + off1.x + this->perm[jj + off1.y + this->perm[kk + off1.z + this->perm[ll + off1.w]]]] & 31;
gi2 = this->perm[ii + off2.x + this->perm[jj + off2.y + this->perm[kk + off2.z + this->perm[ll + off2.w]]]] & 31;
gi3 = this->perm[ii + off3.x + this->perm[jj + off3.y + this->perm[kk + off3.z + this->perm[ll + off3.w]]]] & 31;
gi4 = this->perm[ii + 1 + this->perm[jj + 1 + this->perm[kk + 1 + this->perm[ll + 1]]]] % 32;
c1 = 0.6 - d1.x*d1.x - d1.y*d1.y - d1.z*d1.z - d1.w*d1.w;
c2 = 0.6 - d2.x*d2.x - d2.y*d2.y - d2.z*d2.z - d2.w*d2.w;