/* * show_animate implementation * * Copyright (C) Kai Lingemann, Andreas Nuechter, Jan Elseberg, Dorit Borrmann * * Released under the GPL version 3. * */ #include using std::fstream; using std::ofstream; using std::ios; #include using std::cout; using std::cerr; using std::endl; static int nr_interpolations = 0; void calcUpPath() { // if camera list is empty then return if(cams.empty()) return; PointXY temp ; vector ups_listXY, ups_listXZ; // to interpolate with the xy coordinate. for (unsigned int i = 0; i < ups.size(); i++) { temp.x = ups[i].x; temp.y = ups[i].y; ups_listXY.push_back(temp); } // to interpolate with the xz coordinate. for (unsigned int i = 0; i < ups.size(); i++) { temp.x = ups[i].x; temp.y = ups[i].z; ups_listXZ.push_back(temp); } // now get the nurbs path for the individual xy and xz plane ups_vectorX = cam_nurbs_path.getNurbsPath(ups_listXY, nr_interpolations, inter_by_dist); ups_vectorZ = cam_nurbs_path.getNurbsPath(ups_listXZ, nr_interpolations, inter_by_dist); } void calcLookAtPath() { // if camera list is empty then return if(cams.empty()) return; PointXY temp ; vector lookat_listXY, lookat_listXZ; // to interpolate with the xy coordinate. for (unsigned int i = 0; i < lookats.size(); i++) { temp.x = lookats[i].x; temp.y = lookats[i].y; lookat_listXY.push_back(temp); } // to interpolate with the xz coordinate. for (unsigned int i = 0; i < lookats.size(); i++) { temp.x = lookats[i].x; temp.y = lookats[i].z; lookat_listXZ.push_back(temp); } // now get the nurbs path for the individual xy and xz plane lookat_vectorX = cam_nurbs_path.getNurbsPath(lookat_listXY, nr_interpolations, inter_by_dist); lookat_vectorZ = cam_nurbs_path.getNurbsPath(lookat_listXZ, nr_interpolations, inter_by_dist); } void calcPath() { if (cams.empty()) return; PointXY temp ; vector path_listXY, path_listXZ; // if camera list is empty then return // to interpolate with the xy coordinate. for(unsigned int i = 0;i < cams.size(); i++){ temp.x = cams[i].x; temp.y = cams[i].y; path_listXY.push_back(temp); } // to interpolate with the xz coordinate. for(unsigned int i=0;i> euler[i++]); // Orientation for (unsigned int i = 0; i < 4; poseFile >> quat[i++]); poseFile >> mouseRotX >> mouseRotY >> mouseRotZ >> cangle; poseFile >> showTopView >> cameraNavMouseMode >> pzoom; poseFile >> show_points >> show_path >> show_cameras >> pointsize; poseFile >> show_fog >> fogDensity >> invert; setView(euler, quat, mouseRotX, mouseRotY, mouseRotZ, cangle, showTopView, cameraNavMouseMode, pzoom, show_points, show_path, show_cameras, pointsize, show_fog, fogDensity, invert); poseFile.clear(); poseFile.close(); } /** * This function saves the current camera pose to a file. */ void savePose(int dummy) { cout << "Save" << endl; //output file stream ofstream posefile; //open the output file posefile.open(pose_file_name, ios::out); //if file not found then show error if(!posefile){ cerr << "Error creating the pose file." << endl; return; } //store all the relevant information about the //individual camera position in this file. posefile << X << " " << Y << " " << Z << endl; for(int i = 0; i < 4; i++) { posefile << quat[i] << " "; } posefile << mouseRotX << " " << mouseRotY << " " << mouseRotZ << " " <::iterator it = selected_points[i].begin(); it != selected_points[i].end(); it++) { for (unsigned int k = 0; k < pointtype.getPointDim(); k++) { // selectionfile << selected_points[i][j][k] << " "; selectionfile << (*it)[k] << " "; } selectionfile << endl; } } //close the file after writing selectionfile.clear(); selectionfile.close(); }