AGX Dynamics  2.38.0.2
ParticleContactGraphDrawable.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 having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 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 
17 #ifndef AGXOSG_PARTICLE_CONTACTGRAPH_DRAWABLE_H
18 #define AGXOSG_PARTICLE_CONTACTGRAPH_DRAWABLE_H
19 
20 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
21 #include <osg/Drawable>
22 #include <osgViewer/Viewer>
23 #include <osgSim/ColorRange>
24 #include <osgSim/ScalarsToColors>
25 #include <osg/Version>
26 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
27 
28 #include <agxOSG/export.h>
29 #include <agx/Task.h>
30 #include <agx/observer_ptr.h>
31 #include <agx/ParticleSystem.h>
32 
33 namespace agxOSG
34 {
35  class AGXOSG_EXPORT ParticleContactGraphDrawable : public osg::Drawable
36  {
37 
38  public:
40  // ParticleSystemDrawable( const ParticleSystemDrawable&c, const osg::CopyOp& copyOp );
41 
42  virtual osg::Object* cloneType() const { return new ParticleContactGraphDrawable(m_particleSystem.get()); }
43  virtual osg::Object* clone(const osg::CopyOp&) const { return new ParticleContactGraphDrawable(*this); }
44  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const ParticleContactGraphDrawable *>(obj) != nullptr; }
45  virtual const char* libraryName() const { return "agxOSG"; }
46  virtual const char* className() const { return "ParticleContactGraphDrawable"; }
47 
48 
50 # if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
51  virtual osg::BoundingSphere computeBound() const;
52  virtual osg::BoundingBox computeBoundingBox() const;
53 #else
54  virtual osg::BoundingBox computeBound() const;
55 #endif
56 
58  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
59 
60  void setEnable(bool enable);
61 
62  bool getEnable() const;
63 
64  void updateKernelBuffers();
65 
66  void setMinForce(agx::Real minForce);
67 
68  void setMaxForce(agx::Real maxForce);
69 
70  agx::Real getMinForce() const;
71 
72  agx::Real getMaxForce() const;
73 
74  agx::ParticleSystem * getParticleSystem();
75 
76  void resample();
77 
78  protected:
80 
81  void initColors();
82 
84  // Variables
86  protected:
89 
95 
96  osg::ref_ptr<osgSim::ColorRange> m_colorRange;
99  bool m_enable;
101  };
102 
104 
106 
108 
110 
112 
114 
116 }
117 
118 
119 #endif /* AGXOSG_PARTICLE_SYSTEMDRAWABLE_H */
agxOSG::ParticleContactGraphDrawable::setEnable
void setEnable(bool enable)
Definition: ParticleContactGraphDrawable.h:107
agxOSG::ParticleContactGraphDrawable::cloneType
virtual osg::Object * cloneType() const
Definition: ParticleContactGraphDrawable.h:42
agxOSG::ParticleContactGraphDrawable::m_countBuffer
agxData::BufferRef m_countBuffer
Definition: ParticleContactGraphDrawable.h:92
agx::Real
double Real
Definition: Real.h:42
Task.h
agxOSG::ParticleContactGraphDrawable::m_renderTask
agx::TaskGroupRef m_renderTask
Definition: ParticleContactGraphDrawable.h:88
agxOSG::ParticleContactGraphDrawable::m_minForce
agx::Real m_minForce
Definition: ParticleContactGraphDrawable.h:97
agxOSG::ParticleContactGraphDrawable::m_verticesBuffer
agxData::BufferRef m_verticesBuffer
Definition: ParticleContactGraphDrawable.h:90
ParticleSystem.h
agxOSG::ParticleContactGraphDrawable::setMaxForce
void setMaxForce(agx::Real maxForce)
Definition: ParticleContactGraphDrawable.h:111
agx::observer_ptr< ParticleSystem >
agxOSG::ParticleContactGraphDrawable::m_sampling
agx::Real m_sampling
Definition: ParticleContactGraphDrawable.h:100
agxOSG::ParticleContactGraphDrawable::m_particleSystem
agx::ParticleSystemObserver m_particleSystem
Definition: ParticleContactGraphDrawable.h:87
agxOSG::ParticleContactGraphDrawable::getEnable
bool getEnable() const
Definition: ParticleContactGraphDrawable.h:105
agxOSG::ParticleContactGraphDrawable::libraryName
virtual const char * libraryName() const
Definition: ParticleContactGraphDrawable.h:45
agx::ParticleSystem
A basic particle system that contains all the storages and buffers required for basic operation and a...
Definition: ParticleSystem.h:67
agx::ref_ptr< TaskGroup >
agxOSG::ParticleContactGraphDrawable::m_colorBuffer
agxData::BufferRef m_colorBuffer
Definition: ParticleContactGraphDrawable.h:91
agxOSG::ParticleContactGraphDrawable::setMinForce
void setMinForce(agx::Real minForce)
Definition: ParticleContactGraphDrawable.h:109
agxOSG
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
PushDisableWarnings.h
agxOSG::ParticleContactGraphDrawable::getMinForce
agx::Real getMinForce() const
Definition: ParticleContactGraphDrawable.h:113
agxOSG::ParticleContactGraphDrawable::clone
virtual osg::Object * clone(const osg::CopyOp &) const
Definition: ParticleContactGraphDrawable.h:43
agxOSG::ParticleContactGraphDrawable
Definition: ParticleContactGraphDrawable.h:35
observer_ptr.h
agxOSG::ParticleContactGraphDrawable::getMaxForce
agx::Real getMaxForce() const
Definition: ParticleContactGraphDrawable.h:115
agxOSG::ParticleContactGraphDrawable::m_maxPosCounts
int m_maxPosCounts
Definition: ParticleContactGraphDrawable.h:94
agxOSG::ParticleContactGraphDrawable::m_firstsBuffer
agxData::BufferRef m_firstsBuffer
Definition: ParticleContactGraphDrawable.h:93
agxOSG::ParticleContactGraphDrawable::initColors
void initColors()
agxOSG::ParticleContactGraphDrawable::getParticleSystem
agx::ParticleSystem * getParticleSystem()
Definition: ParticleContactGraphDrawable.h:103
export.h
agxOSG::ParticleContactGraphDrawable::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition: ParticleContactGraphDrawable.h:44
agxOSG::ParticleContactGraphDrawable::className
virtual const char * className() const
Definition: ParticleContactGraphDrawable.h:46
agxOSG::ParticleContactGraphDrawable::m_colorRange
osg::ref_ptr< osgSim::ColorRange > m_colorRange
Definition: ParticleContactGraphDrawable.h:96
agxOSG::ParticleContactGraphDrawable::m_enable
bool m_enable
Definition: ParticleContactGraphDrawable.h:99
agxOSG::ParticleContactGraphDrawable::m_maxForce
agx::Real m_maxForce
Definition: ParticleContactGraphDrawable.h:98
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
AGXOSG_EXPORT
#define AGXOSG_EXPORT
PopDisableWarnings.h