Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-02-16 14:07:10 +0300
committerJacques Lucke <jacques@blender.org>2021-02-16 14:07:10 +0300
commit21de1f91480ac2165517a4ba244fa0708a939baf (patch)
tree6be424f6019f0ebe0bba08fbda667270c7f9be42 /source/blender/blenkernel/BKE_geometry_set_instances.hh
parent39f60e6909e61b8b7982e637a2091a84d618ddd7 (diff)
Geometry Nodes: move geometry set instance handling to separate file
In an upcoming commit I'll also move the make-instances-real functionality to this file. This code is not essential to working with geometry sets in general, so it makes sense to move it to a separate header.
Diffstat (limited to 'source/blender/blenkernel/BKE_geometry_set_instances.hh')
-rw-r--r--source/blender/blenkernel/BKE_geometry_set_instances.hh42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set_instances.hh b/source/blender/blenkernel/BKE_geometry_set_instances.hh
new file mode 100644
index 00000000000..11725d75df9
--- /dev/null
+++ b/source/blender/blenkernel/BKE_geometry_set_instances.hh
@@ -0,0 +1,42 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "BKE_geometry_set.hh"
+
+namespace blender::bke {
+
+/**
+ * Used to keep track of a group of instances using the same geometry data.
+ */
+struct GeometryInstanceGroup {
+ /**
+ * The geometry set instanced on each of the transforms. The components are not necessarily
+ * owned here. For example, they may be owned by the instanced object. This cannot be a
+ * reference because not all instanced data will necessarily have a #geometry_set_eval.
+ */
+ GeometrySet geometry_set;
+
+ /**
+ * As an optimization to avoid copying, the same geometry set can be associated with multiple
+ * instances. Each instance is stored as a transform matrix here. Again, these must be owned
+ * because they may be transformed from the original data. TODO: Validate that last statement.
+ */
+ Vector<float4x4> transforms;
+};
+
+Vector<GeometryInstanceGroup> geometry_set_gather_instances(const GeometrySet &geometry_set);
+
+} // namespace blender::bke