Blender
V2.93
source
blender
draw
engines
workbench
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
32
void
workbench_outline_cache_init
(
WORKBENCH_Data
*
data
)
33
{
34
WORKBENCH_PassList
*psl =
data
->psl;
35
WORKBENCH_PrivateData
*wpd =
data
->stl->wpd;
36
DefaultTextureList
*dtxl =
DRW_viewport_texture_list_get
();
37
struct
GPUShader
*sh;
38
DRWShadingGroup
*grp;
39
40
if
(
OBJECT_OUTLINE_ENABLED
(wpd)) {
41
int
state
=
DRW_STATE_WRITE_COLOR
|
DRW_STATE_BLEND_ALPHA_PREMUL
;
42
DRW_PASS_CREATE
(psl->
outline_ps
,
state
);
43
44
sh =
workbench_shader_outline_get
();
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
);
50
DRW_shgroup_call_procedural_triangles
(grp,
NULL
, 1);
51
}
52
else
{
53
psl->
outline_ps
=
NULL
;
54
}
55
}
DRW_render.h
DRW_STATE_WRITE_COLOR
@ DRW_STATE_WRITE_COLOR
Definition:
DRW_render.h:315
DRW_STATE_BLEND_ALPHA_PREMUL
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition:
DRW_render.h:342
DRW_PASS_CREATE
#define DRW_PASS_CREATE(pass, state)
Definition:
DRW_render.h:593
GPUShader
struct GPUShader GPUShader
Definition:
GPU_shader.h:33
NULL
return NULL
Definition:
bmesh_operator_api_inline.h:224
data
data
Definition:
bmesh_operator_api_inline.h:176
DRW_viewport_texture_list_get
DefaultTextureList * DRW_viewport_texture_list_get(void)
Definition:
draw_manager.c:702
DRW_shgroup_uniform_block
void DRW_shgroup_uniform_block(DRWShadingGroup *shgroup, const char *name, const GPUUniformBuf *ubo)
Definition:
draw_manager_data.c:285
DRW_shgroup_uniform_texture
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
Definition:
draw_manager_data.c:251
DRW_shgroup_call_procedural_triangles
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *shgroup, Object *ob, uint tri_count)
Definition:
draw_manager_data.c:844
DRW_shgroup_create
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
Definition:
draw_manager_data.c:1383
state
static ulong state[N]
Definition:
mathutils_noise.c:96
DRWShadingGroup
Definition:
draw_manager.h:333
DefaultTextureList
Definition:
DRW_engine_types.h:40
DefaultTextureList::depth
struct GPUTexture * depth
Definition:
DRW_engine_types.h:45
WORKBENCH_Data
Definition:
workbench_private.h:173
WORKBENCH_PassList
Definition:
workbench_private.h:134
WORKBENCH_PassList::outline_ps
struct DRWPass * outline_ps
Definition:
workbench_private.h:150
WORKBENCH_PrivateData
Definition:
workbench_private.h:239
WORKBENCH_PrivateData::world_ubo
struct GPUUniformBuf * world_ubo
Definition:
workbench_private.h:257
WORKBENCH_PrivateData::object_id_tx
struct GPUTexture * object_id_tx
Definition:
workbench_private.h:320
workbench_outline_cache_init
void workbench_outline_cache_init(WORKBENCH_Data *data)
Definition:
workbench_effect_outline.c:32
workbench_engine.h
workbench_private.h
OBJECT_OUTLINE_ENABLED
#define OBJECT_OUTLINE_ENABLED(wpd)
Definition:
workbench_private.h:69
workbench_shader_outline_get
GPUShader * workbench_shader_outline_get(void)
Definition:
workbench_shader.c:363
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1