DRW: Add view param to DRW_culling_* functions
This commit is contained in:
@@ -466,7 +466,8 @@ static bool eevee_lightprobes_culling_test(Object *ob)
|
||||
for (int v = 0; v < 8; ++v) {
|
||||
mul_m4_v3(tmp, bbox.vec[v]);
|
||||
}
|
||||
return DRW_culling_box_test(&bbox);
|
||||
const DRWView *default_view = DRW_view_default_get();
|
||||
return DRW_culling_box_test(default_view, &bbox);
|
||||
}
|
||||
case LIGHTPROBE_TYPE_CUBE:
|
||||
return true; /* TODO */
|
||||
|
||||
@@ -1347,8 +1347,9 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, DRWView
|
||||
.center = {ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]},
|
||||
.radius = light_attenuation_radius_get(la, light_threshold),
|
||||
};
|
||||
cube_visible[i] = DRW_culling_sphere_test(&bsphere);
|
||||
cube_visible[i] = DRW_culling_sphere_test(view, &bsphere);
|
||||
}
|
||||
|
||||
bool cascade_visible[MAX_SHADOW_CASCADE];
|
||||
for (i = 0; (ob = linfo->shadow_cascade_ref[i]) && (i < MAX_SHADOW_CASCADE); i++) {
|
||||
EEVEE_LightEngineData *led = EEVEE_light_data_get(ob);
|
||||
@@ -1359,7 +1360,7 @@ void EEVEE_draw_shadows(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, DRWView
|
||||
plane_from_point_normal_v3(plane, sh_data->viewmat[3], sh_data->viewmat[2]);
|
||||
/* TODO: check against near/far instead of "local Z = 0" plane.
|
||||
* Or even the cascades AABB. */
|
||||
cascade_visible[i] = DRW_culling_plane_test(plane);
|
||||
cascade_visible[i] = DRW_culling_plane_test(view, plane);
|
||||
}
|
||||
|
||||
/* Cube Shadow Maps */
|
||||
|
||||
@@ -230,7 +230,8 @@ bool studiolight_object_cast_visible_shadow(WORKBENCH_PrivateData *wpd,
|
||||
WORKBENCH_ObjectData *oed)
|
||||
{
|
||||
BoundBox *shadow_bbox = studiolight_object_shadow_bbox_get(wpd, ob, oed);
|
||||
return DRW_culling_box_test(shadow_bbox);
|
||||
const DRWView *default_view = DRW_view_default_get();
|
||||
return DRW_culling_box_test(default_view, shadow_bbox);
|
||||
}
|
||||
|
||||
float studiolight_object_shadow_distance(WORKBENCH_PrivateData *wpd,
|
||||
|
||||
@@ -573,10 +573,9 @@ float DRW_view_far_distance_get(const DRWView *view);
|
||||
bool DRW_view_is_persp_get(const DRWView *view);
|
||||
|
||||
/* Culling, return true if object is inside view frustum. */
|
||||
/* TODO */
|
||||
// bool DRW_culling_sphere_test(DRWView *view, BoundSphere *bsphere);
|
||||
// bool DRW_culling_box_test(DRWView *view, BoundBox *bbox);
|
||||
// bool DRW_culling_plane_test(DRWView *view, float plane[4]);
|
||||
bool DRW_culling_sphere_test(const DRWView *view, const BoundSphere *bsphere);
|
||||
bool DRW_culling_box_test(const DRWView *view, const BoundBox *bbox);
|
||||
bool DRW_culling_plane_test(const DRWView *view, const float plane[4]);
|
||||
|
||||
/* Viewport */
|
||||
typedef enum {
|
||||
@@ -688,11 +687,6 @@ void DRW_state_lock(DRWState state);
|
||||
|
||||
void DRW_state_clip_planes_len_set(uint plane_len);
|
||||
|
||||
/* Culling, return true if object is inside view frustum. */
|
||||
bool DRW_culling_sphere_test(const BoundSphere *bsphere);
|
||||
bool DRW_culling_box_test(const BoundBox *bbox);
|
||||
bool DRW_culling_plane_test(const float plane[4]);
|
||||
|
||||
void DRW_culling_frustum_corners_get(BoundBox *corners);
|
||||
void DRW_culling_frustum_planes_get(float planes[6][4]);
|
||||
|
||||
|
||||
@@ -479,24 +479,26 @@ static bool draw_culling_plane_test(const BoundBox *corners, const float plane[4
|
||||
|
||||
/* Return True if the given BoundSphere intersect the current view frustum.
|
||||
* bsphere must be in world space. */
|
||||
bool DRW_culling_sphere_test(const BoundSphere *bsphere)
|
||||
bool DRW_culling_sphere_test(const DRWView *view, const BoundSphere *bsphere)
|
||||
{
|
||||
return draw_culling_sphere_test(
|
||||
&DST.view_active->frustum_bsphere, DST.view_active->frustum_planes, bsphere);
|
||||
view = view ? view : DST.view_default;
|
||||
return draw_culling_sphere_test(&view->frustum_bsphere, view->frustum_planes, bsphere);
|
||||
}
|
||||
|
||||
/* Return True if the given BoundBox intersect the current view frustum.
|
||||
* bbox must be in world space. */
|
||||
bool DRW_culling_box_test(const BoundBox *bbox)
|
||||
bool DRW_culling_box_test(const DRWView *view, const BoundBox *bbox)
|
||||
{
|
||||
return draw_culling_box_test(DST.view_active->frustum_planes, bbox);
|
||||
view = view ? view : DST.view_default;
|
||||
return draw_culling_box_test(view->frustum_planes, bbox);
|
||||
}
|
||||
|
||||
/* Return True if the view frustum is inside or intersect the given plane.
|
||||
* plane must be in world space. */
|
||||
bool DRW_culling_plane_test(const float plane[4])
|
||||
bool DRW_culling_plane_test(const DRWView *view, const float plane[4])
|
||||
{
|
||||
return draw_culling_plane_test(&DST.view_active->frustum_corners, plane);
|
||||
view = view ? view : DST.view_default;
|
||||
return draw_culling_plane_test(&view->frustum_corners, plane);
|
||||
}
|
||||
|
||||
void DRW_culling_frustum_corners_get(BoundBox *corners)
|
||||
|
||||
Reference in New Issue
Block a user