| 673 | } |
| 674 | |
| 675 | bool ResourcePool::LoadTexture(const char* name, const std::wstring& path, bool mipmaps)LNOEXCEPT |
| 676 | { |
| 677 | LDEBUG_RESOURCETIMER; |
| 678 | |
| 679 | { |
| 680 | LDEBUG_RESOURCESCOPE; |
| 681 | |
| 682 | LASSERT(LAPP.GetRenderDev()); |
| 683 | |
| 684 | if (m_TexturePool.find(name) != m_TexturePool.end()) |
| 685 | { |
| 686 | LWARNING("LoadTexture: ����'%m'�Ѵ��ڣ���ͼʹ��'%s'���صIJ����ѱ�ȡ��", name, path.c_str()); |
| 687 | return true; |
| 688 | } |
| 689 | |
| 690 | fcyRefPointer<fcyMemStream> tDataBuf; |
| 691 | if (!m_pMgr->LoadFile(path.c_str(), tDataBuf)) |
| 692 | return false; |
| 693 | |
| 694 | fcyRefPointer<f2dTexture2D> tTexture; |
| 695 | if (FCYFAILED(LAPP.GetRenderDev()->CreateTextureFromMemory((fcData)tDataBuf->GetInternalBuffer(), tDataBuf->GetLength(), 0, 0, false, mipmaps, &tTexture))) |
| 696 | { |
| 697 | LERROR("LoadTexture: ���ļ�'%s'��������'%m'ʧ��", path.c_str(), name); |
| 698 | return false; |
| 699 | } |
| 700 | |
| 701 | try |
| 702 | { |
| 703 | fcyRefPointer<ResTexture> tRes; |
| 704 | tRes.DirectSet(new ResTexture(name, tTexture)); |
| 705 | m_TexturePool.emplace(name, tRes); |
| 706 | } |
| 707 | catch (const bad_alloc&) |
| 708 | { |
| 709 | LERROR("LoadTexture: �ڴ治��"); |
| 710 | return false; |
| 711 | } |
| 712 | |
| 713 | #ifdef LSHOWRESLOADINFO |
| 714 | LINFO("LoadTexture: ����'%s'��װ�� -> '%m' (%s)", path.c_str(), name, getResourcePoolTypeName()); |
| 715 | #endif |
| 716 | } |
| 717 | |
| 718 | LDEBUG_RESOURCEHINT(ResourceType::Texture, path.c_str()); |
| 719 | return true; |
| 720 | } |
| 721 | |
| 722 | bool ResourcePool::LoadTexture(const char* name, const char* path, bool mipmaps)LNOEXCEPT |
| 723 | { |
nothing calls this directly
no test coverage detected