Changeset 260 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
- Timestamp:
- 09/08/05 01:52:52 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r242 r260 13 13 class Polygon3; 14 14 class AxisAlignedBox3; 15 15 class Ray; 16 16 17 17 //namespace GtpVisibilityPreprocessor { … … 19 19 /** Container storing a soup of polygons used during BSP tree construction 20 20 */ 21 typedef std::vector<Polygon3 *> PolygonContainer; 21 typedef vector<Polygon3 *> PolygonContainer; 22 typedef vector<Ray *> RayContainer; 22 23 23 24 struct BspRayTraversalData … … 125 126 void SetParent(BspInterior *parent); 126 127 128 PolygonContainer *GetPolygons(); 129 127 130 protected: 128 131 129 132 /// parent of this node 130 133 BspInterior *mParent; 134 135 PolygonContainer mPolygons; 131 136 }; 132 137 … … 158 163 */ 159 164 void SplitPolygons(PolygonContainer *polys, PolygonContainer *frontPolys, 160 PolygonContainer *backPolys, int &splits );165 PolygonContainer *backPolys, int &splits, bool storePolys = false); 161 166 162 167 friend ostream &operator<<(ostream &s, const BspInterior &A) … … 180 185 class BspLeaf : public BspNode 181 186 { 187 friend BspTree; 188 182 189 public: 183 190 BspLeaf(ViewCell *viewCell = NULL); 184 191 185 /** @return true since it is an interior node */ 192 /** @return true since it is an interior node 193 */ 186 194 bool IsLeaf() const; 195 /** Returns pointer from view cell. 196 */ 187 197 ViewCell *GetViewCell(); 198 /** Sets pointer to view cell. 199 */ 200 void SetViewCell(ViewCell *viewCell); 188 201 189 202 protected: 203 204 /** Helper function used to add remaining polygons to leaf. 205 */ 206 void AddPolygons(PolygonContainer *polys); 190 207 191 208 /// polygonal representation of this viewcell … … 222 239 223 240 /// BSP tree construction type 224 enum {VIEWCELLS, SCENE_GEOMETRY };241 enum {VIEWCELLS, SCENE_GEOMETRY, RAYS}; 225 242 226 243 /** Default constructor creating an empty tree. … … 232 249 const BspTreeStatistics &GetStatistics() const; 233 250 234 /** Constructs tree using the given list of view cells.235 A pointer to the appropriate view cell is stored within each leaf.251 /** Constructs tree using the given list of view cells. 252 A pointer to the appropriate view cell is stored within each leaf. 236 253 Many leafs can point to the same viewcell. 237 254 */ 238 255 void Construct(const ViewCellContainer &viewCells); 239 /** Constructs tree using the given list of objects. Each leaf is taken as viewcell. 240 No objects are treated as viewcells explicitly. 256 257 /** Constructs tree using the given list of objects. 258 Note that the objects are not taken as view cells, but the view cells are 259 constructed from the subdivision: Each leaf is taken as one viewcell; 241 260 242 261 @param objects list of objects 243 */ 244 void Construct(const ObjectContainer &objects); 262 @returns list of view cells. 263 */ 264 ViewCellContainer *Construct(const ObjectContainer &objects); 265 266 /** Constructs tree using the given number of rays 267 @param objects list of objects 268 @returns list of view cells. 269 */ 270 ViewCellContainer *Construct(const RayContainer &rays); 245 271 246 272 int CollectLeafPvs(); … … 255 281 */ 256 282 BspNode *GetRoot() const; 283 284 /** If the view cell polygons are stored in the nodes. 285 */ 286 bool StorePolys() const; 257 287 258 288 protected: 259 289 290 /** Initialises BSP tree. 291 @param maxPolygons the maximal polygon count before termination of 292 subdivision 293 @param maxDepth the maximal depth before termination of 294 subdivision 295 */ 296 void InitTree(int maxPolygons, int maxDepth); 297 298 /** Constructs the tree from the given list of polygons. 299 */ 300 void Construct(PolygonContainer *polys); 301 260 302 /** Evaluates plane classification with respect to the plane's 261 303 contribution for a balanced tree. … … 301 343 @param backPolys the polygons of the back child node as a result from splitting 302 344 */ 303 BspNode *SubdivideNode(BspLeaf *leaf, BspInterior *parent, 304 PolygonContainer *polys, const int depth, 305 ViewCell *viewCell, 306 PolygonContainer *frontPolys, PolygonContainer *backPolys); 345 BspNode *SubdivideNode(BspLeaf *leaf, 346 BspInterior *parent, 347 PolygonContainer *polys, 348 const int depth, 349 PolygonContainer *frontPolys, 350 PolygonContainer *backPolys); 307 351 308 352 /** Filters polygons down the tree. … … 321 365 Plane3 SelectPlaneHeuristics(PolygonContainer *polygons, int maxTests) const; 322 366 323 /** Extracts the meshes of the objects and copies them into the mesh. Also calculcates the bounding box of the tree. 367 /** Extracts the meshes of the objects and copies them into the mesh. 368 Adds object aabb to the aabb of the tree. 324 369 @param maxPolys the maximal number of objects to be stored as polygons 325 370 */ 326 371 void Copy2PolygonSoup(const ObjectContainer &objects, PolygonContainer &polys, int maxObjects); 372 /** Extracts the meshes of the view cells and copies them into the mesh. 373 Adds view cell aabb to the aabb of the tree. 374 @param maxPolys the maximal number of objects to be stored as polygons 375 */ 376 void Copy2PolygonSoup(const ViewCellContainer &viewCells, PolygonContainer &polys, int maxObjects); 327 377 328 378 /** Add this mesh as polygons to polygon container. … … 353 403 /// box around the whole view domain 354 404 AxisAlignedBox3 mBox; 405 406 /// if view cell calculation is incremential 407 bool mIsIncremential; 408 409 /// if polygons should be stored in the tree 410 bool mStorePolys; 355 411 356 412 public:
Note: See TracChangeset
for help on using the changeset viewer.