本文整理汇总了C++中CArray::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::Clear方法的具体用法?C++ CArray::Clear怎么用?C++ CArray::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArray
的用法示例。
在下文中一共展示了CArray::Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NewMeshObj
void CGmResMan::NewMeshObj( const char *pcSubDir, const char *pcFileName, CArray<CGMeshObj *> &roArr, bool bTexSmooth, bool bRawPoly )
{
roArr.Clear();
CStr oPre( DATA_DIR + "model/" + pcSubDir );
if( oPre[oPre.GetSize()-1] != '/' )
oPre += '/';
CFileBlockTxt oFile;
if( oFile.Load( ( oPre + pcFileName ).GetData() ) )
{
LOG( "Loading %s.\n", ( oPre + pcFileName ).GetData() );
CStr oMaterialLibName;
if( CGMeshObj::LoadModel_( oFile.GetString(), &roArr, bRawPoly, &oMaterialLibName ) )
{
LOG( "%d OBJ-Meshes loaded.\n", roArr.GetSize() );
bool bMtllibOk = false;
CFileBlockTxt oFileMaterialLib;
if( oMaterialLibName.GetSize() )
{
if( oFileMaterialLib.Load( ( oPre + oMaterialLibName ).GetData() ) )
{
//LOG( "\nmtllib:\n%s\n", (const char *)oFileMaterialLib.m_pucData );
LOG( "%s loaded.\n", oMaterialLibName.GetData() );
bMtllibOk = true;
}
}
for( unsigned int i=0; i<roArr.GetSize(); ++i )
{
CGMeshObj *poMesh = roArr[i];
//poMesh->RotateX( M_PI );
//poMesh->ScaleX( 1.1f );
//poMesh->ScaleY( 1.1f );
//poMesh->ScaleZ( 1.1f );
LOG( "\t%s\n", poMesh->m_oName.GetData() );
LOG( "\t%d vertices\n", poMesh->m_oArrVertex.GetSize() );
LOG( "\t%d indices\n", poMesh->m_oArrIndex.GetSize() );
LOG( "\tmaterial: %s\n", poMesh->m_oMaterialName.GetData() );
if( bMtllibOk )
{
CStr oTexNameDiffuse, oTexNameNormal;
poMesh->LoadMaterial(
oFileMaterialLib.GetString(),
poMesh->m_oMaterialName,
&oTexNameDiffuse, 0, &oTexNameNormal );
if( !bRawPoly )
{
if( oTexNameDiffuse.GetSize() )
{
poMesh->SetTex( NewTexture( oTexNameDiffuse, bTexSmooth, false ), 0 );
}
if( oTexNameNormal.GetSize() )
{
poMesh->SetTex( NewTexture( oTexNameNormal, false, false ), 1 );
}
}
}
else if( !bRawPoly && poMesh->m_oMaterialName.GetSize() )
{
poMesh->SetTex( NewTexture( poMesh->m_oMaterialName, bTexSmooth, false ), 0 );
}
poMesh->m_bEnableColor = false; // Hat keine Funktion bei beim Wavefront Object Meshes.
poMesh->Init();
m_oArrMesh.Append( poMesh ); // new
}
}
}
else
{
ERR( "OBJ Mesh %s.\n", pcFileName );
}
}