AGX Dynamics  2.37.3.2
TerrainRenderer.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_TERRAINRENDERER_H
19 #define AGXOSG_TERRAINRENDERER_H
20 
21 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
22 #include <osgSim/ColorRange>
23 #include <osgSim/ScalarsToColors>
24 #include <osg/ref_ptr>
25 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
26 
27 #include <agxOSG/GeometryNode.h>
28 #include <agxRender/Color.h>
30 #include <agxModel/Terrain.h>
31 #include <agxOSG/utils.h>
32 
34 
35 
36 namespace agxOSG
37 {
38  class Group;
39  class Node;
40  class GeometryNode;
41 }
42 
43 namespace osg
44 {
45  class HeightField;
46  class Geometry;
47 }
49 
50 namespace agxOSG
51 {
53  {
54  public:
55  TerrainRenderer( agxModel::Terrain* terrain, agx::RangeReal youngsRange, osg::Group* root );
56  void post(const agx::TimeStamp& );
57  agxOSG::GeometryNode *getTerrainNode() { return m_terrainNode; }
58 
59  protected:
60  virtual ~TerrainRenderer();
61 
62  private:
63  agxModel::TerrainRef m_terrain;
64  agxOSG::GeometryNode *m_terrainNode;
65  osg::HeightField* m_renderHeightField;
66  agx::RangeReal m_youngsRange;
67  osg::ref_ptr<osg::Group> m_particleGroup;
68  osg::ref_ptr<osg::Geode> m_sphereInstance;
69  osg::ref_ptr<osg::Vec4Array> m_colorArray;
70  };
71 
73  {
74  public:
76  const agxRender::ColorVector& colorRange,
77  agx::RangeReal youngsRange,
78  bool renderWireFrame,
79  osg::Group* root);
80 
81  void post(const agx::TimeStamp&);
82  agxOSG::GeometryNode *getTerrainNode() { return m_terrainNode; }
83 
84  protected:
85  virtual ~TerrainHeightColorRenderer();
86  private:
87  agxModel::TerrainRef m_terrain;
88  agxOSG::GeometryNode *m_terrainNode;
89  agx::RangeReal m_youngsRange;
90  osg::ref_ptr<osg::Group> m_particleGroup;
91  osg::ref_ptr<osg::Geode> m_sphereInstance;
92  osg::ref_ptr<osgSim::ColorRange> m_colorRange;
93  osg::ref_ptr<osg::Vec4Array> m_colorArray;
94  };
95 
97  {
98  public:
99  TerrainGridRenderer(agxModel::Terrain* terrain, const agxRender::Color& gridColor, agx::Real lineThickness, osg::Group* root);
100  void post(const agx::TimeStamp&);
101  agxOSG::GeometryNode *getTerrainNode() { return m_terrainNode; }
102 
103  protected:
104  virtual ~TerrainGridRenderer();
105  private:
106  agxModel::TerrainRef m_terrain;
107  agxOSG::GeometryNode *m_terrainNode;
108  osg::HeightField* m_renderHeightField;
109  osg::ref_ptr<osg::Vec4Array> m_colorArray;
110  };
111 }
112 
113 #endif
agxOSG::GeometryNode * getTerrainNode()
#define AGXOSG_EXPORT
Derive from this class to implement a listener for simulation step events.
Utility color class with "common colors".
Definition: Color.h:33
agx::Real TimeStamp
Definition: TimeStamp.h:26
Templated vector class.
Definition: Vector.h:52
agxOSG::GeometryNode * getTerrainNode()
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
agxOSG::GeometryNode * getTerrainNode()
double Real
Definition: Real.h:42
AGXCORE_EXPORT Component * root()
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97