mirror of
https://github.com/godotengine/godot.git
synced 2024-11-23 12:43:43 +00:00
Style: Apply clang-tidy
fixes (superficial)
• `modernize-use-bool-literals`, `modernize-use-nullptr`, and `readability-braces-around-statements`
This commit is contained in:
parent
89a311205f
commit
bb5f390fb9
@ -1034,7 +1034,7 @@ void Input::action_release(const StringName &p_action) {
|
||||
|
||||
// Create or retrieve existing action.
|
||||
ActionState &action_state = action_states[p_action];
|
||||
action_state.cache.pressed = 0;
|
||||
action_state.cache.pressed = false;
|
||||
action_state.cache.strength = 0.0;
|
||||
action_state.cache.raw_strength = 0.0;
|
||||
// As input may come in part way through a physics tick, the earliest we can react to it is the next physics tick.
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
bool is_flushing() const;
|
||||
int get_max_buffer_usage() const;
|
||||
|
||||
CallQueue(Allocator *p_custom_allocator = 0, uint32_t p_max_pages = 8192, const String &p_error_text = String());
|
||||
CallQueue(Allocator *p_custom_allocator = nullptr, uint32_t p_max_pages = 8192, const String &p_error_text = String());
|
||||
virtual ~CallQueue();
|
||||
};
|
||||
|
||||
|
@ -396,7 +396,7 @@ public:
|
||||
|
||||
_FORCE_INLINE_ bool particles_has_collision(RID p_particles) {
|
||||
Particles *particles = particles_owner.get_or_null(p_particles);
|
||||
ERR_FAIL_NULL_V(particles, 0);
|
||||
ERR_FAIL_NULL_V(particles, false);
|
||||
|
||||
return particles->has_collision_cache;
|
||||
}
|
||||
|
@ -1519,7 +1519,7 @@ RDD::BufferID RenderingDeviceDriverVulkan::buffer_create(uint64_t p_size, BitFie
|
||||
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't create buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
|
||||
err = vmaAllocateMemoryForBuffer(allocator, vk_buffer, &alloc_create_info, &allocation, &alloc_info);
|
||||
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't allocate memory for buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
|
||||
err = vmaBindBufferMemory2(allocator, allocation, 0, vk_buffer, NULL);
|
||||
err = vmaBindBufferMemory2(allocator, allocation, 0, vk_buffer, nullptr);
|
||||
ERR_FAIL_COND_V_MSG(err, BufferID(), "Can't bind memory to buffer of size: " + itos(p_size) + ", error " + itos(err) + ".");
|
||||
|
||||
// Bookkeep.
|
||||
@ -1745,7 +1745,7 @@ RDD::TextureID RenderingDeviceDriverVulkan::texture_create(const TextureFormat &
|
||||
ERR_FAIL_COND_V_MSG(err, TextureID(), "vkCreateImage failed with error " + itos(err) + ".");
|
||||
err = vmaAllocateMemoryForImage(allocator, vk_image, &alloc_create_info, &allocation, &alloc_info);
|
||||
ERR_FAIL_COND_V_MSG(err, TextureID(), "Can't allocate memory for image, error: " + itos(err) + ".");
|
||||
err = vmaBindImageMemory2(allocator, allocation, 0, vk_image, NULL);
|
||||
err = vmaBindImageMemory2(allocator, allocation, 0, vk_image, nullptr);
|
||||
ERR_FAIL_COND_V_MSG(err, TextureID(), "Can't bind memory to image, error: " + itos(err) + ".");
|
||||
|
||||
// Create view.
|
||||
|
@ -282,7 +282,7 @@ Error DirAccessWindows::rename(String p_path, String p_new_path) {
|
||||
uint64_t id = OS::get_singleton()->get_ticks_usec();
|
||||
while (true) {
|
||||
tmpfile_utf16 = (path + itos(id++) + ".tmp").utf16();
|
||||
HANDLE handle = CreateFileW((LPCWSTR)tmpfile_utf16.get_data(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
HANDLE handle = CreateFileW((LPCWSTR)tmpfile_utf16.get_data(), GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (handle != INVALID_HANDLE_VALUE) {
|
||||
CloseHandle(handle);
|
||||
break;
|
||||
|
@ -193,7 +193,7 @@ Error FileAccessWindows::open_internal(const String &p_path, int p_mode_flags) {
|
||||
uint64_t id = OS::get_singleton()->get_ticks_usec();
|
||||
while (true) {
|
||||
tmpfile = path + itos(id++) + ".tmp";
|
||||
HANDLE handle = CreateFileW((LPCWSTR)tmpfile.utf16().get_data(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
HANDLE handle = CreateFileW((LPCWSTR)tmpfile.utf16().get_data(), GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (handle != INVALID_HANDLE_VALUE) {
|
||||
CloseHandle(handle);
|
||||
break;
|
||||
|
@ -40,7 +40,7 @@ Error FileAccessWindowsPipe::open_existing(HANDLE p_rfd, HANDLE p_wfd, bool p_bl
|
||||
_close();
|
||||
|
||||
path_src = String();
|
||||
ERR_FAIL_COND_V_MSG(fd[0] != 0 || fd[1] != 0, ERR_ALREADY_IN_USE, "Pipe is already in use.");
|
||||
ERR_FAIL_COND_V_MSG(fd[0] != nullptr || fd[1] != nullptr, ERR_ALREADY_IN_USE, "Pipe is already in use.");
|
||||
fd[0] = p_rfd;
|
||||
fd[1] = p_wfd;
|
||||
|
||||
@ -58,18 +58,18 @@ Error FileAccessWindowsPipe::open_internal(const String &p_path, int p_mode_flag
|
||||
_close();
|
||||
|
||||
path_src = p_path;
|
||||
ERR_FAIL_COND_V_MSG(fd[0] != 0 || fd[1] != 0, ERR_ALREADY_IN_USE, "Pipe is already in use.");
|
||||
ERR_FAIL_COND_V_MSG(fd[0] != nullptr || fd[1] != nullptr, ERR_ALREADY_IN_USE, "Pipe is already in use.");
|
||||
|
||||
path = String("\\\\.\\pipe\\LOCAL\\") + p_path.replace("pipe://", "").replace("/", "_");
|
||||
|
||||
HANDLE h = CreateFileW((LPCWSTR)path.utf16().get_data(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE h = CreateFileW((LPCWSTR)path.utf16().get_data(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
h = CreateNamedPipeW((LPCWSTR)path.utf16().get_data(), PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 4096, 4096, 0, nullptr);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
last_error = ERR_FILE_CANT_OPEN;
|
||||
return last_error;
|
||||
}
|
||||
ConnectNamedPipe(h, NULL);
|
||||
ConnectNamedPipe(h, nullptr);
|
||||
}
|
||||
fd[0] = h;
|
||||
fd[1] = h;
|
||||
@ -79,19 +79,19 @@ Error FileAccessWindowsPipe::open_internal(const String &p_path, int p_mode_flag
|
||||
}
|
||||
|
||||
void FileAccessWindowsPipe::_close() {
|
||||
if (fd[0] == 0) {
|
||||
if (fd[0] == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (fd[1] != fd[0]) {
|
||||
CloseHandle(fd[1]);
|
||||
}
|
||||
CloseHandle(fd[0]);
|
||||
fd[0] = 0;
|
||||
fd[1] = 0;
|
||||
fd[0] = nullptr;
|
||||
fd[1] = nullptr;
|
||||
}
|
||||
|
||||
bool FileAccessWindowsPipe::is_open() const {
|
||||
return (fd[0] != 0 || fd[1] != 0);
|
||||
return (fd[0] != nullptr || fd[1] != nullptr);
|
||||
}
|
||||
|
||||
String FileAccessWindowsPipe::get_path() const {
|
||||
@ -103,7 +103,7 @@ String FileAccessWindowsPipe::get_path_absolute() const {
|
||||
}
|
||||
|
||||
uint64_t FileAccessWindowsPipe::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
|
||||
ERR_FAIL_COND_V_MSG(fd[0] == 0, -1, "Pipe must be opened before use.");
|
||||
ERR_FAIL_COND_V_MSG(fd[0] == nullptr, -1, "Pipe must be opened before use.");
|
||||
ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
|
||||
|
||||
DWORD read = 0;
|
||||
@ -120,7 +120,7 @@ Error FileAccessWindowsPipe::get_error() const {
|
||||
}
|
||||
|
||||
void FileAccessWindowsPipe::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
ERR_FAIL_COND_MSG(fd[1] == 0, "Pipe must be opened before use.");
|
||||
ERR_FAIL_COND_MSG(fd[1] == nullptr, "Pipe must be opened before use.");
|
||||
ERR_FAIL_COND(!p_src && p_length > 0);
|
||||
|
||||
DWORD read = -1;
|
||||
|
@ -39,7 +39,7 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
class FileAccessWindowsPipe : public FileAccess {
|
||||
HANDLE fd[2] = { 0, 0 };
|
||||
HANDLE fd[2] = { nullptr, nullptr };
|
||||
|
||||
mutable Error last_error = OK;
|
||||
|
||||
|
@ -6337,8 +6337,9 @@ bool AnimationTrackEditor::_is_track_compatible(int p_target_track_idx, Variant:
|
||||
}
|
||||
|
||||
if (path_valid) {
|
||||
if (is_source_bezier)
|
||||
if (is_source_bezier) {
|
||||
p_source_value_type = Variant::FLOAT;
|
||||
}
|
||||
return property_type == p_source_value_type;
|
||||
} else {
|
||||
if (animation->track_get_key_count(p_target_track_idx) > 0) {
|
||||
|
@ -859,7 +859,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
|
||||
|
||||
// 4-1. Guess Finger
|
||||
int tips_index = -1;
|
||||
bool thumb_tips_size = 0;
|
||||
bool thumb_tips_size = false;
|
||||
bool named_finger_is_found = false;
|
||||
LocalVector<String> fingers;
|
||||
fingers.push_back("thumb|pollex");
|
||||
@ -994,7 +994,7 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
|
||||
}
|
||||
|
||||
tips_index = -1;
|
||||
thumb_tips_size = 0;
|
||||
thumb_tips_size = false;
|
||||
named_finger_is_found = false;
|
||||
if (right_hand_or_palm != -1) {
|
||||
LocalVector<LocalVector<String>> right_fingers_map;
|
||||
|
@ -470,7 +470,7 @@ void EditorPropertyOTVariation::update_property() {
|
||||
Vector3i range = supported.get_value_at_index(i);
|
||||
|
||||
EditorPropertyInteger *prop = memnew(EditorPropertyInteger);
|
||||
prop->setup(range.x, range.y, false, 1, false, false);
|
||||
prop->setup(range.x, range.y, false, true, false, false);
|
||||
prop->set_object_and_property(object.ptr(), "keys/" + itos(name_tag));
|
||||
|
||||
String name = TS->tag_to_name(name_tag);
|
||||
|
@ -1550,6 +1550,7 @@ int TileMapLayerEditorTilesPlugin::_get_transformed_alternative(int p_alternativ
|
||||
case TRANSFORM_ROTATE_RIGHT: {
|
||||
// A matrix with every possible flip/transpose combination, sorted by what comes next when you rotate.
|
||||
const LocalVector<bool> rotation_matrix = {
|
||||
// NOLINTBEGIN(modernize-use-bool-literals)
|
||||
0, 0, 0,
|
||||
0, 1, 1,
|
||||
1, 1, 0,
|
||||
@ -1558,6 +1559,7 @@ int TileMapLayerEditorTilesPlugin::_get_transformed_alternative(int p_alternativ
|
||||
0, 0, 1,
|
||||
0, 1, 0,
|
||||
1, 1, 1
|
||||
// NOLINTEND(modernize-use-bool-literals)
|
||||
};
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
|
@ -716,8 +716,9 @@ Vector<String> ProjectConverter3To4::check_for_files() {
|
||||
directories_to_check.append(current_dir.path_join(file_name) + "/");
|
||||
} else {
|
||||
bool proper_extension = false;
|
||||
if (file_name.ends_with(".gd") || file_name.ends_with(".shader") || file_name.ends_with(".gdshader") || file_name.ends_with(".tscn") || file_name.ends_with(".tres") || file_name.ends_with(".godot") || file_name.ends_with(".cs") || file_name.ends_with(".csproj") || file_name.ends_with(".import"))
|
||||
if (file_name.ends_with(".gd") || file_name.ends_with(".shader") || file_name.ends_with(".gdshader") || file_name.ends_with(".tscn") || file_name.ends_with(".tres") || file_name.ends_with(".godot") || file_name.ends_with(".cs") || file_name.ends_with(".csproj") || file_name.ends_with(".import")) {
|
||||
proper_extension = true;
|
||||
}
|
||||
|
||||
if (proper_extension) {
|
||||
collected_files.append(current_dir.path_join(file_name));
|
||||
@ -1321,8 +1322,9 @@ Vector<String> ProjectConverter3To4::parse_arguments(const String &line) {
|
||||
break;
|
||||
};
|
||||
case '"': {
|
||||
if (previous_character != '\\')
|
||||
if (previous_character != '\\') {
|
||||
is_inside_string = !is_inside_string;
|
||||
}
|
||||
}
|
||||
}
|
||||
previous_character = character;
|
||||
|
@ -145,7 +145,7 @@ bool CameraFeedLinux::_request_buffers() {
|
||||
}
|
||||
|
||||
buffers[i].length = buffer.length;
|
||||
buffers[i].start = mmap(NULL, buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, file_descriptor, buffer.m.offset);
|
||||
buffers[i].start = mmap(nullptr, buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, file_descriptor, buffer.m.offset);
|
||||
|
||||
if (buffers[i].start == MAP_FAILED) {
|
||||
for (unsigned int b = 0; b < i; b++) {
|
||||
|
@ -369,21 +369,25 @@ Error FBXDocument::_parse_nodes(Ref<FBXState> p_state) {
|
||||
// all skin clusters connected to the bone.
|
||||
for (const ufbx_connection &child_conn : fbx_node->element.connections_src) {
|
||||
ufbx_skin_cluster *child_cluster = ufbx_as_skin_cluster(child_conn.dst);
|
||||
if (!child_cluster)
|
||||
if (!child_cluster) {
|
||||
continue;
|
||||
}
|
||||
ufbx_skin_deformer *child_deformer = _find_skin_deformer(child_cluster);
|
||||
if (!child_deformer)
|
||||
if (!child_deformer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Found a skin cluster: Now iterate through all the skin clusters of the parent and
|
||||
// try to find one that used by the same deformer.
|
||||
for (const ufbx_connection &parent_conn : fbx_node->parent->element.connections_src) {
|
||||
ufbx_skin_cluster *parent_cluster = ufbx_as_skin_cluster(parent_conn.dst);
|
||||
if (!parent_cluster)
|
||||
if (!parent_cluster) {
|
||||
continue;
|
||||
}
|
||||
ufbx_skin_deformer *parent_deformer = _find_skin_deformer(parent_cluster);
|
||||
if (parent_deformer != child_deformer)
|
||||
if (parent_deformer != child_deformer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Success: Found two skin clusters from the same deformer, now we can resolve the
|
||||
// local bind pose from the difference between the two world-space bind poses.
|
||||
|
@ -790,8 +790,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
||||
text += method->get_name();
|
||||
text += "(";
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
@ -833,8 +834,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
|
||||
text += method->get_name();
|
||||
text += "(";
|
||||
for (int i = 0; i < argc; i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
text += ", ";
|
||||
}
|
||||
text += DADDR(1 + i);
|
||||
}
|
||||
text += ")";
|
||||
|
@ -311,7 +311,7 @@ bool GodotPinJoint2D::get_flag(PhysicsServer2D::PinJointFlag p_flag) const {
|
||||
return motor_enabled;
|
||||
}
|
||||
}
|
||||
ERR_FAIL_V(0);
|
||||
ERR_FAIL_V(false);
|
||||
}
|
||||
|
||||
GodotPinJoint2D::GodotPinJoint2D(const Vector2 &p_pos, GodotBody2D *p_body_a, GodotBody2D *p_body_b) :
|
||||
|
@ -1169,8 +1169,8 @@ void GodotPhysicsServer2D::pin_joint_set_flag(RID p_joint, PinJointFlag p_flag,
|
||||
|
||||
bool GodotPhysicsServer2D::pin_joint_get_flag(RID p_joint, PinJointFlag p_flag) const {
|
||||
GodotJoint2D *joint = joint_owner.get_or_null(p_joint);
|
||||
ERR_FAIL_NULL_V(joint, 0);
|
||||
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_PIN, 0);
|
||||
ERR_FAIL_NULL_V(joint, false);
|
||||
ERR_FAIL_COND_V(joint->get_type() != JOINT_TYPE_PIN, false);
|
||||
|
||||
GodotPinJoint2D *pin_joint = static_cast<GodotPinJoint2D *>(joint);
|
||||
return pin_joint->get_flag(p_flag);
|
||||
|
@ -342,7 +342,7 @@ bool GodotPhysicsDirectSpaceState2D::collide_shape(const ShapeParameters &p_para
|
||||
}
|
||||
|
||||
GodotShape2D *shape = GodotPhysicsServer2D::godot_singleton->shape_owner.get_or_null(p_parameters.shape_rid);
|
||||
ERR_FAIL_NULL_V(shape, 0);
|
||||
ERR_FAIL_NULL_V(shape, false);
|
||||
|
||||
Rect2 aabb = p_parameters.transform.xform(shape->get_aabb());
|
||||
aabb = aabb.merge(Rect2(aabb.position + p_parameters.motion, aabb.size)); //motion
|
||||
@ -439,7 +439,7 @@ static void _rest_cbk_result(const Vector2 &p_point_A, const Vector2 &p_point_B,
|
||||
|
||||
bool GodotPhysicsDirectSpaceState2D::rest_info(const ShapeParameters &p_parameters, ShapeRestInfo *r_info) {
|
||||
GodotShape2D *shape = GodotPhysicsServer2D::godot_singleton->shape_owner.get_or_null(p_parameters.shape_rid);
|
||||
ERR_FAIL_NULL_V(shape, 0);
|
||||
ERR_FAIL_NULL_V(shape, false);
|
||||
|
||||
real_t margin = MAX(p_parameters.margin, TEST_MOTION_MARGIN_MIN_VALUE);
|
||||
|
||||
|
@ -76,8 +76,9 @@ struct _CollectorCallback {
|
||||
Vector3 *prev_axis = nullptr;
|
||||
|
||||
_FORCE_INLINE_ void call(const Vector3 &p_point_A, const Vector3 &p_point_B, Vector3 p_normal) {
|
||||
if (p_normal.dot(p_point_B - p_point_A) < 0)
|
||||
if (p_normal.dot(p_point_B - p_point_A) < 0) {
|
||||
p_normal = -p_normal;
|
||||
}
|
||||
if (swap) {
|
||||
callback(p_point_B, 0, p_point_A, 0, -p_normal, userdata);
|
||||
} else {
|
||||
@ -175,10 +176,11 @@ static void _generate_contacts_edge_edge(const Vector3 *p_points_A, int p_point_
|
||||
// The normal should be perpendicular to both edges.
|
||||
Vector3 normal = rel_A.cross(rel_B);
|
||||
real_t normal_len = normal.length();
|
||||
if (normal_len > 1e-3)
|
||||
if (normal_len > 1e-3) {
|
||||
normal /= normal_len;
|
||||
else
|
||||
} else {
|
||||
normal = p_callback->normal;
|
||||
}
|
||||
p_callback->call(closest_A, closest_B, normal);
|
||||
}
|
||||
|
||||
@ -784,8 +786,9 @@ static void analytic_sphere_collision(const Vector3 &p_origin_a, real_t p_radius
|
||||
|
||||
// Calculate the sphere overlap, and bail if not overlapping
|
||||
real_t overlap = p_radius_a + p_radius_b - b_to_a_len;
|
||||
if (overlap < 0)
|
||||
if (overlap < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Report collision
|
||||
p_collector->collided = true;
|
||||
|
@ -826,7 +826,7 @@ void GodotPhysicsServer3D::body_set_axis_lock(RID p_body, BodyAxis p_axis, bool
|
||||
|
||||
bool GodotPhysicsServer3D::body_is_axis_locked(RID p_body, BodyAxis p_axis) const {
|
||||
const GodotBody3D *body = body_owner.get_or_null(p_body);
|
||||
ERR_FAIL_NULL_V(body, 0);
|
||||
ERR_FAIL_NULL_V(body, false);
|
||||
return body->is_axis_locked(p_axis);
|
||||
}
|
||||
|
||||
|
@ -1133,8 +1133,9 @@ void GodotConvexPolygonShape3D::_setup(const Vector<Vector3> &p_vertices) {
|
||||
max_support = s;
|
||||
}
|
||||
}
|
||||
if (!extreme_vertices.has(best_vertex))
|
||||
if (!extreme_vertices.has(best_vertex)) {
|
||||
extreme_vertices.push_back(best_vertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ bool GodotPhysicsDirectSpaceState3D::collide_shape(const ShapeParameters &p_para
|
||||
}
|
||||
|
||||
GodotShape3D *shape = GodotPhysicsServer3D::godot_singleton->shape_owner.get_or_null(p_parameters.shape_rid);
|
||||
ERR_FAIL_NULL_V(shape, 0);
|
||||
ERR_FAIL_NULL_V(shape, false);
|
||||
|
||||
AABB aabb = p_parameters.transform.xform(shape->get_aabb());
|
||||
aabb = aabb.grow(p_parameters.margin);
|
||||
@ -511,7 +511,7 @@ static void _rest_cbk_result(const Vector3 &p_point_A, int p_index_A, const Vect
|
||||
|
||||
bool GodotPhysicsDirectSpaceState3D::rest_info(const ShapeParameters &p_parameters, ShapeRestInfo *r_info) {
|
||||
GodotShape3D *shape = GodotPhysicsServer3D::godot_singleton->shape_owner.get_or_null(p_parameters.shape_rid);
|
||||
ERR_FAIL_NULL_V(shape, 0);
|
||||
ERR_FAIL_NULL_V(shape, false);
|
||||
|
||||
real_t margin = MAX(p_parameters.margin, TEST_MOTION_MARGIN_MIN_VALUE);
|
||||
|
||||
|
@ -647,7 +647,7 @@ void GodotGeneric6DOFJoint3D::set_flag(Vector3::Axis p_axis, PhysicsServer3D::G6
|
||||
}
|
||||
|
||||
bool GodotGeneric6DOFJoint3D::get_flag(Vector3::Axis p_axis, PhysicsServer3D::G6DOFJointAxisFlag p_flag) const {
|
||||
ERR_FAIL_INDEX_V(p_axis, 3, 0);
|
||||
ERR_FAIL_INDEX_V(p_axis, 3, false);
|
||||
switch (p_flag) {
|
||||
case PhysicsServer3D::G6DOF_JOINT_FLAG_ENABLE_LINEAR_LIMIT: {
|
||||
return m_linearLimits.enable_limit[p_axis];
|
||||
|
@ -341,7 +341,7 @@ XrCompositionLayerBaseHeader *OpenXRViewportCompositionLayerProvider::get_compos
|
||||
}
|
||||
|
||||
XrSwapchainSubImage subimage = {
|
||||
0, // swapchain
|
||||
0, // swapchain // NOLINT(modernize-use-nullptr) - 32-bit uses non-pointer uint64
|
||||
{ { 0, 0 }, { 0, 0 } }, // imageRect
|
||||
0, // imageArrayIndex
|
||||
};
|
||||
|
@ -173,7 +173,7 @@ void OpenXRDebugUtilsExtension::begin_debug_label_region(const char *p_label_nam
|
||||
|
||||
const XrDebugUtilsLabelEXT session_active_region_label = {
|
||||
XR_TYPE_DEBUG_UTILS_LABEL_EXT, // type
|
||||
NULL, // next
|
||||
nullptr, // next
|
||||
p_label_name, // labelName
|
||||
};
|
||||
|
||||
@ -199,7 +199,7 @@ void OpenXRDebugUtilsExtension::insert_debug_label(const char *p_label_name) {
|
||||
|
||||
const XrDebugUtilsLabelEXT session_active_region_label = {
|
||||
XR_TYPE_DEBUG_UTILS_LABEL_EXT, // type
|
||||
NULL, // next
|
||||
nullptr, // next
|
||||
p_label_name, // labelName
|
||||
};
|
||||
|
||||
|
@ -193,7 +193,7 @@ void *OpenXROpenGLExtension::set_session_create_and_get_next_pointer(void *p_nex
|
||||
|
||||
// spec says to use proper values but runtimes don't care
|
||||
graphics_binding_gl.visualid = 0;
|
||||
graphics_binding_gl.glxFBConfig = 0;
|
||||
graphics_binding_gl.glxFBConfig = nullptr;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -2752,8 +2752,9 @@ void OpenXRAPI::parse_velocities(const XrSpaceVelocity &p_velocity, Vector3 &r_l
|
||||
}
|
||||
|
||||
bool OpenXRAPI::xr_result(XrResult result, const char *format, Array args) const {
|
||||
if (XR_SUCCEEDED(result))
|
||||
if (XR_SUCCEEDED(result)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char resultString[XR_MAX_RESULT_STRING_SIZE];
|
||||
xrResultToString(instance, result, resultString);
|
||||
|
@ -115,7 +115,7 @@ void VideoStreamPlaybackTheora::video_write() {
|
||||
format = Image::FORMAT_RGBA8;
|
||||
}
|
||||
|
||||
Ref<Image> img = memnew(Image(size.x, size.y, 0, Image::FORMAT_RGBA8, frame_data)); //zero copy image creation
|
||||
Ref<Image> img = memnew(Image(size.x, size.y, false, Image::FORMAT_RGBA8, frame_data)); //zero copy image creation
|
||||
|
||||
texture->update(img); //zero copy send to rendering server
|
||||
|
||||
|
@ -149,7 +149,7 @@ Ref<Image> _webp_unpack(const Vector<uint8_t> &p_buffer) {
|
||||
|
||||
ERR_FAIL_COND_V_MSG(errdec, Ref<Image>(), "Failed decoding WebP image.");
|
||||
|
||||
Ref<Image> img = memnew(Image(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image));
|
||||
Ref<Image> img = memnew(Image(features.width, features.height, false, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image));
|
||||
return img;
|
||||
}
|
||||
|
||||
|
@ -771,11 +771,11 @@ Vector<String> OS_LinuxBSD::get_system_font_path_for_text(const String &p_font_n
|
||||
FcLangSetAdd(lang_set, reinterpret_cast<const FcChar8 *>(p_locale.utf8().get_data()));
|
||||
FcPatternAddLangSet(pattern, FC_LANG, lang_set);
|
||||
|
||||
FcConfigSubstitute(0, pattern, FcMatchPattern);
|
||||
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
|
||||
FcDefaultSubstitute(pattern);
|
||||
|
||||
FcResult result;
|
||||
FcPattern *match = FcFontMatch(0, pattern, &result);
|
||||
FcPattern *match = FcFontMatch(nullptr, pattern, &result);
|
||||
if (match) {
|
||||
char *file_name = nullptr;
|
||||
if (FcPatternGetString(match, FC_FILE, 0, reinterpret_cast<FcChar8 **>(&file_name)) == FcResultMatch) {
|
||||
@ -816,11 +816,11 @@ String OS_LinuxBSD::get_system_font_path(const String &p_font_name, int p_weight
|
||||
FcPatternAddInteger(pattern, FC_WIDTH, _stretch_to_fc(p_stretch));
|
||||
FcPatternAddInteger(pattern, FC_SLANT, p_italic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN);
|
||||
|
||||
FcConfigSubstitute(0, pattern, FcMatchPattern);
|
||||
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
|
||||
FcDefaultSubstitute(pattern);
|
||||
|
||||
FcResult result;
|
||||
FcPattern *match = FcFontMatch(0, pattern, &result);
|
||||
FcPattern *match = FcFontMatch(nullptr, pattern, &result);
|
||||
if (match) {
|
||||
if (!allow_substitutes) {
|
||||
char *family_name = nullptr;
|
||||
|
@ -159,7 +159,7 @@ extern void CrashHandlerException(int signal) {
|
||||
|
||||
// Load process and image info to determine ASLR addresses offset.
|
||||
MODULEINFO mi;
|
||||
GetModuleInformation(GetCurrentProcess(), GetModuleHandle(NULL), &mi, sizeof(mi));
|
||||
GetModuleInformation(GetCurrentProcess(), GetModuleHandle(nullptr), &mi, sizeof(mi));
|
||||
int64_t image_mem_base = reinterpret_cast<int64_t>(mi.lpBaseOfDll);
|
||||
int64_t image_file_base = get_image_base(_execpath);
|
||||
data.offset = image_mem_base - image_file_base;
|
||||
|
@ -735,7 +735,7 @@ Error DisplayServerWindows::_file_dialog_with_options_show(const String &p_title
|
||||
GetWindowRect(fd->hwnd_owner, &crect);
|
||||
fd->wrect = Rect2i(crect.left, crect.top, crect.right - crect.left, crect.bottom - crect.top);
|
||||
} else {
|
||||
fd->hwnd_owner = 0;
|
||||
fd->hwnd_owner = nullptr;
|
||||
fd->wrect = Rect2i(CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT);
|
||||
}
|
||||
fd->appid = appname;
|
||||
|
@ -122,8 +122,9 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
|
||||
memcmp(p_guid, &IID_XOneSWirelessGamepad, sizeof(*p_guid)) == 0 ||
|
||||
memcmp(p_guid, &IID_XOneSBluetoothGamepad, sizeof(*p_guid)) == 0 ||
|
||||
memcmp(p_guid, &IID_XOneEliteWirelessGamepad, sizeof(*p_guid)) == 0 ||
|
||||
memcmp(p_guid, &IID_XOneElite2WirelessGamepad, sizeof(*p_guid)) == 0)
|
||||
memcmp(p_guid, &IID_XOneElite2WirelessGamepad, sizeof(*p_guid)) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
PRAWINPUTDEVICELIST dev_list = nullptr;
|
||||
unsigned int dev_list_count = 0;
|
||||
|
@ -158,7 +158,7 @@ Size2 NativeMenuWindows::get_size(const RID &p_rid) const {
|
||||
int count = GetMenuItemCount(md->menu);
|
||||
for (int i = 0; i < count; i++) {
|
||||
RECT rect;
|
||||
if (GetMenuItemRect(NULL, md->menu, i, &rect)) {
|
||||
if (GetMenuItemRect(nullptr, md->menu, i, &rect)) {
|
||||
size.x = MAX(size.x, rect.right - rect.left);
|
||||
size.y += rect.bottom - rect.top;
|
||||
}
|
||||
@ -992,7 +992,7 @@ void NativeMenuWindows::set_item_submenu(const RID &p_rid, int p_idx, const RID
|
||||
if (p_submenu_rid.is_valid()) {
|
||||
item.hSubMenu = md_sub->menu;
|
||||
} else {
|
||||
item.hSubMenu = 0;
|
||||
item.hSubMenu = nullptr;
|
||||
}
|
||||
SetMenuItemInfoW(md->menu, p_idx, true, &item);
|
||||
}
|
||||
@ -1095,7 +1095,7 @@ void NativeMenuWindows::set_item_icon(const RID &p_rid, int p_idx, const Ref<Tex
|
||||
item_data->bmp = _make_bitmap(item_data->img);
|
||||
} else {
|
||||
item_data->img = Ref<Image>();
|
||||
item_data->bmp = 0;
|
||||
item_data->bmp = nullptr;
|
||||
}
|
||||
item.hbmpItem = item_data->bmp;
|
||||
SetMenuItemInfoW(md->menu, p_idx, true, &item);
|
||||
|
@ -139,13 +139,13 @@ void RedirectIOToConsole() {
|
||||
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
|
||||
// Restore redirection (Note: if not redirected it's NULL handles not INVALID_HANDLE_VALUE).
|
||||
if (h_stdin != 0) {
|
||||
if (h_stdin != nullptr) {
|
||||
SetStdHandle(STD_INPUT_HANDLE, h_stdin);
|
||||
}
|
||||
if (h_stdout != 0) {
|
||||
if (h_stdout != nullptr) {
|
||||
SetStdHandle(STD_OUTPUT_HANDLE, h_stdout);
|
||||
}
|
||||
if (h_stderr != 0) {
|
||||
if (h_stderr != nullptr) {
|
||||
SetStdHandle(STD_ERROR_HANDLE, h_stderr);
|
||||
}
|
||||
|
||||
@ -908,9 +908,9 @@ Dictionary OS_Windows::execute_with_pipe(const String &p_path, const List<String
|
||||
}
|
||||
|
||||
// Create pipes.
|
||||
HANDLE pipe_in[2] = { 0, 0 };
|
||||
HANDLE pipe_out[2] = { 0, 0 };
|
||||
HANDLE pipe_err[2] = { 0, 0 };
|
||||
HANDLE pipe_in[2] = { nullptr, nullptr };
|
||||
HANDLE pipe_out[2] = { nullptr, nullptr };
|
||||
HANDLE pipe_err[2] = { nullptr, nullptr };
|
||||
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
@ -981,7 +981,7 @@ Dictionary OS_Windows::execute_with_pipe(const String &p_path, const List<String
|
||||
|
||||
Ref<FileAccessWindowsPipe> err_pipe;
|
||||
err_pipe.instantiate();
|
||||
err_pipe->open_existing(pipe_err[0], 0, p_blocking);
|
||||
err_pipe->open_existing(pipe_err[0], nullptr, p_blocking);
|
||||
|
||||
ret["stdio"] = main_pipe;
|
||||
ret["stderr"] = err_pipe;
|
||||
|
@ -67,11 +67,11 @@ Error WindowsUtils::copy_and_rename_pdb(const String &p_dll_path) {
|
||||
{
|
||||
// The custom LoadLibraryExW is used instead of open_dynamic_library
|
||||
// to avoid loading the original PDB into the debugger.
|
||||
HMODULE library_ptr = LoadLibraryExW((LPCWSTR)(p_dll_path.utf16().get_data()), NULL, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE);
|
||||
HMODULE library_ptr = LoadLibraryExW((LPCWSTR)(p_dll_path.utf16().get_data()), nullptr, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE);
|
||||
|
||||
ERR_FAIL_NULL_V_MSG(library_ptr, ERR_FILE_CANT_OPEN, vformat("Failed to load library '%s'.", p_dll_path));
|
||||
|
||||
IMAGE_DEBUG_DIRECTORY *dbg_dir = (IMAGE_DEBUG_DIRECTORY *)ImageDirectoryEntryToDataEx(library_ptr, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &dbg_info_size, NULL);
|
||||
IMAGE_DEBUG_DIRECTORY *dbg_dir = (IMAGE_DEBUG_DIRECTORY *)ImageDirectoryEntryToDataEx(library_ptr, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &dbg_info_size, nullptr);
|
||||
|
||||
bool has_debug = dbg_dir && dbg_dir->Type == IMAGE_DEBUG_TYPE_CODEVIEW;
|
||||
if (has_debug) {
|
||||
|
@ -5069,7 +5069,7 @@ bool TextEdit::multicaret_edit_ignore_caret(int p_caret) const {
|
||||
}
|
||||
|
||||
bool TextEdit::is_caret_visible(int p_caret) const {
|
||||
ERR_FAIL_INDEX_V(p_caret, carets.size(), 0);
|
||||
ERR_FAIL_INDEX_V(p_caret, carets.size(), false);
|
||||
return carets[p_caret].visible;
|
||||
}
|
||||
|
||||
@ -5736,7 +5736,7 @@ TextServer::AutowrapMode TextEdit::get_autowrap_mode() const {
|
||||
}
|
||||
|
||||
bool TextEdit::is_line_wrapped(int p_line) const {
|
||||
ERR_FAIL_INDEX_V(p_line, text.size(), 0);
|
||||
ERR_FAIL_INDEX_V(p_line, text.size(), false);
|
||||
if (get_line_wrapping_mode() == LineWrappingMode::LINE_WRAPPING_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
@ -647,13 +647,13 @@ void FontFile::_convert_packed_8bit(Ref<Image> &p_source, int p_page, int p_sz)
|
||||
wa[ofs_dst + 1] = r[ofs_src + 3];
|
||||
}
|
||||
}
|
||||
Ref<Image> img_r = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_r));
|
||||
Ref<Image> img_r = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_r));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 0, img_r);
|
||||
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_g));
|
||||
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_g));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 1, img_g);
|
||||
Ref<Image> img_b = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_b));
|
||||
Ref<Image> img_b = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_b));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 2, img_b);
|
||||
Ref<Image> img_a = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_a));
|
||||
Ref<Image> img_a = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_a));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 3, img_a);
|
||||
}
|
||||
|
||||
@ -738,22 +738,22 @@ void FontFile::_convert_packed_4bit(Ref<Image> &p_source, int p_page, int p_sz)
|
||||
}
|
||||
}
|
||||
}
|
||||
Ref<Image> img_r = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_r));
|
||||
Ref<Image> img_r = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_r));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 0, img_r);
|
||||
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_g));
|
||||
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_g));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 1, img_g);
|
||||
Ref<Image> img_b = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_b));
|
||||
Ref<Image> img_b = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_b));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 2, img_b);
|
||||
Ref<Image> img_a = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_a));
|
||||
Ref<Image> img_a = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_a));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page * 4 + 3, img_a);
|
||||
|
||||
Ref<Image> img_ro = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_ro));
|
||||
Ref<Image> img_ro = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_ro));
|
||||
set_texture_image(0, Vector2i(p_sz, 1), p_page * 4 + 0, img_ro);
|
||||
Ref<Image> img_go = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_go));
|
||||
Ref<Image> img_go = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_go));
|
||||
set_texture_image(0, Vector2i(p_sz, 1), p_page * 4 + 1, img_go);
|
||||
Ref<Image> img_bo = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_bo));
|
||||
Ref<Image> img_bo = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_bo));
|
||||
set_texture_image(0, Vector2i(p_sz, 1), p_page * 4 + 2, img_bo);
|
||||
Ref<Image> img_ao = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_ao));
|
||||
Ref<Image> img_ao = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_ao));
|
||||
set_texture_image(0, Vector2i(p_sz, 1), p_page * 4 + 3, img_ao);
|
||||
}
|
||||
|
||||
@ -806,10 +806,10 @@ void FontFile::_convert_rgba_4bit(Ref<Image> &p_source, int p_page, int p_sz) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_RGBA8, imgdata_g));
|
||||
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_RGBA8, imgdata_g));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page, img_g);
|
||||
|
||||
Ref<Image> img_o = memnew(Image(w, h, 0, Image::FORMAT_RGBA8, imgdata_o));
|
||||
Ref<Image> img_o = memnew(Image(w, h, false, Image::FORMAT_RGBA8, imgdata_o));
|
||||
set_texture_image(0, Vector2i(p_sz, 1), p_page, img_o);
|
||||
}
|
||||
|
||||
@ -838,7 +838,7 @@ void FontFile::_convert_mono_8bit(Ref<Image> &p_source, int p_page, int p_ch, in
|
||||
wg[ofs_dst + 1] = r[ofs_src + p_ch];
|
||||
}
|
||||
}
|
||||
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_g));
|
||||
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_g));
|
||||
set_texture_image(0, Vector2i(p_sz, p_ol), p_page, img_g);
|
||||
}
|
||||
|
||||
@ -878,10 +878,10 @@ void FontFile::_convert_mono_4bit(Ref<Image> &p_source, int p_page, int p_ch, in
|
||||
}
|
||||
}
|
||||
}
|
||||
Ref<Image> img_g = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_g));
|
||||
Ref<Image> img_g = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_g));
|
||||
set_texture_image(0, Vector2i(p_sz, 0), p_page, img_g);
|
||||
|
||||
Ref<Image> img_o = memnew(Image(w, h, 0, Image::FORMAT_LA8, imgdata_o));
|
||||
Ref<Image> img_o = memnew(Image(w, h, false, Image::FORMAT_LA8, imgdata_o));
|
||||
set_texture_image(0, Vector2i(p_sz, p_ol), p_page, img_o);
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ double AudioStream::get_bpm() const {
|
||||
}
|
||||
|
||||
bool AudioStream::has_loop() const {
|
||||
bool ret = 0;
|
||||
bool ret = false;
|
||||
GDVIRTUAL_CALL(_has_loop, ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -612,8 +612,9 @@ void RendererCanvasCull::canvas_item_set_visibility_layer(RID p_item, uint32_t p
|
||||
|
||||
uint32_t RendererCanvasCull::canvas_item_get_visibility_layer(RID p_item) {
|
||||
Item *canvas_item = canvas_item_owner.get_or_null(p_item);
|
||||
if (!canvas_item)
|
||||
if (!canvas_item) {
|
||||
return 0;
|
||||
}
|
||||
return canvas_item->visibility_layer;
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ bool GI::voxel_gi_is_using_two_bounces(RID p_voxel_gi) const {
|
||||
|
||||
bool GI::voxel_gi_is_interior(RID p_voxel_gi) const {
|
||||
VoxelGI *voxel_gi = voxel_gi_owner.get_or_null(p_voxel_gi);
|
||||
ERR_FAIL_NULL_V(voxel_gi, 0);
|
||||
ERR_FAIL_NULL_V(voxel_gi, false);
|
||||
return voxel_gi->interior;
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ public:
|
||||
|
||||
_FORCE_INLINE_ bool particles_has_collision(RID p_particles) {
|
||||
Particles *particles = particles_owner.get_or_null(p_particles);
|
||||
ERR_FAIL_NULL_V(particles, 0);
|
||||
ERR_FAIL_NULL_V(particles, false);
|
||||
|
||||
return particles->has_collision_cache;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ RID RenderingServer::get_white_texture() {
|
||||
w[i] = 255;
|
||||
}
|
||||
}
|
||||
Ref<Image> white = memnew(Image(4, 4, 0, Image::FORMAT_RGB8, wt));
|
||||
Ref<Image> white = memnew(Image(4, 4, false, Image::FORMAT_RGB8, wt));
|
||||
white_texture = texture_2d_create(white);
|
||||
return white_texture;
|
||||
}
|
||||
|
@ -104,8 +104,9 @@ TEST_CASE("[SceneTree][Primitive][Capsule] Capsule Primitive") {
|
||||
float dist_to_yaxis = 0.f;
|
||||
for (Vector3 point : points) {
|
||||
float new_dist_to_y = point.x * point.x + point.z * point.z;
|
||||
if (new_dist_to_y > dist_to_yaxis)
|
||||
if (new_dist_to_y > dist_to_yaxis) {
|
||||
dist_to_yaxis = new_dist_to_y;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(dist_to_yaxis <= radius * radius);
|
||||
@ -114,10 +115,12 @@ TEST_CASE("[SceneTree][Primitive][Capsule] Capsule Primitive") {
|
||||
float max_y{ 0.f };
|
||||
float min_y{ 0.f };
|
||||
for (Vector3 point : points) {
|
||||
if (point.y > max_y)
|
||||
if (point.y > max_y) {
|
||||
max_y = point.y;
|
||||
if (point.y < min_y)
|
||||
}
|
||||
if (point.y < min_y) {
|
||||
min_y = point.y;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(max_y - min_y <= height);
|
||||
@ -196,12 +199,14 @@ TEST_CASE("[SceneTree][Primitive][Box] Box Primitive") {
|
||||
for (const Vector3 &normal : normals) {
|
||||
bool add_normal{ true };
|
||||
for (const Vector3 &vec : distinct_normals) {
|
||||
if (vec.is_equal_approx(normal))
|
||||
if (vec.is_equal_approx(normal)) {
|
||||
add_normal = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (add_normal)
|
||||
if (add_normal) {
|
||||
distinct_normals.push_back(normal);
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_MESSAGE(distinct_normals.size() == 6,
|
||||
@ -218,8 +223,9 @@ TEST_CASE("[SceneTree][Primitive][Box] Box Primitive") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!normal_correct_direction)
|
||||
if (!normal_correct_direction) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_MESSAGE(normal_correct_direction,
|
||||
|
@ -474,6 +474,6 @@ public:
|
||||
for (int i = 0; i < string_list.size(); ++i) { \
|
||||
CHECK(string_list[i] == m_slices[i]); \
|
||||
} \
|
||||
} while (0)
|
||||
} while (false)
|
||||
|
||||
#endif // TEST_MACROS_H
|
||||
|
Loading…
Reference in New Issue
Block a user