Skip to content

Commit 3c56b3f

Browse files
authored
Merge pull request #983 from fpdotmonkey/projection-compatibility
Provide feature parity for `Projection` with Godot
2 parents c8ba45d + cbf9206 commit 3c56b3f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

godot-core/src/builtin/projection.rs

+14
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ impl Projection {
447447
/// added to the first and second values of the final column respectively.
448448
///
449449
/// _Godot equivalent: `Projection.jitter_offseted()`_
450+
#[doc(alias = "jitter_offseted")]
450451
#[must_use]
451452
pub fn jitter_offset(&self, offset: Vector2) -> Self {
452453
Self::from_cols(
@@ -502,6 +503,19 @@ impl Mul<Vector4> for Projection {
502503
}
503504
}
504505

506+
impl std::ops::Index<Vector4Axis> for Projection {
507+
type Output = Vector4;
508+
509+
fn index(&self, index: Vector4Axis) -> &Self::Output {
510+
match index {
511+
Vector4Axis::X => &self.cols[0],
512+
Vector4Axis::Y => &self.cols[1],
513+
Vector4Axis::Z => &self.cols[2],
514+
Vector4Axis::W => &self.cols[3],
515+
}
516+
}
517+
}
518+
505519
impl ApproxEq for Projection {
506520
fn approx_eq(&self, other: &Self) -> bool {
507521
for i in 0..4 {

0 commit comments

Comments
 (0)