AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
DeformableMeshUpdater.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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
28namespace osg
29{
30 class Node;
31 class Geode;
32 class Group;
33}
34
35namespace 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:
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::Vec3Array > m_osgTexCoords;
96 };
97}
#define AGXOSG_EXPORT
Triangle mesh for geometric intersection tests.
Definition: Trimesh.h:40
Updates a renderable representation of a deformable triangle mesh.
void setForceUpdate(bool flag)
Force the visual mesh to be updated every frame, even though the collision mesh has not been modified...
DeformableMeshUpdater(agxCollide::Trimesh *trimesh, osg::Group *visualRoot)
Constructor.
void update(bool force=false)
Update the visual mesh from the collision mesh.
Derive from this class to implement a listener for simulation GuiEvents.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
uint32_t UInt32
Definition: Integer.h:32