AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
CableDamageRenderer.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#pragma once
17
18#include <agxOSG/export.h>
19
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
34namespace agxOSG
35{
37
38
45 {
46 public:
58 CableDamageRenderer(agxCable::CableDamage* damage, agx::Real colorRangeMax, osg::Group* root);
59
62
63 bool isRenderingCurrent() const;
65
72 void setEnableRendering(bool enable);
73
74
78 bool getEnableRendering() const;
79
85
92 void setColorRangeMax(agx::Real colorRangeMax);
93
103
108 virtual void last(const agx::Real& timeStamp) override;
109
110 protected:
112
113 private:
114 CableDamageRenderer& operator=(CableDamageRenderer&) = delete;
115
116 private:
118 osg::observer_ptr<osg::Group> m_parent;
120 agx::Real m_colorRangeMax;
121 bool m_renderAccumulatedInsteadOfCurrent;
122 };
123
124}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGXOSG_EXPORT
The CableDamage class is used to estimate damage caused to a cable during a simulation.
Definition: CableDamage.h:58
Class that creates OSG rendering nodes for each segment of a cable and colors them with a color gradi...
void setColorRangeMax(agx::Real colorRangeMax)
Set the damage at which the color gradient should reach its maxmimu.
bool isRenderingAccumulated() const
CableDamageRenderer(agxCable::CableDamage *damage, agx::Real colorRangeMax, osg::Group *root)
Create a damage renderer for the given CableDamage instance.
agx::Real getColorRangeMax() const
virtual void last(const agx::Real &timeStamp) override
Update the rendering colors based on the current segment damages.
void setEnableRendering(bool enable)
Enable or disable rendering by adding or removing the created OSG nodes from the node that was passed...
agxOSG::GeometryNode * getOsgNode(size_t index)
Gives access to the OSG nodes created for the cable segments.
A node that can be associated with a collision geometry so that the transformation of this node is up...
Definition: GeometryNode.h:42
Derive from this class to implement a listener for simulation step events.
Templated vector class.
Definition: agx/Vector.h:53
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
double Real
Definition: Real.h:41