a working version with no error but still some bugs around texturing
This commit is contained in:
parent
2d8244386a
commit
68d4610470
16 changed files with 473 additions and 110 deletions
|
@ -42,7 +42,7 @@ vector3 vector3_from_lua_table(sol::table t)
|
|||
}
|
||||
|
||||
|
||||
void register_core_function(sol::state&,sol::table& ns)
|
||||
void register_core_function(sol::state& lua,sol::table& ns)
|
||||
{
|
||||
|
||||
typedef real_t Scalar;
|
||||
|
@ -114,7 +114,7 @@ void register_core_function(sol::state&,sol::table& ns)
|
|||
|
||||
|
||||
ns.new_usertype<size>("size"
|
||||
, sol::constructors<size(),size(Scalar,Scalar)>()
|
||||
, sol::call_constructor,sol::constructors<size(),size(Scalar,Scalar)>()
|
||||
, "width",&size::width
|
||||
, "height",&size::height
|
||||
, "cast_to_float",&size::cast<float>
|
||||
|
@ -174,15 +174,24 @@ void register_core_function(sol::state&,sol::table& ns)
|
|||
|
||||
|
||||
|
||||
ns.new_usertype<image>("image"
|
||||
auto image_type = ns.new_usertype<image>("image"
|
||||
, sol::constructors<image()>()
|
||||
,"create",&image::create
|
||||
,"size",sol::readonly_property(&image::size)
|
||||
,"change_count",sol::property(&image::change_count,&image::set_change_count)
|
||||
).new_enum<false>("layout"
|
||||
,"rgb8", image::RGB8
|
||||
,"rgb32", image::RGBA8
|
||||
,"gray", image::LUM);
|
||||
,"create",&image::create
|
||||
,"size",sol::readonly_property(&image::size)
|
||||
,"generate_noise",&image::generate_noise
|
||||
,"change_count",sol::property(&image::change_count,&image::set_change_count)
|
||||
);
|
||||
|
||||
image_type.create_named("pixel_layout"
|
||||
,"rgb8", image::RGB8
|
||||
,"rgb32", image::RGBA8
|
||||
,"gray", image::LUM
|
||||
);
|
||||
|
||||
// image_type["layout"] = lua.create_table_with(
|
||||
// "rgb8", image::RGB8
|
||||
// ,"rgb32", image::RGBA8
|
||||
// ,"gray", image::LUM);
|
||||
|
||||
|
||||
ns.new_usertype<rectangle>("rectangle"
|
||||
|
|
|
@ -30,8 +30,12 @@ void register_visual_function(sol::state&,sol::table &ns)
|
|||
,"set_source",&shader::set_source
|
||||
,"set_uniforms",&shader::set_uniforms
|
||||
,"set_uniform_float",&shader::set_uniform<float>
|
||||
,"set_uniform_uint",&shader::set_uniform<uint32_t>
|
||||
,"set_uniform_int",&shader::set_uniform<int32_t>
|
||||
,"set_uniform_mat4",&shader::set_uniform<matrix4x4&>
|
||||
,"set_uniform_vec4",&shader::set_uniform<vector4&>
|
||||
,"set_uniform_texture",&shader::set_uniform<texture&>
|
||||
|
||||
).new_enum<false>("shader_type"
|
||||
,"fragment",shader::code_type::fragment
|
||||
,"vertex",shader::code_type::vertex
|
||||
|
@ -60,14 +64,19 @@ void register_visual_function(sol::state&,sol::table &ns)
|
|||
,"blit",&framebuffer::blit);
|
||||
|
||||
ns.new_usertype<texture>("texture"
|
||||
,sol::constructors<texture(),texture(texture::image_ref,texture::data_layout)>()
|
||||
,"image",sol::property(&texture::set_image,&texture::image)
|
||||
,sol::constructors<texture()>()
|
||||
,"create",&texture::create
|
||||
,"update",&texture::update
|
||||
,"bind",&texture::bind
|
||||
,"unbind",&texture::unbind
|
||||
,"native_handle",&texture::native_handle
|
||||
);
|
||||
|
||||
ns.new_usertype<context>("context"
|
||||
,sol::constructors<context()>()
|
||||
,"clear",&context::clear
|
||||
,"set_viewport",&context::set_viewport
|
||||
,"get_error",&context::get_error
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue