| 1130 | } |
| 1131 | |
| 1132 | void PostEffect::_setupTexture( U32 stage, GFXTexHandle &inputTex, const RectI *inTexViewport ) |
| 1133 | { |
| 1134 | const String &texFilename = getTexture( stage ); |
| 1135 | |
| 1136 | GFXTexHandle theTex; |
| 1137 | NamedTexTarget *namedTarget = NULL; |
| 1138 | |
| 1139 | RectI viewport = GFX->getViewport(); |
| 1140 | |
| 1141 | if ( texFilename.compare( "$inTex", 0, String::NoCase ) == 0 ) |
| 1142 | { |
| 1143 | theTex = inputTex; |
| 1144 | |
| 1145 | if ( inTexViewport ) |
| 1146 | { |
| 1147 | viewport = *inTexViewport; |
| 1148 | } |
| 1149 | else if ( theTex ) |
| 1150 | { |
| 1151 | viewport.set( 0, 0, theTex->getWidth(), theTex->getHeight() ); |
| 1152 | } |
| 1153 | } |
| 1154 | else if ( texFilename.compare( "$backBuffer", 0, String::NoCase ) == 0 ) |
| 1155 | { |
| 1156 | theTex = PFXMGR->getBackBufferTex(); |
| 1157 | |
| 1158 | // Always use the GFX viewport when reading from the backbuffer |
| 1159 | } |
| 1160 | else if ( texFilename.isNotEmpty() && texFilename[0] == '#' ) |
| 1161 | { |
| 1162 | namedTarget = NamedTexTarget::find( texFilename.c_str() + 1 ); |
| 1163 | if ( namedTarget ) |
| 1164 | { |
| 1165 | theTex = namedTarget->getTexture( 0 ); |
| 1166 | viewport = namedTarget->getViewport(); |
| 1167 | } |
| 1168 | } |
| 1169 | else |
| 1170 | { |
| 1171 | theTex = mTexture[ stage ]; |
| 1172 | if ( theTex ) |
| 1173 | viewport.set( 0, 0, theTex->getWidth(), theTex->getHeight() ); |
| 1174 | } |
| 1175 | |
| 1176 | mActiveTextures[ stage ] = theTex; |
| 1177 | mActiveNamedTarget[ stage ] = namedTarget; |
| 1178 | mActiveTextureViewport[ stage ] = viewport; |
| 1179 | |
| 1180 | if ( theTex.isValid() ) |
| 1181 | GFX->setTexture( stage, theTex ); |
| 1182 | } |
| 1183 | |
| 1184 | void PostEffect::_setupCubemapTexture(U32 stage, GFXCubemapHandle &inputTex) |
| 1185 | { |
nothing calls this directly
no test coverage detected