当前位置: 首页>>代码示例>>C++>>正文


C++ IRenderAuxGeom::DrawPolyline方法代码示例

本文整理汇总了C++中IRenderAuxGeom::DrawPolyline方法的典型用法代码示例。如果您正苦于以下问题:C++ IRenderAuxGeom::DrawPolyline方法的具体用法?C++ IRenderAuxGeom::DrawPolyline怎么用?C++ IRenderAuxGeom::DrawPolyline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRenderAuxGeom的用法示例。


在下文中一共展示了IRenderAuxGeom::DrawPolyline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IsTargetCloaked

//------------------------------------------------------------------------
//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;
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:54,代码来源:GunTurret.cpp


注:本文中的IRenderAuxGeom::DrawPolyline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。