RpClump *CClumpModelInfo::CreateInstance()
{
    if (GetRwObject() == NULL)
    {
        return NULL;
    }
    AddRef();
    RpClump *pCloned = RpClumpClone((RpClump*)GetRwObject());
    RpAtomic *pFirst = GetFirstAtomic(pCloned);
    if (pFirst)
    {
        if(RpSkinGeometryGetSkin(pFirst->geometry) != NULL)
        {
            if(!dwUnknownFlag10)
            {
                RpHAnimHierarchy *pHAnim = GetAnimHierarchyFromClump(pCloned);
                RpClumpForAllAtomics(pCloned, SetAtomicHAnimHierarchyCB, pHAnim);
                RtAnimAnimation *pAnim = RpAnimBlendCreateAnimationForHierarchy(pHAnim);
                RtAnimInterpolatorSetCurrentAnim(pHAnim->currentAnim, pAnim);
                pHAnim->flags = rpHANIMHIERARCHYUPDATEMODELLINGMATRICES | rpHANIMHIERARCHYUPDATELTMS;
            }
        }
    }
    if (GetIsRoad())
    {
        RpAnimBlendClumpInit(pCloned);
        CAnimBlendHierarchy *pAnim = CAnimManager::GetAnimationByID(GetHashKey(), &CAnimManager::AnimBlocks[m_AnimId]);
        if (pAnim)
        {
            CAnimManager::BlendAnimation(pCloned, pAnim, 2, 1.0f);
        }
    }
    RemoveRef();
    return pCloned;
}
Exemple #2
0
void* CPedModelInfo::SetClump(RpClump* clump)
{
	CClumpModelInfo::SetClump(clump);
	CClumpModelInfo::SetFrameIds(&m_pPedIds);
	if (!m_hitColModel)
	{
		CreateHitColModelSkinned(clump);
	}
	RpClumpForAllAtomics((RpClump*)GetRwObject(), CClumpModelInfo::SetAtomicRendererCB, CVisibilityPlugins::RenderPedCB);
	return (void*)GetAnimHierarchyFromClump(clump);
}