Changeset 2452 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 06/13/07 17:24:15 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2342 r2452 181 181 vector<FaceParentInfo> *parents) 182 182 { 183 //ifstream samplesIn(filename, ios::binary);184 igzstream samplesIn(filename.c_str());185 186 if (! samplesIn.is_open())183 //ifstream inStream(filename, ios::binary); 184 igzstream inStream(filename.c_str()); 185 186 if (!inStream.is_open()) 187 187 return false; 188 188 … … 192 192 int numTriangles; 193 193 194 samplesIn.read(reinterpret_cast<char *>(&numTriangles), sizeof(int));194 inStream.read(reinterpret_cast<char *>(&numTriangles), sizeof(int)); 195 195 root->mGeometry.reserve(numTriangles); 196 196 cout << "loading " << numTriangles << " triangles (" … … 202 202 Triangle3 tri; 203 203 204 samplesIn.read(reinterpret_cast<char *>(tri.mVertices + 0), sizeof(Vector3));205 samplesIn.read(reinterpret_cast<char *>(tri.mVertices + 1), sizeof(Vector3));206 samplesIn.read(reinterpret_cast<char *>(tri.mVertices + 2), sizeof(Vector3));204 inStream.read(reinterpret_cast<char *>(tri.mVertices + 0), sizeof(Vector3)); 205 inStream.read(reinterpret_cast<char *>(tri.mVertices + 1), sizeof(Vector3)); 206 inStream.read(reinterpret_cast<char *>(tri.mVertices + 2), sizeof(Vector3)); 207 207 208 208 // end of file reached 209 if ( samplesIn.eof())209 if (inStream.eof()) 210 210 break; 211 211 … … 841 841 842 842 #if USE_ASCII 843 ifstream samplesIn(fileName);844 if (! samplesIn.is_open())843 ifstream inStream(fileName); 844 if (!inStream.is_open()) 845 845 return false; 846 846 847 847 string buf; 848 while (!(getline( samplesIn, buf)).eof())848 while (!(getline(inStream, buf)).eof()) 849 849 { 850 850 sscanf(buf.c_str(), "%f %f %f %f %f %f %d %d", … … 873 873 } 874 874 #else 875 ifstream samplesIn(fileName, ios::binary);876 if (! samplesIn.is_open())875 ifstream inStream(fileName, ios::binary); 876 if (!inStream.is_open()) 877 877 return false; 878 878 879 879 while (1) 880 880 { 881 samplesIn.read(reinterpret_cast<char *>(&origin), sizeof(Vector3));882 samplesIn.read(reinterpret_cast<char *>(&termination), sizeof(Vector3));883 samplesIn.read(reinterpret_cast<char *>(&(sObj.mId)), sizeof(int));884 samplesIn.read(reinterpret_cast<char *>(&(tObj.mId)), sizeof(int));885 886 if ( samplesIn.eof())881 inStream.read(reinterpret_cast<char *>(&origin), sizeof(Vector3)); 882 inStream.read(reinterpret_cast<char *>(&termination), sizeof(Vector3)); 883 inStream.read(reinterpret_cast<char *>(&(sObj.mId)), sizeof(int)); 884 inStream.read(reinterpret_cast<char *>(&(tObj.mId)), sizeof(int)); 885 886 if (inStream.eof()) 887 887 break; 888 888 … … 908 908 #endif 909 909 910 samplesIn.close();910 inStream.close(); 911 911 912 912 return true; -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2353 r2452 64 64 65 65 66 static string ReplaceSuffix( string filename, string a, stringb)66 static string ReplaceSuffix(const string &filename, const string &a, const string &b) 67 67 { 68 68 string result = filename; 69 69 70 70 int pos = (int)filename.rfind(a, (int)filename.size() - 1); 71 if (pos == filename.size() - a.size()) { 71 if (pos == filename.size() - a.size()) 72 { 72 73 result.replace(pos, a.size(), b); 73 74 } 75 74 76 return result; 75 77 } 76 78 77 79 78 static int SplitFilenames(const string str, vector<string> &filenames)80 static int SplitFilenames(const string &str, vector<string> &filenames) 79 81 { 80 82 int pos = 0;
Note: See TracChangeset
for help on using the changeset viewer.