I hereby claim:
- I am tuttlem on github.
- I am tuttlem (https://keybase.io/tuttlem) on keybase.
- I have a public key whose fingerprint is 4E3E ED83 4041 0AAD 58FC B89C 692A EBE9 0953 9D86
To claim this, I am signing this object:
#include <chrono> | |
#include <sstream> | |
#include <string> | |
#include <memory> | |
#include <iostream> | |
#include <cstdlib> | |
#include "picosha2.h" | |
class block { |
import java.awt.BorderLayout; | |
import java.awt.Canvas; | |
import java.awt.Color; | |
import java.awt.Frame; | |
import java.awt.Graphics2D; | |
import java.awt.Toolkit; | |
import java.awt.image.BufferStrategy; | |
import java.util.Timer; | |
import java.util.TimerTask; |
I hereby claim:
To claim this, I am signing this object:
module Main where | |
import Control.Concurrent | |
main :: IO () | |
main = do | |
-- grab the parent thread id and print it | |
parentId <- myThreadId | |
putStrLn (show parentId) | |
class texture { | |
public: | |
// manage the generated texture id | |
texture(const GLuint t) : _reference(t) { } | |
// cleanup of the allocated resource | |
virtual ~texture(void); | |
// provide access to the reference | |
const GLuint reference() const { return _reference; } |
#include <iostream> | |
#include <lua.hpp> | |
int main(int argc, char *argv[]) { | |
// create a new lua context to work with | |
lua_State *L = luaL_newstate(); | |
// open any library we may use | |
luaL_openlibs(L); |
for (int x = 0; x < w; x ++) { | |
for (int y = 0; y < h; y ++) { | |
float xx = (float)x / (float)this->width; | |
float yy = (float)y / (float)this->height; | |
map[x + (y * w)] = perlin::perlin2d( | |
xx, yy, | |
6, 1.02f | |
); | |
} |
float perlin2d(const float x, const float y, | |
const int octaves, const float persistence) { | |
float total = 0.0f; | |
for (int i = 0; i <= (octaves - 1); i ++) { | |
float frequency = powf(2, i); | |
float amplitude = powf(persistence, i); | |
total = total + interpolateNoise(x * frequency, y * frequency) * amplitude; | |
} |
/* Linear interpolation */ | |
float lerp(float a, float b, float x) { | |
return a * (1 - x) + b * x; | |
} | |
/* Trigonometric interpolation */ | |
float terp(float a, float b, float x) { | |
float ft = x * 3.1415927f; | |
float f = (1 - cosf(ft)) * 0.5f; |
float smoothNoise(const float x, const float y) { | |
int ix = (int)x; | |
int iy = (int)y; | |
// sample the corners | |
float corners = (noise(ix - 1, iy - 1) + | |
noise(ix + 1, iy - 1) + | |
noise(ix - 1, iy + 1) + | |
noise(ix + 1, iy + 1)) / 16; |