AGX Dynamics  2.38.0.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
Task.h
agxOSG::RenderTaskDrawable::clone
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition: RenderTaskDrawable.h:47
agxOSG::RenderTaskDrawable::m_bbox
osg::BoundingBox m_bbox
Definition: RenderTaskDrawable.h:71
agx::observer_ptr< agx::Task >
agxOSG::RenderTaskDrawable::libraryName
virtual const char * libraryName() const
Definition: RenderTaskDrawable.h:49
agx::Task
A representation of a generic task.
Definition: Task.h:57
agxOSG::RenderTaskDrawable::setDrawable
void setDrawable(osg::Drawable *drawable)
Set the drawable that will be drawn for each particle.
Definition: RenderTaskDrawable.h:41
agxOSG
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
PushDisableWarnings.h
observer_ptr.h
agxOSG::RenderTaskDrawable::getDrawable
osg::Drawable * getDrawable()
Return the drawable that will be drawn for each particle.
Definition: RenderTaskDrawable.h:44
agxOSG::RenderTaskDrawable
Definition: RenderTaskDrawable.h:33
agxOSG::RenderTaskDrawable::~RenderTaskDrawable
virtual ~RenderTaskDrawable()
Definition: RenderTaskDrawable.h:66
agxOSG::RenderTaskDrawable::m_drawable
osg::ref_ptr< osg::Drawable > m_drawable
Definition: RenderTaskDrawable.h:69
export.h
agxOSG::RenderTaskDrawable::cloneType
virtual osg::Object * cloneType() const
Definition: RenderTaskDrawable.h:46
agxOSG::RenderTaskDrawable::m_renderTask
agx::observer_ptr< agx::Task > m_renderTask
Definition: RenderTaskDrawable.h:70
agxOSG::RenderTaskDrawable::className
virtual const char * className() const
Definition: RenderTaskDrawable.h:50
AGXOSG_EXPORT
#define AGXOSG_EXPORT
PopDisableWarnings.h
agxOSG::RenderTaskDrawable::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition: RenderTaskDrawable.h:48