| 3665 | } |
| 3666 | |
| 3667 | void GpuProgramTranslator::translateProgramParameters(ScriptCompiler *compiler, const GpuProgramParametersSharedPtr& params, ObjectAbstractNode *obj) |
| 3668 | { |
| 3669 | uint32 animParametricsCount = 0; |
| 3670 | |
| 3671 | String value; |
| 3672 | bool bval; |
| 3673 | for(auto & i : obj->children) |
| 3674 | { |
| 3675 | if(i->type == ANT_PROPERTY) |
| 3676 | { |
| 3677 | PropertyAbstractNode *prop = static_cast<PropertyAbstractNode*>(i.get()); |
| 3678 | switch(prop->id) |
| 3679 | { |
| 3680 | case ID_USE_LINEAR_COLOURS: |
| 3681 | if(getValue(prop, compiler, bval)) |
| 3682 | { |
| 3683 | params->setUseLinearColours(bval); |
| 3684 | } |
| 3685 | break; |
| 3686 | case ID_SHARED_PARAMS_REF: |
| 3687 | if(getValue(prop, compiler, value)) |
| 3688 | { |
| 3689 | try |
| 3690 | { |
| 3691 | params->addSharedParameters(value); |
| 3692 | } |
| 3693 | catch(Exception& e) |
| 3694 | { |
| 3695 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 3696 | e.getDescription()); |
| 3697 | } |
| 3698 | } |
| 3699 | break; |
| 3700 | //TODO Refactor this case. |
| 3701 | case ID_PARAM_INDEXED: |
| 3702 | case ID_PARAM_NAMED: |
| 3703 | { |
| 3704 | if(prop->values.size() >= 3) |
| 3705 | { |
| 3706 | bool named = (prop->id == ID_PARAM_NAMED); |
| 3707 | AbstractNodeList::const_iterator i0 = getNodeAt(prop->values, 0), i1 = getNodeAt(prop->values, 1), |
| 3708 | k = getNodeAt(prop->values, 2); |
| 3709 | |
| 3710 | if((*i0)->type != ANT_ATOM || (*i1)->type != ANT_ATOM) |
| 3711 | { |
| 3712 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 3713 | "name or index and parameter type expected"); |
| 3714 | return; |
| 3715 | } |
| 3716 | |
| 3717 | String name; |
| 3718 | uint32 index = 0; |
| 3719 | |
| 3720 | AtomAbstractNode *atom0 = (AtomAbstractNode*)(*i0).get(), *atom1 = (AtomAbstractNode*)(*i1).get(); |
| 3721 | |
| 3722 | // Assign the name/index |
| 3723 | if(named) |
| 3724 | name = atom0->value; |
nothing calls this directly
no test coverage detected