From abd6b1d7b281c85fce748e0535f1f769916cd9b3 Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Tue, 26 Jan 2021 18:21:12 +0100 Subject: Fix T85049: Geometry Nodes: How to handle instances with shear? Use transform matrices instead of loc, rot, scale variables to store instance transforms. Reviewed By: JacquesLucke Differential Revision: http://developer.blender.org/D10211 --- source/blender/blenkernel/BKE_geometry_set.hh | 31 ++++++--------------------- 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'source/blender/blenkernel/BKE_geometry_set.hh') diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index ad5a5d57045..3b093ae730a 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -24,6 +24,7 @@ #include #include "BLI_float3.hh" +#include "BLI_float4x4.hh" #include "BLI_hash.hh" #include "BLI_map.hh" #include "BLI_set.hh" @@ -422,9 +423,7 @@ class PointCloudComponent : public GeometryComponent { /** A geometry component that stores instances. */ class InstancesComponent : public GeometryComponent { private: - blender::Vector positions_; - blender::Vector rotations_; - blender::Vector scales_; + blender::Vector transforms_; blender::Vector ids_; blender::Vector instanced_data_; @@ -434,30 +433,14 @@ class InstancesComponent : public GeometryComponent { GeometryComponent *copy() const override; void clear(); - void add_instance(Object *object, - blender::float3 position, - blender::float3 rotation = {0, 0, 0}, - blender::float3 scale = {1, 1, 1}, - const int id = -1); - void add_instance(Collection *collection, - blender::float3 position, - blender::float3 rotation = {0, 0, 0}, - blender::float3 scale = {1, 1, 1}, - const int id = -1); - void add_instance(InstancedData data, - blender::float3 position, - blender::float3 rotation, - blender::float3 scale, - const int id = -1); + void add_instance(Object *object, blender::float4x4 transform, const int id = -1); + void add_instance(Collection *collection, blender::float4x4 transform, const int id = -1); + void add_instance(InstancedData data, blender::float4x4 transform, const int id = -1); blender::Span instanced_data() const; - blender::Span positions() const; - blender::Span rotations() const; - blender::Span scales() const; + blender::Span transforms() const; blender::Span ids() const; - blender::MutableSpan positions(); - blender::MutableSpan rotations(); - blender::MutableSpan scales(); + blender::MutableSpan transforms(); int instances_amount() const; bool is_empty() const final; -- cgit v1.2.3