mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -07:00
Removes unused BuildColor4ub from ModelRenderer
We don't need to calculate shading on CPU since we always use shaders.
Refs: a9c27b412b
This commit is contained in:
parent
867bdf318b
commit
c4e7364802
3 changed files with 0 additions and 58 deletions
|
|
@ -53,25 +53,6 @@ public:
|
|||
void SetElevation(float f);
|
||||
void SetRotation(float f);
|
||||
|
||||
/**
|
||||
* Calculate brightness of a point of a unit with the given normal vector,
|
||||
* for rendering with CPU lighting.
|
||||
* The resulting color contains both ambient and diffuse light.
|
||||
* To cope with sun overbrightness, the color is scaled by 0.5.
|
||||
*
|
||||
* @param normal normal vector (must have length 1)
|
||||
*/
|
||||
RGBColor EvaluateUnitScaled(const CVector3D& normal) const
|
||||
{
|
||||
float dot = -normal.Dot(m_SunDir);
|
||||
|
||||
RGBColor color = m_AmbientColor;
|
||||
if (dot > 0)
|
||||
color += m_SunColor * dot;
|
||||
|
||||
return color * 0.5f;
|
||||
}
|
||||
|
||||
// Comparison operators
|
||||
bool operator==(const CLightEnv& o) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -156,29 +156,6 @@ void ModelRenderer::BuildPositionAndNormals(
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void ModelRenderer::BuildColor4ub(
|
||||
CModel* model,
|
||||
const VertexArrayIterator<CVector3D>& Normal,
|
||||
const VertexArrayIterator<SColor4ub>& Color)
|
||||
{
|
||||
PROFILE("lighting vertices");
|
||||
|
||||
CModelDefPtr mdef = model->GetModelDef();
|
||||
size_t numVertices = mdef->GetNumVertices();
|
||||
const CLightEnv& lightEnv = g_Renderer.GetSceneRenderer().GetLightEnv();
|
||||
CColor shadingColor = model->GetShadingColor();
|
||||
|
||||
for (size_t j = 0; j < numVertices; ++j)
|
||||
{
|
||||
RGBColor tempcolor = lightEnv.EvaluateUnitScaled(Normal[j]);
|
||||
tempcolor.X *= shadingColor.r;
|
||||
tempcolor.Y *= shadingColor.g;
|
||||
tempcolor.Z *= shadingColor.b;
|
||||
Color[j] = ConvertRGBColorTo4ub(tempcolor);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void ModelRenderer::GenTangents(const CModelDefPtr& mdef, std::vector<float>& newVertices, bool gpuSkinning)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -141,22 +141,6 @@ public:
|
|||
const VertexArrayIterator<CVector3D>& Position,
|
||||
const VertexArrayIterator<CVector3D>& Normal);
|
||||
|
||||
/**
|
||||
* BuildColor4ub: Build lighting colors for the given model,
|
||||
* based on previously calculated world space normals.
|
||||
*
|
||||
* @param model The model that is to be lit.
|
||||
* @param Normal Array of the model's normal vectors, animated and
|
||||
* transformed into world space.
|
||||
* @param Color Points to the array that will receive the lit vertex color.
|
||||
* The array behind the iterator must large enough to hold
|
||||
* model->GetModelDef()->GetNumVertices() vertices.
|
||||
*/
|
||||
static void BuildColor4ub(
|
||||
CModel* model,
|
||||
const VertexArrayIterator<CVector3D>& Normal,
|
||||
const VertexArrayIterator<SColor4ub>& Color);
|
||||
|
||||
/**
|
||||
* BuildUV: Copy UV coordinates into the given vertex array.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue