Skip to content

Instantly share code, notes, and snippets.

@vasumahesh1
Created October 23, 2016 11:33
Show Gist options
  • Save vasumahesh1/0d0529cca304c8cddefdc746aba25cf5 to your computer and use it in GitHub Desktop.
Save vasumahesh1/0d0529cca304c8cddefdc746aba25cf5 to your computer and use it in GitHub Desktop.
Header file for the Perlin Terrain Gen.
#pragma once
namespace Scaled
{
class Generator
{
static int originalPermutation[256];
int perm[512];
int mapHeight;
int mapWidth;
int octaves;
float persistence;
float amplitude;
float perlinGradientFunc(int hash, float x, float y);
float perlinLerp(float a, float b, float x);
float perlinFade(float t);
float generatePerlin(float x, float y);
public:
Generator(int height, int width);
float Perlin(float x, float y);
void SetNoiseOctaves(int oct);
void SetNoisePersistence(float pers);
void SetAmplitude(float amp);
float** GenerateMap();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment