MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / LoadTexture

Method LoadTexture

LuaSTGPlus/ResourceMgr.cpp:675–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673}
674
675bool 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
722bool ResourcePool::LoadTexture(const char* name, const char* path, bool mipmaps)LNOEXCEPT
723{

Callers

nothing calls this directly

Calls 3

GetRenderDevMethod · 0.80
findMethod · 0.80
LoadFileMethod · 0.80

Tested by

no test coverage detected