- Timestamp:
- 08/07/06 10:40:43 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/Preprocessor.vcproj
r1163 r1184 459 459 </File> 460 460 <File 461 RelativePath="..\src\VssRay.cpp">462 </File>463 <File464 461 RelativePath="..\src\VssRay.h"> 465 462 </File> … … 538 535 <File 539 536 RelativePath="..\src\Renderer.h"> 537 </File> 538 <File 539 RelativePath="..\src\VssRay.cpp"> 540 540 </File> 541 541 </Filter> -
GTP/trunk/Lib/Vis/Preprocessing/src/BoostPreprocessorThread.cpp
r1166 r1184 29 29 // camera.LookAtBox(mPreprocessor->mKdTree->GetBox()); 30 30 // camera.LookInBox(mPreprocessor->mKdTree->GetBox()); 31 camera.SetPosition(Vector3(3473, 6.778 , -1699));32 camera.SetDirection(Vector3(-0.2432 , 0, 0.97));31 camera.SetPosition(Vector3(3473, 6.778f, -1699.0f)); 32 camera.SetDirection(Vector3(-0.2432f, 0, 0.97f)); 33 33 // camera.SetPosition(Vector3(991.7, 187.8, -271)); 34 34 // camera.SetDirection(Vector3(0.9, 0, -0.4)); -
GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h
r1072 r1184 17 17 class Ray; 18 18 class Mesh; 19 class KdLeaf; 19 20 20 21 struct IndexedBoundingBox; … … 55 56 typedef vector<IndexedBoundingBox> IndexedBoundingBoxContainer; 56 57 58 /** Container for ViewCell pointers primarily for the use within the kDTree and 59 BSP hierarchies */ 60 61 typedef vector<KdLeaf *> KdLeafContainer; 62 63 57 64 typedef std::map<int, Intersectable *> ObjectMap; 58 65 -
GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h
r1176 r1184 5 5 #include "Pvs.h" 6 6 #include <set> 7 #include "VssRay.h" 7 8 8 9 namespace GtpVisibilityPreprocessor { … … 33 34 /// kd leaves that this intersectable belongs to 34 35 //set<KdLeaf *> mKdLeaves; 35 36 VssRayContainer mVssRays; 36 37 /// # of object references 37 38 int mReferences; … … 50 51 int GetId() { return mId; } 51 52 53 //////////////////////////////////////////////// 54 // Mailing stuff 52 55 53 56 static void NewMail(const int reserve = 1) { … … 64 67 int IncMail() { return ++ mMailbox - sMailId; } 65 68 66 69 //////////////////////////////////////////////////// 67 70 virtual AxisAlignedBox3 GetBox() const = 0; 68 71 virtual int CastRay(GtpVisibilityPreprocessor::Ray &ray) = 0; -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r1176 r1184 370 370 rayRefs/(double)Leaves() << "\n"; 371 371 372 app << "#N_MAXOBJECTREFS ( Max number of rayRefs / leaf )\n" <<372 app << "#N_MAXOBJECTREFS ( Max number of object refs / leaf )\n" << 373 373 maxObjectRefs << "\n"; 374 374 -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
r1176 r1184 10 10 #include "Pvs.h" 11 11 #include "Viewcell.h" 12 #include "VssRay.h" 13 12 14 13 15 namespace GtpVisibilityPreprocessor { … … 216 218 KdViewCell *mViewCell; 217 219 220 VssRayContainer mVssRays; 221 218 222 /// Objects that are referenced in more than one leaf. 219 223 ObjectContainer mMultipleObjects; -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.cpp
r1176 r1184 47 47 48 48 // already processed node (= objects in pvs)? 49 if ( !node->Mailed())49 if (0 ||!node->Mailed()) 50 50 { 51 51 node->Mail(); … … 54 54 { 55 55 KdLeaf *leaf = dynamic_cast<KdLeaf *>(node); 56 56 #if 1 57 57 // add #objects exclusivly in this node 58 58 pvs += (int)(leaf->mObjects.size() - leaf->mMultipleObjects.size()); … … 72 72 } 73 73 } 74 #else 75 ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 76 77 for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 78 { 79 Intersectable *object = *oit; 80 81 if (!object->Mailed()) 82 { 83 object->Mail(); 84 ++ pvs; 85 } 86 } 87 #endif 74 88 } 75 89 else // traverse tree -
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r1168 r1184 28 28 template<typename T> 29 29 struct PvsData { 30 // int mVisibleSamples; 30 //////////////////////////// 31 // Mailing stuff 32 protected: 33 int mMailbox; 34 35 public: 36 // last mail id -> warning not thread safe! 37 // both mailId and mailbox should be unique for each thread!!! 38 static int sMailId; 39 static int sReservedMailboxes; 40 41 42 static void NewMail(const int reserve = 1) { 43 sMailId += sReservedMailboxes; 44 sReservedMailboxes = reserve; 45 } 46 47 void Mail() { mMailbox = sMailId; } 48 bool Mailed() const { return mMailbox == sMailId; } 49 50 void Mail(const int mailbox) { mMailbox = sMailId + mailbox; } 51 bool Mailed(const int mailbox) const { return mMailbox == sMailId + mailbox; } 52 53 int IncMail() { return ++ mMailbox - sMailId; } 54 ////////////////////////////////////////// 55 31 56 // sum of probability density of visible sample rays 32 57 float mSumPdf; 58 33 59 PvsData<T>() {} 34 60 PvsData<T>(const float sumPdf): … … 37 63 // $$JB in order to return meaningfull values 38 64 // it assumes that the sum pdf has been normalized somehow!!! 39 float GetVisibility() { return mSumPdf; } 65 float GetVisibility() 66 { 67 return mSumPdf; 68 } 40 69 }; 70 71 template<typename T> int PvsData<T>::sMailId = 1; 72 template<typename T> int PvsData<T>::sReservedMailboxes = 1; 41 73 42 74 /** Template class representing the Potentially Visible Set (PVS) … … 89 121 float AddSample(T sample, const float pdf); 90 122 123 /** Adds sample to PVS. 124 @returns PvsData 125 */ 126 PvsData<T> *AddSample2(T sample, const float pdf); 127 91 128 /** Adds one pvs to another one. 92 129 @returns new pvs size … … 291 328 292 329 template <typename T> 330 PvsData<T> * 331 Pvs<T>::AddSample2(T sample, const float pdf) 332 { 333 PvsData<T> *data = Find(sample); 334 335 if (data) { 336 data->mSumPdf += pdf; 337 } 338 else { 339 mEntries[sample] = PvsData<T>(pdf); 340 data = Find(sample); 341 } 342 return data; 343 } 344 345 template <typename T> 293 346 bool 294 347 Pvs<T>::AddSample(T sample, … … 437 490 typedef PvsData<KdNode *> KdPvsData; 438 491 439 //typedef Pvs<Intersectable *> ObjectPvs;440 492 typedef Pvs<ViewCell *> ViewCellPvs; 493 typedef PvsData<ViewCell *> ViewCellPvsData; 494 441 495 } 442 496 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1180 r1184 1889 1889 ray.mPdf, 1890 1890 contribution)) 1891 { 1891 1892 ++ ray.mPvsContribution; 1892 ray.mRelativePvsContribution += contribution; 1893 ray.mRelativePvsContribution += contribution; 1894 } 1893 1895 } 1894 1896 // for directional sampling it is important to count only contributions … … 4810 4812 mOspTree->SetViewCellsManager(this); 4811 4813 4812 mVspTree-> mViewCellsTree = mViewCellsTree;4814 mVspTree->SetViewCellsTree(mViewCellsTree); 4813 4815 } 4814 4816 … … 5726 5728 } 5727 5729 5728 #if 15730 #if TEST_EVALUATION 5729 5731 void VspOspViewCellsManager::EvalViewCellPartition() 5730 5732 { 5731 int samplesPerPass;5732 int numSamples;5733 5733 int castSamples = (int)storedRays.size(); 5734 5734 … … 5746 5746 5747 5747 const bool startFromZero = true; 5748 5748 5749 5749 5750 // reset pvs and start over from zero … … 5787 5788 string fileName = string(statsPrefix) + string(s); 5788 5789 5790 ViewCellContainer leaves; 5791 5792 mViewCellsTree->CollectLeaves(mViewCellsTree->GetRoot(), leaves); 5793 float rc = 0; 5794 ViewCellContainer::const_iterator vit, vit_end = leaves.end(); 5795 for (vit = leaves.begin(); vit != vit_end; ++ vit) 5796 { 5797 ViewCell *vc = *vit; 5798 5799 int pvs = vc->GetPvs().CountObjectsInPvs(); 5800 float vol = vc->GetVolume(); 5801 rc += pvs * vol; 5802 5803 } 5804 5805 Debug << "here295 " << rc / mVspTree->GetBoundingBox().GetVolume(); 5806 5789 5807 mViewCellsTree->ExportStats(fileName); 5790 5808 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
r1180 r1184 954 954 }; 955 955 956 #define TEST_EVALUATION 1 956 957 957 958 /** … … 1012 1013 protected: 1013 1014 1014 #if 11015 #if TEST_EVALUATION 1015 1016 virtual void EvalViewCellPartition(); 1016 1017 #endif … … 1037 1038 /** Exports visualization of the PVS. 1038 1039 */ 1039 void ExportPvs(const ObjectContainer &objects, 1040 void ExportPvs( 1041 const ObjectContainer &objects, 1040 1042 const VssRayContainer &rays); 1041 1043 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp
r1181 r1184 102 102 //app << "#N_PVS: " << pvs << endl; 103 103 104 //app << "#N_MAXOBJECTREFS ( Max number of object refs / leaf )\n" << maxObjectRefs << "\n"; 105 104 106 app << "========== END OF VspTree statistics ==========\n"; 105 107 } … … 134 136 << minPvsNodes * 100 / (double)Leaves() << endl; 135 137 136 //app << "#N_PMIN RAYSLEAVES ( Percentage of leaves with minimal number of rays)\n"137 // << minRaysNodes * 100 / (double)Leaves() << endl;138 //app << "#N_PMINOBJECTREFLEAVES ( Percentage of leaves with minimal number of object ref)\n" 139 //<< minObjectNodes * 100 / (double)Leaves() << endl; 138 140 139 141 app << "#N_MAXCOSTNODES ( Percentage of leaves with terminated because of max cost ratio )\n" … … 143 145 << minProbabilityNodes * 100 / (double)Leaves() << endl; 144 146 145 // app << "#N_PMAXRAYCONTRIBLEAVES ( Percentage of leaves with maximal ray contribution )\n"146 // << maxRayContribNodes * 100 / (double)Leaves() << endl;147 148 147 app << "#N_PMAXDEPTH ( Maximal reached depth )\n" << maxDepth << endl; 149 148 … … 153 152 154 153 app << "#N_INVALIDLEAVES (number of invalid leaves )\n" << invalidLeaves << endl; 154 155 app << "#N_MAXOBJECTREFS ( Max number of object refs / leaf )\n" << 156 maxObjectRefs << "\n"; 155 157 156 158 // app << "#N_RAYS (number of rays / leaf)\n" << AvgRays() << endl; … … 632 634 } 633 635 634 // 636 // set view cell values 635 637 viewCell->mLeaf = leaf; 636 638 … … 734 736 { 735 737 (*it).mRay->Ref(); 736 dynamic_cast<VspLeaf *>(newNode)->mVssRays.push_back((*it).mRay);738 leaf->mVssRays.push_back((*it).mRay); 737 739 } 738 740 } … … 933 935 bool VspTree::AddKdLeafToPvs(KdLeaf *leaf, 934 936 ViewCell *vc, 935 float &pdf,937 const float pdf, 936 938 float &contribution) 937 939 { … … 948 950 #else // add all objects of kd node 949 951 950 pdf = 0;951 952 contribution = 0; 952 953 … … 957 958 Intersectable *object = *it; 958 959 959 float newpdf;960 960 float newcontri; 961 961 962 if (vc->AddPvsSample(object, newpdf, newcontri))962 if (vc->AddPvsSample(object, pdf, newcontri)) 963 963 { 964 964 contri = true; 965 965 } 966 966 967 pdf += newPdf;967 //pdf += newPdf; 968 968 newContri += contribution; 969 969 } … … 2379 2379 stack<LineTraversalData> tStack; 2380 2380 2381 Intersectable::NewMail();2381 //Intersectable::NewMail(); 2382 2382 //ViewCell::NewMail(); 2383 2383 … … 2913 2913 void VspTree::GetViewCells(const VssRay &ray, ViewCellContainer &viewCells) 2914 2914 { 2915 static Ray hray; 2916 hray.Init(ray); 2917 //hray.mFlags |= Ray::CULL_BACKFACES; 2918 //Ray hray(ray); 2919 2920 float tmin = 0, tmax = 1.0; 2921 2922 if (!mBoundingBox.GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 2923 return; 2924 2925 const Vector3 origin = hray.Extrap(tmin); 2926 const Vector3 termination = hray.Extrap(tmax); 2927 2915 2928 // if no precomputation of view cells 2916 CastLineSegment( ray.mOrigin, ray.mTermination, viewCells);2929 CastLineSegment(origin, termination, viewCells); 2917 2930 } 2918 2931 … … 3117 3130 3118 3131 //-- classify objects 3132 3119 3133 int objectsBack = 0; 3120 3134 int objectsFront = 0; 3121 3135 3122 3136 ObjectContainer::const_iterator mi, mi_end = leaf->mObjects.end(); 3123 3137 3124 3138 for ( mi = leaf->mObjects.begin(); mi != mi_end; ++ mi) … … 3127 3141 const AxisAlignedBox3 box = (*mi)->GetBox(); 3128 3142 3129 if (box.Max(axis) > position + mEpsilon)3143 if (box.Max(axis) >= position) 3130 3144 ++ objectsFront; 3131 3145 3132 if (box.Min(axis) < position - mEpsilon)3146 if (box.Min(axis) < position) 3133 3147 ++ objectsBack; 3134 3148 } 3149 3135 3150 3136 3151 // TODO matt: compute pvs … … 3138 3153 backData.mPvs = objectsBack; 3139 3154 3155 //CheckViewCellsPvs(leaf, *tData.mRays); 3156 RemoveParentViewCellsPvs(leaf, *tData.mRays); 3157 3158 3140 3159 KdLeaf *back = new KdLeaf(node, objectsBack); 3141 3160 KdLeaf *front = new KdLeaf(node, objectsFront); 3142 3161 3162 3143 3163 ///////////// 3144 3164 //-- create front and back leaf … … 3161 3181 3162 3182 SplitObjects(leaf, splitPlane, leaf->mObjects, front->mObjects, back->mObjects); 3183 3184 3185 //-- eval view cells pvs 3186 3187 // remove parent pvs update pvs of left and right leaves 3188 // Note: It is necessary to update first left and then right pvs. 3189 // We need to store the view cells seen by each object, 3190 // but also if the view cells are seen as part of two different 3191 // kd leaves, which is stored in the pdf component of the pvs entry. 3192 // Because if an object is part of a view cell more than once, 3193 // it cannot be removed from the pvs by splitting a kd node where 3194 // the view cell sees only the other child of the node. 3195 // This is important during the subdivision 3196 3197 //ViewCellPvsData::NewMail(); 3198 UpdateViewCellsPvs(front, *frontData.mRays); 3199 UpdateViewCellsPvs(back, *backData.mRays); 3200 3201 //////////////////////////////////// 3202 3163 3203 3164 3204 ProcessMultipleRefs(front); … … 3234 3274 { 3235 3275 EvaluateLeafStats(tData); 3276 const bool mStoreRays= true; 3277 //-- store additional info 3278 if (mStoreRays) 3279 { 3280 KdLeaf *leaf = dynamic_cast<KdLeaf *>(newNode); 3281 3282 RayInfoContainer::const_iterator it, it_end = tData.mRays->end(); 3283 3284 for (it = tData.mRays->begin(); it != it_end; ++ it) 3285 { 3286 (*it).mRay->Ref(); 3287 leaf->mVssRays.push_back((*it).mRay); 3288 } 3289 } 3236 3290 } 3237 3291 … … 3250 3304 // compute locally best split plane 3251 3305 const bool success = 3252 SelectSplitPlane(splitCandidate.mParentData, splitCandidate.mSplitPlane, frontProb, backProb); 3306 SelectSplitPlane(splitCandidate.mParentData, 3307 splitCandidate.mSplitPlane, 3308 frontProb, 3309 backProb); 3253 3310 3254 3311 float oldRenderCost; … … 3275 3332 3276 3333 splitCandidate.mMaxCostMisses = 3277 success ? splitCandidate.mParentData.mMaxCostMisses : splitCandidate.mParentData.mMaxCostMisses + 1; 3334 success ? splitCandidate.mParentData.mMaxCostMisses : 3335 splitCandidate.mParentData.mMaxCostMisses + 1; 3278 3336 } 3279 3337 … … 3305 3363 // the node became a leaf -> evaluate stats for leafs 3306 3364 KdLeaf *leaf = data.mNode; 3365 3366 ++ mCreatedLeaves; 3307 3367 3308 3368 if (data.mPvs > mOspStats.maxPvs) … … 3324 3384 } 3325 3385 3326 // if (data.mPvs < mTermMinPvs)3327 // ++ mOspStats.minPvsNodes;3328 3329 3386 if (data.mProbability <= mTermMinProbability) 3330 3387 ++ mOspStats.minProbabilityNodes; … … 3332 3389 // accumulate depth to compute average depth 3333 3390 mOspStats.accumDepth += data.mDepth; 3334 3335 ++ mCreatedLeaves; 3391 3392 // if ((int)(leaf->mObjects.size()) < mTermMinCost) 3393 // ++ mOspStats.minCostNodes; 3394 3395 if ((int)(leaf->mObjects.size()) > mOspStats.maxObjectRefs) 3396 mOspStats.maxObjectRefs = (int)leaf->mObjects.size(); 3336 3397 3337 3398 #ifdef _DEBUG … … 3500 3561 // << "\t pb=(" << volBack << ")\t pf=(" << volFront << ")" << endl; 3501 3562 3502 Debug << "\n§§§§ eval local cost §§§§" << endl3563 /* Debug << "\n§§§§ eval local cost §§§§" << endl 3503 3564 << "back pvs: " << pvsBack << " front pvs: " << pvsFront << " total pvs: " << totalPvs << endl 3504 3565 << "back p: " << volBack / viewSpaceVol << " front p " << volFront / viewSpaceVol << " p: " << totalVol / viewSpaceVol << endl 3505 3566 << "old rc: " << oldRenderCost / viewSpaceVol << " new rc: " << newRenderCost / viewSpaceVol << endl 3506 3567 << "render cost decrease: " << oldRenderCost / viewSpaceVol - newRenderCost / viewSpaceVol << endl; 3507 3568 */ 3508 3569 if (oldRenderCost < newRenderCost) 3509 3570 Debug << "\nwarning!!:\n" << "old rc: " << oldRenderCost * viewSpaceVol << " new rc: " << newRenderCost * viewSpaceVol << endl; … … 3552 3613 3553 3614 const bool positive = ray->HasPosDir(axis); 3554 3615 3616 if (EndPointInsideNode(leaf, *ray, true)) 3617 { 3618 pos = ray->mTermination[axis]; 3619 3620 mSplitCandidates->push_back( 3621 SortableEntry(SortableEntry::BOX_INTERSECT, 3622 pos, 3623 ray->mTerminationObject, 3624 ray) 3625 ); 3626 } 3627 3555 3628 // if hitpoint with object is inside this node 3556 if ( ray->mOriginObject && (GetLeaf(ray->mOrigin, ray->mOriginNode) == leaf))3629 if (EndPointInsideNode(leaf, *ray, false)) 3557 3630 { 3558 3631 pos = ray->mOrigin[axis]; … … 3562 3635 pos, 3563 3636 ray->mOriginObject, 3564 ray)3565 );3566 }3567 3568 if (ray->mTerminationObject && (GetLeaf(ray->mTermination, ray->mTerminationNode) == leaf))3569 {3570 pos = ray->mTermination[axis];3571 3572 mSplitCandidates->push_back(3573 SortableEntry(SortableEntry::BOX_INTERSECT,3574 pos,3575 ray->mTerminationObject,3576 3637 ray) 3577 3638 ); … … 3670 3731 // if hitpoint with one of the objects is inside this node, we 3671 3732 // evaluate the volume of the view cells seen by this ray 3672 if ( ray->mOriginObject && (GetLeaf(ray->mOrigin, ray->mOriginNode) == leaf))3733 if (EndPointInsideNode(leaf, *ray, true)) 3673 3734 { 3674 3735 vol += PrepareHeuristics(*ray, newViewCells); … … 3677 3738 3678 3739 // count double if both hit points are within the kd node 3679 if ( ray->mTerminationObject && (GetLeaf(ray->mTermination, ray->mTerminationNode) == leaf))3740 if (EndPointInsideNode(leaf, *ray, false)) 3680 3741 { 3681 3742 vol += PrepareHeuristics(*ray, newViewCells); … … 3684 3745 } 3685 3746 3686 //Debug << "vol: " << vol << endl;3747 3687 3748 return vol; 3688 3749 } … … 3716 3777 // process ray if the hit point with termination / origin object 3717 3778 // is inside this kd leaf 3718 if ( (ray->mOriginObject && (GetLeaf(ray->mOrigin, ray->mOriginNode) == leaf)) ||3719 (ray->mTerminationObject && (GetLeaf(ray->mTermination, ray->mTerminationNode) == leaf)))3779 if (EndPointInsideNode(leaf, *ray, true) || 3780 EndPointInsideNode(leaf, *ray, false)) 3720 3781 { 3721 3782 EvalVolumeContribution(*ray, volLeft, volRight); … … 3881 3942 if (isTermination) 3882 3943 { 3883 return ray.mTerminationObject && (GetLeaf(ray.mTermination, ray.m OriginNode) == leaf);3944 return ray.mTerminationObject && (GetLeaf(ray.mTermination, ray.mTerminationNode) == leaf); 3884 3945 } 3885 3946 else … … 3945 4006 3946 4007 4008 static bool ViewCellHasMultipleReferences(Intersectable *obj, 4009 ViewCell *vc, 4010 bool checkOnlyMailed) 4011 { 4012 ViewCellPvsData *vdata = obj->mViewCellPvs.Find(vc); 4013 4014 if (vdata) 4015 { 4016 //Debug << "sumpdf: " << vdata->mSumPdf << endl; 4017 // more than one view cell sees this object inside different kd cells 4018 if (!checkOnlyMailed || !vdata->Mailed()) 4019 { 4020 vdata->Mail();//return true; 4021 if (vdata->mSumPdf > 1.5f) 4022 return true; 4023 } 4024 } 4025 4026 return false; 4027 } 4028 4029 3947 4030 float OspTree::EvalRenderCostDecrease(const AxisAlignedPlane &candidatePlane, 3948 4031 const OspTraversalData &tData, … … 3958 4041 float pFrontAndBack = 0; 3959 4042 3960 3961 4043 const float viewSpaceVol = mVspTree->GetBoundingBox().GetVolume(); 3962 4044 3963 //Intersectable::NewMail(); 3964 KdLeaf::NewMail(); 3965 ViewCell::NewMail(); 3966 4045 Intersectable::NewMail(3); 4046 3967 4047 KdLeaf *leaf = tData.mNode; 3968 4048 const int totalPvs = (int)leaf->mObjects.size(); … … 3983 4063 { 3984 4064 ++ pvsFront; 4065 obj->Mail(); 3985 4066 } 3986 4067 … … 3988 4069 { 3989 4070 ++ pvsBack; 3990 } 3991 } 4071 4072 if (obj->Mailed()) 4073 obj->Mail(2); 4074 else 4075 obj->Mail(1); 4076 } 4077 4078 //Debug << "here3 pt: " << obj << " mail: " << obj->mMailbox - Intersectable::sMailId << endl; 4079 } 4080 4081 4082 ViewCellContainer touchedViewCells; 4083 RayInfoContainer touchedRays; 3992 4084 3993 4085 // sum up volume seen from the objects of left and right children … … 3996 4088 3997 4089 RayInfoContainer::const_iterator rit, rit_end = tData.mRays->end(); 3998 3999 ViewCellContainer collectedViewCells; 4090 //map<Intersectable *, ViewCellContainer> objectsMap; 4000 4091 4001 4092 for (rit = tData.mRays->begin(); rit < rit_end; ++ rit) … … 4009 4100 if (originInside || terminationInside) 4010 4101 { 4102 touchedRays.push_back(*rit); 4011 4103 // add volume to volumes of left and / or right children 4012 4104 // if one of the ray end points is inside … … 4026 4118 // if not previously mailed 4027 4119 if (!vc->Mailed() && !vc->Mailed(1) && !vc->Mailed(2)) 4028 collectedViewCells.push_back(vc); 4029 4030 // classify / mail the view cell 4031 MailViewCell(*vit, classification); 4032 } 4033 } 4034 } 4035 4036 4037 // evaluate view cells volume contribution with respect to the mail box classification 4038 ViewCellContainer::const_iterator vit, vit_end = collectedViewCells.end(); 4039 4040 for (vit = collectedViewCells.begin(); vit != vit_end; ++ vit) 4120 { 4121 touchedViewCells.push_back(vc); 4122 } 4123 4124 // classify / mail the view cell 4125 MailViewCell(vc, classification); 4126 4127 /*if (terminationInside) 4128 objectsMap[ray->mTerminationObject].push_back(vc); 4129 if (originInside) 4130 objectsMap[ray->mOriginObject].push_back(vc);*/ 4131 } 4132 } 4133 } 4134 4135 // evaluate view cells volume contribution 4136 // with respect to the mail box classification 4137 ViewCellContainer::const_iterator vit, vit_end = touchedViewCells.end(); 4138 4139 for (vit = touchedViewCells.begin(); vit != vit_end; ++ vit) 4041 4140 { 4042 4141 AddViewCellVolumeContri(*vit, pFront, pBack, pFrontAndBack); 4043 4142 } 4143 4144 ////////////////////////////////////////////// 4145 // 4146 // evaluate contribution of objects which are part of other kd nodes 4147 // which are seen by the same view cell 4148 // These contributions cannot be reduced by splitting, because 4149 // the object would still be part of the pvs 4150 4151 float additionalFrontRenderCost = 0; 4152 float additionalBackRenderCost = 0; 4153 4154 ViewCellPvsData::NewMail(); 4155 4156 for (rit = touchedRays.begin(); rit != touchedRays.end(); ++ rit) 4157 { 4158 VssRay *ray = (*rit).mRay; 4159 4160 ViewCellContainer viewCells; 4161 mVspTree->GetViewCells(*ray, viewCells); 4162 4163 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 4164 4165 // traverse through view cells 4166 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 4167 { 4168 ViewCell *viewCell = *vit; 4169 4170 // for a view cell: 4171 // if object is also in the kd pvs entries from other kd leaves, 4172 // render cost cannot be reduced for this view cell 4173 // => the render cost was falsly reduced, add them again 4174 4175 if (EndPointInsideNode(leaf, *ray, true)) 4176 { 4177 Intersectable *obj = ray->mTerminationObject; 4178 4179 const bool renderCostWrong = 4180 ViewCellHasMultipleReferences(obj, viewCell, true); 4181 // if(!obj->Mailed()){ 4182 // Debug << "pt: " << obj << endl; 4183 // Debug << "vc mail: " << viewCell->mMailbox - ViewCell::sMailId << " obj mail: " << obj->mMailbox << " "<< Intersectable::sMailId << " " <<obj->mMailbox - Intersectable::sMailId << endl; 4184 // obj->Mail(); 4185 // } 4186 // if there is already an entry of this object in the view cell pvs 4187 if (renderCostWrong) 4188 { 4189 // view cell was counted only for front or back => correct tjos 4190 if (viewCell->Mailed(1) && obj->Mailed()) 4191 additionalFrontRenderCost += viewCell->GetVolume(); 4192 else if (viewCell->Mailed() && obj->Mailed(1)) 4193 additionalBackRenderCost += viewCell->GetVolume(); 4194 } 4195 } 4196 4197 if (EndPointInsideNode(leaf, *ray, false)) 4198 { 4199 Intersectable *obj = ray->mOriginObject; 4200 4201 const bool renderCostWrong = 4202 ViewCellHasMultipleReferences(obj, viewCell, true); 4203 // if there is already an entry of this object in the view cell pvs 4204 if (renderCostWrong) 4205 { 4206 if (viewCell->Mailed(1) && obj->Mailed()) 4207 additionalFrontRenderCost += viewCell->GetVolume(); 4208 else if (viewCell->Mailed() && obj->Mailed(1)) 4209 additionalBackRenderCost += viewCell->GetVolume(); 4210 } 4211 } 4212 } 4213 } 4214 4215 ///////////////////////////// 4044 4216 4045 4217 … … 4057 4229 // b) the right node are weighted by the #right node objects 4058 4230 // c) both nodes are weighted by the #parent node objects 4059 const float newRenderCost = pvsFront * pFront + pvsBack * pBack + totalPvs * pFrontAndBack; 4231 const float newRenderCost = pvsFront * pFront + pvsBack * pBack + totalPvs * pFrontAndBack 4232 + additionalFrontRenderCost + additionalBackRenderCost; 4060 4233 4061 4234 // normalize volume with view space volume … … 4067 4240 << " front and back p " << pFrontAndBack / viewSpaceVol << " p: " << tData.mProbability / viewSpaceVol << endl 4068 4241 << "old rc: " << oldRenderCost / viewSpaceVol << " new rc: " << newRenderCost / viewSpaceVol << endl 4069 << "render cost decrease: " << renderCostDecrease << endl; 4070 4242 << "render cost decrease: " << renderCostDecrease << endl 4243 << "additional front " << additionalFrontRenderCost / viewSpaceVol 4244 << " additional back " << additionalBackRenderCost / viewSpaceVol << endl; 4245 4246 if (oldRenderCost < newRenderCost * 0.99) 4247 Debug <<"error!!"<<endl; 4248 4071 4249 //if ((((pOverall - tData.mProbability) / viewSpaceVol) > 0.00001)) 4072 4250 // Debug << "ERROR!!"<<endl; … … 4383 4561 4384 4562 4563 int OspTree::SplitViewCells(const AxisAlignedPlane &candidatePlane, 4564 const RayInfoContainer &rays, 4565 KdLeaf *leaf, 4566 ViewCellContainer &frontViewCells, 4567 ViewCellContainer &backViewCells, 4568 ViewCellContainer &frontAndBackViewCells) const 4569 { 4570 ViewCellContainer touchedViewCells; 4571 RayInfoContainer touchedRays; 4572 4573 // sum up volume seen from the objects of left and right children 4574 // => the volume is the weight for the render cost equation 4575 ViewCell::NewMail(3); 4576 4577 RayInfoContainer::const_iterator rit, rit_end = rays.end(); 4578 4579 for (rit = rays.begin(); rit < rit_end; ++ rit) 4580 { 4581 VssRay *ray = (*rit).mRay; 4582 4583 // test if intersection point with one of the objects is inside this node 4584 const bool originInside = EndPointInsideNode(leaf, *ray, false); 4585 const bool terminationInside = EndPointInsideNode(leaf, *ray, true); 4586 4587 if (originInside || terminationInside) 4588 { 4589 touchedRays.push_back(*rit); 4590 // add volume to volumes of left and / or right children 4591 // if one of the ray end points is inside 4592 const int classification = ClassifyRay(ray, leaf, candidatePlane); 4593 4594 ViewCellContainer viewCells; 4595 mVspTree->GetViewCells(*ray, viewCells); 4596 4597 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 4598 4599 // traverse through view cells and classify them according 4600 // to them being seen from to back / front / front and back node 4601 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 4602 { 4603 ViewCell *vc = *vit; 4604 4605 // if not previously mailed 4606 if (!vc->Mailed() && !vc->Mailed(1) && !vc->Mailed(2)) 4607 { 4608 touchedViewCells.push_back(vc); 4609 } 4610 4611 // classify / mail the view cell 4612 MailViewCell(*vit, classification); 4613 } 4614 } 4615 } 4616 4617 // the important view cells 4618 ViewCellContainer::const_iterator vit, vit_end = touchedViewCells.end(); 4619 4620 for (vit = touchedViewCells.begin(); vit != vit_end; ++ vit) 4621 { 4622 ViewCell *vc = *vit; 4623 4624 if (vc->Mailed()) 4625 frontViewCells.push_back(vc); 4626 else if (vc->Mailed(1)) 4627 backViewCells.push_back(vc); 4628 else if (vc->Mailed(2)) 4629 frontAndBackViewCells.push_back(vc); 4630 } 4631 4632 return 0; 4633 } 4634 4635 4636 int OspTree::CheckViewCellsPvs(KdLeaf *leaf, 4637 const RayInfoContainer &rays) const 4638 { 4639 RayInfoContainer::const_iterator rit, rit_end = rays.end(); 4640 4641 Intersectable::NewMail(); 4642 ObjectContainer touchedObjects; 4643 4644 4645 for (rit = rays.begin(); rit < rit_end; ++ rit) 4646 { 4647 VssRay *ray = (*rit).mRay; 4648 4649 // test if intersection point with one of the objects is inside this node 4650 const bool originInside = EndPointInsideNode(leaf, *ray, false); 4651 const bool terminationInside = EndPointInsideNode(leaf, *ray, true); 4652 4653 if (terminationInside) 4654 { 4655 Intersectable *obj = ray->mTerminationObject; 4656 4657 if (!obj->Mailed()) 4658 { 4659 obj->Mail(); 4660 touchedObjects.push_back(obj); 4661 } 4662 } 4663 4664 if (originInside) 4665 { 4666 Intersectable *obj = ray->mOriginObject; 4667 4668 if (!obj->Mailed()) 4669 { 4670 obj->Mail(); 4671 touchedObjects.push_back(obj); 4672 } 4673 } 4674 } 4675 Debug << "here65 " << touchedObjects.size() << endl; 4676 ObjectContainer::const_iterator it, it_end = touchedObjects.end(); 4677 for (it = touchedObjects.begin(); it != it_end; ++ it) 4678 { 4679 Debug << "\nhere94 obj: " << (*it) << " size: " << (*it)->mViewCellPvs.GetSize() << endl << endl; 4680 ViewCellPvsMap::const_iterator mit, mit_end = (*it)->mViewCellPvs.mEntries.end(); 4681 4682 for (mit = (*it)->mViewCellPvs.mEntries.begin(); mit != mit_end; ++ mit) 4683 { 4684 Debug << "newsumpdf: " << (*mit).second.mSumPdf << endl; 4685 } 4686 } 4687 4688 return 0; 4689 } 4690 4691 4692 4693 4385 4694 KdIntersectable *OspTree::GetOrCreateKdIntersectable(KdNode *node) 4386 4695 { … … 4448 4757 } 4449 4758 */ 4759 4760 4450 4761 void OspTree::MailViewCell(ViewCell *vc, const int cf) const 4451 4762 { … … 4501 4812 4502 4813 4503 float OspTree::EvalViewCellsVolume(KdLeaf *leaf, const RayInfoContainer &rays) const 4814 float OspTree::EvalViewCellsVolume(KdLeaf *leaf, 4815 const RayInfoContainer &rays) const 4504 4816 { 4505 4817 float vol = 0; … … 4514 4826 // process ray if the hit point with termination / origin object 4515 4827 // is inside this kd leaf 4516 if (!(( ray->mOriginObject && (GetLeaf(ray->mOrigin, ray->mOriginNode) == leaf)) ||4517 ( ray->mTerminationObject && (GetLeaf(ray->mTermination, ray->mTerminationNode) == leaf))))4828 if (!((EndPointInsideNode(leaf, *ray, true)) || 4829 (EndPointInsideNode(leaf, *ray, false)))) 4518 4830 continue; 4519 4831 … … 4536 4848 4537 4849 return vol; 4850 } 4851 4852 4853 bool OspTree::AddViewCellToObjectPvs(Intersectable *obj, 4854 ViewCell *vc, 4855 float &contribution, 4856 bool onlyMailed) const 4857 { 4858 contribution = 0; // todo 4859 4860 ViewCellPvsData *vdata = obj->mViewCellPvs.Find(vc); 4861 4862 if (!vdata) 4863 { 4864 vdata = obj->mViewCellPvs.AddSample2(vc, 1); 4865 } 4866 else if (!onlyMailed || !vdata->Mailed()) 4867 { 4868 obj->mViewCellPvs.AddSample(vc, 1); 4869 } 4870 4871 vdata->Mail(); 4872 4873 return true; 4874 } 4875 4876 4877 int OspTree::UpdateViewCellsPvs(KdLeaf *leaf, 4878 const RayInfoContainer &rays) const 4879 4880 { 4881 RayInfoContainer::const_iterator rit, rit_end = rays.end(); 4882 4883 //ViewCell::NewMail(); Intersectable::NewMail(); 4884 ViewCellPvsData::NewMail(); 4885 4886 for (rit = rays.begin(); rit < rit_end; ++ rit) 4887 { 4888 VssRay *ray = (*rit).mRay; 4889 4890 // test if intersection point with one of the objects is inside this node 4891 const bool originInside = EndPointInsideNode(leaf, *ray, false); 4892 const bool terminationInside = EndPointInsideNode(leaf, *ray, true); 4893 4894 if (originInside || terminationInside) 4895 { 4896 ViewCellContainer viewCells; 4897 mVspTree->GetViewCells(*ray, viewCells); 4898 4899 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 4900 4901 // traverse through view cells and classify them according 4902 // to them being seen from to back / front / front and back node 4903 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 4904 { 4905 ViewCell *vc = *vit; 4906 4907 Intersectable *obj = ray->mTerminationObject; 4908 4909 if (obj) 4910 { 4911 float contri; 4912 AddViewCellToObjectPvs(obj, vc, contri, true); 4913 } 4914 4915 obj = ray->mOriginObject; 4916 4917 if (obj) 4918 { 4919 float contri; 4920 AddViewCellToObjectPvs(obj, vc, contri, true); 4921 } 4922 } 4923 } 4924 } 4925 4926 return 0; 4927 } 4928 4929 4930 int OspTree::RemoveParentViewCellsPvs(KdLeaf *leaf, 4931 const RayInfoContainer &rays 4932 ) const 4933 4934 { 4935 RayInfoContainer::const_iterator rit, rit_end = rays.end(); 4936 //ViewCell::NewMail(); Intersectable::NewMail(); 4937 ViewCellPvsData::NewMail(); 4938 4939 for (rit = rays.begin(); rit < rit_end; ++ rit) 4940 { 4941 VssRay *ray = (*rit).mRay; 4942 4943 // test if intersection point with one of the objects is inside this node 4944 const bool originInside = EndPointInsideNode(leaf, *ray, false); 4945 const bool terminationInside = EndPointInsideNode(leaf, *ray, true); 4946 4947 if (originInside || terminationInside) 4948 { 4949 ViewCellContainer viewCells; 4950 mVspTree->GetViewCells(*ray, viewCells); 4951 4952 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 4953 4954 // traverse through view cells and classify them according 4955 // to them being seen from to back / front / front and back node 4956 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 4957 { 4958 ViewCell *vc = *vit; 4959 4960 Intersectable *obj = ray->mTerminationObject; 4961 if (obj) 4962 { 4963 ViewCellPvsData *vdata = obj->mViewCellPvs.Find(vc); 4964 4965 if (vdata && !vdata->Mailed()) 4966 { 4967 vdata->Mail(); 4968 obj->mViewCellPvs.RemoveSample(vc, 1); 4969 } 4970 4971 } 4972 4973 obj = ray->mOriginObject; 4974 if (obj) 4975 { 4976 ViewCellPvsData *vdata = obj->mViewCellPvs.Find(vc); 4977 4978 if (vdata && !vdata->Mailed()) 4979 { 4980 vdata->Mail(); 4981 obj->mViewCellPvs.RemoveSample(vc, 1); 4982 } 4983 } 4984 } 4985 } 4986 } 4987 4988 return 0; 4989 } 4990 4991 4992 float OspTree::EvalRenderCost() 4993 { 4994 float rc = 0; 4995 float prop = mVspTree->GetBoundingBox().GetVolume(); 4996 KdLeafContainer leaves; 4997 CollectLeaves(leaves); 4998 4999 KdLeafContainer::const_iterator kit, kit_end = leaves.end(); 5000 for (kit = leaves.begin(); kit != kit_end; ++ kit) 5001 { 5002 KdLeaf *leaf = *kit; 5003 float newCost = 0; 5004 float vol = 0; 5005 5006 ViewCell::NewMail(); 5007 VssRayContainer::const_iterator rit, rit_end = leaf->mVssRays.end(); 5008 ViewCellContainer touchedViewCells; 5009 5010 for (rit = leaf->mVssRays.begin(); rit != rit_end; ++ rit) 5011 { 5012 VssRay *ray = *rit; 5013 5014 // test if intersection point with one of the objects is inside this node 5015 const bool originInside = EndPointInsideNode(leaf, *ray, false); 5016 const bool terminationInside = EndPointInsideNode(leaf, *ray, true); 5017 5018 if (originInside || terminationInside) 5019 { 5020 ViewCellContainer viewCells; 5021 mVspTree->GetViewCells(*ray, viewCells); 5022 5023 ViewCellContainer::const_iterator vit, vit_end = viewCells.end(); 5024 5025 for (vit = viewCells.begin(); vit != vit_end; ++ vit) 5026 { 5027 ViewCell *vc = *vit; 5028 5029 // if not previously mailed 5030 if (!vc->Mailed()) 5031 { 5032 vc->Mail(); 5033 vc->GetPvs().Clear(); 5034 touchedViewCells.push_back(vc); 5035 } 5036 5037 } 5038 } 5039 } 5040 5041 //ViewCellPvsData::NewMail(); 5042 ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 5043 5044 for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 5045 { 5046 Intersectable *obj = *oit; 5047 ViewCellContainer::const_iterator vit, vit_end = touchedViewCells.end(); 5048 5049 for (vit = touchedViewCells.begin(); vit != vit_end; ++ vit) 5050 { 5051 ViewCell *vc = *vit; 5052 ObjectPvsData *vdata = vc->GetPvs().Find(obj); 5053 5054 if (!vdata) 5055 { 5056 vc->GetPvs().AddSample(obj, 1); 5057 newCost += vc->GetVolume(); 5058 //prop += vc->GetVolume(); 5059 } 5060 } 5061 } 5062 5063 rc += newCost; 5064 } 5065 5066 return rc / prop; 4538 5067 } 4539 5068 … … 4657 5186 mOspTree.mRoot = kdleaf; 4658 5187 5188 // probabilty is voume of all "seen" view cells 5189 #if 1 4659 5190 const float prop = mOspTree.EvalViewCellsVolume(kdleaf, rays); 4660 4661 //-- add first candidate for view space partition 4662 4663 // first osp traversal data 5191 #else 5192 const float prop = mVspTree.GetBoundingBox().GetVolume(); 5193 #endif 5194 5195 //-- add first candidate for object space partition 5196 5197 // create osp traversal data 4664 5198 OspTree::OspTraversalData oData(kdleaf, 4665 5199 0, … … 4670 5204 4671 5205 4672 // computefirst split candidate5206 // first split candidate 4673 5207 OspTree::OspSplitCandidate *oSplitCandidate = 4674 5208 new OspTree::OspSplitCandidate(oData); … … 4676 5210 mOspTree.EvalSplitCandidate(*oSplitCandidate); 4677 5211 4678 mOspTree.mTotalCost = (float)objects.size() * prop / mVspTree.GetBoundingBox().GetVolume(); 5212 mOspTree.mTotalCost = (float)objects.size() * prop / 5213 mVspTree.GetBoundingBox().GetVolume(); 5214 4679 5215 mOspTree.EvalSubdivisionStats(*oSplitCandidate); 4680 5216 … … 4793 5329 ++ mGlobalCostMisses; 4794 5330 4795 Debug << "\n**********" << endl5331 /*Debug << "\n**********" << endl 4796 5332 << "total cost: " << mTotalCost << " render cost decr: " 4797 5333 << splitCandidate->GetRenderCostDecrease() 4798 << " cost ratio: " << costRatio << endl << endl; 5334 << " cost ratio: " << costRatio << endl << endl;*/ 4799 5335 4800 5336 //-- subdivide leaf node … … 4876 5412 cout << "starting osp contruction ... " << endl; 4877 5413 5414 // start with one big kd cell - all objects can be seen from everywhere 5415 // note: only true for view space = object space 5416 4878 5417 // compute first candidate 4879 5418 OspTree::OspSplitCandidate *osc = 4880 5419 PrepareOsp(sampleRays, objects, forcedViewSpace, *objectSpaceRays); 4881 5420 5421 Debug << "reseting cost, new total cost: " << mTotalCost << endl; 5422 mTotalCost = mOspTree.mTotalCost; 5423 4882 5424 mTQueue.Push(osc); 4883 5425 … … 4886 5428 4887 5429 startTime = GetTime(); 4888 4889 // reset cost 4890 // start with one big kd cell - all objects can be seen from everywhere 4891 // note: only true for view space = object space 4892 mTotalCost = (float)osc->mParentData.mNode->mObjects.size();//(float)sc->mParentData.mPvs; 4893 4894 Debug << "reseting cost, new total cost: " << mTotalCost << endl; 4895 5430 4896 5431 // process object space candidates 4897 5432 RunConstruction(repairQueue); … … 4901 5436 mOspTree.mOspStats.Stop(); 4902 5437 5438 float rc = mOspTree.EvalRenderCost(); 5439 5440 Debug << "My render cost evalulation: " << rc << endl; 5441 5442 5443 5444 5445 ViewCellContainer leaves; 5446 5447 mVspTree.CollectViewCells(leaves, false); 5448 float rc2 = 0; 5449 ViewCellContainer::const_iterator vit, vit_end = leaves.end(); 5450 for (vit = leaves.begin(); vit != vit_end; ++ vit) 5451 { 5452 ViewCell *vc = *vit; 5453 5454 int pvs = vc->GetPvs().CountObjectsInPvs(); 5455 float vol = vc->GetVolume(); 5456 rc2 += (float)pvs * vol; 5457 5458 } 5459 5460 Debug << "here225 " << rc2 / mVspTree.GetBoundingBox().GetVolume()<<endl; 4903 5461 #if 0 4904 5462 // reset parameters -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
r1181 r1184 180 180 invalidLeaves = 0; 181 181 accumRays = 0; 182 maxObjectRefs = 0; 182 183 } 183 184 … … 272 273 invalidLeaves = 0; 273 274 objectRefs = 0; 275 276 maxObjectRefs = 0; 274 277 } 275 278 … … 778 781 779 782 780 /// pointer to the hierarchy of view cells781 ViewCellsTree *mViewCellsTree; 782 783 OspTree *mOspTree; 783 ViewCellsTree *GetViewCellsTree() const { return mViewCellsTree; } 784 785 void SetViewCellsTree(ViewCellsTree *vt) { mViewCellsTree = vt; } 786 784 787 785 788 protected: … … 1020 1023 bool AddKdLeafToPvs(KdLeaf *leaf, 1021 1024 ViewCell *vc, 1022 float &pvs,1025 const float pvs, 1023 1026 float &contribution); 1024 1027 … … 1062 1065 1063 1066 1067 1064 1068 protected: 1065 1069 1070 1071 /// pointer to the hierarchy of view cells 1072 ViewCellsTree *mViewCellsTree; 1073 1074 OspTree *mOspTree; 1066 1075 1067 1076 bool mUseKdPvsForHeuristics; … … 1413 1422 void SetViewCellsTree(ViewCellsTree *vt) { mViewCellsTree = vt; } 1414 1423 1424 float EvalRenderCost(); 1415 1425 1416 1426 protected: … … 1571 1581 */ 1572 1582 int SplitRays(const AxisAlignedPlane &plane, 1573 RayInfoContainer &rays, 1574 RayInfoContainer &frontRays, 1575 RayInfoContainer &backRays) const; 1583 RayInfoContainer &rays, 1584 RayInfoContainer &frontRays, 1585 RayInfoContainer &backRays) const; 1586 1587 int SplitViewCells( 1588 const AxisAlignedPlane &candidatePlane, 1589 const RayInfoContainer &rays, 1590 KdLeaf *leaf, 1591 ViewCellContainer &frontViewCells, 1592 ViewCellContainer &backViewCells, 1593 ViewCellContainer &frontAndBackViewCells) const; 1576 1594 1577 1595 /** Adds the object to the pvs of the front and back leaf with a given classification. … … 1625 1643 float &volRight); 1626 1644 1627 /** Evaluates the influence on the pvs of the event.1645 /** Evaluates the influence on the pvs of the event. 1628 1646 @param ve the visibility event 1629 1647 @param pvsLeft updates the left pvs … … 1698 1716 1699 1717 float EvalViewCellsVolume(KdLeaf *leaf, const RayInfoContainer &rays) const; 1700 1718 1719 int RemoveParentViewCellsPvs(KdLeaf *leaf, 1720 const RayInfoContainer &rays 1721 ) const; 1722 1723 int UpdateViewCellsPvs(KdLeaf *leaf, const RayInfoContainer &rays) const; 1724 int OspTree::CheckViewCellsPvs(KdLeaf *leaf, 1725 const RayInfoContainer &rays) const; 1726 bool AddViewCellToObjectPvs( 1727 Intersectable *obj, 1728 ViewCell *vc, 1729 float &contribution, 1730 bool onlyMailed) const; 1701 1731 1702 1732 protected: 1703 1733 1734 1704 1735 /// pointer to the hierarchy of view cells 1705 1736 ViewCellsTree *mViewCellsTree;
Note: See TracChangeset
for help on using the changeset viewer.