| 1137 | } |
| 1138 | |
| 1139 | void PostEffect::process( const SceneRenderState *state, |
| 1140 | GFXTexHandle &inOutTex, |
| 1141 | const RectI *inTexViewport ) |
| 1142 | { |
| 1143 | // If the shader is forced to be skipped... then skip. |
| 1144 | if ( mSkip ) |
| 1145 | return; |
| 1146 | |
| 1147 | // Skip out if we don't support reflection passes. |
| 1148 | if ( state && state->isReflectPass() && !mAllowReflectPass ) |
| 1149 | return; |
| 1150 | |
| 1151 | if ( mOneFrameOnly && !mOnThisFrame ) |
| 1152 | return; |
| 1153 | |
| 1154 | // Check requirements if the shader needs updating. |
| 1155 | if ( mUpdateShader ) |
| 1156 | { |
| 1157 | _checkRequirements(); |
| 1158 | |
| 1159 | // Clear the targets if we failed passing |
| 1160 | // the requirements at this time. |
| 1161 | if ( !mIsValid ) |
| 1162 | _cleanTargets( true ); |
| 1163 | } |
| 1164 | |
| 1165 | // If we're not valid then we cannot render. |
| 1166 | if ( !mIsValid ) |
| 1167 | return; |
| 1168 | |
| 1169 | GFXDEBUGEVENT_SCOPE_EX( PostEffect_Process, ColorI::GREEN, avar("PostEffect: %s", getName()) ); |
| 1170 | |
| 1171 | preProcess_callback(); |
| 1172 | |
| 1173 | GFXTransformSaver saver; |
| 1174 | |
| 1175 | // Set the textures. |
| 1176 | for ( U32 i = 0; i < NumTextures; i++ ) |
| 1177 | _setupTexture( i, inOutTex, inTexViewport ); |
| 1178 | |
| 1179 | _setupStateBlock( state ) ; |
| 1180 | _setupTransforms(); |
| 1181 | |
| 1182 | bool clearTarget = false; |
| 1183 | _setupTarget( state, &clearTarget ); |
| 1184 | |
| 1185 | if ( mTargetTex || mTargetDepthStencil ) |
| 1186 | { |
| 1187 | |
| 1188 | #ifdef TORQUE_OS_XENON |
| 1189 | // You may want to disable this functionality for speed reasons as it does |
| 1190 | // add some overhead. The upside is it makes things "just work". If you |
| 1191 | // re-work your post-effects properly, this is not needed. |
| 1192 | // |
| 1193 | // If this post effect doesn't alpha blend to the back-buffer, than preserve |
| 1194 | // the active render target contents so they are still around the next time |
| 1195 | // that render target activates |
| 1196 | if(!mStateBlockData->getState().blendEnable) |
no test coverage detected