1 | #ifndef _ViewCell_H__ |
---|
2 | #define _ViewCell_H__ |
---|
3 | |
---|
4 | #include "Intersectable.h" |
---|
5 | #include "Containers.h" |
---|
6 | |
---|
7 | class Mesh; |
---|
8 | |
---|
9 | //namespace GtpVisibilityPreprocessor { |
---|
10 | |
---|
11 | class BspInterior; |
---|
12 | class BspPvs; |
---|
13 | struct Triangle3; |
---|
14 | /** |
---|
15 | View cell represented as a mesh |
---|
16 | */ |
---|
17 | class ViewCell: public Intersectable |
---|
18 | { |
---|
19 | public: |
---|
20 | ViewCell(); |
---|
21 | /** Default constructor taking a mesh which represents the shape of |
---|
22 | the viewcell. |
---|
23 | */ |
---|
24 | ViewCell(Mesh *mesh); |
---|
25 | |
---|
26 | /** Returns pointer to the mesh which represents the shape of the viewcell. |
---|
27 | */ |
---|
28 | Mesh *GetMesh(); |
---|
29 | |
---|
30 | /** Returns pointer to PVS. |
---|
31 | @returns PVS, i.e., the visible BSP tree nodes. |
---|
32 | */ |
---|
33 | BspPvs *GetPVS(); |
---|
34 | |
---|
35 | AxisAlignedBox3 GetBox();
|
---|
36 |
|
---|
37 | int CastRay(Ray &ray);
|
---|
38 |
|
---|
39 | bool IsConvex(); |
---|
40 | bool IsWatertight(); |
---|
41 | float IntersectionComplexity(); |
---|
42 | |
---|
43 | int Type() const;
|
---|
44 |
|
---|
45 | void GetRandomSurfacePoint(Vector3 &point, Vector3 &normal); |
---|
46 | |
---|
47 | /** Derives viewcells from object container. |
---|
48 | @param objects the intersectables the viewcells are derived from |
---|
49 | @param viewCells the viewcells are returned in this container |
---|
50 | @param maxViewCells the maximum number of viewcells created. if 0 => unbounded |
---|
51 | */ |
---|
52 | static void DeriveViewCells(const ObjectContainer &objects, |
---|
53 | ViewCellContainer &viewCells, |
---|
54 | const int maxViewCells); |
---|
55 | |
---|
56 | /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector. |
---|
57 | @param the base triangle |
---|
58 | @param the height of the newly created view cell |
---|
59 | */ |
---|
60 | static ViewCell *ExtrudeViewCell(const Triangle3 &baseTri, const float height); |
---|
61 | |
---|
62 | protected: |
---|
63 | |
---|
64 | /// the mesh defining the geometry of this viewcell |
---|
65 | Mesh *mMesh; |
---|
66 | /// the PVS (i.e., the visible bsp tree nodes) |
---|
67 | BspPvs *mPvs; |
---|
68 | |
---|
69 | }; |
---|
70 | |
---|
71 | //}; // GtpVisibilityPreprocessor |
---|
72 | |
---|
73 | #endif |
---|