Skip to content

Instantly share code, notes, and snippets.

View haxiomic's full-sized avatar

George Corney haxiomic

View GitHub Profile
@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:

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 / 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];
}
//THREE.hx r68
import js.html.*;
typedef HTMLElement = js.html.Element;
typedef HTMLCanvasElement = js.html.CanvasElement;
typedef HTMLImageElement = js.html.ImageElement;
typedef WebGLRenderingContext = js.html.webgl.RenderingContext;
/* Auto-generated using ts2hx */
@:enum @:native("THREE.CullFace") abstract CullFace(Int) {
@haxiomic
haxiomic / SassMeister-input-HTML.html
Created February 3, 2015 11:40
Generated by SassMeister.com.
<style>
.column,.columns{
background: #DDD;
text-align: center;
border-radius: 4px;
font-size: 1rem;
text-transform: uppercase;
height: 30px;
line-height: 30px;
margin-bottom: .75rem;
@haxiomic
haxiomic / Main.hx
Last active August 29, 2015 14:16
Working features touch_events
import luxe.Color;
import luxe.Input;
import luxe.Screen;
class Main extends luxe.Game {
var colors:Array<Color>;
override function config(config:luxe.AppConfig) {
@haxiomic
haxiomic / voxel-flatten.hx
Last active August 29, 2015 14:20
voxel flatten
function createSliceTexture(vox:Vox, axis:Int = 0, ?params:TextureParams, maxW:Null<Int> = 4096, POT:Bool = true):SliceTexture{
if(params == null) params = {};
var defaultParams = {
channelType: GL.RGBA,
dataType: GL.UNSIGNED_BYTE,
filter: GL.LINEAR,
wrapS: GL.CLAMP_TO_EDGE,
wrapT: GL.CLAMP_TO_EDGE,
unpackAlignment: TextureTools.defaultParams.unpackAlignment
@haxiomic
haxiomic / instructions
Last active August 29, 2015 14:22
Hello!
# Installing Alchemy Control and Player
- Download an android file transfer tool if you've not got one
### With oculus.zip
- Open the oculus.zip and copy the Oculus folder to the sd card. Copy the Bikini Atoll.mp4 video to Oculus/360Videos.
- Open a file manager app on the android (search file manager on store). Navigate to Oculus/Alchemy/Apps Tap on the two apk files individually and it should prompt to install. Once installed, go to your app launcher, find Alchemy Control and open it.
- It should say "Service Running" in green and above "Autoplay Video Bikini Atoll.mp4". If service isn't running hit enable. If the autoplay video name isn't grey, it can't find the video file. Make sure it's in the right place (should be Oculus/360Videos/Bikini Atoll.mp4). If it says "not set" it can't find the autoplay.txt, make sure that is Oculus/Alchemy/autoplay.txt and contains the video name.
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.ExprTools;
class ClassBuild{
//the entire contents of a class is contained in the class's fields
//a class-building-macro's job is to return an array of fields
static function saveClass():Array<Field>{
@haxiomic
haxiomic / ClassBuild.hx
Last active July 18, 2017 09:04
Recursive version of getSaveData macro for haxe group thread
import haxe.macro.ComplexTypeTools;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.ExprTools;
import haxe.macro.Type.TInst;
import haxe.macro.TypeTools;
class ClassBuild{
//the entire contents of a class is contained in the class's fields