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

Revision 3283, 1.2 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        void Clear();
22
23        bool Empty() const;
24
25        void AddEntry(Bvh *bvh, BvhNode *node);
26
27        int GetSize() const;
28
29        inline SceneEntity *GetEntry(int i) const;
30
31        inline void AddEntry(SceneEntity *ent, float timeStamp = 0.0f);
32
33
34protected:
35
36        /// vector of PVS entries
37        SceneEntityContainer mEntries;
38        std::vector<float> mTimeStamps;
39
40        static bool sStoreTimeStamps;
41};
42
43
44inline SceneEntity *Pvs::GetEntry(int i) const
45{
46        return mEntries[i];
47}
48
49
50inline void Pvs::AddEntry(SceneEntity *ent, float timeStamp)
51{
52        mEntries.push_back(ent);
53
54        if (sStoreTimeStamps)
55        {
56                mTimeStamps.push_back(timeStamp);
57        }
58}
59
60
61inline int Pvs::GetSize() const
62{
63        return (int)mEntries.size();
64}
65
66
67inline void Pvs::AddEntry(Bvh *bvh, BvhNode *node)
68{
69        int geometrySize;
70        SceneEntity **entities;
71        entities = bvh->GetGeometry(node, geometrySize);
72
73        for (int i = 0; i < geometrySize; ++ i)
74        {
75                AddEntry(entities[i]);
76        }
77}
78
79
80}
81
82#endif
Note: See TracBrowser for help on using the repository browser.