Skip to content

Instantly share code, notes, and snippets.


Tilman Schmidt KeyMaster-

View GitHub Profile
KeyMaster- / BytesUtil.hx
Last active Aug 29, 2015 to bit string representation
View BytesUtil.hx
class BytesUtil {
* Represent a Bytes object as single bits in a string
* @param b The bytes
* @return A string of '0's and '1's representing the bytes
public static function toBits(b:Bytes):String {
var s:String = "";
KeyMaster- / spriteGlitch.shader
Last active Dec 18, 2022
A glitch effect shader for Sprites in Unity3D
View spriteGlitch.shader
//Copyright (c) 2014 Tilman Schmidt (@KeyMaster_)
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in
KeyMaster- / IsoCamSetup
Created Oct 5, 2014
Isometric view in the luxe engine
View IsoCamSetup
//Rotate the camera such that z points up and x to the right
var o:Quaternion = new Quaternion().setFromEuler(new Vector().set_xyz(-90, 0, 0).radians());
//Rotate by Arctan(sin(45°)) (grabbed from wikipedia) around x, to get the top-down part
var q:Quaternion = new Quaternion().setFromEuler(new Vector().set_xyz(Math.atan(Math.sin(45 * Maths.DEG2RAD)), 0, 0));
//Rotate around z by -45° to get the side-on part
var p:Quaternion = new Quaternion().setFromEuler(new Vector().set_xyz(0, 0, -45).radians());
//Combine the rotations and apply to the camera
KeyMaster- / PlyImporter.hx
Last active Aug 29, 2015
Importer for PLY files from Blender into Luxe
View PlyImporter.hx
import luxe.Mesh;
import luxe.options.MeshOptions;
import luxe.Vector;
import phoenix.Batcher;
import phoenix.geometry.Geometry;
import PlyParser;
import phoenix.geometry.Vertex;
KeyMaster- / polarWarp.glsl
Created Apr 4, 2015
Cartesian to Polar coordinates warp shader, for
View polarWarp.glsl
//To be used on
//Uses the image at iChannel0 and warps it into polar coordinates
void mainImage( out vec4 fragColor, in vec2 fragCoord )
vec2 relativePos = fragCoord.xy - (iResolution.xy / 2.0);
vec2 polar;
polar.y = sqrt(relativePos.x * relativePos.x + relativePos.y * relativePos.y);
polar.y /= iResolution.x / 2.0;
polar.y = 1.0 - polar.y;
KeyMaster- / polarWarp.glsl
Last active Nov 20, 2019
Luxe polar warp shader
View polarWarp.glsl
//The source texture that will be transformed
uniform sampler2D tex0;
//The texture coordinate passed in from the vertex shader (the default luxe vertex shader is suffice)
varying vec2 tcoord;
//x: width of the texture divided by the radius that represents the top of the image (normally screen width / radius)
//y: height of the texture divided by the radius representing the top of the image (normally screen height / radius)
uniform vec2 sizeOverRadius;
KeyMaster- / PhysBody.hx
Created Apr 4, 2015
Luxe rectangles physics engine (WIP, and very basic)
View PhysBody.hx
package ;
import luxe.Component;
import luxe.Rectangle;
import luxe.Vector;
class PhysBody {
public var rect:Rectangle;
public var vel:Vector;
public var acc:Vector;
KeyMaster- / WavePhys.hx
Created Apr 16, 2015
Code sample for doing wave spring physics
View WavePhys.hx
//Note: This does _not_ compile, it's just to demonstrate the relevant physics bits
class Main extends luxe.Game {
var fieldWidth:Int = 60;
var fieldDepth:Int = 60;
var physTimeStep:Float = 1 / 60;
var physTimeCounter:Float = 0;
var springK:Float = 100;
var springDampening:Float = 0.00;
KeyMaster- / ScreenfluidExample.hx
Created Apr 26, 2015
Example use of a screen-wide fluid to create global drag for nape bodies
View ScreenfluidExample.hx
var screenShape = new Polygon(Polygon.rect(0, 0, Luxe.screen.w, Luxe.screen.h, true));
screenShape.fluidEnabled = true;
//Density of 0.3, Viscosity of 3. These are values you just have to experiment with until it feels right
screenShape.fluidProperties = new FluidProperties(0.3, 3);
//It's important to set the collisionMask (second parameter) to 0 here,
//so the shape doesn't collide with anything (we want everything to just move through it)
screenShape.filter = new InteractionFilter(1, 0);
//Set up a body holding the shape and add it to the space
var screenBody = new Body(BodyType.STATIC);
KeyMaster- / InputSystem.hx
Created Jul 17, 2015
Old OpenFL input system for an entity component system framework
View InputSystem.hx
* Author: Richard Lord
* Copyright (c) Big Room Ventures Ltd. 2007
* Version: 1.0.2
* Modified and extended by Tilman Schmidt (@KeyMaster_)
* - Fixed key buffer size to contain enough bits for all keys
* - Added buffering for entity component system framework
* - Added keyUp and keyDown lookups
* Licence Agreement