AGX Dynamics  2.35.0.1
OrientedGeometryBoundEntity.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_HIERARCHICALGRID_ORIENTEDGEOMETRYBOUND_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_HIERARCHICALGRID_ORIENTEDGEOMETRYBOUND_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 #include <agx/Bound.h>
49 #include <agx/Vec3.h>
50 #include <agx/AffineMatrix4x4.h>
51 
52 namespace agx { namespace Physics { class GeometryPtr; }}
53 
54 namespace agx
55 {
56  namespace Physics
57  {
58  namespace HierarchicalGrid
59  {
60 
61  class OrientedGeometryBoundModel;
62  class OrientedGeometryBoundData;
63  class OrientedGeometryBoundPtr;
64  class OrientedGeometryBoundInstance;
65  class OrientedGeometryBoundSemantics;
66 
67 
69 
74  {
75  public:
77 
78  OrientedGeometryBoundModel(const agx::String& name = "OrientedGeometryBound");
79 
82 
85 
88 
90  virtual void shutdownCleanup() override;
91 
92 
93 
94  /* Attributes */
99 
100  protected:
102  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
103  virtual void configure(agx::TiXmlElement* eEntity) override;
104  virtual void initAttributeAccessors() override;
105  virtual void construct(agxData::EntityPtr instance) override;
107  };
108 
109 
111  #ifndef AGX_PHYSICS_HIERARCHICALGRID_ORIENTEDGEOMETRYBOUND_DATA_SET_OVERRIDE
112  #define AGX_PHYSICS_HIERARCHICALGRID_ORIENTEDGEOMETRYBOUND_DATA_SET
113  class AGXPHYSICS_EXPORT OrientedGeometryBoundData : public agxData::EntityData
114  {
115  public:
116  OrientedGeometryBoundInstance operator[] (size_t index);
117 
118  public:
122  agxData::Array< agx::Vec3 > halfExtents;
124 
125  public:
126  typedef agx::Physics::GeometryPtr geometryType;
127  typedef agx::Bound3 localBoundType;
128  typedef agx::Vec3 halfExtentsType;
129  typedef agx::AffineMatrix4x4 invTransformType;
130 
131  public:
132  OrientedGeometryBoundData(agxData::EntityStorage* storage);
133  OrientedGeometryBoundData();
134 
135  protected:
136  virtual ~OrientedGeometryBoundData() {}
137  virtual void setNumElements(agx::Index numElements) override;
138 
139  private:
140  OrientedGeometryBoundData& operator= (const OrientedGeometryBoundData&) { return *this; }
141 
142  };
143  #endif
145 
146 
148  class AGXPHYSICS_EXPORT OrientedGeometryBoundSemantics : protected agxData::EntityPtr
149  {
150  public:
151 
152  // Automatic getters
153  agx::Physics::GeometryPtr const& getGeometry() const;
154  agx::Bound3 const& getLocalBound() const;
155  agx::Vec3 const& getHalfExtents() const;
156  agx::AffineMatrix4x4 const& getInvTransform() const;
157 
158  // Semantics defined by explicit kernels
159 
160  // Automatic setters
161  void setGeometry(agx::Physics::GeometryPtr const& value);
162  void setLocalBound(agx::Bound3 const& value);
163  void setHalfExtents(agx::Vec3 const& value);
164  void setInvTransform(agx::AffineMatrix4x4 const& value);
165 
166 
167  protected:
168  friend class OrientedGeometryBoundPtr;
169  friend class OrientedGeometryBoundInstance;
170  OrientedGeometryBoundSemantics();
171  };
173 
174 
175 
178  class CALLABLE OrientedGeometryBoundPtr : public agxData::EntityPtr
179  {
180  public:
182  typedef OrientedGeometryBoundData DataType;
183  typedef OrientedGeometryBoundInstance InstanceType;
184 
185  public:
192  AGXPHYSICS_EXPORT OrientedGeometryBoundInstance instance();
193  AGXPHYSICS_EXPORT const OrientedGeometryBoundInstance instance() const;
194 
195  AGXPHYSICS_EXPORT OrientedGeometryBoundSemantics* operator->();
196  AGXPHYSICS_EXPORT const OrientedGeometryBoundSemantics* operator->() const;
197 
198  OrientedGeometryBoundData* getData();
199  const OrientedGeometryBoundData* getData() const;
200 
201 
206 
211 
216 
221 
223  // Only used by tolua!
224  #ifdef AGX_GENERATED_TOLUA_WRAPPER
225  inline agx::Physics::GeometryPtr const& getGeometry() const { return (*this)->getGeometry(); }
226  inline agx::Bound3 const& getLocalBound() const { return (*this)->getLocalBound(); }
227  inline agx::Vec3 const& getHalfExtents() const { return (*this)->getHalfExtents(); }
228  inline agx::AffineMatrix4x4 const& getInvTransform() const { return (*this)->getInvTransform(); }
229 
230 
231  inline void setGeometry(agx::Physics::GeometryPtr const& value) { (*this)->setGeometry(value); }
232  inline void setLocalBound(agx::Bound3 const& value) { (*this)->setLocalBound(value); }
233  inline void setHalfExtents(agx::Vec3 const& value) { (*this)->setHalfExtents(value); }
234  inline void setInvTransform(agx::AffineMatrix4x4 const& value) { (*this)->setInvTransform(value); }
235  #endif
237 
238  };
239 
240 
242  class AGXPHYSICS_EXPORT OrientedGeometryBoundInstance : public agxData::EntityInstance
243  {
244  public:
245  OrientedGeometryBoundInstance();
246  OrientedGeometryBoundInstance(OrientedGeometryBoundData* data, agx::Index index);
247  OrientedGeometryBoundInstance(agxData::EntityStorage *storage, agx::Index index);
248  OrientedGeometryBoundInstance(const agxData::EntityInstance& other);
249  OrientedGeometryBoundInstance(const agxData::EntityPtr& ptr);
250 
251  OrientedGeometryBoundData* getData();
252  const OrientedGeometryBoundData* getData() const;
253 
254  public:
256  agx::Physics::GeometryPtr& geometry();
258  agx::Physics::GeometryPtr const& geometry() const;
259 
261  agx::Bound3& localBound();
263  agx::Bound3 const& localBound() const;
264 
266  agx::Vec3& halfExtents();
268  agx::Vec3 const& halfExtents() const;
269 
271  agx::AffineMatrix4x4& invTransform();
273  agx::AffineMatrix4x4 const& invTransform() const;
274 
275  };
277 
278 
279 
282 
283 
284 
286  /* Implementation */
287  //-----------------------------------------------------------------------------------------------------
288  //-----------------------------------------------------------------------------------------------------
289  inline OrientedGeometryBoundInstance agx::Physics::HierarchicalGrid::OrientedGeometryBoundData::operator[] (size_t index) { return OrientedGeometryBoundInstance(this, (agx::Index)index); }
290  //-----------------------------------------------------------------------------------------------------
293  AGX_FORCE_INLINE OrientedGeometryBoundPtr::OrientedGeometryBoundPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
294  {
296  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
298  }
299 
300  AGX_FORCE_INLINE OrientedGeometryBoundPtr::OrientedGeometryBoundPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
301  {
303  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
305  }
306 
307  AGX_FORCE_INLINE OrientedGeometryBoundPtr& OrientedGeometryBoundPtr::operator= (const agxData::EntityPtr& ptr)
308  {
310  agxAssertN(!ptr || ptr.isInstanceOf(OrientedGeometryBoundModel::instance()),
311  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
312  EntityPtr::getModel()->fullPath().c_str(), OrientedGeometryBoundModel::instance()->fullPath().c_str());
313  return *this;
314  }
315 
316  AGX_FORCE_INLINE OrientedGeometryBoundPtr& OrientedGeometryBoundPtr::operator= (const agxData::EntityInstance& instance)
317  {
319  agxAssertN(!instance || instance.isInstanceOf(OrientedGeometryBoundModel::instance()),
320  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
321  EntityPtr::getModel()->fullPath().c_str(), OrientedGeometryBoundModel::instance()->fullPath().c_str());
322  return *this;
323  }
324 
325  inline OrientedGeometryBoundInstance OrientedGeometryBoundPtr::instance() { return agxData::EntityPtr::instance(); }
326  inline const OrientedGeometryBoundInstance OrientedGeometryBoundPtr::instance() const { return agxData::EntityPtr::instance(); }
327  AGX_FORCE_INLINE OrientedGeometryBoundSemantics* OrientedGeometryBoundPtr::operator->() { return (OrientedGeometryBoundSemantics* )this; }
328  AGX_FORCE_INLINE const OrientedGeometryBoundSemantics* OrientedGeometryBoundPtr::operator->() const { return (const OrientedGeometryBoundSemantics* )this; }
329  AGX_FORCE_INLINE OrientedGeometryBoundData* OrientedGeometryBoundPtr::getData() { return static_cast<OrientedGeometryBoundData* >(agxData::EntityPtr::getData()); }
330  AGX_FORCE_INLINE const OrientedGeometryBoundData* OrientedGeometryBoundPtr::getData() const { return static_cast<const OrientedGeometryBoundData* >(agxData::EntityPtr::getData()); }
331 
332  AGX_FORCE_INLINE agx::Physics::GeometryPtr& OrientedGeometryBoundPtr::geometry() { verifyIndex(); return getData()->geometry[calculateIndex()]; }
333  AGX_FORCE_INLINE agx::Physics::GeometryPtr const& OrientedGeometryBoundPtr::geometry() const { verifyIndex(); return getData()->geometry[calculateIndex()]; }
334 
335  AGX_FORCE_INLINE agx::Bound3& OrientedGeometryBoundPtr::localBound() { verifyIndex(); return getData()->localBound[calculateIndex()]; }
336  AGX_FORCE_INLINE agx::Bound3 const& OrientedGeometryBoundPtr::localBound() const { verifyIndex(); return getData()->localBound[calculateIndex()]; }
337 
338  AGX_FORCE_INLINE agx::Vec3& OrientedGeometryBoundPtr::halfExtents() { verifyIndex(); return getData()->halfExtents[calculateIndex()]; }
339  AGX_FORCE_INLINE agx::Vec3 const& OrientedGeometryBoundPtr::halfExtents() const { verifyIndex(); return getData()->halfExtents[calculateIndex()]; }
340 
341  AGX_FORCE_INLINE agx::AffineMatrix4x4& OrientedGeometryBoundPtr::invTransform() { verifyIndex(); return getData()->invTransform[calculateIndex()]; }
342  AGX_FORCE_INLINE agx::AffineMatrix4x4 const& OrientedGeometryBoundPtr::invTransform() const { verifyIndex(); return getData()->invTransform[calculateIndex()]; }
343 
344  //-----------------------------------------------------------------------------------------------------
345  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance() {}
346  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance(OrientedGeometryBoundData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
347  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
348  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
349  {
351  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
353  }
354 
355  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
356  {
358  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
360  }
361 
362 
363  AGX_FORCE_INLINE OrientedGeometryBoundData* OrientedGeometryBoundInstance::getData() { return static_cast<OrientedGeometryBoundData* >(agxData::EntityInstance::getData()); }
364  AGX_FORCE_INLINE const OrientedGeometryBoundData* OrientedGeometryBoundInstance::getData() const { return static_cast<const OrientedGeometryBoundData* >(agxData::EntityInstance::getData()); }
365 
366  AGX_FORCE_INLINE agx::Physics::GeometryPtr& OrientedGeometryBoundInstance::geometry() { verifyIndex(); return getData()->geometry[getIndex()]; }
367  AGX_FORCE_INLINE agx::Physics::GeometryPtr const& OrientedGeometryBoundInstance::geometry() const { verifyIndex(); return getData()->geometry[getIndex()]; }
368 
369  AGX_FORCE_INLINE agx::Bound3& OrientedGeometryBoundInstance::localBound() { verifyIndex(); return getData()->localBound[getIndex()]; }
370  AGX_FORCE_INLINE agx::Bound3 const& OrientedGeometryBoundInstance::localBound() const { verifyIndex(); return getData()->localBound[getIndex()]; }
371 
372  AGX_FORCE_INLINE agx::Vec3& OrientedGeometryBoundInstance::halfExtents() { verifyIndex(); return getData()->halfExtents[getIndex()]; }
373  AGX_FORCE_INLINE agx::Vec3 const& OrientedGeometryBoundInstance::halfExtents() const { verifyIndex(); return getData()->halfExtents[getIndex()]; }
374 
375  AGX_FORCE_INLINE agx::AffineMatrix4x4& OrientedGeometryBoundInstance::invTransform() { verifyIndex(); return getData()->invTransform[getIndex()]; }
376  AGX_FORCE_INLINE agx::AffineMatrix4x4 const& OrientedGeometryBoundInstance::invTransform() const { verifyIndex(); return getData()->invTransform[getIndex()]; }
377 
378  //-----------------------------------------------------------------------------------------------------
379  AGX_FORCE_INLINE OrientedGeometryBoundSemantics::OrientedGeometryBoundSemantics() {}
380  //-----------------------------------------------------------------------------------------------------
382  }
383  }
384 }
385 
386 AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::OrientedGeometryBoundPtr, "Physics.HierarchicalGrid.OrientedGeometryBoundPtr")
387 AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::OrientedGeometryBoundInstance, "Physics.HierarchicalGrid.OrientedGeometryBoundInstance")
388 
389 #ifdef _MSC_VER
390 # pragma warning(pop)
391 #endif
392 
393 #undef AGX_ENTITY_WRAPPER
394 #undef AGX_ENTITY_NAMESPACE
395 #endif
396 
#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()
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:64
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
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.HierarchicalGrid.OrientedGeometryBound en...
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
void construct(agx::Physics::HierarchicalGrid::OrientedGeometryBoundPtr orientedGeometryBound)
static agxData::ScalarAttributeT< agx::Physics::GeometryPtr > * geometryAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agx::Vec3 > * halfExtentsAttribute
virtual void configure(agx::TiXmlElement *eEntity) override
OrientedGeometryBoundModel(const agx::String &name="OrientedGeometryBound")
static OrientedGeometryBoundPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ScalarAttributeT< agx::Bound3 > * localBoundAttribute
static agxData::ScalarAttributeT< agx::AffineMatrix4x4 > * invTransformAttribute
static OrientedGeometryBoundModel * instance()
Pointer to a entity instance of type Physics.HierarchicalGrid.OrientedGeometryBound.
AGXPHYSICS_EXPORT agx::Bound3 const & localBound() const
AGXPHYSICS_EXPORT OrientedGeometryBoundPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::AffineMatrix4x4 & invTransform()
const OrientedGeometryBoundData * getData() const
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr const & geometry() const
AGXPHYSICS_EXPORT OrientedGeometryBoundSemantics * operator->()
AGXPHYSICS_EXPORT agx::Vec3 const & halfExtents() const
AGXPHYSICS_EXPORT const OrientedGeometryBoundInstance instance() const
AGXPHYSICS_EXPORT agx::AffineMatrix4x4 const & invTransform() const
AGXPHYSICS_EXPORT OrientedGeometryBoundInstance instance()
AGXPHYSICS_EXPORT const OrientedGeometryBoundSemantics * operator->() const
AGXPHYSICS_EXPORT OrientedGeometryBoundPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry()
AGXPHYSICS_EXPORT OrientedGeometryBoundPtr(agxData::EntityStorage *storage, agx::Index id)
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
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