diff options
-rw-r--r-- | main/main.cpp | 10 | ||||
-rw-r--r-- | modules/gltf/gltf_document.cpp | 150 | ||||
-rw-r--r-- | modules/gltf/gltf_document.h | 1 | ||||
-rw-r--r-- | platform/android/export/export.cpp | 41 | ||||
-rw-r--r-- | servers/rendering_server.cpp | 16 | ||||
-rw-r--r-- | tests/SCsub | 5 | ||||
-rw-r--r-- | thirdparty/README.md | 2 | ||||
-rw-r--r-- | thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.cpp | 5 | ||||
-rw-r--r-- | thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.h | 3 | ||||
-rw-r--r-- | thirdparty/bullet/LinearMath/btQuickprof.cpp | 3 | ||||
-rw-r--r-- | thirdparty/bullet/LinearMath/btScalar.h | 2 | ||||
-rw-r--r-- | thirdparty/bullet/LinearMath/btSerializer.h | 2 |
12 files changed, 199 insertions, 41 deletions
diff --git a/main/main.cpp b/main/main.cpp index 70fd45989d..c9911464bb 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -528,6 +528,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph ClassDB::register_class<Performance>(); engine->add_singleton(Engine::Singleton("Performance", performance)); + // Only flush stdout in debug builds by default, as spamming `print()` will + // decrease performance if this is enabled. + GLOBAL_DEF("application/run/flush_stdout_on_print", false); + GLOBAL_DEF("application/run/flush_stdout_on_print.debug", true); + GLOBAL_DEF("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues")); @@ -1121,11 +1126,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } #endif - // Only flush stdout in debug builds by default, as spamming `print()` will - // decrease performance if this is enabled. - GLOBAL_DEF("application/run/flush_stdout_on_print", false); - GLOBAL_DEF("application/run/flush_stdout_on_print.debug", true); - GLOBAL_DEF("logging/file_logging/enable_file_logging", false); // Only file logging by default on desktop platforms as logs can't be // accessed easily on mobile/Web platforms (if at all). diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 946d1af966..a3c90f8591 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -29,6 +29,9 @@ /*************************************************************************/ #include "gltf_document.h" +#include "core/error/error_list.h" +#include "core/error/error_macros.h" +#include "core/variant/variant.h" #include "gltf_accessor.h" #include "gltf_animation.h" #include "gltf_camera.h" @@ -2199,33 +2202,81 @@ Error GLTFDocument::_serialize_meshes(Ref<GLTFState> state) { } } { - Array a = array[Mesh::ARRAY_BONES]; - if (a.size()) { - const int ret_size = a.size() / 4; + const Array &a = array[Mesh::ARRAY_BONES]; + const Vector<Vector3> &vertex_array = array[Mesh::ARRAY_VERTEX]; + if ((a.size() / JOINT_GROUP_SIZE) == vertex_array.size()) { + const int ret_size = a.size() / JOINT_GROUP_SIZE; Vector<Color> attribs; attribs.resize(ret_size); { for (int array_i = 0; array_i < attribs.size(); array_i++) { - int32_t joint_0 = a[(array_i * 4) + 0]; - int32_t joint_1 = a[(array_i * 4) + 1]; - int32_t joint_2 = a[(array_i * 4) + 2]; - int32_t joint_3 = a[(array_i * 4) + 3]; + int32_t joint_0 = a[(array_i * JOINT_GROUP_SIZE) + 0]; + int32_t joint_1 = a[(array_i * JOINT_GROUP_SIZE) + 1]; + int32_t joint_2 = a[(array_i * JOINT_GROUP_SIZE) + 2]; + int32_t joint_3 = a[(array_i * JOINT_GROUP_SIZE) + 3]; attribs.write[array_i] = Color(joint_0, joint_1, joint_2, joint_3); } } attributes["JOINTS_0"] = _encode_accessor_as_joints(state, attribs, true); + } else if ((a.size() / (JOINT_GROUP_SIZE * 2)) >= vertex_array.size()) { + int32_t vertex_count = vertex_array.size(); + Vector<Color> joints_0; + joints_0.resize(vertex_count); + Vector<Color> joints_1; + joints_1.resize(vertex_count); + int32_t weights_8_count = JOINT_GROUP_SIZE * 2; + for (int32_t vertex_i = 0; vertex_i < vertex_count; vertex_i++) { + Color joint_0; + joint_0.r = a[vertex_i * weights_8_count + 0]; + joint_0.g = a[vertex_i * weights_8_count + 1]; + joint_0.b = a[vertex_i * weights_8_count + 2]; + joint_0.a = a[vertex_i * weights_8_count + 3]; + joints_0.write[vertex_i] = joint_0; + Color joint_1; + joint_1.r = a[vertex_i * weights_8_count + 4]; + joint_1.g = a[vertex_i * weights_8_count + 5]; + joint_1.b = a[vertex_i * weights_8_count + 6]; + joint_1.a = a[vertex_i * weights_8_count + 7]; + joints_1.write[vertex_i] = joint_1; + } + attributes["JOINTS_0"] = _encode_accessor_as_joints(state, joints_0, true); + attributes["JOINTS_1"] = _encode_accessor_as_joints(state, joints_1, true); } } { - Array a = array[Mesh::ARRAY_WEIGHTS]; - if (a.size()) { - const int ret_size = a.size() / 4; + const Array &a = array[Mesh::ARRAY_WEIGHTS]; + const Vector<Vector3> &vertex_array = array[Mesh::ARRAY_VERTEX]; + if ((a.size() / JOINT_GROUP_SIZE) == vertex_array.size()) { + const int ret_size = a.size() / JOINT_GROUP_SIZE; Vector<Color> attribs; attribs.resize(ret_size); for (int i = 0; i < ret_size; i++) { - attribs.write[i] = Color(a[(i * 4) + 0], a[(i * 4) + 1], a[(i * 4) + 2], a[(i * 4) + 3]); + attribs.write[i] = Color(a[(i * JOINT_GROUP_SIZE) + 0], a[(i * JOINT_GROUP_SIZE) + 1], a[(i * JOINT_GROUP_SIZE) + 2], a[(i * JOINT_GROUP_SIZE) + 3]); } attributes["WEIGHTS_0"] = _encode_accessor_as_weights(state, attribs, true); + } else if ((a.size() / (JOINT_GROUP_SIZE * 2)) >= vertex_array.size()) { + int32_t vertex_count = vertex_array.size(); + Vector<Color> weights_0; + weights_0.resize(vertex_count); + Vector<Color> weights_1; + weights_1.resize(vertex_count); + int32_t weights_8_count = JOINT_GROUP_SIZE * 2; + for (int32_t vertex_i = 0; vertex_i < vertex_count; vertex_i++) { + Color weight_0; + weight_0.r = a[vertex_i * weights_8_count + 0]; + weight_0.g = a[vertex_i * weights_8_count + 1]; + weight_0.b = a[vertex_i * weights_8_count + 2]; + weight_0.a = a[vertex_i * weights_8_count + 3]; + weights_0.write[vertex_i] = weight_0; + Color weight_1; + weight_1.r = a[vertex_i * weights_8_count + 4]; + weight_1.g = a[vertex_i * weights_8_count + 5]; + weight_1.b = a[vertex_i * weights_8_count + 6]; + weight_1.a = a[vertex_i * weights_8_count + 7]; + weights_1.write[vertex_i] = weight_1; + } + attributes["WEIGHTS_0"] = _encode_accessor_as_weights(state, weights_0, true); + attributes["WEIGHTS_1"] = _encode_accessor_as_weights(state, weights_1, true); } } { @@ -2428,10 +2479,29 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> state) { array[Mesh::ARRAY_COLOR] = _decode_accessor_as_color(state, a["COLOR_0"], true); has_vertex_color = true; } - if (a.has("JOINTS_0")) { + if (a.has("JOINTS_0") && !a.has("JOINTS_1")) { array[Mesh::ARRAY_BONES] = _decode_accessor_as_ints(state, a["JOINTS_0"], true); + } else if (a.has("JOINTS_0") && a.has("JOINTS_1")) { + PackedInt32Array joints_0 = _decode_accessor_as_ints(state, a["JOINTS_0"], true); + PackedInt32Array joints_1 = _decode_accessor_as_ints(state, a["JOINTS_1"], true); + ERR_FAIL_COND_V(joints_0.size() != joints_0.size(), ERR_INVALID_DATA); + int32_t weight_8_count = JOINT_GROUP_SIZE * 2; + int32_t vertex_count = joints_0.size() / JOINT_GROUP_SIZE; + Vector<int> joints; + joints.resize(vertex_count * weight_8_count); + for (int32_t vertex_i = 0; vertex_i < vertex_count; vertex_i++) { + joints.write[vertex_i * weight_8_count + 0] = joints_0[vertex_i * JOINT_GROUP_SIZE + 0]; + joints.write[vertex_i * weight_8_count + 1] = joints_0[vertex_i * JOINT_GROUP_SIZE + 1]; + joints.write[vertex_i * weight_8_count + 2] = joints_0[vertex_i * JOINT_GROUP_SIZE + 2]; + joints.write[vertex_i * weight_8_count + 3] = joints_0[vertex_i * JOINT_GROUP_SIZE + 3]; + joints.write[vertex_i * weight_8_count + 4] = joints_1[vertex_i * JOINT_GROUP_SIZE + 0]; + joints.write[vertex_i * weight_8_count + 5] = joints_1[vertex_i * JOINT_GROUP_SIZE + 1]; + joints.write[vertex_i * weight_8_count + 6] = joints_1[vertex_i * JOINT_GROUP_SIZE + 2]; + joints.write[vertex_i * weight_8_count + 7] = joints_1[vertex_i * JOINT_GROUP_SIZE + 3]; + } + array[Mesh::ARRAY_BONES] = joints; } - if (a.has("WEIGHTS_0")) { + if (a.has("WEIGHTS_0") && !a.has("WEIGHTS_1")) { Vector<float> weights = _decode_accessor_as_floats(state, a["WEIGHTS_0"], true); { //gltf does not seem to normalize the weights for some reason.. int wc = weights.size(); @@ -2452,6 +2522,51 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> state) { } } array[Mesh::ARRAY_WEIGHTS] = weights; + } else if (a.has("WEIGHTS_0") && a.has("WEIGHTS_1")) { + Vector<float> weights_0 = _decode_accessor_as_floats(state, a["WEIGHTS_0"], true); + Vector<float> weights_1 = _decode_accessor_as_floats(state, a["WEIGHTS_1"], true); + Vector<float> weights; + ERR_FAIL_COND_V(weights_0.size() != weights_1.size(), ERR_INVALID_DATA); + int32_t weight_8_count = JOINT_GROUP_SIZE * 2; + int32_t vertex_count = weights_0.size() / JOINT_GROUP_SIZE; + weights.resize(vertex_count * weight_8_count); + for (int32_t vertex_i = 0; vertex_i < vertex_count; vertex_i++) { + weights.write[vertex_i * weight_8_count + 0] = weights_0[vertex_i * JOINT_GROUP_SIZE + 0]; + weights.write[vertex_i * weight_8_count + 1] = weights_0[vertex_i * JOINT_GROUP_SIZE + 1]; + weights.write[vertex_i * weight_8_count + 2] = weights_0[vertex_i * JOINT_GROUP_SIZE + 2]; + weights.write[vertex_i * weight_8_count + 3] = weights_0[vertex_i * JOINT_GROUP_SIZE + 3]; + weights.write[vertex_i * weight_8_count + 4] = weights_1[vertex_i * JOINT_GROUP_SIZE + 0]; + weights.write[vertex_i * weight_8_count + 5] = weights_1[vertex_i * JOINT_GROUP_SIZE + 1]; + weights.write[vertex_i * weight_8_count + 6] = weights_1[vertex_i * JOINT_GROUP_SIZE + 2]; + weights.write[vertex_i * weight_8_count + 7] = weights_1[vertex_i * JOINT_GROUP_SIZE + 3]; + } + { //gltf does not seem to normalize the weights for some reason.. + int wc = weights.size(); + float *w = weights.ptrw(); + + for (int k = 0; k < wc; k += weight_8_count) { + float total = 0.0; + total += w[k + 0]; + total += w[k + 1]; + total += w[k + 2]; + total += w[k + 3]; + total += w[k + 4]; + total += w[k + 5]; + total += w[k + 6]; + total += w[k + 7]; + if (total > 0.0) { + w[k + 0] /= total; + w[k + 1] /= total; + w[k + 2] /= total; + w[k + 3] /= total; + w[k + 4] /= total; + w[k + 5] /= total; + w[k + 6] /= total; + w[k + 7] /= total; + } + } + } + array[Mesh::ARRAY_WEIGHTS] = weights; } if (p.has("indices")) { @@ -2492,6 +2607,9 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> state) { //must generate mikktspace tangents.. ergh.. Ref<SurfaceTool> st; st.instance(); + if (a.has("JOINTS_0") && a.has("JOINTS_1")) { + st->set_skin_weight_count(SurfaceTool::SKIN_8_WEIGHTS); + } st->create_from_triangle_arrays(array); st->generate_tangents(); array = st->commit_to_arrays(); @@ -2608,6 +2726,9 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> state) { if (generate_tangents) { Ref<SurfaceTool> st; st.instance(); + if (a.has("JOINTS_0") && a.has("JOINTS_1")) { + st->set_skin_weight_count(SurfaceTool::SKIN_8_WEIGHTS); + } st->create_from_triangle_arrays(array_copy); st->deindex(); st->generate_tangents(); @@ -2649,6 +2770,9 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> state) { if (d.has("weights")) { const Array &weights = d["weights"]; for (int j = 0; j < weights.size(); j++) { + if (j >= blend_weights.size()) { + break; + } blend_weights.write[j] = weights[j]; } mesh->set_blend_weights(blend_weights); diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h index 0f4772cd26..6f9f46872e 100644 --- a/modules/gltf/gltf_document.h +++ b/modules/gltf/gltf_document.h @@ -71,6 +71,7 @@ class GLTFDocument : public Resource { friend class GLTFSkeleton; public: + const int32_t JOINT_GROUP_SIZE = 4; enum GLTFType { TYPE_SCALAR, TYPE_VEC2, diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 41cff4bc74..e1f9180992 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -240,6 +240,9 @@ static const LauncherIcon launcher_adaptive_icon_backgrounds[icon_densities_coun { "res/mipmap/icon_background.png", 432 } }; +static const int EXPORT_FORMAT_APK = 0; +static const int EXPORT_FORMAT_AAB = 1; + class EditorExportPlatformAndroid : public EditorExportPlatform { GDCLASS(EditorExportPlatformAndroid, EditorExportPlatform); @@ -1613,7 +1616,7 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.apk"), "")); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "custom_template/use_custom_build"), false)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "custom_template/export_format", PROPERTY_HINT_ENUM, "Export APK,Export AAB"), 0)); + r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "custom_template/export_format", PROPERTY_HINT_ENUM, "Export APK,Export AAB"), EXPORT_FORMAT_APK)); Vector<PluginConfig> plugins_configs = get_plugins(); for (int i = 0; i < plugins_configs.size(); i++) { @@ -1772,7 +1775,7 @@ public: } // Export to temporary APK before sending to device. - Error err = export_project(p_preset, true, tmp_export_path, p_debug_flags); + Error err = export_project_helper(p_preset, true, tmp_export_path, EXPORT_FORMAT_APK, true, p_debug_flags); if (err != OK) { CLEANUP_AND_RETURN(err); @@ -2050,7 +2053,7 @@ public: } } - if (int(p_preset->get("custom_template/export_format")) == 1 && /*AAB*/ + if (int(p_preset->get("custom_template/export_format")) == EXPORT_FORMAT_AAB && !bool(p_preset->get("custom_template/use_custom_build"))) { valid = false; err += TTR("\"Export AAB\" is only valid when \"Use Custom Build\" is enabled."); @@ -2170,7 +2173,7 @@ public: Error sign_apk(const Ref<EditorExportPreset> &p_preset, bool p_debug, String export_path, EditorProgress ep) { int export_format = int(p_preset->get("custom_template/export_format")); - String export_label = export_format == 1 ? "AAB" : "APK"; + String export_label = export_format == EXPORT_FORMAT_AAB ? "AAB" : "APK"; String release_keystore = p_preset->get("keystore/release"); String release_username = p_preset->get("keystore/release_user"); String release_password = p_preset->get("keystore/release_password"); @@ -2267,6 +2270,12 @@ public: } virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override { + int export_format = int(p_preset->get("custom_template/export_format")); + bool should_sign = p_preset->get("package/signed"); + return export_project_helper(p_preset, p_debug, p_path, export_format, should_sign, p_flags); + } + + Error export_project_helper(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int export_format, bool should_sign, int p_flags) { ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags); String src_apk; @@ -2275,9 +2284,7 @@ public: EditorProgress ep("export", "Exporting for Android", 105, true); bool use_custom_build = bool(p_preset->get("custom_template/use_custom_build")); - int export_format = int(p_preset->get("custom_template/export_format")); bool p_give_internet = p_flags & (DEBUG_FLAG_DUMB_CLIENT | DEBUG_FLAG_REMOTE_DEBUG); - bool _signed = p_preset->get("package/signed"); bool apk_expansion = p_preset->get("apk_expansion/enable"); Vector<String> enabled_abis = get_enabled_abis(p_preset); @@ -2295,7 +2302,7 @@ public: // Write command line flags into the command_line_flags variable. get_command_line_flags(p_preset, p_path, p_flags, command_line_flags); - if (export_format == 1) { + if (export_format == EXPORT_FORMAT_AAB) { if (!p_path.ends_with(".aab")) { EditorNode::get_singleton()->show_warning(TTR("Invalid filename! Android App Bundle requires the *.aab extension.")); return ERR_UNCONFIGURED; @@ -2305,12 +2312,12 @@ public: return ERR_UNCONFIGURED; } } - if (export_format == 0 && !p_path.ends_with(".apk")) { + if (export_format == EXPORT_FORMAT_APK && !p_path.ends_with(".apk")) { EditorNode::get_singleton()->show_warning( TTR("Invalid filename! Android APK requires the *.apk extension.")); return ERR_UNCONFIGURED; } - if (export_format > 1 || export_format < 0) { + if (export_format > EXPORT_FORMAT_AAB || export_format < EXPORT_FORMAT_APK) { EditorNode::add_io_error("Unsupported export format!\n"); return ERR_UNCONFIGURED; //TODO: is this the right error? } @@ -2377,7 +2384,7 @@ public: String version_code = itos(p_preset->get("version/code")); String version_name = p_preset->get("version/name"); String enabled_abi_string = String("|").join(enabled_abis); - String sign_flag = _signed ? "true" : "false"; + String sign_flag = should_sign ? "true" : "false"; String zipalign_flag = "true"; Vector<PluginConfig> enabled_plugins = get_enabled_plugins(p_preset); @@ -2392,10 +2399,10 @@ public: } String build_type = p_debug ? "Debug" : "Release"; - if (export_format == 1) { + if (export_format == EXPORT_FORMAT_AAB) { String bundle_build_command = vformat("bundle%s", build_type); cmdline.push_back(bundle_build_command); - } else if (export_format == 0) { + } else if (export_format == EXPORT_FORMAT_APK) { String apk_build_command = vformat("assemble%s", build_type); cmdline.push_back(apk_build_command); } @@ -2409,7 +2416,7 @@ public: cmdline.push_back("-Pplugins_maven_repos=" + custom_maven_repos); // argument to specify the list of custom maven repos for the plugins dependencies. cmdline.push_back("-Pperform_zipalign=" + zipalign_flag); // argument to specify whether the build should be zipaligned. cmdline.push_back("-Pperform_signing=" + sign_flag); // argument to specify whether the build should be signed. - if (_signed && !p_debug) { + if (should_sign && !p_debug) { // Pass the release keystore info as well String release_keystore = p_preset->get("keystore/release"); String release_username = p_preset->get("keystore/release_user"); @@ -2434,9 +2441,9 @@ public: List<String> copy_args; String copy_command; - if (export_format == 1) { + if (export_format == EXPORT_FORMAT_AAB) { copy_command = vformat("copyAndRename%sAab", build_type); - } else if (export_format == 0) { + } else if (export_format == EXPORT_FORMAT_APK) { copy_command = vformat("copyAndRename%sApk", build_type); } @@ -2590,7 +2597,7 @@ public: } } - if (file.begins_with("META-INF") && _signed) { + if (file.begins_with("META-INF") && should_sign) { skip = true; } @@ -2678,7 +2685,7 @@ public: CLEANUP_AND_RETURN(err); } - if (_signed) { + if (should_sign) { err = sign_apk(p_preset, p_debug, tmp_unaligned_path, ep); if (err != OK) { CLEANUP_AND_RETURN(err); diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index e9bfb7ecf5..f5e4a187df 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -865,8 +865,22 @@ Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surfa ERR_FAIL_V(ERR_INVALID_DATA); } break; } - ERR_FAIL_COND_V(array_len == 0, ERR_INVALID_DATA); + } else if (i == RS::ARRAY_BONES) { + switch (p_arrays[i].get_type()) { + case Variant::PACKED_INT32_ARRAY: { + Vector<Vector3> vertexes = p_arrays[RS::ARRAY_VERTEX]; + Vector<int32_t> bones = p_arrays[i]; + int32_t bone_8_group_count = bones.size() / (ARRAY_WEIGHTS_SIZE * 2); + int32_t vertex_count = vertexes.size(); + if (vertex_count == bone_8_group_count) { + format |= RS::ARRAY_FLAG_USE_8_BONE_WEIGHTS; + } + } break; + default: { + ERR_FAIL_V(ERR_INVALID_DATA); + } break; + } } else if (i == RS::ARRAY_INDEX) { index_array_len = PackedInt32Array(p_arrays[i]).size(); } diff --git a/tests/SCsub b/tests/SCsub index 7aab28531d..0f3c14f0bd 100644 --- a/tests/SCsub +++ b/tests/SCsub @@ -17,6 +17,11 @@ if env["module_gdnative_enabled"]: if env_tests["platform"] == "windows": env_tests.Append(CPPDEFINES=[("DOCTEST_THREAD_LOCAL", "")]) +# Increase number of addressable sections in object files +# due to doctest's heavy use of templates and macros. +if env_tests.msvc: + env_tests.Append(CCFLAGS=["/bigobj"]) + env_tests.add_source_files(env.tests_sources, "*.cpp") lib = env_tests.add_library("tests", env.tests_sources) diff --git a/thirdparty/README.md b/thirdparty/README.md index 1a325f7111..dd937dcfec 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -22,7 +22,7 @@ Files extracted from upstream source: ## bullet - Upstream: https://github.com/bulletphysics/bullet3 -- Version: 3.07 (e32fc59c88a3908876949c6f2665e8d091d987fa, 2020) +- Version: 3.08 (df09fd9ed37e365ceae884ca7f620b61607dae2e, 2020) - License: zlib Files extracted from upstream source: diff --git a/thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.cpp b/thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.cpp index bec8c6530d..7cb92fa3b4 100644 --- a/thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.cpp +++ b/thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.cpp @@ -125,7 +125,8 @@ btMultiBody::btMultiBody(int n_links, m_posVarCnt(0), m_useRK4(false), m_useGlobalVelocities(false), - m_internalNeedsJointFeedback(false) + m_internalNeedsJointFeedback(false), + m_kinematic_calculate_velocity(false) { m_cachedInertiaTopLeft.setValue(0, 0, 0, 0, 0, 0, 0, 0, 0); m_cachedInertiaTopRight.setValue(0, 0, 0, 0, 0, 0, 0, 0, 0); @@ -2381,7 +2382,7 @@ const char *btMultiBody::serialize(void *dataBuffer, class btSerializer *seriali void btMultiBody::saveKinematicState(btScalar timeStep) { //todo: clamp to some (user definable) safe minimum timestep, to limit maximum angular/linear velocities - if (timeStep != btScalar(0.)) + if (m_kinematic_calculate_velocity && timeStep != btScalar(0.)) { btVector3 linearVelocity, angularVelocity; btTransformUtil::calculateVelocity(getInterpolateBaseWorldTransform(), getBaseWorldTransform(), timeStep, linearVelocity, angularVelocity); diff --git a/thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.h b/thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.h index 25112a6805..5a3efc9414 100644 --- a/thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.h +++ b/thirdparty/bullet/BulletDynamics/Featherstone/btMultiBody.h @@ -823,6 +823,9 @@ private: ///the m_needsJointFeedback gets updated/computed during the stepVelocitiesMultiDof and it for internal usage only bool m_internalNeedsJointFeedback; + + //If enabled, calculate the velocity based on kinematic transform changes. Currently only implemented for the base. + bool m_kinematic_calculate_velocity; }; struct btMultiBodyLinkDoubleData diff --git a/thirdparty/bullet/LinearMath/btQuickprof.cpp b/thirdparty/bullet/LinearMath/btQuickprof.cpp index 86fd1d7812..33b51eb763 100644 --- a/thirdparty/bullet/LinearMath/btQuickprof.cpp +++ b/thirdparty/bullet/LinearMath/btQuickprof.cpp @@ -720,6 +720,9 @@ void btLeaveProfileZoneDefault() #define BT_HAVE_TLS 1 #elif __linux__ #define BT_HAVE_TLS 1 +#elif defined(__FreeBSD__) || defined(__NetBSD__) + // TODO: At the moment disabling purposely OpenBSD, albeit tls support exists but not fully functioning + #define BT_HAVE_TLS 1 #endif // __thread is broken on Andorid clang until r12b. See diff --git a/thirdparty/bullet/LinearMath/btScalar.h b/thirdparty/bullet/LinearMath/btScalar.h index 36b90cc944..0402146af1 100644 --- a/thirdparty/bullet/LinearMath/btScalar.h +++ b/thirdparty/bullet/LinearMath/btScalar.h @@ -25,7 +25,7 @@ subject to the following restrictions: #include <float.h> /* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/ -#define BT_BULLET_VERSION 307 +#define BT_BULLET_VERSION 308 inline int btGetVersion() { diff --git a/thirdparty/bullet/LinearMath/btSerializer.h b/thirdparty/bullet/LinearMath/btSerializer.h index 9abcf031d0..4d1c760e24 100644 --- a/thirdparty/bullet/LinearMath/btSerializer.h +++ b/thirdparty/bullet/LinearMath/btSerializer.h @@ -481,7 +481,7 @@ public: buffer[9] = '3'; buffer[10] = '0'; - buffer[11] = '7'; + buffer[11] = '8'; } virtual void startSerialization() |