9 #include "imstkLogger.h" 10 #include "imstkMacros.h" 11 #include "imstkTaskGraph.h" 32 Component(
const std::string& name =
"Component") : m_name(name) { }
37 const std::string& getName()
const {
return m_name; }
38 void setName(
const std::string& name) { m_name = name; }
88 template<
typename UpdateInfo>
93 Behaviour(
const bool useTaskGraph,
const std::string& name =
"Behaviour") :
Component(name)
97 m_taskGraph = std::make_shared<TaskGraph>();
100 m_taskGraph->getSource()->m_name =
"Behavior_Source";
101 m_taskGraph->getSink()->m_name =
"Behavior_Sink";
108 virtual void update(
const UpdateInfo& imstkNotUsed(updateData)) { }
109 virtual void visualUpdate(
const UpdateInfo& imstkNotUsed(updateData)) { }
116 CHECK(m_taskGraph !=
nullptr) <<
"Tried to setup task graph edges but no TaskGraph exists";
117 m_taskGraph->clearEdges();
118 initGraphEdges(m_taskGraph->getSource(), m_taskGraph->getSink());
121 std::shared_ptr<TaskGraph> getTaskGraph()
const {
return m_taskGraph; }
130 std::shared_ptr<TaskNode> imstkNotUsed(sink)) { }
132 std::shared_ptr<TaskGraph> m_taskGraph =
nullptr;
154 void update(
const double& dt)
override;
155 void visualUpdate(
const double& dt)
override;
157 void setUpdate(std::function<
void(
const double& dt)> updateFunc) { m_updateFunc = updateFunc; }
158 void setVisualUpdate(std::function<
void(
const double& dt)> updateFunc) { m_visualUpdateFunc = updateFunc; }
161 std::function<void(const double& dt)> m_updateFunc;
162 std::function<void(const double& dt)> m_visualUpdateFunc;
std::weak_ptr< Entity > m_entity
Parent entity this component exists on.
void initialize()
Initialize the component, called at a later time after all component construction is complete...
A Behaviour represents a single component system A template is used here for UpdateInfo to keep the C...
std::weak_ptr< Entity > getEntity() const
Get parent entity.
virtual void initGraphEdges(std::shared_ptr< TaskNode > imstkNotUsed(source), std::shared_ptr< TaskNode > imstkNotUsed(sink))
Setup the edges/connections of the TaskGraph.
virtual void init()
Initialize the component, called at a later time after all component construction is complete...
void initTaskGraphEdges()
Setup the edges/connections of the TaskGraph.
Top-level class for entities. Entities contain a collection of components which define how to be used...
Represents a part of an entity, involved in a system. The component system is doubly linked meaning t...
A SceneBehaviour that can update via a lambda function.