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:
authorHans Goudey <h.goudey@me.com>2022-04-01 21:45:02 +0300
committerHans Goudey <h.goudey@me.com>2022-04-01 21:45:02 +0300
commitf688e3cc3130e70e77f0bb050cd71cf1549c765c (patch)
treecb70e8529ac06af6303d8fef5bdf0d294d573a1d /source/blender/draw
parent999f6526b1bc049cdccad3c7a8e165ab342f82d9 (diff)
Cleanup: Use const for bounding boxes where possible
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/eevee/eevee_shadows.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_shadows_cascade.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_volumes.c2
-rw-r--r--source/blender/draw/engines/gpencil/gpencil_cache_utils.c2
-rw-r--r--source/blender/draw/engines/overlay/overlay_extra.c7
-rw-r--r--source/blender/draw/engines/overlay/overlay_outline.c2
-rw-r--r--source/blender/draw/engines/select/select_draw_utils.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_shadow.c8
8 files changed, 13 insertions, 14 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c
index 29d98f6795d..9e571b1d15b 100644
--- a/source/blender/draw/engines/eevee/eevee_shadows.c
+++ b/source/blender/draw/engines/eevee/eevee_shadows.c
@@ -147,7 +147,7 @@ void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob)
}
/* Update World AABB in frontbuffer. */
- BoundBox *bb = BKE_object_boundbox_get(ob);
+ const BoundBox *bb = BKE_object_boundbox_get(ob);
float min[3], max[3];
INIT_MINMAX(min, max);
for (int i = 0; i < 8; i++) {
diff --git a/source/blender/draw/engines/eevee/eevee_shadows_cascade.c b/source/blender/draw/engines/eevee/eevee_shadows_cascade.c
index 25939926cfa..536242f67d8 100644
--- a/source/blender/draw/engines/eevee/eevee_shadows_cascade.c
+++ b/source/blender/draw/engines/eevee/eevee_shadows_cascade.c
@@ -311,7 +311,7 @@ static void eevee_shadow_cascade_setup(EEVEE_LightsInfo *linfo,
if (c < 3) {
dbg_col[c] = 1.0f;
}
- DRW_debug_bbox((BoundBox *)&corners, dbg_col);
+ DRW_debug_bbox((const BoundBox *)&corners, dbg_col);
DRW_debug_sphere(center, csm_render->radius[c], dbg_col);
#endif
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c
index 6ef58c90e7a..7d210f15d8b 100644
--- a/source/blender/draw/engines/eevee/eevee_volumes.c
+++ b/source/blender/draw/engines/eevee/eevee_volumes.c
@@ -346,7 +346,7 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS
if (multiple_transforms) {
/* For multiple grids with different transform, we first transform from object space
* to bounds, then for each individual grid from bounds to texture. */
- BoundBox *bb = BKE_volume_boundbox_get(ob);
+ const BoundBox *bb = BKE_volume_boundbox_get(ob);
float bb_size[3];
sub_v3_v3v3(bb_size, bb->vec[6], bb->vec[0]);
size_to_mat4(bounds_to_object, bb_size);
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index be35660a4d7..40ebd262df5 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -60,7 +60,7 @@ GPENCIL_tObject *gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob)
* strokes not aligned with the object axes. Maybe we could try to
* compute the minimum axis of all strokes. But this would be more
* computationally heavy and should go into the GPData evaluation. */
- BoundBox *bbox = BKE_object_boundbox_get(ob);
+ const BoundBox *bbox = BKE_object_boundbox_get(ob);
/* Convert bbox to matrix */
float mat[4][4], size[3], center[3];
BKE_boundbox_calc_size_aabb(bbox, size);
diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c
index 9953480e7fa..4f0bf0b8048 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.c
+++ b/source/blender/draw/engines/overlay/overlay_extra.c
@@ -345,18 +345,17 @@ static void OVERLAY_bounds(OVERLAY_ExtraCallBuffers *cb,
bool around_origin)
{
float center[3], size[3], tmp[4][4], final_mat[4][4];
- BoundBox bb_local;
if (ob->type == OB_MBALL && !BKE_mball_is_basis(ob)) {
return;
}
- BoundBox *bb = BKE_object_boundbox_get(ob);
-
+ const BoundBox *bb = BKE_object_boundbox_get(ob);
+ BoundBox bb_local;
if (bb == NULL) {
const float min[3] = {-1.0f, -1.0f, -1.0f}, max[3] = {1.0f, 1.0f, 1.0f};
+ BKE_boundbox_init_from_minmax(&bb_local, min, max);
bb = &bb_local;
- BKE_boundbox_init_from_minmax(bb, min, max);
}
BKE_boundbox_calc_size_aabb(bb, size);
diff --git a/source/blender/draw/engines/overlay/overlay_outline.c b/source/blender/draw/engines/overlay/overlay_outline.c
index cb94008f53f..8010319e3fa 100644
--- a/source/blender/draw/engines/overlay/overlay_outline.c
+++ b/source/blender/draw/engines/overlay/overlay_outline.c
@@ -32,7 +32,7 @@ static void gpencil_depth_plane(Object *ob, float r_plane[4])
* strokes not aligned with the object axes. Maybe we could try to
* compute the minimum axis of all strokes. But this would be more
* computationally heavy and should go into the GPData evaluation. */
- BoundBox *bbox = BKE_object_boundbox_get(ob);
+ const BoundBox *bbox = BKE_object_boundbox_get(ob);
/* Convert bbox to matrix */
float mat[4][4], size[3], center[3];
BKE_boundbox_calc_size_aabb(bbox, size);
diff --git a/source/blender/draw/engines/select/select_draw_utils.c b/source/blender/draw/engines/select/select_draw_utils.c
index 7615b5bb39c..613b60f8829 100644
--- a/source/blender/draw/engines/select/select_draw_utils.c
+++ b/source/blender/draw/engines/select/select_draw_utils.c
@@ -31,7 +31,7 @@
void select_id_object_min_max(Object *obj, float r_min[3], float r_max[3])
{
- BoundBox *bb;
+ const BoundBox *bb;
BMEditMesh *em = BKE_editmesh_from_object(obj);
if (em) {
bb = BKE_editmesh_cage_boundbox_get(obj, em);
diff --git a/source/blender/draw/engines/workbench/workbench_shadow.c b/source/blender/draw/engines/workbench/workbench_shadow.c
index 432e571d74b..588c7240ab2 100644
--- a/source/blender/draw/engines/workbench/workbench_shadow.c
+++ b/source/blender/draw/engines/workbench/workbench_shadow.c
@@ -166,7 +166,7 @@ void workbench_shadow_cache_init(WORKBENCH_Data *data)
}
}
-static BoundBox *workbench_shadow_object_shadow_bbox_get(WORKBENCH_PrivateData *wpd,
+static const BoundBox *workbench_shadow_object_shadow_bbox_get(WORKBENCH_PrivateData *wpd,
Object *ob,
WORKBENCH_ObjectData *oed)
{
@@ -178,7 +178,7 @@ static BoundBox *workbench_shadow_object_shadow_bbox_get(WORKBENCH_PrivateData *
INIT_MINMAX(oed->shadow_min, oed->shadow_max);
/* From object space to shadow space */
- BoundBox *bbox = BKE_object_boundbox_get(ob);
+ const BoundBox *bbox = BKE_object_boundbox_get(ob);
for (int i = 0; i < 8; i++) {
float corner[3];
mul_v3_m4v3(corner, tmp_mat, bbox->vec[i]);
@@ -203,7 +203,7 @@ static bool workbench_shadow_object_cast_visible_shadow(WORKBENCH_PrivateData *w
Object *ob,
WORKBENCH_ObjectData *oed)
{
- BoundBox *shadow_bbox = workbench_shadow_object_shadow_bbox_get(wpd, ob, oed);
+ const BoundBox *shadow_bbox = workbench_shadow_object_shadow_bbox_get(wpd, ob, oed);
const DRWView *default_view = DRW_view_default_get();
return DRW_culling_box_test(default_view, shadow_bbox);
}
@@ -212,7 +212,7 @@ static float workbench_shadow_object_shadow_distance(WORKBENCH_PrivateData *wpd,
Object *ob,
WORKBENCH_ObjectData *oed)
{
- BoundBox *shadow_bbox = workbench_shadow_object_shadow_bbox_get(wpd, ob, oed);
+ const BoundBox *shadow_bbox = workbench_shadow_object_shadow_bbox_get(wpd, ob, oed);
const int corners[4] = {0, 3, 4, 7};
float dist = 1e4f, dist_isect;