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


C++ SAuxGeomRenderFlags类代码示例

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


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

示例1: 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);
}
开发者ID:aronarts,项目名称:FireNET,代码行数:7,代码来源:AIDebugRenderer.cpp

示例2: DrawSmokeDebugSpheres

void CSmokeManager::DrawSmokeDebugSpheres()
{
    if(g_pGameCVars->g_debugSmokeGrenades)
        {
            SAuxGeomRenderFlags oldFlags = gEnv->pRenderer->GetIRenderAuxGeom()->GetRenderFlags();
            SAuxGeomRenderFlags newFlags = oldFlags;
            newFlags.SetAlphaBlendMode(e_AlphaBlended);

            gEnv->pRenderer->GetIRenderAuxGeom()->SetRenderFlags(newFlags);

            const int kNumActiveSmokeInstances = m_numActiveSmokeInstances;

            ColorB smokeDebugColor(255, 0, 0, 70);

            for(int i = 0; i < kNumActiveSmokeInstances; i++)
                {
                    //DRAW SPHERE
                    SSmokeInstance& smokeInstance = m_smokeInstances[i];
                    gEnv->pRenderer->GetIRenderAuxGeom()->DrawSphere(smokeInstance.vPositon, smokeInstance.fCurrentRadius, smokeDebugColor);
                }

            gEnv->pRenderer->GetIRenderAuxGeom()->SetRenderFlags(oldFlags);

            // Draw blur amount to screen
            ColorF textCol(0.0f,1.0f,0.0f,1.0f);
            gEnv->pRenderer->Draw2dLabel(50.0f,20.0f,1.4f,&textCol.r,false,"Client Blur Amount: %f",m_clientBlurAmount);
        }
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:28,代码来源:SmokeManager.cpp

示例3: 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);
}
开发者ID:aronarts,项目名称:FireNET,代码行数:7,代码来源:AIDebugRenderer.cpp

示例4: 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);
}
开发者ID:aronarts,项目名称:FireNET,代码行数:7,代码来源:AIDebugRenderer.cpp

示例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);
}
开发者ID:aronarts,项目名称:FireNET,代码行数:7,代码来源:AIDebugRenderer.cpp

示例6: 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);
	}
开发者ID:aronarts,项目名称:FireNET,代码行数:53,代码来源:NetPlayerInput.cpp

示例7: 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);
}
开发者ID:PiratesAhoy,项目名称:HeartsOfOak-Core,代码行数:50,代码来源:CannonBall.cpp

示例8: visibleColor

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);
}
开发者ID:danielasun,项目名称:dbho-GameSDK,代码行数:48,代码来源:PlayerVisTable.cpp

示例9: 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();
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:18,代码来源:ScriptBind_Game.cpp

示例10: 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();
}
开发者ID:Kufusonic,项目名称:Work-in-Progress-Sonic-Fangame,代码行数:19,代码来源:ScriptBind_Game.cpp

示例11: 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);
}
开发者ID:Xydrel,项目名称:Infected,代码行数:41,代码来源:AutoAimManager.cpp

示例12: 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));
		}
	}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:23,代码来源:GameRulesHoldObjectiveBase.cpp

示例13: GetCloseCombatSnapTargetDirection

Vec3 CPlayerRotation::GetCloseCombatSnapTargetDirection( const Vec3& aimPos, const Vec3& aimDirection, const SAutoaimTarget& aaTarget ) const
{
	Lineseg targetLine;
	targetLine.start = aaTarget.secondaryAimPosition;
	targetLine.end = aaTarget.primaryAimPosition;

	Lineseg aimLine;
	aimLine.start = aimPos;
	aimLine.end = aimPos + (aimDirection * g_pGameCVars->aim_assistMaxDistance);

	float t0 = -1.0f, t1 = -1.0f;
	Distance::Lineseg_LinesegSq<float>(targetLine, aimLine, &t0, &t1);

	if (t0 >= 0.0f)
	{

		const Vec3 snapTarget = ((targetLine.start) + ((targetLine.end - targetLine.start) * t0));

#if DBG_AUTO_AIM
		SAuxGeomRenderFlags oldFlags = gEnv->pRenderer->GetIRenderAuxGeom()->GetRenderFlags();
		SAuxGeomRenderFlags newFlags = e_Def3DPublicRenderflags;
		newFlags.SetAlphaBlendMode(e_AlphaBlended);
		newFlags.SetDepthTestFlag(e_DepthTestOff);
		newFlags.SetCullMode(e_CullModeNone); 
		gEnv->pRenderer->GetIRenderAuxGeom()->SetRenderFlags(newFlags);

		gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine(targetLine.start, ColorB(196, 196, 0), targetLine.end, ColorB(196, 196, 0), 4.0f);
		gEnv->pRenderer->GetIRenderAuxGeom()->DrawSphere(snapTarget, 0.125f, ColorB(0, 196, 0));

		gEnv->pRenderer->GetIRenderAuxGeom()->SetRenderFlags(oldFlags);
#endif

		return (snapTarget - aimPos).GetNormalizedSafe(Vec3Constants<float>::fVec3_OneY);
	}

	return ZERO;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:37,代码来源:PlayerRotation.cpp

示例14: tm

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
}
开发者ID:aronarts,项目名称:FireNET,代码行数:62,代码来源:VehiclePartSuspensionPart.cpp

示例15: GetAimConeSettings

void CFireModePlugin_AutoAim::AdjustFiringDirection( const Vec3& attackerPos, Vec3& firingDirToAdjust, const bool bCurrentlyZoomed, const EntityId ownerId ) const
{
	CPlayer* pAttackingPlayer = static_cast<CPlayer*>(g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(ownerId));
	if (pAttackingPlayer && pAttackingPlayer->IsPlayer())
	{
		const ConeParams& aimConeSettings = GetAimConeSettings(bCurrentlyZoomed);

		// Don't do any projectile adjusting if the player already has a target for themselves, and is on target (e.g. manually scoping to get a headshot)	
		if( m_targetSelectionParams.m_bDisableAutoAimIfPlayerAlreadyHasTarget && pAttackingPlayer->GetCurrentTargetEntityId() ||
			!aimConeSettings.m_enabled)
		{

#if ALLOW_PROJECTILEHELPER_DEBUGGING
			m_lastShotAutoAimedStatus.append("FALSE - [Reason]: Player already on target");
#endif //#if #endif //#if ALLOW_PROJECTILEHELPER_DEBUGGING

			return;
		}

		float incomingDirLength = firingDirToAdjust.GetLength();
		CRY_ASSERT(incomingDirLength>0.f);
		Vec3 firingDirToAdjustNorm(firingDirToAdjust*__fres(incomingDirLength));

	#if ALLOW_PROJECTILEHELPER_DEBUGGING
		// DEBUG RENDER
		if (g_pGameCVars->pl_debug_projectileAimHelper)
		{
			// Draw Target acquisition cone
			float length = aimConeSettings.m_maxDistance;
			float radius = length * tan(aimConeSettings.m_outerConeRads * 0.5f);

			SAuxGeomRenderFlags originalFlags = gEnv->pRenderer->GetIRenderAuxGeom()->GetRenderFlags();
			SAuxGeomRenderFlags newFlags = originalFlags;
			newFlags.SetCullMode(e_CullModeNone);
			newFlags.SetFillMode(e_FillModeWireframe);
			newFlags.SetAlphaBlendMode(e_AlphaBlended);

			gEnv->pRenderer->GetIRenderAuxGeom()->SetRenderFlags(newFlags);
			gEnv->pRenderer->GetIRenderAuxGeom()->DrawCone(attackerPos + (firingDirToAdjustNorm*aimConeSettings.m_maxDistance),-firingDirToAdjustNorm, radius , length , ColorB(132,190,255,120), true );

			// Draw projectile adjust cone
			radius = length * tan(aimConeSettings.m_innerConeRads * 0.5f);
			gEnv->pRenderer->GetIRenderAuxGeom()->DrawCone(attackerPos + (firingDirToAdjustNorm*aimConeSettings.m_maxDistance),-firingDirToAdjustNorm, radius , length ,ColorB(0,0,127,120), true );
		
			// Restore render flags
			gEnv->pRenderer->GetIRenderAuxGeom()->SetRenderFlags(originalFlags);
		}
	#endif //#if ALLOW_PROJECTILEHELPER_DEBUGGING

		IEntity* pTargetPlayer = CalculateBestProjectileAutoAimTarget(attackerPos, firingDirToAdjustNorm, bCurrentlyZoomed, ownerId);
		if(pTargetPlayer)
		{
			const SAutoaimTarget* pAutoAimInfo = g_pGame->GetAutoAimManager().GetTargetInfo(pTargetPlayer->GetId());
			if(pAutoAimInfo)
			{
				Vec3 desiredFiringDir = ( pAutoAimInfo->primaryAimPosition - attackerPos ).GetNormalized();

				// Make sure final firing dir still constrained to valid cone
				float vecDot = firingDirToAdjustNorm.Dot(desiredFiringDir);
				float maxConeAngle = cos(0.5f * aimConeSettings.m_innerConeRads);
				if(vecDot >= maxConeAngle)
				{
					// within cone
					firingDirToAdjustNorm = desiredFiringDir;

#if ALLOW_PROJECTILEHELPER_DEBUGGING
					m_lastShotAutoAimedStatus.append("TRUE + desired dir fully WITHIN allowed adjust cone");
#endif //#if ALLOW_PROJECTILEHELPER_DEBUGGING

				}
				else
				{
					// constrain (generally working with small angles, nLerp should be fine + cheap)
					const float invConeDot = 1.0f - maxConeAngle;
					const float invVecDot  = 1.0f - vecDot;
					float zeroToOne  = invConeDot / invVecDot;
					Vec3 finalVec	  = (zeroToOne * desiredFiringDir) + ((1.0f - zeroToOne) * firingDirToAdjustNorm);
					finalVec.Normalize();
					firingDirToAdjustNorm = finalVec;

#if ALLOW_PROJECTILEHELPER_DEBUGGING
					m_lastShotAutoAimedStatus.Format("TRUE + desired dir CONSTRAINED to allowed cone [desired]: %.3f deg [constrained To]: %.3f deg", RAD2DEG(acos(vecDot)), 0.5f * RAD2DEG(aimConeSettings.m_innerConeRads));
#endif //#if ALLOW_PROJECTILEHELPER_DEBUGGING
				}
				
			}
		}
#if ALLOW_PROJECTILEHELPER_DEBUGGING
		else
		{
			m_lastShotAutoAimedStatus.Format("FALSE - CalculateBestProjectileAutoAimTarget NULL [Last reason]: %s", m_lastTargetRejectionReason.c_str());
		}

		// Draw adjusted vec
		if (g_pGameCVars->pl_debug_projectileAimHelper)
		{
			float length = aimConeSettings.m_maxDistance;
			gEnv->pRenderer->GetIRenderAuxGeom()->DrawLine(attackerPos,ColorB(255,0,255,0),attackerPos + firingDirToAdjustNorm * length,ColorB(255,0,255,0));
		}
#endif //#if ALLOW_PROJECTILEHELPER_DEBUGGING
//.........这里部分代码省略.........
开发者ID:Xydrel,项目名称:Infected,代码行数:101,代码来源:ProjectileAutoAimHelper.cpp


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