Forgot to commit some stuff (noise+dynaterrain) from previous commit
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2012 Rémi "Overdrivr" Bèges (remi{dot}beges{at}gmail{dot}com)
|
||||
// Copyright (C) 2012 AUTHORS
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ class NzNoiseBase
|
||||
void SetNewSeed(int seed);
|
||||
int GetUniformRandomValue();
|
||||
void ShufflePermutationTable();
|
||||
int fastfloor(float n);
|
||||
int JenkinsHash(int a, int b, int c);
|
||||
protected:
|
||||
int perm[512];
|
||||
private:
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
//TODO : tableau de gradients en float au lieu de int ? Ou condition ternaires ?
|
||||
// utiliser fastfloor partout
|
||||
// vérifier bon fonctionnement perlin1d
|
||||
// utiliser copies paramètres pour économiser mémoire
|
||||
// améliorer le mélange de la table de perm
|
||||
|
||||
class NzNoiseMachine : public NzNoiseBase
|
||||
{
|
||||
@@ -24,7 +25,6 @@ class NzNoiseMachine : public NzNoiseBase
|
||||
NzNoiseMachine(int seed = 0);
|
||||
~NzNoiseMachine();
|
||||
|
||||
float Get1DPerlinNoiseValue (float x, float res);
|
||||
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);
|
||||
@@ -42,7 +42,6 @@ class NzNoiseMachine : public NzNoiseBase
|
||||
void SetOctavesNumber(float octaves);
|
||||
void RecomputeExponentArray();
|
||||
|
||||
float Get1DFBMNoiseValue(float x, float res);
|
||||
float Get2DFBMNoiseValue(float x, float y, float res);
|
||||
float Get3DFBMNoiseValue(float x, float y, float z, float res);
|
||||
|
||||
@@ -52,10 +51,6 @@ class NzNoiseMachine : public NzNoiseBase
|
||||
protected:
|
||||
private:
|
||||
|
||||
//Pour tronquer les nombres
|
||||
int fastfloor(float n);
|
||||
|
||||
int gradient1[2];
|
||||
float gradient2[8][2];
|
||||
int gradient3[16][3];
|
||||
int gradient4[32][4];
|
||||
@@ -65,15 +60,13 @@ class NzNoiseMachine : public NzNoiseBase
|
||||
|
||||
float n1, n2, n3, n4, n5;
|
||||
NzVector4f A;
|
||||
NzVector4i Origin;
|
||||
NzVector4f d1,d2,d3,d4,d5;
|
||||
NzVector4i off1, off2,off3;
|
||||
NzVector4f IsoOriginDist;
|
||||
NzVector4f H[5];
|
||||
NzVector4i Origin;
|
||||
NzVector4i off1, off2,off3;
|
||||
|
||||
int ii,jj,kk,ll;
|
||||
int gi0,gi1,gi2,gi3,gi4,gi5,gi6,gi7,gi8,gi9,gi10,gi11,gi12,gi13,gi14,gi15;
|
||||
float lenght;
|
||||
float c1,c2,c3,c4,c5,c6;
|
||||
int c;
|
||||
|
||||
|
||||
@@ -1,38 +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 PERLIN1D_H
|
||||
#define PERLIN1D_H
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
//#include <Nazara/Noise/NoiseBase.hpp>
|
||||
#include "NoiseBase.hpp"
|
||||
|
||||
template <typename T> class NzPerlin1D : public NzNoiseBase
|
||||
{
|
||||
public:
|
||||
NzPerlin1D();
|
||||
T GetValue(T x, T res);
|
||||
~NzPerlin1D() = default;
|
||||
protected:
|
||||
private:
|
||||
int x0;
|
||||
int gi0,gi1;
|
||||
int ii;
|
||||
int gradient1[16];
|
||||
T s,t;
|
||||
T Cx;
|
||||
T nx;
|
||||
T tmp;
|
||||
};
|
||||
|
||||
typedef NzPerlin1D<float> NzPerlin1Df;
|
||||
typedef NzPerlin1D<double> NzPerlin1Dd;
|
||||
|
||||
//#include <Nazara/Noise/Perlin1D.inl>
|
||||
#include "Perlin1D.inl"
|
||||
|
||||
#endif // PERLIN1D_H
|
||||
@@ -1,37 +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
|
||||
|
||||
//#include <Nazara/Noise/Error.hpp>
|
||||
//#include <Nazara/Noise/Config.hpp>
|
||||
//#include <Nazara/Noise/Debug.hpp>
|
||||
#include <iostream>
|
||||
|
||||
template <typename T>
|
||||
NzPerlin1D<T>::NzPerlin1D()
|
||||
{
|
||||
gradient1[0] = 1;
|
||||
gradient1[1] = -1;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T NzPerlin1D<T>::GetValue(T x, T res)
|
||||
{
|
||||
nx = x/res;
|
||||
x0 = static_cast<int>(nx);
|
||||
ii = x0 & 255;
|
||||
|
||||
gi0 = perm[ii] % 2;
|
||||
gi1 = perm[ii + 1] % 2;
|
||||
|
||||
tmp = nx-x0;
|
||||
s = gradient1[gi0]*tmp;
|
||||
|
||||
tmp = nx-(x0+1);
|
||||
t = gradient1[gi1]*tmp;
|
||||
|
||||
tmp = nx-x0;
|
||||
Cx = tmp * tmp * tmp * (tmp * (tmp * 6 - 15) + 10);
|
||||
|
||||
return s + Cx*(t-s);
|
||||
}
|
||||
@@ -8,7 +8,8 @@
|
||||
#define PERLIN2D_H
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Noise/NoiseBase.hpp>
|
||||
//#include <Nazara/Noise/NoiseBase.hpp>
|
||||
#include "NoiseBase.hpp"
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
|
||||
template <typename T> class NzPerlin2D : public NzNoiseBase
|
||||
@@ -34,7 +35,8 @@ template <typename T> class NzPerlin2D : public NzNoiseBase
|
||||
typedef NzPerlin2D<float> NzPerlin2Df;
|
||||
typedef NzPerlin2D<double> NzPerlin2Dd;
|
||||
|
||||
#include <Nazara/Noise/Perlin2D.inl>
|
||||
//#include <Nazara/Noise/Perlin2D.inl>
|
||||
#include "Perlin2D.inl"
|
||||
|
||||
#endif // PERLIN2D_H
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Noise/Error.hpp>
|
||||
#include <Nazara/Noise/Config.hpp>
|
||||
#include <Nazara/Noise/Debug.hpp>
|
||||
//#include <Nazara/Noise/Error.hpp>
|
||||
//#include <Nazara/Noise/Config.hpp>
|
||||
//#include <Nazara/Noise/Debug.hpp>
|
||||
|
||||
template <typename T>
|
||||
NzPerlin2D<T>::NzPerlin2D()
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#define PERLIN3D_H
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Noise/NoiseBase.hpp>
|
||||
//#include <Nazara/Noise/NoiseBase.hpp>
|
||||
#include "NoiseBase.hpp"
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
template <typename T> class NzPerlin3D : public NzNoiseBase
|
||||
@@ -35,6 +36,7 @@ template <typename T> class NzPerlin3D : public NzNoiseBase
|
||||
typedef NzPerlin3D<float> NzPerlin3Df;
|
||||
typedef NzPerlin3D<double> NzPerlin3Dd;
|
||||
|
||||
#include <Nazara/Noise/Perlin3D.inl>
|
||||
//#include <Nazara/Noise/Perlin3D.inl>
|
||||
#include "Perlin3D.inl"
|
||||
|
||||
#endif // PERLIN3D_H
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Noise/Error.hpp>
|
||||
#include <Nazara/Noise/Config.hpp>
|
||||
#include <Nazara/Noise/Debug.hpp>
|
||||
//#include <Nazara/Noise/Error.hpp>
|
||||
//#include <Nazara/Noise/Config.hpp>
|
||||
//#include <Nazara/Noise/Debug.hpp>
|
||||
|
||||
template <typename T>
|
||||
NzPerlin3D<T>::NzPerlin3D()
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#define PERLIN4D_H
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Noise/NoiseBase.hpp>
|
||||
//#include <Nazara/Noise/NoiseBase.hpp>
|
||||
#include "NoiseBase.hpp"
|
||||
#include <Nazara/Math/Vector4.hpp>
|
||||
|
||||
template <typename T> class NzPerlin4D : public NzNoiseBase
|
||||
@@ -35,6 +36,7 @@ template <typename T> class NzPerlin4D : public NzNoiseBase
|
||||
typedef NzPerlin4D<float> NzPerlin4Df;
|
||||
typedef NzPerlin4D<double> NzPerlin4Dd;
|
||||
|
||||
#include <Nazara/Noise/Perlin4D.inl>
|
||||
//#include <Nazara/Noise/Perlin4D.inl>
|
||||
#include "Perlin4D.inl"
|
||||
|
||||
#endif // PERLIN4D_H
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Noise/Error.hpp>
|
||||
#include <Nazara/Noise/Config.hpp>
|
||||
#include <Nazara/Noise/Debug.hpp>
|
||||
//#include <Nazara/Noise/Error.hpp>
|
||||
//#include <Nazara/Noise/Config.hpp>
|
||||
//#include <Nazara/Noise/Debug.hpp>
|
||||
|
||||
template <typename T>
|
||||
NzPerlin4D<T>::NzPerlin4D()
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#define SIMPLEX2D_H
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Noise/NoiseBase.hpp>
|
||||
//#include <Nazara/Noise/NoiseBase.hpp>
|
||||
#include "NoiseBase.hpp"
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
|
||||
|
||||
@@ -37,7 +38,8 @@ template <typename T> class NzSimplex2D : public NzNoiseBase
|
||||
typedef NzSimplex2D<float> NzSimplex2Df;
|
||||
typedef NzSimplex2D<double> NzSimplex2Dd;
|
||||
|
||||
#include <Nazara/Noise/Simplex2D.inl>
|
||||
//#include <Nazara/Noise/Simplex2D.inl>
|
||||
#include "Simplex2D.inl"
|
||||
|
||||
#endif // SIMPLEX2D_H
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Noise/Error.hpp>
|
||||
#include <Nazara/Noise/Config.hpp>
|
||||
#include <Nazara/Noise/Debug.hpp>
|
||||
//#include <Nazara/Noise/Error.hpp>
|
||||
//#include <Nazara/Noise/Config.hpp>
|
||||
//#include <Nazara/Noise/Debug.hpp>
|
||||
|
||||
template <typename T>
|
||||
NzSimplex2D<T>::NzSimplex2D()
|
||||
|
||||
Reference in New Issue
Block a user