bones_framework/render/
transform.rs1use crate::prelude::*;
4
5#[derive(Clone, Copy, Debug, HasSchema)]
9#[repr(C)]
10pub struct Transform {
11 pub translation: Vec3,
13 pub rotation: Quat,
15 pub scale: Vec3,
17}
18
19impl Default for Transform {
20 fn default() -> Self {
21 Self {
22 translation: Default::default(),
23 rotation: Default::default(),
24 scale: Vec3::ONE,
25 }
26 }
27}
28
29impl Transform {
30 pub fn from_translation(translation: Vec3) -> Self {
32 Self {
33 translation,
34 ..default()
35 }
36 }
37
38 pub fn from_rotation(rotation: Quat) -> Self {
40 Self {
41 rotation,
42 ..default()
43 }
44 }
45
46 pub fn from_scale(scale: Vec3) -> Self {
48 Self { scale, ..default() }
49 }
50}