Skip to content

Instantly share code, notes, and snippets.

View bzgeb's full-sized avatar

Bronson Zgeb bzgeb

View GitHub Profile
@bzgeb
bzgeb / SetSortingLayer.cs
Created February 20, 2014 19:23
Set sorting layer component. Sets the sorting layer and order of any renderer, not just sprite renderers.
using UnityEngine;
using System.Collections;
public class SetSortingLayer : MonoBehaviour
{
public string sortingLayerName;
public int sortingLayerOrder;
void Start() {
renderer.sortingLayerName = sortingLayerName;
app.configure(function () {
app.use(express.static(__dirname + '/public'));
app.use(express.bodyParser());
app.set('views', __dirname);
//app.set('view engine', 'jade');
// make a custom html template
app.register('.html', {
compile: function(str, options){
return function(locals){
return str;
@bzgeb
bzgeb / gist:72f7b1a5a40ec144e37d
Created October 30, 2014 17:39
Draw a head in processing
////////////////////////Draw a head//////////////////////////////
fill(100 + random(150), 100 + random(150), 100 + random(150));
for ( int i = 0; i < numLines; ++i ) {
beginShape();
for ( float angle = 0; angle < 360; angle += step ) {
float radian = radians( angle );
x = xCenter + ( headXRadius * cos( radian ) ) + random(15);
y = yCenter - ( headYRadius * sin( radian ) ) + random(20);
if ( lastx > -999 ) {
///////////////////////////////////////////////////////////////////////////////
// ATMOSPHERIC SCATTERING
// Viewing the sky from within the atmosphere.
//
// Based on OGRE Forum user HexiDave's Atmospheric Scattering demo
// http://www.ogre3d.org/forums/viewtopic.php?t=37072
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// ATMOSPHERIC SCATTERING
// Viewing the sky from space.
//
// Based on OGRE Forum user HexiDave's Atmospheric Scattering demo
// http://www.ogre3d.org/forums/viewtopic.php?t=37072
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@bzgeb
bzgeb / PdBase_wrapper.mm
Created August 27, 2012 17:33
A wrapper for PdBase which can be called in Unity3D
#import "PdAudio.h"
#import "PdBase.h"
#import "PdDispatcher.h"
#import "Listener.h"
#import "PointerObject.h"
extern "C" {
extern void lrshift_tilde_setup(void);
extern void argument_setup(void);
extern void phasorshot_tilde_setup(void);
@bzgeb
bzgeb / send_symbol.m
Created August 27, 2012 17:56
An example wrapper function for PdBase called by Unity3D
void _sendSymbolToReceiver(char * symbol, int symLength, char * receiver, int recLength)
{
NSString * _receiver = [[NSString alloc] initWithData:[NSData dataWithBytes:receiver length:recLength] encoding:NSUTF16LittleEndianStringEncoding];
NSString * _symbol = [[NSString alloc] initWithData:[NSData dataWithBytes:symbol length:symLength] encoding:NSUTF16LittleEndianStringEncoding];
[PdBase sendSymbol:_symbol toReceiver:_receiver];
[_symbol release];
[_receiver release];
}
@bzgeb
bzgeb / PureData.cs
Created August 27, 2012 18:42
An interface from Unity3d to a native libPd implementation
using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
public class PureData {
/* Interface to native implementation */
[DllImport ("__Internal")]
private static extern void _copyDemoPatchesToUserDomain ();
using UnityEngine;
using System.Collections;
public class TrailerTarget : MonoBehaviour {
public Transform[] positions;
public float[] times;
private int current_index;
IEnumerator OnTrailer()
{
@bzgeb
bzgeb / Synth.cs
Created November 6, 2012 03:11
Example PureData synth
using UnityEngine;
using System.Collections;
public class Synth : MonoBehaviour {
private int transpose = 48;
public void play(int note) {
PureData.sendFloat(note + transpose, "note");
}