Sources/CcgDump/CrySkinMorphBuilder.cpp
//////////////////////////////////////////////////////////////////////////
// initializes the given skin out of the given morph target

initializes the given skin out of the given morph target
initializes the given skin out of the given morph target
void CrySkinMorphBuilder::initSkinMorph (const SMeshMorphTargetVertex* pMorphVerts, unsigned numMorphVerts, class CrySkinMorph* pSkin)
{
	m_pMorphVerts = pMorphVerts;
	m_numMorphVerts = numMorphVerts;
	m_pSkinTarget = pSkin;
	pSkin->m_numDests = m_pGeometry->numVertices();
	if (!numMorphVerts)
	{
		pSkin->clear();
		return;
	}
	findAffectingBoneRange();
	makeMorphBoneVertexArray();
	calculateNumMorphLinks();
	validate();
	unsigned numAuxInts = 2 * (m_numAffectingBones - m_nFirstAffectingBone) + m_numMorphSmoothLinks;
	pSkin->init (m_numMorphRigidLinks + m_numMorphSmoothLinks,
		numAuxInts,
		m_nFirstAffectingBone,
		m_numAffectingBones);
	CrySkinStreams stream, streamBegin, streamEnd;
	streamBegin.pAux  = pSkin->m_arrAux.begin();
	streamBegin.pVert = pSkin->m_arrVertices.begin();
	stream = streamBegin;
	streamEnd.pAux  = streamBegin.pAux  + numAuxInts;
	streamEnd.pVert = streamBegin.pVert	+ m_numMorphRigidLinks + m_numMorphSmoothLinks;
	for (unsigned nBone = m_nFirstAffectingBone; nBone < m_numAffectingBones; ++nBone)
	{
		fillRigidGroup (stream, nBone);
		assert (stream.pAux <= streamEnd.pAux);
		assert (stream.pVert <= streamEnd.pVert);
		fillSmoothGroup (stream, nBone);
		assert (stream.pAux <= streamEnd.pAux);
		assert (stream.pVert <= streamEnd.pVert);
	}
}
void CrySkinMorphBuilder :: initSkinMorph ( const SMeshMorphTargetVertex * pMorphVerts , unsigned numMorphVerts , class CrySkinMorph * pSkin ) { m_pMorphVerts = pMorphVerts ; m_numMorphVerts = numMorphVerts ; m_pSkinTarget = pSkin ; pSkin -> m_numDests = m_pGeometry -> numVertices ( ) ; if ( ! numMorphVerts ) { pSkin -> clear ( ) ; return ; } findAffectingBoneRange ( ) ; makeMorphBoneVertexArray ( ) ; calculateNumMorphLinks ( ) ; validate ( ) ; unsigned numAuxInts = 2 * ( m_numAffectingBones - m_nFirstAffectingBone ) + m_numMorphSmoothLinks ; pSkin -> init ( m_numMorphRigidLinks + m_numMorphSmoothLinks , numAuxInts , m_nFirstAffectingBone , m_numAffectingBones ) ; CrySkinStreams stream , streamBegin , streamEnd ; streamBegin . pAux = pSkin -> m_arrAux . begin ( ) ; streamBegin . pVert = pSkin -> m_arrVertices . begin ( ) ; stream = streamBegin ; streamEnd . pAux = streamBegin . pAux + numAuxInts ; streamEnd . pVert = streamBegin . pVert + m_numMorphRigidLinks + m_numMorphSmoothLinks ; for ( unsigned nBone = m_nFirstAffectingBone ; nBone < m_numAffectingBones ; ++ nBone ) { fillRigidGroup ( stream , nBone ) ; assert ( stream . pAux <= streamEnd . pAux ) ; assert ( stream . pVert <= streamEnd . pVert ) ; fillSmoothGroup ( stream , nBone ) ; assert ( stream . pAux <= streamEnd . pAux ) ; assert ( stream . pVert <= streamEnd . pVert ) ; } }
initializes the given skin out of the given morph target
initializes the given skin out of the given morph target
// for aux ints, we need, for each bone:
 // 2 ints for group headers
 // for each smooth link,
 // 1 int for index of the target vertex
 // for each bone, fill the three groups
 // we start from the rigid vertices
 // only when we processed the last bone, we should have the pAux pointing to the end
