本文整理汇总了C++中CModel::LoadModel方法的典型用法代码示例。如果您正苦于以下问题:C++ CModel::LoadModel方法的具体用法?C++ CModel::LoadModel怎么用?C++ CModel::LoadModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CModel
的用法示例。
在下文中一共展示了CModel::LoadModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadModel
CModel* CModelMng::LoadModel( LPDIRECT3DDEVICE9 pd3dDevice, TCHAR* lpszFileName, LPMODELELEM lpModelElem, int nType, BOOL bParts )
{
HRESULT hr;
CModel* pModel = NULL;
CModel* pModelBill = NULL;
int nModelType = lpModelElem->m_dwModelType;
TCHAR szFileName[MAX_PATH];
MapStrToPtrItor mapItor;
switch( nModelType )
{
case MODELTYPE_SFX:
#ifndef __WORLDSERVER // 새버전에선 월드에서 sfx를 new하지 않는다.
pModel = new CSfxModel;
pModel->SetModelType( nModelType );
((CSfxModel*)pModel)->SetSfx( lpszFileName );
pModel->m_pModelElem = lpModelElem;
pModel->m_pModelElem->m_bUsed = TRUE;
#endif // not World
break;
case MODELTYPE_MESH:
mapItor = m_mapFileToMesh.find( lpszFileName );
if( mapItor != m_mapFileToMesh.end() )
{
((CModel*)(*mapItor).second)->m_pModelElem->m_bUsed = TRUE;
#ifdef __CSC_EXTEXTURE
pModel = (CModel*) (*mapItor).second;
pModel->SetModelType( nModelType );
pModel->m_pModelElem = lpModelElem;
return pModel;
#else //__CSC_EXTEXTURE
return (CModel*) (*mapItor).second;
#endif //__CSC_EXTEXTURE
}
pModel = new CModelObject;
pModel->SetModelType( nModelType );
pModel->m_pModelElem = lpModelElem;
hr = pModel->InitDeviceObjects( pd3dDevice );
hr = pModel->LoadModel( lpszFileName );
if( hr == SUCCESS )
{
hr = pModel->RestoreDeviceObjects();
#ifdef _DEBUG
if( ((CModelObject*)pModel)->GetObject3D()->m_nHavePhysique )
Error( "CModelMng::LoadModel : %s가 동적오브젝트인데 정적오브젝트로 설정되어 있다.", lpszFileName );
#endif
m_mapFileToMesh.insert( MapStrToPtrType( lpszFileName, pModel ) );
pModel->m_pModelElem->m_bUsed = TRUE;
}
else
SAFE_DELETE( pModel )
break;
case MODELTYPE_ANIMATED_MESH:
pModel = new CModelObject;
pModel->SetModelType( nModelType );
pModel->InitDeviceObjects( pd3dDevice );
pModel->m_pModelElem = lpModelElem;
pModel->m_pModelElem->m_bUsed = TRUE;
#if __VER >= 14 // __WING_ITEM
memset( szFileName, 0, sizeof(szFileName) );
_tcsncpy( szFileName, lpszFileName, _tcslen( lpszFileName ) - 4 ); // .o3d를 떼고 파일명부분만 카피
_tcscat( szFileName, _T(".chr") );
switch( nType )
{
case OT_ITEM: // 아이템일 경우, 외장본(.chr)이 있다면 로딩한다 (예: 날개)
{
CResFile resFp;
BOOL bResult = resFp.Open( MakePath( DIR_MODEL, szFileName ), "rb" );
if( bResult == TRUE )
((CModelObject*)pModel)->LoadBone( szFileName );
break;
}
case OT_MOVER: // 무버일 경우 외장본(.chr)을 로딩한다
{
((CModelObject*)pModel)->LoadBone( szFileName );
break;
}
}
#else // __WING_ITEM
if( nType == OT_MOVER ) // 무버는 외장본(.chr)을 먼저로딩해야한다. 여기다 넣어도 되는건지 몰겠군 -_-;
{
memset( szFileName, 0, sizeof(szFileName) );
_tcsncpy( szFileName, lpszFileName, _tcslen( lpszFileName ) - 4 ); // .o3d를 떼고 파일명부분만 카피
_tcscat( szFileName, _T(".chr") );
((CModelObject*)pModel)->LoadBone( szFileName );
}
#endif // __WING_ITEM
if( bParts == FALSE )
{
if( ((CModelObject*)pModel)->LoadModel( lpszFileName ) == SUCCESS ) // skin 읽음
{
((CModelObject*)pModel)->RestoreDeviceObjects();
}
}
break;
}
return pModel;
//.........这里部分代码省略.........