AGXDynamics  2.35.0.2
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 
47  void createRigidBodyInstance( agx::RigidBody* body );
48 
49  protected:
50  virtual ~RigidBodySystemDrawable();
51  void instanceCreated( agx::RigidBodyEmitter* emitter, agx::RigidBody* body );
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 */
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
Task.h
agxOSG::RigidBodySystemDrawable::clone
virtual osg::Object * clone(const osg::CopyOp &) const
Definition: RigidBodySystemDrawable.h:42
agxOSG::RigidBodySystemDrawable::cloneType
virtual osg::Object * cloneType() const
Definition: RigidBodySystemDrawable.h:41
Node.h
agx::observer_ptr< RigidBodyEmitter >
agxOSG::RigidBodySystemDrawable::libraryName
virtual const char * libraryName() const
Definition: RigidBodySystemDrawable.h:44
agxOSG
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
PushDisableWarnings.h
agxOSG::RigidBodySystemDrawable
Definition: RigidBodySystemDrawable.h:35
RigidBodyEmitter.h
observer_ptr.h
agx::RigidBodyEmitter
Spawns new Rigid Bodies inside a volume given to the Emitter.
Definition: RigidBodyEmitter.h:42
agxOSG::RigidBodySystemDrawable::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition: RigidBodySystemDrawable.h:43
export.h
agx::Callback2
Templated callback with two arguments.
Definition: Callback.h:139
agxOSG::RigidBodySystemDrawable::className
virtual const char * className() const
Definition: RigidBodySystemDrawable.h:45
AGXOSG_EXPORT
#define AGXOSG_EXPORT
PopDisableWarnings.h