Commit 31c29cb7 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

REFAC: Move impl to cpp files

parent 0cf1e0f8
......@@ -7,7 +7,6 @@ imstk_add_library( Common
Eigen3::Eigen
g3log
tbb
# tsimd
)
#-----------------------------------------------------------------------------
......
......@@ -142,7 +142,7 @@ public:
void addEdge(std::shared_ptr<TaskNode> srcNode, std::shared_ptr<TaskNode> destNode);
///
/// \brief Attachs another TaskGraph as a subgraph (copies nodes and edges, then connects source->subgraph::source, subgraph::sink->sink),
/// \brief Attaches another TaskGraph as a subgraph (copies nodes and edges, then connects source->subgraph::source, subgraph::sink->sink),
/// source and sink must exist in this graph. Also serves as a graph sum between this and subgraph
///
void nestGraph(std::shared_ptr<TaskGraph> subgraph, std::shared_ptr<TaskNode> source, std::shared_ptr<TaskNode> sink);
......@@ -190,7 +190,7 @@ public:
static std::shared_ptr<TaskGraph> resolveCriticalNodes(std::shared_ptr<TaskGraph> graph);
///
/// \brief Remove redudant edges. Removal is such that all vertices are still reachable and graph goes from source->sink
/// \brief Remove redundant edges. Removal is such that all vertices are still reachable and graph goes from source->sink
/// returns nullptr if failed. Only fails if graph is cyclic.
///
static std::shared_ptr<TaskGraph> transitiveReduce(std::shared_ptr<TaskGraph> graph);
......
......@@ -102,10 +102,10 @@ static void disconnect(EventObject*, EventObject*, std::string (*)());
/// \class EventObject
///
/// \brief EventObject is the base class for all objects in iMSTK that
/// can recieve and emit events. It supports direct and queued observer functions.
/// Direct observers recieve events immediately on the same thread
/// can receive and emit events. It supports direct and queued observer functions.
/// Direct observers receive events immediately on the same thread
/// This can either be posted on an object or be a function pointer
/// Queued observers recieve events within their queue which they can process whenever
/// Queued observers receive events within their queue which they can process whenever
/// they like.
/// These can be connected with the connect/queuedConnect/disconnect functions
/// \todo ThreadObject affinity
......
/*=========================================================================
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#include "imstkModule.h"
namespace imstk
{
void
Module::update()
{
if (m_init && !m_paused)
{
if (sleepDelay != 0.0)
{
std::this_thread::sleep_for(std::chrono::duration<double, std::milli>(sleepDelay));
}
if (muteUpdateEvents)
{
this->updateModule();
}
else
{
this->postEvent(Event(Module::preUpdate()));
this->updateModule();
this->postEvent(Event(Module::postUpdate()));
}
}
}
void
Module::uninit()
{
// Can only uninit if, init'd
if (m_init)
{
uninitModule();
m_init = false;
}
}
}// imstk
......@@ -74,7 +74,7 @@ public:
public:
///
/// \brief Get/Set the timestep
/// \brief Get/Set the time step
///
double getDt() const { return m_dt; }
void setDt(const double dt) { m_dt = dt; }
......@@ -90,6 +90,9 @@ public:
bool getPaused() const { return m_paused; }
void setPaused(const bool paused) { m_paused = paused; }
///
/// \brief Set/Get the execution type (see imstk::ExecutionType)
///
ExecutionType getExecutionType() const { return m_executionType; }
void setExecutionType(const ExecutionType type) { m_executionType = type; }
......@@ -101,37 +104,9 @@ public:
public:
void init() { m_init = initModule(); }
void update()
{
if (m_init && !m_paused)
{
if (sleepDelay != 0.0)
{
std::this_thread::sleep_for(std::chrono::duration<double, std::milli>(sleepDelay));
}
if (muteUpdateEvents)
{
this->updateModule();
}
else
{
this->postEvent(Event(Module::preUpdate()));
this->updateModule();
this->postEvent(Event(Module::postUpdate()));
}
}
}
void uninit()
{
// Can only uninit if, init'd
if (m_init)
{
uninitModule();
m_init = false;
}
}
void update();
void uninit();
public:
virtual bool initModule() = 0;
......
......@@ -418,7 +418,6 @@ VTKRenderer::updateCamera()
m_camera->SetViewUp(up[0], up[1], up[2]);
m_camera->SetViewAngle(cam->getFieldOfView());
m_camera->SetClippingRange(cam->getNearZ(), cam->getFarZ());
m_camera->SetClippingRange(cam->getNearZ(), cam->getFarZ());
}
void
......
......@@ -50,10 +50,10 @@ public:
const Outputs& getTaskNodeOutputs() const { return m_taskNodeOutputs; }
public:
///
/// \brief Modifies the computational graph
///
void compute();
///
/// \brief Modifies the computational graph
///
//void compute();
protected:
Inputs m_taskNodeInputs; ///> The interacting nodes
......
......@@ -31,7 +31,7 @@ class SceneObject;
/// \class ObjectInteractionPair
///
/// \brief This class defines an interaction between two SceneObjects
/// An interaction is a function occuring between two SceneObjects at some point
/// An interaction is a function occurring between two SceneObjects at some point
///
class ObjectInteractionPair : public InteractionPair
{
......@@ -46,7 +46,7 @@ protected:
virtual ~ObjectInteractionPair() override = default;
public:
/// \brief TODO
/// \brief Return the pair of scene objects involved in the interaction
const SceneObjectPair& getObjectsPair() const { return m_objects; }
public:
......
......@@ -71,7 +71,7 @@ protected:
std::shared_ptr<VecDataArray<int, 3>> elements);
///
/// \brief Modify exsiting elements of pbdObj
/// \brief Modify existing elements of pbdObj
///
void modifyTriangles(std::shared_ptr<SurfaceMesh> pbdMesh,
std::shared_ptr<std::vector<size_t>> elementIndices,
......
/*=========================================================================
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#include "imstkCamera.h"
namespace imstk
{
void
Camera::print()
{
std::cout << "CamPos: " << m_position[0] << ", " << m_position[1] << ", " << m_position[2] << std::endl;
std::cout << "FocalPoint: " << m_focalPoint[0] << ", " << m_focalPoint[1] << ", " << m_focalPoint[2] << std::endl;
std::cout << "Up: " << m_viewUp[0] << ", " << m_viewUp[1] << ", " << m_viewUp[2] << std::endl;
}
}
\ No newline at end of file
......@@ -81,44 +81,34 @@ public:
/// \brief Get camera view matrix
/// \returns Camera view matrix reference
///
Mat4d& getView() { return m_view; }
inline Mat4d& getView() { return m_view; }
///
/// \brief Get the inverse view matrix
///
const Mat4d& getInvView() { return m_invView; }
inline const Mat4d& getInvView() { return m_invView; }
///
/// \brief Set the camera view matrix
///
void setView(const Mat4d& view)
inline void setView(const Mat4d& view)
{
m_viewModified = false;
m_view = view;
m_invView = m_view.inverse();
}
///
/// \brief Get camera projection matrix
///
//const Mat4d& getProj() { return m_proj; }
///
/// \brief Set camera projection matrix
///
//void setProj(const Mat4d& proj) { m_proj = proj; }
///
/// \brief Gets the field of view
/// \returns vertical field of view in degrees
///
const double getFieldOfView() const { return m_fieldOfView; }
inline const double getFieldOfView() const { return m_fieldOfView; }
///
/// \brief Sets the field of view
/// \param vertical field of view in degrees
///
void setFieldOfView(const double fov)
inline void setFieldOfView(const double fov)
{
m_fieldOfView = fov;
//m_projModified = true;
......@@ -129,20 +119,19 @@ public:
/// note: You lose depth accuracy as the range between near and far increases
/// could cause z fighting
///
void setNearZ(const double nearZ) { m_nearZ = nearZ; }
const double getNearZ() const { return m_nearZ; }
inline void setNearZ(const double nearZ) { m_nearZ = nearZ; }
inline const double getNearZ() const { return m_nearZ; }
///
/// \brief Set clipping near
/// note: You lose depth accuracy as the range between near and far increases
/// could cause z fighting
///
void setFarZ(const double farZ) { m_farZ = farZ; }
inline void setFarZ(const double farZ) { m_farZ = farZ; }
const double getFarZ() const { return m_farZ; }
inline const double getFarZ() const { return m_farZ; }
virtual void update()
inline virtual void update()
{
if (m_viewModified)
{
......@@ -156,25 +145,24 @@ public:
}*/
}
public:
///
/// \brief Gets the camera position
/// \returns camera position
///
const Vec3d& getPosition() const { return m_position; }
inline const Vec3d& getPosition() const { return m_position; }
///
/// \brief Sets the camera position
///
void setPosition(const Vec3d& pos)
inline void setPosition(const Vec3d& pos)
{
m_position = pos;
m_viewModified = true;
}
void setPosition(const double x,
const double y,
const double z)
inline void setPosition(const double x,
const double y,
const double z)
{
setPosition(Vec3d(x, y, z));
}
......@@ -184,20 +172,20 @@ public:
/// The focal point is the point that the camera points to
/// \returns Focal point position
///
const Vec3d& getFocalPoint() const { return m_focalPoint; }
inline const Vec3d& getFocalPoint() const { return m_focalPoint; }
///
/// \brief Sets the focal point
///
void setFocalPoint(const Vec3d& focalPt)
inline void setFocalPoint(const Vec3d& focalPt)
{
m_focalPoint = focalPt;
m_viewModified = true;
}
void setFocalPoint(const double x,
const double y,
const double z)
inline void setFocalPoint(const double x,
const double y,
const double z)
{
setFocalPoint(Vec3d(x, y, z));
}
......@@ -206,20 +194,20 @@ public:
/// \brief Get the up vector
/// \returns up vector of camera
///
const Vec3d& getViewUp() const { return m_viewUp; }
inline const Vec3d& getViewUp() const { return m_viewUp; }
///
/// \brief Set the up vector
///
void setViewUp(const Vec3d& up)
inline void setViewUp(const Vec3d& up)
{
m_viewUp = up.normalized();
m_viewModified = true;
}
void setViewUp(const double x,
const double y,
const double z)
inline void setViewUp(const double x,
const double y,
const double z)
{
setViewUp(Vec3d(x, y, z));
}
......@@ -227,12 +215,7 @@ public:
///
/// \brief Utility function to quickly print cam stats
///
void print()
{
std::cout << "CamPos: " << m_position[0] << ", " << m_position[1] << ", " << m_position[2] << std::endl;
std::cout << "FocalPoint: " << m_focalPoint[0] << ", " << m_focalPoint[1] << ", " << m_focalPoint[2] << std::endl;
std::cout << "Up: " << m_viewUp[0] << ", " << m_viewUp[1] << ", " << m_viewUp[2] << std::endl;
}
void print();
protected:
// Base camera values
......@@ -242,7 +225,6 @@ protected:
bool m_viewModified = true;
//bool m_projModified = true;
protected:
// Base projection parameters
double m_fieldOfView = 40.0; ///> field of view in degrees
double m_nearZ = 0.01; ///> near plane of the camera
......
......@@ -77,11 +77,6 @@ public:
///
void switchOn() { m_switchState = true; }
///
/// \brief Get the status (On/off) of the light
///
bool isOff() const { return m_switchState; }
///
/// \brief Switch the light Off
///
......@@ -105,7 +100,7 @@ public:
///
/// \brief Set the light intensity. This value is unbounded.
///
void setIntensity(double intensity) { m_intensity = (float)intensity; }
void setIntensity(const double intensity) { m_intensity = (float)intensity; }
protected:
Light(const LightType& type) : SceneEntity(), m_type(type) { }
......
......@@ -37,7 +37,6 @@ public:
/// \brief Constructor
///
explicit AnimationModel(std::shared_ptr<Geometry> geometry);
AnimationModel() = delete;
///
......
......@@ -50,6 +50,20 @@ VisualModel::VisualModel() : m_renderMaterial(std::make_shared<RenderMaterial>()
{
}
void
VisualModel::setRenderMaterial(std::shared_ptr<RenderMaterial> renderMaterial)
{
m_renderMaterial = renderMaterial;
this->postModified();
}
void
VisualModel::setIsVisible(const bool visible)
{
m_isVisible = visible;
this->postModified();
}
bool
VisualModel::getRenderDelegateCreated(Renderer* ren)
{
......
......@@ -81,11 +81,7 @@ public:
///
/// \brief Set/Get render material
///
void setRenderMaterial(std::shared_ptr<RenderMaterial> renderMaterial)
{
m_renderMaterial = renderMaterial;
this->postModified();
}
void setRenderMaterial(std::shared_ptr<RenderMaterial> renderMaterial);
std::shared_ptr<RenderMaterial> getRenderMaterial() const { return m_renderMaterial; }
......@@ -95,11 +91,7 @@ public:
void show() { setIsVisible(true); }
void hide() { setIsVisible(false); }
bool isVisible() const { return m_isVisible; }
void setIsVisible(const bool visible)
{
m_isVisible = visible;
this->postModified();
}
void setIsVisible(const bool visible);
///
/// \brief Get/Set whether the delegate has been created
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment