18 .
description(
"The edge to retrieve data from. Defaults to the edge from the context");
20 "Values that sort the corners attached to the edge");
24 .
description(
"Which of the sorted corners to output");
26 .field_source_reference_all()
28 "A corner of the input edge in its face's winding order, chosen by the sort index");
29 b.add_output<
decl::Int>(
"Total").field_source().reference_pass({0}).description(
30 "The number of faces or corners connected to each edge");
40 : bke::MeshFieldInput(
CPPType::get<
int>(),
"Corner of Edge"),
41 edge_index_(std::move(edge_index)),
42 sort_index_(std::move(sort_index)),
43 sort_weight_(std::move(sort_weight))
49 const AttrDomain domain,
55 const Span<int> corner_edges = mesh.corner_edges();
57 mesh.corner_edges(), mesh.edges_num, map_offsets, map_indices);
61 evaluator.
add(edge_index_);
62 evaluator.add(sort_index_);
64 const VArray<int> edge_indices = evaluator.get_evaluated<
int>(0);
65 const VArray<int> indices_in_sort = evaluator.get_evaluated<
int>(1);
69 corner_evaluator.add(sort_weight_);
70 corner_evaluator.evaluate();
71 const VArray<float> all_sort_weights = corner_evaluator.get_evaluated<
float>(0);
72 const bool use_sorting = !all_sort_weights.
is_single();
74 Array<int> corner_of_edge(mask.min_array_size());
81 for (
const int selection_i : segment) {
82 const int edge_i = edge_indices[selection_i];
83 const int index_in_sort = indices_in_sort[selection_i];
85 corner_of_edge[selection_i] = 0;
89 const Span<int> corners = edge_to_loop_map[edge_i];
90 if (corners.is_empty()) {
91 corner_of_edge[selection_i] = 0;
95 const int index_in_sort_wrapped =
mod_i(index_in_sort, corners.size());
109 std::stable_sort(sort_indices.
begin(), sort_indices.
end(), [&](
int a,
int b) {
110 return sort_weights[a] < sort_weights[b];
112 corner_of_edge[selection_i] = corners[sort_indices[index_in_sort_wrapped]];
115 corner_of_edge[selection_i] = corners[index_in_sort_wrapped];
125 edge_index_.node().for_each_field_input_recursive(fn);
132 return AttrDomain::Edge;
144 const AttrDomain domain,
147 if (domain != AttrDomain::Edge) {
157 return 2345897985577;
167 return AttrDomain::Edge;
174 if (
params.output_is_required(
"Total")) {
175 params.set_output(
"Total",
176 Field<int>(std::make_shared<bke::EvaluateAtIndexInput>(
178 Field<int>(std::make_shared<CornersOfEdgeCountInput>()),
181 if (
params.output_is_required(
"Corner Index")) {
182 params.set_output(
"Corner Index",
183 Field<int>(std::make_shared<CornersOfEdgeInput>(
194 &ntype, GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_EDGE,
"Corners of Edge",
NODE_CLASS_INPUT);
MINLINE int mod_i(int i, int n)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
MutableSpan< T > as_mutable_span()
void reinitialize(const int64_t new_size)
constexpr bool contains(int64_t value) const
constexpr int64_t size() const
void materialize_compressed(const IndexMask &mask, MutableSpan< T > r_span) const
static VArray ForContainer(ContainerT container)
int add(GField field, GVArray *varray_ptr)
virtual void for_each_field_input_recursive(FunctionRef< void(const FieldInput &)> fn) const
const FieldNode & node() const
static IndexMask from_indices(Span< T > indices, IndexMaskMemory &memory)
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void count_indices(Span< int > indices, MutableSpan< int > counts)
void fill_index_range(MutableSpan< T > span, const T start=0)
GroupedSpan< int > build_edge_to_corner_map(Span< int > corner_edges, int edges_num, Array< int > &r_offsets, Array< int > &r_indices)
void node_register_type(bNodeType *ntype)
static void node_geo_exec(GeoNodeExecParams params)
static void node_declare(NodeDeclarationBuilder &b)
static void node_register()
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
unsigned __int64 uint64_t
NodeGeometryExecFunction geometry_node_execute
NodeDeclareFunction declare