| 748 | } |
| 749 | |
| 750 | void afxEffectWrapper::ew_init(afxChoreographer* choreographer, |
| 751 | afxEffectWrapperData* datablock, |
| 752 | afxConstraintMgr* cons_mgr, |
| 753 | F32 time_factor) |
| 754 | { |
| 755 | AssertFatal(choreographer != NULL, "Choreographer is missing."); |
| 756 | AssertFatal(datablock != NULL, "Datablock is missing."); |
| 757 | AssertFatal(cons_mgr != NULL, "Constraint manager is missing."); |
| 758 | |
| 759 | mChoreographer = choreographer; |
| 760 | mDatablock = datablock; |
| 761 | mCons_mgr = cons_mgr; |
| 762 | ea_set_datablock(datablock->effect_data); |
| 763 | |
| 764 | mEW_timing = datablock->ewd_timing; |
| 765 | if (mEW_timing.life_bias != 1.0f) |
| 766 | { |
| 767 | if (mEW_timing.lifetime > 0) |
| 768 | mEW_timing.lifetime *= mEW_timing.life_bias; |
| 769 | mEW_timing.fade_in_time *= mEW_timing.life_bias; |
| 770 | mEW_timing.fade_out_time *= mEW_timing.life_bias; |
| 771 | } |
| 772 | |
| 773 | mPos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def); |
| 774 | mOrient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def); |
| 775 | mAim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def); |
| 776 | mLife_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def); |
| 777 | |
| 778 | mTime_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor; |
| 779 | |
| 780 | if (datablock->propagate_time_factor) |
| 781 | mProp_time_factor = time_factor; |
| 782 | |
| 783 | if (datablock->runsHere(choreographer->isServerObject())) |
| 784 | { |
| 785 | for (int i = 0; i < MAX_XFM_MODIFIERS && datablock->xfm_modifiers[i] != 0; i++) |
| 786 | { |
| 787 | mXfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject()); |
| 788 | AssertFatal(mXfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName())); |
| 789 | if (mXfm_modifiers[i] == 0) |
| 790 | Con::errorf("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName()); |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | if (datablock->effect_name != ST_NULLSTRING) |
| 795 | { |
| 796 | assignName(datablock->effect_name); |
| 797 | choreographer->addNamedEffect(this); |
| 798 | if (datablock->use_as_cons_obj) |
| 799 | { |
| 800 | mEffect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this); |
| 801 | if (mEffect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject())) |
| 802 | mEffect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this); |
| 803 | } |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | void afxEffectWrapper::prestart() |
no test coverage detected