Skip to content

Instantly share code, notes, and snippets.

View lewislepton's full-sized avatar
🏳️‍🌈
tofu bouncing bonanza

Lewis Lepton lewislepton

🏳️‍🌈
tofu bouncing bonanza
View GitHub Profile
@banksean
banksean / perlin-noise-classical.js
Created February 15, 2010 10:00
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
@jamis
jamis / recursive-backtracker.rb
Created December 24, 2010 22:41
Implementation of the recursive backtracking algorithm for maze generation
# Recursive backtracking algorithm for maze generation. Requires that
# the entire maze be stored in memory, but is quite fast, easy to
# learn and implement, and (with a few tweaks) gives fairly good mazes.
# Can also be customized in a variety of ways.
DIRS = (N, S, E, W = 1, 2, 4, 8)
DX = { E => 1, W => -1, N => 0, S => 0 }
DY = { E => 0, W => 0, N => -1, S => 1 }
OPPOSITE = { E => W, W => E, N => S, S => N }
@joelverhagen
joelverhagen / README.md
Created February 12, 2012 02:14
Jekyll YouTube Embed Plugin

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}
@companje
companje / subdivide-tetrahedron.cpp
Created August 4, 2012 16:21
Subdivide a tetrahedron to a sphere with ofMesh in openFrameworks
#include "ofMain.h"
#include "ofAppGlutWindow.h"
class ofApp : public ofBaseApp {
public:
ofMesh mesh;
ofEasyCam cam;
void setup() {
@fserb
fserb / macro.hx
Created November 8, 2013 20:43
Macro example
class MyClass {
/*
usage:
function x() {
var c = new MyClass();
var x = c.func(10);
}
*/
macro public function func(ethis: Expr, block: Expr): Expr {
@SimpleDrunk
SimpleDrunk / hexagon mosaic
Created December 6, 2013 01:28
『openframeworks』shader制作六边形马赛克效果 http://blog.csdn.net/simpledrunk/article/details/17095821
//testApp.h
#pragma once
#include "ofMain.h"
class testApp : public ofBaseApp{
public:
void setup();
void update();
@fserb
fserb / polygon.hx
Created March 24, 2014 22:25
SAT for Polygon intersection in 50 lines of Haxe
// Given a Vec2 vector class...
function hitPolygonAxis(points: Array<Vec2>, ret: Array<Float>) {
for (i in 0...points.length) {
var a = points[i];
var b = points[(i+1) % points.length];
var v = Vec2.make(b.x - a.x, b.y - a.y).normal();
// we should be able to only use half circunference.
ret.push(v.angle());
}
}
@jah2488
jah2488 / raycast.hx
Created April 29, 2014 18:56
A simple raycasting proof of concept I did a few months back in haxe/openfl. Think of the original doom. Its kinda like that.
package;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.Lib;
import flash.ui.Keyboard;
import flash.Vector;
@Ohmnivore
Ohmnivore / gist:6622d99de2d8aa2cce0f
Created May 20, 2014 00:09
Haxe laoder for Ogmo Editor
package ;
#if CLIENT
#else
import entities.Flag;
import entities.HealthPack;
import entities.Spawn;
import flixel.util.FlxPoint;
#end
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active May 24, 2024 03:20
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);