本文整理汇总了C++中IEntityRenderProxy::SetSlotMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntityRenderProxy::SetSlotMaterial方法的具体用法?C++ IEntityRenderProxy::SetSlotMaterial怎么用?C++ IEntityRenderProxy::SetSlotMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityRenderProxy
的用法示例。
在下文中一共展示了IEntityRenderProxy::SetSlotMaterial方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetGeometry
//.........这里部分代码省略.........
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);
if (pCharacter)
pCharacter->SetIMaterial_Instance(pOverrideMaterial);
else if (pRenderProxy)
pRenderProxy->SetSlotMaterial(slot, pOverrideMaterial);
}
if(slot == eIGS_FirstPerson && IsSelected())
{
CActor* pOwnerActor = GetOwnerActor();
IActionController *pActionController = GetActionController();
if(pActionController && pOwnerActor && pOwnerActor->IsClient())
{
UpdateScopeContexts(pActionController);
}
}
return true;
}
示例2: Init
//------------------------------------------------------------------------
bool CVehiclePartTread::Init(IVehicle* pVehicle, const CVehicleParams& table, IVehiclePart* parent, CVehicle::SPartInitInfo& initInfo, int partType)
{
if (!CVehiclePartBase::Init(pVehicle, table, parent, initInfo, eVPT_Tread))
return false;
CVehicleParams subTable = table.findChild("Tread"); // Tread subtable
if (!subTable)
return false;
string filename = subTable.getAttr("filename");
if (filename.empty())
return false;
subTable.getAttr("uvSpeedMultiplier", m_uvSpeedMultiplier);
if (table.haveAttr("component"))
{
if (CVehicleComponent* pComponent = static_cast<CVehicleComponent*>(m_pVehicle->GetComponent(table.getAttr("component"))))
pComponent->AddPart(this);
}
m_slot = GetEntity()->LoadCharacter(m_slot, filename);
m_pCharInstance = GetEntity()->GetCharacter(m_slot);
if (!m_pCharInstance)
return false;
if (subTable.haveAttr("materialName"))
{
string materialName = subTable.getAttr("materialName");
materialName.MakeLower();
IMaterial* pMaterial = 0;
const char* subMtlName = 0;
int subMtlSlot = -1;
// find tread material
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)GetEntity()->GetProxy(ENTITY_PROXY_RENDER);
if (pRenderProxy)
{
pMaterial = pRenderProxy->GetRenderMaterial(m_slot);
if (pMaterial)
{
// if matname doesn't fit, look in submaterials
if (string(pMaterial->GetName()).MakeLower().find(materialName) == string::npos)
{
for (int i=0; i < pMaterial->GetSubMtlCount(); ++i)
{
if (string(pMaterial->GetSubMtl(i)->GetName()).MakeLower().find(materialName) != string::npos)
{
subMtlName = pMaterial->GetSubMtl(i)->GetName();
subMtlSlot = i;
break;
}
}
}
}
}
if (pMaterial)
{
// clone
IMaterial *pCloned = pMaterial->GetMaterialManager()->CloneMultiMaterial(pMaterial, subMtlName);
if (pCloned)
{
pRenderProxy->SetSlotMaterial(m_slot, pCloned);
pMaterial = pCloned;
m_pMaterial = pMaterial;
}
if (subMtlSlot > -1)
m_pShaderResources = pMaterial->GetShaderItem(subMtlSlot).m_pShaderResources;
else
m_pShaderResources = pMaterial->GetShaderItem().m_pShaderResources;
}
if (m_pShaderResources)
{
for (int i = 0; i < EFTT_MAX; ++i)
{
if (!m_pShaderResources->GetTexture(i))
continue;
SEfTexModificator& modif = *m_pShaderResources->GetTexture(i)->AddModificator();
modif.SetMember("m_eMoveType[0]", 1.0f); // ETMM_Fixed: u = m_OscRate[0] + sourceU
modif.SetMember("m_OscRate[0]", 0.0f);
}
}
}
char wheelName[256];
IDefaultSkeleton& rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
for (int i=0; i<rIDefaultSkeleton.GetJointCount(); ++i)
{
const char* boneName = rIDefaultSkeleton.GetJointNameByID(i);
if (0 != boneName)
//.........这里部分代码省略.........