Skip to content

Commit

Permalink
Fix stringification of Projection
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed Nov 22, 2024
1 parent f952bfe commit d0f73df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
12 changes: 4 additions & 8 deletions core/math/projection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,14 +912,10 @@ void Projection::set_light_atlas_rect(const Rect2 &p_rect) {
}

Projection::operator String() const {
String str;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
str += String((j > 0) ? ", " : "\n") + rtos(columns[i][j]);
}
}

return str;
return "[X: " + columns[0].operator String() +
", Y: " + columns[1].operator String() +
", Z: " + columns[2].operator String() +
", W: " + columns[3].operator String() + "]";
}

real_t Projection::get_aspect() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func test():
print(AABB(Vector3.ZERO, Vector3.ONE))
print(Basis.from_euler(Vector3(0, 0, 0)))
print(Transform3D.IDENTITY)
print(Projection.IDENTITY)

print(Color(1, 2, 3, 4))
print(StringName("hello"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ hello world
[P: (0.0, 0.0, 0.0), S: (1.0, 1.0, 1.0)]
[X: (1.0, 0.0, 0.0), Y: (0.0, 1.0, 0.0), Z: (0.0, 0.0, 1.0)]
[X: (1.0, 0.0, 0.0), Y: (0.0, 1.0, 0.0), Z: (0.0, 0.0, 1.0), O: (0.0, 0.0, 0.0)]
[X: (1, 0, 0, 0), Y: (0, 1, 0, 0), Z: (0, 0, 1, 0), W: (0, 0, 0, 1)]
(1.0, 2.0, 3.0, 4.0)
hello
hello/world
Expand Down

0 comments on commit d0f73df

Please sign in to comment.