updated lua bindings

This commit is contained in:
turanszkij
2015-09-06 16:43:08 +02:00
parent af52ca36c4
commit 9ecec8cfa3
6 changed files with 29 additions and 16 deletions
+2 -1
View File
@@ -141,7 +141,8 @@ int Vector_BindLua::Transform(lua_State* L)
Matrix_BindLua* mat = Luna<Matrix_BindLua>::lightcheck(L, 2);
if (mat)
{
vector = XMVector4Transform(vector, mat->matrix);
Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMVector4Transform(vector, mat->matrix)));
return 1;
}
else
wiLua::SError(L, "Transform(Matrix matrix) argument is not a Matrix!");
+2 -1
View File
@@ -1,5 +1,6 @@
#include "wiFont_BindLua.h"
#include "wiFont.h"
#include "CommonInclude.h"
const char wiFont_BindLua::className[] = "Font";
@@ -32,7 +33,7 @@ wiFont_BindLua::wiFont_BindLua(lua_State* L)
}
wiFont_BindLua::~wiFont_BindLua()
{
delete font;
SAFE_DELETE(font);
}
+1 -14
View File
@@ -2131,20 +2131,7 @@ void HitSphere::CleanUpStatic()
#pragma region BONE
XMMATRIX Bone::getTransform(int getTranslation, int getRotation, int getScale){
//XMMATRIX& w = XMMatrixTranslation(0,0,length)*XMLoadFloat4x4(&world);
//if(getTranslation&&getRotation&&getScale){
// return w;
//}
//XMVECTOR v[3];
//XMMATRIX& identity = XMMatrixIdentity();
//XMMatrixDecompose(&v[0],&v[1],&v[2],w);
//return (getScale?XMMatrixScalingFromVector(v[0]):identity)*
// (getRotation?XMMatrixRotationQuaternion(v[1]):identity)*
// (getTranslation?XMMatrixTranslationFromVector(v[2]):identity)
// ;
return XMMatrixTranslation(0,0,length)*XMLoadFloat4x4(&world);
}
#pragma endregion
+20
View File
@@ -595,6 +595,7 @@ Luna<Armature_BindLua>::FunctionType Armature_BindLua::methods[] = {
lunamethod(Armature_BindLua, GetAction),
lunamethod(Armature_BindLua, GetActions),
lunamethod(Armature_BindLua, GetBones),
lunamethod(Armature_BindLua, GetBone),
lunamethod(Armature_BindLua, GetFrame),
lunamethod(Armature_BindLua, GetFrameCount),
lunamethod(Armature_BindLua, ChangeAction),
@@ -664,6 +665,25 @@ int Armature_BindLua::GetBones(lua_State *L)
wiLua::SSetString(L, ss.str());
return 1;
}
int Armature_BindLua::GetBone(lua_State *L)
{
if (armature == nullptr)
{
wiLua::SError(L, "GetBone() armature is null!");
return 0;
}
string name = wiLua::SGetString(L, 2);
for (auto& x : armature->boneCollection)
{
if (!x->name.compare(name))
{
Luna<Transform_BindLua>::push(L, new Transform_BindLua(x));
return 1;
}
}
wiLua::SError(L, "GetBone(String name) bone not found!");
return 0;
}
int Armature_BindLua::GetFrame(lua_State* L)
{
if (armature == nullptr)
+1
View File
@@ -114,6 +114,7 @@ public:
int GetAction(lua_State* L);
int GetActions(lua_State* L);
int GetBones(lua_State* L);
int GetBone(lua_State* L);
int GetFrame(lua_State* L);
int GetFrameCount(lua_State* L);
int IsValid(lua_State *L);
+3
View File
@@ -2235,6 +2235,9 @@ void wiRenderer::DrawDebugLines(Camera* camera, ID3D11DeviceContext* context)
BindVertexBuffer(linesTemp[i]->vertexBuffer, 0, sizeof(XMFLOAT3A), context);
Draw(2, context);
}
for (Lines* x : linesTemp)
delete x;
linesTemp.clear();
}
void wiRenderer::DrawDebugBoxes(Camera* camera, ID3D11DeviceContext* context)