本文整理汇总了C++中IEntityRenderProxy::GetSlotMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntityRenderProxy::GetSlotMaterial方法的具体用法?C++ IEntityRenderProxy::GetSlotMaterial怎么用?C++ IEntityRenderProxy::GetSlotMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityRenderProxy
的用法示例。
在下文中一共展示了IEntityRenderProxy::GetSlotMaterial方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetGeometry
//------------------------------------------------------------------------
bool CItem::SetGeometry(int slot, const ItemString& name, const ItemString& material, bool useParentMaterial, const Vec3& poffset, const Ang3& aoffset, float scale, bool forceReload)
{
assert(slot >= 0 && slot < eIGS_Last);
bool changedfp=false;
switch(slot)
{
case eIGS_Owner:
break;
case eIGS_FirstPerson:
case eIGS_ThirdPerson:
default:
{
if (name.empty() || forceReload)
{
GetEntity()->FreeSlot(slot);
#ifndef ITEM_USE_SHAREDSTRING
m_geometry[slot].resize(0);
#else
m_geometry[slot].reset();
#endif
}
DestroyAttachmentHelpers(slot);
if (!name.empty())
{
if (m_geometry[slot] != name)
{
const char* ext = PathUtil::GetExt(name.c_str());
if ((stricmp(ext, "chr") == 0) || (stricmp(ext, "cdf") == 0) || (stricmp(ext, "cga") == 0) )
GetEntity()->LoadCharacter(slot, name.c_str(), 0);
else
GetEntity()->LoadGeometry(slot, name.c_str(), 0, 0);
changedfp=slot==eIGS_FirstPerson;
}
CreateAttachmentHelpers(slot);
}
/* if (slot == eIGS_FirstPerson)
{
ICharacterInstance *pCharacter = GetEntity()->GetCharacter(eIGS_FirstPerson);
if (pCharacter)
{
pCharacter->SetFlags(pCharacter->GetFlags()&(~CS_FLAG_UPDATE));
}
}
else */if (slot == eIGS_Destroyed)
DrawSlot(eIGS_Destroyed, false);
}
break;
}
Matrix34 slotTM;
slotTM = Matrix34::CreateRotationXYZ(aoffset);
slotTM.ScaleColumn(Vec3(scale, scale, scale));
slotTM.SetTranslation(poffset);
GetEntity()->SetSlotLocalTM(slot, slotTM);
if (changedfp && m_stats.mounted)
{
if (m_sharedparams->pMountParams && !m_sharedparams->pMountParams->pivot.empty())
{
Matrix34 tm=GetEntity()->GetSlotLocalTM(eIGS_FirstPerson, false);
Vec3 pivot = GetSlotHelperPos(eIGS_FirstPerson, m_sharedparams->pMountParams->pivot.c_str(), false);
tm.AddTranslation(pivot);
GetEntity()->SetSlotLocalTM(eIGS_FirstPerson, tm);
}
GetEntity()->InvalidateTM();
}
m_geometry[slot] = name ? name : ItemString();
ReAttachAccessories();
IEntity* pParentEntity = gEnv->pEntitySystem->GetEntity(GetParentId());
IMaterial* pOverrideMaterial = 0;
if (!material.empty())
{
pOverrideMaterial = gEnv->p3DEngine->GetMaterialManager()->LoadMaterial(material.c_str());
}
else if (useParentMaterial && pParentEntity)
{
ICharacterInstance* pParentCharacter = pParentEntity->GetCharacter(slot);
IEntityRenderProxy* pParentRenderProxy = static_cast<IEntityRenderProxy*>(pParentEntity->GetProxy(ENTITY_PROXY_RENDER));
if (pParentCharacter)
pOverrideMaterial = pParentCharacter->GetIMaterial();
else if (pParentRenderProxy)
pOverrideMaterial = pParentRenderProxy->GetSlotMaterial(slot);
}
if (pOverrideMaterial)
{
ICharacterInstance* pCharacter = GetEntity()->GetCharacter(slot);
IEntityRenderProxy* pRenderProxy = static_cast<IEntityRenderProxy*>(GetEntity()->GetProxy(ENTITY_PROXY_RENDER));
OverrideAttachmentMaterial(pOverrideMaterial, this, slot);
//.........这里部分代码省略.........