AGX Dynamics  2.37.2.0
agxOSG/Tree.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 
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 
40  agx::Vec4 getColor() const;
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:
86  TreeRendererRef m_renderer;
87  osg::observer_ptr< osg::Group > m_graphicsRoot;
88  };
89 
91 }
92 
93 #endif
agxModel::TreeRef m_tree
Definition: agxOSG/Tree.h:50
agx::ref_ptr< Tree > TreeRef
Definition: agxOSG/Tree.h:90
#define AGXOSG_EXPORT
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:34
agx::ref_ptr< TreeRenderer > TreeRendererRef
Definition: agxOSG/Tree.h:54
void setColor(const agx::Vec4 &color)
Assign color to this tree.
Definition: agxOSG/Tree.h:65
agx::Real TimeStamp
Definition: TimeStamp.h:26
TreeRendererRef m_renderer
Definition: agxOSG/Tree.h:86
virtual ~TreeRenderer()
Definition: agxOSG/Tree.h:43
osg::ref_ptr< osg::Group > m_node
Definition: agxOSG/Tree.h:49
osg::observer_ptr< osg::Group > m_graphicsRoot
Definition: agxOSG/Tree.h:87
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
virtual void addNotification(agxSDK::Simulation *simulation) override
Called when this assembly is added to a simulation (given that it not already is in the simulation)...
Tree is a structure of Branch objects in a mathematical Tree structure where a Branch can have severa...
Definition: agxModel/Tree.h:39
Tree()
Use agxModel::Tree instead if you intend to use this constructor.
Definition: agxOSG/Tree.h:78
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
virtual ~Tree()
Definition: agxOSG/Tree.h:73
osg::ref_ptr< CylinderGeometryShader > CylinderGeometryShaderRef
AGXCORE_EXPORT Component * root()
CylinderGeometryShaderRef m_cylinderGeometry
Definition: agxOSG/Tree.h:51
const agx::Vec4 getColor() const
Definition: agxOSG/Tree.h:70