本文整理汇总了C++中AutoAlloc::Intersect方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoAlloc::Intersect方法的具体用法?C++ AutoAlloc::Intersect怎么用?C++ AutoAlloc::Intersect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoAlloc
的用法示例。
在下文中一共展示了AutoAlloc::Intersect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModifyPoints
void DropEffector::ModifyPoints(BaseObject* op, BaseObject* gen, BaseDocument* doc, EffectorDataStruct* data, MoData* md, BaseThread* thread)
{
if (!ed.target || !rcol || data->strength == 0.0)
return;
C4D_Falloff* falloff = GetFalloff();
if (!falloff)
return;
Int32 i = 0;
Float fall = 0.0;
Vector off = Vector(0.0);
Vector ray_p = Vector(0.0), ray_dir = Vector(0.0);
Vector targ_off = Vector(0.0), targ_hpb = Vector(0.0);
MDArray<Int32> flag_array = md->GetLongArray(MODATA_FLAGS);
MDArray<Matrix> mat_array = md->GetMatrixArray(MODATA_MATRIX);
MDArray<Float> weight_array = md->GetRealArray(MODATA_WEIGHT);
if (!mat_array)
return;
Int32 mdcount = (Int32)md->GetCount();
for (i = 0; i < mdcount; i++)
{
//If the particle isn't visible, don't calculate
if (!(flag_array[i] & MOGENFLAG_CLONE_ON) || (flag_array[i] & MOGENFLAG_DISABLE))
continue;
//Multiply into global space
off = mat_array[i].off;
off = ed.genmg * off;
//Sample the falloff
falloff->Sample(off, &fall, true, weight_array[i]);
if (fall == 0.0)
continue;
//Set up the ray for the collision
ray_p = ed.itargmg * off;
switch (ed.mode)
{
default:
case DROPEFFECTOR_MODE_PNORMAL: ray_dir = ed.genmg.TransformVector(mat_array[i].v3); break;
case DROPEFFECTOR_MODE_NNORMAL: ray_dir = ed.genmg.TransformVector(-mat_array[i].v3); break;
case DROPEFFECTOR_MODE_AXIS: ray_dir = (ed.targmg.off - off); break;
case DROPEFFECTOR_MODE_SELFAXIS: ray_dir = (ed.genmg.off - off); break;
case DROPEFFECTOR_MODE_PX: ray_dir = Vector(1.0, 0.0, 0.0); break;
case DROPEFFECTOR_MODE_PY: ray_dir = Vector(0.0, 1.0, 0.0); break;
case DROPEFFECTOR_MODE_PZ: ray_dir = Vector(0.0, 0.0, 1.0); break;
case DROPEFFECTOR_MODE_NX: ray_dir = Vector(-1.0, 0.0, 0.0); break;
case DROPEFFECTOR_MODE_NY: ray_dir = Vector(0.0, -1.0, 0.0); break;
case DROPEFFECTOR_MODE_NZ: ray_dir = Vector(0.0, 0.0, -1.0); break;
}
ray_dir = ed.itargmg.TransformVector(ray_dir);
//Calculate an intersection
if (rcol->Intersect(ray_p, !ray_dir, ed.maxdist, false))
{
if (rcol->GetNearestIntersection(&rcolres))
{
fall *= data->strength;
targ_off = Blend(mat_array[i].off, ed.igenmg * (ed.targmg * rcolres.hitpos), fall);
targ_hpb = VectorToHPB(ed.igenmg.TransformVector(ed.targmg.TransformVector(rcolres.s_normal)));
mat_array[i] = HPBToMatrix(Blend(MatrixToHPB(mat_array[i], ROTATIONORDER_DEFAULT), targ_hpb, fall), ROTATIONORDER_DEFAULT);
mat_array[i].off = targ_off;
}
}
}
}