##

rendering/Light.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* 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
*
* 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.
*
*/
#ifndef GAZEBO_RENDERING_LIGHT_HH_
#define GAZEBO_RENDERING_LIGHT_HH_
#include <string>
#include <iostream>
#include <sdf/sdf.hh>
#include <ignition/math/Color.hh>
#include <ignition/math/Quaternion.hh>
#include <ignition/math/Vector3.hh>
#include "gazebo/msgs/msgs.hh"
#include "gazebo/rendering/RenderTypes.hh"
#include "gazebo/common/Color.hh"
#include "gazebo/util/system.hh"
namespace Ogre
{
class Light;
}
namespace gazebo
{
namespace rendering
{
// Forward declare private data.
class LightPrivate;
class GZ_RENDERING_VISIBLE Light :
public boost::enable_shared_from_this<Light>
{
public: explicit Light(ScenePtr _scene);
public: virtual ~Light();
public: void Load(sdf::ElementPtr _sdf);
public: void Load();
public: void LoadFromMsg(ConstLightPtr &_msg);
public: void LoadFromMsg(const msgs::Light &_msg);
public: void SetName(const std::string &_name);
public: std::string Name() const;
public: std::string Type() const;
public: void SetPosition(const ignition::math::Vector3d &_p);
public: ignition::math::Vector3d Position() const;
public: void SetRotation(const ignition::math::Quaterniond &_q);
public: ignition::math::Quaterniond Rotation() const;
public: ignition::math::Pose3d WorldPose() const;
public: virtual bool SetSelected(const bool _s);
// \brief Toggle light visual visibility
public: void ToggleShowVisual();
public: void ShowVisual(const bool _s);
public: void SetVisible(const bool _s);
public: bool Visible() const;
public: void SetLightType(const std::string &_type);
public: std::string LightType() const;
public: void SetDiffuseColor(const common::Color &_color)
GAZEBO_DEPRECATED(9.0);
public: void SetDiffuseColor(const ignition::math::Color &_color);
public: ignition::math::Color DiffuseColor() const;
public: void SetSpecularColor(const common::Color &_color)
GAZEBO_DEPRECATED(9.0);
public: void SetSpecularColor(const ignition::math::Color &_color);
public: ignition::math::Color SpecularColor() const;
public: void SetDirection(const ignition::math::Vector3d &_dir);
public: ignition::math::Vector3d Direction() const;
public: void SetAttenuation(double _constant, double _linear,
double _quadratic);
public: void SetSpotInnerAngle(const double _angle);
public: void SetSpotOuterAngle(const double _angle);
public: void SetSpotFalloff(const double _value);
public: void SetRange(const double _range);
public: void SetCastShadows(const bool _cast);
public: bool CastShadows() const;
public: void FillMsg(msgs::Light &_msg) const;
public: void UpdateFromMsg(ConstLightPtr &_msg);
public: LightPtr Clone(const std::string &_name, ScenePtr _scene);
public: uint32_t Id() const;
protected: virtual void OnPoseChange() {}
private: void CreateVisual();
private: void Update();
private: void UpdateSDFFromMsg(const msgs::Light &_msg);
private: std::unique_ptr<LightPrivate> dataPtr;
};
}
}
#endif
gazebo::rendering::Light::FillMsg
void FillMsg(msgs::Light &_msg) const
Fill the contents of a light message.
gazebo::rendering::Light::Name
std::string Name() const
Get the name of the visual.
gazebo::rendering::Light::LoadFromMsg
void LoadFromMsg(ConstLightPtr &_msg)
Load from a light message.
gazebo::rendering::Light::SetDirection
void SetDirection(const ignition::math::Vector3d &_dir)
Set the direction.
gazebo::rendering::Light::SetCastShadows
void SetCastShadows(const bool _cast)
Set cast shadows.
gazebo::rendering::Light::~Light
virtual ~Light()
Destructor.
Ogre
Definition: JointMaker.hh:39
gazebo::rendering::Light::Id
uint32_t Id() const
Get the id associated with this light.
gazebo::rendering::Light::CastShadows
bool CastShadows() const
Get cast shadows.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::rendering::Light::Visible
bool Visible() const
Get whether the light is visible.
gazebo::rendering::Light::Type
std::string Type() const
Get the type of the light.
gazebo::rendering::Light::Position
ignition::math::Vector3d Position() const
Get the position of the light.
gazebo::rendering::Light::LightType
std::string LightType() const
Get the light type.
gazebo::rendering::Light::OnPoseChange
virtual void OnPoseChange()
On pose change callback.
Definition: rendering/Light.hh:228
gazebo::rendering::Light::SetPosition
void SetPosition(const ignition::math::Vector3d &_p)
Set the position of the light.
gazebo::rendering::Light::WorldPose
ignition::math::Pose3d WorldPose() const
Get the world pose of the light.
gazebo::rendering::Light::SetRange
void SetRange(const double _range)
Set the range.
system.hh
gazebo::rendering::Light::SetVisible
void SetVisible(const bool _s)
Set whether the light will be visible.
gazebo::rendering::Light::SetSpotInnerAngle
void SetSpotInnerAngle(const double _angle)
Set the spot light inner angle.
msgs.hh
gazebo::rendering::Light::SetRotation
void SetRotation(const ignition::math::Quaterniond &_q)
Set the rotation of the light.
gazebo::rendering::Light::SetName
void SetName(const std::string &_name)
Set the name of the visual.
gazebo::rendering::Light::Rotation
ignition::math::Quaterniond Rotation() const
Get the rotation of the light.
gazebo::rendering::Light::SetAttenuation
void SetAttenuation(double _constant, double _linear, double _quadratic)
Set the attenuation.
gazebo::rendering::Light::SetSelected
virtual bool SetSelected(const bool _s)
Set whether this entity has been selected by the user through the gui.
gazebo::rendering::Light::Clone
LightPtr Clone(const std::string &_name, ScenePtr _scene)
Clone the light with a new name.
gazebo::rendering::ScenePtr
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:82
RenderTypes.hh
Color.hh
rendering
rendering
Definition: RenderEngine.hh:31
gazebo::rendering::Light::UpdateFromMsg
void UpdateFromMsg(ConstLightPtr &_msg)
Update a light source from a message.
gazebo::rendering::Light::SetLightType
void SetLightType(const std::string &_type)
Set the light type.
gazebo::rendering::Light::SetSpecularColor
void SetSpecularColor(const common::Color &_color) GAZEBO_DEPRECATED(9.0)
Set the specular color.
gazebo::rendering::Light::SetSpotFalloff
void SetSpotFalloff(const double _value)
Set the spot light falloff.
gazebo::rendering::Light::ShowVisual
void ShowVisual(const bool _s)
Set whether to show the visual.
gazebo::common::Color
Defines a color.
Definition: Color.hh:36
gazebo::rendering::Light::Light
Light(ScenePtr _scene)
Constructor.
gazebo::rendering::Light::Load
void Load()
Load the light using default parameters.
gazebo::rendering::Light::SpecularColor
ignition::math::Color SpecularColor() const
Get the specular color.
gazebo::rendering::Light::Direction
ignition::math::Vector3d Direction() const
Get the direction.
gazebo::rendering::Light::ToggleShowVisual
void ToggleShowVisual()
GAZEBO_DEPRECATED
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
gazebo::rendering::LightPtr
boost::shared_ptr< Light > LightPtr
Definition: RenderTypes.hh:86
gazebo::rendering::Light::SetDiffuseColor
void SetDiffuseColor(const common::Color &_color) GAZEBO_DEPRECATED(9.0)
Set the diffuse color.
gazebo::rendering::Light::DiffuseColor
ignition::math::Color DiffuseColor() const
Get the diffuse color.
gazebo::rendering::Light
A light source.
Definition: rendering/Light.hh:54
gazebo::rendering::Light::SetSpotOuterAngle
void SetSpotOuterAngle(const double _angle)
Set the spot light outer angle.