1 | #ifndef _ViewCell_H__ |
---|
2 | #define _ViewCell_H__ |
---|
3 | |
---|
4 | #include "Mesh.h" |
---|
5 | #include "Containers.h" |
---|
6 | #include "Ray.h" |
---|
7 | |
---|
8 | //namespace GtpVisibilityPreprocessor { |
---|
9 | |
---|
10 | class BspInterior; |
---|
11 | class BspPvs; |
---|
12 | struct Triangle3; |
---|
13 | |
---|
14 | /** |
---|
15 | View cell with an optional mesh representation |
---|
16 | */ |
---|
17 | class ViewCell: public MeshInstance |
---|
18 | { |
---|
19 | public: |
---|
20 | ViewCell(); |
---|
21 | /** Constructor taking a mesh representing the shape of the viewcell. |
---|
22 | */ |
---|
23 | ViewCell(Mesh *mesh); |
---|
24 | /** Returns PvS. |
---|
25 | */ |
---|
26 | ViewCellPvs &GetPvs(); |
---|
27 | |
---|
28 | int Type() const; |
---|
29 | |
---|
30 | /** Derives viewcells from object container. |
---|
31 | @param objects the intersectables the viewcells are derived from |
---|
32 | @param viewCells the viewcells are returned in this container |
---|
33 | @param maxViewCells the maximum number of viewcells created. if 0 => unbounded |
---|
34 | */ |
---|
35 | static void DeriveViewCells(const ObjectContainer &objects, |
---|
36 | ViewCellContainer &viewCells, |
---|
37 | const int maxViewCells); |
---|
38 | |
---|
39 | |
---|
40 | /** Adds a passing ray to the passing ray container. |
---|
41 | */ |
---|
42 | void AddPassingRay(const Ray &ray, const int contributions); |
---|
43 | |
---|
44 | /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector. |
---|
45 | @param the base triangle |
---|
46 | @param the height of the newly created view cell |
---|
47 | */ |
---|
48 | static ViewCell *ExtrudeViewCell(const Triangle3 &baseTri, const float height); |
---|
49 | |
---|
50 | /** Merges two view cells. |
---|
51 | @note the piercing rays of the front and back will be ordered |
---|
52 | @returns new view cell based on the merging. |
---|
53 | */ |
---|
54 | static ViewCell *Merge(ViewCell &front, ViewCell &back); |
---|
55 | |
---|
56 | |
---|
57 | /// Ray set description of the rays passing through this node. |
---|
58 | PassingRaySet mPassingRays; |
---|
59 | |
---|
60 | /// Rays piercing this view cell. |
---|
61 | RayContainer mPiercingRays; |
---|
62 | |
---|
63 | protected: |
---|
64 | |
---|
65 | /// the potentially visible objects |
---|
66 | ViewCellPvs mPvs; |
---|
67 | }; |
---|
68 | |
---|
69 | //}; // GtpVisibilityPreprocessor |
---|
70 | |
---|
71 | #endif |
---|