summaryrefslogtreecommitdiff
path: root/engine/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-21 15:46:36 +0200
committerHampusM <hampus@hampusmat.com>2024-04-21 15:46:36 +0200
commit219c4383e175af263141613afb9563120b2da3f3 (patch)
tree94179e8234e2ed8c27f05d2d2ad8bb1bade9edc9 /engine/src
parent26092b2824ad2d956023adf0af3f1ad0423e02ea (diff)
refactor(engine): make Transform fields public
Diffstat (limited to 'engine/src')
-rw-r--r--engine/src/transform.rs34
1 files changed, 6 insertions, 28 deletions
diff --git a/engine/src/transform.rs b/engine/src/transform.rs
index f55f44e..ad67d4c 100644
--- a/engine/src/transform.rs
+++ b/engine/src/transform.rs
@@ -6,37 +6,12 @@ use crate::vector::Vec3;
#[derive(Debug, Clone, Component)]
pub struct Transform
{
- position: Vec3<f32>,
- scale: Vec3<f32>,
+ pub position: Vec3<f32>,
+ pub scale: Vec3<f32>,
}
impl Transform
{
- #[must_use]
- pub fn new() -> Self
- {
- Self {
- position: Vec3::default(),
- scale: Vec3 { x: 1.0, y: 1.0, z: 1.0 },
- }
- }
-
- #[must_use]
- pub fn position(&self) -> &Vec3<f32>
- {
- &self.position
- }
-
- pub fn set_position(&mut self, position: Vec3<f32>)
- {
- self.position = position;
- }
-
- pub fn set_scale(&mut self, scale: Vec3<f32>)
- {
- self.scale = scale;
- }
-
pub(crate) fn as_matrix(&self) -> Matrix<f32, 4, 4>
{
let mut matrix = Matrix::new_identity();
@@ -53,6 +28,9 @@ impl Default for Transform
{
fn default() -> Self
{
- Self::new()
+ Self {
+ position: Vec3::default(),
+ scale: Vec3 { x: 1.0, y: 1.0, z: 1.0 },
+ }
}
}