X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FTexture.cc;h=7f9f83c335b98eb7f8a39d4e02023ef0b6f68708;hp=3ca067af4ebe72dcc6552b92b3aa2c1aab09f07a;hb=4107dd30ca1a4c7d1a5cd6c0999b9afb5adff779;hpb=58c1f9a499d3bb80ea2869b29c714f61e656d48d diff --git a/src/Moof/Texture.cc b/src/Moof/Texture.cc index 3ca067a..7f9f83c 100644 --- a/src/Moof/Texture.cc +++ b/src/Moof/Texture.cc @@ -89,20 +89,18 @@ class Texture::Impl : public Manager } - static void bindScriptConstants(Mf::Script& script) + static void bindScriptConstants(Script& script) { - script.push(GL_CLAMP); script.set("CLAMP"); - script.push(GL_REPEAT); script.set("REPEAT"); - script.push(GL_LINEAR); script.set("LINEAR"); - script.push(GL_NEAREST); script.set("NEAREST"); - script.push(GL_LINEAR_MIPMAP_LINEAR); - script.set("LINEAR_MIPMAP_LINEAR"); - script.push(GL_LINEAR_MIPMAP_NEAREST); - script.set("LINEAR_MIPMAP_NEAREST"); - script.push(GL_NEAREST_MIPMAP_LINEAR); - script.set("NEAREST_MIPMAP_LINEAR"); - script.push(GL_NEAREST_MIPMAP_NEAREST); - script.set("NEAREST_MIPMAP_NEAREST"); + Script::Slot g = script.globals(); + + g.setField("CLAMP", GL_CLAMP); + g.setField("REPEAT", GL_REPEAT); + g.setField("LINEAR", GL_LINEAR); + g.setField("NEAREST", GL_NEAREST); + g.setField("LINEAR_MIPMAP_LINEAR", GL_LINEAR_MIPMAP_LINEAR); + g.setField("LINEAR_MIPMAP_NEAREST", GL_LINEAR_MIPMAP_NEAREST); + g.setField("NEAREST_MIPMAP_LINEAR", GL_NEAREST_MIPMAP_LINEAR); + g.setField("NEAREST_MIPMAP_NEAREST", GL_NEAREST_MIPMAP_NEAREST); } public: @@ -228,42 +226,29 @@ public: mImage->flip(); - Mf::Script script; + Script script; importLogFunctions(script); bindScriptConstants(script); - if (script.doString(mImage->getComment()) != Mf::Script::SUCCESS) + if (script.doString(mImage->getComment()) != Script::SUCCESS) { std::string str; script[-1].get(str); - Mf::logWarning(str); + logWarning(str); } else { - Mf::logInfo << "loading tiles from texture " << path - << std::endl; - - Mf::Script::Slot globals = script.getGlobalTable(); - Mf::Script::Slot top = script[-1]; - - globals.pushField("tiles_s"); - top.get(mTilesS); - - globals.pushField("tiles_t"); - top.get(mTilesT); - - globals.pushField("min_filter"); - top.get(mMinFilter); - - globals.pushField("mag_filter"); - top.get(mMagFilter); - - globals.pushField("wrap_s"); - top.get(mWrapS); - - globals.pushField("wrap_t"); - top.get(mWrapT); + logInfo << "loading tiles from texture " << path + << std::endl; + + Script::Slot globals = script.globals(); + globals.get(mTilesS, "tiles_s"); + globals.get(mTilesT, "tiles_t"); + globals.get(mMinFilter, "min_filter"); + globals.get(mMagFilter, "mag_filter"); + globals.get(mWrapS, "wrap_s"); + globals.get(mWrapT, "wrap_t"); } }