本文整理汇总了C++中Part::ApplyFrameToEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ Part::ApplyFrameToEntity方法的具体用法?C++ Part::ApplyFrameToEntity怎么用?C++ Part::ApplyFrameToEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part::ApplyFrameToEntity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateOnionSkins
void TestScene::CreateOnionSkins()
{
// current part
Part *editPart = ¤tAnimation->parts[selectedPartIndex];
if (editPart)
{
Entity *editEntity = editPart->entity;
Sprite *editSprite = editPart->sprite;
int currentFrame = int(animationFrame);
const int numFramesToPreview = 5;
for (int i = 0; i < numFramesToPreview; i++)
{
int prevFrame = SafeFrameRange(currentFrame - i);
int nextFrame = SafeFrameRange(currentFrame + i);
const float dyeP = 0.25f;
if (prevFrame != currentFrame)
{
Entity *entity = editPart->CreateEntity(textureSheet);
eAnimation->Add(entity);
editPart->ApplyFrameToEntity(prevFrame, entity);
onionSkins.push_back(entity);
float oldA = entity->color.a;
entity->color = entity->color * (1.0f-dyeP) + Color::blue * dyeP;
entity->color.a = oldA * (0.25f - 0.05f*i);
}
if (nextFrame != currentFrame)
{
// spawn part at next frame
Entity *entity = editPart->CreateEntity(textureSheet);
eAnimation->Add(entity);
editPart->ApplyFrameToEntity(nextFrame, entity);
onionSkins.push_back(entity);
float oldA = entity->color.a;
entity->color = entity->color * (1.0f-dyeP) + Color::red * dyeP;
entity->color.a = oldA * (0.25f - 0.05f*i);
}
}
}
}