Skip to content

Instantly share code, notes, and snippets.

@joeld42
joeld42 / gist:74f67cde97a789467a2f681961b89c27
Created April 12, 2016 23:42
C Allocator that tracks alloc size
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
typedef struct
{
size_t alloc_size;
} block_header;
@joeld42
joeld42 / gist:c8dce66eb4b893cac0f1
Created November 3, 2015 20:10
zbuffer vs depth sorting examples for Luxe
import luxe.Input;
import luxe.Color;
import phoenix.geometry.CircleGeometry;
// NOTE: Using depth sort is reccomended, but if you want to use the
// zbuffer in addition (e.g. to mix with custom GL render passes) this
// is how to do it
//
// Add this to the 'build' section of your project.flow file
@joeld42
joeld42 / gist:3baf9c3a797de83adb22
Created September 29, 2015 21:07
old crufty ear clipping
bool ccwN( sgVec2 dir1, sgVec2 dir2 ) {
return (dir1[0]*dir2[1] - dir2[0]*dir1[1]) > 0;
}
bool ccw( sgVec2 dir1, sgVec2 dir2 ) {
sgNormalizeVec2( dir1 );
sgNormalizeVec2( dir2 );
return ccwN(dir1,dir2);
}