Merge pull request #59979 from bruvzg/cpp_check2

This commit is contained in:
Rémi Verschelde 2022-04-27 10:08:26 +02:00 committed by GitHub
commit 8dfa12cae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 261 additions and 268 deletions

View File

@ -169,7 +169,7 @@ public:
EngineDebugger::get_singleton()->send_message("performance:profile_frame", arr);
}
PerformanceProfiler(Object *p_performance) {
explicit PerformanceProfiler(Object *p_performance) {
performance = p_performance;
}
};

View File

@ -108,7 +108,7 @@ public:
void send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, bool p_editor_notify, ErrorHandlerType p_type);
void debug(bool p_can_continue = true, bool p_is_error_breakpoint = false);
RemoteDebugger(Ref<RemoteDebuggerPeer> p_peer);
explicit RemoteDebugger(Ref<RemoteDebuggerPeer> p_peer);
~RemoteDebugger();
};

View File

@ -49,10 +49,10 @@ class NativeExtensionMethodBind : public MethodBind {
bool vararg;
protected:
virtual Variant::Type _gen_argument_type(int p_arg) const {
virtual Variant::Type _gen_argument_type(int p_arg) const override {
return Variant::Type(get_argument_type_func(method_userdata, p_arg));
}
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
virtual PropertyInfo _gen_argument_type_info(int p_arg) const override {
GDNativePropertyInfo pinfo;
get_argument_info_func(method_userdata, p_arg, &pinfo);
PropertyInfo ret;
@ -66,11 +66,13 @@ protected:
}
public:
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const {
#ifdef DEBUG_METHODS_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
return GodotTypeInfo::Metadata(get_argument_metadata_func(method_userdata, p_arg));
}
#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
Variant ret;
GDExtensionClassInstancePtr extension_instance = p_object->_get_extension_instance();
GDNativeCallError ce{ GDNATIVE_CALL_OK, 0, 0 };
@ -80,16 +82,16 @@ public:
r_error.expected = ce.expected;
return ret;
}
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) {
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override {
ERR_FAIL_COND_MSG(vararg, "Vararg methods don't have ptrcall support. This is most likely an engine bug.");
GDExtensionClassInstancePtr extension_instance = p_object->_get_extension_instance();
ptrcall_func(method_userdata, extension_instance, (const GDNativeTypePtr *)p_args, (GDNativeTypePtr)r_ret);
}
virtual bool is_vararg() const {
virtual bool is_vararg() const override {
return false;
}
NativeExtensionMethodBind(const GDNativeExtensionClassMethodInfo *p_method_info) {
explicit NativeExtensionMethodBind(const GDNativeExtensionClassMethodInfo *p_method_info) {
method_userdata = p_method_info->method_userdata;
call_func = p_method_info->call_func;
ptrcall_func = p_method_info->ptrcall_func;

View File

@ -93,7 +93,7 @@ private:
PathMD5() {}
PathMD5(const Vector<uint8_t> &p_buf) {
explicit PathMD5(const Vector<uint8_t> &p_buf) {
a = *((uint64_t *)&p_buf[0]);
b = *((uint64_t *)&p_buf[8]);
}

View File

@ -67,7 +67,7 @@ public:
*/
class StdLogger : public Logger {
public:
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
virtual void logv(const char *p_format, va_list p_list, bool p_err) override _PRINTF_FORMAT_ATTRIBUTE_2_0;
virtual ~StdLogger() {}
};
@ -87,19 +87,19 @@ class RotatedFileLogger : public Logger {
void rotate_file();
public:
RotatedFileLogger(const String &p_base_path, int p_max_files = 10);
explicit RotatedFileLogger(const String &p_base_path, int p_max_files = 10);
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
virtual void logv(const char *p_format, va_list p_list, bool p_err) override _PRINTF_FORMAT_ATTRIBUTE_2_0;
};
class CompositeLogger : public Logger {
Vector<Logger *> loggers;
public:
CompositeLogger(Vector<Logger *> p_loggers);
explicit CompositeLogger(Vector<Logger *> p_loggers);
virtual void logv(const char *p_format, va_list p_list, bool p_err) _PRINTF_FORMAT_ATTRIBUTE_2_0;
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify, ErrorType p_type = ERR_ERROR);
virtual void logv(const char *p_format, va_list p_list, bool p_err) override _PRINTF_FORMAT_ATTRIBUTE_2_0;
virtual void log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, bool p_editor_notify, ErrorType p_type = ERR_ERROR) override;
void add_logger(Logger *p_logger);

View File

@ -257,7 +257,7 @@ Ref<Resource> Resource::duplicate(bool p_subresources) const {
List<PropertyInfo> plist;
get_property_list(&plist);
Ref<Resource> r = (Resource *)ClassDB::instantiate(get_class());
Ref<Resource> r = static_cast<Resource *>(ClassDB::instantiate(get_class()));
ERR_FAIL_COND_V(r.is_null(), Ref<Resource>());
for (const PropertyInfo &E : plist) {

View File

@ -509,7 +509,7 @@ public:
Face() {
}
void init(Vertex *p_a, Vertex *p_b, Vertex *p_c) {
void init(Vertex *p_a, const Vertex *p_b, const Vertex *p_c) {
nearby_vertex = p_a;
origin = p_a->point;
dir0 = *p_b - *p_a;
@ -614,7 +614,7 @@ private:
static Orientation get_orientation(const Edge *p_prev, const Edge *p_next, const Point32 &p_s, const Point32 &p_t);
Edge *find_max_angle(bool p_ccw, const Vertex *p_start, const Point32 &p_s, const Point64 &p_rxs, const Point64 &p_ssxrxs, Rational64 &p_min_cot);
void find_edge_for_coplanar_faces(Vertex *p_c0, Vertex *p_c1, Edge *&p_e0, Edge *&p_e1, Vertex *p_stop0, Vertex *p_stop1);
void find_edge_for_coplanar_faces(Vertex *p_c0, Vertex *p_c1, Edge *&p_e0, Edge *&p_e1, const Vertex *p_stop0, const Vertex *p_stop1);
Edge *new_edge_pair(Vertex *p_from, Vertex *p_to);
@ -1189,7 +1189,7 @@ ConvexHullInternal::Edge *ConvexHullInternal::find_max_angle(bool p_ccw, const V
return min_edge;
}
void ConvexHullInternal::find_edge_for_coplanar_faces(Vertex *p_c0, Vertex *p_c1, Edge *&p_e0, Edge *&p_e1, Vertex *p_stop0, Vertex *p_stop1) {
void ConvexHullInternal::find_edge_for_coplanar_faces(Vertex *p_c0, Vertex *p_c1, Edge *&p_e0, Edge *&p_e1, const Vertex *p_stop0, const Vertex *p_stop1) {
Edge *start0 = p_e0;
Edge *start1 = p_e1;
Point32 et0 = start0 ? start0->target->point : p_c0->point;

View File

@ -904,8 +904,8 @@ Vector<Vector3> Geometry3D::compute_convex_mesh_points(const Plane *p_planes, in
/* dt of 1d function using squared distance */
static void edt(float *f, int stride, int n) {
float *d = (float *)alloca(sizeof(float) * n + sizeof(int) * n + sizeof(float) * (n + 1));
int *v = (int *)&(d[n]);
float *z = (float *)&v[n];
int *v = reinterpret_cast<int *>(&(d[n]));
float *z = reinterpret_cast<float *>(&v[n]);
int k = 0;
v[0] = 0;

View File

@ -103,6 +103,9 @@ public:
static _ALWAYS_INLINE_ double log(double p_x) { return ::log(p_x); }
static _ALWAYS_INLINE_ float log(float p_x) { return ::logf(p_x); }
static _ALWAYS_INLINE_ double log1p(double p_x) { return ::log1p(p_x); }
static _ALWAYS_INLINE_ float log1p(float p_x) { return ::log1pf(p_x); }
static _ALWAYS_INLINE_ double log2(double p_x) { return ::log2(p_x); }
static _ALWAYS_INLINE_ float log2(float p_x) { return ::log2f(p_x); }

View File

@ -152,7 +152,7 @@ protected:
MethodInfo method_info;
public:
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
virtual PropertyInfo _gen_argument_type_info(int p_arg) const override {
if (p_arg < 0) {
return _gen_return_type_info();
} else if (p_arg < method_info.arguments.size()) {
@ -162,23 +162,23 @@ public:
}
}
virtual Variant::Type _gen_argument_type(int p_arg) const {
virtual Variant::Type _gen_argument_type(int p_arg) const override {
return _gen_argument_type_info(p_arg).type;
}
#ifdef DEBUG_METHODS_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int) const {
virtual GodotTypeInfo::Metadata get_argument_meta(int) const override {
return GodotTypeInfo::METADATA_NONE;
}
#endif
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) {
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override {
ERR_FAIL(); // Can't call.
}
virtual bool is_const() const { return false; }
virtual bool is_vararg() const { return true; }
virtual bool is_vararg() const override { return true; }
MethodBindVarArgBase(
R (T::*p_method)(const Variant **, int, Callable::CallError &),
@ -224,7 +224,7 @@ class MethodBindVarArgT : public MethodBindVarArgBase<MethodBindVarArgT<T>, T, v
friend class MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>;
public:
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
(static_cast<T *>(p_object)->*MethodBindVarArgBase<MethodBindVarArgT<T>, T, void, false>::method)(p_args, p_arg_count, r_error);
return {};
}
@ -255,7 +255,7 @@ class MethodBindVarArgTR : public MethodBindVarArgBase<MethodBindVarArgTR<T, R>,
friend class MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>;
public:
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
return (static_cast<T *>(p_object)->*MethodBindVarArgBase<MethodBindVarArgTR<T, R>, T, R, true>::method)(p_args, p_arg_count, r_error);
}
@ -303,7 +303,7 @@ protected:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
virtual Variant::Type _gen_argument_type(int p_arg) const {
virtual Variant::Type _gen_argument_type(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
return call_get_argument_type<P...>(p_arg);
} else {
@ -314,7 +314,7 @@ protected:
#pragma GCC diagnostic pop
#endif
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
virtual PropertyInfo _gen_argument_type_info(int p_arg) const override {
PropertyInfo pi;
call_get_argument_type_info<P...>(p_arg, pi);
return pi;
@ -322,25 +322,25 @@ protected:
public:
#ifdef DEBUG_METHODS_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const {
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
return call_get_argument_metadata<P...>(p_arg);
}
#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
#ifdef TYPED_METHOD_BIND
call_with_variant_args_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, r_error, get_default_arguments());
#else
call_with_variant_args_dv((MB_T *)(p_object), method, p_args, p_arg_count, r_error, get_default_arguments());
call_with_variant_args_dv(reinterpret_cast<MB_T *>(p_object), method, p_args, p_arg_count, r_error, get_default_arguments());
#endif
return Variant();
}
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) {
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override {
#ifdef TYPED_METHOD_BIND
call_with_ptr_args<T, P...>(static_cast<T *>(p_object), method, p_args);
#else
call_with_ptr_args<MB_T, P...>((MB_T *)(p_object), method, p_args);
call_with_ptr_args<MB_T, P...>(reinterpret_cast<MB_T *>(p_object), method, p_args);
#endif
}
@ -378,7 +378,7 @@ protected:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
virtual Variant::Type _gen_argument_type(int p_arg) const {
virtual Variant::Type _gen_argument_type(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
return call_get_argument_type<P...>(p_arg);
} else {
@ -389,7 +389,7 @@ protected:
#pragma GCC diagnostic pop
#endif
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
virtual PropertyInfo _gen_argument_type_info(int p_arg) const override {
PropertyInfo pi;
call_get_argument_type_info<P...>(p_arg, pi);
return pi;
@ -397,25 +397,25 @@ protected:
public:
#ifdef DEBUG_METHODS_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const {
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
return call_get_argument_metadata<P...>(p_arg);
}
#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
#ifdef TYPED_METHOD_BIND
call_with_variant_argsc_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, r_error, get_default_arguments());
#else
call_with_variant_argsc_dv((MB_T *)(p_object), method, p_args, p_arg_count, r_error, get_default_arguments());
call_with_variant_argsc_dv(reinterpret_cast<MB_T *>(p_object), method, p_args, p_arg_count, r_error, get_default_arguments());
#endif
return Variant();
}
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) {
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override {
#ifdef TYPED_METHOD_BIND
call_with_ptr_argsc<T, P...>(static_cast<T *>(p_object), method, p_args);
#else
call_with_ptr_argsc<MB_T, P...>((MB_T *)(p_object), method, p_args);
call_with_ptr_argsc<MB_T, P...>(reinterpret_cast<MB_T *>(p_object), method, p_args);
#endif
}
@ -455,7 +455,7 @@ protected:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
virtual Variant::Type _gen_argument_type(int p_arg) const {
virtual Variant::Type _gen_argument_type(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
return call_get_argument_type<P...>(p_arg);
} else {
@ -463,7 +463,7 @@ protected:
}
}
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
virtual PropertyInfo _gen_argument_type_info(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
PropertyInfo pi;
call_get_argument_type_info<P...>(p_arg, pi);
@ -478,7 +478,7 @@ protected:
public:
#ifdef DEBUG_METHODS_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const {
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
if (p_arg >= 0) {
return call_get_argument_metadata<P...>(p_arg);
} else {
@ -487,21 +487,21 @@ public:
}
#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
Variant ret;
#ifdef TYPED_METHOD_BIND
call_with_variant_args_ret_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments());
#else
call_with_variant_args_ret_dv((MB_T *)p_object, method, p_args, p_arg_count, ret, r_error, get_default_arguments());
call_with_variant_args_ret_dv(reinterpret_cast<MB_T *>(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments());
#endif
return ret;
}
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) {
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override {
#ifdef TYPED_METHOD_BIND
call_with_ptr_args_ret<T, R, P...>(static_cast<T *>(p_object), method, p_args, r_ret);
#else
call_with_ptr_args_ret<MB_T, R, P...>((MB_T *)(p_object), method, p_args, r_ret);
call_with_ptr_args_ret<MB_T, R, P...>(reinterpret_cast<MB_T *>(p_object), method, p_args, r_ret);
#endif
}
@ -542,7 +542,7 @@ protected:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
virtual Variant::Type _gen_argument_type(int p_arg) const {
virtual Variant::Type _gen_argument_type(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
return call_get_argument_type<P...>(p_arg);
} else {
@ -550,7 +550,7 @@ protected:
}
}
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
virtual PropertyInfo _gen_argument_type_info(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
PropertyInfo pi;
call_get_argument_type_info<P...>(p_arg, pi);
@ -565,7 +565,7 @@ protected:
public:
#ifdef DEBUG_METHODS_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const {
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
if (p_arg >= 0) {
return call_get_argument_metadata<P...>(p_arg);
} else {
@ -574,21 +574,21 @@ public:
}
#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
Variant ret;
#ifdef TYPED_METHOD_BIND
call_with_variant_args_retc_dv(static_cast<T *>(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments());
#else
call_with_variant_args_retc_dv((MB_T *)(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments());
call_with_variant_args_retc_dv(reinterpret_cast<MB_T *>(p_object), method, p_args, p_arg_count, ret, r_error, get_default_arguments());
#endif
return ret;
}
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) {
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override {
#ifdef TYPED_METHOD_BIND
call_with_ptr_args_retc<T, R, P...>(static_cast<T *>(p_object), method, p_args, r_ret);
#else
call_with_ptr_args_retc<MB_T, R, P...>((MB_T *)(p_object), method, p_args, r_ret);
call_with_ptr_args_retc<MB_T, R, P...>(reinterpret_cast<MB_T *>(p_object), method, p_args, r_ret);
#endif
}
@ -626,7 +626,7 @@ protected:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
virtual Variant::Type _gen_argument_type(int p_arg) const {
virtual Variant::Type _gen_argument_type(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
return call_get_argument_type<P...>(p_arg);
} else {
@ -637,7 +637,7 @@ protected:
#pragma GCC diagnostic pop
#endif
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
virtual PropertyInfo _gen_argument_type_info(int p_arg) const override {
PropertyInfo pi;
call_get_argument_type_info<P...>(p_arg, pi);
return pi;
@ -645,18 +645,18 @@ protected:
public:
#ifdef DEBUG_METHODS_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const {
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
return call_get_argument_metadata<P...>(p_arg);
}
#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
(void)p_object; // unused
call_with_variant_args_static_dv(function, p_args, p_arg_count, r_error, get_default_arguments());
return Variant();
}
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) {
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override {
(void)p_object;
(void)r_ret;
call_with_ptr_args_static_method(function, p_args);
@ -689,7 +689,7 @@ protected:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wlogical-op"
#endif
virtual Variant::Type _gen_argument_type(int p_arg) const {
virtual Variant::Type _gen_argument_type(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
return call_get_argument_type<P...>(p_arg);
} else {
@ -700,7 +700,7 @@ protected:
#pragma GCC diagnostic pop
#endif
virtual PropertyInfo _gen_argument_type_info(int p_arg) const {
virtual PropertyInfo _gen_argument_type_info(int p_arg) const override {
if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
PropertyInfo pi;
call_get_argument_type_info<P...>(p_arg, pi);
@ -712,7 +712,7 @@ protected:
public:
#ifdef DEBUG_METHODS_ENABLED
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const {
virtual GodotTypeInfo::Metadata get_argument_meta(int p_arg) const override {
if (p_arg >= 0) {
return call_get_argument_metadata<P...>(p_arg);
} else {
@ -721,13 +721,13 @@ public:
}
#endif
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
virtual Variant call(Object *p_object, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) override {
Variant ret;
call_with_variant_args_static_ret_dv(function, p_args, p_arg_count, ret, r_error, get_default_arguments());
return ret;
}
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) {
virtual void ptrcall(Object *p_object, const void **p_args, void *r_ret) override {
(void)p_object;
call_with_ptr_args_static_method_ret(function, p_args, r_ret);
}

View File

@ -294,7 +294,7 @@ enum class Key {
enum class KeyModifierMask {
CODE_MASK = ((1 << 25) - 1), ///< Apply this mask to any keycode to remove modifiers.
MODIFIER_MASK = (0xFF << 24), ///< Apply this mask to isolate modifiers.
MODIFIER_MASK = (0x7F << 24), ///< Apply this mask to isolate modifiers.
SHIFT = (1 << 25),
ALT = (1 << 26),
META = (1 << 27),

View File

@ -4124,15 +4124,11 @@ String String::path_to(const String &p_path) const {
dst += "/";
}
String base;
if (src.begins_with("res://") && dst.begins_with("res://")) {
base = "res:/";
src = src.replace("res://", "/");
dst = dst.replace("res://", "/");
} else if (src.begins_with("user://") && dst.begins_with("user://")) {
base = "user:/";
src = src.replace("user://", "/");
dst = dst.replace("user://", "/");
@ -4147,7 +4143,6 @@ String String::path_to(const String &p_path) const {
return p_path; //impossible to do this
}
base = src_begin;
src = src.substr(src_begin.length(), src.length());
dst = dst.substr(dst_begin.length(), dst.length());
}

View File

@ -184,7 +184,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) {
if (p_type_from == p_type_to) {
return true;
}
if (p_type_to == NIL && p_type_from != NIL) { //nil can convert to anything
if (p_type_to == NIL) { //nil can convert to anything
return true;
}
@ -490,7 +490,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type
if (p_type_from == p_type_to) {
return true;
}
if (p_type_to == NIL && p_type_from != NIL) { //nil can convert to anything
if (p_type_to == NIL) { //nil can convert to anything
return true;
}

View File

@ -1239,10 +1239,10 @@ void Variant::get_method_list(List<MethodInfo> *p_list) const {
void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_constants) {
ERR_FAIL_INDEX(p_type, Variant::VARIANT_MAX);
_VariantCall::ConstantData &cd = _VariantCall::constant_data[p_type];
const _VariantCall::ConstantData &cd = _VariantCall::constant_data[p_type];
#ifdef DEBUG_ENABLED
for (List<StringName>::Element *E = cd.value_ordered.front(); E; E = E->next()) {
for (const List<StringName>::Element *E = cd.value_ordered.front(); E; E = E->next()) {
p_constants->push_back(E->get());
#else
for (const KeyValue<StringName, int> &E : cd.value) {
@ -1251,7 +1251,7 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c
}
#ifdef DEBUG_ENABLED
for (List<StringName>::Element *E = cd.variant_value_ordered.front(); E; E = E->next()) {
for (const List<StringName>::Element *E = cd.variant_value_ordered.front(); E; E = E->next()) {
p_constants->push_back(E->get());
#else
for (const KeyValue<StringName, Variant> &E : cd.variant_value) {

View File

@ -344,7 +344,6 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
if (string_name) {
r_token.type = TK_STRING_NAME;
r_token.value = StringName(str);
string_name = false; //reset
} else {
r_token.type = TK_STRING;
r_token.value = str;

View File

@ -2013,7 +2013,7 @@
<constant name="KEY_CODE_MASK" value="33554431" enum="KeyModifierMask">
Key Code mask.
</constant>
<constant name="KEY_MODIFIER_MASK" value="-16777216" enum="KeyModifierMask">
<constant name="KEY_MODIFIER_MASK" value="2130706432" enum="KeyModifierMask">
Modifier key mask.
</constant>
<constant name="KEY_MASK_SHIFT" value="33554432" enum="KeyModifierMask">

View File

@ -823,24 +823,24 @@ void RasterizerCanvasGLES3::_render_batch(uint32_t &r_index) {
}
// TODO maybe dont use
void RasterizerCanvasGLES3::_end_batch(uint32_t &r_index) {
void RasterizerCanvasGLES3::_end_batch(uint32_t p_index) {
for (int i = 0; i < 4; i++) {
state.instance_data_array[r_index].modulation[i] = 0.0;
state.instance_data_array[r_index].ninepatch_margins[i] = 0.0;
state.instance_data_array[r_index].src_rect[i] = 0.0;
state.instance_data_array[r_index].dst_rect[i] = 0.0;
state.instance_data_array[p_index].modulation[i] = 0.0;
state.instance_data_array[p_index].ninepatch_margins[i] = 0.0;
state.instance_data_array[p_index].src_rect[i] = 0.0;
state.instance_data_array[p_index].dst_rect[i] = 0.0;
}
state.instance_data_array[r_index].flags = uint32_t(0);
state.instance_data_array[r_index].color_texture_pixel_size[0] = 0.0;
state.instance_data_array[r_index].color_texture_pixel_size[1] = 0.0;
state.instance_data_array[p_index].flags = uint32_t(0);
state.instance_data_array[p_index].color_texture_pixel_size[0] = 0.0;
state.instance_data_array[p_index].color_texture_pixel_size[1] = 0.0;
state.instance_data_array[r_index].pad[0] = 0.0;
state.instance_data_array[r_index].pad[1] = 0.0;
state.instance_data_array[p_index].pad[0] = 0.0;
state.instance_data_array[p_index].pad[1] = 0.0;
state.instance_data_array[r_index].lights[0] = uint32_t(0);
state.instance_data_array[r_index].lights[1] = uint32_t(0);
state.instance_data_array[r_index].lights[2] = uint32_t(0);
state.instance_data_array[r_index].lights[3] = uint32_t(0);
state.instance_data_array[p_index].lights[0] = uint32_t(0);
state.instance_data_array[p_index].lights[1] = uint32_t(0);
state.instance_data_array[p_index].lights[2] = uint32_t(0);
state.instance_data_array[p_index].lights[3] = uint32_t(0);
}
RID RasterizerCanvasGLES3::light_create() {
@ -1102,8 +1102,8 @@ RendererCanvasRender::PolygonID RasterizerCanvasGLES3::request_polygon(const Vec
{
glBindBuffer(GL_ARRAY_BUFFER, pb.vertex_buffer);
glBufferData(GL_ARRAY_BUFFER, stride * vertex_count * sizeof(float), nullptr, GL_STATIC_DRAW); // TODO may not be necessary
const uint8_t *r = polygon_buffer.ptr();
float *fptr = (float *)r;
uint8_t *r = polygon_buffer.ptrw();
float *fptr = reinterpret_cast<float *>(r);
uint32_t *uptr = (uint32_t *)r;
uint32_t base_offset = 0;
{

View File

@ -270,7 +270,7 @@ public:
void _render_items(RID p_to_render_target, int p_item_count, const Transform2D &p_canvas_transform_inverse, Light *p_lights, bool p_to_backbuffer = false);
void _render_item(RID p_render_target, const Item *p_item, const Transform2D &p_canvas_transform_inverse, Item *&current_clip, Light *p_lights, uint32_t &r_index);
void _render_batch(uint32_t &p_max_index);
void _end_batch(uint32_t &p_max_index);
void _end_batch(uint32_t p_index);
void _allocate_instance_data_buffer();
void initialize();

View File

@ -379,7 +379,7 @@ float AudioDriverPulseAudio::get_latency() {
}
void AudioDriverPulseAudio::thread_func(void *p_udata) {
AudioDriverPulseAudio *ad = (AudioDriverPulseAudio *)p_udata;
AudioDriverPulseAudio *ad = static_cast<AudioDriverPulseAudio *>(p_udata);
unsigned int write_ofs = 0;
size_t avail_bytes = 0;
uint64_t default_device_msec = OS::get_singleton()->get_ticks_msec();

View File

@ -6255,7 +6255,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma
//validate with inputs
for (uint32_t i = 0; i < 32; i++) {
if (!(shader->vertex_input_mask & (1 << i))) {
if (!(shader->vertex_input_mask & (1UL << i))) {
continue;
}
bool found = false;

View File

@ -586,20 +586,20 @@ public:
pi.name = "value";
p_list->push_back(pi);
} else {
PropertyHint hint = PROPERTY_HINT_NONE;
String hint_string;
PropertyHint val_hint = PROPERTY_HINT_NONE;
String val_hint_string;
if (v.get_type() == Variant::OBJECT) {
// Could actually check the object property if exists..? Yes I will!
Ref<Resource> res = v;
if (res.is_valid()) {
hint = PROPERTY_HINT_RESOURCE_TYPE;
hint_string = res->get_class();
val_hint = PROPERTY_HINT_RESOURCE_TYPE;
val_hint_string = res->get_class();
}
}
if (v.get_type() != Variant::NIL) {
p_list->push_back(PropertyInfo(v.get_type(), "value", hint, hint_string));
p_list->push_back(PropertyInfo(v.get_type(), "value", val_hint, val_hint_string));
}
}
@ -1264,20 +1264,20 @@ public:
pi.name = "value";
p_list->push_back(pi);
} else {
PropertyHint hint = PROPERTY_HINT_NONE;
String hint_string;
PropertyHint val_hint = PROPERTY_HINT_NONE;
String val_hint_string;
if (v.get_type() == Variant::OBJECT) {
// Could actually check the object property if exists..? Yes I will!
Ref<Resource> res = v;
if (res.is_valid()) {
hint = PROPERTY_HINT_RESOURCE_TYPE;
hint_string = res->get_class();
val_hint = PROPERTY_HINT_RESOURCE_TYPE;
val_hint_string = res->get_class();
}
}
if (v.get_type() != Variant::NIL) {
p_list->push_back(PropertyInfo(v.get_type(), "value", hint, hint_string));
p_list->push_back(PropertyInfo(v.get_type(), "value", val_hint, val_hint_string));
}
}
}
@ -1572,7 +1572,6 @@ void AnimationTimelineEdit::_notification(int p_what) {
Color color_time_dec = color;
color_time_dec.a *= 0.5;
#define SC_ADJ 100
int min = 30;
int dec = 1;
int step = 1;
int decimals = 2;
@ -1588,7 +1587,7 @@ void AnimationTimelineEdit::_notification(int p_what) {
const int max_sc_width = String::num(max_sc).length() * max_digit_width;
while (!step_found) {
min = max_sc_width;
int min = max_sc_width;
if (decimals > 0) {
min += period_width + max_digit_width * decimals;
}
@ -2552,7 +2551,7 @@ bool AnimationTrackEdit::_is_value_key_valid(const Variant &p_key_value, Variant
}
Ref<Texture2D> AnimationTrackEdit::_get_key_type_icon() const {
Ref<Texture2D> type_icons[9] = {
const Ref<Texture2D> type_icons[9] = {
get_theme_icon(SNAME("KeyValue"), SNAME("EditorIcons")),
get_theme_icon(SNAME("KeyTrackPosition"), SNAME("EditorIcons")),
get_theme_icon(SNAME("KeyTrackRotation"), SNAME("EditorIcons")),

View File

@ -101,7 +101,7 @@ void AudioStreamPreviewGenerator::_update_emit(ObjectID p_id) {
}
void AudioStreamPreviewGenerator::_preview_thread(void *p_preview) {
Preview *preview = (Preview *)p_preview;
Preview *preview = static_cast<Preview *>(p_preview);
float muxbuff_chunk_s = 0.25;

View File

@ -128,7 +128,7 @@ void ExportTemplateManager::_download_current() {
}
_download_template(mirror_url, true);
} else if (!mirrors_available && !is_refreshing_mirrors) {
} else if (!is_refreshing_mirrors) {
_set_current_progress_status(TTR("Retrieving the mirror list..."));
_refresh_mirrors();
}

View File

@ -58,7 +58,7 @@ Transform3D Collada::get_root_transform() const {
return unit_scale_transform;
}
void Collada::Vertex::fix_unit_scale(Collada &state) {
void Collada::Vertex::fix_unit_scale(const Collada &state) {
#ifdef COLLADA_IMPORT_SCALE_SCENE
vertex *= state.state.unit_scale;
#endif

View File

@ -266,7 +266,7 @@ public:
}
}
void fix_unit_scale(Collada &state);
void fix_unit_scale(const Collada &state);
bool operator<(const Vertex &p_vert) const {
if (uid == p_vert.uid) {

View File

@ -530,25 +530,25 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co
state_machine_draw->draw_set_transform_matrix(Transform2D());
}
void AnimationNodeStateMachineEditor::_clip_src_line_to_rect(Vector2 &r_from, Vector2 &r_to, const Rect2 &p_rect) {
if (r_to == r_from) {
void AnimationNodeStateMachineEditor::_clip_src_line_to_rect(Vector2 &r_from, const Vector2 &p_to, const Rect2 &p_rect) {
if (p_to == r_from) {
return;
}
//this could be optimized...
Vector2 n = (r_to - r_from).normalized();
Vector2 n = (p_to - r_from).normalized();
while (p_rect.has_point(r_from)) {
r_from += n;
}
}
void AnimationNodeStateMachineEditor::_clip_dst_line_to_rect(Vector2 &r_from, Vector2 &r_to, const Rect2 &p_rect) {
if (r_to == r_from) {
void AnimationNodeStateMachineEditor::_clip_dst_line_to_rect(const Vector2 &p_from, Vector2 &r_to, const Rect2 &p_rect) {
if (r_to == p_from) {
return;
}
//this could be optimized...
Vector2 n = (r_to - r_from).normalized();
Vector2 n = (r_to - p_from).normalized();
while (p_rect.has_point(r_to)) {
r_to -= n;
}

View File

@ -147,8 +147,8 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
void _open_editor(const String &p_name);
void _scroll_changed(double);
void _clip_src_line_to_rect(Vector2 &r_from, Vector2 &r_to, const Rect2 &p_rect);
void _clip_dst_line_to_rect(Vector2 &r_from, Vector2 &r_to, const Rect2 &p_rect);
void _clip_src_line_to_rect(Vector2 &r_from, const Vector2 &p_to, const Rect2 &p_rect);
void _clip_dst_line_to_rect(const Vector2 &p_from, Vector2 &r_to, const Rect2 &p_rect);
void _erase_selected();
void _update_mode();

View File

@ -3372,7 +3372,7 @@ void CanvasItemEditor::_draw_selection() {
// Draw the resize handles
if (tool == TOOL_SELECT && canvas_item->_edit_use_rect() && _is_node_movable(canvas_item)) {
Rect2 rect = canvas_item->_edit_get_rect();
Vector2 endpoints[4] = {
const Vector2 endpoints[4] = {
xform.xform(rect.position),
xform.xform(rect.position + Vector2(rect.size.x, 0)),
xform.xform(rect.position + rect.size),
@ -4575,7 +4575,7 @@ void CanvasItemEditor::_focus_selection(int p_op) {
Rect2 rect;
int count = 0;
Map<Node *, Object *> &selection = editor_selection->get_selection();
const Map<Node *, Object *> &selection = editor_selection->get_selection();
for (const KeyValue<Node *, Object *> &E : selection) {
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key);
if (!canvas_item) {

View File

@ -290,7 +290,7 @@ void GPUParticles2DEditorPlugin::_generate_emission_mask() {
{
uint8_t *tw = texdata.ptrw();
float *twf = (float *)tw;
float *twf = reinterpret_cast<float *>(tw);
for (int i = 0; i < vpc; i++) {
twf[i * 2 + 0] = valid_positions[i].x;
twf[i * 2 + 1] = valid_positions[i].y;
@ -334,7 +334,7 @@ void GPUParticles2DEditorPlugin::_generate_emission_mask() {
{
uint8_t *tw = normdata.ptrw();
float *twf = (float *)tw;
float *twf = reinterpret_cast<float *>(tw);
for (int i = 0; i < vpc; i++) {
twf[i * 2 + 0] = valid_normals[i].x;
twf[i * 2 + 1] = valid_normals[i].y;

View File

@ -354,7 +354,7 @@ void GPUParticles3DEditor::_generate_emission_points() {
uint8_t *iw = point_img.ptrw();
memset(iw, 0, w * h * 3 * sizeof(float));
const Vector3 *r = points.ptr();
float *wf = (float *)iw;
float *wf = reinterpret_cast<float *>(iw);
for (int i = 0; i < point_count; i++) {
wf[i * 3 + 0] = r[i].x;
wf[i * 3 + 1] = r[i].y;
@ -383,7 +383,7 @@ void GPUParticles3DEditor::_generate_emission_points() {
uint8_t *iw = point_img2.ptrw();
memset(iw, 0, w * h * 3 * sizeof(float));
const Vector3 *r = normals.ptr();
float *wf = (float *)iw;
float *wf = reinterpret_cast<float *>(iw);
for (int i = 0; i < point_count; i++) {
wf[i * 3 + 0] = r[i].x;
wf[i * 3 + 1] = r[i].y;

View File

@ -55,7 +55,7 @@ protected:
Vector<Face3> geometry;
bool _generate(Vector<Vector3> &points, Vector<Vector3> &normals);
virtual void _generate_emission_points() = 0;
virtual void _generate_emission_points(){};
void _node_selected(const NodePath &p_path);
static void _bind_methods();

View File

@ -2087,9 +2087,8 @@ void Node3DEditorViewport::_nav_pan(Ref<InputEventWithModifiers> p_event, const
const NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
real_t pan_speed = 1 / 150.0;
int pan_speed_modifier = 10;
if (nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) {
pan_speed *= pan_speed_modifier;
pan_speed *= 10;
}
Transform3D camera_transform;
@ -2112,9 +2111,8 @@ void Node3DEditorViewport::_nav_zoom(Ref<InputEventWithModifiers> p_event, const
const NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
real_t zoom_speed = 1 / 80.0;
int zoom_speed_modifier = 10;
if (nav_scheme == NAVIGATION_MAYA && p_event->is_shift_pressed()) {
zoom_speed *= zoom_speed_modifier;
zoom_speed *= 10;
}
NavigationZoomStyle zoom_style = (NavigationZoomStyle)EditorSettings::get_singleton()->get("editors/3d/navigation/zoom_style").operator int();
@ -2818,7 +2816,7 @@ void Node3DEditorViewport::_draw() {
real_t scale_length = (max_speed - min_speed);
if (!Math::is_zero_approx(scale_length)) {
real_t logscale_t = 1.0 - Math::log(1 + freelook_speed - min_speed) / Math::log(1 + scale_length);
real_t logscale_t = 1.0 - Math::log1p(freelook_speed - min_speed) / Math::log1p(scale_length);
// Display the freelook speed to help the user get a better sense of scale.
const int precision = freelook_speed < 1.0 ? 2 : 1;
@ -2841,7 +2839,7 @@ void Node3DEditorViewport::_draw() {
real_t scale_length = (max_distance - min_distance);
if (!Math::is_zero_approx(scale_length)) {
real_t logscale_t = 1.0 - Math::log(1 + cursor.distance - min_distance) / Math::log(1 + scale_length);
real_t logscale_t = 1.0 - Math::log1p(cursor.distance - min_distance) / Math::log1p(scale_length);
// Display the zoom center distance to help the user get a better sense of scale.
const int precision = cursor.distance < 1.0 ? 2 : 1;
@ -3644,7 +3642,7 @@ void Node3DEditorViewport::focus_selection() {
Vector3 center;
int count = 0;
List<Node *> &selection = editor_selection->get_selected_node_list();
const List<Node *> &selection = editor_selection->get_selected_node_list();
for (Node *E : selection) {
Node3D *sp = Object::cast_to<Node3D>(E);
@ -5515,7 +5513,7 @@ void Node3DEditor::_xform_dialog_action() {
undo_redo->create_action(TTR("XForm Dialog"));
List<Node *> &selection = editor_selection->get_selected_node_list();
const List<Node *> &selection = editor_selection->get_selected_node_list();
for (Node *E : selection) {
Node3D *sp = Object::cast_to<Node3D>(E);
@ -6720,7 +6718,7 @@ Set<RID> _get_physics_bodies_rid(Node *node) {
}
void Node3DEditor::snap_selected_nodes_to_floor() {
List<Node *> &selection = editor_selection->get_selected_node_list();
const List<Node *> &selection = editor_selection->get_selected_node_list();
Dictionary snap_data;
for (Node *E : selection) {

View File

@ -320,14 +320,14 @@ EditorPlugin::AfterGUIInput Path3DEditorPlugin::forward_spatial_gui_input(Camera
if (mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->is_ctrl_pressed()))) {
//click into curve, break it down
Vector<Vector3> v3a = c->tessellate();
int idx = 0;
int rc = v3a.size();
int closest_seg = -1;
Vector3 closest_seg_point;
float closest_d = 1e20;
if (rc >= 2) {
int idx = 0;
const Vector3 *r = v3a.ptr();
float closest_d = 1e20;
if (p_camera->unproject_position(gt.xform(c->get_point_position(0))).distance_to(mbpos) < click_dist) {
return EditorPlugin::AFTER_GUI_INPUT_PASS; //nope, existing

View File

@ -1209,8 +1209,7 @@ void Skeleton3DGizmoPlugin::set_subgizmo_transform(const EditorNode3DGizmo *p_gi
t.basis = to_local * p_transform.get_basis();
// Origin.
Vector3 orig = Vector3();
orig = skeleton->get_bone_pose(p_id).origin;
Vector3 orig = skeleton->get_bone_pose(p_id).origin;
Vector3 sub = p_transform.origin - skeleton->get_bone_global_pose(p_id).origin;
t.origin = orig + to_local.xform(sub);

View File

@ -145,7 +145,7 @@ void TextureRegionEditor::_region_draw() {
}
} else if (snap_mode == SNAP_AUTOSLICE) {
for (const Rect2 &r : autoslice_cache) {
Vector2 endpoints[4] = {
const Vector2 endpoints[4] = {
mtx.basis_xform(r.position),
mtx.basis_xform(r.position + Vector2(r.size.x, 0)),
mtx.basis_xform(r.position + r.size),

View File

@ -350,7 +350,7 @@ void TileAtlasView::_draw_alternatives() {
bool transposed = tile_data->get_transpose();
// Update the y to max value.
Vector2i offset_pos = current_pos;
Vector2i offset_pos;
if (transposed) {
offset_pos = (current_pos + Vector2(texture_region_size.y, texture_region_size.x) / 2 + tile_set_atlas_source->get_tile_effective_texture_offset(atlas_coords, alternative_id));
y_increment = MAX(y_increment, texture_region_size.x);

View File

@ -2057,7 +2057,7 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t
}
drag_last_pos = mb->get_position();
}
} else if (tile_data && tile_data->get_terrain_set() == terrain_set) {
} else if (tile_data->get_terrain_set() == terrain_set) {
if (mb->is_ctrl_pressed()) {
// Paint terrain set with rect.
drag_type = DRAG_TYPE_PAINT_TERRAIN_BITS_RECT;
@ -2387,7 +2387,7 @@ void TileDataTerrainsEditor::forward_painting_alternatives_gui_input(TileAtlasVi
tile_data->set_terrain_set(drag_painted_value);
}
drag_last_pos = mb->get_position();
} else if (tile_data && tile_data->get_terrain_set() == terrain_set) {
} else if (tile_data->get_terrain_set() == terrain_set) {
// Paint terrain bits.
drag_type = DRAG_TYPE_PAINT_TERRAIN_BITS;
drag_modified.clear();

View File

@ -1695,8 +1695,8 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
Size2 zoomed_size = resize_handle->get_size() / tile_atlas_view->get_zoom();
Rect2 region = tile_set_atlas_source->get_tile_texture_region(selected.tile);
Rect2 rect = region.grow_individual(zoomed_size.x, zoomed_size.y, 0, 0);
Vector2i coords[] = { Vector2i(0, 0), Vector2i(1, 0), Vector2i(1, 1), Vector2i(0, 1) };
Vector2i directions[] = { Vector2i(0, -1), Vector2i(1, 0), Vector2i(0, 1), Vector2i(-1, 0) };
const Vector2i coords[] = { Vector2i(0, 0), Vector2i(1, 0), Vector2i(1, 1), Vector2i(0, 1) };
const Vector2i directions[] = { Vector2i(0, -1), Vector2i(1, 0), Vector2i(0, 1), Vector2i(-1, 0) };
bool can_grow[4];
for (int i = 0; i < 4; i++) {
can_grow[i] = tile_set_atlas_source->has_room_for_tile(selected.tile + directions[i], tile_set_atlas_source->get_tile_size_in_atlas(selected.tile), tile_set_atlas_source->get_tile_animation_columns(selected.tile), tile_set_atlas_source->get_tile_animation_separation(selected.tile), tile_set_atlas_source->get_tile_animation_frames_count(selected.tile), selected.tile);

View File

@ -394,13 +394,12 @@ void TileSetScenesCollectionSourceEditor::_drop_data_fw(const Point2 &p_point, c
if (p_from == scene_tiles_list) {
// Handle dropping a texture in the list of atlas resources.
int scene_id = -1;
Dictionary d = p_data;
Vector<String> files = d["files"];
for (int i = 0; i < files.size(); i++) {
Ref<PackedScene> resource = ResourceLoader::load(files[i]);
if (resource.is_valid()) {
scene_id = tile_set_scenes_collection_source->get_next_scene_tile_id();
int scene_id = tile_set_scenes_collection_source->get_next_scene_tile_id();
undo_redo->create_action(TTR("Add a Scene Tile"));
undo_redo->add_do_method(tile_set_scenes_collection_source, "create_scene_tile", resource, scene_id);
undo_redo->add_undo_method(tile_set_scenes_collection_source, "remove_scene_tile", scene_id);

View File

@ -119,7 +119,7 @@ void VisualShaderGraphPlugin::register_shader(VisualShader *p_shader) {
visual_shader = Ref<VisualShader>(p_shader);
}
void VisualShaderGraphPlugin::set_connections(List<VisualShader::Connection> &p_connections) {
void VisualShaderGraphPlugin::set_connections(const List<VisualShader::Connection> &p_connections) {
connections = p_connections;
}
@ -2765,9 +2765,9 @@ void VisualShaderEditor::_add_node(int p_idx, const Vector<Variant> &p_ops, Stri
}
if (vsnode->get_output_port_count() > 0 || created_expression_port) {
int _from_node = id_to_use;
int _from_slot = 0;
if (created_expression_port) {
int _from_slot = 0;
undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, _from_node, _from_slot, to_node, to_slot);
undo_redo->add_undo_method(visual_shader.ptr(), "disconnect_nodes", type, _from_node, _from_slot, to_node, to_slot);
undo_redo->add_do_method(graph_plugin.ptr(), "connect_nodes", type, _from_node, _from_slot, to_node, to_slot);
@ -2805,9 +2805,9 @@ void VisualShaderEditor::_add_node(int p_idx, const Vector<Variant> &p_ops, Stri
if (vsnode->get_input_port_count() > 0 || created_expression_port) {
int _to_node = id_to_use;
int _to_slot = 0;
if (created_expression_port) {
int _to_slot = 0;
undo_redo->add_undo_method(visual_shader.ptr(), "disconnect_nodes", type, from_node, from_slot, _to_node, _to_slot);
undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, from_node, from_slot, _to_node, _to_slot);
undo_redo->add_undo_method(graph_plugin.ptr(), "disconnect_nodes", type, from_node, from_slot, _to_node, _to_slot);

View File

@ -92,7 +92,7 @@ protected:
public:
void register_shader(VisualShader *p_visual_shader);
void set_connections(List<VisualShader::Connection> &p_connections);
void set_connections(const List<VisualShader::Connection> &p_connections);
void register_link(VisualShader::Type p_type, int p_id, VisualShaderNode *p_visual_node, GraphNode *p_graph_node);
void register_output_port(int p_id, int p_port, TextureButton *p_button);
void register_uniform_name(int p_id, LineEdit *p_uniform_name);

View File

@ -575,16 +575,16 @@ private:
unzClose(pkg);
if (failed_files.size()) {
String msg = TTR("The following files failed extraction from package:") + "\n\n";
String err_msg = TTR("The following files failed extraction from package:") + "\n\n";
for (int i = 0; i < failed_files.size(); i++) {
if (i > 15) {
msg += "\nAnd " + itos(failed_files.size() - i) + " more files.";
err_msg += "\nAnd " + itos(failed_files.size() - i) + " more files.";
break;
}
msg += failed_files[i] + "\n";
err_msg += failed_files[i] + "\n";
}
dialog_error->set_text(msg);
dialog_error->set_text(err_msg);
dialog_error->popup_centered();
} else if (!project_path->get_text().ends_with(".zip")) {

View File

@ -2999,7 +2999,7 @@ void SceneTreeDock::attach_shader_to_selected(int p_preferred_mode) {
shader_create_dialog->popup_centered();
}
void SceneTreeDock::open_shader_dialog(Ref<ShaderMaterial> &p_for_material, int p_preferred_mode) {
void SceneTreeDock::open_shader_dialog(const Ref<ShaderMaterial> &p_for_material, int p_preferred_mode) {
selected_shader_material = p_for_material;
attach_shader_to_selected(p_preferred_mode);
}

View File

@ -309,7 +309,7 @@ public:
void open_script_dialog(Node *p_for_node, bool p_extend);
void attach_shader_to_selected(int p_preferred_mode = -1);
void open_shader_dialog(Ref<ShaderMaterial> &p_for_material, int p_preferred_mode = -1);
void open_shader_dialog(const Ref<ShaderMaterial> &p_for_material, int p_preferred_mode = -1);
void open_add_child_dialog();
void open_instance_child_dialog();

View File

@ -40,43 +40,43 @@
/// an instance of that struct with the submitted parameters.
/// Then, that struct is stored in an array; the `sync` function consume that array.
#define COMMAND_1(F_NAME, T_0, D_0) \
struct MERGE(F_NAME, _command) : public SetCommand { \
T_0 d_0; \
MERGE(F_NAME, _command) \
(T_0 p_d_0) : \
d_0(p_d_0) {} \
virtual void exec(GodotNavigationServer *server) { \
server->MERGE(_cmd_, F_NAME)(d_0); \
} \
}; \
void GodotNavigationServer::F_NAME(T_0 D_0) const { \
auto cmd = memnew(MERGE(F_NAME, _command)( \
D_0)); \
add_command(cmd); \
} \
#define COMMAND_1(F_NAME, T_0, D_0) \
struct MERGE(F_NAME, _command) : public SetCommand { \
T_0 d_0; \
MERGE(F_NAME, _command) \
(T_0 p_d_0) : \
d_0(p_d_0) {} \
virtual void exec(GodotNavigationServer *server) override { \
server->MERGE(_cmd_, F_NAME)(d_0); \
} \
}; \
void GodotNavigationServer::F_NAME(T_0 D_0) const { \
auto cmd = memnew(MERGE(F_NAME, _command)( \
D_0)); \
add_command(cmd); \
} \
void GodotNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0)
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
struct MERGE(F_NAME, _command) : public SetCommand { \
T_0 d_0; \
T_1 d_1; \
MERGE(F_NAME, _command) \
( \
T_0 p_d_0, \
T_1 p_d_1) : \
d_0(p_d_0), \
d_1(p_d_1) {} \
virtual void exec(GodotNavigationServer *server) { \
server->MERGE(_cmd_, F_NAME)(d_0, d_1); \
} \
}; \
void GodotNavigationServer::F_NAME(T_0 D_0, T_1 D_1) const { \
auto cmd = memnew(MERGE(F_NAME, _command)( \
D_0, \
D_1)); \
add_command(cmd); \
} \
#define COMMAND_2(F_NAME, T_0, D_0, T_1, D_1) \
struct MERGE(F_NAME, _command) : public SetCommand { \
T_0 d_0; \
T_1 d_1; \
MERGE(F_NAME, _command) \
( \
T_0 p_d_0, \
T_1 p_d_1) : \
d_0(p_d_0), \
d_1(p_d_1) {} \
virtual void exec(GodotNavigationServer *server) override { \
server->MERGE(_cmd_, F_NAME)(d_0, d_1); \
} \
}; \
void GodotNavigationServer::F_NAME(T_0 D_0, T_1 D_1) const { \
auto cmd = memnew(MERGE(F_NAME, _command)( \
D_0, \
D_1)); \
add_command(cmd); \
} \
void GodotNavigationServer::MERGE(_cmd_, F_NAME)(T_0 D_0, T_1 D_1)
#define COMMAND_4(F_NAME, T_0, D_0, T_1, D_1, T_2, D_2, T_3, D_3) \
@ -95,7 +95,7 @@
d_1(p_d_1), \
d_2(p_d_2), \
d_3(p_d_3) {} \
virtual void exec(GodotNavigationServer *server) { \
virtual void exec(GodotNavigationServer *server) override { \
server->MERGE(_cmd_, F_NAME)(d_0, d_1, d_2, d_3); \
} \
}; \

View File

@ -59,7 +59,7 @@ void _emwebxr_on_session_started(char *p_reference_space_type) {
ERR_FAIL_COND(interface.is_null());
String reference_space_type = String(p_reference_space_type);
((WebXRInterfaceJS *)interface.ptr())->_set_reference_space_type(reference_space_type);
static_cast<WebXRInterfaceJS *>(interface.ptr())->_set_reference_space_type(reference_space_type);
interface->emit_signal(SNAME("session_started"));
}
@ -94,7 +94,7 @@ void _emwebxr_on_controller_changed() {
Ref<XRInterface> interface = xr_server->find_interface("WebXR");
ERR_FAIL_COND(interface.is_null());
((WebXRInterfaceJS *)interface.ptr())->_on_controller_changed();
static_cast<WebXRInterfaceJS *>(interface.ptr())->_on_controller_changed();
}
extern "C" EMSCRIPTEN_KEEPALIVE void _emwebxr_on_input_event(char *p_signal_name, int p_input_source) {

View File

@ -139,7 +139,7 @@ void OS_Android::finalize() {
}
OS_Android *OS_Android::get_singleton() {
return (OS_Android *)OS::get_singleton();
return static_cast<OS_Android *>(OS::get_singleton());
}
GodotJavaWrapper *OS_Android::get_godot_java() {

View File

@ -207,7 +207,7 @@ int JavaScriptObjectImpl::_variant2js(const void **p_args, int p_pos, godot_js_w
break;
case Variant::INT: {
const int64_t tmp = v->operator int64_t();
if (tmp >= 1 << 31) {
if (tmp >= 1LL << 31) {
r_val->r = (double)tmp;
return Variant::FLOAT;
}

View File

@ -2143,7 +2143,7 @@ bool DisplayServerX11::window_get_flag(WindowFlags p_flag, WindowID p_window) co
unsigned char *data = nullptr;
if (XGetWindowProperty(x11_display, wd.x11_window, prop, 0, sizeof(Hints), False, AnyPropertyType, &type, &format, &len, &remaining, &data) == Success) {
if (data && (format == 32) && (len >= 5)) {
borderless = !((Hints *)data)->decorations;
borderless = !(reinterpret_cast<Hints *>(data)->decorations);
}
if (data) {
XFree(data);
@ -2175,7 +2175,7 @@ void DisplayServerX11::window_request_attention(WindowID p_window) {
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
const WindowData &wd = windows[p_window];
// Using EWMH -- Extended Window Manager Hints
//
// Sets the _NET_WM_STATE_DEMANDS_ATTENTION atom for WM_STATE
@ -2201,7 +2201,7 @@ void DisplayServerX11::window_move_to_foreground(WindowID p_window) {
_THREAD_SAFE_METHOD_
ERR_FAIL_COND(!windows.has(p_window));
WindowData &wd = windows[p_window];
const WindowData &wd = windows[p_window];
XEvent xev;
Atom net_active_window = XInternAtom(x11_display, "_NET_ACTIVE_WINDOW", False);
@ -2547,10 +2547,9 @@ DisplayServerX11::Property DisplayServerX11::_read_property(Display *p_display,
unsigned long bytes_after = 0;
unsigned char *ret = nullptr;
int read_bytes = 1024;
// Keep trying to read the property until there are no bytes unread.
if (p_property != None) {
int read_bytes = 1024;
do {
if (ret != nullptr) {
XFree(ret);
@ -2570,7 +2569,7 @@ DisplayServerX11::Property DisplayServerX11::_read_property(Display *p_display,
return p;
}
static Atom pick_target_from_list(Display *p_display, Atom *p_list, int p_count) {
static Atom pick_target_from_list(Display *p_display, const Atom *p_list, int p_count) {
static const char *target_type = "text/uri-list";
for (int i = 0; i < p_count; i++) {

View File

@ -2512,10 +2512,10 @@ void TileMap::_set_tile_data(int p_layer, const Vector<int> &p_data) {
uint32_t v = decode_uint32(&local[4]);
// Extract the transform flags that used to be in the tilemap.
bool flip_h = v & (1 << 29);
bool flip_v = v & (1 << 30);
bool transpose = v & (1 << 31);
v &= (1 << 29) - 1;
bool flip_h = v & (1UL << 29);
bool flip_v = v & (1UL << 30);
bool transpose = v & (1UL << 31);
v &= (1UL << 29) - 1;
// Extract autotile/atlas coords.
int16_t coord_x = 0;

View File

@ -563,7 +563,7 @@ void Sprite3D::_draw() {
value |= CLAMP(int((t.normal.y * 0.5 + 0.5) * 1023.0), 0, 1023) << 10;
value |= CLAMP(int((t.normal.z * 0.5 + 0.5) * 1023.0), 0, 1023) << 20;
if (t.d > 0) {
value |= 3 << 30;
value |= 3UL << 30;
}
v_tangent = value;
}
@ -926,7 +926,7 @@ void AnimatedSprite3D::_draw() {
value |= CLAMP(int((t.normal.y * 0.5 + 0.5) * 1023.0), 0, 1023) << 10;
value |= CLAMP(int((t.normal.z * 0.5 + 0.5) * 1023.0), 0, 1023) << 20;
if (t.d > 0) {
value |= 3 << 30;
value |= 3UL << 30;
}
v_tangent = value;
}

View File

@ -777,8 +777,8 @@ Vector<int> Voxelizer::get_voxel_gi_level_cell_count() const {
/* dt of 1d function using squared distance */
static void edt(float *f, int stride, int n) {
float *d = (float *)alloca(sizeof(float) * n + sizeof(int) * n + sizeof(float) * (n + 1));
int *v = (int *)&(d[n]);
float *z = (float *)&v[n];
int *v = reinterpret_cast<int *>(&(d[n]));
float *z = reinterpret_cast<float *>(&v[n]);
int k = 0;
v[0] = 0;

View File

@ -211,7 +211,7 @@ void ImmediateMesh::surface_end() {
value |= CLAMP(int((t.normal.y * 0.5 + 0.5) * 1023.0), 0, 1023) << 10;
value |= CLAMP(int((t.normal.z * 0.5 + 0.5) * 1023.0), 0, 1023) << 20;
if (t.d > 0) {
value |= 3 << 30;
value |= 3UL << 30;
}
*tangent = value;

View File

@ -1033,9 +1033,9 @@ void GodotSpace2D::_broadphase_unpair(GodotCollisionObject2D *A, int p_subindex_
return;
}
GodotSpace2D *self = (GodotSpace2D *)p_self;
GodotSpace2D *self = static_cast<GodotSpace2D *>(p_self);
self->collision_pairs--;
GodotConstraint2D *c = (GodotConstraint2D *)p_data;
GodotConstraint2D *c = static_cast<GodotConstraint2D *>(p_data);
memdelete(c);
}

View File

@ -210,7 +210,7 @@ void RenderForwardClustered::RenderBufferDataForwardClustered::configure(RID p_c
tf.array_layers = view_count; // create a layer for every view
tf.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_CAN_COPY_FROM_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT;
RD::TextureSamples ts[RS::VIEWPORT_MSAA_MAX] = {
const RD::TextureSamples ts[RS::VIEWPORT_MSAA_MAX] = {
RD::TEXTURE_SAMPLES_1,
RD::TEXTURE_SAMPLES_2,
RD::TEXTURE_SAMPLES_4,

View File

@ -218,7 +218,7 @@ class RenderForwardClustered : public RendererSceneRenderRD {
INSTANCE_DATA_FLAGS_PARTICLE_TRAIL_SHIFT = 16,
INSTANCE_DATA_FLAGS_PARTICLE_TRAIL_MASK = 0xFF,
INSTANCE_DATA_FLAGS_FADE_SHIFT = 24,
INSTANCE_DATA_FLAGS_FADE_MASK = 0xFF << INSTANCE_DATA_FLAGS_FADE_SHIFT
INSTANCE_DATA_FLAGS_FADE_MASK = 0xFFUL << INSTANCE_DATA_FLAGS_FADE_SHIFT
};
struct SceneState {

View File

@ -158,7 +158,7 @@ void RenderForwardMobile::RenderBufferDataForwardMobile::configure(RID p_color_b
tf.array_layers = view_count; // create a layer for every view
tf.usage_bits = RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT | RD::TEXTURE_USAGE_CAN_COPY_FROM_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT;
RD::TextureSamples ts[RS::VIEWPORT_MSAA_MAX] = {
const RD::TextureSamples ts[RS::VIEWPORT_MSAA_MAX] = {
RD::TEXTURE_SAMPLES_1,
RD::TEXTURE_SAMPLES_2,
RD::TEXTURE_SAMPLES_4,

View File

@ -132,9 +132,9 @@ RendererCanvasRender::PolygonID RendererCanvasRenderRD::request_polygon(const Ve
buffers.resize(5);
{
const uint8_t *r = polygon_buffer.ptr();
float *fptr = (float *)r;
uint32_t *uptr = (uint32_t *)r;
uint8_t *r = polygon_buffer.ptrw();
float *fptr = reinterpret_cast<float *>(r);
uint32_t *uptr = reinterpret_cast<uint32_t *>(r);
uint32_t base_offset = 0;
{ //vertices
RD::VertexAttribute vd;
@ -1843,7 +1843,7 @@ void RendererCanvasRenderRD::occluder_polygon_set_shape(RID p_occluder, const Ve
{
uint8_t *vw = geometry.ptrw();
float *vwptr = (float *)vw;
float *vwptr = reinterpret_cast<float *>(vw);
uint8_t *iw = indices.ptrw();
uint16_t *iwptr = (uint16_t *)iw;

View File

@ -879,7 +879,7 @@ void RendererSceneGIRD::SDFGI::update_light() {
push_constant.process_offset = 0;
push_constant.process_increment = 1;
} else {
static uint32_t frames_to_update_table[RS::ENV_SDFGI_UPDATE_LIGHT_MAX] = {
static const uint32_t frames_to_update_table[RS::ENV_SDFGI_UPDATE_LIGHT_MAX] = {
1, 2, 4, 8, 16
};

View File

@ -339,7 +339,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
}
} break;
case ShaderLanguage::TYPE_FLOAT: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
const PackedFloat32Array &a = value;
@ -361,7 +361,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
}
} break;
case ShaderLanguage::TYPE_VEC2: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
const PackedVector2Array &a = value;
@ -385,7 +385,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
}
} break;
case ShaderLanguage::TYPE_VEC3: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
const PackedVector3Array &a = value;
@ -411,7 +411,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
}
} break;
case ShaderLanguage::TYPE_VEC4: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
if (value.get_type() == Variant::PACKED_COLOR_ARRAY) {
@ -491,7 +491,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
}
} break;
case ShaderLanguage::TYPE_MAT2: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
const PackedFloat32Array &a = value;
@ -532,7 +532,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
}
} break;
case ShaderLanguage::TYPE_MAT3: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
const PackedFloat32Array &a = value;
@ -587,7 +587,7 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
}
} break;
case ShaderLanguage::TYPE_MAT4: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
const PackedFloat32Array &a = value;
@ -748,12 +748,12 @@ _FORCE_INLINE_ static void _fill_std140_ubo_value(ShaderLanguage::DataType type,
}
} break;
case ShaderLanguage::TYPE_FLOAT: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
gui[0] = value[0].real;
} break;
case ShaderLanguage::TYPE_VEC2: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
for (int i = 0; i < 2; i++) {
gui[i] = value[i].real;
@ -761,7 +761,7 @@ _FORCE_INLINE_ static void _fill_std140_ubo_value(ShaderLanguage::DataType type,
} break;
case ShaderLanguage::TYPE_VEC3: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
for (int i = 0; i < 3; i++) {
gui[i] = value[i].real;
@ -769,14 +769,14 @@ _FORCE_INLINE_ static void _fill_std140_ubo_value(ShaderLanguage::DataType type,
} break;
case ShaderLanguage::TYPE_VEC4: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
for (int i = 0; i < 4; i++) {
gui[i] = value[i].real;
}
} break;
case ShaderLanguage::TYPE_MAT2: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
//in std140 members of mat2 are treated as vec4s
gui[0] = value[0].real;
@ -789,7 +789,7 @@ _FORCE_INLINE_ static void _fill_std140_ubo_value(ShaderLanguage::DataType type,
gui[7] = 0;
} break;
case ShaderLanguage::TYPE_MAT3: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
gui[0] = value[0].real;
gui[1] = value[1].real;
@ -805,7 +805,7 @@ _FORCE_INLINE_ static void _fill_std140_ubo_value(ShaderLanguage::DataType type,
gui[11] = 0;
} break;
case ShaderLanguage::TYPE_MAT4: {
float *gui = (float *)data;
float *gui = reinterpret_cast<float *>(data);
for (int i = 0; i < 16; i++) {
gui[i] = value[i].real;
@ -1885,7 +1885,7 @@ void MaterialStorage::global_variable_remove(const StringName &p_name) {
if (!global_variables.variables.has(p_name)) {
return;
}
GlobalVariables::Variable &gv = global_variables.variables[p_name];
const GlobalVariables::Variable &gv = global_variables.variables[p_name];
if (gv.buffer_index >= 0) {
global_variables.buffer_usage[gv.buffer_index].elements = 0;
@ -2110,7 +2110,7 @@ void MaterialStorage::global_variables_instance_update(RID p_instance, int p_ind
ERR_FAIL_INDEX(p_index, ShaderLanguage::MAX_INSTANCE_UNIFORM_INDICES);
ERR_FAIL_COND_MSG(p_value.get_type() > Variant::COLOR, "Unsupported variant type for instance parameter: " + Variant::get_type_name(p_value.get_type())); //anything greater not supported
ShaderLanguage::DataType datatype_from_value[Variant::COLOR + 1] = {
const ShaderLanguage::DataType datatype_from_value[Variant::COLOR + 1] = {
ShaderLanguage::TYPE_MAX, //nil
ShaderLanguage::TYPE_BOOL, //bool
ShaderLanguage::TYPE_INT, //int

View File

@ -50,7 +50,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(float) * 3);
{
uint8_t *w = buffer.ptrw();
float *fptr = (float *)w;
float *fptr = reinterpret_cast<float *>(w);
fptr[0] = 0.0;
fptr[1] = 0.0;
fptr[2] = 0.0;
@ -62,7 +62,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(float) * 3);
{
uint8_t *w = buffer.ptrw();
float *fptr = (float *)w;
float *fptr = reinterpret_cast<float *>(w);
fptr[0] = 1.0;
fptr[1] = 0.0;
fptr[2] = 0.0;
@ -74,7 +74,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(float) * 4);
{
uint8_t *w = buffer.ptrw();
float *fptr = (float *)w;
float *fptr = reinterpret_cast<float *>(w);
fptr[0] = 1.0;
fptr[1] = 0.0;
fptr[2] = 0.0;
@ -87,7 +87,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(float) * 4);
{
uint8_t *w = buffer.ptrw();
float *fptr = (float *)w;
float *fptr = reinterpret_cast<float *>(w);
fptr[0] = 1.0;
fptr[1] = 1.0;
fptr[2] = 1.0;
@ -100,7 +100,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(float) * 2);
{
uint8_t *w = buffer.ptrw();
float *fptr = (float *)w;
float *fptr = reinterpret_cast<float *>(w);
fptr[0] = 0.0;
fptr[1] = 0.0;
}
@ -110,7 +110,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(float) * 2);
{
uint8_t *w = buffer.ptrw();
float *fptr = (float *)w;
float *fptr = reinterpret_cast<float *>(w);
fptr[0] = 0.0;
fptr[1] = 0.0;
}
@ -121,7 +121,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(float) * 4);
{
uint8_t *w = buffer.ptrw();
float *fptr = (float *)w;
float *fptr = reinterpret_cast<float *>(w);
fptr[0] = 0.0;
fptr[1] = 0.0;
fptr[2] = 0.0;
@ -134,7 +134,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(uint32_t) * 4);
{
uint8_t *w = buffer.ptrw();
uint32_t *fptr = (uint32_t *)w;
uint32_t *fptr = reinterpret_cast<uint32_t *>(w);
fptr[0] = 0;
fptr[1] = 0;
fptr[2] = 0;
@ -147,7 +147,7 @@ MeshStorage::MeshStorage() {
buffer.resize(sizeof(float) * 4);
{
uint8_t *w = buffer.ptrw();
float *fptr = (float *)w;
float *fptr = reinterpret_cast<float *>(w);
fptr[0] = 0.0;
fptr[1] = 0.0;
fptr[2] = 0.0;
@ -284,9 +284,9 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
case RS::ARRAY_CUSTOM2:
case RS::ARRAY_CUSTOM3: {
int idx = i - RS::ARRAY_CUSTOM0;
uint32_t fmt_shift[RS::ARRAY_CUSTOM_COUNT] = { RS::ARRAY_FORMAT_CUSTOM0_SHIFT, RS::ARRAY_FORMAT_CUSTOM1_SHIFT, RS::ARRAY_FORMAT_CUSTOM2_SHIFT, RS::ARRAY_FORMAT_CUSTOM3_SHIFT };
const uint32_t fmt_shift[RS::ARRAY_CUSTOM_COUNT] = { RS::ARRAY_FORMAT_CUSTOM0_SHIFT, RS::ARRAY_FORMAT_CUSTOM1_SHIFT, RS::ARRAY_FORMAT_CUSTOM2_SHIFT, RS::ARRAY_FORMAT_CUSTOM3_SHIFT };
uint32_t fmt = (p_surface.format >> fmt_shift[idx]) & RS::ARRAY_FORMAT_CUSTOM_MASK;
uint32_t fmtsize[RS::ARRAY_CUSTOM_MAX] = { 4, 4, 4, 8, 4, 8, 12, 16 };
const uint32_t fmtsize[RS::ARRAY_CUSTOM_MAX] = { 4, 4, 4, 8, 4, 8, 12, 16 };
attrib_stride += fmtsize[fmt];
} break;
@ -1098,10 +1098,10 @@ void MeshStorage::_mesh_surface_generate_version_for_input_mask(Mesh::Surface::V
vd.offset = attribute_stride;
int idx = i - RS::ARRAY_CUSTOM0;
uint32_t fmt_shift[RS::ARRAY_CUSTOM_COUNT] = { RS::ARRAY_FORMAT_CUSTOM0_SHIFT, RS::ARRAY_FORMAT_CUSTOM1_SHIFT, RS::ARRAY_FORMAT_CUSTOM2_SHIFT, RS::ARRAY_FORMAT_CUSTOM3_SHIFT };
const uint32_t fmt_shift[RS::ARRAY_CUSTOM_COUNT] = { RS::ARRAY_FORMAT_CUSTOM0_SHIFT, RS::ARRAY_FORMAT_CUSTOM1_SHIFT, RS::ARRAY_FORMAT_CUSTOM2_SHIFT, RS::ARRAY_FORMAT_CUSTOM3_SHIFT };
uint32_t fmt = (s->format >> fmt_shift[idx]) & RS::ARRAY_FORMAT_CUSTOM_MASK;
uint32_t fmtsize[RS::ARRAY_CUSTOM_MAX] = { 4, 4, 4, 8, 4, 8, 12, 16 };
RD::DataFormat fmtrd[RS::ARRAY_CUSTOM_MAX] = { RD::DATA_FORMAT_R8G8B8A8_UNORM, RD::DATA_FORMAT_R8G8B8A8_SNORM, RD::DATA_FORMAT_R16G16_SFLOAT, RD::DATA_FORMAT_R16G16B16A16_SFLOAT, RD::DATA_FORMAT_R32_SFLOAT, RD::DATA_FORMAT_R32G32_SFLOAT, RD::DATA_FORMAT_R32G32B32_SFLOAT, RD::DATA_FORMAT_R32G32B32A32_SFLOAT };
const uint32_t fmtsize[RS::ARRAY_CUSTOM_MAX] = { 4, 4, 4, 8, 4, 8, 12, 16 };
const RD::DataFormat fmtrd[RS::ARRAY_CUSTOM_MAX] = { RD::DATA_FORMAT_R8G8B8A8_UNORM, RD::DATA_FORMAT_R8G8B8A8_SNORM, RD::DATA_FORMAT_R16G16_SFLOAT, RD::DATA_FORMAT_R16G16B16A16_SFLOAT, RD::DATA_FORMAT_R32_SFLOAT, RD::DATA_FORMAT_R32G32_SFLOAT, RD::DATA_FORMAT_R32G32B32_SFLOAT, RD::DATA_FORMAT_R32G32B32A32_SFLOAT };
vd.format = fmtrd[fmt];
attribute_stride += fmtsize[fmt];
buffer = s->attribute_buffer;
@ -1238,7 +1238,7 @@ void MeshStorage::multimesh_set_mesh(RID p_multimesh, RID p_mesh) {
if (multimesh->buffer_set) {
Vector<uint8_t> buffer = RD::get_singleton()->buffer_get_data(multimesh->buffer);
const uint8_t *r = buffer.ptr();
const float *data = (const float *)r;
const float *data = reinterpret_cast<const float *>(r);
_multimesh_re_create_aabb(multimesh, data, multimesh->instances);
}
}

View File

@ -1722,7 +1722,7 @@ RID ParticlesStorage::particles_collision_get_heightfield_framebuffer(RID p_part
if (particles_collision->heightfield_texture == RID()) {
//create
int resolutions[RS::PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX] = { 256, 512, 1024, 2048, 4096, 8192 };
const int resolutions[RS::PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX] = { 256, 512, 1024, 2048, 4096, 8192 };
Size2i size;
if (particles_collision->extents.x > particles_collision->extents.z) {
size.x = resolutions[particles_collision->heightfield_resolution];

View File

@ -424,7 +424,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
value |= CLAMP(int((src[i * 4 + 1] * 0.5 + 0.5) * 1023.0), 0, 1023) << 10;
value |= CLAMP(int((src[i * 4 + 2] * 0.5 + 0.5) * 1023.0), 0, 1023) << 20;
if (src[i * 4 + 3] > 0) {
value |= 3 << 30;
value |= 3UL << 30;
}
memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], &value, 4);
@ -440,7 +440,7 @@ Error RenderingServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint
value |= CLAMP(int((src[i * 4 + 1] * 0.5 + 0.5) * 1023.0), 0, 1023) << 10;
value |= CLAMP(int((src[i * 4 + 2] * 0.5 + 0.5) * 1023.0), 0, 1023) << 20;
if (src[i * 4 + 3] > 0) {
value |= 3 << 30;
value |= 3UL << 30;
}
memcpy(&vw[p_offsets[ai] + i * p_vertex_stride], &value, 4);
}
@ -1093,7 +1093,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector2 *w = arr_2d.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
const float *v = (const float *)&r[j * vertex_elem_size + offsets[i]];
const float *v = reinterpret_cast<const float *>(&r[j * vertex_elem_size + offsets[i]]);
w[j] = Vector2(v[0], v[1]);
}
}
@ -1107,7 +1107,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector3 *w = arr_3d.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
const float *v = (const float *)&r[j * vertex_elem_size + offsets[i]];
const float *v = reinterpret_cast<const float *>(&r[j * vertex_elem_size + offsets[i]]);
w[j] = Vector3(v[0], v[1], v[2]);
}
}
@ -1156,7 +1156,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Color *w = arr.ptrw();
for (int32_t j = 0; j < p_vertex_len; j++) {
const uint8_t *v = (const uint8_t *)&ar[j * attrib_elem_size + offsets[i]];
const uint8_t *v = reinterpret_cast<const uint8_t *>(&ar[j * attrib_elem_size + offsets[i]]);
w[j] = Color(v[0] / 255.0, v[1] / 255.0, v[2] / 255.0, v[3] / 255.0);
}
@ -1170,7 +1170,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector2 *w = arr.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
const float *v = (const float *)&ar[j * attrib_elem_size + offsets[i]];
const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]);
w[j] = Vector2(v[0], v[1]);
}
@ -1184,7 +1184,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
Vector2 *w = arr.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
const float *v = (const float *)&ar[j * attrib_elem_size + offsets[i]];
const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]);
w[j] = Vector2(v[0], v[1]);
}
@ -1209,7 +1209,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
uint8_t *w = arr.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
const uint8_t *v = (const uint8_t *)&ar[j * attrib_elem_size + offsets[i]];
const uint8_t *v = reinterpret_cast<const uint8_t *>(&ar[j * attrib_elem_size + offsets[i]]);
memcpy(&w[j * s], v, s);
}
@ -1228,7 +1228,7 @@ Array RenderingServer::_get_array_from_surface(uint32_t p_format, Vector<uint8_t
float *w = arr.ptrw();
for (int j = 0; j < p_vertex_len; j++) {
const float *v = (const float *)&ar[j * attrib_elem_size + offsets[i]];
const float *v = reinterpret_cast<const float *>(&ar[j * attrib_elem_size + offsets[i]]);
memcpy(&w[j * s], v, s * sizeof(float));
}
ret[i] = arr;