source: GTP/trunk/Lib/Vis/Preprocessing/src/SamplingPreprocessor.h @ 860

Revision 860, 2.2 KB checked in by mattausch, 18 years ago (diff)
Line 
1#ifndef _SamplingPreprocessor_H__
2#define _SamplingPreprocessor_H__
3
4#include <fstream>
5using namespace std;
6
7#include "Preprocessor.h"
8#include "VssRay.h"
9
10namespace GtpVisibilityPreprocessor {
11
12class Exporter;
13
14/** Sampling based visibility preprocessing. The implementation is based on heuristical
15    sampling of view space */
16class SamplingPreprocessor : public Preprocessor {
17public:
18               
19  SamplingPreprocessor();
20  ~SamplingPreprocessor();
21
22  virtual bool ComputeVisibility();
23
24
25protected:
26        /** Sets up ray for sampling.
27        */
28  void
29  SetupRay(Ray &ray,
30                   const Vector3 &point,
31                   const Vector3 &direction,
32                   const int type,
33                   const Ray::Intersection &source);
34 
35  /** Refined sampling for finding "holes", i.e., difficult visibility.
36   */
37  void
38  HoleSamplingPass();
39 
40  /** Casts a bundle of sample rays into the scene.
41                @param sampleContributions the number of sample contributions
42                @param contributingSamples the number of samples contributing
43        */
44        void
45        CastRays(const RayContainer &rays);
46       
47        /** Casts a single ray into the scene.
48                @returns sample contributions
49        */
50        int CastRay(Ray &ray);
51       
52        /** Verify if the exact visibility for this object was established.
53        */
54        void
55        VerifyVisibility(Intersectable *object);
56
57        /** Sample the shiluette of objects in order to find visibility changes
58                along the visibility skeleton.
59        */
60        int
61        CastEdgeSamples(
62                                        Intersectable *object,
63                                        const Vector3 &point,
64                                        MeshInstance *mi,
65                                        const int samples
66                                        );
67
68        /** Processes the view cells during a pass.
69                @param newRays the newly cast rays
70                @param sampleContributions returns the accumulated contribution of the samples
71                @param contributingSamples returns the samples contributing to pvs
72        */
73       
74        void ProcessViewCells(const RayContainer &newRays,
75                                                  const ObjectContainer &objects,
76                                                  int &sampleContributions,
77                                                  int &contributingSamples);
78
79        /**
80                Returns random node as target for the current sample ray.
81        */
82        KdNode *GetNodeToSample(Intersectable *object);
83
84
85protected:
86
87
88        int mPass;
89        int mSamplesPerPass;
90        int mTotalSamples;
91       
92        ofstream mStats;
93        ObjectContainer mObjects;
94
95        RayContainer mSampleRays;
96        VssRayContainer mVssSampleRays;
97};
98
99}
100
101#endif
Note: See TracBrowser for help on using the repository browser.