Remove RENDERDATA_UPDATE_COLOR, which is not used, and cleanup.
RENDERDATA_UPDATE_COLOR was used to precompute lightEnv-dependent data
on the CPU. This is no longer done following engine upgrades, and in
particular d7d02a4740
which explictly always did this on the GPU.
ModelAbstract had a 'SetDirtyRec' hack for it because of decals, which
can also be removed. The 'dirty' bit of CRenderableObject is renderdata
for the specific item, never its props, so it never actually needs to be
recursive.
CheckLightEnv is also useless as a result, and removed.
Differential Revision: https://code.wildfiregames.com/D4453
This was SVN commit r26249.
This commit is contained in:
parent
acb043f4a2
commit
330b570ba8
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -63,11 +63,6 @@ public:
|
||||
|
||||
virtual CModelAbstract* Clone() const;
|
||||
|
||||
virtual void SetDirtyRec(int dirtyflags)
|
||||
{
|
||||
SetDirty(dirtyflags);
|
||||
}
|
||||
|
||||
virtual void SetTerrainDirty(ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1);
|
||||
|
||||
virtual void CalcBounds();
|
||||
|
@ -236,8 +236,6 @@ void CGameView::BeginFrame()
|
||||
}
|
||||
g_Renderer.GetSceneRenderer().SetSceneCamera(m->ViewCamera, m->CullCamera);
|
||||
|
||||
CheckLightEnv();
|
||||
|
||||
m->Game->CachePlayerColors();
|
||||
}
|
||||
|
||||
@ -279,27 +277,6 @@ void CGameView::EnumerateObjects(const CFrustum& frustum, SceneCollector* c)
|
||||
m->Game->GetSimulation2()->RenderSubmit(*c, frustum, m->Culling);
|
||||
}
|
||||
|
||||
|
||||
void CGameView::CheckLightEnv()
|
||||
{
|
||||
if (m->CachedLightEnv == g_LightEnv)
|
||||
return;
|
||||
|
||||
m->CachedLightEnv = g_LightEnv;
|
||||
CTerrain* pTerrain = m->Game->GetWorld()->GetTerrain();
|
||||
|
||||
if (!pTerrain)
|
||||
return;
|
||||
|
||||
PROFILE("update light env");
|
||||
pTerrain->MakeDirty(RENDERDATA_UPDATE_COLOR);
|
||||
|
||||
const std::vector<CUnit*>& units = m->Game->GetWorld()->GetUnitManager().GetUnits();
|
||||
for (size_t i = 0; i < units.size(); ++i)
|
||||
units[i]->GetModel().SetDirtyRec(RENDERDATA_UPDATE_COLOR);
|
||||
}
|
||||
|
||||
|
||||
void CGameView::UnloadResources()
|
||||
{
|
||||
g_TexMan.UnloadTerrainTextures();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -92,9 +92,6 @@ private:
|
||||
// Unloads all graphics resources loaded by RegisterInit.
|
||||
void UnloadResources();
|
||||
|
||||
// Checks whether lighting environment has changed and update vertex data if necessary.
|
||||
void CheckLightEnv();
|
||||
|
||||
CGameViewImpl* m;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -125,14 +125,6 @@ public:
|
||||
// TODO: replace with more generic shader define + flags setting
|
||||
void RemoveShadowsRec();
|
||||
|
||||
// recurse down tree setting dirty bits
|
||||
virtual void SetDirtyRec(int dirtyflags) {
|
||||
SetDirty(dirtyflags);
|
||||
for (size_t i=0;i<m_Props.size();i++) {
|
||||
m_Props[i].m_Model->SetDirtyRec(dirtyflags);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void SetTerrainDirty(ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1)
|
||||
{
|
||||
for (size_t i = 0; i < m_Props.size(); ++i)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -89,9 +89,6 @@ public:
|
||||
// and this seems the easiest way to integrate with other code that wants
|
||||
// type-specific processing)
|
||||
|
||||
/// Calls SetDirty on this model and all child objects.
|
||||
virtual void SetDirtyRec(int dirtyflags) = 0;
|
||||
|
||||
/// Returns world space bounds of this object and all child objects.
|
||||
virtual const CBoundingBoxAligned GetWorldBoundsRec() { return GetWorldBounds(); } // default implementation
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -36,7 +36,6 @@ public:
|
||||
virtual CModelDummy* ToCModelDummy() { return this; }
|
||||
|
||||
virtual void CalcBounds() {};
|
||||
virtual void SetDirtyRec(int) {};
|
||||
virtual void SetTerrainDirty(ssize_t, ssize_t, ssize_t, ssize_t) {}
|
||||
virtual void ValidatePosition() {};
|
||||
virtual void InvalidatePosition() {};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -186,11 +186,6 @@ public:
|
||||
|
||||
virtual CModelAbstract* Clone() const;
|
||||
|
||||
virtual void SetDirtyRec(int dirtyflags)
|
||||
{
|
||||
SetDirty(dirtyflags);
|
||||
}
|
||||
|
||||
virtual void SetTerrainDirty(ssize_t UNUSED(i0), ssize_t UNUSED(j0), ssize_t UNUSED(i1), ssize_t UNUSED(j1))
|
||||
{
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -31,7 +31,6 @@
|
||||
// need updating
|
||||
#define RENDERDATA_UPDATE_VERTICES (1<<1)
|
||||
#define RENDERDATA_UPDATE_INDICES (1<<2)
|
||||
#define RENDERDATA_UPDATE_COLOR (1<<4)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -435,10 +435,6 @@ void CRenderer::SetRenderPath(RenderPath rp)
|
||||
g_RenderingOptions.m_RenderPath = rp;
|
||||
|
||||
MakeShadersDirty();
|
||||
|
||||
// We might need to regenerate some render data after changing path
|
||||
if (g_Game)
|
||||
g_Game->GetWorld()->GetTerrain()->MakeDirty(RENDERDATA_UPDATE_COLOR);
|
||||
}
|
||||
|
||||
bool CRenderer::ShouldRender() const
|
||||
|
@ -500,7 +500,6 @@ float ActorViewer::GetRepeatTimeByAttackType(const std::string& type) const
|
||||
void ActorViewer::Render()
|
||||
{
|
||||
// TODO: ActorViewer should reuse CRenderer code and not duplicate it.
|
||||
m.Terrain.MakeDirty(RENDERDATA_UPDATE_COLOR);
|
||||
|
||||
// Set simulation context for rendering purposes
|
||||
g_Renderer.GetSceneRenderer().SetSimulation(&m.Simulation2);
|
||||
|
Loading…
Reference in New Issue
Block a user