SDK/Lua: Bind CameraComponent
This commit is contained in:
parent
cdc53e3dc3
commit
3bd426f3dc
|
|
@ -18,9 +18,12 @@
|
|||
|
||||
namespace Ndk
|
||||
{
|
||||
class CameraComponent;
|
||||
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:
|
||||
inline CameraComponent();
|
||||
|
|
|
|||
|
|
@ -213,6 +213,15 @@ namespace Nz
|
|||
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>)
|
||||
{
|
||||
Rectd rectDouble;
|
||||
|
|
@ -488,6 +497,12 @@ namespace Nz
|
|||
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>)
|
||||
{
|
||||
instance.PushInstance<Rectd>("Rect", val);
|
||||
|
|
@ -597,6 +612,12 @@ namespace Nz
|
|||
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>)
|
||||
{
|
||||
instance.PushInstance<Ndk::ConsoleHandle>("Console", handle);
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ namespace Ndk
|
|||
Nz::LuaClass<Nz::SoundEmitter> soundEmitter;
|
||||
|
||||
// Graphics
|
||||
Nz::LuaClass<Nz::AbstractViewer> abstractViewer;
|
||||
Nz::LuaClass<Nz::InstancedRenderableRef> instancedRenderable;
|
||||
Nz::LuaClass<Nz::MaterialRef> material;
|
||||
Nz::LuaClass<Nz::ModelRef> model;
|
||||
|
|
@ -88,6 +89,7 @@ namespace Ndk
|
|||
Nz::LuaClass<Nz::TextureRef> texture;
|
||||
|
||||
// SDK
|
||||
Nz::LuaClass<CameraComponentHandle> cameraComponent;
|
||||
Nz::LuaClass<ConsoleHandle> console;
|
||||
Nz::LuaClass<GraphicsComponentHandle> graphicsComponent;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ namespace Ndk
|
|||
soundEmitter("SoundEmitter"),
|
||||
|
||||
// Graphics
|
||||
abstractViewer("AbstractViewer"),
|
||||
instancedRenderable("InstancedRenderable"),
|
||||
material("Material"),
|
||||
model("Model"),
|
||||
|
|
@ -68,6 +69,7 @@ namespace Ndk
|
|||
texture("Texture"),
|
||||
|
||||
// SDK
|
||||
cameraComponent("CameraComponent"),
|
||||
console("Console"),
|
||||
graphicsComponent("GraphicsComponent")
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -12,6 +12,18 @@ namespace Ndk
|
|||
|
||||
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::Material ***********************************/
|
||||
|
|
@ -347,6 +359,7 @@ namespace Ndk
|
|||
|
||||
void LuaBinding::RegisterGraphics(Nz::LuaInstance& instance)
|
||||
{
|
||||
abstractViewer.Register(instance);
|
||||
instancedRenderable.Register(instance);
|
||||
material.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"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
|
|
@ -138,6 +138,22 @@ namespace Ndk
|
|||
|
||||
|
||||
#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 **********************************/
|
||||
graphicsComponent.BindMethod("Attach", [] (Nz::LuaInstance& lua, Ndk::GraphicsComponent* instance, std::size_t argumentCount) -> int
|
||||
{
|
||||
|
|
@ -205,6 +221,7 @@ namespace Ndk
|
|||
BindComponent<VelocityComponent>("Velocity");
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
BindComponent<CameraComponent>("Camera");
|
||||
BindComponent<GraphicsComponent>("Graphics");
|
||||
#endif
|
||||
}
|
||||
|
|
@ -225,6 +242,7 @@ namespace Ndk
|
|||
world.Register(instance);
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
cameraComponent.Register(instance);
|
||||
console.Register(instance);
|
||||
graphicsComponent.Register(instance);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue