16 #ifndef SURGSIM_BLOCKS_TRANSFERPHYSICSTOGRAPHICSMESHBEHAVIOR_H 17 #define SURGSIM_BLOCKS_TRANSFERPHYSICSTOGRAPHICSMESHBEHAVIOR_H 34 class MeshRepresentation;
39 class DeformableRepresentation;
44 SURGSIM_STATIC_REGISTRATION(TransferPhysicsToGraphicsMeshBehavior);
62 void setSource(
const std::shared_ptr<Framework::Component>& source);
66 void setTarget(
const std::shared_ptr<Framework::Component>& target);
70 std::shared_ptr<Physics::DeformableRepresentation> getSource()
const;
74 std::shared_ptr<Graphics::MeshRepresentation> getTarget()
const;
81 const std::shared_ptr<DataStructures::TriangleMeshPlain>& source,
82 const std::shared_ptr<DataStructures::TriangleMeshPlain>& target);
88 void setIndexMap(
const std::string& sourceFile,
const std::string& targetFile);
93 void setIndexMap(
const std::vector<std::pair<size_t, size_t>>& indexMap);
96 const std::vector<std::pair<size_t, size_t>> getIndexMap()
const;
98 void update(
double dt)
override;
101 bool doInitialize()
override;
102 bool doWakeUp()
override;
105 void setIndexMap(
const std::pair<std::string, std::string>& fileName);
107 void setIndexMap(
const std::pair<std::shared_ptr<Framework::Asset>, std::shared_ptr<Framework::Asset>>& meshes);
110 std::shared_ptr<Physics::DeformableRepresentation>
m_source;
113 std::shared_ptr<Graphics::MeshRepresentation>
m_target;
125 const std::shared_ptr<DataStructures::TriangleMeshPlain>& source,
126 const std::shared_ptr<DataStructures::TriangleMeshPlain>& target);
131 #endif // SURGSIM_BLOCKS_TRANSFERPHYSICSTOGRAPHICSMESHBEHAVIOR_H Definition: CompoundShapeToGraphics.cpp:29
std::shared_ptr< Graphics::MeshRepresentation > m_target
The Graphics Mesh Representation to which the vertices' positions are set.
Definition: TransferPhysicsToGraphicsMeshBehavior.h:113
std::vector< std::pair< size_t, size_t > > m_indexMap
The mapping to be used if not empty.
Definition: TransferPhysicsToGraphicsMeshBehavior.h:116
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
std::shared_ptr< Physics::DeformableRepresentation > m_source
The DeformableRepresentation from which the Ode state comes.
Definition: TransferPhysicsToGraphicsMeshBehavior.h:110
Behaviors perform actions.
Definition: Behavior.h:40
std::vector< std::pair< size_t, size_t > > generateIndexMap(const std::shared_ptr< DataStructures::TriangleMeshPlain > &source, const std::shared_ptr< DataStructures::TriangleMeshPlain > &target)
Generate a mapping, for each point in source find the points target that coincide.
Definition: TransferPhysicsToGraphicsMeshBehavior.cpp:211
Behavior to copy positions of a PhysicsRepresentation to a GraphicsMesh.
Definition: TransferPhysicsToGraphicsMeshBehavior.h:51