AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
GeometryState.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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/Math.h>
20#include <agx/BitSet_small.h>
21
22#include <agxData/Type.h>
23
25
26namespace agxCollide
27{
28
29 class GeometryState : public agx::BitSet_small<agx::UInt32>
30 {
31 public:
32 enum
33 {
34 ENABLE_BIT = 0,
35 REMOVED_BIT = 1,
36 CAN_COLLIDE_BIT = 2,
37 SENSOR_BIT = 3,
38 BOOLEAN_SENSOR_BIT = 4,
39 ENABLE_MASSPROPERTIES = 5
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 enableMassProperties() const;
50 bool booleanSensor() const;
51 bool sensorAndBooleanSensor() const;
52
53 private:
54 friend class Geometry;
55 friend class Space;
56 void setEnabled(bool flag);
57 void setRemoved(bool flag);
58 void setEnableMassProperties(bool flag);
59 void setShouldCollide(bool flag);
60 void setSensor(bool flag);
61 void setBooleanSensor(bool flag);
62 };
63
64
65 /* Implementation */
66 AGX_FORCE_INLINE GeometryState::GeometryState()
67 {
68 }
69
70 AGX_FORCE_INLINE GeometryState::GeometryState(agx::UInt32 mask) : agx::BitSet_small<agx::UInt32>(mask)
71 {
72 }
73
74 AGX_FORCE_INLINE bool GeometryState::enabled() const
75 {
76 return this->test(ENABLE_BIT);
77 }
78
79 AGX_FORCE_INLINE bool GeometryState::removed() const
80 {
81 return this->test(REMOVED_BIT);
82 }
83
84 AGX_FORCE_INLINE bool GeometryState::shouldCollide() const
85 {
86 return this->test(CAN_COLLIDE_BIT);
87 }
88
89 inline bool GeometryState::sensor() const
90 {
91 return this->test(SENSOR_BIT);
92 }
93
94 inline bool GeometryState::booleanSensor() const
95 {
96 return this->test(BOOLEAN_SENSOR_BIT);
97 }
98
99 inline bool GeometryState::enableMassProperties() const
100 {
101 return this->test(ENABLE_MASSPROPERTIES);
102 }
103
104 inline bool GeometryState::sensorAndBooleanSensor() const
105 {
106 return this->sensor() && this->booleanSensor();
107 }
108
109 AGX_FORCE_INLINE void GeometryState::setEnabled(bool flag)
110 {
111 this->set(ENABLE_BIT,flag);
112 }
113
114 AGX_FORCE_INLINE void GeometryState::setRemoved(bool flag)
115 {
116 this->set(REMOVED_BIT,flag);
117 }
118
119 AGX_FORCE_INLINE void GeometryState::setEnableMassProperties(bool flag)
120 {
121 this->set(ENABLE_MASSPROPERTIES, flag);
122 }
123
124 AGX_FORCE_INLINE void GeometryState::setShouldCollide(bool flag)
125 {
126 this->set(CAN_COLLIDE_BIT,flag);
127 }
128
129 inline void GeometryState::setSensor(bool flag)
130 {
131 this->set(SENSOR_BIT, flag);
132 }
133
134 inline void GeometryState::setBooleanSensor(bool flag)
135 {
136 this->set(BOOLEAN_SENSOR_BIT, flag);
137 }
138}
139
140AGX_TYPE_BINDING(agxCollide::GeometryState, "GeometryState")
141
143
#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,...
#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:32