source: GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.h @ 1737

Revision 1737, 2.7 KB checked in by bittner, 18 years ago (diff)

visibility filter updates

Line 
1#ifndef _RssPreprocessor_H__
2#define _RssPreprocessor_H__
3
4#include <fstream>
5using namespace std;
6
7#include "Preprocessor.h"
8#include "VssRay.h"
9
10namespace GtpVisibilityPreprocessor {
11
12
13class RssTree;
14class RssTreeLeaf;
15
16  class SamplingDistribution {
17  public:
18        SamplingDistribution() {}
19        SamplingDistribution(const int t):mType(t) {}
20        int mType;
21        int mRays;
22        float mContribution;
23        float mTime;
24  };
25 
26/** Sampling based visibility preprocessing. The implementation is
27        based on heuristical sampling of view space
28*/
29class RssPreprocessor : public Preprocessor {
30 
31public:
32  vector<SamplingDistribution> mDistributions;
33  int mSamplesPerPass;
34  int mRssSamplesPerPass;
35  int mInitialSamples;
36  int mRssSamples;
37  bool mUseImportanceSampling;
38
39  bool mExportPvs;
40  bool mExportRssTree;
41  bool mExportRays;
42  int mExportNumRays;
43
44  bool mUseViewcells;
45  bool mUpdateSubdivision;
46
47  bool mObjectBasedSampling;
48  bool mDirectionalSampling;
49 
50  //AxisAlignedBox3 *mViewSpaceBox;
51
52 
53  ofstream mStats;
54  RssTree *mRssTree;
55
56  // rays cast during the processing
57  VssRayContainer mVssRays;
58       
59   /// if initial samples should be loaded from file
60  bool mLoadInitialSamples;
61  /// if initial samples should be stored in file
62  bool mStoreInitialSamples;
63
64  RssPreprocessor();
65  ~RssPreprocessor();
66
67  virtual bool ComputeVisibility();
68
69#if 0 // matt:: moved up into preprocessor
70  int
71  CastRay(
72                  Vector3 &viewPoint,
73                  Vector3 &direction,
74                  const float probability,
75                  VssRayContainer &vssRays
76                  );
77#endif         
78  virtual bool BuildBspTree() { return false; }
79 
80
81  bool
82  ExportRays(const char *filename,
83                         const VssRayContainer &vssRays,
84                         const int number
85                         );
86
87  bool
88  ExportRayAnimation(const char *filename,
89                                         const vector<VssRayContainer> &vssRays
90                                         );
91
92  void
93  ExportObjectRays(VssRayContainer &rays,
94                                   const int objectId);
95       
96  int
97  GenerateImportanceRays(RssTree *vssTree,
98                                                 const int desiredSamples,
99                                                 SimpleRayContainer &rays
100                                                 );
101
102
103  bool
104  ExportRssTreeLeaf(char *filename,
105                                        RssTree *tree,
106                                        RssTreeLeaf *leaf);
107
108  void
109  ExportRssTreeLeaves(RssTree *tree, const int number);
110       
111
112  bool
113  ExportRssTree(char *filename,
114                                RssTree *tree,
115                                const Vector3 &dir
116                                );
117
118
119  float
120  GetAvgPvsSize(RssTree *tree,
121                                const vector<AxisAlignedBox3> &viewcells
122                                );
123 
124
125  void
126  ExportPvs(char *filename,
127                        RssTree *rssTree
128                        );
129
130
131  void
132  ComputeRenderError();
133
134  /** Redefininition of the get sample rays method from the preprocessor */
135  bool
136  GenerateRays(
137                           const int number,
138                           const int sampleType,
139                           SimpleRayContainer &rays
140                           );
141
142};
143
144
145};
146
147#endif
Note: See TracBrowser for help on using the repository browser.