mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-14 04:03:46 +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
bf10d48287
commit
e6a14514e0
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)
|
||||
|
|
|
|||
|
|
@ -166,6 +166,8 @@ class RenderProbeMgr : public RenderBinManager
|
|||
|
||||
Vector<U32> mRegisteredProbes;
|
||||
|
||||
bool mProbesDirty;
|
||||
|
||||
//maximum number of allowed probes
|
||||
static const U32 PROBE_MAX_COUNT = 250;
|
||||
//maximum number of rendered probes per frame adjust as needed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue