Changeset 1566 for GTP/trunk/Lib
- Timestamp:
- 10/04/06 11:11:51 (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
r1563 r1566 85 85 //cout << " h " << mSampleContriPerPass << " " << mSamplesPerPass << " " << mTotalSamples << endl; 86 86 mRayQueue.push(vssRay); 87 //mVssRays.push_back(new VssRay(*vssRay));87 mVssRays.push_back(new VssRay(*vssRay)); 88 88 ++ mSampleContriPerPass; 89 89 … … 184 184 SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin); 185 185 186 // cast ray into the new subdivision point 186 187 VssRay *newRay = mRayCaster->CastRay(sray, mViewCellsManager->GetViewSpaceBox(), false); 187 188 //cout << "\np1: " << p1 << "\np : " << p << "\np2: " << p2 << endl; … … 190 191 const bool enqueued = HandleRay(newRay); 191 192 193 // subdivide further 192 194 const int s1 = SubdivideEdge(hitTriangle, p1, p, x, *newRay, oldRay); 193 195 const int s2 = SubdivideEdge(hitTriangle, p, p2, *newRay, y, oldRay); … … 234 236 simpleRays.AddRay(sr); 235 237 } 236 #if 0 237 VizStruct dummy; 238 dummy.enlargedTriangle = new Polygon3(enlargedTriangle); 239 dummy.originalTriangle = hitTriangle; 240 //dummy.ray = new VssRay(currentRay); 241 vizContainer.push_back(dummy); 242 #endif 238 239 if (0) 240 { 241 VizStruct dummy; 242 dummy.enlargedTriangle = new Polygon3(enlargedTriangle); 243 dummy.originalTriangle = hitTriangle; 244 //dummy.ray = new VssRay(currentRay); 245 vizContainer.push_back(dummy); 246 } 243 247 244 248 // cast rays to triangle vertices and determine visibility … … 363 367 364 368 mTotalSampleContri += mSampleContriPerPass; 365 366 369 return castSamples; 367 370 } … … 439 442 440 443 mViewCellsManager->PrintPvsStatistics(mStats); 444 445 // visualization 446 // mViewCellsManager->Visualize(mVssRays); 447 CLEAR_CONTAINER(mVssRays); 441 448 // ComputeRenderError(); 442 449 ++ mPass; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1563 r1566 4227 4227 } 4228 4228 4229 int limit = min(leafOut, (int)mViewCells.size()); 4230 4231 int raysOut = 0; 4232 4229 ////////// 4233 4230 //-- some rays for output 4231 4232 const int limit = min(leafOut, (int)mViewCells.size()); 4233 const int raysOut = min((int)rays.size(), 100); 4234 4234 4235 for (int i = 0; i < limit; ++ i) 4235 4236 { … … 4246 4247 mViewCellsTree->GetPvs(vc, pvs); 4247 4248 4248 //bspLeaves[j]->Mail();4249 4249 char s[64]; sprintf(s, "bsp-pvs%04d.wrl", i); 4250 4250 Exporter *exporter = Exporter::GetExporter(s); … … 4252 4252 Debug << i << ": pvs size=" << (int)mViewCellsTree->GetPvsSize(vc) << endl; 4253 4253 4254 //-- export the sample rays4255 4254 if (mExportRays) 4256 4255 { 4257 // output rays stored with the view cells during subdivision 4256 //////////// 4257 //-- export rays piercing this view cell 4258 4259 // take rays stored with the view cells during subdivision 4258 4260 VssRayContainer vcRays; 4259 4261 VssRayContainer collectRays; 4260 4262 4261 raysOut = min((int)rays.size(), 100); 4262 4263 // collect intial view cells 4263 // collect initial view cells 4264 4264 ViewCellContainer leaves; 4265 4265 mViewCellsTree->CollectLeaves(vc, leaves); 4266 4266 4267 4267 ViewCellContainer::const_iterator vit, vit_end = leaves.end(); 4268 4269 for (vit = leaves.begin(); vit != vit_end; ++ vit) 4268 for (vit = leaves.begin(); vit != vit_end; ++ vit) 4270 4269 { 4271 4270 BspLeaf *vcLeaf = dynamic_cast<BspViewCell *>(*vit)->mLeaves[0]; 4272 4273 4271 VssRayContainer::const_iterator rit, rit_end = vcLeaf->mVssRays.end(); 4274 4272 … … 4279 4277 } 4280 4278 4279 // prepare some rays for output 4281 4280 VssRayContainer::const_iterator rit, rit_end = collectRays.end(); 4282 4283 4281 for (rit = collectRays.begin(); rit != rit_end; ++ rit) 4284 4282 { 4285 float p = RandomValue(0.0f, (float)collectRays.size());4283 const float p = RandomValue(0.0f, (float)collectRays.size()); 4286 4284 4287 4285 if (p < raysOut) 4286 { 4288 4287 vcRays.push_back(*rit); 4288 } 4289 4289 } 4290 4290 4291 //////////4292 //-- export rays piercing this view cell4293 4291 exporter->ExportRays(vcRays, RgbColor(1, 1, 1)); 4294 4292 } … … 4310 4308 //////// 4311 4309 //-- export pvs 4310 Intersectable::NewMail(); 4312 4311 ObjectPvsMap::const_iterator oit, oit_end = pvs.mEntries.end(); 4313 4314 Intersectable::NewMail(); 4315 4312 4316 4313 // output PVS of view cell 4317 4314 for (oit = pvs.mEntries.begin(); oit != oit_end; ++ oit) 4318 4315 { 4319 4316 Intersectable *intersect = (*oit).first; 4320 4321 4317 if (!intersect->Mailed()) 4322 4318 { … … 5433 5429 { 5434 5430 ViewCell *viewcell = *it; 5435 5431 5436 5432 if (viewcell->GetValid()) 5437 { 5438 // if ray not outside of view space 5433 { // if ray not outside of view space 5439 5434 float contribution; 5440 5435 … … 5470 5465 5471 5466 if (!addRays) 5467 { 5472 5468 return ray.mRelativePvsContribution; 5469 } 5473 5470 5474 5471 // sampled objects are stored in the pvs -
GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.h
r1528 r1566 20 20 // various flags 21 21 enum { 22 FPosDirX = 1, // the direction of ray in X-axis is positive 23 FPosDirY = 2, // the direction of ray in Y-axis is positive 24 FPosDirZ = 4 // the direction of ray in Z-axis is positive 22 FPosDirX = 1, // the direction of ray in X-axis is positive 23 FPosDirY = 2, // the direction of ray in Y-axis is positive 24 FPosDirZ = 4, // the direction of ray in Z-axis is positive 25 BorderSample = 8,// if this ray is an adaptive border ray 26 ReverserRay = 16 // if this ray is a reverse sample 25 27 }; 26 28
Note: See TracChangeset
for help on using the changeset viewer.