All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GlobalLighting.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "VectorMath.h"
6 
7 namespace Eegeo
8 {
9  namespace Lighting
10  {
11  enum LightDirectionType
12  {
13  LightDirectionType_Key = 0,
14  LightDirectionType_Back,
15  LightDirectionType_Fill,
16  LightDirectionType_Ambient,
17  LightDirectionType_MAX
18  };
19 
21  {
22  private:
23 
24  Eegeo::m44 m_lightColorMat;
25  Eegeo::m44 m_alternativeAmbientLightColorMat;
26  Eegeo::m44 m_cameraPositionLightDirectionMatrix;
27  Eegeo::v3 m_nightLightmapColour;
28  Eegeo::v3 m_alternativeAmbientColour;
29  float m_dayToNightParam;
30  float m_nightGlowLightmapIntensity;
31 
32  Eegeo::v3 GetKeyLightVectorByAzimuthZenithForEcefPosition(float _azimuthDegrees, float _zenithDegrees, Eegeo::dv3 _ecefVertexPosition) const;
33  public:
34  const static float KeyLightAzimuth;
35  const static float KeyLightZenith;
36 
38 
39  void SetRenderState(const Eegeo::dv3& cameraLocationEcef);
40  void SetWithScale(GlobalLighting* pSource, float scale);
41 
42  void GetLightDirectionMatrix(const Eegeo::dv3& _ecefVertexPosition, Eegeo::m44 &out_inverseLightDirectionMat) const;
43  const Eegeo::m44& GetLightDirectionMatrixForCameraPosition() const;
44  void SetLightColourMatrix(const Eegeo::m44& lightColourMatrix);
45 
46  const Eegeo::m44 &GetColors(bool useAlternativeAmbient = false) const
47  {
48  return useAlternativeAmbient ? m_alternativeAmbientLightColorMat : m_lightColorMat;
49  }
50 
51  //void FillInRGB(Rendering::VertexTypes::DiffuseTexturedPreLitVertex &v,float packedLightDots);
52 
53  const Eegeo::v3& GetAlternativeAmbientLight() const { return m_alternativeAmbientColour;}
54 
55  void SetNightLightmapColour(const Eegeo::v3& colour) { m_nightLightmapColour = colour; }
56  void SetAlternativeAmbientColour(const Eegeo::v3& colour) { m_alternativeAmbientColour = colour; }
57  const Eegeo::v3& GetNightLightmapColour() const { return m_nightLightmapColour; }
58  //const Eegeo::v3& GetNightForcedAmbientColour() const { return m_nightAmbientColour; }
59 
62  void SetDayToNightParam(float dayToNightParam) { m_dayToNightParam = dayToNightParam; }
63 
66  float GetDayToNightParam() const { return m_dayToNightParam; }
67 
68  void SetNightGlowLightmapIntensity(float nightGlowLightmapIntensity) { m_nightGlowLightmapIntensity = nightGlowLightmapIntensity; }
69  float GetNightGlowLightmapIntensity() const { return m_nightGlowLightmapIntensity; }
70  };
71  }
72 }