diff --git a/Base/SceneElements/Light/imstkLight.cpp b/Base/SceneElements/Light/imstkLight.cpp index 7a8243fcf4857dca379065c758071274153b795a..fdc7c4906dd28d7b926ca17d4b735185cbfef8b6 100644 --- a/Base/SceneElements/Light/imstkLight.cpp +++ b/Base/SceneElements/Light/imstkLight.cpp @@ -26,7 +26,7 @@ namespace imstk { LightType -Light::getType() +Light::getType() const { return m_type; } @@ -82,19 +82,19 @@ Light::setFocalPoint(const double& x, } bool -Light::isOn() +Light::isOn() const { return m_vtkLight->GetSwitch() != 0; } void -Light::switchOn() +Light::switchOn() const { m_vtkLight->SwitchOn(); } bool -Light::isOff() +Light::isOff() const { return !this->isOn(); } @@ -156,8 +156,14 @@ Light::getName() const } void -Light::setName(std::string name) +Light::setName(const std::string& name) { m_name = name; } + +void +Light::setName(const std::string&& name) +{ + m_name = std::move(name); +} } // imstk diff --git a/Base/SceneElements/Light/imstkLight.h b/Base/SceneElements/Light/imstkLight.h index 31795810e90c8f64e6323b099c510533510a6628..44028731342c89389495a86eba82dfba1008af1a 100644 --- a/Base/SceneElements/Light/imstkLight.h +++ b/Base/SceneElements/Light/imstkLight.h @@ -47,18 +47,18 @@ enum class LightType /// /// \class Light /// -/// \brief Abstract class for lights +/// \brief Abstract base class for lights /// class Light { public: /// - /// \brief + /// \brief Returns the type of light (see imstk::LightType) /// - LightType getType(); + LightType getType() const; /// - /// \brief + /// \brief Set the type of the light /// void setType(const LightType& type); @@ -76,22 +76,22 @@ public: const double& z); /// - /// \brief + /// \brief Get the status (On/off) of the light /// - bool isOn(); + bool isOn() const; /// - /// \brief + /// \brief Switch the light On /// - void switchOn(); + void switchOn() const; /// - /// \brief + /// \brief Get the status (On/off) of the light /// - bool isOff(); + bool isOff() const; /// - /// \brief + /// \brief Switch the light Off /// void switchOff(); @@ -128,13 +128,12 @@ public: /// /// \brief Set the light name /// - void setName(std::string name); + void setName(const std::string& name); + void setName(const std::string&& name); protected: - Light(std::string name) - { - m_name = name; - }; + Light(const std::string& name) : m_name(name){}; + Light(std::string&& name) : m_name(std::move(name)){}; vtkSmartPointer<vtkLight> m_vtkLight = vtkSmartPointer<vtkLight>::New(); std::string m_name; @@ -152,7 +151,15 @@ protected: class DirectionalLight : public Light { public: - DirectionalLight(std::string name) : Light(name) + /// + /// \brief Constructor + /// + DirectionalLight(const std::string& name) : Light(name) + { + m_type = LightType::DIRECTIONAL_LIGHT; + m_vtkLight->SetPositional(false); + }; + DirectionalLight(std::string&& name) : Light(std::move(name)) { m_type = LightType::DIRECTIONAL_LIGHT; m_vtkLight->SetPositional(false); @@ -170,7 +177,16 @@ public: class PointLight : public Light { public: - PointLight(std::string name) : Light(name) + /// + /// \brief Constructors + /// + PointLight(const std::string& name) : Light(name) + { + m_type = LightType::POINT_LIGHT; + m_vtkLight->SetPositional(true); + m_vtkLight->SetConeAngle(179.0); + }; + PointLight(std::string&& name) : Light(std::move(name)) { m_type = LightType::POINT_LIGHT; m_vtkLight->SetPositional(true); @@ -199,7 +215,15 @@ public: class SpotLight : public PointLight { public: - SpotLight(std::string name) : PointLight(name) + /// + /// \brief Constructors + /// + SpotLight(const std::string& name) : PointLight(name) + { + m_type = LightType::SPOT_LIGHT; + m_vtkLight->SetConeAngle(45); + }; + SpotLight(std::string&& name) : PointLight(std::move(name)) { m_type = LightType::SPOT_LIGHT; m_vtkLight->SetConeAngle(45); diff --git a/Base/SimulationManager/imstkSimulationManager.cpp b/Base/SimulationManager/imstkSimulationManager.cpp index 352b300e7d5743394b3e6293e62e05849c7d85e3..4e6aaa3d32f83dfb487bfda4c8e7c07f627df28c 100644 --- a/Base/SimulationManager/imstkSimulationManager.cpp +++ b/Base/SimulationManager/imstkSimulationManager.cpp @@ -98,8 +98,8 @@ SimulationManager::createNewScene(std::string&& newSceneName) if (this->isSceneRegistered(newSceneName)) { LOG(WARNING) << "Can not create new scene: '" << newSceneName - << "' is already registered in this simulation\n" - << "You can create a new scene using an unique name"; + << "' is already registered in this simulation\n" + << "You can create a new scene using an unique name"; return nullptr; }