Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_geometry_set.hh
| Show First 20 Lines • Show All 615 Lines • ▼ Show 20 Lines | private: | ||||
| blender::VectorSet<InstanceReference> references_; | blender::VectorSet<InstanceReference> references_; | ||||
| /** Index into `references_`. Determines what data is instanced. */ | /** Index into `references_`. Determines what data is instanced. */ | ||||
| blender::Vector<int> instance_reference_handles_; | blender::Vector<int> instance_reference_handles_; | ||||
| /** Transformation of the instances. */ | /** Transformation of the instances. */ | ||||
| blender::Vector<blender::float4x4> instance_transforms_; | blender::Vector<blender::float4x4> instance_transforms_; | ||||
| /** | /** | ||||
| * IDs of the instances. They are used for consistency over multiple frames for things like | * IDs of the instances. They are used for consistency over multiple frames for things like | ||||
| * motion blur. | * motion blur. Proper stable ID data that actually helps when rendering can only be generated | ||||
| * in some situations, so this vector is allowed to be empty, in which case the index of each | |||||
| * instance will be used for the final ID. | |||||
| */ | */ | ||||
| blender::Vector<int> instance_ids_; | blender::Vector<int> instance_ids_; | ||||
| /* These almost unique ids are generated based on `ids_`, which might not contain unique ids at | /* These almost unique ids are generated based on `ids_`, which might not contain unique ids at | ||||
| * all. They are *almost* unique, because under certain very unlikely circumstances, they are not | * all. They are *almost* unique, because under certain very unlikely circumstances, they are not | ||||
| * unique. Code using these ids should not crash when they are not unique but can generally | * unique. Code using these ids should not crash when they are not unique but can generally | ||||
| * expect them to be unique. */ | * expect them to be unique. */ | ||||
| mutable std::mutex almost_unique_ids_mutex_; | mutable std::mutex almost_unique_ids_mutex_; | ||||
| mutable blender::Array<int> almost_unique_ids_; | mutable blender::Array<int> almost_unique_ids_; | ||||
| public: | public: | ||||
| InstancesComponent(); | InstancesComponent(); | ||||
| ~InstancesComponent() = default; | ~InstancesComponent() = default; | ||||
| GeometryComponent *copy() const override; | GeometryComponent *copy() const override; | ||||
| void clear(); | void clear(); | ||||
| void reserve(int min_capacity); | void reserve(int min_capacity); | ||||
| void resize(int capacity); | void resize(int capacity); | ||||
| int add_reference(const InstanceReference &reference); | int add_reference(const InstanceReference &reference); | ||||
| void add_instance(int instance_handle, const blender::float4x4 &transform, const int id = -1); | void add_instance(int instance_handle, const blender::float4x4 &transform); | ||||
| blender::Span<InstanceReference> references() const; | blender::Span<InstanceReference> references() const; | ||||
| void remove_unused_references(); | void remove_unused_references(); | ||||
| void ensure_geometry_instances(); | void ensure_geometry_instances(); | ||||
| GeometrySet &geometry_set_from_reference(const int reference_index); | GeometrySet &geometry_set_from_reference(const int reference_index); | ||||
| blender::Span<int> instance_reference_handles() const; | blender::Span<int> instance_reference_handles() const; | ||||
| blender::MutableSpan<int> instance_reference_handles(); | blender::MutableSpan<int> instance_reference_handles(); | ||||
| blender::MutableSpan<blender::float4x4> instance_transforms(); | blender::MutableSpan<blender::float4x4> instance_transforms(); | ||||
| blender::Span<blender::float4x4> instance_transforms() const; | blender::Span<blender::float4x4> instance_transforms() const; | ||||
| blender::MutableSpan<int> instance_ids(); | blender::MutableSpan<int> instance_ids(); | ||||
| blender::Span<int> instance_ids() const; | blender::Span<int> instance_ids() const; | ||||
| blender::MutableSpan<int> instance_ids_ensure(); | |||||
JacquesLucke: Should probably be called something like `instance_ids_ensure`. | |||||
Done Inline ActionsI went back and forth between the two. I'm fine ending here though :) HooglyBoogly: I went back and forth between the two. I'm fine ending here though :) | |||||
Done Inline ActionsOops, forgot to submit this earlier. HooglyBoogly: Oops, forgot to submit this earlier. | |||||
| void instance_ids_clear(); | |||||
| int instances_amount() const; | int instances_amount() const; | ||||
| int references_amount() const; | int references_amount() const; | ||||
| blender::Span<int> almost_unique_ids() const; | blender::Span<int> almost_unique_ids() const; | ||||
| int attribute_domain_size(const AttributeDomain domain) const final; | int attribute_domain_size(const AttributeDomain domain) const final; | ||||
| void foreach_referenced_geometry( | void foreach_referenced_geometry( | ||||
| ▲ Show 20 Lines • Show All 145 Lines • Show Last 20 Lines | |||||
Should probably be called something like instance_ids_ensure.