diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-10-05 22:54:10 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-10-07 13:43:09 +0300 |
commit | 055680a89e4b37662daf0c397539866a42c6d54a (patch) | |
tree | b0a6f4926f4ba72bbf323c1c4eca5799cc55e045 /source/blender/draw/intern/draw_view.cc | |
parent | f43c2d9abe0f8b6efca8fa803774a065a6749a88 (diff) |
DRW: Split ViewCullingData out of ViewInfos
This is in order to reduce the size of ViewInfos and support multi view
rendering.
Diffstat (limited to 'source/blender/draw/intern/draw_view.cc')
-rw-r--r-- | source/blender/draw/intern/draw_view.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/draw/intern/draw_view.cc b/source/blender/draw/intern/draw_view.cc index 1e739cf0871..bf3505c7645 100644 --- a/source/blender/draw/intern/draw_view.cc +++ b/source/blender/draw/intern/draw_view.cc @@ -28,8 +28,8 @@ void View::sync(const float4x4 &view_mat, const float4x4 &win_mat) update_view_vectors(); - BoundBox &bound_box = *reinterpret_cast<BoundBox *>(&data_.frustum_corners); - BoundSphere &bound_sphere = *reinterpret_cast<BoundSphere *>(&data_.frustum_bound_sphere); + BoundBox &bound_box = *reinterpret_cast<BoundBox *>(&culling_.corners); + BoundSphere &bound_sphere = *reinterpret_cast<BoundSphere *>(&culling_.bound_sphere); frustum_boundbox_calc(bound_box); frustum_culling_planes_calc(); frustum_culling_sphere_calc(bound_box, bound_sphere); @@ -83,16 +83,16 @@ void View::frustum_culling_planes_calc() { float4x4 persmat = data_.winmat * data_.viewmat; planes_from_projmat(persmat.ptr(), - data_.frustum_planes[0], - data_.frustum_planes[5], - data_.frustum_planes[1], - data_.frustum_planes[3], - data_.frustum_planes[4], - data_.frustum_planes[2]); + culling_.planes[0], + culling_.planes[5], + culling_.planes[1], + culling_.planes[3], + culling_.planes[4], + culling_.planes[2]); /* Normalize. */ for (int p = 0; p < 6; p++) { - data_.frustum_planes[p].w /= normalize_v3(data_.frustum_planes[p]); + culling_.planes[p].w /= normalize_v3(culling_.planes[p]); } } @@ -284,9 +284,11 @@ void View::bind() if (dirty_) { dirty_ = false; data_.push_update(); + culling_.push_update(); } GPU_uniformbuf_bind(data_, DRW_VIEW_UBO_SLOT); + GPU_uniformbuf_bind(culling_, DRW_VIEW_CULLING_UBO_SLOT); } void View::compute_visibility(ObjectBoundsBuf &bounds, uint resource_len, bool debug_freeze) @@ -294,6 +296,8 @@ void View::compute_visibility(ObjectBoundsBuf &bounds, uint resource_len, bool d if (debug_freeze && frozen_ == false) { data_freeze_ = static_cast<ViewInfos>(data_); data_freeze_.push_update(); + culling_freeze_ = static_cast<ViewCullingData>(culling_); + culling_freeze_.push_update(); } #ifdef DEBUG if (debug_freeze) { |