| 277 | } |
| 278 | |
| 279 | GFXTextureObject* 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 | |
| 323 | BaseMatInstance* ReflectionManager::getReflectionMaterial( BaseMatInstance *inMat ) const |
| 324 | { |
no test coverage detected