MCPcopy Create free account
hub / github.com/OGRECave/ogre / translateSamplerParam

Method translateSamplerParam

OgreMain/src/OgreScriptTranslator.cpp:2316–2462  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 12

getColourFunction · 0.85
addErrorMethod · 0.80
setAddressingModeMethod · 0.80
frontMethod · 0.80
setFilteringMethod · 0.80
getValueFunction · 0.70
emptyMethod · 0.45
getValueMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected