void CS_DISPLAY_UPDATE(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty) { CS_RETURN_IF(!decoDisplay); #if ENABLE_PHYSICS_DETECT if (dirty) { ColliderDetector *detector = decoDisplay->getColliderDetector(); if (detector) { CCAffineTransform t = CCAffineTransformConcat(bone->nodeToArmatureTransform(), bone->getArmature()->nodeToWorldTransform()); detector->updateTransform(t); } } #endif switch(decoDisplay->getDisplayData()->displayType) { case CS_DISPLAY_SPRITE: CS_DISPLAY_SPRITE_UPDATE(bone, decoDisplay, dt, dirty); break; case CS_DISPLAY_PARTICLE: CS_DISPLAY_PARTICLE_UPDATE(bone, decoDisplay, dt, dirty); break; case CS_DISPLAY_ARMATURE: CS_DISPLAY_ARMATURE_UPDATE(bone, decoDisplay, dt, dirty); break; case CS_DISPLAY_NODE: CS_DISPLAY_NODE_UPDATE(bone, decoDisplay, dt, dirty); break; default: break; } }
void DisplayFactory::updateDisplay(Bone *bone, float dt, bool dirty) { Node *display = bone->getDisplayRenderNode(); CS_RETURN_IF(!display); switch(bone->getDisplayRenderNodeType()) { case CS_DISPLAY_SPRITE: if (dirty) { static_cast<Skin*>(display)->updateArmatureTransform(); } break; case CS_DISPLAY_PARTICLE: updateParticleDisplay(bone, display, dt); break; case CS_DISPLAY_ARMATURE: updateArmatureDisplay(bone, display, dt); break; default: { Mat4 transform = bone->getNodeToArmatureTransform(); display->setAdditionalTransform(&transform); } break; } #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT || ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX if (dirty) { DecorativeDisplay *decoDisplay = bone->getDisplayManager()->getCurrentDecorativeDisplay(); ColliderDetector *detector = decoDisplay->getColliderDetector(); if (detector) { do { #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT CC_BREAK_IF(!detector->getBody()); #endif Mat4 displayTransform = display->getNodeToParentTransform(); Vec2 anchorPoint = display->getAnchorPointInPoints(); anchorPoint = PointApplyTransform(anchorPoint, displayTransform); displayTransform.m[12] = anchorPoint.x; displayTransform.m[13] = anchorPoint.y; Mat4 t = TransformConcat( bone->getArmature()->getNodeToParentTransform(),displayTransform); detector->updateTransform(t); } while (0); } } #endif }