SuzanneIsland: An island of Real-time rendering effects!
light.h
1 #pragma once
2 
3 #include "geometry.h"
4 
5 
7 
10 class Light : public Geometry
11 {
12 public:
13  Light(const glm::mat4 &modelMatrix_, const std::string &geometryFilePath, glm::vec3 endPos, float cycleDuration_);
14 
16  virtual void update(float timeDelta
17  , bool enableColorChange);
18 
20  glm::vec3 getColor() const;
21 private:
22  // enum for the 4 sections of each day
23  enum DayTime {
24  MORNING = 0, AFTERNOON = 1, EVENING = 2, NIGHT = 3
25  } dayTime;
26 
27  glm::vec3 startPosition;
28  glm::vec3 endPosition;
29  glm::vec3 direction; // unit vector pointing from start to end
30 
31  float cycleDuration; // duration of one whole day/night cycle
32  float distance; // distance between start and endpoint (= distance to interpolate)
33  float timePassed; // accumulated time change
34 
35  glm::vec3 currentColor; // current color interpolated according to time of day
36  const glm::vec3 nightColor;
37  const glm::vec3 morningColor;
38  const glm::vec3 noonColor;
39  const glm::vec3 eveningColor;
40 };
41 
The Light class.
Definition: light.h:10
A SceneObject that holds Surfaces containing mesh data and textures.
Definition: geometry.h:19
virtual void update(float timeDelta, bool enableColorChange)
update the state of the Light
Definition: light.cpp:21
glm::vec3 getColor() const
Returns the current color as calculated.
Definition: light.cpp:75