Changeset 1524 for GTP/trunk/Lib
- Timestamp:
- 09/28/06 09:35:15 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r1523 r1524 71 71 mViewCellsManager->ComputeSampleContribution(*vssRay, true, false); 72 72 73 if ((vssRay->mPvsContribution - oldContri) > 0) // new contribution 73 // some pvs contribution for this ray? 74 if ((vssRay->mPvsContribution - oldContri) > 0) 74 75 { 75 76 //cout << "h"; … … 94 95 const int indexL = (index == 0) ? 2 : index - 1; 95 96 96 const Vector3 a = hitTriangle.mVertices[index] - ray.Get Dir();97 const Vector3 a = hitTriangle.mVertices[index] - ray.GetOrigin(); 97 98 const Vector3 b = hitTriangle.mVertices[indexU] - hitTriangle.mVertices[index]; 98 99 const Vector3 c = hitTriangle.mVertices[index] - hitTriangle.mVertices[indexL]; … … 102 103 const Vector3 dir1 = Normalize(CrossProd(a, b)); //N((pi-xp)×(pi+1- pi)); 103 104 const Vector3 dir2 = Normalize(CrossProd(a, c)); // N((pi-xp)×(pi- pi-1)) 104 const Vector3 dir3 = DotProd(dir 1, dir2) > 0 ? // N((pi-xp)×di,i-1+di,i+1×(pi-xp))105 Normalize(dir2 + dir1) : Normalize(CrossProd(a, dir 2) + CrossProd(dir1, a));105 const Vector3 dir3 = DotProd(dir2, dir1) > 0 ? // N((pi-xp)×di,i-1+di,i+1×(pi-xp)) 106 Normalize(dir2 + dir1) : Normalize(CrossProd(a, dir1) + CrossProd(dir2, a)); 106 107 107 108 // compute the new three hit points … … 113 114 const Vector3 pt3 = hitTriangle.mVertices[index] + eps * len * dir3; 114 115 116 vertices.push_back(pt2); 117 vertices.push_back(pt3); 115 118 vertices.push_back(pt1); 116 //vertices.push_back(pt2);117 vertices.push_back(pt3);118 119 } 119 120 … … 196 197 { 197 198 hitTriangle = dynamic_cast<TriangleIntersectable *>(tObj)->GetItem(); 198 cout << "t: " << hitTriangle << endl << endl;199 199 } 200 200 else … … 217 217 { 218 218 const Vector3 rayDir = (*vit) - currentRay.GetOrigin(); 219 simpleRays.push_back(SimpleRay( *vit, rayDir));219 simpleRays.push_back(SimpleRay(currentRay.GetOrigin(), rayDir)); 220 220 } 221 221 … … 226 226 vizContainer.push_back(dummy); 227 227 228 // establishvisibility228 // cast rays to triangle vertices and determine visibility 229 229 VssRayContainer vssRays; 230 230 CastRays(simpleRays, vssRays, false); 231 231 cout << "here211 " << simpleRays.size() << " " << vssRays.size() << endl; 232 232 // add to ray queue 233 233 EnqueueRays(vssRays); 234 #if 0 234 const int n = (int)enlargedTriangle.size(); 235 236 #if 1 235 237 // recursivly subdivide each edge 236 for (int i = 0; i < 9; ++ i)238 for (int i = 0; i < n; ++ i) 237 239 { 238 240 SubdivideEdge( 239 241 hitTriangle, 240 242 enlargedTriangle[i], 241 enlargedTriangle[(i + 1) % 9],243 enlargedTriangle[(i + 1) % n], 242 244 *vssRays[i], 243 *vssRays[(i + 1) % 9],245 *vssRays[(i + 1) % n], 244 246 currentRay); 245 247 } … … 343 345 castSamples += mInitialSamples; 344 346 #endif 345 //cout << "\ncast " << castSamples << " of " << mSamplesPerPass << endl;347 cout << "\nround finished, cast " << castSamples << " of " << mSamplesPerPass << endl; 346 348 } 347 349 … … 417 419 for (vit = vizContainer.begin(); vit != vit_end; ++ vit) 418 420 { 419 cout << "v";421 exporter->SetWireframe(); 420 422 exporter->ExportPolygon((*vit).enlargedTriangle); 421 423 //Material m; 422 //Polygon3 poly = Polygon3((*vit).originalTriangle); 423 // exporter->ExportPolygon(&poly); 424 exporter->SetFilled(); 425 Polygon3 poly = Polygon3((*vit).originalTriangle); 426 exporter->ExportPolygon(&poly); 424 427 } 425 428 -
GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.cpp
r1500 r1524 75 75 dir = CrossProd(plane1.mNormal, plane2.mNormal); 76 76 77 float abs;78 77 const int index = dir.DrivingAxis(); 79 78 … … 98 97 99 98 Normalize(dir); 100 101 99 return SimpleRay(point, dir); 102 100 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1523 r1524 832 832 else 833 833 { 834 #ifdef GTP_INTERNAL 834 835 mRayCaster = new IntelRayCaster(*this, externKdTree); 835 836 cout << "ray cast method: intel" << endl; 837 #endif 836 838 } 837 839 … … 847 849 ) 848 850 { 849 long t1 = GetTime(); 851 const long t1 = GetTime(); 852 853 for (int i = 0; i < (int)rays.size();) 854 { 855 if (i + 16 < (int)rays.size()) 856 { 857 mRayCaster->CastRays16( 858 i, 859 rays, 860 vssRays, 861 mViewCellsManager->GetViewSpaceBox(), 862 castDoubleRays); 863 i += 16; 864 } 865 else 866 { 867 mRayCaster->CastRay( 868 rays[i].mOrigin, 869 rays[i].mDirection, 870 rays[i].mPdf, 871 vssRays, 872 mViewCellsManager->GetViewSpaceBox(), 873 castDoubleRays); 874 i ++; 875 } 876 } 877 878 #if DEBUB_RAYCAST 879 long t2 = GetTime(); 880 if (i % 10000 == 0) 881 cout<<"."; 850 882 851 883 if (castDoubleRays) 852 { 853 for (int i = 0; i < (int)rays.size(); ) 854 { 855 if (i + 16 < (int)rays.size()) 856 { 857 mRayCaster->CastRays16( 858 i, 859 rays, 860 vssRays, 861 mViewCellsManager->GetViewSpaceBox(), 862 castDoubleRays); 863 i += 16; 864 } 865 else 866 { 867 mRayCaster->CastRay( 868 rays[i].mOrigin, 869 rays[i].mDirection, 870 rays[i].mPdf, 871 vssRays, 872 mViewCellsManager->GetViewSpaceBox(), 873 castDoubleRays); 874 i++; 875 } 876 877 if (i % 10000 == 0) 878 cout<<"."; 879 } 880 881 long t2 = GetTime(); 882 883 if (castDoubleRays) 884 cout << 2 * rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; 885 else 886 cout << rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; 887 } 888 884 cout << 2 * rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; 885 else 886 cout << rays.size() / (1e3f * TimeDiff(t1, t2)) << "M rays/s" << endl; 887 #endif 889 888 } 890 889
Note: See TracChangeset
for help on using the changeset viewer.