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 | /** Default constructor taking a mesh which represents the shape of |
---|
21 | the viewcell. |
---|
22 | */ |
---|
23 | ViewCell(Mesh *mesh); |
---|
24 | |
---|
25 | /** Returns pointer to the mesh which represents the shape of the viewcell. |
---|
26 | */ |
---|
27 | Mesh *GetMesh(); |
---|
28 | |
---|
29 | /** Returns pointer to PVS. |
---|
30 | @returns PVS, i.e., the visible BSP tree nodes. |
---|
31 | */ |
---|
32 | BspPvs *GetPVS(); |
---|
33 | |
---|
34 | AxisAlignedBox3 GetBox();
|
---|
35 |
|
---|
36 | int CastRay(Ray &ray);
|
---|
37 |
|
---|
38 | bool IsConvex(); |
---|
39 | bool IsWatertight(); |
---|
40 | float IntersectionComplexity(); |
---|
41 | |
---|
42 | int Type() const;
|
---|
43 |
|
---|
44 | void GetRandomSurfacePoint(Vector3 &point, Vector3 &normal); |
---|
45 | |
---|
46 | /** Derives viewcells from object container. |
---|
47 | @param objects the intersectables the viewcells are derived from |
---|
48 | @param viewCells the viewcells are returned in this container |
---|
49 | @param maxViewCells if > 0, indicates the maximim number of viewcells that will be created |
---|
50 | */ |
---|
51 | static void DeriveViewCells(const ObjectContainer &objects, |
---|
52 | ViewCellContainer &viewCells, |
---|
53 | const int maxViewCells); |
---|
54 | |
---|
55 | /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector. |
---|
56 | @param the base triangle |
---|
57 | @param the height of the newly created view cell |
---|
58 | */ |
---|
59 | static ViewCell *ExtrudeViewCell(const Triangle3 &baseTri, const float height); |
---|
60 | |
---|
61 | protected: |
---|
62 | |
---|
63 | /// the mesh defining the geometry of this viewcell |
---|
64 | Mesh *mMesh; |
---|
65 | /// the PVS (i.e., the visible bsp tree nodes) |
---|
66 | BspPvs *mPvs; |
---|
67 | |
---|
68 | }; |
---|
69 | |
---|
70 | //}; // GtpVisibilityPreprocessor |
---|
71 | |
---|
72 | #endif |
---|