本文整理汇总了C++中ISkeletonPose::GetStatObjOnJoint方法的典型用法代码示例。如果您正苦于以下问题:C++ ISkeletonPose::GetStatObjOnJoint方法的具体用法?C++ ISkeletonPose::GetStatObjOnJoint怎么用?C++ ISkeletonPose::GetStatObjOnJoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISkeletonPose
的用法示例。
在下文中一共展示了ISkeletonPose::GetStatObjOnJoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeChildState
//------------------------------------------------------------------------
bool CVehiclePartAnimated::ChangeChildState(CVehiclePartAnimatedJoint* pPart, EVehiclePartState state, int flags)
{
// only handle range between intact and destroyed
if (state > pPart->GetState() && (state < eVGS_Damaged1 || state >= eVGS_Destroyed))
return false;
if (state < pPart->GetState() && pPart->GetState() >= eVGS_Destroyed)
return false;
int jointId = pPart->GetJointId();
if (pPart->GetState() == eVGS_Default)
{
ISkeletonPose* pSkeletonPose = m_pCharInstance ? m_pCharInstance->GetISkeletonPose() : NULL;
if (IStatObj* pStatObjIntact = pSkeletonPose ? pSkeletonPose->GetStatObjOnJoint(jointId) : NULL)
{
IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
const char* jointName = rIDefaultSkeleton.GetJointNameByID(jointId);
if (m_intactStatObjs.find(CONST_TEMP_STRING(jointName)) == m_intactStatObjs.end())
m_intactStatObjs.insert(TStringStatObjMap::value_type(jointName, pStatObjIntact));
}
}
if (m_jointParts.find(pPart->GetName()) == m_jointParts.end())
m_jointParts.insert(TStringVehiclePartMap::value_type(pPart->GetName(), pPart));
IStatObj* pStatObj = GetGeometryForState(pPart, state);
if (pStatObj)
SetCGASlot(jointId, pStatObj, (flags & eVPSF_Physicalize) != 0);
return true;
}
示例2: GetDestroyedGeometry
//------------------------------------------------------------------------
IStatObj* CVehiclePartAnimated::GetDestroyedGeometry(const char* pJointName, unsigned int index)
{
if (pJointName[0] && m_pCharInstanceDestroyed)
{
IDefaultSkeleton &rICharacterModelSkeletonDestroyed = m_pCharInstanceDestroyed->GetIDefaultSkeleton();
ISkeletonPose* pSkeletonDestroyed = m_pCharInstanceDestroyed->GetISkeletonPose();
CRY_ASSERT(pSkeletonDestroyed);
char buffer[256];
const char* pSuffix = !m_pSharedParameters->m_destroyedSuffix.empty() ? m_pSharedParameters->m_destroyedSuffix.c_str() : GetDestroyedGeometrySuffix(eVGS_Destroyed);
if (index == 0)
{
cry_sprintf(buffer, "%s%s", pJointName, pSuffix);
}
else
{
cry_sprintf(buffer, "%s_debris_%u", pJointName, index);
}
buffer[sizeof(buffer) - 1] = '\0';
int16 jointIdForDestroyed = rICharacterModelSkeletonDestroyed.GetJointIDByName(buffer);
if (jointIdForDestroyed > -1)
{
return pSkeletonDestroyed->GetStatObjOnJoint(jointIdForDestroyed);
}
}
return NULL;
}
示例3: GetGeometryForState
//------------------------------------------------------------------------
IStatObj* CVehiclePartAnimated::GetGeometryForState(CVehiclePartAnimatedJoint* pPart, EVehiclePartState state)
{
string name;
pPart->GetGeometryName(state, name);
IStatObj* pStatObj = 0;
if (state > eVGS_Default)
{
if (pPart->m_pDestroyedGeometry)
{
pStatObj = pPart->m_pDestroyedGeometry;
}
else
{
IDefaultSkeleton* pIDefaultSkeleton = m_pCharInstanceDestroyed ? &m_pCharInstanceDestroyed->GetIDefaultSkeleton() : 0;
if (pIDefaultSkeleton)
{
int jointId = pIDefaultSkeleton->GetJointIDByName(name.c_str());
ISkeletonPose* pSkeletonPose = m_pCharInstanceDestroyed->GetISkeletonPose();
if (jointId != -1)
pStatObj = pSkeletonPose->GetStatObjOnJoint(jointId);
}
}
}
else
{
TStringStatObjMap::const_iterator it = m_intactStatObjs.find(name.c_str());
if (it != m_intactStatObjs.end())
pStatObj = it->second;
}
return pStatObj;
}
示例4: ChangeState
//------------------------------------------------------------------------
bool CVehiclePartAnimated::ChangeState(EVehiclePartState state, int flags)
{
if ((state == eVGS_Default) && m_initialiseOnChangeState)
{
// Initialise!
// Having to do this because of the way the glass code
// swaps a cstatobj. The way the vehicle code stores its
// statobj in m_intactStatObjs is going to need reviewing
if (m_pCharInstance)
{
ISkeletonPose* pSkeletonPose = m_pCharInstance->GetISkeletonPose();
IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
ISkeletonPose* pSkeletonPoseDestroyed = m_pCharInstanceDestroyed ? m_pCharInstanceDestroyed->GetISkeletonPose() : NULL;
IDefaultSkeleton* pICharacterModelSkeletonDestroyed = m_pCharInstanceDestroyed ? &m_pCharInstanceDestroyed->GetIDefaultSkeleton() : NULL;
if (pSkeletonPose)
{
const bool bDestroyedSkelExists = pSkeletonPoseDestroyed && pICharacterModelSkeletonDestroyed;
for (uint32 i = 0; i < rIDefaultSkeleton.GetJointCount(); i++)
{
if (IStatObj* pStatObjIntact = pSkeletonPose->GetStatObjOnJoint(i))
{
const char* jointName = rIDefaultSkeleton.GetJointNameByID(i);
if (m_intactStatObjs.find(CONST_TEMP_STRING(jointName)) == m_intactStatObjs.end())
{
m_intactStatObjs.insert(TStringStatObjMap::value_type(jointName, pStatObjIntact));
}
// tell the streaming engine to stream destroyed version together with non destroyed
if (bDestroyedSkelExists && i < pICharacterModelSkeletonDestroyed->GetJointCount())
{
if (IStatObj* pStatObjIntactDestroyed = pSkeletonPoseDestroyed->GetStatObjOnJoint(i))
{
pStatObjIntact->SetStreamingDependencyFilePath(pStatObjIntactDestroyed->GetFilePath());
}
}
}
}
}
}
m_initialiseOnChangeState = false;
}
bool change = CVehiclePartBase::ChangeState(state, flags);
if (state == eVGS_Default && !change)
{
// need to restore state if one of the children is in higher state
EVehiclePartState maxState = GetMaxState();
if (maxState > m_state)
change = true;
}
if (!change)
{
return false;
}
if (state == eVGS_Destroyed)
{
if (m_ignoreDestroyedState)
return false;
if (m_pCharInstance && m_pCharInstanceDestroyed)
{
ISkeletonPose* pSkeletonPose = m_pCharInstance->GetISkeletonPose();
IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
if (pSkeletonPose)
{
IMaterial* pDestroyedMaterial = m_pVehicle->GetDestroyedMaterial();
for (uint32 i = 0; i < rIDefaultSkeleton.GetJointCount(); i++)
{
if (IStatObj* pStatObjIntact = pSkeletonPose->GetStatObjOnJoint(i))
{
const char* jointName = rIDefaultSkeleton.GetJointNameByID(i);
IStatObj* pStatObj = GetDestroyedGeometry(jointName);
// sets new StatObj to joint, if null, removes it.
// object whose name includes "proxy" are not removed.
if (pStatObj || !strstr(jointName, "proxy"))
{
SetCGASlot(i, pStatObj);
if (pStatObj && !pDestroyedMaterial)
{
if (IMaterial* pMaterial = pStatObj->GetMaterial())
SetMaterial(pMaterial);
}
#if ENABLE_VEHICLE_DEBUG
if (IsDebugParts())
{
CryLog("swapping StatObj on joint %u (%s) -> %s", i, jointName, pStatObj ? pStatObj->GetGeoName() : "<NULL>");
}
#endif
}
}
//.........这里部分代码省略.........