WIP: uv-simple-select #1

Closed
Chris Blackbourn wants to merge 182 commits from uv-simple-select into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
4 changed files with 21 additions and 26 deletions
Showing only changes of commit 4316ab1d24 - Show all commits

View File

@ -66,7 +66,6 @@ set(SRC
# Lineart code
intern/lineart/lineart_chain.c
intern/lineart/lineart_cpp_bridge.cc
intern/lineart/lineart_cpu.cc
intern/lineart/lineart_ops.c
intern/lineart/lineart_shadow.c

View File

@ -1,23 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup modifiers
*/
#include "BLI_sort.hh"
#include "BLI_vector.hh"
#include "MOD_lineart.h"
#include "lineart_intern.h"
void lineart_sort_adjacent_items(LineartAdjacentEdge *ai, int length)
{
blender::parallel_sort(
ai, ai + length, [](const LineartAdjacentEdge &p1, const LineartAdjacentEdge &p2) {
int a = p1.v1 - p2.v1;
int b = p1.v2 - p2.v2;
/* parallel_sort() requires cmp() to return true when the first element needs to appear
* before the second element in the sorted array, false otherwise (strict weak ordering),
* see https://en.cppreference.com/w/cpp/named_req/Compare. */
return a < 0 ? true : (a == 0 ? b < 0 : false);
});
}

View File

@ -14,6 +14,8 @@
#include "BLI_math.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "BLI_sort.hh"
#include "BLI_vector.hh"
#include "PIL_time.h"
@ -1887,6 +1889,25 @@ static void lineart_edge_neighbor_init_task(void *__restrict userdata,
edge_nabr->flags = 0;
}
void lineart_sort_adjacent_items(LineartAdjacentEdge *ai, int length)
{
blender::parallel_sort(
ai, ai + length, [](const LineartAdjacentEdge &p1, const LineartAdjacentEdge &p2) {
int a = p1.v1 - p2.v1;
int b = p1.v2 - p2.v2;
/* parallel_sort() requires cmp() to return true when the first element needs to appear
* before the second element in the sorted array, false otherwise (strict weak ordering),
* see https://en.cppreference.com/w/cpp/named_req/Compare. */
if (a < 0) {
return true;
}
if (a > 0) {
return false;
}
return b < 0;
});
}
static LineartEdgeNeighbor *lineart_build_edge_neighbor(Mesh *me, int total_edges)
{
/* Because the mesh is triangulated, so `me->totedge` should be reliable? */

View File

@ -173,8 +173,6 @@ void lineart_add_edge_to_array(struct LineartPendingEdges *pe, struct LineartEdg
void lineart_finalize_object_edge_array_reserve(struct LineartPendingEdges *pe, int count);
void lineart_destroy_render_data_keep_init(struct LineartData *ld);
void lineart_sort_adjacent_items(struct LineartAdjacentEdge *ai, int length);
#ifdef __cplusplus
}
#endif