本文整理汇总了C++中KeyFrame::SetScale方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyFrame::SetScale方法的具体用法?C++ KeyFrame::SetScale怎么用?C++ KeyFrame::SetScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyFrame
的用法示例。
在下文中一共展示了KeyFrame::SetScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void MeshLoader_v1::ReadSkelAnim(MeshPtr mesh, DataStreamPtr & stream)
{
Skeleton * skel = mesh->GetSkeleton();
int version = -1;
stream->Read(&version, sizeof (int));
d_assert (version == K_SkelAnim_Version);
char name[128];
stream->Read(name, 128);
Animation * anim = mesh->CreateAnimation(name);
int numAnims = 0;
stream->Read(&numAnims, sizeof(int));
for (int i = 0; i < numAnims; ++i)
{
int boneId, count;
stream->Read(&boneId, sizeof(int));
stream->Read(&count, sizeof(int));
if (count == 0)
continue;
SkeletonAnimation * skel_anim;
skel_anim = anim->CreateSkeletonAnimation(boneId);
KeyFrame * kf;
float time;
Vec3 trans;
Quat rotate;
Vec3 scale;
for (int i = 0; i < count; ++i)
{
stream->Read(&time, sizeof(float));
stream->Read(&trans, sizeof(float) * 3);
stream->Read(&rotate, sizeof(float) * 4);
stream->Read(&scale, sizeof(float) * 3);
kf = skel_anim->CreateKeyFrame();
kf->SetTime(time);
kf->SetTranslate(trans);
kf->SetRotation(rotate);
kf->SetScale(scale);
}
}
anim->_calcuLength();
}
示例2: _
//.........这里部分代码省略.........
if (item->Track() > 1)
// not a "managed" item
continue;
managedItems.AddItem(item);
if (item->HasMaxDuration()) {
int64 maxItemDuration = item->MaxDuration();
minDuration += maxItemDuration;
fixedItemsDuration += maxItemDuration;
if (minItemDuration > maxItemDuration)
minItemDuration = maxItemDuration;
} else {
minDuration += 3 * transitionDuration;
variableItemCount++;
}
maxDuration += item->MaxDuration();
}
count = managedItems.CountItems();
if (count == 0)
return;
if (duration < minDuration)
duration = minDuration;
if (duration > maxDuration)
duration = maxDuration;
// limit transition duration to 1/3 of the minimum item duration
int64 maxTransitionDuration = minItemDuration / 3;
if (transitionDuration > maxTransitionDuration)
transitionDuration = maxTransitionDuration;
int64 variableItemsDuration = duration - fixedItemsDuration
+ transitionDuration * (count - variableItemCount);
int64 startFrame = 0;
int64 lastVariableStartFrame = 0;
int32 variableItemIndex = 0;
for (int32 i = 0; i < count; i++) {
PlaylistItem* item = (PlaylistItem*)managedItems.ItemAtFast(i);
// overlapping items
item->SetClipOffset(0);
item->SetTrack(i & 1);
int64 nextStartFrame;
if (item->HasMaxDuration()) {
nextStartFrame = startFrame + item->MaxDuration()
- transitionDuration;
} else {
variableItemIndex++;
int64 nextVariableStartFrame = (variableItemsDuration - transitionDuration)
* variableItemIndex / variableItemCount;
nextStartFrame = startFrame + nextVariableStartFrame - lastVariableStartFrame;
lastVariableStartFrame = nextVariableStartFrame;
}
item->SetStartFrame(startFrame);
item->SetDuration(nextStartFrame - startFrame + transitionDuration);
startFrame = nextStartFrame;
// transition
PropertyAnimator* animator = item->AlphaAnimator();
if (!animator)
continue;
AutoNotificationSuspender _(animator);
// remove all keyframes to get a clean start
animator->MakeEmpty();
KeyFrame* first = animator->InsertKeyFrameAt(0LL);
KeyFrame* last = animator->InsertKeyFrameAt(item->Duration() - 1);
if (!first || !last)
continue;
first->SetScale(1.0);
last->SetScale(1.0);
// transition in top items
if (transitionDuration > 0 && !(i & 1)) {
// item on first track, animated opacity property
if (i > 0) {
// fade in
KeyFrame* key = animator->InsertKeyFrameAt(transitionDuration);
key->SetScale(1.0);
first->SetScale(0.0);
}
if (i < count - 1) {
// fade out
KeyFrame* key = animator->InsertKeyFrameAt(
item->Duration() - 1 - transitionDuration);
key->SetScale(1.0);
last->SetScale(0.0);
}
}
}
}
示例3: SoundClipID
// _LayoutBackgroundSound
status_t
CollectingPlaylist::_LayoutBackgroundSound(const ServerObjectManager* library)
{
// find the background sound clip, if we are supposed to have one
Clip* soundClip = NULL;
BString soundClipID = SoundClipID();
if (soundClipID.Length() > 0) {
soundClip = dynamic_cast<Clip*>(library->FindObject(
soundClipID.String()));
if (!soundClip) {
print_error("CollectingPlaylist::_LayoutBackgroundSound() - "
"didn't background sound clip: %s (ignoring)\n",
soundClipID.String());
return B_OK;
}
} else {
// no background sound configured
return B_OK;
}
float volume = Value(PROPERTY_BACKGROUND_SOUND_VOLUME, (float)1.0);
uint64 duration = Duration();
uint64 startFrame = 0;
while (startFrame < duration) {
ClipPlaylistItem* item = new (nothrow) ClipPlaylistItem(soundClip);
if (!item) {
print_error("CollectingPlaylist::_LayoutBackgroundSound() - "
"no memory to create ClipPlaylistItem\n");
return B_NO_MEMORY;
}
uint64 itemDuration = soundClip->Duration();
uint64 maxItemDuration = duration - startFrame;
if (startFrame == 0 && itemDuration >= maxItemDuration) {
// one item as long as first track or longer
// cut off
itemDuration = maxItemDuration;
// fade in + fade out
PropertyAnimator* animator = item->AlphaAnimator();
if (animator) {
// remove all keyframes to get a clean start
animator->MakeEmpty();
KeyFrame* first = animator->InsertKeyFrameAt(0LL);
KeyFrame* fadeEnd = animator->InsertKeyFrameAt(3);
KeyFrame* fadeStart = animator->InsertKeyFrameAt(
itemDuration - 4);
KeyFrame* last = animator->InsertKeyFrameAt(itemDuration - 1);
if (!first || !fadeEnd || !fadeStart || !last) {
delete item;
print_error("CollectingPlaylist::_LayoutBackgroundSound()"
" - no memory to add fade keyframes\n");
return B_NO_MEMORY;
}
first->SetScale(0.0);
fadeEnd->SetScale(volume);
fadeStart->SetScale(volume);
last->SetScale(0.0);
}
} else if (startFrame == 0) {
// first item, more to come
// fade in
PropertyAnimator* animator = item->AlphaAnimator();
if (animator) {
// remove all keyframes to get a clean start
animator->MakeEmpty();
KeyFrame* first = animator->InsertKeyFrameAt(0LL);
KeyFrame* fadeEnd = animator->InsertKeyFrameAt(3);
KeyFrame* last = animator->InsertKeyFrameAt(itemDuration - 1);
if (!first || !fadeEnd || !last) {
delete item;
print_error("CollectingPlaylist::_LayoutBackgroundSound()"
" - no memory to add fade keyframes\n");
return B_NO_MEMORY;
}
first->SetScale(0.0);
fadeEnd->SetScale(volume);
last->SetScale(volume);
}
} else if (itemDuration >= maxItemDuration) {
// last item
// cut off
itemDuration = maxItemDuration;
// fade out
PropertyAnimator* animator = item->AlphaAnimator();
if (animator) {
// remove all keyframes to get a clean start
animator->MakeEmpty();
KeyFrame* first = animator->InsertKeyFrameAt(0LL);
KeyFrame* fadeStart = animator->InsertKeyFrameAt(
itemDuration - 4);
KeyFrame* last = animator->InsertKeyFrameAt(itemDuration - 1);
//.........这里部分代码省略.........