DONT KNOW :D
This commit is contained in:
parent
4152ee0413
commit
8505032307
44 changed files with 1360 additions and 275 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
|
||||
namespace VUtils {
|
||||
class Environment {
|
||||
|
|
@ -20,7 +20,7 @@ namespace VUtils {
|
|||
void set(const char* name, const char *value);
|
||||
void setNumber(const char* name, double value);
|
||||
protected:
|
||||
std::unordered_map<std::string, std::string> m_env;
|
||||
std::map<std::string, std::string> m_env;
|
||||
std::string m_prefix = "VENV_";
|
||||
std::string m_filename;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,5 +7,6 @@ namespace VUtils {
|
|||
static double bezierBlend(double t);
|
||||
static double easeIn(double ratio);
|
||||
static double map(double x, double in_min, double in_max, double out_min, double out_max);
|
||||
static double cubicInterpolate (double y0, double y1, double y2, double y3, double factor);
|
||||
};
|
||||
}
|
||||
23
headers/VUtils/Random.h
Normal file
23
headers/VUtils/Random.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <random>
|
||||
|
||||
namespace VUtils {
|
||||
|
||||
class Random {
|
||||
public:
|
||||
static Random& the() {
|
||||
static Random _instance;
|
||||
return _instance;
|
||||
}
|
||||
Random();
|
||||
static double generate(double min, double max);
|
||||
double get(double min, double max);
|
||||
void setDist(double min, double max);
|
||||
double getFast();
|
||||
private:
|
||||
std::random_device m_rd;
|
||||
std::mt19937 m_mt;
|
||||
std::uniform_real_distribution<double> m_dist;
|
||||
};
|
||||
}
|
||||
55
headers/VUtils/SimplexNoise.h
Normal file
55
headers/VUtils/SimplexNoise.h
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* @file SimplexNoise.h
|
||||
* @brief A Perlin Simplex Noise C++ Implementation (1D, 2D, 3D).
|
||||
*
|
||||
* Copyright (c) 2014-2018 Sebastien Rombauts (sebastien.rombauts@gmail.com)
|
||||
*
|
||||
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
|
||||
* or copy at http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <cstddef> // size_t
|
||||
|
||||
/**
|
||||
* @brief A Perlin Simplex Noise C++ Implementation (1D, 2D, 3D, 4D).
|
||||
*/
|
||||
class SimplexNoise {
|
||||
public:
|
||||
// 1D Perlin simplex noise
|
||||
static float noise(float x);
|
||||
// 2D Perlin simplex noise
|
||||
static float noise(float x, float y);
|
||||
// 3D Perlin simplex noise
|
||||
static float noise(float x, float y, float z);
|
||||
|
||||
// Fractal/Fractional Brownian Motion (fBm) noise summation
|
||||
float fractal(size_t octaves, float x) const;
|
||||
float fractal(size_t octaves, float x, float y) const;
|
||||
float fractal(size_t octaves, float x, float y, float z) const;
|
||||
|
||||
/**
|
||||
* Constructor of to initialize a fractal noise summation
|
||||
*
|
||||
* @param[in] frequency Frequency ("width") of the first octave of noise (default to 1.0)
|
||||
* @param[in] amplitude Amplitude ("height") of the first octave of noise (default to 1.0)
|
||||
* @param[in] lacunarity Lacunarity specifies the frequency multiplier between successive octaves (default to 2.0).
|
||||
* @param[in] persistence Persistence is the loss of amplitude between successive octaves (usually 1/lacunarity)
|
||||
*/
|
||||
explicit SimplexNoise(float frequency = 1.0f,
|
||||
float amplitude = 1.0f,
|
||||
float lacunarity = 2.0f,
|
||||
float persistence = 0.5f) :
|
||||
mFrequency(frequency),
|
||||
mAmplitude(amplitude),
|
||||
mLacunarity(lacunarity),
|
||||
mPersistence(persistence) {
|
||||
}
|
||||
|
||||
private:
|
||||
// Parameters of Fractional Brownian Motion (fBm) : sum of N "octaves" of noise
|
||||
float mFrequency; ///< Frequency ("width") of the first octave of noise (default to 1.0)
|
||||
float mAmplitude; ///< Amplitude ("height") of the first octave of noise (default to 1.0)
|
||||
float mLacunarity; ///< Lacunarity specifies the frequency multiplier between successive octaves (default to 2.0).
|
||||
float mPersistence; ///< Persistence is the loss of amplitude between successive octaves (usually 1/lacunarity)
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue