source: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.h @ 352

Revision 352, 1.9 KB checked in by mattausch, 19 years ago (diff)
Line 
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 
10class BspInterior;
11class BspPvs;
12struct Triangle3;
13
14/**
15        View cell with an optional mesh representation
16*/
17class ViewCell: public MeshInstance
18{
19public:
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 based on some criteria
51                @returns new view cell if merge was success. NULL if merge failed.
52        */
53        static ViewCell *MergeViewCells(const ViewCell &front, const ViewCell &back);
54
55
56        /// Ray set description of the rays passing through this node. 
57        PassingRaySet mPassingRays;
58
59        /// Rays piercing this view cell.
60        RayContainer mPiercingRays;
61
62protected:
63       
64        /** Merges view cell with other view cell if certain criteria are met.
65                @note because of performance issues the precondition is that the piercing rays are ordered.
66        */
67        ViewCell *Merge(const ViewCell &other) const;
68
69        /// the potentially visible objects
70        ViewCellPvs mPvs;
71};
72
73//}; // GtpVisibilityPreprocessor
74
75#endif
Note: See TracBrowser for help on using the repository browser.