Changeset 1564


Ignore:
Timestamp:
10/03/06 22:34:29 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
5 edited

Legend:

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

    r1563 r1564  
    107107 
    108108        Environment::GetSingleton()->GetBoolValue( 
    109                 "Hierarchy.Construction.useMultiLevelConstruction", mUseMultiLevelConstruction); 
     109                "Hierarchy.Construction.useMultiLevel", mUseMultiLevelConstruction); 
    110110 
    111111         mUseMultiLevelConstruction; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1563 r1564  
    489489        mViewCellsManager->SetRenderer(mRenderSimulator); 
    490490 
    491  
    492491        if (mUseGlRenderer || mUseGlDebugger) 
    493492        { 
     
    922921        rayBundle.push_back(mainRay); 
    923922 
    924         const float pertubOrigin = 10.0f; 
    925         const float pertubDir = 0.0f; 
     923        const float pertubOrigin = 0.0f; 
     924        const float pertubDir = 0.2f; 
    926925 
    927926        for (int i = 0; i < number - 1; ++ i) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r1563 r1564  
    4747        friend class IntelRayCaster; 
    4848        friend class InternalRayCaster; 
    49          
     49 
    5050public: 
    5151        /** Default constructor initialising e.g., KD tree and BSP tree. 
     
    5555        virtual ~Preprocessor(); 
    5656 
    57   /** Load the input scene.  
    58       @param filename file to load 
    59           @return true on success 
    60   */ 
    61   virtual bool LoadScene(const string filename); 
    62    
    63   /** Export all preprocessed data in a XML format understandable by the 
    64       PreprocessingInterface of the GtpVisibilityPreprocessor Module.  
    65           The file can be compressed depending on the environement settings. 
    66       @return true on successful export 
    67   */ 
    68   virtual bool ExportPreprocessedData(const string filename); 
    69    
    70   /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction 
    71       is driven by the environment settings, which also sais which of the three types of 
    72       entities should be used to drive the heuristical construction (only occluders by default) 
    73   */ 
    74   virtual bool BuildKdTree(); 
    75  
    76   /** Compute visibility method. This method has to be reimplemented by the actual 
    77       Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, 
    78       GlobalSamplingpreprocessor) 
    79     */ 
    80   virtual bool ComputeVisibility() = 0; 
    81  
    82   /** Post Process the computed visibility. By default applys the visibility filter 
    83           (if specified in the environment and export the preprocessed data */ 
    84   virtual bool PostProcessVisibility(); 
    85  
    86   /** View cells are either loaded or prepared for generation, according to the chosen environment 
    87       object. Important evironment options are, e.g, the view cell type. 
    88       Should be done after scene loading (i.e., some options are based on scene type). 
    89   */ 
    90   bool PrepareViewCells(); 
    91  
    92   /** Construct viewcells from the scratch  
    93   */ 
    94   bool ConstructViewCells(); 
    95  
    96   /** Returns the specified sample strategy, NULL if no valid strategy. 
    97   */ 
    98   SamplingStrategy *GenerateSamplingStrategy(const int strategyId) const; 
    99  
    100   /** Export preprocessor data. 
    101   */ 
    102   bool Export( 
     57        /** Load the input scene.  
     58        @param filename file to load 
     59        @return true on success 
     60        */ 
     61        virtual bool LoadScene(const string filename); 
     62 
     63        /** Export all preprocessed data in a XML format understandable by the 
     64        PreprocessingInterface of the GtpVisibilityPreprocessor Module.  
     65        The file can be compressed depending on the environement settings. 
     66        @return true on successful export 
     67        */ 
     68        virtual bool ExportPreprocessedData(const string filename); 
     69 
     70        /** Build the KdTree of currently loaded occluders/occludees/viewcells. The construction 
     71        is driven by the environment settings, which also sais which of the three types of 
     72        entities should be used to drive the heuristical construction (only occluders by default) 
     73        */ 
     74        virtual bool BuildKdTree(); 
     75 
     76        /** Compute visibility method. This method has to be reimplemented by the actual 
     77        Preprocessor implementation (e.g. SamplingPreprocessor, ExactPreprocessor, 
     78        GlobalSamplingpreprocessor) 
     79        */ 
     80        virtual bool ComputeVisibility() = 0; 
     81 
     82        /** Post Process the computed visibility. By default applys the visibility filter 
     83        (if specified in the environment and export the preprocessed data */ 
     84        virtual bool PostProcessVisibility(); 
     85 
     86        /** View cells are either loaded or prepared for generation, according to the chosen environment 
     87        object. Important evironment options are, e.g, the view cell type. 
     88        Should be done after scene loading (i.e., some options are based on scene type). 
     89        */ 
     90        bool PrepareViewCells(); 
     91 
     92        /** Construct viewcells from the scratch  
     93        */ 
     94        bool ConstructViewCells(); 
     95 
     96        /** Returns the specified sample strategy, NULL if no valid strategy. 
     97        */ 
     98        SamplingStrategy *GenerateSamplingStrategy(const int strategyId) const; 
     99 
     100        /** Export preprocessor data. 
     101        */ 
     102        bool Export( 
    103103                const string filename,  
    104104                const bool scene,  
    105105                const bool kdtree);   
    106    
    107   virtual void KdTreeStatistics(ostream &s); 
    108   virtual void BspTreeStatistics(ostream &s); 
    109  
    110   /** Loads samples from file. 
    111           @param samples returns the stored sample rays 
    112           @param objects needed to associate the objects ids 
    113           @returns true if samples were loaded successfully 
    114   */ 
    115   bool LoadSamples(VssRayContainer &samples, 
    116                                    ObjectContainer &objects) const; 
    117  
    118   /** Exports samples to file. 
    119           @returns true if samples were written successfully 
    120   */ 
    121   bool ExportSamples(const VssRayContainer &samples) const; 
    122  
    123   bool LoadKdTree(const string filename); 
    124   bool ExportKdTree(const string filename); 
    125  
    126   virtual bool 
    127   GenerateRays( 
    128                            const int number, 
    129                            const int raysType, 
    130                            SimpleRayContainer &rays 
    131                            ); 
    132    
    133   bool GenerateRayBundle( 
    134           SimpleRayContainer &rayBundle, 
    135           const SimpleRay &mainRay, 
    136           const int number, 
    137           const int shuffleType) const; 
    138  
    139   virtual void CastRays(SimpleRayContainer &rays, 
    140                                                 VssRayContainer &vssRays, 
    141                                                 const bool castDoubleRays, 
    142                                                 const bool pruneInvalidRays = true); 
    143  
    144   /** Returns a view cells manager of the given name. 
    145   */ 
    146   ViewCellsManager *CreateViewCellsManager(const char *name); 
    147   /** Returns a hierarchy manager of the given name. 
    148   */ 
    149   HierarchyManager *CreateHierarchyManager(const char *name); 
    150     
    151   GlRendererBuffer *GetRenderer(); 
    152  
    153   bool InitRayCast(const string externKdTree, const string internKdTree); 
    154  
    155     
    156   //////////////////////////////////////////////// 
    157  
    158   /// scene graph loaded from file 
    159   SceneGraph *mSceneGraph; 
    160  
    161   /// raw array of objects 
    162   ObjectContainer mObjects; 
    163    
    164   /// kD-tree organizing the scene graph (occluders + occludees) + viewcells 
    165   KdTree *mKdTree; 
    166   /// View space partition bsp tree 
    167   VspBspTree *mVspBspTree; 
    168   /// Hierarchy manager handling view space and object space partition 
    169   HierarchyManager *mHierarchyManager; 
    170   /// BSP tree representing the viewcells 
    171   BspTree *mBspTree; 
    172    
    173   /// list of all loaded occluders 
    174   ObjectContainer mOccluders; 
    175   /// list of all loaded occludees 
    176   ObjectContainer mOccludees; 
    177     
    178    
    179   ViewCellsManager *mViewCellsManager; 
    180  
    181   /// greedy optimized hierarchy for both objects and view cells 
    182   VspOspTree *mVspOspTree; 
    183  
    184   bool mUseGlRenderer; 
    185   bool mUseGlDebugger; 
    186  
    187   bool mLoadViewCells; 
    188    
    189   bool mDetectEmptyViewSpace; 
    190  
    191   bool mQuitOnFinish; 
    192   bool mLoadMeshes; 
    193   bool mComputeVisibility; 
    194  
    195   bool mExportVisibility; 
    196   string mVisibilityFileName; 
    197    
    198   bool mApplyVisibilityFilter; 
    199   bool mApplyVisibilitySpatialFilter; 
    200  
    201   float mVisibilityFilterWidth; 
    202   
    203   //int GetRayCastMethod() { return mRayCastMethod; } 
    204   //void SetRayCastMethod(int rayCastMethod) { mRayCastMethod = rayCastMethod; } 
    205  
    206   int mPass; 
     106 
     107        virtual void KdTreeStatistics(ostream &s); 
     108        virtual void BspTreeStatistics(ostream &s); 
     109 
     110        /** Loads samples from file. 
     111        @param samples returns the stored sample rays 
     112        @param objects needed to associate the objects ids 
     113        @returns true if samples were loaded successfully 
     114        */ 
     115        bool LoadSamples(VssRayContainer &samples, 
     116                ObjectContainer &objects) const; 
     117 
     118        /** Exports samples to file. 
     119        @returns true if samples were written successfully 
     120        */ 
     121        bool ExportSamples(const VssRayContainer &samples) const; 
     122 
     123        bool LoadKdTree(const string filename); 
     124        bool ExportKdTree(const string filename); 
     125 
     126        virtual bool 
     127                GenerateRays( 
     128                const int number, 
     129                const int raysType, 
     130                SimpleRayContainer &rays 
     131                ); 
     132 
     133        bool GenerateRayBundle( 
     134                SimpleRayContainer &rayBundle, 
     135                const SimpleRay &mainRay, 
     136                const int number, 
     137                const int shuffleType) const; 
     138 
     139        virtual void CastRays(SimpleRayContainer &rays, 
     140                VssRayContainer &vssRays, 
     141                const bool castDoubleRays, 
     142                const bool pruneInvalidRays = true); 
     143 
     144        /** Returns a view cells manager of the given name. 
     145        */ 
     146        ViewCellsManager *CreateViewCellsManager(const char *name); 
     147        /** Returns a hierarchy manager of the given name. 
     148        */ 
     149        HierarchyManager *CreateHierarchyManager(const char *name); 
     150 
     151        GlRendererBuffer *GetRenderer(); 
     152 
     153        bool InitRayCast(const string externKdTree, const string internKdTree); 
     154 
     155 
     156        //////////////////////////////////////////////// 
     157 
     158        /// scene graph loaded from file 
     159        SceneGraph *mSceneGraph; 
     160 
     161        /// raw array of objects 
     162        ObjectContainer mObjects; 
     163 
     164        /// kD-tree organizing the scene graph (occluders + occludees) + viewcells 
     165        KdTree *mKdTree; 
     166        /// View space partition bsp tree 
     167        VspBspTree *mVspBspTree; 
     168        /// Hierarchy manager handling view space and object space partition 
     169        HierarchyManager *mHierarchyManager; 
     170        /// BSP tree representing the viewcells 
     171        BspTree *mBspTree; 
     172 
     173        /// list of all loaded occluders 
     174        ObjectContainer mOccluders; 
     175        /// list of all loaded occludees 
     176        ObjectContainer mOccludees; 
     177 
     178 
     179        ViewCellsManager *mViewCellsManager; 
     180 
     181        /// greedy optimized hierarchy for both objects and view cells 
     182        VspOspTree *mVspOspTree; 
     183 
     184        bool mUseGlRenderer; 
     185        bool mUseGlDebugger; 
     186 
     187        bool mLoadViewCells; 
     188 
     189        bool mDetectEmptyViewSpace; 
     190 
     191        bool mQuitOnFinish; 
     192        bool mLoadMeshes; 
     193        bool mComputeVisibility; 
     194 
     195        bool mExportVisibility; 
     196        string mVisibilityFileName; 
     197 
     198        bool mApplyVisibilityFilter; 
     199        bool mApplyVisibilitySpatialFilter; 
     200 
     201        float mVisibilityFilterWidth; 
     202 
     203        int mPass; 
    207204 
    208205protected: 
     
    215212        ///////////////////////// 
    216213 
    217   RayCaster *mRayCaster; 
    218   /// samples used for construction of the BSP view cells tree. 
    219   int mBspConstructionSamples; 
    220   /// samples used for construction of the VSP OSP tree. 
    221   int mVspOspConstructionSamples; 
    222   /** Simulates rendering of the scene. 
    223   */ 
    224   RenderSimulator *mRenderSimulator; 
    225    
    226   vector<FaceParentInfo> mFaceParents; 
    227  
    228   GlRendererBuffer *renderer; 
    229  
    230    
     214        RayCaster *mRayCaster; 
     215        /// samples used for construction of the BSP view cells tree. 
     216        int mBspConstructionSamples; 
     217        /// samples used for construction of the VSP OSP tree. 
     218        int mVspOspConstructionSamples; 
     219        /** Simulates rendering of the scene. 
     220        */ 
     221        RenderSimulator *mRenderSimulator; 
     222 
     223        vector<FaceParentInfo> mFaceParents; 
     224 
     225        GlRendererBuffer *renderer; 
     226 
     227 
    231228}; 
    232229 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp

    r1563 r1564  
    702702 
    703703        mStat.nodes = 1; 
    704         mBbox.Initialize();     // initialise bsp tree bounding box 
     704        mBbox.Initialize(); // initialise bsp tree bounding box 
    705705         
    706706        PolygonContainer *polys = new PolygonContainer(); 
     
    843843                } 
    844844        } 
    845          
     845        // clear helper structure 
     846        // note: memory will not be released using clear! 
    846847        facePolyMap.clear(); 
    847848 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r1563 r1564  
    374374        RayInfoContainer *rays = new RayInfoContainer(); 
    375375 
    376         //-- extract polygons from rays if there are polygon candidates 
     376        //////////// 
     377        //-- extract polygons from rays if polygon candidate planes are required 
     378 
    377379        if (mMaxPolyCandidates)  
    378380        { 
    379381                int numObj = 0; 
    380  
    381382                Intersectable::NewMail(); 
    382383 
     
    398399                                obj->Mail(); 
    399400 
    400                                 // transformed mesh instance and mesh instance handle mesh differently 
    401                                 if (obj->Type() == Intersectable::TRANSFORMED_MESH_INSTANCE) 
     401                                // handle intersectable 
     402                                switch (obj->Type()) 
    402403                                { 
    403                                         Mesh mesh; 
     404                                        case Intersectable::TRANSFORMED_MESH_INSTANCE: 
     405                                                { 
     406                                                        Mesh mesh; 
    404407                                 
    405                                         TransformedMeshInstance *tmobj =  
    406                                                 dynamic_cast<TransformedMeshInstance *>(obj); 
     408                                                        TransformedMeshInstance *tmobj =  
     409                                                                dynamic_cast<TransformedMeshInstance *>(obj); 
    407410                                 
    408                                         tmobj->GetTransformedMesh(mesh); 
    409                                         AddMeshToPolygons(&mesh, polys, tmobj); 
    410                                 } 
    411                                 else // MeshInstance 
    412                                 { 
    413                                         MeshInstance *mobj = dynamic_cast<MeshInstance *>(obj); 
    414                                         AddMeshToPolygons(mobj->GetMesh(), polys, mobj); 
     411                                                        tmobj->GetTransformedMesh(mesh); 
     412                                                        AddMeshToPolygons(&mesh, polys, tmobj); 
     413                                                } 
     414                                                break; 
     415                                        case Intersectable::MESH_INSTANCE: 
     416                                                { 
     417                                                        MeshInstance *mobj = dynamic_cast<MeshInstance *>(obj); 
     418                                                        AddMeshToPolygons(mobj->GetMesh(), polys, mobj); 
     419                                                } 
     420                                                break; 
     421                                        case Intersectable::TRIANGLE_INTERSECTABLE: 
     422                                                { 
     423                                                        // TODO 
     424                                                        cout << "here5" << endl; 
     425                                                } 
     426                                        default: 
     427                                                break; 
    415428                                } 
    416429 
Note: See TracChangeset for help on using the changeset viewer.