AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
BoxEntity.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
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid 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
18// AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20
21#ifndef GENERATED_AGX_PHYSICS_GEOMETRY_BOX_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_GEOMETRY_BOX_H_PLUGIN
23
24#define AGX_ENTITY_WRAPPER 1
25
26
27#ifdef _MSC_VER
28# pragma warning(push)
29// warning C4505: 'agxData::VectorAttributeT<T>::print' : unreferenced local function has been removed
30# pragma warning( disable : 4505 )
31// warning C4251: 'X' : class 'Y' needs to have dll-interface to be used by clients of class 'Z'
32# pragma warning( disable : 4251 )
33// warning C4355: 'this' : used in base member initializer list
34# pragma warning( disable : 4355 )
35// marked as __forceinline not inlined
36# pragma warning( disable: 4714 )
37#endif
38
39#include <agxData/EntityModel.h>
41#include <agxData/EntityRef.h>
42#include <agxData/EntityPtr.h>
44#include <agx/Integer.h>
45#include <agx/Real.h>
46#include <agx/macros.h>
48#include <agx/Vec3.h>
49
50
51namespace agx
52{
53 namespace Physics
54 {
55 namespace Geometry
56 {
57
58 class BoxModel;
59 class BoxData;
60 class BoxPtr;
61 class BoxInstance;
62 class BoxSemantics;
63
64
66
71 {
72 public:
73 typedef BoxPtr PtrT;
74
75 BoxModel(const agx::String& name = "Box");
76
78 static BoxModel* instance();
79
82
85
87 virtual void shutdownCleanup() override;
88
89
90
91 /* Attributes */
93
94 protected:
95 virtual ~BoxModel();
96 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
97 virtual void configure(agx::TiXmlElement* eEntity) override;
98 virtual void initAttributeAccessors() override;
99 virtual void construct(agxData::EntityPtr instance) override;
101 };
102
103
105 #ifndef AGX_PHYSICS_GEOMETRY_BOX_DATA_SET_OVERRIDE
106 #define AGX_PHYSICS_GEOMETRY_BOX_DATA_SET
107 class AGXPHYSICS_EXPORT BoxData : public agx::Physics::Geometry::ShapeData
108 {
109 public:
110 BoxInstance operator[] (size_t index);
111
112 public:
113 agxData::Array< BoxPtr >& instance;
114 agxData::Array< agx::Vec3 > halfExtents;
115
116 public:
117 typedef agx::Vec3 halfExtentsType;
118
119 public:
120 BoxData(agxData::EntityStorage* storage);
121 BoxData();
122
123 protected:
124 virtual ~BoxData() {}
125 virtual void setNumElements(agx::Index numElements) override;
126
127 private:
128 BoxData& operator= (const BoxData&) { return *this; }
129
130 };
131 #endif
133
134
136 class AGXPHYSICS_EXPORT BoxSemantics : public agx::Physics::Geometry::ShapeSemantics
137 {
138 public:
139
140 // Automatic getters
141 agx::Vec3 const& getHalfExtents() const;
142
143 // Semantics defined by explicit kernels
144
145 // Automatic setters
146 void setHalfExtents(agx::Vec3 const& value);
147
148
149 protected:
150 friend class BoxPtr;
151 friend class BoxInstance;
152 BoxSemantics();
153 };
155
156
157
160 class CALLABLE BoxPtr : public agx::Physics::Geometry::ShapePtr
161 {
162 public:
164 typedef BoxData DataType;
165 typedef BoxInstance InstanceType;
166
167 public:
175 AGXPHYSICS_EXPORT const BoxInstance instance() const;
176
178 AGXPHYSICS_EXPORT const BoxSemantics* operator->() const;
179
180 BoxData* getData();
181 const BoxData* getData() const;
182
183
188
189 };
190
191 // Entity is Referenced
193
194
196 class AGXPHYSICS_EXPORT BoxInstance : public agx::Physics::Geometry::ShapeInstance
197 {
198 public:
199 BoxInstance();
200 BoxInstance(BoxData* data, agx::Index index);
201 BoxInstance(agxData::EntityStorage *storage, agx::Index index);
202 BoxInstance(const agxData::EntityInstance& other);
203 BoxInstance(const agxData::EntityPtr& ptr);
204
205 BoxData* getData();
206 const BoxData* getData() const;
207
208 public:
210 agx::Vec3& halfExtents();
212 agx::Vec3 const& halfExtents() const;
213
214 };
216
217
218
220 typedef agxData::Array<BoxPtr> BoxPtrArray;
221
222
223
225 /* Implementation */
226 //-----------------------------------------------------------------------------------------------------
227 //-----------------------------------------------------------------------------------------------------
228 inline BoxInstance agx::Physics::Geometry::BoxData::operator[] (size_t index) { return BoxInstance(this, (agx::Index)index); }
229 //-----------------------------------------------------------------------------------------------------
231 AGX_FORCE_INLINE BoxPtr::BoxPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::ShapePtr(storage, id) {}
232 AGX_FORCE_INLINE BoxPtr::BoxPtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapePtr(ptr)
233 {
235 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
236 EntityPtr::getModel()->fullPath().c_str(), BoxModel::instance()->fullPath().c_str());
237 }
238
239 AGX_FORCE_INLINE BoxPtr::BoxPtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::ShapePtr(instance)
240 {
241 agxAssertN(!instance || instance.isInstanceOf(BoxModel::instance()),
242 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
243 EntityPtr::getModel()->fullPath().c_str(), BoxModel::instance()->fullPath().c_str());
244 }
245
246 AGX_FORCE_INLINE BoxPtr& BoxPtr::operator= (const agxData::EntityPtr& ptr)
247 {
249 agxAssertN(!ptr || ptr.isInstanceOf(BoxModel::instance()),
250 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
251 EntityPtr::getModel()->fullPath().c_str(), BoxModel::instance()->fullPath().c_str());
252 return *this;
253 }
254
255 AGX_FORCE_INLINE BoxPtr& BoxPtr::operator= (const agxData::EntityInstance& instance)
256 {
258 agxAssertN(!instance || instance.isInstanceOf(BoxModel::instance()),
259 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
260 EntityPtr::getModel()->fullPath().c_str(), BoxModel::instance()->fullPath().c_str());
261 return *this;
262 }
263
264 inline BoxInstance BoxPtr::instance() { return agxData::EntityPtr::instance(); }
265 inline const BoxInstance BoxPtr::instance() const { return agxData::EntityPtr::instance(); }
266 AGX_FORCE_INLINE BoxSemantics* BoxPtr::operator->() { return (BoxSemantics* )this; }
267 AGX_FORCE_INLINE const BoxSemantics* BoxPtr::operator->() const { return (const BoxSemantics* )this; }
268 AGX_FORCE_INLINE BoxData* BoxPtr::getData() { return static_cast<BoxData* >(agxData::EntityPtr::getData()); }
269 AGX_FORCE_INLINE const BoxData* BoxPtr::getData() const { return static_cast<const BoxData* >(agxData::EntityPtr::getData()); }
270
271 AGX_FORCE_INLINE agx::Vec3& BoxPtr::halfExtents() { verifyIndex(); return getData()->halfExtents[calculateIndex()]; }
272 AGX_FORCE_INLINE agx::Vec3 const& BoxPtr::halfExtents() const { verifyIndex(); return getData()->halfExtents[calculateIndex()]; }
273
274 //-----------------------------------------------------------------------------------------------------
275 AGX_FORCE_INLINE BoxInstance::BoxInstance() {}
276 AGX_FORCE_INLINE BoxInstance::BoxInstance(BoxData* data, agx::Index index) : agx::Physics::Geometry::ShapeInstance(data, index) {}
277 AGX_FORCE_INLINE BoxInstance::BoxInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::ShapeInstance(storage, index) {}
278 AGX_FORCE_INLINE BoxInstance::BoxInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::ShapeInstance(other)
279 {
280 agxAssertN(!other || other.isInstanceOf(BoxModel::instance()),
281 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
282 EntityInstance::getModel()->fullPath().c_str(), BoxModel::instance()->fullPath().c_str());
283 }
284
285 AGX_FORCE_INLINE BoxInstance::BoxInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapeInstance(ptr)
286 {
288 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
289 EntityInstance::getModel()->fullPath().c_str(), BoxModel::instance()->fullPath().c_str());
290 }
291
292
293 AGX_FORCE_INLINE BoxData* BoxInstance::getData() { return static_cast<BoxData* >(agxData::EntityInstance::getData()); }
294 AGX_FORCE_INLINE const BoxData* BoxInstance::getData() const { return static_cast<const BoxData* >(agxData::EntityInstance::getData()); }
295
296 AGX_FORCE_INLINE agx::Vec3& BoxInstance::halfExtents() { verifyIndex(); return getData()->halfExtents[getIndex()]; }
297 AGX_FORCE_INLINE agx::Vec3 const& BoxInstance::halfExtents() const { verifyIndex(); return getData()->halfExtents[getIndex()]; }
298
299 //-----------------------------------------------------------------------------------------------------
300 AGX_FORCE_INLINE BoxSemantics::BoxSemantics() {}
301 //-----------------------------------------------------------------------------------------------------
303 }
304 }
305}
306
307AGX_TYPE_BINDING(agx::Physics::Geometry::BoxPtr, "Physics.Geometry.BoxPtr")
308AGX_TYPE_BINDING(agx::Physics::Geometry::BoxInstance, "Physics.Geometry.BoxInstance")
309
310#ifdef _MSC_VER
311# pragma warning(pop)
312#endif
313
314#undef AGX_ENTITY_WRAPPER
315#undef AGX_ENTITY_NAMESPACE
316#endif
317
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
#define AGXPHYSICS_EXPORT
Type-specific Array used for fast access into the data held by a Buffer.
Definition: Array.h:107
Entity instance provides access to a single instance in an EntityStorage.
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:52
EntityPtr & operator=(const EntityPtr &other)=default
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
An entity reference is a safe/referencing handle to an entity instance whose model is descendant from...
Definition: EntityRef.h:35
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:73
agx::String fullPath() const
Abstract description of the data attributes for the Physics.Geometry.Box entity.
Definition: BoxEntity.h:71
static BoxModel * instance()
static BoxPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
void construct(agx::Physics::Geometry::BoxPtr box)
virtual void construct(agxData::EntityPtr instance) override
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::Vec3 > * halfExtentsAttribute
Definition: BoxEntity.h:92
virtual void configure(agx::TiXmlElement *eEntity) override
BoxModel(const agx::String &name="Box")
virtual void initAttributeAccessors() override
Pointer to a entity instance of type Physics.Geometry.Box.
Definition: BoxEntity.h:161
AGXPHYSICS_EXPORT BoxPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT BoxPtr(const agxData::EntityInstance &instance)
const BoxData * getData() const
AGXPHYSICS_EXPORT BoxPtr()
AGXPHYSICS_EXPORT agx::Vec3 const & halfExtents() const
AGXPHYSICS_EXPORT const BoxSemantics * operator->() const
AGXPHYSICS_EXPORT BoxSemantics * operator->()
AGXPHYSICS_EXPORT const BoxInstance instance() const
AGXPHYSICS_EXPORT BoxPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::Vec3 & halfExtents()
AGXPHYSICS_EXPORT BoxInstance instance()
Abstract description of the data attributes for the Physics.Geometry.Shape entity.
Definition: ShapeEntity.h:76
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:196
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define agxAssertN(expr, format,...)
Definition: debug.h:145
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::EntityRef< BoxPtr > BoxRef
Definition: BoxEntity.h:192
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
UInt32 Index
Definition: Integer.h:44