| 179 | } |
| 180 | |
| 181 | void 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 | |
| 214 | void TriTextureRes::Initialize( const wchar_t* name, const wchar_t* ext ) |
| 215 | { |
nothing calls this directly
no test coverage detected