summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/AllToLua.pkg1
-rw-r--r--source/Bindings.cpp605
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BoundingBox.cpp195
-rw-r--r--source/BoundingBox.h67
5 files changed, 862 insertions, 8 deletions
diff --git a/source/AllToLua.pkg b/source/AllToLua.pkg
index 8d87be307..b423c43a5 100644
--- a/source/AllToLua.pkg
+++ b/source/AllToLua.pkg
@@ -53,6 +53,7 @@ $cfile "Vector3d.h"
$cfile "Vector3i.h"
$cfile "Matrix4f.h"
$cfile "Cuboid.h"
+$cfile "BoundingBox.h"
$cfile "Tracer.h"
$cfile "Group.h"
$cfile "BlockArea.h"
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index cbe728cbf..871fd9c9c 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 08/30/13 18:03:04.
+** Generated automatically by tolua++-1.0.92 on 09/01/13 12:24:41.
*/
#ifndef __cplusplus
@@ -53,6 +53,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
#include "Vector3i.h"
#include "Matrix4f.h"
#include "Cuboid.h"
+#include "BoundingBox.h"
#include "Tracer.h"
#include "Group.h"
#include "BlockArea.h"
@@ -163,6 +164,13 @@ static int tolua_collect_cTracer (lua_State* tolua_S)
return 0;
}
+static int tolua_collect_cBoundingBox (lua_State* tolua_S)
+{
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ Mtolua_delete(self);
+ return 0;
+}
+
static int tolua_collect_Vector3f (lua_State* tolua_S)
{
Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0);
@@ -204,13 +212,14 @@ static int tolua_collect_Vector3d (lua_State* tolua_S)
static void tolua_reg_types (lua_State* tolua_S)
{
tolua_usertype(tolua_S,"cThrownEnderPearlEntity");
- tolua_usertype(tolua_S,"TakeDamageInfo");
tolua_usertype(tolua_S,"cPluginManager");
+ tolua_usertype(tolua_S,"TakeDamageInfo");
tolua_usertype(tolua_S,"cMonster");
- tolua_usertype(tolua_S,"cCraftingGrid");
+ tolua_usertype(tolua_S,"cCuboid");
+ tolua_usertype(tolua_S,"cWindow");
tolua_usertype(tolua_S,"cCraftingRecipe");
tolua_usertype(tolua_S,"cPlugin");
- tolua_usertype(tolua_S,"cWindow");
+ tolua_usertype(tolua_S,"cCraftingGrid");
tolua_usertype(tolua_S,"cStringMap");
tolua_usertype(tolua_S,"cItemGrid");
tolua_usertype(tolua_S,"cBlockArea");
@@ -218,12 +227,12 @@ static void tolua_reg_types (lua_State* tolua_S)
tolua_usertype(tolua_S,"cLuaWindow");
tolua_usertype(tolua_S,"cServer");
tolua_usertype(tolua_S,"cRoot");
- tolua_usertype(tolua_S,"cCuboid");
- tolua_usertype(tolua_S,"std::vector<cIniFile::key>");
tolua_usertype(tolua_S,"cGroup");
+ tolua_usertype(tolua_S,"std::vector<cIniFile::key>");
+ tolua_usertype(tolua_S,"cTracer");
tolua_usertype(tolua_S,"cPickup");
tolua_usertype(tolua_S,"std::vector<std::string>");
- tolua_usertype(tolua_S,"cTracer");
+ tolua_usertype(tolua_S,"cBoundingBox");
tolua_usertype(tolua_S,"cClientHandle");
tolua_usertype(tolua_S,"cChunkDesc");
tolua_usertype(tolua_S,"cFurnaceRecipe");
@@ -22316,6 +22325,559 @@ static int tolua_AllToLua_cCuboid_IsSorted00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: new of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new00
+static int tolua_AllToLua_cBoundingBox_new00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,6,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,7,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,8,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ double a_MinX = ((double) tolua_tonumber(tolua_S,2,0));
+ double a_MaxX = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_MinY = ((double) tolua_tonumber(tolua_S,4,0));
+ double a_MaxY = ((double) tolua_tonumber(tolua_S,5,0));
+ double a_MinZ = ((double) tolua_tonumber(tolua_S,6,0));
+ double a_MaxZ = ((double) tolua_tonumber(tolua_S,7,0));
+ {
+ cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox");
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new_local of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new00_local
+static int tolua_AllToLua_cBoundingBox_new00_local(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,6,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,7,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,8,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ double a_MinX = ((double) tolua_tonumber(tolua_S,2,0));
+ double a_MaxX = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_MinY = ((double) tolua_tonumber(tolua_S,4,0));
+ double a_MaxY = ((double) tolua_tonumber(tolua_S,5,0));
+ double a_MinZ = ((double) tolua_tonumber(tolua_S,6,0));
+ double a_MaxZ = ((double) tolua_tonumber(tolua_S,7,0));
+ {
+ cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new01
+static int tolua_AllToLua_cBoundingBox_new01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) ||
+ (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0));
+ const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0));
+ {
+ cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Min,*a_Max));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox");
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_new00(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new_local of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new01_local
+static int tolua_AllToLua_cBoundingBox_new01_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) ||
+ (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0));
+ const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0));
+ {
+ cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Min,*a_Max));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_new00_local(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new02
+static int tolua_AllToLua_cBoundingBox_new02(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ const Vector3d* a_Pos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0));
+ double a_Radius = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_Height = ((double) tolua_tonumber(tolua_S,4,0));
+ {
+ cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Pos,a_Radius,a_Height));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox");
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_new01(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new_local of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new02_local
+static int tolua_AllToLua_cBoundingBox_new02_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ const Vector3d* a_Pos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0));
+ double a_Radius = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_Height = ((double) tolua_tonumber(tolua_S,4,0));
+ {
+ cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Pos,a_Radius,a_Height));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_new01_local(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new03
+static int tolua_AllToLua_cBoundingBox_new03(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ const cBoundingBox* a_Orig = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0));
+ {
+ cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Orig));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox");
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_new02(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new_local of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new03_local
+static int tolua_AllToLua_cBoundingBox_new03_local(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ const cBoundingBox* a_Orig = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0));
+ {
+ cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Orig));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_new02_local(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Move of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Move00
+static int tolua_AllToLua_cBoundingBox_Move00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ double a_OffX = ((double) tolua_tonumber(tolua_S,2,0));
+ double a_OffY = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_OffZ = ((double) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Move'", NULL);
+#endif
+ {
+ self->Move(a_OffX,a_OffY,a_OffZ);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'Move'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Move of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Move01
+static int tolua_AllToLua_cBoundingBox_Move01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ const Vector3d* a_Off = ((const Vector3d*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Move'", NULL);
+#endif
+ {
+ self->Move(*a_Off);
+ }
+ }
+ return 0;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_Move00(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Expand of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Expand00
+static int tolua_AllToLua_cBoundingBox_Expand00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ double a_ExpandX = ((double) tolua_tonumber(tolua_S,2,0));
+ double a_ExpandY = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_ExpandZ = ((double) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Expand'", NULL);
+#endif
+ {
+ self->Expand(a_ExpandX,a_ExpandY,a_ExpandZ);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'Expand'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: DoesIntersect of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_DoesIntersect00
+static int tolua_AllToLua_cBoundingBox_DoesIntersect00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ const cBoundingBox* a_Other = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DoesIntersect'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->DoesIntersect(*a_Other);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'DoesIntersect'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Union of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Union00
+static int tolua_AllToLua_cBoundingBox_Union00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ const cBoundingBox* a_Other = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Union'", NULL);
+#endif
+ {
+ cBoundingBox tolua_ret = (cBoundingBox) self->Union(*a_Other);
+ {
+#ifdef __cplusplus
+ void* tolua_obj = Mtolua_new((cBoundingBox)(tolua_ret));
+ tolua_pushusertype(tolua_S,tolua_obj,"cBoundingBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+#else
+ void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cBoundingBox));
+ tolua_pushusertype(tolua_S,tolua_obj,"cBoundingBox");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+#endif
+ }
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'Union'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: IsInside of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside00
+static int tolua_AllToLua_cBoundingBox_IsInside00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ const Vector3d* a_Point = ((const Vector3d*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->IsInside(*a_Point);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'IsInside'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: IsInside of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside01
+static int tolua_AllToLua_cBoundingBox_IsInside01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ double a_X = ((double) tolua_tonumber(tolua_S,2,0));
+ double a_Y = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_Z = ((double) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->IsInside(a_X,a_Y,a_Z);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_IsInside00(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: IsInside of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside02
+static int tolua_AllToLua_cBoundingBox_IsInside02(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cBoundingBox",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ cBoundingBox* a_Other = ((cBoundingBox*) tolua_tousertype(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->IsInside(*a_Other);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_IsInside01(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: IsInside of class cBoundingBox */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside03
+static int tolua_AllToLua_cBoundingBox_IsInside03(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) ||
+ (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0);
+ const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0));
+ const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->IsInside(*a_Min,*a_Max);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBoundingBox_IsInside02(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: new of class cTracer */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_new00
static int tolua_AllToLua_cTracer_new00(lua_State* tolua_S)
@@ -28280,6 +28842,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"dtFireContact",dtFireContact);
tolua_constant(tolua_S,"dtInVoid",dtInVoid);
tolua_constant(tolua_S,"dtPotionOfHarming",dtPotionOfHarming);
+ tolua_constant(tolua_S,"dtEnderPearl",dtEnderPearl);
tolua_constant(tolua_S,"dtAdmin",dtAdmin);
tolua_constant(tolua_S,"dtPawnAttack",dtPawnAttack);
tolua_constant(tolua_S,"dtEntityAttack",dtEntityAttack);
@@ -29329,6 +29892,34 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"IsSorted",tolua_AllToLua_cCuboid_IsSorted00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
+ tolua_cclass(tolua_S,"cBoundingBox","cBoundingBox","",tolua_collect_cBoundingBox);
+ #else
+ tolua_cclass(tolua_S,"cBoundingBox","cBoundingBox","",NULL);
+ #endif
+ tolua_beginmodule(tolua_S,"cBoundingBox");
+ tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new00);
+ tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new00_local);
+ tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new00_local);
+ tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new01);
+ tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new01_local);
+ tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new01_local);
+ tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new02);
+ tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new02_local);
+ tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new02_local);
+ tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new03);
+ tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new03_local);
+ tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new03_local);
+ tolua_function(tolua_S,"Move",tolua_AllToLua_cBoundingBox_Move00);
+ tolua_function(tolua_S,"Move",tolua_AllToLua_cBoundingBox_Move01);
+ tolua_function(tolua_S,"Expand",tolua_AllToLua_cBoundingBox_Expand00);
+ tolua_function(tolua_S,"DoesIntersect",tolua_AllToLua_cBoundingBox_DoesIntersect00);
+ tolua_function(tolua_S,"Union",tolua_AllToLua_cBoundingBox_Union00);
+ tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside00);
+ tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside01);
+ tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside02);
+ tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside03);
+ tolua_endmodule(tolua_S);
+ #ifdef __cplusplus
tolua_cclass(tolua_S,"cTracer","cTracer","",tolua_collect_cTracer);
#else
tolua_cclass(tolua_S,"cTracer","cTracer","",NULL);
diff --git a/source/Bindings.h b/source/Bindings.h
index faa81e4c8..8ff6ee2c6 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 08/30/13 18:03:05.
+** Generated automatically by tolua++-1.0.92 on 09/01/13 12:24:42.
*/
/* Exported function */
diff --git a/source/BoundingBox.cpp b/source/BoundingBox.cpp
new file mode 100644
index 000000000..9af726223
--- /dev/null
+++ b/source/BoundingBox.cpp
@@ -0,0 +1,195 @@
+
+// BoundingBox.cpp
+
+// Implements the cBoundingBox class representing an axis-aligned bounding box with floatingpoint coords
+
+#include "Globals.h"
+#include "BoundingBox.h"
+
+
+
+
+
+cBoundingBox::cBoundingBox(double a_MinX, double a_MaxX, double a_MinY, double a_MaxY, double a_MinZ, double a_MaxZ) :
+ m_Min(a_MinX, a_MinY, a_MinZ),
+ m_Max(a_MaxX, a_MaxY, a_MaxZ)
+{
+}
+
+
+
+
+
+cBoundingBox::cBoundingBox(const Vector3d & a_Min, const Vector3d & a_Max) :
+ m_Min(a_Min),
+ m_Max(a_Max)
+{
+}
+
+
+
+
+
+cBoundingBox::cBoundingBox(const Vector3d & a_Pos, double a_Radius, double a_Height) :
+ m_Min(a_Pos.x - a_Radius, a_Pos.y, a_Pos.z - a_Radius),
+ m_Max(a_Pos.x + a_Radius, a_Pos.y + a_Height, a_Pos.z + a_Radius)
+{
+}
+
+
+
+
+
+cBoundingBox::cBoundingBox(const cBoundingBox & a_Orig) :
+ m_Min(a_Orig.m_Min),
+ m_Max(a_Orig.m_Max)
+{
+}
+
+
+
+
+
+void cBoundingBox::Move(double a_OffX, double a_OffY, double a_OffZ)
+{
+ m_Min.x += a_OffX;
+ m_Min.y += a_OffY;
+ m_Min.z += a_OffZ;
+ m_Max.x += a_OffX;
+ m_Max.y += a_OffY;
+ m_Max.z += a_OffZ;
+}
+
+
+
+
+
+void cBoundingBox::Move(const Vector3d & a_Off)
+{
+ m_Min.x += a_Off.x;
+ m_Min.y += a_Off.y;
+ m_Min.z += a_Off.z;
+ m_Max.x += a_Off.x;
+ m_Max.y += a_Off.y;
+ m_Max.z += a_Off.z;
+}
+
+
+
+
+
+void cBoundingBox::Expand(double a_ExpandX, double a_ExpandY, double a_ExpandZ)
+{
+ m_Min.x -= a_ExpandX;
+ m_Min.y -= a_ExpandY;
+ m_Min.z -= a_ExpandZ;
+ m_Max.x += a_ExpandX;
+ m_Max.y += a_ExpandY;
+ m_Max.z += a_ExpandZ;
+}
+
+
+
+
+
+bool cBoundingBox::DoesIntersect(const cBoundingBox & a_Other)
+{
+ return (
+ ((a_Other.m_Min.x < m_Max.x) && (a_Other.m_Max.x > m_Min.x)) && // X coords intersect
+ ((a_Other.m_Min.y < m_Max.y) && (a_Other.m_Max.y > m_Min.y)) && // Y coords intersect
+ ((a_Other.m_Min.z < m_Max.z) && (a_Other.m_Max.z > m_Min.z)) // Z coords intersect
+ );
+}
+
+
+
+
+
+cBoundingBox cBoundingBox::Union(const cBoundingBox & a_Other)
+{
+ return cBoundingBox(
+ std::min(m_Min.x, a_Other.m_Min.x),
+ std::min(m_Min.y, a_Other.m_Min.y),
+ std::min(m_Min.z, a_Other.m_Min.z),
+ std::max(m_Max.x, a_Other.m_Max.x),
+ std::max(m_Max.y, a_Other.m_Max.y),
+ std::max(m_Max.z, a_Other.m_Max.z)
+ );
+}
+
+
+
+
+
+bool cBoundingBox::IsInside(const Vector3d & a_Point)
+{
+ return (
+ ((a_Point.x >= m_Min.x) && (a_Point.x < m_Max.x)) &&
+ ((a_Point.y >= m_Min.y) && (a_Point.y < m_Max.y)) &&
+ ((a_Point.z >= m_Min.z) && (a_Point.z < m_Max.z))
+ );
+}
+
+
+
+
+
+bool cBoundingBox::IsInside(double a_X, double a_Y,double a_Z)
+{
+ return (
+ ((a_X >= m_Min.x) && (a_X < m_Max.x)) &&
+ ((a_Y >= m_Min.y) && (a_Y < m_Max.y)) &&
+ ((a_Z >= m_Min.z) && (a_Z < m_Max.z))
+ );
+}
+
+
+
+
+
+bool cBoundingBox::IsInside(cBoundingBox & a_Other)
+{
+ // If both a_Other's coords are inside this, then the entire a_Other is inside
+ return (IsInside(a_Other.m_Min) && IsInside(a_Other.m_Max));
+}
+
+
+
+
+
+bool cBoundingBox::IsInside(const Vector3d & a_Min, const Vector3d & a_Max)
+{
+ // If both coords are inside this, then the entire a_Other is inside
+ return (IsInside(a_Min) && IsInside(a_Max));
+}
+
+
+
+
+
+bool cBoundingBox::Intersect(const cBoundingBox & a_Other, cBoundingBox & a_Intersection)
+{
+ a_Intersection.m_Min.x = std::max(m_Min.x, a_Other.m_Min.x);
+ a_Intersection.m_Max.x = std::min(m_Max.x, a_Other.m_Max.x);
+ if (a_Intersection.m_Min.x >= a_Intersection.m_Max.x)
+ {
+ return false;
+ }
+ a_Intersection.m_Min.y = std::max(m_Min.y, a_Other.m_Min.y);
+ a_Intersection.m_Max.y = std::min(m_Max.y, a_Other.m_Max.y);
+ if (a_Intersection.m_Min.y >= a_Intersection.m_Max.y)
+ {
+ return false;
+ }
+ a_Intersection.m_Min.z = std::max(m_Min.z, a_Other.m_Min.z);
+ a_Intersection.m_Max.z = std::min(m_Max.z, a_Other.m_Max.z);
+ if (a_Intersection.m_Min.z >= a_Intersection.m_Max.z)
+ {
+ return false;
+ }
+ return true;
+}
+
+
+
+
diff --git a/source/BoundingBox.h b/source/BoundingBox.h
new file mode 100644
index 000000000..5a07df20e
--- /dev/null
+++ b/source/BoundingBox.h
@@ -0,0 +1,67 @@
+
+// BoundingBox.h
+
+// Declares the cBoundingBox class representing an axis-aligned bounding box with floatingpoint coords
+
+
+
+
+#pragma once
+
+#include "Vector3d.h"
+
+
+
+
+
+// tolua_begin
+
+class cBoundingBox
+{
+public:
+ cBoundingBox(double a_MinX, double a_MaxX, double a_MinY, double a_MaxY, double a_MinZ, double a_MaxZ);
+ cBoundingBox(const Vector3d & a_Min, const Vector3d & a_Max);
+ cBoundingBox(const Vector3d & a_Pos, double a_Radius, double a_Height);
+ cBoundingBox(const cBoundingBox & a_Orig);
+
+ /// Moves the entire boundingbox by the specified offset
+ void Move(double a_OffX, double a_OffY, double a_OffZ);
+
+ /// Moves the entire boundingbox by the specified offset
+ void Move(const Vector3d & a_Off);
+
+ /// Expands the bounding box by the specified amount in each direction (so the box becomes larger by 2 * Expand in each direction)
+ void Expand(double a_ExpandX, double a_ExpandY, double a_ExpandZ);
+
+ /// Returns true if the two bounding boxes intersect
+ bool DoesIntersect(const cBoundingBox & a_Other);
+
+ /// Returns the union of the two bounding boxes
+ cBoundingBox Union(const cBoundingBox & a_Other);
+
+ /// Returns true if the point is inside the bounding box
+ bool IsInside(const Vector3d & a_Point);
+
+ /// Returns true if the point is inside the bounding box
+ bool IsInside(double a_X, double a_Y,double a_Z);
+
+ /// Returns true if a_Other is inside this bounding box
+ bool IsInside(cBoundingBox & a_Other);
+
+ /// Returns true if a boundingbox specified by a_Min and a_Max is inside this bounding box
+ bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max);
+
+ // tolua_end
+
+ /// Calculates the intersection of the two bounding boxes; returns true if nonempty
+ bool Intersect(const cBoundingBox & a_Other, cBoundingBox & a_Intersection);
+
+protected:
+ Vector3d m_Min;
+ Vector3d m_Max;
+
+} ; // tolua_export
+
+
+
+