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

Method prepRenderImage

Engine/source/T3D/lighting/reflectionProbe.cpp:824–932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

822}
823
824void ReflectionProbe::prepRenderImage(SceneRenderState *state)
825{
826 if (!mEnabled || (!RenderProbeMgr::smRenderReflectionProbes && !dStrcmp(Con::getVariable("$Probes::Capturing", "0"),"1")))
827 return;
828
829 Point3F distVec = getRenderPosition() - state->getCameraPosition();
830 F32 dist = distVec.len();
831
832 //Culling distance. Can be adjusted for performance options considerations via the scalar
833 if (dist > RenderProbeMgr::smMaxProbeDrawDistance * Con::getFloatVariable("$pref::GI::ProbeDrawDistScale", 1.0))
834 {
835 mProbeInfo.mScore = RenderProbeMgr::smMaxProbeDrawDistance;
836 return;
837 }
838
839 if (mReflectionModeType == DynamicCubemap && mRefreshRateMS < (Platform::getRealMilliseconds() - mDynamicLastBakeMS))
840 {
841 bake();
842 mDynamicLastBakeMS = Platform::getRealMilliseconds();
843 }
844
845 //Submit our probe to actually do the probe action
846 // Get a handy pointer to our RenderPassmanager
847 //RenderPassManager *renderPass = state->getRenderPass();
848
849 //Update our score based on our radius, distance
850 mProbeInfo.mScore = mMax(dist, 1.0f);
851
852 Point3F vect = distVec;
853 vect.normalizeSafe();
854
855 //mProbeInfo.mScore *= mMax(mAbs(mDot(vect, state->getCameraTransform().getForwardVector())),0.001f);
856
857 PROBEMGR->submitProbe(&mProbeInfo);
858
859#ifdef TORQUE_TOOLS
860 if (ReflectionProbe::smRenderPreviewProbes && gEditingMission && mPrefilterMap != nullptr)
861 {
862 if(!mEditorShapeInst)
863 createEditorResources();
864
865 GFXTransformSaver saver;
866
867 // Calculate the distance of this object from the camera
868 Point3F cameraOffset;
869 getRenderTransform().getColumn(3, &cameraOffset);
870 cameraOffset -= state->getDiffuseCameraPosition();
871 dist = cameraOffset.len();
872 if (dist < 0.01f)
873 dist = 0.01f;
874
875 // Set up the LOD for the shape
876 F32 invScale = (1.0f / getMax(getMax(mObjScale.x, mObjScale.y), mObjScale.z));
877
878 mEditorShapeInst->setDetailFromDistance(state, dist * invScale);
879
880 // Make sure we have a valid level of detail
881 if (mEditorShapeInst->getCurrentDetail() < 0)

Callers

nothing calls this directly

Calls 15

getVariableFunction · 0.85
getFloatVariableFunction · 0.85
mMaxFunction · 0.85
getMaxFunction · 0.85
isSelectedFunction · 0.85
submitProbeMethod · 0.80
getColumnMethod · 0.80
setDetailFromDistanceMethod · 0.80
getCurrentDetailMethod · 0.80
getMaterialInstMethod · 0.80
getMaterialListMethod · 0.80

Tested by

no test coverage detected