当前位置: 首页>>代码示例>>C++>>正文


C++ CFrame::SetMeshCount方法代码示例

本文整理汇总了C++中CFrame::SetMeshCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CFrame::SetMeshCount方法的具体用法?C++ CFrame::SetMeshCount怎么用?C++ CFrame::SetMeshCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFrame的用法示例。


在下文中一共展示了CFrame::SetMeshCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

bool CGmObjAnim3::ReadXML( TiXmlNode* poParent, unsigned int uiCounter )
{
	if( !poParent )
		return false;
	
	static char acTxt_[256];
	if( uiCounter == 0 )
	{
	}
	
	switch ( poParent->Type() )
	{
	case TiXmlNode::DOCUMENT:
		LOG( "XML: Document" );
	break;
	case TiXmlNode::ELEMENT:
	{
		const char *pcName = poParent->Value();
		//LOG( "name: %s\n", pcName );
		if( !strcmp( pcName, "animation" ) )
		{
			LOG( "animation:\n" );
			
			TiXmlElement * poElement = poParent->ToElement();
			if( poElement )
			{
				int iIdx;
				CStr oMeshFileName;
				CArray<CStr> oArrAnimFileName;
				
				TiXmlAttribute* poAttrib = poElement->FirstAttribute();
				while( poAttrib )
				{
					const char *pcName = poAttrib->Name();
					if( !strcmp( pcName, "mesh" ) )
					{
						STRING_COPY( acTxt_, sizeof(acTxt_), poAttrib->Value() );
						LOG( "%s: %s\n", poAttrib->Name(), acTxt_ );
						oMeshFileName = acTxt_;
					}
					else if( SSCANF( pcName, "anim_%d", &iIdx ) == 1 )
					{
						LOG( "%s: %d\n", poAttrib->Name(), iIdx );
						STRING_COPY( acTxt_, sizeof(acTxt_), poAttrib->Value() );
						LOG( "%s: %s\n", poAttrib->Name(), acTxt_ );
						if( iIdx >= int( oArrAnimFileName.GetSize() ) )
							oArrAnimFileName.Resize( iIdx + 1 );
						oArrAnimFileName[iIdx] = acTxt_;
						
					}
					poAttrib = poAttrib->Next();
				}
				
				if( oMeshFileName.GetSize() )
				{
					// Model.
					m_poModel = m_poResMan_->NewModelMD5( oMeshFileName, oArrAnimFileName, false );
					
					const unsigned int uiFrameCountTotal = m_poModel->GetFrameCountTotal();
					const unsigned int uiMeshCount = m_poModel->GetMeshCount();
					const unsigned int uiAnimCount = m_poModel->GetAnimCount();
					
					m_oArrAnim.Resize( uiAnimCount );
					m_oArrAnim.Fill( 0 );
					
					m_poData->SetFrameCount( uiFrameCountTotal );
					unsigned int uiFrameIdx = 0;
					
					for( unsigned int uiAnim=0; uiAnim<uiAnimCount; ++uiAnim )
					{
						//m_poModel->SetAnim( uiAnim );	
						const unsigned int uiFrameCount = m_poModel->GetFrameCount( uiAnim );
						
						CAnim * poAnim = new CAnim;
						m_oArrAnim[uiAnim] = poAnim;
						
						poAnim->SetFrameRate( m_poModel->GetFrameRate( uiAnim ) );
						poAnim->SetFrameCount( uiFrameCount );
						
						for( unsigned int uiFrame=0; uiFrame<uiFrameCount; ++uiFrame )
						{
							CFrame * poFrame = new CFrame;
							m_poData->SetFrame( uiFrameIdx, poFrame );
							poAnim->SetFrameIndex( uiFrame, uiFrameIdx );
							++uiFrameIdx;
							
							poFrame->SetMeshCount( uiMeshCount );

							for( unsigned int uiMesh=0; uiMesh<uiMeshCount; ++uiMesh )
							{
								CGMeshMD5 * poMesh = m_poModel->GetPrecalcMesh( uiMesh, uiFrame, uiAnim );
								ASSERT( poMesh );
								poFrame->SetMesh( uiMesh, poMesh );
							}
						}

						poAnim->Init();
					}
					ASSERT( uiFrameIdx == uiFrameCountTotal );
				}
//.........这里部分代码省略.........
开发者ID:0rel,项目名称:okkuplektor,代码行数:101,代码来源:GmObjAnim3_bak02.cpp


注:本文中的CFrame::SetMeshCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。