|
Blender V5.0
|
#include <draw_view.hh>
Classes | |
| struct | OffsetData |
Public Member Functions | |
| View (const char *name, int view_len=1, bool procedural=false) | |
| virtual | ~View ()=default |
| void | sync (const float4x4 &view_mat, const float4x4 &win_mat, int view_id=0) |
| void | visibility_test (bool enable) |
| void | compute_procedural_bounds () |
| bool | is_persp (int view_id=0) const |
| bool | is_inverted (int view_id=0) const |
| float | far_clip (int view_id=0) const |
| float | near_clip (int view_id=0) const |
| const float3 & | location (int view_id=0) const |
| const float3 & | forward (int view_id=0) const |
| const float4x4 & | viewmat (int view_id=0) const |
| const float4x4 & | viewinv (int view_id=0) const |
| const float4x4 & | winmat (int view_id=0) const |
| const float4x4 & | wininv (int view_id=0) const |
| const float4x4 | persmat (int view_id=0) const |
| int | visibility_word_per_draw () const |
| UniformArrayBuffer< ViewMatrices, DRW_VIEW_MAX > & | matrices_ubo_get () |
| std::array< float4, 6 > | frustum_planes_get (int view_id=0) |
| std::array< float3, 8 > | frustum_corners_get (int view_id=0) |
Static Public Member Functions | |
| static View & | default_get () |
| static void | default_set (const float4x4 &view_mat, const float4x4 &win_mat) |
Protected Member Functions | |
| void | bind () |
| virtual void | compute_visibility (ObjectBoundsBuf &bounds, ObjectInfosBuf &infos, uint resource_len, bool debug_freeze) |
| virtual VisibilityBuf & | get_visibility_buffer () |
| bool | has_computed_visibility () const |
| uint64_t | fingerprint_get () const |
| void | update_viewport_size () |
| void | frustum_boundbox_calc (int view_id) |
| void | frustum_culling_planes_calc (int view_id) |
| void | frustum_culling_sphere_calc (int view_id) |
Protected Attributes | |
| UniformArrayBuffer< ViewMatrices, DRW_VIEW_MAX > | data_ |
| UniformArrayBuffer< ViewCullingData, DRW_VIEW_MAX > | culling_ |
| UniformArrayBuffer< ViewMatrices, DRW_VIEW_MAX > | data_freeze_ |
| UniformArrayBuffer< ViewCullingData, DRW_VIEW_MAX > | culling_freeze_ |
| VisibilityBuf | visibility_buf_ |
| uint64_t | manager_fingerprint_ = 0 |
| const char * | debug_name_ |
| int | view_len_ = 0 |
| bool | is_inverted_ = false |
| bool | do_visibility_ = true |
| bool | dirty_ = true |
| bool | frozen_ = false |
| bool | procedural_ = false |
Definition at line 37 of file draw_view.hh.
|
inline |
Definition at line 70 of file draw_view.hh.
References BLI_assert, debug_name_, DRW_VIEW_MAX, name, procedural_, view_len_, and visibility_buf_.
|
virtualdefault |
|
protected |
Called from draw manager.
Definition at line 226 of file draw_view.cc.
References culling_, data_, dirty_, DRW_VIEW_CULLING_UBO_SLOT, DRW_VIEW_UBO_SLOT, GPU_uniformbuf_bind(), and procedural_.
| void blender::draw::View::compute_procedural_bounds | ( | ) |
Update culling data using a compute shader. This is to be used if the matrices were updated externally on the GPU (not using the sync() method).
Definition at line 238 of file draw_view.cc.
References culling_, data_, DRW_shader_draw_view_finalize_get(), DRW_VIEW_UBO_SLOT, GPU_BARRIER_UNIFORM, GPU_compute_dispatch(), GPU_debug_group_begin(), GPU_debug_group_end(), GPU_memory_barrier(), GPU_shader_bind(), GPU_shader_get_ssbo_binding(), GPU_uniformbuf_bind(), GPU_uniformbuf_bind_as_ssbo(), and manager_fingerprint_.
|
protectedvirtual |
Definition at line 257 of file draw_view.cc.
References ceil_to_multiple_u(), culling_, culling_freeze_, data, data_, data_freeze_, divide_ceil_u(), do_visibility_, blender::draw::drw_debug_matrix_as_bbox(), DRW_shader_draw_visibility_compute_get(), DRW_VIEW_CULLING_UBO_SLOT, DRW_VIEW_UBO_SLOT, DRW_VISIBILITY_GROUP_SIZE, frozen_, GPU_BARRIER_SHADER_STORAGE, GPU_compute_dispatch(), GPU_debug_group_begin(), GPU_debug_group_end(), GPU_memory_barrier(), GPU_shader_bind(), GPU_shader_get_ssbo_binding(), GPU_shader_uniform_1i(), GPU_storagebuf_bind(), GPU_storagebuf_clear(), GPU_uniformbuf_bind(), blender::math::invert(), max_ii(), persmat(), view_len_, visibility_buf_, and visibility_word_per_draw().
|
static |
Definition at line 317 of file draw_view.cc.
References DRWContext::data, DRWData::default_view, and drw_get().
Referenced by blender::draw::overlay::Fluids::begin_sync(), blender::draw::overlay::Instance::begin_sync(), blender::eevee::Film::display(), blender::draw::edit_select::Instance::draw(), blender::draw::gpencil::Instance::draw(), blender::draw::overlay::Instance::draw(), blender::workbench::Instance::draw(), blender::workbench::get_world_shading_rotation_matrix(), blender::draw::gpencil::Instance::init(), blender::eevee::Instance::init(), blender::workbench::SceneState::init(), blender::workbench::ShadowPass::init(), blender::draw::gpencil::render_init_buffers(), blender::draw::gpencil::render_result_z(), blender::draw::sculpt_batches_get_ex(), blender::workbench::AntiAliasingPass::setup_view(), and write_render_z_output().
|
static |
Definition at line 322 of file draw_view.cc.
References DRWContext::data, DRWData::default_view, drw_get(), and sync().
Referenced by DRWContext::acquire_data(), and workbench_render_to_image().
|
inline |
Definition at line 106 of file draw_view.hh.
References BLI_assert, data_, is_persp(), view_len_, and winmat().
Referenced by blender::draw::gpencil::render_result_z(), and write_render_z_output().
|
inlineprotected |
Definition at line 249 of file draw_view.hh.
References BLI_assert_msg.
|
inline |
Definition at line 130 of file draw_view.hh.
References BLI_assert, data_, and view_len_.
|
protected |
Definition at line 46 of file draw_view.cc.
References ARRAY_SIZE, blender::bounds::corners(), culling_, data_, i, is_persp(), left, mul_project_m4_v3(), projmat_dimensions(), top, blender::math::transform_point(), and winmat().
Referenced by sync().
| std::array< float3, 8 > blender::draw::View::frustum_corners_get | ( | int | view_id = 0 | ) |
Definition at line 337 of file draw_view.cc.
References culling_.
|
protected |
Definition at line 92 of file draw_view.cc.
References culling_, data_, len, blender::math::length(), persmat(), and planes_from_projmat().
Referenced by sync().
|
protected |
Definition at line 111 of file draw_view.cc.
References add_v3_v3(), ARRAY_SIZE, BoundSphere::center, CLAMP, copy_v3_fl3(), copy_v3_v3(), culling_, data_, e, F, i, interp_v3_v3v3(), len, len_squared_v3(), len_squared_v3v3(), len_v2(), len_v3v3(), mid_v3_v3v3(), mul_m4_v3(), mul_v2_v2fl(), mul_v3_fl(), mul_v3_project_m4_v3(), N, BoundSphere::radius, sub_v2_v2(), viewinv(), wininv(), winmat(), and z().
Referenced by sync().
| std::array< float4, 6 > blender::draw::View::frustum_planes_get | ( | int | view_id = 0 | ) |
Definition at line 327 of file draw_view.cc.
References culling_.
Referenced by blender::workbench::ShadowPass::init(), and blender::draw::sculpt_batches_get_ex().
|
protectedvirtual |
Definition at line 312 of file draw_view.cc.
References visibility_buf_.
|
inlineprotected |
Definition at line 239 of file draw_view.hh.
References manager_fingerprint_.
|
inline |
Definition at line 99 of file draw_view.hh.
References BLI_assert, is_inverted_, UNUSED_VARS_NDEBUG, and view_len_.
|
inline |
Definition at line 93 of file draw_view.hh.
References BLI_assert, data_, and view_len_.
Referenced by blender::eevee::VolumeModule::draw_prepass(), far_clip(), frustum_boundbox_calc(), and near_clip().
|
inline |
Definition at line 124 of file draw_view.hh.
References BLI_assert, data_, and view_len_.
|
inline |
Definition at line 172 of file draw_view.hh.
References data_.
|
inline |
Definition at line 115 of file draw_view.hh.
References BLI_assert, data_, is_persp(), view_len_, and winmat().
Referenced by blender::draw::gpencil::render_result_z(), and write_render_z_output().
|
inline |
Definition at line 161 of file draw_view.hh.
References BLI_assert, data_, and view_len_.
Referenced by compute_visibility(), frustum_culling_planes_calc(), blender::workbench::SceneState::init(), blender::eevee::RayTraceModule::render(), and blender::workbench::AntiAliasingPass::setup_view().
| void blender::draw::View::sync | ( | const float4x4 & | view_mat, |
| const float4x4 & | win_mat, | ||
| int | view_id = 0 ) |
Definition at line 27 of file draw_view.cc.
References data_, dirty_, frustum_boundbox_calc(), frustum_culling_planes_calc(), frustum_culling_sphere_calc(), blender::math::invert(), is_inverted_, is_negative_m4(), manager_fingerprint_, and blender::MatBase< T, NumCol, NumRow, Alignment >::ptr().
Referenced by default_set(), blender::eevee::PlanarProbeModule::set_view(), and blender::draw::test_draw_submit_only().
|
protected |
|
inline |
Definition at line 142 of file draw_view.hh.
References BLI_assert, data_, and view_len_.
Referenced by blender::draw::overlay::Fluids::begin_sync(), blender::eevee::VolumeModule::draw_prepass(), frustum_culling_sphere_calc(), and blender::draw::gpencil::Instance::init().
|
inline |
Definition at line 136 of file draw_view.hh.
References BLI_assert, data_, and view_len_.
Referenced by blender::eevee::VolumeModule::draw_compute(), blender::eevee::VolumeModule::draw_prepass(), blender::workbench::get_world_shading_rotation_matrix(), blender::workbench::ShadowPass::init(), and blender::workbench::AntiAliasingPass::setup_view().
|
inline |
Enable or disable every visibility test (frustum culling, HiZ culling).
Definition at line 81 of file draw_view.hh.
References do_visibility_.
|
inline |
Definition at line 167 of file draw_view.hh.
References divide_ceil_u(), and view_len_.
Referenced by compute_visibility().
|
inline |
Definition at line 154 of file draw_view.hh.
References BLI_assert, data_, and view_len_.
Referenced by frustum_culling_sphere_calc().
|
inline |
Definition at line 148 of file draw_view.hh.
References BLI_assert, data_, and view_len_.
Referenced by blender::eevee::VolumeModule::draw_prepass(), far_clip(), frustum_boundbox_calc(), frustum_culling_sphere_calc(), near_clip(), blender::draw::View::OffsetData::polygon_offset_factor(), blender::draw::gpencil::render_result_z(), blender::workbench::AntiAliasingPass::setup_view(), and blender::draw::View::OffsetData::winmat_polygon_offset().
|
protected |
Definition at line 50 of file draw_view.hh.
Referenced by bind(), compute_procedural_bounds(), compute_visibility(), frustum_boundbox_calc(), frustum_corners_get(), frustum_culling_planes_calc(), frustum_culling_sphere_calc(), and frustum_planes_get().
|
protected |
Definition at line 53 of file draw_view.hh.
Referenced by compute_visibility().
|
protected |
TODO(fclem): Maybe try to reduce the minimum cost if the number of view is lower.
Definition at line 49 of file draw_view.hh.
Referenced by bind(), compute_procedural_bounds(), compute_visibility(), far_clip(), forward(), frustum_boundbox_calc(), frustum_culling_planes_calc(), frustum_culling_sphere_calc(), is_persp(), location(), matrices_ubo_get(), near_clip(), persmat(), sync(), viewinv(), viewmat(), wininv(), and winmat().
|
protected |
Frozen version of data_ used for debugging culling.
Definition at line 52 of file draw_view.hh.
Referenced by compute_visibility().
|
protected |
Definition at line 59 of file draw_view.hh.
Referenced by View().
|
protected |
Definition at line 65 of file draw_view.hh.
|
protected |
Definition at line 64 of file draw_view.hh.
Referenced by compute_visibility(), and visibility_test().
|
protected |
Definition at line 66 of file draw_view.hh.
Referenced by compute_visibility().
|
protected |
Definition at line 63 of file draw_view.hh.
Referenced by is_inverted(), and sync().
|
protected |
Definition at line 57 of file draw_view.hh.
Referenced by compute_procedural_bounds(), has_computed_visibility(), and sync().
|
protected |
Definition at line 67 of file draw_view.hh.
|
protected |
Definition at line 61 of file draw_view.hh.
Referenced by compute_visibility(), far_clip(), forward(), is_inverted(), is_persp(), location(), near_clip(), persmat(), View(), viewinv(), viewmat(), visibility_word_per_draw(), wininv(), and winmat().
|
protected |
Result of the visibility computation. 1 bit or 1 or 2 word per resource ID per view.
Definition at line 55 of file draw_view.hh.
Referenced by compute_visibility(), get_visibility_buffer(), and View().