本文整理汇总了C++中Interpolator::getOffsetXVariation方法的典型用法代码示例。如果您正苦于以下问题:C++ Interpolator::getOffsetXVariation方法的具体用法?C++ Interpolator::getOffsetXVariation怎么用?C++ Interpolator::getOffsetXVariation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interpolator
的用法示例。
在下文中一共展示了Interpolator::getOffsetXVariation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void Particle::init()
{
const Model* model = group->getModel();
data->age = 0.0f;
data->life = random(model->lifeTimeMin,model->lifeTimeMax);
// creates pseudo-iterators to parse arrays
float* particleCurrentIt = currentParams;
float* particleMutableIt = extendedParams;
float* particleInterpolatedIt = extendedParams + model->nbMutableParams;
const int* paramIt = model->enableParams;
// initializes params
for (size_t i = model->nbEnableParams; i != 0; --i)
{
ModelParam param = static_cast<ModelParam>(*paramIt);
const float* templateIt = &model->params[model->indices[param]];
if (model->isInterpolated(param))
{
*particleCurrentIt++ = Model::DEFAULT_VALUES[param];
*particleInterpolatedIt++ = random(0.0f,1.0f); // ratioY
Interpolator* interpolator = model->interpolators[param];
float offsetVariation = interpolator->getOffsetXVariation();
float scaleVariation = interpolator->getScaleXVariation();
*particleInterpolatedIt++ = random(-offsetVariation,offsetVariation); // offsetX
*particleInterpolatedIt++ = 1.0f + random(-scaleVariation,scaleVariation); // scaleX
}
else if (model->isRandom(param))
{
*particleCurrentIt++ = random(*templateIt,*(templateIt + 1));
if (model->isMutable(param))
*particleMutableIt++ = random(*(templateIt + 2),*(templateIt + 3));
}
else
{
*particleCurrentIt++ = *templateIt;
if (model->isMutable(param))
*particleMutableIt++ = *(templateIt + 1);
}
++paramIt;
}
}