Cleanup: DRW: Rename ViewInfos to ViewMatrices
This makes sense now that the struct only contains matrices.
This commit is contained in:
@@ -298,7 +298,6 @@ const float *DRW_viewport_invert_size_get(void)
|
||||
return DST.inv_size;
|
||||
}
|
||||
|
||||
|
||||
const float *DRW_viewport_pixelsize_get(void)
|
||||
{
|
||||
return &DST.pixsize;
|
||||
@@ -599,7 +598,7 @@ static void drw_manager_init(DRWManager *dst, GPUViewport *viewport, const int s
|
||||
}
|
||||
|
||||
if (G_draw.view_ubo == NULL) {
|
||||
G_draw.view_ubo = GPU_uniformbuf_create_ex(sizeof(ViewInfos), NULL, "G_draw.view_ubo");
|
||||
G_draw.view_ubo = GPU_uniformbuf_create_ex(sizeof(ViewMatrices), NULL, "G_draw.view_ubo");
|
||||
}
|
||||
|
||||
if (G_draw.clipping_ubo == NULL) {
|
||||
|
||||
@@ -441,7 +441,7 @@ struct DRWView {
|
||||
/** Parent view if this is a sub view. NULL otherwise. */
|
||||
struct DRWView *parent;
|
||||
|
||||
ViewInfos storage;
|
||||
ViewMatrices storage;
|
||||
|
||||
float4 clip_planes[6];
|
||||
|
||||
@@ -624,7 +624,7 @@ typedef struct DRWManager {
|
||||
uint primary_view_num;
|
||||
/** TODO(@fclem): Remove this. Only here to support
|
||||
* shaders without common_view_lib.glsl */
|
||||
ViewInfos view_storage_cpy;
|
||||
ViewMatrices view_storage_cpy;
|
||||
|
||||
#ifdef USE_GPU_SELECT
|
||||
uint select_id;
|
||||
|
||||
@@ -695,7 +695,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
|
||||
drw_call_calc_orco(ob, ob_infos->orcotexfac);
|
||||
/* Random float value. */
|
||||
uint random = (DST.dupli_source) ?
|
||||
DST.dupli_source->random_id :
|
||||
DST.dupli_source->random_id :
|
||||
/* TODO(fclem): this is rather costly to do at runtime. Maybe we can
|
||||
* put it in ob->runtime and make depsgraph ensure it is up to date. */
|
||||
BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
|
||||
@@ -2145,7 +2145,7 @@ static void draw_view_matrix_state_update(DRWView *view,
|
||||
const float viewmat[4][4],
|
||||
const float winmat[4][4])
|
||||
{
|
||||
ViewInfos *storage = &view->storage;
|
||||
ViewMatrices *storage = &view->storage;
|
||||
|
||||
copy_m4_m4(storage->viewmat.values, viewmat);
|
||||
invert_m4_m4(storage->viewinv.values, storage->viewmat.values);
|
||||
@@ -2354,14 +2354,14 @@ float DRW_view_far_distance_get(const DRWView *view)
|
||||
void DRW_view_viewmat_get(const DRWView *view, float mat[4][4], bool inverse)
|
||||
{
|
||||
view = (view) ? view : DST.view_default;
|
||||
const ViewInfos *storage = &view->storage;
|
||||
const ViewMatrices *storage = &view->storage;
|
||||
copy_m4_m4(mat, (inverse) ? storage->viewinv.values : storage->viewmat.values);
|
||||
}
|
||||
|
||||
void DRW_view_winmat_get(const DRWView *view, float mat[4][4], bool inverse)
|
||||
{
|
||||
view = (view) ? view : DST.view_default;
|
||||
const ViewInfos *storage = &view->storage;
|
||||
const ViewMatrices *storage = &view->storage;
|
||||
copy_m4_m4(mat, (inverse) ? storage->wininv.values : storage->winmat.values);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# include "draw_defines.h"
|
||||
|
||||
typedef struct ViewCullingData ViewCullingData;
|
||||
typedef struct ViewInfos ViewInfos;
|
||||
typedef struct ViewMatrices ViewMatrices;
|
||||
typedef struct ObjectMatrices ObjectMatrices;
|
||||
typedef struct ObjectInfos ObjectInfos;
|
||||
typedef struct ObjectBounds ObjectBounds;
|
||||
@@ -60,14 +60,13 @@ struct ViewCullingData {
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ViewCullingData, 16)
|
||||
|
||||
struct ViewInfos {
|
||||
/* View matrices */
|
||||
struct ViewMatrices {
|
||||
float4x4 viewmat;
|
||||
float4x4 viewinv;
|
||||
float4x4 winmat;
|
||||
float4x4 wininv;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ViewInfos, 16)
|
||||
BLI_STATIC_ASSERT_ALIGN(ViewMatrices, 16)
|
||||
|
||||
/* Do not override old definitions if the shader uses this header but not shader info. */
|
||||
#ifdef USE_GPU_SHADER_CREATE_INFO
|
||||
|
||||
@@ -218,7 +218,7 @@ void View::bind()
|
||||
void View::compute_visibility(ObjectBoundsBuf &bounds, uint resource_len, bool debug_freeze)
|
||||
{
|
||||
if (debug_freeze && frozen_ == false) {
|
||||
data_freeze_ = static_cast<ViewInfos>(data_);
|
||||
data_freeze_ = static_cast<ViewMatrices>(data_);
|
||||
data_freeze_.push_update();
|
||||
culling_freeze_ = static_cast<ViewCullingData>(culling_);
|
||||
culling_freeze_.push_update();
|
||||
|
||||
@@ -25,10 +25,10 @@ class View {
|
||||
friend Manager;
|
||||
|
||||
private:
|
||||
UniformBuffer<ViewInfos> data_;
|
||||
UniformBuffer<ViewMatrices> data_;
|
||||
UniformBuffer<ViewCullingData> culling_;
|
||||
/** Frozen version of data_ used for debugging culling. */
|
||||
UniformBuffer<ViewInfos> data_freeze_;
|
||||
UniformBuffer<ViewMatrices> data_freeze_;
|
||||
UniformBuffer<ViewCullingData> culling_freeze_;
|
||||
/** Result of the visibility computation. 1 bit per resource ID. */
|
||||
VisibilityBuf visibility_buf_;
|
||||
|
||||
@@ -45,7 +45,7 @@ GPU_SHADER_CREATE_INFO(draw_resource_handle)
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(draw_view)
|
||||
.uniform_buf(DRW_VIEW_UBO_SLOT, "ViewInfos", "drw_view", Frequency::PASS)
|
||||
.uniform_buf(DRW_VIEW_UBO_SLOT, "ViewMatrices", "drw_view", Frequency::PASS)
|
||||
.typedef_source("draw_shader_shared.h");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(draw_view_culling)
|
||||
|
||||
Reference in New Issue
Block a user