source: GTP/trunk/Lib/Vis/Preprocessing/src/Beam.h @ 2176

Revision 2176, 2.7 KB checked in by mattausch, 17 years ago (diff)

removed using namespace std from .h

  • Property svn:executable set to *
RevLine 
[505]1#ifndef __BEAM_H
2#define __BEAM_H
[504]3
4#include <vector>
[511]5#include "AxisAlignedBox3.h"
[531]6#include "Statistics.h"
[511]7
[504]8
[863]9namespace GtpVisibilityPreprocessor {
10
[504]11class KdNode;
12class Intersectable;
[540]13class Mesh;
[504]14
[860]15
[531]16// the values need for rss tree update computed already inside the glrendererbuffer
17// not all of them need to be computed
18class BeamSampleStatistics: public StatisticsBase
19{
20public:
21        enum {COMPUTE_PVS_SIZE, COMPUTE_RAY_CONTRIBUTIONS, COMPUTE_PVS_ENTROPY};
22        int flags;
23
24        BeamSampleStatistics(): flags(COMPUTE_RAY_CONTRIBUTIONS)
25        {
26                Reset();
27        }
28       
29        float pvsSize;
30        float rays;
31        float rayContributions;
32        float pvsEntropy;
33        float rayLengthEntropy;
34        float importance;
35       
36        float weightedRayContribution;
37
38        void Reset()
39        {
40                pvsSize = 0;
41                rays = 0;
42                rayContributions = 0;
43                pvsEntropy = 0;
44                rayLengthEntropy = 0;
45                importance = 0;
46        }
47
[2176]48        void Print(std::ostream &app) const;
[531]49
[2176]50        friend std::ostream &operator<<(std::ostream &s, const BeamSampleStatistics &stat)
[531]51        {
52                stat.Print(s);
53                return s;
54        } 
55};
56
57 
[512]58class Beam {
[504]59 
60public:                 
[532]61  enum {STORE_KD_NODES=1, STORE_OBJECTS=2, STORE_VIEW_CELLS, VALID=8};
[504]62  int mFlags;
63 
64  // list of nodes intersected by the frustum
65  vector<KdNode *> mKdNodes;
[513]66  // list of objects intersected by the frustum
67  ObjectContainer mObjects;
68  // view cells intersected by frustum
69  ViewCellContainer mViewCells;
[504]70
71  // spatial box
72  AxisAlignedBox3 mBox;
73  // directional box (it is actually a 2D box - only x and y ranges are valid)
74  // directional parametrization according to VssRay::GetDirParametrization
75  AxisAlignedBox3 mDirBox;
76
77  vector<Plane3> mPlanes;
[507]78
[540]79  Mesh *mMesh;
[511]80   
[540]81  /** Constructs a beam from a spatial and a directional box.
82  */
[511]83  void Construct(const AxisAlignedBox3 &box,
[540]84                             const AxisAlignedBox3 &dBox);
[511]85 
[540]86  /** Computes parameters for glFrustum.
87  */
88  void ComputePerspectiveFrustum(float &left, float &right,
89                                                                 float &bottom, float &top,
90                                                                 float &near, float &far,
91                                                                 const AxisAlignedBox3 &sceneBBox) const;
[511]92
[542]93  /** Computes parameters for glOrtho.
[540]94  */
95  void ComputeOrthoFrustum(float &left, float &right,
96                                                   float &bottom, float &top,
97                                                   float &near, float &far,
98                                                   const AxisAlignedBox3 &sceneBBox) const;
99
[522]100  int ComputeIntersection(const AxisAlignedBox3 &box);
101
[525]102  Vector3 GetMainDirection() const;
103
[507]104  bool IsValid() { return mFlags & VALID; }
105  bool SetValid() { return mFlags |= VALID; }
106
[540]107  Beam():mFlags(STORE_KD_NODES+STORE_OBJECTS), mKdNodes(0), mObjects(0), mViewCells(0), mMesh(NULL)
[504]108  {
109  }
[540]110
[542]111  ~Beam();
112
113  /** Creates beam mesh bounded at zfar.
114  */
[540]115  void CreateMesh(const float zfar);
[504]116};
117
[860]118}
[504]119
120#endif
Note: See TracBrowser for help on using the repository browser.