diff options
author | Hans Goudey <h.goudey@me.com> | 2021-04-08 20:00:26 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-04-08 20:00:26 +0300 |
commit | fd414b49068c011a1fd63a304ea95bbe420d6570 (patch) | |
tree | cb08572a2ec4db702d41b12efbf2f6e010296510 /source/blender/blenkernel/BKE_volume_render.h | |
parent | b51562ed76d5428ed4d511cd248d1b059e341661 (diff) |
Cleanup: Use const arguments for volume code
The problem was that you could getting write access to a grid from a
`const Volume *` without breaking const correctness. I encountered this
when working on support for volumes in the bounding box node. For
geometry nodes there is an important distinction between getting data
"for read" and "for write", with the former returning a `const` version
of the data.
Also, for volumes it was necessary to cast away const, since all of
the relevant functions in `volume.cc` didn't have const versions. This
patch adds `const` in these places, distinguising between "for read"
and "for write" versions of functions where necessary.
The downside is that loading and unloading in the global volume cache
needs const write-access to some member variables. I see that as an
inherent problem that comes up with caching that never has a beautiful
solution anyway.
Some of the const-ness could probably be propogated futher in EEVEE
code, but I'll leave that out, since there is another level of caching.
Differential Revision: https://developer.blender.org/D10916
Diffstat (limited to 'source/blender/blenkernel/BKE_volume_render.h')
-rw-r--r-- | source/blender/blenkernel/BKE_volume_render.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_volume_render.h b/source/blender/blenkernel/BKE_volume_render.h index d7553ccb10b..907e3cf0880 100644 --- a/source/blender/blenkernel/BKE_volume_render.h +++ b/source/blender/blenkernel/BKE_volume_render.h @@ -43,7 +43,7 @@ typedef struct DenseFloatVolumeGrid { } DenseFloatVolumeGrid; bool BKE_volume_grid_dense_floats(const struct Volume *volume, - struct VolumeGrid *volume_grid, + const struct VolumeGrid *volume_grid, DenseFloatVolumeGrid *r_dense_grid); void BKE_volume_dense_float_grid_clear(DenseFloatVolumeGrid *dense_grid); @@ -53,7 +53,7 @@ typedef void (*BKE_volume_wireframe_cb)( void *userdata, float (*verts)[3], int (*edges)[2], int totvert, int totedge); void BKE_volume_grid_wireframe(const struct Volume *volume, - struct VolumeGrid *volume_grid, + const struct VolumeGrid *volume_grid, BKE_volume_wireframe_cb cb, void *cb_userdata); @@ -63,7 +63,7 @@ typedef void (*BKE_volume_selection_surface_cb)( void *userdata, float (*verts)[3], int (*tris)[3], int totvert, int tottris); void BKE_volume_grid_selection_surface(const struct Volume *volume, - struct VolumeGrid *volume_grid, + const struct VolumeGrid *volume_grid, BKE_volume_selection_surface_cb cb, void *cb_userdata); |