MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getRefractTex

Method getRefractTex

Engine/source/scene/reflectionManager.cpp:279–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279GFXTextureObject* ReflectionManager::getRefractTex( bool forceUpdate )
280{
281 GFXTarget *target = GFX->getActiveRenderTarget();
282 GFXFormat targetFormat = target->getFormat();
283 const Point2I &targetSize = target->getSize();
284
285#if defined(TORQUE_OS_XENON)
286 // On the Xbox360, it needs to do a resolveTo from the active target, so this
287 // may as well be the full size of the active target
288 const U32 desWidth = targetSize.x;
289 const U32 desHeight = targetSize.y;
290#else
291 U32 desWidth, desHeight;
292 // D3D11 needs to be the same size as the active target
293 if (GFX->getAdapterType() == Direct3D11)
294 {
295 desWidth = targetSize.x;
296 desHeight = targetSize.y;
297 }
298 else
299 {
300 desWidth = mFloor((F32)targetSize.x * smRefractTexScale);
301 desHeight = mFloor((F32)targetSize.y * smRefractTexScale);
302 }
303#endif
304
305 if ( mRefractTex.isNull() ||
306 mRefractTex->getWidth() != desWidth ||
307 mRefractTex->getHeight() != desHeight ||
308 mRefractTex->getFormat() != targetFormat )
309 {
310 mRefractTex.set( desWidth, desHeight, targetFormat, &RefractTextureProfile, "mRefractTex" );
311 mUpdateRefract = true;
312 }
313
314 if ( forceUpdate || mUpdateRefract )
315 {
316 target->resolveTo( mRefractTex );
317 mUpdateRefract = false;
318 }
319
320 return mRefractTex;
321}
322
323BaseMatInstance* ReflectionManager::getReflectionMaterial( BaseMatInstance *inMat ) const
324{

Callers 4

innerRenderMethod · 0.80
renderObjectMethod · 0.80
setupSceneGraphInfoMethod · 0.80
setupSceneGraphInfoMethod · 0.80

Calls 10

mFloorFunction · 0.85
getActiveRenderTargetMethod · 0.80
getFormatMethod · 0.45
getSizeMethod · 0.45
getAdapterTypeMethod · 0.45
isNullMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
setMethod · 0.45
resolveToMethod · 0.45

Tested by

no test coverage detected