AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
agxOSG/Tree.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. 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_TREE_H
18#define AGXOSG_TREE_H
19
21
22#include <agxModel/Tree.h>
23
24namespace 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:40
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).
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
osg::observer_ptr< osg::Group > m_graphicsRoot
Definition: agxOSG/Tree.h:87
virtual Tree * clone()
Clone call when new tree is needed from internal methods.
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:131
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
agx::Real TimeStamp
Definition: TimeStamp.h:26