AGX Dynamics  2.35.0.1
RigidBodySystemDrawable.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, 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_RIGID_BODY_SYSTEM_DRAWABLE_H
18 #define AGXOSG_RIGID_BODY_SYSTEM_DRAWABLE_H
19 
20 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
21 #include <osg/Drawable>
22 #include <osgViewer/Viewer>
23 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
24 
25 #include <agxOSG/export.h>
26 #include <agxOSG/Node.h>
27 
28 #include <agx/Task.h>
29 #include <agx/observer_ptr.h>
30 #include <agx/RigidBodyEmitter.h>
31 
32 
33 namespace agxOSG
34 {
35  class AGXOSG_EXPORT RigidBodySystemDrawable : public osg::Group
36  {
37  public:
39  // RigidBodySystemDrawable( const RigidBodySystemDrawable&c, const osg::CopyOp& copyOp );
40 
41  virtual osg::Object* cloneType() const { return new RigidBodySystemDrawable ( m_emitter.get() ); }
42  virtual osg::Object* clone(const osg::CopyOp&) const { return new RigidBodySystemDrawable (*this); }
43  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RigidBodySystemDrawable *>(obj)!=nullptr; }
44  virtual const char* libraryName() const { return "agxOSG"; }
45  virtual const char* className() const { return "RigidBodySystemDrawable"; }
46 
48 
49  protected:
52 
53  private:
54  mutable agx::RigidBodyEmitterObserver m_emitter;
55  agx::RigidBodyEmitter::Event::CallbackType m_createInstanceCallback;
56  };
57 
58 }
59 
60 
61 #endif /* AGXOSG_RIGID_BODY_SYSTEM_DRAWABLE_H */
#define AGXOSG_EXPORT
RigidBodySystemDrawable(agx::RigidBodyEmitter *emitter)
virtual const char * libraryName() const
virtual bool isSameKindAs(const osg::Object *obj) const
virtual osg::Object * clone(const osg::CopyOp &) const
virtual osg::Object * cloneType() const
virtual const char * className() const
void createRigidBodyInstance(agx::RigidBody *body)
void instanceCreated(agx::RigidBodyEmitter *emitter, agx::RigidBody *body)
T CallbackType
Definition: Event.h:37
Spawns new Rigid Bodies inside a volume given to the Emitter.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.