AGX Dynamics  2.35.0.1
SplineRendererOld.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_SPLINERENDERER_OLD_H
18 #define AGXOSG_SPLINERENDERER_OLD_H
19 
20 
21 #include <agxOSG/export.h>
22 
23 #include <agxUtil/Spline.h>
24 
26 
27 #include <agx/agx_vector_types.h>
28 
29 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
30 #include <agxOSG/Node.h>
31 #include <osg/Geometry>
33 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
34 
35 namespace agxCollide
36 {
37  class Geometry;
38 }
39 
40 namespace agxOSG
41 {
42 
44  {
45  public:
53  SplineRendererOld( agxUtil::Spline* spline, osg::Group* root );
54 
58  virtual void update();
59 
65  virtual void update( const agx::RealVector& radiiVector );
66 
71  void setSplineModel( agxUtil::Spline* spline ) { m_spline = spline; }
72 
76  agxUtil::Spline* getSplineModel() { return m_spline; }
77  const agxUtil::Spline* getSplineModel() const { return m_spline; }
78 
83  void setRadius( agx::Real radius ) { m_radius = radius; }
84 
88  agx::Real getRadius() const { return m_radius; }
89 
94  void setNumSegmentsPerUnitLength( agx::Real segmentsPerUnitLength ) { m_numSegmentsPerUnitLength = segmentsPerUnitLength; }
95 
99  agx::Real getNumSegmentsPerUnitLength() const { return m_numSegmentsPerUnitLength; }
100 
105  void setColor( const agx::Vec4f& color );
106 
111 
112  virtual void removeNotification();
113 
114  protected:
115  virtual ~SplineRendererOld() {}
116 
117  virtual void addNotification();
118 
119  void initialize( osg::Group* root );
120  virtual void last( const agx::TimeStamp& ) { update(); }
121 
122  agx::RealVector& getRedShiftScales() { return m_redShiftScales; }
123  const agx::RealVector& getRedShiftScales() const { return m_redShiftScales; }
124 
125  protected:
126  osg::ref_ptr< osg::Group > m_node;
127  agxUtil::SplineRef m_spline;
129 
134  };
135 
137 }
138 
139 #endif
#define AGXOSG_EXPORT
virtual void removeNotification()
Called when this listener is removed from the simulation.
virtual void addNotification()
Called when this listener is added to the simulation.
virtual void update(const agx::RealVector &radiiVector)
Use this update if this spline has variable radii.
const agxUtil::Spline * getSplineModel() const
const agx::RealVector & getRedShiftScales() const
osg::ref_ptr< osg::Group > m_node
void setSplineModel(agxUtil::Spline *spline)
Assign spline model.
virtual void update()
Given the current spline control points, data will be pushed for new update.
agx::Real getRadius() const
SplineRendererOld(agxUtil::Spline *spline, osg::Group *root)
Construct spline (geometry shader) renderer.
agx::RealVector m_redShiftScales
Values from 0 to 1 how red the color of the node is (0 default color, 1 red color,...
agx::Vec4f getColor() const
void setNumSegmentsPerUnitLength(agx::Real segmentsPerUnitLength)
Assign how many cylinder segments that should be used per unit length.
CylinderGeometryShaderRef m_splineGeometry
agxUtil::SplineRef m_spline
void initialize(osg::Group *root)
agx::RealVector & getRedShiftScales()
agx::Real getNumSegmentsPerUnitLength() const
void setColor(const agx::Vec4f &color)
Assign color to this spline.
void setRadius(agx::Real radius)
Assign new radius of the cylinder segments.
virtual void last(const agx::TimeStamp &)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
agxUtil::Spline * getSplineModel()
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
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
osg::ref_ptr< CylinderGeometryShader > CylinderGeometryShaderRef
agx::ref_ptr< SplineRendererOld > SplineRendererOldRef
AGXCORE_EXPORT Component * root()
double Real
Definition: Real.h:42
agx::Real TimeStamp
Definition: TimeStamp.h:26