Changeset 1972 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 01/12/07 22:41:01 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r1971 r1972 85 85 mUseForcedColors = false; 86 86 mRenderBoxes = false; 87 //mUseGlLists = true;88 mUseGlLists = false;87 mUseGlLists = true; 88 //mUseGlLists = false; 89 89 90 90 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", mPvsStatFrames); -
GTP/trunk/Lib/Vis/Preprocessing/src/GlobalLinesRenderer.cpp
r1971 r1972 456 456 const int layers = ApplyDepthPeeling(rays); 457 457 458 const float rays_per_sec = rays.size() / TimeDiff(startTime, GetTime()) * 1e-3; 459 cout << "cast " << rays.size() << " samples in " << layers << " layers in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs (" << rays_per_sec << " rays/sec)" << endl; 458 const float rays_per_sec = (float)rays.size() / (TimeDiff(startTime, GetTime()) * 1e-3f); 459 cout << "cast " << rays.size() << " samples in " << layers << " layers in " 460 << TimeDiff(startTime, GetTime()) * 1e-3 << " secs (" << rays_per_sec << " rays/sec)" << endl; 461 460 462 return layers; 461 463 } … … 852 854 void GlobalLinesRenderer::Visualize(const VssRayContainer &vssRays) 853 855 { 856 cout << "exporting visualization ... "; 854 857 Exporter *exporter = Exporter::GetExporter("globalLines.wrl"); 855 858 … … 877 880 } 878 881 879 if (ray->mPass == 4)882 //if (ray->mPass == 4) 880 883 outRays.push_back(ray); 881 884 } 882 885 883 exporter->ExportRays(outRays);884 886 //exporter->ExportRays(outRays); 887 cout << "finished" << endl; 885 888 delete exporter; 886 889 } … … 1030 1033 } 1031 1034 1032 Debug << "time spent in rendering: " << renderTime << endl;1033 Debug << "time spent in buffer: " << bufferTime << endl;1035 Debug << "time spent in rendering: " << renderTime * 1e-3f << endl; 1036 Debug << "time spent in buffer: " << bufferTime * 1e-3f << endl; 1034 1037 1035 1038 PrintGLerror("endpeeling"); -
GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.cpp
r1960 r1972 107 107 108 108 void IntelRayCaster::CastRays16( 109 const int index,110 109 SimpleRayContainer &rays, 111 110 VssRayContainer &vssRays, … … 116 115 int i; 117 116 const int num = 16; 118 117 119 118 #if DEBUG_RAYCAST 120 119 Debug<<"C16 "<<flush; … … 132 131 133 132 for (i=0; i < num; i++) { 134 mlrtaStoreRayAS16(&rays[i ndex + i].mOrigin.x,135 &rays[i ndex + i].mDirection.x,133 mlrtaStoreRayAS16(&rays[i].mOrigin.x, 134 &rays[i].mDirection.x, 136 135 i); 137 136 } … … 150 149 for (i=0; i < num; i++) 151 150 { 152 Vector3 dir = -rays[i ndex + i].mDirection;153 mlrtaStoreRayAS16(&rays[i ndex+i].mOrigin.x,151 Vector3 dir = -rays[i].mDirection; 152 mlrtaStoreRayAS16(&rays[i].mOrigin.x, 154 153 &dir.x, 155 154 i); … … 186 185 187 186 //-rays[index+i].mDirection; // $$ temporary 188 hitA.mPoint = rays[i ndex+i].Extrap(forward_dist[i]);187 hitA.mPoint = rays[i].Extrap(forward_dist[i]); 189 188 } 190 189 … … 202 201 hitB.mNormal = mPreprocessor.GetParentNormal(backward_hit_triangles[i]); 203 202 204 // normalB = rays[i ndex+i].mDirection; // $$ temporary205 hitB.mPoint = rays[i ndex+i].Extrap(-backward_dist[i]);203 // normalB = rays[i].mDirection; // $$ temporary 204 hitB.mPoint = rays[i].Extrap(-backward_dist[i]); 206 205 } 207 206 } … … 211 210 #endif 212 211 213 ProcessRay(rays[i ndex + i],212 ProcessRay(rays[i], 214 213 hitA, 215 214 hitB, -
GTP/trunk/Lib/Vis/Preprocessing/src/IntelRayCaster.h
r1925 r1972 44 44 const bool pruneInvalidRays = true); 45 45 46 virtual void CastRays16( const int i,46 virtual void CastRays16( 47 47 SimpleRayContainer &rays, 48 48 VssRayContainer &vssRays, -
GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp
r1964 r1972 192 192 } 193 193 194 void InternalRayCaster::CastRays16(const int index, 195 194 195 void InternalRayCaster::CastRays16(SimpleRayContainer &rays, 196 196 VssRayContainer &vssRays, 197 197 const AxisAlignedBox3 &sbox, … … 199 199 const bool pruneInvalidRays) 200 200 { 201 const int num = 16;202 203 201 #if DEBUG_RAYCAST 204 202 Debug << "C16 " << flush; 205 203 #endif 206 204 205 SimpleRayContainer::const_iterator sit, sit_end = rays.end(); 206 207 207 // no acceleration for ray bundles implemented right now 208 for ( int i = index; i < index + num; i++)208 for (sit = rays.begin(); sit != sit_end; ++ sit) 209 209 { 210 CastRay( rays[i], vssRays, sbox,castDoubleRays, pruneInvalidRays);210 CastRay(*sit, vssRays, sbox, castDoubleRays, pruneInvalidRays); 211 211 } 212 212 -
GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.h
r1824 r1972 36 36 37 37 virtual int CastRay( 38 const SimpleRay &simpleRay,39 40 const AxisAlignedBox3 &box,41 const bool castDoubleRay,42 const bool pruneInvalidRays = true43 );38 const SimpleRay &simpleRay, 39 VssRayContainer &vssRays, 40 const AxisAlignedBox3 &box, 41 const bool castDoubleRay, 42 const bool pruneInvalidRays = true 43 ); 44 44 45 virtual void CastRays16( 46 const int i, 47 SimpleRayContainer &rays, 48 VssRayContainer &vssRays, 49 const AxisAlignedBox3 &sbox, 50 const bool castDoubleRay, 51 const bool pruneInvalidRays = true 52 ); 45 virtual void CastRays16(SimpleRayContainer &rays, 46 VssRayContainer &vssRays, 47 const AxisAlignedBox3 &sbox, 48 const bool castDoubleRay, 49 const bool pruneInvalidRays = true 50 ); 53 51 54 52 virtual int 55 CastGlobalRay(const SimpleRay &simpleRay, 56 VssRayContainer &vssRays, 57 const AxisAlignedBox3 &box, 58 const bool pruneInvalidRays 59 ); 53 CastGlobalRay( 54 const SimpleRay &simpleRay, 55 VssRayContainer &vssRays, 56 const AxisAlignedBox3 &box, 57 const bool pruneInvalidRays 58 ); 60 59 61 60 protected: -
GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp
r1876 r1972 64 64 pch = strtok(NULL, " "); 65 65 } 66 //if (indices.size() > 4) return NULL;67 66 68 67 return new Face(indices); … … 70 69 71 70 72 static Triangle3 LoadTriangle(char *str, 73 const VertexContainer &vertices, 74 map<int, Vector3> &hashTable) 71 static void LoadTriangles(char *str, 72 const VertexContainer &vertices, 73 map<int, Vector3> &hashTable, 74 vector<Triangle3> &triangles) 75 75 { 76 76 char *pch = strtok(str + 1, " "); … … 78 78 VertexIndexContainer indices; 79 79 80 int i = 0; 80 81 while (pch != NULL) 81 82 { 82 83 const int index = (int)strtol(pch, NULL, 10) - 1; 84 ++ i; 83 85 84 86 // store vertex in hash table 85 hashTable[index] = vertices[index];87 //hashTable[index] = vertices[index]; 86 88 indices.push_back(index); 87 89 88 90 pch = strtok(NULL, " "); 89 } 90 91 return Triangle3(vertices[indices[0]], vertices[indices[1]], vertices[indices[2]]); 91 92 // problem: don't know how intel ray tracer tesselates 93 if ((int)indices.size() > 2) 94 { 95 int index_2 = (int)indices.size() - 2; 96 int index_3 = (int)indices.size() - 1; 97 98 triangles.push_back(Triangle3(vertices[indices[0]], 99 vertices[indices[index_2]], 100 vertices[indices[index_3]])); 101 } 102 } 92 103 } 93 104 … … 230 241 else 231 242 { 232 Triangle3 triangle = LoadTriangle(str, vertices, hashTable); 243 vector<Triangle3> triangles; 244 245 LoadTriangles(str, vertices, hashTable, triangles); 233 246 234 TriangleIntersectable *obj = new TriangleIntersectable(triangle); 235 root->mGeometry.push_back(obj); 236 237 // matt: we don't really need to keep an additional data structure 238 // if working with triangles => remove this 239 if (parents) 247 vector<Triangle3>::const_iterator tit, tit_end = triangles.end(); 248 249 for (tit = triangles.begin(); tit != tit_end; ++ tit) 240 250 { 241 FaceParentInfo info(obj, 0); 242 parents->push_back(info); 251 TriangleIntersectable *obj = new TriangleIntersectable(*tit); 252 root->mGeometry.push_back(obj); 253 254 // matt: we don't really need to keep an additional data structure 255 // if working with triangles => remove this 256 if (0 && parents) 257 { 258 FaceParentInfo info(obj, 0); 259 parents->push_back(info); 260 } 243 261 } 244 262 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1970 r1972 1151 1151 const long t1 = GetTime(); 1152 1152 1153 for (int i = 0; i < (int)rays.size();) 1154 { 1155 // HACK: does not really go together with the 16 ray bundles 1156 if (rays[i].mDistribution == SamplingStrategy::HW_GLOBAL_LINES_DISTRIBUTION) 1157 { 1158 mGlobalLinesRenderer->CastGlobalLines(rays[i], vssRays); 1159 i ++; 1153 SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 1154 1155 SimpleRayContainer rayBucket; 1156 int i = 0; 1157 for (rit = rays.begin(); rit != rit_end; ++ rit, ++ i) 1158 { 1159 SimpleRay ray = *rit; 1160 // HACK: global lines must be treated special 1161 if (ray.mDistribution == SamplingStrategy::HW_GLOBAL_LINES_DISTRIBUTION) 1162 { 1163 mGlobalLinesRenderer->CastGlobalLines(ray, vssRays); 1160 1164 continue; 1161 1165 } 1162 1166 1163 if (i + 16 < (int)rays.size()) 1167 rayBucket.push_back(ray); 1168 1169 // 16 rays gathered => do ray casting 1170 if ((int)rayBucket.size() >= 16) 1164 1171 { 1165 1172 mRayCaster->CastRays16( 1166 i, 1167 rays, 1173 rayBucket, 1168 1174 vssRays, 1169 1175 mViewCellsManager->GetViewSpaceBox(), 1170 1176 castDoubleRays, 1171 1177 pruneInvalidRays); 1172 i += 16; 1173 } 1174 else 1178 1179 rayBucket.clear(); 1180 } 1181 1182 if ((int)rays.size() > 10000 && i % 10000 == 0) 1183 cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 1184 } 1185 1186 // cast rest of rays 1187 SimpleRayContainer::const_iterator sit, sit_end = rayBucket.end(); 1188 1189 for (sit = rayBucket.begin(); sit != sit_end; ++ sit) 1190 { 1191 SimpleRay ray = *sit; 1192 // HACK: global lines must be treated special 1193 if (ray.mDistribution == SamplingStrategy::HW_GLOBAL_LINES_DISTRIBUTION) 1194 { 1195 mGlobalLinesRenderer->CastGlobalLines(ray, vssRays); 1196 } 1197 else 1175 1198 { 1176 1199 mRayCaster->CastRay( 1177 ray s[i],1200 ray, 1178 1201 vssRays, 1179 1202 mViewCellsManager->GetViewSpaceBox(), 1180 1203 castDoubleRays, 1181 1204 pruneInvalidRays); 1182 ++ i; 1183 } 1184 1185 if (rays.size() > 10000 && i % 10000 == 0) 1186 cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 1187 } 1188 1189 if (rays.size() > 10000) 1205 } 1206 } 1207 1208 if ((int)rays.size() > 10000) 1190 1209 { 1191 1210 cout << endl; 1192 1193 long t2 = GetTime(); 1211 long t2 = GetTime(); 1194 1212 1195 1213 #if SHOW_RAYCAST_TIMING 1196 1214 if (castDoubleRays) 1197 1215 cout << 2 * rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; 1198 1216 else 1199 1217 cout << rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r1969 r1972 183 183 184 184 lastPos = event->pos(); 185 updateGL();185 updateGL(); 186 186 } 187 187 -
GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h
r1942 r1972 45 45 VssRay *CastRay(const SimpleRay &simpleRay, 46 46 const AxisAlignedBox3 &box); 47 //const bool castDoubleRay);48 47 49 48 virtual int CastRay(const SimpleRay &simpleRay, … … 54 53 ) = 0; 55 54 56 virtual void CastRays16( const int i,55 virtual void CastRays16( 57 56 SimpleRayContainer &rays, 58 57 VssRayContainer &vssRays, -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r1949 r1972 194 194 OptimizeForWindowsApplication="TRUE" 195 195 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(QTDIR)\include\QtOpenGl";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtCore";"$(QTDIR)\include";QtInterface" 196 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT ;TRY_GLOBAL_LINES"196 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT" 197 197 RuntimeLibrary="2" 198 198 RuntimeTypeInfo="TRUE" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1966 r1972 5829 5829 5830 5830 const long starttime = GetTime(); 5831 cout << "exporting final view cells (after initial construction + post process) ... " ;5831 cout << "exporting final view cells (after initial construction + post process) ... " << endl; 5832 5832 5833 5833 // matt: hack for clamping scene … … 5835 5835 bbox.Scale(scale); 5836 5836 5837 if ( 0&& mExportRays)5837 if (1 && mExportRays) 5838 5838 { 5839 5839 exporter->ExportRays(visRays, RgbColor(0, 1, 0));
Note: See TracChangeset
for help on using the changeset viewer.