added scene with new approach differing from other scenegraphs - more closely modelled after Unity
This commit is contained in:
parent
a99906317d
commit
59cb75513d
14 changed files with 212 additions and 15 deletions
|
@ -22,7 +22,7 @@ target_include_directories(
|
|||
|
||||
target_include_directories(
|
||||
pwscripting
|
||||
PUBLIC
|
||||
PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src/deps/lua-5.3.4/src
|
||||
${CMAKE_SOURCE_DIR}/src/deps/sol
|
||||
)
|
||||
|
|
|
@ -12,10 +12,10 @@ struct lua_state : public pw::script::state {
|
|||
pw::scripting::state _state;
|
||||
pw::scripting::table _namespace;
|
||||
|
||||
|
||||
void load_modules();
|
||||
|
||||
lua_state() {
|
||||
|
||||
// create global pw namespace
|
||||
_namespace = _state.create_named_table("pw");
|
||||
|
||||
|
@ -46,7 +46,8 @@ void lua_state::load_modules() {
|
|||
|
||||
_namespace.set("pi",pw::Pi<Scalar>());
|
||||
|
||||
#if 0
|
||||
using namespace pw;
|
||||
|
||||
_namespace.new_usertype<vector3d>("vector3",
|
||||
"set",&vector3d::set,
|
||||
"x", scripting::property(scripting::resolve<const Scalar&() const>(&vector3d::x), &vector3d::set_x),
|
||||
|
@ -71,25 +72,20 @@ void lua_state::load_modules() {
|
|||
"angle",scripting::property(&axisangled::angle,&axisangled::set_angle)
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
pw::script::script() {
|
||||
pw::script::script()
|
||||
{
|
||||
_state.reset(new lua_state());
|
||||
}
|
||||
|
||||
pw::script::~script()
|
||||
{
|
||||
// _state.collect_garbage();
|
||||
_state = nullptr;
|
||||
}
|
||||
|
||||
//bool pw::script::load(const std::string &s)
|
||||
//{
|
||||
// return _state.load(s.c_str());
|
||||
//}
|
||||
|
||||
int pw::script::run(const std::string &s)
|
||||
{
|
||||
return _state->run(s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue