Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_geometry_set.hh
| Show First 20 Lines • Show All 358 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| /** A geometry component that stores instances. */ | /** A geometry component that stores instances. */ | ||||
| class InstancesComponent : public GeometryComponent { | class InstancesComponent : public GeometryComponent { | ||||
| private: | private: | ||||
| blender::Vector<blender::float3> positions_; | blender::Vector<blender::float3> positions_; | ||||
| blender::Vector<blender::float3> rotations_; | blender::Vector<blender::float3> rotations_; | ||||
| blender::Vector<blender::float3> scales_; | blender::Vector<blender::float3> scales_; | ||||
| blender::Vector<int> ids_; | |||||
| blender::Vector<InstancedData> instanced_data_; | blender::Vector<InstancedData> instanced_data_; | ||||
| public: | public: | ||||
| InstancesComponent(); | InstancesComponent(); | ||||
| ~InstancesComponent() = default; | ~InstancesComponent() = default; | ||||
| GeometryComponent *copy() const override; | GeometryComponent *copy() const override; | ||||
| void clear(); | void clear(); | ||||
| void add_instance(Object *object, | void add_instance(Object *object, | ||||
| blender::float3 position, | blender::float3 position, | ||||
| blender::float3 rotation = {0, 0, 0}, | blender::float3 rotation = {0, 0, 0}, | ||||
| blender::float3 scale = {1, 1, 1}); | blender::float3 scale = {1, 1, 1}, | ||||
| const int id = -1); | |||||
| void add_instance(Collection *collection, | void add_instance(Collection *collection, | ||||
| blender::float3 position, | blender::float3 position, | ||||
| blender::float3 rotation = {0, 0, 0}, | blender::float3 rotation = {0, 0, 0}, | ||||
| blender::float3 scale = {1, 1, 1}); | blender::float3 scale = {1, 1, 1}, | ||||
| const int id = -1); | |||||
| void add_instance(InstancedData data, | void add_instance(InstancedData data, | ||||
| blender::float3 position, | blender::float3 position, | ||||
| blender::float3 rotation, | blender::float3 rotation, | ||||
| blender::float3 scale); | blender::float3 scale, | ||||
| const int id = -1); | |||||
| blender::Span<InstancedData> instanced_data() const; | blender::Span<InstancedData> instanced_data() const; | ||||
| blender::Span<blender::float3> positions() const; | blender::Span<blender::float3> positions() const; | ||||
| blender::Span<blender::float3> rotations() const; | blender::Span<blender::float3> rotations() const; | ||||
| blender::Span<blender::float3> scales() const; | blender::Span<blender::float3> scales() const; | ||||
| blender::Span<int> ids() const; | |||||
| blender::MutableSpan<blender::float3> positions(); | blender::MutableSpan<blender::float3> positions(); | ||||
| int instances_amount() const; | int instances_amount() const; | ||||
| bool is_empty() const final; | bool is_empty() const final; | ||||
| static constexpr inline GeometryComponentType static_type = GeometryComponentType::Instances; | static constexpr inline GeometryComponentType static_type = GeometryComponentType::Instances; | ||||
| }; | }; | ||||