Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc
| Show First 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | static void join_components(Span<const InstancesComponent *> src_components, GeometrySet &result) | ||||
| for (const InstancesComponent *src_component : src_components) { | for (const InstancesComponent *src_component : src_components) { | ||||
| Span<InstanceReference> src_references = src_component->references(); | Span<InstanceReference> src_references = src_component->references(); | ||||
| Array<int> handle_map(src_references.size()); | Array<int> handle_map(src_references.size()); | ||||
| for (const int src_handle : src_references.index_range()) { | for (const int src_handle : src_references.index_range()) { | ||||
| handle_map[src_handle] = dst_component.add_reference(src_references[src_handle]); | handle_map[src_handle] = dst_component.add_reference(src_references[src_handle]); | ||||
| } | } | ||||
| Span<float4x4> src_transforms = src_component->instance_transforms(); | Span<float4x4> src_transforms = src_component->instance_transforms(); | ||||
| Span<int> src_ids = src_component->instance_ids(); | |||||
| Span<int> src_reference_handles = src_component->instance_reference_handles(); | Span<int> src_reference_handles = src_component->instance_reference_handles(); | ||||
| for (const int i : src_transforms.index_range()) { | for (const int i : src_transforms.index_range()) { | ||||
| const int src_handle = src_reference_handles[i]; | const int src_handle = src_reference_handles[i]; | ||||
| const int dst_handle = handle_map[src_handle]; | const int dst_handle = handle_map[src_handle]; | ||||
| const float4x4 &transform = src_transforms[i]; | const float4x4 &transform = src_transforms[i]; | ||||
| const int id = src_ids[i]; | dst_component.add_instance(dst_handle, transform); | ||||
| dst_component.add_instance(dst_handle, transform, id); | |||||
| } | } | ||||
| } | } | ||||
| join_attributes(to_base_components(src_components), dst_component, {"position"}); | |||||
| } | } | ||||
| static void join_components(Span<const VolumeComponent *> src_components, GeometrySet &result) | static void join_components(Span<const VolumeComponent *> src_components, GeometrySet &result) | ||||
| { | { | ||||
| /* Not yet supported. Joining volume grids with the same name requires resampling of at least one | /* Not yet supported. Joining volume grids with the same name requires resampling of at least one | ||||
| * of the grids. The cell size of the resulting volume has to be determined somehow. */ | * of the grids. The cell size of the resulting volume has to be determined somehow. */ | ||||
| VolumeComponent &dst_component = result.get_component_for_write<VolumeComponent>(); | VolumeComponent &dst_component = result.get_component_for_write<VolumeComponent>(); | ||||
| UNUSED_VARS(src_components, dst_component); | UNUSED_VARS(src_components, dst_component); | ||||
| ▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines | |||||