-------------------------------------------------------------------------
| 2314 | } |
| 2315 | //------------------------------------------------------------------------- |
| 2316 | void SamplerTranslator::translateSamplerParam(ScriptCompiler* compiler, const SamplerPtr& sampler, PropertyAbstractNode* prop) |
| 2317 | { |
| 2318 | bool bval; |
| 2319 | Real fval; |
| 2320 | uint32 uival; |
| 2321 | |
| 2322 | switch(prop->id) |
| 2323 | { |
| 2324 | case ID_TEX_ADDRESS_MODE: |
| 2325 | { |
| 2326 | if(prop->values.empty()) |
| 2327 | { |
| 2328 | compiler->addError(ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line); |
| 2329 | } |
| 2330 | else |
| 2331 | { |
| 2332 | AbstractNodeList::const_iterator i0 = getNodeAt(prop->values, 0), |
| 2333 | i1 = getNodeAt(prop->values, 1), |
| 2334 | i2 = getNodeAt(prop->values, 2); |
| 2335 | Sampler::UVWAddressingMode mode; |
| 2336 | |
| 2337 | if(!getValue(*i0, mode.u)) |
| 2338 | { |
| 2339 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 2340 | (*i0)->getValue() + " not supported as first argument (must be \"wrap\", \"clamp\", \"mirror\", or \"border\")"); |
| 2341 | return; |
| 2342 | } |
| 2343 | mode.v = mode.u; |
| 2344 | mode.w = mode.u; |
| 2345 | |
| 2346 | if(i1 != prop->values.end()) |
| 2347 | { |
| 2348 | if(!getValue(*i1, mode.v)) |
| 2349 | { |
| 2350 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 2351 | (*i1)->getValue() + " not supported as second argument (must be \"wrap\", \"clamp\", \"mirror\", or \"border\")"); |
| 2352 | } |
| 2353 | } |
| 2354 | |
| 2355 | if(i2 != prop->values.end()) |
| 2356 | { |
| 2357 | if(!getValue(*i2, mode.w)) |
| 2358 | { |
| 2359 | compiler->addError(ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line, |
| 2360 | (*i2)->getValue() + " not supported as third argument (must be \"wrap\", \"clamp\", \"mirror\", or \"border\")"); |
| 2361 | } |
| 2362 | } |
| 2363 | |
| 2364 | sampler->setAddressingMode(mode); |
| 2365 | } |
| 2366 | } |
| 2367 | break; |
| 2368 | case ID_TEX_BORDER_COLOUR: |
| 2369 | if(prop->values.empty()) |
| 2370 | { |
| 2371 | compiler->addError(ScriptCompiler::CE_NUMBEREXPECTED, prop->file, prop->line); |
| 2372 | } |
| 2373 | else |
nothing calls this directly
no test coverage detected