AGX Dynamics  2.35.0.1
GeometryState.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGX_GEOMETRYSTATE_H
18 #define AGX_GEOMETRYSTATE_H
19 
20 #include <agx/Math.h>
21 #include <agx/BitSet_small.h>
22 
23 #include <agxData/Type.h>
24 
26 
27 namespace agxCollide
28 {
29 
30  class GeometryState : public agx::BitSet_small<agx::UInt32>
31  {
32  public:
33  enum
34  {
35  ENABLE_BIT = 0,
36  REMOVED_BIT = 1,
37  CAN_COLLIDE_BIT = 2,
38  SENSOR_BIT = 3,
39  BOOLEAN_SENSOR_BIT = 4
40  };
41 
42  public:
43  GeometryState();
44  GeometryState(agx::UInt32 mask);
45  bool enabled() const;
46  bool shouldCollide() const;
47  bool removed() const;
48  bool sensor() const;
49  bool booleanSensor() const;
50  bool sensorAndBooleanSensor() const;
51 
52  private:
53  friend class Geometry;
54  friend class Space;
55  void setEnabled(bool flag);
56  void setRemoved(bool flag);
57  void setShouldCollide(bool flag);
58  void setSensor(bool flag);
59  void setBooleanSensor(bool flag);
60  };
61 
62 
63  /* Implementation */
64  AGX_FORCE_INLINE GeometryState::GeometryState()
65  {
66  }
67 
68  AGX_FORCE_INLINE GeometryState::GeometryState(agx::UInt32 mask) : agx::BitSet_small<agx::UInt32>(mask)
69  {
70  }
71 
72  AGX_FORCE_INLINE bool GeometryState::enabled() const
73  {
74  return this->test(ENABLE_BIT);
75  }
76 
77  AGX_FORCE_INLINE bool GeometryState::removed() const
78  {
79  return this->test(REMOVED_BIT);
80  }
81 
82  AGX_FORCE_INLINE bool GeometryState::shouldCollide() const
83  {
84  return this->test(CAN_COLLIDE_BIT);
85  }
86 
87  inline bool GeometryState::sensor() const
88  {
89  return this->test(SENSOR_BIT);
90  }
91 
92  inline bool GeometryState::booleanSensor() const
93  {
94  return this->test(BOOLEAN_SENSOR_BIT);
95  }
96 
97  inline bool GeometryState::sensorAndBooleanSensor() const
98  {
99  return this->sensor() && this->booleanSensor();
100  }
101 
102  AGX_FORCE_INLINE void GeometryState::setEnabled(bool flag)
103  {
104  this->set(ENABLE_BIT,flag);
105  }
106 
107  AGX_FORCE_INLINE void GeometryState::setRemoved(bool flag)
108  {
109  this->set(REMOVED_BIT,flag);
110  }
111 
112  AGX_FORCE_INLINE void GeometryState::setShouldCollide(bool flag)
113  {
114  this->set(CAN_COLLIDE_BIT,flag);
115  }
116 
117  inline void GeometryState::setSensor(bool flag)
118  {
119  this->set(SENSOR_BIT, flag);
120  }
121 
122  inline void GeometryState::setBooleanSensor(bool flag)
123  {
124  this->set(BOOLEAN_SENSOR_BIT, flag);
125  }
126 }
127 
128 AGX_TYPE_BINDING(agxCollide::GeometryState, "GeometryState")
129 
131 
132 #endif /* AGX_RIGIDBODYSTATE_H */
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
Special class for small bitset, because minimum bitset size in clang/gcc is 8 bytes,...
Definition: BitSet_small.h:29
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40