-------------------------------------------------------------------------
| 5051 | } |
| 5052 | //------------------------------------------------------------------------- |
| 5053 | void GpuProgramTranslator::translateProgramParameters(ScriptCompiler *compiler, GpuProgramParametersSharedPtr params, ObjectAbstractNode *obj) |
| 5054 | { |
| 5055 | size_t animParametricsCount = 0; |
| 5056 | |
| 5057 | for(AbstractNodeList::iterator i = obj->children.begin(); i != obj->children.end(); ++i) |
| 5058 | { |
| 5059 | if((*i)->type == ANT_PROPERTY) |
| 5060 | { |
| 5061 | PropertyAbstractNode *prop = static_cast<PropertyAbstractNode*>((*i).get()); |
| 5062 | switch(prop->id) |
| 5063 | { |
| 5064 | case ID_SHARED_PARAMS_REF: |
| 5065 | { |
| 5066 | if(prop->values.size() != 1) |
| 5067 | { |
| 5068 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 5069 | "shared_params_ref requires a single parameter"); |
| 5070 | continue; |
| 5071 | } |
| 5072 | |
| 5073 | AbstractNodeList::const_iterator i0 = getNodeAt(prop->values, 0); |
| 5074 | if((*i0)->type != ANT_ATOM) |
| 5075 | { |
| 5076 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 5077 | "shared parameter set name expected"); |
| 5078 | continue; |
| 5079 | } |
| 5080 | AtomAbstractNode *atom0 = (AtomAbstractNode*)(*i0).get(); |
| 5081 | |
| 5082 | try |
| 5083 | { |
| 5084 | params->addSharedParameters(atom0->value); |
| 5085 | } |
| 5086 | catch(Exception& e) |
| 5087 | { |
| 5088 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 5089 | e.getDescription()); |
| 5090 | } |
| 5091 | } |
| 5092 | break; |
| 5093 | //TODO Refactor this case. |
| 5094 | case ID_PARAM_INDEXED: |
| 5095 | case ID_PARAM_NAMED: |
| 5096 | { |
| 5097 | if(prop->values.size() >= 3) |
| 5098 | { |
| 5099 | bool named = (prop->id == ID_PARAM_NAMED); |
| 5100 | AbstractNodeList::const_iterator i0 = getNodeAt(prop->values, 0), i1 = getNodeAt(prop->values, 1), |
| 5101 | k = getNodeAt(prop->values, 2); |
| 5102 | |
| 5103 | if((*i0)->type != ANT_ATOM || (*i1)->type != ANT_ATOM) |
| 5104 | { |
| 5105 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 5106 | "name or index and parameter type expected"); |
| 5107 | return; |
| 5108 | } |
| 5109 | |
| 5110 | AtomAbstractNode *atom0 = (AtomAbstractNode*)(*i0).get(), *atom1 = (AtomAbstractNode*)(*i1).get(); |
nothing calls this directly
no test coverage detected