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

Method createCubemap

Engine/source/gfx/gfxTextureManager.cpp:1492–1527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1490}
1491
1492GFXCubemap* GFXTextureManager::createCubemap( const Torque::Path &path )
1493{
1494 // Very first thing... check the cache.
1495 CubemapTable::Iterator iter = mCubemapTable.find( path.getFullPath() );
1496 if ( iter != mCubemapTable.end() )
1497 return iter->value;
1498
1499 // Not in the cache... we have to load it ourselves.
1500
1501 // First check for a DDS file.
1502 if ( !sDDSExt.equal( path.getExtension(), String::NoCase ) )
1503 {
1504 // At the moment we only support DDS cubemaps.
1505 return NULL;
1506 }
1507
1508 const U32 scalePower = getTextureDownscalePower( NULL );
1509
1510 // Ok... load the DDS file then.
1511 Resource<DDSFile> dds = DDSFile::load( path, scalePower );
1512 if ( !dds || !dds->isCubemap() )
1513 {
1514 // This wasn't a cubemap... give up too.
1515 return NULL;
1516 }
1517
1518 // We loaded the cubemap dds, so now we create the GFXCubemap from it.
1519 GFXCubemap *cubemap = GFX->createCubemap();
1520 cubemap->initStatic( dds );
1521 cubemap->_setPath( path.getFullPath() );
1522
1523 // Store the cubemap into the cache.
1524 mCubemapTable.insertUnique( path.getFullPath(), cubemap );
1525
1526 return cubemap;
1527}
1528
1529void GFXTextureManager::releaseCubemap( GFXCubemap *cubemap )
1530{

Callers

nothing calls this directly

Calls 9

loadFunction · 0.85
isCubemapMethod · 0.80
_setPathMethod · 0.80
insertUniqueMethod · 0.80
findMethod · 0.45
endMethod · 0.45
equalMethod · 0.45
getExtensionMethod · 0.45
initStaticMethod · 0.45

Tested by

no test coverage detected