Changeset 1614


Ignore:
Timestamp:
10/12/06 01:05:47 (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/BvHierarchy.cpp

    r1610 r1614  
    115115} 
    116116 
     117void BvhLeaf::CollectObjects(ObjectContainer &objects) 
     118{ 
     119        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
     120        for (oit = objects.begin(); oit != oit_end; ++ oit) 
     121        { 
     122                objects.push_back(*oit); 
     123        } 
     124} 
    117125 
    118126/******************************************************************/ 
     
    161169} 
    162170 
     171 
     172void BvhInterior::CollectObjects(ObjectContainer &objects) 
     173{ 
     174        mFront->CollectObjects(objects); 
     175        mBack->CollectObjects(objects); 
     176} 
    163177 
    164178 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r1589 r1614  
    182182        void SetParent(BvhInterior *parent); 
    183183 
     184        // collects all objects under this node 
     185        virtual void CollectObjects(ObjectContainer &objects) = 0; 
    184186        /** The bounding box specifies the node extent. 
    185187        */ 
     
    255257                return s << A.mBoundingBox; 
    256258        } 
    257  
     259virtual void CollectObjects(ObjectContainer &objects); 
    258260protected: 
    259261 
     
    291293                mSubdivisionCandidate = candidate;  
    292294        } 
    293  
     295virtual void CollectObjects(ObjectContainer &objects); 
    294296public: 
    295297 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1610 r1614  
    11031103} 
    11041104 
    1105 } 
     1105 
     1106void HierarchyManager::ExportBoundingBoxes(OUT_STREAM &stream, const ObjectContainer &objects) 
     1107{ 
     1108        stream << "<BoundingBoxes>" << endl; 
     1109             
     1110        if (mObjectSpaceSubdivisionType == KD_BASED_OBJ_SUBDIV) 
     1111        { 
     1112                KdIntersectableMap::const_iterator kit, kit_end = mOspTree->mKdIntersectables.end(); 
     1113 
     1114                int id = 0; 
     1115                for (kit = mOspTree->mKdIntersectables.begin(); kit != kit_end; ++ kit, ++ id) 
     1116                { 
     1117                        Intersectable *obj = (*kit).second; 
     1118                        const AxisAlignedBox3 box = obj->GetBox(); 
     1119                 
     1120                        obj->SetId(id); 
     1121 
     1122                        stream << "<BoundingBox" << " id=\"" << id << "\"" 
     1123                                   << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
     1124                                   << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
     1125                } 
     1126        } 
     1127        else 
     1128        { 
     1129                ObjectContainer::const_iterator oit, oit_end = objects.end(); 
     1130 
     1131                for (oit = objects.begin(); oit != oit_end; ++ oit) 
     1132                { 
     1133                        const AxisAlignedBox3 box = (*oit)->GetBox(); 
     1134                 
     1135                        stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 
     1136                                   << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
     1137                                   << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
     1138                } 
     1139        } 
     1140                 
     1141        stream << "</BoundingBoxes>" << endl; 
     1142} 
     1143 
     1144} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1589 r1614  
    225225        }  
    226226 
     227        void ExportBoundingBoxes(OUT_STREAM &stream, const ObjectContainer &objects); 
     228 
    227229 
    228230protected: 
     
    333335                const VssRayContainer &rays,  
    334336                const ObjectContainer &objects); 
     337 
    335338 
    336339protected: 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h

    r1613 r1614  
    589589  AxisAlignedBox3 mBox; 
    590590  KdTreeStatistics mStat; 
    591  
     591public: 
    592592  /// stores the kd node intersectables used for pvs 
    593593  KdIntersectableMap mKdIntersectables; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1605 r1614  
    1313#include "ViewCellsManager.h" 
    1414#include "Exporter.h" 
     15#include "BvHierarchy.h" 
     16 
    1517 
    1618 
     
    23752377        for (it = viewCell->GetPvs().mEntries.begin(); it != it_end; ++ it) 
    23762378        { 
    2377                 stream << (*it).first->GetId() << " "; 
     2379                Intersectable *obj = (*it).first; 
     2380                // hack: just output full pvs 
     2381                if (obj->Type() == Intersectable::BVH_INTERSECTABLE) 
     2382                { 
     2383                        ObjectContainer objects;  
     2384                        BvhNode *node = dynamic_cast<BvhIntersectable *>(obj)->GetItem(); 
     2385                        node->CollectObjects(objects); 
     2386                 
     2387                        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
     2388                        for (oit = objects.begin(); oit != oit_end; ++ oit) 
     2389                        { 
     2390                                stream << (*oit)->GetId() << " "; 
     2391                        } 
     2392                } 
     2393                else 
     2394                { 
     2395                        stream << (*it).first->GetId() << " "; 
     2396                } 
    23782397        } 
    23792398} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1613 r1614  
    660660                //-- export bounding boxes 
    661661                stream << "<BoundingBoxes>" << endl; 
    662                 ObjectContainer::const_iterator oit, oit_end = objects.end(); 
     662#if USE_KD_PVS  
     663        KdIntersectableMap::const_iterator kit, kit_end = GetPreprocessor()->mKdTree->mKdIntersectables.end(); 
     664 
     665                int id = 0; 
     666                for (kit = GetPreprocessor()->mKdTree->mKdIntersectables.begin(); kit != kit_end; ++ kit, ++ id) 
     667                { 
     668                        Intersectable *obj = (*kit).second; 
     669                        const AxisAlignedBox3 box = obj->GetBox(); 
     670                 
     671                        obj->SetId(id); 
     672 
     673                        stream << "<BoundingBox" << " id=\"" << id << "\"" 
     674                                   << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
     675                                   << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
     676                } 
     677#else 
     678        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
    663679 
    664680                for (oit = objects.begin(); oit != oit_end; ++ oit) 
     
    672688                                   << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
    673689                } 
    674  
     690#endif 
    675691                stream << "</BoundingBoxes>" << endl; 
    676692        } 
     
    53395355                //-- The bounding boxes are used to identify  
    53405356                //-- the objects in the rendering engine 
    5341  
    5342                 stream << "<BoundingBoxes>" << endl; 
    5343                 ObjectContainer::const_iterator oit, oit_end = objects.end(); 
    5344          
    5345                 for (oit = objects.begin(); oit != oit_end; ++ oit) 
    5346                 { 
    5347                         const AxisAlignedBox3 box = (*oit)->GetBox(); 
    5348                         stream << "<BoundingBox" << " id=\"" << (*oit)->GetId() << "\"" 
    5349                                 << " min=\"" << box.Min().x << " " << box.Min().y << " " << box.Min().z << "\"" 
    5350                                  
    5351                                 << " max=\"" << box.Max().x << " " << box.Max().y << " " << box.Max().z << "\" />" << endl; 
    5352                 } 
    5353                  
    5354                 stream << "</BoundingBoxes>" << endl; 
     5357                mHierarchyManager->ExportBoundingBoxes(stream, objects); 
    53555358        } 
    53565359 
Note: See TracChangeset for help on using the changeset viewer.