Index: ps/trunk/source/graphics/GameView.cpp =================================================================== --- ps/trunk/source/graphics/GameView.cpp +++ ps/trunk/source/graphics/GameView.cpp @@ -527,9 +527,6 @@ if (m->CachedLightEnv == g_LightEnv) return; - if (m->CachedLightEnv.GetLightingModel() != g_LightEnv.GetLightingModel()) - g_Renderer.MakeShadersDirty(); - m->CachedLightEnv = g_LightEnv; CTerrain* pTerrain = m->Game->GetWorld()->GetTerrain(); Index: ps/trunk/source/graphics/LightEnv.h =================================================================== --- ps/trunk/source/graphics/LightEnv.h +++ ps/trunk/source/graphics/LightEnv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -35,36 +35,6 @@ */ class CLightEnv { -friend class CMapWriter; -friend class CMapReader; -friend class CXMLReader; -private: - /** - * Height of sun above the horizon, in radians. - * For example, an elevation of M_PI/2 means the sun is straight up. - */ - float m_Elevation; - - /** - * Direction of sun on the compass, in radians. - * For example, a rotation of zero means the sun is in the direction (0,0,-1) - * and a rotation of M_PI/2 means the sun is in the direction (1,0,0) (not taking - * elevation into account). - */ - float m_Rotation; - - /** - * Vector corresponding to m_Elevation and m_Rotation. - * Updated by CalculateSunDirection. - */ - CVector3D m_SunDir; - - /** - * A string that shaders use to determine what lighting model to implement. - * Current recognised values are "old" and "standard". - */ - std::string m_LightingModel; - public: RGBColor m_SunColor; RGBColor m_TerrainAmbientColor; @@ -76,19 +46,15 @@ float m_Brightness, m_Contrast, m_Saturation, m_Bloom; -public: CLightEnv(); float GetElevation() const { return m_Elevation; } float GetRotation() const { return m_Rotation; } const CVector3D& GetSunDir() const { return m_SunDir; } - const std::string& GetLightingModel() const { return m_LightingModel; } void SetElevation(float f); void SetRotation(float f); - void SetLightingModel(const std::string& model) { m_LightingModel = model; } - /** * Calculate brightness of a point of a unit with the given normal vector, * for rendering with CPU lighting. @@ -137,7 +103,6 @@ { return m_Elevation == o.m_Elevation && m_Rotation == o.m_Rotation && - m_LightingModel == o.m_LightingModel && m_SunColor == o.m_SunColor && m_TerrainAmbientColor == o.m_TerrainAmbientColor && m_UnitsAmbientColor == o.m_UnitsAmbientColor && @@ -156,6 +121,30 @@ } private: + friend class CMapWriter; + friend class CMapReader; + friend class CXMLReader; + + /** + * Height of sun above the horizon, in radians. + * For example, an elevation of M_PI/2 means the sun is straight up. + */ + float m_Elevation; + + /** + * Direction of sun on the compass, in radians. + * For example, a rotation of zero means the sun is in the direction (0,0,-1) + * and a rotation of M_PI/2 means the sun is in the direction (1,0,0) (not taking + * elevation into account). + */ + float m_Rotation; + + /** + * Vector corresponding to m_Elevation and m_Rotation. + * Updated by CalculateSunDirection. + */ + CVector3D m_SunDir; + void CalculateSunDirection(); }; Index: ps/trunk/source/graphics/LightEnv.cpp =================================================================== --- ps/trunk/source/graphics/LightEnv.cpp +++ ps/trunk/source/graphics/LightEnv.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -15,21 +15,16 @@ * along with 0 A.D. If not, see . */ -/* - * CLightEnv implementation - */ - #include "precompiled.h" -#include "maths/MathUtil.h" - #include "graphics/LightEnv.h" +#include "maths/MathUtil.h" + CLightEnv::CLightEnv() : m_Elevation(DEGTORAD(45)), m_Rotation(DEGTORAD(315)), - m_LightingModel("standard"), m_SunColor(1.5, 1.5, 1.5), m_TerrainAmbientColor(0x50/255.f, 0x60/255.f, 0x85/255.f), m_UnitsAmbientColor(0x80/255.f, 0x80/255.f, 0x80/255.f), Index: ps/trunk/source/renderer/Renderer.cpp =================================================================== --- ps/trunk/source/renderer/Renderer.cpp +++ ps/trunk/source/renderer/Renderer.cpp @@ -578,9 +578,6 @@ #endif } - if (m_LightEnv) - m->globalContext.Add(CStrIntern("LIGHTING_MODEL_" + m_LightEnv->GetLightingModel()), str_1); - if (m_Options.m_PreferGLSL && m_Options.m_Fog) m->globalContext.Add(str_USE_FOG, str_1);