22 #include "precompiled.h"
41 #include <boost/algorithm/string.hpp>
47 : m_Shadow(0), m_LightEnv(0)
76 shader->Uniform(str_transform,
g_Renderer.GetViewCamera().GetViewProjection());
77 shader->Uniform(str_cameraPos,
g_Renderer.GetViewCamera().GetOrientation().GetTranslation());
79 if (
GetShadowMap() && shader->GetTextureBinding(str_shadowTex).Active())
81 shader->BindTexture(str_shadowTex,
GetShadowMap()->GetTexture());
82 shader->Uniform(str_shadowTransform,
GetShadowMap()->GetTextureMatrix());
85 shader->Uniform(str_shadowScale, width, height, 1.0f / width, 1.0f / height);
90 shader->Uniform(str_ambient,
GetLightEnv()->m_UnitsAmbientColor);
91 shader->Uniform(str_sunDir,
GetLightEnv()->GetSunDir());
92 shader->Uniform(str_sunColor,
GetLightEnv()->m_SunColor);
94 shader->Uniform(str_fogColor,
GetLightEnv()->m_FogColor);
98 if (shader->GetTextureBinding(str_losTex).Active())
CShaderProgram::Binding m_BindingShadingColor
void BeginPass(const CShaderProgramPtr &shader)
BeginPass: Setup OpenGL for the given rendering pass.
GLuint GetTextureSmooth()
Class ShadowMap: Maintain the shadow map texture and perform necessary OpenGL setup, including matrix calculations.
const CLightEnv * GetLightEnv() const
const CLightEnv * m_LightEnv
int GetWidth() const
GetWidth: Return the width of the depth texture.
void PrepareModel(const CShaderProgramPtr &shader, CModel *model)
PrepareModel: Called before rendering the given model.
void SetShadowMap(const ShadowMap *shadow)
SetShadowMap: Set the shadow map that will be used for rendering.
CGame * g_Game
Globally accessible pointer to the CGame object.
CShaderProgram::Binding m_BindingInstancingTransform
const ShadowMap * m_Shadow
virtual player_id_t GetPlayerID() const
void SetLightEnv(const CLightEnv *lightenv)
SetLightEnv: Set the light environment that will be used for rendering.
const ShadowMap * GetShadowMap() const
CColor GetPlayerColour(int player) const
Maintains the LOS (fog-of-war / shroud-of-darkness) texture, used for rendering and for the minimap...
const CMatrix3D & GetTransform() const
virtual CColor GetShadingColor() const
const CMatrix3D & GetTextureMatrix()
Returns a matrix to map (x,y,z) world coordinates onto (u,v) LOS texture coordinates, in the form expected by glLoadMatrixf.
Class CLightEnv: description of a lighting environment - contains all the necessary parameters for re...
shared_ptr< CShaderProgram > CShaderProgramPtr
CShaderProgram::Binding m_BindingPlayerColor
int GetHeight() const
GetHeight: Return the height of the depth texture.
bool Active()
Returns whether this uniform attribute is active in the shader.