AGX Dynamics  2.37.3.2
RenderTaskDrawable.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 #ifndef AGXOSG_RENDERTASKDRAWABLE
17 #define AGXOSG_RENDERTASKDRAWABLE
18 
19 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
20 #include <osg/Drawable>
21 #include <osg/Version>
22 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
23 
24 
25 #include <agxOSG/export.h>
26 #include <agx/Task.h>
27 #include <agx/observer_ptr.h>
28 
29 namespace agxOSG {
30 
31 class ParticleDrawableCallback;
32 
33  class AGXOSG_EXPORT RenderTaskDrawable : public osg::Drawable
34  {
35  public:
36 
37  RenderTaskDrawable( agx::Task *renderTask );
38  RenderTaskDrawable( const RenderTaskDrawable&c, const osg::CopyOp& copyOp );
39 
41  void setDrawable(osg::Drawable *drawable ) { m_drawable = drawable; }
42 
44  osg::Drawable *getDrawable( ) { return m_drawable.get(); }
45 
46  virtual osg::Object* cloneType() const { return new RenderTaskDrawable ( m_renderTask ); }
47  virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new RenderTaskDrawable (*this,copyop); }
48  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderTaskDrawable *>(obj)!=nullptr; }
49  virtual const char* libraryName() const { return "agxOSG"; }
50  virtual const char* className() const { return "RenderTaskDrawable"; }
51 
52 
54 # if OSG_VERSION_GREATER_OR_EQUAL(3,4,0)
55  virtual osg::BoundingSphere computeBound() const;
56  virtual osg::BoundingBox computeBoundingBox() const;
57 #else
58  virtual osg::BoundingBox computeBound() const;
59 #endif
60 
62  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
63 
64  protected:
65  friend class ParticleDrawableCallback;
66  virtual ~RenderTaskDrawable() {}
67 
68 
69  osg::ref_ptr<osg::Drawable> m_drawable;
71  mutable osg::BoundingBox m_bbox;
72  };
73 }
74 #endif
agx::observer_ptr< agx::Task > m_renderTask
virtual const char * className() const
#define AGXOSG_EXPORT
osg::Drawable * getDrawable()
Return the drawable that will be drawn for each particle.
A representation of a generic task.
Definition: Task.h:57
virtual osg::Object * clone(const osg::CopyOp &copyop) const
osg::ref_ptr< osg::Drawable > m_drawable
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
virtual osg::Object * cloneType() const
virtual bool isSameKindAs(const osg::Object *obj) const
void setDrawable(osg::Drawable *drawable)
Set the drawable that will be drawn for each particle.
virtual const char * libraryName() const