Changeset 1193 for GTP/trunk/Lib/Vis/Preprocessing/src
- Timestamp:
- 08/09/06 18:35:42 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
r1184 r1193 34 34 /// kd leaves that this intersectable belongs to 35 35 //set<KdLeaf *> mKdLeaves; 36 VssRayContainer mVssRays; 36 VssRayContainer mVssRays; 37 37 38 /// # of object references 38 39 int mReferences; -
GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp
r1189 r1193 793 793 794 794 // if this a valid split => subdivide this node further 795 if (splitFurther) //-- continue subdivision 795 796 if (splitFurther) 796 797 { 797 798 newNode = SubdivideNode(splitPlane, tData, tFrontData, tBackData, coincident); -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp
r1189 r1193 60 60 { 61 61 MailablePvsData *vdata = obj->mViewCellPvs.Find(vc); 62 62 //return false; 63 63 if (vdata) 64 64 { 65 //Debug << "sumpdf: " << vdata->mSumPdf << endl;66 65 // more than one view cell sees this object inside different kd cells 67 66 if (!checkOnlyMailed || !vdata->Mailed()) … … 69 68 if (checkOnlyMailed) 70 69 vdata->Mail(); 71 70 //Debug << "sumpdf: " << vdata->mSumPdf << endl; 72 71 if (vdata->mSumPdf > 1.5f) 73 72 return true; … … 3218 3217 FilterRays(back, *tData.mRays, *backData.mRays); 3219 3218 3219 ++ mOspStats.splits[splitPlane.mAxis]; 3220 3220 3221 3221 //-- eval view cells pvs … … 3467 3467 const float minBox = box.Min(axis); 3468 3468 const float maxBox = box.Max(axis); 3469 Debug << "min: " << minBox << " max: " << maxBox << endl; 3469 3470 3470 3471 const float sizeBox = maxBox - minBox; … … 3473 3474 float maxBand = minBox + (1.0f - mSplitBorder) * (maxBox - minBox); 3474 3475 3476 const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 3477 3475 3478 //-- sort so we can use a sweep 3476 3479 SortSplitCandidates(tData, axis, minBand, maxBand); 3477 3480 3478 float totalVol = 0; //PrepareHeuristics(tData);3481 float totalVol = 0; 3479 3482 float voll = 0; 3480 3483 float volr = totalVol; 3481 3484 3482 3485 ViewCellContainer touchedViewCells; 3486 3483 3487 const float totalRenderCost = PrepareHeuristics(tData, touchedViewCells); 3484 3488 float renderCost = totalRenderCost; … … 3491 3495 3492 3496 float sum = (float)totalVol * sizeBox; 3497 3498 3499 Debug << "here82 render cost: " << renderCost / viewSpaceVol << endl; 3493 3500 3494 3501 ///////////////////////////////// … … 3511 3518 3512 3519 debugVol = 0; 3513 const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 3520 3514 3521 3515 3522 … … 3517 3524 // the sweep heuristics 3518 3525 3519 Intersectable::NewMail(); 3520 ViewCell::NewMail(); 3521 3526 3522 3527 //-- traverse through events and find best split plane 3523 3528 3524 3529 vector<SortableEntry>::const_iterator ci, ci_end = mSplitCandidates->end(); 3530 //minRenderCost = RandomValue(0,viewSpaceVol); 3525 3531 3526 3532 for (ci = mSplitCandidates->begin(); ci != ci_end; ++ ci) … … 3535 3541 3536 3542 // Note: sufficient to compare size of bounding boxes of front and back side? 3537 3538 3543 if (((*ci).mPos >= minBand) && ((*ci).mPos <= maxBand)) 3539 3544 { 3540 3545 float currentPos; 3541 3546 Debug << "here29 : " << minRenderCost / viewSpaceVol << endl; 3547 3542 3548 // HACK: current positition is BETWEEN visibility events 3543 if (1 && ((*ci).mType == SortableEntry::BOX_INTERSECT) &&((ci + 1) != ci_end))3549 if (1 && /*((*ci).mType == SortableEntry::BOX_INTERSECT) &&*/ ((ci + 1) != ci_end)) 3544 3550 currentPos = ((*ci).mPos + (*(ci + 1)).mPos) * 0.5f; 3545 3551 else … … 3549 3555 { 3550 3556 splitPlaneFound = true; 3551 Debug << "pos: " << position << endl;3552 3557 minRenderCost = renderCost; 3553 3558 position = currentPos; 3554 } 3555 } 3556 } 3557 3559 Debug << "pos: " << position << endl; 3560 } 3561 } 3562 } 3563 //splitPlaneFound = true; 3558 3564 if (splitPlaneFound) 3559 3565 { 3560 ratio = totalRenderCost / minRenderCost;3566 ratio = minRenderCost / totalRenderCost; 3561 3567 } 3562 3568 … … 3676 3682 ViewCellContainer &touchedViewCells) 3677 3683 { 3678 3679 3684 // collect view cells and set mail + counter 3680 3685 ViewCellContainer viewCells; … … 3754 3759 float &renderCost) 3755 3760 { 3761 //Debug << "add contri to obj: " << obj->mMailbox - Intersectable::sMailId << endl; 3756 3762 obj->Mail(2); // set as belonging to both leafs 3757 3763 … … 3761 3767 { 3762 3768 ViewCell *vc = *vit; 3769 //Debug << "here30 vc mail " << vc->mMailbox - ViewCell::sMailId << endl; 3763 3770 3764 3771 // if obj not previously associated with this view cell => increase render cost 3765 if (vc->Mailed(1) && 3766 !ViewCellHasMultipleReferences(obj, vc, false))3767 {3772 if (vc->Mailed(1) && !ViewCellHasMultipleReferences(obj, vc, false)) 3773 { 3774 //Debug << "add to rendercost: " << vc->GetVolume() / mVspTree->GetBoundingBox().GetVolume() << endl; 3768 3775 renderCost += vc->GetVolume(); 3769 3776 } … … 3777 3784 float &renderCost) 3778 3785 { 3786 //Debug << "subtract contri from obj: " << obj->mMailbox - Intersectable::sMailId << endl; 3779 3787 obj->Mail(1); // set as belonging to back leaf 3780 3788 ViewCellContainer::const_iterator vit, vit_end = touchedViewCells.end(); 3781 3789 3782 3790 for (vit = touchedViewCells.begin(); vit != vit_end; ++ vit) 3783 3791 { 3784 3792 ViewCell *vc = *vit; 3793 3794 //Debug << "here6 " << vc->mMailbox - ViewCell::sMailId << endl; 3785 3795 3786 3796 // if obj was previously associated with this view cell but is not now 3787 3797 // => decrease render cost 3788 if (vc->Mailed() && 3789 !ViewCellHasMultipleReferences(obj, vc, false))3790 {3798 if (vc->Mailed() && !ViewCellHasMultipleReferences(obj, vc, false)) 3799 { 3800 //Debug << "subtract from rendercost: " << vc->GetVolume() / mVspTree->GetBoundingBox().GetVolume() << endl; 3791 3801 renderCost -= vc->GetVolume(); 3792 3802 } … … 3803 3813 mVspTree->GetViewCells(VssRay(ray), viewCells); 3804 3814 3805 // /classify view cells and compute volume contri accordingly3806 // /possible view cell classifications:3807 // /view cell mailed => view cell can be seen from left child node3808 // /view cell counter > 0 view cell can be seen from right child node3809 // /combined: view cell volume belongs to both nodes3815 // classify view cells and compute volume contri accordingly 3816 // possible view cell classifications: 3817 // view cell mailed => view cell can be seen from left child node 3818 // view cell counter > 0 view cell can be seen from right child node 3819 // combined: view cell volume belongs to both nodes 3810 3820 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 3811 3821 … … 3821 3831 float &renderCost) 3822 3832 { 3823 // view cells can also be seen from left child node 3833 //Debug << "**************" << endl; 3834 //Debug << "vc contri: " << renderCost / mVspTree->GetBoundingBox().GetVolume() << " " << viewCell->mMailbox - ViewCell::sMailId << " counter: " << viewCell->mCounter << endl; 3835 3824 3836 const float vol = viewCell->GetVolume(); 3825 3837 3826 3838 if (viewCell->Mailed()) 3827 3839 { 3828 viewCell-> NewMail(2); // view cell can be seen from both nodes3840 viewCell->Mail(2); // view cell can be seen from both nodes 3829 3841 3830 3842 // we now see view cell from both nodes => add contri … … 3836 3848 3837 3849 // was render cost already added? 3838 if (!ViewCellHasMultipleReferences(obj, viewCell, false) ||3850 if (!ViewCellHasMultipleReferences(obj, viewCell, false) && 3839 3851 obj->Mailed(1)) 3840 3852 { 3841 renderCost += viewCell->GetVolume(); 3853 //Debug << "obj mail 1!! " << vol / mVspTree->GetBoundingBox().GetVolume() << endl; 3854 renderCost += vol; 3842 3855 } 3843 3856 } … … 3846 3859 if (-- viewCell->mCounter == 0) 3847 3860 { 3848 ViewCell::NewMail(1); // view cell can be seen from back node only3861 viewCell->Mail(1); // view cell can be seen from back node only 3849 3862 3850 3863 //MailablePvsData::NewMail(); … … 3856 3869 3857 3870 // can render cost be be reduced? 3858 if (!ViewCellHasMultipleReferences(obj, viewCell, false) || 3859 obj->Mailed()) 3860 { 3861 renderCost -= viewCell->GetVolume(); 3862 } 3863 } 3864 } 3871 if (!ViewCellHasMultipleReferences(obj, viewCell, false) && obj->Mailed()) 3872 { 3873 renderCost -= vol; 3874 } 3875 } 3876 } 3877 //Debug << "new rc: " << renderCost / mVspTree->GetBoundingBox().GetVolume() << " counter2: " << viewCell->mCounter << endl; 3878 //Debug << "**************"<<endl; 3865 3879 } 3866 3880
Note: See TracChangeset
for help on using the changeset viewer.