Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added LightVisual #202

Merged
merged 13 commits into from
Feb 3, 2021
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
1. Add ogre2 skybox support
* [Pull request #168](https://github.com/ignitionrobotics/ign-rendering/pull/168)

1. Add light visual support
* [Pull request #202](https://github.com/ignitionrobotics/ign-rendering/pull/202)

### Ignition Rendering 4.X

### Ignition Rendering 4.2.0 (2021-01-22)
Expand Down
82 changes: 82 additions & 0 deletions include/ignition/rendering/LightVisual.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (C) 2021 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 IGNITION_RENDERING_LIGHTVISUAL_HH_
#define IGNITION_RENDERING_LIGHTVISUAL_HH_

#include "ignition/rendering/config.hh"
#include "ignition/rendering/Object.hh"
#include "ignition/rendering/RenderTypes.hh"
#include "ignition/rendering/Visual.hh"

namespace ignition
{
namespace rendering
{
inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {

/// \brief Enum for LightVisual types
enum IGNITION_RENDERING_VISIBLE LightVisualType
{
/// \brief No type
LVT_EMPTY = 0,

/// \brief Point light
LVT_POINT = 1,

/// \brief Directional light
LVT_DIRECTIONAL = 2,

/// \brief Spot light
LVT_SPOT = 3
};

/// \class LightVisual LightVisual.hh ignition/rendering/LightVisual.hh
/// \brief Represents a light visual
class IGNITION_RENDERING_VISIBLE LightVisual :
public virtual Visual
{
/// \brief Descructor
public: virtual ~LightVisual() {}

/// \brief set type of the light
/// \param[in] _type type of the light
public: virtual void SetType(LightVisualType _type) = 0;

/// \brief Get light visual type
/// \return The light visual type
public: virtual LightVisualType Type() = 0;

/// \brief set inner angle for spot lights
/// \param[in] _type inner angle
public: virtual void SetInnerAngle(double _innerAngle) = 0;

/// \brief Get inner angle
/// \return The light inner angle
public: virtual double InnerAngle() = 0;

/// \brief set inner angle for spot lights
/// \param[in] _type inner angle
public: virtual void SetOuterAngle(double _outerAngle) = 0;

/// \brief Get inner angle
/// \return The light inner angle
public: virtual double OuterAngle() = 0;
};
}
}
}
#endif
6 changes: 6 additions & 0 deletions include/ignition/rendering/RenderTypes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ namespace ignition
class Grid;
class Heightmap;
class Image;
class Light;
class LightVisual;
class JointVisual;
class LidarVisual;
class Light;
Expand Down Expand Up @@ -146,6 +148,10 @@ namespace ignition
/// \brief Shared pointer to Light
typedef shared_ptr<Light> LightPtr;

/// \def LightVisualPtr
/// \brief Shared pointer to Light
typedef shared_ptr<LightVisual> LightVisualPtr;

/// \def LidarVisualPtr
/// \brief Shared pointer to LidarVisual
typedef shared_ptr<LidarVisual> LidarVisualPtr;
Expand Down
29 changes: 29 additions & 0 deletions include/ignition/rendering/Scene.hh
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,35 @@ namespace ignition
public: virtual GizmoVisualPtr CreateGizmoVisual(
unsigned int _id, const std::string &_name) = 0;

/// \brief Create new light visual. A unique ID and name will
/// automatically be assigned to the light visual.
/// \return The created light visual
public: virtual LightVisualPtr CreateLightVisual() = 0;

/// \brief Create new light visual with the given ID. A unique name
/// will automatically be assigned to the visual. If the given ID is
/// already in use, NULL will be returned.
/// \param[in] _id ID of the new light visual
/// \return The created light visual
public: virtual LightVisualPtr CreateLightVisual(
unsigned int _id) = 0;

/// \brief Create new light visual with the given name. A unique ID
/// will automatically be assigned to the visual. If the given name is
/// already in use, NULL will be returned.
/// \param[in] _name Name of the new light visual
/// \return The created light visual
public: virtual LightVisualPtr CreateLightVisual(
const std::string &_name) = 0;

/// \brief Create new light visual with the given name. If either the
/// given ID or name is already in use, NULL will be returned.
/// \param[in] _id ID of the new light visual
/// \param[in] _name Name of the new light visual
/// \return The created light visual
public: virtual LightVisualPtr CreateLightVisual(
unsigned int _id, const std::string &_name) = 0;

/// \brief Create new box geometry
/// \return The created box
public: virtual GeometryPtr CreateBox() = 0;
Expand Down
Loading