本文整理汇总了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 );
}
}
示例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" );
}
}
}
}
示例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;
//
//.........这里部分代码省略.........