diff --git a/source/blender/blenkernel/BKE_pbvh_pixels.hh b/source/blender/blenkernel/BKE_pbvh_pixels.hh index e49fa4a8f96..bf02e38fc42 100644 --- a/source/blender/blenkernel/BKE_pbvh_pixels.hh +++ b/source/blender/blenkernel/BKE_pbvh_pixels.hh @@ -4,8 +4,6 @@ #pragma once -#include - #include "BLI_math_vector.hh" #include "BLI_rect.h" #include "BLI_vector.hh" diff --git a/source/blender/blenlib/BLI_mesh_boolean.hh b/source/blender/blenlib/BLI_mesh_boolean.hh index 4471e819763..9b3a74c201a 100644 --- a/source/blender/blenlib/BLI_mesh_boolean.hh +++ b/source/blender/blenlib/BLI_mesh_boolean.hh @@ -11,8 +11,8 @@ /* The boolean functions in Blenlib use exact arithmetic, so require GMP. */ #ifdef WITH_GMP +# include "BLI_function_ref.hh" # include "BLI_mesh_intersect.hh" -# include namespace blender::meshintersect { @@ -46,7 +46,7 @@ enum class BoolOpType { IMesh boolean_mesh(IMesh &imesh, BoolOpType op, int nshapes, - std::function shape_fn, + FunctionRef shape_fn, bool use_self, bool hole_tolerant, IMesh *imesh_triangulated, @@ -60,7 +60,7 @@ IMesh boolean_mesh(IMesh &imesh, IMesh boolean_trimesh(IMesh &tm_in, BoolOpType op, int nshapes, - std::function shape_fn, + FunctionRef shape_fn, bool use_self, bool hole_tolerant, IMeshArena *arena); diff --git a/source/blender/blenlib/BLI_mesh_intersect.hh b/source/blender/blenlib/BLI_mesh_intersect.hh index 6059f6d1489..b331968d619 100644 --- a/source/blender/blenlib/BLI_mesh_intersect.hh +++ b/source/blender/blenlib/BLI_mesh_intersect.hh @@ -16,6 +16,7 @@ # include # include "BLI_array.hh" +# include "BLI_function_ref.hh" # include "BLI_index_range.hh" # include "BLI_map.hh" # include "BLI_math_mpq.hh" @@ -403,7 +404,7 @@ IMesh trimesh_self_intersect(const IMesh &tm_in, IMeshArena *arena); IMesh trimesh_nary_intersect(const IMesh &tm_in, int nshapes, - std::function shape_fn, + FunctionRef shape_fn, bool use_self, IMeshArena *arena); diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc index f0824c7d930..1b99e7c396b 100644 --- a/source/blender/blenlib/intern/mesh_boolean.cc +++ b/source/blender/blenlib/intern/mesh_boolean.cc @@ -2198,7 +2198,7 @@ static void propagate_windings_and_in_output_volume(PatchesInfo &pinfo, int c_ambient, BoolOpType op, int nshapes, - std::function shape_fn) + FunctionRef shape_fn) { int dbg_level = 0; if (dbg_level > 0) { @@ -2514,12 +2514,12 @@ static double3 calc_point_inside_tri_db(const Face &tri) class InsideShapeTestData { public: const IMesh &tm; - std::function shape_fn; + FunctionRef shape_fn; int nshapes; /* A per-shape vector of parity of hits of that shape. */ Array hit_parity; - InsideShapeTestData(const IMesh &tm, std::function shape_fn, int nshapes) + InsideShapeTestData(const IMesh &tm, FunctionRef shape_fn, int nshapes) : tm(tm), shape_fn(shape_fn), nshapes(nshapes) { } @@ -2578,7 +2578,7 @@ static void inside_shape_callback(void *userdata, * \param tree: Contains all the triangles of \a tm and can be used for fast ray-casting. */ static void test_tri_inside_shapes(const IMesh &tm, - std::function shape_fn, + FunctionRef shape_fn, int nshapes, int test_t_index, BVHTree *tree, @@ -2726,11 +2726,8 @@ static void raycast_add_flipped(Vector &out_faces, Face &tri, IMeshArena * when the input is not PWN, some patches can be both inside and outside * some shapes (e.g., a plane cutting through Suzanne's open eyes). */ -static IMesh raycast_tris_boolean(const IMesh &tm, - BoolOpType op, - int nshapes, - std::function shape_fn, - IMeshArena *arena) +static IMesh raycast_tris_boolean( + const IMesh &tm, BoolOpType op, int nshapes, FunctionRef shape_fn, IMeshArena *arena) { constexpr int dbg_level = 0; if (dbg_level > 0) { @@ -2804,7 +2801,7 @@ static IMesh raycast_tris_boolean(const IMesh &tm, static IMesh raycast_patches_boolean(const IMesh &tm, BoolOpType op, int nshapes, - std::function shape_fn, + FunctionRef shape_fn, const PatchesInfo &pinfo, IMeshArena *arena) { @@ -3543,7 +3540,7 @@ static IMesh polymesh_from_trimesh_with_dissolve(const IMesh &tm_out, IMesh boolean_trimesh(IMesh &tm_in, BoolOpType op, int nshapes, - std::function shape_fn, + FunctionRef shape_fn, bool use_self, bool hole_tolerant, IMeshArena *arena) @@ -3691,7 +3688,7 @@ static void dump_test_spec(IMesh &imesh) IMesh boolean_mesh(IMesh &imesh, BoolOpType op, int nshapes, - std::function shape_fn, + FunctionRef shape_fn, bool use_self, bool hole_tolerant, IMesh *imesh_triangulated, diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index 60595e57a2a..45bdce6af08 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -2935,7 +2935,7 @@ IMesh trimesh_self_intersect(const IMesh &tm_in, IMeshArena *arena) IMesh trimesh_nary_intersect(const IMesh &tm_in, int nshapes, - std::function shape_fn, + const FunctionRef shape_fn, bool use_self, IMeshArena *arena) { diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc b/source/blender/bmesh/tools/bmesh_boolean.cc index c74558bb6b0..668acfb94cd 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.cc +++ b/source/blender/bmesh/tools/bmesh_boolean.cc @@ -8,6 +8,8 @@ * Main functions for boolean on a #BMesh (used by the tool and modifier) */ +#include + #include "BLI_array.hh" #include "BLI_math_mpq.hh" #include "BLI_mesh_boolean.hh" diff --git a/source/blender/draw/engines/overlay/overlay_next_private.hh b/source/blender/draw/engines/overlay/overlay_next_private.hh index 07e522dd613..106e0704d0b 100644 --- a/source/blender/draw/engines/overlay/overlay_next_private.hh +++ b/source/blender/draw/engines/overlay/overlay_next_private.hh @@ -8,6 +8,8 @@ #pragma once +#include "BLI_function_ref.hh" + #include "DRW_gpu_wrapper.hh" #include "DRW_render.h" #include "UI_resources.hh" @@ -129,7 +131,7 @@ class ShaderModule { } ShaderPtr selectable_shader(const char *create_info_name); ShaderPtr selectable_shader(const char *create_info_name, - std::function patch); + FunctionRef patch); }; struct Resources : public select::SelectMap { diff --git a/source/blender/draw/engines/overlay/overlay_next_shader.cc b/source/blender/draw/engines/overlay/overlay_next_shader.cc index c015e6640a1..d0369956c28 100644 --- a/source/blender/draw/engines/overlay/overlay_next_shader.cc +++ b/source/blender/draw/engines/overlay/overlay_next_shader.cc @@ -34,7 +34,8 @@ ShaderModule::ShaderPtr ShaderModule::selectable_shader(const char *create_info_ } ShaderModule::ShaderPtr ShaderModule::selectable_shader( - const char *create_info_name, std::function patch) + const char *create_info_name, + const FunctionRef patch) { gpu::shader::ShaderCreateInfo info = *reinterpret_cast( GPU_shader_create_info_get(create_info_name)); diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc index cb33443d3c3..dbbdc4d1600 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc @@ -336,7 +336,7 @@ static int get_smooth_group(const OBJMesh &mesh, const OBJExportParams ¶ms, void OBJWriter::write_poly_elements(FormatHandler &fh, const IndexOffsets &offsets, const OBJMesh &obj_mesh_data, - std::function matname_fn) + FunctionRef matname_fn) { const func_vert_uv_normal_indices poly_element_writer = get_poly_element_writer( obj_mesh_data.tot_uv_vertices()); diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh index ede2b4a996a..c773531a060 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh @@ -99,7 +99,7 @@ class OBJWriter : NonMovable, NonCopyable { void write_poly_elements(FormatHandler &fh, const IndexOffsets &offsets, const OBJMesh &obj_mesh_data, - std::function matname_fn); + FunctionRef matname_fn); /** * Write loose edges of a mesh as "l v1 v2". */ diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc index 2db60f596d0..291dceb105e 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc @@ -213,7 +213,7 @@ static void write_mesh_objects(Vector> exportable_as_me /* This function takes a 0-indexed slot index for the obj_mesh object and * returns the material name that we are using in the .obj file for it. */ const auto *obj_mtlindices = mtlindices.is_empty() ? nullptr : &mtlindices[i]; - std::function matname_fn = [&](int s) -> const char * { + auto matname_fn = [&](int s) -> const char * { if (!obj_mtlindices || s < 0 || s >= obj_mtlindices->size()) { return nullptr; }