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);
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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() { \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //created by jvcleave | |
| //edited by Thomas Van Ta | |
| //openFrameworks 0.8-0.9 main.cpp | |
| #include "ofMain.h" | |
| #include "ofApp.h" | |
| #if (OF_VERSION_MINOR != 9) && defined(TARGET_OPENGLES) | |
| #include "ofGLProgrammableRenderer.h" | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //from simon geilfus: https://github.com/simongeilfus/FlyingTokyo19 | |
| //Pass an argument by value when it is a built-in type or a small object (Passing by value makes a copy of the object) : | |
| void firstFunction( int number, bool boolean ); | |
| //Pass an argument by reference when you want the argument to be read-write: | |
| void secondFunction( Rectf &rectangle ); | |
| //Pass an argument by const reference when you want the argument to be read-only (Read-only also ensure that your data won't be unecessarely copied when calling the function): | |
| void thirdFunction( const vector<gl::Texture> &textures ); |
OlderNewer