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

Method _updateTargets

Engine/source/renderInstance/renderFormatChanger.cpp:197–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void RenderFormatToken::_updateTargets()
198{
199 if ( GFX->getActiveRenderTarget() == NULL )
200 return;
201
202 const Point2I &rtSize = GFX->getActiveRenderTarget()->getSize();
203
204 if ( rtSize.x <= mTargetSize.x &&
205 rtSize.y <= mTargetSize.y &&
206 !mTargetUpdatePending )
207 return;
208
209 mTargetSize = rtSize;
210 mTargetUpdatePending = false;
211 mTargetChainIdx = 0;
212
213 for( U32 i = 0; i < TargetChainLength; i++ )
214 {
215 if( !mTargetChain[i] )
216 mTargetChain[i] = GFX->allocRenderToTextureTarget();
217
218 // Update color target
219 if(mColorFormat != GFXFormat_COUNT)
220 {
221 // try reuse of old color texture
222 if( !mTargetColorTexture[i] || mTargetColorTexture[i].getFormat() != mColorFormat
223 || mTargetColorTexture[i].getWidthHeight() != rtSize)
224 {
225 mTargetColorTexture[i].set( rtSize.x, rtSize.y, mColorFormat,
226 &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ),
227 1, mTargetAALevel );
228 mTargetChain[i]->attachTexture( GFXTextureTarget::Color0, mTargetColorTexture[i] );
229 }
230 }
231
232
233
234
235 // Update depth target
236 if(mDepthFormat != GFXFormat_COUNT)
237 {
238 // try reuse of old depth texture
239 if( !mTargetDepthStencilTexture[i] || mTargetDepthStencilTexture[i].getFormat() != mColorFormat
240 || mTargetDepthStencilTexture[i].getWidthHeight() != rtSize)
241 {
242 mTargetDepthStencilTexture[i].set( rtSize.x, rtSize.y, mDepthFormat,
243 &GFXDefaultZTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ),
244 1, mTargetAALevel );
245 mTargetChain[i]->attachTexture( GFXTextureTarget::DepthStencil, mTargetDepthStencilTexture[i] );
246 }
247 }
248
249
250 }
251}
252
253void RenderFormatToken::_teardownTargets()
254{

Callers

nothing calls this directly

Calls 8

avarFunction · 0.85
getActiveRenderTargetMethod · 0.80
getWidthHeightMethod · 0.80
getSizeMethod · 0.45
getFormatMethod · 0.45
setMethod · 0.45
attachTextureMethod · 0.45

Tested by

no test coverage detected