| 1385 | } |
| 1386 | |
| 1387 | void PostEffect::process( const SceneRenderState *state, |
| 1388 | GFXTexHandle &inOutTex, |
| 1389 | const RectI *inTexViewport ) |
| 1390 | { |
| 1391 | // If the shader is forced to be skipped... then skip. |
| 1392 | if ( mSkip ) |
| 1393 | return; |
| 1394 | |
| 1395 | // Skip out if we don't support reflection passes. |
| 1396 | if ( state && state->isReflectPass() && !mAllowReflectPass ) |
| 1397 | return; |
| 1398 | |
| 1399 | if ( mOneFrameOnly && !mOnThisFrame ) |
| 1400 | return; |
| 1401 | |
| 1402 | // Check requirements if the shader needs updating. |
| 1403 | if ( mUpdateShader ) |
| 1404 | { |
| 1405 | _checkRequirements(); |
| 1406 | |
| 1407 | // Clear the targets if we failed passing |
| 1408 | // the requirements at this time. |
| 1409 | if ( !mIsValid ) |
| 1410 | _cleanTargets( true ); |
| 1411 | } |
| 1412 | |
| 1413 | // If we're not valid then we cannot render. |
| 1414 | if ( !mIsValid ) |
| 1415 | return; |
| 1416 | |
| 1417 | GFXDEBUGEVENT_SCOPE_EX( PostEffect_Process, ColorI::GREEN, avar("PostEffect: %s", getName()) ); |
| 1418 | |
| 1419 | preProcess_callback(); |
| 1420 | |
| 1421 | GFXTransformSaver saver; |
| 1422 | |
| 1423 | // Set the textures. |
| 1424 | for (U32 i = 0; i < NumTextures; i++) |
| 1425 | { |
| 1426 | if (mTextureType[i] == NormalTextureType) |
| 1427 | _setupTexture(i, inOutTex, inTexViewport); |
| 1428 | else if (mTextureType[i] == CubemapType) |
| 1429 | _setupCubemapTexture(i, mCubemapTextures[i]); |
| 1430 | else if (mTextureType[i] == CubemapArrayType) |
| 1431 | _setupCubemapArrayTexture(i, mCubemapArrayTextures[i]); |
| 1432 | } |
| 1433 | |
| 1434 | _setupStateBlock( state ) ; |
| 1435 | _setupTransforms(); |
| 1436 | |
| 1437 | bool clearTarget = false; |
| 1438 | _setupTarget( state, &clearTarget ); |
| 1439 | |
| 1440 | if ( mTargetTex || mTargetDepthStencil ) |
| 1441 | { |
| 1442 | const RectI &oldViewport = GFX->getViewport(); |
| 1443 | GFXTarget *oldTarget = GFX->getActiveRenderTarget(); |
| 1444 |
no test coverage detected