9 #ifndef VRECKO_NATURE_TERRAIN_PERLINNOISE_H
10 #define VRECKO_NATURE_TERRAIN_PERLINNOISE_H
13 #include "../TerrainUtility.h"
22 int _permutationTable[514];
23 osg::ref_ptr<osg::Vec2Array> _gradientsTable;
84 static inline float EaseCurve(
float t) {
return (t * t) * (3.0f - 2.0f * t); }
98 inline osg::Vec2 GetGradient(
int x,
int y) {
99 return (*_gradientsTable)[ this->_permutationTable[ this->_permutationTable[ x ] + y ] ]; }
112 static inline float InterpolationLinear(
float from,
float to,
float x) {
return from + x * (to - from); }
125 static inline float InterpolationCosine(
float from,
float to,
float x) {
return from +
126 ((1.0f - cos(x * (
float)
osg::PI)) * 0.5f) * (to - from); }