AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
SurfaceMaterialEntity.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_SURFACEMATERIAL_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_SURFACEMATERIAL_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/Real.h>
49#include <agx/Integer.h>
50
51
52namespace agx
53{
54 namespace Physics
55 {
56
57 class SurfaceMaterialModel;
58 class SurfaceMaterialData;
59 class SurfaceMaterialPtr;
60 class SurfaceMaterialInstance;
61 class SurfaceMaterialSemantics;
62
63
65
70 {
71 public:
73
74 SurfaceMaterialModel(const agx::String& name = "SurfaceMaterial");
75
78
81
84
86 virtual void shutdownCleanup() override;
87
88
89
90 /* Attributes */
97
98 protected:
100 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
101 virtual void configure(agx::TiXmlElement* eEntity) override;
102 virtual void initAttributeAccessors() override;
103 virtual void construct(agxData::EntityPtr instance) override;
105 };
106
107
109 #ifndef AGX_PHYSICS_SURFACEMATERIAL_DATA_SET_OVERRIDE
110 #define AGX_PHYSICS_SURFACEMATERIAL_DATA_SET
111 class AGXPHYSICS_EXPORT SurfaceMaterialData : public agx::ReferencedData
112 {
113 public:
114 SurfaceMaterialInstance operator[] (size_t index);
115
116 public:
120 agxData::Array< agx::Real > adhesiveOverlap;
122 agxData::Array< agx::Bool > frictionEnabled;
124
125 public:
126 typedef agx::Real roughnessType;
127 typedef agx::Real adhesionType;
128 typedef agx::Real adhesiveOverlapType;
129 typedef agx::Real viscosityType;
130 typedef agx::Bool frictionEnabledType;
131 typedef agx::Bool dirtyType;
132
133 public:
134 SurfaceMaterialData(agxData::EntityStorage* storage);
135 SurfaceMaterialData();
136
137 protected:
138 virtual ~SurfaceMaterialData() {}
139 virtual void setNumElements(agx::Index numElements) override;
140
141 private:
142 SurfaceMaterialData& operator= (const SurfaceMaterialData&) { return *this; }
143
144 };
145 #endif
147
148
150 class AGXPHYSICS_EXPORT SurfaceMaterialSemantics : public agx::ReferencedSemantics
151 {
152 public:
153
154 // Automatic getters
155 agx::Real const& getRoughness() const;
156 agx::Real const& getAdhesion() const;
157 agx::Real const& getAdhesiveOverlap() const;
158 agx::Real const& getViscosity() const;
159 agx::Bool const& getFrictionEnabled() const;
160 agx::Bool const& getDirty() const;
161
162 // Semantics defined by explicit kernels
163
164 // Automatic setters
165 void setRoughness(agx::Real const& value);
166 void setAdhesion(agx::Real const& value);
167 void setAdhesiveOverlap(agx::Real const& value);
168 void setViscosity(agx::Real const& value);
169 void setFrictionEnabled(agx::Bool const& value);
170 void setDirty(agx::Bool const& value);
171
172
173 protected:
174 friend class SurfaceMaterialPtr;
175 friend class SurfaceMaterialInstance;
176 SurfaceMaterialSemantics();
177 };
179
180
181
185 {
186 public:
188 typedef SurfaceMaterialData DataType;
189 typedef SurfaceMaterialInstance InstanceType;
190
191 public:
198 AGXPHYSICS_EXPORT SurfaceMaterialInstance instance();
199 AGXPHYSICS_EXPORT const SurfaceMaterialInstance instance() const;
200
201 AGXPHYSICS_EXPORT SurfaceMaterialSemantics* operator->();
202 AGXPHYSICS_EXPORT const SurfaceMaterialSemantics* operator->() const;
203
204 SurfaceMaterialData* getData();
205 const SurfaceMaterialData* getData() const;
206
207
212
217
222
227
232
237
238 };
239
240 // Entity is Referenced
242
243
245 class AGXPHYSICS_EXPORT SurfaceMaterialInstance : public agx::ReferencedInstance
246 {
247 public:
248 SurfaceMaterialInstance();
249 SurfaceMaterialInstance(SurfaceMaterialData* data, agx::Index index);
250 SurfaceMaterialInstance(agxData::EntityStorage *storage, agx::Index index);
251 SurfaceMaterialInstance(const agxData::EntityInstance& other);
252 SurfaceMaterialInstance(const agxData::EntityPtr& ptr);
253
254 SurfaceMaterialData* getData();
255 const SurfaceMaterialData* getData() const;
256
257 public:
259 agx::Real& roughness();
261 agx::Real const& roughness() const;
262
264 agx::Real& adhesion();
266 agx::Real const& adhesion() const;
267
269 agx::Real& adhesiveOverlap();
271 agx::Real const& adhesiveOverlap() const;
272
274 agx::Real& viscosity();
276 agx::Real const& viscosity() const;
277
279 agx::Bool& frictionEnabled();
281 agx::Bool const& frictionEnabled() const;
282
284 agx::Bool& dirty();
286 agx::Bool const& dirty() const;
287
288 };
290
291
292
295
296
297
299 /* Implementation */
300 //-----------------------------------------------------------------------------------------------------
301 //-----------------------------------------------------------------------------------------------------
302 inline SurfaceMaterialInstance agx::Physics::SurfaceMaterialData::operator[] (size_t index) { return SurfaceMaterialInstance(this, (agx::Index)index); }
303 //-----------------------------------------------------------------------------------------------------
306 AGX_FORCE_INLINE SurfaceMaterialPtr::SurfaceMaterialPtr(const agxData::EntityPtr& ptr) : agx::ReferencedPtr(ptr)
307 {
309 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
310 EntityPtr::getModel()->fullPath().c_str(), SurfaceMaterialModel::instance()->fullPath().c_str());
311 }
312
313 AGX_FORCE_INLINE SurfaceMaterialPtr::SurfaceMaterialPtr(const agxData::EntityInstance& instance) : agx::ReferencedPtr(instance)
314 {
316 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
317 EntityPtr::getModel()->fullPath().c_str(), SurfaceMaterialModel::instance()->fullPath().c_str());
318 }
319
320 AGX_FORCE_INLINE SurfaceMaterialPtr& SurfaceMaterialPtr::operator= (const agxData::EntityPtr& ptr)
321 {
323 agxAssertN(!ptr || ptr.isInstanceOf(SurfaceMaterialModel::instance()),
324 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
325 EntityPtr::getModel()->fullPath().c_str(), SurfaceMaterialModel::instance()->fullPath().c_str());
326 return *this;
327 }
328
329 AGX_FORCE_INLINE SurfaceMaterialPtr& SurfaceMaterialPtr::operator= (const agxData::EntityInstance& instance)
330 {
332 agxAssertN(!instance || instance.isInstanceOf(SurfaceMaterialModel::instance()),
333 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
334 EntityPtr::getModel()->fullPath().c_str(), SurfaceMaterialModel::instance()->fullPath().c_str());
335 return *this;
336 }
337
338 inline SurfaceMaterialInstance SurfaceMaterialPtr::instance() { return agxData::EntityPtr::instance(); }
339 inline const SurfaceMaterialInstance SurfaceMaterialPtr::instance() const { return agxData::EntityPtr::instance(); }
340 AGX_FORCE_INLINE SurfaceMaterialSemantics* SurfaceMaterialPtr::operator->() { return (SurfaceMaterialSemantics* )this; }
341 AGX_FORCE_INLINE const SurfaceMaterialSemantics* SurfaceMaterialPtr::operator->() const { return (const SurfaceMaterialSemantics* )this; }
342 AGX_FORCE_INLINE SurfaceMaterialData* SurfaceMaterialPtr::getData() { return static_cast<SurfaceMaterialData* >(agxData::EntityPtr::getData()); }
343 AGX_FORCE_INLINE const SurfaceMaterialData* SurfaceMaterialPtr::getData() const { return static_cast<const SurfaceMaterialData* >(agxData::EntityPtr::getData()); }
344
345 AGX_FORCE_INLINE agx::Real& SurfaceMaterialPtr::roughness() { verifyIndex(); return getData()->roughness[calculateIndex()]; }
346 AGX_FORCE_INLINE agx::Real const& SurfaceMaterialPtr::roughness() const { verifyIndex(); return getData()->roughness[calculateIndex()]; }
347
348 AGX_FORCE_INLINE agx::Real& SurfaceMaterialPtr::adhesion() { verifyIndex(); return getData()->adhesion[calculateIndex()]; }
349 AGX_FORCE_INLINE agx::Real const& SurfaceMaterialPtr::adhesion() const { verifyIndex(); return getData()->adhesion[calculateIndex()]; }
350
351 AGX_FORCE_INLINE agx::Real& SurfaceMaterialPtr::adhesiveOverlap() { verifyIndex(); return getData()->adhesiveOverlap[calculateIndex()]; }
352 AGX_FORCE_INLINE agx::Real const& SurfaceMaterialPtr::adhesiveOverlap() const { verifyIndex(); return getData()->adhesiveOverlap[calculateIndex()]; }
353
354 AGX_FORCE_INLINE agx::Real& SurfaceMaterialPtr::viscosity() { verifyIndex(); return getData()->viscosity[calculateIndex()]; }
355 AGX_FORCE_INLINE agx::Real const& SurfaceMaterialPtr::viscosity() const { verifyIndex(); return getData()->viscosity[calculateIndex()]; }
356
357 AGX_FORCE_INLINE agx::Bool& SurfaceMaterialPtr::frictionEnabled() { verifyIndex(); return getData()->frictionEnabled[calculateIndex()]; }
358 AGX_FORCE_INLINE agx::Bool const& SurfaceMaterialPtr::frictionEnabled() const { verifyIndex(); return getData()->frictionEnabled[calculateIndex()]; }
359
360 AGX_FORCE_INLINE agx::Bool& SurfaceMaterialPtr::dirty() { verifyIndex(); return getData()->dirty[calculateIndex()]; }
361 AGX_FORCE_INLINE agx::Bool const& SurfaceMaterialPtr::dirty() const { verifyIndex(); return getData()->dirty[calculateIndex()]; }
362
363 //-----------------------------------------------------------------------------------------------------
364 AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance() {}
365 AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance(SurfaceMaterialData* data, agx::Index index) : agx::ReferencedInstance(data, index) {}
366 AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance(agxData::EntityStorage* storage, agx::Index index) : agx::ReferencedInstance(storage, index) {}
367 AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance(const agxData::EntityInstance& other) : agx::ReferencedInstance(other)
368 {
370 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
371 EntityInstance::getModel()->fullPath().c_str(), SurfaceMaterialModel::instance()->fullPath().c_str());
372 }
373
374 AGX_FORCE_INLINE SurfaceMaterialInstance::SurfaceMaterialInstance(const agxData::EntityPtr& ptr) : agx::ReferencedInstance(ptr)
375 {
377 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
378 EntityInstance::getModel()->fullPath().c_str(), SurfaceMaterialModel::instance()->fullPath().c_str());
379 }
380
381
382 AGX_FORCE_INLINE SurfaceMaterialData* SurfaceMaterialInstance::getData() { return static_cast<SurfaceMaterialData* >(agxData::EntityInstance::getData()); }
383 AGX_FORCE_INLINE const SurfaceMaterialData* SurfaceMaterialInstance::getData() const { return static_cast<const SurfaceMaterialData* >(agxData::EntityInstance::getData()); }
384
385 AGX_FORCE_INLINE agx::Real& SurfaceMaterialInstance::roughness() { verifyIndex(); return getData()->roughness[getIndex()]; }
386 AGX_FORCE_INLINE agx::Real const& SurfaceMaterialInstance::roughness() const { verifyIndex(); return getData()->roughness[getIndex()]; }
387
388 AGX_FORCE_INLINE agx::Real& SurfaceMaterialInstance::adhesion() { verifyIndex(); return getData()->adhesion[getIndex()]; }
389 AGX_FORCE_INLINE agx::Real const& SurfaceMaterialInstance::adhesion() const { verifyIndex(); return getData()->adhesion[getIndex()]; }
390
391 AGX_FORCE_INLINE agx::Real& SurfaceMaterialInstance::adhesiveOverlap() { verifyIndex(); return getData()->adhesiveOverlap[getIndex()]; }
392 AGX_FORCE_INLINE agx::Real const& SurfaceMaterialInstance::adhesiveOverlap() const { verifyIndex(); return getData()->adhesiveOverlap[getIndex()]; }
393
394 AGX_FORCE_INLINE agx::Real& SurfaceMaterialInstance::viscosity() { verifyIndex(); return getData()->viscosity[getIndex()]; }
395 AGX_FORCE_INLINE agx::Real const& SurfaceMaterialInstance::viscosity() const { verifyIndex(); return getData()->viscosity[getIndex()]; }
396
397 AGX_FORCE_INLINE agx::Bool& SurfaceMaterialInstance::frictionEnabled() { verifyIndex(); return getData()->frictionEnabled[getIndex()]; }
398 AGX_FORCE_INLINE agx::Bool const& SurfaceMaterialInstance::frictionEnabled() const { verifyIndex(); return getData()->frictionEnabled[getIndex()]; }
399
400 AGX_FORCE_INLINE agx::Bool& SurfaceMaterialInstance::dirty() { verifyIndex(); return getData()->dirty[getIndex()]; }
401 AGX_FORCE_INLINE agx::Bool const& SurfaceMaterialInstance::dirty() const { verifyIndex(); return getData()->dirty[getIndex()]; }
402
403 //-----------------------------------------------------------------------------------------------------
404 AGX_FORCE_INLINE SurfaceMaterialSemantics::SurfaceMaterialSemantics() {}
405 //-----------------------------------------------------------------------------------------------------
407 }
408}
409
410AGX_TYPE_BINDING(agx::Physics::SurfaceMaterialPtr, "Physics.SurfaceMaterialPtr")
411AGX_TYPE_BINDING(agx::Physics::SurfaceMaterialInstance, "Physics.SurfaceMaterialInstance")
412
413#ifdef _MSC_VER
414# pragma warning(pop)
415#endif
416
417#undef AGX_ENTITY_WRAPPER
418#undef AGX_ENTITY_NAMESPACE
419#endif
420
#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
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.SurfaceMaterial entity.
static agxData::EntityStorage * defaultStorage()
void construct(agx::Physics::SurfaceMaterialPtr surfaceMaterial)
static agxData::ScalarAttributeT< agx::Real > * viscosityAttribute
static agxData::ScalarAttributeT< agx::Bool > * dirtyAttribute
static agxData::ScalarAttributeT< agx::Real > * adhesionAttribute
SurfaceMaterialModel(const agx::String &name="SurfaceMaterial")
static SurfaceMaterialModel * instance()
virtual void initAttributeAccessors() override
virtual void construct(agxData::EntityPtr instance) override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static SurfaceMaterialPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
virtual void configure(agx::TiXmlElement *eEntity) override
static agxData::ScalarAttributeT< agx::Bool > * frictionEnabledAttribute
static agxData::ScalarAttributeT< agx::Real > * adhesiveOverlapAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static agxData::ScalarAttributeT< agx::Real > * roughnessAttribute
Pointer to a entity instance of type Physics.SurfaceMaterial.
AGXPHYSICS_EXPORT const SurfaceMaterialInstance instance() const
AGXPHYSICS_EXPORT SurfaceMaterialInstance instance()
AGXPHYSICS_EXPORT agx::Real & adhesion()
AGXPHYSICS_EXPORT agx::Real & viscosity()
AGXPHYSICS_EXPORT SurfaceMaterialSemantics * operator->()
AGXPHYSICS_EXPORT agx::Real const & viscosity() const
AGXPHYSICS_EXPORT agx::Bool & dirty()
AGXPHYSICS_EXPORT agx::Real & adhesiveOverlap()
AGXPHYSICS_EXPORT agx::Bool & frictionEnabled()
AGXPHYSICS_EXPORT agx::Bool const & frictionEnabled() const
AGXPHYSICS_EXPORT const SurfaceMaterialSemantics * operator->() const
AGXPHYSICS_EXPORT SurfaceMaterialPtr(const agxData::EntityInstance &instance)
SurfaceMaterialData * getData()
const SurfaceMaterialData * getData() const
AGXPHYSICS_EXPORT agx::Real const & roughness() const
AGXPHYSICS_EXPORT agx::Real const & adhesiveOverlap() const
AGXPHYSICS_EXPORT agx::Real & roughness()
AGXPHYSICS_EXPORT SurfaceMaterialPtr()
AGXPHYSICS_EXPORT agx::Bool const & dirty() const
AGXPHYSICS_EXPORT agx::Real const & adhesion() const
AGXPHYSICS_EXPORT SurfaceMaterialPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT SurfaceMaterialPtr(const agxData::EntityPtr &ptr)
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
Contains classes for low level data storage for AGX.
Definition: Container.h:23
AGXOSG_EXPORT void setRoughness(osg::Node *node, float roughness, bool override=false)
Set the roughness of the material.
agxData::EntityRef< SurfaceMaterialPtr > SurfaceMaterialRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition: Integer.h:40
double Real
Definition: Real.h:41
UInt32 Index
Definition: Integer.h:44