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

Revision 469, 2.2 KB checked in by mattausch, 19 years ago (diff)

updated view cells, view cell manager. changed rendersimulator

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       
45        /** Casts a single ray into the scene.
46                @returns sample contributions
47        */
48        int CastRay(Ray &ray);
49       
50        /** Verify if the exact visibility for this object was established.
51        */
52        void
53        VerifyVisibility(Intersectable *object);
54
55        /** Sample the shiluette of objects in order to find visibility changes
56                along the visibility skeleton.
57        */
58        int
59        CastEdgeSamples(
60                                        Intersectable *object,
61                                        const Vector3 &point,
62                                        MeshInstance *mi,
63                                        const int samples
64                                        );
65
66        /** Processes the view cells during a pass.
67                @param newRays the newly cast rays
68                @param sampleContributions returns the accumulated contribution of the samples
69                @param contributingSamples returns the samples contributing to pvs
70        */
71       
72        void ProcessViewCells(const RayContainer &newRays,
73                                                  const ObjectContainer &objects,
74                                                  int &sampleContributions,
75                                                  int &contributingSamples);
76
77        /**
78                Returns random node as target for the current sample ray.
79        */
80        KdNode *GetNodeToSample(Intersectable *object);
81
82
83protected:
84
85
86        int mPass;
87        int mSamplesPerPass;
88        int mTotalSamples;
89       
90        ofstream mStats;
91        ObjectContainer mObjects;
92
93        RayContainer mSampleRays;
94        VssRayContainer mVssSampleRays;
95};
96
97#endif
Note: See TracBrowser for help on using the repository browser.