AGX Dynamics  2.35.0.1
agxOSG/PressureFieldRenderer.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, is 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:
55  PressureFieldRenderer( osg::Group* root, agx::Real scale = agx::Real( 1 ) );
56 
57  virtual agx::UInt addTriangle( const agxModel::TriangleData& tData, const agx::AffineMatrix4x4& worldToShape ) override;
58  virtual agx::UInt addPressure( agx::UInt index, agx::Real pressure ) override;
59  virtual void clear() override;
60  virtual void done() override;
61 
62  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  agx::UInt m_activeVertices;
74  float m_maxPressure;
75  agx::Real m_scale;
76  std::mutex m_mutex;
77  };
78 }
79 
80 #endif
81 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXOSG_EXPORT
virtual agx::UInt addTriangle(const agxModel::TriangleData &tData, const agx::AffineMatrix4x4 &worldToShape) override
On add triangle.
virtual void clear() override
On clear.
virtual void done() override
On done.
PressureFieldRenderer(osg::Group *root, agx::Real scale=agx::Real(1))
Construct given root node, base color and a scale of the mesh (to have it a bit larger/smaller than t...
virtual agx::UInt addPressure(agx::UInt index, agx::Real pressure) override
On add pressure.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
AGXCORE_EXPORT Component * root()
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42
Triangle data for a normal or a clipped triangle.