AGX Dynamics  2.37.3.2
agxOSG/PressureFieldRenderer.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 #ifndef AGXOSG_PRESSUREFIELDRENDERER_H
18 #define AGXOSG_PRESSUREFIELDRENDERER_H
19 
20 #include <agxOSG/export.h>
21 
23 
24 #include <agx/Referenced.h>
25 #include <agx/Vec4.h>
26 
28 #include <osg/Array>
29 #include <osg/PrimitiveSet>
30 #include <osg/Geometry>
31 #include <agx/PopDisableWarnings.h>
32 
33 #include <mutex>
34 
35 namespace osg
36 {
37  class Group;
38 }
39 
40 namespace agxCollide
41 {
42  class Mesh;
43 }
44 
45 namespace agxOSG
46 {
48 
50  {
51  public:
56  PressureFieldRenderer( osg::Group* root, agx::Real scale = agx::Real( 1 ) );
57 
58  virtual void addTriangle( const agxModel::TriangleData& tData, const agx::AffineMatrix4x4& worldToShape ) override;
59  virtual void clear() override;
60  virtual void done() override;
61  virtual void updateTransform( const agx::AffineMatrix4x4& shapeToWorld ) override;
62 
63  protected:
65 
66  private:
67  osg::ref_ptr<osg::FloatArray> m_heightsArray;
68  osg::ref_ptr<osg::FloatArray> m_pressureArray;
69  osg::ref_ptr<osg::Vec3Array> m_vertices;
70  osg::ref_ptr<osg::Vec3Array> m_normals;
71  osg::ref_ptr<osg::DrawArrays> m_primitiveSet;
72  osg::ref_ptr<osg::Geometry> m_geometry;
73  osg::ref_ptr<osg::MatrixTransform> m_transform;
74  agx::UInt m_activeVertices;
75  float m_maxPressure;
76  std::mutex m_mutex;
77  };
78 }
79 
80 #endif
81 
AGXTERRAIN_EXPORT void clear()
#define AGXOSG_EXPORT
This namespace consists of a set of classes for handling geometric intersection tests including boole...
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
uint32_t UInt
Definition: Integer.h:34
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
double Real
Definition: Real.h:42
AGXCORE_EXPORT Component * root()
Triangle data for a normal or a clipped triangle.