Add a real type · Issue #135 · godot-rust/gdext (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@lilizoey

Description

@lilizoey

Currently a lot of struct and functions in rust are hard-coded to use f32s. Such as Vector2, Vector3 etc. But in godot these structs and functions may be either float or double depending on whether godot is compiled with precision=double or not.

In godot the type used is called real_t and will be either a float or double. We could do the same in our bindings. As it is, our bindings will likely break if we try to use it with a godot that is compiled with precision=double enabled.

The float type in godot, and thus the one used by variant, is always a double, see: https://docs.godotengine.org/en/stable/classes/class_float.html.