本文整理汇总了C++中IEntityRenderProxy::SetLocalBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntityRenderProxy::SetLocalBounds方法的具体用法?C++ IEntityRenderProxy::SetLocalBounds怎么用?C++ IEntityRenderProxy::SetLocalBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityRenderProxy
的用法示例。
在下文中一共展示了IEntityRenderProxy::SetLocalBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateEntities
//.........这里部分代码省略.........
bool bHasCgfFile = gEnv->pCryPak->IsFileExist(m_modelCgf) && m_bc.animationMaxDistanceSq > 0;
if(!bHasCgfFile)
m_bc.animationMaxDistanceSq = 0;
bool bAnyCreated = false;
for (Boids::iterator it = m_boids.begin(); it != m_boids.end(); ++it)
{
CBoidObject *boid = *it;/*m_boids[i]*/;
if (boid->m_dead || boid->m_dying)
continue;
spawnParams.vPosition = boid->m_pos;
spawnParams.vScale = Vec3(boid->m_scale,boid->m_scale,boid->m_scale);
spawnParams.id = 0;
IEntity *pBoidEntity = gEnv->pEntitySystem->SpawnEntity( spawnParams );
if (!pBoidEntity)
{
//delete boid;
//it = m_boids.erase(it);
continue;
}
boid->m_noentity = false;
boid->m_entity = pBoidEntity->GetId();
CBoidObjectProxyPtr pBoidObjectProxy = ComponentCreateAndRegister_DeleteWithRelease<CBoidObjectProxy>( IComponent::SComponentInitializer(pBoidEntity), true );
pBoidEntity->SetProxy(ENTITY_PROXY_BOID_OBJECT,pBoidObjectProxy);
pBoidObjectProxy->SetBoid(boid);
// check if character.
if (IsCharacterFile(m_model))
{
if(bHasCgfFile)
pBoidEntity->LoadGeometry(CBoidObject::eSlot_Cgf, m_modelCgf);
pBoidEntity->LoadCharacter( CBoidObject::eSlot_Chr,m_model );
boid->m_object = pBoidEntity->GetCharacter(0);
if (!boid->m_object)
{
gEnv->pEntitySystem->RemoveEntity(boid->m_entity,true);
boid->m_entity = 0;
//delete boid;
//it = m_boids.erase(it);
continue;
}
}
else
{
pBoidEntity->LoadGeometry( 0,m_model );
}
bAnyCreated = true;
// boid->m_object->GetModel()->AddRef();
AABB aabb;
if (boid->m_object)
{
boid->m_object->SetFlags( CS_FLAG_DRAW_MODEL|CS_FLAG_UPDATE );
boid->PlayAnimation( m_boidDefaultAnimName,true );
aabb = boid->m_object->GetAABB();
}
else
{
pBoidEntity->GetLocalBounds(aabb);
}
float fBBoxRadius = ((aabb.max-aabb.min).GetLength()/2.0f);
m_bc.fBoidRadius = max( fBBoxRadius, 0.001f );
m_bc.fBoidThickness = m_bc.fBoidRadius;
if (!m_bc.vEntitySlotOffset.IsZero())
{
pBoidEntity->SetSlotLocalTM(0,Matrix34::CreateTranslationMat(m_bc.vEntitySlotOffset*fBBoxRadius));
}
boid->Physicalize(m_bc);
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)pBoidEntity->GetProxy(ENTITY_PROXY_RENDER);
if (pRenderProxy != NULL && m_bc.fBoidRadius > 0)
{
float r = m_bc.fBoidRadius;
AABB box;
box.min = Vec3(-r,-r,-r);
box.max = Vec3(r,r,r);
pRenderProxy->SetLocalBounds( box,true );
}
IScriptTable *pScriptTable = pBoidEntity->GetScriptTable();
if (pScriptTable)
{
pScriptTable->SetValue( "flock_entity",m_pEntity->GetScriptTable() );
}
}
m_bEntityCreated = true;
return bAnyCreated;
}