本文整理汇总了C++中IRenderAuxGeom类的典型用法代码示例。如果您正苦于以下问题:C++ IRenderAuxGeom类的具体用法?C++ IRenderAuxGeom怎么用?C++ IRenderAuxGeom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IRenderAuxGeom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DebugDraw
void CAICorpseManager::DebugDraw()
{
if(g_pGameCVars->g_aiCorpses_DebugDraw == 0)
return;
IRenderAuxGeom* pRenderAux = gEnv->pRenderer->GetIRenderAuxGeom();
gEnv->pRenderer->Draw2dLabel( 50.0f, 50.0f, 1.5f, Col_White, false, "Corpse count %" PRISIZE_T " - Max %d", m_corpsesArray.size(), m_maxCorpses );
for(size_t i = 0; i < m_corpsesArray.size(); ++i)
{
CorpseInfo& corpse = m_corpsesArray[i];
CAICorpse* pCorpse = corpse.GetCorpse();
if(pCorpse != NULL)
{
AABB corpseBbox;
pCorpse->GetEntity()->GetWorldBounds(corpseBbox);
const Vec3 refPosition = corpseBbox.IsEmpty() ? pCorpse->GetEntity()->GetWorldPos() : corpseBbox.GetCenter();
gEnv->pRenderer->DrawLabel( refPosition, 1.5f, "%s\nPriority %d\n%s\n%s",
pCorpse->GetEntity()->GetName(), pCorpse->GetPriority(),
corpse.flags.AreAnyFlagsActive( CorpseInfo::eFlag_FarAway ) ? "Far away, remove when not visible" : "Not far away",
corpse.flags.AreAllFlagsActive( CorpseInfo::eFlag_PhysicsDisabled) ? "Physics disabled" : "Physics enabled" );
pRenderAux->DrawCone( refPosition + Vec3(0.0f, 0.0f, 1.5f), Vec3(0.0f, 0.0f, -1.0f), 0.3f, 0.8f, Col_Red );
}
}
}
示例2: 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);
}
示例3: 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);
}
示例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: 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);
}
示例6: GetEntity
void CGameVolume_Water::DebugDrawVolume()
{
IGameVolumes::VolumeInfo volumeInfo;
if (GetVolumeInfoForEntity(GetEntityId(), volumeInfo) == false)
return;
if (volumeInfo.verticesCount < 3)
return;
const Matrix34 worldTM = GetEntity()->GetWorldTM();
const Vec3 depthOffset = worldTM.GetColumn2().GetNormalized() * - m_volumeDepth;
IRenderAuxGeom* pRenderAux = gEnv->pRenderer->GetIRenderAuxGeom();
for (uint32 i = 0; i < volumeInfo.verticesCount - 1; ++i)
{
const Vec3 point1 = worldTM.TransformPoint(volumeInfo.pVertices[i]);
const Vec3 point2 = worldTM.TransformPoint(volumeInfo.pVertices[i + 1]);
pRenderAux->DrawLine( point1, Col_SlateBlue, point1 + depthOffset, Col_SlateBlue, 2.0f );
pRenderAux->DrawLine( point1 + depthOffset, Col_SlateBlue, point2 + depthOffset, Col_SlateBlue, 2.0f );
}
const Vec3 firstPoint = worldTM.TransformPoint(volumeInfo.pVertices[0]);
const Vec3 lastPoint = worldTM.TransformPoint(volumeInfo.pVertices[volumeInfo.verticesCount - 1]);
pRenderAux->DrawLine( lastPoint, Col_SlateBlue, lastPoint + depthOffset, Col_SlateBlue, 2.0f );
pRenderAux->DrawLine( lastPoint + depthOffset, Col_SlateBlue, firstPoint + depthOffset, Col_SlateBlue, 2.0f );
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:28,代码来源:GameVolume_Water.cpp
示例7: OnUpdate
void OnUpdate( SActivationInfo* pActInfo )
{
const Vec3 positionOffsetLocal = GetPortVec3( pActInfo, PORT_IN_POSITION_OFFSET_LOCAL );
const float maxDistance = max( 0.f, GetPortFloat( pActInfo, PORT_IN_MAX_LENGTH ) );
const CCamera& camera = GetISystem()->GetViewCamera();
const Vec3 cameraDirection = camera.GetViewdir();
const Vec3 cameraPositionWorld = camera.GetPosition();
const Matrix33 cameraOrientation = Matrix33::CreateRotationVDir( cameraDirection );
const Vec3 positionOffsetWorld = cameraOrientation * positionOffsetLocal;
const Vec3 rayOriginWorld = cameraPositionWorld + positionOffsetWorld;
const Vec3 raySegment = cameraDirection * maxDistance;
IPhysicalWorld* pWorld = gEnv->pPhysicalWorld;
const int objectTypes = ent_all;
const unsigned int raycastFlags = rwi_stop_at_pierceable | rwi_colltype_any;
ray_hit hit;
const int hitCount = pWorld->RayWorldIntersection( rayOriginWorld, raySegment, objectTypes, raycastFlags, &hit, 1 );
float hitDistance = maxDistance;
if ( 0 < hitCount )
{
hitDistance = hit.dist;
}
const float timeDelta = 0.1f;
const float smoothTime = max( 0.f, GetPortFloat( pActInfo, PORT_IN_SMOOTH_TIME ) );
SmoothCD( m_smoothedHitDistance, m_hitDistanceChangeRate, timeDelta, hitDistance, smoothTime );
ActivateOutput( pActInfo, PORT_OUT_FOCUS_DISTANCE, m_smoothedHitDistance );
const float focusRangeFactor = max( 0.f, GetPortFloat( pActInfo, PORT_IN_FOCUS_RANGE_FACTOR ) );
const float focusRange = focusRangeFactor * m_smoothedHitDistance;
ActivateOutput( pActInfo, PORT_OUT_FOCUS_RANGE, focusRange );
const bool drawDebugInfo = GetPortBool( pActInfo, PORT_IN_DEBUG_ENABLED );
if ( ! drawDebugInfo )
{
return;
}
IRenderer* pRenderer = gEnv->pRenderer;
IRenderAuxGeom* pRenderAuxGeom = pRenderer->GetIRenderAuxGeom();
ColorB rayColor = ( 0 < hitCount ) ? ColorB( 255, 255, 0 ) : ColorB( 255, 0, 0 );
pRenderAuxGeom->DrawSphere( hit.pt, 0.1f, rayColor );
pRenderAuxGeom->DrawLine( rayOriginWorld, rayColor, hit.pt, rayColor );
}
示例8: GetEntity
//------------------------------------------------------------------------
//chr safe to remove?
bool CGunTurret::IsTargetCloaked(IActor *pActor) const
{
// cloak check
if(m_turretparams.find_cloaked)
return false;
bool cloaked = false;
// if destinationId assigned, target can always be found
if(m_destinationId && pActor->GetEntityId() == m_destinationId)
return false;
if(cloaked && m_turretparams.light_fov != 0.f)
{
// if cloaked, target can only be found with searchlight
// check if target inside light cone
const Matrix34 &weaponTM = GetEntity()->GetSlotWorldTM(eIGS_ThirdPerson);
Vec3 wpos(weaponTM.GetTranslation());
Vec3 wdir(weaponTM.GetColumn1());
Vec3 tpos(GetTargetPos(pActor->GetEntity()));
float epsilon = 0.8f;
Quat rot = Quat::CreateRotationAA(epsilon*0.5f*DEG2RAD(m_turretparams.light_fov), weaponTM.GetColumn2());
Vec3 a = wpos + m_turretparams.mg_range*(wdir*rot);
Vec3 b = wpos + m_turretparams.mg_range*(wdir*rot.GetInverted());
bool inside = Overlap::PointInTriangle(tpos, wpos, a, b, weaponTM.GetColumn2());
if(inside)
{
rot = Quat::CreateRotationAA(0.5f*DEG2RAD(m_turretparams.light_fov), weaponTM.GetColumn0());
a = wpos + m_turretparams.mg_range*(wdir*rot);
b = wpos + m_turretparams.mg_range*(wdir*rot.GetInverted());
inside = Overlap::PointInTriangle(tpos, wpos, a, b, weaponTM.GetColumn0());
}
cloaked = !inside;
if(g_pGameCVars->i_debug_turrets == eGTD_Search)
{
IRenderAuxGeom *pGeom = gEnv->pRenderer->GetIRenderAuxGeom();
pGeom->SetRenderFlags(e_Def3DPublicRenderflags);
float color[] = {1,1,1,1};
Vec3 points[] = {wpos, a, b};
pGeom->DrawPolyline(points, 3, true, ColorB(0,255,0,255));
if(inside)
gEnv->pRenderer->Draw2dLabel(200,200,1.4f,color,false,"target inside cone");
}
}
return cloaked;
}
示例9: DrawImpulse
//------------------------------------------------------------------------
void CVehicleMovementStdBoat::DrawImpulse(const pe_action_impulse& action, const Vec3& offset, float scale, const ColorB& col)
{
if (!is_unused(action.impulse) && action.impulse.len2()>0)
{
IRenderAuxGeom* pGeom = gEnv->pRenderer->GetIRenderAuxGeom();
Vec3 start = action.point + offset;
Vec3 end = start - (action.impulse*scale/m_pVehicle->GetMass());
Vec3 dir = (start-end).GetNormalizedSafe();
pGeom->DrawCone(start-1.f*dir, dir, 0.5f, 1.f, col);
pGeom->DrawLine(start, col, end, col);
pGeom->DrawSphere(end, 0.25f, col);
}
}
示例10: DebugDrawLocation
void DebugDrawLocation(const QuatT &location, ColorB colorPos, ColorB colorX, ColorB colorY, ColorB colorZ)
{
IRenderAuxGeom* pAuxGeom = gEnv->pRenderer->GetIRenderAuxGeom();
const float thickness = 7.0f;
const Vec3 pushUp(0.0f, 0.03f, 0.0f);
pAuxGeom->DrawLine(location.t + pushUp, colorX, location.t + pushUp + location.q.GetColumn0(), colorX, thickness);
pAuxGeom->DrawLine(location.t + pushUp, colorY, location.t + pushUp + location.q.GetColumn1(), colorY, thickness);
pAuxGeom->DrawLine(location.t + pushUp, colorZ, location.t + pushUp + location.q.GetColumn2(), colorZ, thickness);
const float radius = 0.06f;
pAuxGeom->DrawSphere(location.t + pushUp, radius, colorPos);
}
示例11: 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);
}
示例12: min
//------------------------------------------------------------------------
void CVehicleMovementTank::Update(const float deltaTime)
{
CVehicleMovementStdWheeled::Update(deltaTime);
#if ENABLE_VEHICLE_DEBUG
if (IsProfilingMovement())
{
if (m_steeringImpulseMin > 0.f && m_wheelContactsLeft != 0 && m_wheelContactsRight != 0)
{
const Matrix34& worldTM = m_pVehicle->GetEntity()->GetWorldTM();
Vec3 localVel = worldTM.GetInvertedFast().TransformVector(m_statusDyn.v);
Vec3 localW = worldTM.GetInvertedFast().TransformVector(m_statusDyn.w);
float speed = m_statusDyn.v.len();
float speedRatio = min(1.f, speed/m_maxSpeed);
const float maxW = 0.3f*gf_PI;
float steer = abs(m_currSteer)>0.001f ? m_currSteer : 0.f;
float desired = steer * maxW;
float curr = -localW.z;
float err = desired - curr; // err>0 means correction to right
Limit(err, -maxW, maxW);
if (abs(err) > 0.01f)
{
float amount = m_steeringImpulseMin + speedRatio*(m_steeringImpulseMax-m_steeringImpulseMin);
float corr = -err * amount * m_statusDyn.mass * deltaTime;
pe_action_impulse imp;
imp.iApplyTime = 1;
imp.angImpulse = worldTM.GetColumn2() * corr;
float color[] = {1,1,1,1};
gEnv->pRenderer->Draw2dLabel(300,300,1.5f,color,false,"err: %.2f ", err);
gEnv->pRenderer->Draw2dLabel(300,320,1.5f,color,false,"corr: %.3f", corr/m_statusDyn.mass);
IRenderAuxGeom* pGeom = gEnv->pRenderer->GetIRenderAuxGeom();
float len = 4.f * imp.angImpulse.len() / deltaTime / m_statusDyn.mass;
Vec3 dir = (float)-sgn(corr) * worldTM.GetColumn0(); //imp.angImpulse.GetNormalized();
pGeom->DrawCone(worldTM.GetTranslation()+Vec3(0,0,5)-(dir*len), dir, 0.5f, len, ColorB(128,0,0,255));
}
}
}
DebugDrawMovement(deltaTime);
#endif
}
开发者ID:daujiv,项目名称:ParentChild-Relationship-PlayerInteraction-CryEngine-Cplusplus,代码行数:48,代码来源:VehicleMovementTank.cpp
示例13: 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();
}
示例14: 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();
}
示例15: 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));
}
}
}