Merge remote-tracking branch 'refs/remotes/origin/master' into reflection-mapping

This commit is contained in:
Lynix
2017-06-10 22:33:03 +02:00
93 changed files with 7350 additions and 2961 deletions

View File

@@ -23,7 +23,6 @@ namespace Ndk
using Factory = std::function<BaseComponent*()>;
BaseComponent(ComponentIndex componentIndex);
BaseComponent(const BaseComponent&) = default;
BaseComponent(BaseComponent&&) = default;
virtual ~BaseComponent();
@@ -34,10 +33,12 @@ namespace Ndk
inline static ComponentIndex GetMaxComponentIndex();
BaseComponent& operator=(const BaseComponent&) = default;
BaseComponent& operator=(const BaseComponent&) = delete;
BaseComponent& operator=(BaseComponent&&) = default;
protected:
BaseComponent(const BaseComponent&) = default;
ComponentIndex m_componentIndex;
EntityHandle m_entity;

View File

@@ -19,7 +19,7 @@
namespace Nz
{
class LuaInstance;
class LuaState;
}
namespace Ndk
@@ -32,7 +32,7 @@ namespace Ndk
class NDK_API Console : public Nz::Node, public Nz::HandledObject<Console>
{
public:
Console(World& world, const Nz::Vector2f& size, Nz::LuaInstance& instance);
Console(World& world, const Nz::Vector2f& size, Nz::LuaState& state);
Console(const Console& console) = delete;
Console(Console&& console) = default;
~Console() = default;
@@ -83,7 +83,7 @@ namespace Ndk
EntityOwner m_input;
EntityOwner m_inputBackground;
Nz::FontRef m_defaultFont;
Nz::LuaInstance& m_instance;
Nz::LuaState& m_state;
Nz::SpriteRef m_historyBackgroundSprite;
Nz::SpriteRef m_inputBackgroundSprite;
Nz::SimpleTextDrawer m_historyDrawer;

View File

@@ -17,14 +17,17 @@
namespace Ndk
{
class BaseComponent;
class BaseSystem;
class Entity;
class EntityList;
class World;
using EntityHandle = Nz::ObjectHandle<Entity>;
class NDK_API Entity : public Nz::HandledObject<Entity>
{
friend class BaseSystem;
friend BaseSystem;
friend EntityList;
friend World;
public:
@@ -78,13 +81,16 @@ namespace Ndk
inline Nz::Bitset<>& GetRemovedComponentBits();
inline void RegisterEntityList(EntityList* list);
inline void RegisterSystem(SystemIndex index);
inline void SetWorld(World* world) noexcept;
inline void UnregisterEntityList(EntityList* list);
inline void UnregisterSystem(SystemIndex index);
std::vector<std::unique_ptr<BaseComponent>> m_components;
std::vector<EntityList*> m_containedInLists;
Nz::Bitset<> m_componentBits;
Nz::Bitset<> m_removedComponentBits;
Nz::Bitset<> m_systemBits;

View File

@@ -6,6 +6,7 @@
#include <Nazara/Core/Error.hpp>
#include <Nazara/Core/StringStream.hpp>
#include <algorithm>
#include <cassert>
#include <type_traits>
#include <utility>
@@ -257,11 +258,10 @@ namespace Ndk
return m_removedComponentBits;
}
/*!
* \brief Registers a system for the entity
*
* \param index Index of the system
*/
inline void Entity::RegisterEntityList(EntityList* list)
{
m_containedInLists.push_back(list);
}
inline void Entity::RegisterSystem(SystemIndex index)
{
@@ -289,6 +289,16 @@ namespace Ndk
* \param index Index of the system
*/
inline void Entity::UnregisterEntityList(EntityList* list)
{
auto it = std::find(m_containedInLists.begin(), m_containedInLists.end(), list);
assert(it != m_containedInLists.end());
// Swap and pop idiom
*it = m_containedInLists.back();
m_containedInLists.pop_back();
}
inline void Entity::UnregisterSystem(SystemIndex index)
{
m_systemBits.UnboundedReset(index);

View File

@@ -15,6 +15,8 @@ namespace Ndk
{
class NDK_API EntityList
{
friend Entity;
public:
class iterator;
friend iterator;
@@ -23,7 +25,7 @@ namespace Ndk
inline EntityList();
inline EntityList(const EntityList& entityList);
inline EntityList(EntityList&& entityList) noexcept;
~EntityList() = default;
inline ~EntityList();
inline void Clear();
@@ -46,6 +48,7 @@ namespace Ndk
private:
inline std::size_t FindNext(std::size_t currentId) const;
inline World* GetWorld() const;
inline void NotifyEntityDestruction(const Entity* entity);
Nz::Bitset<Nz::UInt64> m_entityBits;
World* m_world;
@@ -56,11 +59,11 @@ namespace Ndk
friend EntityList;
public:
inline iterator(const iterator& iterator);
inline iterator(const iterator& it);
const EntityHandle& operator*() const;
inline iterator& operator=(const iterator& iterator);
inline iterator& operator=(const iterator& it);
inline iterator& operator++();
inline iterator operator++(int);

View File

@@ -5,7 +5,6 @@
#include <NDK/EntityList.hpp>
#include <Nazara/Core/Error.hpp>
#include <algorithm>
#include "EntityList.hpp"
namespace Ndk
{
@@ -30,6 +29,8 @@ namespace Ndk
m_entityBits(entityList.m_entityBits),
m_world(entityList.m_world)
{
for (const Ndk::EntityHandle& entity : *this)
entity->RegisterEntityList(this);
}
/*!
@@ -39,6 +40,17 @@ namespace Ndk
m_entityBits(std::move(entityList.m_entityBits)),
m_world(entityList.m_world)
{
for (const Ndk::EntityHandle& entity : *this)
{
entity->UnregisterEntityList(&entityList);
entity->RegisterEntityList(this);
}
}
inline EntityList::~EntityList()
{
for (const Ndk::EntityHandle& entity : *this)
entity->UnregisterEntityList(this);
}
@@ -49,6 +61,9 @@ namespace Ndk
*/
inline void EntityList::Clear()
{
for (const Ndk::EntityHandle& entity : *this)
entity->UnregisterEntityList(this);
m_entityBits.Clear();
m_world = nullptr;
}
@@ -88,15 +103,18 @@ namespace Ndk
*
* \remark If entity is already contained, no action is performed
* \remark If any entity has been inserted since construction (or last Clear call), the entity must belong to the same world as the previously inserted entities
* \remark It's up to the programmer to remove an entity from this list before its deletion
*/
inline void EntityList::Insert(Entity* entity)
{
NazaraAssert(entity, "Invalid entity");
NazaraAssert(!m_world || entity->GetWorld() == m_world, "Incompatible world");
m_entityBits.UnboundedSet(entity->GetId(), true);
m_world = entity->GetWorld();
if (!Has(entity))
{
entity->RegisterEntityList(this);
m_entityBits.UnboundedSet(entity->GetId(), true);
m_world = entity->GetWorld();
}
}
/*!
@@ -111,7 +129,12 @@ namespace Ndk
*/
inline void EntityList::Remove(Entity* entity)
{
m_entityBits.UnboundedSet(entity->GetId(), false);
if (Has(entity))
{
m_entityBits.Reset(entity->GetId());
entity->UnregisterEntityList(this);
}
}
// STL Interface
@@ -140,14 +163,23 @@ namespace Ndk
m_entityBits = entityList.m_entityBits;
m_world = entityList.m_world;
for (const Ndk::EntityHandle& entity : *this)
entity->RegisterEntityList(this);
return *this;
}
inline EntityList& EntityList::operator=(EntityList && entityList) noexcept
inline EntityList& EntityList::operator=(EntityList&& entityList) noexcept
{
m_entityBits = std::move(entityList.m_entityBits);
m_world = entityList.m_world;
for (const Ndk::EntityHandle& entity : *this)
{
entity->UnregisterEntityList(&entityList);
entity->RegisterEntityList(this);
}
return *this;
}
@@ -161,6 +193,13 @@ namespace Ndk
return m_world;
}
inline void EntityList::NotifyEntityDestruction(const Entity* entity)
{
assert(Has(entity));
m_entityBits.Reset(entity->GetId());
}
inline EntityList::iterator::iterator(const EntityList* list, std::size_t nextId) :
m_nextEntityId(nextId),
@@ -168,16 +207,16 @@ namespace Ndk
{
}
inline EntityList::iterator::iterator(const iterator& iterator) :
m_nextEntityId(iterator.m_nextEntityId),
m_list(iterator.m_list)
inline EntityList::iterator::iterator(const iterator& it) :
m_nextEntityId(it.m_nextEntityId),
m_list(it.m_list)
{
}
inline EntityList::iterator& EntityList::iterator::operator=(const iterator& iterator)
inline EntityList::iterator& EntityList::iterator::operator=(const iterator& it)
{
m_nextEntityId = iterator.m_nextEntityId;
m_list = iterator.m_list;
m_nextEntityId = it.m_nextEntityId;
m_list = it.m_list;
return *this;
}
@@ -216,6 +255,6 @@ namespace Ndk
using std::swap;
std::swap(lhs.m_nextEntityId, rhs.m_nextEntityId);
swap(lhs.m_nextEntityId, rhs.m_nextEntityId);
}
}

View File

@@ -24,7 +24,7 @@ namespace Ndk
template<typename T> void BindComponent(const Nz::String& name);
void RegisterClasses(Nz::LuaInstance& instance);
void RegisterClasses(Nz::LuaState& state);
std::unique_ptr<LuaBinding_Base> core;
std::unique_ptr<LuaBinding_Base> math;
@@ -40,13 +40,13 @@ namespace Ndk
private:
template<typename T>
static int AddComponentOfType(Nz::LuaInstance& lua, EntityHandle& handle);
static int AddComponentOfType(Nz::LuaState& lua, EntityHandle& handle);
template<typename T>
static int PushComponentOfType(Nz::LuaInstance& lua, BaseComponent& component);
static int PushComponentOfType(Nz::LuaState& lua, BaseComponent& component);
using AddComponentFunc = int(*)(Nz::LuaInstance&, EntityHandle&);
using GetComponentFunc = int(*)(Nz::LuaInstance&, BaseComponent&);
using AddComponentFunc = int(*)(Nz::LuaState&, EntityHandle&);
using GetComponentFunc = int(*)(Nz::LuaState&, BaseComponent&);
struct ComponentBinding
{
@@ -56,7 +56,7 @@ namespace Ndk
Nz::String name;
};
ComponentBinding* QueryComponentIndex(Nz::LuaInstance& lua, int argIndex = 2);
ComponentBinding* QueryComponentIndex(Nz::LuaState& lua, int argIndex = 2);
std::vector<ComponentBinding> m_componentBinding;
std::unordered_map<Nz::String, ComponentIndex> m_componentBindingByName;

View File

@@ -33,7 +33,7 @@ namespace Ndk
}
template<typename T>
int LuaBinding::AddComponentOfType(Nz::LuaInstance& lua, EntityHandle& handle)
int LuaBinding::AddComponentOfType(Nz::LuaState& lua, EntityHandle& handle)
{
static_assert(std::is_base_of<BaseComponent, T>::value, "ComponentType must inherit BaseComponent");
@@ -43,7 +43,7 @@ namespace Ndk
}
template<typename T>
int LuaBinding::PushComponentOfType(Nz::LuaInstance& lua, BaseComponent& component)
int LuaBinding::PushComponentOfType(Nz::LuaState& lua, BaseComponent& component)
{
static_assert(std::is_base_of<BaseComponent, T>::value, "ComponentType must inherit BaseComponent");

View File

@@ -21,7 +21,7 @@ namespace Ndk
LuaBinding_Audio(LuaBinding& binding);
~LuaBinding_Audio() = default;
void Register(Nz::LuaInstance& instance) override;
void Register(Nz::LuaState& state) override;
Nz::LuaClass<Nz::Music> music;
Nz::LuaClass<Nz::Sound> sound;

View File

@@ -30,7 +30,7 @@ namespace Ndk
LuaBinding_Base(LuaBinding& binding);
virtual ~LuaBinding_Base();
virtual void Register(Nz::LuaInstance& instance) = 0;
virtual void Register(Nz::LuaState& state) = 0;
// Implementation lies in the respective .cpp files (still searching for a cleaner way..)
static std::unique_ptr<LuaBinding_Base> BindCore(LuaBinding& binding);

View File

@@ -21,7 +21,7 @@ namespace Ndk
LuaBinding_Core(LuaBinding& binding);
~LuaBinding_Core() = default;
void Register(Nz::LuaInstance& instance) override;
void Register(Nz::LuaState& state) override;
Nz::LuaClass<Nz::Clock> clock;
Nz::LuaClass<Nz::Directory> directory;

View File

@@ -22,7 +22,7 @@ namespace Ndk
LuaBinding_Graphics(LuaBinding& binding);
~LuaBinding_Graphics() = default;
void Register(Nz::LuaInstance& instance) override;
void Register(Nz::LuaState& state) override;
Nz::LuaClass<Nz::AbstractViewer> abstractViewer;
Nz::LuaClass<Nz::InstancedRenderableRef> instancedRenderable;

View File

@@ -23,7 +23,7 @@ namespace Ndk
LuaBinding_Math(LuaBinding& binding);
~LuaBinding_Math() = default;
void Register(Nz::LuaInstance& instance) override;
void Register(Nz::LuaState& state) override;
Nz::LuaClass<Nz::EulerAnglesd> eulerAngles;
Nz::LuaClass<Nz::Matrix4d> matrix4d;

View File

@@ -9,6 +9,7 @@
#include <Nazara/Network/AbstractSocket.hpp>
#include <Nazara/Network/IpAddress.hpp>
#include <Nazara/Network/UdpSocket.hpp>
#include <NDK/Lua/LuaBinding_Base.hpp>
namespace Ndk
@@ -19,10 +20,11 @@ namespace Ndk
LuaBinding_Network(LuaBinding& binding);
~LuaBinding_Network() = default;
void Register(Nz::LuaInstance& instance) override;
void Register(Nz::LuaState& state) override;
Nz::LuaClass<Nz::AbstractSocket> abstractSocket;
Nz::LuaClass<Nz::IpAddress> ipAddress;
Nz::LuaClass<Nz::UdpSocket> udpSocket;
};
}

View File

@@ -18,7 +18,7 @@ namespace Ndk
LuaBinding_Renderer(LuaBinding& binding);
~LuaBinding_Renderer() = default;
void Register(Nz::LuaInstance& instance) override;
void Register(Nz::LuaState& state) override;
Nz::LuaClass<Nz::TextureRef> texture;
Nz::LuaClass<Nz::TextureLibrary> textureLibrary;

View File

@@ -22,7 +22,7 @@ namespace Ndk
LuaBinding_SDK(LuaBinding& binding);
~LuaBinding_SDK() = default;
void Register(Nz::LuaInstance& instance) override;
void Register(Nz::LuaState& state) override;
Nz::LuaClass<Application*> application;
Nz::LuaClass<EntityHandle> entity;

View File

@@ -21,7 +21,7 @@ namespace Ndk
LuaBinding_Utility(LuaBinding& binding);
~LuaBinding_Utility() = default;
void Register(Nz::LuaInstance& instance) override;
void Register(Nz::LuaState& state) override;
// Utility
Nz::LuaClass<Nz::AbstractImageRef> abstractImage;

View File

@@ -11,7 +11,7 @@
namespace Nz
{
class LuaInstance;
class LuaState;
}
namespace Ndk
@@ -28,7 +28,7 @@ namespace Ndk
static bool Initialize();
static void RegisterClasses(Nz::LuaInstance& instance);
static void RegisterClasses(Nz::LuaState& state);
static void Uninitialize();

View File

@@ -4,7 +4,7 @@
#include <NDK/LuaAPI.hpp>
#include <Nazara/Core/Color.hpp>
#include <Nazara/Lua/LuaInstance.hpp>
#include <Nazara/Lua/LuaState.hpp>
#include <Nazara/Math/EulerAngles.hpp>
#include <Nazara/Math/Quaternion.hpp>
#include <Nazara/Math/Vector3.hpp>
@@ -28,103 +28,103 @@
namespace Nz
{
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Color* color, TypeTag<Color>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Color* color, TypeTag<Color>)
{
instance.CheckType(index, Nz::LuaType_Table);
state.CheckType(index, Nz::LuaType_Table);
color->r = instance.CheckField<UInt8>("r", index);
color->g = instance.CheckField<UInt8>("g", index);
color->b = instance.CheckField<UInt8>("b", index);
color->a = instance.CheckField<UInt8>("a", 255, index);
color->r = state.CheckField<UInt8>("r", index);
color->g = state.CheckField<UInt8>("g", index);
color->b = state.CheckField<UInt8>("b", index);
color->a = state.CheckField<UInt8>("a", 255, index);
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, EulerAnglesd* angles, TypeTag<EulerAnglesd>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, EulerAnglesd* angles, TypeTag<EulerAnglesd>)
{
switch (instance.GetType(index))
switch (state.GetType(index))
{
case Nz::LuaType_Table:
angles->Set(instance.CheckField<double>("pitch", index), instance.CheckField<double>("yaw", index), instance.CheckField<double>("roll", index));
angles->Set(state.CheckField<double>("pitch", index), state.CheckField<double>("yaw", index), state.CheckField<double>("roll", index));
return 1;
default:
{
if (instance.IsOfType(index, "EulerAngles"))
angles->Set(*static_cast<EulerAnglesd*>(instance.ToUserdata(index)));
if (state.IsOfType(index, "EulerAngles"))
angles->Set(*static_cast<EulerAnglesd*>(state.ToUserdata(index)));
else
angles->Set(*static_cast<Quaterniond*>(instance.CheckUserdata(index, "Quaternion")));
angles->Set(*static_cast<Quaterniond*>(state.CheckUserdata(index, "Quaternion")));
return 1;
}
}
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, EulerAnglesf* angles, TypeTag<EulerAnglesf>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, EulerAnglesf* angles, TypeTag<EulerAnglesf>)
{
EulerAnglesd anglesDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &anglesDouble, TypeTag<EulerAnglesd>());
unsigned int ret = LuaImplQueryArg(state, index, &anglesDouble, TypeTag<EulerAnglesd>());
angles->Set(anglesDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, FontRef* fontRef, TypeTag<FontRef>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, FontRef* fontRef, TypeTag<FontRef>)
{
*fontRef = *static_cast<FontRef*>(instance.CheckUserdata(index, "Font"));
*fontRef = *static_cast<FontRef*>(state.CheckUserdata(index, "Font"));
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, FontParams* params, TypeTag<FontParams>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, FontParams* params, TypeTag<FontParams>)
{
NazaraUnused(params);
instance.CheckType(index, Nz::LuaType_Table);
state.CheckType(index, Nz::LuaType_Table);
// Structure is empty for now
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, ImageParams* params, TypeTag<ImageParams>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, ImageParams* params, TypeTag<ImageParams>)
{
instance.CheckType(index, Nz::LuaType_Table);
state.CheckType(index, Nz::LuaType_Table);
params->levelCount = instance.CheckField<Nz::UInt8>("LevelCount");
params->loadFormat = instance.CheckField<Nz::PixelFormatType>("LoadFormat");
params->levelCount = state.CheckField<Nz::UInt8>("LevelCount");
params->loadFormat = state.CheckField<Nz::PixelFormatType>("LoadFormat");
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, IpAddress* address, TypeTag<IpAddress>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, IpAddress* address, TypeTag<IpAddress>)
{
switch (instance.GetType(index))
switch (state.GetType(index))
{
case Nz::LuaType_String:
address->BuildFromAddress(instance.CheckString(index));
address->BuildFromAddress(state.CheckString(index));
return 1;
default:
*address = *static_cast<IpAddress*>(instance.CheckUserdata(index, "IpAddress"));
*address = *static_cast<IpAddress*>(state.CheckUserdata(index, "IpAddress"));
return 1;
}
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Matrix4d* mat, TypeTag<Matrix4d>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Matrix4d* mat, TypeTag<Matrix4d>)
{
switch (instance.GetType(index))
switch (state.GetType(index))
{
case Nz::LuaType_Table:
{
double values[16];
for (std::size_t i = 0; i < 16; ++i)
{
instance.PushInteger(i + 1);
instance.GetTable();
state.PushInteger(i + 1);
state.GetTable();
values[i] = instance.CheckNumber(-1);
instance.Pop();
values[i] = state.CheckNumber(-1);
state.Pop();
}
mat->Set(values);
@@ -133,500 +133,500 @@ namespace Nz
default:
{
if (instance.IsOfType(index, "Matrix4"))
mat->Set(*static_cast<Matrix4d*>(instance.ToUserdata(index)));
if (state.IsOfType(index, "Matrix4"))
mat->Set(*static_cast<Matrix4d*>(state.ToUserdata(index)));
return 1;
}
}
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Matrix4f* mat, TypeTag<Matrix4f>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Matrix4f* mat, TypeTag<Matrix4f>)
{
Matrix4d matDouble = Matrix4d::Identity();
unsigned int ret = LuaImplQueryArg(instance, index, &matDouble, TypeTag<Matrix4d>());
unsigned int ret = LuaImplQueryArg(state, index, &matDouble, TypeTag<Matrix4d>());
mat->Set(matDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, MeshParams* params, TypeTag<MeshParams>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, MeshParams* params, TypeTag<MeshParams>)
{
instance.CheckType(index, Nz::LuaType_Table);
state.CheckType(index, Nz::LuaType_Table);
params->animated = instance.CheckField<bool>("Animated", params->animated);
params->center = instance.CheckField<bool>("Center", params->center);
params->matrix = instance.CheckField<Matrix4f>("Matrix", params->matrix);
params->optimizeIndexBuffers = instance.CheckField<bool>("OptimizeIndexBuffers", params->optimizeIndexBuffers);
params->texCoordOffset = instance.CheckField<Vector2f>("TexCoordOffset", params->texCoordOffset);
params->texCoordScale = instance.CheckField<Vector2f>("TexCoordScale", params->texCoordScale);
params->animated = state.CheckField<bool>("Animated", params->animated);
params->center = state.CheckField<bool>("Center", params->center);
params->matrix = state.CheckField<Matrix4f>("Matrix", params->matrix);
params->optimizeIndexBuffers = state.CheckField<bool>("OptimizeIndexBuffers", params->optimizeIndexBuffers);
params->texCoordOffset = state.CheckField<Vector2f>("TexCoordOffset", params->texCoordOffset);
params->texCoordScale = state.CheckField<Vector2f>("TexCoordScale", params->texCoordScale);
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Quaterniond* quat, TypeTag<Quaterniond>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Quaterniond* quat, TypeTag<Quaterniond>)
{
switch (instance.GetType(index))
switch (state.GetType(index))
{
case Nz::LuaType_Table:
quat->Set(instance.CheckField<double>("w", index), instance.CheckField<double>("x", index), instance.CheckField<double>("y", index), instance.CheckField<double>("z", index));
quat->Set(state.CheckField<double>("w", index), state.CheckField<double>("x", index), state.CheckField<double>("y", index), state.CheckField<double>("z", index));
return 1;
default:
{
if (instance.IsOfType(index, "EulerAngles"))
quat->Set(*static_cast<EulerAnglesd*>(instance.ToUserdata(index)));
if (state.IsOfType(index, "EulerAngles"))
quat->Set(*static_cast<EulerAnglesd*>(state.ToUserdata(index)));
else
quat->Set(*static_cast<Quaterniond*>(instance.CheckUserdata(index, "Quaternion")));
quat->Set(*static_cast<Quaterniond*>(state.CheckUserdata(index, "Quaternion")));
return 1;
}
}
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Quaternionf* quat, TypeTag<Quaternionf>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Quaternionf* quat, TypeTag<Quaternionf>)
{
Quaterniond quatDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &quatDouble, TypeTag<Quaterniond>());
unsigned int ret = LuaImplQueryArg(state, index, &quatDouble, TypeTag<Quaterniond>());
quat->Set(quatDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Rectd* rect, TypeTag<Rectd>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Rectd* rect, TypeTag<Rectd>)
{
instance.CheckType(index, LuaType_Table);
state.CheckType(index, LuaType_Table);
rect->x = instance.CheckField<double>("x", index);
rect->y = instance.CheckField<double>("y", index);
rect->width = instance.CheckField<double>("width", index);
rect->height = instance.CheckField<double>("height", index);
rect->x = state.CheckField<double>("x", index);
rect->y = state.CheckField<double>("y", index);
rect->width = state.CheckField<double>("width", index);
rect->height = state.CheckField<double>("height", index);
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Rectf* rect, TypeTag<Rectf>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Rectf* rect, TypeTag<Rectf>)
{
Rectd rectDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &rectDouble, TypeTag<Rectd>());
unsigned int ret = LuaImplQueryArg(state, index, &rectDouble, TypeTag<Rectd>());
rect->Set(rectDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Recti* rect, TypeTag<Recti>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Recti* rect, TypeTag<Recti>)
{
Rectd rectDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &rectDouble, TypeTag<Rectd>());
unsigned int ret = LuaImplQueryArg(state, index, &rectDouble, TypeTag<Rectd>());
rect->Set(rectDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Rectui* rect, TypeTag<Rectui>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Rectui* rect, TypeTag<Rectui>)
{
Rectd rectDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &rectDouble, TypeTag<Rectd>());
unsigned int ret = LuaImplQueryArg(state, index, &rectDouble, TypeTag<Rectd>());
rect->Set(rectDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector2d* vec, TypeTag<Vector2d>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector2d* vec, TypeTag<Vector2d>)
{
switch (instance.GetType(index))
switch (state.GetType(index))
{
case Nz::LuaType_Number:
if (index < 0 && index > -2)
instance.Error("Vector2 expected, two numbers are required to convert it");
state.Error("Vector2 expected, two numbers are required to convert it");
vec->Set(instance.CheckNumber(index), instance.CheckNumber(index + 1));
vec->Set(state.CheckNumber(index), state.CheckNumber(index + 1));
return 2;
case Nz::LuaType_Table:
vec->Set(instance.CheckField<double>("x", index), instance.CheckField<double>("y", index));
vec->Set(state.CheckField<double>("x", index), state.CheckField<double>("y", index));
return 1;
default:
vec->Set(*static_cast<Vector2d*>(instance.CheckUserdata(index, "Vector2")));
vec->Set(*static_cast<Vector2d*>(state.CheckUserdata(index, "Vector2")));
return 1;
}
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector2f* vec, TypeTag<Vector2f>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector2f* vec, TypeTag<Vector2f>)
{
Vector2d vecDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &vecDouble, TypeTag<Vector2d>());
unsigned int ret = LuaImplQueryArg(state, index, &vecDouble, TypeTag<Vector2d>());
vec->Set(vecDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector2ui* vec, TypeTag<Vector2ui>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector2ui* vec, TypeTag<Vector2ui>)
{
Vector2d vecDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &vecDouble, TypeTag<Vector2d>());
unsigned int ret = LuaImplQueryArg(state, index, &vecDouble, TypeTag<Vector2d>());
vec->Set(vecDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector3d* vec, TypeTag<Vector3d>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector3d* vec, TypeTag<Vector3d>)
{
switch (instance.GetType(index))
switch (state.GetType(index))
{
case Nz::LuaType_Number:
if (index < 0 && index > -3)
instance.Error("Vector3 expected, three numbers are required to convert it");
state.Error("Vector3 expected, three numbers are required to convert it");
vec->Set(instance.CheckNumber(index), instance.CheckNumber(index + 1), instance.CheckNumber(index + 2, 0.0));
vec->Set(state.CheckNumber(index), state.CheckNumber(index + 1), state.CheckNumber(index + 2, 0.0));
return 3;
case Nz::LuaType_Table:
vec->Set(instance.CheckField<double>("x", index), instance.CheckField<double>("y", index), instance.CheckField<double>("z", 0.0, index));
vec->Set(state.CheckField<double>("x", index), state.CheckField<double>("y", index), state.CheckField<double>("z", 0.0, index));
return 1;
default:
vec->Set(*static_cast<Vector3d*>(instance.CheckUserdata(index, "Vector3")));
vec->Set(*static_cast<Vector3d*>(state.CheckUserdata(index, "Vector3")));
return 1;
}
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector3f* vec, TypeTag<Vector3f>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector3f* vec, TypeTag<Vector3f>)
{
Vector3d vecDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &vecDouble, TypeTag<Vector3d>());
unsigned int ret = LuaImplQueryArg(state, index, &vecDouble, TypeTag<Vector3d>());
vec->Set(vecDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Vector3ui* vec, TypeTag<Vector3ui>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Vector3ui* vec, TypeTag<Vector3ui>)
{
Vector3d vecDouble;
unsigned int ret = LuaImplQueryArg(instance, index, &vecDouble, TypeTag<Vector3d>());
unsigned int ret = LuaImplQueryArg(state, index, &vecDouble, TypeTag<Vector3d>());
vec->Set(vecDouble);
return ret;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Ndk::EntityHandle* handle, TypeTag<Ndk::EntityHandle>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Ndk::EntityHandle* handle, TypeTag<Ndk::EntityHandle>)
{
*handle = *static_cast<Ndk::EntityHandle*>(instance.CheckUserdata(index, "Entity"));
*handle = *static_cast<Ndk::EntityHandle*>(state.CheckUserdata(index, "Entity"));
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Ndk::WorldHandle* handle, TypeTag<Ndk::WorldHandle>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, Ndk::WorldHandle* handle, TypeTag<Ndk::WorldHandle>)
{
*handle = *static_cast<Ndk::WorldHandle*>(instance.CheckUserdata(index, "World"));
*handle = *static_cast<Ndk::WorldHandle*>(state.CheckUserdata(index, "World"));
return 1;
}
#ifndef NDK_SERVER
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, InstancedRenderableRef* renderable, TypeTag<InstancedRenderableRef>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, InstancedRenderableRef* renderable, TypeTag<InstancedRenderableRef>)
{
if (instance.IsOfType(index, "InstancedRenderable") ||
instance.IsOfType(index, "Model") ||
instance.IsOfType(index, "Sprite"))
if (state.IsOfType(index, "InstancedRenderable") ||
state.IsOfType(index, "Model") ||
state.IsOfType(index, "Sprite"))
{
*renderable = *static_cast<InstancedRenderableRef*>(instance.ToUserdata(index));
*renderable = *static_cast<InstancedRenderableRef*>(state.ToUserdata(index));
}
else
instance.ArgError(index, "is not a InstancedRenderable instance");
state.ArgError(index, "is not a InstancedRenderable instance");
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, MaterialRef* materialRef, TypeTag<MaterialRef>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, MaterialRef* materialRef, TypeTag<MaterialRef>)
{
*materialRef = *static_cast<MaterialRef*>(instance.CheckUserdata(index, "Material"));
*materialRef = *static_cast<MaterialRef*>(state.CheckUserdata(index, "Material"));
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, MaterialParams* params, TypeTag<MaterialParams>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, MaterialParams* params, TypeTag<MaterialParams>)
{
instance.CheckType(index, Nz::LuaType_Table);
state.CheckType(index, Nz::LuaType_Table);
params->loadAlphaMap = instance.CheckField<bool>("LoadAlphaMap", params->loadAlphaMap);
params->loadDiffuseMap = instance.CheckField<bool>("LoadDiffuseMap", params->loadDiffuseMap);
params->loadEmissiveMap = instance.CheckField<bool>("LoadEmissiveMap", params->loadEmissiveMap);
params->loadHeightMap = instance.CheckField<bool>("LoadHeightMap", params->loadHeightMap);
params->loadNormalMap = instance.CheckField<bool>("LoadNormalMap", params->loadNormalMap);
params->loadSpecularMap = instance.CheckField<bool>("LoadSpecularMap", params->loadSpecularMap);
params->shaderName = instance.CheckField<String>("ShaderName", params->shaderName);
params->loadAlphaMap = state.CheckField<bool>("LoadAlphaMap", params->loadAlphaMap);
params->loadDiffuseMap = state.CheckField<bool>("LoadDiffuseMap", params->loadDiffuseMap);
params->loadEmissiveMap = state.CheckField<bool>("LoadEmissiveMap", params->loadEmissiveMap);
params->loadHeightMap = state.CheckField<bool>("LoadHeightMap", params->loadHeightMap);
params->loadNormalMap = state.CheckField<bool>("LoadNormalMap", params->loadNormalMap);
params->loadSpecularMap = state.CheckField<bool>("LoadSpecularMap", params->loadSpecularMap);
params->shaderName = state.CheckField<String>("ShaderName", params->shaderName);
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, ModelParameters* params, TypeTag<ModelParameters>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, ModelParameters* params, TypeTag<ModelParameters>)
{
instance.CheckType(index, Nz::LuaType_Table);
state.CheckType(index, Nz::LuaType_Table);
params->loadMaterials = instance.CheckField<bool>("LoadMaterials", params->loadMaterials);
params->loadMaterials = state.CheckField<bool>("LoadMaterials", params->loadMaterials);
LuaImplQueryArg(instance, -1, &params->material, TypeTag<MaterialParams>());
LuaImplQueryArg(instance, -1, &params->mesh, TypeTag<MeshParams>());
LuaImplQueryArg(state, -1, &params->material, TypeTag<MaterialParams>());
LuaImplQueryArg(state, -1, &params->mesh, TypeTag<MeshParams>());
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, MusicParams* params, TypeTag<MusicParams>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, MusicParams* params, TypeTag<MusicParams>)
{
instance.CheckType(index, Nz::LuaType_Table);
state.CheckType(index, Nz::LuaType_Table);
params->forceMono = instance.CheckField<bool>("ForceMono", params->forceMono);
params->forceMono = state.CheckField<bool>("ForceMono", params->forceMono);
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, SoundBufferParams* params, TypeTag<SoundBufferParams>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, SoundBufferParams* params, TypeTag<SoundBufferParams>)
{
instance.CheckType(index, Nz::LuaType_Table);
state.CheckType(index, Nz::LuaType_Table);
params->forceMono = instance.CheckField<bool>("ForceMono", params->forceMono);
params->forceMono = state.CheckField<bool>("ForceMono", params->forceMono);
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, SpriteRef* spriteRef, TypeTag<SpriteRef>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, SpriteRef* spriteRef, TypeTag<SpriteRef>)
{
*spriteRef = *static_cast<SpriteRef*>(instance.CheckUserdata(index, "Sprite"));
*spriteRef = *static_cast<SpriteRef*>(state.CheckUserdata(index, "Sprite"));
return 1;
}
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, TextureRef* textureRef, TypeTag<TextureRef>)
inline unsigned int LuaImplQueryArg(const LuaState& state, int index, TextureRef* textureRef, TypeTag<TextureRef>)
{
*textureRef = *static_cast<TextureRef*>(instance.CheckUserdata(index, "Texture"));
*textureRef = *static_cast<TextureRef*>(state.CheckUserdata(index, "Texture"));
return 1;
}
#endif
inline int LuaImplReplyVal(const LuaInstance& instance, Color&& val, TypeTag<Color>)
inline int LuaImplReplyVal(const LuaState& state, Color&& val, TypeTag<Color>)
{
instance.PushTable();
instance.PushField("r", val.r);
instance.PushField("g", val.g);
instance.PushField("b", val.b);
instance.PushField("a", val.a);
state.PushTable();
state.PushField("r", val.r);
state.PushField("g", val.g);
state.PushField("b", val.b);
state.PushField("a", val.a);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, EulerAnglesd&& val, TypeTag<EulerAnglesd>)
inline int LuaImplReplyVal(const LuaState& state, EulerAnglesd&& val, TypeTag<EulerAnglesd>)
{
instance.PushInstance<EulerAnglesd>("EulerAngles", val);
state.PushInstance<EulerAnglesd>("EulerAngles", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, EulerAnglesf&& val, TypeTag<EulerAnglesf>)
inline int LuaImplReplyVal(const LuaState& state, EulerAnglesf&& val, TypeTag<EulerAnglesf>)
{
instance.PushInstance<EulerAnglesd>("EulerAngles", val);
state.PushInstance<EulerAnglesd>("EulerAngles", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, FontRef&& val, TypeTag<FontRef>)
inline int LuaImplReplyVal(const LuaState& state, FontRef&& val, TypeTag<FontRef>)
{
instance.PushInstance<FontRef>("Font", val);
state.PushInstance<FontRef>("Font", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Font::SizeInfo&& val, TypeTag<Font::SizeInfo>)
inline int LuaImplReplyVal(const LuaState& state, Font::SizeInfo&& val, TypeTag<Font::SizeInfo>)
{
instance.PushTable();
instance.PushField("LineHeight", val.lineHeight);
instance.PushField("SpaceAdvance", val.spaceAdvance);
instance.PushField("UnderlinePosition", val.underlinePosition);
instance.PushField("UnderlineThickness", val.underlineThickness);
state.PushTable();
state.PushField("LineHeight", val.lineHeight);
state.PushField("SpaceAdvance", val.spaceAdvance);
state.PushField("UnderlinePosition", val.underlinePosition);
state.PushField("UnderlineThickness", val.underlineThickness);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, ImageParams&& val, TypeTag<ImageParams>)
inline int LuaImplReplyVal(const LuaState& state, ImageParams&& val, TypeTag<ImageParams>)
{
instance.PushTable(0, 2);
instance.PushField("LevelCount", val.levelCount);
instance.PushField("LoadFormat", val.loadFormat);
state.PushTable(0, 2);
state.PushField("LevelCount", val.levelCount);
state.PushField("LoadFormat", val.loadFormat);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, IpAddress&& val, TypeTag<IpAddress>)
inline int LuaImplReplyVal(const LuaState& state, IpAddress&& val, TypeTag<IpAddress>)
{
instance.PushInstance<IpAddress>("IpAddress", val);
state.PushInstance<IpAddress>("IpAddress", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Matrix4d&& val, TypeTag<Matrix4d>)
inline int LuaImplReplyVal(const LuaState& state, Matrix4d&& val, TypeTag<Matrix4d>)
{
instance.PushInstance<Matrix4d>("Matrix4", val);
state.PushInstance<Matrix4d>("Matrix4", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Matrix4f&& val, TypeTag<Matrix4f>)
inline int LuaImplReplyVal(const LuaState& state, Matrix4f&& val, TypeTag<Matrix4f>)
{
instance.PushInstance<Matrix4d>("Matrix4", val);
state.PushInstance<Matrix4d>("Matrix4", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Quaterniond&& val, TypeTag<Quaterniond>)
inline int LuaImplReplyVal(const LuaState& state, Quaterniond&& val, TypeTag<Quaterniond>)
{
instance.PushInstance<Quaterniond>("Quaternion", val);
state.PushInstance<Quaterniond>("Quaternion", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Quaternionf&& val, TypeTag<Quaternionf>)
inline int LuaImplReplyVal(const LuaState& state, Quaternionf&& val, TypeTag<Quaternionf>)
{
instance.PushInstance<Quaterniond>("Quaternion", val);
state.PushInstance<Quaterniond>("Quaternion", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Rectd&& val, TypeTag<Rectd>)
inline int LuaImplReplyVal(const LuaState& state, Rectd&& val, TypeTag<Rectd>)
{
instance.PushInstance<Rectd>("Rect", val);
state.PushInstance<Rectd>("Rect", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Rectf&& val, TypeTag<Rectf>)
inline int LuaImplReplyVal(const LuaState& state, Rectf&& val, TypeTag<Rectf>)
{
instance.PushInstance<Rectd>("Rect", val);
state.PushInstance<Rectd>("Rect", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Recti&& val, TypeTag<Recti>)
inline int LuaImplReplyVal(const LuaState& state, Recti&& val, TypeTag<Recti>)
{
instance.PushInstance<Rectd>("Rect", val);
state.PushInstance<Rectd>("Rect", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Rectui&& val, TypeTag<Rectui>)
inline int LuaImplReplyVal(const LuaState& state, Rectui&& val, TypeTag<Rectui>)
{
instance.PushInstance<Rectd>("Rect", val);
state.PushInstance<Rectd>("Rect", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Vector2d&& val, TypeTag<Vector2d>)
inline int LuaImplReplyVal(const LuaState& state, Vector2d&& val, TypeTag<Vector2d>)
{
instance.PushInstance<Vector2d>("Vector2", val);
state.PushInstance<Vector2d>("Vector2", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Vector2f&& val, TypeTag<Vector2f>)
inline int LuaImplReplyVal(const LuaState& state, Vector2f&& val, TypeTag<Vector2f>)
{
instance.PushInstance<Vector2d>("Vector2", val);
state.PushInstance<Vector2d>("Vector2", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Vector2ui&& val, TypeTag<Vector2ui>)
inline int LuaImplReplyVal(const LuaState& state, Vector2ui&& val, TypeTag<Vector2ui>)
{
instance.PushInstance<Vector2d>("Vector2", val);
state.PushInstance<Vector2d>("Vector2", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Vector3d&& val, TypeTag<Vector3d>)
inline int LuaImplReplyVal(const LuaState& state, Vector3d&& val, TypeTag<Vector3d>)
{
instance.PushInstance<Vector3d>("Vector3", val);
state.PushInstance<Vector3d>("Vector3", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Vector3f&& val, TypeTag<Vector3f>)
inline int LuaImplReplyVal(const LuaState& state, Vector3f&& val, TypeTag<Vector3f>)
{
instance.PushInstance<Vector3d>("Vector3", val);
state.PushInstance<Vector3d>("Vector3", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Vector3ui&& val, TypeTag<Vector3ui>)
inline int LuaImplReplyVal(const LuaState& state, Vector3ui&& val, TypeTag<Vector3ui>)
{
instance.PushInstance<Vector3d>("Vector3", val);
state.PushInstance<Vector3d>("Vector3", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::Entity* ptr, TypeTag<Ndk::Entity*>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::Entity* ptr, TypeTag<Ndk::Entity*>)
{
instance.PushInstance<Ndk::EntityHandle>("Entity", ptr);
state.PushInstance<Ndk::EntityHandle>("Entity", ptr);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::Application* ptr, TypeTag<Ndk::Application*>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::Application* ptr, TypeTag<Ndk::Application*>)
{
instance.PushInstance<Ndk::Application*>("Application", ptr);
state.PushInstance<Ndk::Application*>("Application", ptr);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::EntityHandle&& handle, TypeTag<Ndk::EntityHandle>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::EntityHandle&& handle, TypeTag<Ndk::EntityHandle>)
{
instance.PushInstance<Ndk::EntityHandle>("Entity", handle);
state.PushInstance<Ndk::EntityHandle>("Entity", handle);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::NodeComponentHandle&& handle, TypeTag<Ndk::NodeComponentHandle>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::NodeComponentHandle&& handle, TypeTag<Ndk::NodeComponentHandle>)
{
instance.PushInstance<Ndk::NodeComponentHandle>("NodeComponent", handle);
state.PushInstance<Ndk::NodeComponentHandle>("NodeComponent", handle);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::VelocityComponentHandle&& handle, TypeTag<Ndk::VelocityComponentHandle>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::VelocityComponentHandle&& handle, TypeTag<Ndk::VelocityComponentHandle>)
{
instance.PushInstance<Ndk::VelocityComponentHandle>("VelocityComponent", handle);
state.PushInstance<Ndk::VelocityComponentHandle>("VelocityComponent", handle);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::World* ptr, TypeTag<Ndk::World*>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::World* ptr, TypeTag<Ndk::World*>)
{
instance.PushInstance<Ndk::WorldHandle>("World", ptr);
state.PushInstance<Ndk::WorldHandle>("World", ptr);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::WorldHandle&& handle, TypeTag<Ndk::WorldHandle>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::WorldHandle&& handle, TypeTag<Ndk::WorldHandle>)
{
instance.PushInstance<Ndk::WorldHandle>("World", handle);
state.PushInstance<Ndk::WorldHandle>("World", handle);
return 1;
}
#ifndef NDK_SERVER
inline int LuaImplReplyVal(const LuaInstance& instance, MaterialRef&& handle, TypeTag<MaterialRef>)
inline int LuaImplReplyVal(const LuaState& state, MaterialRef&& handle, TypeTag<MaterialRef>)
{
instance.PushInstance<MaterialRef>("Material", handle);
state.PushInstance<MaterialRef>("Material", handle);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, const SoundBuffer* val, TypeTag<const SoundBuffer*>)
inline int LuaImplReplyVal(const LuaState& state, const SoundBuffer* val, TypeTag<const SoundBuffer*>)
{
instance.PushInstance<SoundBufferConstRef>("SoundBuffer", val);
state.PushInstance<SoundBufferConstRef>("SoundBuffer", val);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, SpriteRef&& handle, TypeTag<SpriteRef>)
inline int LuaImplReplyVal(const LuaState& state, SpriteRef&& handle, TypeTag<SpriteRef>)
{
instance.PushInstance<SpriteRef>("Sprite", handle);
state.PushInstance<SpriteRef>("Sprite", handle);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, TextureRef&& handle, TypeTag<TextureRef>)
inline int LuaImplReplyVal(const LuaState& state, TextureRef&& handle, TypeTag<TextureRef>)
{
instance.PushInstance<TextureRef>("Texture", handle);
state.PushInstance<TextureRef>("Texture", handle);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::CameraComponentHandle&& handle, TypeTag<Ndk::CameraComponentHandle>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::CameraComponentHandle&& handle, TypeTag<Ndk::CameraComponentHandle>)
{
instance.PushInstance<Ndk::CameraComponentHandle>("CameraComponent", handle);
state.PushInstance<Ndk::CameraComponentHandle>("CameraComponent", handle);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::ConsoleHandle&& handle, TypeTag<Ndk::ConsoleHandle>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::ConsoleHandle&& handle, TypeTag<Ndk::ConsoleHandle>)
{
instance.PushInstance<Ndk::ConsoleHandle>("Console", handle);
state.PushInstance<Ndk::ConsoleHandle>("Console", handle);
return 1;
}
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::GraphicsComponentHandle&& handle, TypeTag<Ndk::GraphicsComponentHandle>)
inline int LuaImplReplyVal(const LuaState& state, Ndk::GraphicsComponentHandle&& handle, TypeTag<Ndk::GraphicsComponentHandle>)
{
instance.PushInstance<Ndk::GraphicsComponentHandle>("GraphicsComponent", handle);
state.PushInstance<Ndk::GraphicsComponentHandle>("GraphicsComponent", handle);
return 1;
}
#endif