MCPcopy Create free account
hub / github.com/carbonengine/trinity / PrepareResourcesForRender

Method PrepareResourcesForRender

trinity/Sprite2d/Tr2Sprite2dScene.cpp:2272–2301  ·  view source on GitHub ↗

Prepare required resources for rendering. If any of them are not ready this function returns false, otherwise it returns true and rendering can go forward.

Source from the content-addressed store, hash-verified

2270// this function returns false, otherwise it returns true and rendering can
2271// go forward.
2272bool Tr2Sprite2dScene::PrepareResourcesForRender()
2273{
2274 // Prepare resources if we don't have valid index or vertex buffers
2275 if( !m_indexBuffer.IsValid() || !m_vertexBuffer.IsValid() )
2276 {
2277 PrepareResources();
2278 // Bail out if the buffers still aren't valid
2279 if( !m_indexBuffer.IsValid() || !m_vertexBuffer.IsValid() )
2280 {
2281 return false;
2282 }
2283 }
2284
2285 Tr2EffectResPtr effectRes = m_uberShader2d->GetEffectRes();
2286 if( !effectRes || effectRes->IsLoading() )
2287 {
2288 // Effect is still loading - can't render any UI
2289 return false;
2290 }
2291
2292 if( !effectRes->IsGood() )
2293 {
2294 // Effect load failed - can't render any UI
2295 CCP_LOGERR( "%s: Effect used for rendering failed to load - attempting to reload", __FUNCTION__ );
2296 effectRes->Reload();
2297 return false;
2298 }
2299
2300 return true;
2301}
2302
2303void Tr2Sprite2dScene::SetViewportSizeToVariableStore( float displayWidth, float displayHeight )
2304{

Callers

nothing calls this directly

Calls 5

GetEffectResMethod · 0.80
IsValidMethod · 0.45
IsLoadingMethod · 0.45
IsGoodMethod · 0.45
ReloadMethod · 0.45

Tested by

no test coverage detected