Changeset 1144


Ignore:
Timestamp:
07/20/06 09:51:26 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp

    r1139 r1144  
    5050                SetWireframe(); 
    5151                SetForcedMaterial(white); 
    52                 ExportBox(ospTree.GetBBox(leaf)); 
     52                ExportBox(ospTree.GetBoundingBox(leaf)); 
    5353 
    5454                SetFilled(); 
     
    7979        Intersectable::NewMail(); 
    8080 
     81        // todo: traverse to leaves 
    8182        if (node->IsLeaf()) 
    8283        { 
     84                // eyport leaf pvs 
    8385                KdLeaf *leaf = dynamic_cast<KdLeaf *>(node); 
    84                  
     86 
    8587                ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 
    8688 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp

    r1143 r1144  
    315315        } 
    316316 
     317    mStat.objectRefs -= (int)leaf->mObjects.size(); 
     318    mStat.objectRefs += objectsBack + objectsFront; 
     319  } 
     320 
    317321        // store objects referenced in more than one leaf 
    318322        // for easy access 
    319323        ProcessMultipleRefs(back); 
    320324        ProcessMultipleRefs(front); 
    321  
    322     mStat.objectRefs -= (int)leaf->mObjects.size(); 
    323     mStat.objectRefs += objectsBack + objectsFront; 
    324   } 
    325325 
    326326  delete leaf; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h

    r1143 r1144  
    195195  ObjectContainer mObjects; 
    196196 
    197   /** Objects that are part of several leaves. 
    198   */ 
    199   ObjectContainer mMultipleObjects; 
    200  
    201   /// universal counter 
    202   int mCounter; 
    203          
    204197  /** Ray set description of the rays passing through this node */ 
    205198  PassingRaySet mPassingRays; 
     
    209202 
    210203  /// pvs of view cells seeing this node. 
    211   // ViewCellPvs mViewCellPvs; 
    212204  SplitCandidate *mSplitCandidate; 
    213205 
    214   /** pointer to view cell. 
    215   */ 
     206  /// pointer to view cell. 
    216207  KdViewCell *mViewCell; 
     208 
     209   /// Objects that are referenced in more than one leaf. 
     210  ObjectContainer mMultipleObjects; 
     211 
     212  /// universal counter 
     213  int mCounter; 
    217214}; 
    218215 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1143 r1144  
    440440        { 
    441441                mVspTree = new VspTree(); 
    442                 //mOspTree = new OspTree(); 
     442                mOspTree = new OspTree(); 
    443443                // HACK 
    444                 mOspTree = new OspTree(*mKdTree); 
     444                //mOspTree = new OspTree(*mKdTree); 
    445445 
    446446                mViewCellsManager = new VspOspViewCellsManager(mVspTree, mOspTree); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1143 r1144  
    52165216                VspLeaf *l = vspVc->mLeaf; 
    52175217 
    5218                 const AxisAlignedBox3 box = mVspTree->GetBBox(vspVc->mLeaf); 
     5218                const AxisAlignedBox3 box = mVspTree->GetBoundingBox(vspVc->mLeaf); 
    52195219                 
    52205220                if (clipPlane) 
    52215221                { 
    52225222                        if (box.Side(plane) == -1) 
     5223                        { 
    52235224                                exporter->ExportBox(box); 
     5225                        } 
    52245226                        else if (box.Side(plane) == 0) 
    52255227                        { 
    52265228                                AxisAlignedBox3 fbox, bbox; 
    5227  
    52285229                                box.Split(clipPlane->mAxis, clipPlane->mPosition, fbox, bbox); 
    52295230 
     
    54855486                        KdLeaf::NewMail(); 
    54865487 
    5487                         m.mDiffuseColor = RgbColor(1, 0, 0); 
    5488                         exporter->SetForcedMaterial(m); 
    5489  
    54905488                        // export pvs entries 
    54915489                        for (oit = pvs.mEntries.begin(); oit != oit_end; ++ oit) 
     
    54935491                                Intersectable *obj = (*oit).first; 
    54945492 
     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 
    54955511                                if (!obj->Mailed()) 
    54965512                                { 
     
    56265642        { 
    56275643                VspLeaf *leaf = dynamic_cast<VspViewCell *>(*it)->mLeaf; 
    5628                 const AxisAlignedBox3 box = mVspTree->GetBBox(leaf); 
     5644                const AxisAlignedBox3 box = mVspTree->GetBoundingBox(leaf); 
    56295645 
    56305646        IncludeBoxInMesh(box, *mesh); 
     
    56575673                VspLeaf *leaf = dynamic_cast<VspViewCell *>(*it)->mLeaf; 
    56585674                 
    5659                 const AxisAlignedBox3 box = mVspTree->GetBBox(leaf); 
     5675                const AxisAlignedBox3 box = mVspTree->GetBoundingBox(leaf); 
    56605676 
    56615677                const float lVol = box.GetVolume(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1143 r1144  
    947947                if (obj)  
    948948                { 
    949                         // potentially visible kd cells 
    950949                        if (mStoreKdPvs) 
    951950                        { 
     951                                // potentially visible kd cells 
    952952                                KdLeaf *leaf = mOspTree->GetLeaf(ray->mTermination, ray->mTerminationNode); 
    953953                                AddKdLeafToPvs(leaf, vc, ray->mPdf, contribution); 
     
    10761076                // add objects without the objects which are in several kd leaves 
    10771077                pvsSize += (int)(leaf->mObjects.size() - leaf->mMultipleObjects.size()); 
     1078                //Debug << "here11 " << (int)leaf->mObjects.size() << " " << leaf->mMultipleObjects.size() << endl; 
    10781079        } 
    10791080        else 
     
    11161117        RayInfoContainer::const_iterator ri, ri_end = rays.end(); 
    11171118 
    1118         //-- set all kd nodes as belonging to the front pvs 
     1119        //-- set all kd nodes / objects as belonging to the front pvs 
    11191120 
    11201121        for (ri = rays.begin(); ri != ri_end; ++ ri) 
     
    12141215                Intersectable *object = *oit; 
    12151216 
    1216                 // object not previously in left pvs 
     1217                // object not previously in pvs 
    12171218                if (!object->Mailed()) 
    12181219                { 
     
    19461947        nodeStack.push(mRoot); 
    19471948 
    1948         const AxisAlignedBox3 box = GetBBox(n); 
     1949        const AxisAlignedBox3 box = GetBoundingBox(n); 
    19491950 
    19501951        while (!nodeStack.empty()) 
     
    20072008                        VspNode *next; 
    20082009                         
    2009                         if (GetBBox(interior->GetBack()).Side(plane) < 0) 
     2010                        if (GetBoundingBox(interior->GetBack()).Side(plane) < 0) 
    20102011                        { 
    20112012                                next = interior->GetFront(); 
     
    20132014            else 
    20142015                        { 
    2015                                 if (GetBBox(interior->GetFront()).Side(plane) < 0) 
     2016                                if (GetBoundingBox(interior->GetFront()).Side(plane) < 0) 
    20162017                                { 
    20172018                                        next = interior->GetBack(); 
     
    25492550 
    25502551 
    2551 AxisAlignedBox3 VspTree::GetBBox(VspNode *node) const 
     2552AxisAlignedBox3 VspTree::GetBoundingBox(VspNode *node) const 
    25522553{ 
    25532554        if (!node->GetParent()) 
     
    25842585                nodeStack.pop(); 
    25852586 
    2586                 const AxisAlignedBox3 bbox = GetBBox(node); 
     2587                const AxisAlignedBox3 bbox = GetBoundingBox(node); 
    25872588 
    25882589                if (bbox.Includes(box)) 
     
    36933694 
    36943695 
    3695 AxisAlignedBox3 OspTree::GetBBox(KdNode *node) const 
     3696AxisAlignedBox3 OspTree::GetBoundingBox(KdNode *node) const 
    36963697{ 
    36973698        if (!node->mParent) 
     
    38143815KdLeaf *OspTree::GetLeaf(const Vector3 &pt, KdNode *node) const 
    38153816{ 
     3817        // start from root of tree 
    38163818        if (node == NULL) 
    38173819        { 
     
    38353837                else     
    38363838                {        
     3839                        // find point 
    38373840                        KdInterior *interior = dynamic_cast<KdInterior *>(node); 
    38383841         
    3839                         // random decision 
    3840                         if (interior->mPosition < pt[interior->mAxis]) 
     3842                        if (interior->mPosition > pt[interior->mAxis]) 
    38413843                        { 
    38423844                                nodeStack.push(interior->mBack); 
     
    39423944{ 
    39433945        // 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); 
    39453948 
    39463949        if (it != mKdIntersectables.end())  
     
    40544057                                                                                          RayInfoContainer &rays) 
    40554058{ 
    4056         // get clipped rays 
    4057         mOspTree.ProcessRays(sampleRays, rays); 
    4058  
    40594059        // store pointer to this tree 
    40604060        OspTree::OspSplitCandidate::sOspTree = &mOspTree; 
    40614061        mOspTree.mOspStats.nodes = 1; 
    40624062         
     4063        // compute bounding box from objects 
    40634064        mOspTree.ComputeBoundingBox(objects, forcedObjectSpace); 
    40644065 
     
    40664067        mGlobalCostMisses = 0; 
    40674068 
     4069        // get clipped rays 
     4070        mOspTree.ProcessRays(sampleRays, rays); 
    40684071 
    40694072        // add first candidate for view space partition 
     
    40864089 
    40874090                 
    4088         //mOspTree.ProcessMultipleRefs(NULL, kdleaf, NULL); 
    4089  
    40904091        // compute first split candidate 
    40914092        OspTree::OspSplitCandidate *oSplitCandidate =  
    40924093                new OspTree::OspSplitCandidate(oData); 
     4094 
    40934095    mOspTree.EvalSplitCandidate(*oSplitCandidate); 
    40944096 
     
    42524254        ///////////////////////////////////////////////////////////// 
    42534255 
    4254  
     4256        Debug << "**************** osp construction **************" << endl; 
    42554257        cout << "starting osp contruction ... " << endl; 
     4258 
    42564259        startTime = GetTime(); 
    42574260 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h

    r1143 r1144  
    628628        /** Returns bounding box of the specified node. 
    629629        */ 
    630         AxisAlignedBox3 GetBBox(VspNode *node) const; 
     630        AxisAlignedBox3 GetBoundingBox(VspNode *node) const; 
    631631 
    632632        /** Returns list of BSP leaves with pvs smaller than 
     
    12761276        /** Returns bounding box of the specified node. 
    12771277        */ 
    1278         AxisAlignedBox3 GetBBox(KdNode *node) const; 
     1278        AxisAlignedBox3 GetBoundingBox(KdNode *node) const; 
    12791279 
    12801280        /** Returns list of leaves with pvs smaller than 
Note: See TracChangeset for help on using the changeset viewer.