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

Revision 3259, 1.0 KB checked in by mattausch, 15 years ago (diff)
RevLine 
[3242]1#ifndef __PVS_H
2#define __PVS_H
3
[3243]4#include "common.h"
[3259]5#include "Bvh.h"
[3243]6
[3242]7namespace CHCDemoEngine
8{
9
[3259]10class BvhNode;
11class Bvh;
12
13
14/** Class representing the Potentially Visible Set (PVS) from a view cell.
[3242]15*/
16class Pvs
17{
18
19public:
20
[3259]21        //Pvs() {}
[3242]22
[3259]23        void Clear();
[3242]24
[3259]25        bool Empty() const;
[3242]26
[3259]27        void AddEntry(Bvh *bvh, BvhNode *node);
[3242]28
[3259]29        int GetSize() const;
[3242]30
[3259]31        inline SceneEntity *GetEntry(int i) const;
[3242]32
[3259]33        inline void AddEntry(SceneEntity *ent);
[3242]34
[3259]35
[3242]36protected:
37
[3243]38        /// hash table of PVS entries
39        SceneEntityContainer mEntries;
[3242]40};
41
[3259]42
43inline SceneEntity *Pvs::GetEntry(int i) const
44{
45        return mEntries[i];
[3242]46}
47
[3259]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
[3243]76#endif
Note: See TracBrowser for help on using the repository browser.