AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
RigidBodySystemDrawable.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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>
28
29#include <agx/Task.h>
30#include <agx/observer_ptr.h>
32
33
34namespace agxOSG
35{
36 class AGXOSG_EXPORT RigidBodySystemDrawable : public osg::Group
37 {
38 public:
40
42 // RigidBodySystemDrawable( const RigidBodySystemDrawable&c, const osg::CopyOp& copyOp );
43
44 virtual osg::Object* cloneType() const { return new RigidBodySystemDrawable ( m_emitter.get() ); }
45 virtual osg::Object* clone(const osg::CopyOp&) const { return new RigidBodySystemDrawable (*this); }
46 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RigidBodySystemDrawable *>(obj)!=nullptr; }
47 virtual const char* libraryName() const { return "agxOSG"; }
48 virtual const char* className() const { return "RigidBodySystemDrawable"; }
49
51
52 static osg::Group* copyRigidBodyVisualChildren(agx::RigidBody* newBody, const RigidBodyRenderCache::RigidBodyVisualGroup& visualTemplateGroup);
53
54 protected:
59
62
63 private:
64 mutable agx::RigidBodyEmitterObserver m_emitter;
65 agx::RigidBodyEmitter::Event::CallbackType m_createInstanceCallback;
67 // A placeholder for an empty visualization group
69 };
70
71}
72
73
74#endif /* AGXOSG_RIGID_BODY_SYSTEM_DRAWABLE_H */
#define AGXOSG_EXPORT
A help class to store all information we need to copy a rigid body visualization to duplicate the rig...
virtual const char * className() const
void instanceCreated(agx::RigidBodyEmitter *emitter, agx::RigidBody *body, agx::RigidBodyEmitter::DistributionModel *model)
RigidBodySystemDrawable(agx::RigidBodyEmitter *emitter)
virtual osg::Object * clone(const osg::CopyOp &) const
static osg::Group * copyRigidBodyVisualChildren(agx::RigidBody *newBody, const RigidBodyRenderCache::RigidBodyVisualGroup &visualTemplateGroup)
virtual osg::Object * cloneType() const
void initBodyCache(agx::RigidBodyEmitter *emitter)
void addToBodyNodeCache(agx::RigidBody *body, RigidBodyRenderCache::RigidBodyVisualGroupRef group)
const RigidBodyRenderCache::RigidBodyVisualGroup & getCachedBodyNode(agx::RigidBody *body) const
virtual bool isSameKindAs(const osg::Object *obj) const
void createRigidBodyInstance(agx::RigidBody *body)
agx::HashTable< agxCollide::Geometry *, GeometryNode * > GeometryToNodeCache
virtual const char * libraryName() const
T CallbackType
Definition Event.h:37
Inheritance with partial specialization due to bug with ref_ptr containers.
Spawns new Rigid Bodies inside a volume given to the Emitter.
DistributionModel()
Default constructor.
The rigid body class, combining a geometric model and a frame of reference.
Definition RigidBody.h:52
Smart pointer for handling referenced counted objects.
Definition ref_ptr.h:30
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.