Created
October 22, 2011 02:31
-
-
Save elliotwoods/1305465 to your computer and use it in GitHub Desktop.
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" | |
//-------------------------------------------------------------- | |
void testApp::setup(){ | |
glEnable(GL_DEPTH_TEST); | |
ifstream file ( ofToDataPath("fcrun2.csv").c_str() ); | |
int i=0; | |
string value[3]; | |
ofstream out("out.raw", ios::binary | ios::out); | |
ofVec3f v; | |
ofColor c; | |
while ( file.good() ) | |
{ | |
if (i++%2 == 0) { | |
getline ( file, value[0], ',' ); | |
getline ( file, value[1], ',' ); | |
getline ( file, value[2], ',' ); | |
v = ofVec3f(ofToFloat(value[0]), ofToFloat(value[1]), ofToFloat(value[2])) / 1000.0f; | |
m.addVertex(v); | |
out.write((char*)&v, sizeof(ofVec3f)); | |
} else { | |
getline ( file, value[0], ',' ); | |
getline ( file, value[1], ',' ); | |
getline ( file, value[2] ); | |
c = ofColor(ofToFloat(value[0]), ofToFloat(value[1]), ofToFloat(value[2])); | |
m.addColor(c); | |
out.write((char*)&c, sizeof(ofColor)); | |
} | |
if (i % 100 == 0) | |
cout << i/2 << endl; | |
} | |
file.close(); | |
out.close(); | |
cout << i/2 << " points loaded"; | |
cam.setDistance(100); | |
} | |
//-------------------------------------------------------------- | |
void testApp::draw(){ | |
cam.begin(); | |
m.drawVertices(); | |
cam.end(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment