| 345 | //============================================================================// |
| 346 | |
| 347 | int WorldScript::AddTextureMatrix(lua_State* L) { |
| 348 | const std::string name = luaL_checkstring(L, 1); |
| 349 | std::auto_ptr<TextureMatrix> texmat(new TextureMatrix); |
| 350 | LuaTable table(L, 2); |
| 351 | if (table.IsValid()) { |
| 352 | float f; |
| 353 | fvec2 f2; |
| 354 | std::string s; |
| 355 | if (table.GetFloat("staticSpin", f)) { texmat->setStaticSpin(f); } |
| 356 | // if (table.GetFVec2("staticShift", f2)) { texmat->setStaticShift(f2); } |
| 357 | // if (table.GetFVec2("staticScale", f2)) { texmat->setStaticScale(f2); } |
| 358 | // if (table.GetFVec2("staticCenter", f2)) { texmat->setStaticCenter(f2); } |
| 359 | |
| 360 | if (table.GetFloat("spin", f)) { texmat->setDynamicSpin(f); } |
| 361 | if (table.GetFVec2("shift", f2)) { texmat->setDynamicShift(f2.s, f2.t); } |
| 362 | // if (table.GetFVec2("scale", f2)) { texmat->setDynamicScale(f2.s, f2.t); } |
| 363 | if (table.GetFVec2("center", f2)) { texmat->setDynamicCenter(f2.s, f2.t); } |
| 364 | |
| 365 | if (table.GetString("spinVar", s)) { texmat->setDynamicSpinVar(s); } |
| 366 | if (table.GetString("shiftVar", s)) { texmat->setDynamicShiftVar(s); } |
| 367 | if (table.GetString("scaleVar", s)) { texmat->setDynamicScaleVar(s); } |
| 368 | } |
| 369 | texmat->setName(name); |
| 370 | texmat->finalize(); |
| 371 | |
| 372 | texmat->print(std::cout, name + ": "); // FIXME |
| 373 | |
| 374 | TEXMATRIXMGR.addMatrix(texmat.release()); |
| 375 | return 0; |
| 376 | } |
| 377 | |
| 378 | //============================================================================// |
| 379 |
nothing calls this directly
no test coverage detected