Control the game from Lua!
This commit is contained in:
parent
c9ebd3fefe
commit
05bc8cb7d6
5
main.lua
5
main.lua
@ -7,5 +7,8 @@ function init()
|
||||
end
|
||||
|
||||
function update(delta)
|
||||
print(couch.root:find_node("cube"):get_transform().position[3])
|
||||
local transform = couch.root:find_node("cube"):get_transform()
|
||||
transform.rotation[2] = transform.rotation[2] + delta
|
||||
transform.rotation[1] = transform.rotation[1] - delta * 0.3
|
||||
couch.root:find_node("cube"):set_transform(transform)
|
||||
end
|
||||
|
@ -109,6 +109,8 @@ fn main() {
|
||||
let mvp = glm::perspective::<f32>(4.0/3.0, 45.0_f32.to_radians(), 0.2, 100.0);
|
||||
let mvp = glm::translate::<f32>(&mvp, &cube.get_transform().position);
|
||||
let mvp = glm::rotate_x(&mvp, cube.get_transform().rotation.x);
|
||||
let mvp = glm::rotate_y(&mvp, cube.get_transform().rotation.y);
|
||||
let mvp = glm::rotate_z(&mvp, cube.get_transform().rotation.z);
|
||||
|
||||
let uniforms = uniform! {
|
||||
MVP: *mvp.as_ref(),
|
||||
|
Loading…
Reference in New Issue
Block a user