Differential D12980 Diff 43838 source/blender/nodes/geometry/nodes/legacy/node_geo_point_instance.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/legacy/node_geo_point_instance.cc
| Show First 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | GVArray_Typed<float3> scales = src_geometry.attribute_get_for_read<float3>( | ||||
| "scale", domain, {1, 1, 1}); | "scale", domain, {1, 1, 1}); | ||||
| GVArray_Typed<int> id_attribute = src_geometry.attribute_get_for_read<int>("id", domain, -1); | GVArray_Typed<int> id_attribute = src_geometry.attribute_get_for_read<int>("id", domain, -1); | ||||
| /* The initial size of the component might be non-zero if there are two component types. */ | /* The initial size of the component might be non-zero if there are two component types. */ | ||||
| const int start_len = instances.instances_amount(); | const int start_len = instances.instances_amount(); | ||||
| instances.resize(start_len + domain_size); | instances.resize(start_len + domain_size); | ||||
| MutableSpan<int> handles = instances.instance_reference_handles().slice(start_len, domain_size); | MutableSpan<int> handles = instances.instance_reference_handles().slice(start_len, domain_size); | ||||
| MutableSpan<float4x4> transforms = instances.instance_transforms().slice(start_len, domain_size); | MutableSpan<float4x4> transforms = instances.instance_transforms().slice(start_len, domain_size); | ||||
| MutableSpan<int> instance_ids = instances.instance_ids().slice(start_len, domain_size); | MutableSpan<int> instance_ids = instances.instance_ids_add().slice(start_len, domain_size); | ||||
| /* Skip all of the randomness handling if there is only a single possible instance | /* Skip all of the randomness handling if there is only a single possible instance | ||||
| * (anything except for collection mode with "Whole Collection" turned off). */ | * (anything except for collection mode with "Whole Collection" turned off). */ | ||||
| if (possible_handles.size() == 1) { | if (possible_handles.size() == 1) { | ||||
| const int handle = possible_handles.first(); | const int handle = possible_handles.first(); | ||||
| threading::parallel_for(IndexRange(domain_size), 1024, [&](IndexRange range) { | threading::parallel_for(IndexRange(domain_size), 1024, [&](IndexRange range) { | ||||
| for (const int i : range) { | for (const int i : range) { | ||||
| handles[i] = handle; | handles[i] = handle; | ||||
| ▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines | |||||