open_toontown_panda3d/panda/src/mathutil/perlinNoise.h

56 lines
1.5 KiB
C++

// Filename: perlinNoise.h
// Created by: drose (05Oct05)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef PERLINNOISE_H
#define PERLINNOISE_H
#include "pandabase.h"
#include "pvector.h"
#include "vector_int.h"
#include "luse.h"
#include "randomizer.h"
////////////////////////////////////////////////////////////////////
// Class : PerlinNoise
// Description : This is the base class for PerlinNoise2 and
// PerlinNoise3, different dimensions of Perlin noise
// implementation. The base class just collects the
// common functionality.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_MATHUTIL PerlinNoise {
protected:
PerlinNoise(int table_size, unsigned long seed);
PerlinNoise(const PerlinNoise &copy);
void operator = (const PerlinNoise &copy);
INLINE static double fade(double t);
INLINE static double lerp(double t, double a, double b);
PUBLISHED:
INLINE unsigned long get_seed();
protected:
int _table_size;
int _table_size_mask;
Randomizer _randomizer;
typedef vector_int Index;
Index _index;
};
#include "perlinNoise.I"
#endif