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

RevLine 
[373]1#ifndef _SamplingPreprocessor_H__
2#define _SamplingPreprocessor_H__
3
4#include <fstream>
5using namespace std;
6
7#include "Preprocessor.h"
[411]8#include "VssRay.h"
[373]9
[426]10class Exporter;
11
[373]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
[411]22
[373]23protected:
[440]24        /** Sets up ray for sampling.
25        */
[373]26  void
27  SetupRay(Ray &ray,
28                   const Vector3 &point,
29                   const Vector3 &direction,
[440]30                         const int type,
31                         const Ray::Intersection &source);
[373]32
[440]33        /** Refined sampling for finding "holes", i.e., difficult visibility.
34        */
[373]35  void
36  HoleSamplingPass();
37
[440]38        /** Casts a bundle of sample rays into the scene.
[441]39                @param sampleContributions the number of sample contributions
40                @param contributingSamples the number of samples contributing
[440]41        */
[441]42        void
43        CastRays(const RayContainer &rays,
44                         int &sampleContributions,
45                         int &contributingSamples);
[440]46       
[441]47        /** Casts a single ray into the scene.
48                @returns sample contributions
[440]49        */
[441]50        int CastRay(Ray &ray);
[373]51       
[440]52        /** Verify if the exact visibility for this object was established.
53        */
[373]54        void
55        VerifyVisibility(Intersectable *object);
56
[440]57        /** Sample the shiluette of objects in order to find visibility changes
58                along the visibility skeleton.
59        */
[441]60        int
61        CastEdgeSamples(
62                                        Intersectable *object,
63                                        const Vector3 &point,
64                                        MeshInstance *mi,
65                                        const int samples
66                                        );
[373]67
[440]68        /** Processes the view cells during a pass.
[441]69                @param newRays the newly cast rays
70                @param sampleContributions returns the accumulated contribution of the samples
[440]71                @param contributingSamples returns the samples contributing to pvs
[441]72        */
[440]73       
[441]74        void ProcessViewCells(const RayContainer &newRays,
[440]75                                                  const ObjectContainer &objects,
[441]76                                                  int &sampleContributions,
77                                                  int &contributingSamples);
[411]78
[439]79        /** Adds objects samples to kd and bsp view cells.
[373]80        */
81        int AddObjectSamples(Intersectable *obj, const Ray &ray);
82
[440]83        /**
84                Returns random node as target for the current sample ray.
[373]85        */
[440]86        KdNode *GetNodeToSample(Intersectable *object);
[411]87
[440]88
[411]89protected:
[428]90
91
[411]92        int mPass;
93        int mSamplesPerPass;
94        int mTotalSamples;
[440]95       
[411]96        ofstream mStats;
97        ObjectContainer mObjects;
98
99        RayContainer mSampleRays;
[440]100        VssRayContainer mVssSampleRays;
[373]101};
102
103#endif
Note: See TracBrowser for help on using the repository browser.