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:
authorHans Goudey <h.goudey@me.com>2022-10-05 21:44:02 +0300
committerHans Goudey <h.goudey@me.com>2022-10-05 21:48:01 +0300
commit548a2cbe06b23d90b0e09da49fc854178c270b8a (patch)
tree8706b5be97ace0ff0ca18d4109586ccb5cf0a666 /source/blender/draw/engines
parent6306d747b770685f38f95bc57f8681335ddfa506 (diff)
Cleanup: Clang tidy
Also remove unnecessary struct keywords in C++ files.
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_engine.cc4
-rw-r--r--source/blender/draw/engines/overlay/overlay_antialiasing.cc16
-rw-r--r--source/blender/draw/engines/overlay/overlay_armature.cc32
-rw-r--r--source/blender/draw/engines/overlay/overlay_edit_uv.cc6
-rw-r--r--source/blender/draw/engines/overlay/overlay_engine.cc2
-rw-r--r--source/blender/draw/engines/overlay/overlay_extra.cc22
6 files changed, 40 insertions, 42 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_engine.cc b/source/blender/draw/engines/eevee_next/eevee_engine.cc
index 214f6a001f0..3ea6ea475d0 100644
--- a/source/blender/draw/engines/eevee_next/eevee_engine.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_engine.cc
@@ -165,9 +165,7 @@ static void eevee_render_to_image(void *vedata,
instance->render_frame(layer, viewname);
EEVEE_Data *ved = static_cast<EEVEE_Data *>(vedata);
- if (ved->instance) {
- delete ved->instance;
- }
+ delete ved->instance;
ved->instance = instance;
}
diff --git a/source/blender/draw/engines/overlay/overlay_antialiasing.cc b/source/blender/draw/engines/overlay/overlay_antialiasing.cc
index 2242ad8b609..2eefdce403c 100644
--- a/source/blender/draw/engines/overlay/overlay_antialiasing.cc
+++ b/source/blender/draw/engines/overlay/overlay_antialiasing.cc
@@ -53,7 +53,7 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata)
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
/* Small texture which will have very small impact on render-time. */
- if (txl->dummy_depth_tx == NULL) {
+ if (txl->dummy_depth_tx == nullptr) {
const float pixel[1] = {1.0f};
txl->dummy_depth_tx = DRW_texture_create_2d(
1, 1, GPU_DEPTH_COMPONENT24, DRWTextureFlag(0), pixel);
@@ -68,8 +68,8 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata)
pd->antialiasing.enabled = need_wire_expansion ||
((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0);
- GPUTexture *color_tex = NULL;
- GPUTexture *line_tex = NULL;
+ GPUTexture *color_tex = nullptr;
+ GPUTexture *line_tex = nullptr;
if (pd->antialiasing.enabled) {
DRW_texture_ensure_fullscreen_2d(&txl->overlay_color_tx, GPU_SRGB8_A8, DRW_TEX_FILTER);
@@ -107,7 +107,7 @@ void OVERLAY_antialiasing_cache_init(OVERLAY_Data *vedata)
OVERLAY_PrivateData *pd = vedata->stl->pd;
OVERLAY_PassList *psl = vedata->psl;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
- struct GPUShader *sh;
+ GPUShader *sh;
DRWShadingGroup *grp;
if (pd->antialiasing.enabled) {
@@ -124,7 +124,7 @@ void OVERLAY_antialiasing_cache_init(OVERLAY_Data *vedata)
DRW_shgroup_uniform_texture_ref(grp, "depthTex", &dtxl->depth);
DRW_shgroup_uniform_texture_ref(grp, "colorTex", &txl->overlay_color_tx);
DRW_shgroup_uniform_texture_ref(grp, "lineTex", &txl->overlay_line_tx);
- DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
+ DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
/* A bit out of place... not related to antialiasing. */
@@ -136,7 +136,7 @@ void OVERLAY_antialiasing_cache_init(OVERLAY_Data *vedata)
DRW_shgroup_uniform_texture_ref(grp, "depthTex", &dtxl->depth);
DRW_shgroup_uniform_texture_ref(grp, "xrayDepthTex", &txl->temp_depth_tx);
DRW_shgroup_uniform_float_copy(grp, "opacity", 1.0f - pd->xray_opacity);
- DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
+ DRW_shgroup_call_procedural_triangles(grp, nullptr, 1);
}
}
@@ -169,10 +169,10 @@ void OVERLAY_antialiasing_cache_finish(OVERLAY_Data *vedata)
GPU_ATTACHMENT_TEXTURE(txl->overlay_line_tx)});
}
- pd->antialiasing.do_depth_copy = !(psl->wireframe_ps == NULL ||
+ pd->antialiasing.do_depth_copy = !(psl->wireframe_ps == nullptr ||
DRW_pass_is_empty(psl->wireframe_ps)) ||
(pd->xray_enabled && pd->xray_opacity > 0.0f);
- pd->antialiasing.do_depth_infront_copy = !(psl->wireframe_xray_ps == NULL ||
+ pd->antialiasing.do_depth_infront_copy = !(psl->wireframe_xray_ps == nullptr ||
DRW_pass_is_empty(psl->wireframe_xray_ps));
const bool do_wireframe = pd->antialiasing.do_depth_copy ||
diff --git a/source/blender/draw/engines/overlay/overlay_armature.cc b/source/blender/draw/engines/overlay/overlay_armature.cc
index 45bdc9cd123..0cf9d91804a 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.cc
+++ b/source/blender/draw/engines/overlay/overlay_armature.cc
@@ -5,9 +5,9 @@
* \ingroup draw_engine
*/
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
#include "DNA_armature_types.h"
#include "DNA_constraint_types.h"
@@ -46,7 +46,7 @@
#define PT_DEFAULT_RAD 0.05f /* radius of the point batch. */
-typedef struct ArmatureDrawContext {
+struct ArmatureDrawContext {
/* Current armature object */
Object *ob;
/* bArmature *arm; */ /* TODO */
@@ -87,7 +87,7 @@ typedef struct ArmatureDrawContext {
bool show_relations;
const ThemeWireColor *bcolor; /* pchan color */
-} ArmatureDrawContext;
+};
bool OVERLAY_armature_is_pose_mode(Object *ob, const DRWContextState *draw_ctx)
{
@@ -135,7 +135,7 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
DRW_PASS_CREATE(psl->armature_bone_select_ps, state | pd->clipping_state);
float alpha = pd->overlay.xray_alpha_bone;
- struct GPUShader *sh = OVERLAY_shader_uniform_color();
+ GPUShader *sh = OVERLAY_shader_uniform_color();
DRWShadingGroup *grp;
pd->armature_bone_select_act_grp = grp = DRW_shgroup_create(sh, psl->armature_bone_select_ps);
@@ -148,8 +148,8 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata)
}
for (int i = 0; i < 2; i++) {
- struct GPUShader *sh;
- struct GPUVertFormat *format;
+ GPUShader *sh;
+ GPUVertFormat *format;
DRWShadingGroup *grp = nullptr;
OVERLAY_InstanceFormats *formats = OVERLAY_shader_instance_formats_get();
@@ -620,7 +620,7 @@ extern "C" void drw_batch_cache_generate_requested_delayed(Object *custom);
BLI_INLINE DRWCallBuffer *custom_bone_instance_shgroup(ArmatureDrawContext *ctx,
DRWShadingGroup *grp,
- struct GPUBatch *custom_geom)
+ GPUBatch *custom_geom)
{
DRWCallBuffer *buf = static_cast<DRWCallBuffer *>(
BLI_ghash_lookup(ctx->custom_shapes_ghash, custom_geom));
@@ -644,9 +644,9 @@ static void drw_shgroup_bone_custom_solid_mesh(ArmatureDrawContext *ctx,
* to assure batch cache is valid. */
DRW_mesh_batch_cache_validate(custom, mesh);
- struct GPUBatch *surf = DRW_mesh_batch_cache_get_surface(mesh);
- struct GPUBatch *edges = DRW_mesh_batch_cache_get_edge_detection(mesh, nullptr);
- struct GPUBatch *ledges = DRW_mesh_batch_cache_get_loose_edges(mesh);
+ GPUBatch *surf = DRW_mesh_batch_cache_get_surface(mesh);
+ GPUBatch *edges = DRW_mesh_batch_cache_get_edge_detection(mesh, nullptr);
+ GPUBatch *ledges = DRW_mesh_batch_cache_get_loose_edges(mesh);
BoneInstanceData inst_data;
DRWCallBuffer *buf;
@@ -688,7 +688,7 @@ static void drw_shgroup_bone_custom_mesh_wire(ArmatureDrawContext *ctx,
* to assure batch cache is valid. */
DRW_mesh_batch_cache_validate(custom, mesh);
- struct GPUBatch *geom = DRW_mesh_batch_cache_get_all_edges(mesh);
+ GPUBatch *geom = DRW_mesh_batch_cache_get_all_edges(mesh);
if (geom) {
DRWCallBuffer *buf = custom_bone_instance_shgroup(ctx, ctx->custom_wire, geom);
BoneInstanceData inst_data;
@@ -714,7 +714,7 @@ static void drw_shgroup_custom_bone_curve(ArmatureDrawContext *ctx,
/* This only handles curves without any surface. The other curve types should have been converted
* to meshes and rendered in the mesh drawing function. */
- struct GPUBatch *ledges = nullptr;
+ GPUBatch *ledges = nullptr;
if (custom->type == OB_FONT) {
ledges = DRW_cache_text_edge_wire_get(custom);
}
@@ -2066,7 +2066,7 @@ static void draw_bone_name(ArmatureDrawContext *ctx,
bArmature *arm,
const int boneflag)
{
- struct DRWTextStore *dt = DRW_text_cache_ensure();
+ DRWTextStore *dt = DRW_text_cache_ensure();
uchar color[4];
float vec[3];
@@ -2579,7 +2579,7 @@ void OVERLAY_pose_cache_populate(OVERLAY_Data *vedata, Object *ob)
{
OVERLAY_PrivateData *pd = vedata->stl->pd;
- struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
+ GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
if (POSE_is_driven_by_active_armature(ob)) {
DRW_shgroup_call(pd->armature_bone_select_act_grp, geom, ob);
diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.cc b/source/blender/draw/engines/overlay/overlay_edit_uv.cc
index 2b1af67175e..0fcbe5ab07d 100644
--- a/source/blender/draw/engines/overlay/overlay_edit_uv.cc
+++ b/source/blender/draw/engines/overlay/overlay_edit_uv.cc
@@ -36,11 +36,11 @@
/* Forward declarations. */
static void overlay_edit_uv_cache_populate(OVERLAY_Data *vedata, Object *ob);
-typedef struct OVERLAY_StretchingAreaTotals {
+struct OVERLAY_StretchingAreaTotals {
void *next, *prev;
float *total_area;
float *total_area_uv;
-} OVERLAY_StretchingAreaTotals;
+};
static OVERLAY_UVLineStyle edit_uv_line_style_from_space_image(const SpaceImage *sima)
{
@@ -328,7 +328,7 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata)
}
if (pd->edit_uv.do_tiled_image_overlay) {
- struct DRWTextStore *dt = DRW_text_cache_ensure();
+ DRWTextStore *dt = DRW_text_cache_ensure();
uchar color[4];
/* Color Management: Exception here as texts are drawn in sRGB space directly. */
UI_GetThemeColorShade4ubv(TH_BACK, 60, color);
diff --git a/source/blender/draw/engines/overlay/overlay_engine.cc b/source/blender/draw/engines/overlay/overlay_engine.cc
index c2c4706138f..f1fdfe98fdc 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.cc
+++ b/source/blender/draw/engines/overlay/overlay_engine.cc
@@ -724,7 +724,7 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_antialiasing_end(data);
}
-static void OVERLAY_engine_free(void)
+static void OVERLAY_engine_free()
{
OVERLAY_shader_free();
}
diff --git a/source/blender/draw/engines/overlay/overlay_extra.cc b/source/blender/draw/engines/overlay/overlay_extra.cc
index f0665f7e90f..724ebd64e16 100644
--- a/source/blender/draw/engines/overlay/overlay_extra.cc
+++ b/source/blender/draw/engines/overlay/overlay_extra.cc
@@ -60,8 +60,8 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata)
DRW_PASS_CREATE(psl->extra_grid_ps, state | pd->clipping_state);
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
DRWShadingGroup *grp;
- struct GPUShader *sh = OVERLAY_shader_extra_grid();
- struct GPUTexture *tex = DRW_state_is_fbo() ? dtxl->depth : txl->dummy_depth_tx;
+ GPUShader *sh = OVERLAY_shader_extra_grid();
+ GPUTexture *tex = DRW_state_is_fbo() ? dtxl->depth : txl->dummy_depth_tx;
pd->extra_grid_grp = grp = DRW_shgroup_create(sh, psl->extra_grid_ps);
DRW_shgroup_uniform_texture(grp, "depthBuffer", tex);
@@ -71,8 +71,8 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata)
for (int i = 0; i < 2; i++) {
/* Non Meshes Pass (Camera, empties, lights ...) */
- struct GPUShader *sh;
- struct GPUVertFormat *format;
+ GPUShader *sh;
+ GPUVertFormat *format;
DRWShadingGroup *grp, *grp_sub;
OVERLAY_InstanceFormats *formats = OVERLAY_shader_instance_formats_get();
@@ -248,7 +248,7 @@ OVERLAY_ExtraCallBuffers *OVERLAY_extra_call_buffer_get(OVERLAY_Data *vedata, Ob
}
void OVERLAY_extra_loose_points(OVERLAY_ExtraCallBuffers *cb,
- struct GPUBatch *geom,
+ GPUBatch *geom,
const float mat[4][4],
const float color[4])
{
@@ -258,7 +258,7 @@ void OVERLAY_extra_loose_points(OVERLAY_ExtraCallBuffers *cb,
}
void OVERLAY_extra_wire(OVERLAY_ExtraCallBuffers *cb,
- struct GPUBatch *geom,
+ GPUBatch *geom,
const float mat[4][4],
const float color[4])
{
@@ -806,7 +806,7 @@ void OVERLAY_speaker_cache_populate(OVERLAY_Data *vedata, Object *ob)
/** \name Camera
* \{ */
-typedef union OVERLAY_CameraInstanceData {
+union OVERLAY_CameraInstanceData {
/* Pack render data into object matrix and object color. */
struct {
float color[4];
@@ -842,7 +842,7 @@ typedef union OVERLAY_CameraInstanceData {
float mist_end;
};
};
-} OVERLAY_CameraInstanceData;
+};
static void camera_view3d_reconstruction(
OVERLAY_ExtraCallBuffers *cb, Scene *scene, View3D *v3d, Object *ob, const float color[4])
@@ -946,7 +946,7 @@ static void camera_view3d_reconstruction(
}
if ((v3d->flag2 & V3D_SHOW_BUNDLENAME) && !is_select) {
- struct DRWTextStore *dt = DRW_text_cache_ensure();
+ DRWTextStore *dt = DRW_text_cache_ensure();
DRW_text_cache_add(dt,
bundle_mat[3],
@@ -1333,7 +1333,7 @@ static void OVERLAY_relationship_lines(OVERLAY_ExtraCallBuffers *cb,
OVERLAY_extra_line_dashed(cb, ct->matrix[3], ob->obmat[3], constraint_color);
}
- BKE_constraint_targets_flush(curcon, &targets, 1);
+ BKE_constraint_targets_flush(curcon, &targets, true);
}
}
}
@@ -1507,7 +1507,7 @@ static void OVERLAY_object_center(OVERLAY_ExtraCallBuffers *cb,
static void OVERLAY_object_name(Object *ob, int theme_id)
{
- struct DRWTextStore *dt = DRW_text_cache_ensure();
+ DRWTextStore *dt = DRW_text_cache_ensure();
uchar color[4];
/* Color Management: Exception here as texts are drawn in sRGB space directly. */
UI_GetThemeColor4ubv(theme_id, color);