SDK/Lua: Bind CameraComponent
This commit is contained in:
parent
cdc53e3dc3
commit
3bd426f3dc
|
|
@ -18,9 +18,12 @@
|
||||||
|
|
||||||
namespace Ndk
|
namespace Ndk
|
||||||
{
|
{
|
||||||
|
class CameraComponent;
|
||||||
class Entity;
|
class Entity;
|
||||||
|
|
||||||
class NDK_API CameraComponent : public Component<CameraComponent>, public Nz::AbstractViewer
|
using CameraComponentHandle = Nz::ObjectHandle<CameraComponent>;
|
||||||
|
|
||||||
|
class NDK_API CameraComponent : public Component<CameraComponent>, public Nz::AbstractViewer, public Nz::HandledObject<CameraComponent>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline CameraComponent();
|
inline CameraComponent();
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,15 @@ namespace Nz
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Recti* rect, TypeTag<Recti>)
|
||||||
|
{
|
||||||
|
Rectd rectDouble;
|
||||||
|
unsigned int ret = LuaImplQueryArg(instance, 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 LuaInstance& instance, int index, Rectui* rect, TypeTag<Rectui>)
|
||||||
{
|
{
|
||||||
Rectd rectDouble;
|
Rectd rectDouble;
|
||||||
|
|
@ -488,6 +497,12 @@ namespace Nz
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int LuaImplReplyVal(const LuaInstance& instance, Recti&& val, TypeTag<Recti>)
|
||||||
|
{
|
||||||
|
instance.PushInstance<Rectd>("Rect", val);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
inline int LuaImplReplyVal(const LuaInstance& instance, Rectui&& val, TypeTag<Rectui>)
|
inline int LuaImplReplyVal(const LuaInstance& instance, Rectui&& val, TypeTag<Rectui>)
|
||||||
{
|
{
|
||||||
instance.PushInstance<Rectd>("Rect", val);
|
instance.PushInstance<Rectd>("Rect", val);
|
||||||
|
|
@ -597,6 +612,12 @@ namespace Nz
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::CameraComponentHandle&& handle, TypeTag<Ndk::CameraComponentHandle>)
|
||||||
|
{
|
||||||
|
instance.PushInstance<Ndk::CameraComponentHandle>("CameraComponent", handle);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::ConsoleHandle&& handle, TypeTag<Ndk::ConsoleHandle>)
|
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::ConsoleHandle&& handle, TypeTag<Ndk::ConsoleHandle>)
|
||||||
{
|
{
|
||||||
instance.PushInstance<Ndk::ConsoleHandle>("Console", handle);
|
instance.PushInstance<Ndk::ConsoleHandle>("Console", handle);
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ namespace Ndk
|
||||||
Nz::LuaClass<Nz::SoundEmitter> soundEmitter;
|
Nz::LuaClass<Nz::SoundEmitter> soundEmitter;
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
|
Nz::LuaClass<Nz::AbstractViewer> abstractViewer;
|
||||||
Nz::LuaClass<Nz::InstancedRenderableRef> instancedRenderable;
|
Nz::LuaClass<Nz::InstancedRenderableRef> instancedRenderable;
|
||||||
Nz::LuaClass<Nz::MaterialRef> material;
|
Nz::LuaClass<Nz::MaterialRef> material;
|
||||||
Nz::LuaClass<Nz::ModelRef> model;
|
Nz::LuaClass<Nz::ModelRef> model;
|
||||||
|
|
@ -88,6 +89,7 @@ namespace Ndk
|
||||||
Nz::LuaClass<Nz::TextureRef> texture;
|
Nz::LuaClass<Nz::TextureRef> texture;
|
||||||
|
|
||||||
// SDK
|
// SDK
|
||||||
|
Nz::LuaClass<CameraComponentHandle> cameraComponent;
|
||||||
Nz::LuaClass<ConsoleHandle> console;
|
Nz::LuaClass<ConsoleHandle> console;
|
||||||
Nz::LuaClass<GraphicsComponentHandle> graphicsComponent;
|
Nz::LuaClass<GraphicsComponentHandle> graphicsComponent;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ namespace Ndk
|
||||||
soundEmitter("SoundEmitter"),
|
soundEmitter("SoundEmitter"),
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
|
abstractViewer("AbstractViewer"),
|
||||||
instancedRenderable("InstancedRenderable"),
|
instancedRenderable("InstancedRenderable"),
|
||||||
material("Material"),
|
material("Material"),
|
||||||
model("Model"),
|
model("Model"),
|
||||||
|
|
@ -68,6 +69,7 @@ namespace Ndk
|
||||||
texture("Texture"),
|
texture("Texture"),
|
||||||
|
|
||||||
// SDK
|
// SDK
|
||||||
|
cameraComponent("CameraComponent"),
|
||||||
console("Console"),
|
console("Console"),
|
||||||
graphicsComponent("GraphicsComponent")
|
graphicsComponent("GraphicsComponent")
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,18 @@ namespace Ndk
|
||||||
|
|
||||||
void LuaBinding::BindGraphics()
|
void LuaBinding::BindGraphics()
|
||||||
{
|
{
|
||||||
|
/*********************************** Nz::AbstractViewer ***********************************/
|
||||||
|
abstractViewer.BindMethod("GetAspectRatio", &Nz::AbstractViewer::GetAspectRatio);
|
||||||
|
abstractViewer.BindMethod("GetEyePosition", &Nz::AbstractViewer::GetEyePosition);
|
||||||
|
abstractViewer.BindMethod("GetForward", &Nz::AbstractViewer::GetForward);
|
||||||
|
//abstractViewer.BindMethod("GetFrustum", &Nz::AbstractViewer::GetFrustum);
|
||||||
|
abstractViewer.BindMethod("GetProjectionMatrix", &Nz::AbstractViewer::GetProjectionMatrix);
|
||||||
|
//abstractViewer.BindMethod("GetTarget", &Nz::AbstractViewer::GetTarget);
|
||||||
|
abstractViewer.BindMethod("GetViewMatrix", &Nz::AbstractViewer::GetViewMatrix);
|
||||||
|
abstractViewer.BindMethod("GetViewport", &Nz::AbstractViewer::GetViewport);
|
||||||
|
abstractViewer.BindMethod("GetZFar", &Nz::AbstractViewer::GetZFar);
|
||||||
|
abstractViewer.BindMethod("GetZNear", &Nz::AbstractViewer::GetZNear);
|
||||||
|
|
||||||
/*********************************** Nz::InstancedRenderable ***********************************/
|
/*********************************** Nz::InstancedRenderable ***********************************/
|
||||||
|
|
||||||
/*********************************** Nz::Material ***********************************/
|
/*********************************** Nz::Material ***********************************/
|
||||||
|
|
@ -347,6 +359,7 @@ namespace Ndk
|
||||||
|
|
||||||
void LuaBinding::RegisterGraphics(Nz::LuaInstance& instance)
|
void LuaBinding::RegisterGraphics(Nz::LuaInstance& instance)
|
||||||
{
|
{
|
||||||
|
abstractViewer.Register(instance);
|
||||||
instancedRenderable.Register(instance);
|
instancedRenderable.Register(instance);
|
||||||
material.Register(instance);
|
material.Register(instance);
|
||||||
model.Register(instance);
|
model.Register(instance);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2016 Jérôme Leclercq, Arnaud Cadot
|
// Copyright (C) 2016 Jérôme Leclercq, Arnaud Cadot
|
||||||
// This file is part of the "Nazara Development Kit"
|
// This file is part of the "Nazara Development Kit"
|
||||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||||
|
|
||||||
|
|
@ -138,6 +138,22 @@ namespace Ndk
|
||||||
|
|
||||||
|
|
||||||
#ifndef NDK_SERVER
|
#ifndef NDK_SERVER
|
||||||
|
/*********************************** Ndk::CameraComponent **********************************/
|
||||||
|
cameraComponent.Inherit<Nz::AbstractViewer>(abstractViewer, [] (CameraComponentHandle* handle) -> Nz::AbstractViewer*
|
||||||
|
{
|
||||||
|
return handle->GetObject();
|
||||||
|
});
|
||||||
|
|
||||||
|
cameraComponent.BindMethod("SetFOV", &Ndk::CameraComponent::SetFOV);
|
||||||
|
cameraComponent.BindMethod("SetLayer", &Ndk::CameraComponent::SetLayer);
|
||||||
|
cameraComponent.BindMethod("SetProjectionType", &Ndk::CameraComponent::SetProjectionType);
|
||||||
|
cameraComponent.BindMethod("SetSize", (void(Ndk::CameraComponent::*)(const Nz::Vector2f&)) &Ndk::CameraComponent::SetSize);
|
||||||
|
//cameraComponent.BindMethod("SetTarget", &Ndk::CameraComponent::SetTarget);
|
||||||
|
cameraComponent.BindMethod("SetTargetRegion", &Ndk::CameraComponent::SetTargetRegion);
|
||||||
|
cameraComponent.BindMethod("SetViewport", &Ndk::CameraComponent::SetViewport);
|
||||||
|
cameraComponent.BindMethod("SetZFar", &Ndk::CameraComponent::SetZFar);
|
||||||
|
cameraComponent.BindMethod("SetZNear", &Ndk::CameraComponent::SetZNear);
|
||||||
|
|
||||||
/*********************************** Ndk::GraphicsComponent **********************************/
|
/*********************************** Ndk::GraphicsComponent **********************************/
|
||||||
graphicsComponent.BindMethod("Attach", [] (Nz::LuaInstance& lua, Ndk::GraphicsComponent* instance, std::size_t argumentCount) -> int
|
graphicsComponent.BindMethod("Attach", [] (Nz::LuaInstance& lua, Ndk::GraphicsComponent* instance, std::size_t argumentCount) -> int
|
||||||
{
|
{
|
||||||
|
|
@ -205,6 +221,7 @@ namespace Ndk
|
||||||
BindComponent<VelocityComponent>("Velocity");
|
BindComponent<VelocityComponent>("Velocity");
|
||||||
|
|
||||||
#ifndef NDK_SERVER
|
#ifndef NDK_SERVER
|
||||||
|
BindComponent<CameraComponent>("Camera");
|
||||||
BindComponent<GraphicsComponent>("Graphics");
|
BindComponent<GraphicsComponent>("Graphics");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -225,6 +242,7 @@ namespace Ndk
|
||||||
world.Register(instance);
|
world.Register(instance);
|
||||||
|
|
||||||
#ifndef NDK_SERVER
|
#ifndef NDK_SERVER
|
||||||
|
cameraComponent.Register(instance);
|
||||||
console.Register(instance);
|
console.Register(instance);
|
||||||
graphicsComponent.Register(instance);
|
graphicsComponent.Register(instance);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue