AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
GeometryState.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/BitSet_small.h>
20
21#include <agxData/Type.h>
22
24
25namespace agxCollide
26{
27
28 class GeometryState : public agx::BitSet_small<agx::UInt32>
29 {
30 public:
31 enum
32 {
33 ENABLE_BIT = 0,
34 REMOVED_BIT = 1,
35 CAN_COLLIDE_BIT = 2,
36 SENSOR_BIT = 3,
37 BOOLEAN_SENSOR_BIT = 4,
38 ENABLE_MASSPROPERTIES = 5
39 };
40
41 public:
42 GeometryState();
43 GeometryState(agx::UInt32 mask);
44 bool enabled() const;
45 bool shouldCollide() const;
46 bool removed() const;
47 bool sensor() const;
48 bool enableMassProperties() 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 setEnableMassProperties(bool flag);
58 void setShouldCollide(bool flag);
59 void setSensor(bool flag);
60 void setBooleanSensor(bool flag);
61 };
62
63
64 /* Implementation */
65 AGX_FORCE_INLINE GeometryState::GeometryState()
66 {
67 }
68
69 AGX_FORCE_INLINE GeometryState::GeometryState(agx::UInt32 mask) : agx::BitSet_small<agx::UInt32>(mask)
70 {
71 }
72
73 AGX_FORCE_INLINE bool GeometryState::enabled() const
74 {
75 return this->test(ENABLE_BIT);
76 }
77
78 AGX_FORCE_INLINE bool GeometryState::removed() const
79 {
80 return this->test(REMOVED_BIT);
81 }
82
83 AGX_FORCE_INLINE bool GeometryState::shouldCollide() const
84 {
85 return this->test(CAN_COLLIDE_BIT);
86 }
87
88 inline bool GeometryState::sensor() const
89 {
90 return this->test(SENSOR_BIT);
91 }
92
93 inline bool GeometryState::booleanSensor() const
94 {
95 return this->test(BOOLEAN_SENSOR_BIT);
96 }
97
98 inline bool GeometryState::enableMassProperties() const
99 {
100 return this->test(ENABLE_MASSPROPERTIES);
101 }
102
103 inline bool GeometryState::sensorAndBooleanSensor() const
104 {
105 return this->sensor() && this->booleanSensor();
106 }
107
108 AGX_FORCE_INLINE void GeometryState::setEnabled(bool flag)
109 {
110 this->set(ENABLE_BIT,flag);
111 }
112
113 AGX_FORCE_INLINE void GeometryState::setRemoved(bool flag)
114 {
115 this->set(REMOVED_BIT,flag);
116 }
117
118 AGX_FORCE_INLINE void GeometryState::setEnableMassProperties(bool flag)
119 {
120 this->set(ENABLE_MASSPROPERTIES, flag);
121 }
122
123 AGX_FORCE_INLINE void GeometryState::setShouldCollide(bool flag)
124 {
125 this->set(CAN_COLLIDE_BIT,flag);
126 }
127
128 inline void GeometryState::setSensor(bool flag)
129 {
130 this->set(SENSOR_BIT, flag);
131 }
132
133 inline void GeometryState::setBooleanSensor(bool flag)
134 {
135 this->set(BOOLEAN_SENSOR_BIT, flag);
136 }
137}
138
139AGX_TYPE_BINDING(agxCollide::GeometryState, "GeometryState")
140
142
#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:31
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
#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:32