mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`. `clang-format` developers seem to mostly care about space-based indentation and every other version of clang-format breaks the bad mismatch of tabs and spaces that it seems to use for operand alignment. So it's better without, so that it respects our two-tabs `ContinuationIndentWidth`.
This commit is contained in:
parent
8508f9396d
commit
3b11e33a09
@ -12,7 +12,7 @@ AlignAfterOpenBracket: DontAlign
|
||||
# AlignConsecutiveBitFields: None
|
||||
# AlignConsecutiveDeclarations: None
|
||||
# AlignEscapedNewlines: Right
|
||||
# AlignOperands: Align
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
# AllowAllArgumentsOnNextLine: true
|
||||
# AllowAllConstructorInitializersOnNextLine: true
|
||||
|
@ -164,7 +164,8 @@ void Input::_bind_methods() {
|
||||
|
||||
void Input::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
|
||||
String pf = p_function;
|
||||
if (p_idx == 0 && (pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" ||
|
||||
if (p_idx == 0 &&
|
||||
(pf == "is_action_pressed" || pf == "action_press" || pf == "action_release" ||
|
||||
pf == "is_action_just_pressed" || pf == "is_action_just_released" ||
|
||||
pf == "get_action_strength" || pf == "get_action_raw_strength" ||
|
||||
pf == "get_axis" || pf == "get_vector")) {
|
||||
@ -315,11 +316,11 @@ Vector2 Input::get_vector(const StringName &p_negative_x, const StringName &p_po
|
||||
|
||||
if (p_deadzone < 0.0f) {
|
||||
// If the deadzone isn't specified, get it from the average of the actions.
|
||||
p_deadzone = (InputMap::get_singleton()->action_get_deadzone(p_positive_x) +
|
||||
p_deadzone = 0.25 *
|
||||
(InputMap::get_singleton()->action_get_deadzone(p_positive_x) +
|
||||
InputMap::get_singleton()->action_get_deadzone(p_negative_x) +
|
||||
InputMap::get_singleton()->action_get_deadzone(p_positive_y) +
|
||||
InputMap::get_singleton()->action_get_deadzone(p_negative_y)) /
|
||||
4;
|
||||
InputMap::get_singleton()->action_get_deadzone(p_negative_y));
|
||||
}
|
||||
|
||||
// Circular length limiting and deadzone.
|
||||
|
@ -288,10 +288,7 @@ Vector3 Basis::get_scale() const {
|
||||
//
|
||||
// The rotation part of this decomposition is returned by get_rotation* functions.
|
||||
real_t det_sign = SGN(determinant());
|
||||
return det_sign * Vector3(
|
||||
Vector3(elements[0][0], elements[1][0], elements[2][0]).length(),
|
||||
Vector3(elements[0][1], elements[1][1], elements[2][1]).length(),
|
||||
Vector3(elements[0][2], elements[1][2], elements[2][2]).length());
|
||||
return det_sign * get_scale_abs();
|
||||
}
|
||||
|
||||
// Decomposes a Basis into a rotation-reflection matrix (an element of the group O(3)) and a positive scaling matrix as B = O.S.
|
||||
|
@ -160,7 +160,8 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
|
||||
real_t t3 = t2 * t;
|
||||
|
||||
Vector2 out;
|
||||
out = 0.5 * ((p1 * 2.0) +
|
||||
out = 0.5 *
|
||||
((p1 * 2.0) +
|
||||
(-p0 + p2) * t +
|
||||
(2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 +
|
||||
(-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3);
|
||||
|
@ -93,7 +93,8 @@ Vector3 Vector3::cubic_interpolate(const Vector3 &p_b, const Vector3 &p_pre_a, c
|
||||
real_t t3 = t2 * t;
|
||||
|
||||
Vector3 out;
|
||||
out = 0.5 * ((p1 * 2.0) +
|
||||
out = 0.5 *
|
||||
((p1 * 2.0) +
|
||||
(-p0 + p2) * t +
|
||||
(2.0 * p0 - 5.0 * p1 + 4.0 * p2 - p3) * t2 +
|
||||
(-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3);
|
||||
|
@ -238,10 +238,16 @@ void InputEventConfigurationDialog::_listen_window_input(const Ref<InputEvent> &
|
||||
Ref<InputEventJoypadButton> joyb = p_event;
|
||||
Ref<InputEventJoypadMotion> joym = p_event;
|
||||
|
||||
int type = k.is_valid() ? INPUT_KEY : joyb.is_valid() ? INPUT_JOY_BUTTON :
|
||||
joym.is_valid() ? INPUT_JOY_MOTION :
|
||||
mb.is_valid() ? INPUT_MOUSE_BUTTON :
|
||||
0;
|
||||
int type = 0;
|
||||
if (k.is_valid()) {
|
||||
type = INPUT_KEY;
|
||||
} else if (joyb.is_valid()) {
|
||||
type = INPUT_JOY_BUTTON;
|
||||
} else if (joym.is_valid()) {
|
||||
type = INPUT_JOY_MOTION;
|
||||
} else if (mb.is_valid()) {
|
||||
type = INPUT_MOUSE_BUTTON;
|
||||
}
|
||||
|
||||
if (!(allowed_input_types & type)) {
|
||||
return;
|
||||
|
@ -541,7 +541,10 @@ void Collada::_parse_effect_material(XMLParser &parser, Effect &effect, String &
|
||||
|
||||
COLLADA_PRINT("node name: " + parser.get_node_name());
|
||||
|
||||
if (!parser.is_empty() && (parser.get_node_name() == "profile_COMMON" || parser.get_node_name() == "technique" || parser.get_node_name() == "extra")) {
|
||||
if (!parser.is_empty() &&
|
||||
(parser.get_node_name() == "profile_COMMON" ||
|
||||
parser.get_node_name() == "technique" ||
|
||||
parser.get_node_name() == "extra")) {
|
||||
_parse_effect_material(parser, effect, id); // try again
|
||||
|
||||
} else if (parser.get_node_name() == "newparam") {
|
||||
@ -627,7 +630,8 @@ void Collada::_parse_effect_material(XMLParser &parser, Effect &effect, String &
|
||||
} else if (what == "shininess") {
|
||||
effect.shininess = _parse_param(parser);
|
||||
}
|
||||
} else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END && (parser.get_node_name() == "constant" ||
|
||||
} else if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END &&
|
||||
(parser.get_node_name() == "constant" ||
|
||||
parser.get_node_name() == "lambert" ||
|
||||
parser.get_node_name() == "phong" ||
|
||||
parser.get_node_name() == "blinn")) {
|
||||
|
@ -1311,7 +1311,8 @@ bool ResourceImporterScene::get_internal_option_visibility(InternalImportCategor
|
||||
|
||||
if (p_option == "primitive/radius") {
|
||||
const ShapeType physics_shape = (ShapeType)p_options["physics/shape_type"].operator int();
|
||||
return generate_physics && (physics_shape == SHAPE_TYPE_SPHERE ||
|
||||
return generate_physics &&
|
||||
(physics_shape == SHAPE_TYPE_SPHERE ||
|
||||
physics_shape == SHAPE_TYPE_CYLINDER ||
|
||||
physics_shape == SHAPE_TYPE_CAPSULE);
|
||||
}
|
||||
|
@ -2983,16 +2983,14 @@ void CanvasItemEditor::_draw_ruler_tool() {
|
||||
|
||||
const Vector2 end_to_begin = (end - begin);
|
||||
|
||||
real_t arc_1_start_angle =
|
||||
end_to_begin.x < 0 ?
|
||||
real_t arc_1_start_angle = end_to_begin.x < 0 ?
|
||||
(end_to_begin.y < 0 ? 3.0 * Math_PI / 2.0 - vertical_angle_rad : Math_PI / 2.0) :
|
||||
(end_to_begin.y < 0 ? 3.0 * Math_PI / 2.0 : Math_PI / 2.0 - vertical_angle_rad);
|
||||
real_t arc_1_end_angle = arc_1_start_angle + vertical_angle_rad;
|
||||
// Constrain arc to triangle height & max size
|
||||
real_t arc_1_radius = MIN(MIN(arc_radius_max_length_percent * ruler_length, ABS(end_to_begin.y)), arc_max_radius);
|
||||
|
||||
real_t arc_2_start_angle =
|
||||
end_to_begin.x < 0 ?
|
||||
real_t arc_2_start_angle = end_to_begin.x < 0 ?
|
||||
(end_to_begin.y < 0 ? 0.0 : -horizontal_angle_rad) :
|
||||
(end_to_begin.y < 0 ? Math_PI - horizontal_angle_rad : Math_PI);
|
||||
real_t arc_2_end_angle = arc_2_start_angle + horizontal_angle_rad;
|
||||
|
@ -315,10 +315,7 @@ void ScriptEditorQuickOpen::_text_changed(const String &p_newtext) {
|
||||
void ScriptEditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
|
||||
Ref<InputEventKey> k = p_ie;
|
||||
|
||||
if (k.is_valid() && (k->get_keycode() == KEY_UP ||
|
||||
k->get_keycode() == KEY_DOWN ||
|
||||
k->get_keycode() == KEY_PAGEUP ||
|
||||
k->get_keycode() == KEY_PAGEDOWN)) {
|
||||
if (k.is_valid() && (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_PAGEUP || k->get_keycode() == KEY_PAGEDOWN)) {
|
||||
search_options->gui_input(k);
|
||||
search_box->accept_event();
|
||||
}
|
||||
|
@ -1396,7 +1396,8 @@ Variant ScriptTextEditor::get_drag_data_fw(const Point2 &p_point, Control *p_fro
|
||||
|
||||
bool ScriptTextEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
|
||||
Dictionary d = p_data;
|
||||
if (d.has("type") && (String(d["type"]) == "resource" ||
|
||||
if (d.has("type") &&
|
||||
(String(d["type"]) == "resource" ||
|
||||
String(d["type"]) == "files" ||
|
||||
String(d["type"]) == "nodes" ||
|
||||
String(d["type"]) == "obj_property" ||
|
||||
|
@ -3207,10 +3207,7 @@ void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos, VisualShaderNod
|
||||
|
||||
void VisualShaderEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
|
||||
Ref<InputEventKey> ie = p_ie;
|
||||
if (ie.is_valid() && (ie->get_keycode() == KEY_UP ||
|
||||
ie->get_keycode() == KEY_DOWN ||
|
||||
ie->get_keycode() == KEY_ENTER ||
|
||||
ie->get_keycode() == KEY_KP_ENTER)) {
|
||||
if (ie.is_valid() && (ie->get_keycode() == KEY_UP || ie->get_keycode() == KEY_DOWN || ie->get_keycode() == KEY_ENTER || ie->get_keycode() == KEY_KP_ENTER)) {
|
||||
members->gui_input(ie);
|
||||
node_filter->accept_event();
|
||||
}
|
||||
|
@ -248,8 +248,7 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f,
|
||||
}
|
||||
// Don't rely on sizeof(bmp_file_header) as structure padding
|
||||
// adds 2 bytes offset leading to misaligned color table reading
|
||||
uint32_t ct_offset = BITMAP_FILE_HEADER_SIZE +
|
||||
bmp_header.bmp_info_header.bmp_header_size;
|
||||
uint32_t ct_offset = BITMAP_FILE_HEADER_SIZE + bmp_header.bmp_info_header.bmp_header_size;
|
||||
f->seek(ct_offset);
|
||||
|
||||
uint32_t color_table_size = 0;
|
||||
@ -271,8 +270,7 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f,
|
||||
|
||||
f->seek(bmp_header.bmp_file_header.bmp_file_offset);
|
||||
|
||||
uint32_t bmp_buffer_size = (bmp_header.bmp_file_header.bmp_file_size -
|
||||
bmp_header.bmp_file_header.bmp_file_offset);
|
||||
uint32_t bmp_buffer_size = (bmp_header.bmp_file_header.bmp_file_size - bmp_header.bmp_file_header.bmp_file_offset);
|
||||
|
||||
Vector<uint8_t> bmp_buffer;
|
||||
err = bmp_buffer.resize(bmp_buffer_size);
|
||||
|
@ -3265,8 +3265,7 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {
|
||||
"Script inherits from native type '" + String(native_name) +
|
||||
"', so it can't be instantiated in object of type: '" + p_this->get_class() + "'");
|
||||
}
|
||||
ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(native_name) +
|
||||
"', so it can't be instantiated in object of type: '" + p_this->get_class() + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(native_name) + "', so it can't be instantiated in object of type: '" + p_this->get_class() + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -398,8 +398,7 @@ MonoArray *variant_to_mono_array(const Variant &p_var, GDMonoClass *p_type_class
|
||||
return Array_to_mono_array(p_var.operator ::Array(), array_type->eklass);
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to array of unsupported element type:" +
|
||||
GDMonoClass::get_full_name(array_type->eklass) + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to array of unsupported element type:" + GDMonoClass::get_full_name(array_type->eklass) + "'.");
|
||||
}
|
||||
|
||||
MonoObject *variant_to_mono_object_of_class(const Variant &p_var, GDMonoClass *p_type_class) {
|
||||
@ -432,8 +431,7 @@ MonoObject *variant_to_mono_object_of_class(const Variant &p_var, GDMonoClass *p
|
||||
return GDMonoUtils::create_managed_from(p_var.operator Array(), CACHED_CLASS(Array));
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported type: '" +
|
||||
p_type_class->get_full_name() + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported type: '" + p_type_class->get_full_name() + "'.");
|
||||
}
|
||||
|
||||
MonoObject *variant_to_mono_object_of_genericinst(const Variant &p_var, GDMonoClass *p_type_class) {
|
||||
@ -488,8 +486,7 @@ MonoObject *variant_to_mono_object_of_genericinst(const Variant &p_var, GDMonoCl
|
||||
return GDMonoUtils::unmanaged_get_managed(p_var.operator Object *());
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported generic type: '" +
|
||||
p_type_class->get_full_name() + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported generic type: '" + p_type_class->get_full_name() + "'.");
|
||||
}
|
||||
|
||||
MonoObject *variant_to_mono_object(const Variant &p_var) {
|
||||
@ -824,14 +821,12 @@ void *variant_to_managed_unboxed(const Variant &p_var, const ManagedType &p_type
|
||||
RETURN_TYPE_VAL(uint64_t, val);
|
||||
}
|
||||
default: {
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to enum value of unsupported base type: '" +
|
||||
GDMonoClass::get_full_name(mono_class_from_mono_type(enum_basetype)) + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to enum value of unsupported base type: '" + GDMonoClass::get_full_name(mono_class_from_mono_type(enum_basetype)) + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported value type: '" +
|
||||
p_type.type_class->get_full_name() + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported value type: '" + p_type.type_class->get_full_name() + "'.");
|
||||
} break;
|
||||
#undef RETURN_TYPE_VAL
|
||||
case MONO_TYPE_STRING:
|
||||
@ -847,8 +842,7 @@ void *variant_to_managed_unboxed(const Variant &p_var, const ManagedType &p_type
|
||||
return variant_to_mono_object(p_var);
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported type with encoding: " +
|
||||
itos(p_type.type_encoding) + ".");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported type with encoding: " + itos(p_type.type_encoding) + ".");
|
||||
}
|
||||
|
||||
MonoObject *variant_to_mono_object(const Variant &p_var, const ManagedType &p_type) {
|
||||
@ -981,14 +975,12 @@ MonoObject *variant_to_mono_object(const Variant &p_var, const ManagedType &p_ty
|
||||
return BOX_ENUM(enum_baseclass, val);
|
||||
}
|
||||
default: {
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to enum value of unsupported base type: '" +
|
||||
GDMonoClass::get_full_name(enum_baseclass) + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to enum value of unsupported base type: '" + GDMonoClass::get_full_name(enum_baseclass) + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported value type: '" +
|
||||
p_type.type_class->get_full_name() + "'.");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported value type: '" + p_type.type_class->get_full_name() + "'.");
|
||||
} break;
|
||||
case MONO_TYPE_STRING:
|
||||
return (MonoObject *)variant_to_mono_string(p_var);
|
||||
@ -1003,8 +995,7 @@ MonoObject *variant_to_mono_object(const Variant &p_var, const ManagedType &p_ty
|
||||
return variant_to_mono_object(p_var);
|
||||
}
|
||||
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported type with encoding: " +
|
||||
itos(p_type.type_encoding) + ".");
|
||||
ERR_FAIL_V_MSG(nullptr, "Attempted to convert Variant to unsupported type with encoding: " + itos(p_type.type_encoding) + ".");
|
||||
}
|
||||
|
||||
Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type, bool p_fail_with_err = true) {
|
||||
@ -1271,8 +1262,7 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
|
||||
}
|
||||
|
||||
if (p_fail_with_err) {
|
||||
ERR_FAIL_V_MSG(Variant(), "Attempted to convert an unmarshallable managed type to Variant. Name: '" +
|
||||
p_type.type_class->get_name() + "' Encoding: " + itos(p_type.type_encoding) + ".");
|
||||
ERR_FAIL_V_MSG(Variant(), "Attempted to convert an unmarshallable managed type to Variant. Name: '" + p_type.type_class->get_name() + "' Encoding: " + itos(p_type.type_encoding) + ".");
|
||||
} else {
|
||||
return Variant();
|
||||
}
|
||||
|
@ -84,7 +84,6 @@ bool PluginConfigAndroid::is_plugin_config_valid(PluginConfigAndroid plugin_conf
|
||||
if (valid_binary_type) {
|
||||
valid_binary = !plugin_config.binary.is_empty() &&
|
||||
(plugin_config.binary_type == PluginConfigAndroid::BINARY_TYPE_REMOTE ||
|
||||
|
||||
FileAccess::exists(plugin_config.binary));
|
||||
}
|
||||
|
||||
|
@ -578,8 +578,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
||||
|
||||
if (!pack_valid) {
|
||||
Intent notifierIntent = new Intent(activity, activity.getClass());
|
||||
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
|
||||
Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(activity, 0,
|
||||
notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
@ -121,8 +121,7 @@ void App::SetWindow(CoreWindow ^ p_window) {
|
||||
window->PointerWheelChanged +=
|
||||
ref new TypedEventHandler<CoreWindow ^, PointerEventArgs ^>(this, &App::OnPointerWheelChanged);
|
||||
|
||||
mouseChangedNotifier = SignalNotifier::AttachToEvent(L"os_mouse_mode_changed", ref new SignalHandler(
|
||||
this, &App::OnMouseModeChanged));
|
||||
mouseChangedNotifier = SignalNotifier::AttachToEvent(L"os_mouse_mode_changed", ref new SignalHandler(this, &App::OnMouseModeChanged));
|
||||
|
||||
mouseChangedNotifier->Enable();
|
||||
|
||||
|
@ -213,8 +213,7 @@ TypedArray<String> CPUParticles3D::get_configuration_warnings() const {
|
||||
warnings.push_back(TTR("Nothing is visible because no mesh has been assigned."));
|
||||
}
|
||||
|
||||
if (!anim_material_found && (get_param_max(PARAM_ANIM_SPEED) != 0.0 || get_param_max(PARAM_ANIM_OFFSET) != 0.0 ||
|
||||
get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) {
|
||||
if (!anim_material_found && (get_param_max(PARAM_ANIM_SPEED) != 0.0 || get_param_max(PARAM_ANIM_OFFSET) != 0.0 || get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) {
|
||||
warnings.push_back(TTR("CPUParticles3D animation requires the usage of a StandardMaterial3D whose Billboard Mode is set to \"Particle Billboard\"."));
|
||||
}
|
||||
|
||||
|
@ -2319,7 +2319,8 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a
|
||||
real_t t2 = t * t;
|
||||
real_t t3 = t2 * t;
|
||||
|
||||
return 0.5f * ((p1 * 2.0f) +
|
||||
return 0.5f *
|
||||
((p1 * 2.0f) +
|
||||
(-p0 + p2) * t +
|
||||
(2.0f * p0 - 5.0f * p1 + 4 * p2 - p3) * t2 +
|
||||
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
|
||||
|
@ -495,8 +495,7 @@ void GodotBodyPair3D::solve(real_t p_step) {
|
||||
Vector3 temp1 = inv_inertia_tensor_A.xform(c.rA.cross(tv));
|
||||
Vector3 temp2 = inv_inertia_tensor_B.xform(c.rB.cross(tv));
|
||||
|
||||
real_t t = -tvl /
|
||||
(inv_mass_A + inv_mass_B + tv.dot(temp1.cross(c.rA) + temp2.cross(c.rB)));
|
||||
real_t t = -tvl / (inv_mass_A + inv_mass_B + tv.dot(temp1.cross(c.rA) + temp2.cross(c.rB)));
|
||||
|
||||
Vector3 jt = t * tv;
|
||||
|
||||
@ -863,8 +862,7 @@ void GodotBodySoftBodyPair3D::solve(real_t p_step) {
|
||||
|
||||
Vector3 temp1 = body_inv_inertia_tensor.xform(c.rA.cross(tv));
|
||||
|
||||
real_t t = -tvl /
|
||||
(body_inv_mass + node_inv_mass + tv.dot(temp1.cross(c.rA)));
|
||||
real_t t = -tvl / (body_inv_mass + node_inv_mass + tv.dot(temp1.cross(c.rA)));
|
||||
|
||||
Vector3 jt = t * tv;
|
||||
|
||||
|
@ -129,7 +129,9 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
|
||||
plane_space(normal[0], normal[1], normal[2]);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
memnew_placement(&m_jac[i], GodotJacobianEntry3D(
|
||||
memnew_placement(
|
||||
&m_jac[i],
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
@ -192,8 +194,7 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
|
||||
real_t swingAxisSign = (b2Axis1.dot(b1Axis1) >= 0.0f) ? 1.0f : -1.0f;
|
||||
m_swingAxis *= swingAxisSign;
|
||||
|
||||
m_kSwing = real_t(1.) / (A->compute_angular_impulse_denominator(m_swingAxis) +
|
||||
B->compute_angular_impulse_denominator(m_swingAxis));
|
||||
m_kSwing = real_t(1.) / (A->compute_angular_impulse_denominator(m_swingAxis) + B->compute_angular_impulse_denominator(m_swingAxis));
|
||||
}
|
||||
|
||||
// Twist limits
|
||||
@ -212,8 +213,7 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
|
||||
m_twistAxis.normalize();
|
||||
m_twistAxis *= -1.0f;
|
||||
|
||||
m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) +
|
||||
B->compute_angular_impulse_denominator(m_twistAxis));
|
||||
m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) + B->compute_angular_impulse_denominator(m_twistAxis));
|
||||
|
||||
} else if (twist > m_twistSpan * lockedFreeFactor) {
|
||||
m_twistCorrection = (twist - m_twistSpan);
|
||||
@ -222,8 +222,7 @@ bool GodotConeTwistJoint3D::setup(real_t p_timestep) {
|
||||
m_twistAxis = (b2Axis1 + b1Axis1) * 0.5f;
|
||||
m_twistAxis.normalize();
|
||||
|
||||
m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) +
|
||||
B->compute_angular_impulse_denominator(m_twistAxis));
|
||||
m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) + B->compute_angular_impulse_denominator(m_twistAxis));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,9 @@ void GodotGeneric6DOFJoint3D::calculateTransforms() {
|
||||
void GodotGeneric6DOFJoint3D::buildLinearJacobian(
|
||||
GodotJacobianEntry3D &jacLinear, const Vector3 &normalWorld,
|
||||
const Vector3 &pivotAInW, const Vector3 &pivotBInW) {
|
||||
memnew_placement(&jacLinear, GodotJacobianEntry3D(
|
||||
memnew_placement(
|
||||
&jacLinear,
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
@ -293,7 +295,10 @@ void GodotGeneric6DOFJoint3D::buildLinearJacobian(
|
||||
|
||||
void GodotGeneric6DOFJoint3D::buildAngularJacobian(
|
||||
GodotJacobianEntry3D &jacAngular, const Vector3 &jointAxisW) {
|
||||
memnew_placement(&jacAngular, GodotJacobianEntry3D(jointAxisW,
|
||||
memnew_placement(
|
||||
&jacAngular,
|
||||
GodotJacobianEntry3D(
|
||||
jointAxisW,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
|
@ -149,7 +149,9 @@ bool GodotHingeJoint3D::setup(real_t p_step) {
|
||||
plane_space(normal[0], normal[1], normal[2]);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
memnew_placement(&m_jac[i], GodotJacobianEntry3D(
|
||||
memnew_placement(
|
||||
&m_jac[i],
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
pivotAInW - A->get_transform().origin - A->get_center_of_mass(),
|
||||
@ -175,19 +177,28 @@ bool GodotHingeJoint3D::setup(real_t p_step) {
|
||||
Vector3 jointAxis1 = A->get_transform().basis.xform(jointAxis1local);
|
||||
Vector3 hingeAxisWorld = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(2));
|
||||
|
||||
memnew_placement(&m_jacAng[0], GodotJacobianEntry3D(jointAxis0,
|
||||
memnew_placement(
|
||||
&m_jacAng[0],
|
||||
GodotJacobianEntry3D(
|
||||
jointAxis0,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
|
||||
memnew_placement(&m_jacAng[1], GodotJacobianEntry3D(jointAxis1,
|
||||
memnew_placement(
|
||||
&m_jacAng[1],
|
||||
GodotJacobianEntry3D(
|
||||
jointAxis1,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
B->get_inv_inertia()));
|
||||
|
||||
memnew_placement(&m_jacAng[2], GodotJacobianEntry3D(hingeAxisWorld,
|
||||
memnew_placement(
|
||||
&m_jacAng[2],
|
||||
GodotJacobianEntry3D(
|
||||
hingeAxisWorld,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_inv_inertia(),
|
||||
@ -220,8 +231,7 @@ bool GodotHingeJoint3D::setup(real_t p_step) {
|
||||
|
||||
//Compute K = J*W*J' for hinge axis
|
||||
Vector3 axisA = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(2));
|
||||
m_kHinge = 1.0f / (A->compute_angular_impulse_denominator(axisA) +
|
||||
B->compute_angular_impulse_denominator(axisA));
|
||||
m_kHinge = 1.0f / (A->compute_angular_impulse_denominator(axisA) + B->compute_angular_impulse_denominator(axisA));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -63,7 +63,9 @@ bool GodotPinJoint3D::setup(real_t p_step) {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
normal[i] = 1;
|
||||
memnew_placement(&m_jac[i], GodotJacobianEntry3D(
|
||||
memnew_placement(
|
||||
&m_jac[i],
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
A->get_transform().xform(m_pivotInA) - A->get_transform().origin - A->get_center_of_mass(),
|
||||
|
@ -112,7 +112,9 @@ bool GodotSliderJoint3D::setup(real_t p_step) {
|
||||
//linear part
|
||||
for (i = 0; i < 3; i++) {
|
||||
normalWorld = m_calculatedTransformA.basis.get_axis(i);
|
||||
memnew_placement(&m_jacLin[i], GodotJacobianEntry3D(
|
||||
memnew_placement(
|
||||
&m_jacLin[i],
|
||||
GodotJacobianEntry3D(
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
m_relPosA - A->get_center_of_mass(),
|
||||
@ -129,7 +131,9 @@ bool GodotSliderJoint3D::setup(real_t p_step) {
|
||||
// angular part
|
||||
for (i = 0; i < 3; i++) {
|
||||
normalWorld = m_calculatedTransformA.basis.get_axis(i);
|
||||
memnew_placement(&m_jacAng[i], GodotJacobianEntry3D(
|
||||
memnew_placement(
|
||||
&m_jacAng[i],
|
||||
GodotJacobianEntry3D(
|
||||
normalWorld,
|
||||
A->get_principal_inertia_axes().transposed(),
|
||||
B->get_principal_inertia_axes().transposed(),
|
||||
|
@ -137,8 +137,7 @@ void RendererCanvasCull::_attach_canvas_item_for_draw(RendererCanvasCull::Item *
|
||||
|
||||
// We have two choices now, if user has drawn something, we must assume users wants to draw the "mask", so compute the size based on this.
|
||||
// If nothing has been drawn, we just take it over and draw it ourselves.
|
||||
if (ci->canvas_group->fit_empty && (ci->commands == nullptr ||
|
||||
(ci->commands->next == nullptr && ci->commands->type == RendererCanvasCull::Item::Command::TYPE_RECT && (static_cast<RendererCanvasCull::Item::CommandRect *>(ci->commands)->flags & RendererCanvasRender::CANVAS_RECT_IS_GROUP)))) {
|
||||
if (ci->canvas_group->fit_empty && (ci->commands == nullptr || (ci->commands->next == nullptr && ci->commands->type == RendererCanvasCull::Item::Command::TYPE_RECT && (static_cast<RendererCanvasCull::Item::CommandRect *>(ci->commands)->flags & RendererCanvasRender::CANVAS_RECT_IS_GROUP)))) {
|
||||
// No commands, or sole command is the one used to draw, so we (re)create the draw command.
|
||||
ci->clear();
|
||||
|
||||
|
@ -29,8 +29,7 @@ float compute_alpha_hash_threshold(vec3 pos, float hash_scale) {
|
||||
|
||||
vec3 cases = vec3(a_interp * a_interp / (2.0 * min_lerp * (1.0 - min_lerp)),
|
||||
(a_interp - 0.5 * min_lerp) / (1.0 - min_lerp),
|
||||
1.0 - ((1.0 - a_interp) * (1.0 - a_interp) /
|
||||
(2.0 * min_lerp * (1.0 - min_lerp))));
|
||||
1.0 - ((1.0 - a_interp) * (1.0 - a_interp) / (2.0 * min_lerp * (1.0 - min_lerp))));
|
||||
|
||||
float alpha_hash_threshold =
|
||||
(lerp_factor < (1.0 - min_lerp)) ? ((lerp_factor < min_lerp) ? cases.x : cases.y) : cases.z;
|
||||
|
Loading…
Reference in New Issue
Block a user