Skip to content

Instantly share code, notes, and snippets.

View haxiomic's full-sized avatar
:octocat:
Everything is happening

George Corney haxiomic

:octocat:
Everything is happening
View GitHub Profile
@haxiomic
haxiomic / gist:25ceea09e8aaee11a3d3
Last active August 29, 2015 14:07
Tools for analysing javascript classes (tested on three.js)
function generateClassTree(classObject){//eg: (THREE) => ["Object3D"={"Mesh":{"SkinnedMesh"}, "Camera"}]
var classNameTree = {};
//pull out only class-like properties
var unpushedClasses = {};
for(var className in classObject){
if(classObject[className] instanceof Function)
unpushedClasses[className] = classObject[className];
}
function orderedMerge(a:Array<Int>, b:Array<Int>){
var result = new Array<Int>();
var ai = 0, bi = 0;
while(ai < a.length || bi < b.length){
var nextA:Null<Int> = ai < a.length ? a[ai] : null;
var nextB:Null<Int> = bi < b.length ? b[bi] : null;
if((nextA < nextB && nextA != null) || nextB == null){
result.push(nextA);
@haxiomic
haxiomic / shaderblox.md
Last active August 29, 2015 14:06
shaderblox
  • Allocation management with reference counting in ShaderBase
  • better inheritance with glsl parser

A few other ideas:

#defines, defines could be used to replace branching in shaders because is so expensive (http://stackoverflow.com/a/14836396/4038621), and alter constants

say you've got some shader: