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:
authorClément Foucault <foucault.clem@gmail.com>2019-05-21 17:55:17 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-22 14:29:05 +0300
commit742848843dd04df530f25ac5111cfc2f16237f51 (patch)
tree66a135625015608516bcf28c366744d772c8bafe /source/blender/draw/intern
parent925b5823ccbc4fb3f7f90b29950e3d7bb0d5c90e (diff)
DRW: Add view param to DRW_culling_* functions
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/DRW_render.h12
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c16
2 files changed, 12 insertions, 16 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index b2ae71d8653..378bb23188c 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -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]);
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index f6d18aeed3d..36e9244df06 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -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)