source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/PvsCollectionRenderer.h @ 3284

Revision 3284, 2.0 KB checked in by mattausch, 15 years ago (diff)
Line 
1#ifndef __PVSCOLLECTIONRENDERER_H
2#define __PVSCOLLECTIONRENDERER_H
3
4#include "RenderTraverser.h"
5
6namespace CHCDemoEngine
7{
8
9struct ViewCell;
10
11/** Preprocessing as well as online culling using hardware occlusion
12    queries have certain pros and cons. This method allows
13        us to combine those two paradigms for the maximum performance.
14        In particular, we propose following
15        algorithm, which gets rid of most of the shortcomings of either
16        approach. I.e., it is a strictly conservative approach that requires
17        only very short preprocessing time in the range of some seconds, while
18        inducing practically no overhead during runtime.
19
20        First we compute a very coarse global visibilitiy solution using our
21        sampling based preprocessor, which will be already sufficient to drive the
22        online alorithm. During walkthrough, we use occlusion queries to test
23        potentially invisible objects in a very efficient way, eliminating most of
24        the overhead of the query testing. The method assumes that previously
25        invisible objects are not part of a PVS, and as long as the assumption
26        hold's the algorithm has very low overhead. The method is conservative, and
27        converges over time in the sense that newly found visible objects are added
28        to the PVS. As the PVSs become more and more exact, the render time
29        overhead reduces to a minimum.
30*/
31class PvsCollectionRenderer: public RenderTraverser
32{
33public:
34        /** Default constructor.
35        */
36        PvsCollectionRenderer();
37       
38        virtual ~PvsCollectionRenderer();
39
40        void SetViewCell(ViewCell *vc) { mViewCell = vc; }
41
42        //virtual int GetType() const { return CULL_COLLECTOR; }
43        virtual int GetType() const { return -1; }
44
45protected:
46
47        /** Traverses and renders the scene with the specified method
48        */
49        virtual void Traverse();
50
51        void AddGeometryToPIS(BvhNode *node);
52
53
54        //////////////////////
55
56        ViewCell *mViewCell;
57        /// the potentially invisible set of objects
58        BvhNodeContainer mPIS;
59};
60
61
62}
63
64
65
66#endif // RENDERTRAVERSER_H
Note: See TracBrowser for help on using the repository browser.