#ifndef __HASHPVS_H #define __HASHPVS_H #include #include #include "common.h" #include #include "PvsBase.h" using namespace std; namespace GtpVisibilityPreprocessor { class KdNode; class BspNode; class Ray; class Intersectable; class ViewCell; /** Template class representing the Potentially Visible Set (PVS) mainly from a view cell, but also e.g., from objects. */ template class HashPvs: public PvsBase { template friend class PvsIterator2; public: HashPvs() {}; //virtual ~HashPvs() {}; int GetSize() const; bool Empty() const; /** Adds sample to PVS. @returns contribution of sample (0 or 1) */ float AddSample(T sample); /** Adds sample to PVS without checking for presence of the sample warning: pvs remains unsorted! */ void AddSampleDirty(T sample); /** Adds sample dirty (on the end of the vector) but first checks if sample is already in clean part of the pvs. */ bool AddSampleDirtyCheck(T sample); /** Sort pvs entries - this should always be called after a sequence of AddSampleDirty calls */ void Sort(); /** Clears the pvs. */ void Clear(const bool trim = true); //static void Merge(PvsBase &mergedPvs, const PvsBase &a, const PvsBase &b); bool IsDirty() const; bool RequiresResort() const; //typename PvsIterator GetIterator() const; protected: /// vector of PVS entries vector mEntries; /// Number of samples used to create the PVS int mSamples; }; template int HashPvs::GetSize() const { return 0; } template bool HashPvs::Empty() const { return false; } template float HashPvs::AddSample(T sample) { return 0; } template void HashPvs::AddSampleDirty(T sample) { } template bool HashPvs::AddSampleDirtyCheck(T sample) { return false; } template void HashPvs::Sort() { } template void HashPvs::Clear(const bool trim = true) { } template bool HashPvs::IsDirty() const { return false; } template bool HashPvs::RequiresResort() const { return false; } //typename PvsIterator GetIterator() const; } #endif