本文整理汇总了C++中IRenderAuxGeom::GetRenderFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ IRenderAuxGeom::GetRenderFlags方法的具体用法?C++ IRenderAuxGeom::GetRenderFlags怎么用?C++ IRenderAuxGeom::GetRenderFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderAuxGeom
的用法示例。
在下文中一共展示了IRenderAuxGeom::GetRenderFlags方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void Draw()
{
IRenderAuxGeom* pRender = gEnv->pRenderer->GetIRenderAuxGeom();
SAuxGeomRenderFlags flags = pRender->GetRenderFlags();
SAuxGeomRenderFlags oldFlags = pRender->GetRenderFlags();
flags.SetDepthWriteFlag(e_DepthWriteOff);
flags.SetDepthTestFlag(e_DepthTestOff);
pRender->SetRenderFlags(flags);
m_timer += gEnv->pTimer->GetFrameTime();
if (m_timer>30.f) m_timer = 0.f;
float time = gEnv->pTimer->GetCurrTime();
float dt = (1.f/50.f);
Vec3 offset = Vec3(0.f, 0.f, 0.025f + 0.003f*sinf(8.f*m_timer));
Vec3 offset2 = Vec3(0.f, 0.f, 0.035f + 0.003f*sinf(5.f*m_timer));
ColorB desiredColour = ColorB(255,0,0,255); // Red
ColorB desiredVelColour = ColorB(255,(int)(128.f+127.f*sinf(8.f*m_timer)),0,255); // Yellow/Red
ColorB actualPosColour = ColorB(0,255,0,255); // Green
ColorB actualVelColour = ColorB(0,0,(int)(128.f+127.f*sinf(5.f*m_timer)),255); // blue/black
ColorB snapPosColour = ColorB(255,255,255,255); // White
ColorB lerpErrorColour = ColorB(255,0,0,255); // Red
// Draw the desired positions
for (unsigned int i=0; i<m_desired.size(); i++)
{
Desired &d = m_desired[i];
pRender->DrawSphere(d.pos + offset, 0.025f, desiredColour);
pRender->DrawLine(d.pos + offset, desiredVelColour, d.pos + offset + d.vel*dt, desiredVelColour);
}
if(g_pGameCVars->pl_debugInterpolation == 1) // Show entity position + velocity
{
for (unsigned int i=0; i<m_actual.size(); i++)
{
Actual &a = m_actual[i];
pRender->DrawSphere(a.pos + offset2, 0.025f, a.snapped ? snapPosColour : actualPosColour);
pRender->DrawLine(a.pos + offset2, actualVelColour, a.pos + offset2 + a.vel*dt, actualVelColour);
}
}
if(g_pGameCVars->pl_debugInterpolation == 2) // Show entity position + lerpError
{
for (unsigned int i=0; i<m_actual.size(); i++)
{
Actual &a = m_actual[i];
pRender->DrawSphere(a.pos + offset2, 0.025f, a.snapped ? snapPosColour : actualPosColour);
pRender->DrawLine(a.pos + offset2, lerpErrorColour, a.pos + offset2 + a.lerpError, lerpErrorColour);
}
}
pRender->SetRenderFlags(oldFlags);
}
示例2: SetDrawInFront
void CAIDebugRenderer::SetDrawInFront(bool bOn)
{
IRenderAuxGeom* pRenderAuxGeom = m_pRenderer->GetIRenderAuxGeom();
SAuxGeomRenderFlags flags = pRenderAuxGeom->GetRenderFlags();
flags.SetDrawInFrontMode(bOn ? e_DrawInFrontOn : e_DrawInFrontOff);
pRenderAuxGeom->SetRenderFlags(flags);
}
示例3: SetDepthWrite
void CAIDebugRenderer::SetDepthWrite(bool bOn)
{
IRenderAuxGeom* pRenderAuxGeom = m_pRenderer->GetIRenderAuxGeom();
SAuxGeomRenderFlags flags = pRenderAuxGeom->GetRenderFlags();
flags.SetDepthWriteFlag(bOn ? e_DepthWriteOn : e_DepthWriteOff);
pRenderAuxGeom->SetRenderFlags(flags);
}
示例4: SetBackFaceCulling
void CAIDebugRenderer::SetBackFaceCulling(bool bOn)
{
IRenderAuxGeom* pRenderAuxGeom = m_pRenderer->GetIRenderAuxGeom();
SAuxGeomRenderFlags flags = pRenderAuxGeom->GetRenderFlags();
flags.SetCullMode(bOn ? e_CullModeBack : e_CullModeNone);
pRenderAuxGeom->SetRenderFlags(flags);
}
示例5: SetAlphaBlended
void CAIDebugRenderer::SetAlphaBlended(bool bOn)
{
IRenderAuxGeom* pRenderAuxGeom = m_pRenderer->GetIRenderAuxGeom();
SAuxGeomRenderFlags flags = pRenderAuxGeom->GetRenderFlags();
flags.SetAlphaBlendMode(bOn ? e_AlphaBlended : e_AlphaNone);
pRenderAuxGeom->SetRenderFlags(flags);
}
示例6: Update
void SDebugCannonBallPenetration::Update(float frameTime)
{
IRenderAuxGeom* pRenderAux = gEnv->pRenderer->GetIRenderAuxGeom();
SAuxGeomRenderFlags oldFlags = pRenderAux->GetRenderFlags();
SAuxGeomRenderFlags newFlags = e_Def3DPublicRenderflags;
newFlags.SetAlphaBlendMode(e_AlphaBlended);
newFlags.SetDepthTestFlag(e_DepthTestOff);
newFlags.SetCullMode(e_CullModeNone);
pRenderAux->SetRenderFlags(newFlags);
const float baseDebugTimeOut = (g_pGameCVars->g_bulletPenetrationDebugTimeout > 0.0f) ? g_pGameCVars->g_bulletPenetrationDebugTimeout : DEFAULT_DEBUG_CannonBall_HIT_LIFETIME;
for (int i = 0; i < MAX_DEBUG_CannonBall_HITS; ++i)
{
SDebugCannonBallHit& currentHit = m_hitsList[i];
if (currentHit.lifeTime <= 0.0f)
{
continue;
}
currentHit.lifeTime -= frameTime;
//const float alpha = powf((currentHit.lifeTime / baseDebugTimeOut), 4.0f);
// avoid powf whenever possible, for such simple cases, can do with 2 muls
float alpha = (currentHit.lifeTime / baseDebugTimeOut);
alpha *= alpha;
alpha *= alpha;
const ColorB red(255, 0, 0, (uint8)(192 * alpha)), green(0, 255, 0, (uint8)(192 * alpha));
const ColorB& hitColor = currentHit.stoppedCannonBall ? red : green;
const Vec3 coneBase = currentHit.isBackFaceHit ? (currentHit.hitPosition + (currentHit.CannonBallDirection * 0.3f)) : (currentHit.hitPosition - (currentHit.CannonBallDirection * 0.2f)) ;
const Vec3 lineEnd = (coneBase - (currentHit.CannonBallDirection * 0.3f));
pRenderAux->DrawCone(coneBase, currentHit.CannonBallDirection, 0.12f, 0.2f, hitColor);
pRenderAux->DrawLine(coneBase, hitColor, lineEnd, hitColor, 3.0f);
const Vec3 baseText = (currentHit.isBackFaceHit) ? coneBase + (0.2f * currentHit.CannonBallDirection) : lineEnd - (0.3f * currentHit.CannonBallDirection);
const Vec3 textLineOffset(0.0f, 0.0f, 0.14f);
const float textColor[4] = {1.0f, 1.0f, 1.0f, alpha};
gEnv->pRenderer->DrawLabelEx(baseText - (textLineOffset * 2.0f), 1.25f, textColor, true, false, "Damage: %.1f", currentHit.damage);
gEnv->pRenderer->DrawLabelEx(baseText - (textLineOffset * 3.0f), 1.25f, textColor, true, false, "Pierceability: %d", currentHit.surfacePierceability);
gEnv->pRenderer->DrawLabelEx(baseText - (textLineOffset * 4.0f), 1.25f, textColor, true, false, "%s", GetPenetrationLevelByPierceability(currentHit.surfacePierceability));
gEnv->pRenderer->DrawLabelEx(baseText - (textLineOffset * 5.0f), 1.25f, textColor, true, false, currentHit.tooThick ? "Too thick!" : "------");
}
pRenderAux->SetRenderFlags(oldFlags);
}
示例7: Update
void CPlayerVisTableDebugDraw::Update()
{
const float currentTime = gEnv->pTimer->GetCurrTime();
const float maxDebugLifeTime = 1.0f;
IRenderAuxGeom* pRenderAux = gEnv->pRenderer->GetIRenderAuxGeom();
const ColorB visibleColor(0, 255, 0, 128);
const ColorB hiddenColor(255, 0, 0, 128);
const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
SAuxGeomRenderFlags oldRenderFlags = pRenderAux->GetRenderFlags();
SAuxGeomRenderFlags newRenderFlags = e_Def3DPublicRenderflags;
newRenderFlags.SetAlphaBlendMode(e_AlphaBlended);
newRenderFlags.SetDepthTestFlag(e_DepthTestOff);
newRenderFlags.SetCullMode(e_CullModeNone);
pRenderAux->SetRenderFlags(newRenderFlags);
TDebugTargets::iterator targetIt = m_debugTargets.begin();
while (targetIt != m_debugTargets.end())
{
SDebugInfo& targetInfo = *targetIt;
const float lastUpdateAge = (currentTime - targetInfo.m_lastUpdatedTime);
const bool remove = (lastUpdateAge > maxDebugLifeTime);
if (!remove)
{
IEntity* pTargetEntity = gEnv->pEntitySystem->GetEntity(targetInfo.m_targetId);
if (pTargetEntity)
{
const ColorB& color = targetInfo.m_visible ? visibleColor : hiddenColor;
const Vec3 worldRefPosition = pTargetEntity->GetWorldTM().TransformPoint(targetInfo.m_localTargetPos);
const Vec3 offset(0.0f, 0.0f, 0.4f);
pRenderAux->DrawCone(worldRefPosition + offset, -Vec3Constants<float>::fVec3_OneZ, 0.125f, offset.z, color);
gEnv->pRenderer->DrawLabelEx(worldRefPosition, 1.5f, white, true, false, "%.2f", lastUpdateAge);
}
++targetIt;
}
else
{
TDebugTargets::iterator nextElement = m_debugTargets.erase(targetIt);
targetIt = nextElement;
}
}
pRenderAux->SetRenderFlags(oldRenderFlags);
}
示例8: DebugDrawCone
int CScriptBind_Game::DebugDrawCone( IFunctionHandler *pH, float x, float y, float z, float radius, float height, int r, int g, int b, int a )
{
IRenderAuxGeom* pRenderAuxGeom = gEnv->pRenderer->GetIRenderAuxGeom();
if (pRenderAuxGeom)
{
SAuxGeomRenderFlags oldFlags = pRenderAuxGeom->GetRenderFlags();
SAuxGeomRenderFlags newFlags = oldFlags;
newFlags.SetCullMode(e_CullModeNone);
newFlags.SetAlphaBlendMode(e_AlphaBlended);
pRenderAuxGeom->SetRenderFlags(newFlags);
pRenderAuxGeom->DrawCone(Vec3(x,y,z), Vec3(0.f, 0.f, 1.f), radius, height, ColorB(r,g,b,a));
pRenderAuxGeom->SetRenderFlags(oldFlags);
}
return pH->EndFunction();
}
示例9: DebugDrawAABB
int CScriptBind_Game::DebugDrawAABB( IFunctionHandler *pH, float x, float y, float z, float x2, float y2, float z2, int r, int g, int b, int a )
{
IRenderAuxGeom* pRenderAuxGeom = gEnv->pRenderer->GetIRenderAuxGeom();
if (pRenderAuxGeom)
{
SAuxGeomRenderFlags oldFlags = pRenderAuxGeom->GetRenderFlags();
SAuxGeomRenderFlags newFlags = oldFlags;
newFlags.SetCullMode(e_CullModeNone);
newFlags.SetAlphaBlendMode(e_AlphaBlended);
pRenderAuxGeom->SetRenderFlags(newFlags);
AABB bbox(Vec3(x, y, z), Vec3(x2, y2, z2));
pRenderAuxGeom->DrawAABB(bbox, true, ColorB(r, g, b, a), eBBD_Faceted);
pRenderAuxGeom->SetRenderFlags(oldFlags);
}
return pH->EndFunction();
}
示例10: DebugDraw
void CAutoAimManager::DebugDraw()
{
IRenderAuxGeom* pRenderAux = gEnv->pRenderer->GetIRenderAuxGeom();
const int numAutoaimTargets = m_autoaimTargets.size();
const Vec3 viewPos = gEnv->pSystem->GetViewCamera().GetPosition();
SAuxGeomRenderFlags oldFlags = pRenderAux->GetRenderFlags();
SAuxGeomRenderFlags newFlags = e_Def3DPublicRenderflags;
newFlags.SetAlphaBlendMode(e_AlphaBlended);
newFlags.SetDepthTestFlag(e_DepthTestOff);
newFlags.SetCullMode(e_CullModeNone);
pRenderAux->SetRenderFlags(newFlags);
const ColorB enemyColor(255,0,0,128);
const ColorB friendlyColor(0,255,0,128);
const ColorB followColorInner(255,255,0,64);
const ColorB followColorOuter(255,255,0,0);
const ColorB snapColor(255,255,255,64);
for(int i = 0; i < numAutoaimTargets; i++)
{
const SAutoaimTarget& aaTarget = m_autoaimTargets[i];
Vec3 dirToTarget = aaTarget.primaryAimPosition - viewPos;
dirToTarget.NormalizeSafe();
const float snapRadius = aaTarget.HasFlagSet(eAATF_AIRadarTagged) ? aaTarget.snapRadiusTagged * g_pGameCVars->aim_assistSnapRadiusTaggedScale :
aaTarget.snapRadius * g_pGameCVars->aim_assistSnapRadiusScale;
pRenderAux->DrawSphere(aaTarget.primaryAimPosition, aaTarget.innerRadius, aaTarget.HasFlagSet(eAATF_AIHostile) ? enemyColor : friendlyColor);
pRenderAux->DrawSphere(aaTarget.secondaryAimPosition, 0.2f, aaTarget.HasFlagSet(eAATF_AIHostile) ? enemyColor : friendlyColor);
DrawDisc(aaTarget.primaryAimPosition, dirToTarget, aaTarget.innerRadius, aaTarget.outerRadius, followColorInner, followColorOuter);
DrawDisc(aaTarget.primaryAimPosition, dirToTarget, aaTarget.outerRadius, snapRadius, followColorOuter, snapColor);
}
pRenderAux->SetRenderFlags(oldFlags);
const float white[4] = {1.0f, 1.0f, 1.0f, 0.75f};
gEnv->pRenderer->Draw2dLabel(50.0f, 50.0f, 1.5f, white, false, "Number of targets: %d", numAutoaimTargets);
}
示例11: DebugDrawCylinder
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::DebugDrawCylinder(SHoldEntityDetails *pDetails)
{
// Draw debug cylinder
if(g_pGameCVars->g_holdObjectiveDebug == eHOB_Debug_Draw_Sphere)
{
IEntity *pHoldEntity = gEnv->pEntitySystem->GetEntity(pDetails->m_id);
if (pHoldEntity)
{
IRenderAuxGeom* pAuxRenderer = gEnv->pRenderer->GetIRenderAuxGeom();
SAuxGeomRenderFlags renderFlags = pAuxRenderer->GetRenderFlags();
renderFlags.SetAlphaBlendMode(e_AlphaBlended);
pAuxRenderer->SetRenderFlags(renderFlags);
pAuxRenderer->DrawCylinder( pHoldEntity->GetPos()+Vec3(0.f,0.f,pDetails->m_controlOffsetZ+(pDetails->m_controlHeight*0.5f)),
Vec3(0.0f,0.0f,1.0f),
pDetails->m_controlRadius,
pDetails->m_controlHeight,
ColorB(255,255,0,128));
}
}
}
示例12: Update
void CVehiclePartSuspensionPart::Update(const float frameTime)
{
inherited::Update(frameTime);
const Matrix34& parentTm = m_pParentPart->GetLocalTM(false);
const Matrix34& targetTm = m_targetPart->GetLocalTM(false);
Vec3 pos = parentTm * m_pos0;
Vec3 targetPos = (m_ikFlags&k_flagIgnoreTargetRotation) ? (targetTm.GetColumn3() + m_targetOffset) : (targetTm * m_targetOffset);
Vec3 dir = targetPos - pos;
float length = dir.GetLength();
if (length > 1e-2f)
{
Matrix33 rot = Matrix33::CreateRotationV0V1(m_direction0, dir*(1.f/length));
Matrix33 partRot = rot*Matrix33(m_initialRot);
if (m_mode==k_modeRotate || m_mode==k_modeSnapToEF)
{
if (m_mode==k_modeSnapToEF)
{
pos = targetPos - rot * m_direction0;
}
Matrix34 tm(partRot, pos);
SetLocalTM(tm);
}
else if (m_mode==k_modeStretch)
{
const float scale = length * m_invLength0;
const Vec3 z = m_direction0;
const Vec3 sz = m_direction0*(scale-1.f);
Matrix33 scaleM;
scaleM.m00 = 1.f+sz.x*z.x; scaleM.m01 = sz.y*z.x ; scaleM.m02 = sz.z*z.x;
scaleM.m10 = sz.x*z.y ; scaleM.m11 = 1.f+sz.y*z.y; scaleM.m12 = sz.z*z.y;
scaleM.m20 = sz.x*z.z ; scaleM.m21 = sz.y*z.z ; scaleM.m22 = 1.f+sz.z*z.z;
Matrix34 tm(partRot * scaleM, pos);
SetLocalTM(tm);
}
}
#if !defined(_RELEASE)
if (VehicleCVars().v_debugSuspensionIK)
{
IRenderAuxGeom* pAuxGeom = gEnv->pRenderer->GetIRenderAuxGeom();
SAuxGeomRenderFlags flags = pAuxGeom->GetRenderFlags();
SAuxGeomRenderFlags oldFlags = pAuxGeom->GetRenderFlags();
flags.SetDepthWriteFlag(e_DepthWriteOff);
flags.SetDepthTestFlag(e_DepthTestOff);
pAuxGeom->SetRenderFlags(flags);
ColorB colRed(255,0,0,255);
ColorB colBlue(0,0,255,255);
ColorB colWhite(255,255,255,255);
ColorB colGreen(0,255,0,255);
pos = m_pVehicle->GetEntity()->GetWorldTM() * pos;
targetPos = m_pVehicle->GetEntity()->GetWorldTM() * targetPos;
pAuxGeom->DrawSphere(pos, 0.02f, colGreen);
pAuxGeom->DrawSphere(targetPos, 0.02f, colBlue);
pAuxGeom->DrawLine(pos, colWhite, targetPos, colWhite);
}
#endif
}