TransferPhysicsToGraphicsMeshBehavior.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_BLOCKS_TRANSFERPHYSICSTOGRAPHICSMESHBEHAVIOR_H
17 #define SURGSIM_BLOCKS_TRANSFERPHYSICSTOGRAPHICSMESHBEHAVIOR_H
18 
21 
22 namespace SurgSim
23 {
24 
25 namespace Framework
26 {
27 class Component;
28 }
29 
30 namespace Graphics
31 {
32 class MeshRepresentation;
33 }
34 
35 namespace Physics
36 {
37 class DeformableRepresentation;
38 }
39 
40 namespace Blocks
41 {
42 SURGSIM_STATIC_REGISTRATION(TransferPhysicsToGraphicsMeshBehavior);
43 
46 {
47 public:
51 
53 
56  void setSource(const std::shared_ptr<SurgSim::Framework::Component>& source);
57 
60  void setTarget(const std::shared_ptr<SurgSim::Framework::Component>& target);
61 
64  std::shared_ptr<SurgSim::Physics::DeformableRepresentation> getSource() const;
65 
68  std::shared_ptr<SurgSim::Graphics::MeshRepresentation> getTarget() const;
69 
70  virtual void update(double dt) override;
71 
72 private:
73  virtual bool doInitialize() override;
74  virtual bool doWakeUp() override;
75 
77  std::shared_ptr<SurgSim::Physics::DeformableRepresentation> m_source;
78 
80  std::shared_ptr<SurgSim::Graphics::MeshRepresentation> m_target;
81 };
82 
83 }; // namespace Blocks
84 }; // namespace SurgSim
85 
86 #endif // SURGSIM_BLOCKS_TRANSFERPHYSICSTOGRAPHICSMESHBEHAVIOR_H
std::shared_ptr< SurgSim::Physics::DeformableRepresentation > m_source
The DeformableRepresentation from which the Ode state comes.
Definition: TransferPhysicsToGraphicsMeshBehavior.h:77
Definition: DriveElementFromInputBehavior.cpp:27
Graphics representation of a mesh, can be initialized from a Mesh structure.
Definition: MeshRepresentation.h:28
std::shared_ptr< SurgSim::Graphics::MeshRepresentation > m_target
The Graphics Mesh Representation to which the vertices&#39; positions are set.
Definition: TransferPhysicsToGraphicsMeshBehavior.h:80
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
Behaviors perform actions.
Definition: Behavior.h:40
SURGSIM_STATIC_REGISTRATION(PoseComponent)
Behavior to copy positions of a PhysicsRepresentation to a GraphicsMesh.
Definition: TransferPhysicsToGraphicsMeshBehavior.h:45