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

Method BakeLightProfile

trinity/Resources/Tr2LightProfileRes.cpp:219–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219BlueStdResult Tr2LightProfileRes::BakeLightProfile( const wchar_t* path, Tr2HostBitmapPtr& output )
220{
221 output = nullptr;
222
223 if( !IsIesExtension( path ) )
224 {
225 return BlueStdResult( BLUE_STD_RESULT_VALUE_ERROR, "This function expects an .ies path" );
226 }
227
228 IBlueStreamPtr stream;
229 auto success = BePaths->GetFileContentsWithYield( path, &stream );
230 if( !BeIsSuccess( success ) )
231 {
232 return BlueStdResult( BLUE_STD_RESULT_IO_ERROR, success.value.c_str() );
233 }
234
235 output.CreateInstance();
236
237 std::string contents;
238 contents.resize( stream->GetSize() );
239 stream->Read( contents.data(), contents.size() );
240
241 if( !ParseIes( contents, *output ) )
242 {
243 output = nullptr;
244 return BlueStdResult( BLUE_STD_RESULT_RUNTIME_ERROR, "Failed to parse IES file" );
245 }
246 return BlueStdResult( BLUE_STD_RESULT_OK );
247}
248
249BlueStdResult Tr2LightProfileRes::GetThumbnail( uint32_t width, uint32_t height, Tr2HostBitmapPtr& bitmap ) const
250{

Callers

nothing calls this directly

Calls 6

IsIesExtensionFunction · 0.85
BeIsSuccessFunction · 0.85
CreateInstanceMethod · 0.80
sizeMethod · 0.80
GetSizeMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected