Handle inf default values in the bindings generator.

This commit is contained in:
Relintai 2023-05-31 22:41:12 +02:00
parent 2b669fcb6f
commit c6607875c9
2 changed files with 5 additions and 0 deletions

View File

@ -349,6 +349,9 @@ def generate_class_header(used_classes, c, use_template_get_node):
if default_value == "Null" or default_value == "[Object:null]": if default_value == "Null" or default_value == "[Object:null]":
return "nullptr" return "nullptr"
if _type == 'float':
return default_value.replace("inf", "Math_INF")
return default_value return default_value
if argument["has_default_value"] or has_default_argument: if argument["has_default_value"] or has_default_argument:

View File

@ -105,6 +105,8 @@ typedef float real_t;
#define Math_PI 3.1415926535897932384626433833 #define Math_PI 3.1415926535897932384626433833
#define Math_TAU 6.2831853071795864769252867666 #define Math_TAU 6.2831853071795864769252867666
#define Math_INF INFINITY
#define Math_NAN NAN
#define _PLANE_EQ_DOT_EPSILON 0.999 #define _PLANE_EQ_DOT_EPSILON 0.999
#define _PLANE_EQ_D_EPSILON 0.0001 #define _PLANE_EQ_D_EPSILON 0.0001