本文整理汇总了C++中idVec3::ProjectSelfOntoSphere方法的典型用法代码示例。如果您正苦于以下问题:C++ idVec3::ProjectSelfOntoSphere方法的具体用法?C++ idVec3::ProjectSelfOntoSphere怎么用?C++ idVec3::ProjectSelfOntoSphere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idVec3
的用法示例。
在下文中一共展示了idVec3::ProjectSelfOntoSphere方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParticleOrigin
//.........这里部分代码省略.........
break;
}
case PDIR_OUTWARD:
{
dir = origin;
dir.Normalize();
dir[2] += directionParms[0];
break;
}
}
// add speed
float iSpeed = speed.Integrate( g->frac, g->random );
origin += dir * iSpeed * particleLife;
}
else
{
//
// custom paths completely override both the origin and velocity calculations, but still
// use the standard gravity
//
float angle1, angle2, speed1, speed2;
switch( customPathType )
{
case PPATH_HELIX: // ( sizeX sizeY sizeZ radialSpeed axialSpeed )
{
speed1 = g->random.CRandomFloat();
speed2 = g->random.CRandomFloat();
angle1 = g->random.RandomFloat() * idMath::TWO_PI + customPathParms[3] * speed1 * g->age;
float s1, c1;
idMath::SinCos16( angle1, s1, c1 );
origin[0] = c1 * customPathParms[0];
origin[1] = s1 * customPathParms[1];
origin[2] = g->random.RandomFloat() * customPathParms[2] + customPathParms[4] * speed2 * g->age;
break;
}
case PPATH_FLIES: // ( radialSpeed axialSpeed size )
{
speed1 = idMath::ClampFloat( 0.4f, 1.0f, g->random.CRandomFloat() );
speed2 = idMath::ClampFloat( 0.4f, 1.0f, g->random.CRandomFloat() );
angle1 = g->random.RandomFloat() * idMath::PI * 2 + customPathParms[0] * speed1 * g->age;
angle2 = g->random.RandomFloat() * idMath::PI * 2 + customPathParms[1] * speed1 * g->age;
float s1, c1, s2, c2;
idMath::SinCos16( angle1, s1, c1 );
idMath::SinCos16( angle2, s2, c2 );
origin[0] = c1 * c2;
origin[1] = s1 * c2;
origin[2] = -s2;
origin *= customPathParms[2];
break;
}
case PPATH_ORBIT: // ( radius speed axis )
{
angle1 = g->random.RandomFloat() * idMath::TWO_PI + customPathParms[1] * g->age;
float s1, c1;
idMath::SinCos16( angle1, s1, c1 );
origin[0] = c1 * customPathParms[0];
origin[1] = s1 * customPathParms[0];
origin.ProjectSelfOntoSphere( customPathParms[0] );
break;
}
case PPATH_DRIP: // ( speed )
{
origin[0] = 0.0f;
origin[1] = 0.0f;
origin[2] = -( g->age * customPathParms[0] );
break;
}
default:
{
common->Error( "idParticleStage::ParticleOrigin: bad customPathType" );
}
}
origin += offset;
}
// adjust for the per-particle smoke offset
origin *= g->axis;
origin += g->origin;
// add gravity after adjusting for axis
if( worldGravity )
{
idVec3 gra( 0, 0, -gravity );
gra *= g->renderEnt->axis.Transpose();
origin += gra * g->age * g->age;
}
else
{
origin[2] -= gravity * g->age * g->age;
}
}