| 212 | } |
| 213 | |
| 214 | void TriTextureRes::Initialize( const wchar_t* name, const wchar_t* ext ) |
| 215 | { |
| 216 | m_pipelineFence.Cancel(); |
| 217 | CancelPendingLoad(); |
| 218 | CleanupAsyncSave( false ); |
| 219 | |
| 220 | m_pipeline = nullptr; |
| 221 | m_pipelineInputs.clear(); |
| 222 | |
| 223 | if( IsGradientTexturePath( name ) ) |
| 224 | { |
| 225 | m_path = name; |
| 226 | m_ext = ext; |
| 227 | RasterizeProceduralTexture( name, &RasterizeGradient ); |
| 228 | return; |
| 229 | } |
| 230 | if( IsSolidColorTexturePath( name ) ) |
| 231 | { |
| 232 | m_path = name; |
| 233 | m_ext = ext; |
| 234 | RasterizeProceduralTexture( name, &RasterizeSolidColor ); |
| 235 | return; |
| 236 | } |
| 237 | |
| 238 | if( IsCtrPath( name ) ) |
| 239 | { |
| 240 | m_pipeline = BeResMan->LoadObject<Tr2TexturePipeline>( name ); |
| 241 | if( m_pipeline ) |
| 242 | { |
| 243 | std::set<std::wstring> resources; |
| 244 | m_pipeline->GetResourceDependencies( resources ); |
| 245 | for( auto it = begin( resources ); it != end( resources ); ++it ) |
| 246 | { |
| 247 | Tr2ImageResPtr image; |
| 248 | BeResMan->GetResource( *it, L"raw", image ); |
| 249 | m_pipelineInputs[*it] = image; |
| 250 | } |
| 251 | m_isGood = false; |
| 252 | m_isPrepared = false; |
| 253 | m_isLoading = true; |
| 254 | m_path = name; |
| 255 | m_ext = ext; |
| 256 | |
| 257 | m_pipelineFence.Put( std::bind( &TriTextureRes::ResourcePrepFinished, this ) ); |
| 258 | return; |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | m_mipLevelMaxCount = 255; |
| 263 | |
| 264 | m_isTextureResizable = Tr2Renderer::IsTextureToResize( CW2A( name ) ); |
| 265 | |
| 266 | m_isTextureLoadDisabled = Tr2Renderer::IsTextureLoadDisabled(); |
| 267 | |
| 268 | if( IsVtaPath( name ) ) |
| 269 | { |
| 270 | auto length = wcslen( name ); |
| 271 | if( Tr2TextureLodManager::Instance().GetUseLowResVtaFilesSetting() ) |
no test coverage detected