AGXDynamics  2.31.1.0
SoilParticleSystemDrawable.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 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>
27 
28 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
29 #include <osg/Drawable>
30 #include <osg/Version>
31 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
32 
33 namespace agxOSG
34 {
38  class AGXOSG_EXPORT SoilParticleSystemDrawable : public osg::Drawable
39  {
40  public:
41  SoilParticleSystemDrawable(agxTerrain::Terrain* terrain);
42 
43  void setEnable(bool enable);
44  bool getEnable() const;
45 
49  bool isInitialized() const;
50 
51  virtual osg::Object* cloneType() const { return new SoilParticleSystemDrawable(m_terrain); }
52  virtual osg::Object* clone(const osg::CopyOp&) const { return new SoilParticleSystemDrawable(*this); }
53  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const SoilParticleSystemDrawable *>(obj) != nullptr; }
54  virtual const char* libraryName() const { return "agxOSG"; }
55  virtual const char* className() const { return "SoilParticleSystemDrawable"; }
56 
58 #if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
59  virtual osg::BoundingSphere computeBound() const;
60  virtual osg::BoundingBox computeBoundingBox() const;
61 #else
62  virtual osg::BoundingBox computeBound() const;
63 #endif
64 
66  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
67 
68  public:
69  void onAddNotification( agxSDK::Simulation* simulation );
70  void onRemoveNotification( agxSDK::Simulation* simulation );
71 
72  protected:
73  virtual ~SoilParticleSystemDrawable();
74 
76  // Variables
78  protected:
79  agxTerrain::TerrainRef m_terrain;
80  osg::Group* m_group;
81  agx::TaskGroupRef m_renderTask;
82  bool m_enable;
83  };
84 }
85 #endif
#define AGXOSG_EXPORT
A terrain model based a 3D grid model with overlapping height field that can be deformed by interacti...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:121
AGXBRICK_EXPORT bool isInitialized()