AGX Dynamics  2.35.0.1
agxOSG/Tree.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, 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 
17 #ifndef AGXOSG_TREE_H
18 #define AGXOSG_TREE_H
19 
21 
22 #include <agxModel/Tree.h>
23 
24 namespace agxOSG
25 {
27  {
28  public:
29  TreeRenderer( agxModel::Tree* tree, osg::Group* root );
30 
35  void setColor( const agx::Vec4& color );
36 
41 
42  protected:
43  virtual ~TreeRenderer() {}
44 
45  virtual void addNotification();
46  virtual void post( const agx::TimeStamp& );
47 
48  protected:
49  osg::ref_ptr< osg::Group > m_node;
52  };
53 
55 
57  {
58  public:
59  Tree( osg::Group* root );
60 
65  void setColor( const agx::Vec4& color ) { m_renderer->setColor( color ); }
66 
70  const agx::Vec4 getColor() const { return m_renderer->getColor(); }
71 
72  protected:
73  virtual ~Tree() {}
74 
78  Tree() : m_renderer( nullptr ), m_graphicsRoot( nullptr ) {}
79 
80  virtual Tree* clone();
81 
82  virtual void addNotification( agxSDK::Simulation* simulation );
84 
85  protected:
87  osg::observer_ptr< osg::Group > m_graphicsRoot;
88  };
89 
91 }
92 
93 #endif
#define AGXOSG_EXPORT
Tree is a structure of Branch objects in a mathematical Tree structure where a Branch can have severa...
Definition: agxModel/Tree.h:39
virtual void addNotification(agxSDK::Simulation *simulation)
Called when this assembly is added to a simulation (given that it not already is in the simulation).
void setColor(const agx::Vec4 &color)
Assign color to this tree.
agxModel::TreeRef m_tree
Definition: agxOSG/Tree.h:50
CylinderGeometryShaderRef m_cylinderGeometry
Definition: agxOSG/Tree.h:51
virtual void addNotification()
Called when this listener is added to the simulation.
virtual void post(const agx::TimeStamp &)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
virtual ~TreeRenderer()
Definition: agxOSG/Tree.h:43
osg::ref_ptr< osg::Group > m_node
Definition: agxOSG/Tree.h:49
TreeRenderer(agxModel::Tree *tree, osg::Group *root)
agx::Vec4 getColor() const
Tree(osg::Group *root)
virtual ~Tree()
Definition: agxOSG/Tree.h:73
TreeRendererRef m_renderer
Definition: agxOSG/Tree.h:86
void setColor(const agx::Vec4 &color)
Assign color to this tree.
Definition: agxOSG/Tree.h:65
Tree()
Use agxModel::Tree instead if you intend to use this constructor.
Definition: agxOSG/Tree.h:78
const agx::Vec4 getColor() const
Definition: agxOSG/Tree.h:70
virtual Tree * clone()
Clone call when new tree is needed from internal methods.
osg::observer_ptr< osg::Group > m_graphicsRoot
Definition: agxOSG/Tree.h:87
virtual void addNotification(agxSDK::Simulation *simulation)
Called when this assembly is added to a simulation (given that it not already is in the simulation).
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Derive from this class to implement a listener for simulation step events.
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:35
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
agx::ref_ptr< TreeRenderer > TreeRendererRef
Definition: agxOSG/Tree.h:54
agx::ref_ptr< Tree > TreeRef
Definition: agxOSG/Tree.h:90
osg::ref_ptr< CylinderGeometryShader > CylinderGeometryShaderRef
AGXCORE_EXPORT Component * root()
agx::Real TimeStamp
Definition: TimeStamp.h:26