1
0
forked from mirrors/0ad

Removes code duplications for binding shadows to shaders.

This was SVN commit r24710.
This commit is contained in:
vladislavbelov
2021-01-19 19:19:04 +00:00
parent 4a2cc3273e
commit 5cbf8f04ec
4 changed files with 15 additions and 73 deletions
+7 -23
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -664,20 +664,16 @@ void ShadowMap::EndRender()
glColorMask(1,1,1,1);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Retrieve the texture handle and texture matrix for shadowing
GLuint ShadowMap::GetTexture() const
void ShadowMap::BindTo(const CShaderProgramPtr& shader) const
{
return m->Texture;
}
if (!shader->GetTextureBinding(str_shadowTex).Active())
return;
const CMatrix3D& ShadowMap::GetTextureMatrix() const
{
return m->TextureMatrix;
shader->BindTexture(str_shadowTex, m->Texture);
shader->Uniform(str_shadowTransform, m->TextureMatrix);
shader->Uniform(str_shadowScale, m->Width, m->Height, 1.0f / m->Width, 1.0f / m->Height);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Depth texture bits
int ShadowMap::GetDepthTextureBits() const
@@ -700,18 +696,6 @@ void ShadowMap::SetDepthTextureBits(int bits)
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// Depth texture size
int ShadowMap::GetWidth() const
{
return m->Width;
}
int ShadowMap::GetHeight() const
{
return m->Height;
}
//////////////////////////////////////////////////////////////////////////////
void ShadowMap::RenderDebugBounds()