mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-03 18:09:13 +03:00
Make Basis look column-major while retaining a row-major representation
Per https://github.com/godotengine/godot/issues/14553: Godot stores Basis in row-major layout for more change for efficiently taking advantage of SIMD instructions, but in scripts Basis looks like and is accessible in a column-major format. This change modifies the C++ binding so that from the script's perspective Basis does look like if it was column-major while retaining a row-major in-memory representation. This is achieved using a set of helper template classes which allow accessing individual columns whose components are non-continues in memory as if it was a Vector3 type. This ensures script interface compatibility without needing to transpose the Basis every time it is passed over the script-engine boundary. Also made most of the Vector2 and Vector3 class interfaces inlined in the process for increased performance. While unrelated (but didn't want to file a separate PR for it), this change adds the necessary flags to have debug symbol information under MSVC. Fixes #241.
This commit is contained in:
@@ -31,15 +31,6 @@ Basis::Basis() {
|
||||
elements[2][2] = 1;
|
||||
}
|
||||
|
||||
const Vector3 &Basis::operator[](int axis) const {
|
||||
|
||||
return elements[axis];
|
||||
}
|
||||
Vector3 &Basis::operator[](int axis) {
|
||||
|
||||
return elements[axis];
|
||||
}
|
||||
|
||||
#define cofac(row1, col1, row2, col2) \
|
||||
(elements[row1][col1] * elements[row2][col2] - elements[row1][col2] * elements[row2][col1])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user