本文整理汇总了C++中IStatObj::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ IStatObj::GetFlags方法的具体用法?C++ IStatObj::GetFlags怎么用?C++ IStatObj::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IStatObj
的用法示例。
在下文中一共展示了IStatObj::GetFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterExplosionShape
int CScriptBind_Physics::RegisterExplosionShape(IFunctionHandler *pH,const char *sGeometryFile,float fSize,int nIdMaterial,float fProbability,
const char *sSplintersFile, float fSplintersOffset, const char *sSplintersCloudEffect)
{
//////////////////////////////////////////////////////////////////////////
// Remove all this.
//////////////////////////////////////////////////////////////////////////
IStatObj *pObj = gEnv->p3DEngine->LoadStatObj( sGeometryFile,"#ForceBreakable",NULL,false );
if (!pObj || pObj->IsDefaultObject())
{
ScriptWarning( "<RegisterExplosionShape> Object file %s not found",sGeometryFile );
return pH->EndFunction();
}
pObj->AddRef();
pObj->GetIndexedMesh(true); // prepare idxMesh now
if(sSplintersFile && *sSplintersFile!=0) // if sSplintersFile was specified
{
IStatObj *pSplinters = gEnv->p3DEngine->LoadStatObj(sSplintersFile,NULL,NULL,false);
if (pSplinters)
{
pObj->SetSubObjectCount(pObj->GetSubObjectCount()+1);
IStatObj::SSubObject *pSubObj = pObj->GetSubObject(pObj->GetSubObjectCount()-1);
pSubObj->nType = STATIC_SUB_OBJECT_MESH;
pSubObj->bHidden = true;
pSubObj->name = "splinters";
(pSubObj->pStatObj = pSplinters)->AddRef();
pSubObj->helperSize.x = fSplintersOffset;
nIdMaterial |= 1<<16;
if (*sSplintersCloudEffect)
{
pSplinters->SetSubObjectCount(pSplinters->GetSubObjectCount()+1);
pSplinters->SetFlags(pSplinters->GetFlags() & ~STATIC_OBJECT_COMPOUND);
pSubObj = pSplinters->GetSubObject(pSplinters->GetSubObjectCount()-1);
pSubObj->nType = STATIC_SUB_OBJECT_DUMMY;
pSubObj->bHidden = true;
pSubObj->name = "splinters_cloud";
pSubObj->properties = sSplintersCloudEffect;
}
}
}
phys_geometry *pPhysGeom = pObj->GetPhysGeom();
if (pPhysGeom)
{
m_pPhysicalWorld->AddExplosionShape( pPhysGeom->pGeom,fSize,nIdMaterial,fProbability );
}
return pH->EndFunction();
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:49,代码来源:ScriptBind_Physics.cpp
示例2: ExtractPhysDataFromEvent
//--------------------------------------------------------------------------------------------------
// Name: ExtractPhysDataFromEvent
// Desc: Extracts collider's physical data from an event
// Note 1: Ideally *ALL* of this should be calculated offline and the minimal data loaded
// Note 2: We're currently duplicating some work done in CryAction, so should be reading that in
//--------------------------------------------------------------------------------------------------
bool CBreakableGlassSystem::ExtractPhysDataFromEvent(const EventPhysCollision& physEvent, SBreakableGlassPhysData& data, SBreakableGlassInitParams& initParams)
{
if (IPhysicalEntity* pPhysEntity = physEvent.pEntity[PHYSEVENT_COLLIDEE])
{
// Get collider entity data
const int entType = pPhysEntity->GetiForeignData();
const int entPart = physEvent.partid[PHYSEVENT_COLLIDEE];
// Local output data
IStatObj* pStatObj = NULL;
IMaterial* pRenderMat = NULL;
phys_geometry* pPhysGeom = NULL;
uint renderFlags = 0;
Matrix34A entityMat;
entityMat.SetIdentity();
// Only handling simple objects at the moment
const pe_type physType = pPhysEntity->GetType();
if (physType == PE_STATIC || physType == PE_RIGID)
{
// Entity or static object?
if (entType == PHYS_FOREIGN_ID_ENTITY)
{
IEntity* pEntity = (IEntity*)pPhysEntity->GetForeignData(PHYS_FOREIGN_ID_ENTITY);
pStatObj = pEntity->GetStatObj(entPart);
entityMat = pEntity->GetSlotWorldTM(entPart);
if (IEntityRenderProxy* pRenderProxy = (IEntityRenderProxy*)pEntity->GetProxy(ENTITY_PROXY_RENDER))
{
pRenderMat = pRenderProxy->GetRenderMaterial(entPart);
IRenderNode* pRenderNode = pRenderProxy->GetRenderNode();
renderFlags = pRenderNode ? pRenderNode->GetRndFlags() : 0;
// Fall back to top level material if sub-object fails to find it
if (!pRenderMat)
{
pRenderMat = pRenderProxy->GetRenderMaterial();
if (!pRenderMat && pStatObj)
{
pRenderMat = pStatObj->GetMaterial();
}
}
}
}
else if (entType == PHYS_FOREIGN_ID_STATIC)
{
if (IRenderNode* pBrush = (IRenderNode*)physEvent.pForeignData[PHYSEVENT_COLLIDEE])
{
pStatObj = pBrush->GetEntityStatObj(0, 0, &entityMat);
pRenderMat = pBrush->GetMaterial();
renderFlags = pBrush->GetRndFlags();
// May need to get sub-object and it's material
if (pStatObj && pStatObj->GetFlags() & STATIC_OBJECT_COMPOUND)
{
if (IStatObj::SSubObject* pSubObj = pStatObj->GetSubObject(entPart))
{
pStatObj = pSubObj->pStatObj;
if (!pSubObj->bIdentityMatrix)
{
entityMat = entityMat * pSubObj->tm;
}
// Find the correct sub-material
// Note: We loop as the slots don't always line up
const int subMtlCount = pRenderMat->GetSubMtlCount();
for (int i = 0; i < subMtlCount; ++i)
{
if (IMaterial* pSubMat = pRenderMat->GetSubMtl(i))
{
if (pSubMat->GetSurfaceTypeId() == initParams.surfaceTypeId)
{
pRenderMat = pSubMat;
break;
}
}
}
}
}
}
}
}
// Validate geometry of collided object
pPhysGeom = pStatObj ? pStatObj->GetPhysGeom() : NULL;
IGeometry* pGeom = pPhysGeom ? pPhysGeom->pGeom : NULL;
bool validGeom = false;
//.........这里部分代码省略.........