Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<iomanip>
- #include<sstream>
- using namespace std;
- int main(int argc, char** argv)
- {
- if(argc!=3)
- {
- fprintf(stderr,"Usage: %s\n(1)Input_filename\n(2)Output_filename",argv[0]);
- //exit(1);
- }
- ifstream ifs(argv[1]);
- ofstream ofs(argv[2]);
- string line;
- while(getline(ifs,line))
- {
- float x,y,z;
- //int a,b,c,d,e,f;
- int r,g,b;
- int x_i,y_i;
- float y_c,x_c;
- float r_f,g_f,b_f;
- //std::cout << std::fixed << std::setprecision(2) << pi << '\n';
- istringstream is(line);
- is >> x >> y >> z >> r >> g >> b;
- r_f=(float)r/255;
- g_f=(float)r/255;
- b_f=(float)r/255;
- //x_i=(int)x*10000;
- //y_i=(int)y*10000;
- //y_c=(float)y_i/10000;
- //x_c=(float)x_i/10000;
- //cout<< y <<" "<< x <<" "<< z <<" "<< r <<" "<< g <<" "<< b <<endl;
- ofs << fixed << setprecision(4) <<"glColor3f("<< r_f <<"f,"<< g_f<<"f,"<<b_f<<"f);glVertex3f("<<x<< "f," << y <<"f,"<< z<<"f);"<< endl;
- }
- ifs.close();
- ofs.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment