AGX Dynamics  2.37.2.0
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 
107  AGX_FORCE_INLINE void ParticleContactGraphDrawable::setEnable(bool enable) { m_enable = enable; }
108 
109  AGX_FORCE_INLINE void ParticleContactGraphDrawable::setMinForce(agx::Real minForce) { m_minForce = minForce; initColors(); }
110 
111  AGX_FORCE_INLINE void ParticleContactGraphDrawable::setMaxForce(agx::Real maxForce) { m_maxForce = maxForce; initColors(); }
112 
114 
116 }
117 
118 
119 #endif /* AGXOSG_PARTICLE_SYSTEMDRAWABLE_H */
#define AGXOSG_EXPORT
#define AGX_FORCE_INLINE
Definition: Object.h:59
A basic particle system that contains all the storages and buffers required for basic operation and a...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
osg::ref_ptr< osgSim::ColorRange > m_colorRange
virtual bool isSameKindAs(const osg::Object *obj) const
double Real
Definition: Real.h:42
virtual osg::Object * clone(const osg::CopyOp &) const