opensurgsim
VisualizeContactsBehavior.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2015, 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_VISUALIZECONTACTSBEHAVIOR_H
17 #define SURGSIM_BLOCKS_VISUALIZECONTACTSBEHAVIOR_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "SurgSim/Framework/Behavior.h"
23 #include "SurgSim/Framework/ObjectFactory.h"
24 
25 namespace SurgSim
26 {
27 
28 namespace Graphics
29 {
30 class VectorFieldRepresentation;
31 }
32 
33 namespace Collision
34 {
35 class Representation;
36 }
37 
38 namespace Blocks
39 {
40 
41 SURGSIM_STATIC_REGISTRATION(VisualizeContactsBehavior);
42 
46 {
47 public:
50  explicit VisualizeContactsBehavior(const std::string& name);
51 
53 
56  std::shared_ptr<SurgSim::Framework::Component> getSource();
57 
60  void setSource(std::shared_ptr<SurgSim::Framework::Component> source);
61 
62  void update(double dt) override;
63 
64  int getTargetManagerType() const override;
65 
67  double getVectorFieldScale();
68 
70  // \param scale The scale of the vector field.
71  void setVectorFieldScale(double scale);
72 
73 protected:
74  bool doInitialize() override;
75 
76  bool doWakeUp() override;
77 
78 private:
80  std::shared_ptr<SurgSim::Collision::Representation> m_source;
81 
83  std::shared_ptr<SurgSim::Graphics::VectorFieldRepresentation> m_vectorField;
84 };
85 
86 } // namespace Blocks
87 } // namespace SurgSim
88 
89 #endif // SURGSIM_BLOCKS_VISUALIZECONTACTSBEHAVIOR_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
This behavior is used to visualize the contacts on collision representation through vector field...
Definition: VisualizeContactsBehavior.h:45
Behaviors perform actions.
Definition: Behavior.h:40