Blender  V2.93
workbench_effect_outline.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2020, Blender Foundation.
17  */
18 
27 #include "DRW_render.h"
28 
29 #include "workbench_engine.h"
30 #include "workbench_private.h"
31 
33 {
34  WORKBENCH_PassList *psl = data->psl;
35  WORKBENCH_PrivateData *wpd = data->stl->wpd;
37  struct GPUShader *sh;
38  DRWShadingGroup *grp;
39 
40  if (OBJECT_OUTLINE_ENABLED(wpd)) {
43 
45 
46  grp = DRW_shgroup_create(sh, psl->outline_ps);
47  DRW_shgroup_uniform_texture(grp, "objectIdBuffer", wpd->object_id_tx);
48  DRW_shgroup_uniform_texture(grp, "depthBuffer", dtxl->depth);
49  DRW_shgroup_uniform_block(grp, "world_block", wpd->world_ubo);
51  }
52  else {
53  psl->outline_ps = NULL;
54  }
55 }
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:315
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition: DRW_render.h:342
#define DRW_PASS_CREATE(pass, state)
Definition: DRW_render.h:593
struct GPUShader GPUShader
Definition: GPU_shader.h:33
DefaultTextureList * DRW_viewport_texture_list_get(void)
Definition: draw_manager.c:702
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup, const char *name, const GPUUniformBuf *ubo)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *shgroup, Object *ob, uint tri_count)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
static ulong state[N]
struct GPUTexture * depth
struct DRWPass * outline_ps
struct GPUUniformBuf * world_ubo
struct GPUTexture * object_id_tx
void workbench_outline_cache_init(WORKBENCH_Data *data)
#define OBJECT_OUTLINE_ENABLED(wpd)
GPUShader * workbench_shader_outline_get(void)