Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=====================================================================================//
  6. #ifndef NOISE_H
  7. #define NOISE_H
  8. #include <math.h>
  9. #include "basetypes.h"
  10. #include "mathlib/vector.h"
  11. #include "tier0/dbg.h"
  12. // The following code is the c-ification of Ken Perlin's new noise algorithm
  13. // "JAVA REFERENCE IMPLEMENTATION OF IMPROVED NOISE - COPYRIGHT 2002 KEN PERLIN"
  14. // as available here: http://mrl.nyu.edu/~perlin/noise/
  15. // it generates a single octave of noise in the -1..1 range
  16. // this should at some point probably replace SparseConvolutionNoise - jd
  17. float ImprovedPerlinNoise( Vector const &pnt );
  18. // get the noise value at a point. Output range is 0..1.
  19. float SparseConvolutionNoise( Vector const &pnt );
  20. // get the noise value at a point, passing a custom noise shaping function. The noise shaping
  21. // function should map the domain 0..1 to 0..1.
  22. float SparseConvolutionNoise(Vector const &pnt, float (*pNoiseShapeFunction)(float) );
  23. // returns a 1/f noise. more octaves take longer
  24. float FractalNoise( Vector const &pnt, int n_octaves );
  25. // returns a abs(f)*1/f noise i.e. turbulence
  26. float Turbulence( Vector const &pnt, int n_octaves );
  27. #endif // NOISE_H