1
0
Fork 0

auts: add transform to have flexible positions

This commit is contained in:
coaljoe 2020-04-30 12:05:32 +03:00
parent a7c7c3d51a
commit 0adc284a9d
3 changed files with 30 additions and 4 deletions

5
main.v
View File

@ -48,6 +48,11 @@ fn main() {
ob.dim_z = 2
ob.elem = e4
// Position
ob.transform.pos_x = 10.0
ob.transform.pos_y = 10.0
ob.transform.rot_z = 45.0
println("ob: ${ob}")
//

View File

@ -9,12 +9,17 @@ mut:
elem &Elem // XXX use id/enum
// Position in the world
pos_x int
pos_y int
pos_z int
//pos_x int
//pos_y int
//pos_z int
// Flixible position in the world
transform &Transform
}
fn new_object() &Object {
o := &Object{}
o := &Object{
transform: new_transform(),
}
return o
}

16
transform.v Normal file
View File

@ -0,0 +1,16 @@
module main
struct Transform {
mut:
pos_x f32
pos_y f32
pos_z f32
rot_x f32
rot_y f32
rot_z f32
}
fn new_transform() &Transform {
t := &Transform{}
return t
}