Choreonoid  1.8
PointLight.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_POINT_LIGHT_H
7 #define CNOID_BODY_POINT_LIGHT_H
8 
9 #include "Light.h"
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class Mapping;
15 
16 class CNOID_EXPORT PointLight : public Light
17 {
18 public:
19  PointLight();
20  PointLight(const PointLight& org, bool copyStateOnly = false);
21 
22  virtual const char* typeName() const override;
23  void copyStateFrom(const PointLight& other);
24  virtual void copyStateFrom(const DeviceState& other) override;
25  virtual DeviceState* cloneState() const override;
26  virtual void forEachActualType(std::function<bool(const std::type_info& type)> func) override;
27 
28  static int pointLightStateSize();
29  virtual int stateSize() const override;
30  virtual const double* readState(const double* buf) override;
31  virtual double* writeState(double* out_buf) const override;
32 
33  float constantAttenuation() const { return constantAttenuation_; }
34  void setConstantAttenuation(float a) { constantAttenuation_ = a; }
35 
36  float linearAttenuation() const { return linearAttenuation_; }
37  void setLinearAttenuation(float a) { linearAttenuation_ = a; }
38 
39  float quadraticAttenuation() const { return quadraticAttenuation_; }
40  void setQuadraticAttenuation(float a) { quadraticAttenuation_ = a; }
41 
42  bool readSpecifications(const Mapping* info);
43  bool writeSpecifications(Mapping* info) const;
44 
45 protected:
46  virtual Referenced* doClone(CloneMap* cloneMap) const override;
47 
48 private:
49  float constantAttenuation_;
50  float linearAttenuation_;
51  float quadraticAttenuation_;
52 };
53 
55 
56 }
57 
58 #endif
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::Light
Definition: Light.h:16
cnoid::PointLight::setLinearAttenuation
void setLinearAttenuation(float a)
Definition: PointLight.h:37
cnoid::PointLight::quadraticAttenuation
float quadraticAttenuation() const
Definition: PointLight.h:39
Light.h
cnoid::ref_ptr
Definition: Referenced.h:103
cnoid::PointLight::linearAttenuation
float linearAttenuation() const
Definition: PointLight.h:36
cnoid::PointLight::constantAttenuation
float constantAttenuation() const
Definition: PointLight.h:33
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::PointLight::setQuadraticAttenuation
void setQuadraticAttenuation(float a)
Definition: PointLight.h:40
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::DeviceState
Definition: Device.h:20
cnoid::PointLight::setConstantAttenuation
void setConstantAttenuation(float a)
Definition: PointLight.h:34
cnoid::Referenced
Definition: Referenced.h:54
cnoid::PointLightPtr
ref_ptr< PointLight > PointLightPtr
Definition: PointLight.h:54
cnoid::PointLight
Definition: PointLight.h:16