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

Method GetSection

trinity/Resources/Tr2CmfContent.cpp:52–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52const void* Tr2CmfContents::GetSection( uint32_t index )
53{
54 if( index >= m_sections.size() )
55 {
56 CCP_ASSERT_M( false, "Tr2CmfContents::GetSection: index out of range!" );
57 return nullptr;
58 }
59 auto& section = m_sections[index];
60 if( section.section.compression == cmf::SectionCompression::None )
61 {
62 return m_sections[index].data.get();
63 }
64 // May happen if the buffer has been unloaded from memory
65 if( !section.data )
66 {
67 return nullptr;
68 }
69
70 CCP_STATS_ZONE( __FUNCTION__ );
71
72 auto decompressed = std::make_unique<uint8_t[]>( section.section.uncompressedSize );
73 cmf::Decompress( decompressed.get(), section.section, section.data.get() );
74 std::swap( decompressed, section.data );
75 section.section.compression = cmf::SectionCompression::None;
76 return section.data.get();
77}
78
79const void* Tr2CmfContents::GetViewData( const cmf::BufferView& view )
80{

Callers 3

RayIntersectionMethod · 0.80
InitializeMethod · 0.80

Calls 3

swapFunction · 0.85
sizeMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected