Skip to content

Commit

Permalink
Merge pull request #28 from ocboogie/rotation_transformation
Browse files Browse the repository at this point in the history
Implement `Transformation::rotate`
  • Loading branch information
hecrj committed May 6, 2019
2 parents c0d80a8 + 884e308 commit f79d129
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/graphics/transformation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ impl Transformation {
&nalgebra::Vector3::new(x, y, 1.0),
))
}

/// Obtain a rotation transformation.
///
/// You can use this to rotate your camera, for example.
/// Note: Rotation is in radians.
pub fn rotate(rotation: f32) -> Transformation {
Transformation(nalgebra::Matrix4::new_rotation(
nalgebra::Vector3::new(0.0, 0.0, rotation)
))
}
}

impl Mul for Transformation {
Expand Down

0 comments on commit f79d129

Please sign in to comment.