MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getBestProbes

Method getBestProbes

Engine/source/renderInstance/renderProbeMgr.cpp:284–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282 return diff > 0 ? 1 : diff < 0 ? -1 : 0;
283}
284void RenderProbeMgr::getBestProbes(const Point3F& objPosition, ProbeDataSet* probeDataSet)
285{
286 PROFILE_SCOPE(ProbeManager_getBestProbes);
287
288 //Array rendering
289 U32 probeCount = mActiveProbes.size();
290
291 Vector<S8> bestPickProbes;
292 bestPickProbes.setSize(probeDataSet->maxProbeCount);
293 bestPickProbes.fill(-1);
294
295 mHasSkylight = false;
296 probeDataSet->skyLightIdx = -1;
297
298 probeDataSet->effectiveProbeCount = 0;
299 for (U32 i = 0; i < probeCount; i++)
300 {
301 //Check if we've already got a skylight. If we do and we've otherwise filled to our max amounto of probes alloewed, then bail
302 if (mHasSkylight && probeDataSet->effectiveProbeCount >= probeDataSet->maxProbeCount)
303 break;
304
305 const ProbeRenderInst& curEntry = mActiveProbes[i];
306
307 //Obviously, if the probe is marked as not enabled, we skip
308 if (!curEntry.mProbeInfo->mIsEnabled)
309 continue;
310
311 if (curEntry.mProbeInfo->mProbeShapeType != ReflectionProbe::ProbeInfo::Skylight)
312 {
313 if (probeDataSet->effectiveProbeCount < probeDataSet->maxProbeCount)
314 {
315 bestPickProbes[probeDataSet->effectiveProbeCount] = i;
316 probeDataSet->effectiveProbeCount++;
317 }
318 }
319 else
320 {
321 probeDataSet->skyLightIdx = curEntry.mCubemapIndex;
322 probeDataSet->skyLightDamp = curEntry.mProbeInfo->mCanDamp;
323 mHasSkylight = true;
324 }
325 }
326
327 //If we, for whatever reason, have nothing, bail now
328 if (mHasSkylight == false && probeDataSet->effectiveProbeCount == 0)
329 return;
330
331 //Grab our best probe picks
332 for (U32 i = 0; i < bestPickProbes.size(); i++)
333 {
334 if (bestPickProbes[i] == -1)
335 continue;
336
337 const ProbeRenderInst& curEntry = mActiveProbes[bestPickProbes[i]];
338 probeDataSet->probeConfigArray[i] = Point4F(curEntry.mProbeInfo->mProbeShapeType,
339 curEntry.mProbeInfo->mRadius,
340 curEntry.mProbeInfo->mAtten,
341 curEntry.mCubemapIndex);

Callers

nothing calls this directly

Calls 8

asPoint3FMethod · 0.80
Point4FClass · 0.50
sizeMethod · 0.45
setSizeMethod · 0.45
fillMethod · 0.45
inverseMethod · 0.45
getScaleMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected