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

Function CreateCubeTexture

trinity/Tr2ImageIOHelpers.cpp:12–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10{
11
12bool CreateCubeTexture( ImageIO::HostBitmap& bitmap, Tr2TextureAL& out, uint32_t& memoryUse, Tr2PrimaryRenderContext& renderContext )
13{
14 CCP_STATS_ZONE( __FUNCTION__ );
15
16 if( !bitmap.IsValid() )
17 {
18 return false;
19 }
20
21 const unsigned trueMipLevelCount = bitmap.GetTrueMipCount();
22
23 std::vector<Tr2SubresourceData> initData;
24
25 for( unsigned face = 0; face != 6; ++face )
26 {
27 for( unsigned i = 0; i != trueMipLevelCount; ++i )
28 {
29 Tr2SubresourceData srd;
30 srd.m_sysMem = const_cast<char*>( bitmap.GetMipRawData( i, CubemapFace( face ) ) );
31 srd.m_sysMemSlicePitch = bitmap.GetMipSize( i );
32 srd.m_sysMemPitch = bitmap.GetMipPitch( i );
33
34 if( !srd.m_sysMem )
35 {
36 return false;
37 }
38
39 initData.push_back( srd );
40
41 memoryUse += srd.m_sysMemSlicePitch;
42 }
43 }
44
45 return !FAILED( out.Create( bitmap, Tr2GpuUsage::SHADER_RESOURCE, Tr2CpuUsage::READ, &initData[0], renderContext ) );
46}
47
48bool CreateVolumeTexture( ImageIO::HostBitmap& bitmap, Tr2TextureAL& out, uint32_t& memoryUse, Tr2PrimaryRenderContext& renderContext )
49{

Callers 1

CreateTextureFunction · 0.85

Calls 4

GetTrueMipCountMethod · 0.80
GetMipSizeMethod · 0.80
IsValidMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected