本文整理汇总了C++中IStatObj::GetRenderMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ IStatObj::GetRenderMesh方法的具体用法?C++ IStatObj::GetRenderMesh怎么用?C++ IStatObj::GetRenderMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStatObj
的用法示例。
在下文中一共展示了IStatObj::GetRenderMesh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChangeState
//.........这里部分代码省略.........
}
#if ENABLE_VEHICLE_DEBUG
if (IsDebugParts())
{
CryLog("swapping StatObj on joint %u (%s) -> %s", i, jointName, pStatObj ? pStatObj->GetGeoName() : "<NULL>");
}
#endif
}
}
}
FlagSkeleton(pSkeletonPose, rIDefaultSkeleton);
for (TStringVehiclePartMap::iterator ite = m_jointParts.begin(); ite != m_jointParts.end(); ++ite)
{
IVehiclePart* pPart = ite->second;
pPart->ChangeState(state, flags | eVPSF_Physicalize);
}
CryCharAnimationParams animParams;
animParams.m_nFlags |= CA_LOOP_ANIMATION;
// pSkeleton->SetRedirectToLayer0(1);
// pSkeleton->StartAnimation("Default",0, 0,0, animParams); // [MR: commented out on Ivos request]
if (pDestroyedMaterial)
{
SetMaterial(pDestroyedMaterial);
}
}
}
}
else if (state == eVGS_Default)
{
if (m_pCharInstance && m_pCharInstanceDestroyed)
{
// reset material (in case we replaced it with the destroyed material)
IMaterial* pMaterial = m_pVehicle->GetPaintMaterial();
if (!pMaterial)
{
// no paint, so revert to the material already set on the character
pMaterial = m_pCharInstance->GetIMaterial();
}
if (pMaterial)
{
SetMaterial(pMaterial);
}
IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
{
for (TStringStatObjMap::iterator ite = m_intactStatObjs.begin(); ite != m_intactStatObjs.end(); ++ite)
{
const string &jointName = ite->first;
IStatObj* pStatObj = ite->second;
int16 jointId = rIDefaultSkeleton.GetJointIDByName(jointName.c_str());
if (jointId > -1)
{
// if compound StatObj (from deformation), use first SubObj for restoring
if (pStatObj != NULL)
{
if (!pStatObj->GetRenderMesh() && pStatObj->GetSubObjectCount() > 0)
{
pStatObj = pStatObj->GetSubObject(0)->pStatObj;
}
SetCGASlot(jointId, pStatObj);
#if ENABLE_VEHICLE_DEBUG
if (IsDebugParts())
CryLog("restoring StatObj on joint %i (%s) -> %s", jointId, jointName.c_str(), pStatObj ? pStatObj->GetGeoName() : "<NULL>");
#endif
}
TStringVehiclePartMap::iterator it = m_jointParts.find(jointName);
if (it != m_jointParts.end())
{
it->second->ChangeState(state, flags & ~eVPSF_Physicalize | eVPSF_Force);
}
}
}
flags |= eVPSF_Physicalize;
}
}
}
m_state = state;
// physicalize after all parts have been restored
if (flags & eVPSF_Physicalize && GetEntity()->GetPhysics())
{
Physicalize();
for (TStringVehiclePartMap::iterator it = m_jointParts.begin(); it != m_jointParts.end(); ++it)
{
it->second->Physicalize();
}
}
return true;
}
示例2: ProcessEvent
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
{
switch (event)
{
case eFE_Initialize:
break;
case eFE_Activate:
IGameFramework* pGameFramework = gEnv->pGame->GetIGameFramework();
if(IsPortActive(pActInfo, EIP_Cast))
{
// setup ray + optionally skip 1 entity
ray_hit rayHit;
static const float maxRayDist = 100.f;
const unsigned int flags = rwi_stop_at_pierceable|rwi_colltype_any;
IPhysicalEntity *skipList[1];
int skipCount = 0;
IEntity* skipEntity = gEnv->pEntitySystem->GetEntity(GetPortEntityId(pActInfo, EIP_SkipEntity));
if(skipEntity)
{
skipList[0] = skipEntity->GetPhysics();
skipCount = 1;
}
Vec3 rayPos = GetPortVec3(pActInfo, EIP_RayPos);
Vec3 rayDir = GetPortVec3(pActInfo, EIP_RayDir);
// Check if the ray hits an entity
if(gEnv->pSystem->GetIPhysicalWorld()->RayWorldIntersection(rayPos, rayDir * 100, ent_all, flags, &rayHit, 1, skipList, skipCount))
{
int type = rayHit.pCollider->GetiForeignData();
if (type == PHYS_FOREIGN_ID_ENTITY)
{
IEntity* pEntity = (IEntity*)rayHit.pCollider->GetForeignData(PHYS_FOREIGN_ID_ENTITY);
IEntityRenderProxy* pRenderProxy = pEntity ? (IEntityRenderProxy*)pEntity->GetProxy(ENTITY_PROXY_RENDER) : 0;
// Get the renderproxy, and use it to check if the material is a DynTex, and get the UIElement if so
if(pRenderProxy)
{
IRenderNode *pRenderNode = pRenderProxy->GetRenderNode();
IMaterial* pMaterial = pRenderProxy->GetRenderMaterial();
SEfResTexture* texture = 0;
if(pMaterial && pMaterial->GetShaderItem().m_pShaderResources)
texture= pMaterial->GetShaderItem().m_pShaderResources->GetTexture(EFTT_DIFFUSE);
IUIElement* pElement = texture ? gEnv->pFlashUI->GetUIElementByInstanceStr(texture->m_Name) : 0;
if(pElement && pRenderNode)
{
int m_dynTexGeomSlot = 0;
IStatObj* pObj = pRenderNode->GetEntityStatObj(m_dynTexGeomSlot);
// result
bool hasHit = false;
Vec2 uv0, uv1, uv2;
Vec3 p0, p1, p2;
Vec3 hitpos;
// calculate ray dir
CCamera cam = gEnv->pRenderer->GetCamera();
if (pEntity->GetSlotFlags(m_dynTexGeomSlot) & ENTITY_SLOT_RENDER_NEAREST)
{
ICVar *r_drawnearfov = gEnv->pConsole->GetCVar("r_DrawNearFoV");
assert(r_drawnearfov);
cam.SetFrustum(cam.GetViewSurfaceX(),cam.GetViewSurfaceZ(),DEG2RAD(r_drawnearfov->GetFVal()),cam.GetNearPlane(),cam.GetFarPlane(), cam.GetPixelAspectRatio());
}
Vec3 vPos0 = rayPos;
Vec3 vPos1 = rayPos + rayDir;
// translate into object space
const Matrix34 m = pEntity->GetWorldTM().GetInverted();
vPos0 = m * vPos0;
vPos1 = m * vPos1;
// walk through all sub objects
const int objCount = pObj->GetSubObjectCount();
for (int obj = 0; obj <= objCount && !hasHit; ++obj)
{
Vec3 vP0, vP1;
IStatObj* pSubObj = NULL;
if (obj == objCount)
{
vP0 = vPos0;
vP1 = vPos1;
pSubObj = pObj;
}
else
{
IStatObj::SSubObject* pSub = pObj->GetSubObject(obj);
const Matrix34 mm = pSub->tm.GetInverted();
vP0 = mm * vPos0;
vP1 = mm * vPos1;
pSubObj = pSub->pStatObj;
}
IRenderMesh* pMesh = pSubObj ? pSubObj->GetRenderMesh() : NULL;
if (pMesh)
//.........这里部分代码省略.........