diff options
| author | Alexander Pickering <alex@cogarr.net> | 2018-06-30 16:15:05 -0600 |
|---|---|---|
| committer | Alexander Pickering <alex@cogarr.net> | 2018-06-30 16:15:05 -0600 |
| commit | ed58795eaf03bdee0b1fae8d05ce5b86d17549f7 (patch) | |
| tree | 065092f3e95bf74fdba541f6c5f7504757487d3d /src/client/lua_api/scene | |
| parent | 45e61c74802af739736d33c82f27596b45987eee (diff) | |
| download | brokengine-ed58795eaf03bdee0b1fae8d05ce5b86d17549f7.tar.gz brokengine-ed58795eaf03bdee0b1fae8d05ce5b86d17549f7.tar.bz2 brokengine-ed58795eaf03bdee0b1fae8d05ce5b86d17549f7.zip | |
Warning-less build
All compile warning for -Wall have been fixed
Diffstat (limited to 'src/client/lua_api/scene')
| -rw-r--r-- | src/client/lua_api/scene/icamera.cpp | 48 | ||||
| -rw-r--r-- | src/client/lua_api/scene/igeneric.cpp | 10 | ||||
| -rw-r--r-- | src/client/lua_api/scene/ilight.cpp | 18 | ||||
| -rw-r--r-- | src/client/lua_api/scene/imesh.cpp | 10 |
4 files changed, 45 insertions, 41 deletions
diff --git a/src/client/lua_api/scene/icamera.cpp b/src/client/lua_api/scene/icamera.cpp index 654fc7b..0554ce1 100644 --- a/src/client/lua_api/scene/icamera.cpp +++ b/src/client/lua_api/scene/icamera.cpp @@ -22,11 +22,11 @@ using namespace core; extern IrrlichtDevice* device; -static LISceneNode* checkiscenecamera(lua_State* L, int index){ - void* ud = luaL_checkudata(L,index,"scene.iscenecamera"); - luaL_argcheck(L,ud != NULL, index, "'scene.iscenecamera' expected"); - return (LISceneNode*) ud; -} +//static LISceneNode* checkiscenecamera(lua_State* L, int index){ + //void* ud = luaL_checkudata(L,index,"scene.iscenecamera"); + //luaL_argcheck(L,ud != NULL, index, "'scene.iscenecamera' expected"); + //return (LISceneNode*) ud; +//} /* static LISceneNode* checkiscenecamera(lua_State* L){ @@ -34,11 +34,11 @@ static LISceneNode* checkiscenecamera(lua_State* L){ } */ -static LISceneNode* checkismayacamera(lua_State* L, int index){ - void* ud = luaL_checkudata(L,index,"scene.iscenemayacamera"); - luaL_argcheck(L,ud != NULL, index, "'scene.iscenemayacamera' expected"); - return (LISceneNode*) ud; -} +//static LISceneNode* checkismayacamera(lua_State* L, int index){ + //void* ud = luaL_checkudata(L,index,"scene.iscenemayacamera"); + //luaL_argcheck(L,ud != NULL, index, "'scene.iscenemayacamera' expected"); + //return (LISceneNode*) ud; +//} /* static LISceneNode* checkismayacamera(lua_State* L){ return checkismayacamera(L,1); @@ -94,24 +94,28 @@ static int newiscenefpscamera(lua_State* L){// return 1; } -//iscenecamera.new(Vector position, Vector lookat, parrent) +//iscenecamera.new(Vector position, Vector lookat,{node=parent}) static int newiscenecamera(lua_State* L){ printf("Createing camera!\n"); int nargs = lua_gettop(L); double px,py,pz; double lx,ly,lz; - - int parent = lua_tonumber(L,-1); - lua_pop(L,1); + ISceneNode* parent = NULL; + if(nargs == 3){ + lua_getfield(L,-1,"node");//{position},{lookat},{parent},ud_ISceneNode + parent = (ISceneNode*)lua_touserdata(L,-1); + lua_pop(L,2);//{position},{lookat} + } + //{position},{lookat} //The position of the camera - popvector3d(L,&px,&py,&pz); + popvector3d(L,&px,&py,&pz);//{position} printf("position of camera was %f,%f,%f\n",px,py,pz); - popvector3d(L,&lx,&ly,&lz); + popvector3d(L,&lx,&ly,&lz);// printf("lookat of camera was %f,%f,%f\n",lx,ly,lz); //If the element has a parrent if(nargs >= 3){ - printf("got the parrent\n"); + printf("got the parrent, %p\n",parent); } @@ -119,11 +123,11 @@ static int newiscenecamera(lua_State* L){ ISceneManager* smgr = device->getSceneManager(); ICameraSceneNode* cam = smgr->addCameraSceneNode(0, vector3df(px,py,pz), vector3df(lx,ly,lz)); printf("Registered the camera!\n"); - lua_newtable(L); - lua_pushlightuserdata(L,cam); - lua_setfield(L,-2,"node"); - luaL_getmetatable(L,"scene.icamera"); - lua_setmetatable(L,-2); + lua_newtable(L);//{} + lua_pushlightuserdata(L,cam);//{},ud_cam + lua_setfield(L,-2,"node");//{node=ud_cam} + luaL_getmetatable(L,"scene.icamera");//{node=ud_cam},{scene.icamera} + lua_setmetatable(L,-2);//{cam} return 1; } diff --git a/src/client/lua_api/scene/igeneric.cpp b/src/client/lua_api/scene/igeneric.cpp index 4619064..c60aa90 100644 --- a/src/client/lua_api/scene/igeneric.cpp +++ b/src/client/lua_api/scene/igeneric.cpp @@ -35,14 +35,14 @@ int iscenegetpos(lua_State* L){//{node=ud_IMeshSceneNode} return 1; } -int iscenesetpos(lua_State* L){//{node=ud_IMeshSceneNode},{x,y,z} +int iscenesetpos(lua_State* L){//{node=ISceneNode},{x,y,z} double x,y,z; - popvector3d(L,&x,&y,&z);//{node=ud_IMeshSceneNode} - lua_getfield(L,-1,"node");//{node=ud_IMeshSceneNode},ud_IMeshSceneNode - ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1);//{node=ud_IMeshSceneNode},ud_IMeshSceneNode + popvector3d(L,&x,&y,&z);//{node=ud_ISceneNode} + lua_getfield(L,-1,"node");//{node=ud_ISceneNode},ud_ISceneNode + ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1);//{node=ud_ISceneNode},ud_ISceneNode i->setPosition(vector3df(x,y,z)); i->updateAbsolutePosition(); - vector3df pos = i->getAbsolutePosition(); + //vector3df pos = i->getAbsolutePosition(); //printf("After setting pos, new pos is %f %f %f",pos.X,pos.Y,pos.Z); lua_pop(L,2);// return 0; diff --git a/src/client/lua_api/scene/ilight.cpp b/src/client/lua_api/scene/ilight.cpp index 8f52f2d..7473bfa 100644 --- a/src/client/lua_api/scene/ilight.cpp +++ b/src/client/lua_api/scene/ilight.cpp @@ -22,15 +22,15 @@ using namespace core; extern IrrlichtDevice* device; -static LISceneNode* checkiscenelight(lua_State* L, int index){ - void* ud = luaL_checkudata(L,index,"scene.ilight"); - luaL_argcheck(L,ud != NULL, index, "'scene.ilight' expected"); - return (LISceneNode*) ud; -} - -static LISceneNode* checkilight(lua_State* L){ - return checkiscenelight(L,1); -} +//static LISceneNode* checkiscenelight(lua_State* L, int index){ + //void* ud = luaL_checkudata(L,index,"scene.ilight"); + //luaL_argcheck(L,ud != NULL, index, "'scene.ilight' expected"); + //return (LISceneNode*) ud; +//} + +//static LISceneNode* checkilight(lua_State* L){ + //return checkiscenelight(L,1); +//} //{} :: scene.newlight(radius, {v3 position}) static int newiscenelight(lua_State* L){ diff --git a/src/client/lua_api/scene/imesh.cpp b/src/client/lua_api/scene/imesh.cpp index c72e83a..b5c8939 100644 --- a/src/client/lua_api/scene/imesh.cpp +++ b/src/client/lua_api/scene/imesh.cpp @@ -23,11 +23,11 @@ using namespace video; extern IrrlichtDevice* device; -static LISceneNode* checkismesh(lua_State* L, int index){ - void* ud = luaL_checkudata(L,index,"scene.imesh"); - luaL_argcheck(L,ud != NULL, index, "'scene.imesh' expected"); - return (LISceneNode*) ud; -} +//static LISceneNode* checkismesh(lua_State* L, int index){ + //void* ud = luaL_checkudata(L,index,"scene.imesh"); + //luaL_argcheck(L,ud != NULL, index, "'scene.imesh' expected"); + //return (LISceneNode*) ud; +//} /* static LISceneNode* checkismesh(lua_State* L){ |
