1
1
forked from 0ad/0ad

Removes unused and obsolete LightingModel.

It was introduced in d295dacb9b as a way to control behavior of shaders.
Its usage in shaders was completely removed in 05008d190e (before that
in b7888aea52).

Reviewed By: elexis
Tested By: Stan
Differential Revision: https://code.wildfiregames.com/D2011
This was SVN commit r22403.
This commit is contained in:
Vladislav Belov 2019-06-26 22:30:23 +00:00
parent 3b77a0fba1
commit ec4d84c72f
4 changed files with 28 additions and 50 deletions

View File

@ -527,9 +527,6 @@ void CGameView::CheckLightEnv()
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();

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/*
* 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),

View File

@ -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 CMapReader;
*/
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 @@ public:
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 @@ public:
{
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 @@ public:
}
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();
};

View File

@ -578,9 +578,6 @@ void CRenderer::ReloadShaders()
#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);