Changeset 2603
- Timestamp:
- 01/16/08 22:52:29 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Camera.cpp
r2575 r2603 19 19 #ifdef USE_HAVRAN_RAYCASTER 20 20 //#include "timer.h" 21 #include "ktbconf.h" 21 22 #include "raypack.h" 22 23 #endif … … 290 291 ) 291 292 { 292 #if def USE_HAVRAN_RAYCASTER293 #if defined(USE_HAVRAN_RAYCASTER) && defined(_USE_HAVRAN_SSE) 293 294 294 295 int x; … … 314 315 //CTimer timer; 315 316 //timer.Start(); 316 317 317 318 RayPacket2x2 rp; 318 319 for (y = 0; y < mHeight-1; y+=2) { -
GTP/trunk/Lib/Vis/Preprocessing/src/HavranRayCaster.cpp
r2602 r2603 10 10 #include "Preprocessor.h" 11 11 #include "IntersectableWrapper.h" 12 #include "Environment.h" 12 13 13 14 #ifdef USE_HAVRAN_RAYCASTER … … 32 33 33 34 35 34 36 #ifdef USE_HAVRAN_RAYCASTER 35 37 #ifdef _USE_HAVRAN_SSE … … 62 64 { 63 65 #ifdef USE_HAVRAN_RAYCASTER 64 65 CTimer timer; 66 67 cout << "\nBuilding up kd-tree for Havran ray caster ..."<<endl<<flush; 68 69 timer.Start(); 70 mKtbtree->BuildUp(objlist); 71 timer.Stop(); 72 cout << "\nBuilding up kd-tree is finished, user time = " 73 << timer.UserTime() << " real time = " << timer.RealTime() << 74 endl <<flush; 66 char buff[256]; 67 Environment::GetSingleton()->GetStringValue("Scene.filename", buff); 68 string filename(buff); 69 const string kdfile = ReplaceSuffix(filename, ".obj", ".kdh"); 70 71 if (!ImportBinTree(kdfile, objlist)) { 72 cout << "\nKd-tree for Havran ray caster imported."<<endl<<flush; 73 } else { 74 CTimer timer; 75 cout << "\nBuilding up kd-tree for Havran ray caster ..."<<endl<<flush; 76 77 timer.Start(); 78 mKtbtree->BuildUp(objlist); 79 timer.Stop(); 80 cout << "\nBuilding up kd-tree is finished, user time = " 81 << timer.UserTime() << " real time = " << timer.RealTime() << 82 endl <<flush; 83 ExportBinTree(kdfile); 84 } 75 85 #endif 76 86 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Makefile
r2602 r2603 1 1 ############################################################################# 2 2 # Makefile for building: preprocessor 3 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 16. I 2 1:20:0420083 # Generated by qmake (2.00a) (Qt 4.1.2) on: st 16. I 22:10:45 2008 4 4 # Project: preprocessor.pro 5 5 # Template: app -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2601 r2603 156 156 157 157 158 static int SplitFilenames(const string str, vector<string> &filenames)159 {160 int pos = 0;161 162 while(1) {163 int npos = (int)str.find(';', pos);164 165 if (npos < 0 || npos - pos < 1)166 break;167 filenames.push_back(string(str, pos, npos - pos));168 pos = npos + 1;169 }170 171 filenames.push_back(string(str, pos, str.size() - pos));172 return (int)filenames.size();173 }174 158 175 159 … … 331 315 } 332 316 333 static string ReplaceSuffix(const string &filename, string a, string b)334 {335 string result = filename;336 337 int pos = (int)filename.rfind(a, (int)filename.size() - 1);338 if (pos == filename.size() - a.size()) {339 result.replace(pos, a.size(), b);340 }341 return result;342 }343 317 344 318 … … 1071 1045 // return true; 1072 1046 } 1073 1047 1074 1048 1075 1049 if (!mUseKdTree) { -
GTP/trunk/Lib/Vis/Preprocessing/src/common.cpp
r2187 r2603 81 81 { 82 82 srand(seed); 83 } 84 85 86 string 87 ReplaceSuffix(const string &filename, const string &a, const string &b) 88 { 89 string result = filename; 90 91 int pos = (int)filename.rfind(a, (int)filename.size() - 1); 92 if (pos == filename.size() - a.size()) 93 { 94 result.replace(pos, a.size(), b); 95 } 96 97 return result; 98 } 99 100 101 int 102 SplitFilenames(const string &str, vector<string> &filenames) 103 { 104 int pos = 0; 105 106 while(1) { 107 int npos = (int)str.find(';', pos); 108 109 if (npos < 0 || npos - pos < 1) 110 break; 111 filenames.push_back(string(str, pos, npos - pos)); 112 pos = npos + 1; 113 } 114 115 filenames.push_back(string(str, pos, str.size() - pos)); 116 return (int)filenames.size(); 83 117 } 84 118 -
GTP/trunk/Lib/Vis/Preprocessing/src/common.h
r2588 r2603 19 19 #include <iostream> 20 20 #include <fstream> 21 #include <string> 21 22 #include <limits.h> 22 23 #include <vector> 23 24 24 25 … … 489 490 strdup(char *a); 490 491 492 std::string 493 ReplaceSuffix(const std::string &filename, const std::string &a, const std::string &b); 494 495 496 int 497 SplitFilenames(const std::string &str, std::vector<std::string> &filenames); 498 491 499 bool 492 500 FileExists(char *filename); … … 511 519 StripPath(const char *s); 512 520 } 521 513 522 514 523 -
GTP/trunk/Lib/Vis/Preprocessing/src/havran/ktball.cpp
r2602 r2603 11 11 12 12 // GOLEM library 13 #include "ktbconf.h" 13 14 #include "ktb.h" 14 15 #include "ktbai.h" … … 925 926 926 927 if (!stream.is_open()) { 927 cerr << "Kd-tree description file (.k bt) cannot be opened for reading\n";928 cerr << "Kd-tree description file (.kdh) cannot be opened for reading\n"; 928 929 return true; // error 929 930 } -
GTP/trunk/Lib/Vis/Preprocessing/src/havran/ktbconf.h
r2602 r2603 24 24 25 25 // If we support the use of SSE instructions for ray shooting 26 // #define _USE_HAVRAN_SSE26 // #define _USE_HAVRAN_SSE 27 27 28 28 namespace GtpVisibilityPreprocessor { -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2598 r2603 72 72 73 73 74 static string ReplaceSuffix(const string &filename, const string &a, const string &b)75 {76 string result = filename;77 78 int pos = (int)filename.rfind(a, (int)filename.size() - 1);79 if (pos == filename.size() - a.size())80 {81 result.replace(pos, a.size(), b);82 }83 84 return result;85 }86 87 88 static int SplitFilenames(const string &str, vector<string> &filenames)89 {90 int pos = 0;91 92 while(1) {93 int npos = (int)str.find(';', pos);94 95 if (npos < 0 || npos - pos < 1)96 break;97 filenames.push_back(string(str, pos, npos - pos));98 pos = npos + 1;99 }100 101 filenames.push_back(string(str, pos, str.size() - pos));102 return (int)filenames.size();103 }104 74 105 75
Note: See TracChangeset
for help on using the changeset viewer.