MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / updateStates

Method updateStates

Engine/source/gfx/gfxDevice.cpp:332–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332void GFXDevice::updateStates(bool forceSetAll /*=false*/)
333{
334 PROFILE_SCOPE(GFXDevice_updateStates);
335
336 if(forceSetAll)
337 {
338 bool rememberToEndScene = false;
339 if(!canCurrentlyRender())
340 {
341 if (!beginScene())
342 {
343 AssertFatal(false, "GFXDevice::updateStates: Unable to beginScene!");
344 }
345 rememberToEndScene = true;
346 }
347
348 setVertexDecl( mCurrVertexDecl );
349
350 for ( U32 i=0; i < VERTEX_STREAM_COUNT; i++ )
351 {
352 setVertexStream( i, mCurrentVertexBuffer[i] );
353 setVertexStreamFrequency( i, mVertexBufferFrequency[i] );
354 }
355
356 if( mCurrentPrimitiveBuffer.isValid() ) // This could be NULL when the device is initalizing
357 mCurrentPrimitiveBuffer->prepare();
358
359 /// Stateblocks
360 if ( mNewStateBlock )
361 setStateBlockInternal(mNewStateBlock, true);
362 mCurrentStateBlock = mNewStateBlock;
363
364 for(U32 i = 0; i < getNumSamplers(); i++)
365 {
366 switch (mTexType[i])
367 {
368 case GFXTDT_Normal :
369 {
370 mCurrentTexture[i] = mNewTexture[i];
371 setTextureInternal(i, mCurrentTexture[i]);
372 }
373 break;
374 case GFXTDT_Cube :
375 {
376 mCurrentCubemap[i] = mNewCubemap[i];
377 if (mCurrentCubemap[i])
378 mCurrentCubemap[i]->setToTexUnit(i);
379 else
380 setTextureInternal(i, NULL);
381 }
382 break;
383 case GFXTDT_CubeArray:
384 {
385 mCurrentCubemapArray[i] = mNewCubemapArray[i];
386 if (mCurrentCubemapArray[i])
387 mCurrentCubemapArray[i]->setToTexUnit(i);
388 else
389 setTextureInternal(i, NULL);

Callers 4

_updateRenderTargetsMethod · 0.80
GameRenderWorldFunction · 0.80
renderFrameFunction · 0.80
renderFrameMethod · 0.80

Calls 3

isValidMethod · 0.45
prepareMethod · 0.45
setToTexUnitMethod · 0.45

Tested by

no test coverage detected