本文整理汇总了C++中IRenderAuxGeom::DrawCylinder方法的典型用法代码示例。如果您正苦于以下问题:C++ IRenderAuxGeom::DrawCylinder方法的具体用法?C++ IRenderAuxGeom::DrawCylinder怎么用?C++ IRenderAuxGeom::DrawCylinder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderAuxGeom
的用法示例。
在下文中一共展示了IRenderAuxGeom::DrawCylinder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DebugDrawCylinder
int CScriptBind_Game::DebugDrawCylinder( 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->DrawCylinder(Vec3(x, y, z), Vec3(0.f, 0.f, 1.f), radius, height, ColorB(r, g, b, a));
pRenderAuxGeom->SetRenderFlags(oldFlags);
}
return pH->EndFunction();
}
示例2: 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));
}
}
}
示例3: Update
//.........这里部分代码省略.........
}
if(inside)
{
enemyDir.NormalizeSafe();
checkDir.NormalizeSafe();
float dotProd = checkDir.Dot(m_triggerDirection);
if(debug)
{
pRAG->DrawLine(GetEntity()->GetPos(), ColorF(1,0,0,1), GetEntity()->GetPos() + Matrix33::CreateRotationZ(m_triggerAngle/2.0f)*m_triggerDirection*m_triggerRadius, ColorF(1,0,0,1), 5.0f);
pRAG->DrawLine(GetEntity()->GetPos(), ColorF(1,0,0,1), GetEntity()->GetPos() + Matrix33::CreateRotationZ(-m_triggerAngle/2.0f)*m_triggerDirection*m_triggerRadius, ColorF(1,0,0,1), 5.0f);
ColorF clr;
clr.a = 0.3f;
clr.b = 0.4f;
clr.g = 0.1f;
clr.r = 1.0f;
pRAG->DrawLine(GetEntity()->GetPos(), clr, GetEntity()->GetPos() + (enemyDir * m_triggerRadius), clr, 5.0f);
}
if(dotProd > cry_cosf(m_triggerAngle/2.0f))
{
static const int objTypes = ent_all&(~ent_terrain);
static const unsigned int flags = rwi_stop_at_pierceable|rwi_colltype_any;
ray_hit hit;
int col = gEnv->pPhysicalWorld->RayWorldIntersection(GetEntity()->GetPos(), (enemyDir * m_triggerRadius * 1.5f), objTypes, flags, &hit, 1, GetEntity()->GetPhysics());
bool bang = false;
if (!col)
bang = true;
else if (entityBBox.IsContainPoint(hit.pt))
bang = true;
else if (hit.pt.GetSquaredDistance(GetEntity()->GetWorldPos()) >= distanceSq)
bang = true;
if (bang)
{
// pass in the explosion normal, which is -m_triggerDirection
Explode(true, false, Vec3(0,0,0), -m_triggerDirection);
if(debug)
{
ColorF clr;
clr.a = 0.3f;
clr.g = 0.1f;
clr.r = 1.0f;
clr.b = 1.0f;
pRAG->DrawLine(GetEntity()->GetPos(), clr, GetEntity()->GetPos() + (enemyDir * m_triggerRadius), clr, 5.0f);
}
}
}
}
}
}
}
}
}
else
{
m_timeToArm -= gEnv->pTimer->GetFrameTime();
if(m_timeToArm <= 0.0f)
{
m_armed = true;
IEntityTriggerProxy *pTriggerProxy = (IEntityTriggerProxy*)(GetEntity()->GetProxy(ENTITY_PROXY_TRIGGER));
if (!pTriggerProxy)
{
GetEntity()->CreateProxy(ENTITY_PROXY_TRIGGER);
pTriggerProxy = (IEntityTriggerProxy*)GetEntity()->GetProxy(ENTITY_PROXY_TRIGGER);
}
if(pTriggerProxy)
{
// create a trigger volume a couple of metres bigger than we need, to ensure we catch vehicles.
// Checks above will still make sure the entity is within the radius before detonating though.
float radius = m_triggerRadius + 2.0f;
AABB boundingBox = AABB(Vec3(-radius,-radius,-radius), Vec3(radius,radius,radius));
pTriggerProxy->SetTriggerBounds(boundingBox);
}
}
}
}
if(debug && m_armed)
{
IRenderAuxGeom * pRAG = gEnv->pRenderer->GetIRenderAuxGeom();
ColorF clr;
clr.a = 0.3f;
clr.b = 0.4f;
clr.g = 0.1f;
clr.r = 1.0f;
pRAG->SetRenderFlags( e_Mode3D | e_AlphaBlended | e_DrawInFrontOff | e_FillModeSolid | e_CullModeNone );
pRAG->DrawCylinder(GetEntity()->GetPos(), Vec3(0, 0, 1), m_triggerRadius, m_triggerRadius * 2.0f, clr);
Vec3 size(m_triggerRadius + 2.0f, m_triggerRadius + 2.0f, m_triggerRadius + 2.0f);
AABB box(GetEntity()->GetPos() - size, GetEntity()->GetPos() + size);
pRAG->DrawAABB(box, false, ColorF(0.1f, 0.1f, 0.1f, 0.1f), eBBD_Faceted);
pRAG->DrawLine(GetEntity()->GetPos(), clr, GetEntity()->GetPos() + m_triggerDirection, clr, 5.0f);
}
}
示例4: Update
void CPersistantDebug::Update( float frameTime )
{
if (m_objects.empty())
return;
IRenderAuxGeom * pAux = gEnv->pRenderer->GetIRenderAuxGeom();
static const int flags3D = e_Mode3D | e_AlphaBlended | e_DrawInFrontOff | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn;
static const int flags2D = e_Mode2D | e_AlphaBlended;
std::vector<ListObj::iterator> toClear;
std::vector<MapListObj::iterator> toClearMap;
for (MapListObj::iterator iterMap = m_objects.begin(); iterMap != m_objects.end(); ++iterMap)
{
toClear.resize(0);
for (ListObj::iterator iterList = iterMap->second.begin(); iterList != iterMap->second.end(); ++iterList)
{
iterList->timeRemaining -= frameTime;
if (iterList->timeRemaining <= 0.0f && !(iterList->obj == eOT_EntityTag && iterList->columns.size() > 1))
toClear.push_back(iterList);
else
{
ColorF clr = iterList->clr;
clr.a *= iterList->timeRemaining / iterList->totalTime;
switch (iterList->obj)
{
case eOT_Sphere:
pAux->SetRenderFlags( flags3D );
pAux->DrawSphere( iterList->pos, iterList->radius, clr );
break;
case eOT_Quat:
pAux->SetRenderFlags( flags3D );
{
float r = iterList->radius;
Vec3 x = r * iterList->q.GetColumn0();
Vec3 y = r * iterList->q.GetColumn1();
Vec3 z = r * iterList->q.GetColumn2();
Vec3 p = iterList->pos;
OBB obb = OBB::CreateOBB( Matrix33::CreateIdentity(), Vec3(0.05f,0.05f,0.05f), ZERO );
pAux->DrawOBB( obb, p, false, clr, eBBD_Extremes_Color_Encoded );
pAux->DrawLine( p, ColorF(1,0,0,clr.a), p+x, ColorF(1,0,0,clr.a) );
pAux->DrawLine( p, ColorF(0,1,0,clr.a), p+y, ColorF(0,1,0,clr.a) );
pAux->DrawLine( p, ColorF(0,0,1,clr.a), p+z, ColorF(0,0,1,clr.a) );
}
break;
case eOT_Arrow:
pAux->SetRenderFlags( flags3D );
pAux->DrawLine( iterList->pos - iterList->dir * iterList->radius, clr, iterList->pos + iterList->dir * iterList->radius, clr );
pAux->DrawCone( iterList->pos + iterList->dir * iterList->radius, iterList->dir, 0.1f * iterList->radius, 0.3f * iterList->radius, clr );
break;
case eOT_Line:
pAux->SetRenderFlags( flags3D );
pAux->DrawLine( iterList->pos, clr, iterList->pos + iterList->dir, clr );
break;
case eOT_Cone:
pAux->SetRenderFlags( flags3D );
pAux->DrawCone( iterList->pos, iterList->dir, iterList->radius, iterList->radius2, clr );
break;
case eOT_Cylinder:
pAux->SetRenderFlags( flags3D );
pAux->DrawCylinder( iterList->pos, iterList->dir, iterList->radius, iterList->radius2, clr );
break;
case eOT_AABB:
pAux->SetRenderFlags( flags3D );
pAux->DrawAABB( AABB(iterList->pos,iterList->dir), Matrix34(IDENTITY), false, clr, eBBD_Faceted );
break;
case eOT_Line2D:
pAux->SetRenderFlags( flags2D );
pAux->DrawLine( iterList->pos, clr, iterList->dir, clr );
break;
case eOT_Text:
{
float clrAry[4] = {clr.r, clr.g, clr.b, clr.a};
gEnv->pRenderer->Draw2dLabel( iterList->pos.x, iterList->pos.y, iterList->radius, clrAry, false, "%s", iterList->text.c_str() );
}
break;
case eOT_Disc:
{
pAux->SetRenderFlags( flags3D );
vtx_idx indTriQuad[ 6 ] =
{
0, 2, 1,
0, 3, 2
};
vtx_idx indTriTri[ 3 ] =
{
0, 1, 2
};
int steps = (int)(10 * iterList->radius2);
steps = std::max(steps, 10);
float angStep = gf_PI2 / steps;
for (int i=0; i<steps; i++)
{
float a0 = angStep*i;
float a1 = angStep*(i+1);
float c0 = cosf( a0 );
float c1 = cosf( a1 );
float s0 = sinf( a0 );
float s1 = sinf( a1 );
Vec3 pts[4];
//.........这里部分代码省略.........