Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_view.cc
| Show All 25 Lines | void View::sync(const float4x4 &view_mat, const float4x4 &win_mat, int view_id) | ||||
| frustum_boundbox_calc(view_id); | frustum_boundbox_calc(view_id); | ||||
| frustum_culling_planes_calc(view_id); | frustum_culling_planes_calc(view_id); | ||||
| frustum_culling_sphere_calc(view_id); | frustum_culling_sphere_calc(view_id); | ||||
| dirty_ = true; | dirty_ = true; | ||||
| } | } | ||||
| void View::sync(const DRWView *view) | |||||
| { | |||||
| float4x4 view_mat, win_mat; | |||||
| DRW_view_viewmat_get(view, view_mat.ptr(), false); | |||||
| DRW_view_winmat_get(view, win_mat.ptr(), false); | |||||
| this->sync(view_mat, win_mat); | |||||
| } | |||||
| void View::frustum_boundbox_calc(int view_id) | void View::frustum_boundbox_calc(int view_id) | ||||
| { | { | ||||
| /* Extract the 8 corners from a Projection Matrix. */ | /* Extract the 8 corners from a Projection Matrix. */ | ||||
| #if 0 /* Equivalent to this but it has accuracy problems. */ | #if 0 /* Equivalent to this but it has accuracy problems. */ | ||||
| BKE_boundbox_init_from_minmax(&bbox, float3(-1.0f),float3(1.0f)); | BKE_boundbox_init_from_minmax(&bbox, float3(-1.0f),float3(1.0f)); | ||||
| for (int i = 0; i < 8; i++) { | for (int i = 0; i < 8; i++) { | ||||
| mul_project_m4_v3(data_.wininv.ptr(), bbox.vec[i]); | mul_project_m4_v3(data_.wininv.ptr(), bbox.vec[i]); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | if (frozen_) { | ||||
| /* Bind back the non frozen data. */ | /* Bind back the non frozen data. */ | ||||
| GPU_uniformbuf_bind(data_, DRW_VIEW_UBO_SLOT); | GPU_uniformbuf_bind(data_, DRW_VIEW_UBO_SLOT); | ||||
| GPU_uniformbuf_bind(culling_, DRW_VIEW_CULLING_UBO_SLOT); | GPU_uniformbuf_bind(culling_, DRW_VIEW_CULLING_UBO_SLOT); | ||||
| } | } | ||||
| GPU_debug_group_end(); | GPU_debug_group_end(); | ||||
| } | } | ||||
| VisibilityBuf &View::get_visibility_buffer() | |||||
| { | |||||
| return visibility_buf_; | |||||
| } | |||||
| } // namespace blender::draw | } // namespace blender::draw | ||||