| 1357 | } |
| 1358 | |
| 1359 | bool ResourcePool::LoadFX(const char* name, const std::wstring& path)LNOEXCEPT |
| 1360 | { |
| 1361 | LDEBUG_RESOURCETIMER; |
| 1362 | |
| 1363 | { |
| 1364 | LDEBUG_RESOURCESCOPE; |
| 1365 | |
| 1366 | LASSERT(LAPP.GetRenderDev()); |
| 1367 | |
| 1368 | if (m_FXPool.find(name) != m_FXPool.end()) |
| 1369 | { |
| 1370 | LWARNING("LoadFX: FX'%m'�Ѵ��ڣ����ز����ѱ�ȡ��", name); |
| 1371 | return true; |
| 1372 | } |
| 1373 | |
| 1374 | // ��ȡ�ļ� |
| 1375 | fcyRefPointer<fcyMemStream> tDataBuf; |
| 1376 | if (!m_pMgr->LoadFile(path.c_str(), tDataBuf)) |
| 1377 | return false; |
| 1378 | |
| 1379 | try |
| 1380 | { |
| 1381 | fcyRefPointer<f2dEffect> tEffect; |
| 1382 | if (FCYFAILED(LAPP.GetRenderDev()->CreateEffect(tDataBuf, false, &tEffect))) |
| 1383 | { |
| 1384 | LERROR("LoadFX: ����shader���ļ�'%s'ʧ�� (lasterr=%m)", path.c_str(), LAPP.GetEngine()->GetLastErrDesc()); |
| 1385 | return false; |
| 1386 | } |
| 1387 | |
| 1388 | fcyRefPointer<ResFX> tRes; |
| 1389 | tRes.DirectSet(new ResFX(name, tEffect)); |
| 1390 | m_FXPool.emplace(name, tRes); |
| 1391 | } |
| 1392 | catch (const fcyException& e) |
| 1393 | { |
| 1394 | LERROR("LoadFX: �������ļ�'%s'ʧ�� (�쳣��Ϣ'%m' Դ'%m')", path.c_str(), e.GetDesc(), e.GetSrc()); |
| 1395 | return false; |
| 1396 | } |
| 1397 | catch (const bad_alloc&) |
| 1398 | { |
| 1399 | LERROR("LoadFX: �ڴ治��"); |
| 1400 | return false; |
| 1401 | } |
| 1402 | #ifdef LSHOWRESLOADINFO |
| 1403 | LINFO("LoadFX: FX'%m'��װ�� (%s)", name, getResourcePoolTypeName()); |
| 1404 | #endif |
| 1405 | } |
| 1406 | |
| 1407 | LDEBUG_RESOURCEHINT(ResourceType::FX, path.c_str()); |
| 1408 | return true; |
| 1409 | } |
| 1410 | |
| 1411 | LNOINLINE bool ResourcePool::LoadFX(const char* name, const char* path)LNOEXCEPT |
| 1412 | { |
nothing calls this directly
no test coverage detected