Changeset 429 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 11/24/05 03:42:19 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r422 r429 245 245 return false; 246 246 } 247 248 249 void Preprocessor::ExportSplits(const ObjectContainer &objects, 250 const RayContainer &sampleRays, 251 const int visSamples) 252 { 253 Exporter *exporter = Exporter::GetExporter("bsp_splits.x3d"); 254 255 if (exporter) 256 { 257 Material m; 258 m.mDiffuseColor = RgbColor(1, 0, 0); 259 exporter->SetForcedMaterial(m); 260 exporter->SetWireframe(); 261 exporter->ExportBspSplits(*mBspTree, true); 262 263 // take forced material, else big scenes cannot be viewed 264 m.mDiffuseColor = RgbColor(0, 1, 0); 265 exporter->SetForcedMaterial(m); 266 exporter->SetFilled(); 267 268 exporter->ResetForcedMaterial(); 269 270 // export rays 271 if (0) 272 { 273 RayContainer outRays; 274 275 for (int i = 0; i < sampleRays.size(); ++ i) 276 { 277 // only rays piercing geometry 278 if (!sampleRays[i]->intersections.empty()) 279 outRays.push_back(sampleRays[i]); 280 } 281 if (BspTree::sConstructionMethod == BspTree::FROM_SAMPLES) 282 { 283 // export rays 284 exporter->ExportRays(outRays, 1000, RgbColor(1, 1, 0)); 285 } 286 } 287 288 if (1) 289 ExportSceneGeometry(exporter, objects); 290 291 delete exporter; 292 } 293 } 294 295 inline bool vc_gt(ViewCell *a, ViewCell *b) 296 { 297 return a->GetPvs().GetSize() > b->GetPvs().GetSize(); 298 } 299 300 void Preprocessor::ExportBspPvs(const ObjectContainer &objects, 301 const RayContainer &sampleRays, 302 const int visSamples) 303 { 304 const int leafOut = 10; 305 306 ViewCell::NewMail(); 307 308 //-- some rays for output 309 const int raysOut = min((int)sampleRays.size(), visSamples); 310 cout << "visualization using " << visSamples << " samples" << endl; 311 vector<Ray *> vcRays[leafOut]; 312 313 if (0) 314 { 315 //-- some random view cells and rays for output 316 vector<BspLeaf *> bspLeaves; 317 318 for (int i = 0; i < leafOut; ++ i) 319 bspLeaves.push_back(mBspTree->GetRandomLeaf()); 320 321 for (int i = 0; i < bspLeaves.size(); ++ i) 322 { 323 cout << "creating output for view cell " << i << " ... "; 324 // check whether we can add the current ray to the output rays 325 for (int k = 0; k < raysOut; ++ k) 326 { 327 Ray *ray = sampleRays[k]; 328 329 for (int j = 0; j < (int)ray->bspIntersections.size(); ++ j) 330 { 331 BspLeaf *leaf = ray->bspIntersections[j].mLeaf; 332 333 if (bspLeaves[i]->GetViewCell() == leaf->GetViewCell()) 334 { 335 vcRays[i].push_back(ray); 336 } 337 } 338 } 339 340 Intersectable::NewMail(); 341 342 BspViewCell *vc = dynamic_cast<BspViewCell *>(bspLeaves[i]->GetViewCell()); 343 344 //bspLeaves[j]->Mail(); 345 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 346 347 Exporter *exporter = Exporter::GetExporter(s); 348 exporter->SetFilled(); 349 350 ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 351 352 exporter->SetWireframe(); 353 //exporter->SetFilled(); 354 355 Material m;//= RandomMaterial(); 356 m.mDiffuseColor = RgbColor(0, 1, 0); 357 exporter->SetForcedMaterial(m); 358 359 if (vc->GetMesh()) 360 exporter->ExportViewCell(vc); 361 else 362 { 363 PolygonContainer cell; 364 // export view cell geometry 365 mBspTree->ConstructGeometry(vc, cell); 366 exporter->ExportPolygons(cell); 367 CLEAR_CONTAINER(cell); 368 } 369 370 Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize() 371 << ", piercing rays=" << (int)vcRays[i].size() << endl; 372 373 // export rays piercing this view cell 374 exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 375 376 m.mDiffuseColor = RgbColor(1, 0, 0); 377 exporter->SetForcedMaterial(m); 378 379 // exporter->SetWireframe(); 380 exporter->SetFilled(); 381 382 // output PVS of view cell 383 for (; it != vc->GetPvs().mEntries.end(); ++ it) 384 { 385 Intersectable *intersect = (*it).first; 386 if (!intersect->Mailed()) 387 { 388 exporter->ExportIntersectable(intersect); 389 intersect->Mail(); 390 } 391 } 392 393 // output rest of the objects 394 if (0) 395 { 396 Material m;//= RandomMaterial(); 397 m.mDiffuseColor = RgbColor(0, 0, 1); 398 exporter->SetForcedMaterial(m); 399 400 for (int j = 0; j < objects.size(); ++ j) 401 if (!objects[j]->Mailed()) 402 { 403 exporter->SetForcedMaterial(m); 404 exporter->ExportIntersectable(objects[j]); 405 objects[j]->Mail(); 406 } 407 } 408 DEL_PTR(exporter); 409 cout << "finished" << endl; 410 } 411 } 412 else 413 { 414 ViewCellContainer viewCells; 415 416 mBspTree->CollectViewCells(viewCells); 417 stable_sort(viewCells.begin(), viewCells.end(), vc_gt); 418 419 int limit = min(leafOut, (int)viewCells.size()); 420 421 for (int i = 0; i < limit; ++ i) 422 { 423 cout << "creating output for view cell " << i << " ... "; 424 425 Intersectable::NewMail(); 426 BspViewCell *vc = dynamic_cast<BspViewCell *>(viewCells[i]); 427 428 cout << "creating output for view cell " << i << " ... "; 429 // check whether we can add the current ray to the output rays 430 for (int k = 0; k < raysOut; ++ k) 431 { 432 Ray *ray = sampleRays[k]; 433 434 for (int j = 0; j < (int)ray->bspIntersections.size(); ++ j) 435 { 436 BspLeaf *leaf = ray->bspIntersections[j].mLeaf; 437 438 if (vc == leaf->GetViewCell()) 439 { 440 vcRays[i].push_back(ray); 441 } 442 } 443 } 444 445 //bspLeaves[j]->Mail(); 446 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i); 447 448 Exporter *exporter = Exporter::GetExporter(s); 449 450 exporter->SetWireframe(); 451 452 Material m;//= RandomMaterial(); 453 m.mDiffuseColor = RgbColor(0, 1, 0); 454 exporter->SetForcedMaterial(m); 455 456 if (vc->GetMesh()) 457 exporter->ExportViewCell(vc); 458 else 459 { 460 PolygonContainer cell; 461 // export view cell 462 mBspTree->ConstructGeometry(vc, cell); 463 exporter->ExportPolygons(cell); 464 CLEAR_CONTAINER(cell); 465 } 466 467 468 Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize() 469 << ", piercing rays=" << (int)vcRays[i].size() << endl; 470 471 472 // export rays piercing this view cell 473 exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 474 475 m.mDiffuseColor = RgbColor(1, 0, 0); 476 exporter->SetForcedMaterial(m); 477 478 ViewCellPvsMap::const_iterator it, 479 it_end = vc->GetPvs().mEntries.end(); 480 481 // output PVS of view cell 482 for (it = vc->GetPvs().mEntries.begin(); it != it_end; ++ it) 483 { 484 Intersectable *intersect = (*it).first; 485 if (!intersect->Mailed()) 486 { 487 Material m = RandomMaterial(); 488 489 exporter->SetForcedMaterial(m); 490 491 exporter->ExportIntersectable(intersect); 492 intersect->Mail(); 493 } 494 } 495 496 DEL_PTR(exporter); 497 cout << "finished" << endl; 498 } 499 } 500 } 501 502 503 void Preprocessor::ExportSceneGeometry(Exporter *exporter, 504 const ObjectContainer &objects) 505 { 506 Material m;//= RandomMaterial(); 507 m.mDiffuseColor = RgbColor(0, 1, 0); 508 exporter->SetForcedMaterial(m); 509 exporter->SetWireframe(); 510 511 for (int j = 0; j < objects.size(); ++ j) 512 exporter->ExportIntersectable(objects[j]); 513 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h
r419 r429 13 13 class RenderSimulator; 14 14 class SceneGraph; 15 class Exporter; 15 16 16 17 /** Namespace for the external visibility preprocessor … … 92 93 bool ParseViewCellsOptions(); 93 94 95 94 96 /// scene graph loaded from file 95 97 SceneGraph *mSceneGraph; … … 117 119 */ 118 120 VspKdTree *mVspKdTree; 121 122 protected: 123 void ExportBspPvs(const ObjectContainer &objects, 124 const RayContainer &sampleRays, 125 const int visSamples); 126 127 void ExportSplits(const ObjectContainer &objects, 128 const RayContainer &sampleRays, 129 const int visSamples); 130 131 /** Export scene geometry. 132 */ 133 void ExportSceneGeometry(Exporter *exporter, const ObjectContainer &objects); 134 135 int mBspConstructionSamples; 119 136 }; 120 137 -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r428 r429 122 122 123 123 124 void 125 SamplingPreprocessor::HoleSamplingPass() 126 { 127 vector<KdLeaf *> leaves; 128 mKdTree->CollectLeaves(leaves); 129 130 // go through all the leaves and evaluate their passing contribution 131 for (int i=0 ; i < leaves.size(); i++) { 132 KdLeaf *leaf = leaves[i]; 133 cout<<leaf->mPassingRays<<endl; 134 } 135 } 136 124 137 int SamplingPreprocessor::AddObjectSamples(Intersectable *obj, const Ray &ray) 125 138 { … … 149 162 150 163 return contributingSamples; 151 }152 153 154 void155 SamplingPreprocessor::HoleSamplingPass()156 {157 vector<KdLeaf *> leaves;158 mKdTree->CollectLeaves(leaves);159 160 // go through all the leaves and evaluate their passing contribution161 for (int i=0 ; i < leaves.size(); i++) {162 KdLeaf *leaf = leaves[i];163 cout<<leaf->mPassingRays<<endl;164 }165 164 } 166 165 … … 450 449 direction = point - pointToSample; 451 450 point = pointToSample; 452 Debug << "point: " << pointToSample << endl;451 //Debug << "point: " << pointToSample << endl; 453 452 } 454 453 } … … 650 649 cout << "exporting splits ... "; 651 650 if (exportSplits) 652 ExportSplits(objects );651 ExportSplits(objects, mSampleRays, mVisualizationSamples); 653 652 cout << "finished" << endl; 654 653 655 654 // export the PVS of sample view cells 656 655 if (1) 657 ExportBspPvs(objects );656 ExportBspPvs(objects, mSampleRays, mVisualizationSamples); 658 657 } 659 658 … … 731 730 732 731 for (it = vssRays.begin(); it != it_end; ++ it) 733 if (!(*it)->mOriginObject) 734 rays.push_back(*it); 732 { 733 //if (!(*it)->mOriginObject && !(*it)->mTerminationObject) 734 rays.push_back(*it); 735 736 //if (!(*it)->mOriginObject && !(*it)->mTerminationObject) 737 // Debug << "ERR: " << (*it)->mOrigin << " " << (*it)->mTermination << endl; 738 } 735 739 736 740 exporter->ExportRays(rays, RgbColor(1, 0, 0)); … … 816 820 { 817 821 // store samples for vsp kd tree construction 818 if ((int)mVspSampleRays.size() < mVspConstructionSamples) 822 if ((object || !ray.intersections.empty()) && 823 ((int)mVspSampleRays.size() < mVspConstructionSamples)) 819 824 { 820 825 ray.sourceObject = Ray::Intersection(0.0, object, faceIndex); … … 936 941 return merged; 937 942 } 938 939 // export scene geometry940 void SamplingPreprocessor::ExportSceneGeometry(Exporter *exporter, const ObjectContainer &objects)941 {942 Material m;//= RandomMaterial();943 m.mDiffuseColor = RgbColor(0, 1, 0);944 exporter->SetForcedMaterial(m);945 exporter->SetWireframe();946 947 for (int j = 0; j < objects.size(); ++ j)948 exporter->ExportIntersectable(objects[j]);949 }950 951 void SamplingPreprocessor::ExportSplits(const ObjectContainer &objects)952 {953 Exporter *exporter = Exporter::GetExporter("bsp_splits.x3d");954 955 if (exporter)956 {957 Material m;958 m.mDiffuseColor = RgbColor(1, 0, 0);959 exporter->SetForcedMaterial(m);960 exporter->SetWireframe();961 exporter->ExportBspSplits(*mBspTree, true);962 963 // take forced material, else big scenes cannot be viewed964 m.mDiffuseColor = RgbColor(0, 1, 0);965 exporter->SetForcedMaterial(m);966 exporter->SetFilled();967 968 exporter->ResetForcedMaterial();969 970 // export rays971 if (0)972 {973 RayContainer outRays;974 975 for (int i = 0; i < mSampleRays.size(); ++ i)976 {977 // only rays piercing geometry978 if (!mSampleRays[i]->intersections.empty())979 outRays.push_back(mSampleRays[i]);980 }981 if (BspTree::sConstructionMethod == BspTree::FROM_SAMPLES)982 {983 // export rays984 exporter->ExportRays(outRays, 1000, RgbColor(1, 1, 0));985 }986 }987 988 if (1)989 ExportSceneGeometry(exporter, objects);990 991 delete exporter;992 }993 }994 995 inline bool vc_gt(ViewCell *a, ViewCell *b)996 {997 return a->GetPvs().GetSize() > b->GetPvs().GetSize();998 }999 1000 void SamplingPreprocessor::ExportBspPvs(const ObjectContainer &objects)1001 {1002 const int leafOut = 10;1003 1004 ViewCell::NewMail();1005 1006 //-- some rays for output1007 const int raysOut = min((int)mSampleRays.size(), mVisualizationSamples);1008 cout << "visualization using " << mVisualizationSamples << " samples" << endl;1009 vector<Ray *> vcRays[leafOut];1010 1011 if (0){1012 //-- some random view cells and rays for output1013 vector<BspLeaf *> bspLeaves;1014 1015 for (int i = 0; i < leafOut; ++ i)1016 bspLeaves.push_back(mBspTree->GetRandomLeaf());1017 1018 for (int i = 0; i < bspLeaves.size(); ++ i)1019 {1020 cout << "creating output for view cell " << i << " ... ";1021 // check whether we can add the current ray to the output rays1022 for (int k = 0; k < raysOut; ++ k)1023 {1024 Ray *ray = mSampleRays[k];1025 1026 for (int j = 0; j < (int)ray->bspIntersections.size(); ++ j)1027 {1028 BspLeaf *leaf = ray->bspIntersections[j].mLeaf;1029 1030 if (bspLeaves[i]->GetViewCell() == leaf->GetViewCell())1031 {1032 vcRays[i].push_back(ray);1033 }1034 }1035 }1036 1037 Intersectable::NewMail();1038 1039 BspViewCell *vc = dynamic_cast<BspViewCell *>(bspLeaves[i]->GetViewCell());1040 1041 //bspLeaves[j]->Mail();1042 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i);1043 1044 Exporter *exporter = Exporter::GetExporter(s);1045 exporter->SetFilled();1046 1047 ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin();1048 1049 exporter->SetWireframe();1050 //exporter->SetFilled();1051 1052 Material m;//= RandomMaterial();1053 m.mDiffuseColor = RgbColor(0, 1, 0);1054 exporter->SetForcedMaterial(m);1055 1056 if (vc->GetMesh())1057 exporter->ExportViewCell(vc);1058 else1059 {1060 PolygonContainer cell;1061 // export view cell geometry1062 mBspTree->ConstructGeometry(vc, cell);1063 exporter->ExportPolygons(cell);1064 CLEAR_CONTAINER(cell);1065 }1066 1067 Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize()1068 << ", piercing rays=" << (int)vcRays[i].size() << endl;1069 1070 // export rays piercing this view cell1071 exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0));1072 1073 m.mDiffuseColor = RgbColor(1, 0, 0);1074 exporter->SetForcedMaterial(m);1075 1076 // exporter->SetWireframe();1077 exporter->SetFilled();1078 1079 // output PVS of view cell1080 for (; it != vc->GetPvs().mEntries.end(); ++ it)1081 {1082 Intersectable *intersect = (*it).first;1083 if (!intersect->Mailed())1084 {1085 exporter->ExportIntersectable(intersect);1086 intersect->Mail();1087 }1088 }1089 1090 // output rest of the objects1091 if (0)1092 {1093 Material m;//= RandomMaterial();1094 m.mDiffuseColor = RgbColor(0, 0, 1);1095 exporter->SetForcedMaterial(m);1096 1097 for (int j = 0; j < objects.size(); ++ j)1098 if (!objects[j]->Mailed())1099 {1100 exporter->SetForcedMaterial(m);1101 exporter->ExportIntersectable(objects[j]);1102 objects[j]->Mail();1103 }1104 }1105 DEL_PTR(exporter);1106 cout << "finished" << endl;1107 }1108 }1109 else1110 {1111 ViewCellContainer viewCells;1112 1113 mBspTree->CollectViewCells(viewCells);1114 stable_sort(viewCells.begin(), viewCells.end(), vc_gt);1115 1116 int limit = min(leafOut, (int)viewCells.size());1117 1118 for (int i = 0; i < limit; ++ i)1119 {1120 cout << "creating output for view cell " << i << " ... ";1121 1122 Intersectable::NewMail();1123 BspViewCell *vc = dynamic_cast<BspViewCell *>(viewCells[i]);1124 1125 cout << "creating output for view cell " << i << " ... ";1126 // check whether we can add the current ray to the output rays1127 for (int k = 0; k < raysOut; ++ k)1128 {1129 Ray *ray = mSampleRays[k];1130 1131 for (int j = 0; j < (int)ray->bspIntersections.size(); ++ j)1132 {1133 BspLeaf *leaf = ray->bspIntersections[j].mLeaf;1134 1135 if (vc == leaf->GetViewCell())1136 {1137 vcRays[i].push_back(ray);1138 }1139 }1140 }1141 1142 //bspLeaves[j]->Mail();1143 char s[64]; sprintf(s, "bsp-pvs%04d.x3d", i);1144 1145 Exporter *exporter = Exporter::GetExporter(s);1146 1147 exporter->SetWireframe();1148 1149 Material m;//= RandomMaterial();1150 m.mDiffuseColor = RgbColor(0, 1, 0);1151 exporter->SetForcedMaterial(m);1152 1153 if (vc->GetMesh())1154 exporter->ExportViewCell(vc);1155 else1156 {1157 PolygonContainer cell;1158 // export view cell1159 mBspTree->ConstructGeometry(vc, cell);1160 exporter->ExportPolygons(cell);1161 CLEAR_CONTAINER(cell);1162 }1163 1164 1165 Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize()1166 << ", piercing rays=" << (int)vcRays[i].size() << endl;1167 1168 1169 // export rays piercing this view cell1170 exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0));1171 1172 m.mDiffuseColor = RgbColor(1, 0, 0);1173 exporter->SetForcedMaterial(m);1174 1175 ViewCellPvsMap::const_iterator it,1176 it_end = vc->GetPvs().mEntries.end();1177 1178 // output PVS of view cell1179 for (it = vc->GetPvs().mEntries.begin(); it != it_end; ++ it)1180 {1181 Intersectable *intersect = (*it).first;1182 if (!intersect->Mailed())1183 {1184 Material m = RandomMaterial();1185 1186 exporter->SetForcedMaterial(m);1187 1188 exporter->ExportIntersectable(intersect);1189 intersect->Mail();1190 }1191 }1192 1193 DEL_PTR(exporter);1194 cout << "finished" << endl;1195 }1196 }1197 } -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h
r428 r429 83 83 bool BuildBspTree(); 84 84 85 void ExportSplits(const ObjectContainer &objects);86 87 void ExportBspPvs(const ObjectContainer &objects);88 89 /** Export scene geometry.90 */91 void ExportSceneGeometry(Exporter *exporter, const ObjectContainer &objects);92 93 85 /** Post processes view cells (i.e., merges or subdivides view cells based 94 86 on the PVS and the ray sets. … … 111 103 RayContainer mSampleRays; 112 104 VssRayContainer mVspSampleRays; 113 int mBspConstructionSamples;105 114 106 int mVspConstructionSamples; 115 107 -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp
r427 r429 24 24 environment->GetIntValue("VssPreprocessor.vssSamples", mVssSamples); 25 25 environment->GetIntValue("VssPreprocessor.vssSamplesPerPass", mVssSamplesPerPass); 26 environment->GetBoolValue("VssPreprocessor.useImportanceSampling", mUseImportanceSampling); 26 environment->GetBoolValue("VssPreprocessor.useImportanceSampling", mUseImportanceSampling); 27 environment->GetIntValue("BspTree.Construction.samples", mBspConstructionSamples); 27 28 28 29 mStats.open("stats.log"); … … 353 354 VssTree *vssTree = NULL; 354 355 356 RayContainer bspRays; 357 355 358 while (totalSamples < mInitialSamples) { 356 359 int passContributingSamples = 0; … … 422 425 423 426 424 425 427 vssTree = new VssTree; 426 428 429 const int bspSamples = min((int)mVssRays.size(), mBspConstructionSamples); 430 431 for (int i = 0; i < bspSamples; ++ i) 432 bspRays.push_back(new Ray(*mVssRays[i])); 433 434 mBspTree = new BspTree(&mUnbounded); 435 436 mBspTree->SetGenerateViewCells(true); 437 mBspTree->Construct(bspRays); 438 439 for (int i = bspSamples; i < (int)mVssRays.size(); ++ i) 440 { 441 CastRay(*mBspTree, *mVssRays[i]); 442 } 443 427 444 vssTree->Construct(mVssRays, mViewSpaceBox); 428 445 … … 469 486 } 470 487 488 489 for (int i = 0; i < (int)vssRays.size(); ++ i) 490 { 491 CastRay(*mBspTree, *mVssRays[i]); 492 } 471 493 472 494 samples+=num; … … 482 504 483 505 delete vssTree; 484 485 return true; 486 } 487 506 507 ObjectContainer objects; 508 ExportSplits(objects, bspRays, 10000); 509 ExportBspPvs(objects, bspRays, 10000); 510 511 CLEAR_CONTAINER(bspRays); 512 513 return true; 514 } 515 516 void VssPreprocessor::CastRay(const BspTree &tree, const VssRay & vssRay) 517 { 518 //-- cast ray to BSP tree to get intersection with view cells 519 Ray ray(vssRay); 520 521 mBspTree->CastRay(ray); 522 523 if (ray.sourceObject.mObject) 524 //sampleContributions += 525 AddObjectSamples(ray.sourceObject.mObject, ray); 526 527 if (!ray.intersections.empty()) // second intersection found 528 { 529 //sampleContributions += 530 AddObjectSamples(ray.intersections[0].mObject, ray); 531 } 532 } 533 534 int VssPreprocessor::AddObjectSamples(Intersectable *obj, const Ray &ray) 535 { 536 int contributingSamples = 0; 537 int j; 538 539 // object can be seen from the view cell => add to view cell pvs 540 for (j=0; j < ray.bspIntersections.size(); ++ j) 541 { 542 BspLeaf *leaf = ray.bspIntersections[j].mLeaf; 543 // if ray not in unbounded space 544 if (leaf->GetViewCell() != &mUnbounded) 545 contributingSamples += 546 leaf->GetViewCell()->GetPvs().AddSample(obj); 547 } 548 549 // rays passing through this viewcell 550 if (mPass > 1) 551 for (j=1; j < ((int)ray.bspIntersections.size() - 1); ++ j) 552 { 553 BspLeaf *leaf = ray.bspIntersections[j].mLeaf; 554 555 if (leaf->GetViewCell() != &mUnbounded) 556 leaf->GetViewCell()-> 557 AddPassingRay(ray, contributingSamples ? 1 : 0); 558 } 559 560 return contributingSamples; 561 } -
trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h
r427 r429 85 85 ExportVssTreeLeaves(VssTree *tree, const int number); 86 86 87 void CastRay(const BspTree &tree, const VssRay & vssRay); 87 88 89 int AddObjectSamples(Intersectable *obj, const Ray &ray); 88 90 }; 89 91 -
trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.h
r428 r429 72 72 mOrigin = ray.GetLoc(); 73 73 74 Debug << "origin: " << mOrigin << endl;74 //Debug << "origin: " << mOrigin << endl; 75 75 76 76 if (!ray.intersections.empty()) … … 81 81 else 82 82 { 83 //mTermination = 1e6; 84 mTermination = mOrigin + ray.GetDir() * 1e6; 83 mTermination = mOrigin + ray.GetDir() * 99999; 85 84 mTerminationObject = NULL; 86 85 }
Note: See TracChangeset
for help on using the changeset viewer.