mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add .set_rotation(mat4)
This commit is contained in:
parent
a7404c2637
commit
04da2f5e69
3 changed files with 13 additions and 1 deletions
|
|
@ -39,5 +39,6 @@ function on_hud_render()
|
|||
note:update_settings({
|
||||
color={math.sin(time.uptime() * 12) * 0.5 + 0.5, 0, 0, 1}
|
||||
})
|
||||
note:set_axis_x({math.sin(time.uptime()), 0, math.cos(time.uptime())})
|
||||
-- note:set_axis_x({math.sin(time.uptime()), 0, math.cos(time.uptime())})
|
||||
note:set_rotation(mat4.rotate({1, 1, 0}, time.uptime() * 57))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ local Text3D = {__index={
|
|||
set_axis_x=function(self, v) return gfx.text3d.set_axis_x(self.id, v) end,
|
||||
get_axis_y=function(self) return gfx.text3d.get_axis_y(self.id) end,
|
||||
set_axis_y=function(self, v) return gfx.text3d.set_axis_y(self.id, v) end,
|
||||
set_rotation=function(self, m) return gfx.text3d.set_rotation(self.id, m) end,
|
||||
get_text=function(self) return gfx.text3d.get_text(self.id) end,
|
||||
set_text=function(self, s) return gfx.text3d.set_text(self.id, s) end,
|
||||
update_settings=function(self, t) return gfx.text3d.update_settings(self.id, t) end,
|
||||
|
|
|
|||
|
|
@ -89,6 +89,15 @@ static int l_update_settings(lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l_set_rotation(lua::State* L) {
|
||||
if (auto note = renderer->texts->get(lua::tointeger(L, 1))) {
|
||||
auto matrix = lua::tomat4(L, 2);
|
||||
note->setAxisX(matrix * glm::vec4(1, 0, 0, 1));
|
||||
note->setAxisY(matrix * glm::vec4(0, 1, 0, 1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg text3dlib[] = {
|
||||
{"show", lua::wrap<l_show>},
|
||||
{"hide", lua::wrap<l_hide>},
|
||||
|
|
@ -100,6 +109,7 @@ const luaL_Reg text3dlib[] = {
|
|||
{"set_axis_x", lua::wrap<l_set_axis_x>},
|
||||
{"get_axis_y", lua::wrap<l_get_axis_y>},
|
||||
{"set_axis_y", lua::wrap<l_set_axis_y>},
|
||||
{"set_rotation", lua::wrap<l_set_rotation>},
|
||||
{"update_settings", lua::wrap<l_update_settings>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue