本文整理汇总了C++中CEntity::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntity::GetName方法的具体用法?C++ CEntity::GetName怎么用?C++ CEntity::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntity
的用法示例。
在下文中一共展示了CEntity::GetName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEntity
//
// 获得实体
//
CEntity* CSceneManager::GetEntity(DWORD dwName, CEntity::TYPE type) const
{
CEntity *pEntity = NULL;
EntityMap::const_iterator itEntity;
switch (type) {
case CEntity::MESH:
itEntity = m_meshs.find(pEntity->GetName());
pEntity = m_meshs.end() != itEntity ? itEntity->second : NULL;
break;
case CEntity::SKIN:
itEntity = m_skins.find(pEntity->GetName());
pEntity = m_skins.end() != itEntity ? itEntity->second : NULL;
break;
case CEntity::EFFECT:
itEntity = m_effects.find(pEntity->GetName());
pEntity = m_effects.end() != itEntity ? itEntity->second : NULL;
break;
case CEntity::HALO:
itEntity = m_halos.find(pEntity->GetName());
pEntity = m_halos.end() != itEntity ? itEntity->second : NULL;
break;
case CEntity::LIGHT:
itEntity = m_lights.find(pEntity->GetName());
pEntity = m_lights.end() != itEntity ? itEntity->second : NULL;
break;
}
return pEntity;
}
示例2: GetPoolEntityFromActiveSet
CEntity* CEntityPool::GetPoolEntityFromActiveSet()
{
FUNCTION_PROFILER(GetISystem(), PROFILE_ENTITY);
assert(!gEnv->IsEditor());
CEntity* pPoolEntity = NULL;
assert(m_pEntityPoolManager);
CEntitySystem* pEntitySystem = m_pEntityPoolManager->GetEntitySystem();
const uint32 uActiveSize = m_ActivePoolIds.size();
const bool bAtMax = (m_uMaxSize > 0 && uActiveSize >= m_uMaxSize);
m_ReturnToPoolWeights.clear();
m_ReturnToPoolWeights.reserve(m_ActivePoolIds.size());
// Go through the active list and ask if any are available for removal
TPoolIdsVec::iterator itPoolSlot = m_ActivePoolIds.begin();
TPoolIdsVec::iterator itPoolSlotEnd = m_ActivePoolIds.end();
for (; itPoolSlot != itPoolSlotEnd; ++itPoolSlot)
{
CEntity* pEntity = (CEntity*)pEntitySystem->GetEntity(itPoolSlot->usingId);
if (!pEntity)
{
CRY_ASSERT_MESSAGE(pEntity, "NULL Pool Entity in Active set");
continue;
}
SReturnToPoolWeight returnToPoolWeight;
returnToPoolWeight.pEntity = pEntity;
returnToPoolWeight.weight = m_pEntityPoolManager->GetReturnToPoolWeight(pEntity, bAtMax);
m_ReturnToPoolWeights.push_back(returnToPoolWeight);
}
// Sort and use top if weight > 0
if (!m_ReturnToPoolWeights.empty())
{
std::sort(m_ReturnToPoolWeights.begin(), m_ReturnToPoolWeights.end());
SReturnToPoolWeight &bestEntry = m_ReturnToPoolWeights.front();
if (bestEntry.weight > FLT_EPSILON)
{
pPoolEntity = bestEntry.pEntity;
#ifdef ENTITY_POOL_DEBUGGING
if (bAtMax)
{
++m_iDebug_TakenFromActiveForced;
EntityWarning("[Entity Pool] Pool \'%s\' has reached its max size and a new entity was requested. An entity from the active set was forced to be reused: \'%s\' (%d)",
m_sName.c_str(), pPoolEntity->GetName(), m_iDebug_TakenFromActiveForced);
}
#endif //ENTITY_POOL_DEBUGGING
}
}
return pPoolEntity;
}
示例3: DebugDraw
void CEntityPool::DebugDraw(IRenderer* pRenderer, float &fColumnX, float &fColumnY, bool bExtraInfo) const
{
assert(pRenderer);
assert(m_pEntityPoolManager);
CEntitySystem* pEntitySystem = m_pEntityPoolManager->GetEntitySystem();
const float colWhite[] = {1.0f,1.0f,1.0f,1.0f};
const float colYellow[] = {1.0f,1.0f,0.0f,1.0f};
const float colOrange[] = {1.0f,0.5f,0.25f,1.0f};
const float colRed[] = {1.0f,0.0f,0.0f,1.0f};
const string::size_type activeCount = m_ActivePoolIds.size();
const string::size_type inactiveCount = m_InactivePoolIds.size();
const bool bAtMax = (m_uMaxSize > 0 && activeCount >= m_uMaxSize);
const float* pColor = colWhite;
if (m_bDebug_HasExpanded)
pColor = colRed;
else if (m_iDebug_TakenFromActiveForced > 0)
pColor = colOrange;
else if (inactiveCount <= 0)
pColor = colYellow;
pRenderer->Draw2dLabel(fColumnX + 5.0f, fColumnY, 1.2f, pColor, false, "Pool \'%s\' (Default Class = \'%s\'):", m_sName.c_str(), m_sDefaultClass.c_str());
fColumnY += 15.0f;
if (m_iDebug_TakenFromActiveForced > 0)
{
pRenderer->Draw2dLabel(fColumnX + 5.0f, fColumnY, 1.5f, colRed, false, "Force Reused Counter: %d", m_iDebug_TakenFromActiveForced);
fColumnY += 20.0f;
}
string sInactiveCount;
sInactiveCount.Format("Not In Use - Count: %" PRISIZE_T, inactiveCount);
pRenderer->Draw2dLabel(fColumnX + 10.0f, fColumnY, 1.0f, colWhite, false, "%s", sInactiveCount.c_str());
fColumnY += 12.0f;
if (bExtraInfo && inactiveCount > 0)
{
string sInactiveList;
TPoolIdsVec::const_iterator itInactiveId = m_InactivePoolIds.begin();
TPoolIdsVec::const_iterator itInactiveIdEnd = m_InactivePoolIds.end();
for (bool bFirstIt = true; itInactiveId != itInactiveIdEnd; ++itInactiveId, bFirstIt = false)
{
string sId;
const EntityId inactiveId = itInactiveId->poolId;
sId.Format("%u", inactiveId);
sInactiveList.append(bFirstIt ? " (" : ", ");
sInactiveList += sId;
}
pRenderer->Draw2dLabel(fColumnX + 15.0f, fColumnY, 1.0f, colWhite, false, "%s", sInactiveList.c_str());
fColumnY += 12.0f;
}
string sActiveCount;
sActiveCount.Format("In Use - Count: %" PRISIZE_T, activeCount);
pRenderer->Draw2dLabel(fColumnX + 10.0f, fColumnY, 1.0f, colWhite, false, "%s", sActiveCount.c_str());
fColumnY += 12.0f;
if (bExtraInfo && activeCount > 0)
{
TReturnToPoolWeights returnToPoolWeights;
returnToPoolWeights.reserve(m_ActivePoolIds.size());
// Go through the active list and ask if any are available for removal
TPoolIdsVec::const_iterator itActiveId = m_ActivePoolIds.begin();
TPoolIdsVec::const_iterator itActiveIdEnd = m_ActivePoolIds.end();
for (; itActiveId != itActiveIdEnd; ++itActiveId)
{
const EntityId activeId = itActiveId->usingId;
CEntity* pActiveEntity = pEntitySystem->GetEntityFromID(activeId);
if (!pActiveEntity)
continue;
SReturnToPoolWeight returnToPoolWeight;
returnToPoolWeight.pEntity = pActiveEntity;
returnToPoolWeight.weight = m_pEntityPoolManager->GetReturnToPoolWeight(pActiveEntity, bAtMax);
returnToPoolWeights.push_back(returnToPoolWeight);
}
if (!returnToPoolWeights.empty())
{
std::sort(returnToPoolWeights.begin(), returnToPoolWeights.end());
}
// Debug output each one
TReturnToPoolWeights::iterator itActiveWeight = returnToPoolWeights.begin();
TReturnToPoolWeights::iterator itActiveWeightEnd = returnToPoolWeights.end();
for (; itActiveWeight != itActiveWeightEnd; ++itActiveWeight)
{
SReturnToPoolWeight &activeWeight = *itActiveWeight;
CEntity* pActiveEntity = activeWeight.pEntity;
assert(pActiveEntity);
const float* pActiveColor = colWhite;
string sActiveInfo;
sActiveInfo.Format("%s (%u)", pActiveEntity->GetName(), pActiveEntity->GetId());
//.........这里部分代码省略.........
示例4: Update
BOOL CImpactCtrl::Update()
{
CString result;
CString query;
int selectionSize;
Clean();
query = "set ImpactSelection $DiscoverSelection";
result=ExecCommand(query);
if(result.Left(m_cszError.GetLength()).CompareNoCase(m_cszError)==0)
return FALSE;
// Calculationg selection size
query = "size $ImpactSelection";
result=ExecCommand(query);
if(result.Left(m_cszError.GetLength()).CompareNoCase(m_cszError)==0)
return FALSE;
selectionSize = atoi(result);
if(selectionSize > 0) {
query = "printformat \"%s\t%s\t%s\t%s\t%s\t%s\t%s\" name kind language etag private protected cname;print $ImpactSelection";
result=ExecPrint(query);
if(result.Left(m_cszError.GetLength()).CompareNoCase(m_cszError)==0)
return FALSE;
CString szRootName;
szRootName.LoadString(IDS_IMPACTROOTNAME);
int nRootIconIdx = GetIconIdx(IDB_IMPACTPROJECT);
HTREEITEM hRoot = m_ImpactTree.InsertItem(szRootName,nRootIconIdx,nRootIconIdx);
TVINSERTSTRUCT tvInsert;
tvInsert.hParent = hRoot;
tvInsert.hInsertAfter = NULL;
tvInsert.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
int nStartDelim=0,
nEndDelim;
while((nEndDelim=result.Find(_T('\n'),nStartDelim))!=-1) {
CString szAttrs = result.Mid(nStartDelim,nEndDelim-nStartDelim);
CEntity* pEntity = new CEntity(szAttrs,_T('\t'));
// if current language is ELS - give it another try ask a language using another command
if(!pEntity->GetLanguage().CompareNoCase("ELS")) {
CString szEtag = pEntity->GetEtag();
if(szEtag.Find(" ")>-1) szEtag = "{" + szEtag + "}";
CString queryLanguage = "language [ etag " + szEtag + " ]";
pEntity->SetLanguage(ExecCommand(queryLanguage));
}
CImpactActionsSet* pSet = CreateActions(pEntity);
if(pSet!=NULL) { // if we have impact queries for such an entity
CImpactItem* pImpactItem = new CImpactItem(pEntity,pSet);
int nIconIdx = GetIconIdx(pEntity->GetKind());
tvInsert.item.pszText = (char*)(LPCTSTR)pEntity->GetName();
tvInsert.item.iImage = nIconIdx;
tvInsert.item.iSelectedImage = nIconIdx;
tvInsert.item.lParam = (LPARAM)pImpactItem;
HTREEITEM hEntityRoot = m_ImpactTree.InsertItem(&tvInsert);
AddActions(hEntityRoot,pImpactItem);
} else {
delete pEntity;
}
nStartDelim = nEndDelim+1;
}
m_ImpactTree.Expand(hRoot,TVE_EXPAND);
}
query = "unset ImpactSelection";
result=ExecCommand(query);
return result.Left(m_cszError.GetLength()).CompareNoCase(m_cszError)!=0;
}
示例5: GetPropertyValue
CTString GetPropertyValue(CEntity *pen, CEntityProperty *pepProperty, INDEX &iFormat)
{
CTString strResult="";
iFormat=PDF_STRING;
// see type of changing property
switch( pepProperty->ep_eptType)
{
case CEntityProperty::EPT_FLAGS:
case CEntityProperty::EPT_ZONEFLAGS:
{
strResult.PrintF("0x%08x", ENTITYPROPERTY( pen, pepProperty->ep_slOffset, ULONG));
break;
}
case CEntityProperty::EPT_ZONEFLAGS_EX:
{
strResult.PrintF("0x%08x", ENTITYPROPERTY( pen, pepProperty->ep_slOffset, ULONG64));
break;
}
case CEntityProperty::EPT_ENUM:
{
// obtain enum property description object
CEntityPropertyEnumType *epEnum = pepProperty->ep_pepetEnumType;
INDEX iEnum = ENTITYPROPERTY( pen, pepProperty->ep_slOffset, INDEX);
// search for selected enum
BOOL bEnumFound=FALSE;
for(INDEX iEnumItem=0; iEnumItem<epEnum->epet_ctValues; iEnumItem++)
{
if(iEnum==epEnum->epet_aepevValues[ iEnumItem].epev_iValue)
{
strResult=epEnum->epet_aepevValues[ iEnumItem].epev_strName;
bEnumFound=TRUE;
}
}
if( !bEnumFound)
{
strResult="Invalid enum value!!!";
}
break;
}
case CEntityProperty::EPT_ANIMATION:
{
iFormat=PDF_INDEX;
INDEX iAnim = ENTITYPROPERTY( pen, pepProperty->ep_slOffset, INDEX);
CAnimData *pAD = pen->GetAnimData( pepProperty->ep_slOffset);
if( pAD != NULL)
{
CAnimInfo aiInfo;
pAD->GetAnimInfo(iAnim, aiInfo);
strResult=aiInfo.ai_AnimName;
}
break;
}
case CEntityProperty::EPT_ENTITYPTR:
case CEntityProperty::EPT_PARENT:
{
CEntity *penPtr = ENTITYPROPERTY( pen, pepProperty->ep_slOffset, CEntityPointer);
if( penPtr!=NULL)
{
strResult="->"+penPtr->GetName();
}
else
{
strResult="No target";
}
break;
}
case CEntityProperty::EPT_FLOAT:
case CEntityProperty::EPT_RANGE:
case CEntityProperty::EPT_ANGLE:
{
iFormat=PDF_FLOAT;
strResult.PrintF("%g", ENTITYPROPERTY( pen, pepProperty->ep_slOffset, FLOAT));
break;
}
case CEntityProperty::EPT_ILLUMINATIONTYPE:
{
INDEX iIllumination = ENTITYPROPERTY( pen, pepProperty->ep_slOffset, INDEX);
strResult=pen->en_pwoWorld->wo_aitIlluminationTypes[iIllumination].it_strName;
break;
}
case CEntityProperty::EPT_STRING:
case CEntityProperty::EPT_STRINGTRANS:
{
strResult=ENTITYPROPERTY( pen, pepProperty->ep_slOffset, CTString);
break;
}
case CEntityProperty::EPT_FLOATAABBOX3D:
{
FLOATaabbox3D box=ENTITYPROPERTY( pen, pepProperty->ep_slOffset, FLOATaabbox3D);
strResult.PrintF("(%g,%g,%g)-(%g,%g,%g)",
box.Min()(1),box.Min()(2),box.Min()(3),
box.Max()(1),box.Max()(2),box.Max()(3));
break;
}
case CEntityProperty::EPT_ANGLE3D:
{
ANGLE3D ang=ENTITYPROPERTY( pen, pepProperty->ep_slOffset, ANGLE3D);
strResult.PrintF("%g,%g,%g",ang(1),ang(2),ang(3));
break;
}
//.........这里部分代码省略.........