AGX Dynamics  2.35.0.1
SoilParticleSystemDrawable.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 #pragma once
18 
19 #include <agx/config/AGX_USE_AGXTERRAIN.h>
20 #if AGX_USE_AGXTERRAIN()
21 
22 
23 #include <agxOSG/export.h>
24 
25 #include <agxTerrain/Terrain.h>
26 
27 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
28 #include <osg/Drawable>
29 #include <osg/Version>
30 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
31 
32 namespace agxOSG
33 {
37  class AGXOSG_EXPORT SoilParticleSystemDrawable : public osg::Drawable
38  {
39  public:
40  SoilParticleSystemDrawable(agxTerrain::Terrain* terrain);
41 
42  void setEnable(bool enable);
43  bool getEnable() const;
44 
48  bool isInitialized() const;
49 
50  virtual osg::Object* cloneType() const { return new SoilParticleSystemDrawable(m_terrain); }
51  virtual osg::Object* clone(const osg::CopyOp&) const { return new SoilParticleSystemDrawable(*this); }
52  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const SoilParticleSystemDrawable *>(obj) != nullptr; }
53  virtual const char* libraryName() const { return "agxOSG"; }
54  virtual const char* className() const { return "SoilParticleSystemDrawable"; }
55 
57 #if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
58  virtual osg::BoundingSphere computeBound() const;
59  virtual osg::BoundingBox computeBoundingBox() const;
60 #else
61  virtual osg::BoundingBox computeBound() const;
62 #endif
63 
65  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
66 
67  agx::ParticleSystem* getParticleSystem();
68 
69  public:
70  void onAddNotification( agxSDK::Simulation* simulation );
71  void onRemoveNotification( agxSDK::Simulation* simulation );
72 
73  protected:
74  virtual ~SoilParticleSystemDrawable();
75 
77  // Variables
79  protected:
80  agxTerrain::TerrainRef m_terrain;
81  osg::Group* m_group;
82  agx::TaskGroupRef m_renderTask;
83  bool m_enable;
84  };
85 }
86 #endif
#define AGXOSG_EXPORT
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
A basic particle system that contains all the storages and buffers required for basic operation and a...
AGXBRICK_EXPORT bool isInitialized()
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.