AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ParticleSystemDrawable.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, is 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_SYSTEMDRAWABLE_H
18 #define AGXOSG_PARTICLE_SYSTEMDRAWABLE_H
19 
21 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
22 #include <osg/Drawable>
23 #include <osgViewer/Viewer>
24 #include <osg/Version>
25 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
26 
27 #include <agxOSG/export.h>
28 #include <agx/Task.h>
29 #include <agx/observer_ptr.h>
30 #include <agx/ParticleSystem.h>
31 
32 namespace agxOSG
33 {
34  class AGXOSG_EXPORT ParticleSystemDrawable : public osg::Drawable
35  {
36  public:
40  TRIANGLES
41  #if AGX_USE_OPENGL_INSTANCING()
42  , INSTANCES
43  #endif
44  };
45 
47  {
51  };
52 
53  public:
54 
55  ParticleSystemDrawable( agx::ParticleSystem *particleSystem, ParticleRenderingMode renderMode = QUAD_SPRITES, ParticleShaderMode particleShaderMode = ROTATION_SPRITES);
56  // ParticleSystemDrawable( const ParticleSystemDrawable&c, const osg::CopyOp& copyOp );
57 
58 
59  ParticleShaderMode getParticleShaderMode() const;
60  void setParticleShaderMode(ParticleShaderMode flag);
61 
62 
63  virtual osg::Object* cloneType() const { return new ParticleSystemDrawable ( m_particleSystem.get() ); }
64  virtual osg::Object* clone(const osg::CopyOp&) const { return new ParticleSystemDrawable (*this); }
65  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const ParticleSystemDrawable *>(obj)!=nullptr; }
66  virtual const char* libraryName() const { return "agxOSG"; }
67  virtual const char* className() const { return "ParticleSystemDrawable"; }
68 
69 
71 # if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
72  virtual osg::BoundingSphere computeBound() const;
73  virtual osg::BoundingBox computeBoundingBox() const;
74 #else
75  virtual osg::BoundingBox computeBound() const;
76 #endif
77 
79  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
80 
81  void setEnable(bool enable);
82 
83  bool getEnable() const;
84 
85  agx::ParticleSystem* getParticleSystem();
86 
88  static void setAllowedRenderMode(ParticleRenderingMode mode);
89 
91  static ParticleRenderingMode getAllowedRenderMode();
92 
93  protected:
94  virtual ~ParticleSystemDrawable();
95 
100  bool m_enable;
101  private:
102  static ParticleRenderingMode s_allowedRenderMode;
103  };
104 
106 
108 }
109 
110 #endif /* AGXOSG_PARTICLE_SYSTEMDRAWABLE_H */
#define AGXOSG_EXPORT
virtual const char * className() const
virtual osg::Object * cloneType() const
#define AGX_FORCE_INLINE
Definition: Object.h:62
virtual osg::Object * clone(const osg::CopyOp &) const
A basic particle system that contains all the storages and buffers required for basic operation and a...
virtual const char * libraryName() const
agx::ParticleSystemObserver m_particleSystem
virtual bool isSameKindAs(const osg::Object *obj) const