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

Revision 372, 2.4 KB checked in by bittner, 19 years ago (diff)

preparation for vss preprocessor. converted all .cpp and .h to dos new line format

Line 
1#ifndef _SamplingPreprocessor_H__
2#define _SamplingPreprocessor_H__
3
4#include <fstream>
5using namespace std;
6
7#include "Preprocessor.h"
8
9
10/** Sampling based visibility preprocessing. The implementation is based on heuristical
11    sampling of view space */
12class SamplingPreprocessor : public Preprocessor {
13public:
14        int mPass;
15
16  int mSamplesPerPass;
17  int mTotalSamples;
18  int mKdPvsDepth;
19  ofstream mStats;
20  ObjectContainer mObjects;
21  RayContainer mSampleRays;
22  int mBspConstructionSamples;
23  int mPostProcessSamples;
24       
25  SamplingPreprocessor();
26
27  ~SamplingPreprocessor();
28
29  virtual bool ComputeVisibility();
30
31  void
32  SetupRay(Ray &ray,
33                   const Vector3 &point,
34                   const Vector3 &direction,
35                   const int type);
36
37  KdNode *
38  GetNodeForPvs(KdLeaf *leaf);
39
40        int
41        AddNodeSamples(const Ray &ray,
42                                                                 Intersectable *sObject,
43                                                                 Intersectable *tObject
44                                                                 );
45
46  void
47  HoleSamplingPass();
48
49        int
50        CastRay(Intersectable *object,
51                                        Ray &ray);
52       
53        KdNode *
54        GetNodeToSample(Intersectable *object);
55        void
56        VerifyVisibility(Intersectable *object);
57
58        int
59        CastEdgeSamples(
60                                                                        Intersectable *object,
61                                                                        const Vector3 &point,
62                                                                        MeshInstance *mi,
63                                                                        const int samples
64                                                                        );
65
66        /** Processes the BSP based view cells during a pass.
67               
68                @param ray the current ray
69                @param object the currently processed object
70                @param faceIndex the sampled face of the object
71                @param contributingSamples samples contributing to pvs
72                @param sampleContributions contribution of the samples
73
74                @returns true if BSP tree has been constructed, false if not yet
75
76        */
77        bool ProcessBspViewCells(Ray &ray,
78                                                         Intersectable *object,
79                                                         int faceIndex,
80                                                         int &contributingSamples,
81                                                         int &sampleContributions);
82
83        /** Adds objects samples to bsp view cells.
84        */
85        int AddObjectSamples(Intersectable *obj, const Ray &ray);
86
87        bool BuildBspTree();
88
89        void ExportSplits(const ObjectContainer &objects);
90
91        void ExportBspPvs(const ObjectContainer &objects);
92
93        /** Post processes view cells (i.e., merges or subdivides view cells based
94                on the PVS and the ray sets.
95                @returns number of merged view cells.
96        */
97        int PostprocessViewCells(const RayContainer &rays);
98
99        /** Simulated rendering using a simple render heuristics. Used to evaluate the
100                quality of the view cell partition.
101        */
102        Real EvaluateRenderHeuristics();
103};
104
105
106
107#endif
Note: See TracBrowser for help on using the repository browser.