Choreonoid  1.8
Light.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_LIGHT_H
7 #define CNOID_BODY_LIGHT_H
8 
9 #include "Device.h"
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class Mapping;
15 
16 class CNOID_EXPORT Light : public Device
17 {
18 protected:
19  Light();
20  Light(const Light& org, bool copyStateOnly = false);
21 
22 public:
23  void copyStateFrom(const Light& other);
25  virtual void forEachActualType(std::function<bool(const std::type_info& type)> func) override;
26 
27  bool on() const override;
28  void on(bool on) override;
29 
30  const Vector3f& color() const { return color_; }
31  void setColor(const Vector3f& c) { color_ = c; }
32  void setColor(const Vector3& c) { color_ = c.cast<Vector3f::Scalar>(); }
33 
34  float intensity() const { return intensity_; }
35  void setIntensity(float intensity) { intensity_ = intensity; }
36 
37  static int lightStateSize();
38  virtual const double* readState(const double* buf) override;
39  virtual double* writeState(double* out_buf) const override;
40 
41  bool readSpecifications(const Mapping* info);
42  bool writeSpecifications(Mapping* info) const;
43 
44 private:
45  Vector3f color_;
46  float intensity_;
47  bool on_;
48 };
49 
51 
52 }
53 
54 #endif
cnoid::Mapping
Definition: ValueTree.h:253
Device.h
cnoid::Light
Definition: Light.h:16
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::ref_ptr
Definition: Referenced.h:103
cnoid::Light::color
const Vector3f & color() const
Definition: Light.h:30
cnoid::DeviceState::copyStateFrom
virtual void copyStateFrom(const DeviceState &other)=0
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Light::intensity
float intensity() const
Definition: Light.h:34
cnoid::Light::setIntensity
void setIntensity(float intensity)
Definition: Light.h:35
cnoid::Light::setColor
void setColor(const Vector3 &c)
Definition: Light.h:32
cnoid::Device
Definition: Device.h:53
cnoid::Light::setColor
void setColor(const Vector3f &c)
Definition: Light.h:31
cnoid::LightPtr
ref_ptr< Light > LightPtr
Definition: Light.h:50