Pyrogenesis  trunk
ICmpObstructionManager.h
Go to the documentation of this file.
1 /* Copyright (C) 2017 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_ICMPOBSTRUCTIONMANAGER
19 #define INCLUDED_ICMPOBSTRUCTIONMANAGER
20 
22 
24 
25 #include "maths/FixedVector2D.h"
26 
28 
29 /**
30  * Obstruction manager: provides efficient spatial queries over objects in the world.
31  *
32  * The class deals with two types of shape:
33  * "static" shapes, typically representing buildings, which are rectangles with a given
34  * width and height and angle;
35  * and "unit" shapes, representing units that can move around the world, which have a
36  * radius and no rotation. (Units sometimes act as axis-aligned squares, sometimes
37  * as approximately circles, due to the algorithm used by the short pathfinder.)
38  *
39  * Other classes (particularly ICmpObstruction) register shapes with this interface
40  * and keep them updated.
41  *
42  * The @c Test functions provide exact collision tests.
43  * The edge of a shape counts as 'inside' the shape, for the purpose of collisions.
44  * The functions accept an IObstructionTestFilter argument, which can restrict the
45  * set of shapes that are counted as collisions.
46  *
47  * Units can be marked as either moving or stationary, which simply determines whether
48  * certain filters include or exclude them.
49  *
50  * The @c Rasterize function approximates the current set of shapes onto a 2D grid,
51  * for use with tile-based pathfinding.
52  */
54 {
55 public:
56  /**
57  * External identifiers for shapes.
58  * (This is a struct rather than a raw u32 for type-safety.)
59  */
60  struct tag_t
61  {
62  tag_t() : n(0) {}
63  explicit tag_t(u32 n) : n(n) {}
64  bool valid() const { return n != 0; }
65 
66  u32 n;
67  };
68 
69  /**
70  * Boolean flags affecting the obstruction behaviour of a shape.
71  */
72  enum EFlags
73  {
74  FLAG_BLOCK_MOVEMENT = (1 << 0), // prevents units moving through this shape
75  FLAG_BLOCK_FOUNDATION = (1 << 1), // prevents foundations being placed on this shape
76  FLAG_BLOCK_CONSTRUCTION = (1 << 2), // prevents buildings being constructed on this shape
77  FLAG_BLOCK_PATHFINDING = (1 << 3), // prevents the tile pathfinder choosing paths through this shape
78  FLAG_MOVING = (1 << 4) // indicates this unit is currently moving
79  };
80 
81  /**
82  * Bitmask of EFlag values.
83  */
84  typedef u8 flags_t;
85 
86  /**
87  * Set the bounds of the world.
88  * Any point outside the bounds is considered obstructed.
89  * @param x0,z0,x1,z1 Coordinates of the corners of the world
90  */
91  virtual void SetBounds(entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1) = 0;
92 
93  /**
94  * Register a static shape.
95  *
96  * @param ent entity ID associated with this shape (or INVALID_ENTITY if none)
97  * @param x,z coordinates of center, in world space
98  * @param a angle of rotation (clockwise from +Z direction)
99  * @param w width (size along X axis)
100  * @param h height (size along Z axis)
101  * @param flags a set of EFlags values
102  * @param group primary control group of the shape. Must be a valid control group ID.
103  * @param group2 Optional; secondary control group of the shape. Defaults to INVALID_ENTITY.
104  * @return a valid tag for manipulating the shape
105  * @see StaticShape
106  */
108  entity_pos_t w, entity_pos_t h, flags_t flags, entity_id_t group, entity_id_t group2 = INVALID_ENTITY) = 0;
109 
110  /**
111  * Register a unit shape.
112  *
113  * @param ent entity ID associated with this shape (or INVALID_ENTITY if none)
114  * @param x,z coordinates of center, in world space
115  * @param clearance pathfinding clearance of the unit (works as a radius)
116  * @param flags a set of EFlags values
117  * @param group control group (typically the owner entity, or a formation controller entity
118  * - units ignore collisions with others in the same group)
119  * @return a valid tag for manipulating the shape
120  * @see UnitShape
121  */
123  flags_t flags, entity_id_t group) = 0;
124 
125  /**
126  * Adjust the position and angle of an existing shape.
127  * @param tag tag of shape (must be valid)
128  * @param x X coordinate of center, in world space
129  * @param z Z coordinate of center, in world space
130  * @param a angle of rotation (clockwise from +Z direction); ignored for unit shapes
131  */
132  virtual void MoveShape(tag_t tag, entity_pos_t x, entity_pos_t z, entity_angle_t a) = 0;
133 
134  /**
135  * Set whether a unit shape is moving or stationary.
136  * @param tag tag of shape (must be valid and a unit shape)
137  * @param moving whether the unit is currently moving through the world or is stationary
138  */
139  virtual void SetUnitMovingFlag(tag_t tag, bool moving) = 0;
140 
141  /**
142  * Set the control group of a unit shape.
143  * @param tag tag of shape (must be valid and a unit shape)
144  * @param group control group entity ID
145  */
146  virtual void SetUnitControlGroup(tag_t tag, entity_id_t group) = 0;
147 
148  /**
149  * Sets the control group of a static shape.
150  * @param tag Tag of the shape to set the control group for. Must be a valid and static shape tag.
151  * @param group Control group entity ID.
152  */
153  virtual void SetStaticControlGroup(tag_t tag, entity_id_t group, entity_id_t group2) = 0;
154 
155  /**
156  * Remove an existing shape. The tag will be made invalid and must not be used after this.
157  * @param tag tag of shape (must be valid)
158  */
159  virtual void RemoveShape(tag_t tag) = 0;
160 
161  /**
162  * Collision test a flat-ended thick line against the current set of shapes.
163  * The line caps extend by @p r beyond the end points.
164  * Only intersections going from outside to inside a shape are counted.
165  * @param filter filter to restrict the shapes that are counted
166  * @param x0 X coordinate of line's first point
167  * @param z0 Z coordinate of line's first point
168  * @param x1 X coordinate of line's second point
169  * @param z1 Z coordinate of line's second point
170  * @param r radius (half width) of line
171  * @param relaxClearanceForUnits whether unit-unit collisions should be more permissive.
172  * @return true if there is a collision
173  */
174  virtual bool TestLine(const IObstructionTestFilter& filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, bool relaxClearanceForUnits) const = 0;
175 
176  /**
177  * Collision test a static square shape against the current set of shapes.
178  * @param filter filter to restrict the shapes that are being tested against
179  * @param x X coordinate of center
180  * @param z Z coordinate of center
181  * @param a angle of rotation (clockwise from +Z direction)
182  * @param w width (size along X axis)
183  * @param h height (size along Z axis)
184  * @param out if non-NULL, all colliding shapes' entities will be added to this list
185  * @return true if there is a collision
186  */
187  virtual bool TestStaticShape(const IObstructionTestFilter& filter,
189  std::vector<entity_id_t>* out) const = 0;
190 
191  /**
192  * Collision test a unit shape against the current set of registered shapes, and optionally writes a list of the colliding
193  * shapes' entities to an output list.
194  *
195  * @param filter filter to restrict the shapes that are being tested against
196  * @param x X coordinate of shape's center
197  * @param z Z coordinate of shape's center
198  * @param clearance clearance of the shape's unit
199  * @param out if non-NULL, all colliding shapes' entities will be added to this list
200  *
201  * @return true if there is a collision
202  */
203  virtual bool TestUnitShape(const IObstructionTestFilter& filter,
204  entity_pos_t x, entity_pos_t z, entity_pos_t clearance,
205  std::vector<entity_id_t>* out) const = 0;
206 
207  /**
208  * Convert the current set of shapes onto a navcell grid, for all passability classes contained in @p passClasses.
209  * If @p fullUpdate is false, the function will only go through dirty shapes.
210  * Shapes are expanded by the @p passClasses clearances, by ORing their masks onto the @p grid.
211  */
212  virtual void Rasterize(Grid<NavcellData>& grid, const std::vector<PathfinderPassability>& passClasses, bool fullUpdate) = 0;
213 
214  /**
215  * Gets dirtiness information and resets it afterwards. Then it's the role of CCmpPathfinder
216  * to pass the information to other components if needed. (AIs, etc.)
217  * The return value is false if an update is unnecessary.
218  */
219  virtual void UpdateInformations(GridUpdateInformation& informations) = 0;
220 
221  /**
222  * Standard representation for all types of shapes, for use with geometry processing code.
223  */
225  {
226  entity_pos_t x, z; // position of center
227  CFixedVector2D u, v; // 'horizontal' and 'vertical' orthogonal unit vectors, representing orientation
228  entity_pos_t hw, hh; // half width, half height of square
229  };
230 
231  /**
232  * Find all the obstructions that are inside (or partially inside) the given range.
233  * @param filter filter to restrict the shapes that are counted
234  * @param x0 X coordinate of left edge of range
235  * @param z0 Z coordinate of bottom edge of range
236  * @param x1 X coordinate of right edge of range
237  * @param z1 Z coordinate of top edge of range
238  * @param squares output list of obstructions
239  */
240  virtual void GetObstructionsInRange(const IObstructionTestFilter& filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector<ObstructionSquare>& squares) const = 0;
241  virtual void GetStaticObstructionsInRange(const IObstructionTestFilter& filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector<ObstructionSquare>& squares) const = 0;
242  virtual void GetUnitObstructionsInRange(const IObstructionTestFilter& filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector<ObstructionSquare>& squares) const = 0;
243 
244  /**
245  * Returns the entity IDs of all unit shapes that intersect the given
246  * obstruction square, filtering out using the given filter.
247  * @param square the Obstruction squre we want to compare with.
248  * @param out output list of obstructions
249  * @param filter filter for the obstructing units
250  * @param strict whether to be strict in the check or more permissive (ie rasterize more or less). Default false.
251  */
252  virtual void GetUnitsOnObstruction(const ObstructionSquare& square, std::vector<entity_id_t>& out, const IObstructionTestFilter& filter, bool strict = false) const = 0;
253 
254  /**
255  * Get the obstruction square representing the given shape.
256  * @param tag tag of shape (must be valid)
257  */
258  virtual ObstructionSquare GetObstruction(tag_t tag) const = 0;
259 
261 
263 
264  /**
265  * Set the passability to be restricted to a circular map.
266  */
267  virtual void SetPassabilityCircular(bool enabled) = 0;
268 
269  virtual bool GetPassabilityCircular() const = 0;
270 
271  /**
272  * Toggle the rendering of debug info.
273  */
274  virtual void SetDebugOverlay(bool enabled) = 0;
275 
276  DECLARE_INTERFACE_TYPE(ObstructionManager)
277 };
278 
279 /**
280  * Interface for ICmpObstructionManager @c Test functions to filter out unwanted shapes.
281  */
283 {
284 public:
287 
289 
290  /**
291  * Return true if the shape with the specified parameters should be tested for collisions.
292  * This is called for all shapes that would collide, and also for some that wouldn't.
293  *
294  * @param tag tag of shape being tested
295  * @param flags set of EFlags for the shape
296  * @param group the control group of the shape (typically the shape's unit, or the unit's formation controller, or 0)
297  * @param group2 an optional secondary control group of the shape, or INVALID_ENTITY if none specified. Currently
298  * exists only for static shapes.
299  */
300  virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const = 0;
301 };
302 
303 /**
304  * Obstruction test filter that will test against all shapes.
305  */
307 {
308 public:
309  virtual bool TestShape(tag_t UNUSED(tag), flags_t UNUSED(flags), entity_id_t UNUSED(group), entity_id_t UNUSED(group2)) const
310  {
311  return true;
312  }
313 };
314 
315 /**
316  * Obstruction test filter that will test only against stationary (i.e. non-moving) shapes.
317  */
319 {
320 public:
321  virtual bool TestShape(tag_t UNUSED(tag), flags_t flags, entity_id_t UNUSED(group), entity_id_t UNUSED(group2)) const
322  {
323  return !(flags & ICmpObstructionManager::FLAG_MOVING);
324  }
325 };
326 
327 /**
328  * Obstruction test filter that reject shapes in a given control group,
329  * and rejects shapes that don't block unit movement, and optionally rejects moving shapes.
330  */
332 {
335 
336 public:
338  m_AvoidMoving(avoidMoving), m_Group(group)
339  {}
340 
341  virtual bool TestShape(tag_t UNUSED(tag), flags_t flags, entity_id_t group, entity_id_t group2) const
342  {
343  if (group == m_Group || (group2 != INVALID_ENTITY && group2 == m_Group))
344  return false;
345 
347  return false;
348 
349  if ((flags & ICmpObstructionManager::FLAG_MOVING) && !m_AvoidMoving)
350  return false;
351 
352  return true;
353  }
354 };
355 
356 /**
357  * Obstruction test filter that will test only against shapes that:
358  * - are part of neither one of the specified control groups
359  * - AND, depending on the value of the 'exclude' argument:
360  * - have at least one of the specified flags set.
361  * - OR have none of the specified flags set.
362  *
363  * The first (primary) control group to reject shapes from must be specified and valid. The secondary
364  * control group to reject entities from may be set to INVALID_ENTITY to not use it.
365  *
366  * This filter is useful to e.g. allow foundations within the same control group to be placed and
367  * constructed arbitrarily close together (e.g. for wall pieces that need to link up tightly).
368  */
370 {
371  bool m_Exclude;
375 
376 public:
378  m_Exclude(exclude), m_Group(group1), m_Group2(group2), m_Mask(mask)
379  {
380  Init();
381  }
382 
384  m_Exclude(false), m_Group(group1), m_Group2(group2), m_Mask(mask)
385  {
386  Init();
387  }
388 
389  virtual bool TestShape(tag_t UNUSED(tag), flags_t flags, entity_id_t group, entity_id_t group2) const
390  {
391  // Don't test shapes that share one or more of our control groups.
392  if (group == m_Group || group == m_Group2 || (group2 != INVALID_ENTITY &&
393  (group2 == m_Group || group2 == m_Group2)))
394  return false;
395 
396  // If m_Exclude is true, don't test against shapes that have any of the
397  // obstruction flags specified in m_Mask.
398  if (m_Exclude)
399  return (flags & m_Mask) == 0;
400 
401  // Otherwise, only include shapes that match at least one flag in m_Mask.
402  return (flags & m_Mask) != 0;
403  }
404 private:
405  void Init()
406  {
407  // the primary control group to filter out must be valid
408  ENSURE(m_Group != INVALID_ENTITY);
409 
410  // for simplicity, if m_Group2 is INVALID_ENTITY (i.e. not used), then set it equal to m_Group
411  // so that we have fewer special cases to consider in TestShape().
412  if (m_Group2 == INVALID_ENTITY)
413  m_Group2 = m_Group;
414  }
415 };
416 
417 /**
418  * Obstruction test filter that will test only against shapes that:
419  * - are part of both of the specified control groups
420  * - AND have at least one of the specified flags set.
421  *
422  * The first (primary) control group to include shapes from must be specified and valid.
423  *
424  * This filter is useful for preventing entities with identical control groups
425  * from colliding e.g. building a new wall segment on top of an existing wall)
426  *
427  * @todo This filter needs test cases.
428  */
430 {
435 
436 public:
438  m_Tag(tag), m_Group(group1), m_Group2(group2), m_Mask(mask)
439  {
440  ENSURE(m_Group != INVALID_ENTITY);
441  }
442 
443  virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
444  {
445  // To be included in testing, a shape must not have the specified tag, and must
446  // match at least one of the flags in m_Mask, as well as both control groups.
447  return (tag.n != m_Tag.n && (flags & m_Mask) != 0 && ((group == m_Group
448  && group2 == m_Group2) || (group2 == m_Group && group == m_Group2)));
449  }
450 };
451 
452 /**
453  * Obstruction test filter that will test only against shapes that do not have the specified tag set.
454  */
456 {
458 public:
459  SkipTagObstructionFilter(tag_t tag) : m_Tag(tag)
460  {
461  }
462 
463  virtual bool TestShape(tag_t tag, flags_t UNUSED(flags), entity_id_t UNUSED(group), entity_id_t UNUSED(group2)) const
464  {
465  return tag.n != m_Tag.n;
466  }
467 };
468 
469 /**
470  * Obstruction test filter that will test only against shapes that:
471  * - do not have the specified tag
472  * - AND have at least one of the specified flags set.
473  */
475 {
478 public:
479  SkipTagRequireFlagsObstructionFilter(tag_t tag, flags_t mask) : m_Tag(tag), m_Mask(mask)
480  {
481  }
482 
483  virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t UNUSED(group), entity_id_t UNUSED(group2)) const
484  {
485  return (tag.n != m_Tag.n && (flags & m_Mask) != 0);
486  }
487 };
488 
489 #endif // INCLUDED_ICMPOBSTRUCTIONMANAGER
flags_t m_Mask
Definition: ICmpObstructionManager.h:477
Definition: IComponent.h:33
A simple fixed-point number class.
Definition: Fixed.h:115
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:429
Interface for ICmpObstructionManager Test functions to filter out unwanted shapes.
Definition: ICmpObstructionManager.h:282
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:369
u32 n
Definition: ICmpObstructionManager.h:66
tag_t()
Definition: ICmpObstructionManager.h:62
Definition: FixedVector2D.h:24
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
Definition: code_annotation.h:38
virtual void SetUnitControlGroup(tag_t tag, entity_id_t group)=0
Set the control group of a unit shape.
virtual tag_t AddUnitShape(entity_id_t ent, entity_pos_t x, entity_pos_t z, entity_pos_t clearance, flags_t flags, entity_id_t group)=0
Register a unit shape.
virtual tag_t AddStaticShape(entity_id_t ent, entity_pos_t x, entity_pos_t z, entity_angle_t a, entity_pos_t w, entity_pos_t h, flags_t flags, entity_id_t group, entity_id_t group2=INVALID_ENTITY)=0
Register a static shape.
tag_t m_Tag
Definition: ICmpObstructionManager.h:457
virtual void SetBounds(entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1)=0
Set the bounds of the world.
virtual void UpdateInformations(GridUpdateInformation &informations)=0
Gets dirtiness information and resets it afterwards.
SkipTagObstructionFilter(tag_t tag)
Definition: ICmpObstructionManager.h:459
virtual void SetPassabilityCircular(bool enabled)=0
Set the passability to be restricted to a circular map.
virtual void Init(const CParamNode &paramNode)=0
bool m_Exclude
Definition: ICmpObstructionManager.h:371
Obstruction test filter that reject shapes in a given control group, and rejects shapes that don&#39;t bl...
Definition: ICmpObstructionManager.h:331
virtual void GetUnitObstructionsInRange(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const =0
static void out(const wchar_t *fmt,...)
Definition: wdbg_sym.cpp:419
ControlGroupMovementObstructionFilter(bool avoidMoving, entity_id_t group)
Definition: ICmpObstructionManager.h:337
Definition: ICmpObstructionManager.h:74
SkipControlGroupsRequireFlagObstructionFilter(entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:383
bool m_AvoidMoving
Definition: ICmpObstructionManager.h:333
virtual bool TestStaticShape(const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, std::vector< entity_id_t > *out) const =0
Collision test a static square shape against the current set of shapes.
entity_id_t m_Group2
Definition: ICmpObstructionManager.h:433
Structure holding grid dirtiness informations, for clever updates.
Definition: Grid.h:208
tag_t(u32 n)
Definition: ICmpObstructionManager.h:63
entity_id_t m_Group
Definition: ICmpObstructionManager.h:432
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:483
Obstruction test filter that will test against all shapes.
Definition: ICmpObstructionManager.h:306
uint8_t u8
Definition: types.h:37
virtual bool TestLine(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, bool relaxClearanceForUnits) const =0
Collision test a flat-ended thick line against the current set of shapes.
virtual void Rasterize(Grid< NavcellData > &grid, const std::vector< PathfinderPassability > &passClasses, bool fullUpdate)=0
Convert the current set of shapes onto a navcell grid, for all passability classes contained in passC...
entity_id_t m_Group2
Definition: ICmpObstructionManager.h:373
Obstruction test filter that will test only against stationary (i.e.
Definition: ICmpObstructionManager.h:318
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:321
tag_t m_Tag
Definition: ICmpObstructionManager.h:476
virtual bool TestUnitShape(const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t clearance, std::vector< entity_id_t > *out) const =0
Collision test a unit shape against the current set of registered shapes, and optionally writes a lis...
virtual void GetUnitsOnObstruction(const ObstructionSquare &square, std::vector< entity_id_t > &out, const IObstructionTestFilter &filter, bool strict=false) const =0
Returns the entity IDs of all unit shapes that intersect the given obstruction square, filtering out using the given filter.
flags_t m_Mask
Definition: ICmpObstructionManager.h:374
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
Definition: debug.h:287
virtual void GetObstructionsInRange(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const =0
Find all the obstructions that are inside (or partially inside) the given range.
uint32_t u32
Definition: types.h:39
entity_pos_t hw
Definition: ICmpObstructionManager.h:228
virtual void SetUnitMovingFlag(tag_t tag, bool moving)=0
Set whether a unit shape is moving or stationary.
SkipControlGroupsRequireFlagObstructionFilter(bool exclude, entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:377
virtual void SetStaticControlGroup(tag_t tag, entity_id_t group, entity_id_t group2)=0
Sets the control group of a static shape.
u8 flags_t
Bitmask of EFlag values.
Definition: ICmpObstructionManager.h:84
entity_id_t m_Group
Definition: ICmpObstructionManager.h:334
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:309
ICmpObstructionManager::flags_t flags_t
Definition: ICmpObstructionManager.h:286
entity_id_t m_Group
Definition: ICmpObstructionManager.h:372
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
virtual ~IObstructionTestFilter()
Definition: ICmpObstructionManager.h:288
Definition: ICmpObstructionManager.h:75
Definition: ICmpObstructionManager.h:77
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:341
Obstruction test filter that will test only against shapes that:
Definition: ICmpObstructionManager.h:474
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Definition: ICmpObstructionManager.h:443
void Init()
Definition: ICmpObstructionManager.h:405
tag_t m_Tag
Definition: ICmpObstructionManager.h:431
Obstruction test filter that will test only against shapes that do not have the specified tag set...
Definition: ICmpObstructionManager.h:455
EFlags
Boolean flags affecting the obstruction behaviour of a shape.
Definition: ICmpObstructionManager.h:72
Definition: ICmpObstructionManager.h:78
ICmpObstructionManager::tag_t tag_t
Definition: ICmpObstructionManager.h:285
virtual bool GetPassabilityCircular() const =0
entity_pos_t z
Definition: ICmpObstructionManager.h:226
SkipTagRequireControlGroupsAndFlagObstructionFilter(tag_t tag, entity_id_t group1, entity_id_t group2, flags_t mask)
Definition: ICmpObstructionManager.h:437
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:463
virtual void GetStaticObstructionsInRange(const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, std::vector< ObstructionSquare > &squares) const =0
virtual void RemoveShape(tag_t tag)=0
Remove an existing shape.
virtual ObstructionSquare GetUnitShapeObstruction(entity_pos_t x, entity_pos_t z, entity_pos_t clearance) const =0
const entity_id_t INVALID_ENTITY
Invalid entity ID.
Definition: Entity.h:35
u32 entity_id_t
Entity ID type.
Definition: Entity.h:23
SkipTagRequireFlagsObstructionFilter(tag_t tag, flags_t mask)
Definition: ICmpObstructionManager.h:479
virtual void MoveShape(tag_t tag, entity_pos_t x, entity_pos_t z, entity_angle_t a)=0
Adjust the position and angle of an existing shape.
Standard representation for all types of shapes, for use with geometry processing code...
Definition: ICmpObstructionManager.h:224
virtual ObstructionSquare GetObstruction(tag_t tag) const =0
Get the obstruction square representing the given shape.
virtual void SetDebugOverlay(bool enabled)=0
Toggle the rendering of debug info.
Obstruction manager: provides efficient spatial queries over objects in the world.
Definition: ICmpObstructionManager.h:53
bool valid() const
Definition: ICmpObstructionManager.h:64
flags_t m_Mask
Definition: ICmpObstructionManager.h:434
External identifiers for shapes.
Definition: ICmpObstructionManager.h:60
CFixedVector2D v
Definition: ICmpObstructionManager.h:227
virtual ObstructionSquare GetStaticShapeObstruction(entity_pos_t x, entity_pos_t z, entity_angle_t a, entity_pos_t w, entity_pos_t h) const =0
virtual bool TestShape(tag_t tag, flags_t flags, entity_id_t group, entity_id_t group2) const
Return true if the shape with the specified parameters should be tested for collisions.
Definition: ICmpObstructionManager.h:389
Definition: ICmpObstructionManager.h:76