#ifndef _VssPreprocessor_H__ #define _VssPreprocessor_H__ #include using namespace std; #include "Preprocessor.h" #include "VssRay.h" namespace GtpVisibilityPreprocessor { class VssTree; class VssTreeLeaf; /** Sampling based visibility preprocessing. The implementation is based on heuristical sampling of view space */ class VssPreprocessor : public Preprocessor { public: int mSamplesPerPass; int mVssSamplesPerPass; int mInitialSamples; int mVssSamples; bool mUseImportanceSampling; bool mEnlargeViewSpace; AxisAlignedBox3 *mViewSpaceBox; ofstream mStats; ObjectContainer mObjects; /// if initial samples should be loaded from file bool mLoadInitialSamples; /// if initial samples should be stored in file bool mStoreInitialSamples; /// if box around view space should be used bool mUseViewSpaceBox; // rays cast during the processing VssRayContainer mVssRays; VssPreprocessor(); ~VssPreprocessor(); virtual bool ComputeVisibility(); Vector3 GetViewpoint(AxisAlignedBox3 *viewSpaceBox); Vector3 GetDirection(const Vector3 &viewpoint, AxisAlignedBox3 *viewSpaceBox ); void CastRays(SimpleRayContainer &rays, VssRayContainer &vssRays); bool ExportRays(const char *filename, const VssRayContainer &vssRays, const int number ); int GenerateImportanceRays(VssTree *vssTree, const int desiredSamples, SimpleRayContainer &rays ); bool ExportVssTreeLeaf(char *filename, VssTree *tree, VssTreeLeaf *leaf); void ExportVssTreeLeaves(VssTree *tree, const int number); bool ExportVssTree(char *filename, VssTree *tree, const Vector3 &dir ); float GetAvgPvsSize(VssTree *tree, const vector &viewcells ); void TestBeamCasting(VssTree *tre, ViewCellsManager *vm, const ObjectContainer &objects); bool mTestBeamSampling; protected: void CastRays16(SimpleRayContainer &rays, VssRayContainer &vssRays, const AxisAlignedBox3 &sbox); }; } #endif