source: GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h @ 1473

Revision 1473, 2.0 KB checked in by mattausch, 18 years ago (diff)
  • Property svn:executable set to *
Line 
1#ifndef _GvsPreprocessor_H__
2#define _GvsPreprocessor_H__
3
4#include <fstream>
5#include <stack>
6using namespace std;
7
8#include "Preprocessor.h"
9
10namespace GtpVisibilityPreprocessor {
11
12class Exporter;
13class VssRay;
14
15
16typedef stack<VssRay *> RayQueue;
17
18/** Sampling based visibility preprocessing. The implementation is
19        based on heuristical sampling of view space.
20*/
21class GvsPreprocessor : public Preprocessor {
22
23public:
24
25        GvsPreprocessor();
26        ~GvsPreprocessor() {}
27
28        virtual bool ComputeVisibility();
29       
30
31protected:
32
33        /** Runs the adaptive sampling. The method starts with a number of random rays given
34                by the queue and continues as long it finds new visible geometry (i.e., the queue is
35                not empty).
36
37                @returns the number of samples cast.
38        */
39        int RunSampling();
40
41        /** One pass of the sampling preprocessor. Continues as long as at least passSample
42                rays have been cast.
43                @returns the number of samples cast.
44        */
45        int Pass(const int passSamples);
46
47        /** Generates the rays starting the adaptive visibility sampling process.
48        */
49        int CastAvsSamples(
50                const int samplesPerPass,
51                const int sampleType,
52                RayQueue &passSamples);
53
54        /** Uses the information gained from the ray for doing adaptive border sampling.
55                This function tries to find the border of the triangle found visible by the
56                current ray. New rays are generated which sample this border.
57               
58                We use the following strategies:
59
60                a) if new triangle was found: adaptive border sampling
61                b) if triangle was found reverse sampling
62        */
63        int HandleRay(VssRay &ray);
64
65        /**
66        */     
67        int AdaptiveBorderSampling(VssRay &ray);
68       
69        int ReverseSampling(VssRay &ray);
70
71        /** Cast samples according to a specific sampling strategy.
72        */
73        int CastPassSamples(
74                const int samplesPerPass,
75                const int sampleType,
76                VssRayContainer &passSamples) const;
77
78
79
80        //////////////////////
81
82        ofstream mStats;
83        int mSamples;
84        int mSamplesPerPass;
85        RayQueue mRayQueue;
86        int mSamplingType;
87        int mTotalSamples;
88};
89
90};
91
92#endif
Note: See TracBrowser for help on using the repository browser.