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

Method updateReflection

Engine/source/scene/reflector.cpp:299–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299void CubeReflector::updateReflection( const ReflectParams &params, Point3F explicitPostion)
300{
301 GFXDEBUGEVENT_SCOPE( CubeReflector_UpdateReflection, ColorI::WHITE );
302
303 mIsRendering = true;
304
305 // Setup textures and targets...
306 S32 texDim = mDesc->texSize;
307 texDim = getMax( texDim, 32 );
308
309 // Protect against the reflection texture being bigger
310 // than the current game back buffer.
311 texDim = getMin( texDim, params.viewportExtent.x );
312 texDim = getMin( texDim, params.viewportExtent.y );
313
314 bool texResize = ( texDim != mLastTexSize );
315
316 const GFXFormat reflectFormat = REFLECTMGR->getReflectFormat();
317
318 if ( texResize ||
319 mCubemap.isNull() ||
320 mCubemap->getFormat() != reflectFormat )
321 {
322 mCubemap = GFX->createCubemap();
323 mCubemap->initDynamic( texDim, reflectFormat );
324 }
325
326 mDepthBuff = LightShadowMap::_getDepthTarget( texDim, texDim );
327
328 if ( mRenderTarget.isNull() )
329 mRenderTarget = GFX->allocRenderToTextureTarget();
330
331 GFX->pushActiveRenderTarget();
332 mRenderTarget->attachTexture( GFXTextureTarget::DepthStencil, mDepthBuff );
333
334
335 F32 oldVisibleDist = gClientSceneGraph->getVisibleDistance();
336 gClientSceneGraph->setVisibleDistance( mDesc->farDist );
337
338
339 for ( U32 i = 0; i < 6; i++ )
340 updateFace( params, i, explicitPostion);
341
342
343 GFX->popActiveRenderTarget();
344
345 gClientSceneGraph->setVisibleDistance(oldVisibleDist);
346
347 mIsRendering = false;
348 mLastTexSize = texDim;
349}
350
351void CubeReflector::updateFace( const ReflectParams &params, U32 faceidx, Point3F explicitPostion)
352{

Callers 2

updateMethod · 0.45
bakeProbeMethod · 0.45

Calls 15

getMaxFunction · 0.85
makeFovPortFrustumFunction · 0.85
dSprintfFunction · 0.85
getReflectFormatMethod · 0.80
getVisibleDistanceMethod · 0.80
setVisibleDistanceMethod · 0.80
popActiveRenderTargetMethod · 0.80
allocRenderTargetMethod · 0.80
getCurrentRenderStyleMethod · 0.80
isPendingMethod · 0.80

Tested by

no test coverage detected