34 changed files with 19 additions and 213 deletions
@ -1,47 +0,0 @@
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* ===================================================================================== |
||||
* |
||||
* Filename: gradientnoise.cpp |
||||
* |
||||
* Description: |
||||
* |
||||
* Version: 1.0 |
||||
* Created: 05/10/2014 03:47:54 PM |
||||
* Revision: none |
||||
* Compiler: gcc |
||||
* |
||||
* Author: YOUR NAME (), |
||||
* Organization: |
||||
* |
||||
* ===================================================================================== |
||||
*/ |
||||
#include "gradientnoise.h" |
||||
|
||||
namespace vtk { |
||||
|
||||
GradientNoise::GradientNoise() : Module(GetSourceModuleCount()){ |
||||
|
||||
} |
||||
|
||||
int GradientNoise::GetSourceModuleCount() const { |
||||
return 0; |
||||
} |
||||
|
||||
double GradientNoise::GetValue(double x, double y, double z) const { |
||||
//We don't need x and z, so we suppress the warnings about it
|
||||
(void)x; |
||||
(void)z; |
||||
|
||||
if (y <= stop0) return -1.0; |
||||
if (y >= stop1) return 1.0; |
||||
|
||||
return ((y - stop0) / (stop1 - stop0)) * 2 - 1; |
||||
} |
||||
|
||||
void GradientNoise::setStop(const int& index, const double& value) { |
||||
if (index == 0) stop0 = value; |
||||
else if (index == 1) stop1 = value; |
||||
} |
||||
|
||||
} |
||||
|
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* ===================================================================================== |
||||
* |
||||
* Filename: gradientnoise.h |
||||
* |
||||
* Description: Produces a vertical gradient |
||||
* |
||||
* Version: 1.0 |
||||
* Created: 05/10/2014 03:42:45 PM |
||||
* Revision: none |
||||
* Compiler: gcc |
||||
* |
||||
* Author: YOUR NAME (), |
||||
* Organization: |
||||
* |
||||
* ===================================================================================== |
||||
*/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <noise/noise.h> |
||||
|
||||
|
||||
//TODO: Add support for more than 2 stops
|
||||
|
||||
namespace vtk { |
||||
|
||||
class GradientNoise : public noise::module::Module { |
||||
public: |
||||
GradientNoise(); |
||||
|
||||
virtual int GetSourceModuleCount() const; |
||||
virtual double GetValue(double x, double y, double z) const; |
||||
|
||||
void setStop(const int& index, const double& value); |
||||
|
||||
protected: |
||||
double stop0; |
||||
double stop1; |
||||
}; |
||||
|
||||
|
||||
} |
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* ===================================================================================== |
||||
* |
||||
* Filename: yturbulence.cpp |
||||
* |
||||
* Description: |
||||
* |
||||
* Version: 1.0 |
||||
* Created: 05/10/2014 06:17:38 PM |
||||
* Revision: none |
||||
* Compiler: gcc |
||||
* |
||||
* Author: YOUR NAME (), |
||||
* Organization: |
||||
* |
||||
* ===================================================================================== |
||||
*/ |
||||
#include "yturbulence.h" |
||||
|
||||
namespace vtk { |
||||
YTurbulence::YTurbulence() : Module(GetSourceModuleCount()){ |
||||
|
||||
} |
||||
|
||||
int YTurbulence::GetSourceModuleCount() const { |
||||
return 1; |
||||
} |
||||
|
||||
double YTurbulence::GetValue(double x, double y, double z) const { |
||||
double xOff, yOff, zOff; |
||||
xOff = x + (12414.0 / 65536.0); |
||||
yOff = y + (65124.0 / 65536.0); |
||||
zOff = z + (31337.0 / 65536.0); |
||||
|
||||
double distortion = y + (yNoise.GetValue(xOff, yOff, zOff) * power); |
||||
|
||||
return m_pSourceModule[0]->GetValue(x, distortion, z); |
||||
} |
||||
|
||||
} |
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* ===================================================================================== |
||||
* |
||||
* Filename: yturbulence.h |
||||
* |
||||
* Description: Y axis turbulence using perlin, |
||||
* Basically just normal turbulence, but only on Y. |
||||
* |
||||
* Version: 1.0 |
||||
* Created: 05/10/2014 06:11:09 PM |
||||
* Revision: none |
||||
* Compiler: gcc |
||||
* |
||||
* Author: YOUR NAME (), |
||||
* Organization: |
||||
* |
||||
* ===================================================================================== |
||||
*/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <noise/noise.h> |
||||
|
||||
|
||||
//TODO: Add support for more than 2 stops
|
||||
|
||||
namespace vtk { |
||||
|
||||
class YTurbulence : public noise::module::Module { |
||||
public: |
||||
YTurbulence(); |
||||
|
||||
virtual int GetSourceModuleCount() const; |
||||
virtual double GetValue(double x, double y, double z) const; |
||||
|
||||
noise::module::Perlin yNoise; |
||||
double power; |
||||
protected: |
||||
|
||||
}; |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue