示例#1
0
																																						//
// Creates a copy of the mesh which has no image or material specifications
DirectX::Mesh* DirectX::Mesh::cloneOutline( Mesh* out )
{
	if( !out ) out = new Mesh( ); out->release( );

	unsigned int nVertices = m_mesh->GetNumVertices( );
	unsigned int nFaces = m_mesh->GetNumFaces( );
	unsigned long options = m_mesh->GetOptions( );
	unsigned int fvf = m_mesh->GetFVF( );

	void* vertices = lockVertexBuffer( D3DLOCK_READONLY );
	void* indices = lockIndexBuffer( D3DLOCK_READONLY );
	out->create( vertices, indices, fvf, nVertices, nFaces, options );
	unlockVertexBuffer( ); unlockIndexBuffer( );

	out->update( ); return out;
}
	//-----------------------------------------------------------------------
	void MeshReadHelper::prepareFaces(size_t _subMeshIndex)
	{
		mCurSubMeshInfoFi = _subMeshIndex;
		mCurSubMeshInfoF = &mSubMeshInfos[_subMeshIndex];
		lockIndexBuffer();
	}