Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/RenderModifiers.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | void ShaderRenderModifier::BeginPass(const CShaderProgramPtr& shader) | ||||
if (shader->GetTextureBinding(str_losTex).Active()) | if (shader->GetTextureBinding(str_losTex).Active()) | ||||
{ | { | ||||
CLOSTexture& los = g_Renderer.GetScene().GetLOSTexture(); | CLOSTexture& los = g_Renderer.GetScene().GetLOSTexture(); | ||||
shader->BindTexture(str_losTex, los.GetTextureSmooth()); | shader->BindTexture(str_losTex, los.GetTextureSmooth()); | ||||
// Don't bother sending the whole matrix, we just need two floats (scale and translation) | // Don't bother sending the whole matrix, we just need two floats (scale and translation) | ||||
shader->Uniform(str_losTransform, los.GetTextureMatrix()[0], los.GetTextureMatrix()[12], 0.f, 0.f); | shader->Uniform(str_losTransform, los.GetTextureMatrix()[0], los.GetTextureMatrix()[12], 0.f, 0.f); | ||||
} | } | ||||
m_BindingInstancingTransform = shader->GetUniformBinding(str_instancingTransform); | |||||
m_BindingShadingColor = shader->GetUniformBinding(str_shadingColor); | m_BindingShadingColor = shader->GetUniformBinding(str_shadingColor); | ||||
m_BindingPlayerColor = shader->GetUniformBinding(str_playerColor); | m_BindingPlayerColor = shader->GetUniformBinding(str_playerColor); | ||||
} | } | ||||
void ShaderRenderModifier::PrepareModel(const CShaderProgramPtr& shader, CModel* model) | void ShaderRenderModifier::PrepareModel(const CShaderProgramPtr& shader, CModel* model) | ||||
{ | { | ||||
if (m_BindingInstancingTransform.Active()) | |||||
shader->Uniform(m_BindingInstancingTransform, model->GetTransform()); | |||||
if (m_BindingShadingColor.Active()) | if (m_BindingShadingColor.Active()) | ||||
shader->Uniform(m_BindingShadingColor, model->GetShadingColor()); | shader->Uniform(m_BindingShadingColor, model->GetShadingColor()); | ||||
if (m_BindingPlayerColor.Active()) | if (m_BindingPlayerColor.Active()) | ||||
shader->Uniform(m_BindingPlayerColor, g_Game->GetPlayerColor(model->GetPlayerID())); | shader->Uniform(m_BindingPlayerColor, g_Game->GetPlayerColor(model->GetPlayerID())); | ||||
} | } |
Wildfire Games · Phabricator