MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / AddTextureMatrix

Method AddTextureMatrix

src/world/WorldScript.cpp:347–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345//============================================================================//
346
347int 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

Callers

nothing calls this directly

Calls 15

setStaticSpinMethod · 0.80
setDynamicSpinMethod · 0.80
GetFVec2Method · 0.80
setDynamicShiftMethod · 0.80
setDynamicCenterMethod · 0.80
setDynamicSpinVarMethod · 0.80
setDynamicShiftVarMethod · 0.80
setDynamicScaleVarMethod · 0.80
addMatrixMethod · 0.80
IsValidMethod · 0.45
GetFloatMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected