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 | |
---|
11 | /** Class storing visibility information. |
---|
12 | */ |
---|
13 | class VisibilityInfo |
---|
14 | { |
---|
15 | public: |
---|
16 | VisibilityInfo(const int visiblePixels, const int projectedPixels); |
---|
17 | |
---|
18 | int GetVisiblePixels() const; |
---|
19 | int GetProjectedPixels() const; |
---|
20 | |
---|
21 | void SetVisiblePixels(int vis); |
---|
22 | void SetProjectedPixels(int vis); |
---|
23 | |
---|
24 | /** Computes ratio of visible to projected pixels. */ |
---|
25 | float ComputeRelativeVisibility(); |
---|
26 | |
---|
27 | /** Adds visibility to current visibility information. |
---|
28 | */ |
---|
29 | void AddVisibility(const VisibilityInfo &info); |
---|
30 | /** Adds visibility to current visibility information. |
---|
31 | */ |
---|
32 | void AddVisibility(const int visiblePixels, const int vrojectedPixels); |
---|
33 | |
---|
34 | protected: |
---|
35 | /** number of visible pixels. |
---|
36 | */ |
---|
37 | int mVisiblePixels; |
---|
38 | /** number of projected pixels |
---|
39 | */ |
---|
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; |
---|
51 | //bool operator<(const NodeInfo& rhs) const {return mNode < rhs.mNode;} |
---|
52 | |
---|
53 | protected: |
---|
54 | |
---|
55 | /** Pointer to the hierarchy nnode. |
---|
56 | */ |
---|
57 | HierarchyNode *mNode; |
---|
58 | }; |
---|
59 | |
---|
60 | /** Class storing the visibility information of a mesh. |
---|
61 | */ |
---|
62 | class MeshInfo: public VisibilityInfo |
---|
63 | { |
---|
64 | public: |
---|
65 | MeshInfo(Mesh *mesh, const int visiblePixels, const int projectedPixels); |
---|
66 | |
---|
67 | Mesh *GetMesh() const; |
---|
68 | void SetMesh(Mesh *mesh); |
---|
69 | |
---|
70 | //bool operator<(const MeshInfo& rhs) const {return mMesh < rhs.mMesh;} |
---|
71 | //bool operator==(const MeshInfo& rhs) const {return mMesh == rhs.mMesh;} |
---|
72 | |
---|
73 | protected: |
---|
74 | |
---|
75 | /** Pointer to the mesh. |
---|
76 | */ |
---|
77 | Mesh *mMesh; |
---|
78 | }; |
---|
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 | |
---|
98 | //TODO: this define shall be replaced by template typedef |
---|
99 | #define InfoContainer std::vector |
---|
100 | //#define InfoContainer std::set |
---|
101 | }; |
---|
102 | |
---|
103 | |
---|
104 | #endif |
---|