本文整理汇总了C++中IEntityRenderProxy类的典型用法代码示例。如果您正苦于以下问题:C++ IEntityRenderProxy类的具体用法?C++ IEntityRenderProxy怎么用?C++ IEntityRenderProxy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IEntityRenderProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FUNCTION_PROFILER
bool CVisibleObjectsHelper::CheckObjectViewDist(const Agent& agent, const SVisibleObject &visibleObject) const
{
FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);
assert(agent.IsValid());
bool bInViewDist = true;
IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
assert(pEntitySystem);
IEntity *pAIEntity = pEntitySystem->GetEntity(agent.GetEntityID());
IEntity *pObjectEntity = pEntitySystem->GetEntity(visibleObject.entityId);
IEntityRenderProxy *pObjectRenderProxy = (pAIEntity != NULL && pObjectEntity ? static_cast<IEntityRenderProxy *>(pObjectEntity->GetProxy(ENTITY_PROXY_RENDER)) : NULL);
if (pObjectRenderProxy != NULL)
{
IRenderNode *pObjectRenderNode = pObjectRenderProxy->GetRenderNode();
if (pObjectRenderNode != NULL)
{
const float fDistanceSq = pAIEntity->GetWorldPos().GetSquaredDistance(pObjectEntity->GetWorldPos());
const float fMaxViewDistSq = sqr(pObjectRenderNode->GetMaxViewDist());
bInViewDist = (fDistanceSq <= fMaxViewDistSq);
}
}
return bInViewDist;
}
示例2: SetGameObject
//------------------------------------------------------------------------
bool CProjectile::Init(IGameObject *pGameObject)
{
SetGameObject(pGameObject);
g_pGame->GetWeaponSystem()->AddProjectile(GetEntity(), this);
if (!GetGameObject()->CaptureProfileManager(this))
return false;
m_pAmmoParams = g_pGame->GetWeaponSystem()->GetAmmoParams(GetEntity()->GetClass());
if (0 == (GetEntity()->GetFlags() & (ENTITY_FLAG_CLIENT_ONLY | ENTITY_FLAG_SERVER_ONLY)))
if (!m_pAmmoParams->predictSpawn)
if (!GetGameObject()->BindToNetwork())
return false;
GetGameObject()->EnablePhysicsEvent(true, eEPE_OnCollisionLogged);
LoadGeometry();
Physicalize();
IEntityRenderProxy *pProxy = static_cast<IEntityRenderProxy *>(GetEntity()->GetProxy(ENTITY_PROXY_RENDER));
if (pProxy && pProxy->GetRenderNode())
{
pProxy->GetRenderNode()->SetViewDistRatio(255);
pProxy->GetRenderNode()->SetLodRatio(255);
}
float lifetime = m_pAmmoParams->lifetime;
if (lifetime > 0.0f)
GetEntity()->SetTimer(ePTIMER_LIFETIME, (int)(lifetime*1000.0f));
float showtime = m_pAmmoParams->showtime;
if (showtime > 0.0f)
{
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)&(~ENTITY_SLOT_RENDER));
GetEntity()->SetTimer(ePTIMER_SHOWTIME, (int)(showtime*1000.0f));
}
else
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)|ENTITY_SLOT_RENDER);
// Only for bullets
m_hitPoints = m_pAmmoParams->hitPoints;
m_hitListener = false;
if(m_hitPoints>0)
{
//Only projectiles with hit points are hit listeners
g_pGame->GetGameRules()->AddHitListener(this);
m_hitListener = true;
m_noBulletHits = m_pAmmoParams->noBulletHits;
}
if (m_tracked) // if this is true here, it means m_tracked was serialized from spawn info
{
m_tracked=false;
SetTracked(true);
}
return true;
}
示例3: CreateLaserEntity
IEntity* CLaserBeam::CreateLaserEntity()
{
IEntity* pLaserEntity = gEnv->pEntitySystem->GetEntity(m_laserEntityId);
if (pLaserEntity)
return pLaserEntity;
IEntity* pOwnerEntity = gEnv->pEntitySystem->GetEntity(m_ownerEntityId);
if (!pOwnerEntity)
return 0;
SEntitySpawnParams spawnParams;
spawnParams.pClass = gEnv->pEntitySystem->GetClassRegistry()->GetDefaultClass();
spawnParams.sName = "LaserBeam";
spawnParams.nFlags = (pOwnerEntity->GetFlags() | ENTITY_FLAG_NO_SAVE) & ~ENTITY_FLAG_CASTSHADOW;
IEntity* pNewEntity = gEnv->pEntitySystem->SpawnEntity(spawnParams);
if(pNewEntity)
{
m_laserEntityId = pNewEntity->GetId();
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)pNewEntity->GetProxy(ENTITY_PROXY_RENDER);
IRenderNode * pRenderNode = pRenderProxy?pRenderProxy->GetRenderNode():NULL;
if(pRenderNode)
pRenderNode->SetRndFlags(ERF_RENDER_ALWAYS,true);
SetLaserEntitySlots(false);
}
return pNewEntity;
}
示例4: assert
//--------------------------------------------------------------
void CWeaponSystem::OnGameTokenEvent( EGameTokenEvent event,IGameToken *pGameToken )
{
assert(pGameToken);
if(EGAMETOKEN_EVENT_CHANGE == event)
{
bool handled = false;
if(!strcmp("weapon.effects.ice",pGameToken->GetName()))
{
pGameToken->GetValueAs(m_frozenEnvironment);
handled = true;
}
else if(!strcmp("weapon.effects.wet",pGameToken->GetName()))
{
pGameToken->GetValueAs(m_wetEnvironment);
handled = true;
}
if (handled)
{
IGameFramework* pGF = gEnv->pGame->GetIGameFramework();
IActorSystem* pAS = pGF->GetIActorSystem();
int count = pAS->GetActorCount();
if (count)
{
IActorIteratorPtr it = pAS->CreateActorIterator();
while (CActor* pActor = (CActor*)it->Next())
{
CPlayer *pPlayer = (pActor->GetActorClass() == CPlayer::GetActorClassType()) ? static_cast<CPlayer*>(pActor) : 0;
if (pPlayer && pPlayer->GetNanoSuit())
{
// go through all players and turn their ice effects on/off
IEntityRenderProxy* pRenderProxy = (IEntityRenderProxy*)pPlayer->GetEntity()->GetProxy(ENTITY_PROXY_RENDER);
if (pRenderProxy)
{
uint8 mask = pRenderProxy->GetMaterialLayersMask();
uint32 blend = pRenderProxy->GetMaterialLayersBlend();
mask = IsFrozenEnvironment() ? mask|MTL_LAYER_DYNAMICFROZEN : mask&~MTL_LAYER_DYNAMICFROZEN;
mask = IsWetEnvironment() ? mask|MTL_LAYER_WET : mask&~MTL_LAYER_WET;
pRenderProxy->SetMaterialLayersMask(mask);
pRenderProxy->SetMaterialLayersBlend(blend);
if (CItem* pItem = static_cast<CItem*>(pPlayer->GetCurrentItem(true)))
{
pItem->FrostSync(true);
pItem->WetSync(true);
}
if (COffHand* pOffHand = static_cast<COffHand*>(pPlayer->GetItemByClass(CItem::sOffHandClass)))
{
pOffHand->FrostSync(pOffHand->GetOffHandState() != eOHS_INIT_STATE);
pOffHand->WetSync(pOffHand->GetOffHandState() != eOHS_INIT_STATE);
}
}
}
}
}
}
}
}
示例5: SetHUDSilhouettesParams
void CScriptbind_Entity::SetHUDSilhouettesParams(IEntity *pEntity, float r, float g, float b, float a)
{
IEntityRenderProxy *pRenderProxy = static_cast<IEntityRenderProxy *>(pEntity->GetProxy(ENTITY_PROXY_RENDER));
if(!pRenderProxy)
return;
pRenderProxy->SetVisionParams(r, g, b, a);
}
示例6:
void EntityEffects::CHeatController::SetThermalVisionParams( const float scale )
{
IEntityRenderProxy *pEntityRenderProxy = static_cast<IEntityRenderProxy *>(m_ownerEntity->GetProxy(ENTITY_PROXY_RENDER));
if(pEntityRenderProxy)
{
pEntityRenderProxy->SetVisionParams(scale, scale, scale, scale);
}
CHeatControllerDebug::DebugInfo(m_ownerEntity, scale);
}
示例7: min
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::UpdateEffect(float frameTime)
{
IEntity *pRingEntity = gEnv->pEntitySystem->GetEntity(m_effectData.ringEntityID);
if(pRingEntity)
{
// Update lerps
m_effectData.materialColorLerp.UpdateLerp(frameTime);
m_effectData.particleColorLerp.UpdateLerp(frameTime);
// Update ring cgf
if(m_effectData.alphaLerp.HasFinishedLerping() == false)
{
if(m_effectData.alphaFadeInDelay > 0.0f)
{
m_effectData.alphaFadeInDelay -= frameTime;
if(m_effectData.alphaFadeInDelay <= 0.0f)
{
m_effectData.alphaFadeInDelay = 0.0f;
float alpha = min(m_effectData.alphaLerp.GetValue(),0.99f);
SetRingAlpha(pRingEntity,alpha);
pRingEntity->Hide(false);
}
}
else
{
m_effectData.alphaLerp.UpdateLerp(frameTime);
float alpha = min(m_effectData.alphaLerp.GetValue(),0.99f);
SetRingAlpha(pRingEntity,alpha);
// Fully faded out, so hide
if(m_effectData.alphaLerp.HasFinishedLerping() && m_effectData.alphaLerp.GetNewValue() == 0.0f)
{
pRingEntity->Hide(true);
SetNewEffectColor(eRPT_Neutral);
}
}
}
// Update Color
float lerpValue = m_effectData.materialColorLerp.GetValue();
Vec3 currentColor = LERP(*m_effectData.pPrevCol,*m_effectData.pDestCol,lerpValue);
// Set ring color
IEntityRenderProxy* pRenderProxy = (IEntityRenderProxy*)pRingEntity->GetProxy(ENTITY_PROXY_RENDER);
if(pRenderProxy)
{
IMaterial* pRingMaterial = pRenderProxy->GetRenderMaterial();
SetMaterialDiffuseColor(pRingMaterial,currentColor);
}
// Set particle geom material color
SetMaterialDiffuseColor(m_effectData.pParticleGeomMaterial,currentColor);
}
}
示例8: SetRingAlpha
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::SetRingAlpha(IEntity* pRingEntity,float alpha)
{
if(pRingEntity)
{
IEntityRenderProxy* pRenderProxy = (IEntityRenderProxy*)pRingEntity->GetProxy(ENTITY_PROXY_RENDER);
if(pRenderProxy)
{
IMaterial* pRindMaterial = pRenderProxy->GetRenderMaterial();
SetMaterialDiffuseAlpha(pRindMaterial,alpha);
}
}
}
示例9: DeleteEntities
void CFlock::DeleteEntities( bool bForceDeleteAll )
{
if (m_pEntity)
{
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)m_pEntity->GetProxy(ENTITY_PROXY_RENDER);
if (pRenderProxy)
pRenderProxy->ClearSlots();
}
I3DEngine *engine = gEnv->p3DEngine;
for (Boids::iterator it = m_boids.begin(); it != m_boids.end(); ++it)
{
CBoidObject* boid = *it;
if (boid->m_pickedUp && !bForceDeleteAll) // Do not delete picked up boids.
continue;
// SAFE_RELEASE(boid->m_object);
boid->m_object = 0;
boid->m_noentity = true;
if (boid->m_entity)
{
// Delete entity.
IEntity *pBoidEntity = gEnv->pEntitySystem->GetEntity(boid->m_entity);
if (pBoidEntity)
{
CBoidObjectProxy *pBoidObjectProxy = static_cast<CBoidObjectProxy *>(pBoidEntity->GetProxy(ENTITY_PROXY_BOID_OBJECT));
/* Luciano: old code did this (without getting the existing boid object proxy first), not sure why
if(!pBoidObjectProxy)
{
pBoidObjectProxy = new CBoidObjectProxy(pBoidEntity);
pBoidEntity->SetProxy(ENTITY_PROXY_BOID_OBJECT,pBoidObjectProxy);
}*/
if (pBoidObjectProxy)
pBoidObjectProxy->SetBoid(0);
}
gEnv->pEntitySystem->RemoveEntity(boid->m_entity);
boid->m_entity = 0;
boid->m_pPhysics = 0;
boid->m_physicsControlled = false;
}
}
m_bEntityCreated = false;
}
示例10: SetGeometry
//------------------------------------------------------------------------
void CTracer::SetGeometry(const char *name, float scale)
{
if (IEntity *pEntity=gEnv->pEntitySystem->GetEntity(m_entityId))
{
m_geometrySlot =pEntity->LoadGeometry(TRACER_GEOM_SLOT, name);
if (scale!=1.0f)
{
Matrix34 tm=Matrix34::CreateIdentity();
tm.ScaleColumn(Vec3(scale, scale, scale));
pEntity->SetSlotLocalTM(m_geometrySlot, tm);
}
// Set opacity
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)pEntity->GetProxy(ENTITY_PROXY_RENDER);
pRenderProxy->SetOpacity(m_geometryOpacity);
}
}
示例11: GetEntity
void CDoorPanel::AssignAsFSCommandHandler()
{
IEntity* pEntity = GetEntity();
if (pEntity)
{
IEntityRenderProxy* pRenderProxy = static_cast<IEntityRenderProxy*>(pEntity->GetProxy(ENTITY_PROXY_RENDER));
if (pRenderProxy)
{
_smart_ptr<IMaterial> pMaterial = pRenderProxy->GetRenderMaterial(DOOR_PANEL_MODEL_NORMAL_SLOT);
IFlashPlayer* pFlashPlayer = CHUDUtils::GetFlashPlayerFromMaterialIncludingSubMaterials(pMaterial, true);
if (pFlashPlayer) // Valid to not have a flash player, since will update when flash setup
{
pFlashPlayer->SetFSCommandHandler(this);
pFlashPlayer->Release();
}
}
}
}
示例12: SetGameObject
//------------------------------------------------------------------------
bool CProjectile::Init(IGameObject *pGameObject)
{
SetGameObject(pGameObject);
g_pGame->GetWeaponSystem()->AddProjectile(GetEntity(), this);
if(!GetGameObject()->CaptureProfileManager(this))
return false;
m_pAmmoParams = g_pGame->GetWeaponSystem()->GetAmmoParams(GetEntity()->GetClass());
if(0 == (GetEntity()->GetFlags() & (ENTITY_FLAG_CLIENT_ONLY | ENTITY_FLAG_SERVER_ONLY)))
if(!m_pAmmoParams->predictSpawn)
if(!GetGameObject()->BindToNetwork())
return false;
LoadGeometry();
Physicalize();
IEntityRenderProxy *pProxy = static_cast<IEntityRenderProxy *>(GetEntity()->GetProxy(ENTITY_PROXY_RENDER));
if(pProxy && pProxy->GetRenderNode())
{
pProxy->GetRenderNode()->SetViewDistRatio(255);
pProxy->GetRenderNode()->SetLodRatio(255);
}
float lifetime = m_pAmmoParams->lifetime;
if(lifetime > 0.0f)
GetEntity()->SetTimer(ePTIMER_LIFETIME, (int)(lifetime*1000.0f));
float showtime = m_pAmmoParams->showtime;
if(showtime > 0.0f)
{
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)&(~ENTITY_SLOT_RENDER));
GetEntity()->SetTimer(ePTIMER_SHOWTIME, (int)(showtime*1000.0f));
}
else
GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)|ENTITY_SLOT_RENDER);
return true;
}
示例13: GetRenderProxy
//------------------------------------------------------------------------
void CItem::CopyRenderFlags(IEntity *pOwner)
{
if (!pOwner || !GetRenderProxy())
return;
IRenderNode *pRenderNode = GetRenderProxy()->GetRenderNode();
if (pRenderNode)
{
IEntityRenderProxy *pOwnerRenderProxy = (IEntityRenderProxy *)pOwner->GetProxy(ENTITY_PROXY_RENDER);
IRenderNode *pOwnerRenderNode = pOwnerRenderProxy?pOwnerRenderProxy->GetRenderNode():NULL;
if (pOwnerRenderNode)
{
pRenderNode->SetViewDistRatio(pOwnerRenderNode->GetViewDistRatio());
pRenderNode->SetLodRatio(pOwnerRenderNode->GetLodRatio());
uint32 flags = pOwner->GetFlags()&(ENTITY_FLAG_CASTSHADOW);
uint32 mflags = GetEntity()->GetFlags()&(~(ENTITY_FLAG_CASTSHADOW));
GetEntity()->SetFlags(mflags|flags);
}
}
}
示例14: UpdateBoidsViewDistRatio
void CFlock::UpdateBoidsViewDistRatio()
{
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)m_pEntity->GetProxy(ENTITY_PROXY_RENDER);
if (pRenderProxy)
{
m_nViewDistRatio = pRenderProxy->GetRenderNode()->GetViewDistRatio();
}
for (Boids::iterator it = m_boids.begin(); it != m_boids.end(); ++it)
{
CBoidObject* boid = *it;
IEntity *pBoidEntity = gEnv->pEntitySystem->GetEntity(boid->m_entity);
if (pBoidEntity)
{
pRenderProxy = (IEntityRenderProxy*)pBoidEntity->GetProxy(ENTITY_PROXY_RENDER);
if (pRenderProxy)
{
pRenderProxy->GetRenderNode()->SetViewDistRatio(m_nViewDistRatio);
}
}
}
}
示例15: CreateLaserEntity
//---------------------------------------------------------------------------
void CLam::CreateLaserEntity()
{
if(m_pLaserEntityId)
{
//Check if entity is valid
IEntity *pEntity = m_pEntitySystem->GetEntity(m_pLaserEntityId);
if(!pEntity)
m_pLaserEntityId = 0;
}
if (!m_pLaserEntityId)
{
SEntitySpawnParams spawnParams;
spawnParams.pClass = gEnv->pEntitySystem->GetClassRegistry()->GetDefaultClass();
spawnParams.sName = "LAMLaser";
spawnParams.nFlags = (GetEntity()->GetFlags() | ENTITY_FLAG_NO_SAVE) & ~ENTITY_FLAG_CASTSHADOW;
IEntity *pNewEntity =gEnv->pEntitySystem->SpawnEntity(spawnParams);
//assert(pNewEntity && "Laser entity could no be spawned!!");
if(pNewEntity)
{
pNewEntity->FreeSlot(0);
pNewEntity->FreeSlot(1);
m_pLaserEntityId = pNewEntity->GetId();
if(IEntity* pEntity = GetEntity())
pEntity->AttachChild(pNewEntity);
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)pNewEntity->GetProxy(ENTITY_PROXY_RENDER);
IRenderNode * pRenderNode = pRenderProxy?pRenderProxy->GetRenderNode():NULL;
if(pRenderNode)
pRenderNode->SetRndFlags(ERF_RENDER_ALWAYS,true);
}
}
}