AGX Dynamics  2.37.3.2
DeformableMeshUpdater.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
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a 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 #pragma once
17 
18 
19 #include <agxOSG/export.h>
21 #include <agxCollide/Trimesh.h>
22 #include <agxOSG/GeometryNode.h>
23 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
24 #include <osg/observer_ptr>
25 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
26 
27 
28 namespace osg
29 {
30  class Node;
31  class Geode;
32  class Group;
33 }
34 
35 namespace agxOSG
36 {
37 
42  {
43  public:
51  DeformableMeshUpdater(agxCollide::Trimesh* trimesh, osg::Group* visualRoot);
52 
57  void update(bool force = false);
58 
63  void setForceUpdate(bool flag);
64 
65  bool getForceUpdate() const;
66 
67  protected:
68  virtual ~DeformableMeshUpdater();
69 
70  private:
71 
72  bool prepareGeometry(osg::Node* node);
73  bool prepareGeometry(osg::Group* group);
74  bool prepareGeometry(osg::Geode* geode);
75 
76  void addNotification() override;
77 
78  bool prepareGeometry();
79  void update(float x, float y) override;
80 
81  private:
82 
84  osg::observer_ptr<osg::Group> m_visualRoot;
85  agx::UInt32 m_lastModificationCount;
86  bool m_forceUpdate;
87 
88 
89  osg::observer_ptr<agxOSG::GeometryNode> m_geometryNode;
90 
91  osg::ref_ptr< osg::Drawable > m_drawable;
92  osg::ref_ptr< osg::Geometry > m_osgGeometry;
93  osg::ref_ptr< osg::Vec3Array > m_osgVertices;
94  osg::ref_ptr< osg::Vec3Array > m_osgNormals;
95  osg::ref_ptr< osg::Vec2Array > m_osgTexCoords;
96  };
97 }
#define AGXOSG_EXPORT
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
Derive from this class to implement a listener for simulation GuiEvents.
Triangle mesh for geometric intersection tests.
Definition: Trimesh.h:42
uint32_t UInt32
Definition: Integer.h:40
Updates a renderable representation of a deformable triangle mesh.