source: trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.h @ 441

Revision 441, 2.3 KB checked in by mattausch, 19 years ago (diff)

added visibilitymanager
removed area computation from bsp

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
10class Exporter;
11
12/** Sampling based visibility preprocessing. The implementation is based on heuristical
13    sampling of view space */
14class SamplingPreprocessor : public Preprocessor {
15public:
16               
17  SamplingPreprocessor();
18  ~SamplingPreprocessor();
19
20  virtual bool ComputeVisibility();
21
22
23protected:
24        /** Sets up ray for sampling.
25        */
26  void
27  SetupRay(Ray &ray,
28                   const Vector3 &point,
29                   const Vector3 &direction,
30                         const int type,
31                         const Ray::Intersection &source);
32
33        /** Refined sampling for finding "holes", i.e., difficult visibility.
34        */
35  void
36  HoleSamplingPass();
37
38        /** Casts a bundle of sample rays into the scene.
39                @param sampleContributions the number of sample contributions
40                @param contributingSamples the number of samples contributing
41        */
42        void
43        CastRays(const RayContainer &rays,
44                         int &sampleContributions,
45                         int &contributingSamples);
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        /** Adds objects samples to kd and bsp view cells.
80        */
81        int AddObjectSamples(Intersectable *obj, const Ray &ray);
82
83        /**
84                Returns random node as target for the current sample ray.
85        */
86        KdNode *GetNodeToSample(Intersectable *object);
87
88
89protected:
90
91
92        int mPass;
93        int mSamplesPerPass;
94        int mTotalSamples;
95       
96        ofstream mStats;
97        ObjectContainer mObjects;
98
99        RayContainer mSampleRays;
100        VssRayContainer mVssSampleRays;
101};
102
103#endif
Note: See TracBrowser for help on using the repository browser.