AGXDynamics  2.31.1.0
RenderBoxEntity.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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_RENDERBOX_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_GEOMETRY_RENDERBOX_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>
47 #include <agxGL/RenderBox.h>
48 
49 
50 namespace agx
51 {
52  namespace Physics
53  {
54  namespace Geometry
55  {
56 
57  class RenderBoxModel;
58  class RenderBoxData;
59  class RenderBoxPtr;
60  class RenderBoxInstance;
61  class RenderBoxSemantics;
62 
63 
65 
70  {
71  public:
72  typedef RenderBoxPtr PtrT;
73 
74  RenderBoxModel(const agx::String& name = "RenderBox");
75 
77  static RenderBoxModel* instance();
78 
80  static RenderBoxPtr createInstance();
81 
83  static agxData::EntityStorage* defaultStorage();
84 
86  virtual void shutdownCleanup() override;
87 
88 
89 
90  /* Attributes */
94 
95  protected:
96  virtual ~RenderBoxModel();
97  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
98  virtual void configure(agx::TiXmlElement* eEntity) override;
99  virtual void initAttributeAccessors() override;
100  virtual void construct(agxData::EntityPtr instance) override;
102  };
103 
104 
106  #ifndef AGX_PHYSICS_GEOMETRY_RENDERBOX_DATA_SET_OVERRIDE
107  #define AGX_PHYSICS_GEOMETRY_RENDERBOX_DATA_SET
108  class AGXPHYSICS_EXPORT RenderBoxData : public agxData::EntityData
109  {
110  public:
111  RenderBoxInstance operator[] (size_t index);
112 
113  public:
118 
119  public:
120  typedef agxGL::RenderBoxVertices verticesType;
121  typedef agxGL::RenderBoxNormals normalsType;
122  typedef agxGL::RenderBoxOutlines outlinesType;
123 
124  public:
125  RenderBoxData(agxData::EntityStorage* storage);
126  RenderBoxData();
127 
128  protected:
129  virtual ~RenderBoxData() {}
130  virtual void setNumElements(agx::Index numElements) override;
131 
132  private:
133  RenderBoxData& operator= (const RenderBoxData&) { return *this; }
134 
135  };
136  #endif
138 
139 
141  class AGXPHYSICS_EXPORT RenderBoxSemantics : protected agxData::EntityPtr
142  {
143  public:
144 
145  // Automatic getters
146  agxGL::RenderBoxVertices const& getVertices() const;
147  agxGL::RenderBoxNormals const& getNormals() const;
148  agxGL::RenderBoxOutlines const& getOutlines() const;
149 
150  // Semantics defined by explicit kernels
151 
152  // Automatic setters
153  void setVertices(agxGL::RenderBoxVertices const& value);
154  void setNormals(agxGL::RenderBoxNormals const& value);
155  void setOutlines(agxGL::RenderBoxOutlines const& value);
156 
157 
158  protected:
159  friend class RenderBoxPtr;
160  friend class RenderBoxInstance;
161  RenderBoxSemantics();
162  };
164 
165 
166 
169  class CALLABLE RenderBoxPtr : public agxData::EntityPtr
170  {
171  public:
173  typedef RenderBoxData DataType;
174  typedef RenderBoxInstance InstanceType;
175 
176  public:
181  AGXPHYSICS_EXPORT RenderBoxPtr& operator= (const agxData::EntityPtr& ptr);
182  AGXPHYSICS_EXPORT RenderBoxPtr& operator= (const agxData::EntityInstance& instance);
183  AGXPHYSICS_EXPORT RenderBoxInstance instance();
184  AGXPHYSICS_EXPORT const RenderBoxInstance instance() const;
185 
186  AGXPHYSICS_EXPORT RenderBoxSemantics* operator->();
187  AGXPHYSICS_EXPORT const RenderBoxSemantics* operator->() const;
188 
189  RenderBoxData* getData();
190  const RenderBoxData* getData() const;
191 
192 
196  AGXPHYSICS_EXPORT agxGL::RenderBoxVertices const& vertices() const;
197 
201  AGXPHYSICS_EXPORT agxGL::RenderBoxNormals const& normals() const;
202 
206  AGXPHYSICS_EXPORT agxGL::RenderBoxOutlines const& outlines() const;
207 
209  // Only used by tolua!
210  #ifdef AGX_GENERATED_TOLUA_WRAPPER
211  inline agxGL::RenderBoxVertices const& getVertices() const { return (*this)->getVertices(); }
212  inline agxGL::RenderBoxNormals const& getNormals() const { return (*this)->getNormals(); }
213  inline agxGL::RenderBoxOutlines const& getOutlines() const { return (*this)->getOutlines(); }
214 
215 
216  inline void setVertices(agxGL::RenderBoxVertices const& value) { (*this)->setVertices(value); }
217  inline void setNormals(agxGL::RenderBoxNormals const& value) { (*this)->setNormals(value); }
218  inline void setOutlines(agxGL::RenderBoxOutlines const& value) { (*this)->setOutlines(value); }
219  #endif
221 
222  };
223 
224 
226  class AGXPHYSICS_EXPORT RenderBoxInstance : public agxData::EntityInstance
227  {
228  public:
229  RenderBoxInstance();
230  RenderBoxInstance(RenderBoxData* data, agx::Index index);
231  RenderBoxInstance(agxData::EntityStorage *storage, agx::Index index);
232  RenderBoxInstance(const agxData::EntityInstance& other);
233  RenderBoxInstance(const agxData::EntityPtr& ptr);
234 
235  RenderBoxData* getData();
236  const RenderBoxData* getData() const;
237 
238  public:
240  agxGL::RenderBoxVertices& vertices();
242  agxGL::RenderBoxVertices const& vertices() const;
243 
245  agxGL::RenderBoxNormals& normals();
247  agxGL::RenderBoxNormals const& normals() const;
248 
250  agxGL::RenderBoxOutlines& outlines();
252  agxGL::RenderBoxOutlines const& outlines() const;
253 
254  };
256 
257 
258 
261 
262 
263 
265  /* Implementation */
266  //-----------------------------------------------------------------------------------------------------
267  //-----------------------------------------------------------------------------------------------------
268  inline RenderBoxInstance agx::Physics::Geometry::RenderBoxData::operator[] (size_t index) { return RenderBoxInstance(this, (agx::Index)index); }
269  //-----------------------------------------------------------------------------------------------------
273  {
275  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
277  }
278 
280  {
281  agxAssertN(!instance || instance.isInstanceOf(RenderBoxModel::instance()),
282  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
284  }
285 
287  {
290  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
292  return *this;
293  }
294 
296  {
298  agxAssertN(!instance || instance.isInstanceOf(RenderBoxModel::instance()),
299  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
301  return *this;
302  }
303 
304  inline RenderBoxInstance RenderBoxPtr::instance() { return agxData::EntityPtr::instance(); }
305  inline const RenderBoxInstance RenderBoxPtr::instance() const { return agxData::EntityPtr::instance(); }
306  AGX_FORCE_INLINE RenderBoxSemantics* RenderBoxPtr::operator->() { return (RenderBoxSemantics* )this; }
307  AGX_FORCE_INLINE const RenderBoxSemantics* RenderBoxPtr::operator->() const { return (const RenderBoxSemantics* )this; }
308  AGX_FORCE_INLINE RenderBoxData* RenderBoxPtr::getData() { return static_cast<RenderBoxData* >(agxData::EntityPtr::getData()); }
309  AGX_FORCE_INLINE const RenderBoxData* RenderBoxPtr::getData() const { return static_cast<const RenderBoxData* >(agxData::EntityPtr::getData()); }
310 
311  AGX_FORCE_INLINE agxGL::RenderBoxVertices& RenderBoxPtr::vertices() { verifyIndex(); return getData()->vertices[calculateIndex()]; }
312  AGX_FORCE_INLINE agxGL::RenderBoxVertices const& RenderBoxPtr::vertices() const { verifyIndex(); return getData()->vertices[calculateIndex()]; }
313 
314  AGX_FORCE_INLINE agxGL::RenderBoxNormals& RenderBoxPtr::normals() { verifyIndex(); return getData()->normals[calculateIndex()]; }
315  AGX_FORCE_INLINE agxGL::RenderBoxNormals const& RenderBoxPtr::normals() const { verifyIndex(); return getData()->normals[calculateIndex()]; }
316 
317  AGX_FORCE_INLINE agxGL::RenderBoxOutlines& RenderBoxPtr::outlines() { verifyIndex(); return getData()->outlines[calculateIndex()]; }
318  AGX_FORCE_INLINE agxGL::RenderBoxOutlines const& RenderBoxPtr::outlines() const { verifyIndex(); return getData()->outlines[calculateIndex()]; }
319 
320  //-----------------------------------------------------------------------------------------------------
321  AGX_FORCE_INLINE RenderBoxInstance::RenderBoxInstance() {}
322  AGX_FORCE_INLINE RenderBoxInstance::RenderBoxInstance(RenderBoxData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
323  AGX_FORCE_INLINE RenderBoxInstance::RenderBoxInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
324  AGX_FORCE_INLINE RenderBoxInstance::RenderBoxInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
325  {
327  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
329  }
330 
331  AGX_FORCE_INLINE RenderBoxInstance::RenderBoxInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
332  {
334  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
336  }
337 
338 
339  AGX_FORCE_INLINE RenderBoxData* RenderBoxInstance::getData() { return static_cast<RenderBoxData* >(agxData::EntityInstance::getData()); }
340  AGX_FORCE_INLINE const RenderBoxData* RenderBoxInstance::getData() const { return static_cast<const RenderBoxData* >(agxData::EntityInstance::getData()); }
341 
342  AGX_FORCE_INLINE agxGL::RenderBoxVertices& RenderBoxInstance::vertices() { verifyIndex(); return getData()->vertices[getIndex()]; }
343  AGX_FORCE_INLINE agxGL::RenderBoxVertices const& RenderBoxInstance::vertices() const { verifyIndex(); return getData()->vertices[getIndex()]; }
344 
345  AGX_FORCE_INLINE agxGL::RenderBoxNormals& RenderBoxInstance::normals() { verifyIndex(); return getData()->normals[getIndex()]; }
346  AGX_FORCE_INLINE agxGL::RenderBoxNormals const& RenderBoxInstance::normals() const { verifyIndex(); return getData()->normals[getIndex()]; }
347 
348  AGX_FORCE_INLINE agxGL::RenderBoxOutlines& RenderBoxInstance::outlines() { verifyIndex(); return getData()->outlines[getIndex()]; }
349  AGX_FORCE_INLINE agxGL::RenderBoxOutlines const& RenderBoxInstance::outlines() const { verifyIndex(); return getData()->outlines[getIndex()]; }
350 
351  //-----------------------------------------------------------------------------------------------------
352  AGX_FORCE_INLINE RenderBoxSemantics::RenderBoxSemantics() {}
353  //-----------------------------------------------------------------------------------------------------
355  }
356  }
357 }
358 
359 AGX_TYPE_BINDING(agx::Physics::Geometry::RenderBoxPtr, "Physics.Geometry.RenderBoxPtr")
360 AGX_TYPE_BINDING(agx::Physics::Geometry::RenderBoxInstance, "Physics.Geometry.RenderBoxInstance")
361 
362 #ifdef _MSC_VER
363 # pragma warning(pop)
364 #endif
365 
366 #undef AGX_ENTITY_WRAPPER
367 #undef AGX_ENTITY_NAMESPACE
368 #endif
369 
AGXPHYSICS_EXPORT agxGL::RenderBoxVertices & vertices()
agxData::EntityData * getData()
AGXPHYSICS_EXPORT RenderBoxSemantics * operator->()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
Abstract description of the data attributes for the Physics.Geometry.RenderBox entity.
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:73
#define agxAssertN(expr, format,...)
Definition: debug.h:145
agxData::EntityData * getData()
agx::String fullPath() const
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
Pointer to a entity instance of type Physics.Geometry.RenderBox.
AGXPHYSICS_EXPORT agxGL::RenderBoxOutlines & outlines()
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
#define AGXPHYSICS_EXPORT
Entity instance provides access to a single instance in an EntityStorage.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
void AGXPHYSICS_EXPORT renderBox(const agx::AffineMatrix4x4 &transform, const agx::Vec3 &halfLengths, const agx::Vec4 &color=agx::Vec4(1))
bool isInstanceOf(agxData::EntityModel *model) const
#define AGX_FORCE_INLINE
Definition: Object.h:63
AGXPHYSICS_EXPORT RenderBoxPtr & operator=(const agxData::EntityPtr &ptr)
static agxData::ScalarAttributeT< agxGL::RenderBoxVertices > * verticesAttribute
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
AGXPHYSICS_EXPORT RenderBoxInstance instance()
static RenderBoxModel * instance()
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
EntityPtr & operator=(const EntityPtr &other)=default
Namespace agx contains the dynamics/math part of the AGX Dynamics API.
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
static agxData::ScalarAttributeT< agxGL::RenderBoxNormals > * normalsAttribute
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:63
#define CALLABLE
Definition: Object.h:77
bool isInstanceOf(agxData::EntityModel *model) const
static agxData::ScalarAttributeT< agxGL::RenderBoxOutlines > * outlinesAttribute
AGXPHYSICS_EXPORT agxGL::RenderBoxNormals & normals()
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:102
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:101