31#ifndef VP_PANDA3D_LIGHT_H
32#define VP_PANDA3D_LIGHT_H
34#include <visp3/core/vpConfig.h>
36#if defined(VISP_HAVE_PANDA3D)
39#include <visp3/core/vpPoint.h>
40#include <visp3/core/vpRGBf.h>
41#include <visp3/ar/vpPanda3DBaseRenderer.h>
44#include "ambientLight.h"
45#include "directionalLight.h"
46#include "pointLight.h"
47#include "directionalLight.h"
134 PT(AmbientLight) light =
new AmbientLight(
m_name);
136 NodePath alnp = scene.attach_new_node(light);
137 scene.set_light(alnp);
176 if (position.
size() != 3) {
177 throw vpException(vpException::dimensionError,
"Point light position must be a 3 dimensional vector");
179 m_position.resize(4,
false);
180 m_position.insert(0, position);
182 if (attenuation.
size() != 3) {
183 throw vpException(vpException::dimensionError,
"Point light attenuation components must be a 3 dimensional vector");
191 PT(PointLight) light =
new PointLight(
m_name);
193 light->set_attenuation(LVecBase3(m_attenuation[0], m_attenuation[1], m_attenuation[2]));
194 NodePath np = scene.attach_new_node(light);
196 np.set_pos(m_position[0], m_position[1], m_position[2]);
234 if (m_direction.size() != 3) {
235 throw vpException(vpException::dimensionError,
"Direction light direction must be a 3 dimensional vector");
237 m_direction.normalize();
244 PT(DirectionalLight) light =
new DirectionalLight(
m_name);
247 light->set_direction(LVector3f(m_direction[0], m_direction[1], m_direction[2]));
248 NodePath np = scene.attach_new_node(light);
310 if (m_lightableScene.is_empty()) {
313 light.addToScene(m_lightableScene);
318 NodePath m_lightableScene;
unsigned int size() const
Return the number of elements of the 2D array.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
@ notInitialized
Used to indicate that a parameter is not initialized.
void addToScene(NodePath &scene) const VP_OVERRIDE
Add the light to the scene.
virtual ~vpPanda3DAmbientLight()=default
vpPanda3DAmbientLight(const std::string &name, const vpRGBf &color)
static vpColVector vispVectorToPanda(const vpColVector &vec)
virtual ~vpPanda3DDirectionalLight()=default
void addToScene(NodePath &scene) const VP_OVERRIDE
Add the light to the scene.
vpPanda3DDirectionalLight(const std::string &name, const vpRGBf &color, const vpColVector &direction)
Build a new directional light.
Base class for a Light that can be added to a Panda3D scene.
const std::string & getName() const
Get the name of the light.
const vpRGBf & getColor() const
Get the light's color.
virtual void addToScene(NodePath &scene) const =0
Add the light to the scene.
vpRGBf m_color
Name of the light. Should be unique in the scene.
virtual ~vpPanda3DLight()=default
vpPanda3DLight(const std::string &name, const vpRGBf &color)
Build a new Panda3D light, given a unique name and an RGB color.
void addLight(const vpPanda3DLight &light) VP_OVERRIDE
Add a light to the scene. All of the objects in the scene will be lit.
vpPanda3DLightableScene()
void setLightableScene(NodePath &scene)
vpPanda3DLightableScene(NodePath &scene)
virtual ~vpPanda3DLightableScene()=default
Interface for objects, scenes or other Panda3D related data that can be lit by a vpPanda3DLight.
virtual ~vpPanda3DLightable()=default
virtual void addLight(const vpPanda3DLight &light)=0
Light this lightable object with a new light.
void addToScene(NodePath &scene) const VP_OVERRIDE
Add the light to the scene.
virtual ~vpPanda3DPointLight()=default
vpPanda3DPointLight(const std::string &name, const vpRGBf &color, const vpColVector &position, const vpColVector &attenuation)
Build a new point light.