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


C++ idVec3::Set方法代码示例

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


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

示例1: SetupTransforms

void idSimpleWindow::SetupTransforms( float x, float y )
{
	static idMat3 trans;
	static idVec3 org;
	
	trans.Identity();
	org.Set( origin.x + x, origin.y + y, 0 );
	if( rotate )
	{
		static idRotation rot;
		static idVec3 vec( 0, 0, 1 );
		rot.Set( org, vec, rotate );
		trans = rot.ToMat3();
	}
	
	static idMat3 smat;
	smat.Identity();
	if( shear.x() || shear.y() )
	{
		smat[0][1] = shear.x();
		smat[1][0] = shear.y();
		trans *= smat;
	}
	
	if( !trans.IsIdentity() )
	{
		dc->SetTransformInfo( org, trans );
	}
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:29,代码来源:SimpleWindow.cpp

示例2: TryStartPursuit

void rvMonsterStroggHover::TryStartPursuit ( void )
{
	if ( GetEnemy() )
	{
		inPursuit = false;
		if ( !marker.GetEntity() ) {
			//wtf?!
			assert(0);
			return;
		}
		attackPosOffset.Set( gameLocal.random.CRandomFloat()*500.0f, gameLocal.random.CRandomFloat()*500.0f, 0.0f );
		if ( attackPosOffset.Length() < 150.0f )
		{
			attackPosOffset.Normalize();
			attackPosOffset *= 150.0f;
		}
		attackPosOffset.z = (gameLocal.random.CRandomFloat()*30.0f)+50.0f + move.fly_offset;
		marker.GetEntity()->GetPhysics()->SetOrigin( GetEnemy()->GetPhysics()->GetOrigin()+attackPosOffset );
		if ( MarkerPosValid() )
		{
			if ( MoveToEntity( marker ) )
			{
				inPursuit = true;
				holdPosTime = 0;
				SetState( "State_Pursue" );
			}
		}
	}
}
开发者ID:ET-NiK,项目名称:amxxgroup,代码行数:29,代码来源:Monster_StroggHover.cpp

示例3: ParticleOrigin

/*
===============
idParticleStage::ParticleOrigin
===============
*/
void idParticleStage::ParticleOrigin( particleGen_t* g, idVec3& origin ) const
{
	if( customPathType == PPATH_STANDARD )
	{
		//
		// find intial origin distribution
		//
		float radiusSqr, angle1, angle2;
		
		switch( distributionType )
		{
			case PDIST_RECT:  	// ( sizeX sizeY sizeZ )
			{
				origin[0] = ( ( randomDistribution ) ? g->random.CRandomFloat() : 1.0f ) * distributionParms[0];
				origin[1] = ( ( randomDistribution ) ? g->random.CRandomFloat() : 1.0f ) * distributionParms[1];
				origin[2] = ( ( randomDistribution ) ? g->random.CRandomFloat() : 1.0f ) * distributionParms[2];
				break;
			}
			case PDIST_CYLINDER:  	// ( sizeX sizeY sizeZ ringFraction )
			{
				angle1 = ( ( randomDistribution ) ? g->random.CRandomFloat() : 1.0f ) * idMath::TWO_PI;
				
				idMath::SinCos16( angle1, origin[0], origin[1] );
				origin[2] = ( ( randomDistribution ) ? g->random.CRandomFloat() : 1.0f );
				
				// reproject points that are inside the ringFraction to the outer band
				if( distributionParms[3] > 0.0f )
				{
					radiusSqr = origin[0] * origin[0] + origin[1] * origin[1];
					if( radiusSqr < distributionParms[3] * distributionParms[3] )
					{
						// if we are inside the inner reject zone, rescale to put it out into the good zone
						float f = sqrt( radiusSqr ) / distributionParms[3];
						float invf = 1.0f / f;
						float newRadius = distributionParms[3] + f * ( 1.0f - distributionParms[3] );
						float rescale = invf * newRadius;
						
						origin[0] *= rescale;
						origin[1] *= rescale;
					}
				}
				origin[0] *= distributionParms[0];
				origin[1] *= distributionParms[1];
				origin[2] *= distributionParms[2];
				break;
			}
			case PDIST_SPHERE:  	// ( sizeX sizeY sizeZ ringFraction )
			{
				// iterating with rejection is the only way to get an even distribution over a sphere
				if( randomDistribution )
				{
					do
					{
						origin[0] = g->random.CRandomFloat();
						origin[1] = g->random.CRandomFloat();
						origin[2] = g->random.CRandomFloat();
						radiusSqr = origin[0] * origin[0] + origin[1] * origin[1] + origin[2] * origin[2];
					}
					while( radiusSqr > 1.0f );
				}
				else
				{
					origin.Set( 1.0f, 1.0f, 1.0f );
					radiusSqr = 3.0f;
				}
				
				if( distributionParms[3] > 0.0f )
				{
					// we could iterate until we got something that also satisfied ringFraction,
					// but for narrow rings that could be a lot of work, so reproject inside points instead
					if( radiusSqr < distributionParms[3] * distributionParms[3] )
					{
						// if we are inside the inner reject zone, rescale to put it out into the good zone
						float f = sqrt( radiusSqr ) / distributionParms[3];
						float invf = 1.0f / f;
						float newRadius = distributionParms[3] + f * ( 1.0f - distributionParms[3] );
						float rescale = invf * newRadius;
						
						origin[0] *= rescale;
						origin[1] *= rescale;
						origin[2] *= rescale;
					}
				}
				origin[0] *= distributionParms[0];
				origin[1] *= distributionParms[1];
				origin[2] *= distributionParms[2];
				break;
			}
		}
		
		// offset will effect all particle origin types
		// add this before the velocity and gravity additions
		origin += offset;
		
		//
//.........这里部分代码省略.........
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:101,代码来源:DeclParticle.cpp


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