[65] | 1 | #ifndef _VisibilityInfo_H__ |
---|
| 2 | #define _VisibilityInfo_H__ |
---|
| 3 | |
---|
| 4 | #include <vector> |
---|
| 5 | |
---|
| 6 | #include "VisibilityMesh.h" |
---|
| 7 | #include "HierarchyInterface.h" |
---|
| 8 | |
---|
| 9 | namespace GtpVisibility { |
---|
| 10 | |
---|
[145] | 11 | /** Class storing visibility information. |
---|
[71] | 12 | */ |
---|
[145] | 13 | class VisibilityInfo |
---|
[71] | 14 | { |
---|
| 15 | public: |
---|
[145] | 16 | VisibilityInfo(const int visiblePixels, const int projectedPixels); |
---|
[65] | 17 | |
---|
[145] | 18 | int GetVisiblePixels() const; |
---|
| 19 | int GetProjectedPixels() const; |
---|
[130] | 20 | |
---|
[145] | 21 | void SetVisiblePixels(int vis); |
---|
| 22 | void SetProjectedPixels(int vis); |
---|
| 23 | |
---|
| 24 | /** Computes ratio of visible to projected pixels. */ |
---|
| 25 | float ComputeRelativeVisibility(); |
---|
[143] | 26 | |
---|
[145] | 27 | /** Adds visibility to current visibility information. |
---|
| 28 | */ |
---|
| 29 | void AddVisibility(const VisibilityInfo &info); |
---|
[150] | 30 | /** Adds visibility to current visibility information. |
---|
| 31 | */ |
---|
| 32 | void AddVisibility(const int visiblePixels, const int vrojectedPixels); |
---|
[143] | 33 | |
---|
[145] | 34 | protected: |
---|
[150] | 35 | /** number of visible pixels. |
---|
| 36 | */ |
---|
[145] | 37 | int mVisiblePixels; |
---|
[150] | 38 | /** number of projected pixels |
---|
| 39 | */ |
---|
[145] | 40 | int mProjectedPixels; |
---|
| 41 | }; |
---|
| 42 | /** Class storing the visibility information of a hierarchy node. |
---|
| 43 | */ |
---|
| 44 | class NodeInfo: public VisibilityInfo |
---|
| 45 | { |
---|
| 46 | public: |
---|
| 47 | NodeInfo(HierarchyNode *node, const int visiblePixels, const int projectedPixels); |
---|
| 48 | |
---|
| 49 | void SetNode(HierarchyNode *node); |
---|
| 50 | HierarchyNode *GetNode() const; |
---|
[143] | 51 | //bool operator<(const NodeInfo& rhs) const {return mNode < rhs.mNode;} |
---|
| 52 | |
---|
[71] | 53 | protected: |
---|
[141] | 54 | |
---|
[145] | 55 | /** Pointer to the hierarchy nnode. |
---|
| 56 | */ |
---|
[65] | 57 | HierarchyNode *mNode; |
---|
[71] | 58 | }; |
---|
[65] | 59 | |
---|
[71] | 60 | /** Class storing the visibility information of a mesh. |
---|
| 61 | */ |
---|
[145] | 62 | class MeshInfo: public VisibilityInfo |
---|
[71] | 63 | { |
---|
| 64 | public: |
---|
[145] | 65 | MeshInfo(Mesh *mesh, const int visiblePixels, const int projectedPixels); |
---|
[65] | 66 | |
---|
[145] | 67 | Mesh *GetMesh() const; |
---|
| 68 | void SetMesh(Mesh *mesh); |
---|
[130] | 69 | |
---|
[145] | 70 | //bool operator<(const MeshInfo& rhs) const {return mMesh < rhs.mMesh;} |
---|
[141] | 71 | //bool operator==(const MeshInfo& rhs) const {return mMesh == rhs.mMesh;} |
---|
| 72 | |
---|
[71] | 73 | protected: |
---|
[141] | 74 | |
---|
[71] | 75 | /** Pointer to the mesh. |
---|
| 76 | */ |
---|
[65] | 77 | Mesh *mMesh; |
---|
[71] | 78 | }; |
---|
[159] | 79 | |
---|
| 80 | /** Class storing the visibility information of a patch, i.e., parts of meshes having the same material |
---|
| 81 | properties. |
---|
| 82 | */ |
---|
| 83 | class PatchInfo: public VisibilityInfo |
---|
| 84 | { |
---|
| 85 | public: |
---|
| 86 | PatchInfo(Patch *Patch, const int visiblePixels, const int projectedPixels); |
---|
| 87 | |
---|
| 88 | Patch *GetPatch() const; |
---|
| 89 | void SetPatch(Patch *patch); |
---|
| 90 | |
---|
| 91 | protected: |
---|
| 92 | |
---|
| 93 | /** Pointer to the patch. |
---|
| 94 | */ |
---|
| 95 | Patch *mPatch; |
---|
| 96 | }; |
---|
| 97 | |
---|
[71] | 98 | //TODO: this define shall be replaced by template typedef |
---|
[143] | 99 | #define InfoContainer std::vector |
---|
| 100 | //#define InfoContainer std::set |
---|
[65] | 101 | }; |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | #endif |
---|