#ifndef __PVSCOLLECTIONRENDERER_H #define __PVSCOLLECTIONRENDERER_H #include "RenderTraverser.h" namespace CHCDemoEngine { struct ViewCell; /** Preprocessing as well as online culling using hardware occlusion queries have certain pros and cons. This method allows us to combine those two paradigms for the maximum performance. In particular, we propose following algorithm, which gets rid of most of the shortcomings of either approach. I.e., it is a strictly conservative approach that requires only very short preprocessing time in the range of some seconds, while inducing practically no overhead during runtime. First we compute a very coarse global visibilitiy solution using our sampling based preprocessor, which will be already sufficient to drive the online alorithm. During walkthrough, we use occlusion queries to test potentially invisible objects in a very efficient way, eliminating most of the overhead of the query testing. The method assumes that previously invisible objects are not part of a PVS, and as long as the assumption hold's the algorithm has very low overhead. The method is conservative, and converges over time in the sense that newly found visible objects are added to the PVS. As the PVSs become more and more exact, the render time overhead reduces to a minimum. */ class PvsCollectionRenderer: public RenderTraverser { public: /** Default constructor. */ PvsCollectionRenderer(); virtual ~PvsCollectionRenderer(); void SetViewCell(ViewCell *vc) { mViewCell = vc; } //virtual int GetType() const { return CULL_COLLECTOR; } virtual int GetType() const { return -1; } protected: /** Traverses and renders the scene with the specified method */ virtual void Traverse(); void AddGeometryToPIS(BvhNode *node); ////////////////////// ViewCell *mViewCell; /// the potentially invisible set of objects BvhNodeContainer mPIS; }; } #endif // RENDERTRAVERSER_H