本文整理汇总了C++中IAttachment::HideInShadow方法的典型用法代码示例。如果您正苦于以下问题:C++ IAttachment::HideInShadow方法的具体用法?C++ IAttachment::HideInShadow怎么用?C++ IAttachment::HideInShadow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAttachment
的用法示例。
在下文中一共展示了IAttachment::HideInShadow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateFPBodyPartsVisibility
void CLocalPlayerComponent::UpdateFPBodyPartsVisibility()
{
if (m_rPlayer.m_stats.isThirdPerson == false)
{
ICharacterInstance *pMainCharacter = m_rPlayer.GetEntity()->GetCharacter(0);
IAttachmentManager *pAttachmentManager = pMainCharacter ? pMainCharacter->GetIAttachmentManager() : NULL;
if (pAttachmentManager)
{
CRY_ASSERT(m_rPlayer.HasBoneID(BONE_CALF_L));
CRY_ASSERT(m_rPlayer.HasBoneID(BONE_CALF_R));
const CCamera& camera = gEnv->p3DEngine->GetRenderingCamera();
const Matrix34& playerWorldTM = m_rPlayer.GetEntity()->GetWorldTM();
bool visible = true;
if (m_rPlayer.m_linkStats.linkID == 0)
{
//volatile static float radius = 0.475f;
const float radius = 0.16f;
const Sphere calfSphereL(playerWorldTM.TransformPoint(m_rPlayer.GetBoneTransform(BONE_CALF_L).t), radius);
const Sphere calfSpehreR(playerWorldTM.TransformPoint(m_rPlayer.GetBoneTransform(BONE_CALF_R).t), radius);
visible = camera.IsSphereVisible_F(calfSphereL) || camera.IsSphereVisible_F(calfSpehreR);
}
//const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
//gEnv->pRenderer->Draw2dLabel(50.0f, 50.0f, 2.0f, white, false, visible ? "Rendering complete FP body" : "Rendering only arms");
//Early out if no change
if (m_fpCompleteBodyVisible == visible)
return;
//Hide/Unhide certain parts depending on visibility
const int kNumParstToToggle = 2;
const char *tooglePartsTable[kNumParstToToggle] = {"lower_body", "upper_body"};
for (int i=0; i<kNumParstToToggle; i++)
{
IAttachment* pAttachment = pAttachmentManager->GetInterfaceByName(tooglePartsTable[i]);
if (pAttachment)
{
pAttachment->HideAttachment(!visible);
pAttachment->HideInShadow(1);
}
}
m_fpCompleteBodyVisible = visible;
}
}
}
示例2: UpdateStowedWeapons
void CHandGrenades::UpdateStowedWeapons()
{
CActor *pOwnerActor = GetOwnerActor();
if (!pOwnerActor)
return;
ICharacterInstance *pOwnerCharacter = pOwnerActor->GetEntity()->GetCharacter(0);
if (!pOwnerCharacter)
return;
IStatObj *pTPObj = GetEntity()->GetStatObj(eIGS_ThirdPerson);
if (!pTPObj)
return;
int ammoCount = m_fm ? pOwnerActor->GetInventory()->GetAmmoCount(m_fm->GetAmmoType()) : 0;
if (IsSelected() && (ammoCount > 0))
{
ammoCount--;
}
if (!pOwnerActor->IsThirdPerson())
{
ammoCount = 0;
}
int numGrenDiff = ammoCount - m_numStowedCopies;
if(numGrenDiff != 0)
{
if (m_stowSlot < 0)
{
m_stowSlot = PickStowSlot(pOwnerCharacter->GetIAttachmentManager(), m_sharedparams->params.bone_attachment_01.c_str(), m_sharedparams->params.bone_attachment_02.c_str());
}
if (m_stowSlot >= 0)
{
bool attach = numGrenDiff > 0;
int tot = abs(numGrenDiff);
IAttachmentManager *pAttachmentManager = pOwnerCharacter->GetIAttachmentManager();
IAttachment *pAttachment = NULL;
for (int i=0; i<tot; i++)
{
//--- Generate the secondary slot from the first by adding one to the attachment name, is all we need at present...
const char *attach1 = (m_stowSlot == 0) ? m_sharedparams->params.bone_attachment_01.c_str() : m_sharedparams->params.bone_attachment_02.c_str();
int lenAttachName = strlen(attach1);
stack_string attach2(attach1, lenAttachName-1);
attach2 += (attach1[lenAttachName-1]+1);
if (attach)
{
pAttachment = pAttachmentManager->GetInterfaceByName(attach1);
if(pAttachment && pAttachment->GetIAttachmentObject())
{
pAttachment = pAttachmentManager->GetInterfaceByName(attach2);
}
if (pAttachment && !pAttachment->GetIAttachmentObject())
{
CCGFAttachment *pCGFAttachment = new CCGFAttachment();
pCGFAttachment->pObj = pTPObj;
pAttachment->AddBinding(pCGFAttachment);
pAttachment->HideAttachment(0);
pAttachment->HideInShadow(0);
m_numStowedCopies++;
}
}
else
{
pAttachment = pAttachmentManager->GetInterfaceByName(attach2);
if(!pAttachment || !pAttachment->GetIAttachmentObject())
{
pAttachment = pAttachmentManager->GetInterfaceByName(attach1);
}
if (pAttachment && pAttachment->GetIAttachmentObject())
{
pAttachment->ClearBinding();
m_numStowedCopies--;
}
}
}
}
}
}