Cleanup: redundant struct qualifier & long lines
This commit is contained in:
parent
d21a4407dc
commit
c4780ee459
|
@ -159,8 +159,8 @@ typedef struct DRWDynamicCall {
|
|||
struct DRWShadingGroup {
|
||||
struct DRWShadingGroup *next, *prev;
|
||||
|
||||
struct GPUShader *shader; /* Shader to bind */
|
||||
struct DRWInterface *interface; /* Uniforms pointers */
|
||||
GPUShader *shader; /* Shader to bind */
|
||||
DRWInterface *interface; /* Uniforms pointers */
|
||||
ListBase calls; /* DRWCall or DRWDynamicCall depending of type*/
|
||||
DRWState state; /* State changes for this batch only */
|
||||
int type;
|
||||
|
|
|
@ -107,12 +107,12 @@ static struct {
|
|||
* Add sources to source/blender/draw/modes/shaders
|
||||
* init in EDIT_CURVE_engine_init();
|
||||
* free in EDIT_CURVE_engine_free(); */
|
||||
struct GPUShader *surface_sh;
|
||||
GPUShader *surface_sh;
|
||||
|
||||
struct GPUShader *wire_sh;
|
||||
GPUShader *wire_sh;
|
||||
|
||||
struct GPUShader *overlay_edge_sh; /* handles and nurbs control cage */
|
||||
struct GPUShader *overlay_vert_sh;
|
||||
GPUShader *overlay_edge_sh; /* handles and nurbs control cage */
|
||||
GPUShader *overlay_vert_sh;
|
||||
|
||||
} e_data = {NULL}; /* Engine data */
|
||||
|
||||
|
|
|
@ -102,9 +102,9 @@ static struct {
|
|||
* Add sources to source/blender/draw/modes/shaders
|
||||
* init in EDIT_LATTICE_engine_init();
|
||||
* free in EDIT_LATTICE_engine_free(); */
|
||||
struct GPUShader *wire_sh;
|
||||
GPUShader *wire_sh;
|
||||
|
||||
struct GPUShader *overlay_vert_sh;
|
||||
GPUShader *overlay_vert_sh;
|
||||
|
||||
} e_data = {NULL}; /* Engine data */
|
||||
|
||||
|
|
|
@ -87,19 +87,19 @@ typedef struct EDIT_MESH_Data {
|
|||
/* *********** STATIC *********** */
|
||||
|
||||
static struct {
|
||||
struct GPUShader *overlay_tri_sh;
|
||||
struct GPUShader *overlay_tri_fast_sh;
|
||||
struct GPUShader *overlay_tri_vcol_sh;
|
||||
struct GPUShader *overlay_tri_vcol_fast_sh;
|
||||
struct GPUShader *overlay_edge_sh;
|
||||
struct GPUShader *overlay_edge_vcol_sh;
|
||||
struct GPUShader *overlay_vert_sh;
|
||||
struct GPUShader *overlay_facedot_sh;
|
||||
struct GPUShader *overlay_mix_sh;
|
||||
struct GPUShader *overlay_facefill_sh;
|
||||
struct GPUShader *normals_face_sh;
|
||||
struct GPUShader *normals_sh;
|
||||
struct GPUShader *depth_sh;
|
||||
GPUShader *overlay_tri_sh;
|
||||
GPUShader *overlay_tri_fast_sh;
|
||||
GPUShader *overlay_tri_vcol_sh;
|
||||
GPUShader *overlay_tri_vcol_fast_sh;
|
||||
GPUShader *overlay_edge_sh;
|
||||
GPUShader *overlay_edge_vcol_sh;
|
||||
GPUShader *overlay_vert_sh;
|
||||
GPUShader *overlay_facedot_sh;
|
||||
GPUShader *overlay_mix_sh;
|
||||
GPUShader *overlay_facefill_sh;
|
||||
GPUShader *normals_face_sh;
|
||||
GPUShader *normals_sh;
|
||||
GPUShader *depth_sh;
|
||||
} e_data = {NULL}; /* Engine data */
|
||||
|
||||
typedef struct g_data {
|
||||
|
@ -231,7 +231,7 @@ static DRWPass *edit_mesh_create_overlay_pass(
|
|||
DRWShadingGroup **r_face_shgrp, DRWShadingGroup **r_ledges_shgrp,
|
||||
DRWShadingGroup **r_lverts_shgrp, DRWShadingGroup **r_facedot_shgrp)
|
||||
{
|
||||
static struct GPUShader *tri_sh, *ledge_sh;
|
||||
GPUShader *tri_sh, *ledge_sh;
|
||||
const struct bContext *C = DRW_get_context();
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
|
|
@ -181,10 +181,10 @@ typedef struct g_data{
|
|||
} g_data; /* Transient data */
|
||||
|
||||
static struct {
|
||||
struct GPUShader *outline_resolve_sh;
|
||||
struct GPUShader *outline_detect_sh;
|
||||
struct GPUShader *outline_fade_sh;
|
||||
struct GPUShader *grid_sh;
|
||||
GPUShader *outline_resolve_sh;
|
||||
GPUShader *outline_detect_sh;
|
||||
GPUShader *outline_fade_sh;
|
||||
GPUShader *grid_sh;
|
||||
float camera_pos[3];
|
||||
float grid_settings[5];
|
||||
float grid_mat[4][4];
|
||||
|
@ -215,16 +215,20 @@ static void OBJECT_engine_init(void *vedata)
|
|||
|
||||
const float *viewport_size = DRW_viewport_size_get();
|
||||
|
||||
DRWFboTexture tex[2] = {{&txl->outlines_depth_tx, DRW_BUF_DEPTH_24, 0},
|
||||
{&txl->outlines_color_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
DRW_framebuffer_init(&fbl->outlines,
|
||||
(int)viewport_size[0], (int)viewport_size[1],
|
||||
tex, 2);
|
||||
DRWFboTexture tex[2] = {
|
||||
{&txl->outlines_depth_tx, DRW_BUF_DEPTH_24, 0},
|
||||
{&txl->outlines_color_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER},
|
||||
};
|
||||
DRW_framebuffer_init(
|
||||
&fbl->outlines,
|
||||
(int)viewport_size[0], (int)viewport_size[1],
|
||||
tex, 2);
|
||||
|
||||
DRWFboTexture blur_tex = {&txl->outlines_blur_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER};
|
||||
DRW_framebuffer_init(&fbl->blur,
|
||||
(int)viewport_size[0], (int)viewport_size[1],
|
||||
&blur_tex, 1);
|
||||
DRW_framebuffer_init(
|
||||
&fbl->blur,
|
||||
(int)viewport_size[0], (int)viewport_size[1],
|
||||
&blur_tex, 1);
|
||||
|
||||
if (!e_data.outline_resolve_sh) {
|
||||
e_data.outline_resolve_sh = DRW_shader_create_fullscreen(datatoc_object_outline_resolve_frag_glsl, NULL);
|
||||
|
@ -239,9 +243,10 @@ static void OBJECT_engine_init(void *vedata)
|
|||
}
|
||||
|
||||
if (!e_data.grid_sh) {
|
||||
e_data.grid_sh = DRW_shader_create_with_lib(datatoc_object_grid_vert_glsl, NULL,
|
||||
datatoc_object_grid_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl, NULL);
|
||||
e_data.grid_sh = DRW_shader_create_with_lib(
|
||||
datatoc_object_grid_vert_glsl, NULL,
|
||||
datatoc_object_grid_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl, NULL);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -385,7 +390,7 @@ static void OBJECT_engine_free(void)
|
|||
DRW_SHADER_FREE_SAFE(e_data.grid_sh);
|
||||
}
|
||||
|
||||
static DRWShadingGroup *shgroup_outline(DRWPass *pass, const float col[4], struct GPUShader *sh)
|
||||
static DRWShadingGroup *shgroup_outline(DRWPass *pass, const float col[4], GPUShader *sh)
|
||||
{
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
|
||||
DRW_shgroup_uniform_vec4(grp, "color", col, 1);
|
||||
|
@ -394,7 +399,7 @@ static DRWShadingGroup *shgroup_outline(DRWPass *pass, const float col[4], struc
|
|||
}
|
||||
|
||||
/* currently same as 'shgroup_outline', new function to avoid confustion */
|
||||
static DRWShadingGroup *shgroup_wire(DRWPass *pass, const float col[4], struct GPUShader *sh)
|
||||
static DRWShadingGroup *shgroup_wire(DRWPass *pass, const float col[4], GPUShader *sh)
|
||||
{
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
|
||||
DRW_shgroup_uniform_vec4(grp, "color", col, 1);
|
||||
|
@ -452,7 +457,7 @@ static void OBJECT_cache_init(void *vedata)
|
|||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_WIRE;
|
||||
psl->outlines = DRW_pass_create("Outlines Pass", state);
|
||||
|
||||
struct GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* Select */
|
||||
stl->g_data->outlines_select = shgroup_outline(psl->outlines, ts.colorSelect, sh);
|
||||
|
@ -598,7 +603,9 @@ static void OBJECT_cache_init(void *vedata)
|
|||
/* Non Meshes Pass (Camera, empties, lamps ...) */
|
||||
struct Batch *geom;
|
||||
|
||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND | DRW_STATE_POINT;
|
||||
DRWState state =
|
||||
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
||||
DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND | DRW_STATE_POINT;
|
||||
state |= DRW_STATE_WIRE;
|
||||
psl->non_meshes = DRW_pass_create("Non Meshes Pass", state);
|
||||
|
||||
|
@ -668,7 +675,7 @@ static void OBJECT_cache_init(void *vedata)
|
|||
}
|
||||
|
||||
{
|
||||
struct GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* Unselected */
|
||||
stl->g_data->wire = shgroup_wire(psl->non_meshes, ts.colorWire, sh);
|
||||
|
@ -766,7 +773,7 @@ static void OBJECT_cache_init(void *vedata)
|
|||
outlineWidth = 1.0f * U.pixelsize;
|
||||
size = U.obcenter_dia * U.pixelsize + outlineWidth;
|
||||
|
||||
struct GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA);
|
||||
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA);
|
||||
|
||||
/* Active */
|
||||
grp = DRW_shgroup_point_batch_create(sh, psl->ob_center);
|
||||
|
@ -942,7 +949,9 @@ static void DRW_shgroup_camera(OBJECT_StorageList *stl, Object *ob, SceneLayer *
|
|||
|
||||
/* Active cam */
|
||||
if (is_active) {
|
||||
DRW_shgroup_dynamic_call_add(stl->g_data->camera_tria, color, cam->drwcorners, &cam->drwdepth, cam->drwtria, ob->obmat);
|
||||
DRW_shgroup_dynamic_call_add(
|
||||
stl->g_data->camera_tria, color,
|
||||
cam->drwcorners, &cam->drwdepth, cam->drwtria, ob->obmat);
|
||||
}
|
||||
|
||||
/* draw the rest in normalize object space */
|
||||
|
@ -959,10 +968,16 @@ static void DRW_shgroup_camera(OBJECT_StorageList *stl, Object *ob, SceneLayer *
|
|||
size_to_mat4(sizemat, size);
|
||||
mul_m4_m4m4(cam->drwfocusmat, cam->drwfocusmat, sizemat);
|
||||
|
||||
DRW_shgroup_dynamic_call_add(stl->g_data->camera_focus, (is_active ? col_hi : col), &cam->drawsize, cam->drwfocusmat);
|
||||
DRW_shgroup_dynamic_call_add(
|
||||
stl->g_data->camera_focus, (is_active ? col_hi : col),
|
||||
&cam->drawsize, cam->drwfocusmat);
|
||||
|
||||
DRW_shgroup_dynamic_call_add(stl->g_data->camera_clip, color, &cam->clipsta, &cam->clipend, cam->drwnormalmat);
|
||||
DRW_shgroup_dynamic_call_add(stl->g_data->camera_clip_points, (is_active ? col_hi : col), &cam->clipsta, &cam->clipend, cam->drwnormalmat);
|
||||
DRW_shgroup_dynamic_call_add(
|
||||
stl->g_data->camera_clip, color,
|
||||
&cam->clipsta, &cam->clipend, cam->drwnormalmat);
|
||||
DRW_shgroup_dynamic_call_add(
|
||||
stl->g_data->camera_clip_points, (is_active ? col_hi : col),
|
||||
&cam->clipsta, &cam->clipend, cam->drwnormalmat);
|
||||
}
|
||||
|
||||
if (cam->flag & CAM_SHOWMIST) {
|
||||
|
@ -971,8 +986,12 @@ static void DRW_shgroup_camera(OBJECT_StorageList *stl, Object *ob, SceneLayer *
|
|||
if (world) {
|
||||
static float col[3] = {0.5f, 0.5f, 0.5f}, col_hi[3] = {1.0f, 1.0f, 1.0f};
|
||||
world->mistend = world->miststa + world->mistdist;
|
||||
DRW_shgroup_dynamic_call_add(stl->g_data->camera_mist, color, &world->miststa, &world->mistend, cam->drwnormalmat);
|
||||
DRW_shgroup_dynamic_call_add(stl->g_data->camera_mist_points, (is_active ? col_hi : col), &world->miststa, &world->mistend, cam->drwnormalmat);
|
||||
DRW_shgroup_dynamic_call_add(
|
||||
stl->g_data->camera_mist, color,
|
||||
&world->miststa, &world->mistend, cam->drwnormalmat);
|
||||
DRW_shgroup_dynamic_call_add(
|
||||
stl->g_data->camera_mist_points, (is_active ? col_hi : col),
|
||||
&world->miststa, &world->mistend, cam->drwnormalmat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1350,7 +1350,7 @@ void GPU_fx_compositor_init_ssao_settings(GPUSSAOSettings *fx_ssao)
|
|||
fx_ssao->samples = 20;
|
||||
}
|
||||
|
||||
void GPU_fx_shader_init_interface(struct GPUShader *shader, GPUFXShaderEffect effect)
|
||||
void GPU_fx_shader_init_interface(GPUShader *shader, GPUFXShaderEffect effect)
|
||||
{
|
||||
if (!shader)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue