本文整理汇总了C++中IEntityRenderProxy::SetOpacity方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntityRenderProxy::SetOpacity方法的具体用法?C++ IEntityRenderProxy::SetOpacity怎么用?C++ IEntityRenderProxy::SetOpacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityRenderProxy
的用法示例。
在下文中一共展示了IEntityRenderProxy::SetOpacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: Update
//------------------------------------------------------------------------
void CTracerManager::Update(float frameTime)
{
CryPrefetch(m_tracerPool);
const CCamera& viewCamera = gEnv->pSystem->GetViewCamera();
const Vec3 cameraPosition = viewCamera.GetPosition();
const float viewCameraFovScale = viewCamera.GetFov() / DEG2RAD(g_pGame->GetFOV());
const int kNumActiveTracers = m_numActiveTracers;
for(int i = 0; i < kNumActiveTracers;)
{
int nextTracerIndex = i + 1;
CTracer& tracer = m_tracerPool[i];
CryPrefetch(&m_tracerPool[nextTracerIndex]);
//Update
const bool stillMoving = tracer.Update(frameTime, cameraPosition, viewCameraFovScale);
//Is it worth putting this in another loop for instruction cache coherency? Profile when PS3 is up and running - Rich S
if(stillMoving || (tracer.m_fadeOutTime > 0.f))
{
tracer.m_tracerFlags |= kTracerFlag_active;
if (!stillMoving)
{
tracer.m_fadeOutTime -= frameTime;
if (tracer.m_effectSlot > -1)
{
if (IEntity *pEntity = gEnv->pEntitySystem->GetEntity(tracer.m_entityId))
{
IParticleEmitter * emitter = pEntity->GetParticleEmitter(tracer.m_effectSlot);
if (emitter)
{
emitter->Activate(false);
}
if (tracer.m_tracerFlags & kTracerFlag_useGeometry)
{
pEntity->SetSlotFlags(tracer.m_geometrySlot, pEntity->GetSlotFlags(tracer.m_geometrySlot) &~ (ENTITY_SLOT_RENDER|ENTITY_SLOT_RENDER_NEAREST));
}
tracer.m_effectSlot = -1;
}
}
if(tracer.m_tracerFlags & kTracerFlag_useGeometry)
{
// Fade out geometry
if((tracer.m_fadeOutTime < tracer.m_startFadeOutTime) && (tracer.m_startFadeOutTime > 0.0f))
{
if (IEntity *pEntity = gEnv->pEntitySystem->GetEntity(tracer.m_entityId))
{
IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)pEntity->GetProxy(ENTITY_PROXY_RENDER);
pRenderProxy->SetOpacity(max((tracer.m_fadeOutTime / tracer.m_startFadeOutTime) * tracer.m_geometryOpacity, 0.0f));
}
}
}
}
}
else
{
tracer.m_tracerFlags &= ~kTracerFlag_active;
tracer.m_boundToBulletId = 0;
}
i = nextTracerIndex;
}
//This is where we clear out the inactive tracers, so the counter isn't const
int numActiveTracers = kNumActiveTracers;
CWeaponSystem* pWeaponSystem = g_pGame->GetWeaponSystem();
for(int i = kNumActiveTracers - 1; i >= 0;)
{
int nextIndex = i - 1;
CTracer& tracer = m_tracerPool[i];
CryPrefetch(&m_tracerPool[nextIndex]);
if(!(tracer.m_tracerFlags & kTracerFlag_active))
{
if (IEntity *pEntity=gEnv->pEntitySystem->GetEntity(tracer.m_entityId))
{
pEntity->Hide(true);
pEntity->FreeSlot(TRACER_GEOM_SLOT);
pEntity->FreeSlot(TRACER_FX_SLOT);
}
//Switch the inactive tracer so it's at the end of the array;
const int lastTracer = numActiveTracers - 1;
static CTracer temp;
temp = tracer;
numActiveTracers = lastTracer;
tracer = m_tracerPool[lastTracer];
m_tracerPool[lastTracer] = temp;
//Re-bind index to the corresponding bullet
//.........这里部分代码省略.........