diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2022-07-26 00:43:48 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2022-07-26 00:43:48 +0300 |
commit | f081e76037432cb926be45e980eac201d337032c (patch) | |
tree | dd1225521c12ea21c0b0c3d51ec1ae3f8730755f /source/blender/draw/intern/draw_cache_impl_pointcloud.c | |
parent | fa2084ae58a77b1201289b6bedac427f73c762d1 (diff) | |
parent | 462f99bf38648a08226b1fba423315aec2bc577b (diff) |
Merge branch 'master' into geometry-nodes-iterative-cachegeometry-nodes-rigid-body-integration
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_pointcloud.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_pointcloud.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_pointcloud.c b/source/blender/draw/intern/draw_cache_impl_pointcloud.c index d715899e291..55d0eee00e5 100644 --- a/source/blender/draw/intern/draw_cache_impl_pointcloud.c +++ b/source/blender/draw/intern/draw_cache_impl_pointcloud.c @@ -18,6 +18,7 @@ #include "DNA_object_types.h" #include "DNA_pointcloud_types.h" +#include "BKE_customdata.h" #include "BKE_pointcloud.h" #include "GPU_batch.h" @@ -139,7 +140,11 @@ static void pointcloud_batch_cache_ensure_pos(Object *ob, PointCloudBatchCache * } PointCloud *pointcloud = ob->data; - const bool has_radius = pointcloud->radius != NULL; + const float(*positions)[3] = (float(*)[3])CustomData_get_layer_named( + &pointcloud->pdata, CD_PROP_FLOAT3, "position"); + const float *radii = (float *)CustomData_get_layer_named( + &pointcloud->pdata, CD_PROP_FLOAT, "radius"); + const bool has_radius = radii != NULL; static GPUVertFormat format = {0}; static GPUVertFormat format_no_radius = {0}; @@ -162,14 +167,14 @@ static void pointcloud_batch_cache_ensure_pos(Object *ob, PointCloudBatchCache * if (has_radius) { float(*vbo_data)[4] = (float(*)[4])GPU_vertbuf_get_data(cache->pos); for (int i = 0; i < pointcloud->totpoint; i++) { - copy_v3_v3(vbo_data[i], pointcloud->co[i]); + copy_v3_v3(vbo_data[i], positions[i]); /* TODO(fclem): remove multiplication here. * Here only for keeping the size correct for now. */ - vbo_data[i][3] = pointcloud->radius[i] * 100.0f; + vbo_data[i][3] = radii[i] * 100.0f; } } else { - GPU_vertbuf_attr_fill(cache->pos, pos, pointcloud->co); + GPU_vertbuf_attr_fill(cache->pos, pos, positions); } } |