Changeset 65 for trunk


Ignore:
Timestamp:
04/28/05 22:55:26 (19 years ago)
Author:
bittner
Message:

Merged headers and sources for dummy modules. Added GtpVisibilityPreprocessor?

Location:
trunk/VUT
Files:
23 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibility/include/HierarchyInterface.h

    r59 r65  
    4141        */ 
    4242        void SetSceneRoot(HierarchyNode *root); 
     43  /** Get the root of the scene hierarchy. 
     44      @return the hierarchy root 
     45  */ 
     46  HierarchyNode *GetSceneRoot() const { 
     47    return mSceneRoot; 
     48  } 
    4349        /** Sets the scene root and initialises this scene traverser for a traversal. 
    4450                @param root current scene root 
  • trunk/VUT/GtpVisibility/include/PreprocessingManager.h

    r59 r65  
    22#define _VisibilityPreprocessingManager_H__ 
    33 
    4 #include "GtpVisibilitySceneTraverser.h" 
    5 #include "GtpVisibilityInfo.h" 
     4#include <string> 
     5using namespace std; 
    66 
     7#include "HierarchyInterface.h" 
     8#include "VisibilityInfo.h" 
     9#include "VisibilityVector3.h" 
    710 
    8 /** This abstract class defining interface for a specific visibility query 
    9     algorithm. The algorithm is either used to render the scene with false colors 
    10     and query visibility of scene nodes and polygons */ 
    11 */ 
    12 class VisibilityPreprocessingInterface 
    13 { 
    14 public: 
     11namespace GtpVisibility { 
     12   
     13  /** 
     14     This class defines an interface to the external visibility preprocessor. 
     15     It allows to export the static part of the scene to a file in the XML format 
     16     understood by the preprocessor. By default all the exported meshes are considered 
     17     as scene occluders, whereas occludees are formed by their bounding boxes, 
     18     and bounding boxes of the scene hierarchy. 
    1519 
     20     This class also allows to import the preprocessed data with PVS 
     21     information for the viewcells (note that the viewcells are either generated 
     22     automatically by the preprocessor or loaded from a polyhedral definition stored 
     23     in a file (see documentation for the Preprocessor class). 
     24  */ 
     25   
     26  class PreprocessingManager 
     27  { 
     28  public: 
     29     
     30    /** 
     31       Constructor taking a HierarchyInterface as argument. 
     32       The HierarchyInterface makes the PreprocessingManager independent from the actual 
     33       scene representation as long as it supports a required set of methods. 
     34     */ 
     35    PreprocessingManager( HierarchyInterface *hierarchyInterface ); 
     36     
    1637 
    17   /** Constructor taking a scene traverser for a specific type of hierarchy as argument.  
    18    */ 
    19         VisibilityPreprocessingInterface( GtpVisibility::SceneTraverser *sceneTraverser ); 
     38    /** 
     39       Destructor which deletes all data describing static scene visibility. 
     40    */ 
     41    virtual ~PreprocessingManager(); 
     42 
     43    /** 
     44       Export the scene for visibility preprocessing. Exports the hierarchyInterface including 
     45       its bounding boxes + mesh data. Note that the bounding boxes can be used as occludees 
     46       by the extrenal preprocessor. The viewcell data will either be supplied directly to the 
     47       visibility preprocessing standalone module. 
     48 
     49       @param filename name of the file to export. 
     50       @return true if the export was succesful. 
     51    */ 
     52    virtual bool ExportScene(const string filename 
     53                             ) = 0; 
     54     
     55    /** 
     56       Load preprocessed visibility information. The loaded data is matched with the current 
     57       scene graph. The topology of the current scene graph has to match with the loaded data. 
     58       There is also geometrical check of the bounding boxes. Once loading is succesful the 
     59       PreprocessingManager establishes links from its internal visibility representation 
     60       to the scene graph: no change of this part of the scene graph is allowed; this would 
     61       violate the static scene assumption! 
     62 
     63       @param filename name of the file to load. 
     64       @return true if the loading was succesful. 
     65    */ 
     66    virtual bool LoadPreprocessedData(const string filename 
     67                                      ) = 0; 
     68     
     69    /**  
     70        Retrieve a PVS corresponding to the given spherical neighborhood of the point. 
     71        Typically the implementation of this method will firs locate all viewcells 
     72        intersecting the sphere using efficient logarithmic search enhanced with caching 
     73        the last query. Then it computes a union of the PVS for the found viewcells. 
     74 
     75        @param point the center point of the spherical neighborhood 
     76 
     77        @param radius the radius of the spherical neighborhood. Note that if radius==0 a 
     78        more efficient implementation of the method for this special case can be used. 
     79 
     80        @param visibleNodes is not NULL 
     81        a set of visible scene graph nodes is added to the visibleNodes container. 
     82        This set is formed of visible leafs or fully visible interior nodes. 
     83        If visibleMeshes != NULL the set of visible meshes is 
     84        added to the container. Returns true if the corresponding PVS exists. 
     85    */ 
     86    virtual bool GetPVS(const Vector3 &point, 
     87                        const float radius, 
     88                        InfoContainer<NodeInfo> *visibleNodes, 
     89                        InfoContainer<MeshInfo> *visibleMeshes ); 
     90     
     91     
    2092   
     93    /** Sets the scene traverser. 
     94        @remark the scene traverser is dependent on the type of hierarchyInterface the scene consists of. 
     95    */ 
     96    virtual void SetSceneTraverser( HierarchyInterface *hierarchyInterface ) { 
     97      mSceneTraverser = hierarchyInterface; 
     98    } 
     99     
     100  protected: 
     101    /** Get checksum of the current occluder set in the scene graph. This method is used to check 
     102        if the preprocessed data matches the current scene graph 
     103        -> $$ could be moved to VisibilitySceneTraverser */ 
     104    long GetOccluderChecksum() const { 
     105      return 0; 
     106    } 
     107       
     108     
     109    /** Get checksum of the current occludee set in the scene graph. This method is used to check 
     110        if the preprocessed data matches the current scene graph 
     111        -> $$ could be moved to VisibilitySceneTraverser */ 
     112    long GetOccludeeChecksum() const { 
     113      return 0; 
     114    } 
     115     
     116     
     117    /**  
     118        Find viewcells intersecting a spherical neighborhood of a point. 
     119        Returns false if no viewcell was found. 
     120    */ 
     121    virtual bool LocateViewCellIds(const Vector3 &center, 
     122                                   const float radius, 
     123                                   vector<int> *viewCellIds 
     124                                   ) = 0; 
     125     
     126    /** 
     127       Add a PVS of the given viewcell to the already evaluated PVS by computing 
     128       a union with visibleNodes and visibleMeshes. Returns the number of added entries. 
     129    */ 
     130    virtual int AddViewCellPVS(const int cellID, 
     131                               InfoContainer<NodeInfo> *visibleNodes, 
     132                               InfoContainer<MeshInfo> *visibleMeshes ) = 0; 
     133     
     134    HierarchyInterface *mSceneTraverser; 
     135  }; 
    21136   
    22   /**  
    23       Export the scene for visibility preprocessing. Exports the hierarchy including 
    24       its bounding boxes + mesh data for occluders. The viewcell data will either be 
    25       supplied directly to the visibility preprocessing standalone module 
    26   */ 
    27   virtual ErrorCode ExportScene(const string filename); 
    28    
    29    
    30   /**  
    31       Load preprocessed visibility information 
    32   */ 
    33   virtual ErrorCode LoadPreprocessedData(const string filename); 
    34    
    35   /**  
    36       Uses the specified sphere to find its PVS 
    37   */ 
    38   virtual ErrorCode GetPointPVS(const Vector3D &point, 
    39                                 VisibilityContainer<NodeVisibilityInfo> *visibleNodes, 
    40                                 VisibilityContainer<MeshVisibilityInfo> *visibleMeshes ) = 0; 
    41    
    42   /**  
    43       Uses the specified sphere to find its PVS 
    44   */ 
    45   virtual ErrorCode GetSpherePVS(const Vector3D &point, 
    46                                  const float radius, 
    47                                  VisibilityContainer<NodeVisibilityInfo> *visibleNodes, 
    48                                  VisibilityContainer<MeshVisibilityInfo> *visibleMeshes ) = 0; 
    49  
    50    
    51    
    52   /** Sets the scene traverser. 
    53       @remark the scene traverser is dependent on the type of hierarchy the scene consists of. 
    54   */ 
    55   void setSceneTraverser( GtpVisibility::SceneTraverser *sceneTraverser ); 
    56  
    57 protected: 
    58   /** Helper method for getting a scene name */ 
    59   string GetSceneName() const; 
    60  
    61   /** Get checksum of the current occluder set in the scene graph. This method is used to check 
    62       if the preprocessed data matches the current scene graph 
    63       -> $$ could be moved to VisibilitySceneTraverser */ 
    64   long GetOccluderChecksum() const; 
    65  
    66   /** Get checksum of the current occludee set in the scene graph. This method is used to check 
    67       if the preprocessed data matches the current scene graph 
    68       -> $$ could be moved to VisibilitySceneTraverser */ 
    69   long GetOccludeeChecksum() const; 
    70  
    71   /**  
    72       Finds a viewcell given a point in space 
    73   */ 
    74   virtual ErrorCode FindViewCellId(const Vector3D &point, 
    75                                    int *viewCellId 
    76                                    ); 
    77  
    78   /**  
    79       Uses the specified viewcell to find its PVS 
    80   */ 
    81   virtual ErrorCode GetViewCellPVS(const int cellID, 
    82                                    VisibilityContainer<NodeVisibilityInfo> *visibleNodes, 
    83                                    VisibilityContainer<MeshVisibilityInfo> *visibleMeshes ) = 0; 
    84  
    85   GtpVisibility::SceneTraverser *mSceneTraverser; 
    86137}; 
    87138 
    88 #endif // VisibilityPreprocessingManager 
     139#endif // VisibilityPreprocessingInterafce 
  • trunk/VUT/GtpVisibility/include/QueryManager.h

    r59 r65  
    22#define _VisibilityQueryManager_H__ 
    33 
     4#include <vector> 
     5 
    46#include "VisibilityInfo.h" 
     7#include "VisibilityVector3.h" 
     8#include "VisibilityCamera.h" 
     9#include "VisibilityRay.h" 
    510 
     11namespace GtpVisibility { 
     12   
     13/** This abstract class defines interface for a specific visibility query 
     14    algorithm. The interface supports two from point visibility queries and 
     15    the ray shooting query. The output of the queries consists of list of 
     16    visible meshes and hierarchy nodes. The from point queries will be implemented 
     17    either with item bufferring or based purelly on occlusion queries. Note that 
     18    the actuall implementation can also exploit the 
     19    output of the visibility preprocessor. 
     20*/ 
     21  class QueryManager 
     22  { 
     23  public: 
     24    /** Constructor taking a hierarchy interface as an argument. This allows to operate 
     25        onm different hierarchy types, while reusing the implementation of the query methods. 
     26     */ 
     27    QueryManager( HierarchyInterface *hierarchyInterface ); 
     28     
     29    /**  
     30        Computes restricted visibility from point by using an explicit camera to execute 
     31        the visibility query. 
     32        @param camera The camera to be used 
    633 
    7 /** This abstract class defining interface for a specific visibility query 
    8     algorithm. The algorithm is either used to render the scene with false colors 
    9     and query visibility of scene nodes and polygons */ 
    10 */ 
    11 class VisibilityQueryManager 
    12 { 
    13 public: 
    14   /** Constructor taking a scene traverser for a specific type of hierarchy as argument.  
    15    */ 
    16         VisibilityQueryManager( GtpVisibility::SceneTraverser *sceneTraverser ); 
     34        @param visibleNodes Pointer to the container where visible nodes should be added. 
     35        This set is formed of visible leafs or fully visible interior nodes. 
     36        If NULL no visible nodes are not evaluated. 
    1737 
     38        @param visibleGeometry Pointer to the container where visible meshes should be added. 
     39        If NULL no visible meshes are not evaluated. 
     40 
     41        @param relativeVisibility If true the visibility member for 
     42        NodeInfo and MeshInfo represent relative visibility; i.e. the number of visible 
     43        pixels divided by the the number of projected pixels. 
     44 
     45        @return true if the corresponding PVS exists. 
     46    */ 
     47    virtual void 
     48    ComputeCameraVisibility(const Camera &camera, 
     49                            InfoContainer<NodeInfo> *visibleNodes, 
     50                            InfoContainer<MeshInfo> *visibleGeometry, 
     51                            bool relativeVisibility = false 
     52                            ) = 0; 
     53     
     54    /**  
     55        Uses the specified point to execute the visibility query in all directions.  
     56        @sa ComputeCameraVisibility() 
     57    */ 
     58    virtual void 
     59    ComputeFromPointVisibility(const Vector3 &point, 
     60                               InfoContainer<NodeInfo> *visibleNodes, 
     61                               InfoContainer<MeshInfo> *visibleGeometry, 
     62                               bool relativeVisibility = false 
     63                               ) = 0; 
     64     
    1865  /**  
    19       Uses explicit camera to execute the visibility query 
     66      Ray shooting intreface: finds an intersection with objects in the scene. 
     67 
     68      @param ray The given input ray (assuming the ray direction is normalized) 
     69 
     70      @param visibleMeshes List of meshes intersecting the ray 
     71 
     72      @param isGlobalLine If false only first intersection with opaque object is returned. 
     73      Otherwise all intersections of the ray with the scene are found. 
     74 
     75      @return true if there is any intersection.  
    2076  */ 
    21   virtual void 
    22   ComputeFromPointVisibility(const Camera &camera, 
    23                              VisibilityContainer<NodeVisibilityInfo> *visibleNodes, 
    24                              VisibilityContainer<MeshVisibilityInfo> *visibleGeometry ) = 0; 
    25    
    26   /**  
    27       Uses the specified point to execute the visibility query in all directions 
    28   */ 
    29   virtual void 
    30   ComputeFromPointVisibility(const Vector3D &point, 
    31                              VisibilityContainer<NodeVisibilityInfo> *visibleNodes, 
    32                              VisibilityContainer<MeshVisibilityInfo> *visibleGeometry ) = 0; 
    33    
    34   /**  
    35       Ray shooting intreface: finds an intersection with the first opaque 
    36       object in the scene if globalLine = false, otherwise finds all intersections 
    37       with the scene.  
    38   */ 
    39   virtual void 
    40   ShootRay(const Ray &ray, 
    41            VisibilityContainer<NodeVisibilityInfo> *visibleNodes, 
    42            VisibilityContainer<MeshVisibilityInfo> *visibleMeshes, 
    43            bool isGlobalLine = false 
    44            ) = 0; 
    45    
    46    
    47   /**  
    48       Preprocessing interface: PVS for a given point found using PVS of the corresponding viewcell 
    49   */ 
    50   virtual int 
    51   GetFromPointPVS(const Vector3D &point, 
    52                   VisibilityContainer<NodeVisibilityInfo> *visibleNodes, 
    53                   VisibilityContainer<MeshVisibilityInfo> *visibleMeshes ) = 0; 
    54    
    55   /**  
    56       Preprocessing interface: PVS for a given sphere using union of cell based PVS 
    57   */ 
    58   virtual int 
    59   GetFromSpherePVS(const Vector3D &center, 
    60                    const float radius, 
    61                    VisibilityContainer<NodeVisibilityInfo> *visibleNodes, 
    62                    VisibilityContainer<MeshVisibilityInfo> *visibleMeshes ) = 0; 
    63    
     77    virtual bool 
     78    ShootRay(const Ray &ray, 
     79             std::vector<Mesh *> *visibleMeshes, 
     80             bool isGlobalLine = false 
     81             ); 
    6482   
    6583  /** Sets the scene traverser. 
    66       @remark the scene traverser is dependent on the type of hierarchy the scene consists of. 
     84      @remark the scene traverser depends on the type of hierarchyInterface the scene consists of. 
    6785  */ 
    68   void setSceneTraverser( GtpVisibility::SceneTraverser *sceneTraverser ); 
     86  void SetSceneTraverser(HierarchyInterface *hierarchyInterface ); 
    6987 
    7088protected: 
    71         GtpVisibility::SceneTraverser *mSceneTraverser; 
     89    HierarchyInterface *mHierarchyInterface; 
    7290   
    73   VisibilityPreprocessingInterface *mPreprocessingManager; 
     91}; 
     92 
    7493}; 
    7594 
  • trunk/VUT/GtpVisibility/include/VisibilityInfo.h

    r59 r65  
    22#define _VisibilityInfo_H__ 
    33 
     4#include <vector> 
    45 
     6#include "VisibilityMesh.h" 
     7#include "HierarchyInterface.h" 
    58 
    6 /** Class storing the visibility information of a scene node.  
    7 */ 
    8 class NodeVisibilityInfo { 
    9   /** pointer to the scene node */ 
    10   SceneNode *mNode; 
    11   /** node visibility can either be a number of visible pixels or relative 
    12       number of visible pixels (if the hardware queries will provide the 
    13       total number of ratsterized pixels */ 
    14   float mVisibility; 
     9namespace GtpVisibility { 
     10   
     11  /** Class storing the visibility information of a scene node.  
     12   */ 
     13  class NodeInfo { 
     14  public: 
     15    NodeInfo(HierarchyNode *node, 
     16             const float v): 
     17      mNode(node), mVisibility(v) {} 
     18 
     19  protected: 
     20    /** pointer to the scene node */ 
     21    HierarchyNode *mNode; 
     22    /** node visibility can either be a number of visible pixels or relative 
     23        number of visible pixels (if the hardware queries will provide the 
     24        total number of ratsterized pixels */ 
     25    float mVisibility; 
     26  }; 
     27   
     28   
     29  /** Class storing the visibility information of a mesh.  
     30   */ 
     31  class MeshInfo { 
     32  public: 
     33    MeshInfo(Mesh *mesh, 
     34             const float v): 
     35      mMesh(mesh), mVisibility(v) {} 
     36 
     37  protected: 
     38    /** pointer to the scene node */ 
     39    Mesh *mMesh; 
     40    /** node visibility can either be a number of visible pixels or relative 
     41        number of visible pixels (if the hardware queries will provide the 
     42        total number of ratsterized pixels */ 
     43    float mVisibility; 
     44  }; 
     45   
     46  // this define shall be replaced by template typedef 
     47#define InfoContainer std::vector 
    1548}; 
    1649 
    1750 
    18 /** Class storing the visibility information of a mesh.  
    19 */ 
    20 class MeshVisibilityInfo { 
    21   /** pointer to the scene node */ 
    22   Geometry *mGeometry; 
    23   /** node visibility can either be a number of visible pixels or relative 
    24       number of visible pixels (if the hardware queries will provide the 
    25       total number of ratsterized pixels */ 
    26   float mVisibility; 
    27 }; 
    28  
    29 /** Default container type for visibility infos */ 
    30 temlate <typename T> 
    31 typedef vector<T> VisibilityContainer<T>; 
    32  
    3351#endif 
  • trunk/VUT/GtpVisibility/include/VisibilityManager.h

    r59 r65  
    44#include "CullingManager.h" 
    55#include "VisibilityEnvironment.h" 
     6 
    67 
    78/** This namespace includes all classes which are created by the VUT (Vienna University 
     
    1213namespace GtpVisibility { 
    1314 
     15  class QueryManager; 
     16  class PreprocessingManager; 
     17   
    1418/** This class manages all forms of visibility. It is the main 
    1519        class of our visibility module and manages online occlusion culling, 
     
    4145protected: 
    4246         
    43         CullingManager *mCullingManager; 
    44         VisibilityEnvironment *mVisibilityEnvironment; 
    45         VisibilityEnvironment::CullingManagerType mCullingManagerType; 
     47  CullingManager *mCullingManager; 
     48  QueryManager *mQueryManager; 
     49  PreprocessingManager *mPreprocessingManager; 
     50  VisibilityEnvironment *mVisibilityEnvironment; 
     51  VisibilityEnvironment::CullingManagerType mCullingManagerType; 
    4652}; 
    4753} // namespace GtpVisibility 
  • trunk/VUT/GtpVisibility/src/VisibilityManager.cpp

    r59 r65  
    33#include "CoherentHierarchicalCullingManager.h" 
    44#include "FrustumCullingManager.h" 
     5#include "DummyPreprocessingManager.h" 
     6#include "DummyQueryManager.h" 
    57 
    68namespace GtpVisibility { 
     
    1315        mCullingManagerType = VisibilityEnvironment::FRUSTUM_CULLING; 
    1416        mCullingManager = new FrustumCullingManager(0); 
     17 
     18        mQueryManager = new DummyQueryManager(0); 
     19        mPreprocessingManager = new DummyPreprocessingManager(0); 
     20 
    1521} 
    1622 
Note: See TracChangeset for help on using the changeset viewer.