Overhauls the handling of probes to utilize an active probe list to improve performance and allow a greater total number of active probes in a scene.

Also fixes handling of metal materials during bakes to render properly, and fixes a possible double-up return in findObjectByType, which could cause doubling when getting probes in the scene
This commit is contained in:
Areloch 2020-10-19 00:53:09 -05:00
parent 072b5ecb19
commit 6a3603c737
22 changed files with 490 additions and 610 deletions

View file

@ -135,6 +135,11 @@ void Skylight::unpackUpdate(NetConnection *conn, BitStream *stream)
{
// Let the Parent read any info it sent
Parent::unpackUpdate(conn, stream);
if (mDirty)
{
updateProbeParams();
}
}
//-----------------------------------------------------------------------------
@ -143,9 +148,6 @@ void Skylight::unpackUpdate(NetConnection *conn, BitStream *stream)
void Skylight::updateProbeParams()
{
if (!mProbeInfo)
return;
mProbeShapeType = ProbeRenderInst::Skylight;
Parent::updateProbeParams();
}
@ -157,24 +159,17 @@ void Skylight::prepRenderImage(SceneRenderState *state)
//special hook-in for skylights
Point3F camPos = state->getCameraPosition();
mProbeInfo->mBounds.setCenter(camPos);
mProbeInfo.mBounds.setCenter(camPos);
mProbeInfo->setPosition(camPos);
if (mReflectionModeType == DynamicCubemap && mRefreshRateMS < (Platform::getRealMilliseconds() - mDynamicLastBakeMS))
{
//bake();
mDynamicLastBakeMS = Platform::getRealMilliseconds();
processDynamicCubemap();
}
mProbeInfo.setPosition(camPos);
//Submit our probe to actually do the probe action
// Get a handy pointer to our RenderPassmanager
//RenderPassManager *renderPass = state->getRenderPass();
//PROBEMGR->registerSkylight(mProbeInfo, this);
PROBEMGR->submitProbe(mProbeInfo);
#ifdef TORQUE_TOOLS
if (Skylight::smRenderPreviewProbes && gEditingMission && mEditorShapeInst && mPrefilterMap != nullptr)
{
GFXTransformSaver saver;
@ -235,6 +230,7 @@ void Skylight::prepRenderImage(SceneRenderState *state)
if (isSelectedInEditor)
{
}
#endif
}
void Skylight::setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat)