Skip to content

Instantly share code, notes, and snippets.

@MartinBspheroid
MartinBspheroid / grainnoise.frag
Created November 18, 2013 19:02
GLSL noise one-liner
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
@MartinBspheroid
MartinBspheroid / vectorArrayManager
Created October 14, 2013 09:00
Vector array for particle systems etc.
for(vector<bloomPop>::iterator it = bloomPool.begin(); it != bloomPool.end();){ // loop through vector with iterator
it->update(); // update all objects in vector
if(it->time < 0){ /// if condition matches...
it = bloomPool.erase(it); // ..go to hell..
}else{
++it; // ..or keep counting and continue!
}
}