AGX Dynamics  2.35.0.1
ConvexEntity.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
18 // AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20 
21 #ifndef GENERATED_AGX_PHYSICS_GEOMETRY_CONVEX_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GEOMETRY_CONVEX_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>
40 #include <agxData/EntityStorage.h>
41 #include <agxData/EntityRef.h>
42 #include <agxData/EntityPtr.h>
43 #include <agxData/EntityInstance.h>
44 #include <agx/Integer.h>
45 #include <agx/Real.h>
46 #include <agx/macros.h>
48 
49 
50 namespace agx
51 {
52  namespace Physics
53  {
54  namespace Geometry
55  {
56 
57  class ConvexModel;
58  class ConvexData;
59  class ConvexPtr;
60  class ConvexInstance;
61  class ConvexSemantics;
62 
63 
65 
70  {
71  public:
72  typedef ConvexPtr PtrT;
73 
74  ConvexModel(const agx::String& name = "Convex");
75 
77  static ConvexModel* instance();
78 
81 
84 
86  virtual void shutdownCleanup() override;
87 
88 
89 
90  /* Attributes */
91 
92  protected:
93  virtual ~ConvexModel();
94  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
95  virtual void configure(agx::TiXmlElement* eEntity) override;
96  virtual void initAttributeAccessors() override;
97  virtual void construct(agxData::EntityPtr instance) override;
99  };
100 
101 
103  #ifndef AGX_PHYSICS_GEOMETRY_CONVEX_DATA_SET_OVERRIDE
104  #define AGX_PHYSICS_GEOMETRY_CONVEX_DATA_SET
105  class AGXPHYSICS_EXPORT ConvexData : public agx::Physics::Geometry::TrimeshData
106  {
107  public:
108  ConvexInstance operator[] (size_t index);
109 
110  public:
111  agxData::Array< ConvexPtr >& instance;
112 
113  public:
114 
115  public:
116  ConvexData(agxData::EntityStorage* storage);
117  ConvexData();
118 
119  protected:
120  virtual ~ConvexData() {}
121  virtual void setNumElements(agx::Index numElements) override;
122 
123  private:
124  ConvexData& operator= (const ConvexData&) { return *this; }
125 
126  };
127  #endif
129 
130 
132  class AGXPHYSICS_EXPORT ConvexSemantics : public agx::Physics::Geometry::TrimeshSemantics
133  {
134  public:
135 
136  // Automatic getters
137 
138  // Semantics defined by explicit kernels
139 
140  // Automatic setters
141 
142 
143  protected:
144  friend class ConvexPtr;
145  friend class ConvexInstance;
146  ConvexSemantics();
147  };
149 
150 
151 
154  class CALLABLE ConvexPtr : public agx::Physics::Geometry::TrimeshPtr
155  {
156  public:
158  typedef ConvexData DataType;
159  typedef ConvexInstance InstanceType;
160 
161  public:
168  AGXPHYSICS_EXPORT ConvexInstance instance();
169  AGXPHYSICS_EXPORT const ConvexInstance instance() const;
170 
171  AGXPHYSICS_EXPORT ConvexSemantics* operator->();
172  AGXPHYSICS_EXPORT const ConvexSemantics* operator->() const;
173 
174  ConvexData* getData();
175  const ConvexData* getData() const;
176 
177 
179  // Only used by tolua!
180  #ifdef AGX_GENERATED_TOLUA_WRAPPER
181 
182 
183  #endif
185 
186  };
187 
188  // Entity is Referenced
190 
191 
193  class AGXPHYSICS_EXPORT ConvexInstance : public agx::Physics::Geometry::TrimeshInstance
194  {
195  public:
196  ConvexInstance();
197  ConvexInstance(ConvexData* data, agx::Index index);
198  ConvexInstance(agxData::EntityStorage *storage, agx::Index index);
199  ConvexInstance(const agxData::EntityInstance& other);
200  ConvexInstance(const agxData::EntityPtr& ptr);
201 
202  ConvexData* getData();
203  const ConvexData* getData() const;
204 
205  public:
206  };
208 
209 
210 
213 
214 
215 
217  /* Implementation */
218  //-----------------------------------------------------------------------------------------------------
219  //-----------------------------------------------------------------------------------------------------
220  inline ConvexInstance agx::Physics::Geometry::ConvexData::operator[] (size_t index) { return ConvexInstance(this, (agx::Index)index); }
221  //-----------------------------------------------------------------------------------------------------
223  AGX_FORCE_INLINE ConvexPtr::ConvexPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::TrimeshPtr(storage, id) {}
224  AGX_FORCE_INLINE ConvexPtr::ConvexPtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::TrimeshPtr(ptr)
225  {
227  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
228  EntityPtr::getModel()->fullPath().c_str(), ConvexModel::instance()->fullPath().c_str());
229  }
230 
231  AGX_FORCE_INLINE ConvexPtr::ConvexPtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::TrimeshPtr(instance)
232  {
233  agxAssertN(!instance || instance.isInstanceOf(ConvexModel::instance()),
234  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
235  EntityPtr::getModel()->fullPath().c_str(), ConvexModel::instance()->fullPath().c_str());
236  }
237 
238  AGX_FORCE_INLINE ConvexPtr& ConvexPtr::operator= (const agxData::EntityPtr& ptr)
239  {
241  agxAssertN(!ptr || ptr.isInstanceOf(ConvexModel::instance()),
242  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
243  EntityPtr::getModel()->fullPath().c_str(), ConvexModel::instance()->fullPath().c_str());
244  return *this;
245  }
246 
247  AGX_FORCE_INLINE ConvexPtr& ConvexPtr::operator= (const agxData::EntityInstance& instance)
248  {
250  agxAssertN(!instance || instance.isInstanceOf(ConvexModel::instance()),
251  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
252  EntityPtr::getModel()->fullPath().c_str(), ConvexModel::instance()->fullPath().c_str());
253  return *this;
254  }
255 
256  inline ConvexInstance ConvexPtr::instance() { return agxData::EntityPtr::instance(); }
257  inline const ConvexInstance ConvexPtr::instance() const { return agxData::EntityPtr::instance(); }
258  AGX_FORCE_INLINE ConvexSemantics* ConvexPtr::operator->() { return (ConvexSemantics* )this; }
259  AGX_FORCE_INLINE const ConvexSemantics* ConvexPtr::operator->() const { return (const ConvexSemantics* )this; }
260  AGX_FORCE_INLINE ConvexData* ConvexPtr::getData() { return static_cast<ConvexData* >(agxData::EntityPtr::getData()); }
261  AGX_FORCE_INLINE const ConvexData* ConvexPtr::getData() const { return static_cast<const ConvexData* >(agxData::EntityPtr::getData()); }
262 
263  //-----------------------------------------------------------------------------------------------------
264  AGX_FORCE_INLINE ConvexInstance::ConvexInstance() {}
265  AGX_FORCE_INLINE ConvexInstance::ConvexInstance(ConvexData* data, agx::Index index) : agx::Physics::Geometry::TrimeshInstance(data, index) {}
266  AGX_FORCE_INLINE ConvexInstance::ConvexInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::TrimeshInstance(storage, index) {}
267  AGX_FORCE_INLINE ConvexInstance::ConvexInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::TrimeshInstance(other)
268  {
269  agxAssertN(!other || other.isInstanceOf(ConvexModel::instance()),
270  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
272  }
273 
274  AGX_FORCE_INLINE ConvexInstance::ConvexInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::TrimeshInstance(ptr)
275  {
277  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
279  }
280 
281 
282  AGX_FORCE_INLINE ConvexData* ConvexInstance::getData() { return static_cast<ConvexData* >(agxData::EntityInstance::getData()); }
283  AGX_FORCE_INLINE const ConvexData* ConvexInstance::getData() const { return static_cast<const ConvexData* >(agxData::EntityInstance::getData()); }
284 
285  //-----------------------------------------------------------------------------------------------------
286  AGX_FORCE_INLINE ConvexSemantics::ConvexSemantics() {}
287  //-----------------------------------------------------------------------------------------------------
289  }
290  }
291 }
292 
293 AGX_TYPE_BINDING(agx::Physics::Geometry::ConvexPtr, "Physics.Geometry.ConvexPtr")
294 AGX_TYPE_BINDING(agx::Physics::Geometry::ConvexInstance, "Physics.Geometry.ConvexInstance")
295 
296 #ifdef _MSC_VER
297 # pragma warning(pop)
298 #endif
299 
300 #undef AGX_ENTITY_WRAPPER
301 #undef AGX_ENTITY_NAMESPACE
302 #endif
303 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
EntityPtr & operator=(const EntityPtr &other)=default
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.Convex entity.
Definition: ConvexEntity.h:70
static ConvexModel * instance()
static agxData::EntityStorage * defaultStorage()
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void initAttributeAccessors() override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static ConvexPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
ConvexModel(const agx::String &name="Convex")
void construct(agx::Physics::Geometry::ConvexPtr convex)
virtual void configure(agx::TiXmlElement *eEntity) override
virtual void construct(agxData::EntityPtr instance) override
Pointer to a entity instance of type Physics.Geometry.Convex.
Definition: ConvexEntity.h:155
AGXPHYSICS_EXPORT ConvexSemantics * operator->()
AGXPHYSICS_EXPORT ConvexPtr(const agxData::EntityPtr &ptr)
const ConvexData * getData() const
AGXPHYSICS_EXPORT ConvexPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const ConvexSemantics * operator->() const
AGXPHYSICS_EXPORT const ConvexInstance instance() const
AGXPHYSICS_EXPORT ConvexPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT ConvexInstance instance()
Abstract description of the data attributes for the Physics.Geometry.Trimesh entity.
Definition: TrimeshEntity.h:70
Pointer to a entity instance of type Physics.Geometry.Trimesh.
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:97
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::EntityRef< ConvexPtr > ConvexRef
Definition: ConvexEntity.h:189
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
UInt32 Index
Definition: Integer.h:52