AGX Dynamics 2.41.3.0
Loading...
Searching...
No Matches
ShapeEntity.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_SHAPE_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_GEOMETRY_SHAPE_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/Integer.h>
51#include <agx/AffineMatrix4x4.h>
52namespace agxCollide { class Shape; }
53
54namespace agx { namespace Physics { class GeometryPtr; }}
55
56namespace agx
57{
58 namespace Physics
59 {
60 namespace Geometry
61 {
62
63 class ShapeModel;
64 class ShapeData;
65 class ShapePtr;
66 class ShapeInstance;
67 class ShapeSemantics;
68
69
71
76 {
77 public:
78 typedef ShapePtr PtrT;
79
80 ShapeModel(const agx::String& name = "Shape");
81
84
87
90
92 virtual void shutdownCleanup() override;
93
94
95
96 /* Attributes */
104
105 protected:
106 virtual ~ShapeModel();
107 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
108 virtual void configure(agx::TiXmlElement* eEntity) override;
109 virtual void initAttributeAccessors() override;
110 virtual void construct(agxData::EntityPtr instance) override;
112 };
113
114
116 #ifndef AGX_PHYSICS_GEOMETRY_SHAPE_DATA_SET_OVERRIDE
117 #define AGX_PHYSICS_GEOMETRY_SHAPE_DATA_SET
118 class AGXPHYSICS_EXPORT ShapeData : public agx::ReferencedData
119 {
120 public:
121 ShapeInstance operator[] (size_t index);
122
123 public:
130 agxData::Array< agx::UInt32 > modifiedCount;
132
133 public:
134 typedef agx::UInt8 typeType;
135 typedef agx::Bool inGroupType;
136 typedef agxCollide::BoundingAABB boundingAABBType;
137 typedef agx::Physics::GeometryPtr geometryType;
138 typedef agx::AffineMatrix4x4 transformType;
139 typedef agx::UInt32 modifiedCountType;
140 typedef agxCollide::Shape* modelType;
141
142 public:
143 ShapeData(agxData::EntityStorage* storage);
144 ShapeData();
145
146 protected:
147 virtual ~ShapeData() {}
148 virtual void setNumElements(agx::Index numElements) override;
149
150 private:
151 ShapeData& operator= (const ShapeData&) { return *this; }
152
153 };
154 #endif
156
157
159 class AGXPHYSICS_EXPORT ShapeSemantics : public agx::ReferencedSemantics
160 {
161 public:
162
163 // Automatic getters
164 agx::UInt8 const& getType() const;
165 agx::Bool const& getInGroup() const;
166 agxCollide::BoundingAABB const& getBoundingAABB() const;
167 agx::Physics::GeometryPtr const& getGeometry() const;
168 agx::AffineMatrix4x4 const& getTransform() const;
169 agx::UInt32 const& getModifiedCount() const;
170 agxCollide::Shape* const& getModel() const;
171
172 // Semantics defined by explicit kernels
173
174 // Automatic setters
175 void setType(agx::UInt8 const& value);
176 void setInGroup(agx::Bool const& value);
177 void setBoundingAABB(agxCollide::BoundingAABB const& value);
178 void setGeometry(agx::Physics::GeometryPtr const& value);
179 void setTransform(agx::AffineMatrix4x4 const& value);
180 void setModifiedCount(agx::UInt32 const& value);
181 void setModel(agxCollide::Shape* const& value);
182
183
184 protected:
185 friend class ShapePtr;
186 friend class ShapeInstance;
187 ShapeSemantics();
188 };
190
191
192
196 {
197 public:
199 typedef ShapeData DataType;
200 typedef ShapeInstance InstanceType;
201
202 public:
210 AGXPHYSICS_EXPORT const ShapeInstance instance() const;
211
212 AGXPHYSICS_EXPORT ShapeSemantics* operator->();
213 AGXPHYSICS_EXPORT const ShapeSemantics* operator->() const;
214
215 ShapeData* getData();
216 const ShapeData* getData() const;
217
218
223
228
233
238
243
248
253
254 };
255
256 // Entity is Referenced
258
259
261 class AGXPHYSICS_EXPORT ShapeInstance : public agx::ReferencedInstance
262 {
263 public:
264 ShapeInstance();
265 ShapeInstance(ShapeData* data, agx::Index index);
266 ShapeInstance(agxData::EntityStorage *storage, agx::Index index);
267 ShapeInstance(const agxData::EntityInstance& other);
268 ShapeInstance(const agxData::EntityPtr& ptr);
269
270 ShapeData* getData();
271 const ShapeData* getData() const;
272
273 public:
275 agx::UInt8& type();
277 agx::UInt8 const& type() const;
278
280 agx::Bool& inGroup();
282 agx::Bool const& inGroup() const;
283
285 agxCollide::BoundingAABB& boundingAABB();
287 agxCollide::BoundingAABB const& boundingAABB() const;
288
290 agx::Physics::GeometryPtr& geometry();
292 agx::Physics::GeometryPtr const& geometry() const;
293
295 agx::AffineMatrix4x4& transform();
297 agx::AffineMatrix4x4 const& transform() const;
298
300 agx::UInt32& modifiedCount();
302 agx::UInt32 const& modifiedCount() const;
303
305 agxCollide::Shape*& model();
307 agxCollide::Shape* const& model() const;
308
309 };
311
312
313
316
317
318
320 /* Implementation */
321 //-----------------------------------------------------------------------------------------------------
322 //-----------------------------------------------------------------------------------------------------
323 inline ShapeInstance agx::Physics::Geometry::ShapeData::operator[] (size_t index) { return ShapeInstance(this, (agx::Index)index); }
324 //-----------------------------------------------------------------------------------------------------
327 AGX_FORCE_INLINE ShapePtr::ShapePtr(const agxData::EntityPtr& ptr) : agx::ReferencedPtr(ptr)
328 {
330 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
331 EntityPtr::getModel()->fullPath().c_str(), ShapeModel::instance()->fullPath().c_str());
332 }
333
334 AGX_FORCE_INLINE ShapePtr::ShapePtr(const agxData::EntityInstance& instance) : agx::ReferencedPtr(instance)
335 {
336 agxAssertN(!instance || instance.isInstanceOf(ShapeModel::instance()),
337 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
338 EntityPtr::getModel()->fullPath().c_str(), ShapeModel::instance()->fullPath().c_str());
339 }
340
341 AGX_FORCE_INLINE ShapePtr& ShapePtr::operator= (const agxData::EntityPtr& ptr)
342 {
344 agxAssertN(!ptr || ptr.isInstanceOf(ShapeModel::instance()),
345 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
346 EntityPtr::getModel()->fullPath().c_str(), ShapeModel::instance()->fullPath().c_str());
347 return *this;
348 }
349
350 AGX_FORCE_INLINE ShapePtr& ShapePtr::operator= (const agxData::EntityInstance& instance)
351 {
353 agxAssertN(!instance || instance.isInstanceOf(ShapeModel::instance()),
354 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
355 EntityPtr::getModel()->fullPath().c_str(), ShapeModel::instance()->fullPath().c_str());
356 return *this;
357 }
358
359 inline ShapeInstance ShapePtr::instance() { return agxData::EntityPtr::instance(); }
360 inline const ShapeInstance ShapePtr::instance() const { return agxData::EntityPtr::instance(); }
361 AGX_FORCE_INLINE ShapeSemantics* ShapePtr::operator->() { return (ShapeSemantics* )this; }
362 AGX_FORCE_INLINE const ShapeSemantics* ShapePtr::operator->() const { return (const ShapeSemantics* )this; }
363 AGX_FORCE_INLINE ShapeData* ShapePtr::getData() { return static_cast<ShapeData* >(agxData::EntityPtr::getData()); }
364 AGX_FORCE_INLINE const ShapeData* ShapePtr::getData() const { return static_cast<const ShapeData* >(agxData::EntityPtr::getData()); }
365
366 AGX_FORCE_INLINE agx::UInt8& ShapePtr::type() { verifyIndex(); return getData()->type[calculateIndex()]; }
367 AGX_FORCE_INLINE agx::UInt8 const& ShapePtr::type() const { verifyIndex(); return getData()->type[calculateIndex()]; }
368
369 AGX_FORCE_INLINE agx::Bool& ShapePtr::inGroup() { verifyIndex(); return getData()->inGroup[calculateIndex()]; }
370 AGX_FORCE_INLINE agx::Bool const& ShapePtr::inGroup() const { verifyIndex(); return getData()->inGroup[calculateIndex()]; }
371
372 AGX_FORCE_INLINE agxCollide::BoundingAABB& ShapePtr::boundingAABB() { verifyIndex(); return getData()->boundingAABB[calculateIndex()]; }
373 AGX_FORCE_INLINE agxCollide::BoundingAABB const& ShapePtr::boundingAABB() const { verifyIndex(); return getData()->boundingAABB[calculateIndex()]; }
374
375 AGX_FORCE_INLINE agx::Physics::GeometryPtr& ShapePtr::geometry() { verifyIndex(); return getData()->geometry[calculateIndex()]; }
376 AGX_FORCE_INLINE agx::Physics::GeometryPtr const& ShapePtr::geometry() const { verifyIndex(); return getData()->geometry[calculateIndex()]; }
377
378 AGX_FORCE_INLINE agx::AffineMatrix4x4& ShapePtr::transform() { verifyIndex(); return getData()->transform[calculateIndex()]; }
379 AGX_FORCE_INLINE agx::AffineMatrix4x4 const& ShapePtr::transform() const { verifyIndex(); return getData()->transform[calculateIndex()]; }
380
381 AGX_FORCE_INLINE agx::UInt32& ShapePtr::modifiedCount() { verifyIndex(); return getData()->modifiedCount[calculateIndex()]; }
382 AGX_FORCE_INLINE agx::UInt32 const& ShapePtr::modifiedCount() const { verifyIndex(); return getData()->modifiedCount[calculateIndex()]; }
383
384 AGX_FORCE_INLINE agxCollide::Shape*& ShapePtr::model() { verifyIndex(); return getData()->model[calculateIndex()]; }
385 AGX_FORCE_INLINE agxCollide::Shape* const& ShapePtr::model() const { verifyIndex(); return getData()->model[calculateIndex()]; }
386
387 //-----------------------------------------------------------------------------------------------------
388 AGX_FORCE_INLINE ShapeInstance::ShapeInstance() {}
389 AGX_FORCE_INLINE ShapeInstance::ShapeInstance(ShapeData* data, agx::Index index) : agx::ReferencedInstance(data, index) {}
390 AGX_FORCE_INLINE ShapeInstance::ShapeInstance(agxData::EntityStorage* storage, agx::Index index) : agx::ReferencedInstance(storage, index) {}
391 AGX_FORCE_INLINE ShapeInstance::ShapeInstance(const agxData::EntityInstance& other) : agx::ReferencedInstance(other)
392 {
394 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
395 EntityInstance::getModel()->fullPath().c_str(), ShapeModel::instance()->fullPath().c_str());
396 }
397
398 AGX_FORCE_INLINE ShapeInstance::ShapeInstance(const agxData::EntityPtr& ptr) : agx::ReferencedInstance(ptr)
399 {
401 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
402 EntityInstance::getModel()->fullPath().c_str(), ShapeModel::instance()->fullPath().c_str());
403 }
404
405
406 AGX_FORCE_INLINE ShapeData* ShapeInstance::getData() { return static_cast<ShapeData* >(agxData::EntityInstance::getData()); }
407 AGX_FORCE_INLINE const ShapeData* ShapeInstance::getData() const { return static_cast<const ShapeData* >(agxData::EntityInstance::getData()); }
408
409 AGX_FORCE_INLINE agx::UInt8& ShapeInstance::type() { verifyIndex(); return getData()->type[getIndex()]; }
410 AGX_FORCE_INLINE agx::UInt8 const& ShapeInstance::type() const { verifyIndex(); return getData()->type[getIndex()]; }
411
412 AGX_FORCE_INLINE agx::Bool& ShapeInstance::inGroup() { verifyIndex(); return getData()->inGroup[getIndex()]; }
413 AGX_FORCE_INLINE agx::Bool const& ShapeInstance::inGroup() const { verifyIndex(); return getData()->inGroup[getIndex()]; }
414
415 AGX_FORCE_INLINE agxCollide::BoundingAABB& ShapeInstance::boundingAABB() { verifyIndex(); return getData()->boundingAABB[getIndex()]; }
416 AGX_FORCE_INLINE agxCollide::BoundingAABB const& ShapeInstance::boundingAABB() const { verifyIndex(); return getData()->boundingAABB[getIndex()]; }
417
418 AGX_FORCE_INLINE agx::Physics::GeometryPtr& ShapeInstance::geometry() { verifyIndex(); return getData()->geometry[getIndex()]; }
419 AGX_FORCE_INLINE agx::Physics::GeometryPtr const& ShapeInstance::geometry() const { verifyIndex(); return getData()->geometry[getIndex()]; }
420
421 AGX_FORCE_INLINE agx::AffineMatrix4x4& ShapeInstance::transform() { verifyIndex(); return getData()->transform[getIndex()]; }
422 AGX_FORCE_INLINE agx::AffineMatrix4x4 const& ShapeInstance::transform() const { verifyIndex(); return getData()->transform[getIndex()]; }
423
424 AGX_FORCE_INLINE agx::UInt32& ShapeInstance::modifiedCount() { verifyIndex(); return getData()->modifiedCount[getIndex()]; }
425 AGX_FORCE_INLINE agx::UInt32 const& ShapeInstance::modifiedCount() const { verifyIndex(); return getData()->modifiedCount[getIndex()]; }
426
427 AGX_FORCE_INLINE agxCollide::Shape*& ShapeInstance::model() { verifyIndex(); return getData()->model[getIndex()]; }
428 AGX_FORCE_INLINE agxCollide::Shape* const& ShapeInstance::model() const { verifyIndex(); return getData()->model[getIndex()]; }
429
430 //-----------------------------------------------------------------------------------------------------
431 AGX_FORCE_INLINE ShapeSemantics::ShapeSemantics() {}
432 //-----------------------------------------------------------------------------------------------------
434 }
435 }
436}
437
438AGX_TYPE_BINDING(agx::Physics::Geometry::ShapePtr, "Physics.Geometry.ShapePtr")
439AGX_TYPE_BINDING(agx::Physics::Geometry::ShapeInstance, "Physics.Geometry.ShapeInstance")
440
441#ifdef _MSC_VER
442# pragma warning(pop)
443#endif
444
445#undef AGX_ENTITY_WRAPPER
446#undef AGX_ENTITY_NAMESPACE
447#endif
448
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
#define AGXPHYSICS_EXPORT
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:38
Base class for a shape.
Definition: Shape.h:58
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
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:73
agx::String fullPath() const
Pointer to a entity instance of type Physics.Geometry.
Abstract description of the data attributes for the Physics.Geometry.Shape entity.
Definition: ShapeEntity.h:76
static agxData::ScalarAttributeT< agx::Bool > * inGroupAttribute
Definition: ShapeEntity.h:98
static ShapePtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ScalarAttributeT< agx::AffineMatrix4x4 > * transformAttribute
Definition: ShapeEntity.h:101
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::Physics::GeometryPtr > * geometryAttribute
Definition: ShapeEntity.h:100
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
virtual void initAttributeAccessors() override
static ShapeModel * instance()
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::ScalarAttributeT< agx::UInt8 > * typeAttribute
Definition: ShapeEntity.h:97
ShapeModel(const agx::String &name="Shape")
virtual void configure(agx::TiXmlElement *eEntity) override
static agxData::PointerAttributeT< agxCollide::Shape * > * modelAttribute
Definition: ShapeEntity.h:103
void construct(agx::Physics::Geometry::ShapePtr shape)
static agxData::ScalarAttributeT< agx::UInt32 > * modifiedCountAttribute
Definition: ShapeEntity.h:102
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agxCollide::BoundingAABB > * boundingAABBAttribute
Definition: ShapeEntity.h:99
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:196
AGXPHYSICS_EXPORT agx::UInt8 & type()
AGXPHYSICS_EXPORT const ShapeSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Bool const & inGroup() const
AGXPHYSICS_EXPORT agx::AffineMatrix4x4 & transform()
AGXPHYSICS_EXPORT ShapePtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT ShapeInstance instance()
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry()
AGXPHYSICS_EXPORT agx::UInt8 const & type() const
AGXPHYSICS_EXPORT ShapePtr()
AGXPHYSICS_EXPORT agx::UInt32 & modifiedCount()
AGXPHYSICS_EXPORT agx::UInt32 const & modifiedCount() const
AGXPHYSICS_EXPORT agxCollide::Shape *& model()
AGXPHYSICS_EXPORT agxCollide::Shape *const & model() const
AGXPHYSICS_EXPORT agx::Bool & inGroup()
AGXPHYSICS_EXPORT ShapeSemantics * operator->()
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr const & geometry() const
const ShapeData * getData() const
AGXPHYSICS_EXPORT agxCollide::BoundingAABB const & boundingAABB() const
AGXPHYSICS_EXPORT agxCollide::BoundingAABB & boundingAABB()
AGXPHYSICS_EXPORT agx::AffineMatrix4x4 const & transform() const
AGXPHYSICS_EXPORT ShapePtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT ShapePtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const ShapeInstance instance() const
Abstract description of the data attributes for the Referenced entity.
Pointer to a entity instance of type Referenced.
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
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::EntityRef< ShapePtr > ShapeRef
Definition: ShapeEntity.h:257
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:32
bool Bool
Definition: Integer.h:40
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
uint8_t UInt8
Definition: Integer.h:30
UInt32 Index
Definition: Integer.h:44