bones_render/
transform.rs1use crate::prelude::*;
4
5#[derive(Clone, Copy, Debug, TypeUlid)]
9#[ulid = "01GNFQWJWWXJJEXZQEDQJWZQWP"]
10#[repr(C)]
11pub struct Transform {
12 pub translation: Vec3,
14 pub rotation: Quat,
16 pub scale: Vec3,
18}
19
20impl Default for Transform {
21 fn default() -> Self {
22 Self {
23 translation: Default::default(),
24 rotation: Default::default(),
25 scale: Vec3::ONE,
26 }
27 }
28}
29
30impl Transform {
31 pub fn from_translation(translation: Vec3) -> Self {
33 Self {
34 translation,
35 ..default()
36 }
37 }
38
39 pub fn from_rotation(rotation: Quat) -> Self {
41 Self {
42 rotation,
43 ..default()
44 }
45 }
46
47 pub fn from_scale(scale: Vec3) -> Self {
49 Self { scale, ..default() }
50 }
51}