Skip to content

Instantly share code, notes, and snippets.

View thomasvanta's full-sized avatar

VanTa thomasvanta

View GitHub Profile
@thomasvanta
thomasvanta / GLSL-blends.md
Created October 1, 2015 18:38
collected glsl blend modes

Luma

float luma(vec3 color) {
  return dot(color, vec3(0.299, 0.587, 0.114));
}

float luma(vec4 color) {
  return dot(color.rgb, vec3(0.299, 0.587, 0.114));
}
@thomasvanta
thomasvanta / GLSL-Noise.md
Created September 29, 2015 10:17 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@thomasvanta
thomasvanta / com.tvt.keep-twitter-alive.plist
Last active September 6, 2015 18:40 — forked from admsyn/README.txt
Keep an installation alive with launchd & launchctl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</exit>
<true/>
</dict>
<key>Label</key>
@thomasvanta
thomasvanta / whiteNanoKontrolConstants.h
Created February 8, 2015 18:20
NanoKontrol 1 midi Map for ofxMidi
// White NanoKontrol midi Map
const int NANO_KONTROL_SC1_SLIDER_1 = 2;
const int NANO_KONTROL_SC1_SLIDER_2 = 3;
const int NANO_KONTROL_SC1_SLIDER_3 = 4;
const int NANO_KONTROL_SC1_SLIDER_4 = 5;
const int NANO_KONTROL_SC1_SLIDER_5 = 6;
const int NANO_KONTROL_SC1_SLIDER_6 = 8;
const int NANO_KONTROL_SC1_SLIDER_7 = 9;
const int NANO_KONTROL_SC1_SLIDER_8 = 12;
@thomasvanta
thomasvanta / gist:8716300
Created January 30, 2014 19:00
OF: 2D Grid
textureRes = (int)sqrt((float)numParticles);
numParticles = textureRes * textureRes;
float * pos = new float[numParticles*3];
for (int x = 0; x < textureRes; x++){
for (int y = 0; y < textureRes; y++){
int i = textureRes * y + x;
pos[i*3 + 0] = ofMap(x + 1, 0, textureRes + 1, 0, 1); //x*offset;
pos[i*3 + 1] = ofMap(y + 1, 0, textureRes + 1, 0, 1); //y*offset;
#include "testApp.h"
const string SHADER_VS = " \
uniform mat4 projection_matrix; \
uniform mat4 view_matrix; \
attribute vec4 pos; \
attribute vec2 tex; \
varying vec2 vtex; \
\
void main() { \
@thomasvanta
thomasvanta / gist:5579927
Created May 14, 2013 21:54
openFrameworks: drag force
drag.set(particles[i]->vel.getNormalized());//copy of the velocity vectors direction
float speed = particles[i]->vel.length(); //get the vectors length in order to:
drag.scale(c*speed); //multiply it by coeficient
particles[i]->applyForce(drag);
@thomasvanta
thomasvanta / gist:5579913
Created May 14, 2013 21:52
Processing: drag force
PVector drag = p.vel.get(); //get a copy of velocity
drag.normalize(); //normalize it
float c = -0.005; //coeficient
float speed = p.vel.mag(); //modulo de la velocidad
drag.mult(c*speed*speed);
p.applyForce(drag);