This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Read file "package.json" into variable string, removing line breaks. | |
set string= | |
for /f "delims=" %%x in (package.json) do set "string=!string!%%x" | |
rem Remove quotes | |
set string=%string:"=% | |
rem Remove braces | |
set "string=%string:~2,-2%" | |
rem Change colon+space by equal-sign | |
set "string=%string:: ==%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Implemented as described here: | |
http://flafla2.github.io/2014/08/09/perlinnoise.html | |
]]-- | |
perlin = {} | |
perlin.p = {} | |
-- Hash lookup table as defined by Ken Perlin | |
-- This is a randomly arranged array of all numbers from 0-255 inclusive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Perlin { | |
public int repeat; | |
public Perlin(int repeat = -1) { | |
this.repeat = repeat; | |
} | |
public double OctavePerlin(double x, double y, double z, int octaves, double persistence) { | |
double total = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Perlin { | |
public static double OctavePerlin(double x, double y, double z, int octaves, double persistence) { | |
double total = 0; | |
double frequency = 1; | |
double amplitude = 1; | |
for(int i=0;i<octaves;i++) { | |
total += perlin(x * frequency, y * frequency, z * frequency) * amplitude; | |
amplitude *= persistence; |