| 381 | //----------------------------------------------------------------------------- |
| 382 | |
| 383 | void SkeletonObject::updateComposition( const F32 time ) |
| 384 | { |
| 385 | // Update position/orientation/state of visualization |
| 386 | float delta = (time - mLastFrameTime) * mTimeScale; |
| 387 | mLastFrameTime = time; |
| 388 | |
| 389 | spSkeleton_update(mSkeleton, delta); |
| 390 | |
| 391 | if (!mAnimationFinished) |
| 392 | { |
| 393 | spAnimationState_update(mState, delta); |
| 394 | spAnimationState_apply(mState, mSkeleton); |
| 395 | } |
| 396 | |
| 397 | spSkeleton_updateWorldTransform(mSkeleton); |
| 398 | |
| 399 | // Get the ImageAsset used by the sprites |
| 400 | StringTableEntry assetId = (*mSkeletonAsset).mImageAsset.getAssetId(); |
| 401 | |
| 402 | clearSprites(); |
| 403 | |
| 404 | Vector2 vertices[4]; |
| 405 | |
| 406 | F32 vertexPositions[8]; |
| 407 | for (int i = 0; i < mSkeleton->slotCount; ++i) |
| 408 | { |
| 409 | spSlot* slot = mSkeleton->slots[i]; |
| 410 | spAttachment* attachment = slot->attachment; |
| 411 | |
| 412 | if (!attachment || attachment->type != ATTACHMENT_REGION) |
| 413 | continue; |
| 414 | |
| 415 | spRegionAttachment* regionAttachment = (spRegionAttachment*)attachment; |
| 416 | spRegionAttachment_computeWorldVertices(regionAttachment, slot->skeleton->x, slot->skeleton->y, slot->bone, vertexPositions); |
| 417 | |
| 418 | SpriteBatchItem* pSprite = SpriteBatch::createSprite(); |
| 419 | |
| 420 | pSprite->setDepth(mSceneLayerDepth); |
| 421 | |
| 422 | pSprite->setSrcBlendFactor(mSrcBlendFactor); |
| 423 | pSprite->setDstBlendFactor(mDstBlendFactor); |
| 424 | |
| 425 | mSkeleton->r = mBlendColor.red; |
| 426 | mSkeleton->g = mBlendColor.green; |
| 427 | mSkeleton->b = mBlendColor.blue; |
| 428 | mSkeleton->a = mBlendColor.alpha; |
| 429 | |
| 430 | F32 alpha = mSkeleton->a * slot->a; |
| 431 | pSprite->setBlendColor(ColorF( |
| 432 | mSkeleton->r * slot->r * alpha, |
| 433 | mSkeleton->g * slot->g * alpha, |
| 434 | mSkeleton->b * slot->b * alpha, |
| 435 | alpha |
| 436 | )); |
| 437 | |
| 438 | mSkeleton->flipX = getFlipX(); |
| 439 | mSkeleton->flipY = getFlipY(); |
| 440 |
nothing calls this directly
no test coverage detected