AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
TrimeshEntity.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_TRIMESH_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_GEOMETRY_TRIMESH_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
49
50namespace agx
51{
52 namespace Physics
53 {
54 namespace Geometry
55 {
56
57 class TrimeshModel;
58 class TrimeshData;
59 class TrimeshPtr;
60 class TrimeshInstance;
61 class TrimeshSemantics;
62
63
65
70 {
71 public:
73
74 TrimeshModel(const agx::String& name = "Trimesh");
75
78
81
84
86 virtual void shutdownCleanup() override;
87
88
89
90 /* Attributes */
91
92 protected:
93 virtual ~TrimeshModel();
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_TRIMESH_DATA_SET_OVERRIDE
104 #define AGX_PHYSICS_GEOMETRY_TRIMESH_DATA_SET
105 class AGXPHYSICS_EXPORT TrimeshData : public agx::Physics::Geometry::MeshData
106 {
107 public:
108 TrimeshInstance operator[] (size_t index);
109
110 public:
112
113 public:
114
115 public:
116 TrimeshData(agxData::EntityStorage* storage);
117 TrimeshData();
118
119 protected:
120 virtual ~TrimeshData() {}
121 virtual void setNumElements(agx::Index numElements) override;
122
123 private:
124 TrimeshData& operator= (const TrimeshData&) { return *this; }
125
126 };
127 #endif
129
130
132 class AGXPHYSICS_EXPORT TrimeshSemantics : 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 TrimeshPtr;
145 friend class TrimeshInstance;
146 TrimeshSemantics();
147 };
149
150
151
154 class CALLABLE TrimeshPtr : public agx::Physics::Geometry::MeshPtr
155 {
156 public:
158 typedef TrimeshData DataType;
159 typedef TrimeshInstance InstanceType;
160
161 public:
168 AGXPHYSICS_EXPORT TrimeshInstance instance();
169 AGXPHYSICS_EXPORT const TrimeshInstance instance() const;
170
171 AGXPHYSICS_EXPORT TrimeshSemantics* operator->();
172 AGXPHYSICS_EXPORT const TrimeshSemantics* operator->() const;
173
174 TrimeshData* getData();
175 const TrimeshData* getData() const;
176
177
178 };
179
180 // Entity is Referenced
182
183
185 class AGXPHYSICS_EXPORT TrimeshInstance : public agx::Physics::Geometry::MeshInstance
186 {
187 public:
188 TrimeshInstance();
189 TrimeshInstance(TrimeshData* data, agx::Index index);
190 TrimeshInstance(agxData::EntityStorage *storage, agx::Index index);
191 TrimeshInstance(const agxData::EntityInstance& other);
192 TrimeshInstance(const agxData::EntityPtr& ptr);
193
194 TrimeshData* getData();
195 const TrimeshData* getData() const;
196
197 public:
198 };
200
201
202
205
206
207
209 /* Implementation */
210 //-----------------------------------------------------------------------------------------------------
211 //-----------------------------------------------------------------------------------------------------
212 inline TrimeshInstance agx::Physics::Geometry::TrimeshData::operator[] (size_t index) { return TrimeshInstance(this, (agx::Index)index); }
213 //-----------------------------------------------------------------------------------------------------
215 AGX_FORCE_INLINE TrimeshPtr::TrimeshPtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::MeshPtr(storage, id) {}
216 AGX_FORCE_INLINE TrimeshPtr::TrimeshPtr(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\'",
220 EntityPtr::getModel()->fullPath().c_str(), TrimeshModel::instance()->fullPath().c_str());
221 }
222
223 AGX_FORCE_INLINE TrimeshPtr::TrimeshPtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::MeshPtr(instance)
224 {
225 agxAssertN(!instance || instance.isInstanceOf(TrimeshModel::instance()),
226 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
227 EntityPtr::getModel()->fullPath().c_str(), TrimeshModel::instance()->fullPath().c_str());
228 }
229
230 AGX_FORCE_INLINE TrimeshPtr& TrimeshPtr::operator= (const agxData::EntityPtr& ptr)
231 {
233 agxAssertN(!ptr || ptr.isInstanceOf(TrimeshModel::instance()),
234 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
235 EntityPtr::getModel()->fullPath().c_str(), TrimeshModel::instance()->fullPath().c_str());
236 return *this;
237 }
238
239 AGX_FORCE_INLINE TrimeshPtr& TrimeshPtr::operator= (const agxData::EntityInstance& instance)
240 {
242 agxAssertN(!instance || instance.isInstanceOf(TrimeshModel::instance()),
243 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
244 EntityPtr::getModel()->fullPath().c_str(), TrimeshModel::instance()->fullPath().c_str());
245 return *this;
246 }
247
248 inline TrimeshInstance TrimeshPtr::instance() { return agxData::EntityPtr::instance(); }
249 inline const TrimeshInstance TrimeshPtr::instance() const { return agxData::EntityPtr::instance(); }
250 AGX_FORCE_INLINE TrimeshSemantics* TrimeshPtr::operator->() { return (TrimeshSemantics* )this; }
251 AGX_FORCE_INLINE const TrimeshSemantics* TrimeshPtr::operator->() const { return (const TrimeshSemantics* )this; }
252 AGX_FORCE_INLINE TrimeshData* TrimeshPtr::getData() { return static_cast<TrimeshData* >(agxData::EntityPtr::getData()); }
253 AGX_FORCE_INLINE const TrimeshData* TrimeshPtr::getData() const { return static_cast<const TrimeshData* >(agxData::EntityPtr::getData()); }
254
255 //-----------------------------------------------------------------------------------------------------
256 AGX_FORCE_INLINE TrimeshInstance::TrimeshInstance() {}
257 AGX_FORCE_INLINE TrimeshInstance::TrimeshInstance(TrimeshData* data, agx::Index index) : agx::Physics::Geometry::MeshInstance(data, index) {}
258 AGX_FORCE_INLINE TrimeshInstance::TrimeshInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::MeshInstance(storage, index) {}
259 AGX_FORCE_INLINE TrimeshInstance::TrimeshInstance(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\'",
263 EntityInstance::getModel()->fullPath().c_str(), TrimeshModel::instance()->fullPath().c_str());
264 }
265
266 AGX_FORCE_INLINE TrimeshInstance::TrimeshInstance(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\'",
270 EntityInstance::getModel()->fullPath().c_str(), TrimeshModel::instance()->fullPath().c_str());
271 }
272
273
274 AGX_FORCE_INLINE TrimeshData* TrimeshInstance::getData() { return static_cast<TrimeshData* >(agxData::EntityInstance::getData()); }
275 AGX_FORCE_INLINE const TrimeshData* TrimeshInstance::getData() const { return static_cast<const TrimeshData* >(agxData::EntityInstance::getData()); }
276
277 //-----------------------------------------------------------------------------------------------------
278 AGX_FORCE_INLINE TrimeshSemantics::TrimeshSemantics() {}
279 //-----------------------------------------------------------------------------------------------------
281 }
282 }
283}
284
285AGX_TYPE_BINDING(agx::Physics::Geometry::TrimeshPtr, "Physics.Geometry.TrimeshPtr")
286AGX_TYPE_BINDING(agx::Physics::Geometry::TrimeshInstance, "Physics.Geometry.TrimeshInstance")
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
#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.Mesh entity.
Definition: MeshEntity.h:70
Pointer to a entity instance of type Physics.Geometry.Mesh.
Definition: MeshEntity.h:155
Abstract description of the data attributes for the Physics.Geometry.Trimesh entity.
Definition: TrimeshEntity.h:70
virtual void construct(agxData::EntityPtr instance) override
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
TrimeshModel(const agx::String &name="Trimesh")
virtual void configure(agx::TiXmlElement *eEntity) override
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
virtual void initAttributeAccessors() override
void construct(agx::Physics::Geometry::TrimeshPtr trimesh)
static TrimeshModel * instance()
static agxData::EntityStorage * defaultStorage()
static TrimeshPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
Pointer to a entity instance of type Physics.Geometry.Trimesh.
const TrimeshData * getData() const
AGXPHYSICS_EXPORT TrimeshPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT TrimeshPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT const TrimeshSemantics * operator->() const
AGXPHYSICS_EXPORT TrimeshSemantics * operator->()
AGXPHYSICS_EXPORT const TrimeshInstance instance() const
AGXPHYSICS_EXPORT TrimeshPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT TrimeshInstance instance()
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
agxData::EntityRef< TrimeshPtr > TrimeshRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
UInt32 Index
Definition: Integer.h:44