AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
ShapeGroupEntity.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_SHAPEGROUP_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_GEOMETRY_SHAPEGROUP_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>
50#include <agx/AffineMatrix4x4.h>
51
52namespace agx { namespace Physics { namespace Geometry { class ShapePtr; }}}
53
54namespace agx
55{
56 namespace Physics
57 {
58 namespace Geometry
59 {
60
61 class ShapeGroupModel;
62 class ShapeGroupData;
63 class ShapeGroupPtr;
64 class ShapeGroupInstance;
65 class ShapeGroupSemantics;
66
67
69
74 {
75 public:
77
78 ShapeGroupModel(const agx::String& name = "ShapeGroup");
79
82
85
88
90 virtual void shutdownCleanup() override;
91
92
93
94 /* Attributes */
98
99 protected:
101 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
102 virtual void configure(agx::TiXmlElement* eEntity) override;
103 virtual void initAttributeAccessors() override;
104 virtual void construct(agxData::EntityPtr instance) override;
106 };
107
108
110 #ifndef AGX_PHYSICS_GEOMETRY_SHAPEGROUP_DATA_SET_OVERRIDE
111 #define AGX_PHYSICS_GEOMETRY_SHAPEGROUP_DATA_SET
112 class AGXPHYSICS_EXPORT ShapeGroupData : public agx::Physics::Geometry::ShapeData
113 {
114 public:
115 ShapeGroupInstance operator[] (size_t index);
116
117 public:
122
123 public:
124 typedef agx::UInt tagType;
126 typedef agx::Vector< agx::AffineMatrix4x4 > childTransformsType;
127
128 public:
129 ShapeGroupData(agxData::EntityStorage* storage);
130 ShapeGroupData();
131
132 protected:
133 virtual ~ShapeGroupData() {}
134 virtual void setNumElements(agx::Index numElements) override;
135
136 private:
137 ShapeGroupData& operator= (const ShapeGroupData&) { return *this; }
138
139 };
140 #endif
142
143
145 class AGXPHYSICS_EXPORT ShapeGroupSemantics : public agx::Physics::Geometry::ShapeSemantics
146 {
147 public:
148
149 // Automatic getters
150 agx::UInt const& getTag() const;
151 agx::Vector< agx::Physics::Geometry::ShapePtr > const& getChildShapes() const;
152 agx::Vector< agx::AffineMatrix4x4 > const& getChildTransforms() const;
153
154 // Semantics defined by explicit kernels
155
156 // Automatic setters
157 void setTag(agx::UInt const& value);
158 void setChildShapes(agx::Vector< agx::Physics::Geometry::ShapePtr > const& value);
159 void setChildTransforms(agx::Vector< agx::AffineMatrix4x4 > const& value);
160
161
162 protected:
163 friend class ShapeGroupPtr;
164 friend class ShapeGroupInstance;
165 ShapeGroupSemantics();
166 };
168
169
170
173 class CALLABLE ShapeGroupPtr : public agx::Physics::Geometry::ShapePtr
174 {
175 public:
177 typedef ShapeGroupData DataType;
178 typedef ShapeGroupInstance InstanceType;
179
180 public:
187 AGXPHYSICS_EXPORT ShapeGroupInstance instance();
188 AGXPHYSICS_EXPORT const ShapeGroupInstance instance() const;
189
190 AGXPHYSICS_EXPORT ShapeGroupSemantics* operator->();
191 AGXPHYSICS_EXPORT const ShapeGroupSemantics* operator->() const;
192
193 ShapeGroupData* getData();
194 const ShapeGroupData* getData() const;
195
196
201
206
211
212 };
213
214 // Entity is Referenced
216
217
219 class AGXPHYSICS_EXPORT ShapeGroupInstance : public agx::Physics::Geometry::ShapeInstance
220 {
221 public:
222 ShapeGroupInstance();
223 ShapeGroupInstance(ShapeGroupData* data, agx::Index index);
224 ShapeGroupInstance(agxData::EntityStorage *storage, agx::Index index);
225 ShapeGroupInstance(const agxData::EntityInstance& other);
226 ShapeGroupInstance(const agxData::EntityPtr& ptr);
227
228 ShapeGroupData* getData();
229 const ShapeGroupData* getData() const;
230
231 public:
233 agx::UInt& tag();
235 agx::UInt const& tag() const;
236
240 agx::Vector< agx::Physics::Geometry::ShapePtr > const& childShapes() const;
241
243 agx::Vector< agx::AffineMatrix4x4 >& childTransforms();
245 agx::Vector< agx::AffineMatrix4x4 > const& childTransforms() const;
246
247 };
249
250
251
254
255
256
258 /* Implementation */
259 //-----------------------------------------------------------------------------------------------------
260 //-----------------------------------------------------------------------------------------------------
261 inline ShapeGroupInstance agx::Physics::Geometry::ShapeGroupData::operator[] (size_t index) { return ShapeGroupInstance(this, (agx::Index)index); }
262 //-----------------------------------------------------------------------------------------------------
264 AGX_FORCE_INLINE ShapeGroupPtr::ShapeGroupPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::ShapePtr(storage, id) {}
265 AGX_FORCE_INLINE ShapeGroupPtr::ShapeGroupPtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapePtr(ptr)
266 {
268 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
269 EntityPtr::getModel()->fullPath().c_str(), ShapeGroupModel::instance()->fullPath().c_str());
270 }
271
272 AGX_FORCE_INLINE ShapeGroupPtr::ShapeGroupPtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::ShapePtr(instance)
273 {
274 agxAssertN(!instance || instance.isInstanceOf(ShapeGroupModel::instance()),
275 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
276 EntityPtr::getModel()->fullPath().c_str(), ShapeGroupModel::instance()->fullPath().c_str());
277 }
278
279 AGX_FORCE_INLINE ShapeGroupPtr& ShapeGroupPtr::operator= (const agxData::EntityPtr& ptr)
280 {
282 agxAssertN(!ptr || ptr.isInstanceOf(ShapeGroupModel::instance()),
283 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
284 EntityPtr::getModel()->fullPath().c_str(), ShapeGroupModel::instance()->fullPath().c_str());
285 return *this;
286 }
287
288 AGX_FORCE_INLINE ShapeGroupPtr& ShapeGroupPtr::operator= (const agxData::EntityInstance& instance)
289 {
291 agxAssertN(!instance || instance.isInstanceOf(ShapeGroupModel::instance()),
292 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
293 EntityPtr::getModel()->fullPath().c_str(), ShapeGroupModel::instance()->fullPath().c_str());
294 return *this;
295 }
296
297 inline ShapeGroupInstance ShapeGroupPtr::instance() { return agxData::EntityPtr::instance(); }
298 inline const ShapeGroupInstance ShapeGroupPtr::instance() const { return agxData::EntityPtr::instance(); }
299 AGX_FORCE_INLINE ShapeGroupSemantics* ShapeGroupPtr::operator->() { return (ShapeGroupSemantics* )this; }
300 AGX_FORCE_INLINE const ShapeGroupSemantics* ShapeGroupPtr::operator->() const { return (const ShapeGroupSemantics* )this; }
301 AGX_FORCE_INLINE ShapeGroupData* ShapeGroupPtr::getData() { return static_cast<ShapeGroupData* >(agxData::EntityPtr::getData()); }
302 AGX_FORCE_INLINE const ShapeGroupData* ShapeGroupPtr::getData() const { return static_cast<const ShapeGroupData* >(agxData::EntityPtr::getData()); }
303
304 AGX_FORCE_INLINE agx::UInt& ShapeGroupPtr::tag() { verifyIndex(); return getData()->tag[calculateIndex()]; }
305 AGX_FORCE_INLINE agx::UInt const& ShapeGroupPtr::tag() const { verifyIndex(); return getData()->tag[calculateIndex()]; }
306
307 AGX_FORCE_INLINE agx::Vector< agx::Physics::Geometry::ShapePtr >& ShapeGroupPtr::childShapes() { verifyIndex(); return getData()->childShapes[calculateIndex()]; }
308 AGX_FORCE_INLINE agx::Vector< agx::Physics::Geometry::ShapePtr > const& ShapeGroupPtr::childShapes() const { verifyIndex(); return getData()->childShapes[calculateIndex()]; }
309
310 AGX_FORCE_INLINE agx::Vector< agx::AffineMatrix4x4 >& ShapeGroupPtr::childTransforms() { verifyIndex(); return getData()->childTransforms[calculateIndex()]; }
311 AGX_FORCE_INLINE agx::Vector< agx::AffineMatrix4x4 > const& ShapeGroupPtr::childTransforms() const { verifyIndex(); return getData()->childTransforms[calculateIndex()]; }
312
313 //-----------------------------------------------------------------------------------------------------
314 AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance() {}
315 AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance(ShapeGroupData* data, agx::Index index) : agx::Physics::Geometry::ShapeInstance(data, index) {}
316 AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::ShapeInstance(storage, index) {}
317 AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::ShapeInstance(other)
318 {
320 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
321 EntityInstance::getModel()->fullPath().c_str(), ShapeGroupModel::instance()->fullPath().c_str());
322 }
323
324 AGX_FORCE_INLINE ShapeGroupInstance::ShapeGroupInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapeInstance(ptr)
325 {
327 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
328 EntityInstance::getModel()->fullPath().c_str(), ShapeGroupModel::instance()->fullPath().c_str());
329 }
330
331
332 AGX_FORCE_INLINE ShapeGroupData* ShapeGroupInstance::getData() { return static_cast<ShapeGroupData* >(agxData::EntityInstance::getData()); }
333 AGX_FORCE_INLINE const ShapeGroupData* ShapeGroupInstance::getData() const { return static_cast<const ShapeGroupData* >(agxData::EntityInstance::getData()); }
334
335 AGX_FORCE_INLINE agx::UInt& ShapeGroupInstance::tag() { verifyIndex(); return getData()->tag[getIndex()]; }
336 AGX_FORCE_INLINE agx::UInt const& ShapeGroupInstance::tag() const { verifyIndex(); return getData()->tag[getIndex()]; }
337
338 AGX_FORCE_INLINE agx::Vector< agx::Physics::Geometry::ShapePtr >& ShapeGroupInstance::childShapes() { verifyIndex(); return getData()->childShapes[getIndex()]; }
339 AGX_FORCE_INLINE agx::Vector< agx::Physics::Geometry::ShapePtr > const& ShapeGroupInstance::childShapes() const { verifyIndex(); return getData()->childShapes[getIndex()]; }
340
341 AGX_FORCE_INLINE agx::Vector< agx::AffineMatrix4x4 >& ShapeGroupInstance::childTransforms() { verifyIndex(); return getData()->childTransforms[getIndex()]; }
342 AGX_FORCE_INLINE agx::Vector< agx::AffineMatrix4x4 > const& ShapeGroupInstance::childTransforms() const { verifyIndex(); return getData()->childTransforms[getIndex()]; }
343
344 //-----------------------------------------------------------------------------------------------------
345 AGX_FORCE_INLINE ShapeGroupSemantics::ShapeGroupSemantics() {}
346 //-----------------------------------------------------------------------------------------------------
348 }
349 }
350}
351
352AGX_TYPE_BINDING(agx::Physics::Geometry::ShapeGroupPtr, "Physics.Geometry.ShapeGroupPtr")
353AGX_TYPE_BINDING(agx::Physics::Geometry::ShapeGroupInstance, "Physics.Geometry.ShapeGroupInstance")
354
355#ifdef _MSC_VER
356# pragma warning(pop)
357#endif
358
359#undef AGX_ENTITY_WRAPPER
360#undef AGX_ENTITY_NAMESPACE
361#endif
362
#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.ShapeGroup entity.
static agxData::ScalarAttributeT< agx::Vector< agx::Physics::Geometry::ShapePtr > > * childShapesAttribute
static ShapeGroupPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::EntityStorage * defaultStorage()
virtual void configure(agx::TiXmlElement *eEntity) override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static agxData::ScalarAttributeT< agx::Vector< agx::AffineMatrix4x4 > > * childTransformsAttribute
void construct(agx::Physics::Geometry::ShapeGroupPtr shapeGroup)
ShapeGroupModel(const agx::String &name="ShapeGroup")
static ShapeGroupModel * instance()
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void construct(agxData::EntityPtr instance) override
virtual void initAttributeAccessors() override
static agxData::ScalarAttributeT< agx::UInt > * tagAttribute
Pointer to a entity instance of type Physics.Geometry.ShapeGroup.
AGXPHYSICS_EXPORT agx::Vector< agx::AffineMatrix4x4 > const & childTransforms() const
AGXPHYSICS_EXPORT ShapeGroupPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT const ShapeGroupSemantics * operator->() const
AGXPHYSICS_EXPORT ShapeGroupPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::UInt const & tag() const
AGXPHYSICS_EXPORT ShapeGroupInstance instance()
AGXPHYSICS_EXPORT agx::Vector< agx::Physics::Geometry::ShapePtr > & childShapes()
AGXPHYSICS_EXPORT ShapeGroupSemantics * operator->()
AGXPHYSICS_EXPORT agx::Vector< agx::AffineMatrix4x4 > & childTransforms()
AGXPHYSICS_EXPORT const ShapeGroupInstance instance() const
AGXPHYSICS_EXPORT ShapeGroupPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::UInt & tag()
AGXPHYSICS_EXPORT agx::Vector< agx::Physics::Geometry::ShapePtr > const & childShapes() const
const ShapeGroupData * getData() const
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
Templated vector class.
Definition: agx/Vector.h:53
#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< ShapeGroupPtr > ShapeGroupRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint64_t UInt
Definition: Integer.h:27
UInt32 Index
Definition: Integer.h:44