MCPcopy Create free account
hub / github.com/Apress/Ray-Tracing-Gems-II / LoadTGAFromFile

Method LoadTGAFromFile

Chapter_27/Core/TextureManager.cpp:288–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288const ManagedTexture* TextureManager::LoadTGAFromFile( const std::wstring& fileName, bool sRGB )
289{
290 auto ManagedTex = FindOrLoadTexture(fileName);
291
292 ManagedTexture* ManTex = ManagedTex.first;
293 const bool RequestsLoad = ManagedTex.second;
294
295 if (!RequestsLoad)
296 {
297 ManTex->WaitForLoad();
298 return ManTex;
299 }
300
301 Utility::ByteArray ba = Utility::ReadFileSync( s_RootPath + fileName );
302 if (ba->size() > 0)
303 {
304 ManTex->CreateTGAFromMemory( ba->data(), ba->size(), sRGB );
305 ManTex->GetResource()->SetName(fileName.c_str());
306 }
307 else
308 ManTex->SetToInvalidTexture();
309
310 return ManTex;
311}
312
313
314const ManagedTexture* TextureManager::LoadPIXImageFromFile( const std::wstring& fileName )

Callers

nothing calls this directly

Calls 8

FindOrLoadTextureFunction · 0.85
WaitForLoadMethod · 0.80
CreateTGAFromMemoryMethod · 0.80
c_strMethod · 0.80
SetToInvalidTextureMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
GetResourceMethod · 0.45

Tested by

no test coverage detected