AGX Dynamics  2.37.2.0
PressureToColorConverter.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 
17 
18 #ifndef AGXOSG_PRESSURE_TO_COLOR_CONVERTER_H
19 #define AGXOSG_PRESSURE_TO_COLOR_CONVERTER_H
20 
21 
22 #include <agx/macros.h>
23 #include <agx/Referenced.h>
24 
25 #include <agxOSG/export.h>
26 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
27 #include <osg/Image>
28 #include <osgSim/ColorRange>
29 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
30 namespace agxOSG
31 {
32 
33  class PressureAtlas;
34 
37 
39  {
40  public:
42  virtual void convert(bool dirty) = 0;
43 
44  osg::Image* getPressureMap();
45  osg::Image* getColorMap();
46 
47  protected:
49 
50  protected:
51  osg::ref_ptr<osg::Image> m_pressureMap;
52  osg::ref_ptr<osg::Image> m_colorMap;
53  };
54 
55 
57 
59  {
60  public:
61  PressureToRgbaConverter(PressureAtlas* atlas, osgSim::ColorRange* colorRange);
62  virtual void convert(bool dirty) override;
63 
64  protected:
66 
67  private:
68  osg::ref_ptr<osgSim::ColorRange> m_colorRange;
69  };
70 
71 
73 
75  {
76  public:
77  GatherMaxPressure(PressureAtlas* atlas, osgSim::ColorRange* colorRange);
78  virtual void convert(bool) override;
79 
80  void convertToColorImage();
81 
82  void clear();
83 
84  protected:
85  virtual ~GatherMaxPressure() {}
86 
87  private:
88  osg::ref_ptr<osg::Image> m_pressureMap;
89  osg::ref_ptr<osg::Image> m_maxPressure;
90  };
91 
92 
94 
96  {
97  public:
98  GatherAvgPressure(PressureAtlas* atlas, osgSim::ColorRange* colorRange);
99  virtual void convert(bool dirty) override;
100 
101  void convertToColorImage();
102 
103  void clear();
104 
105  protected:
106  virtual ~GatherAvgPressure();
107 
108  private:
109  osg::ref_ptr<osg::Image> m_pressureMap;
110  double* m_totalPressure;
111  osg::ref_ptr<osg::Image> m_avgPressure;
112  size_t m_numSamples;
113  };
114 
115 }
116 #endif
AGXTERRAIN_EXPORT void clear()
A pressure map for a single trimesh.
Definition: PressureAtlas.h:43
#define AGXOSG_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Base class providing referencing counted objects.
Definition: Referenced.h:119
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
osg::ref_ptr< osg::Image > m_colorMap