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

Method RasterizeProceduralTexture

trinity/Resources/TriTextureRes.cpp:181–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179}
180
181void TriTextureRes::RasterizeProceduralTexture( const wchar_t* data, void ( *Rastrization )( const std::string_view&, ImageIO::HostBitmap& ) )
182{
183 CCP_STATS_ZONE( __FUNCTION__ );
184
185 m_isGood = false;
186 m_isPrepared = false;
187 m_isLoading = true;
188
189 ImageIO::HostBitmap bmp;
190 ( *Rastrization )( static_cast<const char*>( CW2A( data ) ), bmp );
191 m_isLoading = false;
192 m_isGood = false;
193 if( bmp.IsValid() )
194 {
195 if( !Tr2Renderer::IsResourceCreationAllowed() )
196 {
197 return;
198 }
199 m_isPrepared = true;
200
201 USE_MAIN_THREAD_RENDER_CONTEXT();
202 uint32_t memoryUse;
203 if( !Tr2ImageIOHelpers::CreateTexture( bmp, m_ownTexture, memoryUse, renderContext, USAGE_IMMUTABLE ) )
204 {
205 CCP_LOGWARN( "Tr2ImageHandler failed to create texture '%S'", GetPath() );
206 return;
207 }
208 m_ownTexture.SetName( CW2A( GetPath() ) );
209
210 SetTexture( m_ownTexture );
211 }
212}
213
214void TriTextureRes::Initialize( const wchar_t* name, const wchar_t* ext )
215{

Callers

nothing calls this directly

Calls 3

CreateTextureFunction · 0.85
IsValidMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected