Initial commit, yay
This commit is contained in:
commit
25e26756cd
85 changed files with 7077 additions and 0 deletions
52
src/rand/opensimplex.h
Normal file
52
src/rand/opensimplex.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* This code is part of the strategy game operational-space.
|
||||
* operational-space comes with ABSOLUTELY NO WARRANTY and is licensed under GPL-2.0.
|
||||
* Copyright (C) 2024 VegOwOtenks, Sleppo04
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef OPENSIMPLEX2S_H
|
||||
#define OPENSIMPLEX2S_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
#define PRIME_X (0x5205402B9270C86FL)
|
||||
#define PRIME_Y (0x598CD327003817B5L)
|
||||
#define HASH_MULTIPLIER (0x53A3F72DEEC546F5L)
|
||||
|
||||
#define ROOT2OVER2 (0.7071067811865476)
|
||||
#define SKEW_2D (0.366025403784439)
|
||||
#define UNSKEW_2D (-0.21132486540518713)
|
||||
|
||||
#define N_GRADS_2D_EXPONENT (7)
|
||||
#define N_GRADS_2D (1 << N_GRADS_2D_EXPONENT)
|
||||
|
||||
#define NORMALIZER_2D (0.05481866495625118)
|
||||
|
||||
#define RSQUARED_2D (2.0f / 3.0f)
|
||||
|
||||
/// @brief Get the standard noise using the at position x and y with seed seed
|
||||
/// @param seed
|
||||
/// @param x
|
||||
/// @param y
|
||||
/// @return noise at x, y with seed seed
|
||||
// TODO: Don't use this one, it has weird diagonal artifacts
|
||||
float OpenSimplex_2DNoise(int64_t seed, double x, double y);
|
||||
|
||||
float OpenSimplex_2DNoise_ImprovedX(int64_t seed, double x, double y);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue