AGX Dynamics  2.38.0.2
HeightFieldEntity.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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_HEIGHTFIELD_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GEOMETRY_HEIGHTFIELD_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 HeightFieldModel;
58  class HeightFieldData;
59  class HeightFieldPtr;
60  class HeightFieldInstance;
61  class HeightFieldSemantics;
62 
63 
65 
70  {
71  public:
73 
74  HeightFieldModel(const agx::String& name = "HeightField");
75 
77  static HeightFieldModel* instance();
78 
80  static HeightFieldPtr createInstance();
81 
83  static agxData::EntityStorage* defaultStorage();
84 
86  virtual void shutdownCleanup() override;
87 
88 
89 
90  /* Attributes */
91 
92  protected:
93  virtual ~HeightFieldModel();
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;
98  void construct(agx::Physics::Geometry::HeightFieldPtr heightField);
99  };
100 
101 
103  #ifndef AGX_PHYSICS_GEOMETRY_HEIGHTFIELD_DATA_SET_OVERRIDE
104  #define AGX_PHYSICS_GEOMETRY_HEIGHTFIELD_DATA_SET
105  class AGXPHYSICS_EXPORT HeightFieldData : public agx::Physics::Geometry::MeshData
106  {
107  public:
108  HeightFieldInstance operator[] (size_t index);
109 
110  public:
112 
113  public:
114 
115  public:
116  HeightFieldData(agxData::EntityStorage* storage);
117  HeightFieldData();
118 
119  protected:
120  virtual ~HeightFieldData() {}
121  virtual void setNumElements(agx::Index numElements) override;
122 
123  private:
124  HeightFieldData& operator= (const HeightFieldData&) { return *this; }
125 
126  };
127  #endif
129 
130 
132  class AGXPHYSICS_EXPORT HeightFieldSemantics : public agx::Physics::Geometry::MeshSemantics
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 HeightFieldPtr;
145  friend class HeightFieldInstance;
146  HeightFieldSemantics();
147  };
149 
150 
151 
154  class CALLABLE HeightFieldPtr : public agx::Physics::Geometry::MeshPtr
155  {
156  public:
158  typedef HeightFieldData DataType;
159  typedef HeightFieldInstance InstanceType;
160 
161  public:
166  AGXPHYSICS_EXPORT HeightFieldPtr& operator= (const agxData::EntityPtr& ptr);
167  AGXPHYSICS_EXPORT HeightFieldPtr& operator= (const agxData::EntityInstance& instance);
168  AGXPHYSICS_EXPORT HeightFieldInstance instance();
169  AGXPHYSICS_EXPORT const HeightFieldInstance instance() const;
170 
171  AGXPHYSICS_EXPORT HeightFieldSemantics* operator->();
172  AGXPHYSICS_EXPORT const HeightFieldSemantics* operator->() const;
173 
174  HeightFieldData* getData();
175  const HeightFieldData* getData() const;
176 
177 
178  };
179 
180  // Entity is Referenced
182 
183 
185  class AGXPHYSICS_EXPORT HeightFieldInstance : public agx::Physics::Geometry::MeshInstance
186  {
187  public:
188  HeightFieldInstance();
189  HeightFieldInstance(HeightFieldData* data, agx::Index index);
190  HeightFieldInstance(agxData::EntityStorage *storage, agx::Index index);
191  HeightFieldInstance(const agxData::EntityInstance& other);
192  HeightFieldInstance(const agxData::EntityPtr& ptr);
193 
194  HeightFieldData* getData();
195  const HeightFieldData* getData() const;
196 
197  public:
198  };
200 
201 
202 
205 
206 
207 
209  /* Implementation */
210  //-----------------------------------------------------------------------------------------------------
211  //-----------------------------------------------------------------------------------------------------
212  inline HeightFieldInstance agx::Physics::Geometry::HeightFieldData::operator[] (size_t index) { return HeightFieldInstance(this, (agx::Index)index); }
213  //-----------------------------------------------------------------------------------------------------
215  AGX_FORCE_INLINE HeightFieldPtr::HeightFieldPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::MeshPtr(storage, id) {}
216  AGX_FORCE_INLINE HeightFieldPtr::HeightFieldPtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::MeshPtr(ptr)
217  {
219  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
221  }
222 
223  AGX_FORCE_INLINE HeightFieldPtr::HeightFieldPtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::MeshPtr(instance)
224  {
225  agxAssertN(!instance || instance.isInstanceOf(HeightFieldModel::instance()),
226  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
228  }
229 
230  AGX_FORCE_INLINE HeightFieldPtr& HeightFieldPtr::operator= (const agxData::EntityPtr& ptr)
231  {
233  agxAssertN(!ptr || ptr.isInstanceOf(HeightFieldModel::instance()),
234  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
235  EntityPtr::getModel()->fullPath().c_str(), HeightFieldModel::instance()->fullPath().c_str());
236  return *this;
237  }
238 
239  AGX_FORCE_INLINE HeightFieldPtr& HeightFieldPtr::operator= (const agxData::EntityInstance& instance)
240  {
242  agxAssertN(!instance || instance.isInstanceOf(HeightFieldModel::instance()),
243  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
244  EntityPtr::getModel()->fullPath().c_str(), HeightFieldModel::instance()->fullPath().c_str());
245  return *this;
246  }
247 
248  inline HeightFieldInstance HeightFieldPtr::instance() { return agxData::EntityPtr::instance(); }
249  inline const HeightFieldInstance HeightFieldPtr::instance() const { return agxData::EntityPtr::instance(); }
250  AGX_FORCE_INLINE HeightFieldSemantics* HeightFieldPtr::operator->() { return (HeightFieldSemantics* )this; }
251  AGX_FORCE_INLINE const HeightFieldSemantics* HeightFieldPtr::operator->() const { return (const HeightFieldSemantics* )this; }
252  AGX_FORCE_INLINE HeightFieldData* HeightFieldPtr::getData() { return static_cast<HeightFieldData* >(agxData::EntityPtr::getData()); }
253  AGX_FORCE_INLINE const HeightFieldData* HeightFieldPtr::getData() const { return static_cast<const HeightFieldData* >(agxData::EntityPtr::getData()); }
254 
255  //-----------------------------------------------------------------------------------------------------
256  AGX_FORCE_INLINE HeightFieldInstance::HeightFieldInstance() {}
257  AGX_FORCE_INLINE HeightFieldInstance::HeightFieldInstance(HeightFieldData* data, agx::Index index) : agx::Physics::Geometry::MeshInstance(data, index) {}
258  AGX_FORCE_INLINE HeightFieldInstance::HeightFieldInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::MeshInstance(storage, index) {}
259  AGX_FORCE_INLINE HeightFieldInstance::HeightFieldInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::MeshInstance(other)
260  {
262  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
264  }
265 
266  AGX_FORCE_INLINE HeightFieldInstance::HeightFieldInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::MeshInstance(ptr)
267  {
269  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
271  }
272 
273 
274  AGX_FORCE_INLINE HeightFieldData* HeightFieldInstance::getData() { return static_cast<HeightFieldData* >(agxData::EntityInstance::getData()); }
275  AGX_FORCE_INLINE const HeightFieldData* HeightFieldInstance::getData() const { return static_cast<const HeightFieldData* >(agxData::EntityInstance::getData()); }
276 
277  //-----------------------------------------------------------------------------------------------------
278  AGX_FORCE_INLINE HeightFieldSemantics::HeightFieldSemantics() {}
279  //-----------------------------------------------------------------------------------------------------
281  }
282  }
283 }
284 
285 AGX_TYPE_BINDING(agx::Physics::Geometry::HeightFieldPtr, "Physics.Geometry.HeightFieldPtr")
286 AGX_TYPE_BINDING(agx::Physics::Geometry::HeightFieldInstance, "Physics.Geometry.HeightFieldInstance")
287 
288 #ifdef _MSC_VER
289 # pragma warning(pop)
290 #endif
291 
292 #undef AGX_ENTITY_WRAPPER
293 #undef AGX_ENTITY_NAMESPACE
294 #endif
295 
agx::Physics::Geometry::HeightFieldModel
Abstract description of the data attributes for the Physics.Geometry.HeightField entity.
Definition: HeightFieldEntity.h:69
agx::Physics::Geometry::MeshModel
Abstract description of the data attributes for the Physics.Geometry.Mesh entity.
Definition: MeshEntity.h:69
agx::Physics::Geometry::HeightFieldModel::instance
static HeightFieldModel * instance()
agx::Physics::Geometry::HeightFieldPtr::HeightFieldPtr
AGXPHYSICS_EXPORT HeightFieldPtr()
agx::Physics::Geometry::HeightFieldRef
agxData::EntityRef< HeightFieldPtr > HeightFieldRef
Definition: HeightFieldEntity.h:181
CALLABLE
#define CALLABLE
Definition: macros.h:72
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agxData::EntityPtr::getData
agxData::EntityData * getData()
Definition: EntityStorage.h:594
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
macros.h
agxData::EntityPtr::isInstanceOf
bool isInstanceOf(agxData::EntityModel *model) const
Definition: EntityStorage.h:784
agx::Model::fullPath
agx::String fullPath() const
agxData::EntityStorage
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
EntityModel.h
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
agxData::EntityPtr::instance
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
agxData::EntityInstance::isInstanceOf
bool isInstanceOf(agxData::EntityModel *model) const
Definition: EntityStorage.h:829
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxData
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::Array
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
EntityStorage.h
EntityRef.h
EntityPtr.h
agx::Physics::Geometry::HeightFieldPtr::InstanceType
HeightFieldInstance InstanceType
Definition: HeightFieldEntity.h:159
agx::Physics::Geometry::HeightFieldModel::PtrT
HeightFieldPtr PtrT
Definition: HeightFieldEntity.h:72
EntityInstance.h
Integer.h
agx::Physics::Geometry::HeightFieldPtr::DataType
HeightFieldData DataType
Definition: HeightFieldEntity.h:158
agxData::EntityPtr::operator=
EntityPtr & operator=(const EntityPtr &other)=default
agx::Index
UInt32 Index
Definition: Integer.h:44
agxData::EntityInstance
Entity instance provides access to a single instance in an EntityStorage.
Definition: EntityInstance.h:43
agxData::EntityInstance::getData
agxData::EntityData * getData()
Definition: EntityInstance.h:149
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agx::Physics::Geometry::HeightFieldPtr
Pointer to a entity instance of type Physics.Geometry.HeightField.
Definition: HeightFieldEntity.h:154
agx::Physics::Geometry::MeshPtr
Pointer to a entity instance of type Physics.Geometry.Mesh.
Definition: MeshEntity.h:154
agxData::EntityRef
An entity reference is a safe/referencing handle to an entity instance whose model is descendant from...
Definition: EntityRef.h:34
agx::AgXString< std::string >
agxAssertN
#define agxAssertN(expr, format,...)
Definition: debug.h:145
agx::Physics::Geometry::HeightFieldPtr::ModelType
HeightFieldModel ModelType
Definition: HeightFieldEntity.h:157
AGX_TYPE_BINDING
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
Real.h
agxData::EntityPtr
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
MeshEntity.h
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agx::getModel
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:363