#ifndef _VisibilityQueryManager_H__ #define _VisibilityQueryManager_H__ #include #include "VisibilityInfo.h" #include "VisibilityVector3.h" #include "VisibilityCamera.h" #include "VisibilityRay.h" namespace GtpVisibility { typedef std::vector QueryList; /** This abstract class defines interface for a specific visibility query algorithm. The interface supports two from point visibility queries and the ray shooting query. The output of the queries consists of list of visible meshes and hierarchy nodes. The from point queries will be implemented either with item bufferring or based purelly on occlusion queries. Note that the actuall implementation can also exploit the output of the visibility preprocessor. */ class QueryManager { public: /** Constructor taking a hierarchy interface as an argument. This allows to operate on different hierarchy types, while reusing the implementation of the query methods. */ QueryManager(HierarchyInterface *hierarchyInterface, int queryModes); /** Computes restricted visibility from point by using an explicit camera to execute the visibility query. @param camera The camera to be used @param visibleNodes Pointer to the container where visible nodes should be added. This set is formed of visible leafs or fully visible interior nodes. If NULL no visible nodes are not evaluated. @param visibleGeometry Pointer to the container where visible meshes should be added. If NULL no visible meshes are not evaluated. @param visiblePatches Pointer to the container where visible patches should be added. If NULL no visible meshes are not evaluated. @param relativeVisibility If true the visibility member for NodeInfo and MeshInfo represent relative visibility; i.e. the number of visible pixels divided by the the number of projected pixels. @return true if the corresponding PVS exists. */ virtual void ComputeCameraVisibility(const Camera &camera, NodeInfoContainer *visibleNodes, MeshInfoContainer *visibleGeometry, PatchInfoContainer *visiblePatches, const bool relativeVisibility, const bool approximateVisibility ) = 0; /** Uses the specified point to execute the visibility query in all directions. @sa ComputeCameraVisibility() */ virtual void ComputeFromPointVisibility(const Vector3 &point, NodeInfoContainer *visibleNodes, MeshInfoContainer *visibleGeometry, PatchInfoContainer *visiblePatches, const bool relativeVisibility, const bool approximateVisibility ) = 0; /** Ray shooting interface: finds an intersection with objects in the scene. @param ray The given input ray (assuming the ray direction is normalized) @param visibleMeshes List of meshes intersecting the ray @param isGlobalLine If false only first intersection with opaque object is returned. Otherwise all intersections of the ray with the scene are found. @return true if there is any intersection. */ virtual bool ShootRay(const Ray &ray, std::vector *visibleMeshes, bool isGlobalLine = false ); /** Sets the hierarchy interface. @remark the traversal depends on the type of hierarchyInterface the scene consists of. */ void SetHierarchyInterface(HierarchyInterface *hierarchyInterface); enum {PATCH_VISIBILITY = 2, GEOMETRY_VISIBILITY = 4, NODE_VISIBILITY = 8}; protected: HierarchyInterface *mHierarchyInterface; int mQueryModes; }; }; #endif // VisibilityQueryManager