The member _godot_string should never be straight out overwritten ever without
first destroying the underlying string object's memory. This change solves the
problem through the introduction of a new private constructor to create String
objects with a pre-existing godot_string handle.
Fixes Vector 2 and 3 bounce and reflect methods to match gdscript
Co-Authored-By: Bruno Campos <brunocu@msn.com>
Move calculation to reflect
fix commit
squash
fix style
Changed error message macros to actually use Godot's error reporting
facilities instead of outputting straight to stderr. This enables
GDNative errors to actually show up inside the editor.
Messages and set of available macros now also better matches that of
the engine itself.
The [] operator of Basis was returning a reference to a temporary, so fixed it.
There was no * operator in Transform equivalent to the xform function, which is
not in line with GDScript behavior.
Also fixed remaining cases where Transform relied on the old behavior of the
[] operator of Basis (i.e. that it returns the row, not the column).
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.