From 98c9825c49a1674f59eafb3253829ca7d5cac3c1 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 14 Jan 2019 16:40:14 +0800 Subject: *rename source file --- src/libjin-lua/modules/graphics/je_lua_mesh.cpp | 87 ------------------------- 1 file changed, 87 deletions(-) delete mode 100644 src/libjin-lua/modules/graphics/je_lua_mesh.cpp (limited to 'src/libjin-lua/modules/graphics/je_lua_mesh.cpp') diff --git a/src/libjin-lua/modules/graphics/je_lua_mesh.cpp b/src/libjin-lua/modules/graphics/je_lua_mesh.cpp deleted file mode 100644 index fc42096..0000000 --- a/src/libjin-lua/modules/graphics/je_lua_mesh.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "common/je_lua_object.h" -#include "common/je_lua_common.h" -#include "libjin/jin.h" -#include "je_lua_mesh.h" -#include "je_lua_texture.h" - -using namespace JinEngine::Math; -using namespace JinEngine::Graphics; - -namespace JinEngine -{ - namespace Lua - { - - const char* Jin_Lua_Mesh = "Mesh"; - - LUA_IMPLEMENT inline Mesh* checkMesh(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); - return luaObj->getObject(); - } - - LUA_IMPLEMENT int l_getBound(lua_State* L) - { - Mesh* mesh = checkMesh(L); - BBox bbox = mesh->getBound(); - luax_pushnumber(L, bbox.l); - luax_pushnumber(L, bbox.r); - luax_pushnumber(L, bbox.t); - luax_pushnumber(L, bbox.b); - return 4; - } - - LUA_IMPLEMENT int l_setGraphic(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); - Mesh* mesh = luaObj->getObject(); - luaObj->removeDependency((int)MeshDependency::DEP_GRAPHIC); - LuaObject* obj = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Texture); - mesh->setGraphic(obj->getObject()); - luaObj->setDependency((int)MeshDependency::DEP_GRAPHIC, obj); - return 0; - } - - // x, y, u, v, color_table - LUA_IMPLEMENT int l_pushVertex(lua_State* L) - { - Mesh* mesh = checkMesh(L); - float x = luax_checknumber(L, 2); - float y = luax_checknumber(L, 3); - float u = luax_checknumber(L, 4); - float v = luax_checknumber(L, 5); - if (!luax_istable(L, 6)) - { - luax_typerror(L, 6, "color table"); - return 1; - } - Color c; - c.r = luax_rawgetnumberthenpop(L, -1, 1); - c.g = luax_rawgetnumberthenpop(L, -1, 2); - c.b = luax_rawgetnumberthenpop(L, -1, 3); - c.a = luax_rawgetnumberthenpop(L, -1, 4); - mesh->pushVertex(x, y, u, v, c); - return 0; - } - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); - luaObj->release(); - return 0; - } - - LUA_EXPORT void luaopen_Mesh(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "getBound", l_getBound }, - { "setGraphic", l_setGraphic }, - { "pushVertex", l_pushVertex }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Mesh, methods); - } - - } // namespace Lua -} // namespace JinEngine \ No newline at end of file -- cgit v1.1-26-g67d0