summaryrefslogtreecommitdiff
path: root/core/math/bsp_tree.cpp
diff options
context:
space:
mode:
authorHein-Pieter van Braam <hp@tmm.cx>2018-07-26 01:26:46 +0200
committerGitHub <noreply@github.com>2018-07-26 01:26:46 +0200
commit832e2bfcd38965a01a9149d509169dd197e42f58 (patch)
tree18b7ff35f1eeee39031a16e9c1d834ebf03d44cf /core/math/bsp_tree.cpp
parent9423f23ffb80c946dec380f73f3f313ec44d0d18 (diff)
parent0e29f7974b59e4440cf02e1388fb9d8ab2b5c5fd (diff)
Merge pull request #20137 from hpvb/reduce-vector-cow
Reduce unnecessary COW on Vector by make writing explicit
Diffstat (limited to 'core/math/bsp_tree.cpp')
-rw-r--r--core/math/bsp_tree.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/math/bsp_tree.cpp b/core/math/bsp_tree.cpp
index 2e184f7a88..24096de551 100644
--- a/core/math/bsp_tree.cpp
+++ b/core/math/bsp_tree.cpp
@@ -449,10 +449,10 @@ BSP_Tree::operator Variant() const {
for (int i = 0; i < planes.size(); i++) {
- plane_values[i * 4 + 0] = planes[i].normal.x;
- plane_values[i * 4 + 1] = planes[i].normal.y;
- plane_values[i * 4 + 2] = planes[i].normal.z;
- plane_values[i * 4 + 3] = planes[i].d;
+ plane_values.write[i * 4 + 0] = planes[i].normal.x;
+ plane_values.write[i * 4 + 1] = planes[i].normal.y;
+ plane_values.write[i * 4 + 2] = planes[i].normal.z;
+ plane_values.write[i * 4 + 3] = planes[i].d;
}
d["planes"] = plane_values;
@@ -498,10 +498,10 @@ BSP_Tree::BSP_Tree(const Variant &p_variant) {
PoolVector<real_t>::Read r = src_planes.read();
for (int i = 0; i < plane_count / 4; i++) {
- planes[i].normal.x = r[i * 4 + 0];
- planes[i].normal.y = r[i * 4 + 1];
- planes[i].normal.z = r[i * 4 + 2];
- planes[i].d = r[i * 4 + 3];
+ planes.write[i].normal.x = r[i * 4 + 0];
+ planes.write[i].normal.y = r[i * 4 + 1];
+ planes.write[i].normal.z = r[i * 4 + 2];
+ planes.write[i].d = r[i * 4 + 3];
}
}
@@ -520,9 +520,9 @@ BSP_Tree::BSP_Tree(const Variant &p_variant) {
for (int i = 0; i < nodes.size(); i++) {
- nodes[i].over = r[i * 3 + 0];
- nodes[i].under = r[i * 3 + 1];
- nodes[i].plane = r[i * 3 + 2];
+ nodes.write[i].over = r[i * 3 + 0];
+ nodes.write[i].under = r[i * 3 + 1];
+ nodes.write[i].plane = r[i * 3 + 2];
}
}