aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/scene/icamera.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2018-06-30 16:15:05 -0600
committerAlexander Pickering <alex@cogarr.net>2018-06-30 16:15:05 -0600
commited58795eaf03bdee0b1fae8d05ce5b86d17549f7 (patch)
tree065092f3e95bf74fdba541f6c5f7504757487d3d /src/client/lua_api/scene/icamera.cpp
parent45e61c74802af739736d33c82f27596b45987eee (diff)
downloadbrokengine-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/icamera.cpp')
-rw-r--r--src/client/lua_api/scene/icamera.cpp48
1 files changed, 26 insertions, 22 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;
}