1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use bevy_math::Mat4;
use bevy_property::Properties;
use std::fmt;
#[derive(Debug, PartialEq, Clone, Copy, Properties)]
pub struct Transform {
pub value: Mat4,
pub sync: bool,
}
impl Transform {
#[inline(always)]
pub fn identity() -> Self {
Transform {
value: Mat4::identity(),
sync: true,
}
}
#[inline(always)]
pub fn new(value: Mat4) -> Self {
Transform { value, sync: true }
}
#[inline(always)]
pub fn new_sync_disabled(value: Mat4) -> Self {
Transform { value, sync: false }
}
}
impl Default for Transform {
fn default() -> Self {
Self::identity()
}
}
impl fmt::Display for Transform {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.value)
}
}