Robotran C Documentation
MbsSpotLight.hh
Go to the documentation of this file.
1 
6 #ifdef OPEN_GL
7 
8 #ifndef _MBS_SPOT_LIGHT_HH_
9 #define _MBS_SPOT_LIGHT_HH_
10 
11 #include "MbsPointLight.hh"
12 
13 namespace OpenGLMbs{
14 
17 class MbsSpotLight: public MbsPointLight
18 {
19  public:
20  MbsSpotLight(glm::vec3 const& rel_pos = glm::vec3(0.0f),
21  glm::vec3 const& attenuation = glm::vec3(1.0f, 0.0f, 0.0f),
22  glm::vec3 const& rel_dir = glm::vec3(0.0f, 0.0f, -1.0f),
23  glm::mat4 const& parent_mat = glm::mat4(1.0f),
24  glm::vec3 const& color = glm::vec3(1.0f),
25  float ambient = 0.05f,
26  float spread_angle = 3.1415927f,
27  float concentration = 0.0f,
28  bool active = true,
29  int depth_x_width = 1024, int depth_y_width = 1024, float shadow_bias = 0.0f,
30  float depth_near = 0.1f, float depth_far = 100.0f,
31  glm::vec3 const& shadow_z_up = glm::vec3(0.0, 0.0, 1.0),
32  float depth_FoV_rad = 1.0f);
33  virtual ~MbsSpotLight();
34 
35  virtual void Update();
36 
38  glm::vec3 GetNormDir() const { return norm_dir; }
39 
41  float GetSpreadAngle() const { return spread_angle; }
42 
44  float GetConcentration() const { return concentration; }
45 
47  void UpdateRelDir(glm::vec3 const& rel_dir)
48  {
49  this->rel_dir = rel_dir;
50  rel_dir_4 = glm::vec4(rel_dir, 0.0f);
51 
52  Update();
53  }
54 
56  virtual void UpdateParentPos(glm::mat4 const& parent_mat)
57  {
58  MbsPointLight::UpdateParentPos(parent_mat);
59 
60  Update();
61  }
62 
63  private:
64  glm::vec3 dir;
65  glm::vec4 dir_4;
66  glm::vec3 norm_dir;
67 
68  glm::vec3 rel_dir;
69  glm::vec4 rel_dir_4;
70 
71  float spread_angle;
72  float concentration;
73 };
74 
75 }
76 #endif
77 #endif
MbsSpotLight.hh
MbsSpotLight class.
OpenGLMbs
Definition: MpegFrameCaptureOptions.hh:6
MbsPointLight.hh
MbsPointLight class.