Line | |
---|
1 | #ifndef __PVS_H
|
---|
2 | #define __PVS_H
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include "Bvh.h"
|
---|
6 |
|
---|
7 | namespace CHCDemoEngine
|
---|
8 | {
|
---|
9 |
|
---|
10 | class BvhNode;
|
---|
11 | class Bvh;
|
---|
12 |
|
---|
13 |
|
---|
14 | /** Class representing the Potentially Visible Set (PVS) from a view cell.
|
---|
15 | */
|
---|
16 | class Pvs
|
---|
17 | {
|
---|
18 |
|
---|
19 | public:
|
---|
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 |
|
---|
36 | protected:
|
---|
37 |
|
---|
38 | /// hash table of PVS entries
|
---|
39 | SceneEntityContainer mEntries;
|
---|
40 | };
|
---|
41 |
|
---|
42 |
|
---|
43 | inline SceneEntity *Pvs::GetEntry(int i) const
|
---|
44 | {
|
---|
45 | return mEntries[i];
|
---|
46 | }
|
---|
47 |
|
---|
48 |
|
---|
49 | inline void Pvs::AddEntry(SceneEntity *ent)
|
---|
50 | {
|
---|
51 | mEntries.push_back(ent);
|
---|
52 | }
|
---|
53 |
|
---|
54 |
|
---|
55 | inline int Pvs::GetSize() const
|
---|
56 | {
|
---|
57 | return (int)mEntries.size();
|
---|
58 | }
|
---|
59 |
|
---|
60 |
|
---|
61 | inline 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.