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