mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
tweaked the updating behavior in the probe manager so calling updateProbes just flags a ProbesDirty bool, which is used to kick the update of the static parameters when the bin's render() is called
that way if multiple probes get updated at once, we don't hit the update loop for each one, which is obviously silly also fixed the 'probes' cubemaps aren't ready until you nudge them' turns out when we were setting out global var which we used for the irradiance and prefilter cubemap paths, it was being set AFTER the probes got loaded so it was using an invalid path to look up the cubemaps -@areloch
This commit is contained in:
parent
427154f6e1
commit
b5436b6cb7
3 changed files with 12 additions and 29 deletions
|
|
@ -182,7 +182,8 @@ void ProbeShaderConstants::_onShaderReload()
|
|||
RenderProbeMgr::RenderProbeMgr()
|
||||
: RenderBinManager(RenderPassManager::RIT_Probes, 1.0f, 1.0f),
|
||||
mLastShader(nullptr),
|
||||
mLastConstants(nullptr)
|
||||
mLastConstants(nullptr),
|
||||
mProbesDirty(false)
|
||||
{
|
||||
mEffectiveProbeCount = 0;
|
||||
mMipCount = 0;
|
||||
|
|
@ -372,7 +373,7 @@ PostEffect* RenderProbeMgr::getProbeArrayEffect()
|
|||
|
||||
void RenderProbeMgr::updateProbes()
|
||||
{
|
||||
_setupStaticParameters();
|
||||
mProbesDirty = true;
|
||||
}
|
||||
|
||||
void RenderProbeMgr::_setupStaticParameters()
|
||||
|
|
@ -457,31 +458,7 @@ void RenderProbeMgr::_setupStaticParameters()
|
|||
mEffectiveProbeCount++;
|
||||
}
|
||||
|
||||
/*if (mEffectiveProbeCount != 0)
|
||||
{
|
||||
bool useOldWay = false;
|
||||
if (useOldWay)
|
||||
{
|
||||
//old static way
|
||||
mPrefilterArray = GFXCubemapArrayHandle(GFX->createCubemapArray());
|
||||
mIrradianceArray = GFXCubemapArrayHandle(GFX->createCubemapArray());
|
||||
|
||||
mPrefilterArray->init(cubeMaps.address(), cubeMaps.size());
|
||||
mIrradianceArray->init(irradMaps.address(), irradMaps.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
//faked static way by doing it via update
|
||||
for (U32 i = 0; i < cubemapIdxes.size(); i++)
|
||||
{
|
||||
U32 probeIdx = cubemapIdxes[i];
|
||||
|
||||
const U32 cubeIndex = ProbeRenderInst::all[probeIdx]->mCubemapIndex;
|
||||
mIrradianceArray->updateTexture(irradMaps[i], cubeIndex);
|
||||
mPrefilterArray->updateTexture(cubeMaps[i], cubeIndex);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
mProbesDirty = false;
|
||||
}
|
||||
|
||||
void RenderProbeMgr::updateProbeTexture(ProbeRenderInst* probe)
|
||||
|
|
@ -772,7 +749,8 @@ void RenderProbeMgr::render( SceneRenderState *state )
|
|||
if (getProbeArrayEffect() == nullptr)
|
||||
return;
|
||||
|
||||
//updateProbes();
|
||||
if (mProbesDirty)
|
||||
_setupStaticParameters();
|
||||
|
||||
// Early out if nothing to draw.
|
||||
if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (!ProbeRenderInst::all.size() || mEffectiveProbeCount == 0 || mCubeMapCount != 0 ) && !hasSkylight)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue