Ignore:
Timestamp:
06/19/06 16:14:40 (18 years ago)
Author:
mattausch
Message:

added view cells manager for vsposptree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1006 r1021  
    3232class MergeCandidate; 
    3333class BoundingBoxConverter; 
     34class VspTree; 
     35class OspTree; 
     36class VspNode; 
    3437 
    3538 
     
    6669 
    6770        /// view cell container types 
    68         enum {BSP, KD, VSP_KD, VSP_BSP}; 
     71        enum {BSP, KD, VSP_KD, VSP_BSP, VSP_OSP}; 
    6972   
    7073        /// render cost evaluation type 
     
    369372        void CollectViewCells(const int n); 
    370373 
    371         /** Returns true if this (logical) view cell is equal to a spatial node. 
    372         */ 
    373         virtual bool EqualToSpatialNode(ViewCell *viewCell) const; 
    374  
    375374        /** Sets current view cells set to active, i.e., the sampling is done in this view cell set. 
    376375        */ 
     
    472471 
    473472 
     473        /** Returns true if this view cell is equivalent to a node of the spatial hierarchy. 
     474        */ 
     475        virtual bool EqualToSpatialNode(ViewCell *viewCell) const; 
     476 
    474477protected: 
    475478        /** Exports bounding boxes as xml stream 
     
    528531        /** Sets exporter color. 
    529532        */ 
    530         virtual void ExportColor(Exporter *exporter, ViewCell *vc) const = 0; 
     533        virtual void ExportColor(Exporter *exporter, ViewCell *vc) const; 
    531534 
    532535        /** Returns volume of the view space. 
     
    619622        /// if rays should be used to collect merge candidates 
    620623        bool mUseRaysForMerge; 
     624 
    621625        /// if there should be an additional merge step after the subdivision 
    622626        bool mMergeViewCells; 
     
    718722protected: 
    719723 
    720  
    721724        void CollectViewCells(); 
    722725 
    723         void ExportColor(Exporter *exporter, ViewCell *vc) const; 
    724726         
    725727        /// the BSP tree. 
     
    799801        KdNode *GetNodeForPvs(KdLeaf *leaf); 
    800802 
    801         void ExportColor(Exporter *exporter, ViewCell *vc) const; 
    802  
    803803 
    804804        /// the BSP tree. 
     
    880880        BspNode *GetSpatialNode(ViewCell *viewCell) const; 
    881881 
    882         /** Merges the view cells. 
     882        /** Merges view cells according to some criteria 
    883883        */ 
    884884        void MergeViewCells(const VssRayContainer &rays,  
     
    895895         
    896896 
    897         void ExportColor(Exporter *exporter, ViewCell *vc) const; 
    898  
    899897        /** Prepare view cells for use after loading them from disc. 
    900898        */ 
     
    921919        void EvalFromPointQueries(); 
    922920 
     921        /** Exports visualization of the BSP splits. 
     922        */ 
     923        void ExportSplits(const ObjectContainer &objects,  
     924                                          const VssRayContainer &rays); 
     925 
     926        /** Exports visualization of the BSP PVS. 
     927        */ 
     928        void ExportBspPvs(const ObjectContainer &objects, 
     929                                          const VssRayContainer &rays); 
     930 
    923931 
    924932        /// the view space partition BSP tree. 
     
    928936private: 
    929937 
    930         /** Exports visualization of the BSP splits. 
    931         */ 
    932         void ExportSplits(const ObjectContainer &objects,  
    933                                           const VssRayContainer &rays); 
     938        /** test if subdivision is valid in terms of volume / area. 
     939        */ 
     940        void TestSubdivision(); 
     941}; 
     942 
     943 
     944/** 
     945        Manages different higher order operations on the view cells. 
     946*/ 
     947class VspOspViewCellsManager: public ViewCellsManager 
     948{ 
     949 
     950public: 
     951 
     952        VspOspViewCellsManager(VspTree *tree, OspTree *ospTree); 
     953        ~VspOspViewCellsManager(); 
     954 
     955        int ConstructSubdivision(const ObjectContainer &objects, 
     956                                                         const VssRayContainer &rays); 
     957 
     958        int PostProcess(const ObjectContainer &objects,  
     959                                        const VssRayContainer &rays); 
     960 
     961        void Visualize(const ObjectContainer &objects, 
     962                                   const VssRayContainer &sampleRays); 
     963 
     964        int GetType() const; 
     965         
     966        ViewCell *GenerateViewCell(Mesh *mesh = NULL) const; 
     967 
     968        bool ViewCellsConstructed() const; 
     969 
     970         
     971        int CastLineSegment(const Vector3 &origin, 
     972                                                const Vector3 &termination, 
     973                                                ViewCellContainer &viewcells); 
     974 
     975        float GetProbability(ViewCell *viewCell); 
     976         
     977        ViewCell *GetViewCell(const Vector3 &point, const bool active = false) const; 
     978 
     979        bool GetViewPoint(Vector3 &viewPoint) const; 
     980 
     981        bool ViewPointValid(const Vector3 &viewPoint) const; 
     982 
     983        void CreateMesh(ViewCell *vc); 
     984 
     985        bool ExportViewCells(const string filename, const bool exportPvs, const ObjectContainer &objects); 
     986 
     987        int CastBeam(Beam &beam); 
     988 
     989        void ExportViewCellGeometry(Exporter *exporter,  
     990                                                                ViewCell *vc, 
     991                                                                const Plane3 *clipPlane = NULL) const; 
     992 
     993        void Finalize(ViewCell *viewCell, const bool createMesh); 
     994 
     995 
     996protected: 
     997 
     998        int ComputeBoxIntersections(const AxisAlignedBox3 &box, ViewCellContainer &viewCells) const; 
     999         
     1000        void CollectViewCells(); 
     1001 
     1002 
     1003        /** Prepare view cells for use after loading them from disc. 
     1004        */ 
     1005        void PrepareLoadedViewCells(); 
     1006 
     1007        /** Constructs merge hierarchy which corresponds to the spatial hierarchy. 
     1008        */ 
     1009        ViewCell *ConstructSpatialMergeTree(VspNode *root); 
     1010 
     1011        void UpdatePvsForEvaluation(ViewCell *root, ObjectPvs &pvs); 
    9341012 
    9351013        /** Exports visualization of the BSP PVS. 
     
    9381016                                          const VssRayContainer &rays); 
    9391017 
    940         /** test if subdivision is valid in terms of volume / area. 
    941         */ 
    942         void TestSubdivision(); 
     1018 
     1019        /// the view space partition tree. 
     1020        VspTree *mVspTree; 
     1021        OspTree *mOspTree; 
    9431022}; 
    9441023 
Note: See TracChangeset for help on using the changeset viewer.