AGX Dynamics  2.37.3.2
CableDamageRenderer.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 #pragma once
17 
18 #include <agxOSG/export.h>
19 
20 #include <agxCable/CableDamage.h>
21 
23 
24 #include <agx/Vector.h>
25 #include <agxOSG/Node.h>
26 #include <agxOSG/GeometryNode.h>
27 
28 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
29 #include <osg/observer_ptr>
30 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
31 
32 
33 
34 namespace agxOSG
35 {
37 
38 
45  {
46  public:
58  CableDamageRenderer(agxCable::CableDamage* damage, agx::Real colorRangeMax, osg::Group* root);
59 
60  void renderCurrent();
61  void renderAccumulated();
62 
63  bool isRenderingCurrent() const;
64  bool isRenderingAccumulated() const;
65 
72  void setEnableRendering(bool enable);
73 
74 
78  bool getEnableRendering() const;
79 
84  agx::Real getColorRangeMax() const;
85 
92  void setColorRangeMax(agx::Real colorRangeMax);
93 
102  agxOSG::GeometryNode* getOsgNode(size_t index);
103 
108  virtual void last(const agx::Real& timeStamp) override;
109 
110  protected:
111  virtual ~CableDamageRenderer() {}
112 
113  private:
114  CableDamageRenderer& operator=(CableDamageRenderer&) = delete;
115 
116  private:
117  agxCable::CableDamageRef m_damage;
118  osg::observer_ptr<osg::Group> m_parent;
120  agx::Real m_colorRangeMax;
121  bool m_renderAccumulatedInsteadOfCurrent;
122  };
123 
124 }
#define AGXOSG_EXPORT
Derive from this class to implement a listener for simulation step events.
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Templated vector class.
Definition: Vector.h:52
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
A node that can be associated with a collision geometry so that the transformation of this node is up...
Definition: GeometryNode.h:41
double Real
Definition: Real.h:42
AGXCORE_EXPORT Component * root()
The CableDamage class is used to estimate damage caused to a cable during a simulation.
Definition: CableDamage.h:57
Class that creates OSG rendering nodes for each segment of a cable and colors them with a color gradi...