Robotran C Documentation
MbsDirLight.hh
Go to the documentation of this file.
1 
6 #ifdef OPEN_GL
7 
8 #ifndef _MBS_DIR_LIGHT_HH_
9 #define _MBS_DIR_LIGHT_HH_
10 
11 #include "MbsLight.hh"
12 
13 namespace OpenGLMbs{
14 
15 class MbsDirLight: public MbsLight
16 {
17  public:
18  MbsDirLight(glm::vec3 const& rel_dir = glm::vec3(0.0f, 0.0f, -1.0f),
19  glm::mat4 const& parent_mat = glm::mat4(1.0f),
20  glm::vec3 const& color = glm::vec3(1.0f),
21  float ambient = 0.05f,
22  bool active = true,
23  int depth_x_width = 1024, int depth_y_width = 1024, float shadow_bias = 0.0f,
24  float depth_near = -10.0f, float depth_far = 20.0f,
25  glm::vec3 const& shadow_z_up = glm::vec3(0.0, 0.0, 1.0),
26  float depth_scale = 0.0015f,
27  glm::vec3 const& rel_shadow_point = glm::vec3(0.0f));
28  virtual ~MbsDirLight();
29 
30  virtual void Update();
31 
33  glm::vec3 GetNormDir() const { return norm_dir; }
34 
36  void UpdateRelDir(glm::vec3 const& rel_dir)
37  {
38  this->rel_dir = rel_dir;
39  rel_dir_4 = glm::vec4(rel_dir, 0.0f);
40 
41  Update();
42  }
43 
45  virtual void UpdateParentPos(glm::mat4 const& parent_mat)
46  {
47  MbsLight::UpdateParentPos(parent_mat);
48 
49  Update();
50  }
51 
52  private:
53  glm::vec3 dir;
54  glm::vec4 dir_4;
55  glm::vec3 norm_dir;
56 
57  glm::vec3 rel_dir;
58  glm::vec4 rel_dir_4;
59 
60  // shadow
61  glm::vec3 rel_shadow_point;
62 
63  glm::mat4 shadow_mat_pos;
64  glm::mat4 shadow_mat_rel;
65 };
66 
67 }
68 #endif
69 #endif
OpenGLMbs
Definition: MpegFrameCaptureOptions.hh:6
MbsDirLight.hh
MbsDirLight class.
MbsLight.hh
MbsLight class.