#ifndef _SamplingPreprocessor_H__ #define _SamplingPreprocessor_H__ #include using namespace std; #include "Preprocessor.h" struct SimpleRay { Vector3 mOrigin; Vector3 mDirection; }; /** Sampling based visibility preprocessing. The implementation is based on heuristical sampling of view space */ class SamplingPreprocessor : public Preprocessor { public: int mPass; int mSamplesPerPass; int mTotalSamples; int mKdPvsDepth; ofstream mStats; ObjectContainer mObjects; RayContainer mSampleRays; int mBspConstructionSamples; SamplingPreprocessor(); ~SamplingPreprocessor(); virtual bool ComputeVisibility(); void SetupRay(Ray &ray, const Vector3 &point, const Vector3 &direction, const int type); KdNode * GetNodeForPvs(KdLeaf *leaf); int AddNodeSamples(Intersectable *object, const Ray &ray); void HoleSamplingPass(); int CastRay(Intersectable *object, Ray &ray); int CastEdgeSamples( Intersectable *object, const Vector3 &point, MeshInstance *mi, const int samples ); /** Adds objects samples to view cells. */ int AddObjectSamples(Intersectable *obj, const Ray &ray); bool BuildBspTree(); }; #endif