void addFace(ofMesh& mesh, ofVec3f a, ofVec3f b, ofVec3f c) {
ofVec3f normal = ((b - a).cross(c - a)).normalize();
mesh.addNormal(normal);
mesh.addVertex(a);
mesh.addNormal(normal);
mesh.addVertex(b);
mesh.addNormal(normal);
This file contains 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
#!/bin/sh | |
while : ; | |
do /path/app; | |
sleep 30; | |
done |
This file contains 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
string serialIn; | |
unsigned char buffer[1]; | |
while( readBytes( buffer, 1) > 0){ | |
if (buffer[0] == '\n'){ | |
break; | |
} | |
serialIn.push_back(buffer[0]); | |
}; |
ofAppGlutWindow window;
#if defined (TARGET_OSX)
window.setGlutDisplayString("rgba double samples>=4 depth");
#endif
ofSetupOpenGL(&window, 1280,1024, OF_WINDOW);
void billBoard(){
ofVec3f objectLookAt = ofVec3f(0,0,1);
ofVec3f objToCam = cam.getGlobalPosition();
objToCam.normalize();
float theta = objectLookAt.angle(objToCam);
ofVec3f axisOfRotation = objToCam.crossed(objectLookAt);
axisOfRotation.normalize();
This file contains 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
void rotateTo(ofPoint _dir){ | |
ofVec3f newTarget = _dir; | |
newTarget.normalize(); | |
ofVec3f up( 0, -1, 0 ); | |
ofVec3f axis = up.crossed( newTarget ); | |
axis.normalize(); | |
float angle = up.angle( newTarget ); | |
ofRotate( angle, axis.x, axis.y, axis.z ); | |
} |
ofBuffer buffer = ofBufferFromFile(_file);
while(!buffer.isLastLine()) {
string temp = buffer.getNextLine();
if(temp.length() != 0) {
vector<string> values = ofSplitString(temp, ",");
// ofToInt(value[0]);
OlderNewer