Files
NazaraEngine/SDK/src/NDK/LuaBinding_Graphics.cpp
Lynix d7b7135e27 Lua/LuaClass: Fix argument count via GetStackTop (Close #75)
Former-commit-id: 3a0e60a6e7ec7c85ff5f179cc84a468d8c0682f4 [formerly f0712658e69c7ced1fa46f8878f96776d6b36567] [formerly 3035b072473d17863c3c0f6950451ccf582c107e [formerly fe3cbf8a2cf87cf6cc3d3e8577011159bff04387]]
Former-commit-id: df8812d712d28efc2bc83258df53dcb21bbb4b2d [formerly 6d2d8773c96d406690bd5cfc19cef7d1706ff6fc]
Former-commit-id: 461fec0cc2dd99690a3de10436730514712beb73
2016-10-03 19:49:43 +02:00

60 lines
2.0 KiB
C++

// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
#include <NDK/LuaBinding.hpp>
#include <NDK/LuaAPI.hpp>
namespace Ndk
{
/*!
* \brief Binds Graphics module to Lua
*/
void LuaBinding::BindGraphics()
{
/*********************************** Nz::InstancedRenderable ***********************************/
/*********************************** Nz::Model ***********************************/
modelClass.Inherit<Nz::InstancedRenderableRef>(instancedRenderable, [] (Nz::ModelRef* model) -> Nz::InstancedRenderableRef*
{
return reinterpret_cast<Nz::InstancedRenderableRef*>(model); //TODO: Make a ObjectRefCast
});
modelClass.SetConstructor([] (Nz::LuaInstance& lua, Nz::ModelRef* model, std::size_t argumentCount)
{
NazaraUnused(argumentCount);
Nz::PlacementNew(model, Nz::Model::New());
return true;
});
//modelClass.SetMethod("GetMaterial", &Nz::Model::GetMaterial);
modelClass.BindMethod("GetMaterialCount", &Nz::Model::GetMaterialCount);
//modelClass.SetMethod("GetMesh", &Nz::Model::GetMesh);
modelClass.BindMethod("GetSkin", &Nz::Model::GetSkin);
modelClass.BindMethod("GetSkinCount", &Nz::Model::GetSkinCount);
modelClass.BindMethod("IsAnimated", &Nz::Model::IsAnimated);
modelClass.BindMethod("LoadFromFile", &Nz::Model::LoadFromFile, Nz::ModelParameters());
modelClass.BindMethod("Reset", &Nz::Model::Reset);
//modelClass.SetMethod("SetMaterial", &Nz::Model::SetMaterial);
//modelClass.SetMethod("SetMesh", &Nz::Model::SetMesh);
//modelClass.SetMethod("SetSequence", &Nz::Model::SetSequence);
modelClass.BindMethod("SetSkin", &Nz::Model::SetSkin);
modelClass.BindMethod("SetSkinCount", &Nz::Model::SetSkinCount);
}
/*!
* \brief Registers the classes that will be used by the Lua instance
*
* \param instance Lua instance that will interact with the Graphics classes
*/
void LuaBinding::RegisterGraphics(Nz::LuaInstance& instance)
{
instancedRenderable.Register(instance);
modelClass.Register(instance);
}
}