the usual triangle test with the shader pipeline

This commit is contained in:
Hartmut Seichter 2019-01-16 16:55:37 +01:00
parent 1f6ff8526b
commit 351d29cd54
10 changed files with 263 additions and 105 deletions

View file

@ -5,6 +5,7 @@
#include "script_core.hpp"
#include "script_system.hpp"
#include "script_scene.hpp"
#include "script_visual.hpp"
namespace pw {
@ -46,6 +47,7 @@ void lua_state::load_modules() {
script_core::load(_namespace);
script_system::load(_namespace);
script_scene::load(_namespace);
script_visual::load(_namespace);
}

View file

@ -6,27 +6,8 @@
#include "pw/core/debug.hpp"
// hijacking
//#include "pw/visual/pipeline.hpp"
namespace pw {
#if defined(__clang)
struct window_lua : public window {
// overridable function
sol::function lua_update;
window_lua(sol::this_state L)
// default is an empty callback
: lua_update(sol::make_reference<sol::function>(L.lua_state(), [](){}))
{
// set this internal callback of the window to the lua callback
_on_update = [this](window&){this->lua_update();};
}
};
#endif
void script_system::load(sol::table &ns)
{
@ -41,30 +22,20 @@ void script_system::load(sol::table &ns)
);
ns.new_usertype<input>("input",
"new", sol::no_constructor,
"get",&input::get,
"mouse_position",sol::readonly_property(&input::mouse_position),
"mouse_button",sol::readonly_property(&input::mouse_button),
"mouse_pressed",sol::readonly_property(&input::mouse_pressed),
"input_string",sol::readonly_property(&input::input_string)
);
ns.new_usertype<input>("input",
"new", sol::no_constructor,
"get",&input::get,
"mouse_position",sol::readonly_property(&input::mouse_position),
"mouse_button",sol::readonly_property(&input::mouse_button),
"mouse_pressed",sol::readonly_property(&input::mouse_pressed),
"input_string",sol::readonly_property(&input::input_string)
);
ns.new_usertype<display>("display",
"all",&display::all,
"name",sol::readonly_property(&display::name)
);
ns.new_usertype<display>("display",
"all",&display::all,
"name",sol::readonly_property(&display::name)
);
// ns.set_function("my_class_func_2", &my_class::func);
//
// // hijack part
// //
// ns.new_usertype<pipeline>("pipeline",
// "create",&pipeline::create
// );
}
}

View file

@ -0,0 +1,18 @@
#include "script_visual.hpp"
#include "pw/core/debug.hpp"
#include "pw/visual/pipeline.hpp"
namespace pw {
void script_visual::load(sol::table &ns)
{
ns.new_usertype<pipeline>("pipeline",
"create",&pipeline::create,
"draw",&pipeline::draw
);
}
}

View file

@ -0,0 +1,17 @@
#ifndef PW_SCRIPTING_PRIVATE_VISUAL_HPP
#define PW_SCRIPTING_PRIVATE_VISUAL_HPP
#include "scripting.hpp"
namespace pw {
struct script_visual {
static void load(scripting::table& ns);
};
}
#endif