[219] | 1 | #ifndef _ViewCell_H__ |
---|
| 2 | #define _ViewCell_H__ |
---|
| 3 | |
---|
[224] | 4 | #include "Intersectable.h" |
---|
[235] | 5 | #include "Containers.h" |
---|
[224] | 6 | |
---|
[219] | 7 | class Mesh; |
---|
| 8 | |
---|
| 9 | //namespace GtpVisibilityPreprocessor { |
---|
| 10 | |
---|
[221] | 11 | class BspInterior; |
---|
[220] | 12 | class BspPvs; |
---|
[261] | 13 | struct Triangle3; |
---|
[219] | 14 | /** |
---|
| 15 | View cell represented as a mesh |
---|
| 16 | */ |
---|
[224] | 17 | class ViewCell: public Intersectable |
---|
[219] | 18 | { |
---|
| 19 | public: |
---|
[265] | 20 | ViewCell(); |
---|
[220] | 21 | /** Default constructor taking a mesh which represents the shape of |
---|
| 22 | the viewcell. |
---|
| 23 | */ |
---|
[235] | 24 | ViewCell(Mesh *mesh); |
---|
[219] | 25 | |
---|
[220] | 26 | /** Returns pointer to the mesh which represents the shape of the viewcell. |
---|
| 27 | */ |
---|
[235] | 28 | Mesh *GetMesh(); |
---|
[219] | 29 | |
---|
[220] | 30 | /** Returns pointer to PVS. |
---|
| 31 | @returns PVS, i.e., the visible BSP tree nodes. |
---|
| 32 | */ |
---|
[235] | 33 | BspPvs *GetPVS(); |
---|
[220] | 34 | |
---|
[235] | 35 | AxisAlignedBox3 GetBox();
|
---|
[224] | 36 |
|
---|
[235] | 37 | int CastRay(Ray &ray);
|
---|
[224] | 38 |
|
---|
[235] | 39 | bool IsConvex(); |
---|
| 40 | bool IsWatertight(); |
---|
| 41 | float IntersectionComplexity(); |
---|
[224] | 42 | |
---|
[235] | 43 | int Type() const;
|
---|
[224] | 44 |
|
---|
[235] | 45 | void GetRandomSurfacePoint(Vector3 &point, Vector3 &normal); |
---|
[224] | 46 | |
---|
[235] | 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 |
---|
[268] | 50 | @param maxViewCells the maximum number of viewcells created. if 0 => unbounded |
---|
[235] | 51 | */ |
---|
| 52 | static void DeriveViewCells(const ObjectContainer &objects, |
---|
| 53 | ViewCellContainer &viewCells, |
---|
[239] | 54 | const int maxViewCells); |
---|
[260] | 55 | |
---|
[261] | 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 | |
---|
[219] | 62 | protected: |
---|
| 63 | |
---|
[235] | 64 | /// the mesh defining the geometry of this viewcell |
---|
[219] | 65 | Mesh *mMesh; |
---|
[220] | 66 | /// the PVS (i.e., the visible bsp tree nodes) |
---|
| 67 | BspPvs *mPvs; |
---|
[219] | 68 | |
---|
| 69 | }; |
---|
[262] | 70 | |
---|
[219] | 71 | //}; // GtpVisibilityPreprocessor |
---|
| 72 | |
---|
| 73 | #endif |
---|