本文整理汇总了C++中MFMatrix::SetRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ MFMatrix::SetRotation方法的具体用法?C++ MFMatrix::SetRotation怎么用?C++ MFMatrix::SetRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFMatrix
的用法示例。
在下文中一共展示了MFMatrix::SetRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Multiply
MFMatrix& MFMatrix::Rotate(const MFVector &axis, float angle)
{
MFMatrix mat;
mat.SetRotation(axis, angle);
return Multiply(mat, *this);
}
示例2: MFParticleSystem_AddParticle
MF_API void MFParticleSystem_AddParticle(MFParticleEmitter *pEmitter)
{
MFParticleEmitterParameters *pE = &pEmitter->params;
MFParticleSystem *pParticleSystem = pE->pParticleSystem;
MFParticle *pNew = NULL;
if(pParticleSystem->particles.GetLength() < pParticleSystem->params.maxActiveParticles)
pNew = pParticleSystem->particles.Create();
if(pNew)
{
MFParticleParameters *pP = &pParticleSystem->params;
pNew->colour = pP->colour;
pNew->life = pP->life;
pNew->rot = 0.0f;
pNew->size = pP->size;
switch(pE->type)
{
case MFET_Point:
pNew->pos = pE->position.GetTrans();
break;
case MFET_Sphere:
case MFET_Disc:
{
MFVector offset;
do
{
offset = MakeVector(MFRand_Range(-pE->radius, pE->radius), MFRand_Range(-pE->radius, pE->radius), MFRand_Range(-pE->radius, pE->radius));
}
while(offset.MagSquared3() > pE->radius*pE->radius);
if(pE->type == MFET_Disc)
{
// flatten it on to the disc
float dist = offset.Dot3(pE->position.GetYAxis());
offset -= pE->position.GetYAxis()*dist;
}
pNew->pos = pE->position.GetTrans() + offset;
break;
}
}
switch(pE->behaviour)
{
case MFEB_Direction:
pNew->velocity.Normalise3(pE->startVector);
break;
case MFEB_TargetAttract:
pNew->velocity.Normalise3(pE->startVector - pE->position.GetTrans());
break;
case MFEB_TargetRepel:
pNew->velocity.Normalise3(pE->position.GetTrans() - pE->startVector);
break;
}
pNew->velocity *= pE->velocity + MFRand_Range(-pE->velocityScatter, pE->velocityScatter);
if(pE->directionScatter)
{
MFVector scatter;
do
{
scatter = MakeVector(MFRand_Range(-1, 1), MFRand_Range(-1, 1), MFRand_Range(-1, 1));
float dist = scatter.Dot3(pE->position.GetYAxis());
scatter -= pE->position.GetYAxis()*dist;
}
while(scatter.MagSquared3() < 0.000001f);
scatter.Normalise3();
MFMatrix scatterMat;
scatterMat.SetRotation(scatter, MFRand_Unit()*pE->directionScatter);
pNew->velocity = ApplyMatrixH(pNew->velocity, scatterMat);
}
}
}