source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Pvs.h @ 3259

Revision 3259, 1.0 KB checked in by mattausch, 15 years ago (diff)
Line 
1#ifndef __PVS_H
2#define __PVS_H
3
4#include "common.h"
5#include "Bvh.h"
6
7namespace CHCDemoEngine
8{
9
10class BvhNode;
11class Bvh;
12
13
14/** Class representing the Potentially Visible Set (PVS) from a view cell.
15*/
16class Pvs
17{
18
19public:
20
21        //Pvs() {}
22
23        void Clear();
24
25        bool Empty() const;
26
27        void AddEntry(Bvh *bvh, BvhNode *node);
28
29        int GetSize() const;
30
31        inline SceneEntity *GetEntry(int i) const;
32
33        inline void AddEntry(SceneEntity *ent);
34
35
36protected:
37
38        /// hash table of PVS entries
39        SceneEntityContainer mEntries;
40};
41
42
43inline SceneEntity *Pvs::GetEntry(int i) const
44{
45        return mEntries[i];
46}
47
48
49inline void Pvs::AddEntry(SceneEntity *ent)
50{
51        mEntries.push_back(ent);
52}
53
54
55inline int Pvs::GetSize() const
56{
57        return (int)mEntries.size();
58}
59
60
61inline void Pvs::AddEntry(Bvh *bvh, BvhNode *node)
62{
63        int geometrySize;
64        SceneEntity **entities;
65        entities = bvh->GetGeometry(node, geometrySize);
66
67        for (int i = 0; i < geometrySize; ++ i)
68        {
69                AddEntry(entities[i]);
70        }
71}
72
73
74}
75
76#endif
Note: See TracBrowser for help on using the repository browser.