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


C++ LTVector函数代码示例

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


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

示例1: GetNodeModelColor

static LTVector GetNodeModelColor(ModelsDB::HNODE hModelNode)
{
	LTVector vColor(1, 1, 1);

	switch ( g_pModelsDB->GetNodeLocation( hModelNode ))
	{
		case HL_HEAD :
			vColor = LTVector(1, 0, 0);
		break;

		case HL_TORSO :
			vColor = LTVector(1, 1, 0);
		break;

		case HL_ARM_LEFT :
		case HL_ARM_RIGHT :
			vColor = LTVector(0, 1, 0);
		break;

		case HL_LEG_LEFT :
		case HL_LEG_RIGHT :
			vColor = LTVector(0, 0, 1);
		break;
	}

	return vColor;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:27,代码来源:CharacterHitBox.cpp

示例2: GetRandom

void CPolygonDebrisFX::SetDebrisPos(int i, LTVector vPos)
{
	if (i < 0 || i >= m_ds.nNumDebris) return;
	if (i >= m_nNumPolies) return;
	if (m_Polies[i] == LTNULL) return;

	// Instead of moving the current poly, add another one at the
	// new position if we're showing a trail..

	if (m_cs.PolyDebrisFX.bShowTrail)
	{
		PLFXLINESTRUCT ls;

        LTVector vLength = (m_cs.vDir * GetRandom(m_cs.PolyDebrisFX.fMinLength, m_cs.PolyDebrisFX.fMaxLength)) / 2.0f;

		ls.vStartPos = vPos - vLength;

		// Get the last vert position...

		PolyLineList* pLines = m_Polies[i]->GetLines();
		if (pLines->GetLength() > 0)
		{
			PolyLine** pLine = pLines->GetItem(TLIT_LAST);
			if (pLine && *pLine)
			{
				PolyVertStruct** pVert = (*pLine)->list.GetItem(TLIT_LAST);
				if (pVert && *pVert)
				{
					ls.vStartPos = m_Polies[i]->GetVertPos((*pVert));
				}
			}
		}

        LTVector vMinC1 = m_cs.PolyDebrisFX.vMinColor1;
        LTVector vMaxC1 = m_cs.PolyDebrisFX.vMaxColor1;
        LTVector vMinC2 = m_cs.PolyDebrisFX.vMinColor2;
        LTVector vMaxC2 = m_cs.PolyDebrisFX.vMaxColor2;

		ls.vEndPos				= vPos;
        ls.vInnerColorStart     = LTVector(GetRandom(vMinC1.x, vMaxC1.x), GetRandom(vMinC1.y, vMaxC1.y), GetRandom(vMinC1.z, vMaxC1.z));
        ls.vInnerColorEnd       = LTVector(GetRandom(vMinC2.x, vMaxC2.x), GetRandom(vMinC2.y, vMaxC2.y), GetRandom(vMinC2.z, vMaxC2.z));
		ls.fAlphaStart			= m_cs.PolyDebrisFX.fInitialAlpha;
		ls.fAlphaEnd			= m_cs.PolyDebrisFX.fFinalAlpha;
        //ls.fLifeTime            = m_fDebrisLife[i] - (g_pLTClient->GetTime() - m_fStartTime);
		ls.fLifeTime			= g_cvarPolyDebrisTrailTime.GetFloat();
		ls.fLifeTime			= ls.fLifeTime < 0.0f ? 0.0f : ls.fLifeTime;
		ls.fAlphaLifeTime		= ls.fLifeTime;

		m_Polies[i]->AddLine(ls);
	}
	else
	{
		m_Polies[i]->SetPos(vPos);
	}
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:55,代码来源:PolyDebrisFX.cpp

示例3: sprintf

void CCoin::RotateToRest()
{
	if ( !m_bRotatedToRest )
	{
		char szSpawn[1024];
		sprintf(szSpawn, "WeaponItem Gravity 0;AmmoAmount 1;WeaponType Coin;AmmoType Coin");

		LTVector vPos;
		g_pLTServer->GetObjectPos(m_hObject, &vPos);
		vPos.y += 2.0f; // This offsets us from the floor a bit so we don't pop through when WeaponItem sets its dims.

		LTRotation rRot;
		rRot.Init();

		BaseClass* pObj = SpawnObject(szSpawn, vPos, rRot);

		if ( pObj && pObj->m_hObject )
		{
			g_pLTServer->SetAcceleration(pObj->m_hObject, &LTVector(0,0,0));
			g_pLTServer->SetVelocity(pObj->m_hObject, &LTVector(0,0,0));
		}

		g_pLTServer->SetObjectFlags(m_hObject, g_pLTServer->GetObjectFlags(m_hObject)&~FLAG_VISIBLE);
	}

	CGrenade::RotateToRest();

	if ( IsCharacter(m_hFiredFrom) )
	{
		LTVector vPosition;
        g_pLTServer->GetObjectPos(m_hObject, &vPosition);

        CCharacter* pCharacter = (CCharacter*)g_pLTServer->HandleToObject(m_hFiredFrom);

		CharCoinInfo cinfo;
        cinfo.fTime = g_pLTServer->GetTime();
		cinfo.eSurfaceType = m_eLastHitSurface;
		cinfo.vPosition = vPosition;

		SURFACE* pSurf = g_pSurfaceMgr->GetSurface(m_eLastHitSurface);
		_ASSERT(pSurf);
		if (pSurf)
		{
			cinfo.fVolume = pSurf->fMovementNoiseModifier;
		}
		else
		{
			cinfo.fVolume = 1.0f;
		}

		pCharacter->SetLastCoinInfo(&cinfo);
	}
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:53,代码来源:ProjectileTypes.cpp

示例4: SetNodeConstraints

bool CTrackedNodeMgr::SetNodeConstraints(	HTRACKEDNODE ID,
											float fXDiscomfortAngle,
											float fYDiscomfortAngle,
											float fXMaxAngle,
											float fYMaxAngle,
											float fMaxAngVel
										)
{
	//just forward this onto the more elaborate version
	return SetNodeConstraints(ID,	LTVector(0.0f, 1.0f, 0.0f), LTVector(-1.0f, 0.0f, 0.0f), 
									fXDiscomfortAngle, fYDiscomfortAngle,
									fXMaxAngle, fYMaxAngle,
									fMaxAngVel);
}
开发者ID:emoose,项目名称:lithtech,代码行数:14,代码来源:TrackedNodeMgr.cpp

示例5:

CPrefabRef *CPrefabMgr::CreateUnboundRef(CEditRegion *pRegion, CWorldNode *pParent, const char *pFilename, const char *pName)
{
	CPrefabRef *pResult = new CPrefabRef;
	// Set the object's name correctly
	pResult->SetName(pName);
	// Set its filename
	pResult->SetPrefabFilename(pFilename);
	// Clear out the position and orientation
	pResult->SetPos(LTVector(0.0f, 0.0f, 0.0f));
	pResult->SetOr(LTVector(0.0f, 0.0f, 0.0f));
	// Add it to the tree
	no_InitializeNewNode(pRegion, pResult, pParent);
	return pResult;
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:14,代码来源:PrefabMgr.cpp

示例6: LTVector

CAIMovement::CAIMovement()
{
	m_pAI = LTNULL;
	m_eState = eStateUnset;
	m_vDest = LTVector(0,0,0);
	m_pDestVolume = LTNULL;
	m_bUnderwater = LTFALSE;
	m_bClimbing = LTFALSE;
	m_bFaceDest = LTTRUE;
	m_bIgnoreVolumes = LTFALSE;
	m_eLastMovementType = kAM_None;
	m_fAnimRate = 1.f;
	m_bMovementLocked = LTFALSE;
	m_bRotationLocked = LTFALSE;
	m_bNoDynamicPathfinding = LTFALSE;
	m_vLastValidVolumePos.Init( 0.0f, 0.0f, 0.0f );
	m_bMoved = LTFALSE;

	m_bNewPathSet = LTFALSE;
	m_cBoundPts = 0;
	m_iBoundPt = 0;

	m_bDoParabola = LTFALSE;
	m_fParabolaPeakDist = 0.f;
	m_fParabolaPeakHeight = 0.f;
	m_fParabola_a = 0.f;
	m_bParabolaPeaked = LTFALSE;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:28,代码来源:AIMovement.cpp

示例7: GetContouringInfo

void GetContouringInfo( LTVector &vForward, LTVector &vNormal, 
					   float &fOutAmount, float &fOutPitchPercent, float &fOutRollPercent )
{
	LTVector	vPlaneF = (vNormal.y >= 1.0f) ? vForward : vNormal;
	
	vPlaneF.y = 0.0f;
	vPlaneF.Normalize();

	LTRotation	rPlaneRot( vPlaneF, LTVector(0, 1, 0));
	LTVector	vPlaneR = rPlaneRot.Right();
	
	// Calculate how much pitch and roll we should apply...

	fOutPitchPercent	= vForward.Dot( vPlaneF );
	fOutRollPercent		= vForward.Dot( vPlaneR );

	// Figure out the length of the foward vector projected on the xz plane.  This
	// is needed because Euler angles are calculated cummulatively, not just based
	// on the global coordinate axis.

	float fXZLen = (float)sqrt( 1.0f - vNormal.y * vNormal.y );

	// Subtract the pitch from 90 degrees cause we want to be parallel to the plane

	fOutAmount = MATH_HALFPI - (float)atan2( vNormal.y, fXZLen );
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:26,代码来源:ClientUtilities.cpp

示例8: LTVector

void CHUDSubtitles::Render()
{
	// Sanity checks...
	if (!m_bVisible) return;
	if (GetConsoleInt("Subtitles",0) == 0) return;

	// Only show subtitles if conversations in range...
	LTVector vListenerPos;
	bool bListenerInClient;
	LTRotation rRot;
	g_pLTClient->GetListener(&bListenerInClient, &vListenerPos, &rRot);

	bool bForceDraw = (bool)(m_vSpeakerPos == LTVector(0, 0, 0));
	bForceDraw = ((g_pPlayerMgr->GetPlayerCamera()->GetCameraMode() == CPlayerCamera::kCM_Cinematic) ? true : bForceDraw);

	LTVector vPos = m_vSpeakerPos - vListenerPos;
	float fAdjustedRadius = m_fRadius * g_vtAdjustedRadius.GetFloat();

	if (!bForceDraw && vPos.Mag() > fAdjustedRadius)
		return;



	//render normal

	if (m_bOverflow)
		m_Text.RenderClipped(m_Rect);
	else
		m_Text.Render();


}
开发者ID:Arc0re,项目名称:lithtech,代码行数:32,代码来源:HUDSubtitles.cpp

示例9: LTVector

void LightGroup::UpdateClients()
{
	// Calculate our current color
	LTVector vColor = (m_bOn) ? m_vColor : LTVector(0.0f, 0.0f, 0.0f);

	{
		// Set up the update message
		CAutoMessage cMsg;
		cMsg.Writeuint8(MID_SFX_MESSAGE);
		cMsg.Writeuint8(SFX_LIGHTGROUP_ID);
		cMsg.WriteObject(m_hObject);
		cMsg.Writeuint32(m_nID);
		cMsg.WriteLTVector(vColor);

		// Send the message to all connected clients
		g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
	}
	
	{
		CAutoMessage cMsg;
		cMsg.Writeuint8(SFX_LIGHTGROUP_ID);

		cMsg.Writeuint32(m_nID);
		cMsg.WriteLTVector(vColor);

		// Make sure new clients will get the message
		g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());
	}

	m_bClientNeedsUpdate = false;
}
开发者ID:emoose,项目名称:lithtech,代码行数:31,代码来源:LightGroup.cpp

示例10: GenerateBasisSpace

//Given an index for a vertex to calculate a basis space for, as well as index offsets to
//form two basis vectors for a plane, it will calculate the space and store it in
//the vertex of the specified index
static inline void GenerateBasisSpace(char* pData, CPolyGridBumpVertex* pVert, int32 nXOff1, int32 nXOff2, int32 nYOff1, int32 nYOff2,
								  float fWidth, float fHeight, float fWidthTimesHeight, float fYScale)
{
	//sanity checks!
	assert(nXOff1 != nXOff2);
	assert(nYOff1 != nYOff2);

	pVert->m_vBasisRight.x = -fWidth;
	pVert->m_vBasisRight.y = ((int32)pData[nXOff1] - pData[nXOff2]) * fYScale;
	pVert->m_vBasisRight.z = 0.0f;

	pVert->m_vBasisForward.x = 0.0f;
	pVert->m_vBasisForward.y = ((int32)pData[nYOff1] - pData[nYOff2]) * fYScale;
	pVert->m_vBasisForward.z = fHeight;

	pVert->m_vBasisUp.x = pVert->m_vBasisRight.y * fHeight;
	pVert->m_vBasisUp.y = fWidthTimesHeight;
	pVert->m_vBasisUp.z = pVert->m_vBasisForward.y * fWidth;

	//normalize our normals
	pVert->m_vBasisUp.Normalize();
	pVert->m_vBasisForward.Normalize();
	pVert->m_vBasisRight.Normalize();

	//just a quick check to make sure that the normal is in the right hemisphere
	assert(pVert->m_vBasisUp.Dot(LTVector(0.0f, 1.0f, 0.0f)) > 0.0f);
}
开发者ID:emoose,项目名称:lithtech,代码行数:30,代码来源:drawpolygrid.cpp

示例11: LTVector

LTVector CAIWeaponAbstract::DefaultGetFirePosition(CAI* pAI)
{
	if (!pAI)
	{
		return LTVector(0,0,0);
	}

	if ( !m_szFireSocketName.empty() )
	{
		HMODELSOCKET hFiringSocket = INVALID_MODEL_SOCKET;

		// Set the socket to fire from to the socket named if it exists
		// check to see if we already have the socket so we can try to
		// avoid annoying lookups.
		g_pModelLT->GetSocket( 
			pAI->m_hObject, 
			m_szFireSocketName.c_str(), 
			hFiringSocket);

		LTTransform transform;
		LTRESULT SocketTransform = g_pModelLT->GetSocketTransform( pAI->m_hObject, hFiringSocket, transform, true );
		AIASSERT( SocketTransform == LT_OK, pAI->m_hObject, "Unable to get socket for transform" );
		return transform.m_vPos;
	}
	else 
	{
		return pAI->GetWeaponPosition( m_pWeapon, false );
	}
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:29,代码来源:AIWeaponAbstract.cpp

示例12: LTVector

//----------------------------------------------------------------------------
//              
//	ROUTINE:	CHoverMovementModifier::Update()
//              
//	PURPOSE:	Try to smooth the path within limits so that we don't snap on
//				stairs.  Otherwise just 
//              
//----------------------------------------------------------------------------
LTVector CHoverMovementModifier::Update( HOBJECT hObject, const LTVector& vDims, const LTVector& vOldPos, const LTVector& vNewPos, AIVolume* pLastVolume )
{
	// Get the position the AI is really at -- that is, the new X and Z, with
	// the OLD positions Y

	const LTVector vTruePos = LTVector( vNewPos.x, vOldPos.y, vNewPos.z);
	LTVector vFinalPosition = vTruePos;

	// Find the distance down to the new position the AI would be popped to.

	float flLowerBound = GetLowerBound( hObject, m_cCheckDist, vDims, vTruePos );

	// Find the DIFFERENCE between the heights.  If it is less than +-X, then
	// drift in that direction.  If it is greater, then snap to the max
	// distance away that is allowed

	float flDifference = (float)fabs( flLowerBound - vOldPos.y );
	if ( flDifference != 0.0f )
	{
		if ( flDifference <= m_cMaxVerticalDifference )
		{
			// Attempt to make the path a little bit smoother by adjusting
			// the position a bit more slowly
			LTVector vHorizontalMovement = vNewPos - vOldPos;
			vHorizontalMovement.y = 0;
			vFinalPosition.y = Interpolate( vOldPos.y, flLowerBound, vHorizontalMovement.Mag() );
		}
		else
		{
			vFinalPosition.y = Snap( vOldPos.y, flLowerBound, flDifference );
		}
	}

	return vFinalPosition;
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:43,代码来源:AIMovementModifier.cpp

示例13: DEG2RAD

void CLeanMgr::BeginLean( eLeanDirection kDir )
{
	m_kLeanDir = kDir;

	m_fMaxLeanAngle = DEG2RAD( g_vtLeanAngle.GetFloat() );
	m_fLeanFromAngle = m_fLastLeanAngle;

	m_fStartTime = 0.0f;
	m_fEndTime = g_vtLeanOutTime.GetFloat();

	if( m_bLeanedOut )
	{
		// Send a message to the server to remove the original stimulus.

		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_PLAYER_CLIENTMSG );
		cMsg.Writeuint8( CP_PLAYER_LEAN );
		cMsg.Writeuint8( PL_CENTER );
		cMsg.WriteLTVector( LTVector( 0, 0, 0) );
		g_pLTClient->SendToServer( cMsg.Read(), MESSAGE_GUARANTEED );
	}

	// If we are just begining to lean then we are not leaned out...

	m_bLeanedOut = false;
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:26,代码来源:LeanMgr.cpp

示例14: GetIntersectionUnderPoint

bool GetIntersectionUnderPoint( LTVector &vInPt, HOBJECT *pFilterList, LTVector &vOutNormal, LTVector &vOutPt )
{
	IntersectQuery	iq;
	IntersectInfo		ii;
	
	vOutNormal.Init(0, 1, 0);

	iq.m_Flags	= IGNORE_NONSOLID | INTERSECT_OBJECTS | INTERSECT_HPOLY;
	iq.m_From	= vInPt;
	iq.m_To		= iq.m_From + LTVector( 0, -1, 0) * 256.0f;

	iq.m_FilterFn  = ObjListFilterFn;
	iq.m_pUserData = pFilterList;

	if( g_pLTClient->IntersectSegment( iq, &ii ) )
	{
		if( ii.m_hObject )
		{
			vOutNormal	= ii.m_Plane.m_Normal;
			vOutPt		= ii.m_Point;

			return true;
		}
	}
	
	return false;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:27,代码来源:ClientUtilities.cpp

示例15: LTVector

CNudge::CNudge(CAIHuman* pAI)
{
	m_pAI = pAI;
	m_eState = eStateNoNudge;
	m_ePriority = ePriorityLow;
	m_vNudge = LTVector(0,0,0);
}
开发者ID:germanocaldeira,项目名称:no-one-lives-forever,代码行数:7,代码来源:AINudge.cpp


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