ScummVM API documentation
SectorVisibility.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_SECTOR_VISIBILTY_H
29 #define HPL_SECTOR_VISIBILTY_H
30 
31 #include "hpl1/engine/math/BoundingVolume.h"
32 #include "hpl1/engine/math/Frustum.h"
33 
34 namespace hpl {
35 
36 class cPortal;
37 class cSector;
38 class cPortalContainer;
39 class cSectorVisibilityContainer;
40 
41 enum eSectorVisibilityType {
42  eSectorVisibilityType_BV,
43  eSectorVisibilityType_Frustum,
44 };
45 
46 //----------------------------------------------------
47 
52 public:
55 
56  cShadowVolumeBV mShadow;
57  cPortal *mpPortal;
58  bool mbNullShadow;
59 };
60 
61 //----------------------------------------------------
62 
68  friend class cSectorVisibilityContainer;
69 
70 public:
73 
74  cPortalVisibilitySet *GetParent() { return mpParent; }
75 
76  inline cPortalVisibility *GetVisibility(size_t alIdx) { return mvVisibility[alIdx]; }
77  inline size_t GetVisibilityNum() { return mvVisibility.size(); }
78 
79  bool PortalExists(cPortal *apPortal);
80 
81  int AddPortalVisibility(cPortal *apPortal);
82 
83 private:
85  cPortalVisibilitySet *mpParent;
86 
87  cSectorVisibilityContainer *mpContainer;
88 };
89 
90 //----------------------------------------------------
91 
96  friend class cSectorVisibilityContainer;
97 
98 public:
101 
102  bool PortalExists(cPortal *apPortal);
103 
104  cPortalVisibilitySet *GetSetConnectingFromSector(cSector *apSector);
105 
106  void AddVisibilitySet(cPortalVisibilitySet *apSet);
107 
108  cSector *GetSector() const { return mpSector; }
109 
110  bool IntersectionBV(cBoundingVolume *apBV);
111 
112 private:
113  cSector *mpSector;
115  bool bStart;
116 
117  cSectorVisibilityContainer *mpContainer;
118 };
119 
121 typedef tSectorVisibilityMap::iterator tSectorVisibilityMapIt;
122 
123 //----------------------------------------------------
124 
127 
129 typedef tSectorSet::iterator tSectorSetIt;
130 
132 
137 public:
138  cSectorVisibilityContainer(eSectorVisibilityType aType);
140 
141  void SetFrustum(const cFrustum &aFrustum) { mFrustum = aFrustum; }
142  void SetBV(const cBoundingVolume &aBV) { mBoundingVolume = aBV; }
143 
144  const cVector3f &GetOrigin() { return mvOrigin; }
145 
146  void Compute(cPortalContainer *apContainer);
147 
148  cPortalVisibilitySet *CreatePortalVisibiltySet(cPortalVisibilitySet *apParent);
149 
150  cSectorVisibility *GetSectorVisibilty(cSector *apSector);
151 
152  tSectorVisibilityIterator GetSectorIterator();
153 
154  bool IntersectionBV(cBoundingVolume *apBV, cPortalVisibilitySet *apSet);
155 
156  bool mbLog;
157 
158 private:
159  void SearchSector(cSector *apSector, cPortalVisibilitySet *apParentSet, int alPortalIndex);
160 
161  tString GetTabs();
162 
163  // cPortalContainer *mpContainer;
164 
165  tSectorSet m_setStartSectors;
166 
167  tSectorVisibilityMap m_mapSectors;
168  eSectorVisibilityType mType;
169 
170  tPortalVisibilitySetList mlstPortalVisibilty;
171 
172  cVector3f mvOrigin;
173  cBoundingVolume mBoundingVolume;
174  cFrustum mFrustum;
175 
176  int mlTabs;
177 };
178 
179 //----------------------------------------------------
180 
181 } // namespace hpl
182 
183 #endif // HPL_SECTOR_VISIBILTY_H
Definition: PortalContainer.h:181
Definition: AI.h:36
Definition: str.h:59
Definition: SectorVisibility.h:95
Definition: SystemTypes.h:467
Definition: array.h:52
typename TreeT::BasicIterator iterator
Definition: stablemap.h:48
Definition: BoundingVolume.h:71
Definition: SectorVisibility.h:67
Definition: BoundingVolume.h:57
Definition: PortalContainer.h:125
Definition: SectorVisibility.h:51
Definition: SectorVisibility.h:136
Definition: list_intern.h:51
Definition: PortalContainer.h:229
Definition: Frustum.h:57