Changeset 1144 for GTP/trunk/Lib/Vis
- Timestamp:
- 07/20/06 09:51:26 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r1139 r1144 50 50 SetWireframe(); 51 51 SetForcedMaterial(white); 52 ExportBox(ospTree.GetB Box(leaf));52 ExportBox(ospTree.GetBoundingBox(leaf)); 53 53 54 54 SetFilled(); … … 79 79 Intersectable::NewMail(); 80 80 81 // todo: traverse to leaves 81 82 if (node->IsLeaf()) 82 83 { 84 // eyport leaf pvs 83 85 KdLeaf *leaf = dynamic_cast<KdLeaf *>(node); 84 86 85 87 ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 86 88 -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp
r1143 r1144 315 315 } 316 316 317 mStat.objectRefs -= (int)leaf->mObjects.size(); 318 mStat.objectRefs += objectsBack + objectsFront; 319 } 320 317 321 // store objects referenced in more than one leaf 318 322 // for easy access 319 323 ProcessMultipleRefs(back); 320 324 ProcessMultipleRefs(front); 321 322 mStat.objectRefs -= (int)leaf->mObjects.size();323 mStat.objectRefs += objectsBack + objectsFront;324 }325 325 326 326 delete leaf; -
GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h
r1143 r1144 195 195 ObjectContainer mObjects; 196 196 197 /** Objects that are part of several leaves.198 */199 ObjectContainer mMultipleObjects;200 201 /// universal counter202 int mCounter;203 204 197 /** Ray set description of the rays passing through this node */ 205 198 PassingRaySet mPassingRays; … … 209 202 210 203 /// pvs of view cells seeing this node. 211 // ViewCellPvs mViewCellPvs;212 204 SplitCandidate *mSplitCandidate; 213 205 214 /** pointer to view cell. 215 */ 206 /// pointer to view cell. 216 207 KdViewCell *mViewCell; 208 209 /// Objects that are referenced in more than one leaf. 210 ObjectContainer mMultipleObjects; 211 212 /// universal counter 213 int mCounter; 217 214 }; 218 215 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1143 r1144 440 440 { 441 441 mVspTree = new VspTree(); 442 //mOspTree = new OspTree();442 mOspTree = new OspTree(); 443 443 // HACK 444 mOspTree = new OspTree(*mKdTree);444 //mOspTree = new OspTree(*mKdTree); 445 445 446 446 mViewCellsManager = new VspOspViewCellsManager(mVspTree, mOspTree); -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1143 r1144 5216 5216 VspLeaf *l = vspVc->mLeaf; 5217 5217 5218 const AxisAlignedBox3 box = mVspTree->GetB Box(vspVc->mLeaf);5218 const AxisAlignedBox3 box = mVspTree->GetBoundingBox(vspVc->mLeaf); 5219 5219 5220 5220 if (clipPlane) 5221 5221 { 5222 5222 if (box.Side(plane) == -1) 5223 { 5223 5224 exporter->ExportBox(box); 5225 } 5224 5226 else if (box.Side(plane) == 0) 5225 5227 { 5226 5228 AxisAlignedBox3 fbox, bbox; 5227 5228 5229 box.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox); 5229 5230 … … 5485 5486 KdLeaf::NewMail(); 5486 5487 5487 m.mDiffuseColor = RgbColor(1, 0, 0);5488 exporter->SetForcedMaterial(m);5489 5490 5488 // export pvs entries 5491 5489 for (oit = pvs.mEntries.begin(); oit != oit_end; ++ oit) … … 5493 5491 Intersectable *obj = (*oit).first; 5494 5492 5493 if (obj->Type() == Intersectable::KD_INTERSECTABLE) 5494 { 5495 m.mDiffuseColor = RgbColor(1, 1, 1); 5496 exporter->SetForcedMaterial(m); 5497 5498 // export bounding box of node 5499 KdIntersectable *kdObj = dynamic_cast<KdIntersectable *>(obj); 5500 AxisAlignedBox3 box = mOspTree->GetBoundingBox(kdObj->GetNode()); 5501 5502 exporter->SetWireframe(); 5503 exporter->ExportBox(box); 5504 exporter->SetFilled(); 5505 } 5506 5507 m.mDiffuseColor = RgbColor(1, 0, 0); 5508 exporter->SetForcedMaterial(m); 5509 5510 // export pvs entry 5495 5511 if (!obj->Mailed()) 5496 5512 { … … 5626 5642 { 5627 5643 VspLeaf *leaf = dynamic_cast<VspViewCell *>(*it)->mLeaf; 5628 const AxisAlignedBox3 box = mVspTree->GetB Box(leaf);5644 const AxisAlignedBox3 box = mVspTree->GetBoundingBox(leaf); 5629 5645 5630 5646 IncludeBoxInMesh(box, *mesh); … … 5657 5673 VspLeaf *leaf = dynamic_cast<VspViewCell *>(*it)->mLeaf; 5658 5674 5659 const AxisAlignedBox3 box = mVspTree->GetB Box(leaf);5675 const AxisAlignedBox3 box = mVspTree->GetBoundingBox(leaf); 5660 5676 5661 5677 const float lVol = box.GetVolume(); -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp
r1143 r1144 947 947 if (obj) 948 948 { 949 // potentially visible kd cells950 949 if (mStoreKdPvs) 951 950 { 951 // potentially visible kd cells 952 952 KdLeaf *leaf = mOspTree->GetLeaf(ray->mTermination, ray->mTerminationNode); 953 953 AddKdLeafToPvs(leaf, vc, ray->mPdf, contribution); … … 1076 1076 // add objects without the objects which are in several kd leaves 1077 1077 pvsSize += (int)(leaf->mObjects.size() - leaf->mMultipleObjects.size()); 1078 //Debug << "here11 " << (int)leaf->mObjects.size() << " " << leaf->mMultipleObjects.size() << endl; 1078 1079 } 1079 1080 else … … 1116 1117 RayInfoContainer::const_iterator ri, ri_end = rays.end(); 1117 1118 1118 //-- set all kd nodes as belonging to the front pvs1119 //-- set all kd nodes / objects as belonging to the front pvs 1119 1120 1120 1121 for (ri = rays.begin(); ri != ri_end; ++ ri) … … 1214 1215 Intersectable *object = *oit; 1215 1216 1216 // object not previously in leftpvs1217 // object not previously in pvs 1217 1218 if (!object->Mailed()) 1218 1219 { … … 1946 1947 nodeStack.push(mRoot); 1947 1948 1948 const AxisAlignedBox3 box = GetB Box(n);1949 const AxisAlignedBox3 box = GetBoundingBox(n); 1949 1950 1950 1951 while (!nodeStack.empty()) … … 2007 2008 VspNode *next; 2008 2009 2009 if (GetB Box(interior->GetBack()).Side(plane) < 0)2010 if (GetBoundingBox(interior->GetBack()).Side(plane) < 0) 2010 2011 { 2011 2012 next = interior->GetFront(); … … 2013 2014 else 2014 2015 { 2015 if (GetB Box(interior->GetFront()).Side(plane) < 0)2016 if (GetBoundingBox(interior->GetFront()).Side(plane) < 0) 2016 2017 { 2017 2018 next = interior->GetBack(); … … 2549 2550 2550 2551 2551 AxisAlignedBox3 VspTree::GetB Box(VspNode *node) const2552 AxisAlignedBox3 VspTree::GetBoundingBox(VspNode *node) const 2552 2553 { 2553 2554 if (!node->GetParent()) … … 2584 2585 nodeStack.pop(); 2585 2586 2586 const AxisAlignedBox3 bbox = GetB Box(node);2587 const AxisAlignedBox3 bbox = GetBoundingBox(node); 2587 2588 2588 2589 if (bbox.Includes(box)) … … 3693 3694 3694 3695 3695 AxisAlignedBox3 OspTree::GetB Box(KdNode *node) const3696 AxisAlignedBox3 OspTree::GetBoundingBox(KdNode *node) const 3696 3697 { 3697 3698 if (!node->mParent) … … 3814 3815 KdLeaf *OspTree::GetLeaf(const Vector3 &pt, KdNode *node) const 3815 3816 { 3817 // start from root of tree 3816 3818 if (node == NULL) 3817 3819 { … … 3835 3837 else 3836 3838 { 3839 // find point 3837 3840 KdInterior *interior = dynamic_cast<KdInterior *>(node); 3838 3841 3839 // random decision 3840 if (interior->mPosition < pt[interior->mAxis]) 3842 if (interior->mPosition > pt[interior->mAxis]) 3841 3843 { 3842 3844 nodeStack.push(interior->mBack); … … 3942 3944 { 3943 3945 // search nodes 3944 std::map<KdNode *, KdIntersectable *>::const_iterator it = mKdIntersectables.find(node); 3946 std::map<KdNode *, KdIntersectable *>:: 3947 const_iterator it = mKdIntersectables.find(node); 3945 3948 3946 3949 if (it != mKdIntersectables.end()) … … 4054 4057 RayInfoContainer &rays) 4055 4058 { 4056 // get clipped rays4057 mOspTree.ProcessRays(sampleRays, rays);4058 4059 4059 // store pointer to this tree 4060 4060 OspTree::OspSplitCandidate::sOspTree = &mOspTree; 4061 4061 mOspTree.mOspStats.nodes = 1; 4062 4062 4063 // compute bounding box from objects 4063 4064 mOspTree.ComputeBoundingBox(objects, forcedObjectSpace); 4064 4065 … … 4066 4067 mGlobalCostMisses = 0; 4067 4068 4069 // get clipped rays 4070 mOspTree.ProcessRays(sampleRays, rays); 4068 4071 4069 4072 // add first candidate for view space partition … … 4086 4089 4087 4090 4088 //mOspTree.ProcessMultipleRefs(NULL, kdleaf, NULL);4089 4090 4091 // compute first split candidate 4091 4092 OspTree::OspSplitCandidate *oSplitCandidate = 4092 4093 new OspTree::OspSplitCandidate(oData); 4094 4093 4095 mOspTree.EvalSplitCandidate(*oSplitCandidate); 4094 4096 … … 4252 4254 ///////////////////////////////////////////////////////////// 4253 4255 4254 4256 Debug << "**************** osp construction **************" << endl; 4255 4257 cout << "starting osp contruction ... " << endl; 4258 4256 4259 startTime = GetTime(); 4257 4260 -
GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h
r1143 r1144 628 628 /** Returns bounding box of the specified node. 629 629 */ 630 AxisAlignedBox3 GetB Box(VspNode *node) const;630 AxisAlignedBox3 GetBoundingBox(VspNode *node) const; 631 631 632 632 /** Returns list of BSP leaves with pvs smaller than … … 1276 1276 /** Returns bounding box of the specified node. 1277 1277 */ 1278 AxisAlignedBox3 GetB Box(KdNode *node) const;1278 AxisAlignedBox3 GetBoundingBox(KdNode *node) const; 1279 1279 1280 1280 /** Returns list of leaves with pvs smaller than
Note: See TracChangeset
for help on using the changeset viewer.