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

Method DoLoad

trinity/Resources/Tr2LightProfileRes.cpp:68–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68Tr2LightProfileRes::LoadingResult Tr2LightProfileRes::DoLoad()
69{
70 if( !m_dataStream )
71 {
72 return LR_FAILED;
73 }
74 if( IsIesExtension( m_path.c_str() ) )
75 {
76 return ParseIes() ? LR_SUCCESS : LR_FAILED;
77 }
78
79 auto result = ImageIO::ReadImage( *m_dataStream, ImageIO::LoadParameters( m_path.c_str() ), m_bitmap );
80 if( !result )
81 {
82 CCP_LOGWARN( "Tr2LightProfileRes: error reading '%S' - %s", GetPath(), result.GetErrorMessage().c_str() );
83 return LR_FAILED;
84 }
85 if( !IsCompatibleBitmap( m_bitmap ) )
86 {
87 CCP_LOGWARN( "Tr2LightProfileRes: bitmap '%S' contains an uncompatible lightmap. The lightmap needs to be %ux1 texture with format R16F", GetPath(), PROFILE_LIGHTMAP_SIZE );
88 m_bitmap.Destroy();
89 return LR_FAILED;
90 }
91
92 return LR_SUCCESS;
93}
94
95bool Tr2LightProfileRes::DoPrepare()
96{

Callers

nothing calls this directly

Calls 3

IsIesExtensionFunction · 0.85
IsCompatibleBitmapFunction · 0.85
DestroyMethod · 0.45

Tested by

no test coverage detected