Add bindings for Vector4, Vector4i, Projection built-in types.
This commit is contained in:
@@ -576,6 +576,21 @@ void _err_print_index_error(const char *p_function, const char *p_file, int p_li
|
||||
|
||||
} // namespace godot
|
||||
|
||||
/**
|
||||
* This should be a 'free' assert for program flow and should not be needed in any releases,
|
||||
* only used in dev builds.
|
||||
*/
|
||||
#ifdef DEBUG_ENABLED
|
||||
#define DEV_ASSERT(m_cond) \
|
||||
if (unlikely(!(m_cond))) { \
|
||||
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "FATAL: DEV_ASSERT failed \"" _STR(m_cond) "\" is false."); \
|
||||
GENERATE_TRAP(); \
|
||||
} else \
|
||||
((void)0)
|
||||
#else
|
||||
#define DEV_ASSERT(m_cond)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Gives an error message when a method bind is invalid (likely the hash changed).
|
||||
* Avoids crashing the application in this case. It's not free, so it's debug only.
|
||||
|
||||
@@ -278,6 +278,21 @@ inline float lerp_angle(float p_from, float p_to, float p_weight) {
|
||||
return p_from + distance * p_weight;
|
||||
}
|
||||
|
||||
inline double cubic_interpolate(double p_from, double p_to, double p_pre, double p_post, double p_weight) {
|
||||
return 0.5 *
|
||||
((p_from * 2.0) +
|
||||
(-p_pre + p_to) * p_weight +
|
||||
(2.0 * p_pre - 5.0 * p_from + 4.0 * p_to - p_post) * (p_weight * p_weight) +
|
||||
(-p_pre + 3.0 * p_from - 3.0 * p_to + p_post) * (p_weight * p_weight * p_weight));
|
||||
}
|
||||
inline float cubic_interpolate(float p_from, float p_to, float p_pre, float p_post, float p_weight) {
|
||||
return 0.5f *
|
||||
((p_from * 2.0f) +
|
||||
(-p_pre + p_to) * p_weight +
|
||||
(2.0f * p_pre - 5.0f * p_from + 4.0f * p_to - p_post) * (p_weight * p_weight) +
|
||||
(-p_pre + 3.0f * p_from - 3.0f * p_to + p_post) * (p_weight * p_weight * p_weight));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline T clamp(T x, T minv, T maxv) {
|
||||
if (x < minv) {
|
||||
|
||||
@@ -135,11 +135,14 @@ MAKE_PTRARG(Rect2i);
|
||||
MAKE_PTRARG_BY_REFERENCE(Vector3);
|
||||
MAKE_PTRARG_BY_REFERENCE(Vector3i);
|
||||
MAKE_PTRARG(Transform2D);
|
||||
MAKE_PTRARG_BY_REFERENCE(Vector4);
|
||||
MAKE_PTRARG_BY_REFERENCE(Vector4i);
|
||||
MAKE_PTRARG_BY_REFERENCE(Plane);
|
||||
MAKE_PTRARG(Quaternion);
|
||||
MAKE_PTRARG_BY_REFERENCE(AABB);
|
||||
MAKE_PTRARG_BY_REFERENCE(Basis);
|
||||
MAKE_PTRARG_BY_REFERENCE(Transform3D);
|
||||
MAKE_PTRARG_BY_REFERENCE(Projection);
|
||||
MAKE_PTRARG_BY_REFERENCE(Color);
|
||||
MAKE_PTRARG(StringName);
|
||||
MAKE_PTRARG(NodePath);
|
||||
|
||||
@@ -135,11 +135,14 @@ MAKE_TYPE_INFO(Rect2i, GDNATIVE_VARIANT_TYPE_RECT2I)
|
||||
MAKE_TYPE_INFO(Vector3, GDNATIVE_VARIANT_TYPE_VECTOR3)
|
||||
MAKE_TYPE_INFO(Vector3i, GDNATIVE_VARIANT_TYPE_VECTOR3I)
|
||||
MAKE_TYPE_INFO(Transform2D, GDNATIVE_VARIANT_TYPE_TRANSFORM2D)
|
||||
MAKE_TYPE_INFO(Vector4, GDNATIVE_VARIANT_TYPE_VECTOR4)
|
||||
MAKE_TYPE_INFO(Vector4i, GDNATIVE_VARIANT_TYPE_VECTOR4I)
|
||||
MAKE_TYPE_INFO(Plane, GDNATIVE_VARIANT_TYPE_PLANE)
|
||||
MAKE_TYPE_INFO(Quaternion, GDNATIVE_VARIANT_TYPE_QUATERNION)
|
||||
MAKE_TYPE_INFO(AABB, GDNATIVE_VARIANT_TYPE_AABB)
|
||||
MAKE_TYPE_INFO(Basis, GDNATIVE_VARIANT_TYPE_BASIS)
|
||||
MAKE_TYPE_INFO(Transform3D, GDNATIVE_VARIANT_TYPE_TRANSFORM3D)
|
||||
MAKE_TYPE_INFO(Projection, GDNATIVE_VARIANT_TYPE_PROJECTION)
|
||||
MAKE_TYPE_INFO(Color, GDNATIVE_VARIANT_TYPE_COLOR)
|
||||
MAKE_TYPE_INFO(StringName, GDNATIVE_VARIANT_TYPE_STRING_NAME)
|
||||
MAKE_TYPE_INFO(NodePath, GDNATIVE_VARIANT_TYPE_NODE_PATH)
|
||||
|
||||
Reference in New Issue
Block a user