new Lua API
This commit is contained in:
parent
9628bc7cb3
commit
f6641b828a
2 changed files with 18 additions and 1 deletions
|
@ -166,6 +166,11 @@ template <> inline const char* typeToString<bool>()
|
|||
return "boolean";
|
||||
}
|
||||
|
||||
template <> inline const char* typeToString<float>()
|
||||
{
|
||||
return "boolean";
|
||||
}
|
||||
|
||||
|
||||
template <typename T> inline bool isType(lua_State* L, int index)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "lua_script/lua_script_system.h"
|
||||
|
||||
#include "renderer/culling_system.h"
|
||||
#include "renderer/frame_buffer.h"
|
||||
#include "renderer/material.h"
|
||||
#include "renderer/material_manager.h"
|
||||
#include "renderer/model.h"
|
||||
|
@ -2331,12 +2332,22 @@ public:
|
|||
}
|
||||
|
||||
|
||||
static void LUA_pipelineRender(Pipeline* pipeline)
|
||||
static void LUA_pipelineRender(Pipeline* pipeline, int w, int h)
|
||||
{
|
||||
pipeline->setViewport(0, 0, w, h);
|
||||
pipeline->render();
|
||||
}
|
||||
|
||||
|
||||
static bgfx::TextureHandle* LUA_getRenderBuffer(Pipeline* pipeline,
|
||||
const char* framebuffer_name,
|
||||
int renderbuffer_idx)
|
||||
{
|
||||
FrameBuffer::RenderBuffer& rb = pipeline->getFramebuffer(framebuffer_name)->getRenderbuffer(renderbuffer_idx);
|
||||
return &rb.m_handle;
|
||||
}
|
||||
|
||||
|
||||
static Texture* LUA_getMaterialTexture(Material* material, int texture_index)
|
||||
{
|
||||
if (!material) return nullptr;
|
||||
|
@ -4596,6 +4607,7 @@ void RenderScene::registerLuaAPI(lua_State* L)
|
|||
REGISTER_FUNCTION(destroyPipeline);
|
||||
REGISTER_FUNCTION(setPipelineScene);
|
||||
REGISTER_FUNCTION(pipelineRender);
|
||||
REGISTER_FUNCTION(getRenderBuffer);
|
||||
REGISTER_FUNCTION(getMaterialTexture);
|
||||
REGISTER_FUNCTION(getTextureWidth);
|
||||
REGISTER_FUNCTION(getTextureHeight);
|
||||
|
|
Loading…
Reference in a new issue